diff --git a/db/instaldeco.sql b/db/instaldeco.sql new file mode 100644 index 0000000..c420c5a --- /dev/null +++ b/db/instaldeco.sql @@ -0,0 +1,514 @@ +-- phpMyAdmin SQL Dump +-- version 3.3.9 +-- http://www.phpmyadmin.net +-- +-- Servidor: localhost +-- Tiempo de generación: 23-09-2011 a las 17:13:52 +-- Versión del servidor: 5.1.53 +-- Versión de PHP: 5.3.4 + +SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; + + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; + +-- +-- Base de datos: `instaldeco` +-- + +-- -------------------------------------------------------- + +-- +-- Estructura de tabla para la tabla `wp_commentmeta` +-- + +CREATE TABLE IF NOT EXISTS `wp_commentmeta` ( + `meta_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `comment_id` bigint(20) unsigned NOT NULL DEFAULT '0', + `meta_key` varchar(255) DEFAULT NULL, + `meta_value` longtext, + PRIMARY KEY (`meta_id`), + KEY `comment_id` (`comment_id`), + KEY `meta_key` (`meta_key`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; + +-- +-- Volcar la base de datos para la tabla `wp_commentmeta` +-- + + +-- -------------------------------------------------------- + +-- +-- Estructura de tabla para la tabla `wp_comments` +-- + +CREATE TABLE IF NOT EXISTS `wp_comments` ( + `comment_ID` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `comment_post_ID` bigint(20) unsigned NOT NULL DEFAULT '0', + `comment_author` tinytext NOT NULL, + `comment_author_email` varchar(100) NOT NULL DEFAULT '', + `comment_author_url` varchar(200) NOT NULL DEFAULT '', + `comment_author_IP` varchar(100) NOT NULL DEFAULT '', + `comment_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `comment_date_gmt` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `comment_content` text NOT NULL, + `comment_karma` int(11) NOT NULL DEFAULT '0', + `comment_approved` varchar(20) NOT NULL DEFAULT '1', + `comment_agent` varchar(255) NOT NULL DEFAULT '', + `comment_type` varchar(20) NOT NULL DEFAULT '', + `comment_parent` bigint(20) unsigned NOT NULL DEFAULT '0', + `user_id` bigint(20) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`comment_ID`), + KEY `comment_approved` (`comment_approved`), + KEY `comment_post_ID` (`comment_post_ID`), + KEY `comment_approved_date_gmt` (`comment_approved`,`comment_date_gmt`), + KEY `comment_date_gmt` (`comment_date_gmt`), + KEY `comment_parent` (`comment_parent`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ; + +-- +-- Volcar la base de datos para la tabla `wp_comments` +-- + +INSERT INTO `wp_comments` (`comment_ID`, `comment_post_ID`, `comment_author`, `comment_author_email`, `comment_author_url`, `comment_author_IP`, `comment_date`, `comment_date_gmt`, `comment_content`, `comment_karma`, `comment_approved`, `comment_agent`, `comment_type`, `comment_parent`, `user_id`) VALUES +(1, 1, 'Sr WordPress', '', 'http://wordpress.org/', '', '2011-09-23 17:04:51', '2011-09-23 17:04:51', 'Hola, esto es un comentario.
Para borrar un comentario sólo tienes que entrar y ver los comentarios de la entrada. Entonces tendrás la opción de editar o borrar.', 0, '1', '', '', 0, 0); + +-- -------------------------------------------------------- + +-- +-- Estructura de tabla para la tabla `wp_links` +-- + +CREATE TABLE IF NOT EXISTS `wp_links` ( + `link_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `link_url` varchar(255) NOT NULL DEFAULT '', + `link_name` varchar(255) NOT NULL DEFAULT '', + `link_image` varchar(255) NOT NULL DEFAULT '', + `link_target` varchar(25) NOT NULL DEFAULT '', + `link_description` varchar(255) NOT NULL DEFAULT '', + `link_visible` varchar(20) NOT NULL DEFAULT 'Y', + `link_owner` bigint(20) unsigned NOT NULL DEFAULT '1', + `link_rating` int(11) NOT NULL DEFAULT '0', + `link_updated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `link_rel` varchar(255) NOT NULL DEFAULT '', + `link_notes` mediumtext NOT NULL, + `link_rss` varchar(255) NOT NULL DEFAULT '', + PRIMARY KEY (`link_id`), + KEY `link_visible` (`link_visible`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=8 ; + +-- +-- Volcar la base de datos para la tabla `wp_links` +-- + +INSERT INTO `wp_links` (`link_id`, `link_url`, `link_name`, `link_image`, `link_target`, `link_description`, `link_visible`, `link_owner`, `link_rating`, `link_updated`, `link_rel`, `link_notes`, `link_rss`) VALUES +(1, 'http://codex.wordpress.org/', 'Documentation', '', '', '', 'Y', 1, 0, '0000-00-00 00:00:00', '', '', ''), +(2, 'http://wordpress.org/news/', 'WordPress Blog', '', '', '', 'Y', 1, 0, '0000-00-00 00:00:00', '', '', 'http://wordpress.org/news/feed/'), +(3, 'http://wordpress.org/extend/ideas/', 'Suggest Ideas', '', '', '', 'Y', 1, 0, '0000-00-00 00:00:00', '', '', ''), +(4, 'http://wordpress.org/support/', 'Support Forum', '', '', '', 'Y', 1, 0, '0000-00-00 00:00:00', '', '', ''), +(5, 'http://wordpress.org/extend/plugins/', 'Plugins', '', '', '', 'Y', 1, 0, '0000-00-00 00:00:00', '', '', ''), +(6, 'http://wordpress.org/extend/themes/', 'Themes', '', '', '', 'Y', 1, 0, '0000-00-00 00:00:00', '', '', ''), +(7, 'http://planet.wordpress.org/', 'WordPress Planet', '', '', '', 'Y', 1, 0, '0000-00-00 00:00:00', '', '', ''); + +-- -------------------------------------------------------- + +-- +-- Estructura de tabla para la tabla `wp_options` +-- + +CREATE TABLE IF NOT EXISTS `wp_options` ( + `option_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `blog_id` int(11) NOT NULL DEFAULT '0', + `option_name` varchar(64) NOT NULL DEFAULT '', + `option_value` longtext NOT NULL, + `autoload` varchar(20) NOT NULL DEFAULT 'yes', + PRIMARY KEY (`option_id`), + UNIQUE KEY `option_name` (`option_name`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=160 ; + +-- +-- Volcar la base de datos para la tabla `wp_options` +-- + +INSERT INTO `wp_options` (`option_id`, `blog_id`, `option_name`, `option_value`, `autoload`) VALUES +(1, 0, 'siteurl', 'http://localhost/instaldeco', 'yes'), +(2, 0, 'blogname', 'Instaldeco', 'yes'), +(3, 0, 'blogdescription', 'Otro sitio realizado con WordPress', 'yes'), +(4, 0, 'users_can_register', '0', 'yes'), +(5, 0, 'admin_email', 'darranz@rodax-software.com', 'yes'), +(6, 0, 'start_of_week', '1', 'yes'), +(7, 0, 'use_balanceTags', '0', 'yes'), +(8, 0, 'use_smilies', '1', 'yes'), +(9, 0, 'require_name_email', '1', 'yes'), +(10, 0, 'comments_notify', '1', 'yes'), +(11, 0, 'posts_per_rss', '10', 'yes'), +(12, 0, 'rss_use_excerpt', '0', 'yes'), +(13, 0, 'mailserver_url', 'mail.example.com', 'yes'), +(14, 0, 'mailserver_login', 'login@example.com', 'yes'), +(15, 0, 'mailserver_pass', 'password', 'yes'), +(16, 0, 'mailserver_port', '110', 'yes'), +(17, 0, 'default_category', '1', 'yes'), +(18, 0, 'default_comment_status', 'open', 'yes'), +(19, 0, 'default_ping_status', 'open', 'yes'), +(20, 0, 'default_pingback_flag', '1', 'yes'), +(21, 0, 'default_post_edit_rows', '20', 'yes'), +(22, 0, 'posts_per_page', '10', 'yes'), +(23, 0, 'date_format', 'j F, Y', 'yes'), +(24, 0, 'time_format', 'G:i', 'yes'), +(25, 0, 'links_updated_date_format', 'j F, Y G:i', 'yes'), +(26, 0, 'links_recently_updated_prepend', '', 'yes'), +(27, 0, 'links_recently_updated_append', '', 'yes'), +(28, 0, 'links_recently_updated_time', '120', 'yes'), +(29, 0, 'comment_moderation', '0', 'yes'), +(30, 0, 'moderation_notify', '1', 'yes'), +(31, 0, 'permalink_structure', '', 'yes'), +(32, 0, 'gzipcompression', '0', 'yes'), +(33, 0, 'hack_file', '0', 'yes'), +(34, 0, 'blog_charset', 'UTF-8', 'yes'), +(35, 0, 'moderation_keys', '', 'no'), +(36, 0, 'active_plugins', 'a:0:{}', 'yes'), +(37, 0, 'home', 'http://localhost/instaldeco', 'yes'), +(38, 0, 'category_base', '', 'yes'), +(39, 0, 'ping_sites', 'http://rpc.pingomatic.com/', 'yes'), +(40, 0, 'advanced_edit', '0', 'yes'), +(41, 0, 'comment_max_links', '2', 'yes'), +(42, 0, 'gmt_offset', '0', 'yes'), +(43, 0, 'default_email_category', '1', 'yes'), +(44, 0, 'recently_edited', '', 'no'), +(45, 0, 'template', 'Broadside', 'yes'), +(46, 0, 'stylesheet', 'Broadside', 'yes'), +(47, 0, 'comment_whitelist', '1', 'yes'), +(48, 0, 'blacklist_keys', '', 'no'), +(49, 0, 'comment_registration', '0', 'yes'), +(50, 0, 'rss_language', 'en', 'yes'), +(51, 0, 'html_type', 'text/html', 'yes'), +(52, 0, 'use_trackback', '0', 'yes'), +(53, 0, 'default_role', 'subscriber', 'yes'), +(54, 0, 'db_version', '18226', 'yes'), +(55, 0, 'uploads_use_yearmonth_folders', '1', 'yes'), +(56, 0, 'upload_path', '', 'yes'), +(57, 0, 'blog_public', '1', 'yes'), +(58, 0, 'default_link_category', '2', 'yes'), +(59, 0, 'show_on_front', 'posts', 'yes'), +(60, 0, 'tag_base', '', 'yes'), +(61, 0, 'show_avatars', '1', 'yes'), +(62, 0, 'avatar_rating', 'G', 'yes'), +(63, 0, 'upload_url_path', '', 'yes'), +(64, 0, 'thumbnail_size_w', '150', 'yes'), +(65, 0, 'thumbnail_size_h', '150', 'yes'), +(66, 0, 'thumbnail_crop', '1', 'yes'), +(67, 0, 'medium_size_w', '300', 'yes'), +(68, 0, 'medium_size_h', '300', 'yes'), +(69, 0, 'avatar_default', 'mystery', 'yes'), +(70, 0, 'enable_app', '0', 'yes'), +(71, 0, 'enable_xmlrpc', '0', 'yes'), +(72, 0, 'large_size_w', '1024', 'yes'), +(73, 0, 'large_size_h', '1024', 'yes'), +(74, 0, 'image_default_link_type', 'file', 'yes'), +(75, 0, 'image_default_size', '', 'yes'), +(76, 0, 'image_default_align', '', 'yes'), +(77, 0, 'close_comments_for_old_posts', '0', 'yes'), +(78, 0, 'close_comments_days_old', '14', 'yes'), +(79, 0, 'thread_comments', '1', 'yes'), +(80, 0, 'thread_comments_depth', '5', 'yes'), +(81, 0, 'page_comments', '0', 'yes'), +(82, 0, 'comments_per_page', '50', 'yes'), +(83, 0, 'default_comments_page', 'newest', 'yes'), +(84, 0, 'comment_order', 'asc', 'yes'), +(85, 0, 'sticky_posts', 'a:0:{}', 'yes'), +(86, 0, 'widget_categories', 'a:2:{i:2;a:4:{s:5:"title";s:0:"";s:5:"count";i:0;s:12:"hierarchical";i:0;s:8:"dropdown";i:0;}s:12:"_multiwidget";i:1;}', 'yes'), +(87, 0, 'widget_text', 'a:2:{i:2;a:0:{}s:12:"_multiwidget";i:1;}', 'yes'), +(88, 0, 'widget_rss', 'a:2:{i:2;a:0:{}s:12:"_multiwidget";i:1;}', 'yes'), +(89, 0, 'timezone_string', '', 'yes'), +(90, 0, 'embed_autourls', '1', 'yes'), +(91, 0, 'embed_size_w', '', 'yes'), +(92, 0, 'embed_size_h', '600', 'yes'), +(93, 0, 'page_for_posts', '0', 'yes'), +(94, 0, 'page_on_front', '0', 'yes'), +(95, 0, 'default_post_format', '0', 'yes'), +(96, 0, 'wp_user_roles', 'a:5:{s:13:"administrator";a:2:{s:4:"name";s:13:"Administrator";s:12:"capabilities";a:62:{s:13:"switch_themes";b:1;s:11:"edit_themes";b:1;s:16:"activate_plugins";b:1;s:12:"edit_plugins";b:1;s:10:"edit_users";b:1;s:10:"edit_files";b:1;s:14:"manage_options";b:1;s:17:"moderate_comments";b:1;s:17:"manage_categories";b:1;s:12:"manage_links";b:1;s:12:"upload_files";b:1;s:6:"import";b:1;s:15:"unfiltered_html";b:1;s:10:"edit_posts";b:1;s:17:"edit_others_posts";b:1;s:20:"edit_published_posts";b:1;s:13:"publish_posts";b:1;s:10:"edit_pages";b:1;s:4:"read";b:1;s:8:"level_10";b:1;s:7:"level_9";b:1;s:7:"level_8";b:1;s:7:"level_7";b:1;s:7:"level_6";b:1;s:7:"level_5";b:1;s:7:"level_4";b:1;s:7:"level_3";b:1;s:7:"level_2";b:1;s:7:"level_1";b:1;s:7:"level_0";b:1;s:17:"edit_others_pages";b:1;s:20:"edit_published_pages";b:1;s:13:"publish_pages";b:1;s:12:"delete_pages";b:1;s:19:"delete_others_pages";b:1;s:22:"delete_published_pages";b:1;s:12:"delete_posts";b:1;s:19:"delete_others_posts";b:1;s:22:"delete_published_posts";b:1;s:20:"delete_private_posts";b:1;s:18:"edit_private_posts";b:1;s:18:"read_private_posts";b:1;s:20:"delete_private_pages";b:1;s:18:"edit_private_pages";b:1;s:18:"read_private_pages";b:1;s:12:"delete_users";b:1;s:12:"create_users";b:1;s:17:"unfiltered_upload";b:1;s:14:"edit_dashboard";b:1;s:14:"update_plugins";b:1;s:14:"delete_plugins";b:1;s:15:"install_plugins";b:1;s:13:"update_themes";b:1;s:14:"install_themes";b:1;s:11:"update_core";b:1;s:10:"list_users";b:1;s:12:"remove_users";b:1;s:9:"add_users";b:1;s:13:"promote_users";b:1;s:18:"edit_theme_options";b:1;s:13:"delete_themes";b:1;s:6:"export";b:1;}}s:6:"editor";a:2:{s:4:"name";s:6:"Editor";s:12:"capabilities";a:34:{s:17:"moderate_comments";b:1;s:17:"manage_categories";b:1;s:12:"manage_links";b:1;s:12:"upload_files";b:1;s:15:"unfiltered_html";b:1;s:10:"edit_posts";b:1;s:17:"edit_others_posts";b:1;s:20:"edit_published_posts";b:1;s:13:"publish_posts";b:1;s:10:"edit_pages";b:1;s:4:"read";b:1;s:7:"level_7";b:1;s:7:"level_6";b:1;s:7:"level_5";b:1;s:7:"level_4";b:1;s:7:"level_3";b:1;s:7:"level_2";b:1;s:7:"level_1";b:1;s:7:"level_0";b:1;s:17:"edit_others_pages";b:1;s:20:"edit_published_pages";b:1;s:13:"publish_pages";b:1;s:12:"delete_pages";b:1;s:19:"delete_others_pages";b:1;s:22:"delete_published_pages";b:1;s:12:"delete_posts";b:1;s:19:"delete_others_posts";b:1;s:22:"delete_published_posts";b:1;s:20:"delete_private_posts";b:1;s:18:"edit_private_posts";b:1;s:18:"read_private_posts";b:1;s:20:"delete_private_pages";b:1;s:18:"edit_private_pages";b:1;s:18:"read_private_pages";b:1;}}s:6:"author";a:2:{s:4:"name";s:6:"Author";s:12:"capabilities";a:10:{s:12:"upload_files";b:1;s:10:"edit_posts";b:1;s:20:"edit_published_posts";b:1;s:13:"publish_posts";b:1;s:4:"read";b:1;s:7:"level_2";b:1;s:7:"level_1";b:1;s:7:"level_0";b:1;s:12:"delete_posts";b:1;s:22:"delete_published_posts";b:1;}}s:11:"contributor";a:2:{s:4:"name";s:11:"Contributor";s:12:"capabilities";a:5:{s:10:"edit_posts";b:1;s:4:"read";b:1;s:7:"level_1";b:1;s:7:"level_0";b:1;s:12:"delete_posts";b:1;}}s:10:"subscriber";a:2:{s:4:"name";s:10:"Subscriber";s:12:"capabilities";a:2:{s:4:"read";b:1;s:7:"level_0";b:1;}}}', 'yes'), +(97, 0, 'widget_search', 'a:2:{i:2;a:1:{s:5:"title";s:0:"";}s:12:"_multiwidget";i:1;}', 'yes'), +(98, 0, 'widget_recent-posts', 'a:2:{i:2;a:2:{s:5:"title";s:0:"";s:6:"number";i:5;}s:12:"_multiwidget";i:1;}', 'yes'), +(99, 0, 'widget_recent-comments', 'a:2:{i:2;a:2:{s:5:"title";s:0:"";s:6:"number";i:5;}s:12:"_multiwidget";i:1;}', 'yes'), +(100, 0, 'widget_archives', 'a:2:{i:2;a:3:{s:5:"title";s:0:"";s:5:"count";i:0;s:8:"dropdown";i:0;}s:12:"_multiwidget";i:1;}', 'yes'), +(101, 0, 'widget_meta', 'a:2:{i:2;a:1:{s:5:"title";s:0:"";}s:12:"_multiwidget";i:1;}', 'yes'), +(102, 0, 'sidebars_widgets', 'a:8:{s:19:"wp_inactive_widgets";a:0:{}s:19:"primary-widget-area";a:6:{i:0;s:8:"search-2";i:1;s:14:"recent-posts-2";i:2;s:17:"recent-comments-2";i:3;s:10:"archives-2";i:4;s:12:"categories-2";i:5;s:6:"meta-2";}s:21:"secondary-widget-area";a:0:{}s:24:"first-footer-widget-area";a:0:{}s:25:"second-footer-widget-area";a:0:{}s:24:"third-footer-widget-area";a:0:{}s:25:"fourth-footer-widget-area";a:0:{}s:13:"array_version";i:3;}', 'yes'), +(103, 0, 'cron', 'a:3:{i:1316840695;a:3:{s:16:"wp_version_check";a:1:{s:32:"40cd750bba9870f18aada2478b24840a";a:3:{s:8:"schedule";s:10:"twicedaily";s:4:"args";a:0:{}s:8:"interval";i:43200;}}s:17:"wp_update_plugins";a:1:{s:32:"40cd750bba9870f18aada2478b24840a";a:3:{s:8:"schedule";s:10:"twicedaily";s:4:"args";a:0:{}s:8:"interval";i:43200;}}s:16:"wp_update_themes";a:1:{s:32:"40cd750bba9870f18aada2478b24840a";a:3:{s:8:"schedule";s:10:"twicedaily";s:4:"args";a:0:{}s:8:"interval";i:43200;}}}i:1316883906;a:1:{s:19:"wp_scheduled_delete";a:1:{s:32:"40cd750bba9870f18aada2478b24840a";a:3:{s:8:"schedule";s:5:"daily";s:4:"args";a:0:{}s:8:"interval";i:86400;}}}s:7:"version";i:2;}', 'yes'), +(104, 0, '_transient_doing_cron', '1316797649', 'yes'), +(116, 0, '_site_transient_timeout_browser_4f512b96d61e54437d052ed0b03eb8c5', '1317402305', 'yes'), +(105, 0, '_site_transient_update_core', 'O:8:"stdClass":3:{s:7:"updates";a:2:{i:0;O:8:"stdClass":9:{s:8:"response";s:6:"latest";s:8:"download";s:49:"http://es.wordpress.org/wordpress-3.2.1-es_ES.zip";s:6:"locale";s:5:"es_ES";s:8:"packages";O:8:"stdClass":4:{s:4:"full";s:49:"http://es.wordpress.org/wordpress-3.2.1-es_ES.zip";s:10:"no_content";b:0;s:11:"new_bundled";b:0;s:7:"partial";b:0;}s:7:"current";s:5:"3.2.1";s:11:"php_version";s:5:"5.2.4";s:13:"mysql_version";s:3:"5.0";s:11:"new_bundled";s:3:"3.2";s:15:"partial_version";s:0:"";}i:1;O:8:"stdClass":9:{s:8:"response";s:6:"latest";s:8:"download";s:40:"http://wordpress.org/wordpress-3.2.1.zip";s:6:"locale";s:5:"en_US";s:8:"packages";O:8:"stdClass":4:{s:4:"full";s:40:"http://wordpress.org/wordpress-3.2.1.zip";s:10:"no_content";s:51:"http://wordpress.org/wordpress-3.2.1-no-content.zip";s:11:"new_bundled";s:52:"http://wordpress.org/wordpress-3.2.1-new-bundled.zip";s:7:"partial";b:0;}s:7:"current";s:5:"3.2.1";s:11:"php_version";s:5:"5.2.4";s:13:"mysql_version";s:3:"5.0";s:11:"new_bundled";s:3:"3.2";s:15:"partial_version";s:0:"";}}s:12:"last_checked";i:1316797656;s:15:"version_checked";s:5:"3.2.1";}', 'yes'), +(106, 0, '_site_transient_update_plugins', 'O:8:"stdClass":3:{s:12:"last_checked";i:1316797503;s:7:"checked";a:2:{s:19:"akismet/akismet.php";s:5:"2.5.3";s:9:"hello.php";s:3:"1.6";}s:8:"response";a:0:{}}', 'yes'), +(107, 0, 'widget_pages', 'a:2:{i:2;a:0:{}s:12:"_multiwidget";i:1;}', 'yes'), +(108, 0, 'widget_calendar', 'a:2:{i:2;a:0:{}s:12:"_multiwidget";i:1;}', 'yes'), +(109, 0, 'widget_links', 'a:2:{i:2;a:0:{}s:12:"_multiwidget";i:1;}', 'yes'), +(110, 0, 'widget_tag_cloud', 'a:2:{i:2;a:0:{}s:12:"_multiwidget";i:1;}', 'yes'), +(111, 0, 'widget_nav_menu', 'a:2:{i:2;a:0:{}s:12:"_multiwidget";i:1;}', 'yes'), +(112, 0, 'widget_widget_twentyeleven_ephemera', 'a:2:{i:2;a:0:{}s:12:"_multiwidget";i:1;}', 'yes'), +(113, 0, '_site_transient_timeout_theme_roots', '1316804703', 'yes'), +(114, 0, '_site_transient_theme_roots', 'a:3:{s:9:"Broadside";s:7:"/themes";s:12:"twentyeleven";s:7:"/themes";s:9:"twentyten";s:7:"/themes";}', 'yes'), +(115, 0, '_site_transient_update_themes', 'O:8:"stdClass":3:{s:12:"last_checked";i:1316797505;s:7:"checked";a:3:{s:9:"Broadside";s:3:"1.0";s:12:"twentyeleven";s:3:"1.2";s:9:"twentyten";s:3:"1.2";}s:8:"response";a:0:{}}', 'yes'), +(117, 0, '_site_transient_browser_4f512b96d61e54437d052ed0b03eb8c5', 'a:9:{s:8:"platform";s:7:"Windows";s:4:"name";s:7:"Firefox";s:7:"version";s:5:"6.0.2";s:10:"update_url";s:23:"http://www.firefox.com/";s:7:"img_src";s:50:"http://s.wordpress.org/images/browsers/firefox.png";s:11:"img_src_ssl";s:49:"https://wordpress.org/images/browsers/firefox.png";s:15:"current_version";s:1:"6";s:7:"upgrade";b:0;s:8:"insecure";b:0;}', 'yes'), +(118, 0, 'dashboard_widget_options', 'a:4:{s:25:"dashboard_recent_comments";a:1:{s:5:"items";i:5;}s:24:"dashboard_incoming_links";a:5:{s:4:"home";s:27:"http://localhost/instaldeco";s:4:"link";s:103:"http://blogsearch.google.com/blogsearch?scoring=d&partner=wordpress&q=link:http://localhost/instaldeco/";s:3:"url";s:136:"http://blogsearch.google.com/blogsearch_feeds?scoring=d&ie=utf-8&num=10&output=rss&partner=wordpress&q=link:http://localhost/instaldeco/";s:5:"items";i:10;s:9:"show_date";b:0;}s:17:"dashboard_primary";a:7:{s:4:"link";s:26:"http://wordpress.org/news/";s:3:"url";s:31:"http://wordpress.org/news/feed/";s:5:"title";s:22:"Blog oficial WordPress";s:5:"items";i:2;s:12:"show_summary";i:1;s:11:"show_author";i:0;s:9:"show_date";i:1;}s:19:"dashboard_secondary";a:7:{s:4:"link";s:28:"http://planet.wordpress.org/";s:3:"url";s:33:"http://planet.wordpress.org/feed/";s:5:"title";s:30:"Otras noticias sobre WordPress";s:5:"items";i:5;s:12:"show_summary";i:0;s:11:"show_author";i:0;s:9:"show_date";i:0;}}', 'yes'), +(157, 0, 'current_theme', 'Broadside', 'yes'), +(120, 0, 'can_compress_scripts', '1', 'yes'), +(121, 0, '_transient_timeout_feed_d54818a85854ebcb9b5357c7d7c038bf', '1316840707', 'no'), +(122, 0, '_transient_feed_d54818a85854ebcb9b5357c7d7c038bf', 'a:4:{s:5:"child";a:1:{s:0:"";a:1:{s:3:"rss";a:1:{i:0;a:6:{s:4:"data";s:4:"\n \n";s:7:"attribs";a:1:{s:0:"";a:1:{s:7:"version";s:3:"2.0";}}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:1:{s:0:"";a:1:{s:7:"channel";a:1:{i:0;a:6:{s:4:"data";s:33:"\n \n \n \n \n \n \n ";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:2:{s:0:"";a:3:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:54:"link:http://localhost/instaldeco/ - Google Blog Search";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:91:"http://www.google.com/search?ie=utf-8&q=link:http://localhost/instaldeco/&tbm=blg&tbs=sbd:1";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:87:"Your search - link:http://localhost/instaldeco/ - did not match any documents. ";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:36:"http://a9.com/-/spec/opensearch/1.1/";a:3:{s:12:"totalResults";a:1:{i:0;a:5:{s:4:"data";s:1:"0";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:10:"startIndex";a:1:{i:0;a:5:{s:4:"data";s:1:"1";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:12:"itemsPerPage";a:1:{i:0;a:5:{s:4:"data";s:2:"10";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}}}}}}}}s:4:"type";i:128;s:7:"headers";a:7:{s:12:"content-type";s:28:"text/xml; charset=ISO-8859-1";s:4:"date";s:29:"Fri, 23 Sep 2011 17:05:11 GMT";s:7:"expires";s:2:"-1";s:13:"cache-control";s:18:"private, max-age=0";s:10:"set-cookie";a:2:{i:0;s:143:"PREF=ID=87a31538b20a40a2:FF=0:TM=1316797511:LM=1316797511:S=JgZ9fHYWPUzTah0u; expires=Sun, 22-Sep-2013 17:05:11 GMT; path=/; domain=.google.com";i:1;s:212:"NID=51=MImeqNX-cUSLFsY8wtS-gW19OltvZpAPzu7nCxesWsOUpd9eTejP4M-CfBq2sw1BmNIJTpOyR62cWld10ZWlZfhG5gKVrq5y57MrjsrPG0uZRgSIsxNZqYrkd8T1Fcgi; expires=Sat, 24-Mar-2012 17:05:11 GMT; path=/; domain=.google.com; HttpOnly";}s:6:"server";s:3:"gws";s:16:"x-xss-protection";s:13:"1; mode=block";}s:5:"build";s:14:"20090627192103";}', 'no'), +(123, 0, '_transient_timeout_feed_mod_d54818a85854ebcb9b5357c7d7c038bf', '1316840707', 'no'), +(124, 0, '_transient_feed_mod_d54818a85854ebcb9b5357c7d7c038bf', '1316797507', 'no'), +(125, 0, '_transient_timeout_dash_20494a3d90a6669585674ed0eb8dcd8f', '1316840707', 'no'), +(126, 0, '_transient_dash_20494a3d90a6669585674ed0eb8dcd8f', '

Este widget de escritorio consulta a la Búsqueda de blogs de Google de modo que cuando otro blog enlace a su sitio se mostrará aquí. No se ha encontrado ningún enlace entrante… aún. Está bien, no hay prisa.

\n', 'no'), +(127, 0, '_transient_timeout_feed_ac0b00fe65abe10e0c5b588f3ed8c7ca', '1316840708', 'no'); +INSERT INTO `wp_options` (`option_id`, `blog_id`, `option_name`, `option_value`, `autoload`) VALUES +(128, 0, '_transient_feed_ac0b00fe65abe10e0c5b588f3ed8c7ca', 'a:4:{s:5:"child";a:1:{s:0:"";a:1:{s:3:"rss";a:1:{i:0;a:6:{s:4:"data";s:3:"\n\n\n";s:7:"attribs";a:1:{s:0:"";a:1:{s:7:"version";s:3:"2.0";}}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:1:{s:0:"";a:1:{s:7:"channel";a:1:{i:0;a:6:{s:4:"data";s:50:"\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n ";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:3:{s:0:"";a:7:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:14:"WordPress News";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:25:"http://wordpress.org/news";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:14:"WordPress News";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:13:"lastBuildDate";a:1:{i:0;a:5:{s:4:"data";s:31:"Fri, 16 Sep 2011 15:08:48 +0000";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:8:"language";a:1:{i:0;a:5:{s:4:"data";s:2:"en";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:9:"generator";a:1:{i:0;a:5:{s:4:"data";s:45:"http://wordpress.org/?v=3.3-aortic-dissection";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"item";a:10:{i:0;a:6:{s:4:"data";s:56:"\n \n \n \n \n \n \n \n \n \n \n \n\n \n \n \n \n \n ";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:5:{s:0:"";a:7:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:32:"Software Freedom Day + Hackathon";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:65:"http://wordpress.org/news/2011/09/software-freedom-day-hackathon/";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:8:"comments";a:1:{i:0;a:5:{s:4:"data";s:74:"http://wordpress.org/news/2011/09/software-freedom-day-hackathon/#comments";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:7:"pubDate";a:1:{i:0;a:5:{s:4:"data";s:31:"Thu, 15 Sep 2011 07:33:56 +0000";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:8:"category";a:6:{i:0;a:5:{s:4:"data";s:9:"Community";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}i:1;a:5:{s:4:"data";s:11:"Development";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}i:2;a:5:{s:4:"data";s:6:"Events";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}i:3;a:5:{s:4:"data";s:7:"Testing";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}i:4;a:5:{s:4:"data";s:8:"WordCamp";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}i:5;a:5:{s:4:"data";s:7:"bughunt";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"guid";a:1:{i:0;a:5:{s:4:"data";s:33:"http://wordpress.org/news/?p=2058";s:7:"attribs";a:1:{s:0:"";a:1:{s:11:"isPermaLink";s:5:"false";}}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:359:"Saturday, September 17 is Software Freedom Day. To that end, a few announcements about this weekend’s hackathon and WordCamp Portland. 3.3 Hackathon WordPress 3.3 is about to hit feature freeze. This means it’s the last chance to squeeze in features that haven’t quite been finished, and enhancements and fixes that no one has had time [...]";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:32:"http://purl.org/dc/elements/1.1/";a:1:{s:7:"creator";a:1:{i:0;a:5:{s:4:"data";s:10:"Jane Wells";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:40:"http://purl.org/rss/1.0/modules/content/";a:1:{s:7:"encoded";a:1:{i:0;a:5:{s:4:"data";s:3772:"

Saturday, September 17 is Software Freedom Day. To that end, a few announcements about this weekend’s hackathon and WordCamp Portland.

\n

3.3 Hackathon

\n

WordPress 3.3 is about to hit feature freeze. This means it’s the last chance to squeeze in features that haven’t quite been finished, and enhancements and fixes that no one has had time to address yet. Around this time, there are often dozens of tickets that have patches, but the patches have not been tested enough to be committed to core. Then the contributors who worked hard on the patches are disappointed that their code doesn’t make it into the current release. You can help us prevent this!

\n

This weekend, we’ll be running a has-patch needs-testing marathon for the 3.3 milestone. Basically, we’re looking for people who can help test patches and/or refresh patches that need updating. Lead developers and core contributors will be hanging around in the #wordpress-dev channel on irc.freenode.net to answer questions as needed, and will be committing patches as they get enough verification. As you test the patches, report your findings on the trac tickets in question. If all developers who make a living working with WordPress helped out for even an hour or two this weekend, we could clear the 200 tickets or so that are in this situation. To make it fun, why not get together with other WordPress devs and have an in-person hackathon meetup?

\n

WordCamp Portland

\n

At WordCamp Portland this weekend, some of the WordPress core team will be in attendance, including me, Nacin, and Koop. In addition to giving presentations and participating in the unconference sessions, we’ll be involved with a couple of other cool things at WCPDX:

\n\n

So, if you live it the Portland/Seattle area and haven’t already bought a ticket to attend WordCamp Portland, hurry up, as it’s going to be a great celebration of Software Freedom Day and WordPress.

\n";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:36:"http://wellformedweb.org/CommentAPI/";a:1:{s:10:"commentRss";a:1:{i:0;a:5:{s:4:"data";s:70:"http://wordpress.org/news/2011/09/software-freedom-day-hackathon/feed/";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:38:"http://purl.org/rss/1.0/modules/slash/";a:1:{s:8:"comments";a:1:{i:0;a:5:{s:4:"data";s:1:"0";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}i:1;a:6:{s:4:"data";s:47:"\n \n \n \n \n \n \n \n \n\n \n \n \n \n \n ";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:5:{s:0:"";a:7:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:23:"A Tale of Two WordCamps";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:58:"http://wordpress.org/news/2011/09/a-tale-of-two-wordcamps/";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:8:"comments";a:1:{i:0;a:5:{s:4:"data";s:67:"http://wordpress.org/news/2011/09/a-tale-of-two-wordcamps/#comments";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:7:"pubDate";a:1:{i:0;a:5:{s:4:"data";s:31:"Wed, 14 Sep 2011 21:17:08 +0000";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:8:"category";a:3:{i:0;a:5:{s:4:"data";s:9:"Community";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}i:1;a:5:{s:4:"data";s:6:"Events";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}i:2;a:5:{s:4:"data";s:8:"WordCamp";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"guid";a:1:{i:0;a:5:{s:4:"data";s:33:"http://wordpress.org/news/?p=2057";s:7:"attribs";a:1:{s:0:"";a:1:{s:11:"isPermaLink";s:5:"false";}}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:380:"This coming weekend, two WordCamps will be going on simultaneously — yep, it’s WordCamp season again! This weekend will be the first of many this autumn with multiple WordCamps. Tomorrow (not quite the weekend but close enough) is WordCamp Cape Town, and then this weekend, first-time WordCamp Albuquerque coincides with 4-time returning champ WordCamp Portland, [...]";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:32:"http://purl.org/dc/elements/1.1/";a:1:{s:7:"creator";a:1:{i:0;a:5:{s:4:"data";s:10:"Jane Wells";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:40:"http://purl.org/rss/1.0/modules/content/";a:1:{s:7:"encoded";a:1:{i:0;a:5:{s:4:"data";s:3683:"

This coming weekend, two WordCamps will be going on simultaneously — yep, it’s WordCamp season again! This weekend will be the first of many this autumn with multiple WordCamps. Tomorrow (not quite the weekend but close enough) is WordCamp Cape Town, and then this weekend, first-time WordCamp Albuquerque coincides with 4-time returning champ WordCamp Portland, a cool juxtaposition of a more established local community with one that is just getting started. If you’re anywhere near the Portland area, you should try to attend. The WordPress Foundation will be sponsoring some special activities around Software Freedom Day, and some members of the core team (me, Nacin, Koop) will be there.

\n

Is there a WordCamp coming up near you? Let’s find out!

\n

Sep 15: WordCamp Cape Town Cape Town, South Africa

\n

Sep 16-18: WordCamp Albuquerque Albuquerque, NM

\n

Sep 17-18: WordCamp Portland Portland, OR

\n

Sep 24: WordCamp Lisboa Lisboa, Portugal

\n

Sep 24: WordCamp Germany Koln, Germany

\n

Sep 25: WordCamp Sofia Sofia, Bulgaria

\n

Oct 1: WordCamp Louisville Louisville, Kentucky

\n

Oct 8-9: WordCamp Sevilla Seville, Spain

\n
\n

Oct 15-16: WordCamp Jabalpur Jabalpur, India

\n

Nov 5-6: WordCamp Toronto Toronto, ON

\n

Nov 5-6: WordCamp Gold Coast Gold Coast, Australia

\n

Nov 5-6: WordCamp Philly Philadelphia, PA

\n

Nov 12: WordCamp Caguas Caguas, Puerto Rico

\n

Nov 12-13: WordCamp Kenya Nairobi, Kenya

\n

Nov 12-13: WordCamp Detroit Detroit, MI

\n

Nov 12: WordCamp Richmond Richmond, VA

\n

Nov 12-13: WordCamp Denmark Copenhagen, Denmark

\n

Dec 17: WordCamp Las Vegas Las Vegas, NV

\n

Feb 3-4 WordCamp Atlanta Atlanta, GA

\n

There are also a number of WordCamps still in the early organizing stage that do not yet have dates set. These include: Ft. Wayne, IN; London, UK; Edmonton, Canada; Baku, Azerbaijan; Oslo, Norway; Sacramento, CA;  Birmingham, Alabama; Pittsburgh, PA; Omaha, NE; Orlando, FL; Tokyo, Japan; Paris, France; Zagreb, Croatia; Nashville, TN, Washington DC, Baltimore, MD; Bangkok, Thailand; Istanbul, Turkey.

\n

Hope to see you soon at a WordCamp near you!

\n


\n

\n
\n";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:36:"http://wellformedweb.org/CommentAPI/";a:1:{s:10:"commentRss";a:1:{i:0;a:5:{s:4:"data";s:63:"http://wordpress.org/news/2011/09/a-tale-of-two-wordcamps/feed/";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:38:"http://purl.org/rss/1.0/modules/slash/";a:1:{s:8:"comments";a:1:{i:0;a:5:{s:4:"data";s:1:"0";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}i:2;a:6:{s:4:"data";s:47:"\n \n \n \n \n \n \n \n \n\n \n \n \n \n \n ";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:5:{s:0:"";a:7:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:35:"Vote for WordPress Sessions at SXSW";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:58:"http://wordpress.org/news/2011/09/vote-for-wordpress-sxsw/";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:8:"comments";a:1:{i:0;a:5:{s:4:"data";s:67:"http://wordpress.org/news/2011/09/vote-for-wordpress-sxsw/#comments";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:7:"pubDate";a:1:{i:0;a:5:{s:4:"data";s:31:"Fri, 02 Sep 2011 04:45:03 +0000";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:8:"category";a:3:{i:0;a:5:{s:4:"data";s:9:"Community";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}i:1;a:5:{s:4:"data";s:11:"conferences";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}i:2;a:5:{s:4:"data";s:4:"sxsw";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"guid";a:1:{i:0;a:5:{s:4:"data";s:33:"http://wordpress.org/news/?p=2036";s:7:"attribs";a:1:{s:0:"";a:1:{s:11:"isPermaLink";s:5:"false";}}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:302:"Each year, members of the web community from around the world submit session proposals to the South by Southwest Interactive conference, an event that played a role in the birth of WordPress. We head to Austin every year, do a BBQ or throw a party, but despite the fact that almost 15% of the web [...]";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:32:"http://purl.org/dc/elements/1.1/";a:1:{s:7:"creator";a:1:{i:0;a:5:{s:4:"data";s:10:"Jane Wells";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:40:"http://purl.org/rss/1.0/modules/content/";a:1:{s:7:"encoded";a:1:{i:0;a:5:{s:4:"data";s:6289:"

Each year, members of the web community from around the world submit session proposals to the South by Southwest Interactive conference, an event that played a role in the birth of WordPress. We head to Austin every year, do a BBQ or throw a party, but despite the fact that almost 15% of the web is powered by WordPress, there aren’t many sessions related to WordPress on the schedule. This year, more than 3200 proposals are competing for about 350 slots, and who has time to read through, vote, and comment on 3200 proposals? Out of those 3200+ proposals, only 8 relate to WordPress! I thought it would be handy to post a guide to the WordPressy proposals for SXSWi 2012, so that if you would like to check them out and vote on them it woud be fast and easy. Leaving a comment in addition to your thumbs up/down vote helps the staff and advisory board know which sessions are likely to have an interested audience, so make sure to leave comments on the sessions you think would be cool (remember, they also publish the podcasts afterward). Voting ends in about 24 hours, so if you want to weigh in, now’s the time. Thanks for helping spread the word!

\n

WordPress-specific Sessions

\n

This list is based on searching for “WordPress” in proposal titles, descriptions, and tags. Clicking the proposal title will take you to that page in the SXSW PanelPicker, where you can vote and comment. Names that are linked go to those people’s WordPress.org profiles.

\n

Blog Wars: Movable Type vs. WordPress Revisited

\n

Mark Jaquith – WordPress Lead Developer
\nByrne Reese – Endevver
\nThese days people tend to pit us against Drupal rather than Movable Type, but looking back at the early rivalry and learning from the positive and negative aspects of it would be cool as we position ourselves in competition with new platforms. I like seeing Mark present at conferences, he always prepares well and does a good job. Though I’m guessing these guys will be all friendly and collaborative, I might take a nostalgia hit and imagine them in a fistfight just to liven things up.

\n

Designing WordPress

\n

Jane Wells – WordPress User Experience Lead
\nDisclosure: This is me! Balancing the desire for truly open and participatory design processes against the often more efficient and consistent results of a more curated design method is something we’ve been working on for the past year or so in WordPress core. I’d use the design process for several recent core features (like the UI refresh and internal linking) to illustrate the issues we’ve faced and the results we’ve achieved.

\n

Open Source Social Networking

\n

John James Jacoby – BuddyPress Lead Developer
\nJ-trip (as John James Jacoby is fondly known by many in the community) is the lead dev for BuddyPress and the new bbPress plugin. He’s proposing a panel discussion among reps from several open source social network platforms. It’s always cool hearing more about BuddyPress, but it would be even cooler to figure out how it fits in with and/or stacks up against other platforms.

\n

Welcome to the Chaos – the Distributed Workplace

\n

Nikolay Bachiyski – WordPress Core Developer, GlotPress Lead Developer
\nLori McLeese – Automattic
\nThis one isn’t about WordPress per se, though using WordPress as a communication tool is one of the topics and Automattic is obviously a WordPress-based business. The main reason I think people should vote for this session is because Nikolay, core committing developer for internationalization and lead developer of GlotPress, our translation tool, is an awesome speaker. He is hysterically funny when he presents. I would bet money this presentation will involve a bear.

\n

Deploying WordPress: From Zero to Ninja

\n

Grant Norwood – Michael & Susan Dell Foundation
\nWhen Mark Jaquith says a presentation on security and deployment is on his short list, I’m impressed. (He said it in the comments on the proposal.)

\n

Beyond the Theme – Using WordPress as an API

\n

David Tufts – kickpress.org
\nObviously a hot topic in the community right now, seems like a no-brainer to choose.

\n

Local Government Online: WordPress Beats Drupal

\n

Jase Wilson – Luminopolis
\nThere was a presentation at WordCamp San Francisco this month on moving a news site from Drupal to WordPress. More and more the question comes up of which tool is best for various situations and requirements. And obviously getting government to use more open source software would be a cost-saver in these tough economic times.

\n

WordPress website built live in 45 minutes

\n

Glenn Todd – Dvize Creative
\nLive walkthroughs are always fun, and help prove to the uninitiated how easy WordPress can be.

\n

So: go vote on these session proposals and help spread the WordPress love. If you know of any WordPress-related proposals that didn’t come up in my search, let me know in a comment and I’ll update this post. Thanks, and maybe we’ll see you in Austin in March!

\n";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:36:"http://wellformedweb.org/CommentAPI/";a:1:{s:10:"commentRss";a:1:{i:0;a:5:{s:4:"data";s:63:"http://wordpress.org/news/2011/09/vote-for-wordpress-sxsw/feed/";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:38:"http://purl.org/rss/1.0/modules/slash/";a:1:{s:8:"comments";a:1:{i:0;a:5:{s:4:"data";s:1:"0";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}i:3;a:6:{s:4:"data";s:44:"\n \n \n \n \n \n \n \n\n \n \n \n \n \n ";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:5:{s:0:"";a:7:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:17:"State of the Word";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:52:"http://wordpress.org/news/2011/08/state-of-the-word/";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:8:"comments";a:1:{i:0;a:5:{s:4:"data";s:61:"http://wordpress.org/news/2011/08/state-of-the-word/#comments";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:7:"pubDate";a:1:{i:0;a:5:{s:4:"data";s:31:"Fri, 19 Aug 2011 15:32:04 +0000";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:8:"category";a:2:{i:0;a:5:{s:4:"data";s:9:"Community";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}i:1;a:5:{s:4:"data";s:4:"Meta";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"guid";a:1:{i:0;a:5:{s:4:"data";s:33:"http://wordpress.org/news/?p=2019";s:7:"attribs";a:1:{s:0:"";a:1:{s:11:"isPermaLink";s:5:"false";}}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:307:"This has been an exciting year for WordPress. We’ve grown to power 14.7% of the top million websites in the world, up from 8.5%, and the latest data show 22 out of every 100 new active domains in the US are running WordPress. We also conducted our first ever user and developer survey, which got [...]";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:32:"http://purl.org/dc/elements/1.1/";a:1:{s:7:"creator";a:1:{i:0;a:5:{s:4:"data";s:14:"Matt Mullenweg";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:40:"http://purl.org/rss/1.0/modules/content/";a:1:{s:7:"encoded";a:1:{i:0;a:5:{s:4:"data";s:2043:"

This has been an exciting year for WordPress. We’ve grown to power 14.7% of the top million websites in the world, up from 8.5%, and the latest data show 22 out of every 100 new active domains in the US are running WordPress.

\n

We also conducted our first ever user and developer survey, which got over 18,000 responses from all over the world:

\n

\n

We found a few interesting tidbits from the survey responses already, including that 6,800 self-employed respondents were responsible for over 170,000 sites personally, and charged a median hourly rate of $50. In tough economic times, it’s heartening to see Open Source creating so many jobs. (If each site took only 3 hours to make, that’s $29.5M of work at the average hourly rate.)

\n

I talk about this data, and much more, in my State of the Word address which you can watch here:

\n

\n

We know there’s more good stuff hidden in there and we’re open sourcing and releasing the raw information behind it. If you’re a researcher and would like to dig into the anonymized survey data yourself, you can grab it here. (Careful, it’s a 9MB CSV.)

\n

There has never been a better time to be part of the WordPress community, and I want to thank each and every one of you for making it such a wonderful place to be. Now it’s time to get back to work, there’s still 85.3% of the web that needs help.

\n";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:36:"http://wellformedweb.org/CommentAPI/";a:1:{s:10:"commentRss";a:1:{i:0;a:5:{s:4:"data";s:57:"http://wordpress.org/news/2011/08/state-of-the-word/feed/";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:38:"http://purl.org/rss/1.0/modules/slash/";a:1:{s:8:"comments";a:1:{i:0;a:5:{s:4:"data";s:1:"0";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}i:4;a:6:{s:4:"data";s:44:"\n \n \n \n \n \n \n \n\n \n \n \n \n \n ";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:5:{s:0:"";a:7:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:23:"WordCamp SF Livestream!";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:57:"http://wordpress.org/news/2011/08/wordcamp-sf-livestream/";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:8:"comments";a:1:{i:0;a:5:{s:4:"data";s:66:"http://wordpress.org/news/2011/08/wordcamp-sf-livestream/#comments";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:7:"pubDate";a:1:{i:0;a:5:{s:4:"data";s:31:"Fri, 12 Aug 2011 08:38:03 +0000";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:8:"category";a:2:{i:0;a:5:{s:4:"data";s:9:"Community";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}i:1;a:5:{s:4:"data";s:8:"WordCamp";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"guid";a:1:{i:0;a:5:{s:4:"data";s:33:"http://wordpress.org/news/?p=2012";s:7:"attribs";a:1:{s:0:"";a:1:{s:11:"isPermaLink";s:5:"false";}}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:342:"The annual WordPress conference, WordCamp San Francisco, starts in fewer than 8 hours. The sold out event — three full days of programming for bloggers, developers, theme designers, and professional WordPress users — will be shared with more than 1,000 ticket holders from near and far. If you are one of the many people who [...]";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:32:"http://purl.org/dc/elements/1.1/";a:1:{s:7:"creator";a:1:{i:0;a:5:{s:4:"data";s:10:"Jane Wells";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:40:"http://purl.org/rss/1.0/modules/content/";a:1:{s:7:"encoded";a:1:{i:0;a:5:{s:4:"data";s:2414:"

The annual WordPress conference, WordCamp San Francisco, starts in fewer than 8 hours. The sold out event — three full days of programming for bloggers, developers, theme designers, and professional WordPress users — will be shared with more than 1,000 ticket holders from near and far. If you are one of the many people who wanted to come but couldn’t swing the time off or travel expenses, you should check out the livestream tickets that are for sale. You can even get a conference t-shirt to commemorate your “virtual” participation.

\n

Speakers include members of the WordPress core development team, leaders of WordPress-based businesses, hobbyists, and everything in between. Take a look at the schedules for Friday, Saturday, and Sunday, and if you see something that sounds interesting (how could you not?), buy a livestream ticket. The stream will start at 16:00 UTC on Friday, August 12.

\n

Viewing Parties

\n

Celebrate your own local WordPress community by calling together some friends and having a livestream viewing party. In the case of regular WordPress meetup groups, if you do a viewing party we will have a process after #WCSF is over whereby attendees will be eligible to buy conference shirts if their meetup group organizer confirms viewing party attendance.

\n

Videos from all the recorded sessions will be posted for free on WordPress.tv within a couple of weeks, but watching the livestream allows you to support WordCamp while providing instant gratification. And let’s face it: the best part is that you’ll know what the heck people are talking about on Twitter using the hashtag #wcsf.

\n";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:36:"http://wellformedweb.org/CommentAPI/";a:1:{s:10:"commentRss";a:1:{i:0;a:5:{s:4:"data";s:62:"http://wordpress.org/news/2011/08/wordcamp-sf-livestream/feed/";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:38:"http://purl.org/rss/1.0/modules/slash/";a:1:{s:8:"comments";a:1:{i:0;a:5:{s:4:"data";s:1:"0";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}i:5;a:6:{s:4:"data";s:44:"\n \n \n \n \n \n \n \n\n \n \n \n \n \n ";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:5:{s:0:"";a:7:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:23:"Best WordCamp Speakers?";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:57:"http://wordpress.org/news/2011/07/best-wordcamp-speakers/";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:8:"comments";a:1:{i:0;a:5:{s:4:"data";s:66:"http://wordpress.org/news/2011/07/best-wordcamp-speakers/#comments";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:7:"pubDate";a:1:{i:0;a:5:{s:4:"data";s:31:"Sat, 16 Jul 2011 21:32:34 +0000";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:8:"category";a:2:{i:0;a:5:{s:4:"data";s:9:"Community";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}i:1;a:5:{s:4:"data";s:8:"WordCamp";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"guid";a:1:{i:0;a:5:{s:4:"data";s:33:"http://wordpress.org/news/?p=2000";s:7:"attribs";a:1:{s:0:"";a:1:{s:11:"isPermaLink";s:5:"false";}}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:357:"As we complete speaker selection for the annual WordPress conference (a.k.a. WordCamp San Francisco), it’s clear that even though there were more than 200 speaker applications, many great WordCamp speakers did not apply. No fear! We will seek them out to make sure that WordCamp SF has a fantastic lineup, including people who didn’t apply [...]";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:32:"http://purl.org/dc/elements/1.1/";a:1:{s:7:"creator";a:1:{i:0;a:5:{s:4:"data";s:10:"Jane Wells";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:40:"http://purl.org/rss/1.0/modules/content/";a:1:{s:7:"encoded";a:1:{i:0;a:5:{s:4:"data";s:1600:"

As we complete speaker selection for the annual WordPress conference (a.k.a. WordCamp San Francisco), it’s clear that even though there were more than 200 speaker applications, many great WordCamp speakers did not apply. No fear! We will seek them out to make sure that WordCamp SF has a fantastic lineup, including people who didn’t apply (too shy? who knows?) but have wowed local crowds at previous WordCamps.

\n

This is about as basic a survey as there is. Tell us the three best WordCamp presentations you saw in the past year or so. For each, give the presenters name, the topic (exact title not necessary) and which WordCamp it was at (important).

\n

Example:

\n

1. Joe Shmoe, Using the Loop, WordCamp Sheboygan 2011
\n2. Jane Doe, Top 5 WordPress Plugins, WordCamp La Mancha 2010
\n3. Lee Smith, Your First Core Patch, WordCamp Atlantis 2011

\n

That’s it. We don’t need your name or any info at all, just your three top speaker votes. We’ll take a look at the people with the most votes, and consider them for WCSF if they’re not already in the application pool. Thanks for your help in making this year’s conference better and more WordPressy than ever.

\n

Vote Now!

\n

P.S. Have you bought your tickets yet?

\n";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:36:"http://wellformedweb.org/CommentAPI/";a:1:{s:10:"commentRss";a:1:{i:0;a:5:{s:4:"data";s:62:"http://wordpress.org/news/2011/07/best-wordcamp-speakers/feed/";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:38:"http://purl.org/rss/1.0/modules/slash/";a:1:{s:8:"comments";a:1:{i:0;a:5:{s:4:"data";s:1:"0";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}i:6;a:6:{s:4:"data";s:41:"\n \n \n \n \n \n \n\n \n \n \n \n \n ";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:5:{s:0:"";a:7:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:15:"WordPress 3.2.1";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:50:"http://wordpress.org/news/2011/07/wordpress-3-2-1/";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:8:"comments";a:1:{i:0;a:5:{s:4:"data";s:59:"http://wordpress.org/news/2011/07/wordpress-3-2-1/#comments";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:7:"pubDate";a:1:{i:0;a:5:{s:4:"data";s:31:"Tue, 12 Jul 2011 19:49:06 +0000";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:8:"category";a:1:{i:0;a:5:{s:4:"data";s:8:"Releases";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"guid";a:1:{i:0;a:5:{s:4:"data";s:33:"http://wordpress.org/news/?p=1982";s:7:"attribs";a:1:{s:0:"";a:1:{s:11:"isPermaLink";s:5:"false";}}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:358:"After more than a million downloads of WordPress 3.2, we’re now releasing WordPress 3.2.1 into the wild. This maintenance release fixes a server incompatibility related to JSON that’s unfortunately affected some of you, as well as a few other fixes in the new dashboard design and the Twenty Eleven theme. If you’ve already updated to [...]";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:32:"http://purl.org/dc/elements/1.1/";a:1:{s:7:"creator";a:1:{i:0;a:5:{s:4:"data";s:12:"Andrew Nacin";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:40:"http://purl.org/rss/1.0/modules/content/";a:1:{s:7:"encoded";a:1:{i:0;a:5:{s:4:"data";s:1129:"

After more than a million downloads of WordPress 3.2, we’re now releasing WordPress 3.2.1 into the wild. This maintenance release fixes a server incompatibility related to JSON that’s unfortunately affected some of you, as well as a few other fixes in the new dashboard design and the Twenty Eleven theme. If you’ve already updated to 3.2, then this update will be even faster than usual, thanks to the new feature in 3.2 that only updates files that have been changed, rather than replacing all the files in your installation.

\n

For a full list of fixes, view the changelog the list of tickets. Our release haiku:

\n

JSON, the admin
\nA little bit tidier
\nEdge cases covered

\n

Download 3.2.1 or update now from the Dashboard → Updates menu in your site’s admin area.

\n";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:36:"http://wellformedweb.org/CommentAPI/";a:1:{s:10:"commentRss";a:1:{i:0;a:5:{s:4:"data";s:55:"http://wordpress.org/news/2011/07/wordpress-3-2-1/feed/";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:38:"http://purl.org/rss/1.0/modules/slash/";a:1:{s:8:"comments";a:1:{i:0;a:5:{s:4:"data";s:1:"0";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}i:7;a:6:{s:4:"data";s:41:"\n \n \n \n \n \n \n\n \n \n \n \n \n ";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:5:{s:0:"";a:7:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:27:"WordPress 3.2 now available";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:43:"http://wordpress.org/news/2011/07/gershwin/";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:8:"comments";a:1:{i:0;a:5:{s:4:"data";s:52:"http://wordpress.org/news/2011/07/gershwin/#comments";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:7:"pubDate";a:1:{i:0;a:5:{s:4:"data";s:31:"Mon, 04 Jul 2011 21:07:06 +0000";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:8:"category";a:1:{i:0;a:5:{s:4:"data";s:8:"Releases";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"guid";a:1:{i:0;a:5:{s:4:"data";s:33:"http://wordpress.org/news/?p=1924";s:7:"attribs";a:1:{s:0:"";a:1:{s:11:"isPermaLink";s:5:"false";}}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:329:"Here in the U.S. we are observing Independence Day, and I can’t think of a more fitting way to mark a day that celebrates freedom than by releasing more free software to help democratize publishing around the globe. I’m excited to announce that WordPress 3.2 is now available to the world, both as an update in [...]";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:32:"http://purl.org/dc/elements/1.1/";a:1:{s:7:"creator";a:1:{i:0;a:5:{s:4:"data";s:14:"Matt Mullenweg";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:40:"http://purl.org/rss/1.0/modules/content/";a:1:{s:7:"encoded";a:1:{i:0;a:5:{s:4:"data";s:14127:"

Here in the U.S. we are observing Independence Day, and I can’t think of a more fitting way to mark a day that celebrates freedom than by releasing more free software to help democratize publishing around the globe. I’m excited to announce that WordPress 3.2 is now available to the world, both as an update in your dashboard and a download on WordPress.org. Version 3.2 is our fifteenth major release of WordPress and comes just four months after 3.1 (which coincidentally just passed the 15 million download mark this morning), reflecting the growing speed of development in the WordPress community and our dedication to getting improvements in your hands as soon as possible. We’re dedicating this release to noted composer and pianist George Gershwin.

\n

Before we get to the release, in anticipation of the State of the Word speech at the upcoming WordCamp San Francisco (the annual WordPress conference) we’re doing a survey or census of the WordPress world. If you have a moment, please fill out this survey and we’ll share what we learn by publishing the aggregate results in August.

\n

The focus for this release was making WordPress faster and lighter. The first thing you’ll notice when you log in to 3.2 is a refreshed dashboard design that tightens the typography, design, and code behind the admin. (Rhapsody in Grey?) If you’re starting a new blog, you’ll also appreciate the fully HTML5 new Twenty Eleven theme, fulfilling our plan to replace the default theme every year. Start writing your first post in our redesigned post editor and venture to the full-screen button in the editing toolbar to enter the new distraction-free writing or zen mode, my personal favorite feature of the release. All of the widgets, menus, buttons, and interface elements fade away to allow you to compose and edit your thoughts in a completely clean environment conducive to writing, but when your mouse strays to the top of the screen your most-used shortcuts are right there where you need them. (I like to press F11 to take my browser full-screen, getting rid of even the OS chrome.)

\n

\n

Under the hood there have been a number of improvements, not the least of which is the streamlining enabled by our previously announced plan of retiring support for PHP4, older versions of MySQL, and legacy browsers like IE6, which allows us to take advantage of more features enabled by new technologies. The admin bar has a few more shortcuts to your most commonly-used actions. On the comment moderation screen, the new approve & reply feature speeds up your conversation management. You’ll notice in your first update after 3.2 that we’ll only be updating the files that have changed with each new release instead of every file in your WordPress installation, which makes updates significantly faster on all hosting platforms. There are also some fun new theme features shown off by Twenty Eleven, like the ability to have multiple rotating header images to highlight all of your favorite photos.

\n

There is way more, like our new freedoms and credits screens (linked from your dashboard footer), so for the full story check out the Codex page on 3.2 or the Trac milestone which includes the 400+ tickets closed in this release.

\n

A Community Effort

\n

We now finally have a credits page inside of WordPress itself (though a cool revision is coming in 3.3), but for posterity let’s give a round of applause to these fine folks who contributed to 3.2:

\n

Aaron Brazell, Aaron Campbell, Aaron Jorbin, Adam Harley, Alex Concha, ampt, Andrew Nacin, Andrew Ozz, andrewryno, andy, Austin Matzko, BenChapman, Ben Dunkle, bluntelk, Boone Gorges, Brandon Allen, Brandon Burke, Caspie, cfinke, charlesclarkson, chexee, coffee2code, Cristi Burcă, daniloercoli, Daryl Koopersmith, David Cowgill, David Trower, demetris, Devin Reams, Dion Hulse, dllh, Dominik Schilling, Doug Provencio, dvwallin, Dylan Kuhn, Eric Mann, fabifott, Franklin Tse, Frumph, garyc40, Glenn Ansley, guyn, hakre, hebbet, Helen Hou-Sandi, hew, holizz, Ian Stewart, Jacob Gillespie, Jane Wells, Jayjdk, Jeff Farthing, Joachim Kudish, joelhardi, John Blackbourn, John Ford, John James Jacoby, JohnONolan, Jon Cave, joostdevalk, Jorge Bernal, Joseph Scott, Justin Sternberg, Justin Tadlock, kevinB, Knut Sparhell, kovshenin, Kuraishi, Lance Willett, linuxologos, lloydbudd, Luc De Brouwer, marcis20, Mark Jaquith, Mark McWilliams, Martin Lormes, Matías Ventura, Matt Martz, Matt Thomas, MattyRob, mcepl, mdawaffe, Michael Fields, MichaelH, michaeltyson, Mike Schroder, Milan Dinić, mintindeed, mitchoyoshitaka, Mohammad Jangda, mrroundhill, natecook, nathanrice, Niall Kennedy, Nick Bohle, Nikolay Bachiyski, nuxwin, Otto, pavelevap, pete.mall, Peter Westwood, Prasath Nadarajah, Ptah Dunbar, Rafael Poveda, Rahe, Ramiy, Rasheed Bydousi, Reuben Gunday, Robert Chapin, Ron Rennick, Ross Hanney, Ryan Boren, Ryan Imel, Safirul Alredha, Samir Shah, saracannon, sbressler, Sergey Biryukov, shakenstirred, Sidney Harrell, Simon Prosser, sorich87, szadok, tetele, tigertech, trepmal, Utkarsh Kukreti, valentinas, webduo, Xavier Borderie, Yoav Farhi, Ze Fontainhas, and ziofix.

\n

Bonus: On their WordPress.org profiles over 20,000 people have said they make their living from WordPress. Are you one of them? Don’t forget to take a minute for our survey.

\n";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:36:"http://wellformedweb.org/CommentAPI/";a:1:{s:10:"commentRss";a:1:{i:0;a:5:{s:4:"data";s:48:"http://wordpress.org/news/2011/07/gershwin/feed/";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:38:"http://purl.org/rss/1.0/modules/slash/";a:1:{s:8:"comments";a:1:{i:0;a:5:{s:4:"data";s:1:"0";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}i:8;a:6:{s:4:"data";s:53:"\n \n \n \n \n \n \n \n \n \n \n\n \n \n \n \n \n ";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:5:{s:0:"";a:7:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:32:"Are You Ready for WordPress 3.2?";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:66:"http://wordpress.org/news/2011/07/are-you-ready-for-wordpress-3-2/";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:8:"comments";a:1:{i:0;a:5:{s:4:"data";s:75:"http://wordpress.org/news/2011/07/are-you-ready-for-wordpress-3-2/#comments";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:7:"pubDate";a:1:{i:0;a:5:{s:4:"data";s:31:"Sun, 03 Jul 2011 23:32:26 +0000";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:8:"category";a:5:{i:0;a:5:{s:4:"data";s:7:"Hosting";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}i:1;a:5:{s:4:"data";s:12:"health check";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}i:2;a:5:{s:4:"data";s:20:"minimum requirements";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}i:3;a:5:{s:4:"data";s:5:"MySQL";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}i:4;a:5:{s:4:"data";s:3:"PHP";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"guid";a:1:{i:0;a:5:{s:4:"data";s:33:"http://wordpress.org/news/?p=1952";s:7:"attribs";a:1:{s:0:"";a:1:{s:11:"isPermaLink";s:5:"false";}}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:312:"WordPress 3.2 is going to be released very soon, and we want you to be ready! Take note: the minimum requirements are changing. PHP and MySQL As of 3.2, you’ll need to be running PHP 5.2.4 and MySQL 5.0. As we mentioned almost a year ago when we announced that this change was coming, the percentage [...]";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:32:"http://purl.org/dc/elements/1.1/";a:1:{s:7:"creator";a:1:{i:0;a:5:{s:4:"data";s:10:"Jane Wells";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:40:"http://purl.org/rss/1.0/modules/content/";a:1:{s:7:"encoded";a:1:{i:0;a:5:{s:4:"data";s:4342:"

WordPress 3.2 is going to be released very soon, and we want you to be ready! Take note: the minimum requirements are changing.

\n

PHP and MySQL

\n

As of 3.2, you’ll need to be running PHP 5.2.4 and MySQL 5.0. As we mentioned almost a year ago when we announced that this change was coming, the percentage of people running older versions of PHP and MySQL is relatively low. With more than 45 million people using WordPress, though, even a small percentage can mean a lot of people! Don’t caught with your pants dashboard down — make sure you’re running compatible versions of PHP and MySQL before you update tomorrow when WordPress 3.2 is released.

\n

Log in to your hosting account, and check to make sure you have at least  PHP 5.2.4 and MySQL 5.0. Most of the major hosts already default to these or newer versions, but there are some exceptions. Check to see which versions you are running, and if you’re still on an older version, it should be as simple as changing a dropdown menu and clicking Save to get up to date.

\n

If you don’t know how to find this information in your hosting account or you don’t even know how to access your hosting control panel because someone else manages that for you, don’t fret. You can find out if you’re ready for 3.2 with the Health Check plugin. In your dashboard, go to Plugins → Add New and search for “health check” (it should be the first result). Install it, activate it, and it will tell you if you need to update anything.

\n

If you need more help, contact your host’s customer service and use this email template to ask them to help you.

\n

Hi there. I host my domain [example.com] with you, and I run WordPress on my site. The minimum requirements are changing to PHP 5.2.4 and MySQL 5.0, and I would appreciate your help in confirming that my site’s setup meets these requirements. If I’m currently running an older version of PHP or MySQL, could you update it for me, or tell me how to do it? Thanks so much!

\n

If your host replies that they can’t update to these versions, it might be time to look for a new host.

\n

IE6 and Outdated Browsers

\n

With 3.2, we’re also dropping support for Internet Explorer 6, a 10-years-old outdated browser that even Microsoft is ready to leave behind. From now on, if you access your WordPress dashboard from an outdated browser, we’ll let you know. Why? Because as web technology improves, so does WordPress, as we build features to take advantage of these improvements. If you’re using an out-of-date browser, chances are you’re missing out.

\n

If your browser is out of date, you’ll see a friendly orangey-yellow box in your dashboard letting you know you a newer version is available (which you can dismiss, of course). If you’re using IE6, though, the box will be red, and your dashboard will not function properly. If you’re stuck on IE6 because the computer you use is maintained by a business, library, school, or the like, and you are not able to download a newer browser, here’s a sample email you can use to ask your boss/administrator/IT guys to update the browser.

\n

Hi there. The computer I use at [where you use the computer] is equipped with an out-of-date web browser. Internet Explorer 6 was created 10 years ago, before modern web standards, and does not support modern web applications. More and more sites and applications are dropping support for IE6, including the new version of WordPress. Even Microsoft, the makers of IE6, are counting down until IE6 goes the way of the dinosaur (see http://www.ie6countdown.com/ for more information). Can you please install an updated version of IE or any modern browser (see http://browsehappy.com for more information) on the available computers? Thank you very much.

\n

Welcome to the future!

\n

 

\n

 

\n";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:36:"http://wellformedweb.org/CommentAPI/";a:1:{s:10:"commentRss";a:1:{i:0;a:5:{s:4:"data";s:71:"http://wordpress.org/news/2011/07/are-you-ready-for-wordpress-3-2/feed/";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:38:"http://purl.org/rss/1.0/modules/slash/";a:1:{s:8:"comments";a:1:{i:0;a:5:{s:4:"data";s:1:"0";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}i:9;a:6:{s:4:"data";s:44:"\n \n \n \n \n \n \n \n\n \n \n \n \n \n ";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:5:{s:0:"";a:7:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:45:"WordPress 3.1.4 (and 3.2 Release Candidate 3)";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:50:"http://wordpress.org/news/2011/06/wordpress-3-1-4/";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:8:"comments";a:1:{i:0;a:5:{s:4:"data";s:59:"http://wordpress.org/news/2011/06/wordpress-3-1-4/#comments";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:7:"pubDate";a:1:{i:0;a:5:{s:4:"data";s:31:"Wed, 29 Jun 2011 19:00:40 +0000";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:8:"category";a:2:{i:0;a:5:{s:4:"data";s:8:"Releases";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}i:1;a:5:{s:4:"data";s:8:"Security";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"guid";a:1:{i:0;a:5:{s:4:"data";s:33:"http://wordpress.org/news/?p=1927";s:7:"attribs";a:1:{s:0:"";a:1:{s:11:"isPermaLink";s:5:"false";}}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:368:"WordPress 3.1.4 is available now and is a maintenance and security update for all previous versions. This release fixes an issue that could allow a malicious Editor-level user to gain further access to the site. Thanks K. Gudinavicius of SEC Consult for bringing this to our attention. Version 3.1.4 also incorporates several other security fixes and hardening [...]";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:32:"http://purl.org/dc/elements/1.1/";a:1:{s:7:"creator";a:1:{i:0;a:5:{s:4:"data";s:10:"Ryan Boren";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:40:"http://purl.org/rss/1.0/modules/content/";a:1:{s:7:"encoded";a:1:{i:0;a:5:{s:4:"data";s:2016:"

WordPress 3.1.4 is available now and is a maintenance and security update for all previous versions.

\n

This release fixes an issue that could allow a malicious Editor-level user to gain further access to the site. Thanks K. Gudinavicius of SEC Consult for bringing this to our attention. Version 3.1.4 also incorporates several other security fixes and hardening measures thanks to the work of WordPress developers Alexander Concha and Jon Cave of our security team. Consult the change log for more details.

\n

Download WordPress 3.1.4 or update immediately from the Dashboard → Updates menu in your site’s admin area.

\n

WordPress 3.2 Release Candidate 3

\n

This release was about all that stood in the way of a final release of WordPress 3.2. So we’re also announcing the third release candidate for 3.2, which contains all of the fixes in 3.1.4; few minor RTL, JavaScript, and user interface fixes; and ensures graceful failures if 3.2 is run on PHP4. As a reminder, we’ve bumped our minimum requirements for version 3.2 to PHP 5.2.4 and MySQL 5.0.

\n

To test WordPress 3.2, try the WordPress Beta Tester plugin (you’ll want “bleeding edge nightlies”). Or you can download the release candidate here (zip). At this stage, plugin authors should be doing final tests to ensure compatibility.

\n

Bonus: For more on what to test and what to do if you find an issue, please read our Beta 1 post.

\n";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:36:"http://wellformedweb.org/CommentAPI/";a:1:{s:10:"commentRss";a:1:{i:0;a:5:{s:4:"data";s:55:"http://wordpress.org/news/2011/06/wordpress-3-1-4/feed/";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:38:"http://purl.org/rss/1.0/modules/slash/";a:1:{s:8:"comments";a:1:{i:0;a:5:{s:4:"data";s:1:"0";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}}}s:27:"http://www.w3.org/2005/Atom";a:1:{s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:0:"";s:7:"attribs";a:1:{s:0:"";a:3:{s:4:"href";s:31:"http://wordpress.org/news/feed/";s:3:"rel";s:4:"self";s:4:"type";s:19:"application/rss+xml";}}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:44:"http://purl.org/rss/1.0/modules/syndication/";a:2:{s:12:"updatePeriod";a:1:{i:0;a:5:{s:4:"data";s:6:"hourly";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:15:"updateFrequency";a:1:{i:0;a:5:{s:4:"data";s:1:"1";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}}}}}}}}s:4:"type";i:128;s:7:"headers";a:8:{s:6:"server";s:5:"nginx";s:4:"date";s:29:"Fri, 23 Sep 2011 17:05:11 GMT";s:12:"content-type";s:23:"text/xml; charset=UTF-8";s:10:"connection";s:5:"close";s:4:"vary";s:15:"Accept-Encoding";s:10:"x-pingback";s:36:"http://wordpress.org/news/xmlrpc.php";s:13:"last-modified";s:29:"Fri, 16 Sep 2011 15:08:48 GMT";s:4:"x-nc";s:11:"HIT luv 138";}s:5:"build";s:14:"20090627192103";}', 'no'); +INSERT INTO `wp_options` (`option_id`, `blog_id`, `option_name`, `option_value`, `autoload`) VALUES +(129, 0, '_transient_timeout_feed_mod_ac0b00fe65abe10e0c5b588f3ed8c7ca', '1316840708', 'no'), +(130, 0, '_transient_feed_mod_ac0b00fe65abe10e0c5b588f3ed8c7ca', '1316797508', 'no'), +(131, 0, '_transient_timeout_dash_4077549d03da2e451c8b5f002294ff51', '1316840708', 'no'), +(132, 0, '_transient_dash_4077549d03da2e451c8b5f002294ff51', '
', 'no'), +(133, 0, '_transient_timeout_feed_a5420c83891a9c88ad2a4f04584a5efc', '1316840708', 'no'), +(134, 0, '_transient_feed_a5420c83891a9c88ad2a4f04584a5efc', 'a:4:{s:5:"child";a:1:{s:0:"";a:1:{s:3:"rss";a:1:{i:0;a:6:{s:4:"data";s:3:"\n \n";s:7:"attribs";a:1:{s:0:"";a:1:{s:7:"version";s:3:"2.0";}}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:1:{s:0:"";a:1:{s:7:"channel";a:1:{i:0;a:6:{s:4:"data";s:72:"\n \n \n \n \n \n \n \n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\n ";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:2:{s:0:"";a:7:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:39:"WordPress Plugins » View: Most Popular";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:51:"http://wordpress.org/extend/plugins/browse/popular/";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:39:"WordPress Plugins » View: Most Popular";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:8:"language";a:1:{i:0;a:5:{s:4:"data";s:5:"en-US";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:7:"pubDate";a:1:{i:0;a:5:{s:4:"data";s:31:"Fri, 23 Sep 2011 16:50:54 +0000";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:9:"generator";a:1:{i:0;a:5:{s:4:"data";s:25:"http://bbpress.org/?v=1.1";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"item";a:15:{i:0;a:6:{s:4:"data";s:30:"\n \n \n \n \n \n \n ";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:2:{s:0:"";a:5:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:29:"Arne on "Google XML Sitemaps"";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:70:"http://wordpress.org/extend/plugins/google-sitemap-generator/#post-132";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:7:"pubDate";a:1:{i:0;a:5:{s:4:"data";s:31:"Fri, 09 Mar 2007 22:31:32 +0000";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"guid";a:1:{i:0;a:5:{s:4:"data";s:40:"132@http://wordpress.org/extend/plugins/";s:7:"attribs";a:1:{s:0:"";a:1:{s:11:"isPermaLink";s:5:"false";}}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:105:"This plugin will generate a special XML sitemap which will help search engines to better index your blog.";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:32:"http://purl.org/dc/elements/1.1/";a:1:{s:7:"creator";a:1:{i:0;a:5:{s:4:"data";s:4:"Arne";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}i:1;a:6:{s:4:"data";s:30:"\n \n \n \n \n \n \n ";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:2:{s:0:"";a:5:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:36:"Takayuki Miyoshi on "Contact Form 7"";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:61:"http://wordpress.org/extend/plugins/contact-form-7/#post-2141";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:7:"pubDate";a:1:{i:0;a:5:{s:4:"data";s:31:"Thu, 02 Aug 2007 12:45:03 +0000";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"guid";a:1:{i:0;a:5:{s:4:"data";s:41:"2141@http://wordpress.org/extend/plugins/";s:7:"attribs";a:1:{s:0:"";a:1:{s:11:"isPermaLink";s:5:"false";}}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:54:"Just another contact form plugin. Simple but flexible.";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:32:"http://purl.org/dc/elements/1.1/";a:1:{s:7:"creator";a:1:{i:0;a:5:{s:4:"data";s:16:"Takayuki Miyoshi";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}i:2;a:6:{s:4:"data";s:30:"\n \n \n \n \n \n \n ";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:2:{s:0:"";a:5:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:33:"uberdose on "All in One SEO Pack"";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:65:"http://wordpress.org/extend/plugins/all-in-one-seo-pack/#post-753";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:7:"pubDate";a:1:{i:0;a:5:{s:4:"data";s:31:"Fri, 30 Mar 2007 20:08:18 +0000";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"guid";a:1:{i:0;a:5:{s:4:"data";s:40:"753@http://wordpress.org/extend/plugins/";s:7:"attribs";a:1:{s:0:"";a:1:{s:11:"isPermaLink";s:5:"false";}}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:92:"Automatically optimizes your Wordpress blog for Search Engines (Search Engine Optimization).";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:32:"http://purl.org/dc/elements/1.1/";a:1:{s:7:"creator";a:1:{i:0;a:5:{s:4:"data";s:8:"uberdose";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}i:3;a:6:{s:4:"data";s:30:"\n \n \n \n \n \n \n ";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:2:{s:0:"";a:5:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:32:"Joost de Valk on "WordPress SEO"";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:60:"http://wordpress.org/extend/plugins/wordpress-seo/#post-8321";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:7:"pubDate";a:1:{i:0;a:5:{s:4:"data";s:31:"Thu, 01 Jan 2009 20:34:44 +0000";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"guid";a:1:{i:0;a:5:{s:4:"data";s:41:"8321@http://wordpress.org/extend/plugins/";s:7:"attribs";a:1:{s:0:"";a:1:{s:11:"isPermaLink";s:5:"false";}}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:140:"Yoast's all in one WordPress SEO solution for your WordPress site: SEO titles, meta descriptions, XML sitemaps, breadcrumbs & more.";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:32:"http://purl.org/dc/elements/1.1/";a:1:{s:7:"creator";a:1:{i:0;a:5:{s:4:"data";s:13:"Joost de Valk";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}i:4;a:6:{s:4:"data";s:30:"\n \n \n \n \n \n \n ";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:2:{s:0:"";a:5:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:34:"flash gallery on "1 Flash Gallery"";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:63:"http://wordpress.org/extend/plugins/1-flash-gallery/#post-24163";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:7:"pubDate";a:1:{i:0;a:5:{s:4:"data";s:31:"Thu, 03 Feb 2011 14:02:51 +0000";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"guid";a:1:{i:0;a:5:{s:4:"data";s:42:"24163@http://wordpress.org/extend/plugins/";s:7:"attribs";a:1:{s:0:"";a:1:{s:11:"isPermaLink";s:5:"false";}}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:146:"1 Flash Gallery is a Photo Gallery with slideshow function, many skins and powerfull admin to manage your image gallery without any program skills";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:32:"http://purl.org/dc/elements/1.1/";a:1:{s:7:"creator";a:1:{i:0;a:5:{s:4:"data";s:13:"flash gallery";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}i:5;a:6:{s:4:"data";s:30:"\n \n \n \n \n \n \n ";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:2:{s:0:"";a:5:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:38:"Brian Colinger on "WordPress Importer"";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:66:"http://wordpress.org/extend/plugins/wordpress-importer/#post-18101";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:7:"pubDate";a:1:{i:0;a:5:{s:4:"data";s:31:"Thu, 20 May 2010 17:42:45 +0000";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"guid";a:1:{i:0;a:5:{s:4:"data";s:42:"18101@http://wordpress.org/extend/plugins/";s:7:"attribs";a:1:{s:0:"";a:1:{s:11:"isPermaLink";s:5:"false";}}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:101:"Import posts, pages, comments, custom fields, categories, tags and more from a WordPress export file.";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:32:"http://purl.org/dc/elements/1.1/";a:1:{s:7:"creator";a:1:{i:0;a:5:{s:4:"data";s:14:"Brian Colinger";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}i:6;a:6:{s:4:"data";s:30:"\n \n \n \n \n \n \n ";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:2:{s:0:"";a:5:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:30:"Alex Rabe on "NextGEN Gallery"";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:62:"http://wordpress.org/extend/plugins/nextgen-gallery/#post-1169";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:7:"pubDate";a:1:{i:0;a:5:{s:4:"data";s:31:"Mon, 23 Apr 2007 20:08:06 +0000";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"guid";a:1:{i:0;a:5:{s:4:"data";s:41:"1169@http://wordpress.org/extend/plugins/";s:7:"attribs";a:1:{s:0:"";a:1:{s:11:"isPermaLink";s:5:"false";}}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:108:"NextGEN Gallery is a full integrated Image Gallery plugin for WordPress with dozens of options and features.";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:32:"http://purl.org/dc/elements/1.1/";a:1:{s:7:"creator";a:1:{i:0;a:5:{s:4:"data";s:9:"Alex Rabe";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}i:7;a:6:{s:4:"data";s:30:"\n \n \n \n \n \n \n ";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:2:{s:0:"";a:5:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:28:"casibus on "ourSTATS Widget"";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:65:"http://wordpress.org/extend/plugins/ourstatsde-widget/#post-18282";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:7:"pubDate";a:1:{i:0;a:5:{s:4:"data";s:31:"Sat, 29 May 2010 14:16:19 +0000";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"guid";a:1:{i:0;a:5:{s:4:"data";s:42:"18282@http://wordpress.org/extend/plugins/";s:7:"attribs";a:1:{s:0:"";a:1:{s:11:"isPermaLink";s:5:"false";}}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:51:"create a widget for the ourstats.de counter service";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:32:"http://purl.org/dc/elements/1.1/";a:1:{s:7:"creator";a:1:{i:0;a:5:{s:4:"data";s:7:"casibus";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}i:8;a:6:{s:4:"data";s:30:"\n \n \n \n \n \n \n ";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:2:{s:0:"";a:5:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:38:"mdawaffe on "Jetpack by WordPress.com"";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:55:"http://wordpress.org/extend/plugins/jetpack/#post-23862";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:7:"pubDate";a:1:{i:0;a:5:{s:4:"data";s:31:"Thu, 20 Jan 2011 02:21:38 +0000";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"guid";a:1:{i:0;a:5:{s:4:"data";s:42:"23862@http://wordpress.org/extend/plugins/";s:7:"attribs";a:1:{s:0:"";a:1:{s:11:"isPermaLink";s:5:"false";}}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:104:"Supercharge your WordPress site with powerful features previously only available to WordPress.com users.";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:32:"http://purl.org/dc/elements/1.1/";a:1:{s:7:"creator";a:1:{i:0;a:5:{s:4:"data";s:8:"mdawaffe";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}i:9;a:6:{s:4:"data";s:30:"\n \n \n \n \n \n \n ";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:2:{s:0:"";a:5:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:33:"Disqus on "Disqus Comment System"";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:68:"http://wordpress.org/extend/plugins/disqus-comment-system/#post-6808";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:7:"pubDate";a:1:{i:0;a:5:{s:4:"data";s:31:"Thu, 28 Aug 2008 01:22:05 +0000";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"guid";a:1:{i:0;a:5:{s:4:"data";s:41:"6808@http://wordpress.org/extend/plugins/";s:7:"attribs";a:1:{s:0:"";a:1:{s:11:"isPermaLink";s:5:"false";}}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:113:"The Disqus comment system replaces your WordPress comment system with your comments hosted and powered by Disqus.";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:32:"http://purl.org/dc/elements/1.1/";a:1:{s:7:"creator";a:1:{i:0;a:5:{s:4:"data";s:6:"Disqus";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}i:10;a:6:{s:4:"data";s:30:"\n \n \n \n \n \n \n ";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:2:{s:0:"";a:5:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:66:"eight7teen on "SexyBookmarks | email, bookmark, and share buttons"";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:60:"http://wordpress.org/extend/plugins/sexybookmarks/#post-9249";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:7:"pubDate";a:1:{i:0;a:5:{s:4:"data";s:31:"Sun, 22 Feb 2009 11:30:11 +0000";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"guid";a:1:{i:0;a:5:{s:4:"data";s:41:"9249@http://wordpress.org/extend/plugins/";s:7:"attribs";a:1:{s:0:"";a:1:{s:11:"isPermaLink";s:5:"false";}}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:104:"Adds an attractive social bookmarking menu to your posts, pages, index, or any combination of the three.";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:32:"http://purl.org/dc/elements/1.1/";a:1:{s:7:"creator";a:1:{i:0;a:5:{s:4:"data";s:10:"eight7teen";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}i:11;a:6:{s:4:"data";s:30:"\n \n \n \n \n \n \n ";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:2:{s:0:"";a:5:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:30:"BraveNewCode Inc. on "WPtouch"";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:54:"http://wordpress.org/extend/plugins/wptouch/#post-5468";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:7:"pubDate";a:1:{i:0;a:5:{s:4:"data";s:31:"Thu, 01 May 2008 04:58:09 +0000";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"guid";a:1:{i:0;a:5:{s:4:"data";s:41:"5468@http://wordpress.org/extend/plugins/";s:7:"attribs";a:1:{s:0:"";a:1:{s:11:"isPermaLink";s:5:"false";}}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:150:"WPtouch: A simple, powerful and elegant mobile theme for your website.\n\nWPtouch automatically transforms your WordPress blog into an iPhone applicatio";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:32:"http://purl.org/dc/elements/1.1/";a:1:{s:7:"creator";a:1:{i:0;a:5:{s:4:"data";s:17:"BraveNewCode Inc.";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}i:12;a:6:{s:4:"data";s:30:"\n \n \n \n \n \n \n ";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:2:{s:0:"";a:5:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:27:"Matt Mullenweg on "Akismet"";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:52:"http://wordpress.org/extend/plugins/akismet/#post-15";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:7:"pubDate";a:1:{i:0;a:5:{s:4:"data";s:31:"Fri, 09 Mar 2007 22:11:30 +0000";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"guid";a:1:{i:0;a:5:{s:4:"data";s:39:"15@http://wordpress.org/extend/plugins/";s:7:"attribs";a:1:{s:0:"";a:1:{s:11:"isPermaLink";s:5:"false";}}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:98:"Akismet checks your comments against the Akismet web service to see if they look like spam or not.";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:32:"http://purl.org/dc/elements/1.1/";a:1:{s:7:"creator";a:1:{i:0;a:5:{s:4:"data";s:14:"Matt Mullenweg";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}i:13;a:6:{s:4:"data";s:30:"\n \n \n \n \n \n \n ";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:2:{s:0:"";a:5:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:36:"Frederick Townes on "W3 Total Cache"";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:62:"http://wordpress.org/extend/plugins/w3-total-cache/#post-12073";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:7:"pubDate";a:1:{i:0;a:5:{s:4:"data";s:31:"Wed, 29 Jul 2009 18:46:31 +0000";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"guid";a:1:{i:0;a:5:{s:4:"data";s:42:"12073@http://wordpress.org/extend/plugins/";s:7:"attribs";a:1:{s:0:"";a:1:{s:11:"isPermaLink";s:5:"false";}}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:135:"Improve site performance and user experience via caching: browser, page, object, database, minify and content delivery network support.";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:32:"http://purl.org/dc/elements/1.1/";a:1:{s:7:"creator";a:1:{i:0;a:5:{s:4:"data";s:16:"Frederick Townes";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}i:14;a:6:{s:4:"data";s:30:"\n \n \n \n \n \n \n ";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:2:{s:0:"";a:5:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:49:"Joost de Valk on "Google Analytics for WordPress"";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:77:"http://wordpress.org/extend/plugins/google-analytics-for-wordpress/#post-2316";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:7:"pubDate";a:1:{i:0;a:5:{s:4:"data";s:31:"Fri, 14 Sep 2007 12:15:27 +0000";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"guid";a:1:{i:0;a:5:{s:4:"data";s:41:"2316@http://wordpress.org/extend/plugins/";s:7:"attribs";a:1:{s:0:"";a:1:{s:11:"isPermaLink";s:5:"false";}}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:145:"Track your WordPress site easily and with lots of metadata: views per author & category, automatic tracking of outbound clicks and pageviews.";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:32:"http://purl.org/dc/elements/1.1/";a:1:{s:7:"creator";a:1:{i:0;a:5:{s:4:"data";s:13:"Joost de Valk";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}}}s:27:"http://www.w3.org/2005/Atom";a:1:{s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:0:"";s:7:"attribs";a:1:{s:0:"";a:3:{s:4:"href";s:52:"http://wordpress.org/extend/plugins/rss/view/popular";s:3:"rel";s:4:"self";s:4:"type";s:19:"application/rss+xml";}}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}}}}}}}}s:4:"type";i:128;s:7:"headers";a:8:{s:6:"server";s:5:"nginx";s:4:"date";s:29:"Fri, 23 Sep 2011 17:05:13 GMT";s:12:"content-type";s:23:"text/xml; charset=UTF-8";s:10:"connection";s:5:"close";s:4:"vary";s:15:"Accept-Encoding";s:13:"last-modified";s:19:"2007-03-09 22:31:32";s:14:"content-length";s:4:"7946";s:4:"x-nc";s:11:"HIT luv 138";}s:5:"build";s:14:"20090627192103";}', 'no'), +(135, 0, '_transient_timeout_feed_mod_a5420c83891a9c88ad2a4f04584a5efc', '1316840708', 'no'), +(136, 0, '_transient_feed_mod_a5420c83891a9c88ad2a4f04584a5efc', '1316797508', 'no'), +(137, 0, '_transient_timeout_feed_867bd5c64f85878d03a060509cd2f92c', '1316840709', 'no'); +INSERT INTO `wp_options` (`option_id`, `blog_id`, `option_name`, `option_value`, `autoload`) VALUES +(138, 0, '_transient_feed_867bd5c64f85878d03a060509cd2f92c', 'a:4:{s:5:"child";a:1:{s:0:"";a:1:{s:3:"rss";a:1:{i:0;a:6:{s:4:"data";s:3:"\n\n\n";s:7:"attribs";a:1:{s:0:"";a:1:{s:7:"version";s:3:"2.0";}}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:1:{s:0:"";a:1:{s:7:"channel";a:1:{i:0;a:6:{s:4:"data";s:61:"\n \n \n \n \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:1:{s:0:"";a:5:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:16:"WordPress Planet";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:28:"http://planet.wordpress.org/";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:8:"language";a:1:{i:0;a:5:{s:4:"data";s:2:"en";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:47:"WordPress Planet - http://planet.wordpress.org/";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"item";a:50:{i:0;a:6:{s:4:"data";s:13:"\n \n \n \n \n \n \n";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:2:{s:0:"";a:5:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:60:"WordPress.tv: Jay Collier: Web Strategy for Higher Education";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"guid";a:1:{i:0;a:5:{s:4:"data";s:27:"http://wordpress.tv/?p=6898";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:77:"http://wordpress.tv/2011/09/23/jay-collier-web-strategy-for-higher-education/";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:1828:"
\n
\n
Jay Collier: Web Strategy for Higher Education
";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:7:"pubDate";a:1:{i:0;a:5:{s:4:"data";s:31:"Fri, 23 Sep 2011 14:08:44 +0000";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:32:"http://purl.org/dc/elements/1.1/";a:1:{s:7:"creator";a:1:{i:0;a:5:{s:4:"data";s:15:"WordCamp Boston";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}i:1;a:6:{s:4:"data";s:13:"\n \n \n \n \n \n \n";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:2:{s:0:"";a:5:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:65:"Weblog Tools Collection: Do You Really Need All of Those Plugins?";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"guid";a:1:{i:0;a:5:{s:4:"data";s:41:"http://weblogtoolscollection.com/?p=10513";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:73:"http://feedproxy.google.com/~r/weblogtoolscollection/UXMP/~3/yrylbhxwr6c/";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:2805:"

There has been some interesting discussion on how many plugins you should use on your WordPress blog, and whether that number contributes to any problems along the way. The fact of the matter is, it’s really hard to say.

\n

In most situations, using an excessive amount of plugins won’t cause any problems, but plugins use memory when they run, and shared hosting provider love to limit the memory that you can consume at any given moment. If you’re running into memory errors, there are a few things that you can try, but you should probably consider using less plugins or moving to a better host. Outside of hosting limitations, the number of plugins doesn’t play much of a role. We use 36 plugins here, and I have worked on a blog before that used 82, both without issue.

\n

If you’re running into other errors, that’s more than likely just one plugin with nothing to do whatsoever with the amount of plugins you’re using. As long as you continue to use the offending plugin, you’d see the same errors with 2 plugins as you would with 200.

\n

The real question here is, do you need all of those plugins? It might be time to do some spring cleaning.

\n

Are you using a plugin to loads a chatroom in your sidebar? Has that chatroom been used once in the last month? If not, it’s probably time to get rid of that plugin. Do you use a plugin to display a gallery on your blog? WordPress has had built-in gallery support for over three years, so it might be time to get rid of that plugin too. Do you use Simple Facebook Connect to automatically post to Facebook, but use another plugin to add a Facebook Like button to your posts? Well, Simple Facebook Connect can add a Like button too, so you might as well get rid of that second plugin. And, like Simple Facebook Connect and Jetpack, there are plenty of good plugins out there which can probably take the place of more than one plugin on your blog.

\n

The number of plugins you use really doesn’t have much of on an impact on your blog (unless you’re running into hosting limitations), but it can’t hurt to clean things up once a year or so.

\n";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:7:"pubDate";a:1:{i:0;a:5:{s:4:"data";s:31:"Fri, 23 Sep 2011 13:00:56 +0000";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:32:"http://purl.org/dc/elements/1.1/";a:1:{s:7:"creator";a:1:{i:0;a:5:{s:4:"data";s:10:"James Huff";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}i:2;a:6:{s:4:"data";s:13:"\n \n \n \n \n \n \n";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:2:{s:0:"";a:5:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:42:"WPTavern: bbPress 2.0 Stable Now Available";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"guid";a:1:{i:0;a:5:{s:4:"data";s:31:"http://www.wptavern.com/?p=5462";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:94:"http://feedproxy.google.com/~r/WordpressTavern/~3/rPBGL04BvEQ/bbpress-2-0-stable-now-available";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:3148:"

After a long time in development, bbPress 2.0 stable has been given the green light. While new version releases are exciting, this particular one for bbPress is especially so as it is a total rethink of how bbPress runs, integrates, and functions as a forums plugin instead of stand-alone software. If you’re already using an established bbPress install, moving into the plugin version of bbPress is as simple as importing your content from one to the other. John James Jacoby describes the move as follows:

\n

If you already have a previous version installed, updating to 2.0 is easy with the bbPress Importer. Move your bbPress 1.0 powered content into your new WordPress/bbPress installation and you’re ready to go. (There is already a migration plugin in the works for other forum software that promises to be pretty amazing, too!)

\n

I’m particularly interested in seeing what the migration plugin will be like as I’m currently using vBulletin to handle the forum side of the Tavern. I really like what vBulletin offers out of the box and I’ve been pretty pleased with it since I began using it for the site. However, I’ve reached a point where I’d like to switch over just to see what it’s like while at the same time, offer me an opportunity to write about bbPress more often from an end user perspective. One of the best things about bbPress is the ease in which it takes to make it look similar if not exactly like the WordPress theme in use.

\n

It’s encouraging to see that since the release of bbPress 2.0, there will be more work dedicated to the surrounding ecosystem such as the website, the addition of a bbPress focused Codex, and the official bbPress forum. While giving the 2.0 version a try, I noticed that you can’t browse the bbPress plugin repository and install plugins like you can with WordPress. I hope that at some point in the future, I can expect the same user experience out of bbPress that I currently get out of WordPress.

\n\n\n

Related posts:

  1. Why I Use VBulletin
  2. \n
  3. Why bbPress Is Good For SEO
  4. \n
  5. Listener Poll: Do You Think bbPress Will Evolve Into A WordPress Plugin?
  6. \n

";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:7:"pubDate";a:1:{i:0;a:5:{s:4:"data";s:31:"Fri, 23 Sep 2011 13:00:00 +0000";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:32:"http://purl.org/dc/elements/1.1/";a:1:{s:7:"creator";a:1:{i:0;a:5:{s:4:"data";s:6:"Jeffro";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}i:3;a:6:{s:4:"data";s:13:"\n \n \n \n \n \n \n";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:2:{s:0:"";a:5:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:62:"WordPress.tv: Doug Yuen: Improving Your WordPress Productivity";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"guid";a:1:{i:0;a:5:{s:4:"data";s:27:"http://wordpress.tv/?p=6872";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:79:"http://wordpress.tv/2011/09/22/doug-yuen-improving-your-wordpress-productivity/";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:1836:"
\n
\n
Doug Yuen: Improving Your WordPress Productivity
";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:7:"pubDate";a:1:{i:0;a:5:{s:4:"data";s:31:"Fri, 23 Sep 2011 05:05:06 +0000";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:32:"http://purl.org/dc/elements/1.1/";a:1:{s:7:"creator";a:1:{i:0;a:5:{s:4:"data";s:15:"WordCamp Boston";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}i:4;a:6:{s:4:"data";s:13:"\n \n \n \n \n \n \n";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:2:{s:0:"";a:5:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:95:"WordPress.tv: Gregory Cornelius & Scott Dasse: Synchronizing Creativity with Content Management";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"guid";a:1:{i:0;a:5:{s:4:"data";s:27:"http://wordpress.tv/?p=6897";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:110:"http://wordpress.tv/2011/09/22/gregory-cornelius-scott-dasse-synchronizing-creativity-with-content-management/";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:1911:"
\n
\n
Gregory Cornelius & Scott Dasse: Synchronizing Creativity with Content Management
";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:7:"pubDate";a:1:{i:0;a:5:{s:4:"data";s:31:"Thu, 22 Sep 2011 23:00:29 +0000";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:32:"http://purl.org/dc/elements/1.1/";a:1:{s:7:"creator";a:1:{i:0;a:5:{s:4:"data";s:15:"WordCamp Boston";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}i:5;a:6:{s:4:"data";s:13:"\n \n \n \n \n \n \n";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:2:{s:0:"";a:5:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:67:"WPTavern: Sara Cannon On Responsive Web Design From WordCamp Boston";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"guid";a:1:{i:0;a:5:{s:4:"data";s:31:"http://www.wptavern.com/?p=5459";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:119:"http://feedproxy.google.com/~r/WordpressTavern/~3/pVDM5jf5btw/sara-cannon-on-responsive-web-design-from-wordcamp-boston";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:2063:"

Within the past few weeks, I’ve noticed the term ‘Responsive‘ showing up everywhere, especially as it relates to WordPress 3.3 and the administrative area. Having no idea what this term meant, I got in touch with Sara Cannon to figure it out. Unfortunately (or fortunately), she is pretty busy helping with making the back-end of WordPress 3.3 responsive. So the next best thing is her presentation from WordCamp Boston on optimizing a WordPress site for multiple devices. To make a long story short, having a responsive designed WordPress site means it will look good across multiple screen dimensions without the need for plugins or weird tricks. The webpage responds to look correct within the confines of the devices screen. It’s not about designing one site that is pixel perfect on a 30 inch monitor. It’s about designing a website that can be fluid enough to look great on an iPad, 30 inch screen, or an iPhone. After watching the presentation, I can see why this is a cool technique. Perhaps with WordPress 3.3, we’ll be able to login with our iPhones and be able to easily navigate and administrate our websites much easier through the phone rather than through a specific app. I recommend viewing the video in full screen mode as it’s difficult to see the slides.

\n
\n\n\n

Related posts:

  1. Interview With Paul Mycroft On The Erosion Of His Web Design Business
  2. \n
  3. Hasty Mistake With WP2.8 Header Design Challenge
  4. \n

";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:7:"pubDate";a:1:{i:0;a:5:{s:4:"data";s:31:"Thu, 22 Sep 2011 17:00:01 +0000";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:32:"http://purl.org/dc/elements/1.1/";a:1:{s:7:"creator";a:1:{i:0;a:5:{s:4:"data";s:6:"Jeffro";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}i:6;a:6:{s:4:"data";s:13:"\n \n \n \n \n \n \n";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:2:{s:0:"";a:5:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:44:"WPTavern: Plugin Quality Not Plugin Quantity";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"guid";a:1:{i:0;a:5:{s:4:"data";s:31:"http://www.wptavern.com/?p=5454";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:96:"http://feedproxy.google.com/~r/WordpressTavern/~3/OetOSHEl5iE/plugin-quality-not-plugin-quantity";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:6656:"

Ryan Imel of WPCandy.com has published an editorial that has sparked yet another good discussion. This time, the focus is on the misnomer that it’s better to keep your active plugin count as low as possible to avoid problems.

\n

I’ve been down this road before. In at least a couple of the WordCamps I’ve attended where we discussed plugins, I would tell folks that I had almost 30 active plugins running on WPTavern.com. Judging by their reaction, you’d think I just dropped a bomb on them. In my defense, those 30 or so plugins enabled me to have the functionality I wanted within a WordPress installation. For the most part, these plugins have caused me 0 problems. The total number of active plugins has varied between more than 30 and less than 25 over the past four years but I’ve never had more than 35 activated at one time. After 4 years of using WordPress, my activated plugin count has remained nearly the same for two reasons. The first is that I’m pretty content with the functionality I have. The second is that I’m not the adventurous type who likes to try every plugin known to man.

\n

The funny thing about this discussion is that, you could have 3 plugins activated with one of those causing your site to hang. Or, you could have 25 and your site loads in less than 3 seconds. As Ryan mentions, the number of activated plugins doesn’t matter so much as the quality of the code within them. This conclusion leads us into an entirely different subset of circumstances. For instance, how do you judge the quality of a plugin before installation? How does one know if a particular plugin doesn’t play nice with some other plugin? Are we to sit here and expect end users to know good code from bad? From my perspective, if I activate a plugin and it provides the functionality it says it does, I generally don’t go under the hood to see how it’s done, just as long as it’s done without any apparent issues.

\n

In a perfect world, we should be able to activate 100 different plugins from a variety of different authors and have them all work seamlessly without any problems. But this isn’t a perfect world. It’s open source. It’s the wild wild west of coding. Sure, there are coding standards for WordPress, but not everyone is going to follow them. Not everyone is going to do things the way they should be done because it’s an open world. A plugin review team that works similarly to the theme review team is non-existent allowing plugins that don’t have malicious code into the repository regardless of their code quality. So how does this problem end up getting solved for everyone involved? It doesn’t. We can continue to educate both users and developers until the cows come home but the very nature of how things work in this open source environment allows for bad code quality to happen. It’s the nature of the beast. I think that over time, the problem can become less of an issue but it will never go away. Not unless some major crackdown starts happening on the plugin repository. Educating plugin authors is a good way to treat one of the symptoms of the overall problem but screening code before it gets past the pearly gates of the repository into the hands of users is the only way to truly solve the problem. Just like the theme review team, until a plugin reaches certain quality criteria, it can not be allowed to be hosted on the repository. It may sound bad, but the repository gate keepers would be the ones educating plugin authors before their code is accepted so in the end, it would be win-win situation.

\n

This could cause some plugin fragmentation in terms of where people go to get their plugins but that has existed for years. It might even cause a backlash similar if not, worse than the one generated from implementing the theme review team. But at the end of the day, something like this is good for end users all around. There certainly would be no guarantees that everything will work seamlessly after the team is put together but what it would be doing is increasing the odds of that happening in the future. It would also increase the number of plugins hosted on the repository that can be used as examples of plugins that did things the right way.

\n

However, a plugin review team introduces it’s own complexities such as how many people will be on the team, will only new plugins be screened or all plugins pushing updates to the repository, will these volunteers be paid etc. The funny thing is, if only new plugins were screened on the repository, it would mean that potentially down the road, an update to that plugin would introduce shoddy code which in turn would break someones site.

\n

After thinking about all of this, I start to wonder if it’s a case of “just can’t win“. Perhaps it’s best to educate users and developers as best we can and hope for the best?

\n

Related But Not Required Reading:

\n

Validating Plugins
\nQuality Check Your WordPress Plugins
\nFinding Quality WordPress Plugins
\nWordPress Plugins: How To Know If You Have Too Many

\n\n\n

Related posts:

  1. Plugin Repository Now Supports Videos
  2. \n
  3. Plugin Code Repository Bookmarklet
  4. \n
  5. Please Adopt This Plugin – Comment Quicktags Reloaded
  6. \n

";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:7:"pubDate";a:1:{i:0;a:5:{s:4:"data";s:31:"Thu, 22 Sep 2011 14:15:23 +0000";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:32:"http://purl.org/dc/elements/1.1/";a:1:{s:7:"creator";a:1:{i:0;a:5:{s:4:"data";s:6:"Jeffro";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}i:7;a:6:{s:4:"data";s:13:"\n \n \n \n \n \n \n";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:2:{s:0:"";a:5:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:58:"Weblog Tools Collection: WordPress Theme Releases for 9/22";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"guid";a:1:{i:0;a:5:{s:4:"data";s:41:"http://weblogtoolscollection.com/?p=10507";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:73:"http://feedproxy.google.com/~r/weblogtoolscollection/UXMP/~3/ckb_zipZFu4/";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:1602:"

\n

gazpoMag is a clean and featured-rich magazine style theme.

\n

\n

Girly Girl has fluid width, two columns, left sidebar, is widget ready, has valid XHTML, and features feminine colors like rose pink, gray, and lime green.

\n

\n

Insomnia is great for online magazines and personal blogs.

\n

\n

PhotoClick is a one column theme for photography and personal blogs, with a three column widget-ready footer.

\n";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:7:"pubDate";a:1:{i:0;a:5:{s:4:"data";s:31:"Thu, 22 Sep 2011 13:00:58 +0000";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:32:"http://purl.org/dc/elements/1.1/";a:1:{s:7:"creator";a:1:{i:0;a:5:{s:4:"data";s:10:"James Huff";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}i:8;a:6:{s:4:"data";s:13:"\n \n \n \n \n \n \n";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:2:{s:0:"";a:5:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:84:"WordPress.tv: Chris Penn: How to Market Your Blog (okay, Mom’s reading, now what?)";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"guid";a:1:{i:0;a:5:{s:4:"data";s:27:"http://wordpress.tv/?p=6721";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:102:"http://wordpress.tv/2011/09/22/chris-penn-how-to-market-your-blog-okay-mom%e2%80%99s-reading-now-what/";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:1866:"
\n
\n
Chris Penn: How to Market Your Blog (okay, Mom’s reading, now what?)
";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:7:"pubDate";a:1:{i:0;a:5:{s:4:"data";s:31:"Thu, 22 Sep 2011 05:55:40 +0000";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:32:"http://purl.org/dc/elements/1.1/";a:1:{s:7:"creator";a:1:{i:0;a:5:{s:4:"data";s:15:"WordCamp Boston";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}i:9;a:6:{s:4:"data";s:13:"\n \n \n \n \n \n \n";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:2:{s:0:"";a:5:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:98:"WordPress.tv: Sara Cannon: Theming & Mobile – Optimizing your WordPress site for Various Devices";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"guid";a:1:{i:0;a:5:{s:4:"data";s:27:"http://wordpress.tv/?p=6821";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:109:"http://wordpress.tv/2011/09/22/sara-cannon-theming-mobile-optimizing-your-wordpress-site-for-various-devices/";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:1941:"
\n
\n
Sara Cannon: Theming & Mobile – Optimizing your WordPress site for Various Devices
";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:7:"pubDate";a:1:{i:0;a:5:{s:4:"data";s:31:"Thu, 22 Sep 2011 04:52:49 +0000";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:32:"http://purl.org/dc/elements/1.1/";a:1:{s:7:"creator";a:1:{i:0;a:5:{s:4:"data";s:15:"WordCamp Boston";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}i:10;a:6:{s:4:"data";s:13:"\n \n \n \n \n \n \n";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:2:{s:0:"";a:5:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:42:"WordPress.tv: C. C. Chapman: Content Rules";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"guid";a:1:{i:0;a:5:{s:4:"data";s:27:"http://wordpress.tv/?p=6843";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:57:"http://wordpress.tv/2011/09/22/c-c-chapman-content-rules/";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:1767:"
\n
\n
C. C. Chapman: Content Rules
";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:7:"pubDate";a:1:{i:0;a:5:{s:4:"data";s:31:"Thu, 22 Sep 2011 03:49:56 +0000";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:32:"http://purl.org/dc/elements/1.1/";a:1:{s:7:"creator";a:1:{i:0;a:5:{s:4:"data";s:15:"WordCamp Boston";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}i:11;a:6:{s:4:"data";s:13:"\n \n \n \n \n \n \n";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:2:{s:0:"";a:5:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:54:"WordPress.tv: Kyle Dickson: Mobile WordPress on Campus";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"guid";a:1:{i:0;a:5:{s:4:"data";s:27:"http://wordpress.tv/?p=6895";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:71:"http://wordpress.tv/2011/09/22/kyle-dickson-mobile-wordpress-on-campus/";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:1822:"
\n
\n
Kyle Dickson: Mobile WordPress on Campus
";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:7:"pubDate";a:1:{i:0;a:5:{s:4:"data";s:31:"Thu, 22 Sep 2011 02:48:21 +0000";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:32:"http://purl.org/dc/elements/1.1/";a:1:{s:7:"creator";a:1:{i:0;a:5:{s:4:"data";s:15:"WordCamp Boston";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}i:12;a:6:{s:4:"data";s:13:"\n \n \n \n \n \n \n";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:2:{s:0:"";a:5:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:58:"WordPress.tv: Jon Bishop: Creating Content With Shortcodes";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"guid";a:1:{i:0;a:5:{s:4:"data";s:27:"http://wordpress.tv/?p=6844";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:75:"http://wordpress.tv/2011/09/21/jon-bishop-creating-content-with-shortcodes/";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:1823:"
\n
\n
Jon Bishop: Creating Content With Shortcodes
";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:7:"pubDate";a:1:{i:0;a:5:{s:4:"data";s:31:"Wed, 21 Sep 2011 21:02:37 +0000";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:32:"http://purl.org/dc/elements/1.1/";a:1:{s:7:"creator";a:1:{i:0;a:5:{s:4:"data";s:15:"WordCamp Boston";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}i:13;a:6:{s:4:"data";s:13:"\n \n \n \n \n \n \n";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:2:{s:0:"";a:5:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:67:"WordPress.tv: Jake Goldman: Getting Started with WordPress as a CMS";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"guid";a:1:{i:0;a:5:{s:4:"data";s:27:"http://wordpress.tv/?p=6854";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:84:"http://wordpress.tv/2011/09/21/jake-goldman-getting-started-with-wordpress-as-a-cms/";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:1848:"
\n
\n
Jake Goldman: Getting Started with WordPress as a CMS
";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:7:"pubDate";a:1:{i:0;a:5:{s:4:"data";s:31:"Wed, 21 Sep 2011 19:50:04 +0000";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:32:"http://purl.org/dc/elements/1.1/";a:1:{s:7:"creator";a:1:{i:0;a:5:{s:4:"data";s:15:"WordCamp Boston";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}i:14;a:6:{s:4:"data";s:13:"\n \n \n \n \n \n \n";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:2:{s:0:"";a:5:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:45:"Weblog Tools Collection: bbPress 2.0 Released";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"guid";a:1:{i:0;a:5:{s:4:"data";s:41:"http://weblogtoolscollection.com/?p=10504";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:73:"http://feedproxy.google.com/~r/weblogtoolscollection/UXMP/~3/jVd5MmBHci0/";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:1515:"

bbPress 2.0 has been released. With BuddyPress 1.5 launching just a few hours earlier, this is a great day for major WordPress-extending plugins. That’s right, there’s no more complicated installation and integration instructions. bbPress is now a WordPress plugin, and it can easily integrate with Akismet and BuddyPress too.

\n

Simply by activating bbPress 2.0, any standard WordPress theme is suddenly capable of having support forums, user profiles, topic tags, and custom topic views. Your users are able to mark topics as favorites to read them later, and can subscribe to be notified via email to topic replies, so they never miss out on the conversation.

\n

If you’re currently using the old version of bbPress, this new version comes with a handy importer to get you started, and there are importers for other forum platforms planned for the future. If you run into any trouble, please feel free to contact the bbPress support forums.

\n";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:7:"pubDate";a:1:{i:0;a:5:{s:4:"data";s:31:"Wed, 21 Sep 2011 19:16:57 +0000";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:32:"http://purl.org/dc/elements/1.1/";a:1:{s:7:"creator";a:1:{i:0;a:5:{s:4:"data";s:10:"James Huff";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}i:15;a:6:{s:4:"data";s:13:"\n \n \n \n \n \n \n";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:2:{s:0:"";a:5:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:68:"WordPress.tv: Arwin Holmes: Enterprise WordPress Do’s and Don’ts";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"guid";a:1:{i:0;a:5:{s:4:"data";s:27:"http://wordpress.tv/?p=6857";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:79:"http://wordpress.tv/2011/09/21/arwin-holmes-enterprise-wordpress-dos-and-donts/";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:1847:"
\n
\n
Arwin Holmes: Enterprise WordPress Do’s and Don’ts
";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:7:"pubDate";a:1:{i:0;a:5:{s:4:"data";s:31:"Wed, 21 Sep 2011 18:51:30 +0000";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:32:"http://purl.org/dc/elements/1.1/";a:1:{s:7:"creator";a:1:{i:0;a:5:{s:4:"data";s:15:"WordCamp Boston";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}i:16;a:6:{s:4:"data";s:13:"\n \n \n \n \n \n \n";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:2:{s:0:"";a:5:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:25:"Matt: 40% of Time Traffic";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"guid";a:1:{i:0;a:5:{s:4:"data";s:21:"http://ma.tt/?p=39292";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:40:"http://ma.tt/2011/09/40-of-time-traffic/";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:403:"

At least 40% of TIME.com traffic is going through WordPress, probably more when you add up the non-vertical sites. Bummer they never mention WordPress in the original article.

";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:7:"pubDate";a:1:{i:0;a:5:{s:4:"data";s:31:"Wed, 21 Sep 2011 18:13:03 +0000";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:32:"http://purl.org/dc/elements/1.1/";a:1:{s:7:"creator";a:1:{i:0;a:5:{s:4:"data";s:4:"Matt";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}i:17;a:6:{s:4:"data";s:13:"\n \n \n \n \n \n \n";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:2:{s:0:"";a:5:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:110:"WordPress.tv: Andrew Nacin & Daryl Koopersmith: Lean. Agile. Mobile. Social. Local. Organic. Pivot. WordPress.";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"guid";a:1:{i:0;a:5:{s:4:"data";s:27:"http://wordpress.tv/?p=6868";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:117:"http://wordpress.tv/2011/09/21/andrew-nacin-daryl-koopersmith-lean-agile-mobile-social-local-organic-pivot-wordpress/";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:1939:"
\n
\n
Andrew Nacin & Daryl Koopersmith: Lean. Agile. Mobile. Social. Local. Organic. Pivot. WordPress.
";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:7:"pubDate";a:1:{i:0;a:5:{s:4:"data";s:31:"Wed, 21 Sep 2011 17:44:51 +0000";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:32:"http://purl.org/dc/elements/1.1/";a:1:{s:7:"creator";a:1:{i:0;a:5:{s:4:"data";s:15:"WordCamp Boston";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}i:18;a:6:{s:4:"data";s:13:"\n \n \n \n \n \n \n";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:2:{s:0:"";a:5:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:55:"WPTavern: New Feature Pointers Slated For WordPress 3.3";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"guid";a:1:{i:0;a:5:{s:4:"data";s:31:"http://www.wptavern.com/?p=5451";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:107:"http://feedproxy.google.com/~r/WordpressTavern/~3/zcWv6C3CLqg/new-feature-pointers-slated-for-wordpress-3-3";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:952:"

Theme.FM has a great writeup explaining one of the new features that is slated to arrive with WordPress 3.3 called Pointers. These pointers appear to show the end user some information related to a new feature. However, it looks as though in future versions of WordPress, there will be an API built around pointers which should allow plugin and theme authors to tap into it’s usefulness. If you don’t like the pointers feature, WPEngineer has an explanation as to how to disable it. Keep in mind though, that the information is based on the nightly build of WordPress so the implementation could be different later on.

\n\n\n

No related posts.

";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:7:"pubDate";a:1:{i:0;a:5:{s:4:"data";s:31:"Wed, 21 Sep 2011 17:38:47 +0000";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:32:"http://purl.org/dc/elements/1.1/";a:1:{s:7:"creator";a:1:{i:0;a:5:{s:4:"data";s:6:"Jeffro";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}i:19;a:6:{s:4:"data";s:13:"\n \n \n \n \n \n \n";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:2:{s:0:"";a:5:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:63:"Publisher Blog: TIME.com Running Verticals on WordPress.com VIP";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"guid";a:1:{i:0;a:5:{s:4:"data";s:43:"http://publisherblog.automattic.com/?p=1712";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:84:"http://publisherblog.automattic.com/2011/09/21/time-com-verticals-wordpress-com-vip/";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:3968:"

Great piece yesterday in paidcontent.org about how TIME.com is leveraging the WordPress.com VIP SaaS platform to run all their vertical sites. In the post TIME.com cites their internal Omniture numbers, stating that ” ..verticals drove 40 percent of total site visits in 2011.

\n

It’s great to see Techland, SwamplandBattleland, and other TIME.com verticals that run on WordPress.com VIP highlighted in this article:

\n

“In developing the vertical strategy, we decided to pinpoint areas of reader and advertiser interest, blow them out as mini-publications in their own right,” (Jim) Frederick (the site’s managing editor) said. “The idea was to get writers who can speak to Tech enthusiasts for Techland or personal finance fans at Moneyland, and forge new readerships, while still embracing our core audience and feeling familiar to our Time loyalists, too.””

\n

LightBox, an amazing photography blog that lives on WordPress.com VIP and then connects effortlessly to Twitter, Facebook, and Tumblr, is a great example of WordPress as a digital hub. TIME.com uses the WordPress site to draw in audiences from various services back to the core content.

\n

Nice work TIME.com team !

\n

\n

Ready to become a VIP Services Client? Some of the world’s biggest brands rely on WordPress.com VIP Services.

\n
";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:7:"pubDate";a:1:{i:0;a:5:{s:4:"data";s:31:"Wed, 21 Sep 2011 15:16:35 +0000";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:32:"http://purl.org/dc/elements/1.1/";a:1:{s:7:"creator";a:1:{i:0;a:5:{s:4:"data";s:10:"Sara Rosso";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}i:20;a:6:{s:4:"data";s:13:"\n \n \n \n \n \n \n";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:2:{s:0:"";a:5:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:48:"Weblog Tools Collection: BuddyPress 1.5 Released";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"guid";a:1:{i:0;a:5:{s:4:"data";s:41:"http://weblogtoolscollection.com/?p=10500";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:73:"http://feedproxy.google.com/~r/weblogtoolscollection/UXMP/~3/gPy9ximwQog/";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:1188:"

BuddyPress 1.5 has been released. With “hundreds of bug fixes, enhancements, and all-new features,” this is one of the largest updates that the WordPress-powered social networking platform has received in quite some time.

\n

Some highlights of this release include a new installation and update wizard, a new profile manager, integration with WordPress navigation menus, and a greatly improved default theme.

\n

Before upgrading, you may want to stop by this handy guide for some tips as well as plugin and theme compatibility reports. This release has been well tested over a few beta releases and release candidates, but if you run into any trouble, please feel free to contact the BuddyPress support forums.

\n";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:7:"pubDate";a:1:{i:0;a:5:{s:4:"data";s:31:"Wed, 21 Sep 2011 13:00:19 +0000";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:32:"http://purl.org/dc/elements/1.1/";a:1:{s:7:"creator";a:1:{i:0;a:5:{s:4:"data";s:10:"James Huff";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}i:21;a:6:{s:4:"data";s:13:"\n \n \n \n \n \n \n";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:2:{s:0:"";a:5:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:35:"bbPress: bbPress 2.0 now available!";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"guid";a:1:{i:0;a:5:{s:4:"data";s:25:"http://bbpress.org/?p=488";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:58:"http://bbpress.org/blog/2011/09/bbpress-2-0-now-available/";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:2582:"

In hot pursuit of BuddyPress 1.5 follows bbPress 2.0!

\n

No longer are the days of elaborate xml-rpc connections or impossible to figure-out cookie configurations! No more are the integration woes, complex theme arrangements, or separate dashboards! bbPress 2.0 represents a complete rethink of how to fit forums inside WordPress in the simplest, most elegant way possible.

\n

Simply by activating bbPress 2.0, any standard WordPress theme is suddenly capable of having support forums, user profiles, topic tags, and custom topic views. Your users are able to mark topics as favorites to read them later, and can subscribe to be notified via email to topic replies, so they never miss out on the conversation.

\n

bbPress 2.0 comes with Akismet and BuddyPress functionalities baked-in, so if you’re already using either plugin, no additional configuration is required.

\n

If you already have a previous version installed, updating to 2.0 is easy with the bbPress Importer. Move your bbPress 1.0 powered content into your new WordPress/bbPress installation and you’re ready to go. (There is already a migration plugin in the works for other forum software that promises to be pretty amazing, too!)

\n

If you’d like to see bbPress 2.0 in action, a few brave developers have been using it on their live sites already:

\n\n

In the coming weeks we’ll be moving our own forums onto bbPress 2.0, adding a codex to improve the documentation, and doing some general housekeeping here at bbpress.org. We’ve put a lot of work into rebuilding the software, now it’s time to rebuild the site to properly support it!

\n

Props for 2.0 go out to: andy, anointed, boonebgorges, christopher-jon, Coolkevman, cnorris23, dimadin, DJPaul, duck_, dudd, Fartlek, GautamGupta, greenshady, jaredatch, jghazally, Jason K, Kaspace, markmcwilliams, mouratidis, nacin, Nightgunner5, petemall, ryangannon, ryanimel, ramiy, scribu, schrepel, sorich87, vanillalounge, Viper007Bond, westi, and wonderboymusic.

\n

Download bbPress 2.0

";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:7:"pubDate";a:1:{i:0;a:5:{s:4:"data";s:31:"Wed, 21 Sep 2011 08:42:31 +0000";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:32:"http://purl.org/dc/elements/1.1/";a:1:{s:7:"creator";a:1:{i:0;a:5:{s:4:"data";s:17:"John James Jacoby";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}i:22;a:6:{s:4:"data";s:13:"\n \n \n \n \n \n \n";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:2:{s:0:"";a:5:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:97:"WordPress.tv: Jonathan May: Helping Your Small Business Client Take On Maintaining Their Own Site";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"guid";a:1:{i:0;a:5:{s:4:"data";s:27:"http://wordpress.tv/?p=6852";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:114:"http://wordpress.tv/2011/09/20/jonathan-may-helping-your-small-business-client-take-on-maintaining-their-own-site/";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:1903:"
\n
\n
Jonathan May: Helping Your Small Business Client Take On Maintaining Their Own Site
";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:7:"pubDate";a:1:{i:0;a:5:{s:4:"data";s:31:"Tue, 20 Sep 2011 23:50:13 +0000";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:32:"http://purl.org/dc/elements/1.1/";a:1:{s:7:"creator";a:1:{i:0;a:5:{s:4:"data";s:15:"WordCamp Boston";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}i:23;a:6:{s:4:"data";s:13:"\n \n \n \n \n \n \n";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:2:{s:0:"";a:5:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:51:"WP Android: Version 1.5: Follow your Favorite Blogs";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"guid";a:1:{i:0;a:5:{s:4:"data";s:35:"http://android.wordpress.org/?p=439";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:52:"http://android.wordpress.org/2011/09/20/version-1-5/";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:4135:"

The new Read feature in action.

\n

Today we released Version 1.5 of WordPress for Android to the Android Market, which makes it effortless to keep up with your favorite blogs and sites while on the go.

\n

If you’ve connected one of your WordPress.com blogs with the app, you’ll now see a ‘Read’ button at the bottom of your blogs list. Clicking it will display all the latest posts published on the blogs that you follow, along with the option to like or reblog them. You can even follow blogs and sites that aren’t on WordPress.com, as long as they have an RSS feed.

\n

Sweet! How do I add more sites to my reader?

\n

\n

Tap the “Follow” button while viewing any WordPress.com blog (you’ll find it in the top admin bar while logged in) to add it to your reader. To add a site that’s not on WordPress.com, simply enter the URL of the site at the top of your following list and then click ‘Follow’.

\n

Not following any blogs yet? Check out today’s Freshly Pressed to browse some that you might like.

\n

What else is new?

\n

We’ve tweaked a few things here and there in the app, including using the HTML5 video tag for video uploads instead of the outdated QuickTime tag. There are also a handful of bug fixes in Version 1.5 that improve the app’s reliability.

\n

What’s next for WordPress for Android?

\n

We’re excited to let you know that work has already begun on the next major update to WordPress for Android – Version 2.0. It’s going to have a beautiful new look and will be stuffed with awesome new features. For updates on Version 2.0, check out our Developer Blog. And if you have any feedback on Version 1.5 and the new Read feature, be sure to let us know!

\n

Follow @WPAndroid on Twitter for the latest news.

\n
";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:7:"pubDate";a:1:{i:0;a:5:{s:4:"data";s:31:"Tue, 20 Sep 2011 13:35:39 +0000";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:32:"http://purl.org/dc/elements/1.1/";a:1:{s:7:"creator";a:1:{i:0;a:5:{s:4:"data";s:3:"Dan";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}i:24;a:6:{s:4:"data";s:13:"\n \n \n \n \n \n \n";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:2:{s:0:"";a:5:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:59:"Weblog Tools Collection: WordPress Plugin Releases for 9/20";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"guid";a:1:{i:0;a:5:{s:4:"data";s:41:"http://weblogtoolscollection.com/?p=10498";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:73:"http://feedproxy.google.com/~r/weblogtoolscollection/UXMP/~3/4yceyJiZ3_U/";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:1050:"

New plugins

\n

PHPLeague allows you to to manage your sports leagues and can be used for many different sports like football (soccer), basketball, handball, volleyball and even ice-hockey.

\n

Updated plugins

\n

Google XML Sitemaps will generate a special XML sitemap which will help search engines to better index your blog.

\n

Posts 2 Posts allows you to create many-to-many connections between posts of all kinds.

\n

WP-Table Reloaded enables you to create and manage tables in your admin area. No HTML knowledge is needed.

\n";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:7:"pubDate";a:1:{i:0;a:5:{s:4:"data";s:31:"Tue, 20 Sep 2011 13:00:29 +0000";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:32:"http://purl.org/dc/elements/1.1/";a:1:{s:7:"creator";a:1:{i:0;a:5:{s:4:"data";s:10:"James Huff";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}i:25;a:6:{s:4:"data";s:13:"\n \n \n \n \n \n \n";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:2:{s:0:"";a:5:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:42:"Matt: Why Your Company Should Have a Creed";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"guid";a:1:{i:0;a:5:{s:4:"data";s:21:"http://ma.tt/?p=39282";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:38:"http://ma.tt/2011/09/automattic-creed/";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:5290:"

Does your company have a creed? Twice a year, True Ventures (one of Automattic’s investors) organizes an event called Founders’ Camp, a one-day conference for the founders and CEOs of companies in their portfolio. The latest was held in the Automattic Lounge at Pier 38 in San Francisco (it could be the last).

\n

There was an interesting conversation led by Ethan Diamond, Alex Bard, Howard Lindzon, and Narendra Rocherolle on the importance of culture in an organization and how it gets formed. Despite its importance, “culture” is one of those fuzzy things that’s difficult for many founders, especially men, to discuss earnestly.  Even though I have extremely strong opinions about company culture, I find it feels “corny” to talk about it directly. Nevertheless, as part of the discussion, I shared the following practical example from Automattic about something we did to codify and share our values.

\n

It started innocently enough — someone copied me when they emailed their paperwork to accept a job offer. For the first time in a while I looked at the offer letter and realized that it read like a bad generic legal template: no branding; terrible typography; the most important information (start date, salary, stock options) buried under a sea of text; and, worst of all, it was being sent out in .docx format (especially embarrassing for a company whose foundation is Open Source). The offer didn’t reflect who we were, how we worked, and certainly not how we thought about design and user experience.

\n

Nick and MT of the Janitorial team at Automattic designed new documents and worked out a clever way to have a web form on our intranet generate the pages as HTML. It has some extra goodies like vector signatures. Anybody sending a contract or offer can create a PDF out of that web page, and email the document out to the recipient. Everything is logged and tracked. (As a bonus our legal templates for employees and contractors are now tracked in SVN along with the rest of our code.)

\n

Finally, as a hack to introduce new folks to our culture, we put a beta “Automattic Creed”, basically a statement of things important to us, written in the first person. We put it after the legal gobbledygook and before the signature area; if you chose to accept the offer, you’d sign your name next to the values before starting work. This seemed like a powerful statement and might affect people’s perceptions in the same way that putting signatures at the top of forms increases honesty.

\n

That was around the beginning of May last year, and everyone who has joined since then (about half the company) has gotten the creed in their offer letter. The feedback from the beta was excellent and later that same month we added the creed to the home page of our Automattic Field Guide (our internal reference site), where it still lives today with a link to a recent discussion about what the creed means in practice.

\n

Adding the creed before the signature block ended up being an easy change that had a big impact on the company.

\n

A fair number of founders at the event have asked what the creed is. If you’re curious here it is (as of September 19th, 2011):

\n

I will never stop learning. I won’t just work on things that are assigned to me. I know there’s no such thing as a status quo. I will build our business sustainably through passionate and loyal customers. I will never pass up an opportunity to help out a colleague, and I’ll remember the days before I knew everything. I am more motivated by impact than money, and I know that Open Source is one of the most powerful ideas of our generation. I will communicate as much as possible, because it’s the oxygen of a distributed company. I am in a marathon, not a sprint, and no matter how far away the goal is, the only way to get there is by putting one foot in front of another every day. Given time, there is no problem that’s insurmountable.

\n

I’m sure that it will evolve in the future, just as Automattic and WordPress will. If you’re building a startup or any sort of organization, take a few moments to reflect on the qualities that the people you most enjoy working with embody and the user experience of new people joining your organization, from the offer letter to their first day.

\n

Of course if you’d like to see the above in an offer letter, consider applying for Automattic.

\n

If you write a creed for your company or non-profit after reading this, please leave it in the comments!

";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:7:"pubDate";a:1:{i:0;a:5:{s:4:"data";s:31:"Tue, 20 Sep 2011 02:23:56 +0000";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:32:"http://purl.org/dc/elements/1.1/";a:1:{s:7:"creator";a:1:{i:0;a:5:{s:4:"data";s:4:"Matt";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}i:26;a:6:{s:4:"data";s:13:"\n \n \n \n \n \n \n";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:2:{s:0:"";a:5:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:33:"Matt: Silicon Valleys Rental Boom";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"guid";a:1:{i:0;a:5:{s:4:"data";s:21:"http://ma.tt/?p=39279";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:49:"http://ma.tt/2011/09/silicon-valleys-rental-boom/";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:580:"

It’s not only about the money, says Matt Mullenweg, a techie who helped create the popular WordPress blogging software and has invested in Getaround. Some of this is about “my generation’s desire to conserve resources and make better use of what we have to leave the world a better place for our children.”

\n

Silicon Valleys Rental Boom on The Daily Beast by Dan Lyons.

";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:7:"pubDate";a:1:{i:0;a:5:{s:4:"data";s:31:"Mon, 19 Sep 2011 20:57:48 +0000";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:32:"http://purl.org/dc/elements/1.1/";a:1:{s:7:"creator";a:1:{i:0;a:5:{s:4:"data";s:4:"Matt";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}i:27;a:6:{s:4:"data";s:13:"\n \n \n \n \n \n \n";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:2:{s:0:"";a:5:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:61:"WordPress.tv: John Resig: jQuery Performance and New Features";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"guid";a:1:{i:0;a:5:{s:4:"data";s:27:"http://wordpress.tv/?p=6870";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:78:"http://wordpress.tv/2011/09/19/john-resig-jquery-performance-and-new-features/";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:1843:"
\n
\n
John Resig: jQuery Performance and New Features
";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:7:"pubDate";a:1:{i:0;a:5:{s:4:"data";s:31:"Mon, 19 Sep 2011 17:15:17 +0000";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:32:"http://purl.org/dc/elements/1.1/";a:1:{s:7:"creator";a:1:{i:0;a:5:{s:4:"data";s:15:"WordCamp Boston";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}i:28;a:6:{s:4:"data";s:13:"\n \n \n \n \n \n \n";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:2:{s:0:"";a:5:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:78:"WordPress.tv: Christina Dulude: Simplifying Your Life with WordPress Multisite";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"guid";a:1:{i:0;a:5:{s:4:"data";s:27:"http://wordpress.tv/?p=6896";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:95:"http://wordpress.tv/2011/09/19/christina-dulude-simplifying-your-life-with-wordpress-multisite/";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:1875:"
\n
\n
Christina Dulude: Simplifying Your Life with WordPress Mulisite
";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:7:"pubDate";a:1:{i:0;a:5:{s:4:"data";s:31:"Mon, 19 Sep 2011 16:56:55 +0000";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:32:"http://purl.org/dc/elements/1.1/";a:1:{s:7:"creator";a:1:{i:0;a:5:{s:4:"data";s:15:"WordCamp Boston";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}i:29;a:6:{s:4:"data";s:13:"\n \n \n \n \n \n \n";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:2:{s:0:"";a:5:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:114:"WordPress.tv: Andrew Norcross: You’re doing it wrong and it’s all my fault: dissecting the client relationship";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"guid";a:1:{i:0;a:5:{s:4:"data";s:27:"http://wordpress.tv/?p=6901";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:142:"http://wordpress.tv/2011/09/19/andrew-norcross-you%e2%80%99re-doing-it-wrong-and-it%e2%80%99s-all-my-fault-dissecting-the-client-relationship/";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:1934:"
\n
\n
Andrew Norcross: You’re doing it wrong and it’s all my fault: dissecting the client relationship
";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:7:"pubDate";a:1:{i:0;a:5:{s:4:"data";s:31:"Mon, 19 Sep 2011 16:47:50 +0000";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:32:"http://purl.org/dc/elements/1.1/";a:1:{s:7:"creator";a:1:{i:0;a:5:{s:4:"data";s:15:"WordCamp Boston";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}i:30;a:6:{s:4:"data";s:13:"\n \n \n \n \n \n \n";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:2:{s:0:"";a:5:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:48:"Alex King: wp_publish_post() Does Not Set post_*";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"guid";a:1:{i:0;a:5:{s:4:"data";s:27:"http://alexking.org/?p=7260";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:70:"http://alexking.org/blog/2011/09/19/wp_publish_post-does-not-set-post_";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:2125:"

The inline documentation for wp_publish_post() says that it will:

\n

Publish a post by transitioning the post status.

\n

and that’s exactly what it does. Moreover, that’s all it does.

\n

If you are creating a draft post via wp_insert_post() (or wp_update_post(), which calls wp_insert_post()), certain defaults will be set for you when the post status is set to publish (or future, etc.). Among these is the automatic creation of the post_name from the post_title (if none has been explicitly provided) and setting post_date_gmt.

\n

I had some code on my site that was hitting a service to get data, creating a draft, adding some meta data and taxonomy information, then publishing it. When I was initially doing this (and using wp_publish_post() instead of wp_update_post()), I was ending up with published, unnamed posts. Not what I had in mind.

\n

There are two ways around this:

\n
    \n
  1. Use wp_update_post() instead of wp_publish_post(). This works fine, but it’s a little heavier, and conceptually I think the code reads better with the wp_publish_post() call instead.
  2. \n
  3. Use wp_publish_post(), but make sure to set the post_name, post_date_gmt, etc. when you create your draft post via wp_insert_post().
  4. \n
\n

For what it’s worth, I was using wp_update_post(), switched to wp_publish_post() because it seemed cleaner, and have since gone back to wp_update_post(). Using less of my own code and letting WordPress core code do more work for me feels more future-proof.

\n

Hopefully this is useful to someone else who starts digging through the code and is having trouble deciding which of the various functions to use.

";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:7:"pubDate";a:1:{i:0;a:5:{s:4:"data";s:31:"Mon, 19 Sep 2011 15:44:20 +0000";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:32:"http://purl.org/dc/elements/1.1/";a:1:{s:7:"creator";a:1:{i:0;a:5:{s:4:"data";s:4:"Alex";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}i:31;a:6:{s:4:"data";s:13:"\n \n \n \n \n \n \n";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:2:{s:0:"";a:5:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:22:"Matt: Design at Amazon";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"guid";a:1:{i:0;a:5:{s:4:"data";s:21:"http://ma.tt/?p=39276";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:38:"http://ma.tt/2011/09/design-at-amazon/";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:293:"

Amazon is hiring designers and using WordPress to do so. Update: Site is down, anyone know what happened? I wonder if it wasn’t meant to be public. Update 2: Now it’s back.

";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:7:"pubDate";a:1:{i:0;a:5:{s:4:"data";s:31:"Sun, 18 Sep 2011 19:08:59 +0000";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:32:"http://purl.org/dc/elements/1.1/";a:1:{s:7:"creator";a:1:{i:0;a:5:{s:4:"data";s:4:"Matt";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}i:32;a:6:{s:4:"data";s:13:"\n \n \n \n \n \n \n";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:2:{s:0:"";a:5:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:58:"Weblog Tools Collection: WordPress Theme Releases for 9/18";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"guid";a:1:{i:0;a:5:{s:4:"data";s:41:"http://weblogtoolscollection.com/?p=10492";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:73:"http://feedproxy.google.com/~r/weblogtoolscollection/UXMP/~3/KWdGDqoHRBY/";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:1204:"

\n

Cash is designed for blogs of a financial nature.

\n

\n

Neo_WDL has featured posts, social icons, twitter updates, threaded comments and widget support.

\n

\n

SimpleBlogger is an easy to use, lightweight, yet advance theme that can be easily customized to make your own.

\n";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:7:"pubDate";a:1:{i:0;a:5:{s:4:"data";s:31:"Sun, 18 Sep 2011 13:00:24 +0000";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:32:"http://purl.org/dc/elements/1.1/";a:1:{s:7:"creator";a:1:{i:0;a:5:{s:4:"data";s:10:"James Huff";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}i:33;a:6:{s:4:"data";s:13:"\n \n \n \n \n \n \n";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:2:{s:0:"";a:5:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:55:"Joseph: Slides: Site Performance, From Pinto to Ferrari";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"guid";a:1:{i:0;a:5:{s:4:"data";s:30:"http://josephscott.org/?p=4782";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:86:"http://josephscott.org/archives/2011/09/slides-site-performance-from-pinto-to-ferrari/";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:689:"

Here are the slides from my “Site Performance, From Pinto to Ferrari” talk that I gave at WordCamp SLC 2011 and Wordcamp Albuquerque 2011.

\n
Site Performance – From Pinto to Ferrari \n
View more presentations from Joseph Scott
\n

";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:7:"pubDate";a:1:{i:0;a:5:{s:4:"data";s:31:"Sat, 17 Sep 2011 17:34:56 +0000";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:32:"http://purl.org/dc/elements/1.1/";a:1:{s:7:"creator";a:1:{i:0;a:5:{s:4:"data";s:12:"Joseph Scott";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}i:34;a:6:{s:4:"data";s:13:"\n \n \n \n \n \n \n";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:2:{s:0:"";a:5:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:59:"Weblog Tools Collection: WordPress Plugin Security Showdown";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"guid";a:1:{i:0;a:5:{s:4:"data";s:41:"http://weblogtoolscollection.com/?p=10487";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:73:"http://feedproxy.google.com/~r/weblogtoolscollection/UXMP/~3/YD9QC1O6SU0/";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:1109:"

It’s the weekend, time to work on your next WordPress plugin, but are you following the right security practices? At this year’s WordCamp San Francisco, core developers Mark Jaquith and Jon Cave, along with developer and author Brad Williams, covered some of the best security practices for plugin development and offered some real-life examples of just how easy it is to turn a world-class plugin into a crippling vulnerability.

\n

“One of the greatest things about WordPress plugins is they can do anything, and one of the most frightening things about WordPress plugins is they can do anything.” ~ Mark Jaquith

\n
\n";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:7:"pubDate";a:1:{i:0;a:5:{s:4:"data";s:31:"Sat, 17 Sep 2011 13:00:39 +0000";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:32:"http://purl.org/dc/elements/1.1/";a:1:{s:7:"creator";a:1:{i:0;a:5:{s:4:"data";s:10:"James Huff";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}i:35;a:6:{s:4:"data";s:13:"\n \n \n \n \n \n \n";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:2:{s:0:"";a:5:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:39:"WPTavern: WordUp – A Fork Of WordCamp";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"guid";a:1:{i:0;a:5:{s:4:"data";s:31:"http://www.wptavern.com/?p=5438";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:87:"http://feedproxy.google.com/~r/WordpressTavern/~3/G1SxjKcYN0Y/wordup-a-fork-of-wordcamp";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:2035:"

If you’re anywhere near the Edinburgh area around October 22nd, make a pit stop to an event they are calling WordUp Edinburgh. According to the event website, this un-conference will mimic the WordCamp model in that there will be presentations with attendance being free. However, there are only going to be 50 spots available for this one day event. Congrats to those who purchased their tickets as all available spots have been sold. From taking a look at the attendee list, I’m happy to see that co-creator of WordPress, Mike Little, will be there along with one of my favorite commenters, Donnacha of WordSkill.com.

\n

With regards to the event name, what do you think of WordUp? Could this become the defacto name for independent WordCamp events not wanting to have to deal with all of the guidelines that come with using the trademarked term, WordCamp? At least with WordCamps, we generally have an idea as to what to expect out of the event thanks to longevity of the term being used as well as a tighter grip being placed on events using the name. So I leave you with this poll question.

\n
Note: There is a poll embedded within this post, please visit the site to participate in this post''s poll.
\n\n\n

Related posts:

  1. WordCamp Central Redesigned
  2. \n
  3. My Thoughts On The Virtual WordCamp
  4. \n
  5. WordCamp Hitting The Big Apple
  6. \n

";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:7:"pubDate";a:1:{i:0;a:5:{s:4:"data";s:31:"Sat, 17 Sep 2011 11:00:10 +0000";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:32:"http://purl.org/dc/elements/1.1/";a:1:{s:7:"creator";a:1:{i:0;a:5:{s:4:"data";s:6:"Jeffro";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}i:36;a:6:{s:4:"data";s:13:"\n \n \n \n \n \n \n";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:2:{s:0:"";a:5:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:24:"Matt: Theme Code Matters";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"guid";a:1:{i:0;a:5:{s:4:"data";s:21:"http://ma.tt/?p=39272";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:40:"http://ma.tt/2011/09/theme-code-matters/";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:124:"

Theme Code Matters, Too on Themeshaper.

";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:7:"pubDate";a:1:{i:0;a:5:{s:4:"data";s:31:"Sat, 17 Sep 2011 01:32:24 +0000";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:32:"http://purl.org/dc/elements/1.1/";a:1:{s:7:"creator";a:1:{i:0;a:5:{s:4:"data";s:4:"Matt";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}i:37;a:6:{s:4:"data";s:13:"\n \n \n \n \n \n \n";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:2:{s:0:"";a:5:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:41:"WPTavern: WordPress Mentioned On TheGuild";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"guid";a:1:{i:0;a:5:{s:4:"data";s:31:"http://www.wptavern.com/?p=5434";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:93:"http://feedproxy.google.com/~r/WordpressTavern/~3/vFNNEoucwj0/wordpress-mentioned-on-theguild";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:836:"

Not really WordPress news but it’s cool to hear a WordPress reference in the show, TheGuild. Fast forward to 9:03 to hear the WordPress remark. As an aside, I watched the entire episode and didn’t understand the show one bit. This was the first time I’ve watched TheGuild and since I’ve never played MMORPG games, I guess I don’t get any of the inside jokes.

\n
Video: Season 5 – Episode 8 – Social Traumas
\n\n\n

No related posts.

";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:7:"pubDate";a:1:{i:0;a:5:{s:4:"data";s:31:"Fri, 16 Sep 2011 20:00:39 +0000";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:32:"http://purl.org/dc/elements/1.1/";a:1:{s:7:"creator";a:1:{i:0;a:5:{s:4:"data";s:6:"Jeffro";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}i:38;a:6:{s:4:"data";s:13:"\n \n \n \n \n \n \n";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:2:{s:0:"";a:5:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:42:"WPTavern: WordPress Wins 2011 bOSSie Award";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"guid";a:1:{i:0;a:5:{s:4:"data";s:31:"http://www.wptavern.com/?p=5430";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:94:"http://feedproxy.google.com/~r/WordpressTavern/~3/4bzIDuJQM1o/wordpress-wins-2011-bossie-award";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:2106:"

WordPress can put yet another trophy on its mantle with a 2011 bOSSie award by InfoWorld within the Best Open Source Applications category. Confusingly, Drupal also won an award within the same category. Are the two pieces of software so different that they can be considered seperate entities with regards to what they enable the end user to accomplish? Don’t they both accomplish the same task but in their own way?

\n

2011 Bossie Logo

\n

As an aside to open source software, I thought this quote on TechnewsWorld made a good point.

\n

“I had a client that was unhappy because the robot he is helping design for a NASA competition at the local college just doesn’t have the level of lighting realism he wanted with Solidworks,” hairyfeet added. “So I just sent him to this link on the Blender wiki and voila! Thanks to FOSS and a volunteer that wrote the import scripts, he is happily having his robot rendering in photo realism by Blender.”

\n

That, in fact, “is what FOSS should be about — not about politics or factions, or all the GPL vs. BSD flamewars, but ‘can this software make someone’s day easier and/or better?’” hairyfeet concluded. “If it does, that is what makes good software to me.”

\n\n\n

No related posts.

";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:7:"pubDate";a:1:{i:0;a:5:{s:4:"data";s:31:"Fri, 16 Sep 2011 17:00:49 +0000";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:32:"http://purl.org/dc/elements/1.1/";a:1:{s:7:"creator";a:1:{i:0;a:5:{s:4:"data";s:6:"Jeffro";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}i:39;a:6:{s:4:"data";s:13:"\n \n \n \n \n \n \n";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:2:{s:0:"";a:5:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:63:"Publisher Blog: Animal Politico : WordPress Publisher Spotlight";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"guid";a:1:{i:0;a:5:{s:4:"data";s:43:"http://publisherblog.automattic.com/?p=1702";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:93:"http://publisherblog.automattic.com/2011/09/16/animal-politico-wordpress-publisher-spotlight/";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:4080:"

Reflection Media, a small web-design and development firm with a focus on WordPress Custom Solutions, was hired to implement the design and structure of the portal. They answered a few questions about Animal Politico and WordPress.

\n

Tell us about the site:
\n Animal Politico is a Mexican political portal. It’s only available online and is powered almost entirely by WordPress. Since its launch last Autumn, there are over 5000 articles and 44 sub-blogs out of which 3 sub-blogs are used as sort of a discussion forum.

\n

Other features include:

\n\n
\n

What publishing challenges did WordPress help Animal Politico address?
\nI think what was most needed by the editors was flexibility to post, sort and prioritize news articles. With the help of custom taxonomies and a few custom meta-boxes we were able to offer them just that without any problems. Price was also an issue and choosing WordPress as our platform considerably reduced the development expenses.

\n

What are your (development) team’s favorite WordPress features?
\nI think the flexibility we get from the hooks and filters system is what we love most. It provides almost unlimited flexibility without disrupting the update path.

\n

Are you a publisher working with WordPress? We want to hear from you

\n

Want WordPress for your site? Get.WP.com

\n
";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:7:"pubDate";a:1:{i:0;a:5:{s:4:"data";s:31:"Fri, 16 Sep 2011 16:00:28 +0000";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:32:"http://purl.org/dc/elements/1.1/";a:1:{s:7:"creator";a:1:{i:0;a:5:{s:4:"data";s:10:"Sara Rosso";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}i:40;a:6:{s:4:"data";s:13:"\n \n \n \n \n \n \n";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:2:{s:0:"";a:5:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:46:"WPTavern: WPWeekly Episode 112 – Kickstarted";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"guid";a:1:{i:0;a:5:{s:4:"data";s:31:"http://www.wptavern.com/?p=5445";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:104:"http://feedproxy.google.com/~r/WordpressTavern/~3/tjzwcd_SRdA/wpweekly-episode-112-%e2%80%93-kickstarted";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:3399:"

wordpressweekly1In this pre-recorded edition of WordPress Weekly, I get you caught up with the news that made the headlines this week. While I didn’t have time to go in-depth on any particular topic, this episode features two interviews. One with Tom McFarlin talking about the lessons he’s learned through commercial plugin development and the other with Scott Kingsley Clark who discusses why he decided to use Kickstarter to fund the development of Pods 2.0. While you enjoy the show, I’ll be prepping the yard and such for the party tomorrow.

\n

One year ago on September 17th, my would be father-in-law passed away from prostate cancer. Fellas, if you’re over 30 or 40, better keep an eye on that thing as it’s taking men out left and right.

\n

Stories Discussed:

\n

Andrea Middleton Takes Over WordCamp Central
\niWeb To WordPress Converter
\nAn Update On Upcoming WordCamps
\nbbPress RC 5 Released
\nBuddyPress 1.5 RC 1 and BuddyPress 1.2.10 Released

\n

Interview With Tom McFarlin Regarding His Lessons Learned So Far With Commercial Plugin Development
\nInterview With Scott Clark Discussing His Use Of Kickstarter.com To Fund Pods 2.0 Development

\n

WPWeekly Meta:

\n

Next Episode: Friday, September 23rd 9P.M. Eastern

\n

Subscribe To WPWeekly Via Itunes: Click here to subscribe

\n

Length Of Episode: 42 Minutes

\n

Download The Show: WordPressWeeklyEpisode112.mp3

\n

Listen To Episode #112:
\n

\n\n\n

Related posts:

  1. Pods Plugin Successfully Kickstarted To Version 2.0
  2. \n
  3. WPWeekly Episode 63 – Interview With Randy Hoyt And Scott Clark
  4. \n
  5. WPWeekly Episode 62 – Celebrating The Freedoms Of The GPL
  6. \n

";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:7:"pubDate";a:1:{i:0;a:5:{s:4:"data";s:31:"Fri, 16 Sep 2011 14:40:12 +0000";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:32:"http://purl.org/dc/elements/1.1/";a:1:{s:7:"creator";a:1:{i:0;a:5:{s:4:"data";s:6:"Jeffro";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}i:41;a:6:{s:4:"data";s:13:"\n \n \n \n \n \n \n";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:2:{s:0:"";a:5:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:61:"WPTavern: Pods Plugin Successfully Kickstarted To Version 2.0";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"guid";a:1:{i:0;a:5:{s:4:"data";s:31:"http://www.wptavern.com/?p=5425";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:113:"http://feedproxy.google.com/~r/WordpressTavern/~3/IF6e2Ptw-GE/pods-plugin-successfully-kickstarted-to-version-2-0";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:2922:"

logo for Pods pluginScoot Kingsley Clark who is the lead developer of the Pods Development Framework has successfully acquired the funds necessary to complete development work for Pods 2.0 along with the community website. After launching his project on Kickstarter.com, he managed to get the $1,500.00 goal necessary within 24 hours. However, the project has been so successful at getting pledges, he is nearly 200% or $2,000.00 above the original goal with 7 days left in the pledging period. With regards to what Scott plans on doing with the extra cash, this is what he says under the FAQ section of the project page:

\n

All additional money raised goes towards the Pods Foundation to help fund future development, travel for WordCamps and presentations, and hosting costs. So really, 2.0 is now funded – BUT you can still fund the foundation and everything it stands for.\n

\n

You might be wondering what he means by Pods Foundation. When I had a chance to speak with Scott the other day, he told me that the purpose of the foundation as well as how it’s structured is very similar to the WordPress foundation. I’m pretty sure this is the first WordPress plugin to have it’s own Non Profit foundation attached to it unless you know of another one? Because of the foundation, you can be assured that the money donated will go towards improvement of the plugin and accompanying community website.

\n

Congratulations goes out to Scott as well as his community of users. I have yet to see any other plugin or theme developers use Kickstarter in such a way. Do you think this was a unique opportunity for something like the Pods plugin or could other plugin authors leverage Kickstarter successfully to fund development of their projects?

\n\n\n

Related posts:

  1. IntenseDebate Plugin Version 2.4.2 Released
  2. \n
  3. WPWeekly Episode 63 – Interview With Randy Hoyt And Scott Clark
  4. \n

";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:7:"pubDate";a:1:{i:0;a:5:{s:4:"data";s:31:"Fri, 16 Sep 2011 13:00:29 +0000";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:32:"http://purl.org/dc/elements/1.1/";a:1:{s:7:"creator";a:1:{i:0;a:5:{s:4:"data";s:6:"Jeffro";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}i:42;a:6:{s:4:"data";s:13:"\n \n \n \n \n \n \n";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:2:{s:0:"";a:5:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:59:"Weblog Tools Collection: WordPress Plugin Releases for 9/16";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"guid";a:1:{i:0;a:5:{s:4:"data";s:41:"http://weblogtoolscollection.com/?p=10484";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:73:"http://feedproxy.google.com/~r/weblogtoolscollection/UXMP/~3/Fmkk9BbiUwI/";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:940:"

New plugins

\n

Auto Read More Generator will put a “Read More…” link for each post of the blog page after the first image and the first paragraph.

\n

GetMeCooking Recipe Template makes it easy for you to add recipes within your blog posts in a consistent, Search Engine friendly format and it allows your visitors to easily view and print the recipes.

\n

Updated plugins

\n

Slick Contact Forms creates a widget, which adds a contact form using either a floating, drop down button or a sticky, sliding tab.

\n";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:7:"pubDate";a:1:{i:0;a:5:{s:4:"data";s:31:"Fri, 16 Sep 2011 13:00:03 +0000";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:32:"http://purl.org/dc/elements/1.1/";a:1:{s:7:"creator";a:1:{i:0;a:5:{s:4:"data";s:10:"James Huff";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}i:43;a:6:{s:4:"data";s:13:"\n \n \n \n \n \n \n";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:2:{s:0:"";a:5:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:56:"WPTavern: Andrea Middleton Now Managing WordCamp Central";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"guid";a:1:{i:0;a:5:{s:4:"data";s:31:"http://www.wptavern.com/?p=5421";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:108:"http://feedproxy.google.com/~r/WordpressTavern/~3/zmWcbIqTwoE/andrea-middleton-now-managing-wordcamp-central";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:940:"

WordCamp Central is now managed by Andrea Middleton instead of Jane Wells. Within the post, Jane mentions that she will take on more of an advisory role while Andrea will be handling all of the management activities associated with the position. According to the facts presented within the introduction post, it certainly seems as though Andrea has the right credentials for the job.

\n\n\n

Related posts:

  1. Jane Wells Is Not So Bad
  2. \n
  3. My WordCamp Columbus Experience
  4. \n

";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:7:"pubDate";a:1:{i:0;a:5:{s:4:"data";s:31:"Fri, 16 Sep 2011 12:15:13 +0000";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:32:"http://purl.org/dc/elements/1.1/";a:1:{s:7:"creator";a:1:{i:0;a:5:{s:4:"data";s:6:"Jeffro";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}i:44;a:6:{s:4:"data";s:13:"\n \n \n \n \n \n \n";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:2:{s:0:"";a:5:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:52:"Weblog Tools Collection: BuddyPress 1.5 RC1 Released";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"guid";a:1:{i:0;a:5:{s:4:"data";s:41:"http://weblogtoolscollection.com/?p=10481";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:73:"http://feedproxy.google.com/~r/weblogtoolscollection/UXMP/~3/3STcLYH0Mxk/";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:924:"

The first release candidate of BuddyPress 1.5 has been released. Long considered to be the one true social networking solution for WordPress, there is a lot to look forward to in BuddyPress 1.5, and this is the first solid glimpse of that.

\n

Though the developers have not exactly cleared this release for use on live sites yet, now is the time to test it out if you’re handy with discovering bugs, and there’s even a test installation available for you to get your hands dirty with.

\n";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:7:"pubDate";a:1:{i:0;a:5:{s:4:"data";s:31:"Thu, 15 Sep 2011 17:30:07 +0000";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:32:"http://purl.org/dc/elements/1.1/";a:1:{s:7:"creator";a:1:{i:0;a:5:{s:4:"data";s:10:"James Huff";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}i:45;a:6:{s:4:"data";s:13:"\n \n \n \n \n \n \n";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:2:{s:0:"";a:5:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:42:"Dev Blog: Software Freedom Day + Hackathon";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"guid";a:1:{i:0;a:5:{s:4:"data";s:33:"http://wordpress.org/news/?p=2058";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:65:"http://wordpress.org/news/2011/09/software-freedom-day-hackathon/";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:3802:"

Saturday, September 17 is Software Freedom Day. To that end, a few announcements about this weekend’s hackathon and WordCamp Portland.

\n

3.3 Hackathon

\n

WordPress 3.3 is about to hit feature freeze. This means it’s the last chance to squeeze in features that haven’t quite been finished, and enhancements and fixes that no one has had time to address yet. Around this time, there are often dozens of tickets that have patches, but the patches have not been tested enough to be committed to core. Then the contributors who worked hard on the patches are disappointed that their code doesn’t make it into the current release. You can help us prevent this!

\n

This weekend, we’ll be running a has-patch needs-testing marathon for the 3.3 milestone. Basically, we’re looking for people who can help test patches and/or refresh patches that need updating. Lead developers and core contributors will be hanging around in the #wordpress-dev channel on irc.freenode.net to answer questions as needed, and will be committing patches as they get enough verification. As you test the patches, report your findings on the trac tickets in question. If all developers who make a living working with WordPress helped out for even an hour or two this weekend, we could clear the 200 tickets or so that are in this situation. To make it fun, why not get together with other WordPress devs and have an in-person hackathon meetup?

\n

WordCamp Portland

\n

At WordCamp Portland this weekend, some of the WordPress core team will be in attendance, including me, Nacin, and Koop. In addition to giving presentations and participating in the unconference sessions, we’ll be involved with a couple of other cool things at WCPDX:

\n\n

So, if you live it the Portland/Seattle area and haven’t already bought a ticket to attend WordCamp Portland, hurry up, as it’s going to be a great celebration of Software Freedom Day and WordPress.

";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:7:"pubDate";a:1:{i:0;a:5:{s:4:"data";s:31:"Thu, 15 Sep 2011 07:33:56 +0000";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:32:"http://purl.org/dc/elements/1.1/";a:1:{s:7:"creator";a:1:{i:0;a:5:{s:4:"data";s:10:"Jane Wells";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}i:46;a:6:{s:4:"data";s:13:"\n \n \n \n \n \n \n";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:2:{s:0:"";a:5:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:33:"Dev Blog: A Tale of Two WordCamps";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"guid";a:1:{i:0;a:5:{s:4:"data";s:33:"http://wordpress.org/news/?p=2057";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:58:"http://wordpress.org/news/2011/09/a-tale-of-two-wordcamps/";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:3682:"

This coming weekend, two WordCamps will be going on simultaneously — yep, it’s WordCamp season again! This weekend will be the first of many this autumn with multiple WordCamps. Tomorrow (not quite the weekend but close enough) is WordCamp Cape Town, and then this weekend, first-time WordCamp Albuquerque coincides with 4-time returning champ WordCamp Portland, a cool juxtaposition of a more established local community with one that is just getting started. If you’re anywhere near the Portland area, you should try to attend. The WordPress Foundation will be sponsoring some special activities around Software Freedom Day, and some members of the core team (me, Nacin, Koop) will be there.

\n

Is there a WordCamp coming up near you? Let’s find out!

\n

Sep 15: WordCamp Cape Town Cape Town, South Africa

\n

Sep 16-18: WordCamp Albuquerque Albuquerque, NM

\n

Sep 17-18: WordCamp Portland Portland, OR

\n

Sep 24: WordCamp Lisboa Lisboa, Portugal

\n

Sep 24: WordCamp Germany Koln, Germany

\n

Sep 25: WordCamp Sofia Sofia, Bulgaria

\n

Oct 1: WordCamp Louisville Louisville, Kentucky

\n

Oct 8-9: WordCamp Sevilla Seville, Spain

\n
\n

Oct 15-16: WordCamp Jabalpur Jabalpur, India

\n

Nov 5-6: WordCamp Toronto Toronto, ON

\n

Nov 5-6: WordCamp Gold Coast Gold Coast, Australia

\n

Nov 5-6: WordCamp Philly Philadelphia, PA

\n

Nov 12: WordCamp Caguas Caguas, Puerto Rico

\n

Nov 12-13: WordCamp Kenya Nairobi, Kenya

\n

Nov 12-13: WordCamp Detroit Detroit, MI

\n

Nov 12: WordCamp Richmond Richmond, VA

\n

Nov 12-13: WordCamp Denmark Copenhagen, Denmark

\n

Dec 17: WordCamp Las Vegas Las Vegas, NV

\n

Feb 3-4 WordCamp Atlanta Atlanta, GA

\n

There are also a number of WordCamps still in the early organizing stage that do not yet have dates set. These include: Ft. Wayne, IN; London, UK; Edmonton, Canada; Baku, Azerbaijan; Oslo, Norway; Sacramento, CA;  Birmingham, Alabama; Pittsburgh, PA; Omaha, NE; Orlando, FL; Tokyo, Japan; Paris, France; Zagreb, Croatia; Nashville, TN, Washington DC, Baltimore, MD; Bangkok, Thailand; Istanbul, Turkey.

\n

Hope to see you soon at a WordCamp near you!

\n


\n

\n
";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:7:"pubDate";a:1:{i:0;a:5:{s:4:"data";s:31:"Wed, 14 Sep 2011 21:17:08 +0000";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:32:"http://purl.org/dc/elements/1.1/";a:1:{s:7:"creator";a:1:{i:0;a:5:{s:4:"data";s:10:"Jane Wells";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}i:47;a:6:{s:4:"data";s:13:"\n \n \n \n \n \n \n";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:2:{s:0:"";a:5:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:56:"WPTavern: Using WordPress To Create Multiple Image Sizes";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"guid";a:1:{i:0;a:5:{s:4:"data";s:31:"http://www.wptavern.com/?p=5419";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:108:"http://feedproxy.google.com/~r/WordpressTavern/~3/OIYihc-aYKM/using-wordpress-to-create-multiple-image-sizes";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:684:"

WPBeginner has an excellent tutorial that describes how to use the built in functions of WordPress to generate additional image sizes for use in themes. This is possibly a better alternative than using TimThumb.

\n\n\n

Related posts:

  1. Screencast: Basic Image Editing In WordPress 2.9
  2. \n

";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:7:"pubDate";a:1:{i:0;a:5:{s:4:"data";s:31:"Wed, 14 Sep 2011 18:45:23 +0000";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:32:"http://purl.org/dc/elements/1.1/";a:1:{s:7:"creator";a:1:{i:0;a:5:{s:4:"data";s:6:"Jeffro";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}i:48;a:6:{s:4:"data";s:13:"\n \n \n \n \n \n \n";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:2:{s:0:"";a:5:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:42:"WordPress.tv: Kelly Dwan: Creating Plugins";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"guid";a:1:{i:0;a:5:{s:4:"data";s:27:"http://wordpress.tv/?p=6861";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:59:"http://wordpress.tv/2011/09/14/kelly-dwan-creating-plugins/";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:1786:"
\n
\n
Kelly Dwan: Creating Plugins
";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:7:"pubDate";a:1:{i:0;a:5:{s:4:"data";s:31:"Wed, 14 Sep 2011 13:15:24 +0000";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:32:"http://purl.org/dc/elements/1.1/";a:1:{s:7:"creator";a:1:{i:0;a:5:{s:4:"data";s:15:"WordCamp Boston";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}i:49;a:6:{s:4:"data";s:13:"\n \n \n \n \n \n \n";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:2:{s:0:"";a:5:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:37:"WPTavern: iWeb To WordPress Converter";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"guid";a:1:{i:0;a:5:{s:4:"data";s:31:"http://www.wptavern.com/?p=5416";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:89:"http://feedproxy.google.com/~r/WordpressTavern/~3/D8kEwHe-BCg/iweb-to-wordpress-converter";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:687:"

With MobileMe slated to shutdown on June 30th, 2012 taking iWeb with it, users will need to find a new home for their iWeb powered website. A company by the name of Rage Software has created an iWeb to WordPress converter that takes an exported iWeb website and converts it into a WordPress XML file that can be imported into the self hosted version of WordPress or WordPress.com. Seems easy enough although the conversion software will set you back $49.95.

\n
\n\n\n

No related posts.

";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:7:"pubDate";a:1:{i:0;a:5:{s:4:"data";s:31:"Wed, 14 Sep 2011 13:00:58 +0000";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:32:"http://purl.org/dc/elements/1.1/";a:1:{s:7:"creator";a:1:{i:0;a:5:{s:4:"data";s:6:"Jeffro";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}}}}}}}}}}}}s:4:"type";i:128;s:7:"headers";a:9:{s:6:"server";s:5:"nginx";s:4:"date";s:29:"Fri, 23 Sep 2011 17:05:12 GMT";s:12:"content-type";s:15:"application/xml";s:10:"connection";s:5:"close";s:4:"vary";s:15:"Accept-Encoding";s:13:"last-modified";s:29:"Fri, 23 Sep 2011 17:00:20 GMT";s:14:"content-length";s:6:"141909";s:4:"x-nc";s:11:"HIT luv 138";s:13:"accept-ranges";s:5:"bytes";}s:5:"build";s:14:"20090627192103";}', 'no'); +INSERT INTO `wp_options` (`option_id`, `blog_id`, `option_name`, `option_value`, `autoload`) VALUES +(139, 0, '_transient_timeout_feed_mod_867bd5c64f85878d03a060509cd2f92c', '1316840709', 'no'), +(140, 0, '_transient_feed_mod_867bd5c64f85878d03a060509cd2f92c', '1316797509', 'no'), +(141, 0, '_transient_timeout_dash_aa95765b5cc111c56d5993d476b1c2f0', '1316840709', 'no'), +(142, 0, '_transient_dash_aa95765b5cc111c56d5993d476b1c2f0', '
', 'no'), +(143, 0, '_transient_timeout_feed_57bc725ad6568758915363af670fd8bc', '1316840709', 'no'), +(144, 0, '_transient_feed_57bc725ad6568758915363af670fd8bc', 'a:4:{s:5:"child";a:1:{s:0:"";a:1:{s:3:"rss";a:1:{i:0;a:6:{s:4:"data";s:3:"\n \n";s:7:"attribs";a:1:{s:0:"";a:1:{s:7:"version";s:3:"2.0";}}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:1:{s:0:"";a:1:{s:7:"channel";a:1:{i:0;a:6:{s:4:"data";s:72:"\n \n \n \n \n \n \n \n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\n ";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:2:{s:0:"";a:7:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:33:"WordPress Plugins » View: Newest";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:47:"http://wordpress.org/extend/plugins/browse/new/";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:33:"WordPress Plugins » View: Newest";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:8:"language";a:1:{i:0;a:5:{s:4:"data";s:5:"en-US";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:7:"pubDate";a:1:{i:0;a:5:{s:4:"data";s:31:"Fri, 23 Sep 2011 16:59:48 +0000";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:9:"generator";a:1:{i:0;a:5:{s:4:"data";s:25:"http://bbpress.org/?v=1.1";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"item";a:15:{i:0;a:6:{s:4:"data";s:30:"\n \n \n \n \n \n \n ";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:2:{s:0:"";a:5:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:59:"infogeniuz on "infoGeniuz Form Analytics for Gravity Forms"";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:91:"http://wordpress.org/extend/plugins/infogeniuz-form-analytics-for-gravity-forms/#post-29919";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:7:"pubDate";a:1:{i:0;a:5:{s:4:"data";s:31:"Tue, 06 Sep 2011 20:37:43 +0000";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"guid";a:1:{i:0;a:5:{s:4:"data";s:42:"29919@http://wordpress.org/extend/plugins/";s:7:"attribs";a:1:{s:0:"";a:1:{s:11:"isPermaLink";s:5:"false";}}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:115:"Add number of visits & pageviews, browser & geolocation data to all your Gravity Forms email notifications.";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:32:"http://purl.org/dc/elements/1.1/";a:1:{s:7:"creator";a:1:{i:0;a:5:{s:4:"data";s:10:"infogeniuz";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}i:1;a:6:{s:4:"data";s:30:"\n \n \n \n \n \n \n ";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:2:{s:0:"";a:5:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:41:"quebarato on "QueBarato! Blog Connection"";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:73:"http://wordpress.org/extend/plugins/quebarato-blog-connection/#post-30399";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:7:"pubDate";a:1:{i:0;a:5:{s:4:"data";s:31:"Wed, 21 Sep 2011 23:07:58 +0000";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"guid";a:1:{i:0;a:5:{s:4:"data";s:42:"30399@http://wordpress.org/extend/plugins/";s:7:"attribs";a:1:{s:0:"";a:1:{s:11:"isPermaLink";s:5:"false";}}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:127:"Ganhar dinheiro através de um post em seu blog parece a idéia perfeita? O QueBarato! apresenta o QueBarato! Blog Connection.";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:32:"http://purl.org/dc/elements/1.1/";a:1:{s:7:"creator";a:1:{i:0;a:5:{s:4:"data";s:9:"quebarato";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}i:2;a:6:{s:4:"data";s:30:"\n \n \n \n \n \n \n ";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:2:{s:0:"";a:5:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:32:"luciana123 on "Notify On Action"";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:64:"http://wordpress.org/extend/plugins/notify-on-action/#post-30397";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:7:"pubDate";a:1:{i:0;a:5:{s:4:"data";s:31:"Wed, 21 Sep 2011 21:39:22 +0000";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"guid";a:1:{i:0;a:5:{s:4:"data";s:42:"30397@http://wordpress.org/extend/plugins/";s:7:"attribs";a:1:{s:0:"";a:1:{s:11:"isPermaLink";s:5:"false";}}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:117:"This plugin allows Admins to set up email notification on any action performed in any of functions on themes/plugins.";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:32:"http://purl.org/dc/elements/1.1/";a:1:{s:7:"creator";a:1:{i:0;a:5:{s:4:"data";s:10:"luciana123";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}i:3;a:6:{s:4:"data";s:30:"\n \n \n \n \n \n \n ";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:2:{s:0:"";a:5:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:55:"James Irving-Swift (Swifty) on "Electric Studio Mailer"";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:70:"http://wordpress.org/extend/plugins/electric-studio-mailer/#post-30381";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:7:"pubDate";a:1:{i:0;a:5:{s:4:"data";s:31:"Wed, 21 Sep 2011 13:39:43 +0000";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"guid";a:1:{i:0;a:5:{s:4:"data";s:42:"30381@http://wordpress.org/extend/plugins/";s:7:"attribs";a:1:{s:0:"";a:1:{s:11:"isPermaLink";s:5:"false";}}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:66:"Creates an easy function for sending mail from your Wordpress site";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:32:"http://purl.org/dc/elements/1.1/";a:1:{s:7:"creator";a:1:{i:0;a:5:{s:4:"data";s:27:"James Irving-Swift (Swifty)";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}i:4;a:6:{s:4:"data";s:30:"\n \n \n \n \n \n \n ";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:2:{s:0:"";a:5:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:24:"bestwebsoft on "Gallery"";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:62:"http://wordpress.org/extend/plugins/gallery-plugin/#post-30427";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:7:"pubDate";a:1:{i:0;a:5:{s:4:"data";s:31:"Thu, 22 Sep 2011 16:56:44 +0000";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"guid";a:1:{i:0;a:5:{s:4:"data";s:42:"30427@http://wordpress.org/extend/plugins/";s:7:"attribs";a:1:{s:0:"";a:1:{s:11:"isPermaLink";s:5:"false";}}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:63:"This plugin allows you to implement gallery page into web site.";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:32:"http://purl.org/dc/elements/1.1/";a:1:{s:7:"creator";a:1:{i:0;a:5:{s:4:"data";s:11:"bestwebsoft";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}i:5;a:6:{s:4:"data";s:30:"\n \n \n \n \n \n \n ";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:2:{s:0:"";a:5:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:34:"jokerbr313 on "Advanced Post List"";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:65:"http://wordpress.org/extend/plugins/advance-post-list/#post-30371";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:7:"pubDate";a:1:{i:0;a:5:{s:4:"data";s:31:"Wed, 21 Sep 2011 09:16:11 +0000";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"guid";a:1:{i:0;a:5:{s:4:"data";s:42:"30371@http://wordpress.org/extend/plugins/";s:7:"attribs";a:1:{s:0:"";a:1:{s:11:"isPermaLink";s:5:"false";}}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:132:"Create a large variety of post lists with easy to use advanced settings. Highly customizable for designing unique post-list designs.";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:32:"http://purl.org/dc/elements/1.1/";a:1:{s:7:"creator";a:1:{i:0;a:5:{s:4:"data";s:10:"jokerbr313";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}i:6;a:6:{s:4:"data";s:30:"\n \n \n \n \n \n \n ";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:2:{s:0:"";a:5:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:26:"dmitry78 on "XiSearch bar"";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:60:"http://wordpress.org/extend/plugins/xisearch-bar/#post-30313";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:7:"pubDate";a:1:{i:0;a:5:{s:4:"data";s:31:"Mon, 19 Sep 2011 11:38:26 +0000";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"guid";a:1:{i:0;a:5:{s:4:"data";s:42:"30313@http://wordpress.org/extend/plugins/";s:7:"attribs";a:1:{s:0:"";a:1:{s:11:"isPermaLink";s:5:"false";}}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:145:"XiSearch bar: increase the quantity and improve the quality of your site content thanks to the advanced search options on every page of your site";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:32:"http://purl.org/dc/elements/1.1/";a:1:{s:7:"creator";a:1:{i:0;a:5:{s:4:"data";s:8:"dmitry78";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}i:7;a:6:{s:4:"data";s:30:"\n \n \n \n \n \n \n ";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:2:{s:0:"";a:5:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:25:"mikeyotoole on "WP Folio"";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:59:"http://wordpress.org/extend/plugins/wp-foliolio/#post-30390";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:7:"pubDate";a:1:{i:0;a:5:{s:4:"data";s:31:"Wed, 21 Sep 2011 19:15:00 +0000";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"guid";a:1:{i:0;a:5:{s:4:"data";s:42:"30390@http://wordpress.org/extend/plugins/";s:7:"attribs";a:1:{s:0:"";a:1:{s:11:"isPermaLink";s:5:"false";}}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:140:"WP-Foliolio enables a Web Developer/Designer to create a Wordpress Portfolio for their work with wp's familiar content creation system.";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:32:"http://purl.org/dc/elements/1.1/";a:1:{s:7:"creator";a:1:{i:0;a:5:{s:4:"data";s:11:"mikeyotoole";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}i:8;a:6:{s:4:"data";s:30:"\n \n \n \n \n \n \n ";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:2:{s:0:"";a:5:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:61:"benatkin on "WordPress SyntaxHighlighter Evolved: Brush Pack"";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:76:"http://wordpress.org/extend/plugins/syntaxhighlighter-brush-pack/#post-30403";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:7:"pubDate";a:1:{i:0;a:5:{s:4:"data";s:31:"Thu, 22 Sep 2011 02:25:40 +0000";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"guid";a:1:{i:0;a:5:{s:4:"data";s:42:"30403@http://wordpress.org/extend/plugins/";s:7:"attribs";a:1:{s:0:"";a:1:{s:11:"isPermaLink";s:5:"false";}}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:150:"Adds brushes to SyntaxHighlighter Evolved. Based on\n[WordPress SyntaxHighlighter Evolved: CoffeeScript\nBrush](http://wordpress.org/extend/plugins/synt";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:32:"http://purl.org/dc/elements/1.1/";a:1:{s:7:"creator";a:1:{i:0;a:5:{s:4:"data";s:8:"benatkin";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}i:9;a:6:{s:4:"data";s:30:"\n \n \n \n \n \n \n ";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:2:{s:0:"";a:5:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:31:"KwarK on "Kw LiveStream Plugin"";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:68:"http://wordpress.org/extend/plugins/kw-livestream-plugin/#post-30404";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:7:"pubDate";a:1:{i:0;a:5:{s:4:"data";s:31:"Thu, 22 Sep 2011 05:41:56 +0000";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"guid";a:1:{i:0;a:5:{s:4:"data";s:42:"30404@http://wordpress.org/extend/plugins/";s:7:"attribs";a:1:{s:0:"";a:1:{s:11:"isPermaLink";s:5:"false";}}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:121:"A simple plugin for streaming (live tv) with livestream.com and shortcode with WordPress. Multiple livestream possibility";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:32:"http://purl.org/dc/elements/1.1/";a:1:{s:7:"creator";a:1:{i:0;a:5:{s:4:"data";s:5:"KwarK";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}i:10;a:6:{s:4:"data";s:30:"\n \n \n \n \n \n \n ";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:2:{s:0:"";a:5:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:29:"Simon Fransson on "Logged in"";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:57:"http://wordpress.org/extend/plugins/logged-in/#post-30432";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:7:"pubDate";a:1:{i:0;a:5:{s:4:"data";s:31:"Thu, 22 Sep 2011 20:06:43 +0000";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"guid";a:1:{i:0;a:5:{s:4:"data";s:42:"30432@http://wordpress.org/extend/plugins/";s:7:"attribs";a:1:{s:0:"";a:1:{s:11:"isPermaLink";s:5:"false";}}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:142:"Allows you to close your site to non-logged in users, by redirecting them to the login page, displaying a message or a specific template file.";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:32:"http://purl.org/dc/elements/1.1/";a:1:{s:7:"creator";a:1:{i:0;a:5:{s:4:"data";s:14:"Simon Fransson";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}i:11;a:6:{s:4:"data";s:30:"\n \n \n \n \n \n \n ";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:2:{s:0:"";a:5:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:22:"DaganLev on "DGallery"";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:56:"http://wordpress.org/extend/plugins/dgallery/#post-30428";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:7:"pubDate";a:1:{i:0;a:5:{s:4:"data";s:31:"Thu, 22 Sep 2011 18:40:33 +0000";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"guid";a:1:{i:0;a:5:{s:4:"data";s:42:"30428@http://wordpress.org/extend/plugins/";s:7:"attribs";a:1:{s:0:"";a:1:{s:11:"isPermaLink";s:5:"false";}}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:87:"Overrides WordPress regular gallery with a nicer gallery based on Google+ photo gallery";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:32:"http://purl.org/dc/elements/1.1/";a:1:{s:7:"creator";a:1:{i:0;a:5:{s:4:"data";s:8:"DaganLev";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}i:12;a:6:{s:4:"data";s:30:"\n \n \n \n \n \n \n ";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:2:{s:0:"";a:5:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:37:"SultanICQ on "Web Page Speed Checker"";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:70:"http://wordpress.org/extend/plugins/web-page-speed-checker/#post-30354";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:7:"pubDate";a:1:{i:0;a:5:{s:4:"data";s:31:"Tue, 20 Sep 2011 15:50:11 +0000";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"guid";a:1:{i:0;a:5:{s:4:"data";s:42:"30354@http://wordpress.org/extend/plugins/";s:7:"attribs";a:1:{s:0:"";a:1:{s:11:"isPermaLink";s:5:"false";}}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:102:"Web Page Speed Checker is a plugin designed to control the Google Page Speed Score of your blog pages.";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:32:"http://purl.org/dc/elements/1.1/";a:1:{s:7:"creator";a:1:{i:0;a:5:{s:4:"data";s:9:"SultanICQ";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}i:13;a:6:{s:4:"data";s:30:"\n \n \n \n \n \n \n ";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:2:{s:0:"";a:5:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:36:"Inpsyde GmbH on "Multilingual Press"";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:66:"http://wordpress.org/extend/plugins/multilingual-press/#post-26125";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:7:"pubDate";a:1:{i:0;a:5:{s:4:"data";s:31:"Tue, 26 Apr 2011 18:29:56 +0000";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"guid";a:1:{i:0;a:5:{s:4:"data";s:42:"26125@http://wordpress.org/extend/plugins/";s:7:"attribs";a:1:{s:0:"";a:1:{s:11:"isPermaLink";s:5:"false";}}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:46:"Multilingual websites with WordPress Multisite";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:32:"http://purl.org/dc/elements/1.1/";a:1:{s:7:"creator";a:1:{i:0;a:5:{s:4:"data";s:12:"Inpsyde GmbH";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}i:14;a:6:{s:4:"data";s:30:"\n \n \n \n \n \n \n ";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:2:{s:0:"";a:5:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:68:"Londontime on "Share Google , twitter , facebook and social sharing"";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:63:"http://wordpress.org/extend/plugins/google-wp-buton/#post-30359";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:7:"pubDate";a:1:{i:0;a:5:{s:4:"data";s:31:"Tue, 20 Sep 2011 18:22:23 +0000";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"guid";a:1:{i:0;a:5:{s:4:"data";s:42:"30359@http://wordpress.org/extend/plugins/";s:7:"attribs";a:1:{s:0:"";a:1:{s:11:"isPermaLink";s:5:"false";}}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:87:"Adds a set of cool icons and widgets at the end of your post for your readers to share.";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:32:"http://purl.org/dc/elements/1.1/";a:1:{s:7:"creator";a:1:{i:0;a:5:{s:4:"data";s:10:"Londontime";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}}}s:27:"http://www.w3.org/2005/Atom";a:1:{s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:0:"";s:7:"attribs";a:1:{s:0:"";a:3:{s:4:"href";s:48:"http://wordpress.org/extend/plugins/rss/view/new";s:3:"rel";s:4:"self";s:4:"type";s:19:"application/rss+xml";}}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}}}}}}}}s:4:"type";i:128;s:7:"headers";a:8:{s:6:"server";s:5:"nginx";s:4:"date";s:29:"Fri, 23 Sep 2011 17:05:13 GMT";s:12:"content-type";s:23:"text/xml; charset=UTF-8";s:10:"connection";s:5:"close";s:4:"vary";s:15:"Accept-Encoding";s:13:"last-modified";s:19:"2011-09-06 20:37:43";s:14:"content-length";s:4:"8029";s:4:"x-nc";s:11:"HIT luv 138";}s:5:"build";s:14:"20090627192103";}', 'no'), +(145, 0, '_transient_timeout_feed_mod_57bc725ad6568758915363af670fd8bc', '1316840709', 'no'), +(146, 0, '_transient_feed_mod_57bc725ad6568758915363af670fd8bc', '1316797509', 'no'), +(147, 0, '_transient_timeout_feed_1a5f760f2e2b48827d4974a60857e7c2', '1316840710', 'no'); +INSERT INTO `wp_options` (`option_id`, `blog_id`, `option_name`, `option_value`, `autoload`) VALUES +(148, 0, '_transient_feed_1a5f760f2e2b48827d4974a60857e7c2', 'a:4:{s:5:"child";a:1:{s:0:"";a:1:{s:3:"rss";a:1:{i:0;a:6:{s:4:"data";s:3:"\n \n";s:7:"attribs";a:1:{s:0:"";a:1:{s:7:"version";s:3:"2.0";}}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:1:{s:0:"";a:1:{s:7:"channel";a:1:{i:0;a:6:{s:4:"data";s:72:"\n \n \n \n \n \n \n \n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\n ";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:2:{s:0:"";a:7:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:43:"WordPress Plugins » View: Recently Updated";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:51:"http://wordpress.org/extend/plugins/browse/updated/";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:43:"WordPress Plugins » View: Recently Updated";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:8:"language";a:1:{i:0;a:5:{s:4:"data";s:5:"en-US";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:7:"pubDate";a:1:{i:0;a:5:{s:4:"data";s:31:"Fri, 23 Sep 2011 16:59:08 +0000";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:9:"generator";a:1:{i:0;a:5:{s:4:"data";s:25:"http://bbpress.org/?v=1.1";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"item";a:15:{i:0;a:6:{s:4:"data";s:30:"\n \n \n \n \n \n \n ";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:2:{s:0:"";a:5:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:30:"Shelby DeNike on "Minify Link"";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:58:"http://wordpress.org/extend/plugins/minifylink/#post-17415";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:7:"pubDate";a:1:{i:0;a:5:{s:4:"data";s:31:"Tue, 20 Apr 2010 19:40:14 +0000";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"guid";a:1:{i:0;a:5:{s:4:"data";s:42:"17415@http://wordpress.org/extend/plugins/";s:7:"attribs";a:1:{s:0:"";a:1:{s:11:"isPermaLink";s:5:"false";}}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:116:"The Minify Link WordPress plugin simply changes all permalinks on your site to Minify links using the Minify.us API.";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:32:"http://purl.org/dc/elements/1.1/";a:1:{s:7:"creator";a:1:{i:0;a:5:{s:4:"data";s:13:"Shelby DeNike";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}i:1;a:6:{s:4:"data";s:30:"\n \n \n \n \n \n \n ";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:2:{s:0:"";a:5:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:29:"dkukral on "Email on Publish"";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:64:"http://wordpress.org/extend/plugins/email-on-publish/#post-26810";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:7:"pubDate";a:1:{i:0;a:5:{s:4:"data";s:31:"Mon, 23 May 2011 20:54:45 +0000";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"guid";a:1:{i:0;a:5:{s:4:"data";s:42:"26810@http://wordpress.org/extend/plugins/";s:7:"attribs";a:1:{s:0:"";a:1:{s:11:"isPermaLink";s:5:"false";}}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:67:"Plugin for WordPress that emails to text of the post when published";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:32:"http://purl.org/dc/elements/1.1/";a:1:{s:7:"creator";a:1:{i:0;a:5:{s:4:"data";s:7:"dkukral";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}i:2;a:6:{s:4:"data";s:30:"\n \n \n \n \n \n \n ";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:2:{s:0:"";a:5:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:38:"OddOneOut on "Better WordPress Minify"";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:58:"http://wordpress.org/extend/plugins/bwp-minify/#post-25706";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:7:"pubDate";a:1:{i:0;a:5:{s:4:"data";s:31:"Wed, 06 Apr 2011 16:16:48 +0000";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"guid";a:1:{i:0;a:5:{s:4:"data";s:42:"25706@http://wordpress.org/extend/plugins/";s:7:"attribs";a:1:{s:0:"";a:1:{s:11:"isPermaLink";s:5:"false";}}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:80:"Allows you to minify your CSS and JS files for faster page loading for visitors.";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:32:"http://purl.org/dc/elements/1.1/";a:1:{s:7:"creator";a:1:{i:0;a:5:{s:4:"data";s:9:"OddOneOut";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}i:3;a:6:{s:4:"data";s:30:"\n \n \n \n \n \n \n ";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:2:{s:0:"";a:5:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:47:"OddOneOut on "Better WordPress Polldaddy Polls"";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:61:"http://wordpress.org/extend/plugins/bwp-polldaddy/#post-25707";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:7:"pubDate";a:1:{i:0;a:5:{s:4:"data";s:31:"Wed, 06 Apr 2011 16:18:59 +0000";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"guid";a:1:{i:0;a:5:{s:4:"data";s:42:"25707@http://wordpress.org/extend/plugins/";s:7:"attribs";a:1:{s:0:"";a:1:{s:11:"isPermaLink";s:5:"false";}}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:63:"Helps you add Polldaddy Polls to your WordPress website easily.";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:32:"http://purl.org/dc/elements/1.1/";a:1:{s:7:"creator";a:1:{i:0;a:5:{s:4:"data";s:9:"OddOneOut";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}i:4;a:6:{s:4:"data";s:30:"\n \n \n \n \n \n \n ";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:2:{s:0:"";a:5:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:39:"hda on "Histoire des Arts | Culture.fr"";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:65:"http://wordpress.org/extend/plugins/histoire-des-arts/#post-27656";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:7:"pubDate";a:1:{i:0;a:5:{s:4:"data";s:31:"Tue, 21 Jun 2011 15:19:39 +0000";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"guid";a:1:{i:0;a:5:{s:4:"data";s:42:"27656@http://wordpress.org/extend/plugins/";s:7:"attribs";a:1:{s:0:"";a:1:{s:11:"isPermaLink";s:5:"false";}}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:11:"description";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:32:"http://purl.org/dc/elements/1.1/";a:1:{s:7:"creator";a:1:{i:0;a:5:{s:4:"data";s:3:"hda";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}i:5;a:6:{s:4:"data";s:30:"\n \n \n \n \n \n \n ";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:2:{s:0:"";a:5:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:43:"loverlynetwork on "Lover.ly Network Plugin"";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:70:"http://wordpress.org/extend/plugins/loverly-network-plugin/#post-29199";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:7:"pubDate";a:1:{i:0;a:5:{s:4:"data";s:31:"Wed, 10 Aug 2011 04:36:44 +0000";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"guid";a:1:{i:0;a:5:{s:4:"data";s:42:"29199@http://wordpress.org/extend/plugins/";s:7:"attribs";a:1:{s:0:"";a:1:{s:11:"isPermaLink";s:5:"false";}}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:102:"The Lover.ly Network Plugin allows publishing partners to connect their blog to the Lover.ly platform.";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:32:"http://purl.org/dc/elements/1.1/";a:1:{s:7:"creator";a:1:{i:0;a:5:{s:4:"data";s:14:"loverlynetwork";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}i:6;a:6:{s:4:"data";s:30:"\n \n \n \n \n \n \n ";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:2:{s:0:"";a:5:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:42:"russell.albin on "Simple Business Manager"";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:71:"http://wordpress.org/extend/plugins/simple-business-manager/#post-25737";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:7:"pubDate";a:1:{i:0;a:5:{s:4:"data";s:31:"Fri, 08 Apr 2011 00:19:34 +0000";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"guid";a:1:{i:0;a:5:{s:4:"data";s:42:"25737@http://wordpress.org/extend/plugins/";s:7:"attribs";a:1:{s:0:"";a:1:{s:11:"isPermaLink";s:5:"false";}}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:53:"Manage your customers, send invoices, track spending.";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:32:"http://purl.org/dc/elements/1.1/";a:1:{s:7:"creator";a:1:{i:0;a:5:{s:4:"data";s:13:"russell.albin";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}i:7;a:6:{s:4:"data";s:30:"\n \n \n \n \n \n \n ";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:2:{s:0:"";a:5:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:18:"plista on "plista"";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:54:"http://wordpress.org/extend/plugins/plista/#post-29335";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:7:"pubDate";a:1:{i:0;a:5:{s:4:"data";s:31:"Mon, 15 Aug 2011 14:47:14 +0000";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"guid";a:1:{i:0;a:5:{s:4:"data";s:42:"29335@http://wordpress.org/extend/plugins/";s:7:"attribs";a:1:{s:0:"";a:1:{s:11:"isPermaLink";s:5:"false";}}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:44:"Plugin for displaying plista Recommendations";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:32:"http://purl.org/dc/elements/1.1/";a:1:{s:7:"creator";a:1:{i:0;a:5:{s:4:"data";s:6:"plista";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}i:8;a:6:{s:4:"data";s:30:"\n \n \n \n \n \n \n ";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:2:{s:0:"";a:5:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:28:"Ste_95 on "Post Pay Counter"";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:64:"http://wordpress.org/extend/plugins/post-pay-counter/#post-29796";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:7:"pubDate";a:1:{i:0;a:5:{s:4:"data";s:31:"Fri, 02 Sep 2011 11:25:39 +0000";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"guid";a:1:{i:0;a:5:{s:4:"data";s:42:"29796@http://wordpress.org/extend/plugins/";s:7:"attribs";a:1:{s:0:"";a:1:{s:11:"isPermaLink";s:5:"false";}}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:144:"Easily calculate and handle author's pay on a multi-author blog by computing every written post remuneration basing on admin defined rules.";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:32:"http://purl.org/dc/elements/1.1/";a:1:{s:7:"creator";a:1:{i:0;a:5:{s:4:"data";s:6:"Ste_95";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}i:9;a:6:{s:4:"data";s:30:"\n \n \n \n \n \n \n ";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:2:{s:0:"";a:5:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:41:"xcloner on "XCloner - Backup and Restore"";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:74:"http://wordpress.org/extend/plugins/xcloner-backup-and-restore/#post-21206";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:7:"pubDate";a:1:{i:0;a:5:{s:4:"data";s:31:"Tue, 28 Sep 2010 07:20:29 +0000";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"guid";a:1:{i:0;a:5:{s:4:"data";s:42:"21206@http://wordpress.org/extend/plugins/";s:7:"attribs";a:1:{s:0:"";a:1:{s:11:"isPermaLink";s:5:"false";}}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:185:"XCloner is a full backup and restore plugin for Wordpress, it will backup and restore both files and database. http://www.xcloner.com";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:32:"http://purl.org/dc/elements/1.1/";a:1:{s:7:"creator";a:1:{i:0;a:5:{s:4:"data";s:7:"xcloner";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}i:10;a:6:{s:4:"data";s:30:"\n \n \n \n \n \n \n ";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:2:{s:0:"";a:5:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:60:"optimum7 on "Google Rank Checker - SEO Tool with Google API"";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:92:"http://wordpress.org/extend/plugins/google-rank-checker-seo-tool-with-google-api/#post-29215";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:7:"pubDate";a:1:{i:0;a:5:{s:4:"data";s:31:"Wed, 10 Aug 2011 14:04:34 +0000";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"guid";a:1:{i:0;a:5:{s:4:"data";s:42:"29215@http://wordpress.org/extend/plugins/";s:7:"attribs";a:1:{s:0:"";a:1:{s:11:"isPermaLink";s:5:"false";}}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:122:"Google Rank Checker - SEO Tool with Google API provides the estimated Google position for a keyword and corresponding URL.";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:32:"http://purl.org/dc/elements/1.1/";a:1:{s:7:"creator";a:1:{i:0;a:5:{s:4:"data";s:8:"optimum7";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}i:11;a:6:{s:4:"data";s:30:"\n \n \n \n \n \n \n ";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:2:{s:0:"";a:5:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:29:"Glenn Ansley on "FT Calendar"";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:59:"http://wordpress.org/extend/plugins/ft-calendar/#post-24823";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:7:"pubDate";a:1:{i:0;a:5:{s:4:"data";s:31:"Tue, 01 Mar 2011 04:51:28 +0000";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"guid";a:1:{i:0;a:5:{s:4:"data";s:42:"24823@http://wordpress.org/extend/plugins/";s:7:"attribs";a:1:{s:0:"";a:1:{s:11:"isPermaLink";s:5:"false";}}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:206:"A calendar plugin supporting multiple calendars, recurring events, and several different widgets / shortcodes. More info at http://calendar-plugin.com";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:32:"http://purl.org/dc/elements/1.1/";a:1:{s:7:"creator";a:1:{i:0;a:5:{s:4:"data";s:12:"Glenn Ansley";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}i:12;a:6:{s:4:"data";s:30:"\n \n \n \n \n \n \n ";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:2:{s:0:"";a:5:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:60:"infogeniuz on "infoGeniuz Form Analytics for Contact Form 7"";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:92:"http://wordpress.org/extend/plugins/infogeniuz-form-analytics-for-contact-form-7/#post-29918";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:7:"pubDate";a:1:{i:0;a:5:{s:4:"data";s:31:"Tue, 06 Sep 2011 20:37:13 +0000";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"guid";a:1:{i:0;a:5:{s:4:"data";s:42:"29918@http://wordpress.org/extend/plugins/";s:7:"attribs";a:1:{s:0:"";a:1:{s:11:"isPermaLink";s:5:"false";}}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:116:"Add number of visits & pageviews, browser & geolocation data to all your Contact Form 7 email notifications.";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:32:"http://purl.org/dc/elements/1.1/";a:1:{s:7:"creator";a:1:{i:0;a:5:{s:4:"data";s:10:"infogeniuz";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}i:13;a:6:{s:4:"data";s:30:"\n \n \n \n \n \n \n ";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:2:{s:0:"";a:5:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:41:"strangerstudios on "Paid Memberships Pro"";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:68:"http://wordpress.org/extend/plugins/paid-memberships-pro/#post-28043";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:7:"pubDate";a:1:{i:0;a:5:{s:4:"data";s:31:"Mon, 04 Jul 2011 04:02:50 +0000";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"guid";a:1:{i:0;a:5:{s:4:"data";s:42:"28043@http://wordpress.org/extend/plugins/";s:7:"attribs";a:1:{s:0:"";a:1:{s:11:"isPermaLink";s:5:"false";}}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:150:"An infinitely customizable Membership Plugin for WordPress integrated with Authorize.net or PayPal(r) for recurring payments, flexible content control";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:32:"http://purl.org/dc/elements/1.1/";a:1:{s:7:"creator";a:1:{i:0;a:5:{s:4:"data";s:15:"strangerstudios";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}i:14;a:6:{s:4:"data";s:30:"\n \n \n \n \n \n \n ";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";s:5:"child";a:2:{s:0:"";a:5:{s:5:"title";a:1:{i:0;a:5:{s:4:"data";s:36:"Zamango on "Zamango Page Navigation"";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:71:"http://wordpress.org/extend/plugins/zamango-page-navigation/#post-15724";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:7:"pubDate";a:1:{i:0;a:5:{s:4:"data";s:31:"Wed, 03 Feb 2010 07:49:32 +0000";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:4:"guid";a:1:{i:0;a:5:{s:4:"data";s:42:"15724@http://wordpress.org/extend/plugins/";s:7:"attribs";a:1:{s:0:"";a:1:{s:11:"isPermaLink";s:5:"false";}}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:11:"description";a:1:{i:0;a:5:{s:4:"data";s:122:"It creates pagebar on lists (for ex. on category or search results) and Next Post & Previous Post links on each post.";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:32:"http://purl.org/dc/elements/1.1/";a:1:{s:7:"creator";a:1:{i:0;a:5:{s:4:"data";s:7:"Zamango";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}}}s:27:"http://www.w3.org/2005/Atom";a:1:{s:4:"link";a:1:{i:0;a:5:{s:4:"data";s:0:"";s:7:"attribs";a:1:{s:0:"";a:3:{s:4:"href";s:52:"http://wordpress.org/extend/plugins/rss/view/updated";s:3:"rel";s:4:"self";s:4:"type";s:19:"application/rss+xml";}}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}}}}}}}}s:4:"type";i:128;s:7:"headers";a:8:{s:6:"server";s:5:"nginx";s:4:"date";s:29:"Fri, 23 Sep 2011 17:05:14 GMT";s:12:"content-type";s:23:"text/xml; charset=UTF-8";s:10:"connection";s:5:"close";s:4:"vary";s:15:"Accept-Encoding";s:13:"last-modified";s:19:"2010-04-20 19:40:14";s:14:"content-length";s:4:"7997";s:4:"x-nc";s:11:"HIT luv 138";}s:5:"build";s:14:"20090627192103";}', 'no'), +(149, 0, '_transient_timeout_feed_mod_1a5f760f2e2b48827d4974a60857e7c2', '1316840710', 'no'), +(150, 0, '_transient_feed_mod_1a5f760f2e2b48827d4974a60857e7c2', '1316797510', 'no'), +(151, 0, '_transient_timeout_plugin_slugs', '1316883910', 'no'), +(152, 0, '_transient_plugin_slugs', 'a:2:{i:0;s:19:"akismet/akismet.php";i:1;s:9:"hello.php";}', 'no'), +(153, 0, '_transient_timeout_dash_de3249c4736ad3bd2cd29147c4a0d43e', '1316840710', 'no'), +(154, 0, '_transient_dash_de3249c4736ad3bd2cd29147c4a0d43e', '

Más populares

\n
W3 Total Cache
 (Instalar)\n

Improve site performance and user experience via caching: browser, page, object, database, minify and content delivery network support.

\n

Plugins recientes

\n
Logged in
 (Instalar)\n

Allows you to close your site to non-logged in users, by redirecting them to the login page, displaying a message or a specific template file.

\n

Actualizados recientemente

\n
plista
 (Instalar)\n

Plugin for displaying plista Recommendations

\n', 'no'), +(155, 0, '_site_transient_timeout_wporg_theme_feature_list', '1316808471', 'yes'), +(156, 0, '_site_transient_wporg_theme_feature_list', 'a:5:{s:6:"Colors";a:15:{i:0;s:5:"black";i:1;s:4:"blue";i:2;s:5:"brown";i:3;s:4:"gray";i:4;s:5:"green";i:5;s:6:"orange";i:6;s:4:"pink";i:7;s:6:"purple";i:8;s:3:"red";i:9;s:6:"silver";i:10;s:3:"tan";i:11;s:5:"white";i:12;s:6:"yellow";i:13;s:4:"dark";i:14;s:5:"light";}s:7:"Columns";a:6:{i:0;s:10:"one-column";i:1;s:11:"two-columns";i:2;s:13:"three-columns";i:3;s:12:"four-columns";i:4;s:12:"left-sidebar";i:5;s:13:"right-sidebar";}s:5:"Width";a:2:{i:0;s:11:"fixed-width";i:1;s:14:"flexible-width";}s:8:"Features";a:18:{i:0;s:8:"blavatar";i:1;s:10:"buddypress";i:2;s:17:"custom-background";i:3;s:13:"custom-colors";i:4;s:13:"custom-header";i:5;s:11:"custom-menu";i:6;s:12:"editor-style";i:7;s:21:"featured-image-header";i:8;s:15:"featured-images";i:9;s:20:"front-page-post-form";i:10;s:19:"full-width-template";i:11;s:12:"microformats";i:12;s:12:"post-formats";i:13;s:20:"rtl-language-support";i:14;s:11:"sticky-post";i:15;s:13:"theme-options";i:16;s:17:"threaded-comments";i:17;s:17:"translation-ready";}s:7:"Subject";a:3:{i:0;s:7:"holiday";i:1;s:13:"photoblogging";i:2;s:8:"seasonal";}}', 'yes'), +(158, 0, 'theme_mods_Broadside', 'a:1:{i:0;b:0;}', 'yes'), +(159, 0, 'optionsframework', 'a:1:{s:2:"id";s:9:"broadside";}', 'yes'); + +-- -------------------------------------------------------- + +-- +-- Estructura de tabla para la tabla `wp_postmeta` +-- + +CREATE TABLE IF NOT EXISTS `wp_postmeta` ( + `meta_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `post_id` bigint(20) unsigned NOT NULL DEFAULT '0', + `meta_key` varchar(255) DEFAULT NULL, + `meta_value` longtext, + PRIMARY KEY (`meta_id`), + KEY `post_id` (`post_id`), + KEY `meta_key` (`meta_key`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ; + +-- +-- Volcar la base de datos para la tabla `wp_postmeta` +-- + +INSERT INTO `wp_postmeta` (`meta_id`, `post_id`, `meta_key`, `meta_value`) VALUES +(1, 2, '_wp_page_template', 'default'); + +-- -------------------------------------------------------- + +-- +-- Estructura de tabla para la tabla `wp_posts` +-- + +CREATE TABLE IF NOT EXISTS `wp_posts` ( + `ID` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `post_author` bigint(20) unsigned NOT NULL DEFAULT '0', + `post_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `post_date_gmt` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `post_content` longtext NOT NULL, + `post_title` text NOT NULL, + `post_excerpt` text NOT NULL, + `post_status` varchar(20) NOT NULL DEFAULT 'publish', + `comment_status` varchar(20) NOT NULL DEFAULT 'open', + `ping_status` varchar(20) NOT NULL DEFAULT 'open', + `post_password` varchar(20) NOT NULL DEFAULT '', + `post_name` varchar(200) NOT NULL DEFAULT '', + `to_ping` text NOT NULL, + `pinged` text NOT NULL, + `post_modified` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `post_modified_gmt` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `post_content_filtered` text NOT NULL, + `post_parent` bigint(20) unsigned NOT NULL DEFAULT '0', + `guid` varchar(255) NOT NULL DEFAULT '', + `menu_order` int(11) NOT NULL DEFAULT '0', + `post_type` varchar(20) NOT NULL DEFAULT 'post', + `post_mime_type` varchar(100) NOT NULL DEFAULT '', + `comment_count` bigint(20) NOT NULL DEFAULT '0', + PRIMARY KEY (`ID`), + KEY `post_name` (`post_name`), + KEY `type_status_date` (`post_type`,`post_status`,`post_date`,`ID`), + KEY `post_parent` (`post_parent`), + KEY `post_author` (`post_author`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=4 ; + +-- +-- Volcar la base de datos para la tabla `wp_posts` +-- + +INSERT INTO `wp_posts` (`ID`, `post_author`, `post_date`, `post_date_gmt`, `post_content`, `post_title`, `post_excerpt`, `post_status`, `comment_status`, `ping_status`, `post_password`, `post_name`, `to_ping`, `pinged`, `post_modified`, `post_modified_gmt`, `post_content_filtered`, `post_parent`, `guid`, `menu_order`, `post_type`, `post_mime_type`, `comment_count`) VALUES +(1, 1, '2011-09-23 17:04:51', '2011-09-23 17:04:51', 'Bienvenido a WordPress. Esta es tu primera entrada. Edítala o bórrala, ¡y comienza a publicar!.', '¡Hola mundo!', '', 'publish', 'open', 'open', '', 'hola-mundo', '', '', '2011-09-23 17:04:51', '2011-09-23 17:04:51', '', 0, 'http://localhost/instaldeco/?p=1', 0, 'post', '', 1), +(2, 1, '2011-09-23 17:04:51', '2011-09-23 17:04:51', 'Esta es una página de ejemplo, Es diferente a una entrada de un blog porque se mantiene estática y, en la mayoría de temas, se mostrará en la barra de navegación. Casi todo el mundo comienza con una página Sobre mí para presentarse a los potenciales visitantes. Puede decir algo así:\n\n
¡Hola!: Soy físico durante el día, lector de manga por las noches y este es mi blog. Vivo en Albacete y tengo un gato llamado Alex. Me encantan los mojitos (y mirar a la gente corriendo en los parques)
\n\nO algo así:\n\n
La empresa Calcetines XYC se fundó en 1973, y ha estado produciendo calcetines de calidad para sus clientes desde entonces. Se encuentra en Vetusta, tiene unos 2.000 empleados e intenta ayudar en lo que puede para mejorar la vida en Vestusta
\n\nDeberías ir a tu escritorio, borrar esta página y crear algunas nuevas con tu contenido. ¡A divertirse!', 'Página de ejemplo', '', 'publish', 'open', 'open', '', 'pagina-ejemplo', '', '', '2011-09-23 17:04:51', '2011-09-23 17:04:51', '', 0, 'http://localhost/instaldeco/?page_id=2', 0, 'page', '', 0), +(3, 1, '2011-09-23 17:05:05', '0000-00-00 00:00:00', '', 'Borrador automático', '', 'auto-draft', 'open', 'open', '', '', '', '', '2011-09-23 17:05:05', '0000-00-00 00:00:00', '', 0, 'http://localhost/instaldeco/?p=3', 0, 'post', '', 0); + +-- -------------------------------------------------------- + +-- +-- Estructura de tabla para la tabla `wp_terms` +-- + +CREATE TABLE IF NOT EXISTS `wp_terms` ( + `term_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(200) NOT NULL DEFAULT '', + `slug` varchar(200) NOT NULL DEFAULT '', + `term_group` bigint(10) NOT NULL DEFAULT '0', + PRIMARY KEY (`term_id`), + UNIQUE KEY `slug` (`slug`), + KEY `name` (`name`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=3 ; + +-- +-- Volcar la base de datos para la tabla `wp_terms` +-- + +INSERT INTO `wp_terms` (`term_id`, `name`, `slug`, `term_group`) VALUES +(1, 'Sin categoría', 'sin-categoria', 0), +(2, 'Sitios de interés', 'sitios-de-interes', 0); + +-- -------------------------------------------------------- + +-- +-- Estructura de tabla para la tabla `wp_term_relationships` +-- + +CREATE TABLE IF NOT EXISTS `wp_term_relationships` ( + `object_id` bigint(20) unsigned NOT NULL DEFAULT '0', + `term_taxonomy_id` bigint(20) unsigned NOT NULL DEFAULT '0', + `term_order` int(11) NOT NULL DEFAULT '0', + PRIMARY KEY (`object_id`,`term_taxonomy_id`), + KEY `term_taxonomy_id` (`term_taxonomy_id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; + +-- +-- Volcar la base de datos para la tabla `wp_term_relationships` +-- + +INSERT INTO `wp_term_relationships` (`object_id`, `term_taxonomy_id`, `term_order`) VALUES +(1, 2, 0), +(2, 2, 0), +(3, 2, 0), +(4, 2, 0), +(5, 2, 0), +(6, 2, 0), +(7, 2, 0), +(1, 1, 0); + +-- -------------------------------------------------------- + +-- +-- Estructura de tabla para la tabla `wp_term_taxonomy` +-- + +CREATE TABLE IF NOT EXISTS `wp_term_taxonomy` ( + `term_taxonomy_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `term_id` bigint(20) unsigned NOT NULL DEFAULT '0', + `taxonomy` varchar(32) NOT NULL DEFAULT '', + `description` longtext NOT NULL, + `parent` bigint(20) unsigned NOT NULL DEFAULT '0', + `count` bigint(20) NOT NULL DEFAULT '0', + PRIMARY KEY (`term_taxonomy_id`), + UNIQUE KEY `term_id_taxonomy` (`term_id`,`taxonomy`), + KEY `taxonomy` (`taxonomy`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=3 ; + +-- +-- Volcar la base de datos para la tabla `wp_term_taxonomy` +-- + +INSERT INTO `wp_term_taxonomy` (`term_taxonomy_id`, `term_id`, `taxonomy`, `description`, `parent`, `count`) VALUES +(1, 1, 'category', '', 0, 1), +(2, 2, 'link_category', '', 0, 7); + +-- -------------------------------------------------------- + +-- +-- Estructura de tabla para la tabla `wp_usermeta` +-- + +CREATE TABLE IF NOT EXISTS `wp_usermeta` ( + `umeta_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `user_id` bigint(20) unsigned NOT NULL DEFAULT '0', + `meta_key` varchar(255) DEFAULT NULL, + `meta_value` longtext, + PRIMARY KEY (`umeta_id`), + KEY `user_id` (`user_id`), + KEY `meta_key` (`meta_key`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=17 ; + +-- +-- Volcar la base de datos para la tabla `wp_usermeta` +-- + +INSERT INTO `wp_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`) VALUES +(1, 1, 'first_name', ''), +(2, 1, 'last_name', ''), +(3, 1, 'nickname', 'rodax'), +(4, 1, 'description', ''), +(5, 1, 'rich_editing', 'true'), +(6, 1, 'comment_shortcuts', 'false'), +(7, 1, 'admin_color', 'fresh'), +(8, 1, 'use_ssl', '0'), +(9, 1, 'show_admin_bar_front', 'true'), +(10, 1, 'show_admin_bar_admin', 'false'), +(11, 1, 'aim', ''), +(12, 1, 'yim', ''), +(13, 1, 'jabber', ''), +(14, 1, 'wp_capabilities', 'a:1:{s:13:"administrator";s:1:"1";}'), +(15, 1, 'wp_user_level', '10'), +(16, 1, 'wp_dashboard_quick_press_last_post_id', '3'); + +-- -------------------------------------------------------- + +-- +-- Estructura de tabla para la tabla `wp_users` +-- + +CREATE TABLE IF NOT EXISTS `wp_users` ( + `ID` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `user_login` varchar(60) NOT NULL DEFAULT '', + `user_pass` varchar(64) NOT NULL DEFAULT '', + `user_nicename` varchar(50) NOT NULL DEFAULT '', + `user_email` varchar(100) NOT NULL DEFAULT '', + `user_url` varchar(100) NOT NULL DEFAULT '', + `user_registered` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `user_activation_key` varchar(60) NOT NULL DEFAULT '', + `user_status` int(11) NOT NULL DEFAULT '0', + `display_name` varchar(250) NOT NULL DEFAULT '', + PRIMARY KEY (`ID`), + KEY `user_login_key` (`user_login`), + KEY `user_nicename` (`user_nicename`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ; + +-- +-- Volcar la base de datos para la tabla `wp_users` +-- + +INSERT INTO `wp_users` (`ID`, `user_login`, `user_pass`, `user_nicename`, `user_email`, `user_url`, `user_registered`, `user_activation_key`, `user_status`, `display_name`) VALUES +(1, 'rodax', '$P$BqFhZetRbRm3e2uUSMqEeLew82pySR1', 'rodax', 'darranz@rodax-software.com', '', '2011-09-23 17:04:51', '', 0, 'rodax'); diff --git a/src/index.php b/src/index.php new file mode 100644 index 0000000..49403ec --- /dev/null +++ b/src/index.php @@ -0,0 +1,18 @@ + \ No newline at end of file diff --git a/src/licencia.txt b/src/licencia.txt new file mode 100644 index 0000000..c87e954 --- /dev/null +++ b/src/licencia.txt @@ -0,0 +1,322 @@ + + GNU GENERAL PUBLIC LICENSE + Version 2, Junio 1991 + +Copyright (C) 1989, 1991 Free Software Foundation, Inc. +675 Mass Ave, Cambridge, MA 02139, EEUU + +Se permiten la copia y distribución de copias literales de este documento, +pero no se permite su modificación. + +----------------------------------------------------------------------- + + NOTA IMPORTANTE + +Esta es una traducción no oficial al español de la GNU General Public +License. No ha sido publicada por la Free Software Foundation, y no +establece legalmente las condiciones de distribución para el software que +usa la GNU GPL. Estas condiciones se establecen solamente por el texto +original, en inglés, de la GNU GPL. Sin embargo, esperamos que esta +traducción ayude a los hispanohablantes a entender mejor la GNU GPL. + + AUTORES DE LA TRADUCCIÓN + + * Jesús González Barahona + * Pedro de las Heras Quirós + * Jordi J. Canals (Revisión y Formato. Junio de 2008) + * Fernando Tellado (A partir de Noviembre de 2009) + + +----------------------------------------------------------------------- + + Preámbulo + + Las licencias que cubren la mayor parte del software están diseñadas +para quitarle a usted la libertad de compartirlo y modificarlo. Por el +contrario, la Licencia Pública General de GNU pretende garantizarle la +libertad de compartir y modificar software libre, para asegurar que el +software es libre para todos sus usuarios. Esta Licencia Pública General +se aplica a la mayor parte del software del la Free Software Foundation y +a cualquier otro programa si sus autores se comprometen a utilizarla. +(Existe otro software de la Free Software Foundation que está cubierto por +la Licencia Pública General de GNU para Bibliotecas). Si quiere, también +puede aplicarla a sus propios programas. + + Cuando hablamos de software libre, estamos refiriéndonos a libertad, no +a precio. Nuestras Licencias Públicas Generales están diseñadas para +asegurarnos de que tenga la libertad de distribuir copias de software +libre (y cobrar por ese servicio si quiere), de que reciba el código +fuente o que pueda conseguirlo si lo quiere, de que pueda modificar el +software o usar fragmentos de él en nuevos programas libres, y de que sepa +que puede hacer todas estas cosas. + + Para proteger sus derechos necesitamos algunas restricciones que +prohiban a cualquiera negarle a usted estos derechos o pedirle que +renuncie a ellos. Estas restricciones se traducen en ciertas obligaciones +que le afectan si distribuye copias del software, o si lo modifica. + + Por ejemplo, si distribuye copias de uno de estos programas, sea +gratuitamente, o a cambio de una contraprestación, debe dar a los +receptores todos los derechos que tiene. Debe asegurarse de que ellos +también reciben, o pueden conseguir, el código fuente. Y debe mostrarles +estas condiciones de forma que conozcan sus derechos. + + Protegemos sus derechos con la combinación de dos medidas: + + 1. Ponemos el software bajo copyright y + 2. le ofrecemos esta licencia, que le da permiso legal para copiar, + distribuir y/o modificar el software. + + También, para la protección de cada autor y la nuestra propia, queremos +asegurarnos de que todo el mundo comprende que no se proporciona ninguna +garantía para este software libre. Si el software se modifica por +cualquiera y éste a su vez lo distribuye, queremos que sus receptores +sepan que lo que tienen no es el original, de forma que cualquier problema +introducido por otros no afecte a la reputación de los autores originales. + + Por último, cualquier programa libre está constantemente amenazado por +patentes sobre el software. Queremos evitar el peligro de que los +redistribuidores de un programa libre obtengan patentes por su cuenta, +convirtiendo de facto el programa en propietario. Para evitar esto, hemos +dejado claro que cualquier patente debe ser pedida para el uso libre de +cualquiera, o no ser pedida. + + Los términos exactos y las condiciones para la copia, distribución y +modificación se exponen a continuación. + + + GNU GENERAL PUBLIC LICENSE + TERMINOS Y CONDICIONES PARA LA COPIA, DISTRIBUCIÓN Y MODIFICACIÓN + + 0. Esta Licencia se aplica a cualquier programa u otro tipo de trabajo +que contenga una nota colocada por el tenedor del copyright diciendo que +puede ser distribuido bajo los términos de esta Licencia Pública General. +En adelante, «Programa» se referirá a cualquier programa o trabajo que +cumpla esa condición y «trabajo basado en el Programa» se referirá bien al +Programa o a cualquier trabajo derivado de él según la ley de copyright. +Esto es, un trabajo que contenga el programa o una proción de él, bien en +forma literal o con modificaciones y/o traducido en otro lenguaje. Por +lo tanto, la traducción está incluida sin limitaciones en el término +«modificación». Cada concesionario (licenciatario) será denominado «usted». + +Cualquier otra actividad que no sea la copia, distribución o modificación +no está cubierta por esta Licencia, está fuera de su ámbito. El acto de +ejecutar el Programa no está restringido, y los resultados del Programa +están cubiertos únicamente si sus contenidos constituyen un trabajo basado +en el Programa, independientemente de haberlo producido mediante la +ejecución del programa. El que esto se cumpla, depende de lo que haga el +programa. + + 1. Usted puede copiar y distribuir copias literales del código fuente +del Programa, según lo has recibido, en cualquier medio, supuesto que de +forma adecuada y bien visible publique en cada copia un anuncio de +copyright adecuado y un repudio de garantía, mantenga intactos todos los +anuncios que se refieran a esta Licencia y a la ausencia de garantía, y +proporcione a cualquier otro receptor del programa una copia de esta +Licencia junto con el Programa. + +Puede cobrar un precio por el acto físico de transferir una copia, y +puede, según su libre albedrío, ofrecer garantía a cambio de unos +honorarios. + + 3. Puede modificar su copia o copias del Programa o de cualquier +porción de él, formando de esta manera un trabajo basado en el Programa, y +copiar y distribuir esa modificación o trabajo bajo los términos del +apartado 1, antedicho, supuesto que además cumpla las siguientes +condiciones: + + a) Debe hacer que los ficheros modificados lleven anuncios prominentes + indicando que los ha cambiado y la fecha de cualquier cambio. + + b) Debe hacer que cualquier trabajo que distribuya o publique y que en + todo o en parte contenga o sea derivado del Programa o de cualquier + parte de él sea licenciada como un todo, sin carga alguna, a todas las + terceras partes y bajo los términos de esta Licencia. + + c) Si el programa modificado lee normalmente órdenes interactivamente + cuando es ejecutado, debe hacer que, cuando comience su ejecución para + ese uso interactivo de la forma más habitual, muestre o escriba un + mensaje que incluya un anuncio de copyright y un anuncio de que no se + ofrece ninguna garantía (o por el contrario que sí se ofrece garantía) + y que los usuarios pueden redistribuir el programa bajo estas + condiciones, e indicando al usuario cómo ver una copia de esta + licencia. (Excepción: si el propio programa es interactivo pero + normalmente no muestra ese anuncio, no se requiere que su trabajo + basado en el Programa muestre ningún anuncio). + + +Estos requisitos se aplican al trabajo modificado como un todo. Si partes +identificables de ese trabajo no son derivadas del Programa, y pueden, +razonablemente, ser consideradas trabajos independientes y separados por +ellos mismos, entonces esta Licencia y sus términos no se aplican a esas +partes cuando sean distribuidas como trabajos separados. Pero cuando +distribuya esas mismas secciones como partes de un todo que es un trabajo +basado en el Programa, la distribución del todo debe ser según los +términos de esta licencia, cuyos permisos para otros licenciatarios se +extienden al todo completo, y por lo tanto a todas y cada una de sus +partes, con independencia de quién la escribió. Por lo tanto, no es la +intención de este apartado reclamar derechos o desafiar sus derechos sobre +trabajos escritos totalmente por usted mismo. El intento es ejercer el +derecho a controlar la distribución de trabajos derivados o colectivos +basados en el Programa. + +Además, el simple hecho de reunir un trabajo no basado en el Programa con +el Programa (o con un trabajo basado en el Programa) en un volumen de +almacenamiento o en un medio de distribución no hace que dicho trabajo +entre dentro del ámbito cubierto por esta Licencia. + + 3. Puede copiar y distribuir el Programa (o un trabajo basado en él, +según se especifica en el apartado 2, como código objeto o en formato +ejecutable según los términos de los apartados 1 y 2, supuesto que además +cumpla una de las siguientes condiciones: + + a) Acompañarlo con el código fuente completo correspondiente, en + formato electrónico, que debe ser distribuido según se especifica en + los apartados 1 y 2 de esta Licencia en un medio habitualmente + utilizado para el intercambio de programas, o + + b) Acompañarlo con una oferta por escrito, válida durante al menos + tres años, de proporcionar a cualquier tercera parte una copia completa + en formato electrónico del código fuente correspondiente, a un coste + no mayor que el de realizar físicamente la distribución del fuente, + que será distribuido bajo las condiciones descritas en los apartados 1 + y 2 anteriores, en un medio habitualmente utilizado para el + intercambio de programas, o + + c) Acompañarlo con la información que recibiste ofreciendo distribuir + el código fuente correspondiente. (Esta opción se permite sólo para + distribución no comercial y sólo si usted recibió el programa como + código objeto o en formato ejecutable con tal oferta, de acuerdo con + el apartado b anterior). + +Por código fuente de un trabajo se entiende la forma preferida del trabajo +cuando se le hacen modificaciones. Para un trabajo ejecutable, se entiende +por código fuente completo todo el código fuente para todos los módulos +que contiene, más cualquier fichero asociado de definición de interfaces, +más los guiones utilizados para controlar la compilación e instalación del +ejecutable. Como excepción especial el código fuente distribuido no +necesita incluir nada que sea distribuido normalmente (bien como fuente, +bien en forma binaria) con los componentes principales (compilador, kernel +y similares) del sistema operativo en el cual funciona el ejecutable, a no +ser que el propio componente acompañe al ejecutable. + +Si la distribución del ejecutable o del código objeto se hace mediante la +oferta acceso para copiarlo de un cierto lugar, entonces se considera la +oferta de acceso para copiar el código fuente del mismo lugar como +distribución del código fuente, incluso aunque terceras partes no estén +forzadas a copiar el fuente junto con el código objeto. + + 4. No puede copiar, modificar, sublicenciar o distribuir el Programa +excepto como prevé expresamente esta Licencia. Cualquier intento de +copiar, modificar sublicenciar o distribuir el Programa de otra forma es +inválida, y hará que cesen automáticamente los derechos que te proporciona +esta Licencia. En cualquier caso, las partes que hayan recibido copias o +derechos de usted bajo esta Licencia no cesarán en sus derechos mientras +esas partes continúen cumpliéndola. + + 5. No está obligado a aceptar esta licencia, ya que no la ha firmado. +Sin embargo, no hay hada más que le proporcione permiso para modificar o +distribuir el Programa o sus trabajos derivados. Estas acciones están +prohibidas por la ley si no acepta esta Licencia. Por lo tanto, si +modifica o distribuye el Programa (o cualquier trabajo basado en el +Programa), está indicando que acepta esta Licencia para poder hacerlo, y +todos sus términos y condiciones para copiar, distribuir o modificar el +Programa o trabajos basados en él. + + 6. Cada vez que redistribuya el Programa (o cualquier trabajo basado en +el Programa), el receptor recibe automáticamente una licencia del +licenciatario original para copiar, distribuir o modificar el Programa, de +forma sujeta a estos términos y condiciones. No puede imponer al receptor +ninguna restricción más sobre el ejercicio de los derechos aquí +garantizados. No es usted responsable de hacer cumplir esta licencia por +terceras partes. + + 7. Si como consecuencia de una resolución judicial o de una alegación de +infracción de patente o por cualquier otra razón (no limitada a asuntos +relacionados con patentes) se le imponen condiciones (ya sea por mandato +judicial, por acuerdo o por cualquier otra causa) que contradigan las +condiciones de esta Licencia, ello no le exime de cumplir las condiciones +de esta Licencia. Si no puede realizar distribuciones de forma que se +satisfagan simultáneamente sus obligaciones bajo esta licencia y cualquier +otra obligación pertinente entonces, como consecuencia, no puede +distribuir el Programa de ninguna forma. Por ejemplo, si una patente no +permite la redistribución libre de derechos de autor del Programa por +parte de todos aquellos que reciban copias directa o indirectamente a +través de usted, entonces la única forma en que podría satisfacer tanto +esa condición como esta Licencia sería evitar completamente la +distribución del Programa. + +Si cualquier porción de este apartado se considera inválida o imposible de +cumplir bajo cualquier circunstancia particular ha de cumplirse el resto y +la sección por entero ha de cumplirse en cualquier otra circunstancia + +No es el propósito de este apartado inducirle a infringir ninguna +reivindicación de patente ni de ningún otro derecho de propiedad o +impugnar la validez de ninguna de dichas reivindicaciones. Este apartado +tiene el único propósito de proteger la integridad del sistema de +distribución de software libre, que se realiza mediante prácticas de +licencia pública. Mucha gente ha hecho contribuciones generosas a la gran +variedad de software distribuido mediante ese sistema con la confianza de +que el sistema se aplicará consistentemente. Será el autor/donante quien +decida si quiere distribuir software mediante cualquier otro sistema y una +licencia no puede imponer esa elección. + +Este apartado pretende dejar completamente claro lo que se cree que es una +consecuencia del resto de esta Licencia. + + 8. Si la distribución y/o uso de el Programa está restringida en ciertos +países, bien por patentes o por interfaces bajo copyright, el tenedor del +copyright que coloca este Programa bajo esta Licencia puede añadir una +limitación explícita de distribución geográfica excluyendo esos países, de +forma que la distribución se permita sólo en o entre los países no +excluidos de esta manera. En ese caso, esta Licencia incorporará la +limitación como si estuviese escrita en el cuerpo de esta Licencia. + + 9. La Free Software Foundation puede publicar versiones revisadas y/o +nuevas de la Licencia Pública General de tiempo en tiempo. Dichas nuevas +versiones serán similares en espíritu a la presente versión, pero pueden +ser diferentes en detalles para considerar nuevos problemas o situaciones. + +Cada versión recibe un número de versión que la distingue de otras. Si el +Programa especifica un número de versión de esta Licencia que se refiere a +ella y a «cualquier versión posterior», tienes la opción de seguir los +términos y condiciones, bien de esa versión, bien de cualquier versión +posterior publicada por la Free Software Foundation. Si el Programa no +especifica un número de versión de esta Licencia, puedes escoger cualquier +versión publicada por la Free Software Foundation. + + 10. Si quiere incorporar partes del Programa en otros programas libres +cuyas condiciones de distribución son diferentes, escribe al autor para +pedirle permiso. Si el software tiene copyright de la Free Software +Foundation, escribe a la Free Software Foundation: algunas veces hacemos +excepciones en estos casos. Nuestra decisión estará guiada por el doble +objetivo de de preservar la libertad de todos los derivados de nuestro +software libre y promover el que se comparta y reutilice el software en +general. + + + AUSENCIA DE GARANTÍA + + 11. Como el programa se licencia libre de cargas, no se ofrece ninguna +garantía sobre el programa, en todas la extensión permitida por la +legislación aplicable. Excepto cuando se indique de otra forma por +escrito, los tenedores del copyright y/u otras partes proporcionan el +programa «tal cual», sin garantía de ninguna clase, bien expresa o +implícita, con inclusión, pero sin limitación a las garantías mercantiles +implícitas o a la conveniencia para un propósito particular. Cualquier +riesgo referente a la calidad y prestaciones del programa es asumido por +usted. Si se probase que el Programa es defectuoso, asume el coste de +cualquier servicio, reparación o corrección. + + 12. En ningún caso, salvo que lo requiera la legislación aplicable o +haya sido acordado por escrito, ningún tenedor del copyright ni ninguna +otra parte que modifique y/o redistribuya el Programa según se permite en +esta Licencia será responsable ante usted por daños, incluyendo cualquier +daño general, especial, incidental o resultante producido por el uso o la +imposibilidad de uso del Programa (con inclusión, pero sin limitación a la +pérdida de datos o a la generación incorrecta de datos o a pérdidas +sufridas por usted o por terceras partes o a un fallo del Programa al +funcionar en combinación con cualquier otro programa), incluso si dicho +tenedor u otra parte ha sido advertido de la posibilidad de dichos daños. + + FIN DE TÉRMINOS Y CONDICIONES diff --git a/src/license.txt b/src/license.txt new file mode 100644 index 0000000..d31195a --- /dev/null +++ b/src/license.txt @@ -0,0 +1,281 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 51 Franklin St, Fifth Floor, Boston, MA 02110, 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 + diff --git a/src/readme.html b/src/readme.html new file mode 100644 index 0000000..964d5d6 --- /dev/null +++ b/src/readme.html @@ -0,0 +1,104 @@ + + + + + WordPress › Léame + + + +

+ WordPress +
Versión 3.2.1 +

+

Plataforma Semántica de Publicación Personal

+ +

Para empezar

+

Te damos la bienvenida. WordPress es un proyecto muy especial para mí. Cada desarrollador o colaborador añade algo único a la mezcla, y juntos vamos creando algo hermoso de lo que me enorgullece formar parte. Se han dedicado miles de horas a WordPress y nos seguimos empleando en mejorarlo cada día. Gracias por hacerlo parte de tu mundo.

+

— Matt Mullenweg

+ +

Instalación: la famosa Instalación en 5 minutos

+
    +
  1. Descomprime el paquete en una carpeta vacía.
  2. +
  3. Abre wp-config-sample.php con un editor de texto como WordPad o similar y rellena los datos de tu conexión a la base de datos.
  4. +
  5. Guarda el archivo como wp-config.php.
  6. +
  7. Sube todo a tu servidor.
  8. +
  9. Abre /wp-admin/install.php en tu navegador. Con esto deberán crearse las tablas necesarias para tu blog. Si hay algún error, haz el favor de comprobar tu archivo wp-config.php y probar de nuevo. Si vuelve a fallar, visita los foros de ayuda con todos los datos que puedas aportar.
  10. +
  11. Anota la contraseña que se te proporcionará.
  12. +
  13. El programa de instalación te enviará entonces a la página de entrada. Entra con el nombre de usuario admin y la contraseña generada durante la instalación. Ahora podrás hacer clic en 'Perfil' y cambiar la contraseña.
  14. +
+ +

Actualizar

+

Usar el Actualizador automático

+

Si estás actualizando desde la versión 2.7 o superior puedes usar el actualizador automático:

+
    +
  1. Abre wp-admin/update-core.php en tu navegador y sigue las instrucciones.
  2. +
  3. ¿Querías más?.¡Eso es todo!
  4. +
+ +

Actualizar manualmente:

+
    +
  1. Antes de actualizar nada, asegúrate de tener copias de seguridad de cualquier archivo que hayas modificado, como index.php.
  2. +
  3. Elimina tus archivos de WP anteriores, guardando aquellos que hayas modificado.
  4. +
  5. Sube los nuevos archivos a tu servidor.
  6. +
  7. Dirige tu navegador a /wp-admin/upgrade.php.
  8. +
+

Cambios en las plantillas

+

Si has modificado tus plantillas, es posible que debas hacerles algunos cambios cuando actualices entre versiones mayores.

+ +

Migrar desde otros sistemas

+

WordPress puede importar contenido de otros sistemas. Lo primero que tienes que hacer es instalar WordPress y ponerlo en marcha como se ha descrito arriba, y luego usar nuestras herramientas de importación.

+ +

Requisitos del sistema

+ + +

Recomendaciones del sistema

+ + + +

Recursos en la red

+

Si alguna de tus preguntas no encuentra respuesta en este documento, te sugerimos que aproveches los numerosos recursos de WordPress en la red:

+
+
El Codex de WordPress
+
El Codex es la enciclopedia de todo lo relacionado con WordPress. Es la fuente de información más detallada disponible sobre WordPress.
+
El blog de desarrollo
+
Aquí encontrarás las últimas actualizaciones y noticias relacionadas con WordPress. Inclúyelo en tus marcadores y visítalo con frecuencia.
+
WordPress Planet
+
El WordPress Planet (Planeta WordPress) es un agregador de noticias que recopila entradas de blogs de WordPress por toda la web.
+
Foros de ayuda de WordPress
+
Si has buscado por todas partes pero sigues sin encontrar la respuesta, en los foros de ayuda, muy activos, cuentas con una amplia comunidad deseosa de ayudar. Para ayudarles a ayudarte, asegúrate de usar un título descriptivo e incluir en tu pregunta tantos detalles como te sea posible.
+
Canal IRC de WordPress
+
Por último, existe un canal de chat utilizado por la gente que usa Wordpress para intercambiar opiniones y eventualmente solicitar ayuda. La página del wiki que ves arriba podrá orientarte. (irc.freenode.net #wordpress)
+
+ +

Interfaz XML-RPC y Atom

+

Ahora puedes publicar en tu blog de WordPress con herramientas como Windows Live Writer, Ecto, Bloggar, Radio Userland (es decir, puedes utilizar la función de blog por e-mail de Radio Userland), NewzCrawler, y otras herramientas compatibles con las API (en inglés, Interfaz de Programación de la Aplicación) de blog. :) Puedes ampliar la información en XML-RPC support en el Codex.

+ +

Publicar por e-mail

+

Puedes publicar por medio de un cliente de e-mail. Para configurar esta opción, ve a la pantalla de opciones de "Escribir" y rellena los datos de tu cuenta POP3 secreta. Después tendrás que configurar la ejecución periódica de wp-mail.php para que revise el buzón en busca de correo nuevo. Puedes hacerlo mediante Cron-jobs o, si tu proveedor de alojamiento no lo permite, buscar uno de los muchos servicios de monitorización web para que compruebe la URL de tu wp-mail.php.

+

Publicar es sencillo: cualquier mensaje que envíes a la dirección especificada será publicado, con el asunto como título. Por eso es mejor mantener en privado la dirección. El script borrará los mensajes una vez publicados.

+ +

Perfiles de usuario

+

Hemos introducido un sistema flexible de perfiles de usuario en la versión 2.0. Puedes leer más sobre Funciones y Competencias en el Codex.

+ +

Notas finales

+ + +

Comparte tu afición

+

WordPress no cuenta con campañas de publicidad multimillonarias ni promotores famosos, pero tiene algo aún mejor: tú. Si disfrutas con WordPress, por favor, piensa en decírselo a un amigo, instalárselo a alguien menos entendido que tú o escribir al autor de un artículo que pase de nosotros.

+ +

WordPress es la continuación oficial de b2/cafélog, de Michel V. El trabajo se ha continuado gracias a los desarrolladores de WordPress. Si quieres apoyar a WordPress puedes dar un donativo.

+ +

Copyright

+

WordPress se distribuye bajo la GPLv2 (ver la licencia).

+ + + diff --git a/src/wp-activate.php b/src/wp-activate.php new file mode 100644 index 0000000..1ec4028 --- /dev/null +++ b/src/wp-activate.php @@ -0,0 +1,102 @@ +cache_enabled = false; + +do_action( 'activate_header' ); + +function do_activate_header() { + do_action( 'activate_wp_head' ); +} +add_action( 'wp_head', 'do_activate_header' ); + +function wpmu_activate_stylesheet() { + ?> + + + +
+ + +

+
+

+ +
+

+

+ +

+
+ + get_error_code() || 'blog_taken' == $result->get_error_code() ) { + $signup = $result->get_error_data(); + ?> +

+ '; + if ( $signup->domain . $signup->path == '' ) { + printf( __('Your account has been activated. You may now log in to the site using your chosen username of “%2$s”. Please check your email inbox at %3$s for your password and login instructions. If you do not receive an email, please check your junk or spam folder. If you still do not receive an email within an hour, you can reset your password.'), network_site_url( 'wp-login.php', 'login' ), $signup->user_login, $signup->user_email, network_site_url( 'wp-login.php?action=lostpassword', 'login' ) ); + } else { + printf( __('Your site at %2$s is active. You may now log in to your site using your chosen username of “%3$s”. Please check your email inbox at %4$s for your password and login instructions. If you do not receive an email, please check your junk or spam folder. If you still do not receive an email within an hour, you can reset your password.'), 'http://' . $signup->domain, $signup->domain, $signup->user_login, $signup->user_email, network_site_url( 'wp-login.php?action=lostpassword' ) ); + } + echo '

'; + } else { + ?> +

+ '.$result->get_error_message().'

'; + } + } else { + extract($result); + $url = get_blogaddress_by_id( (int) $blog_id); + $user = new WP_User( (int) $user_id); + ?> +

+ +
+

user_login ?>

+

+
+ + +

View your site or Log in'), $url, $url . 'wp-login.php' ); ?>

+ +

Log in or go back to the homepage.' ), network_site_url('wp-login.php', 'login'), network_home_url() ); ?>

+ +
+ + \ No newline at end of file diff --git a/src/wp-admin/admin-ajax.php b/src/wp-admin/admin-ajax.php new file mode 100644 index 0000000..18a853b --- /dev/null +++ b/src/wp-admin/admin-ajax.php @@ -0,0 +1,1555 @@ +ALERT: You are logged out! Could not save draft. Please log in again.'), wp_login_url() ); + $x = new WP_Ajax_Response( array( + 'what' => 'autosave', + 'id' => $id, + 'data' => $message + ) ); + $x->send(); + } + + if ( !empty( $_REQUEST['action'] ) ) + do_action( 'wp_ajax_nopriv_' . $_REQUEST['action'] ); + + die('-1'); +} + +if ( isset( $_GET['action'] ) ) : +switch ( $action = $_GET['action'] ) : +case 'fetch-list' : + + $list_class = $_GET['list_args']['class']; + check_ajax_referer( "fetch-list-$list_class", '_ajax_fetch_list_nonce' ); + + $current_screen = (object) $_GET['list_args']['screen']; + //TODO fix this in a better way see #15336 + $current_screen->is_network = 'false' === $current_screen->is_network ? false : true; + $current_screen->is_user = 'false' === $current_screen->is_user ? false : true; + + define( 'WP_NETWORK_ADMIN', $current_screen->is_network ); + define( 'WP_USER_ADMIN', $current_screen->is_user ); + + $wp_list_table = _get_list_table( $list_class ); + if ( ! $wp_list_table ) + die( '0' ); + + if ( ! $wp_list_table->ajax_user_can() ) + die( '-1' ); + + $wp_list_table->ajax_response(); + + die( '0' ); + break; +case 'ajax-tag-search' : + if ( isset( $_GET['tax'] ) ) { + $taxonomy = sanitize_key( $_GET['tax'] ); + $tax = get_taxonomy( $taxonomy ); + if ( ! $tax ) + die( '0' ); + if ( ! current_user_can( $tax->cap->assign_terms ) ) + die( '-1' ); + } else { + die('0'); + } + + $s = stripslashes( $_GET['q'] ); + + if ( false !== strpos( $s, ',' ) ) { + $s = explode( ',', $s ); + $s = $s[count( $s ) - 1]; + } + $s = trim( $s ); + if ( strlen( $s ) < 2 ) + die; // require 2 chars for matching + + $results = $wpdb->get_col( $wpdb->prepare( "SELECT t.name 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.name LIKE (%s)", $taxonomy, '%' . like_escape( $s ) . '%' ) ); + + echo join( $results, "\n" ); + die; + break; +case 'wp-compression-test' : + if ( !current_user_can( 'manage_options' ) ) + die('-1'); + + if ( ini_get('zlib.output_compression') || 'ob_gzhandler' == ini_get('output_handler') ) { + update_site_option('can_compress_scripts', 0); + die('0'); + } + + if ( isset($_GET['test']) ) { + 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' ); + header('Content-Type: application/x-javascript; charset=UTF-8'); + $force_gzip = ( defined('ENFORCE_GZIP') && ENFORCE_GZIP ); + $test_str = '"wpCompressionTest Lorem ipsum dolor sit amet consectetuer mollis sapien urna ut a. Eu nonummy condimentum fringilla tempor pretium platea vel nibh netus Maecenas. Hac molestie amet justo quis pellentesque est ultrices interdum nibh Morbi. Cras mattis pretium Phasellus ante ipsum ipsum ut sociis Suspendisse Lorem. Ante et non molestie. Porta urna Vestibulum egestas id congue nibh eu risus gravida sit. Ac augue auctor Ut et non a elit massa id sodales. Elit eu Nulla at nibh adipiscing mattis lacus mauris at tempus. Netus nibh quis suscipit nec feugiat eget sed lorem et urna. Pellentesque lacus at ut massa consectetuer ligula ut auctor semper Pellentesque. Ut metus massa nibh quam Curabitur molestie nec mauris congue. Volutpat molestie elit justo facilisis neque ac risus Ut nascetur tristique. Vitae sit lorem tellus et quis Phasellus lacus tincidunt nunc Fusce. Pharetra wisi Suspendisse mus sagittis libero lacinia Integer consequat ac Phasellus. Et urna ac cursus tortor aliquam Aliquam amet tellus volutpat Vestibulum. Justo interdum condimentum In augue congue tellus sollicitudin Quisque quis nibh."'; + + if ( 1 == $_GET['test'] ) { + echo $test_str; + die; + } elseif ( 2 == $_GET['test'] ) { + if ( !isset($_SERVER['HTTP_ACCEPT_ENCODING']) ) + die('-1'); + if ( false !== stripos( $_SERVER['HTTP_ACCEPT_ENCODING'], 'deflate') && function_exists('gzdeflate') && ! $force_gzip ) { + header('Content-Encoding: deflate'); + $out = gzdeflate( $test_str, 1 ); + } elseif ( false !== stripos( $_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') && function_exists('gzencode') ) { + header('Content-Encoding: gzip'); + $out = gzencode( $test_str, 1 ); + } else { + die('-1'); + } + echo $out; + die; + } elseif ( 'no' == $_GET['test'] ) { + update_site_option('can_compress_scripts', 0); + } elseif ( 'yes' == $_GET['test'] ) { + update_site_option('can_compress_scripts', 1); + } + } + + die('0'); + break; +case 'imgedit-preview' : + $post_id = intval($_GET['postid']); + if ( empty($post_id) || !current_user_can('edit_post', $post_id) ) + die('-1'); + + check_ajax_referer( "image_editor-$post_id" ); + + include_once( ABSPATH . 'wp-admin/includes/image-edit.php' ); + if ( ! stream_preview_image($post_id) ) + die('-1'); + + die(); + break; +case 'menu-quick-search': + if ( ! current_user_can( 'edit_theme_options' ) ) + die('-1'); + + require_once ABSPATH . 'wp-admin/includes/nav-menu.php'; + + _wp_ajax_menu_quick_search( $_REQUEST ); + + exit; + break; +case 'oembed-cache' : + $return = ( $wp_embed->cache_oembed( $_GET['post'] ) ) ? '1' : '0'; + die( $return ); + break; +default : + do_action( 'wp_ajax_' . $_GET['action'] ); + die('0'); + break; +endswitch; +endif; + +/** + * Sends back current comment total and new page links if they need to be updated. + * + * Contrary to normal success AJAX response ("1"), die with time() on success. + * + * @since 2.7 + * + * @param int $comment_id + * @return die + */ +function _wp_ajax_delete_comment_response( $comment_id, $delta = -1 ) { + $total = (int) @$_POST['_total']; + $per_page = (int) @$_POST['_per_page']; + $page = (int) @$_POST['_page']; + $url = esc_url_raw( @$_POST['_url'] ); + // JS didn't send us everything we need to know. Just die with success message + if ( !$total || !$per_page || !$page || !$url ) + die( (string) time() ); + + $total += $delta; + if ( $total < 0 ) + $total = 0; + + // Only do the expensive stuff on a page-break, and about 1 other time per page + if ( 0 == $total % $per_page || 1 == mt_rand( 1, $per_page ) ) { + $post_id = 0; + $status = 'total_comments'; // What type of comment count are we looking for? + $parsed = parse_url( $url ); + if ( isset( $parsed['query'] ) ) { + parse_str( $parsed['query'], $query_vars ); + if ( !empty( $query_vars['comment_status'] ) ) + $status = $query_vars['comment_status']; + if ( !empty( $query_vars['p'] ) ) + $post_id = (int) $query_vars['p']; + } + + $comment_count = wp_count_comments($post_id); + + if ( isset( $comment_count->$status ) ) // We're looking for a known type of comment count + $total = $comment_count->$status; + // else use the decremented value from above + } + + $time = time(); // The time since the last comment count + + $x = new WP_Ajax_Response( array( + 'what' => 'comment', + 'id' => $comment_id, // here for completeness - not used + 'supplemental' => array( + 'total_items_i18n' => sprintf( _n( '1 item', '%s items', $total ), number_format_i18n( $total ) ), + 'total_pages' => ceil( $total / $per_page ), + 'total_pages_i18n' => number_format_i18n( ceil( $total / $per_page ) ), + 'total' => $total, + 'time' => $time + ) + ) ); + $x->send(); +} + +function _wp_ajax_add_hierarchical_term() { + $action = $_POST['action']; + $taxonomy = get_taxonomy(substr($action, 4)); + check_ajax_referer( $action, '_ajax_nonce-add-' . $taxonomy->name ); + if ( !current_user_can( $taxonomy->cap->edit_terms ) ) + die('-1'); + $names = explode(',', $_POST['new'.$taxonomy->name]); + $parent = isset($_POST['new'.$taxonomy->name.'_parent']) ? (int) $_POST['new'.$taxonomy->name.'_parent'] : 0; + if ( 0 > $parent ) + $parent = 0; + if ( $taxonomy->name == 'category' ) + $post_category = isset($_POST['post_category']) ? (array) $_POST['post_category'] : array(); + else + $post_category = ( isset($_POST['tax_input']) && isset($_POST['tax_input'][$taxonomy->name]) ) ? (array) $_POST['tax_input'][$taxonomy->name] : array(); + $checked_categories = array_map( 'absint', (array) $post_category ); + $popular_ids = wp_popular_terms_checklist($taxonomy->name, 0, 10, false); + + foreach ( $names as $cat_name ) { + $cat_name = trim($cat_name); + $category_nicename = sanitize_title($cat_name); + if ( '' === $category_nicename ) + continue; + if ( !($cat_id = term_exists($cat_name, $taxonomy->name, $parent)) ) { + $new_term = wp_insert_term($cat_name, $taxonomy->name, array('parent' => $parent)); + $cat_id = $new_term['term_id']; + } + $checked_categories[] = $cat_id; + if ( $parent ) // Do these all at once in a second + continue; + $category = get_term( $cat_id, $taxonomy->name ); + ob_start(); + wp_terms_checklist( 0, array( 'taxonomy' => $taxonomy->name, 'descendants_and_self' => $cat_id, 'selected_cats' => $checked_categories, 'popular_cats' => $popular_ids )); + $data = ob_get_contents(); + ob_end_clean(); + $add = array( + 'what' => $taxonomy->name, + 'id' => $cat_id, + 'data' => str_replace( array("\n", "\t"), '', $data), + 'position' => -1 + ); + } + + if ( $parent ) { // Foncy - replace the parent and all its children + $parent = get_term( $parent, $taxonomy->name ); + $term_id = $parent->term_id; + + while ( $parent->parent ) { // get the top parent + $parent = &get_term( $parent->parent, $taxonomy->name ); + if ( is_wp_error( $parent ) ) + break; + $term_id = $parent->term_id; + } + + ob_start(); + wp_terms_checklist( 0, array('taxonomy' => $taxonomy->name, 'descendants_and_self' => $term_id, 'selected_cats' => $checked_categories, 'popular_cats' => $popular_ids)); + $data = ob_get_contents(); + ob_end_clean(); + $add = array( + 'what' => $taxonomy->name, + 'id' => $term_id, + 'data' => str_replace( array("\n", "\t"), '', $data), + 'position' => -1 + ); + } + + ob_start(); + wp_dropdown_categories( array( + 'taxonomy' => $taxonomy->name, 'hide_empty' => 0, 'name' => 'new'.$taxonomy->name.'_parent', 'orderby' => 'name', + 'hierarchical' => 1, 'show_option_none' => '— '.$taxonomy->labels->parent_item.' —' + ) ); + $sup = ob_get_contents(); + ob_end_clean(); + $add['supplemental'] = array( 'newcat_parent' => $sup ); + + $x = new WP_Ajax_Response( $add ); + $x->send(); +} + +$id = isset($_POST['id'])? (int) $_POST['id'] : 0; +switch ( $action = $_POST['action'] ) : +case 'delete-comment' : // On success, die with time() instead of 1 + if ( !$comment = get_comment( $id ) ) + die( (string) time() ); + if ( !current_user_can( 'edit_post', $comment->comment_post_ID ) ) + die('-1'); + + check_ajax_referer( "delete-comment_$id" ); + $status = wp_get_comment_status( $comment->comment_ID ); + + $delta = -1; + if ( isset($_POST['trash']) && 1 == $_POST['trash'] ) { + if ( 'trash' == $status ) + die( (string) time() ); + $r = wp_trash_comment( $comment->comment_ID ); + } elseif ( isset($_POST['untrash']) && 1 == $_POST['untrash'] ) { + if ( 'trash' != $status ) + die( (string) time() ); + $r = wp_untrash_comment( $comment->comment_ID ); + if ( ! isset( $_POST['comment_status'] ) || $_POST['comment_status'] != 'trash' ) // undo trash, not in trash + $delta = 1; + } elseif ( isset($_POST['spam']) && 1 == $_POST['spam'] ) { + if ( 'spam' == $status ) + die( (string) time() ); + $r = wp_spam_comment( $comment->comment_ID ); + } elseif ( isset($_POST['unspam']) && 1 == $_POST['unspam'] ) { + if ( 'spam' != $status ) + die( (string) time() ); + $r = wp_unspam_comment( $comment->comment_ID ); + if ( ! isset( $_POST['comment_status'] ) || $_POST['comment_status'] != 'spam' ) // undo spam, not in spam + $delta = 1; + } elseif ( isset($_POST['delete']) && 1 == $_POST['delete'] ) { + $r = wp_delete_comment( $comment->comment_ID ); + } else { + die('-1'); + } + + if ( $r ) // Decide if we need to send back '1' or a more complicated response including page links and comment counts + _wp_ajax_delete_comment_response( $comment->comment_ID, $delta ); + die( '0' ); + break; +case 'delete-tag' : + $tag_id = (int) $_POST['tag_ID']; + check_ajax_referer( "delete-tag_$tag_id" ); + + $taxonomy = !empty($_POST['taxonomy']) ? $_POST['taxonomy'] : 'post_tag'; + $tax = get_taxonomy($taxonomy); + + if ( !current_user_can( $tax->cap->delete_terms ) ) + die('-1'); + + $tag = get_term( $tag_id, $taxonomy ); + if ( !$tag || is_wp_error( $tag ) ) + die('1'); + + if ( wp_delete_term($tag_id, $taxonomy)) + die('1'); + else + die('0'); + break; +case 'delete-link' : + check_ajax_referer( "delete-bookmark_$id" ); + if ( !current_user_can( 'manage_links' ) ) + die('-1'); + + $link = get_bookmark( $id ); + if ( !$link || is_wp_error( $link ) ) + die('1'); + + if ( wp_delete_link( $id ) ) + die('1'); + else + die('0'); + break; +case 'delete-meta' : + check_ajax_referer( "delete-meta_$id" ); + if ( !$meta = get_post_meta_by_id( $id ) ) + die('1'); + + if ( !current_user_can( 'edit_post', $meta->post_id ) || is_protected_meta( $meta->meta_key ) ) + die('-1'); + if ( delete_meta( $meta->meta_id ) ) + die('1'); + die('0'); + break; +case 'delete-post' : + check_ajax_referer( "{$action}_$id" ); + if ( !current_user_can( 'delete_post', $id ) ) + die('-1'); + + if ( !get_post( $id ) ) + die('1'); + + if ( wp_delete_post( $id ) ) + die('1'); + else + die('0'); + break; +case 'trash-post' : +case 'untrash-post' : + check_ajax_referer( "{$action}_$id" ); + if ( !current_user_can( 'delete_post', $id ) ) + die('-1'); + + if ( !get_post( $id ) ) + die('1'); + + if ( 'trash-post' == $action ) + $done = wp_trash_post( $id ); + else + $done = wp_untrash_post( $id ); + + if ( $done ) + die('1'); + + die('0'); + break; +case 'delete-page' : + check_ajax_referer( "{$action}_$id" ); + if ( !current_user_can( 'delete_page', $id ) ) + die('-1'); + + if ( !get_page( $id ) ) + die('1'); + + if ( wp_delete_post( $id ) ) + die('1'); + else + die('0'); + break; +case 'dim-comment' : // On success, die with time() instead of 1 + + if ( !$comment = get_comment( $id ) ) { + $x = new WP_Ajax_Response( array( + 'what' => 'comment', + 'id' => new WP_Error('invalid_comment', sprintf(__('Comment %d does not exist'), $id)) + ) ); + $x->send(); + } + + if ( !current_user_can( 'edit_post', $comment->comment_post_ID ) && !current_user_can( 'moderate_comments' ) ) + die('-1'); + + $current = wp_get_comment_status( $comment->comment_ID ); + if ( $_POST['new'] == $current ) + die( (string) time() ); + + check_ajax_referer( "approve-comment_$id" ); + if ( in_array( $current, array( 'unapproved', 'spam' ) ) ) + $result = wp_set_comment_status( $comment->comment_ID, 'approve', true ); + else + $result = wp_set_comment_status( $comment->comment_ID, 'hold', true ); + + if ( is_wp_error($result) ) { + $x = new WP_Ajax_Response( array( + 'what' => 'comment', + 'id' => $result + ) ); + $x->send(); + } + + // Decide if we need to send back '1' or a more complicated response including page links and comment counts + _wp_ajax_delete_comment_response( $comment->comment_ID ); + die( '0' ); + break; +case 'add-link-category' : // On the Fly + check_ajax_referer( $action ); + if ( !current_user_can( 'manage_categories' ) ) + die('-1'); + $names = explode(',', $_POST['newcat']); + $x = new WP_Ajax_Response(); + foreach ( $names as $cat_name ) { + $cat_name = trim($cat_name); + $slug = sanitize_title($cat_name); + if ( '' === $slug ) + continue; + if ( !$cat_id = term_exists( $cat_name, 'link_category' ) ) { + $cat_id = wp_insert_term( $cat_name, 'link_category' ); + } + $cat_id = $cat_id['term_id']; + $cat_name = esc_html(stripslashes($cat_name)); + $x->add( array( + 'what' => 'link-category', + 'id' => $cat_id, + 'data' => "", + 'position' => -1 + ) ); + } + $x->send(); + break; +case 'add-tag' : + check_ajax_referer( 'add-tag', '_wpnonce_add-tag' ); + $post_type = !empty($_POST['post_type']) ? $_POST['post_type'] : 'post'; + $taxonomy = !empty($_POST['taxonomy']) ? $_POST['taxonomy'] : 'post_tag'; + $tax = get_taxonomy($taxonomy); + + if ( !current_user_can( $tax->cap->edit_terms ) ) + die('-1'); + + $x = new WP_Ajax_Response(); + + $tag = wp_insert_term($_POST['tag-name'], $taxonomy, $_POST ); + + if ( !$tag || is_wp_error($tag) || (!$tag = get_term( $tag['term_id'], $taxonomy )) ) { + $message = __('An error has occurred. Please reload the page and try again.'); + if ( is_wp_error($tag) && $tag->get_error_message() ) + $message = $tag->get_error_message(); + + $x->add( array( + 'what' => 'taxonomy', + 'data' => new WP_Error('error', $message ) + ) ); + $x->send(); + } + + set_current_screen( $_POST['screen'] ); + + $wp_list_table = _get_list_table('WP_Terms_List_Table'); + + $level = 0; + if ( is_taxonomy_hierarchical($taxonomy) ) { + $level = count( get_ancestors( $tag->term_id, $taxonomy ) ); + ob_start(); + $wp_list_table->single_row( $tag, $level ); + $noparents = ob_get_clean(); + } + + ob_start(); + $wp_list_table->single_row( $tag ); + $parents = ob_get_clean(); + + $x->add( array( + 'what' => 'taxonomy', + 'supplemental' => compact('parents', 'noparents') + ) ); + $x->add( array( + 'what' => 'term', + 'position' => $level, + 'supplemental' => (array) $tag + ) ); + $x->send(); + break; +case 'get-tagcloud' : + if ( isset( $_POST['tax'] ) ) { + $taxonomy = sanitize_key( $_POST['tax'] ); + $tax = get_taxonomy( $taxonomy ); + if ( ! $tax ) + die( '0' ); + if ( ! current_user_can( $tax->cap->assign_terms ) ) + die( '-1' ); + } else { + die('0'); + } + + $tags = get_terms( $taxonomy, array( 'number' => 45, 'orderby' => 'count', 'order' => 'DESC' ) ); + + if ( empty( $tags ) ) + die( isset( $tax->no_tagcloud ) ? $tax->no_tagcloud : __('No tags found!') ); + + if ( is_wp_error( $tags ) ) + die( $tags->get_error_message() ); + + foreach ( $tags as $key => $tag ) { + $tags[ $key ]->link = '#'; + $tags[ $key ]->id = $tag->term_id; + } + + // We need raw tag names here, so don't filter the output + $return = wp_generate_tag_cloud( $tags, array('filter' => 0) ); + + if ( empty($return) ) + die('0'); + + echo $return; + + exit; + break; +case 'get-comments' : + check_ajax_referer( $action ); + + set_current_screen( 'edit-comments' ); + + $wp_list_table = _get_list_table('WP_Post_Comments_List_Table'); + + if ( !current_user_can( 'edit_post', $post_id ) ) + die('-1'); + + $wp_list_table->prepare_items(); + + if ( !$wp_list_table->has_items() ) + die('1'); + + $x = new WP_Ajax_Response(); + ob_start(); + foreach ( $wp_list_table->items as $comment ) { + get_comment( $comment ); + $wp_list_table->single_row( $comment ); + } + $comment_list_item = ob_get_contents(); + ob_end_clean(); + + $x->add( array( + 'what' => 'comments', + 'data' => $comment_list_item + ) ); + $x->send(); + break; +case 'replyto-comment' : + check_ajax_referer( $action, '_ajax_nonce-replyto-comment' ); + + set_current_screen( 'edit-comments' ); + + $comment_post_ID = (int) $_POST['comment_post_ID']; + if ( !current_user_can( 'edit_post', $comment_post_ID ) ) + die('-1'); + + $status = $wpdb->get_var( $wpdb->prepare("SELECT post_status FROM $wpdb->posts WHERE ID = %d", $comment_post_ID) ); + + if ( empty($status) ) + die('1'); + elseif ( in_array($status, array('draft', 'pending', 'trash') ) ) + die( __('Error: you are replying to a comment on a draft post.') ); + + $user = wp_get_current_user(); + if ( $user->ID ) { + $comment_author = $wpdb->escape($user->display_name); + $comment_author_email = $wpdb->escape($user->user_email); + $comment_author_url = $wpdb->escape($user->user_url); + $comment_content = trim($_POST['content']); + if ( current_user_can('unfiltered_html') ) { + if ( wp_create_nonce('unfiltered-html-comment_' . $comment_post_ID) != $_POST['_wp_unfiltered_html_comment'] ) { + kses_remove_filters(); // start with a clean slate + kses_init_filters(); // set up the filters + } + } + } else { + die( __('Sorry, you must be logged in to reply to a comment.') ); + } + + if ( '' == $comment_content ) + die( __('Error: please type a comment.') ); + + $comment_parent = absint($_POST['comment_ID']); + $comment_auto_approved = false; + $commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_content', 'comment_type', 'comment_parent', 'user_ID'); + + $comment_id = wp_new_comment( $commentdata ); + $comment = get_comment($comment_id); + if ( ! $comment ) die('1'); + + $position = ( isset($_POST['position']) && (int) $_POST['position'] ) ? (int) $_POST['position'] : '-1'; + + + // automatically approve parent comment + if ( !empty($_POST['approve_parent']) ) { + $parent = get_comment( $comment_parent ); + + if ( $parent && $parent->comment_approved === '0' && $parent->comment_post_ID == $comment_post_ID ) { + if ( wp_set_comment_status( $parent->comment_ID, 'approve' ) ) + $comment_auto_approved = true; + } + } + + ob_start(); + if ( 'dashboard' == $_REQUEST['mode'] ) { + require_once( ABSPATH . 'wp-admin/includes/dashboard.php' ); + _wp_dashboard_recent_comments_row( $comment ); + } else { + if ( 'single' == $_REQUEST['mode'] ) { + $wp_list_table = _get_list_table('WP_Post_Comments_List_Table'); + } else { + $wp_list_table = _get_list_table('WP_Comments_List_Table'); + } + $wp_list_table->single_row( $comment ); + } + $comment_list_item = ob_get_contents(); + ob_end_clean(); + + $response = array( + 'what' => 'comment', + 'id' => $comment->comment_ID, + 'data' => $comment_list_item, + 'position' => $position + ); + + if ( $comment_auto_approved ) + $response['supplemental'] = array( 'parent_approved' => $parent->comment_ID ); + + $x = new WP_Ajax_Response(); + $x->add( $response ); + $x->send(); + break; +case 'edit-comment' : + check_ajax_referer( 'replyto-comment', '_ajax_nonce-replyto-comment' ); + + set_current_screen( 'edit-comments' ); + + $comment_post_ID = (int) $_POST['comment_post_ID']; + if ( ! current_user_can( 'edit_post', $comment_post_ID ) ) + die('-1'); + + if ( '' == $_POST['content'] ) + die( __('Error: please type a comment.') ); + + $comment_id = (int) $_POST['comment_ID']; + $_POST['comment_status'] = $_POST['status']; + edit_comment(); + + $position = ( isset($_POST['position']) && (int) $_POST['position']) ? (int) $_POST['position'] : '-1'; + $comments_status = isset($_POST['comments_listing']) ? $_POST['comments_listing'] : ''; + + $checkbox = ( isset($_POST['checkbox']) && true == $_POST['checkbox'] ) ? 1 : 0; + $wp_list_table = _get_list_table( $checkbox ? 'WP_Comments_List_Table' : 'WP_Post_Comments_List_Table' ); + + ob_start(); + $wp_list_table->single_row( get_comment( $comment_id ) ); + $comment_list_item = ob_get_contents(); + ob_end_clean(); + + $x = new WP_Ajax_Response(); + + $x->add( array( + 'what' => 'edit_comment', + 'id' => $comment->comment_ID, + 'data' => $comment_list_item, + 'position' => $position + )); + + $x->send(); + break; +case 'add-menu-item' : + if ( ! current_user_can( 'edit_theme_options' ) ) + die('-1'); + + check_ajax_referer( 'add-menu_item', 'menu-settings-column-nonce' ); + + require_once ABSPATH . 'wp-admin/includes/nav-menu.php'; + + // For performance reasons, we omit some object properties from the checklist. + // The following is a hacky way to restore them when adding non-custom items. + + $menu_items_data = array(); + foreach ( (array) $_POST['menu-item'] as $menu_item_data ) { + if ( + ! empty( $menu_item_data['menu-item-type'] ) && + 'custom' != $menu_item_data['menu-item-type'] && + ! empty( $menu_item_data['menu-item-object-id'] ) + ) { + switch( $menu_item_data['menu-item-type'] ) { + case 'post_type' : + $_object = get_post( $menu_item_data['menu-item-object-id'] ); + break; + + case 'taxonomy' : + $_object = get_term( $menu_item_data['menu-item-object-id'], $menu_item_data['menu-item-object'] ); + break; + } + + $_menu_items = array_map( 'wp_setup_nav_menu_item', array( $_object ) ); + $_menu_item = array_shift( $_menu_items ); + + // Restore the missing menu item properties + $menu_item_data['menu-item-description'] = $_menu_item->description; + } + + $menu_items_data[] = $menu_item_data; + } + + $item_ids = wp_save_nav_menu_items( 0, $menu_items_data ); + if ( is_wp_error( $item_ids ) ) + die('-1'); + + foreach ( (array) $item_ids as $menu_item_id ) { + $menu_obj = get_post( $menu_item_id ); + if ( ! empty( $menu_obj->ID ) ) { + $menu_obj = wp_setup_nav_menu_item( $menu_obj ); + $menu_obj->label = $menu_obj->title; // don't show "(pending)" in ajax-added items + $menu_items[] = $menu_obj; + } + } + + if ( ! empty( $menu_items ) ) { + $args = array( + 'after' => '', + 'before' => '', + 'link_after' => '', + 'link_before' => '', + 'walker' => new Walker_Nav_Menu_Edit, + ); + echo walk_nav_menu_tree( $menu_items, 0, (object) $args ); + } + break; +case 'add-meta' : + check_ajax_referer( 'add-meta', '_ajax_nonce-add-meta' ); + $c = 0; + $pid = (int) $_POST['post_id']; + $post = get_post( $pid ); + + if ( isset($_POST['metakeyselect']) || isset($_POST['metakeyinput']) ) { + if ( !current_user_can( 'edit_post', $pid ) ) + die('-1'); + if ( isset($_POST['metakeyselect']) && '#NONE#' == $_POST['metakeyselect'] && empty($_POST['metakeyinput']) ) + die('1'); + if ( $post->post_status == 'auto-draft' ) { + $save_POST = $_POST; // Backup $_POST + $_POST = array(); // Make it empty for edit_post() + $_POST['action'] = 'draft'; // Warning fix + $_POST['post_ID'] = $pid; + $_POST['post_type'] = $post->post_type; + $_POST['post_status'] = 'draft'; + $now = current_time('timestamp', 1); + $_POST['post_title'] = sprintf('Draft created on %s at %s', date(get_option('date_format'), $now), date(get_option('time_format'), $now)); + + if ( $pid = edit_post() ) { + if ( is_wp_error( $pid ) ) { + $x = new WP_Ajax_Response( array( + 'what' => 'meta', + 'data' => $pid + ) ); + $x->send(); + } + $_POST = $save_POST; // Now we can restore original $_POST again + if ( !$mid = add_meta( $pid ) ) + die(__('Please provide a custom field value.')); + } else { + die('0'); + } + } else if ( !$mid = add_meta( $pid ) ) { + die(__('Please provide a custom field value.')); + } + + $meta = get_post_meta_by_id( $mid ); + $pid = (int) $meta->post_id; + $meta = get_object_vars( $meta ); + $x = new WP_Ajax_Response( array( + 'what' => 'meta', + 'id' => $mid, + 'data' => _list_meta_row( $meta, $c ), + 'position' => 1, + 'supplemental' => array('postid' => $pid) + ) ); + } else { // Update? + $mid = (int) array_pop( array_keys($_POST['meta']) ); + $key = $_POST['meta'][$mid]['key']; + $value = $_POST['meta'][$mid]['value']; + if ( '' == trim($key) ) + die(__('Please provide a custom field name.')); + if ( '' == trim($value) ) + die(__('Please provide a custom field value.')); + if ( !$meta = get_post_meta_by_id( $mid ) ) + die('0'); // if meta doesn't exist + if ( !current_user_can( 'edit_post', $meta->post_id ) ) + die('-1'); + if ( is_protected_meta( $meta->meta_key ) ) + die('-1'); + if ( $meta->meta_value != stripslashes($value) || $meta->meta_key != stripslashes($key) ) { + if ( !$u = update_meta( $mid, $key, $value ) ) + die('0'); // We know meta exists; we also know it's unchanged (or DB error, in which case there are bigger problems). + } + + $key = stripslashes($key); + $value = stripslashes($value); + $x = new WP_Ajax_Response( array( + 'what' => 'meta', + 'id' => $mid, 'old_id' => $mid, + 'data' => _list_meta_row( array( + 'meta_key' => $key, + 'meta_value' => $value, + 'meta_id' => $mid + ), $c ), + 'position' => 0, + 'supplemental' => array('postid' => $meta->post_id) + ) ); + } + $x->send(); + break; +case 'add-user' : + check_ajax_referer( $action ); + if ( !current_user_can('create_users') ) + die('-1'); + if ( !$user_id = add_user() ) + die('0'); + elseif ( is_wp_error( $user_id ) ) { + $x = new WP_Ajax_Response( array( + 'what' => 'user', + 'id' => $user_id + ) ); + $x->send(); + } + $user_object = new WP_User( $user_id ); + + $wp_list_table = _get_list_table('WP_Users_List_Table'); + + $x = new WP_Ajax_Response( array( + 'what' => 'user', + 'id' => $user_id, + 'data' => $wp_list_table->single_row( $user_object, '', $user_object->roles[0] ), + 'supplemental' => array( + 'show-link' => sprintf(__( 'User %s added' ), "user-$user_id", $user_object->user_login), + 'role' => $user_object->roles[0] + ) + ) ); + $x->send(); + break; +case 'autosave' : // The name of this action is hardcoded in edit_post() + define( 'DOING_AUTOSAVE', true ); + + $nonce_age = check_ajax_referer( 'autosave', 'autosavenonce' ); + + $_POST['post_category'] = explode(",", $_POST['catslist']); + if ( $_POST['post_type'] == 'page' || empty($_POST['post_category']) ) + unset($_POST['post_category']); + + $do_autosave = (bool) $_POST['autosave']; + $do_lock = true; + + $data = $alert = ''; + /* translators: draft saved date format, see http://php.net/date */ + $draft_saved_date_format = __('g:i:s a'); + /* translators: %s: date and time */ + $message = sprintf( __('Draft saved at %s.'), date_i18n( $draft_saved_date_format ) ); + + $supplemental = array(); + if ( isset($login_grace_period) ) + $alert .= sprintf( __('Your login has expired. Please open a new browser window and log in again. '), add_query_arg( 'interim-login', 1, wp_login_url() ) ); + + $id = $revision_id = 0; + + $post_ID = (int) $_POST['post_ID']; + $_POST['ID'] = $post_ID; + $post = get_post($post_ID); + if ( 'auto-draft' == $post->post_status ) + $_POST['post_status'] = 'draft'; + + if ( $last = wp_check_post_lock( $post->ID ) ) { + $do_autosave = $do_lock = false; + + $last_user = get_userdata( $last ); + $last_user_name = $last_user ? $last_user->display_name : __( 'Someone' ); + $data = __( 'Autosave disabled.' ); + + $supplemental['disable_autosave'] = 'disable'; + $alert .= sprintf( __( '%s is currently editing this article. If you update it, you will overwrite the changes.' ), esc_html( $last_user_name ) ); + } + + if ( 'page' == $post->post_type ) { + if ( !current_user_can('edit_page', $post_ID) ) + die(__('You are not allowed to edit this page.')); + } else { + if ( !current_user_can('edit_post', $post_ID) ) + die(__('You are not allowed to edit this post.')); + } + + if ( $do_autosave ) { + // Drafts and auto-drafts are just overwritten by autosave + if ( 'auto-draft' == $post->post_status || 'draft' == $post->post_status ) { + $id = edit_post(); + } else { // Non drafts are not overwritten. The autosave is stored in a special post revision. + $revision_id = wp_create_post_autosave( $post->ID ); + if ( is_wp_error($revision_id) ) + $id = $revision_id; + else + $id = $post->ID; + } + $data = $message; + } else { + if ( isset( $_POST['auto_draft'] ) && '1' == $_POST['auto_draft'] ) + $id = 0; // This tells us it didn't actually save + else + $id = $post->ID; + } + + if ( $do_lock && ( isset( $_POST['auto_draft'] ) && ( $_POST['auto_draft'] != '1' ) ) && $id && is_numeric($id) ) + wp_set_post_lock( $id ); + + if ( $nonce_age == 2 ) { + $supplemental['replace-autosavenonce'] = wp_create_nonce('autosave'); + $supplemental['replace-getpermalinknonce'] = wp_create_nonce('getpermalink'); + $supplemental['replace-samplepermalinknonce'] = wp_create_nonce('samplepermalink'); + $supplemental['replace-closedpostboxesnonce'] = wp_create_nonce('closedpostboxes'); + if ( $id ) { + if ( $_POST['post_type'] == 'post' ) + $supplemental['replace-_wpnonce'] = wp_create_nonce('update-post_' . $id); + elseif ( $_POST['post_type'] == 'page' ) + $supplemental['replace-_wpnonce'] = wp_create_nonce('update-page_' . $id); + } + } + + if ( ! empty($alert) ) + $supplemental['alert'] = $alert; + + $x = new WP_Ajax_Response( array( + 'what' => 'autosave', + 'id' => $id, + 'data' => $id ? $data : '', + 'supplemental' => $supplemental + ) ); + $x->send(); + break; +case 'closed-postboxes' : + check_ajax_referer( 'closedpostboxes', 'closedpostboxesnonce' ); + $closed = isset( $_POST['closed'] ) ? explode( ',', $_POST['closed']) : array(); + $closed = array_filter($closed); + + $hidden = isset( $_POST['hidden'] ) ? explode( ',', $_POST['hidden']) : array(); + $hidden = array_filter($hidden); + + $page = isset( $_POST['page'] ) ? $_POST['page'] : ''; + + if ( !preg_match( '/^[a-z_-]+$/', $page ) ) + die('-1'); + + if ( ! $user = wp_get_current_user() ) + die('-1'); + + if ( is_array($closed) ) + update_user_option($user->ID, "closedpostboxes_$page", $closed, true); + + if ( is_array($hidden) ) { + $hidden = array_diff( $hidden, array('submitdiv', 'linksubmitdiv', 'manage-menu', 'create-menu') ); // postboxes that are always shown + update_user_option($user->ID, "metaboxhidden_$page", $hidden, true); + } + + die('1'); + break; +case 'hidden-columns' : + check_ajax_referer( 'screen-options-nonce', 'screenoptionnonce' ); + $hidden = isset( $_POST['hidden'] ) ? $_POST['hidden'] : ''; + $hidden = explode( ',', $_POST['hidden'] ); + $page = isset( $_POST['page'] ) ? $_POST['page'] : ''; + + if ( !preg_match( '/^[a-z_-]+$/', $page ) ) + die('-1'); + + if ( ! $user = wp_get_current_user() ) + die('-1'); + + if ( is_array($hidden) ) + update_user_option($user->ID, "manage{$page}columnshidden", $hidden, true); + + die('1'); + break; +case 'menu-get-metabox' : + if ( ! current_user_can( 'edit_theme_options' ) ) + die('-1'); + + require_once ABSPATH . 'wp-admin/includes/nav-menu.php'; + + if ( isset( $_POST['item-type'] ) && 'post_type' == $_POST['item-type'] ) { + $type = 'posttype'; + $callback = 'wp_nav_menu_item_post_type_meta_box'; + $items = (array) get_post_types( array( 'show_in_nav_menus' => true ), 'object' ); + } elseif ( isset( $_POST['item-type'] ) && 'taxonomy' == $_POST['item-type'] ) { + $type = 'taxonomy'; + $callback = 'wp_nav_menu_item_taxonomy_meta_box'; + $items = (array) get_taxonomies( array( 'show_ui' => true ), 'object' ); + } + + if ( ! empty( $_POST['item-object'] ) && isset( $items[$_POST['item-object']] ) ) { + $item = apply_filters( 'nav_menu_meta_box_object', $items[ $_POST['item-object'] ] ); + ob_start(); + call_user_func_array($callback, array( + null, + array( + 'id' => 'add-' . $item->name, + 'title' => $item->labels->name, + 'callback' => $callback, + 'args' => $item, + ) + )); + + $markup = ob_get_clean(); + + echo json_encode(array( + 'replace-id' => $type . '-' . $item->name, + 'markup' => $markup, + )); + } + + exit; + break; +case 'menu-quick-search': + if ( ! current_user_can( 'edit_theme_options' ) ) + die('-1'); + + require_once ABSPATH . 'wp-admin/includes/nav-menu.php'; + + _wp_ajax_menu_quick_search( $_REQUEST ); + + exit; + break; +case 'wp-link-ajax': + require_once ABSPATH . 'wp-admin/includes/internal-linking.php'; + + check_ajax_referer( 'internal-linking', '_ajax_linking_nonce' ); + + $args = array(); + + if ( isset( $_POST['search'] ) ) + $args['s'] = stripslashes( $_POST['search'] ); + $args['pagenum'] = ! empty( $_POST['page'] ) ? absint( $_POST['page'] ) : 1; + + $results = wp_link_query( $args ); + + if ( ! isset( $results ) ) + die( '0' ); + + echo json_encode( $results ); + echo "\n"; + + exit; + break; +case 'menu-locations-save': + if ( ! current_user_can( 'edit_theme_options' ) ) + die('-1'); + check_ajax_referer( 'add-menu_item', 'menu-settings-column-nonce' ); + if ( ! isset( $_POST['menu-locations'] ) ) + die('0'); + set_theme_mod( 'nav_menu_locations', array_map( 'absint', $_POST['menu-locations'] ) ); + die('1'); + break; +case 'meta-box-order': + check_ajax_referer( 'meta-box-order' ); + $order = isset( $_POST['order'] ) ? (array) $_POST['order'] : false; + $page_columns = isset( $_POST['page_columns'] ) ? (int) $_POST['page_columns'] : 0; + $page = isset( $_POST['page'] ) ? $_POST['page'] : ''; + + if ( !preg_match( '/^[a-z_-]+$/', $page ) ) + die('-1'); + + if ( ! $user = wp_get_current_user() ) + die('-1'); + + if ( $order ) + update_user_option($user->ID, "meta-box-order_$page", $order, true); + + if ( $page_columns ) + update_user_option($user->ID, "screen_layout_$page", $page_columns, true); + + die('1'); + break; +case 'get-permalink': + check_ajax_referer( 'getpermalink', 'getpermalinknonce' ); + $post_id = isset($_POST['post_id'])? intval($_POST['post_id']) : 0; + die(add_query_arg(array('preview' => 'true'), get_permalink($post_id))); +break; +case 'sample-permalink': + check_ajax_referer( 'samplepermalink', 'samplepermalinknonce' ); + $post_id = isset($_POST['post_id'])? intval($_POST['post_id']) : 0; + $title = isset($_POST['new_title'])? $_POST['new_title'] : ''; + $slug = isset($_POST['new_slug'])? $_POST['new_slug'] : null; + die(get_sample_permalink_html($post_id, $title, $slug)); +break; +case 'inline-save': + check_ajax_referer( 'inlineeditnonce', '_inline_edit' ); + + if ( ! isset($_POST['post_ID']) || ! ( $post_ID = (int) $_POST['post_ID'] ) ) + exit; + + if ( 'page' == $_POST['post_type'] ) { + if ( ! current_user_can( 'edit_page', $post_ID ) ) + die( __('You are not allowed to edit this page.') ); + } else { + if ( ! current_user_can( 'edit_post', $post_ID ) ) + die( __('You are not allowed to edit this post.') ); + } + + set_current_screen( $_POST['screen'] ); + + if ( $last = wp_check_post_lock( $post_ID ) ) { + $last_user = get_userdata( $last ); + $last_user_name = $last_user ? $last_user->display_name : __( 'Someone' ); + printf( $_POST['post_type'] == 'page' ? __( 'Saving is disabled: %s is currently editing this page.' ) : __( 'Saving is disabled: %s is currently editing this post.' ), esc_html( $last_user_name ) ); + exit; + } + + $data = &$_POST; + + $post = get_post( $post_ID, ARRAY_A ); + $post = add_magic_quotes($post); //since it is from db + + $data['content'] = $post['post_content']; + $data['excerpt'] = $post['post_excerpt']; + + // rename + $data['user_ID'] = $GLOBALS['user_ID']; + + if ( isset($data['post_parent']) ) + $data['parent_id'] = $data['post_parent']; + + // status + if ( isset($data['keep_private']) && 'private' == $data['keep_private'] ) + $data['post_status'] = 'private'; + else + $data['post_status'] = $data['_status']; + + if ( empty($data['comment_status']) ) + $data['comment_status'] = 'closed'; + if ( empty($data['ping_status']) ) + $data['ping_status'] = 'closed'; + + // update the post + edit_post(); + + $wp_list_table = _get_list_table('WP_Posts_List_Table'); + + $mode = $_POST['post_view']; + $wp_list_table->display_rows( array( get_post( $_POST['post_ID'] ) ) ); + + exit; + break; +case 'inline-save-tax': + check_ajax_referer( 'taxinlineeditnonce', '_inline_edit' ); + + $taxonomy = sanitize_key( $_POST['taxonomy'] ); + $tax = get_taxonomy( $taxonomy ); + if ( ! $tax ) + die( '0' ); + + if ( ! current_user_can( $tax->cap->edit_terms ) ) + die( '-1' ); + + set_current_screen( 'edit-' . $taxonomy ); + + $wp_list_table = _get_list_table('WP_Terms_List_Table'); + + if ( ! isset($_POST['tax_ID']) || ! ( $id = (int) $_POST['tax_ID'] ) ) + die(-1); + + $tag = get_term( $id, $taxonomy ); + $_POST['description'] = $tag->description; + + $updated = wp_update_term($id, $taxonomy, $_POST); + if ( $updated && !is_wp_error($updated) ) { + $tag = get_term( $updated['term_id'], $taxonomy ); + if ( !$tag || is_wp_error( $tag ) ) { + if ( is_wp_error($tag) && $tag->get_error_message() ) + die( $tag->get_error_message() ); + die( __('Item not updated.') ); + } + + echo $wp_list_table->single_row( $tag ); + } else { + if ( is_wp_error($updated) && $updated->get_error_message() ) + die( $updated->get_error_message() ); + die( __('Item not updated.') ); + } + + exit; + break; +case 'find_posts': + check_ajax_referer( 'find-posts' ); + + if ( empty($_POST['ps']) ) + exit; + + if ( !empty($_POST['post_type']) && in_array( $_POST['post_type'], get_post_types() ) ) + $what = $_POST['post_type']; + else + $what = 'post'; + + $s = stripslashes($_POST['ps']); + preg_match_all('/".*?("|$)|((?<=[\\s",+])|^)[^\\s",+]+/', $s, $matches); + $search_terms = array_map('_search_terms_tidy', $matches[0]); + + $searchand = $search = ''; + foreach ( (array) $search_terms as $term ) { + $term = esc_sql( like_escape( $term ) ); + $search .= "{$searchand}(($wpdb->posts.post_title LIKE '%{$term}%') OR ($wpdb->posts.post_content LIKE '%{$term}%'))"; + $searchand = ' AND '; + } + $term = esc_sql( like_escape( $s ) ); + if ( count($search_terms) > 1 && $search_terms[0] != $s ) + $search .= " OR ($wpdb->posts.post_title LIKE '%{$term}%') OR ($wpdb->posts.post_content LIKE '%{$term}%')"; + + $posts = $wpdb->get_results( "SELECT ID, post_title, post_status, post_date FROM $wpdb->posts WHERE post_type = '$what' AND post_status IN ('draft', 'publish') AND ($search) ORDER BY post_date_gmt DESC LIMIT 50" ); + + if ( ! $posts ) { + $posttype = get_post_type_object($what); + exit($posttype->labels->not_found); + } + + $html = ''; + foreach ( $posts as $post ) { + + switch ( $post->post_status ) { + case 'publish' : + case 'private' : + $stat = __('Published'); + break; + case 'future' : + $stat = __('Scheduled'); + break; + case 'pending' : + $stat = __('Pending Review'); + break; + case 'draft' : + $stat = __('Draft'); + break; + } + + if ( '0000-00-00 00:00:00' == $post->post_date ) { + $time = ''; + } else { + /* translators: date format in table columns, see http://php.net/date */ + $time = mysql2date(__('Y/m/d'), $post->post_date); + } + + $html .= ''; + $html .= ''."\n\n"; + } + $html .= '

'.__('Title').''.__('Date').''.__('Status').'
'.esc_html( $time ).''.esc_html( $stat ).'
'; + + $x = new WP_Ajax_Response(); + $x->add( array( + 'what' => $what, + 'data' => $html + )); + $x->send(); + + break; +case 'widgets-order' : + check_ajax_referer( 'save-sidebar-widgets', 'savewidgets' ); + + if ( !current_user_can('edit_theme_options') ) + die('-1'); + + unset( $_POST['savewidgets'], $_POST['action'] ); + + // save widgets order for all sidebars + if ( is_array($_POST['sidebars']) ) { + $sidebars = array(); + foreach ( $_POST['sidebars'] as $key => $val ) { + $sb = array(); + if ( !empty($val) ) { + $val = explode(',', $val); + foreach ( $val as $k => $v ) { + if ( strpos($v, 'widget-') === false ) + continue; + + $sb[$k] = substr($v, strpos($v, '_') + 1); + } + } + $sidebars[$key] = $sb; + } + wp_set_sidebars_widgets($sidebars); + die('1'); + } + + die('-1'); + break; +case 'save-widget' : + check_ajax_referer( 'save-sidebar-widgets', 'savewidgets' ); + + if ( !current_user_can('edit_theme_options') || !isset($_POST['id_base']) ) + die('-1'); + + unset( $_POST['savewidgets'], $_POST['action'] ); + + do_action('load-widgets.php'); + do_action('widgets.php'); + do_action('sidebar_admin_setup'); + + $id_base = $_POST['id_base']; + $widget_id = $_POST['widget-id']; + $sidebar_id = $_POST['sidebar']; + $multi_number = !empty($_POST['multi_number']) ? (int) $_POST['multi_number'] : 0; + $settings = isset($_POST['widget-' . $id_base]) && is_array($_POST['widget-' . $id_base]) ? $_POST['widget-' . $id_base] : false; + $error = '

' . __('An error has occurred. Please reload the page and try again.') . '

'; + + $sidebars = wp_get_sidebars_widgets(); + $sidebar = isset($sidebars[$sidebar_id]) ? $sidebars[$sidebar_id] : array(); + + // delete + if ( isset($_POST['delete_widget']) && $_POST['delete_widget'] ) { + + if ( !isset($wp_registered_widgets[$widget_id]) ) + die($error); + + $sidebar = array_diff( $sidebar, array($widget_id) ); + $_POST = array('sidebar' => $sidebar_id, 'widget-' . $id_base => array(), 'the-widget-id' => $widget_id, 'delete_widget' => '1'); + } elseif ( $settings && preg_match( '/__i__|%i%/', key($settings) ) ) { + if ( !$multi_number ) + die($error); + + $_POST['widget-' . $id_base] = array( $multi_number => array_shift($settings) ); + $widget_id = $id_base . '-' . $multi_number; + $sidebar[] = $widget_id; + } + $_POST['widget-id'] = $sidebar; + + foreach ( (array) $wp_registered_widget_updates as $name => $control ) { + + if ( $name == $id_base ) { + if ( !is_callable( $control['callback'] ) ) + continue; + + ob_start(); + call_user_func_array( $control['callback'], $control['params'] ); + ob_end_clean(); + break; + } + } + + if ( isset($_POST['delete_widget']) && $_POST['delete_widget'] ) { + $sidebars[$sidebar_id] = $sidebar; + wp_set_sidebars_widgets($sidebars); + echo "deleted:$widget_id"; + die(); + } + + if ( !empty($_POST['add_new']) ) + die(); + + if ( $form = $wp_registered_widget_controls[$widget_id] ) + call_user_func_array( $form['callback'], $form['params'] ); + + die(); + break; +case 'image-editor': + $attachment_id = intval($_POST['postid']); + if ( empty($attachment_id) || !current_user_can('edit_post', $attachment_id) ) + die('-1'); + + check_ajax_referer( "image_editor-$attachment_id" ); + include_once( ABSPATH . 'wp-admin/includes/image-edit.php' ); + + $msg = false; + switch ( $_POST['do'] ) { + case 'save' : + $msg = wp_save_image($attachment_id); + $msg = json_encode($msg); + die($msg); + break; + case 'scale' : + $msg = wp_save_image($attachment_id); + break; + case 'restore' : + $msg = wp_restore_image($attachment_id); + break; + } + + wp_image_editor($attachment_id, $msg); + die(); + break; +case 'set-post-thumbnail': + $post_ID = intval( $_POST['post_id'] ); + if ( !current_user_can( 'edit_post', $post_ID ) ) + die( '-1' ); + $thumbnail_id = intval( $_POST['thumbnail_id'] ); + + check_ajax_referer( "set_post_thumbnail-$post_ID" ); + + if ( $thumbnail_id == '-1' ) { + delete_post_meta( $post_ID, '_thumbnail_id' ); + die( _wp_post_thumbnail_html() ); + } + + if ( set_post_thumbnail( $post_ID, $thumbnail_id ) ) + die( _wp_post_thumbnail_html( $thumbnail_id ) ); + die( '0' ); + break; +case 'date_format' : + die( date_i18n( sanitize_option( 'date_format', $_POST['date'] ) ) ); + break; +case 'time_format' : + die( date_i18n( sanitize_option( 'time_format', $_POST['date'] ) ) ); + break; +case 'wp-fullscreen-save-post' : + if ( isset($_POST['post_ID']) ) + $post_id = (int) $_POST['post_ID']; + else + $post_id = 0; + + $post = null; + $post_type_object = null; + $post_type = null; + if ( $post_id ) { + $post = get_post($post_id); + if ( $post ) { + $post_type_object = get_post_type_object($post->post_type); + if ( $post_type_object ) { + $post_type = $post->post_type; + $current_screen->post_type = $post->post_type; + $current_screen->id = $current_screen->post_type; + } + } + } elseif ( isset($_POST['post_type']) ) { + $post_type_object = get_post_type_object($_POST['post_type']); + if ( $post_type_object ) { + $post_type = $post_type_object->name; + $current_screen->post_type = $post_type; + $current_screen->id = $current_screen->post_type; + } + } + + check_ajax_referer('update-' . $post_type . '_' . $post_id, '_wpnonce'); + + $post_id = edit_post(); + + if ( is_wp_error($post_id) ) { + if ( $post_id->get_error_message() ) + $message = $post_id->get_error_message(); + else + $message = __('Save failed'); + + echo json_encode( array( 'message' => $message, 'last_edited' => '' ) ); + die(); + } else { + $message = __('Saved.'); + } + + if ( $post ) { + $last_date = mysql2date( get_option('date_format'), $post->post_modified ); + $last_time = mysql2date( get_option('time_format'), $post->post_modified ); + } else { + $last_date = date_i18n( get_option('date_format') ); + $last_time = date_i18n( get_option('time_format') ); + } + + if ( $last_id = get_post_meta($post_id, '_edit_last', true) ) { + $last_user = get_userdata($last_id); + $last_edited = sprintf( __('Last edited by %1$s on %2$s at %3$s'), esc_html( $last_user->display_name ), $last_date, $last_time ); + } else { + $last_edited = sprintf( __('Last edited on %1$s at %2$s'), $last_date, $last_time ); + } + + echo json_encode( array( 'message' => $message, 'last_edited' => $last_edited ) ); + die(); + break; +default : + do_action( 'wp_ajax_' . $_POST['action'] ); + die('0'); + break; +endswitch; +?> diff --git a/src/wp-admin/admin-footer.php b/src/wp-admin/admin-footer.php new file mode 100644 index 0000000..04d7315 --- /dev/null +++ b/src/wp-admin/admin-footer.php @@ -0,0 +1,51 @@ + + +
+
+
+ + + + +
+ + + diff --git a/src/wp-admin/admin-functions.php b/src/wp-admin/admin-functions.php new file mode 100644 index 0000000..b8c84fd --- /dev/null +++ b/src/wp-admin/admin-functions.php @@ -0,0 +1,16 @@ + \ No newline at end of file diff --git a/src/wp-admin/admin-header.php b/src/wp-admin/admin-header.php new file mode 100644 index 0000000..18b5ff3 --- /dev/null +++ b/src/wp-admin/admin-header.php @@ -0,0 +1,219 @@ + + + > + + +<?php echo $admin_title; ?> + + + + + + +"> + + +
+ +
+ + +
+parent_file = $parent_file; +$current_screen->parent_base = preg_replace('/\?.*$/', '', $parent_file); +$current_screen->parent_base = str_replace('.php', '', $current_screen->parent_base); +?> + +
+ \ No newline at end of file diff --git a/src/wp-admin/admin.php b/src/wp-admin/admin.php new file mode 100644 index 0000000..ce1227d --- /dev/null +++ b/src/wp-admin/admin.php @@ -0,0 +1,238 @@ +flush_rules(); + update_option( 'db_upgraded', false ); + + /** + * Runs on the next page load after successful upgrade + * + * @since 2.8 + */ + do_action('after_db_upgrade'); +} elseif ( get_option('db_version') != $wp_db_version ) { + if ( !is_multisite() ) { + wp_redirect(admin_url('upgrade.php?_wp_http_referer=' . urlencode(stripslashes($_SERVER['REQUEST_URI'])))); + exit; + } elseif ( apply_filters( 'do_mu_upgrade', true ) ) { + /** + * On really small MU installs run the upgrader every time, + * else run it less often to reduce load. + * + * @since 2.8.4b + */ + $c = get_blog_count(); + if ( $c <= 50 || ( $c > 50 && mt_rand( 0, (int)( $c / 50 ) ) == 1 ) ) { + require_once( ABSPATH . WPINC . '/http.php' ); + $response = wp_remote_get( admin_url( 'upgrade.php?step=1' ), array( 'timeout' => 120, 'httpversion' => '1.1' ) ); + do_action( 'after_mu_upgrade', $response ); + unset($response); + } + unset($c); + } +} + +require_once(ABSPATH . 'wp-admin/includes/admin.php'); + +auth_redirect(); + +nocache_headers(); + +// Schedule trash collection +if ( !wp_next_scheduled('wp_scheduled_delete') && !defined('WP_INSTALLING') ) + wp_schedule_event(time(), 'daily', 'wp_scheduled_delete'); + +set_screen_options(); + +$date_format = get_option('date_format'); +$time_format = get_option('time_format'); + +wp_reset_vars(array('profile', 'redirect', 'redirect_url', 'a', 'text', 'trackback', 'pingback')); + +wp_enqueue_script( 'common' ); +wp_enqueue_script( 'jquery-color' ); + +$editing = false; + +if ( isset($_GET['page']) ) { + $plugin_page = stripslashes($_GET['page']); + $plugin_page = plugin_basename($plugin_page); +} + +if ( isset($_GET['post_type']) ) + $typenow = sanitize_key($_GET['post_type']); +else + $typenow = ''; + +if ( isset($_GET['taxonomy']) ) + $taxnow = sanitize_key($_GET['taxonomy']); +else + $taxnow = ''; + +if ( WP_NETWORK_ADMIN ) + require(ABSPATH . 'wp-admin/network/menu.php'); +elseif ( WP_USER_ADMIN ) + require(ABSPATH . 'wp-admin/user/menu.php'); +else + require(ABSPATH . 'wp-admin/menu.php'); + +if ( current_user_can( 'manage_options' ) ) + @ini_set( 'memory_limit', apply_filters( 'admin_memory_limit', WP_MAX_MEMORY_LIMIT ) ); + +do_action('admin_init'); + +if ( isset($plugin_page) ) { + if ( !empty($typenow) ) + $the_parent = $pagenow . '?post_type=' . $typenow; + else + $the_parent = $pagenow; + if ( ! $page_hook = get_plugin_page_hook($plugin_page, $the_parent) ) { + $page_hook = get_plugin_page_hook($plugin_page, $plugin_page); + // backwards compatibility for plugins using add_management_page + if ( empty( $page_hook ) && 'edit.php' == $pagenow && '' != get_plugin_page_hook($plugin_page, 'tools.php') ) { + // There could be plugin specific params on the URL, so we need the whole query string + if ( !empty($_SERVER[ 'QUERY_STRING' ]) ) + $query_string = $_SERVER[ 'QUERY_STRING' ]; + else + $query_string = 'page=' . $plugin_page; + wp_redirect( admin_url('tools.php?' . $query_string) ); + exit; + } + } + unset($the_parent); +} + +$hook_suffix = ''; +if ( isset($page_hook) ) + $hook_suffix = $page_hook; +else if ( isset($plugin_page) ) + $hook_suffix = $plugin_page; +else if ( isset($pagenow) ) + $hook_suffix = $pagenow; + +set_current_screen(); + +// Handle plugin admin pages. +if ( isset($plugin_page) ) { + if ( $page_hook ) { + do_action('load-' . $page_hook); + if (! isset($_GET['noheader'])) + require_once(ABSPATH . 'wp-admin/admin-header.php'); + + do_action($page_hook); + } else { + if ( validate_file($plugin_page) ) + wp_die(__('Invalid plugin page')); + + + if ( !( file_exists(WP_PLUGIN_DIR . "/$plugin_page") && is_file(WP_PLUGIN_DIR . "/$plugin_page") ) && !( file_exists(WPMU_PLUGIN_DIR . "/$plugin_page") && is_file(WPMU_PLUGIN_DIR . "/$plugin_page") ) ) + wp_die(sprintf(__('Cannot load %s.'), htmlentities($plugin_page))); + + do_action('load-' . $plugin_page); + + if ( !isset($_GET['noheader'])) + require_once(ABSPATH . 'wp-admin/admin-header.php'); + + if ( file_exists(WPMU_PLUGIN_DIR . "/$plugin_page") ) + include(WPMU_PLUGIN_DIR . "/$plugin_page"); + else + include(WP_PLUGIN_DIR . "/$plugin_page"); + } + + include(ABSPATH . 'wp-admin/admin-footer.php'); + + exit(); +} else if (isset($_GET['import'])) { + + $importer = $_GET['import']; + + if ( ! current_user_can('import') ) + wp_die(__('You are not allowed to import.')); + + if ( validate_file($importer) ) { + wp_redirect( admin_url( 'import.php?invalid=' . $importer ) ); + exit; + } + + // Allow plugins to define importers as well + if ( !isset($wp_importers) || !isset($wp_importers[$importer]) || ! is_callable($wp_importers[$importer][2])) { + if (! file_exists(ABSPATH . "wp-admin/import/$importer.php")) { + wp_redirect( admin_url( 'import.php?invalid=' . $importer ) ); + exit; + } + include(ABSPATH . "wp-admin/import/$importer.php"); + } + + $parent_file = 'tools.php'; + $submenu_file = 'import.php'; + $title = __('Import'); + + if (! isset($_GET['noheader'])) + require_once(ABSPATH . 'wp-admin/admin-header.php'); + + require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); + + define('WP_IMPORTING', true); + + if ( apply_filters( 'force_filtered_html_on_import', false ) ) + kses_init_filters(); // Always filter imported data with kses on multisite. + + call_user_func($wp_importers[$importer][2]); + + include(ABSPATH . 'wp-admin/admin-footer.php'); + + // Make sure rules are flushed + global $wp_rewrite; + $wp_rewrite->flush_rules(false); + + exit(); +} else { + do_action("load-$pagenow"); + // Backwards compatibility with old load-page-new.php, load-page.php, + // and load-categories.php actions. + if ( $typenow == 'page' ) { + if ( $pagenow == 'post-new.php' ) + do_action( 'load-page-new.php' ); + elseif ( $pagenow == 'post.php' ) + do_action( 'load-page.php' ); + } elseif ( $pagenow == 'edit-tags.php' ) { + if ( $taxnow == 'category' ) + do_action( 'load-categories.php' ); + elseif ( $taxnow == 'link_category' ) + do_action( 'load-edit-link-categories.php' ); + } +} + +if ( !empty($_REQUEST['action']) ) + do_action('admin_action_' . $_REQUEST['action']); + +?> diff --git a/src/wp-admin/async-upload.php b/src/wp-admin/async-upload.php new file mode 100644 index 0000000..6fa6518 --- /dev/null +++ b/src/wp-admin/async-upload.php @@ -0,0 +1,70 @@ +post_type ) + wp_die( __( 'Unknown post type.' ) ); + $post_type_object = get_post_type_object( 'attachment' ); + if ( ! current_user_can( $post_type_object->cap->edit_post, $id ) ) + wp_die( __( 'You are not allowed to edit this item.' ) ); + + if ( 2 == $_REQUEST['fetch'] ) { + add_filter('attachment_fields_to_edit', 'media_single_attachment_fields_to_edit', 10, 2); + echo get_media_item($id, array( 'send' => false, 'delete' => true )); + } else { + add_filter('attachment_fields_to_edit', 'media_post_single_attachment_fields_to_edit', 10, 2); + echo get_media_item($id); + } + exit; +} + +check_admin_referer('media-form'); + +$id = media_handle_upload('async-upload', $_REQUEST['post_id']); +if ( is_wp_error($id) ) { + echo '
+ ' . __('Dismiss') . ' + ' . sprintf(__('“%s” has failed to upload due to an error'), esc_html($_FILES['async-upload']['name']) ) . '
' . + esc_html($id->get_error_message()) . '
'; + exit; +} + +if ( $_REQUEST['short'] ) { + // short form response - attachment ID only + echo $id; +} else { + // long form response - big chunk o html + $type = $_REQUEST['type']; + echo apply_filters("async_upload_{$type}", $id); +} + +?> diff --git a/src/wp-admin/comment.php b/src/wp-admin/comment.php new file mode 100644 index 0000000..a26ed5c --- /dev/null +++ b/src/wp-admin/comment.php @@ -0,0 +1,289 @@ +

$msg

"; + include('./admin-footer.php'); + die; +} + +switch( $action ) { + +case 'editcomment' : + $title = __('Edit Comment'); + + add_contextual_help( $current_screen, '

' . __( 'You can edit the information left in a comment if needed. This is often useful when you notice that a commenter has made a typographical error.' ) . '

' . + '

' . __( 'You can also moderate the comment from this screen using the Status box, where you can also change the timestamp of the comment.' ) . '

' . + '

' . __( 'For more information:' ) . '

' . + '

' . __( 'Documentation on Comments' ) . '

' . + '

' . __( 'Support Forums' ) . '

' + ); + + wp_enqueue_script('comment'); + require_once('./admin-header.php'); + + $comment_id = absint( $_GET['c'] ); + + if ( !$comment = get_comment( $comment_id ) ) + comment_footer_die( __('Oops, no comment with this ID.') . sprintf(' '.__('Go back').'!', 'javascript:history.go(-1)') ); + + if ( !current_user_can( 'edit_comment', $comment_id ) ) + comment_footer_die( __('You are not allowed to edit this comment.') ); + + if ( 'trash' == $comment->comment_approved ) + comment_footer_die( __('This comment is in the Trash. Please move it out of the Trash if you want to edit it.') ); + + $comment = get_comment_to_edit( $comment_id ); + + include('./edit-form-comment.php'); + + break; + +case 'delete' : +case 'approve' : +case 'trash' : +case 'spam' : + + $title = __('Moderate Comment'); + + $comment_id = absint( $_GET['c'] ); + + if ( !$comment = get_comment_to_edit( $comment_id ) ) { + wp_redirect( admin_url('edit-comments.php?error=1') ); + die(); + } + + if ( !current_user_can( 'edit_comment', $comment->comment_ID ) ) { + wp_redirect( admin_url('edit-comments.php?error=2') ); + die(); + } + + // No need to re-approve/re-trash/re-spam a comment. + if ( $action == str_replace( '1', 'approve', $comment->comment_approved ) ) { + wp_redirect( admin_url( 'edit-comments.php?same=' . $comment_id ) ); + die(); + } + + require_once('./admin-header.php'); + + $formaction = $action . 'comment'; + $nonce_action = 'approve' == $action ? 'approve-comment_' : 'delete-comment_'; + $nonce_action .= $comment_id; + +?> +
+ +
+ + +

+ +comment_approved != '0' ) { // if not unapproved + $message = ''; + switch ( $comment->comment_approved ) { + case '1' : + $message = __('This comment is currently approved.'); + break; + case 'spam' : + $message = __('This comment is currently marked as spam.'); + break; + case 'trash' : + $message = __('This comment is currently in the Trash.'); + break; + } + if ( $message ) + echo '

' . $message . '

'; +} +?> +

+ + + + + + +comment_author_email ) { ?> + + + + + +comment_author_url ) { ?> + + + + + + + + + +
comment_author; ?>
comment_author_email; ?>
comment_author_url; ?>
comment_content; ?>
+ +

+ +
+ + + + + + +
+ + + + + +
+ +
+
+'.__('Go back').'!', 'edit-comments.php') ); + if ( !current_user_can( 'edit_comment', $comment->comment_ID ) ) + comment_footer_die( __('You are not allowed to edit comments on this post.') ); + + if ( '' != wp_get_referer() && ! $noredir && false === strpos(wp_get_referer(), 'comment.php') ) + $redir = wp_get_referer(); + elseif ( '' != wp_get_original_referer() && ! $noredir ) + $redir = wp_get_original_referer(); + elseif ( in_array( $action, array( 'approvecomment', 'unapprovecomment' ) ) ) + $redir = admin_url('edit-comments.php?p=' . absint( $comment->comment_post_ID ) ); + else + $redir = admin_url('edit-comments.php'); + + $redir = remove_query_arg( array('spammed', 'unspammed', 'trashed', 'untrashed', 'deleted', 'ids', 'approved', 'unapproved'), $redir ); + + switch ( $action ) { + case 'deletecomment' : + wp_delete_comment( $comment_id ); + $redir = add_query_arg( array('deleted' => '1'), $redir ); + break; + case 'trashcomment' : + wp_trash_comment($comment_id); + $redir = add_query_arg( array('trashed' => '1', 'ids' => $comment_id), $redir ); + break; + case 'untrashcomment' : + wp_untrash_comment($comment_id); + $redir = add_query_arg( array('untrashed' => '1'), $redir ); + break; + case 'spamcomment' : + wp_spam_comment($comment_id); + $redir = add_query_arg( array('spammed' => '1', 'ids' => $comment_id), $redir ); + break; + case 'unspamcomment' : + wp_unspam_comment($comment_id); + $redir = add_query_arg( array('unspammed' => '1'), $redir ); + break; + case 'approvecomment' : + wp_set_comment_status( $comment_id, 'approve' ); + $redir = add_query_arg( array( 'approved' => 1 ), $redir ); + break; + case 'unapprovecomment' : + wp_set_comment_status( $comment_id, 'hold' ); + $redir = add_query_arg( array( 'unapproved' => 1 ), $redir ); + break; + } + + wp_redirect( $redir ); + die; + break; + +case 'editedcomment' : + + $comment_id = absint( $_POST['comment_ID'] ); + $comment_post_id = absint( $_POST['comment_post_ID'] ); + + check_admin_referer( 'update-comment_' . $comment_id ); + + edit_comment(); + + $location = ( empty( $_POST['referredby'] ) ? "edit-comments.php?p=$comment_post_id" : $_POST['referredby'] ) . '#comment-' . $comment_id; + $location = apply_filters( 'comment_edit_redirect', $location, $comment_id ); + wp_redirect( $location ); + + exit(); + break; + +default: + wp_die( __('Unknown action.') ); + break; + +} // end switch + +include('./admin-footer.php'); + +?> diff --git a/src/wp-admin/credits.php b/src/wp-admin/credits.php new file mode 100644 index 0000000..773053a --- /dev/null +++ b/src/wp-admin/credits.php @@ -0,0 +1,176 @@ +' . __('Each name or handle is a link to that person’s profile in the WordPress.org community directory.') . '

' . + '

' . __('You can register your own profile at this link to start contributing.') . '

' . + '

' . __('WordPress always needs more people to report bugs, patch bugs, test betas, work on UI design, translate strings, write documentation, and add questions/answers/suggestions to the Support Forums. Join in!') . '

' . + '

' . __('For more information:') . '

' . + '

' . __('Documentation on Contributing to WordPress') . '

' . + '

' . __('Support Forums') . '

' +); + +add_action( 'admin_head', '_wp_credits_add_css' ); +function _wp_credits_add_css() { ?> + +' . esc_html( $display_name ) . ''; +} + +function _wp_credits_build_object_link( &$data ) { + $data = '' . $data[0] . ''; +} + +include( './admin-header.php' ); +?> +
+ +

+ +' . sprintf( __( 'WordPress is created by a worldwide team of passionate individuals. Get involved in WordPress.' ), + 'http://wordpress.org/about/', + /* translators: Url to the codex documentation on contributing to WordPress used on the credits page */ + __( 'http://codex.wordpress.org/Contributing_to_WordPress' ) ) . '

'; + include( './admin-footer.php' ); + exit; +} + +echo '

' . __( 'WordPress is created by a worldwide team of passionate individuals. We couldn’t possibly list them all, but here some of the most influential people currently involved with the project:' ) . "

\n"; + +$gravatar = is_ssl() ? 'https://secure.gravatar.com/avatar/' : 'http://0.gravatar.com/avatar/'; + +foreach ( $credits['groups'] as $group_slug => $group_data ) { + if ( $group_data['name'] ) { + if ( 'Translators' == $group_data['name'] ) { + // Considered a special slug in the API response. (Also, will never be returned for en_US.) + $title = _x( 'Translators', 'Translate this to be the equivalent of English Translators in your language for the credits page Translators section' ); + } elseif ( isset( $group_data['placeholders'] ) ) { + $title = vsprintf( translate( $group_data['name'] ), $group_data['placeholders'] ); + } else { + $title = translate( $group_data['name'] ); + } + + echo '

' . $title . "

\n"; + } + + if ( ! empty( $group_data['shuffle'] ) ) + shuffle( $group_data['data'] ); // We were going to sort by ability to pronounce "hierarchical," but that wouldn't be fair to Matt. + + switch ( $group_data['type'] ) { + case 'list' : + array_walk( $group_data['data'], '_wp_credits_add_profile_link', $credits['data']['profiles'] ); + echo '

' . wp_sprintf( '%l.', $group_data['data'] ) . "

\n\n"; + break; + case 'libraries' : + array_walk( $group_data['data'], '_wp_credits_build_object_link' ); + echo '

' . wp_sprintf( '%l.', $group_data['data'] ) . "

\n\n"; + break; + default: + $compact = 'compact' == $group_data['type']; + $classes = 'wp-people-group ' . ( $compact ? 'compact' : '' ); + echo '\n"; + break; + } +} + +?> +

Get involved in WordPress.' ), + /* translators: Url to the codex documentation on contributing to WordPress used on the credits page */ + __( 'http://codex.wordpress.org/Contributing_to_WordPress' ) ); ?>

+ +
+ diff --git a/src/wp-admin/css/colors-classic-rtl.css b/src/wp-admin/css/colors-classic-rtl.css new file mode 100644 index 0000000..268fa9e --- /dev/null +++ b/src/wp-admin/css/colors-classic-rtl.css @@ -0,0 +1 @@ +.bar{border-right-color:none;border-left-color:#99d;}.post-com-count{background-image:url(../images/bubble_bg-rtl.gif);}#user_info_arrow{background:transparent url(../images/arrows-vs.png) no-repeat 0 5px;}#user_info:hover #user_info_arrow,#user_info.active #user_info_arrow{background:transparent url(../images/arrows-dark-vs.png) no-repeat 0 5px;}#adminmenushadow,#adminmenuback{background-image:url(../images/menu-shadow-rtl.png);background-position:top left;}#adminmenu li.wp-has-current-submenu.wp-menu-open .wp-menu-toggle,#adminmenu li.wp-has-current-submenu:hover .wp-menu-toggle{background:transparent url(../images/arrows-dark-vs.png) no-repeat 8px 6px;}#adminmenu .wp-has-submenu:hover .wp-menu-toggle,#adminmenu .wp-menu-open .wp-menu-toggle{background:transparent url(../images/arrows-vs.png) no-repeat 8px 6px;}#adminmenu .wp-submenu .wp-submenu-head{border-right-color:none;border-left-color:#d1e5ee;}.folded #adminmenu .wp-submenu-wrap{-moz-box-shadow:-2px 2px 5px rgba(0,0,0,0.4);-webkit-box-shadow:-2px 2px 5px rgba(0,0,0,0.4);box-shadow:-2px 2px 5px rgba(0,0,0,0.4);}#collapse-button div{background-position:0 -108px;}.folded #collapse-button div{background-position:0 -72px;}.meta-box-sortables .postbox:hover .handlediv{background:transparent url(../images/arrows-vs.png) no-repeat 6px 7px;}.tablenav .tablenav-pages a{border-color:#d1e5ee;background:#eee url('../images/menu-bits-rtl-vs.gif?ver=20100610') repeat-x scroll right -379px;}#post-body .misc-pub-section{border-right-color:none;border-left-color:#d1e5ee;}#favorite-toggle{background:transparent url(../images/arrows-vs.png) no-repeat 4px 2px;}#screen-meta a.show-settings,.toggle-arrow{background:transparent url(../images/arrows-vs.png) no-repeat left 3px;}#screen-meta .screen-meta-active a.show-settings{background:transparent url(../images/arrows-vs.png) no-repeat left -33px;}.sidebar-name-arrow{background:transparent url(../images/arrows-vs.png) no-repeat 5px 9px;}.sidebar-name:hover .sidebar-name-arrow{background:transparent url(../images/arrows-dark-vs.png) no-repeat 5px 9px;} \ No newline at end of file diff --git a/src/wp-admin/css/colors-classic-rtl.dev.css b/src/wp-admin/css/colors-classic-rtl.dev.css new file mode 100644 index 0000000..8a56444 --- /dev/null +++ b/src/wp-admin/css/colors-classic-rtl.dev.css @@ -0,0 +1,98 @@ +.bar { + border-right-color: none; + border-left-color: #99d; +} + +.post-com-count { + background-image: url(../images/bubble_bg-rtl.gif); +} + +#user_info_arrow { + background: transparent url(../images/arrows-vs.png) no-repeat 0 5px; +} + +#user_info:hover #user_info_arrow, +#user_info.active #user_info_arrow { + background: transparent url(../images/arrows-dark-vs.png) no-repeat 0 5px; +} + +/* editors */ + +/* menu */ + +#adminmenushadow, +#adminmenuback { + background-image: url(../images/menu-shadow-rtl.png); + background-position: top left; +} + +#adminmenu li.wp-has-current-submenu.wp-menu-open .wp-menu-toggle, +#adminmenu li.wp-has-current-submenu:hover .wp-menu-toggle { + background: transparent url(../images/arrows-dark-vs.png) no-repeat 8px 6px; +} + +#adminmenu .wp-has-submenu:hover .wp-menu-toggle, +#adminmenu .wp-menu-open .wp-menu-toggle { + background: transparent url(../images/arrows-vs.png) no-repeat 8px 6px; +} + + +#adminmenu .wp-submenu .wp-submenu-head { + border-right-color: none; + border-left-color: #d1e5ee; +} + +.folded #adminmenu .wp-submenu-wrap { + -moz-box-shadow: -2px 2px 5px rgba( 0, 0, 0, 0.4 ); + -webkit-box-shadow: -2px 2px 5px rgba( 0, 0, 0, 0.4 ); + box-shadow: -2px 2px 5px rgba( 0, 0, 0, 0.4 ); +} + +/* collapse menu button */ +#collapse-button div { + background-position: 0 -108px; +} +.folded #collapse-button div { + background-position: 0 -72px; +} + +/* edit image */ + +.meta-box-sortables .postbox:hover .handlediv { + background: transparent url(../images/arrows-vs.png) no-repeat 6px 7px; +} + +.tablenav .tablenav-pages a { + border-color: #d1e5ee; + background: #eee url('../images/menu-bits-rtl-vs.gif?ver=20100610') repeat-x scroll right -379px; +} + +#post-body .misc-pub-section { + border-right-color: none; + border-left-color: #d1e5ee; +} + +#favorite-toggle { + background: transparent url(../images/arrows-vs.png) no-repeat 4px 2px; +} + +#screen-meta a.show-settings, +.toggle-arrow { + background: transparent url(../images/arrows-vs.png) no-repeat left 3px; +} + +#screen-meta .screen-meta-active a.show-settings { + background: transparent url(../images/arrows-vs.png) no-repeat left -33px; +} + +.sidebar-name-arrow { + background: transparent url(../images/arrows-vs.png) no-repeat 5px 9px; +} +.sidebar-name:hover .sidebar-name-arrow { + background: transparent url(../images/arrows-dark-vs.png) no-repeat 5px 9px; +} + + +/* custom header & background pages */ + +/* custom header & background pages */ \ No newline at end of file diff --git a/src/wp-admin/css/colors-classic.css b/src/wp-admin/css/colors-classic.css new file mode 100644 index 0000000..d5d4ebe --- /dev/null +++ b/src/wp-admin/css/colors-classic.css @@ -0,0 +1 @@ +html,.wp-dialog{background-color:#fff;}* html input,* html .widget{border-color:#dfdfdf;}textarea,input[type="text"],input[type="password"],input[type="file"],input[type="button"],input[type="submit"],input[type="reset"],select{border-color:#dfdfdf;background-color:#fff;}kbd,code{background:#eaeaea;}input[readonly]{background-color:#eee;}.find-box-search{border-color:#dfdfdf;background-color:#f1f1f1;}.find-box{background-color:#f1f1f1;}.find-box-inside{background-color:#fff;}a.page-numbers:hover{border-color:#999;}body,#wpbody,.form-table .pre{color:#333;}body>#upload-menu{border-bottom-color:#fff;}#postcustomstuff table,#your-profile fieldset,#rightnow,div.dashboard-widget,#dashboard-widgets p.dashboard-widget-links,#replyrow #ed_reply_toolbar input{border-color:#D1E5EE;}#poststuff .inside label.spam,#poststuff .inside label.deleted{color:red;}#poststuff .inside label.waiting{color:orange;}#poststuff .inside label.approved{color:green;}#postcustomstuff table{border-color:#dfdfdf;background-color:#F9F9F9;}#postcustomstuff thead th{background-color:#F1F1F1;}#postcustomstuff table input,#postcustomstuff table textarea{border-color:#dfdfdf;background-color:#fff;}.widefat{border-color:#D1E5EE;background-color:#fff;}div.dashboard-widget-error{background-color:#c43;}div.dashboard-widget-notice{background-color:#cfe1ef;}div.dashboard-widget-submit{border-top-color:#ccc;}div.tabs-panel,.wp-tab-panel,ul.category-tabs li.tabs,ul.add-menu-item-tabs li.tabs,.wp-tab-active{border-color:#dfdfdf;background-color:#fff;}ul.category-tabs li.tabs,ul.add-menu-item-tabs li.tabs,.wp-tab-active{background-color:#fff;}input.disabled,textarea.disabled{background-color:#ccc;}#plugin-information .action-button a,#plugin-information .action-button a:hover,#plugin-information .action-button a:visited{color:#fff;}.widget .widget-top,.postbox h3,.stuffbox h3,.widefat thead tr th,.widefat tfoot tr th,h3.dashboard-widget-title,h3.dashboard-widget-title span,h3.dashboard-widget-title small,.find-box-head,.sidebar-name,#nav-menu-header,#nav-menu-footer,.menu-item-handle,#fullscreen-topbar{background-color:#f5fafd;background-image:-ms-linear-gradient(top,#f7fcfe,#eff8ff);background-image:-moz-linear-gradient(top,#f7fcfe,#eff8ff);background-image:-o-linear-gradient(top,#f7fcfe,#eff8ff);background-image:-webkit-gradient(linear,left top,left bottom,from(#f7fcfe),to(#eff8ff));background-image:-webkit-linear-gradient(top,#f7fcfe,#eff8ff);background-image:linear-gradient(top,#f7fcfe,#eff8ff);}.widget .widget-top,.postbox h3,.stuffbox h3{border-bottom-color:#D1E5EE;text-shadow:#fff 0 1px 0;-moz-box-shadow:0 1px 0 #fff;-webkit-box-shadow:0 1px 0 #fff;box-shadow:0 1px 0 #fff;}.form-table th,.form-wrap label{color:#222;text-shadow:#fff 0 1px 0;}.description,.form-wrap p{color:#666;}strong .post-com-count span{background-color:#21759b;}.sorthelper{background-color:#ccf3fa;}.ac_match,.subsubsub a.current{color:#000;}.wrap h2{color:#174f69;}.wrap .add-new-h2{background:#f1f1f1;}.subtitle{color:#777;}.ac_over{background-color:#f0f0b8;}.ac_results{background-color:#fff;border-color:#808080;}.ac_results li{color:#101010;}.alternate,.alt{background-color:#f7fcfe;}.available-theme a.screenshot{background-color:#f1f1f1;border-color:#ddd;}.bar{background-color:#e8e8e8;border-right-color:#99d;}#media-upload,#media-upload .media-item .slidetoggle{background:#fff;}#media-upload .slidetoggle{border-top-color:#dfdfdf;}div.error,.login #login_error{background-color:#ffebe8;border-color:#c00;}div.error a{color:#c00;}.form-invalid{background-color:#ffebe8!important;}.form-invalid input,.form-invalid select{border-color:#c00!important;}.submit{border-color:#DFDFDF;}.highlight{background-color:#e4f2fd;color:#000;}.howto,.nonessential,#edit-slug-box,.form-input-tip,.subsubsub{color:#666;}.media-item{border-bottom-color:#dfdfdf;}#wpbody-content #media-items .describe{border-top-color:#dfdfdf;}.media-upload-form label.form-help,td.help{color:#9a9a9a;}.post-com-count{background-image:url(../images/bubble_bg.gif);color:#fff;}.post-com-count span{background-color:#bbb;color:#fff;}.post-com-count:hover span{background-color:#d54e21;}.quicktags,.search{background-color:#ccc;color:#000;}.side-info h5{border-bottom-color:#dadada;}.side-info ul{color:#666;}.button,.button-secondary,.submit input,input[type=button],input[type=submit]{border-color:#bbb;color:#464646;}.button:hover,.button-secondary:hover,.submit input:hover,input[type=button]:hover,input[type=submit]:hover{color:#000;border-color:#666;}.button,.submit input,.button-secondary{background:#f2f2f2 url(../images/white-grad.png) repeat-x scroll left top;text-shadow:rgba(255,255,255,1) 0 1px 0;}.button:active,.submit input:active,.button-secondary:active{background:#eee url(../images/white-grad-active.png) repeat-x scroll left top;}input.button-primary,button.button-primary,a.button-primary{border-color:#298cba;font-weight:bold;color:#fff;background:#21759B url(../images/button-grad.png) repeat-x scroll left top;text-shadow:rgba(0,0,0,0.3) 0 -1px 0;}input.button-primary:active,button.button-primary:active,a.button-primary:active{background:#21759b url(../images/button-grad-active.png) repeat-x scroll left top;color:#eaf2fa;}input.button-primary:hover,button.button-primary:hover,a.button-primary:hover,a.button-primary:focus,a.button-primary:active{border-color:#13455b;color:#eaf2fa;}.button-disabled,.button[disabled],.button:disabled,.button-secondary[disabled],.button-secondary:disabled,a.button.disabled{color:#aaa!important;border-color:#ddd!important;}.button-primary-disabled,.button-primary[disabled],.button-primary:disabled{color:#9FD0D5!important;background:#298CBA!important;}a:hover,a:active,a:focus{color:#d54e21;}#wphead #viewsite a:hover,#adminmenu a:hover,#adminmenu ul.wp-submenu a:hover,#the-comment-list .comment a:hover,#rightnow a:hover,#media-upload a.del-link:hover,div.dashboard-widget-submit input:hover,.subsubsub a:hover,.subsubsub a.current:hover,.ui-tabs-nav a:hover,.plugins .inactive a:hover,#all-plugins-table .plugins .inactive a:hover,#search-plugins-table .plugins .inactive a:hover{color:#d54e21;}#the-comment-list .comment-item,#dashboard-widgets #dashboard_quick_press form p.submit{border-color:#dfdfdf;}#side-sortables .category-tabs .tabs a,#side-sortables .add-menu-item-tabs .tabs a,.wp-tab-bar .wp-tab-active a{color:#333;}#rightnow .rbutton{background-color:#ebebeb;color:#264761;}.submitbox .submit{background-color:#464646;color:#ccc;}.plugins a.delete:hover,#all-plugins-table .plugins a.delete:hover,#search-plugins-table .plugins a.delete:hover,.submitbox .submitdelete{color:#f00;border-bottom-color:#f00;}.submitbox .submitdelete:hover,#media-items a.delete:hover{color:#fff;background-color:#f00;border-bottom-color:#f00;}#normal-sortables .submitbox .submitdelete:hover{color:#000;background-color:#f00;border-bottom-color:#f00;}.tablenav .dots{border-color:transparent;}.tablenav .next,.tablenav .prev{border-color:transparent;color:#21759b;}.tablenav .next:hover,.tablenav .prev:hover{border-color:transparent;color:#d54e21;}div.updated,.login .message{background-color:#ffffe0;border-color:#e6db55;}.update-message{color:#000;}a.page-numbers{border-bottom-color:#B8D3E2;}.commentlist li{border-bottom-color:#ccc;}.widefat td,.widefat th{border-top-color:#fff;border-bottom-color:#D0DFE9;}.widefat th{text-shadow:rgba(255,255,255,0.8) 0 1px 0;}.widefat td{color:#555;}.widefat p,.widefat ol,.widefat ul{color:#333;}.widefat thead tr th,.widefat tfoot tr th,h3.dashboard-widget-title,h3.dashboard-widget-title span,h3.dashboard-widget-title small,.find-box-head{color:#333;}th.sortable a:hover,th.sortable a:active,th.sortable a:focus{color:#333;}h3.dashboard-widget-title small a{color:#d7d7d7;}h3.dashboard-widget-title small a:hover{color:#fff;}a,#adminmenu a,#poststuff #edButtonPreview,#poststuff #edButtonHTML,#the-comment-list p.comment-author strong a,#media-upload a.del-link,#media-items a.delete,.plugins a.delete,.ui-tabs-nav a{color:#21759b;}#adminmenu .awaiting-mod,#adminmenu .update-plugins,#sidemenu a .update-plugins,#rightnow .reallynow{background-color:#464646;color:#fff;-moz-box-shadow:rgba(255,255,255,0.5) 0 1px 0;-khtml-box-shadow:rgba(255,255,255,0.5) 0 1px 0;-webkit-box-shadow:rgba(255,255,255,0.5) 0 1px 0;box-shadow:rgba(255,255,255,0.5) 0 1px 0;}#plugin-information .action-button{background-color:#d54e21;color:#fff;}#adminmenu li.current a .awaiting-mod,#adminmenu li a.wp-has-current-submenu .update-plugins{background-color:#464646;color:#fff;-moz-box-shadow:rgba(255,255,255,0.5) 0 1px 0;-khtml-box-shadow:rgba(255,255,255,0.5) 0 1px 0;-webkit-box-shadow:rgba(255,255,255,0.5) 0 1px 0;box-shadow:rgba(255,255,255,0.5) 0 1px 0;}div#media-upload-header,div#plugin-information-header{background-color:#f9f9f9;border-bottom-color:#dfdfdf;}#currenttheme img{border-color:#666;}#dashboard_secondary div.dashboard-widget-content ul li a{background-color:#f9f9f9;}input.readonly,textarea.readonly{background-color:#ddd;}#ed_toolbar input,#ed_reply_toolbar input{background:#fff url("../images/fade-butt.png") repeat-x 0 -2px;}#editable-post-name{background-color:#fffbcc;}#edit-slug-box strong,.tablenav .displaying-num,#submitted-on,.submitted-on{color:#777;}.login #nav a,.login #backtoblog a{color:#21759b!important;}.login #nav a:hover,.login #backtoblog a:hover{color:#d54e21!important;}#footer{color:#777;border-color:#b0c8d7;}#media-items,.imgedit-group{border-color:#dfdfdf;}.checkbox,.side-info,.plugins tr,#your-profile #rich_editing{background-color:#fcfcfc;}.plugins .inactive,.plugins .inactive th,.plugins .inactive td,tr.inactive+tr.plugin-update-tr .plugin-update{background-color:#efede7;}.plugin-update-tr .update-message{background-color:#fffbe4;border-color:#dfdfdf;}.plugins .active,.plugins .active th,.plugins .active td{color:#000;}.plugins .inactive a{color:#579;}#the-comment-list tr.undo,#the-comment-list div.undo{background-color:#f4f4f4;}#the-comment-list .unapproved{background-color:#ffffe0;}#the-comment-list .approve a{color:#006505;}#the-comment-list .unapprove a{color:#d98500;}table.widefat span.delete a,table.widefat span.trash a,table.widefat span.spam a,#dashboard_recent_comments .delete a,#dashboard_recent_comments .trash a,#dashboard_recent_comments .spam a{color:#bc0b0b;}.widget,#widget-list .widget-top,.postbox,#titlediv,#poststuff .postarea,.stuffbox{border-color:#d1e5ee;-moz-box-shadow:inset 0 1px 0 #fff;-webkit-box-shadow:inset 0 1px 0 #fff;box-shadow:inset 0 1px 0 #fff;-moz-border-radius:3px;-khtml-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;}.widget,#widget-list .widget-top,.postbox,.menu-item-settings{background-color:#f7fcfe;}.postbox h3{color:#174f69;}.widget .widget-top{color:#174f69;}.sidebar-name:hover h3,.postbox h3:hover{color:#000;}.curtime #timestamp{background-image:url(../images/date-button.gif);}#quicktags #ed_link{color:#00f;}#rightnow .youhave{background-color:#f0f6fb;}#rightnow a{color:#448abd;}.tagchecklist span a,#bulk-titles div a{background:url(../images/xit.gif) no-repeat;}.tagchecklist span a:hover,#bulk-titles div a:hover{background:url(../images/xit.gif) no-repeat -10px 0;}#update-nag,.update-nag{background-color:#fffbcc;border-color:#e6db55;color:#555;}.login #backtoblog a{color:#464646;}#wphead{border-bottom:#d0dfe9 1px solid;}#wphead h1 a{color:#174f69;}#user_info{color:#777;}#user_info:hover,#user_info.active{color:#185069;}#user_info.active{background-color:#f7fcfe;background-image:-ms-linear-gradient(bottom,#f7fcfe,#f9f9f9);background-image:-moz-linear-gradient(bottom,#f7fcfe,#f9f9f9);background-image:-o-linear-gradient(bottom,#f7fcfe,#f9f9f9);background-image:-webkit-gradient(linear,left bottom,left top,from(#f7fcfe),to(#f9f9f9));background-image:-webkit-linear-gradient(bottom,#f7fcfe,#f9f9f9);background-image:linear-gradient(bottom,#f7fcfe,#f9f9f9);border-color:#d0dfe9 #d0dfe9 #d0dfe9;}#user_info_arrow{background:transparent url(../images/arrows-vs.png) no-repeat 6px 5px;}#user_info:hover #user_info_arrow,#user_info.active #user_info_arrow{background:transparent url(../images/arrows-dark-vs.png) no-repeat 6px 5px;}#user_info_links{-moz-box-shadow:0 3px 2px -2px rgba(0,0,0,0.2);-webkit-box-shadow:0 3px 2px -2px rgba(0,0,0,0.2);box-shadow:0 3px 2px -2px rgba(0,0,0,0.2);}#user_info_links ul{background:#f7fcfe;border-color:#d0dfe9 #d0dfe9 #d0dfe9;-moz-box-shadow:inset 0 1px 0 #f9f9f9;-webkit-box-shadow:inset 0 1px 0 #f9f9f9;box-shadow:inset 0 1px 0 #f9f9f9;}#user_info_links li:hover{background-color:#ECF8FE;}#user_info_links li:hover a,#user_info_links li a:hover{text-decoration:none;}#user_info a:link,#user_info a:visited,#footer a:link,#footer a:visited{text-decoration:none;}#footer a:hover{color:#000;text-decoration:underline;}div#media-upload-error,.file-error,abbr.required,.widget-control-remove:hover,table.widefat .delete a:hover,table.widefat .trash a:hover,table.widefat .spam a:hover,#dashboard_recent_comments .delete a:hover,#dashboard_recent_comments .trash a:hover #dashboard_recent_comments .spam a:hover{color:#f00;}#pass-strength-result{background-color:#eee;border-color:#ddd!important;}#pass-strength-result.bad{background-color:#ffb78c;border-color:#ff853c!important;}#pass-strength-result.good{background-color:#ffec8b;border-color:#fc0!important;}#pass-strength-result.short{background-color:#ffa0a0;border-color:#f04040!important;}#pass-strength-result.strong{background-color:#c3ff88;border-color:#8dff1c!important;}#quicktags{border-color:#cfdfe9;background-color:#cfdfe9;background-image:url("../images/ed-bg-vs.gif?ver=20101102");}#ed_toolbar input{border-color:#C3C3C3;}#ed_toolbar input:hover{border-color:#aaa;background:#ddd;}#poststuff .wp_themeSkin .mceStatusbar{border-color:#d0dfe9;}#poststuff .wp_themeSkin .mceStatusbar *{color:#555;}#poststuff #edButtonPreview,#poststuff #edButtonHTML{background-color:#f7fcfe;border-color:#d0dfe9 #d0dfe9 #d0dfe9;color:#999;}#poststuff #editor-toolbar .active{border-color:#d0dfe9 #d0dfe9 #eff8ff;background-color:#eff8ff;color:#333;}#post-status-info{background-color:#eff8ff;}.wp_themeSkin *,.wp_themeSkin a:hover,.wp_themeSkin a:link,.wp_themeSkin a:visited,.wp_themeSkin a:active{color:#000;}.wp_themeSkin table.mceLayout{border-color:#bed1dd #bed1dd #d0dfe9;}#editorcontainer #content,#editorcontainer .wp_themeSkin .mceIframeContainer{-moz-box-shadow:inset 1px 1px 2px rgba(0,0,0,0.1);-webkit-box-shadow:inset 1px 1px 2px rgba(0,0,0,0.1);box-shadow:inset 1px 1px 2px rgba(0,0,0,0.1);}.wp_themeSkin iframe{background:transparent;}.wp_themeSkin .mceStatusbar{color:#000;background-color:#f5f5f5;}.wp_themeSkin .mceButton{border-color:#B0C8D7;background-color:#cfdfe9;background-image:-ms-linear-gradient(bottom,#cfdfe9,#fff);background-image:-moz-linear-gradient(bottom,#cfdfe9,#fff);background-image:-o-linear-gradient(bottom,#cfdfe9,#fff);background-image:-webkit-gradient(linear,left bottom,left top,from(#cfdfe9),to(#fff));background-image:-webkit-linear-gradient(bottom,#cfdfe9,#fff)!important;background-image:linear-gradient(bottom,#cfdfe9,#fff);}.wp_themeSkin a.mceButtonEnabled:hover{border-color:#5589AA!important;background-color:#c9c9c9;background-image:-ms-linear-gradient(bottom,#bdccd5,#fff);background-image:-moz-linear-gradient(bottom,#bdccd5,#fff));background-image:-o-linear-gradient(bottom,#bdccd5,#fff));background-image:-webkit-gradient(linear,left bottom,left top,from(#bdccd5),to(#fff));background-image:-webkit-linear-gradient(bottom,#bdccd5,#fff)!important;background-image:linear-gradient(bottom,#bdccd5,#fff);}.wp_themeSkin a.mceButton:active,.wp_themeSkin a.mceButtonEnabled:active,.wp_themeSkin a.mceButtonSelected:active,.wp_themeSkin a.mceButtonActive,.wp_themeSkin a.mceButtonActive:active,.wp_themeSkin a.mceButtonActive:hover{background:#B0C8D7!important;background-image:-ms-linear-gradient(bottom,#fff,#cfdfe9);background-image:-moz-linear-gradient(bottom,#fff,#cfdfe9));background-image:-o-linear-gradient(bottom,#fff,#cfdfe9));background-image:-webkit-gradient(linear,left bottom,left top,from(#fff),to(#cfdfe9));background-image:-webkit-linear-gradient(bottom,#fff,#cfdfe9)!important;background-image:linear-gradient(bottom,#fff,#cfdfe9);border-color:#5589AA!important;}.wp_themeSkin .mceButtonDisabled{border-color:#B0C8D7!important;}.wp_themeSkin .mceListBox .mceText,.wp_themeSkin .mceListBox .mceOpen{border-color:#B0C8D7;background-color:#cfdfe9;background-image:-ms-linear-gradient(bottom,#cfdfe9,#fff);background-image:-moz-linear-gradient(bottom,#cfdfe9,#fff);background-image:-o-linear-gradient(bottom,#cfdfe9,#fff);background-image:-webkit-gradient(linear,left bottom,left top,from(#cfdfe9),to(#fff));background-image:-webkit-linear-gradient(bottom,#cfdfe9,#fff)!important;background-image:linear-gradient(bottom,#cfdfe9,#fff);}.wp_themeSkin .mceListBox .mceOpen{border-left:0!important;}.wp_themeSkin table.mceListBoxEnabled:hover .mceOpen,.wp_themeSkin .mceListBoxHover .mceOpen,.wp_themeSkin .mceListBoxHover:active .mceOpen,.wp_themeSkin .mceListBoxSelected .mceOpen,.wp_themeSkin .mceListBoxSelected .mceText,.wp_themeSkin table.mceListBoxEnabled:active .mceText{background:#B0C8D7;border-color:#5589AA!important;}.wp_themeSkin table.mceListBoxEnabled:hover .mceText,.wp_themeSkin .mceListBoxHover .mceText,.wp_themeSkin table.mceListBoxEnabled:hover .mceOpen,.wp_themeSkin .mceListBoxHover .mceOpen{border-color:#5589AA!important;background-color:#c9c9c9;background-image:-ms-linear-gradient(bottom,#cfdfe9,#fff);background-image:-moz-linear-gradient(bottom,#cfdfe9,#fff);background-image:-o-linear-gradient(bottom,#cfdfe9,#fff);background-image:-webkit-gradient(linear,left bottom,left top,from(#cfdfe9),to(#fff));background-image:-webkit-linear-gradient(bottom,#cfdfe9,#fff)!important;background-image:linear-gradient(bottom,#cfdfe9,#fff);}.wp_themeSkin select.mceListBox{border-color:#B2B2B2;background-color:#fff;}.wp_themeSkin .mceSplitButton a.mceAction,.wp_themeSkin .mceSplitButton a.mceOpen{border-color:#B0C8D7;}.wp_themeSkin .mceSplitButton a.mceOpen:hover,.wp_themeSkin .mceSplitButtonSelected a.mceOpen,.wp_themeSkin table.mceSplitButtonEnabled:hover a.mceAction,.wp_themeSkin .mceSplitButton a.mceAction:hover{border-color:#5589AA!important;}.wp_themeSkin table.mceSplitButton td{background-color:#cfdfe9;background-image:-ms-linear-gradient(bottom,#cfdfe9,#fff);background-image:-moz-linear-gradient(bottom,#cfdfe9,#fff);background-image:-o-linear-gradient(bottom,#cfdfe9,#fff);background-image:-webkit-gradient(linear,left bottom,left top,from(#cfdfe9),to(#fff));background-image:-webkit-linear-gradient(bottom,#cfdfe9,#fff)!important;background-image:linear-gradient(bottom,#cfdfe9,#fff);}.wp_themeSkin table.mceSplitButton:hover td{background-image:-ms-linear-gradient(bottom,#cfdfe9,#fff);background-image:-moz-linear-gradient(bottom,#cfdfe9,#fff);background-image:-o-linear-gradient(bottom,#cfdfe9,#fff);background-image:-webkit-gradient(linear,left bottom,left top,from(#cfdfe9),to(#fff));background-image:-webkit-linear-gradient(bottom,#cfdfe9,#fff)!important;background-image:linear-gradient(bottom,#cfdfe9,#fff);}.wp_themeSkin .mceSplitButtonActive{background-color:#B0C8D7;}.wp_themeSkin div.mceColorSplitMenu table{background-color:#ebebeb;border-color:#B2B2B2;}.wp_themeSkin .mceColorSplitMenu a{border-color:#B2B2B2;}.wp_themeSkin .mceColorSplitMenu a.mceMoreColors{border-color:#fff;}.wp_themeSkin .mceColorSplitMenu a.mceMoreColors:hover{border-color:#0A246A;background-color:#B6BDD2;}.wp_themeSkin a.mceMoreColors:hover{border-color:#0A246A;}.wp_themeSkin .mceMenu{border-color:#ddd;}.wp_themeSkin .mceMenu table{background-color:#ebeaeb;}.wp_themeSkin .mceMenu .mceText{color:#000;}.wp_themeSkin .mceMenu .mceMenuItemEnabled a:hover,.wp_themeSkin .mceMenu .mceMenuItemActive{background-color:#f5f5f5;}.wp_themeSkin td.mceMenuItemSeparator{background-color:#aaa;}.wp_themeSkin .mceMenuItemTitle a{background-color:#ccc;border-bottom-color:#aaa;}.wp_themeSkin .mceMenuItemTitle span.mceText{color:#000;}.wp_themeSkin .mceMenuItemDisabled .mceText{color:#888;}.wp_themeSkin tr.mceFirst td.mceToolbar{background:#cfdfe9 url("../images/ed-bg-vs.gif?ver=20101102") repeat-x scroll left top;border-color:#cfdfe9;}.wp-admin #mceModalBlocker{background:#000;}.wp-admin .clearlooks2 .mceFocus .mceTop .mceLeft{background:#444;border-left:1px solid #999;border-top:1px solid #999;-moz-border-radius:3px 0 0 0;-webkit-border-top-left-radius:3px;-khtml-border-top-left-radius:3px;border-top-left-radius:3px;}.wp-admin .clearlooks2 .mceFocus .mceTop .mceRight{background:#444;border-right:1px solid #999;border-top:1px solid #999;border-top-right-radius:3px;-khtml-border-top-right-radius:3px;-webkit-border-top-right-radius:3px;-moz-border-radius:0 3px 0 0;}.wp-admin .clearlooks2 .mceMiddle .mceLeft{background:#f1f1f1;border-left:1px solid #999;}.wp-admin .clearlooks2 .mceMiddle .mceRight{background:#f1f1f1;border-right:1px solid #999;}.wp-admin .clearlooks2 .mceBottom{background:#f1f1f1;border-bottom:1px solid #999;}.wp-admin .clearlooks2 .mceBottom .mceLeft{background:#f1f1f1;border-bottom:1px solid #999;border-left:1px solid #999;}.wp-admin .clearlooks2 .mceBottom .mceCenter{background:#f1f1f1;border-bottom:1px solid #999;}.wp-admin .clearlooks2 .mceBottom .mceRight{background:#f1f1f1;border-bottom:1px solid #999;border-right:1px solid #999;}.wp-admin .clearlooks2 .mceFocus .mceTop span{color:#e5e5e5;}#titlediv #title{border-color:#bdccd5;}#editorcontainer{border-color:#bdccd5 #bdccd5 #d0dfe9;}#post-status-info{border-color:#d0dfe9 #bdccd5 #bdccd5;}.editwidget .widget-inside{border-color:#d0dfe9;}#titlediv #title{background-color:#fff;}#tTips p#tTips_inside{background-color:#ddd;color:#333;}#timestampdiv input,#namediv input,#poststuff .inside .the-tagcloud{border-color:#ddd;}#adminmenuback,#adminmenuwrap{background-color:#EFF8FF;border-color:#D1E5EE;}#adminmenushadow,#adminmenuback{background-image:url(../images/menu-shadow.png);background-position:top right;background-repeat:repeat-y;}#adminmenu li.wp-menu-separator{background:#D1E5EE;border-color:#bed1dd;}#adminmenu div.separator{border-color:#D1E5EE;}#adminmenu li.wp-has-current-submenu.wp-menu-open .wp-menu-toggle,#adminmenu li.wp-has-current-submenu:hover .wp-menu-toggle{background:transparent url(../images/arrows-dark-vs.png) no-repeat -1px 6px;}#adminmenu .wp-has-submenu:hover .wp-menu-toggle,#adminmenu .wp-menu-open .wp-menu-toggle{background:transparent url(../images/arrows-vs.png) no-repeat -2px 6px;}#adminmenu a.menu-top,.folded #adminmenu li.menu-top,#adminmenu .wp-submenu .wp-submenu-head{border-top-color:#fff;border-bottom-color:#d1e5ee;}#adminmenu li.wp-menu-open{border-color:#d1e5ee;}#adminmenu li.wp-has-current-submenu a.wp-has-current-submenu,#adminmenu li.current a.menu-top,.folded #adminmenu li.wp-has-current-submenu,.folded #adminmenu li.current.menu-top,#adminmenu .wp-menu-arrow,#adminmenu .wp-has-current-submenu .wp-submenu .wp-submenu-head{background-color:#5589AA;background-image:-ms-linear-gradient(bottom,#5589AA,#5A8FAD);background-image:-moz-linear-gradient(bottom,#5589AA,#5A8FAD);background-image:-o-linear-gradient(bottom,#5589AA,#5A8FAD);background-image:-webkit-gradient(linear,left bottom,left top,from(#5589AA),to(#5A8FAD));background-image:-webkit-linear-gradient(bottom,#5589AA,#5A8FAD);background-image:linear-gradient(bottom,#5589AA,#5A8FAD);}#adminmenu li.wp-has-current-submenu a.wp-has-current-submenu,#adminmenu li.current a.menu-top,#adminmenu .wp-has-current-submenu .wp-submenu .wp-submenu-head{text-shadow:0 -1px 0 #333;color:#fff;border-top-color:#5A8FAD;border-bottom-color:#5589AA;}.folded #adminmenu li.wp-has-current-submenu,.folded #adminmenu li.current.menu-top{border-top-color:#5A8FAD;border-bottom-color:#5589AA;}#adminmenu .wp-submenu a:hover{background-color:#EAF2FA!important;color:#333!important;}#adminmenu .wp-submenu li.current,#adminmenu .wp-submenu li.current a,#adminmenu .wp-submenu li.current a:hover{color:#333;}#adminmenu .wp-submenu ul{background-color:#fff;}.folded #adminmenu .wp-submenu-wrap,.folded #adminmenu .wp-submenu ul{border-color:#d0dfe9;}.folded #adminmenu .wp-submenu-wrap{-moz-box-shadow:2px 2px 5px rgba(0,0,0,0.4);-webkit-box-shadow:2px 2px 5px rgba(0,0,0,0.4);box-shadow:2px 2px 5px rgba(0,0,0,0.4);}#adminmenu .wp-submenu .wp-submenu-head{border-right-color:#d0dfe9;background-color:#EFF8FF;}#adminmenu div.wp-submenu{background-color:transparent;}#collapse-menu{color:#A0C3D5;}#collapse-menu:hover{color:#5A8FAD;}#collapse-button{border-color:#d0dfe9;background-color:#eff8ff;background-image:-ms-linear-gradient(bottom,#eff8ff,#fff);background-image:-moz-linear-gradient(bottom,#eff8ff,#fff);background-image:-o-linear-gradient(bottom,#eff8ff,#fff);background-image:-webkit-gradient(linear,left bottom,left top,from(#eff8ff),to(#fff));background-image:-webkit-linear-gradient(bottom,#eff8ff,#fff);background-image:linear-gradient(bottom,#eff8ff,#fff);}#collapse-menu:hover #collapse-button{border-color:#A0C3D5;}#collapse-button div{background:transparent url(../images/arrows-vs.png) no-repeat 0 -72px;}.folded #collapse-button div{background-position:0 -108px;}#adminmenu .menu-icon-dashboard div.wp-menu-image{background:transparent url('../images/menu-vs.png?ver=20100531') no-repeat scroll -60px -33px;}#adminmenu .menu-icon-dashboard:hover div.wp-menu-image,#adminmenu .menu-icon-dashboard.wp-has-current-submenu div.wp-menu-image,#adminmenu .menu-icon-dashboard.current div.wp-menu-image{background:transparent url('../images/menu-vs.png?ver=20100531') no-repeat scroll -60px -1px;}#adminmenu .menu-icon-post div.wp-menu-image{background:transparent url('../images/menu-vs.png?ver=20100531') no-repeat scroll -271px -33px;}#adminmenu .menu-icon-post:hover div.wp-menu-image,#adminmenu .menu-icon-post.wp-has-current-submenu div.wp-menu-image{background:transparent url('../images/menu-vs.png?ver=20100531') no-repeat scroll -271px -1px;}#adminmenu .menu-icon-media div.wp-menu-image{background:transparent url('../images/menu-vs.png?ver=20100531') no-repeat scroll -120px -33px;}#adminmenu .menu-icon-media:hover div.wp-menu-image,#adminmenu .menu-icon-media.wp-has-current-submenu div.wp-menu-image{background:transparent url('../images/menu-vs.png?ver=20100531') no-repeat scroll -120px -1px;}#adminmenu .menu-icon-links div.wp-menu-image{background:transparent url('../images/menu-vs.png?ver=20100531') no-repeat scroll -90px -33px;}#adminmenu .menu-icon-links:hover div.wp-menu-image,#adminmenu .menu-icon-links.wp-has-current-submenu div.wp-menu-image{background:transparent url('../images/menu-vs.png?ver=20100531') no-repeat scroll -90px -1px;}#adminmenu .menu-icon-page div.wp-menu-image{background:transparent url('../images/menu-vs.png?ver=20100531') no-repeat scroll -150px -33px;}#adminmenu .menu-icon-page:hover div.wp-menu-image,#adminmenu .menu-icon-page.wp-has-current-submenu div.wp-menu-image{background:transparent url('../images/menu-vs.png?ver=20100531') no-repeat scroll -150px -1px;}#adminmenu .menu-icon-comments div.wp-menu-image{background:transparent url('../images/menu-vs.png?ver=20100531') no-repeat scroll -30px -33px;}#adminmenu .menu-icon-comments:hover div.wp-menu-image,#adminmenu .menu-icon-comments.wp-has-current-submenu div.wp-menu-image,#adminmenu .menu-icon-comments.current div.wp-menu-image{background:transparent url('../images/menu-vs.png?ver=20100531') no-repeat scroll -30px -1px;}#adminmenu .menu-icon-appearance div.wp-menu-image{background:transparent url('../images/menu-vs.png?ver=20100531') no-repeat scroll 0 -33px;}#adminmenu .menu-icon-appearance:hover div.wp-menu-image,#adminmenu .menu-icon-appearance.wp-has-current-submenu div.wp-menu-image{background:transparent url('../images/menu-vs.png?ver=20100531') no-repeat scroll 0 -1px;}#adminmenu .menu-icon-plugins div.wp-menu-image{background:transparent url('../images/menu-vs.png?ver=20100531') no-repeat scroll -180px -33px;}#adminmenu .menu-icon-plugins:hover div.wp-menu-image,#adminmenu .menu-icon-plugins.wp-has-current-submenu div.wp-menu-image{background:transparent url('../images/menu-vs.png?ver=20100531') no-repeat scroll -180px -1px;}#adminmenu .menu-icon-users div.wp-menu-image{background:transparent url('../images/menu-vs.png?ver=20100531') no-repeat scroll -300px -33px;}#adminmenu .menu-icon-users:hover div.wp-menu-image,#adminmenu .menu-icon-users.wp-has-current-submenu div.wp-menu-image,#adminmenu .menu-icon-users.current div.wp-menu-image{background:transparent url('../images/menu-vs.png?ver=20100531') no-repeat scroll -300px -1px;}#adminmenu .menu-icon-tools div.wp-menu-image{background:transparent url('../images/menu-vs.png?ver=20100531') no-repeat scroll -210px -33px;}#adminmenu .menu-icon-tools:hover div.wp-menu-image,#adminmenu .menu-icon-tools.wp-has-current-submenu div.wp-menu-image,#adminmenu .menu-icon-tools.current div.wp-menu-image{background:transparent url('../images/menu-vs.png?ver=20100531') no-repeat scroll -210px -1px;}#icon-options-general,#adminmenu .menu-icon-settings div.wp-menu-image{background:transparent url('../images/menu-vs.png?ver=20100531') no-repeat scroll -240px -33px;}#adminmenu .menu-icon-settings:hover div.wp-menu-image,#adminmenu .menu-icon-settings.wp-has-current-submenu div.wp-menu-image{background:transparent url('../images/menu-vs.png?ver=20100531') no-repeat scroll -240px -1px;}#adminmenu .menu-icon-site div.wp-menu-image{background:transparent url('../images/menu-vs.png?ver=20100531') no-repeat scroll -360px -33px;}#adminmenu .menu-icon-site:hover div.wp-menu-image,#adminmenu .menu-icon-site.wp-has-current-submenu div.wp-menu-image{background:transparent url('../images/menu-vs.png?ver=20100531') no-repeat scroll -360px -1px;}#icon-edit,#icon-post{background:transparent url(../images/icons32-vs.png?ver=20100531) no-repeat -552px -5px;}#icon-index{background:transparent url(../images/icons32-vs.png?ver=20100531) no-repeat -137px -5px;}#icon-upload{background:transparent url(../images/icons32-vs.png?ver=20100531) no-repeat -251px -5px;}#icon-link-manager,#icon-link,#icon-link-category{background:transparent url(../images/icons32-vs.png?ver=20100531) no-repeat -190px -5px;}#icon-edit-pages,#icon-page{background:transparent url(../images/icons32-vs.png?ver=20100531) no-repeat -312px -5px;}#icon-edit-comments{background:transparent url(../images/icons32-vs.png?ver=20100531) no-repeat -72px -5px;}#icon-themes{background:transparent url(../images/icons32-vs.png?ver=20100531) no-repeat -11px -5px;}#icon-plugins{background:transparent url(../images/icons32-vs.png?ver=20100531) no-repeat -370px -5px;}#icon-users,#icon-profile,#icon-user-edit{background:transparent url(../images/icons32-vs.png?ver=20100531) no-repeat -600px -5px;}#icon-tools,#icon-admin{background:transparent url(../images/icons32-vs.png?ver=20100531) no-repeat -432px -5px;}#icon-options-general{background:transparent url(../images/icons32-vs.png?ver=20100531) no-repeat -492px -5px;}#icon-ms-admin{background:transparent url(../images/icons32-vs.png?ver=20100531) no-repeat -659px -5px;}table.diff .diff-deletedline{background-color:#fdd;}table.diff .diff-deletedline del{background-color:#f99;}table.diff .diff-addedline{background-color:#dfd;}table.diff .diff-addedline ins{background-color:#9f9;}#att-info{background-color:#E4F2FD;}#sidemenu a{background-color:#f9f9f9;border-color:#f9f9f9;border-bottom-color:#dfdfdf;}#sidemenu a.current{background-color:#fff;border-color:#dfdfdf #dfdfdf #fff;color:#D54E21;}#screen-options-wrap,#contextual-help-wrap{background-color:#f7fcfe;border-color:#D1e5ee;}#screen-options-link-wrap,#contextual-help-link-wrap{background-color:#eff8ff;border-right:1px solid #D1E5EE;border-left:1px solid #D1E5EE;border-bottom:1px solid #D1E5EE;background-image:-ms-linear-gradient(bottom,#eff8ff,#fff);background-image:-moz-linear-gradient(bottom,#eff8ff,#fff);background-image:-o-linear-gradient(bottom,#eff8ff,#fff);background-image:-webkit-gradient(linear,left bottom,left top,from(#eff8ff),to(#fff));background-image:-webkit-linear-gradient(bottom,#eff8ff,#fff);background-image:linear-gradient(bottom,#eff8ff,#fff);}#screen-meta-links a.show-settings{color:#606060;}#screen-meta-links a.show-settings:hover{color:#000;}#replysubmit{background-color:#f1f1f1;border-top-color:#ddd;}#replyerror{border-color:#ddd;background-color:#f9f9f9;}#edithead,#replyhead{background-color:#f1f1f1;}#ed_reply_toolbar{background-color:#e9e9e9;}.vim-current,.vim-current th,.vim-current td{background-color:#E4F2FD!important;}.star-average,.star.star-rating{background-color:#fc0;}div.star.select:hover{background-color:#d00;}div.star img{border-left:1px solid #fff;border-right:1px solid #fff;}#plugin-information .fyi ul{background-color:#eaf3fa;}#plugin-information .fyi h2.mainheader{background-color:#cee1ef;}#plugin-information pre,#plugin-information code{background-color:#ededff;}#plugin-information pre{border:1px solid #ccc;}.inline-edit-row fieldset input[type="text"],.inline-edit-row fieldset textarea,#bulk-titles,#replyrow input{border-color:#ddd;}.inline-editor div.title{background-color:#EAF3FA;}.inline-editor ul.cat-checklist{background-color:#fff;border-color:#ddd;}.inline-editor .categories .catshow,.inline-editor .categories .cathide{color:#21759b;}.inline-editor .quick-edit-save{background-color:#f1f1f1;}#replyrow #ed_reply_toolbar input:hover{border-color:#aaa;background:#ddd;}fieldset.inline-edit-col-right .inline-edit-col{border-color:#dfdfdf;}.attention{color:#D54E21;}.meta-box-sortables .postbox:hover .handlediv{background:transparent url(../images/arrows-vs.png) no-repeat 6px 7px;}.tablenav .tablenav-pages{color:#555;}.tablenav .tablenav-pages a{border-color:#d1e5ee;background:#eee url('../images/menu-bits-vs.gif?ver=20101102') repeat-x scroll left -379px;}.tablenav .tablenav-pages a:hover,.tablenav .tablenav-pages a:focus{color:#d54e21;}.tablenav .tablenav-pages a.disabled,.tablenav .tablenav-pages a.disabled:hover,.tablenav .tablenav-pages a.disabled:focus{color:#aaa;}.tablenav .tablenav-pages .current{background:#dfdfdf;border-color:#d3d3d3;}#availablethemes,#availablethemes td{border-color:#ddd;}#current-theme img{border-color:#999;}#TB_window #TB_title a.tb-theme-preview-link,#TB_window #TB_title a.tb-theme-preview-link:visited{color:#999;}#TB_window #TB_title a.tb-theme-preview-link:hover,#TB_window #TB_title a.tb-theme-preview-link:focus{color:#ccc;}.misc-pub-section{border-top-color:#fff;border-bottom-color:#eee;}#minor-publishing{border-bottom-color:#ddd;}#post-body .misc-pub-section{border-right-color:#eee;}.post-com-count span{background-color:#bbb;}.form-table .color-palette td{border-color:#fff;}.sortable-placeholder{border-color:#bbb;background-color:#f5f5f5;}#post-body ul.category-tabs li.tabs a,#post-body ul.add-menu-item-tabs li.tabs a,body.press-this ul.category-tabs li.tabs a{color:#333;}#wp_editimgbtn,#wp_delimgbtn,#wp_editgallery,#wp_delgallery{border-color:#999;background-color:#eee;}#wp_editimgbtn:hover,#wp_delimgbtn:hover,#wp_editgallery:hover,#wp_delgallery:hover{border-color:#555;background-color:#ccc;}#favorite-first{border-color:#c0c0c0;background:#f1f1f1;background:-moz-linear-gradient(bottom,#e7e7e7,#fff);background:-webkit-gradient(linear,left bottom,left top,from(#e7e7e7),to(#fff));}#favorite-inside{border-color:#c0c0c0;background-color:#fff;}#favorite-toggle{background:transparent url(../images/fav-arrow.gif?ver=20100531) no-repeat 0 -4px;border-color:#d0dfe9;-moz-box-shadow:inset 1px 0 0 #fff;-webkit-box-shadow:inset 1px 0 0 #fff;box-shadow:inset 1px 0 0 #fff;}#favorite-actions a{color:#464646;}#favorite-actions a:hover{color:#000;}#favorite-inside a:hover{text-decoration:underline;}#screen-meta a.show-settings,.toggle-arrow{background:transparent url(../images/arrows-vs.png) no-repeat right 3px;}#screen-meta .screen-meta-active a.show-settings{background:transparent url(../images/arrows-vs.png) no-repeat right -33px;}.view-switch #view-switch-list{background:transparent url(../images/list.png) no-repeat 0 0;}.view-switch .current #view-switch-list{background:transparent url(../images/list.png) no-repeat -40px 0;}.view-switch #view-switch-excerpt{background:transparent url(../images/list.png) no-repeat -20px 0;}.view-switch .current #view-switch-excerpt{background:transparent url(../images/list.png) no-repeat -60px 0;}#header-logo{background:transparent url(../images/wp-logo-vs.png?ver=20101102) no-repeat scroll center center;}.popular-tags,.feature-filter{background-color:#fff;border-color:#DFDFDF;}#theme-information .action-button{border-top-color:#DFDFDF;}.theme-listing br.line{border-bottom-color:#ccc;}div.widgets-sortables,#widgets-left .inactive{background-color:#f7fcfe;border-color:#d0dfe9;}#available-widgets .widget-holder{background-color:#f7fcfe;border-color:#d0dfe9;}#available-widgets .widget-description{color:#555;}.sidebar-name{color:#464646;background-color:#f7fcfe;background-image:-ms-linear-gradient(top,#ECF8FE,#f7fcfe);background-image:-moz-linear-gradient(top,#ECF8FE,#f7fcfe);background-image:-o-linear-gradient(top,#ECF8FE,#f7fcfe);background-image:-webkit-gradient(linear,left top,left bottom,from(#ECF8FE),to(#f7fcfe));background-image:-webkit-linear-gradient(top,#ECF8FE,#f7fcfe);background-image:linear-gradient(top,#ECF8FE,#f7fcfe);text-shadow:#fff 0 1px 0;border-color:#d0dfe9;-moz-box-shadow:inset 0 1px 0 #fff;-webkit-box-shadow:inset 0 1px 0 #fff;box-shadow:inset 0 1px 0 #fff;}.sidebar-name:hover,#removing-widget{color:#d54e21;}#removing-widget span{color:black;}.sidebar-name-arrow{background:transparent url(../images/arrows-vs.png) no-repeat 5px 9px;}.sidebar-name:hover .sidebar-name-arrow{background:transparent url(../images/arrows-dark-vs.png) no-repeat 5px 9px;}.in-widget-title{color:#606060;}.deleting .widget-title *{color:#aaa;}.imgedit-menu div{border-color:#d5d5d5;background-color:#f1f1f1;}.imgedit-menu div:hover{border-color:#c1c1c1;background-color:#eaeaea;}.imgedit-menu div.disabled{border-color:#ccc;background-color:#ddd;filter:alpha(opacity=50);opacity:.5;}#dashboard_recent_comments div.undo{border-top-color:#dfdfdf;}.comment-ays,.comment-ays th{border-color:#ddd;}.comment-ays th{background-color:#f1f1f1;}#menu-management .menu-edit{border-color:#d0dfe9;}#post-body{background:#fff;border-top-color:#fff;border-bottom-color:#d0dfe9;}#nav-menu-header{border-bottom-color:#d0dfe9;}#nav-menu-footer{border-top-color:#fff;}#menu-management .nav-tabs-arrow a{color:#C1C1C1;}#menu-management .nav-tabs-arrow a:hover{color:#D54E21;}#menu-management .nav-tabs-arrow a:active{color:#464646;}#menu-management .nav-tab-active{border-color:#dfdfdf;}#menu-management .nav-tab{background:#f7fcfe;border-color:#d0dfe9;}.js .input-with-default-title{color:#aaa;}#cancel-save{color:#f00;}#cancel-save:hover{background-color:#F00;color:#fff;}.list-container{border-color:#dfdfdf;}.menu-item-handle{border-color:#d0dfe9;}.menu li.deleting .menu-item-handle{background-color:#f66;text-shadow:#ccc;}.item-type{color:#999;}.item-controls .menu-item-delete:hover{color:#f00;}.item-edit{background:transparent url(../images/arrows-vs.png) no-repeat 8px 10px;border-bottom-color:#eee;}.item-edit:hover{background:transparent url(../images/arrows-dark-vs.png) no-repeat 8px 10px;}.menu-item-settings{border-color:#d0dfe9;}.link-to-original{color:#777;border-color:#d0dfe9;}#cancel-save:hover{color:#fff!important;}#update-menu-item{color:#fff!important;}#update-menu-item:hover,#update-menu-item:active,#update-menu-item:focus{color:#eaf2fa!important;border-color:#13455b!important;}.submitbox .submitcancel{color:#21759B;border-bottom-color:#21759B;}.submitbox .submitcancel:hover{background:#21759B;color:#fff;}#menu-management .nav-tab-active,.menu-item-handle,.menu-item-settings{-moz-box-shadow:inset 0 1px 0 #fff;-webkit-box-shadow:inset 0 1px 0 #fff;box-shadow:inset 0 1px 0 #fff;}#menu-management .nav-tab-active{background:#eff8ff;border-bottom-color:#eff8ff;}#upload-form label{color:#777;}.fullscreen-overlay{background:#fff;}.wp-fullscreen-focus #wp-fullscreen-title,.wp-fullscreen-focus #wp-fullscreen-container{border-color:#BED1DD;}#fullscreen-topbar{border-bottom-color:#D1E5EE;} \ No newline at end of file diff --git a/src/wp-admin/css/colors-classic.dev.css b/src/wp-admin/css/colors-classic.dev.css new file mode 100644 index 0000000..329d32e --- /dev/null +++ b/src/wp-admin/css/colors-classic.dev.css @@ -0,0 +1,2087 @@ +html, +.wp-dialog { + background-color: #fff; +} + +* html input, +* html .widget { + border-color: #dfdfdf; +} + +textarea, +input[type="text"], +input[type="password"], +input[type="file"], +input[type="button"], +input[type="submit"], +input[type="reset"], +select { + border-color: #dfdfdf; + background-color: #fff; +} + +kbd, +code { + background: #eaeaea; +} + +input[readonly] { + background-color: #eee; +} + +.find-box-search { + border-color: #dfdfdf; + background-color: #f1f1f1; +} + +.find-box { + background-color: #f1f1f1; +} + +.find-box-inside { + background-color: #fff; +} + +a.page-numbers:hover { + border-color: #999; +} + +body, +#wpbody, +.form-table .pre { + color: #333; +} + +body > #upload-menu { + border-bottom-color: #fff; +} + +#postcustomstuff table, +#your-profile fieldset, +#rightnow, +div.dashboard-widget, +#dashboard-widgets p.dashboard-widget-links, +#replyrow #ed_reply_toolbar input { + border-color: #D1E5EE +} + +#poststuff .inside label.spam, +#poststuff .inside label.deleted { + color: red; +} + +#poststuff .inside label.waiting { + color: orange; +} + +#poststuff .inside label.approved { + color: green; +} + +#postcustomstuff table { + border-color: #dfdfdf; + background-color: #F9F9F9; +} + +#postcustomstuff thead th { + background-color: #F1F1F1; +} + +#postcustomstuff table input, +#postcustomstuff table textarea { + border-color: #dfdfdf; + background-color: #fff; +} + +.widefat { + border-color: #D1E5EE; + background-color: #fff; +} + +div.dashboard-widget-error { + background-color: #c43; +} + +div.dashboard-widget-notice { + background-color: #cfe1ef; +} + +div.dashboard-widget-submit { + border-top-color: #ccc; +} + +div.tabs-panel, +.wp-tab-panel, +ul.category-tabs li.tabs, +ul.add-menu-item-tabs li.tabs, +.wp-tab-active { + border-color: #dfdfdf; + background-color: #fff; +} + +ul.category-tabs li.tabs, +ul.add-menu-item-tabs li.tabs, +.wp-tab-active { + background-color: #fff; +} + +input.disabled, +textarea.disabled { + background-color: #ccc; +} +/* #upload-menu li a.upload-tab-link, */ +#plugin-information .action-button a, +#plugin-information .action-button a:hover, +#plugin-information .action-button a:visited { + color: #fff; +} + +.widget .widget-top, +.postbox h3, +.stuffbox h3, +.widefat thead tr th, +.widefat tfoot tr th, +h3.dashboard-widget-title, +h3.dashboard-widget-title span, +h3.dashboard-widget-title small, +.find-box-head, +.sidebar-name, +#nav-menu-header, +#nav-menu-footer, +.menu-item-handle, +#fullscreen-topbar { + background-color: #f5fafd; /* Fallback */ + background-image: -ms-linear-gradient(top, #f7fcfe, #eff8ff); /* IE10 */ + background-image: -moz-linear-gradient(top, #f7fcfe, #eff8ff); /* Firefox */ + background-image: -o-linear-gradient(top, #f7fcfe, #eff8ff); /* Opera */ + background-image: -webkit-gradient(linear, left top, left bottom, from(#f7fcfe), to(#eff8ff)); /* old Webkit */ + background-image: -webkit-linear-gradient(top, #f7fcfe, #eff8ff); /* new Webkit */ + background-image: linear-gradient(top, #f7fcfe, #eff8ff); /* proposed W3C Markup */ +} + +.widget .widget-top, +.postbox h3, +.stuffbox h3 { + border-bottom-color: #D1E5EE; + text-shadow: #fff 0 1px 0; + -moz-box-shadow: 0 1px 0 #fff; + -webkit-box-shadow: 0 1px 0 #fff; + box-shadow: 0 1px 0 #fff; +} + +.form-table th, +.form-wrap label { + color: #222; + text-shadow: #fff 0 1px 0; +} + +.description, +.form-wrap p { + color: #666; +} + +strong .post-com-count span { + background-color: #21759b; +} + +.sorthelper { + background-color: #ccf3fa; +} + +.ac_match, +.subsubsub a.current { + color: #000; +} + +.wrap h2 { + color: #174f69; +} + +.wrap .add-new-h2 { + background: #f1f1f1; +} + +.subtitle { + color: #777; +} + +.ac_over { + background-color: #f0f0b8; +} + +.ac_results { + background-color: #fff; + border-color: #808080; +} + +.ac_results li { + color: #101010; +} + +.alternate, +.alt { + background-color: #f7fcfe; +} + +.available-theme a.screenshot { + background-color: #f1f1f1; + border-color: #ddd; +} + +.bar { + background-color: #e8e8e8; + border-right-color: #99d; +} + +#media-upload, +#media-upload .media-item .slidetoggle { + background: #fff; +} + +#media-upload .slidetoggle { + border-top-color: #dfdfdf; +} + +div.error, +.login #login_error { + background-color: #ffebe8; + border-color: #c00; +} + +div.error a { + color: #c00; +} + +.form-invalid { + background-color: #ffebe8 !important; +} + +.form-invalid input, +.form-invalid select { + border-color: #c00 !important; +} + +.submit { + border-color: #DFDFDF; +} + +.highlight { + background-color: #e4f2fd; + color: #000; +} + +.howto, +.nonessential, +#edit-slug-box, +.form-input-tip, +.subsubsub { + color: #666; +} + +.media-item { + border-bottom-color: #dfdfdf; +} + +#wpbody-content #media-items .describe { + border-top-color: #dfdfdf; +} + +.media-upload-form label.form-help, +td.help { + color: #9a9a9a; +} + +.post-com-count { + background-image: url(../images/bubble_bg.gif); + color: #fff; +} + +.post-com-count span { + background-color: #bbb; + color: #fff; +} + +.post-com-count:hover span { + background-color: #d54e21; +} + +.quicktags, .search { + background-color: #ccc; + color: #000; +} + +.side-info h5 { + border-bottom-color: #dadada; +} + +.side-info ul { + color: #666; +} + +.button, +.button-secondary, +.submit input, +input[type=button], +input[type=submit] { + border-color: #bbb; + color: #464646; +} + +.button:hover, +.button-secondary:hover, +.submit input:hover, +input[type=button]:hover, +input[type=submit]:hover { + color: #000; + border-color: #666; +} + +.button, +.submit input, +.button-secondary { + background: #f2f2f2 url(../images/white-grad.png) repeat-x scroll left top; + text-shadow: rgba(255,255,255,1) 0 1px 0; +} + +.button:active, +.submit input:active, +.button-secondary:active { + background: #eee url(../images/white-grad-active.png) repeat-x scroll left top; +} + +input.button-primary, +button.button-primary, +a.button-primary { + border-color: #298cba; + font-weight: bold; + color: #fff; + background: #21759B url(../images/button-grad.png) repeat-x scroll left top; + text-shadow: rgba(0,0,0,0.3) 0 -1px 0; +} + +input.button-primary:active, +button.button-primary:active, +a.button-primary:active { + background: #21759b url(../images/button-grad-active.png) repeat-x scroll left top; + color: #eaf2fa; +} + +input.button-primary:hover, +button.button-primary:hover, +a.button-primary:hover, +a.button-primary:focus, +a.button-primary:active { + border-color: #13455b; + color: #eaf2fa; +} + +.button-disabled, +.button[disabled], +.button:disabled, +.button-secondary[disabled], +.button-secondary:disabled, +a.button.disabled { + color: #aaa !important; + border-color: #ddd !important; +} + +.button-primary-disabled, +.button-primary[disabled], +.button-primary:disabled { + color: #9FD0D5 !important; + background: #298CBA !important; +} + +a:hover, +a:active, +a:focus { + color: #d54e21; +} + +#wphead #viewsite a:hover, +#adminmenu a:hover, +#adminmenu ul.wp-submenu a:hover, +#the-comment-list .comment a:hover, +#rightnow a:hover, +#media-upload a.del-link:hover, +div.dashboard-widget-submit input:hover, +.subsubsub a:hover, +.subsubsub a.current:hover, +.ui-tabs-nav a:hover, +.plugins .inactive a:hover, +#all-plugins-table .plugins .inactive a:hover, +#search-plugins-table .plugins .inactive a:hover { + color: #d54e21; +} + +#the-comment-list .comment-item, +#dashboard-widgets #dashboard_quick_press form p.submit { + border-color: #dfdfdf; +} + +#side-sortables .category-tabs .tabs a, +#side-sortables .add-menu-item-tabs .tabs a, +.wp-tab-bar .wp-tab-active a { + color: #333; +} + +#rightnow .rbutton { + background-color: #ebebeb; + color: #264761; +} + +.submitbox .submit { + background-color: #464646; + color: #ccc; +} + +.plugins a.delete:hover, +#all-plugins-table .plugins a.delete:hover, +#search-plugins-table .plugins a.delete:hover, +.submitbox .submitdelete { + color: #f00; + border-bottom-color: #f00; +} + +.submitbox .submitdelete:hover, +#media-items a.delete:hover { + color: #fff; + background-color: #f00; + border-bottom-color: #f00; +} + +#normal-sortables .submitbox .submitdelete:hover { + color: #000; + background-color: #f00; + border-bottom-color: #f00; +} + +.tablenav .dots { + border-color: transparent; +} + +.tablenav .next, +.tablenav .prev { + border-color: transparent; + color: #21759b; +} + +.tablenav .next:hover, +.tablenav .prev:hover { + border-color: transparent; + color: #d54e21; +} + +div.updated, +.login .message { + background-color: #ffffe0; + border-color: #e6db55; +} + +.update-message { + color: #000; +} + +a.page-numbers { + border-bottom-color: #B8D3E2; +} + +.commentlist li { + border-bottom-color: #ccc; +} + +.widefat td, +.widefat th { + border-top-color: #fff; + border-bottom-color: #D0DFE9; +} + +.widefat th { + text-shadow: rgba(255,255,255,0.8) 0 1px 0; +} + +.widefat td { + color: #555; +} +.widefat p, +.widefat ol, +.widefat ul { + color: #333; +} + +.widefat thead tr th, +.widefat tfoot tr th, +h3.dashboard-widget-title, +h3.dashboard-widget-title span, +h3.dashboard-widget-title small, +.find-box-head { + color: #333; +} + +th.sortable a:hover, th.sortable a:active, th.sortable a:focus { + color: #333; +} + +h3.dashboard-widget-title small a { + color: #d7d7d7; +} + +h3.dashboard-widget-title small a:hover { + color: #fff; +} + +a, +#adminmenu a, +#poststuff #edButtonPreview, +#poststuff #edButtonHTML, +#the-comment-list p.comment-author strong a, +#media-upload a.del-link, +#media-items a.delete, +.plugins a.delete, +.ui-tabs-nav a { + color: #21759b; +} + +#adminmenu .awaiting-mod, +#adminmenu .update-plugins, +#sidemenu a .update-plugins, +#rightnow .reallynow { + background-color: #464646; + color: #fff; + -moz-box-shadow: rgba(255,255,255,0.5) 0 1px 0; + -khtml-box-shadow: rgba(255,255,255,0.5) 0 1px 0; + -webkit-box-shadow: rgba(255,255,255,0.5) 0 1px 0; + box-shadow: rgba(255,255,255,0.5) 0 1px 0; +} +#plugin-information .action-button { + background-color: #d54e21; + color: #fff; +} + +#adminmenu li.current a .awaiting-mod, +#adminmenu li a.wp-has-current-submenu .update-plugins{ + background-color: #464646; + color: #fff; + -moz-box-shadow: rgba(255,255,255,0.5) 0 1px 0; + -khtml-box-shadow: rgba(255,255,255,0.5) 0 1px 0; + -webkit-box-shadow: rgba(255,255,255,0.5) 0 1px 0; + box-shadow: rgba(255,255,255,0.5) 0 1px 0; +} + +div#media-upload-header, +div#plugin-information-header { + background-color: #f9f9f9; + border-bottom-color: #dfdfdf; +} + +#currenttheme img { + border-color: #666; +} + +#dashboard_secondary div.dashboard-widget-content ul li a { + background-color: #f9f9f9; +} + +input.readonly, textarea.readonly { + background-color: #ddd; +} + +#ed_toolbar input, +#ed_reply_toolbar input { + background: #fff url("../images/fade-butt.png") repeat-x 0 -2px; +} + +#editable-post-name { + background-color: #fffbcc; +} + +#edit-slug-box strong, +.tablenav .displaying-num, +#submitted-on, +.submitted-on { + color: #777; +} + +.login #nav a, +.login #backtoblog a { + color: #21759b !important; +} + +.login #nav a:hover, +.login #backtoblog a:hover { + color: #d54e21 !important; +} + +#footer { + color: #777; + border-color: #b0c8d7; +} + +#media-items, +.imgedit-group { + border-color: #dfdfdf; +} + +.checkbox, +.side-info, +.plugins tr, +#your-profile #rich_editing { + background-color: #fcfcfc; +} + +.plugins .inactive, +.plugins .inactive th, +.plugins .inactive td, +tr.inactive + tr.plugin-update-tr .plugin-update { + background-color: #efede7; +} + +.plugin-update-tr .update-message { + background-color: #fffbe4; + border-color: #dfdfdf; +} + +.plugins .active, +.plugins .active th, +.plugins .active td { + color: #000; +} + +.plugins .inactive a { + color: #557799; +} + +#the-comment-list tr.undo, +#the-comment-list div.undo { + background-color: #f4f4f4; +} + +#the-comment-list .unapproved { + background-color: #ffffe0; +} + +#the-comment-list .approve a { + color: #006505; +} + +#the-comment-list .unapprove a { + color: #d98500; +} + +table.widefat span.delete a, +table.widefat span.trash a, +table.widefat span.spam a, +#dashboard_recent_comments .delete a, +#dashboard_recent_comments .trash a, +#dashboard_recent_comments .spam a { + color: #bc0b0b; +} + +.widget, +#widget-list .widget-top, +.postbox, +#titlediv, +#poststuff .postarea, +.stuffbox { + border-color: #d1e5ee; + -moz-box-shadow: inset 0 1px 0 #fff; + -webkit-box-shadow: inset 0 1px 0 #fff; + box-shadow: inset 0 1px 0 #fff; + -moz-border-radius: 3px; + -khtml-border-radius: 3px; + -webkit-border-radius: 3px; + border-radius: 3px; +} + +.widget, +#widget-list .widget-top, +.postbox, +.menu-item-settings { + background-color: #f7fcfe; +} + +.postbox h3 { + color: #174f69; +} + +.widget .widget-top { + color: #174f69; +} + +.sidebar-name:hover h3, +.postbox h3:hover { + color: #000; +} + +.curtime #timestamp { + background-image: url(../images/date-button.gif); +} + +#quicktags #ed_link { + color: #00f; +} + +#rightnow .youhave { + background-color: #f0f6fb; +} + +#rightnow a { + color: #448abd; +} + +.tagchecklist span a, +#bulk-titles div a { + background: url(../images/xit.gif) no-repeat; +} + +.tagchecklist span a:hover, +#bulk-titles div a:hover { + background: url(../images/xit.gif) no-repeat -10px 0; +} + +#update-nag, .update-nag { + background-color: #fffbcc; + border-color: #e6db55; + color: #555; +} + +.login #backtoblog a { + color: #464646; +} + +#wphead { + border-bottom:#d0dfe9 1px solid; +} + +#wphead h1 a { + color: #174f69; +} + +#user_info { + color: #777; +} + +#user_info:hover, +#user_info.active { + color: #185069; +} + +#user_info.active { + background-color: #f7fcfe; /* Fallback */ + background-image: -ms-linear-gradient(bottom, #f7fcfe, #f9f9f9); /* IE10 */ + background-image: -moz-linear-gradient(bottom, #f7fcfe, #f9f9f9); /* Firefox */ + background-image: -o-linear-gradient(bottom, #f7fcfe, #f9f9f9); /* Opera */ + background-image: -webkit-gradient(linear, left bottom, left top, from(#f7fcfe), to(#f9f9f9)); /* old Webkit */ + background-image: -webkit-linear-gradient(bottom, #f7fcfe, #f9f9f9); /* new Webkit */ + background-image: linear-gradient(bottom, #f7fcfe, #f9f9f9); /* proposed W3C Markup */ + border-color: #d0dfe9 #d0dfe9 #d0dfe9; +} + +#user_info_arrow { + background: transparent url(../images/arrows-vs.png) no-repeat 6px 5px; +} + +#user_info:hover #user_info_arrow, +#user_info.active #user_info_arrow { + background: transparent url(../images/arrows-dark-vs.png) no-repeat 6px 5px; +} + +#user_info_links { + -moz-box-shadow: 0 3px 2px -2px rgba( 0, 0, 0, 0.2 ); + -webkit-box-shadow: 0 3px 2px -2px rgba( 0, 0, 0, 0.2 ); + box-shadow: 0 3px 2px -2px rgba( 0, 0, 0, 0.2 ); +} + +#user_info_links ul { + background: #f7fcfe; + border-color: #d0dfe9 #d0dfe9 #d0dfe9; + -moz-box-shadow: inset 0 1px 0 #f9f9f9; + -webkit-box-shadow: inset 0 1px 0 #f9f9f9; + box-shadow: inset 0 1px 0 #f9f9f9; +} + +#user_info_links li:hover { + background-color: #ECF8FE; +} + +#user_info_links li:hover a, +#user_info_links li a:hover { + text-decoration: none; +} + +#user_info a:link, +#user_info a:visited, +#footer a:link, +#footer a:visited { + text-decoration: none; +} + +#footer a:hover { + color: #000; + text-decoration: underline; +} + +div#media-upload-error, +.file-error, +abbr.required, +.widget-control-remove:hover, +table.widefat .delete a:hover, +table.widefat .trash a:hover, +table.widefat .spam a:hover, +#dashboard_recent_comments .delete a:hover, +#dashboard_recent_comments .trash a:hover +#dashboard_recent_comments .spam a:hover { + color: #f00; +} + +#pass-strength-result { + background-color: #eee; + border-color: #ddd !important; +} + +#pass-strength-result.bad { + background-color: #ffb78c; + border-color: #ff853c !important; +} + +#pass-strength-result.good { + background-color: #ffec8b; + border-color: #fc0 !important; +} + +#pass-strength-result.short { + background-color: #ffa0a0; + border-color: #f04040 !important; +} + +#pass-strength-result.strong { + background-color: #c3ff88; + border-color: #8dff1c !important; +} + +/* editors */ +#quicktags { + border-color: #cfdfe9; + background-color: #cfdfe9; + background-image: url("../images/ed-bg-vs.gif?ver=20101102"); +} + +#ed_toolbar input { + border-color: #C3C3C3; +} + +#ed_toolbar input:hover { + border-color: #aaa; + background: #ddd; +} + +#poststuff .wp_themeSkin .mceStatusbar { + border-color: #d0dfe9; +} + +#poststuff .wp_themeSkin .mceStatusbar * { + color: #555; +} + +#poststuff #edButtonPreview, +#poststuff #edButtonHTML { + background-color: #f7fcfe; + border-color: #d0dfe9 #d0dfe9 #d0dfe9; + color: #999; +} + +#poststuff #editor-toolbar .active { + border-color: #d0dfe9 #d0dfe9 #eff8ff; + background-color: #eff8ff; + color: #333; +} + +/* TinyMCE */ +#post-status-info { + background-color: #eff8ff; +} + +.wp_themeSkin *, +.wp_themeSkin a:hover, +.wp_themeSkin a:link, +.wp_themeSkin a:visited, +.wp_themeSkin a:active { + color: #000; +} + +/* Containers */ +.wp_themeSkin table.mceLayout { + border-color: #bed1dd #bed1dd #d0dfe9; +} + +#editorcontainer #content, +#editorcontainer .wp_themeSkin .mceIframeContainer { + -moz-box-shadow: inset 1px 1px 2px rgba( 0, 0, 0, 0.1 ); + -webkit-box-shadow: inset 1px 1px 2px rgba( 0, 0, 0, 0.1 ); + box-shadow: inset 1px 1px 2px rgba( 0, 0, 0, 0.1 ); +} +.wp_themeSkin iframe { + background: transparent; +} + +/* Layout */ +.wp_themeSkin .mceStatusbar { + color: #000; + background-color: #f5f5f5; +} + +/* Button */ +.wp_themeSkin .mceButton { + border-color: #B0C8D7; + background-color: #cfdfe9; /* Fallback */ + background-image: -ms-linear-gradient(bottom, #cfdfe9, #fff); /* IE10 */ + background-image: -moz-linear-gradient(bottom, #cfdfe9, #fff); /* Firefox */ + background-image: -o-linear-gradient(bottom, #cfdfe9, #fff); /* Opera */ + background-image: -webkit-gradient(linear, left bottom, left top, from(#cfdfe9), to(#fff)); /* old Webkit */ + background-image: -webkit-linear-gradient(bottom, #cfdfe9, #fff) !important; /* new Webkit */ + background-image: linear-gradient(bottom, #cfdfe9, #fff); /* proposed W3C Markup */ +} + +.wp_themeSkin a.mceButtonEnabled:hover { + border-color: #5589AA !important; + background-color: #c9c9c9; /* Fallback */ + background-image: -ms-linear-gradient(bottom, #bdccd5, #fff); /* IE10 */ + background-image: -moz-linear-gradient(bottom, #bdccd5, #fff)); /* Firefox */ + background-image: -o-linear-gradient(bottom, #bdccd5, #fff)); /* Opera */ + background-image: -webkit-gradient(linear, left bottom, left top, from(#bdccd5), to(#fff)); /* old Webkit */ + background-image: -webkit-linear-gradient(bottom, #bdccd5, #fff) !important; /* new Webkit */ + background-image: linear-gradient(bottom, #bdccd5, #fff); /* proposed W3C Markup */ +} + +.wp_themeSkin a.mceButton:active, +.wp_themeSkin a.mceButtonEnabled:active, +.wp_themeSkin a.mceButtonSelected:active, +.wp_themeSkin a.mceButtonActive, +.wp_themeSkin a.mceButtonActive:active, +.wp_themeSkin a.mceButtonActive:hover { + background: #B0C8D7 !important; + background-image: -ms-linear-gradient(bottom, #fff, #cfdfe9); /* IE10 */ + background-image: -moz-linear-gradient(bottom, #fff, #cfdfe9)); /* Firefox */ + background-image: -o-linear-gradient(bottom, #fff, #cfdfe9)); /* Opera */ + background-image: -webkit-gradient(linear, left bottom, left top, from(#fff), to(#cfdfe9)); /* old Webkit */ + background-image: -webkit-linear-gradient(bottom, #fff, #cfdfe9) !important; /* new Webkit */ + background-image: linear-gradient(bottom, #fff, #cfdfe9); /* proposed W3C Markup */ + border-color: #5589AA !important; +} + +.wp_themeSkin .mceButtonDisabled { + border-color: #B0C8D7 !important; +} + +/* ListBox */ +.wp_themeSkin .mceListBox .mceText, +.wp_themeSkin .mceListBox .mceOpen { + border-color: #B0C8D7; + background-color: #cfdfe9; /* Fallback */ + background-image: -ms-linear-gradient(bottom, #cfdfe9, #fff); /* IE10 */ + background-image: -moz-linear-gradient(bottom, #cfdfe9, #fff); /* Firefox */ + background-image: -o-linear-gradient(bottom, #cfdfe9, #fff); /* Opera */ + background-image: -webkit-gradient(linear, left bottom, left top, from(#cfdfe9), to(#fff)); /* old Webkit */ + background-image: -webkit-linear-gradient(bottom, #cfdfe9, #fff) !important; /* new Webkit */ + background-image: linear-gradient(bottom, #cfdfe9, #fff); /* proposed W3C Markup */ +} + +.wp_themeSkin .mceListBox .mceOpen { + border-left: 0px !important; +} + +.wp_themeSkin table.mceListBoxEnabled:hover .mceOpen, +.wp_themeSkin .mceListBoxHover .mceOpen, +.wp_themeSkin .mceListBoxHover:active .mceOpen, +.wp_themeSkin .mceListBoxSelected .mceOpen, +.wp_themeSkin .mceListBoxSelected .mceText, +.wp_themeSkin table.mceListBoxEnabled:active .mceText { + background: #B0C8D7; + border-color: #5589AA !important; +} + +/* List Box Hover */ +.wp_themeSkin table.mceListBoxEnabled:hover .mceText, +.wp_themeSkin .mceListBoxHover .mceText, +.wp_themeSkin table.mceListBoxEnabled:hover .mceOpen, +.wp_themeSkin .mceListBoxHover .mceOpen { + border-color: #5589AA !important; + background-color: #c9c9c9; /* Fallback */ + background-image: -ms-linear-gradient(bottom, #cfdfe9, #fff); /* IE10 */ + background-image: -moz-linear-gradient(bottom, #cfdfe9, #fff); /* Firefox */ + background-image: -o-linear-gradient(bottom, #cfdfe9, #fff); /* Opera */ + background-image: -webkit-gradient(linear, left bottom, left top, from(#cfdfe9), to(#fff)); /* old Webkit */ + background-image: -webkit-linear-gradient(bottom, #cfdfe9, #fff) !important; /* new Webkit */ + background-image: linear-gradient(bottom, #cfdfe9, #fff); /* proposed W3C Markup */ +} + +.wp_themeSkin select.mceListBox { + border-color: #B2B2B2; + background-color: #fff; +} + +/* SplitButton */ +.wp_themeSkin .mceSplitButton a.mceAction, +.wp_themeSkin .mceSplitButton a.mceOpen { + border-color: #B0C8D7; +} + +.wp_themeSkin .mceSplitButton a.mceOpen:hover, +.wp_themeSkin .mceSplitButtonSelected a.mceOpen, +.wp_themeSkin table.mceSplitButtonEnabled:hover a.mceAction, +.wp_themeSkin .mceSplitButton a.mceAction:hover { + border-color: #5589AA !important; +} + + +.wp_themeSkin table.mceSplitButton td { + background-color: #cfdfe9; /* Fallback */ + background-image: -ms-linear-gradient(bottom, #cfdfe9, #fff); /* IE10 */ + background-image: -moz-linear-gradient(bottom, #cfdfe9, #fff); /* Firefox */ + background-image: -o-linear-gradient(bottom, #cfdfe9, #fff); /* Opera */ + background-image: -webkit-gradient(linear, left bottom, left top, from(#cfdfe9), to(#fff)); /* old Webkit */ + background-image: -webkit-linear-gradient(bottom, #cfdfe9, #fff) !important; /* new Webkit */ + background-image: linear-gradient(bottom, #cfdfe9, #fff); /* proposed W3C Markup */ +} + +.wp_themeSkin table.mceSplitButton:hover td { + background-image: -ms-linear-gradient(bottom, #cfdfe9, #fff); /* IE10 */ + background-image: -moz-linear-gradient(bottom, #cfdfe9, #fff); /* Firefox */ + background-image: -o-linear-gradient(bottom, #cfdfe9, #fff); /* Opera */ + background-image: -webkit-gradient(linear, left bottom, left top, from(#cfdfe9), to(#fff)); /* old Webkit */ + background-image: -webkit-linear-gradient(bottom, #cfdfe9, #fff) !important; /* new Webkit */ + background-image: linear-gradient(bottom, #cfdfe9, #fff); /* proposed W3C Markup */ +} + +.wp_themeSkin .mceSplitButtonActive { + background-color: #B0C8D7; +} + +/* ColorSplitButton */ +.wp_themeSkin div.mceColorSplitMenu table { + background-color: #ebebeb; + border-color: #B2B2B2; +} + +.wp_themeSkin .mceColorSplitMenu a { + border-color: #B2B2B2; +} + +.wp_themeSkin .mceColorSplitMenu a.mceMoreColors { + border-color: #fff; +} + +.wp_themeSkin .mceColorSplitMenu a.mceMoreColors:hover { + border-color: #0A246A; + background-color: #B6BDD2; +} + +.wp_themeSkin a.mceMoreColors:hover { + border-color: #0A246A; +} + +/* Menu */ +.wp_themeSkin .mceMenu { + border-color: #ddd; +} + +.wp_themeSkin .mceMenu table { + background-color: #ebeaeb; +} + +.wp_themeSkin .mceMenu .mceText { + color: #000; +} + +.wp_themeSkin .mceMenu .mceMenuItemEnabled a:hover, +.wp_themeSkin .mceMenu .mceMenuItemActive { + background-color: #f5f5f5; +} +.wp_themeSkin td.mceMenuItemSeparator { + background-color: #aaa; +} +.wp_themeSkin .mceMenuItemTitle a { + background-color: #ccc; + border-bottom-color: #aaa; +} +.wp_themeSkin .mceMenuItemTitle span.mceText { + color: #000; +} +.wp_themeSkin .mceMenuItemDisabled .mceText { + color: #888; +} + +.wp_themeSkin tr.mceFirst td.mceToolbar { + background: #cfdfe9 url("../images/ed-bg-vs.gif?ver=20101102") repeat-x scroll left top; + border-color: #cfdfe9; +} + +.wp-admin #mceModalBlocker { + background: #000; +} + +.wp-admin .clearlooks2 .mceFocus .mceTop .mceLeft { + background: #444444; + border-left: 1px solid #999; + border-top: 1px solid #999; + -moz-border-radius: 3px 0 0 0; + -webkit-border-top-left-radius: 3px; + -khtml-border-top-left-radius: 3px; + border-top-left-radius: 3px; +} + +.wp-admin .clearlooks2 .mceFocus .mceTop .mceRight { + background: #444444; + border-right: 1px solid #999; + border-top: 1px solid #999; + border-top-right-radius: 3px; + -khtml-border-top-right-radius: 3px; + -webkit-border-top-right-radius: 3px; + -moz-border-radius: 0 3px 0 0; +} + +.wp-admin .clearlooks2 .mceMiddle .mceLeft { + background: #f1f1f1; + border-left: 1px solid #999; +} + +.wp-admin .clearlooks2 .mceMiddle .mceRight { + background: #f1f1f1; + border-right: 1px solid #999; +} + +.wp-admin .clearlooks2 .mceBottom { + background: #f1f1f1; + border-bottom: 1px solid #999; +} + +.wp-admin .clearlooks2 .mceBottom .mceLeft { + background: #f1f1f1; + border-bottom: 1px solid #999; + border-left: 1px solid #999; +} + +.wp-admin .clearlooks2 .mceBottom .mceCenter { + background: #f1f1f1; + border-bottom: 1px solid #999; +} + +.wp-admin .clearlooks2 .mceBottom .mceRight { + background: #f1f1f1; + border-bottom: 1px solid #999; + border-right: 1px solid #999; +} + +.wp-admin .clearlooks2 .mceFocus .mceTop span { + color: #e5e5e5; +} +/* end TinyMCE */ + +#titlediv #title { + border-color: #bdccd5; +} + +#editorcontainer { + border-color: #bdccd5 #bdccd5 #d0dfe9; +} + +#post-status-info { + border-color: #d0dfe9 #bdccd5 #bdccd5; +} + +.editwidget .widget-inside { + border-color: #d0dfe9; +} + +#titlediv #title { + background-color: #fff; +} + +#tTips p#tTips_inside { + background-color: #ddd; + color: #333; +} + +#timestampdiv input, +#namediv input, +#poststuff .inside .the-tagcloud { + border-color: #ddd; +} + +/* menu */ +#adminmenuback, +#adminmenuwrap { + background-color: #EFF8FF; + border-color: #D1E5EE; +} + +#adminmenushadow, +#adminmenuback { + background-image: url(../images/menu-shadow.png); + background-position: top right; + background-repeat: repeat-y; +} + +#adminmenu li.wp-menu-separator { + background: #D1E5EE; + border-color: #bed1dd; +} + +#adminmenu div.separator { + border-color: #D1E5EE; +} + +#adminmenu li.wp-has-current-submenu.wp-menu-open .wp-menu-toggle, +#adminmenu li.wp-has-current-submenu:hover .wp-menu-toggle { + background: transparent url(../images/arrows-dark-vs.png) no-repeat -1px 6px; +} + +#adminmenu .wp-has-submenu:hover .wp-menu-toggle, +#adminmenu .wp-menu-open .wp-menu-toggle { + background: transparent url(../images/arrows-vs.png) no-repeat -2px 6px; +} + +#adminmenu a.menu-top, +.folded #adminmenu li.menu-top, +#adminmenu .wp-submenu .wp-submenu-head { + border-top-color: #ffffff; + border-bottom-color: #d1e5ee; +} + +#adminmenu li.wp-menu-open { + border-color: #d1e5ee; +} + +#adminmenu li.wp-has-current-submenu a.wp-has-current-submenu, +#adminmenu li.current a.menu-top, +.folded #adminmenu li.wp-has-current-submenu, +.folded #adminmenu li.current.menu-top, +#adminmenu .wp-menu-arrow, +#adminmenu .wp-has-current-submenu .wp-submenu .wp-submenu-head { + background-color: #5589AA; /* Fallback */ + background-image: -ms-linear-gradient(bottom, #5589AA, #5A8FAD); /* IE10 */ + background-image: -moz-linear-gradient(bottom, #5589AA, #5A8FAD); /* Firefox */ + background-image: -o-linear-gradient(bottom, #5589AA, #5A8FAD); /* Opera */ + background-image: -webkit-gradient(linear, left bottom, left top, from(#5589AA), to(#5A8FAD)); /* old Webkit */ + background-image: -webkit-linear-gradient(bottom, #5589AA, #5A8FAD); /* new Webkit */ + background-image: linear-gradient(bottom, #5589AA, #5A8FAD); /* proposed W3C Markup */ +} + +#adminmenu li.wp-has-current-submenu a.wp-has-current-submenu, +#adminmenu li.current a.menu-top, +#adminmenu .wp-has-current-submenu .wp-submenu .wp-submenu-head { + text-shadow: 0 -1px 0 #333; + color: #fff; + border-top-color: #5A8FAD; + border-bottom-color: #5589AA; +} + +.folded #adminmenu li.wp-has-current-submenu, +.folded #adminmenu li.current.menu-top { + border-top-color: #5A8FAD; + border-bottom-color: #5589AA; +} + +#adminmenu .wp-submenu a:hover { + background-color: #EAF2FA !important; + color: #333 !important; +} + +#adminmenu .wp-submenu li.current, +#adminmenu .wp-submenu li.current a, +#adminmenu .wp-submenu li.current a:hover { + color: #333; +} + +#adminmenu .wp-submenu ul { + background-color: #fff; +} + +.folded #adminmenu .wp-submenu-wrap, +.folded #adminmenu .wp-submenu ul { + border-color: #d0dfe9; +} + +.folded #adminmenu .wp-submenu-wrap { + -moz-box-shadow: 2px 2px 5px rgba( 0, 0, 0, 0.4 ); + -webkit-box-shadow: 2px 2px 5px rgba( 0, 0, 0, 0.4 ); + box-shadow: 2px 2px 5px rgba( 0, 0, 0, 0.4 ); +} + +#adminmenu .wp-submenu .wp-submenu-head { + border-right-color: #d0dfe9; + background-color: #EFF8FF; +} + +#adminmenu div.wp-submenu { + background-color: transparent; +} + +/* collapse menu button */ +#collapse-menu { + color: #A0C3D5; +} + +#collapse-menu:hover { + color: #5A8FAD; +} + +#collapse-button { + border-color: #d0dfe9; + background-color: #eff8ff; /* Fallback */ + background-image: -ms-linear-gradient(bottom, #eff8ff, #fff); /* IE10 */ + background-image: -moz-linear-gradient(bottom, #eff8ff, #fff); /* Firefox */ + background-image: -o-linear-gradient(bottom, #eff8ff, #fff); /* Opera */ + background-image: -webkit-gradient(linear, left bottom, left top, from(#eff8ff), to(#fff)); /* old Webkit */ + background-image: -webkit-linear-gradient(bottom, #eff8ff, #fff); /* new Webkit */ + background-image: linear-gradient(bottom, #eff8ff, #fff); /* proposed W3C Markup */ +} +#collapse-menu:hover #collapse-button { + border-color: #A0C3D5; +} +#collapse-button div { + background: transparent url(../images/arrows-vs.png) no-repeat 0 -72px; +} +.folded #collapse-button div { + background-position: 0 -108px; +} + +/* menu and screen icons */ +#adminmenu .menu-icon-dashboard div.wp-menu-image { + background: transparent url('../images/menu-vs.png?ver=20100531') no-repeat scroll -60px -33px; +} + +#adminmenu .menu-icon-dashboard:hover div.wp-menu-image, +#adminmenu .menu-icon-dashboard.wp-has-current-submenu div.wp-menu-image, +#adminmenu .menu-icon-dashboard.current div.wp-menu-image { + background: transparent url('../images/menu-vs.png?ver=20100531') no-repeat scroll -60px -1px; +} + +#adminmenu .menu-icon-post div.wp-menu-image { + background: transparent url('../images/menu-vs.png?ver=20100531') no-repeat scroll -271px -33px; +} + +#adminmenu .menu-icon-post:hover div.wp-menu-image, +#adminmenu .menu-icon-post.wp-has-current-submenu div.wp-menu-image { + background: transparent url('../images/menu-vs.png?ver=20100531') no-repeat scroll -271px -1px; +} + +#adminmenu .menu-icon-media div.wp-menu-image { + background: transparent url('../images/menu-vs.png?ver=20100531') no-repeat scroll -120px -33px; +} + +#adminmenu .menu-icon-media:hover div.wp-menu-image, +#adminmenu .menu-icon-media.wp-has-current-submenu div.wp-menu-image { + background: transparent url('../images/menu-vs.png?ver=20100531') no-repeat scroll -120px -1px; +} + +#adminmenu .menu-icon-links div.wp-menu-image { + background: transparent url('../images/menu-vs.png?ver=20100531') no-repeat scroll -90px -33px; +} + +#adminmenu .menu-icon-links:hover div.wp-menu-image, +#adminmenu .menu-icon-links.wp-has-current-submenu div.wp-menu-image { + background: transparent url('../images/menu-vs.png?ver=20100531') no-repeat scroll -90px -1px; +} + +#adminmenu .menu-icon-page div.wp-menu-image { + background: transparent url('../images/menu-vs.png?ver=20100531') no-repeat scroll -150px -33px; +} + +#adminmenu .menu-icon-page:hover div.wp-menu-image, +#adminmenu .menu-icon-page.wp-has-current-submenu div.wp-menu-image { + background: transparent url('../images/menu-vs.png?ver=20100531') no-repeat scroll -150px -1px; +} + +#adminmenu .menu-icon-comments div.wp-menu-image { + background: transparent url('../images/menu-vs.png?ver=20100531') no-repeat scroll -30px -33px; +} + +#adminmenu .menu-icon-comments:hover div.wp-menu-image, +#adminmenu .menu-icon-comments.wp-has-current-submenu div.wp-menu-image, +#adminmenu .menu-icon-comments.current div.wp-menu-image { + background: transparent url('../images/menu-vs.png?ver=20100531') no-repeat scroll -30px -1px; +} + +#adminmenu .menu-icon-appearance div.wp-menu-image { + background: transparent url('../images/menu-vs.png?ver=20100531') no-repeat scroll 0 -33px; +} + +#adminmenu .menu-icon-appearance:hover div.wp-menu-image, +#adminmenu .menu-icon-appearance.wp-has-current-submenu div.wp-menu-image { + background: transparent url('../images/menu-vs.png?ver=20100531') no-repeat scroll 0 -1px; +} + +#adminmenu .menu-icon-plugins div.wp-menu-image { + background: transparent url('../images/menu-vs.png?ver=20100531') no-repeat scroll -180px -33px; +} + +#adminmenu .menu-icon-plugins:hover div.wp-menu-image, +#adminmenu .menu-icon-plugins.wp-has-current-submenu div.wp-menu-image { + background: transparent url('../images/menu-vs.png?ver=20100531') no-repeat scroll -180px -1px; +} + +#adminmenu .menu-icon-users div.wp-menu-image { + background: transparent url('../images/menu-vs.png?ver=20100531') no-repeat scroll -300px -33px; +} + +#adminmenu .menu-icon-users:hover div.wp-menu-image, +#adminmenu .menu-icon-users.wp-has-current-submenu div.wp-menu-image, +#adminmenu .menu-icon-users.current div.wp-menu-image { + background: transparent url('../images/menu-vs.png?ver=20100531') no-repeat scroll -300px -1px; +} + +#adminmenu .menu-icon-tools div.wp-menu-image { + background: transparent url('../images/menu-vs.png?ver=20100531') no-repeat scroll -210px -33px; +} + +#adminmenu .menu-icon-tools:hover div.wp-menu-image, +#adminmenu .menu-icon-tools.wp-has-current-submenu div.wp-menu-image, +#adminmenu .menu-icon-tools.current div.wp-menu-image { + background: transparent url('../images/menu-vs.png?ver=20100531') no-repeat scroll -210px -1px; +} + +#icon-options-general, +#adminmenu .menu-icon-settings div.wp-menu-image { + background: transparent url('../images/menu-vs.png?ver=20100531') no-repeat scroll -240px -33px; +} + +#adminmenu .menu-icon-settings:hover div.wp-menu-image, +#adminmenu .menu-icon-settings.wp-has-current-submenu div.wp-menu-image { + background: transparent url('../images/menu-vs.png?ver=20100531') no-repeat scroll -240px -1px; +} + +#adminmenu .menu-icon-site div.wp-menu-image { + background: transparent url('../images/menu-vs.png?ver=20100531') no-repeat scroll -360px -33px; +} + +#adminmenu .menu-icon-site:hover div.wp-menu-image, +#adminmenu .menu-icon-site.wp-has-current-submenu div.wp-menu-image { + background: transparent url('../images/menu-vs.png?ver=20100531') no-repeat scroll -360px -1px; +} +/* end menu and screen icons */ + +/* Screen Icons */ +#icon-edit, +#icon-post { + background: transparent url(../images/icons32-vs.png?ver=20100531) no-repeat -552px -5px; +} + +#icon-index { + background: transparent url(../images/icons32-vs.png?ver=20100531) no-repeat -137px -5px; +} + +#icon-upload { + background: transparent url(../images/icons32-vs.png?ver=20100531) no-repeat -251px -5px; +} + +#icon-link-manager, +#icon-link, +#icon-link-category { + background: transparent url(../images/icons32-vs.png?ver=20100531) no-repeat -190px -5px; +} + +#icon-edit-pages, +#icon-page { + background: transparent url(../images/icons32-vs.png?ver=20100531) no-repeat -312px -5px; +} + +#icon-edit-comments { + background: transparent url(../images/icons32-vs.png?ver=20100531) no-repeat -72px -5px; +} + +#icon-themes { + background: transparent url(../images/icons32-vs.png?ver=20100531) no-repeat -11px -5px; +} + +#icon-plugins { + background: transparent url(../images/icons32-vs.png?ver=20100531) no-repeat -370px -5px; +} + +#icon-users, +#icon-profile, +#icon-user-edit { + background: transparent url(../images/icons32-vs.png?ver=20100531) no-repeat -600px -5px; +} + +#icon-tools, +#icon-admin { + background: transparent url(../images/icons32-vs.png?ver=20100531) no-repeat -432px -5px; +} + +#icon-options-general { + background: transparent url(../images/icons32-vs.png?ver=20100531) no-repeat -492px -5px; +} + +#icon-ms-admin { + background: transparent url(../images/icons32-vs.png?ver=20100531) no-repeat -659px -5px; +} +/* end screen icons */ + + +/* Diff */ +table.diff .diff-deletedline { + background-color: #fdd; +} + +table.diff .diff-deletedline del { + background-color: #f99; +} + +table.diff .diff-addedline { + background-color: #dfd; +} + +table.diff .diff-addedline ins { + background-color: #9f9; +} + +#att-info { + background-color: #E4F2FD; +} + +/* edit image */ +#sidemenu a { + background-color: #f9f9f9; + border-color: #f9f9f9; + border-bottom-color: #dfdfdf; +} + +#sidemenu a.current { + background-color: #fff; + border-color: #dfdfdf #dfdfdf #fff; + color: #D54E21; +} + +#screen-options-wrap, +#contextual-help-wrap { + background-color: #f7fcfe; + border-color: #D1e5ee; +} + +#screen-options-link-wrap, +#contextual-help-link-wrap { + background-color: #eff8ff; /* Fallback */ + border-right: 1px solid #D1E5EE; + border-left: 1px solid #D1E5EE; + border-bottom: 1px solid #D1E5EE; + background-image: -ms-linear-gradient(bottom, #eff8ff, #fff); /* IE10 */ + background-image: -moz-linear-gradient(bottom, #eff8ff, #fff); /* Firefox */ + background-image: -o-linear-gradient(bottom, #eff8ff, #fff); /* Opera */ + background-image: -webkit-gradient(linear, left bottom, left top, from(#eff8ff), to(#fff)); /* old Webkit */ + background-image: -webkit-linear-gradient(bottom, #eff8ff, #fff); /* new Webkit */ + background-image: linear-gradient(bottom, #eff8ff, #fff); /* proposed W3C Markup */ +} + +#screen-meta-links a.show-settings { + color: #606060; +} + +#screen-meta-links a.show-settings:hover { + color: #000; +} + +#replysubmit { + background-color: #f1f1f1; + border-top-color: #ddd; +} + +#replyerror { + border-color: #ddd; + background-color: #f9f9f9; +} + +#edithead, +#replyhead { + background-color: #f1f1f1; +} + +#ed_reply_toolbar { + background-color: #e9e9e9; +} + +/* table vim shortcuts */ +.vim-current, +.vim-current th, +.vim-current td { + background-color: #E4F2FD !important; +} + +/* Install Plugins */ +.star-average, +.star.star-rating { + background-color: #fc0; +} + +div.star.select:hover { + background-color: #d00; +} + +div.star img { + border-left: 1px solid #fff; + border-right: 1px solid #fff; +} + +#plugin-information .fyi ul { + background-color: #eaf3fa; +} + +#plugin-information .fyi h2.mainheader { + background-color: #cee1ef; +} + +#plugin-information pre, +#plugin-information code { + background-color: #ededff; +} + +#plugin-information pre { + border: 1px solid #ccc; +} + +/* inline editor */ +.inline-edit-row fieldset input[type="text"], +.inline-edit-row fieldset textarea, +#bulk-titles, +#replyrow input { + border-color: #ddd; +} + +.inline-editor div.title { + background-color: #EAF3FA; +} + +.inline-editor ul.cat-checklist { + background-color: #fff; + border-color: #ddd; +} + +.inline-editor .categories .catshow, +.inline-editor .categories .cathide { + color: #21759b; +} + +.inline-editor .quick-edit-save { + background-color: #f1f1f1; +} + +#replyrow #ed_reply_toolbar input:hover { + border-color: #aaa; + background: #ddd; +} + +fieldset.inline-edit-col-right .inline-edit-col { + border-color: #dfdfdf; +} + +.attention { + color: #D54E21; +} + +.meta-box-sortables .postbox:hover .handlediv { + background: transparent url(../images/arrows-vs.png) no-repeat 6px 7px; +} + +.tablenav .tablenav-pages { + color: #555; +} + +.tablenav .tablenav-pages a { + border-color: #d1e5ee; + background: #eee url('../images/menu-bits-vs.gif?ver=20101102') repeat-x scroll left -379px; +} + +.tablenav .tablenav-pages a:hover, +.tablenav .tablenav-pages a:focus { + color: #d54e21; +} + +.tablenav .tablenav-pages a.disabled, +.tablenav .tablenav-pages a.disabled:hover, +.tablenav .tablenav-pages a.disabled:focus { + color: #aaa; +} + +.tablenav .tablenav-pages .current { + background: #dfdfdf; + border-color: #d3d3d3; +} + +#availablethemes, +#availablethemes td { + border-color: #ddd; +} + +#current-theme img { + border-color: #999; +} + +#TB_window #TB_title a.tb-theme-preview-link, +#TB_window #TB_title a.tb-theme-preview-link:visited { + color: #999; +} + +#TB_window #TB_title a.tb-theme-preview-link:hover, +#TB_window #TB_title a.tb-theme-preview-link:focus { + color: #ccc; +} + +.misc-pub-section { + border-top-color: #fff; + border-bottom-color: #eee; +} + +#minor-publishing { + border-bottom-color: #ddd; +} + +#post-body .misc-pub-section { + border-right-color: #eee; +} + +.post-com-count span { + background-color: #bbb; +} + +.form-table .color-palette td { + border-color: #fff; +} + +.sortable-placeholder { + border-color: #bbb; + background-color: #f5f5f5; +} + +#post-body ul.category-tabs li.tabs a, +#post-body ul.add-menu-item-tabs li.tabs a, +body.press-this ul.category-tabs li.tabs a { + color: #333; +} + +#wp_editimgbtn, +#wp_delimgbtn, +#wp_editgallery, +#wp_delgallery { + border-color: #999; + background-color: #eee; +} + +#wp_editimgbtn:hover, +#wp_delimgbtn:hover, +#wp_editgallery:hover, +#wp_delgallery:hover { + border-color: #555; + background-color: #ccc; +} + +#favorite-first { + border-color: #c0c0c0; + background: #f1f1f1; /* fallback color */ + background:-moz-linear-gradient(bottom, #e7e7e7, #fff); + background:-webkit-gradient(linear, left bottom, left top, from(#e7e7e7), to(#fff)); +} + +#favorite-inside { + border-color: #c0c0c0; + background-color: #fff; +} + +#favorite-toggle { + background: transparent url(../images/fav-arrow.gif?ver=20100531) no-repeat 0 -4px; + border-color: #d0dfe9; + -moz-box-shadow: inset 1px 0 0 #fff; + -webkit-box-shadow: inset 1px 0 0 #fff; + box-shadow: inset 1px 0 0 #fff; +} + +#favorite-actions a { + color: #464646; +} + +#favorite-actions a:hover { + color: #000; +} + +#favorite-inside a:hover { + text-decoration: underline; +} + +#screen-meta a.show-settings, +.toggle-arrow { + background: transparent url(../images/arrows-vs.png) no-repeat right 3px; +} + +#screen-meta .screen-meta-active a.show-settings { + background: transparent url(../images/arrows-vs.png) no-repeat right -33px; +} + +.view-switch #view-switch-list { + background: transparent url(../images/list.png) no-repeat 0 0; +} + +.view-switch .current #view-switch-list { + background: transparent url(../images/list.png) no-repeat -40px 0; +} + +.view-switch #view-switch-excerpt { + background: transparent url(../images/list.png) no-repeat -20px 0; +} + +.view-switch .current #view-switch-excerpt { + background: transparent url(../images/list.png) no-repeat -60px 0; +} + +#header-logo { + background: transparent url(../images/wp-logo-vs.png?ver=20101102) no-repeat scroll center center; +} + +.popular-tags, +.feature-filter { + background-color: #fff; + border-color: #DFDFDF; +} + +#theme-information .action-button { + border-top-color: #DFDFDF; +} + +.theme-listing br.line { + border-bottom-color: #ccc; +} + +div.widgets-sortables, +#widgets-left .inactive { + background-color: #f7fcfe; + border-color: #d0dfe9; +} + +#available-widgets .widget-holder { + background-color: #f7fcfe; + border-color: #d0dfe9; +} + +#available-widgets .widget-description { + color: #555; +} + +.sidebar-name { + color: #464646; + background-color: #f7fcfe; /* Fallback */ + background-image: -ms-linear-gradient(top, #ECF8FE, #f7fcfe); /* IE10 */ + background-image: -moz-linear-gradient(top, #ECF8FE, #f7fcfe); /* Firefox */ + background-image: -o-linear-gradient(top, #ECF8FE, #f7fcfe); /* Opera */ + background-image: -webkit-gradient(linear, left top, left bottom, from(#ECF8FE), to(#f7fcfe)); /* old Webkit */ + background-image: -webkit-linear-gradient(top, #ECF8FE, #f7fcfe); /* new Webkit */ + background-image: linear-gradient(top, #ECF8FE, #f7fcfe); /* proposed W3C Markup */ + text-shadow: #fff 0 1px 0; + border-color: #d0dfe9; + -moz-box-shadow: inset 0 1px 0 #fff; + -webkit-box-shadow: inset 0 1px 0 #fff; + box-shadow: inset 0 1px 0 #fff; +} + +.sidebar-name:hover, +#removing-widget { + color: #d54e21; +} + +#removing-widget span { + color: black; +} + +.sidebar-name-arrow { + background: transparent url(../images/arrows-vs.png) no-repeat 5px 9px; +} + +.sidebar-name:hover .sidebar-name-arrow { + background: transparent url(../images/arrows-dark-vs.png) no-repeat 5px 9px; +} + +.in-widget-title { + color: #606060; +} + +.deleting .widget-title * { + color: #aaa; +} + +.imgedit-menu div { + border-color: #d5d5d5; + background-color: #f1f1f1; +} + +.imgedit-menu div:hover { + border-color: #c1c1c1; + background-color: #eaeaea; +} + +.imgedit-menu div.disabled { + border-color: #ccc; + background-color: #ddd; + filter: alpha(opacity=50); + opacity: 0.5; +} + +#dashboard_recent_comments div.undo { + border-top-color: #dfdfdf; +} + +.comment-ays, +.comment-ays th { + border-color: #ddd; +} + +.comment-ays th { + background-color: #f1f1f1; +} + +/* added from nav-menu.css */ +#menu-management .menu-edit { + border-color: #d0dfe9; +} + +#post-body { + background: #ffffff; + border-top-color: #fff; + border-bottom-color: #d0dfe9; +} + +#nav-menu-header { + border-bottom-color: #d0dfe9; +} + +#nav-menu-footer { + border-top-color: #fff; +} + +#menu-management .nav-tabs-arrow a { + color: #C1C1C1; +} + +#menu-management .nav-tabs-arrow a:hover { + color: #D54E21; +} + +#menu-management .nav-tabs-arrow a:active { + color: #464646; +} + +#menu-management .nav-tab-active { + border-color: #dfdfdf; +} + +#menu-management .nav-tab { + background: #f7fcfe; + border-color: #d0dfe9; +} + +.js .input-with-default-title { + color: #aaa; +} + +#cancel-save { + color: #ff0000; +} + +#cancel-save:hover { + background-color: #FF0000; + color: #fff; +} + +.list-container { + border-color: #dfdfdf; +} + +.menu-item-handle { + border-color: #d0dfe9; +} + +.menu li.deleting .menu-item-handle { + background-color: #f66; + text-shadow: #ccc; +} + +.item-type { /* Menu item controls */ + color: #999999; +} + +.item-controls .menu-item-delete:hover { + color: #ff0000; +} + +.item-edit { + background: transparent url(../images/arrows-vs.png) no-repeat 8px 10px; + border-bottom-color: #eee; +} + +.item-edit:hover { + background: transparent url(../images/arrows-dark-vs.png) no-repeat 8px 10px; +} + +.menu-item-settings { /* Menu editing */ + border-color: #d0dfe9; +} + +.link-to-original { + color: #777; + border-color: #d0dfe9; +} + +#cancel-save:hover { + color: #fff !important; +} + +#update-menu-item { + color: #fff !important; +} + +#update-menu-item:hover, +#update-menu-item:active, +#update-menu-item:focus { + color: #eaf2fa !important; + border-color: #13455b !important; +} + +.submitbox .submitcancel { + color: #21759B; + border-bottom-color: #21759B; +} + +.submitbox .submitcancel:hover { + background: #21759B; + color: #fff; +} +/* end added from nav-menu.css */ + +#menu-management .nav-tab-active, +.menu-item-handle, +.menu-item-settings { + -moz-box-shadow: inset 0 1px 0 #fff; + -webkit-box-shadow: inset 0 1px 0 #fff; + box-shadow: inset 0 1px 0 #fff; +} + +#menu-management .nav-tab-active { + background: #eff8ff; + border-bottom-color: #eff8ff; +} + +/* custom header & background pages */ +#upload-form label { + color: #777; +} +/* custom header & background pages */ + +/* full screen */ +.fullscreen-overlay { + background: #fff; +} + +.wp-fullscreen-focus #wp-fullscreen-title, +.wp-fullscreen-focus #wp-fullscreen-container { + border-color: #BED1DD; +} + +#fullscreen-topbar { + border-bottom-color: #D1E5EE; +} diff --git a/src/wp-admin/css/colors-fresh-rtl.css b/src/wp-admin/css/colors-fresh-rtl.css new file mode 100644 index 0000000..bd5b114 --- /dev/null +++ b/src/wp-admin/css/colors-fresh-rtl.css @@ -0,0 +1 @@ +.bar{border-right-color:none;border-left-color:#99d;}.post-com-count{background-image:url(../images/bubble_bg-rtl.gif);}#user_info_arrow{background:transparent url(../images/arrows.png) no-repeat 0 5px;}#user_info:hover #user_info_arrow,#user_info.active #user_info_arrow{background:transparent url(../images/arrows-dark.png) no-repeat 0 5px;}#adminmenushadow,#adminmenuback{background-image:url(../images/menu-shadow-rtl.png);background-position:top left;}#adminmenu li.wp-has-current-submenu.wp-menu-open .wp-menu-toggle,#adminmenu li.wp-has-current-submenu:hover .wp-menu-toggle{background:transparent url(../images/arrows-dark.png) no-repeat 8px 6px;}#adminmenu .wp-has-submenu:hover .wp-menu-toggle,#adminmenu .wp-menu-open .wp-menu-toggle{background:transparent url(../images/arrows.png) no-repeat 8px 6px;}#adminmenu .wp-submenu .wp-submenu-head{border-right-color:none;border-left-color:#dfdfdf;}.folded #adminmenu .wp-submenu-wrap{-moz-box-shadow:-2px 2px 5px rgba(0,0,0,0.4);-webkit-box-shadow:-2px 2px 5px rgba(0,0,0,0.4);box-shadow:-2px 2px 5px rgba(0,0,0,0.4);}#collapse-button div{background-position:0 -108px;}.folded #collapse-button div{background-position:0 -72px;}.meta-box-sortables .postbox:hover .handlediv{background:transparent url(../images/arrows.png) no-repeat 6px 7px;}.tablenav .tablenav-pages a{border-color:#e3e3e3;background:#eee url('../images/menu-bits-rtl.gif?ver=20100610') repeat-x scroll right -379px;}#post-body .misc-pub-section{border-right-color:none;border-left-color:#eee;}#favorite-toggle{background:transparent url(../images/arrows.png) no-repeat 4px 2px;}#screen-meta a.show-settings,.toggle-arrow{background:transparent url(../images/arrows.png) no-repeat left 3px;}#screen-meta .screen-meta-active a.show-settings{background:transparent url(../images/arrows.png) no-repeat left -33px;}.sidebar-name-arrow{background:transparent url(../images/arrows.png) no-repeat 5px 9px;}.sidebar-name:hover .sidebar-name-arrow{background:transparent url(../images/arrows-dark.png) no-repeat 5px 9px;} \ No newline at end of file diff --git a/src/wp-admin/css/colors-fresh-rtl.dev.css b/src/wp-admin/css/colors-fresh-rtl.dev.css new file mode 100644 index 0000000..58ffe59 --- /dev/null +++ b/src/wp-admin/css/colors-fresh-rtl.dev.css @@ -0,0 +1,98 @@ +.bar { + border-right-color: none; + border-left-color: #99d; +} + +.post-com-count { + background-image: url(../images/bubble_bg-rtl.gif); +} + +#user_info_arrow { + background: transparent url(../images/arrows.png) no-repeat 0 5px; +} + +#user_info:hover #user_info_arrow, +#user_info.active #user_info_arrow { + background: transparent url(../images/arrows-dark.png) no-repeat 0 5px; +} + +/* editors */ + +/* menu */ + +#adminmenushadow, +#adminmenuback { + background-image: url(../images/menu-shadow-rtl.png); + background-position: top left; +} + +#adminmenu li.wp-has-current-submenu.wp-menu-open .wp-menu-toggle, +#adminmenu li.wp-has-current-submenu:hover .wp-menu-toggle { + background: transparent url(../images/arrows-dark.png) no-repeat 8px 6px; +} + +#adminmenu .wp-has-submenu:hover .wp-menu-toggle, +#adminmenu .wp-menu-open .wp-menu-toggle { + background: transparent url(../images/arrows.png) no-repeat 8px 6px; +} + + +#adminmenu .wp-submenu .wp-submenu-head { + border-right-color: none; + border-left-color: #dfdfdf; +} + +.folded #adminmenu .wp-submenu-wrap { + -moz-box-shadow: -2px 2px 5px rgba( 0, 0, 0, 0.4 ); + -webkit-box-shadow: -2px 2px 5px rgba( 0, 0, 0, 0.4 ); + box-shadow: -2px 2px 5px rgba( 0, 0, 0, 0.4 ); +} + +/* collapse menu button */ +#collapse-button div { + background-position: 0 -108px; +} +.folded #collapse-button div { + background-position: 0 -72px; +} + +/* edit image */ + +.meta-box-sortables .postbox:hover .handlediv { + background: transparent url(../images/arrows.png) no-repeat 6px 7px; +} + +.tablenav .tablenav-pages a { + border-color: #e3e3e3; + background: #eee url('../images/menu-bits-rtl.gif?ver=20100610') repeat-x scroll right -379px; +} + +#post-body .misc-pub-section { + border-right-color: none; + border-left-color: #eee; +} + +#favorite-toggle { + background: transparent url(../images/arrows.png) no-repeat 4px 2px; +} + +#screen-meta a.show-settings, +.toggle-arrow { + background: transparent url(../images/arrows.png) no-repeat left 3px; +} + +#screen-meta .screen-meta-active a.show-settings { + background: transparent url(../images/arrows.png) no-repeat left -33px; +} + +.sidebar-name-arrow { + background: transparent url(../images/arrows.png) no-repeat 5px 9px; +} +.sidebar-name:hover .sidebar-name-arrow { + background: transparent url(../images/arrows-dark.png) no-repeat 5px 9px; +} + + +/* custom header & background pages */ + +/* custom header & background pages */ diff --git a/src/wp-admin/css/colors-fresh.css b/src/wp-admin/css/colors-fresh.css new file mode 100644 index 0000000..760faee --- /dev/null +++ b/src/wp-admin/css/colors-fresh.css @@ -0,0 +1 @@ +html,.wp-dialog{background-color:#fff;}* html input,* html .widget{border-color:#dfdfdf;}textarea,input[type="text"],input[type="password"],input[type="file"],input[type="button"],input[type="submit"],input[type="reset"],select{border-color:#dfdfdf;background-color:#fff;}kbd,code{background:#eaeaea;}input[readonly]{background-color:#eee;}.find-box-search{border-color:#dfdfdf;background-color:#f1f1f1;}.find-box{background-color:#f1f1f1;}.find-box-inside{background-color:#fff;}a.page-numbers:hover{border-color:#999;}body,#wpbody,.form-table .pre{color:#333;}body>#upload-menu{border-bottom-color:#fff;}#postcustomstuff table,#your-profile fieldset,#rightnow,div.dashboard-widget,#dashboard-widgets p.dashboard-widget-links,#replyrow #ed_reply_toolbar input{border-color:#ccc;}#poststuff .inside label.spam,#poststuff .inside label.deleted{color:red;}#poststuff .inside label.waiting{color:orange;}#poststuff .inside label.approved{color:green;}#postcustomstuff table{border-color:#dfdfdf;background-color:#F9F9F9;}#postcustomstuff thead th{background-color:#F1F1F1;}#postcustomstuff table input,#postcustomstuff table textarea{border-color:#dfdfdf;background-color:#fff;}.widefat{border-color:#dfdfdf;background-color:#f9f9f9;}div.dashboard-widget-error{background-color:#c43;}div.dashboard-widget-notice{background-color:#cfe1ef;}div.dashboard-widget-submit{border-top-color:#ccc;}div.tabs-panel,.wp-tab-panel,ul.category-tabs li.tabs,ul.add-menu-item-tabs li.tabs,.wp-tab-active{border-color:#dfdfdf;background-color:#fff;}ul.category-tabs li.tabs,ul.add-menu-item-tabs li.tabs,.wp-tab-active{background-color:#fff;}input.disabled,textarea.disabled{background-color:#ccc;}#plugin-information .action-button a,#plugin-information .action-button a:hover,#plugin-information .action-button a:visited{color:#fff;}.widget .widget-top,.postbox h3,.stuffbox h3,.widefat thead tr th,.widefat tfoot tr th,h3.dashboard-widget-title,h3.dashboard-widget-title span,h3.dashboard-widget-title small,.find-box-head,.sidebar-name,#nav-menu-header,#nav-menu-footer,.menu-item-handle,#fullscreen-topbar{background-color:#f1f1f1;background-image:-ms-linear-gradient(top,#f9f9f9,#ececec);background-image:-moz-linear-gradient(top,#f9f9f9,#ececec);background-image:-o-linear-gradient(top,#f9f9f9,#ececec);background-image:-webkit-gradient(linear,left top,left bottom,from(#f9f9f9),to(#ececec));background-image:-webkit-linear-gradient(top,#f9f9f9,#ececec);background-image:linear-gradient(top,#f9f9f9,#ececec);}.widget .widget-top,.postbox h3,.stuffbox h3{border-bottom-color:#dfdfdf;text-shadow:#fff 0 1px 0;-moz-box-shadow:0 1px 0 #fff;-webkit-box-shadow:0 1px 0 #fff;box-shadow:0 1px 0 #fff;}.form-table th,.form-wrap label{color:#222;text-shadow:#fff 0 1px 0;}.description,.form-wrap p{color:#666;}strong .post-com-count span{background-color:#21759b;}.sorthelper{background-color:#ccf3fa;}.ac_match,.subsubsub a.current{color:#000;}.wrap h2{color:#464646;}.wrap .add-new-h2{background:#f1f1f1;}.subtitle{color:#777;}.ac_over{background-color:#f0f0b8;}.ac_results{background-color:#fff;border-color:#808080;}.ac_results li{color:#101010;}.alternate,.alt{background-color:#fcfcfc;}.available-theme a.screenshot{background-color:#f1f1f1;border-color:#ddd;}.bar{background-color:#e8e8e8;border-right-color:#99d;}#media-upload,#media-upload .media-item .slidetoggle{background:#fff;}#media-upload .slidetoggle{border-top-color:#dfdfdf;}div.error,.login #login_error{background-color:#ffebe8;border-color:#c00;}div.error a{color:#c00;}.form-invalid{background-color:#ffebe8!important;}.form-invalid input,.form-invalid select{border-color:#c00!important;}.submit{border-color:#DFDFDF;}.highlight{background-color:#e4f2fd;color:#000;}.howto,.nonessential,#edit-slug-box,.form-input-tip,.subsubsub{color:#666;}.media-item{border-bottom-color:#dfdfdf;}#wpbody-content #media-items .describe{border-top-color:#dfdfdf;}.media-upload-form label.form-help,td.help{color:#9a9a9a;}.post-com-count{background-image:url(../images/bubble_bg.gif);color:#fff;}.post-com-count span{background-color:#bbb;color:#fff;}.post-com-count:hover span{background-color:#d54e21;}.quicktags,.search{background-color:#ccc;color:#000;}.side-info h5{border-bottom-color:#dadada;}.side-info ul{color:#666;}.button,.button-secondary,.submit input,input[type=button],input[type=submit]{border-color:#bbb;color:#464646;}.button:hover,.button-secondary:hover,.submit input:hover,input[type=button]:hover,input[type=submit]:hover{color:#000;border-color:#666;}.button,.submit input,.button-secondary{background:#f2f2f2 url(../images/white-grad.png) repeat-x scroll left top;text-shadow:rgba(255,255,255,1) 0 1px 0;}.button:active,.submit input:active,.button-secondary:active{background:#eee url(../images/white-grad-active.png) repeat-x scroll left top;}input.button-primary,button.button-primary,a.button-primary{border-color:#298cba;font-weight:bold;color:#fff;background:#21759B url(../images/button-grad.png) repeat-x scroll left top;text-shadow:rgba(0,0,0,0.3) 0 -1px 0;}input.button-primary:active,button.button-primary:active,a.button-primary:active{background:#21759b url(../images/button-grad-active.png) repeat-x scroll left top;color:#eaf2fa;}input.button-primary:hover,button.button-primary:hover,a.button-primary:hover,a.button-primary:focus,a.button-primary:active{border-color:#13455b;color:#eaf2fa;}.button-disabled,.button[disabled],.button:disabled,.button-secondary[disabled],.button-secondary:disabled,a.button.disabled{color:#aaa!important;border-color:#ddd!important;}.button-primary-disabled,.button-primary[disabled],.button-primary:disabled{color:#9FD0D5!important;background:#298CBA!important;}a:hover,a:active,a:focus{color:#d54e21;}#wphead #viewsite a:hover,#adminmenu a:hover,#adminmenu ul.wp-submenu a:hover,#the-comment-list .comment a:hover,#rightnow a:hover,#media-upload a.del-link:hover,div.dashboard-widget-submit input:hover,.subsubsub a:hover,.subsubsub a.current:hover,.ui-tabs-nav a:hover,.plugins .inactive a:hover,#all-plugins-table .plugins .inactive a:hover,#search-plugins-table .plugins .inactive a:hover{color:#d54e21;}#the-comment-list .comment-item,#dashboard-widgets #dashboard_quick_press form p.submit{border-color:#dfdfdf;}#side-sortables .category-tabs .tabs a,#side-sortables .add-menu-item-tabs .tabs a,.wp-tab-bar .wp-tab-active a{color:#333;}#rightnow .rbutton{background-color:#ebebeb;color:#264761;}.submitbox .submit{background-color:#464646;color:#ccc;}.plugins a.delete:hover,#all-plugins-table .plugins a.delete:hover,#search-plugins-table .plugins a.delete:hover,.submitbox .submitdelete{color:#f00;border-bottom-color:#f00;}.submitbox .submitdelete:hover,#media-items a.delete:hover{color:#fff;background-color:#f00;border-bottom-color:#f00;}#normal-sortables .submitbox .submitdelete:hover{color:#000;background-color:#f00;border-bottom-color:#f00;}.tablenav .dots{border-color:transparent;}.tablenav .next,.tablenav .prev{border-color:transparent;color:#21759b;}.tablenav .next:hover,.tablenav .prev:hover{border-color:transparent;color:#d54e21;}div.updated,.login .message{background-color:#ffffe0;border-color:#e6db55;}.update-message{color:#000;}a.page-numbers{border-bottom-color:#B8D3E2;}.commentlist li{border-bottom-color:#ccc;}.widefat td,.widefat th{border-top-color:#fff;border-bottom-color:#dfdfdf;}.widefat th{text-shadow:rgba(255,255,255,0.8) 0 1px 0;}.widefat td{color:#555;}.widefat p,.widefat ol,.widefat ul{color:#333;}.widefat thead tr th,.widefat tfoot tr th,h3.dashboard-widget-title,h3.dashboard-widget-title span,h3.dashboard-widget-title small,.find-box-head{color:#333;}th.sortable a:hover,th.sortable a:active,th.sortable a:focus{color:#333;}h3.dashboard-widget-title small a{color:#d7d7d7;}h3.dashboard-widget-title small a:hover{color:#fff;}a,#adminmenu a,#poststuff #edButtonPreview,#poststuff #edButtonHTML,#the-comment-list p.comment-author strong a,#media-upload a.del-link,#media-items a.delete,.plugins a.delete,.ui-tabs-nav a{color:#21759b;}#adminmenu .awaiting-mod,#adminmenu .update-plugins,#sidemenu a .update-plugins,#rightnow .reallynow{background-color:#464646;color:#fff;-moz-box-shadow:rgba(255,255,255,0.5) 0 1px 0;-khtml-box-shadow:rgba(255,255,255,0.5) 0 1px 0;-webkit-box-shadow:rgba(255,255,255,0.5) 0 1px 0;box-shadow:rgba(255,255,255,0.5) 0 1px 0;}#plugin-information .action-button{background-color:#d54e21;color:#fff;}#adminmenu li.current a .awaiting-mod,#adminmenu li a.wp-has-current-submenu .update-plugins{background-color:#464646;color:#fff;-moz-box-shadow:rgba(255,255,255,0.5) 0 1px 0;-khtml-box-shadow:rgba(255,255,255,0.5) 0 1px 0;-webkit-box-shadow:rgba(255,255,255,0.5) 0 1px 0;box-shadow:rgba(255,255,255,0.5) 0 1px 0;}div#media-upload-header,div#plugin-information-header{background-color:#f9f9f9;border-bottom-color:#dfdfdf;}#currenttheme img{border-color:#666;}#dashboard_secondary div.dashboard-widget-content ul li a{background-color:#f9f9f9;}input.readonly,textarea.readonly{background-color:#ddd;}#ed_toolbar input,#ed_reply_toolbar input{background:#fff url("../images/fade-butt.png") repeat-x 0 -2px;}#editable-post-name{background-color:#fffbcc;}#edit-slug-box strong,.tablenav .displaying-num,#submitted-on,.submitted-on{color:#777;}.login #nav a,.login #backtoblog a{color:#21759b!important;}.login #nav a:hover,.login #backtoblog a:hover{color:#d54e21!important;}#footer{color:#777;border-color:#dfdfdf;}#media-items,.imgedit-group{border-color:#dfdfdf;}.checkbox,.side-info,.plugins tr,#your-profile #rich_editing{background-color:#fcfcfc;}.plugins .inactive,.plugins .inactive th,.plugins .inactive td,tr.inactive+tr.plugin-update-tr .plugin-update{background-color:#f4f4f4;}.plugin-update-tr .update-message{background-color:#fffbe4;border-color:#dfdfdf;}.plugins .active,.plugins .active th,.plugins .active td{color:#000;}.plugins .inactive a{color:#579;}#the-comment-list tr.undo,#the-comment-list div.undo{background-color:#f4f4f4;}#the-comment-list .unapproved{background-color:#ffffe0;}#the-comment-list .approve a{color:#006505;}#the-comment-list .unapprove a{color:#d98500;}table.widefat span.delete a,table.widefat span.trash a,table.widefat span.spam a,#dashboard_recent_comments .delete a,#dashboard_recent_comments .trash a,#dashboard_recent_comments .spam a{color:#bc0b0b;}.widget,#widget-list .widget-top,.postbox,#titlediv,#poststuff .postarea,.stuffbox{border-color:#dfdfdf;-moz-box-shadow:inset 0 1px 0 #fff;-webkit-box-shadow:inset 0 1px 0 #fff;box-shadow:inset 0 1px 0 #fff;-moz-border-radius:3px;-khtml-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;}.widget,#widget-list .widget-top,.postbox,.menu-item-settings{background-color:#f5f5f5;background-image:-ms-linear-gradient(top,#f9f9f9,#f5f5f5);background-image:-moz-linear-gradient(top,#f9f9f9,#f5f5f5);background-image:-o-linear-gradient(top,#f9f9f9,#f5f5f5);background-image:-webkit-gradient(linear,left top,left bottom,from(#f9f9f9),to(#f5f5f5));background-image:-webkit-linear-gradient(top,#f9f9f9,#f5f5f5);background-image:linear-gradient(top,#f9f9f9,#f5f5f5);}.postbox h3{color:#464646;}.widget .widget-top{color:#222;}.sidebar-name:hover h3,.postbox h3:hover{color:#000;}.curtime #timestamp{background-image:url(../images/date-button.gif);}#quicktags #ed_link{color:#00f;}#rightnow .youhave{background-color:#f0f6fb;}#rightnow a{color:#448abd;}.tagchecklist span a,#bulk-titles div a{background:url(../images/xit.gif) no-repeat;}.tagchecklist span a:hover,#bulk-titles div a:hover{background:url(../images/xit.gif) no-repeat -10px 0;}#update-nag,.update-nag{background-color:#FFFBCC;border-color:#E6DB55;color:#555;}.login #backtoblog a{color:#464646;}#wphead{border-bottom:#dfdfdf 1px solid;}#wphead h1 a{color:#464646;}#user_info{color:#555;}#user_info:hover,#user_info.active{color:#222;}#user_info.active{background-color:#f1f1f1;background-image:-ms-linear-gradient(bottom,#e9e9e9,#f9f9f9);background-image:-moz-linear-gradient(bottom,#e9e9e9,#f9f9f9);background-image:-o-linear-gradient(bottom,#e9e9e9,#f9f9f9);background-image:-webkit-gradient(linear,left bottom,left top,from(#e9e9e9),to(#f9f9f9));background-image:-webkit-linear-gradient(bottom,#e9e9e9,#f9f9f9);background-image:linear-gradient(bottom,#e9e9e9,#f9f9f9);border-color:#aaa #aaa #dfdfdf;}#user_info_arrow{background:transparent url(../images/arrows.png) no-repeat 6px 5px;}#user_info:hover #user_info_arrow,#user_info.active #user_info_arrow{background:transparent url(../images/arrows-dark.png) no-repeat 6px 5px;}#user_info_links{-moz-box-shadow:0 3px 2px -2px rgba(0,0,0,0.2);-webkit-box-shadow:0 3px 2px -2px rgba(0,0,0,0.2);box-shadow:0 3px 2px -2px rgba(0,0,0,0.2);}#user_info_links ul{background:#f1f1f1;border-color:#ccc #aaa #aaa;-moz-box-shadow:inset 0 1px 0 #f9f9f9;-webkit-box-shadow:inset 0 1px 0 #f9f9f9;box-shadow:inset 0 1px 0 #f9f9f9;}#user_info_links li:hover{background-color:#dfdfdf;}#user_info_links li:hover a,#user_info_links li a:hover{text-decoration:none;}#user_info a:link,#user_info a:visited,#footer a:link,#footer a:visited{text-decoration:none;}#footer a:hover{color:#000;text-decoration:underline;}div#media-upload-error,.file-error,abbr.required,.widget-control-remove:hover,table.widefat .delete a:hover,table.widefat .trash a:hover,table.widefat .spam a:hover,#dashboard_recent_comments .delete a:hover,#dashboard_recent_comments .trash a:hover #dashboard_recent_comments .spam a:hover{color:#f00;}#pass-strength-result{background-color:#eee;border-color:#ddd!important;}#pass-strength-result.bad{background-color:#ffb78c;border-color:#ff853c!important;}#pass-strength-result.good{background-color:#ffec8b;border-color:#fc0!important;}#pass-strength-result.short{background-color:#ffa0a0;border-color:#f04040!important;}#pass-strength-result.strong{background-color:#c3ff88;border-color:#8dff1c!important;}#quicktags{border-color:#ccc;background-color:#dfdfdf;background-image:url("../images/ed-bg.gif");}#ed_toolbar input{border-color:#C3C3C3;}#ed_toolbar input:hover{border-color:#aaa;background:#ddd;}#poststuff .wp_themeSkin .mceStatusbar{border-color:#dfdfdf;}#poststuff .wp_themeSkin .mceStatusbar *{color:#555;}#poststuff #edButtonPreview,#poststuff #edButtonHTML{background-color:#f1f1f1;border-color:#dfdfdf #dfdfdf #ccc;color:#999;}#poststuff #editor-toolbar .active{border-color:#ccc #ccc #e9e9e9;background-color:#e9e9e9;color:#333;}#post-status-info{background-color:#EDEDED;}.wp_themeSkin *,.wp_themeSkin a:hover,.wp_themeSkin a:link,.wp_themeSkin a:visited,.wp_themeSkin a:active{color:#000;}.wp_themeSkin table.mceLayout{border-color:#ccc #ccc #dfdfdf;}#editorcontainer #content,#editorcontainer .wp_themeSkin .mceIframeContainer{-moz-box-shadow:inset 1px 1px 2px rgba(0,0,0,0.1);-webkit-box-shadow:inset 1px 1px 2px rgba(0,0,0,0.1);box-shadow:inset 1px 1px 2px rgba(0,0,0,0.1);}.wp_themeSkin iframe{background:transparent;}.wp_themeSkin .mceStatusbar{color:#000;background-color:#f5f5f5;}.wp_themeSkin .mceButton{border-color:#ccc;background-color:#eee;background-image:-ms-linear-gradient(bottom,#ddd,#fff);background-image:-moz-linear-gradient(bottom,#ddd,#fff);background-image:-o-linear-gradient(bottom,#ddd,#fff);background-image:-webkit-gradient(linear,left bottom,left top,from(#ddd),to(#fff));background-image:-webkit-linear-gradient(bottom,#ddd,#fff);background-image:linear-gradient(bottom,#ddd,#fff);}.wp_themeSkin a.mceButtonEnabled:hover{border-color:#a0a0a0;background:#ddd;background-image:-ms-linear-gradient(bottom,#ccc,#fff);background-image:-moz-linear-gradient(bottom,#ccc,#fff);background-image:-o-linear-gradient(bottom,#ccc,#fff);background-image:-webkit-gradient(linear,left bottom,left top,from(#ccc),to(#fff));background-image:-webkit-linear-gradient(bottom,#ccc,#fff);background-image:linear-gradient(bottom,#ccc,#fff);}.wp_themeSkin a.mceButton:active,.wp_themeSkin a.mceButtonEnabled:active,.wp_themeSkin a.mceButtonSelected:active,.wp_themeSkin a.mceButtonActive,.wp_themeSkin a.mceButtonActive:active,.wp_themeSkin a.mceButtonActive:hover{background-color:#ddd;background-image:-ms-linear-gradient(bottom,#eee,#bbb);background-image:-moz-linear-gradient(bottom,#eee,#bbb);background-image:-o-linear-gradient(bottom,#eee,#bbb);background-image:-webkit-gradient(linear,left bottom,left top,from(#eee),to(#bbb));background-image:-webkit-linear-gradient(bottom,#eee,#bbb);background-image:linear-gradient(bottom,#eee,#bbb);border-color:#909090;}.wp_themeSkin .mceButtonDisabled{border-color:#ccc!important;}.wp_themeSkin .mceListBox .mceText,.wp_themeSkin .mceListBox .mceOpen{border-color:#ccc;background-color:#eee;background-image:-ms-linear-gradient(bottom,#ddd,#fff);background-image:-moz-linear-gradient(bottom,#ddd,#fff);background-image:-o-linear-gradient(bottom,#ddd,#fff);background-image:-webkit-gradient(linear,left bottom,left top,from(#ddd),to(#fff));background-image:-webkit-linear-gradient(bottom,#ddd,#fff);background-image:linear-gradient(bottom,#ddd,#fff);}.wp_themeSkin .mceListBox .mceOpen{border-left:0!important;}.wp_themeSkin table.mceListBoxEnabled:hover .mceOpen,.wp_themeSkin .mceListBoxHover .mceOpen,.wp_themeSkin .mceListBoxHover:active .mceOpen,.wp_themeSkin .mceListBoxSelected .mceOpen,.wp_themeSkin .mceListBoxSelected .mceText,.wp_themeSkin table.mceListBoxEnabled:active .mceText{background:#ccc;border-color:#999;}.wp_themeSkin table.mceListBoxEnabled:hover .mceText,.wp_themeSkin .mceListBoxHover .mceText,.wp_themeSkin table.mceListBoxEnabled:hover .mceOpen,.wp_themeSkin .mceListBoxHover .mceOpen{border-color:#909090;background-color:#eee;background-image:-ms-linear-gradient(bottom,#ccc,#fff);background-image:-moz-linear-gradient(bottom,#ccc,#fff);background-image:-o-linear-gradient(bottom,#ccc,#fff);background-image:-webkit-gradient(linear,left bottom,left top,from(#ccc),to(#fff));background-image:-webkit-linear-gradient(bottom,#ccc,#fff);background-image:linear-gradient(bottom,#ccc,#fff);}.wp_themeSkin select.mceListBox{border-color:#B2B2B2;background-color:#fff;}.wp_themeSkin .mceSplitButton a.mceAction,.wp_themeSkin .mceSplitButton a.mceOpen{border-color:#ccc;}.wp_themeSkin .mceSplitButton a.mceOpen:hover,.wp_themeSkin .mceSplitButtonSelected a.mceOpen,.wp_themeSkin table.mceSplitButtonEnabled:hover a.mceAction,.wp_themeSkin .mceSplitButton a.mceAction:hover{border-color:#909090;}.wp_themeSkin table.mceSplitButton td{background-color:#eee;background-image:-ms-linear-gradient(bottom,#ddd,#fff);background-image:-moz-linear-gradient(bottom,#ddd,#fff);background-image:-o-linear-gradient(bottom,#ddd,#fff);background-image:-webkit-gradient(linear,left bottom,left top,from(#ddd),to(#fff));background-image:-webkit-linear-gradient(bottom,#ddd,#fff);background-image:linear-gradient(bottom,#ddd,#fff);}.wp_themeSkin table.mceSplitButton:hover td{background-image:-ms-linear-gradient(bottom,#ccc,#fff);background-image:-moz-linear-gradient(bottom,#ccc,#fff);background-image:-o-linear-gradient(bottom,#ccc,#fff);background-image:-webkit-gradient(linear,left bottom,left top,from(#ccc),to(#fff));background-image:-webkit-linear-gradient(bottom,#ccc,#fff);background-image:linear-gradient(bottom,#ccc,#fff);}.wp_themeSkin .mceSplitButtonActive{background-color:#B2B2B2;}.wp_themeSkin div.mceColorSplitMenu table{background-color:#ebebeb;border-color:#B2B2B2;}.wp_themeSkin .mceColorSplitMenu a{border-color:#B2B2B2;}.wp_themeSkin .mceColorSplitMenu a.mceMoreColors{border-color:#fff;}.wp_themeSkin .mceColorSplitMenu a.mceMoreColors:hover{border-color:#0A246A;background-color:#B6BDD2;}.wp_themeSkin a.mceMoreColors:hover{border-color:#0A246A;}.wp_themeSkin .mceMenu{border-color:#ddd;}.wp_themeSkin .mceMenu table{background-color:#ebeaeb;}.wp_themeSkin .mceMenu .mceText{color:#000;}.wp_themeSkin .mceMenu .mceMenuItemEnabled a:hover,.wp_themeSkin .mceMenu .mceMenuItemActive{background-color:#f5f5f5;}.wp_themeSkin td.mceMenuItemSeparator{background-color:#aaa;}.wp_themeSkin .mceMenuItemTitle a{background-color:#ccc;border-bottom-color:#aaa;}.wp_themeSkin .mceMenuItemTitle span.mceText{color:#000;}.wp_themeSkin .mceMenuItemDisabled .mceText{color:#888;}.wp_themeSkin tr.mceFirst td.mceToolbar{background:#dfdfdf url("../images/ed-bg.gif") repeat-x scroll left top;border-color:#ccc;}.wp-admin #mceModalBlocker{background:#000;}.wp-admin .clearlooks2 .mceFocus .mceTop .mceLeft{background:#444;border-left:1px solid #999;border-top:1px solid #999;-moz-border-radius:3px 0 0 0;-webkit-border-top-left-radius:3px;-khtml-border-top-left-radius:3px;border-top-left-radius:3px;}.wp-admin .clearlooks2 .mceFocus .mceTop .mceRight{background:#444;border-right:1px solid #999;border-top:1px solid #999;border-top-right-radius:3px;-khtml-border-top-right-radius:3px;-webkit-border-top-right-radius:3px;-moz-border-radius:0 3px 0 0;}.wp-admin .clearlooks2 .mceMiddle .mceLeft{background:#f1f1f1;border-left:1px solid #999;}.wp-admin .clearlooks2 .mceMiddle .mceRight{background:#f1f1f1;border-right:1px solid #999;}.wp-admin .clearlooks2 .mceBottom{background:#f1f1f1;border-bottom:1px solid #999;}.wp-admin .clearlooks2 .mceBottom .mceLeft{background:#f1f1f1;border-bottom:1px solid #999;border-left:1px solid #999;}.wp-admin .clearlooks2 .mceBottom .mceCenter{background:#f1f1f1;border-bottom:1px solid #999;}.wp-admin .clearlooks2 .mceBottom .mceRight{background:#f1f1f1;border-bottom:1px solid #999;border-right:1px solid #999;}.wp-admin .clearlooks2 .mceFocus .mceTop span{color:#e5e5e5;}#titlediv #title{border-color:#ccc;}#editorcontainer{border-color:#ccc #ccc #dfdfdf;}#post-status-info{border-color:#dfdfdf #ccc #ccc;}.editwidget .widget-inside{border-color:#dfdfdf;}#titlediv #title{background-color:#fff;}#tTips p#tTips_inside{background-color:#ddd;color:#333;}#timestampdiv input,#namediv input,#poststuff .inside .the-tagcloud{border-color:#ddd;}#adminmenuback,#adminmenuwrap{background-color:#ececec;border-color:#ccc;}#adminmenushadow,#adminmenuback{background-image:url(../images/menu-shadow.png);background-position:top right;background-repeat:repeat-y;}#adminmenu li.wp-menu-separator{background:#dfdfdf;border-color:#cfcfcf;}#adminmenu div.separator{border-color:#e1e1e1;}#adminmenu li.wp-has-current-submenu.wp-menu-open .wp-menu-toggle,#adminmenu li.wp-has-current-submenu:hover .wp-menu-toggle{background:transparent url(../images/arrows-dark.png) no-repeat -1px 6px;}#adminmenu .wp-has-submenu:hover .wp-menu-toggle,#adminmenu .wp-menu-open .wp-menu-toggle{background:transparent url(../images/arrows.png) no-repeat -2px 6px;}#adminmenu a.menu-top,.folded #adminmenu li.menu-top,#adminmenu .wp-submenu .wp-submenu-head{border-top-color:#f9f9f9;border-bottom-color:#dfdfdf;}#adminmenu li.wp-menu-open{border-color:#dfdfdf;}#adminmenu li.wp-has-current-submenu a.wp-has-current-submenu,#adminmenu li.current a.menu-top,.folded #adminmenu li.wp-has-current-submenu,.folded #adminmenu li.current.menu-top,#adminmenu .wp-menu-arrow,#adminmenu .wp-has-current-submenu .wp-submenu .wp-submenu-head{background-color:#777;background-image:-ms-linear-gradient(bottom,#6d6d6d,#808080);background-image:-moz-linear-gradient(bottom,#6d6d6d,#808080);background-image:-o-linear-gradient(bottom,#6d6d6d,#808080);background-image:-webkit-gradient(linear,left bottom,left top,from(#6d6d6d),to(#808080));background-image:-webkit-linear-gradient(bottom,#6d6d6d,#808080);background-image:linear-gradient(bottom,#6d6d6d,#808080);}#adminmenu li.wp-has-current-submenu a.wp-has-current-submenu,#adminmenu li.current a.menu-top,#adminmenu .wp-has-current-submenu .wp-submenu .wp-submenu-head{text-shadow:0 -1px 0 #333;color:#fff;border-top-color:#808080;border-bottom-color:#6d6d6d;}.folded #adminmenu li.wp-has-current-submenu,.folded #adminmenu li.current.menu-top{border-top-color:#808080;border-bottom-color:#6d6d6d;}#adminmenu .wp-submenu a:hover{background-color:#EAF2FA!important;color:#333!important;}#adminmenu .wp-submenu li.current,#adminmenu .wp-submenu li.current a,#adminmenu .wp-submenu li.current a:hover{color:#333;}#adminmenu .wp-submenu ul{background-color:#fff;}.folded #adminmenu .wp-submenu-wrap,.folded #adminmenu .wp-submenu ul{border-color:#dfdfdf;}.folded #adminmenu .wp-submenu-wrap{-moz-box-shadow:2px 2px 5px rgba(0,0,0,0.4);-webkit-box-shadow:2px 2px 5px rgba(0,0,0,0.4);box-shadow:2px 2px 5px rgba(0,0,0,0.4);}#adminmenu .wp-submenu .wp-submenu-head{border-right-color:#dfdfdf;background-color:#ececec;}#adminmenu div.wp-submenu{background-color:transparent;}#collapse-menu{color:#aaa;}#collapse-menu:hover{color:#999;}#collapse-button{border-color:#ccc;background-color:#f4f4f4;background-image:-ms-linear-gradient(bottom,#dfdfdf,#fff);background-image:-moz-linear-gradient(bottom,#dfdfdf,#fff);background-image:-o-linear-gradient(bottom,#dfdfdf,#fff);background-image:-webkit-gradient(linear,left bottom,left top,from(#dfdfdf),to(#fff));background-image:-webkit-linear-gradient(bottom,#dfdfdf,#fff);background-image:linear-gradient(bottom,#dfdfdf,#fff);}#collapse-menu:hover #collapse-button{border-color:#aaa;}#collapse-button div{background:transparent url(../images/arrows.png) no-repeat 0 -72px;}.folded #collapse-button div{background-position:0 -108px;}#adminmenu .menu-icon-dashboard div.wp-menu-image{background:transparent url('../images/menu.png?ver=20100531') no-repeat scroll -60px -33px;}#adminmenu .menu-icon-dashboard:hover div.wp-menu-image,#adminmenu .menu-icon-dashboard.wp-has-current-submenu div.wp-menu-image,#adminmenu .menu-icon-dashboard.current div.wp-menu-image{background:transparent url('../images/menu.png?ver=20100531') no-repeat scroll -60px -1px;}#adminmenu .menu-icon-post div.wp-menu-image{background:transparent url('../images/menu.png?ver=20100531') no-repeat scroll -271px -33px;}#adminmenu .menu-icon-post:hover div.wp-menu-image,#adminmenu .menu-icon-post.wp-has-current-submenu div.wp-menu-image{background:transparent url('../images/menu.png?ver=20100531') no-repeat scroll -271px -1px;}#adminmenu .menu-icon-media div.wp-menu-image{background:transparent url('../images/menu.png?ver=20100531') no-repeat scroll -120px -33px;}#adminmenu .menu-icon-media:hover div.wp-menu-image,#adminmenu .menu-icon-media.wp-has-current-submenu div.wp-menu-image{background:transparent url('../images/menu.png?ver=20100531') no-repeat scroll -120px -1px;}#adminmenu .menu-icon-links div.wp-menu-image{background:transparent url('../images/menu.png?ver=20100531') no-repeat scroll -90px -33px;}#adminmenu .menu-icon-links:hover div.wp-menu-image,#adminmenu .menu-icon-links.wp-has-current-submenu div.wp-menu-image{background:transparent url('../images/menu.png?ver=20100531') no-repeat scroll -90px -1px;}#adminmenu .menu-icon-page div.wp-menu-image{background:transparent url('../images/menu.png?ver=20100531') no-repeat scroll -150px -33px;}#adminmenu .menu-icon-page:hover div.wp-menu-image,#adminmenu .menu-icon-page.wp-has-current-submenu div.wp-menu-image{background:transparent url('../images/menu.png?ver=20100531') no-repeat scroll -150px -1px;}#adminmenu .menu-icon-comments div.wp-menu-image{background:transparent url('../images/menu.png?ver=20100531') no-repeat scroll -30px -33px;}#adminmenu .menu-icon-comments:hover div.wp-menu-image,#adminmenu .menu-icon-comments.wp-has-current-submenu div.wp-menu-image,#adminmenu .menu-icon-comments.current div.wp-menu-image{background:transparent url('../images/menu.png?ver=20100531') no-repeat scroll -30px -1px;}#adminmenu .menu-icon-appearance div.wp-menu-image{background:transparent url('../images/menu.png?ver=20100531') no-repeat scroll 0 -33px;}#adminmenu .menu-icon-appearance:hover div.wp-menu-image,#adminmenu .menu-icon-appearance.wp-has-current-submenu div.wp-menu-image{background:transparent url('../images/menu.png?ver=20100531') no-repeat scroll 0 -1px;}#adminmenu .menu-icon-plugins div.wp-menu-image{background:transparent url('../images/menu.png?ver=20100531') no-repeat scroll -180px -33px;}#adminmenu .menu-icon-plugins:hover div.wp-menu-image,#adminmenu .menu-icon-plugins.wp-has-current-submenu div.wp-menu-image{background:transparent url('../images/menu.png?ver=20100531') no-repeat scroll -180px -1px;}#adminmenu .menu-icon-users div.wp-menu-image{background:transparent url('../images/menu.png?ver=20100531') no-repeat scroll -300px -33px;}#adminmenu .menu-icon-users:hover div.wp-menu-image,#adminmenu .menu-icon-users.wp-has-current-submenu div.wp-menu-image,#adminmenu .menu-icon-users.current div.wp-menu-image{background:transparent url('../images/menu.png?ver=20100531') no-repeat scroll -300px -1px;}#adminmenu .menu-icon-tools div.wp-menu-image{background:transparent url('../images/menu.png?ver=20100531') no-repeat scroll -210px -33px;}#adminmenu .menu-icon-tools:hover div.wp-menu-image,#adminmenu .menu-icon-tools.wp-has-current-submenu div.wp-menu-image,#adminmenu .menu-icon-tools.current div.wp-menu-image{background:transparent url('../images/menu.png?ver=20100531') no-repeat scroll -210px -1px;}#icon-options-general,#adminmenu .menu-icon-settings div.wp-menu-image{background:transparent url('../images/menu.png?ver=20100531') no-repeat scroll -240px -33px;}#adminmenu .menu-icon-settings:hover div.wp-menu-image,#adminmenu .menu-icon-settings.wp-has-current-submenu div.wp-menu-image{background:transparent url('../images/menu.png?ver=20100531') no-repeat scroll -240px -1px;}#adminmenu .menu-icon-site div.wp-menu-image{background:transparent url('../images/menu.png?ver=20100531') no-repeat scroll -360px -33px;}#adminmenu .menu-icon-site:hover div.wp-menu-image,#adminmenu .menu-icon-site.wp-has-current-submenu div.wp-menu-image{background:transparent url('../images/menu.png?ver=20100531') no-repeat scroll -360px -1px;}#icon-edit,#icon-post{background:transparent url(../images/icons32.png?ver=20100531) no-repeat -552px -5px;}#icon-index{background:transparent url(../images/icons32.png?ver=20100531) no-repeat -137px -5px;}#icon-upload{background:transparent url(../images/icons32.png?ver=20100531) no-repeat -251px -5px;}#icon-link-manager,#icon-link,#icon-link-category{background:transparent url(../images/icons32.png?ver=20100531) no-repeat -190px -5px;}#icon-edit-pages,#icon-page{background:transparent url(../images/icons32.png?ver=20100531) no-repeat -312px -5px;}#icon-edit-comments{background:transparent url(../images/icons32.png?ver=20100531) no-repeat -72px -5px;}#icon-themes{background:transparent url(../images/icons32.png?ver=20100531) no-repeat -11px -5px;}#icon-plugins{background:transparent url(../images/icons32.png?ver=20100531) no-repeat -370px -5px;}#icon-users,#icon-profile,#icon-user-edit{background:transparent url(../images/icons32.png?ver=20100531) no-repeat -600px -5px;}#icon-tools,#icon-admin{background:transparent url(../images/icons32.png?ver=20100531) no-repeat -432px -5px;}#icon-options-general{background:transparent url(../images/icons32.png?ver=20100531) no-repeat -492px -5px;}#icon-ms-admin{background:transparent url(../images/icons32.png?ver=20100531) no-repeat -659px -5px;}table.diff .diff-deletedline{background-color:#fdd;}table.diff .diff-deletedline del{background-color:#f99;}table.diff .diff-addedline{background-color:#dfd;}table.diff .diff-addedline ins{background-color:#9f9;}#att-info{background-color:#E4F2FD;}#sidemenu a{background-color:#f9f9f9;border-color:#f9f9f9;border-bottom-color:#dfdfdf;}#sidemenu a.current{background-color:#fff;border-color:#dfdfdf #dfdfdf #fff;color:#D54E21;}#screen-options-wrap,#contextual-help-wrap{background-color:#f1f1f1;border-color:#dfdfdf;}#screen-options-link-wrap,#contextual-help-link-wrap{background-color:#e3e3e3;border-right:1px solid transparent;border-left:1px solid transparent;border-bottom:1px solid transparent;background-image:-ms-linear-gradient(bottom,#dfdfdf,#f1f1f1);background-image:-moz-linear-gradient(bottom,#dfdfdf,#f1f1f1);background-image:-o-linear-gradient(bottom,#dfdfdf,#f1f1f1);background-image:-webkit-gradient(linear,left bottom,left top,from(#dfdfdf),to(#f1f1f1));background-image:-webkit-linear-gradient(bottom,#dfdfdf,#f1f1f1);background-image:linear-gradient(bottom,#dfdfdf,#f1f1f1);}#screen-meta-links a.show-settings{color:#777;}#screen-meta-links a.show-settings:hover{color:#000;}#replysubmit{background-color:#f1f1f1;border-top-color:#ddd;}#replyerror{border-color:#ddd;background-color:#f9f9f9;}#edithead,#replyhead{background-color:#f1f1f1;}#ed_reply_toolbar{background-color:#e9e9e9;}.vim-current,.vim-current th,.vim-current td{background-color:#E4F2FD!important;}.star-average,.star.star-rating{background-color:#fc0;}div.star.select:hover{background-color:#d00;}div.star img{border-left:1px solid #fff;border-right:1px solid #fff;}.widefat div.star img{border-left:1px solid #f9f9f9;border-right:1px solid #f9f9f9;}#plugin-information .fyi ul{background-color:#eaf3fa;}#plugin-information .fyi h2.mainheader{background-color:#cee1ef;}#plugin-information pre,#plugin-information code{background-color:#ededff;}#plugin-information pre{border:1px solid #ccc;}.inline-edit-row fieldset input[type="text"],.inline-edit-row fieldset textarea,#bulk-titles,#replyrow input{border-color:#ddd;}.inline-editor div.title{background-color:#EAF3FA;}.inline-editor ul.cat-checklist{background-color:#fff;border-color:#ddd;}.inline-editor .categories .catshow,.inline-editor .categories .cathide{color:#21759b;}.inline-editor .quick-edit-save{background-color:#f1f1f1;}#replyrow #ed_reply_toolbar input:hover{border-color:#aaa;background:#ddd;}fieldset.inline-edit-col-right .inline-edit-col{border-color:#dfdfdf;}.attention{color:#D54E21;}.meta-box-sortables .postbox:hover .handlediv{background:transparent url(../images/arrows.png) no-repeat 6px 7px;}.tablenav .tablenav-pages{color:#555;}.tablenav .tablenav-pages a{border-color:#e3e3e3;background:#eee url('../images/menu-bits.gif?ver=20100610') repeat-x scroll left -379px;}.tablenav .tablenav-pages a:hover,.tablenav .tablenav-pages a:focus{color:#d54e21;}.tablenav .tablenav-pages a.disabled,.tablenav .tablenav-pages a.disabled:hover,.tablenav .tablenav-pages a.disabled:focus{color:#aaa;}.tablenav .tablenav-pages .current{background:#dfdfdf;border-color:#d3d3d3;}#availablethemes,#availablethemes td{border-color:#ddd;}#current-theme img{border-color:#999;}#TB_window #TB_title a.tb-theme-preview-link,#TB_window #TB_title a.tb-theme-preview-link:visited{color:#999;}#TB_window #TB_title a.tb-theme-preview-link:hover,#TB_window #TB_title a.tb-theme-preview-link:focus{color:#ccc;}.misc-pub-section{border-top-color:#fff;border-bottom-color:#dfdfdf;}#minor-publishing{border-bottom-color:#dfdfdf;}#post-body .misc-pub-section{border-right-color:#eee;}.post-com-count span{background-color:#bbb;}.form-table .color-palette td{border-color:#fff;}.sortable-placeholder{border-color:#bbb;background-color:#f5f5f5;}#post-body ul.category-tabs li.tabs a,#post-body ul.add-menu-item-tabs li.tabs a,body.press-this ul.category-tabs li.tabs a{color:#333;}#wp_editimgbtn,#wp_delimgbtn,#wp_editgallery,#wp_delgallery{border-color:#999;background-color:#eee;}#wp_editimgbtn:hover,#wp_delimgbtn:hover,#wp_editgallery:hover,#wp_delgallery:hover{border-color:#555;background-color:#ccc;}#favorite-first{border-color:#c0c0c0;background:#f1f1f1;background:-moz-linear-gradient(bottom,#e7e7e7,#fff);background:-webkit-gradient(linear,left bottom,left top,from(#e7e7e7),to(#fff));}#favorite-inside{border-color:#c0c0c0;background-color:#fff;}#favorite-toggle{background:transparent url(../images/arrows.png) no-repeat 4px 2px;border-color:#dfdfdf;-moz-box-shadow:inset 1px 0 0 #fff;-webkit-box-shadow:inset 1px 0 0 #fff;box-shadow:inset 1px 0 0 #fff;}#favorite-actions a{color:#464646;}#favorite-actions a:hover{color:#000;}#favorite-inside a:hover{text-decoration:underline;}#screen-meta a.show-settings,.toggle-arrow{background:transparent url(../images/arrows.png) no-repeat right 3px;}#screen-meta .screen-meta-active a.show-settings{background:transparent url(../images/arrows.png) no-repeat right -33px;}.view-switch #view-switch-list{background:transparent url(../images/list.png) no-repeat 0 0;}.view-switch .current #view-switch-list{background:transparent url(../images/list.png) no-repeat -40px 0;}.view-switch #view-switch-excerpt{background:transparent url(../images/list.png) no-repeat -20px 0;}.view-switch .current #view-switch-excerpt{background:transparent url(../images/list.png) no-repeat -60px 0;}#header-logo{background:transparent url(../images/wp-logo.png?ver=20110504) no-repeat scroll center center;}.popular-tags,.feature-filter{background-color:#fff;border-color:#DFDFDF;}#theme-information .action-button{border-top-color:#DFDFDF;}.theme-listing br.line{border-bottom-color:#ccc;}div.widgets-sortables,#widgets-left .inactive{background-color:#fcfcfc;border-color:#dfdfdf;}#available-widgets .widget-holder{background-color:#fcfcfc;border-color:#dfdfdf;}#available-widgets .widget-description{color:#555;}.sidebar-name{color:#464646;text-shadow:#fff 0 1px 0;border-color:#dfdfdf;-moz-box-shadow:inset 0 1px 0 #fff;-webkit-box-shadow:inset 0 1px 0 #fff;box-shadow:inset 0 1px 0 #fff;}.sidebar-name:hover,#removing-widget{color:#d54e21;}#removing-widget span{color:black;}.sidebar-name-arrow{background:transparent url(../images/arrows.png) no-repeat 5px 9px;}.sidebar-name:hover .sidebar-name-arrow{background:transparent url(../images/arrows-dark.png) no-repeat 5px 9px;}.in-widget-title{color:#606060;}.deleting .widget-title *{color:#aaa;}.imgedit-menu div{border-color:#d5d5d5;background-color:#f1f1f1;}.imgedit-menu div:hover{border-color:#c1c1c1;background-color:#eaeaea;}.imgedit-menu div.disabled{border-color:#ccc;background-color:#ddd;filter:alpha(opacity=50);opacity:.5;}#dashboard_recent_comments div.undo{border-top-color:#dfdfdf;}.comment-ays,.comment-ays th{border-color:#ddd;}.comment-ays th{background-color:#f1f1f1;}#menu-management .menu-edit{border-color:#dfdfdf;}#post-body{background:#fff;border-top-color:#fff;border-bottom-color:#dfdfdf;}#nav-menu-header{border-bottom-color:#dfdfdf;}#nav-menu-footer{border-top-color:#fff;}#menu-management .nav-tabs-arrow a{color:#C1C1C1;}#menu-management .nav-tabs-arrow a:hover{color:#D54E21;}#menu-management .nav-tabs-arrow a:active{color:#464646;}#menu-management .nav-tab-active{border-color:#dfdfdf;}#menu-management .nav-tab{background:#fbfbfb;border-color:#dfdfdf;}.js .input-with-default-title{color:#aaa;}#cancel-save{color:#f00;}#cancel-save:hover{background-color:#F00;color:#fff;}.list-container{border-color:#DFDFDF;}.menu-item-handle{border-color:#dfdfdf;}.menu li.deleting .menu-item-handle{background-color:#f66;text-shadow:#ccc;}.item-type{color:#999;}.item-controls .menu-item-delete:hover{color:#f00;}.item-edit{background:transparent url(../images/arrows.png) no-repeat 8px 10px;border-bottom-color:#eee;}.item-edit:hover{background:transparent url(../images/arrows-dark.png) no-repeat 8px 10px;}.menu-item-settings{border-color:#dfdfdf;}.link-to-original{color:#777;border-color:#dfdfdf;}#cancel-save:hover{color:#fff!important;}#update-menu-item{color:#fff!important;}#update-menu-item:hover,#update-menu-item:active,#update-menu-item:focus{color:#eaf2fa!important;border-color:#13455b!important;}.submitbox .submitcancel{color:#21759B;border-bottom-color:#21759B;}.submitbox .submitcancel:hover{background:#21759B;color:#fff;}#menu-management .nav-tab-active,.menu-item-handle,.menu-item-settings{-moz-box-shadow:inset 0 1px 0 #fff;-webkit-box-shadow:inset 0 1px 0 #fff;box-shadow:inset 0 1px 0 #fff;}#menu-management .nav-tab-active{background:#f9f9f9;border-bottom-color:#f9f9f9;}#upload-form label{color:#777;}.fullscreen-overlay{background:#fff;}.wp-fullscreen-focus #wp-fullscreen-title,.wp-fullscreen-focus #wp-fullscreen-container{border-color:#ccc;}#fullscreen-topbar{border-bottom-color:#DFDFDF;} \ No newline at end of file diff --git a/src/wp-admin/css/colors-fresh.dev.css b/src/wp-admin/css/colors-fresh.dev.css new file mode 100644 index 0000000..eb86042 --- /dev/null +++ b/src/wp-admin/css/colors-fresh.dev.css @@ -0,0 +1,2091 @@ +html, +.wp-dialog { + background-color: #fff; +} + +* html input, +* html .widget { + border-color: #dfdfdf; +} + +textarea, +input[type="text"], +input[type="password"], +input[type="file"], +input[type="button"], +input[type="submit"], +input[type="reset"], +select { + border-color: #dfdfdf; + background-color: #fff; +} + +kbd, +code { + background: #eaeaea; +} + +input[readonly] { + background-color: #eee; +} + +.find-box-search { + border-color: #dfdfdf; + background-color: #f1f1f1; +} + +.find-box { + background-color: #f1f1f1; +} + +.find-box-inside { + background-color: #fff; +} + +a.page-numbers:hover { + border-color: #999; +} + +body, +#wpbody, +.form-table .pre { + color: #333; +} + +body > #upload-menu { + border-bottom-color: #fff; +} + +#postcustomstuff table, +#your-profile fieldset, +#rightnow, +div.dashboard-widget, +#dashboard-widgets p.dashboard-widget-links, +#replyrow #ed_reply_toolbar input { + border-color: #ccc; +} + +#poststuff .inside label.spam, +#poststuff .inside label.deleted { + color: red; +} + +#poststuff .inside label.waiting { + color: orange; +} + +#poststuff .inside label.approved { + color: green; +} + +#postcustomstuff table { + border-color: #dfdfdf; + background-color: #F9F9F9; +} + +#postcustomstuff thead th { + background-color: #F1F1F1; +} + +#postcustomstuff table input, +#postcustomstuff table textarea { + border-color: #dfdfdf; + background-color: #fff; +} + +.widefat { + border-color: #dfdfdf; + background-color: #f9f9f9; +} + +div.dashboard-widget-error { + background-color: #c43; +} + +div.dashboard-widget-notice { + background-color: #cfe1ef; +} + +div.dashboard-widget-submit { + border-top-color: #ccc; +} + +div.tabs-panel, +.wp-tab-panel, +ul.category-tabs li.tabs, +ul.add-menu-item-tabs li.tabs, +.wp-tab-active { + border-color: #dfdfdf; + background-color: #fff; +} + +ul.category-tabs li.tabs, +ul.add-menu-item-tabs li.tabs, +.wp-tab-active { + background-color: #fff; +} + +input.disabled, +textarea.disabled { + background-color: #ccc; +} +/* #upload-menu li a.upload-tab-link, */ +#plugin-information .action-button a, +#plugin-information .action-button a:hover, +#plugin-information .action-button a:visited { + color: #fff; +} + +.widget .widget-top, +.postbox h3, +.stuffbox h3, +.widefat thead tr th, +.widefat tfoot tr th, +h3.dashboard-widget-title, +h3.dashboard-widget-title span, +h3.dashboard-widget-title small, +.find-box-head, +.sidebar-name, +#nav-menu-header, +#nav-menu-footer, +.menu-item-handle, +#fullscreen-topbar { + background-color: #f1f1f1; /* Fallback */ + background-image: -ms-linear-gradient(top, #f9f9f9, #ececec); /* IE10 */ + background-image: -moz-linear-gradient(top, #f9f9f9, #ececec); /* Firefox */ + background-image: -o-linear-gradient(top, #f9f9f9, #ececec); /* Opera */ + background-image: -webkit-gradient(linear, left top, left bottom, from(#f9f9f9), to(#ececec)); /* old Webkit */ + background-image: -webkit-linear-gradient(top, #f9f9f9, #ececec); /* new Webkit */ + background-image: linear-gradient(top, #f9f9f9, #ececec); /* proposed W3C Markup */ +} + +.widget .widget-top, +.postbox h3, +.stuffbox h3 { + border-bottom-color: #dfdfdf; + text-shadow: #fff 0 1px 0; + -moz-box-shadow: 0 1px 0 #fff; + -webkit-box-shadow: 0 1px 0 #fff; + box-shadow: 0 1px 0 #fff; +} + +.form-table th, +.form-wrap label { + color: #222; + text-shadow: #fff 0 1px 0; +} + +.description, +.form-wrap p { + color: #666; +} + +strong .post-com-count span { + background-color: #21759b; +} + +.sorthelper { + background-color: #ccf3fa; +} + +.ac_match, +.subsubsub a.current { + color: #000; +} + +.wrap h2 { + color: #464646; +} + +.wrap .add-new-h2 { + background: #f1f1f1; +} + +.subtitle { + color: #777; +} + +.ac_over { + background-color: #f0f0b8; +} + +.ac_results { + background-color: #fff; + border-color: #808080; +} + +.ac_results li { + color: #101010; +} + +.alternate, +.alt { + background-color: #fcfcfc; +} + +.available-theme a.screenshot { + background-color: #f1f1f1; + border-color: #ddd; +} + +.bar { + background-color: #e8e8e8; + border-right-color: #99d; +} + +#media-upload, +#media-upload .media-item .slidetoggle { + background: #fff; +} + +#media-upload .slidetoggle { + border-top-color: #dfdfdf; +} + +div.error, +.login #login_error { + background-color: #ffebe8; + border-color: #c00; +} + +div.error a { + color: #c00; +} + +.form-invalid { + background-color: #ffebe8 !important; +} + +.form-invalid input, +.form-invalid select { + border-color: #c00 !important; +} + +.submit { + border-color: #DFDFDF; +} + +.highlight { + background-color: #e4f2fd; + color: #000; +} + +.howto, +.nonessential, +#edit-slug-box, +.form-input-tip, +.subsubsub { + color: #666; +} + +.media-item { + border-bottom-color: #dfdfdf; +} + +#wpbody-content #media-items .describe { + border-top-color: #dfdfdf; +} + +.media-upload-form label.form-help, +td.help { + color: #9a9a9a; +} + +.post-com-count { + background-image: url(../images/bubble_bg.gif); + color: #fff; +} + +.post-com-count span { + background-color: #bbb; + color: #fff; +} + +.post-com-count:hover span { + background-color: #d54e21; +} + +.quicktags, .search { + background-color: #ccc; + color: #000; +} + +.side-info h5 { + border-bottom-color: #dadada; +} + +.side-info ul { + color: #666; +} + +.button, +.button-secondary, +.submit input, +input[type=button], +input[type=submit] { + border-color: #bbb; + color: #464646; +} + +.button:hover, +.button-secondary:hover, +.submit input:hover, +input[type=button]:hover, +input[type=submit]:hover { + color: #000; + border-color: #666; +} + +.button, +.submit input, +.button-secondary { + background: #f2f2f2 url(../images/white-grad.png) repeat-x scroll left top; + text-shadow: rgba(255,255,255,1) 0 1px 0; +} + +.button:active, +.submit input:active, +.button-secondary:active { + background: #eee url(../images/white-grad-active.png) repeat-x scroll left top; +} + +input.button-primary, +button.button-primary, +a.button-primary { + border-color: #298cba; + font-weight: bold; + color: #fff; + background: #21759B url(../images/button-grad.png) repeat-x scroll left top; + text-shadow: rgba(0,0,0,0.3) 0 -1px 0; +} + +input.button-primary:active, +button.button-primary:active, +a.button-primary:active { + background: #21759b url(../images/button-grad-active.png) repeat-x scroll left top; + color: #eaf2fa; +} + +input.button-primary:hover, +button.button-primary:hover, +a.button-primary:hover, +a.button-primary:focus, +a.button-primary:active { + border-color: #13455b; + color: #eaf2fa; +} + +.button-disabled, +.button[disabled], +.button:disabled, +.button-secondary[disabled], +.button-secondary:disabled, +a.button.disabled { + color: #aaa !important; + border-color: #ddd !important; +} + +.button-primary-disabled, +.button-primary[disabled], +.button-primary:disabled { + color: #9FD0D5 !important; + background: #298CBA !important; +} + +a:hover, +a:active, +a:focus { + color: #d54e21; +} + +#wphead #viewsite a:hover, +#adminmenu a:hover, +#adminmenu ul.wp-submenu a:hover, +#the-comment-list .comment a:hover, +#rightnow a:hover, +#media-upload a.del-link:hover, +div.dashboard-widget-submit input:hover, +.subsubsub a:hover, +.subsubsub a.current:hover, +.ui-tabs-nav a:hover, +.plugins .inactive a:hover, +#all-plugins-table .plugins .inactive a:hover, +#search-plugins-table .plugins .inactive a:hover { + color: #d54e21; +} + +#the-comment-list .comment-item, +#dashboard-widgets #dashboard_quick_press form p.submit { + border-color: #dfdfdf; +} + +#side-sortables .category-tabs .tabs a, +#side-sortables .add-menu-item-tabs .tabs a, +.wp-tab-bar .wp-tab-active a { + color: #333; +} + +#rightnow .rbutton { + background-color: #ebebeb; + color: #264761; +} + +.submitbox .submit { + background-color: #464646; + color: #ccc; +} + +.plugins a.delete:hover, +#all-plugins-table .plugins a.delete:hover, +#search-plugins-table .plugins a.delete:hover, +.submitbox .submitdelete { + color: #f00; + border-bottom-color: #f00; +} + +.submitbox .submitdelete:hover, +#media-items a.delete:hover { + color: #fff; + background-color: #f00; + border-bottom-color: #f00; +} + +#normal-sortables .submitbox .submitdelete:hover { + color: #000; + background-color: #f00; + border-bottom-color: #f00; +} + +.tablenav .dots { + border-color: transparent; +} + +.tablenav .next, +.tablenav .prev { + border-color: transparent; + color: #21759b; +} + +.tablenav .next:hover, +.tablenav .prev:hover { + border-color: transparent; + color: #d54e21; +} + +div.updated, +.login .message { + background-color: #ffffe0; + border-color: #e6db55; +} + +.update-message { + color: #000; +} + +a.page-numbers { + border-bottom-color: #B8D3E2; +} + +.commentlist li { + border-bottom-color: #ccc; +} + +.widefat td, +.widefat th { + border-top-color: #fff; + border-bottom-color: #dfdfdf; +} + +.widefat th { + text-shadow: rgba(255,255,255,0.8) 0 1px 0; +} + +.widefat td { + color: #555; +} +.widefat p, +.widefat ol, +.widefat ul { + color: #333; +} + +.widefat thead tr th, +.widefat tfoot tr th, +h3.dashboard-widget-title, +h3.dashboard-widget-title span, +h3.dashboard-widget-title small, +.find-box-head { + color: #333; +} + +th.sortable a:hover, th.sortable a:active, th.sortable a:focus { + color: #333; +} + +h3.dashboard-widget-title small a { + color: #d7d7d7; +} + +h3.dashboard-widget-title small a:hover { + color: #fff; +} + +a, +#adminmenu a, +#poststuff #edButtonPreview, +#poststuff #edButtonHTML, +#the-comment-list p.comment-author strong a, +#media-upload a.del-link, +#media-items a.delete, +.plugins a.delete, +.ui-tabs-nav a { + color: #21759b; +} + +#adminmenu .awaiting-mod, +#adminmenu .update-plugins, +#sidemenu a .update-plugins, +#rightnow .reallynow { + background-color: #464646; + color: #fff; + -moz-box-shadow: rgba(255,255,255,0.5) 0 1px 0; + -khtml-box-shadow: rgba(255,255,255,0.5) 0 1px 0; + -webkit-box-shadow: rgba(255,255,255,0.5) 0 1px 0; + box-shadow: rgba(255,255,255,0.5) 0 1px 0; +} +#plugin-information .action-button { + background-color: #d54e21; + color: #fff; +} + +#adminmenu li.current a .awaiting-mod, +#adminmenu li a.wp-has-current-submenu .update-plugins{ + background-color: #464646; + color: #fff; + -moz-box-shadow: rgba(255,255,255,0.5) 0 1px 0; + -khtml-box-shadow: rgba(255,255,255,0.5) 0 1px 0; + -webkit-box-shadow: rgba(255,255,255,0.5) 0 1px 0; + box-shadow: rgba(255,255,255,0.5) 0 1px 0; +} + +div#media-upload-header, +div#plugin-information-header { + background-color: #f9f9f9; + border-bottom-color: #dfdfdf; +} + +#currenttheme img { + border-color: #666; +} + +#dashboard_secondary div.dashboard-widget-content ul li a { + background-color: #f9f9f9; +} + +input.readonly, textarea.readonly { + background-color: #ddd; +} + +#ed_toolbar input, +#ed_reply_toolbar input { + background: #fff url("../images/fade-butt.png") repeat-x 0 -2px; +} + +#editable-post-name { + background-color: #fffbcc; +} + +#edit-slug-box strong, +.tablenav .displaying-num, +#submitted-on, +.submitted-on { + color: #777; +} + +.login #nav a, +.login #backtoblog a { + color: #21759b !important; +} + +.login #nav a:hover, +.login #backtoblog a:hover { + color: #d54e21 !important; +} + +#footer { + color: #777; + border-color: #dfdfdf; +} + +#media-items, +.imgedit-group { + border-color: #dfdfdf; +} + +.checkbox, +.side-info, +.plugins tr, +#your-profile #rich_editing { + background-color: #fcfcfc; +} + +.plugins .inactive, +.plugins .inactive th, +.plugins .inactive td, +tr.inactive + tr.plugin-update-tr .plugin-update { + background-color: #f4f4f4; +} + +.plugin-update-tr .update-message { + background-color: #fffbe4; + border-color: #dfdfdf; +} + +.plugins .active, +.plugins .active th, +.plugins .active td { + color: #000; +} + +.plugins .inactive a { + color: #557799; +} + +#the-comment-list tr.undo, +#the-comment-list div.undo { + background-color: #f4f4f4; +} + +#the-comment-list .unapproved { + background-color: #ffffe0; +} + +#the-comment-list .approve a { + color: #006505; +} + +#the-comment-list .unapprove a { + color: #d98500; +} + +table.widefat span.delete a, +table.widefat span.trash a, +table.widefat span.spam a, +#dashboard_recent_comments .delete a, +#dashboard_recent_comments .trash a, +#dashboard_recent_comments .spam a { + color: #bc0b0b; +} + +.widget, +#widget-list .widget-top, +.postbox, +#titlediv, +#poststuff .postarea, +.stuffbox { + border-color: #dfdfdf; + -moz-box-shadow: inset 0 1px 0 #fff; + -webkit-box-shadow: inset 0 1px 0 #fff; + box-shadow: inset 0 1px 0 #fff; + -moz-border-radius: 3px; + -khtml-border-radius: 3px; + -webkit-border-radius: 3px; + border-radius: 3px; +} + +.widget, +#widget-list .widget-top, +.postbox, +.menu-item-settings { + background-color: #f5f5f5; /* Fallback */ + background-image: -ms-linear-gradient(top, #f9f9f9, #f5f5f5); /* IE10 */ + background-image: -moz-linear-gradient(top, #f9f9f9, #f5f5f5); /* Firefox */ + background-image: -o-linear-gradient(top, #f9f9f9, #f5f5f5); /* Opera */ + background-image: -webkit-gradient(linear, left top, left bottom, from(#f9f9f9), to(#f5f5f5)); /* old Webkit */ + background-image: -webkit-linear-gradient(top, #f9f9f9, #f5f5f5); /* new Webkit */ + background-image: linear-gradient(top, #f9f9f9, #f5f5f5); /* proposed W3C Markup */ +} + +.postbox h3 { + color: #464646; +} + +.widget .widget-top { + color: #222; +} + +.sidebar-name:hover h3, +.postbox h3:hover { + color: #000; +} + +.curtime #timestamp { + background-image: url(../images/date-button.gif); +} + +#quicktags #ed_link { + color: #00f; +} + +#rightnow .youhave { + background-color: #f0f6fb; +} + +#rightnow a { + color: #448abd; +} + +.tagchecklist span a, +#bulk-titles div a { + background: url(../images/xit.gif) no-repeat; +} + +.tagchecklist span a:hover, +#bulk-titles div a:hover { + background: url(../images/xit.gif) no-repeat -10px 0; +} + +#update-nag, .update-nag { + background-color: #FFFBCC; + border-color: #E6DB55; + color: #555; +} + +.login #backtoblog a { + color: #464646; +} + +#wphead { + border-bottom:#dfdfdf 1px solid; +} + +#wphead h1 a { + color: #464646; +} + +#user_info { + color: #555; +} + +#user_info:hover, +#user_info.active { + color: #222; +} + +#user_info.active { + background-color: #f1f1f1; /* Fallback */ + background-image: -ms-linear-gradient(bottom, #e9e9e9, #f9f9f9); /* IE10 */ + background-image: -moz-linear-gradient(bottom, #e9e9e9, #f9f9f9); /* Firefox */ + background-image: -o-linear-gradient(bottom, #e9e9e9, #f9f9f9); /* Opera */ + background-image: -webkit-gradient(linear, left bottom, left top, from(#e9e9e9), to(#f9f9f9)); /* old Webkit */ + background-image: -webkit-linear-gradient(bottom, #e9e9e9, #f9f9f9); /* new Webkit */ + background-image: linear-gradient(bottom, #e9e9e9, #f9f9f9); /* proposed W3C Markup */ + border-color: #aaa #aaa #dfdfdf; +} + +#user_info_arrow { + background: transparent url(../images/arrows.png) no-repeat 6px 5px; +} + +#user_info:hover #user_info_arrow, +#user_info.active #user_info_arrow { + background: transparent url(../images/arrows-dark.png) no-repeat 6px 5px; +} + +#user_info_links { + -moz-box-shadow: 0 3px 2px -2px rgba( 0, 0, 0, 0.2 ); + -webkit-box-shadow: 0 3px 2px -2px rgba( 0, 0, 0, 0.2 ); + box-shadow: 0 3px 2px -2px rgba( 0, 0, 0, 0.2 ); +} + +#user_info_links ul { + background: #f1f1f1; + border-color: #ccc #aaa #aaa; + -moz-box-shadow: inset 0 1px 0 #f9f9f9; + -webkit-box-shadow: inset 0 1px 0 #f9f9f9; + box-shadow: inset 0 1px 0 #f9f9f9; +} + +#user_info_links li:hover { + background-color: #dfdfdf; +} + +#user_info_links li:hover a, +#user_info_links li a:hover { + text-decoration: none; +} + +#user_info a:link, +#user_info a:visited, +#footer a:link, +#footer a:visited { + text-decoration: none; +} + +#footer a:hover { + color: #000; + text-decoration: underline; +} + +div#media-upload-error, +.file-error, +abbr.required, +.widget-control-remove:hover, +table.widefat .delete a:hover, +table.widefat .trash a:hover, +table.widefat .spam a:hover, +#dashboard_recent_comments .delete a:hover, +#dashboard_recent_comments .trash a:hover +#dashboard_recent_comments .spam a:hover { + color: #f00; +} + +#pass-strength-result { + background-color: #eee; + border-color: #ddd !important; +} + +#pass-strength-result.bad { + background-color: #ffb78c; + border-color: #ff853c !important; +} + +#pass-strength-result.good { + background-color: #ffec8b; + border-color: #fc0 !important; +} + +#pass-strength-result.short { + background-color: #ffa0a0; + border-color: #f04040 !important; +} + +#pass-strength-result.strong { + background-color: #c3ff88; + border-color: #8dff1c !important; +} + +/* editors */ +#quicktags { + border-color: #ccc; + background-color: #dfdfdf; + background-image: url("../images/ed-bg.gif"); +} + +#ed_toolbar input { + border-color: #C3C3C3; +} + +#ed_toolbar input:hover { + border-color: #aaa; + background: #ddd; +} + +#poststuff .wp_themeSkin .mceStatusbar { + border-color: #dfdfdf; +} + +#poststuff .wp_themeSkin .mceStatusbar * { + color: #555; +} + +#poststuff #edButtonPreview, +#poststuff #edButtonHTML { + background-color: #f1f1f1; + border-color: #dfdfdf #dfdfdf #ccc; + color: #999; +} + +#poststuff #editor-toolbar .active { + border-color: #ccc #ccc #e9e9e9; + background-color: #e9e9e9; + color: #333; +} + +/* TinyMCE */ +#post-status-info { + background-color: #EDEDED; +} + +.wp_themeSkin *, +.wp_themeSkin a:hover, +.wp_themeSkin a:link, +.wp_themeSkin a:visited, +.wp_themeSkin a:active { + color: #000; +} + +/* Containers */ +.wp_themeSkin table.mceLayout { + border-color: #ccc #ccc #dfdfdf; +} + +#editorcontainer #content, +#editorcontainer .wp_themeSkin .mceIframeContainer { + -moz-box-shadow: inset 1px 1px 2px rgba( 0, 0, 0, 0.1 ); + -webkit-box-shadow: inset 1px 1px 2px rgba( 0, 0, 0, 0.1 ); + box-shadow: inset 1px 1px 2px rgba( 0, 0, 0, 0.1 ); +} +.wp_themeSkin iframe { + background: transparent; +} + +/* Layout */ +.wp_themeSkin .mceStatusbar { + color: #000; + background-color: #f5f5f5; +} + +/* Button */ +.wp_themeSkin .mceButton { + border-color: #ccc; + background-color: #eee; /* Fallback */ + background-image: -ms-linear-gradient(bottom, #ddd, #fff); /* IE10 */ + background-image: -moz-linear-gradient(bottom, #ddd, #fff); /* Firefox */ + background-image: -o-linear-gradient(bottom, #ddd, #fff); /* Opera */ + background-image: -webkit-gradient(linear, left bottom, left top, from(#ddd), to(#fff)); /* old Webkit */ + background-image: -webkit-linear-gradient(bottom, #ddd, #fff); /* new Webkit */ + background-image: linear-gradient(bottom, #ddd, #fff); /* proposed W3C Markup */ +} + +.wp_themeSkin a.mceButtonEnabled:hover { + border-color: #a0a0a0; + background: #ddd; /* Fallback */ + background-image: -ms-linear-gradient(bottom, #ccc, #fff); /* IE10 */ + background-image: -moz-linear-gradient(bottom, #ccc, #fff); /* Firefox */ + background-image: -o-linear-gradient(bottom, #ccc, #fff); /* Opera */ + background-image: -webkit-gradient(linear, left bottom, left top, from(#ccc), to(#fff)); /* old Webkit */ + background-image: -webkit-linear-gradient(bottom, #ccc, #fff); /* new Webkit */ + background-image: linear-gradient(bottom, #ccc, #fff); /* proposed W3C Markup */ +} + +.wp_themeSkin a.mceButton:active, +.wp_themeSkin a.mceButtonEnabled:active, +.wp_themeSkin a.mceButtonSelected:active, +.wp_themeSkin a.mceButtonActive, +.wp_themeSkin a.mceButtonActive:active, +.wp_themeSkin a.mceButtonActive:hover { + background-color: #ddd; /* Fallback */ + background-image: -ms-linear-gradient(bottom, #eee, #bbb); /* IE10 */ + background-image: -moz-linear-gradient(bottom, #eee, #bbb); /* Firefox */ + background-image: -o-linear-gradient(bottom, #eee, #bbb); /* Opera */ + background-image: -webkit-gradient(linear, left bottom, left top, from(#eee), to(#bbb)); /* old Webkit */ + background-image: -webkit-linear-gradient(bottom, #eee, #bbb); /* new Webkit */ + background-image: linear-gradient(bottom, #eee, #bbb); /* proposed W3C Markup */ + border-color: #909090; +} + +.wp_themeSkin .mceButtonDisabled { + border-color: #ccc !important; +} + +/* ListBox */ +.wp_themeSkin .mceListBox .mceText, +.wp_themeSkin .mceListBox .mceOpen { + border-color: #ccc; + background-color: #eee; /* Fallback */ + background-image: -ms-linear-gradient(bottom, #ddd, #fff); /* IE10 */ + background-image: -moz-linear-gradient(bottom, #ddd, #fff); /* Firefox */ + background-image: -o-linear-gradient(bottom, #ddd, #fff); /* Opera */ + background-image: -webkit-gradient(linear, left bottom, left top, from(#ddd), to(#fff)); /* old Webkit */ + background-image: -webkit-linear-gradient(bottom, #ddd, #fff); /* new Webkit */ + background-image: linear-gradient(bottom, #ddd, #fff); /* proposed W3C Markup */ +} + +.wp_themeSkin .mceListBox .mceOpen { + border-left: 0 !important; +} + +.wp_themeSkin table.mceListBoxEnabled:hover .mceOpen, +.wp_themeSkin .mceListBoxHover .mceOpen, +.wp_themeSkin .mceListBoxHover:active .mceOpen, +.wp_themeSkin .mceListBoxSelected .mceOpen, +.wp_themeSkin .mceListBoxSelected .mceText, +.wp_themeSkin table.mceListBoxEnabled:active .mceText { + background: #ccc; + border-color: #999; +} + +/* List Box Hover */ +.wp_themeSkin table.mceListBoxEnabled:hover .mceText, +.wp_themeSkin .mceListBoxHover .mceText, +.wp_themeSkin table.mceListBoxEnabled:hover .mceOpen, +.wp_themeSkin .mceListBoxHover .mceOpen { + border-color: #909090; + background-color: #eee; /* Fallback */ + background-image: -ms-linear-gradient(bottom, #ccc, #fff); /* IE10 */ + background-image: -moz-linear-gradient(bottom, #ccc, #fff); /* Firefox */ + background-image: -o-linear-gradient(bottom, #ccc, #fff); /* Opera */ + background-image: -webkit-gradient(linear, left bottom, left top, from(#ccc), to(#fff)); /* old Webkit */ + background-image: -webkit-linear-gradient(bottom, #ccc, #fff); /* new Webkit */ + background-image: linear-gradient(bottom, #ccc, #fff); /* proposed W3C Markup */ +} + +.wp_themeSkin select.mceListBox { + border-color: #B2B2B2; + background-color: #fff; +} + +/* SplitButton */ +.wp_themeSkin .mceSplitButton a.mceAction, +.wp_themeSkin .mceSplitButton a.mceOpen { + border-color: #ccc; +} + +.wp_themeSkin .mceSplitButton a.mceOpen:hover, +.wp_themeSkin .mceSplitButtonSelected a.mceOpen, +.wp_themeSkin table.mceSplitButtonEnabled:hover a.mceAction, +.wp_themeSkin .mceSplitButton a.mceAction:hover { + border-color: #909090; +} + + +.wp_themeSkin table.mceSplitButton td { + background-color: #eee; /* Fallback */ + background-image: -ms-linear-gradient(bottom, #ddd, #fff); /* IE10 */ + background-image: -moz-linear-gradient(bottom, #ddd, #fff); /* Firefox */ + background-image: -o-linear-gradient(bottom, #ddd, #fff); /* Opera */ + background-image: -webkit-gradient(linear, left bottom, left top, from(#ddd), to(#fff)); /* old Webkit */ + background-image: -webkit-linear-gradient(bottom, #ddd, #fff); /* new Webkit */ + background-image: linear-gradient(bottom, #ddd, #fff); /* proposed W3C Markup */ +} + +.wp_themeSkin table.mceSplitButton:hover td { + background-image: -ms-linear-gradient(bottom, #ccc, #fff); /* IE10 */ + background-image: -moz-linear-gradient(bottom, #ccc, #fff); /* Firefox */ + background-image: -o-linear-gradient(bottom, #ccc, #fff); /* Opera */ + background-image: -webkit-gradient(linear, left bottom, left top, from(#ccc), to(#fff)); /* old Webkit */ + background-image: -webkit-linear-gradient(bottom, #ccc, #fff); /* new Webkit */ + background-image: linear-gradient(bottom, #ccc, #fff); /* proposed W3C Markup */ +} + +.wp_themeSkin .mceSplitButtonActive { + background-color: #B2B2B2; +} + +/* ColorSplitButton */ +.wp_themeSkin div.mceColorSplitMenu table { + background-color: #ebebeb; + border-color: #B2B2B2; +} + +.wp_themeSkin .mceColorSplitMenu a { + border-color: #B2B2B2; +} + +.wp_themeSkin .mceColorSplitMenu a.mceMoreColors { + border-color: #fff; +} + +.wp_themeSkin .mceColorSplitMenu a.mceMoreColors:hover { + border-color: #0A246A; + background-color: #B6BDD2; +} + +.wp_themeSkin a.mceMoreColors:hover { + border-color: #0A246A; +} + +/* Menu */ +.wp_themeSkin .mceMenu { + border-color: #ddd; +} + +.wp_themeSkin .mceMenu table { + background-color: #ebeaeb; +} + +.wp_themeSkin .mceMenu .mceText { + color: #000; +} + +.wp_themeSkin .mceMenu .mceMenuItemEnabled a:hover, +.wp_themeSkin .mceMenu .mceMenuItemActive { + background-color: #f5f5f5; +} +.wp_themeSkin td.mceMenuItemSeparator { + background-color: #aaa; +} +.wp_themeSkin .mceMenuItemTitle a { + background-color: #ccc; + border-bottom-color: #aaa; +} +.wp_themeSkin .mceMenuItemTitle span.mceText { + color: #000; +} +.wp_themeSkin .mceMenuItemDisabled .mceText { + color: #888; +} + +.wp_themeSkin tr.mceFirst td.mceToolbar { + background: #dfdfdf url("../images/ed-bg.gif") repeat-x scroll left top; + border-color: #ccc; +} + +.wp-admin #mceModalBlocker { + background: #000; +} + +.wp-admin .clearlooks2 .mceFocus .mceTop .mceLeft { + background: #444444; + border-left: 1px solid #999; + border-top: 1px solid #999; + -moz-border-radius: 3px 0 0 0; + -webkit-border-top-left-radius: 3px; + -khtml-border-top-left-radius: 3px; + border-top-left-radius: 3px; +} + +.wp-admin .clearlooks2 .mceFocus .mceTop .mceRight { + background: #444444; + border-right: 1px solid #999; + border-top: 1px solid #999; + border-top-right-radius: 3px; + -khtml-border-top-right-radius: 3px; + -webkit-border-top-right-radius: 3px; + -moz-border-radius: 0 3px 0 0; +} + +.wp-admin .clearlooks2 .mceMiddle .mceLeft { + background: #f1f1f1; + border-left: 1px solid #999; +} + +.wp-admin .clearlooks2 .mceMiddle .mceRight { + background: #f1f1f1; + border-right: 1px solid #999; +} + +.wp-admin .clearlooks2 .mceBottom { + background: #f1f1f1; + border-bottom: 1px solid #999; +} + +.wp-admin .clearlooks2 .mceBottom .mceLeft { + background: #f1f1f1; + border-bottom: 1px solid #999; + border-left: 1px solid #999; +} + +.wp-admin .clearlooks2 .mceBottom .mceCenter { + background: #f1f1f1; + border-bottom: 1px solid #999; +} + +.wp-admin .clearlooks2 .mceBottom .mceRight { + background: #f1f1f1; + border-bottom: 1px solid #999; + border-right: 1px solid #999; +} + +.wp-admin .clearlooks2 .mceFocus .mceTop span { + color: #e5e5e5; +} +/* end TinyMCE */ + +#titlediv #title { + border-color: #ccc; +} + +#editorcontainer { + border-color: #ccc #ccc #dfdfdf; +} + +#post-status-info { + border-color: #dfdfdf #ccc #ccc; +} + +.editwidget .widget-inside { + border-color: #dfdfdf; +} + +#titlediv #title { + background-color: #fff; +} + +#tTips p#tTips_inside { + background-color: #ddd; + color: #333; +} + +#timestampdiv input, +#namediv input, +#poststuff .inside .the-tagcloud { + border-color: #ddd; +} + +/* menu */ +#adminmenuback, +#adminmenuwrap { + background-color: #ececec; + border-color: #ccc; +} + +#adminmenushadow, +#adminmenuback { + background-image: url(../images/menu-shadow.png); + background-position: top right; + background-repeat: repeat-y; +} + +#adminmenu li.wp-menu-separator { + background: #dfdfdf; + border-color: #cfcfcf; +} + +#adminmenu div.separator { + border-color: #e1e1e1; +} + +#adminmenu li.wp-has-current-submenu.wp-menu-open .wp-menu-toggle, +#adminmenu li.wp-has-current-submenu:hover .wp-menu-toggle { + background: transparent url(../images/arrows-dark.png) no-repeat -1px 6px; +} + +#adminmenu .wp-has-submenu:hover .wp-menu-toggle, +#adminmenu .wp-menu-open .wp-menu-toggle { + background: transparent url(../images/arrows.png) no-repeat -2px 6px; +} + +#adminmenu a.menu-top, +.folded #adminmenu li.menu-top, +#adminmenu .wp-submenu .wp-submenu-head { + border-top-color: #f9f9f9; + border-bottom-color: #dfdfdf; +} + +#adminmenu li.wp-menu-open { + border-color: #dfdfdf; +} + +#adminmenu li.wp-has-current-submenu a.wp-has-current-submenu, +#adminmenu li.current a.menu-top, +.folded #adminmenu li.wp-has-current-submenu, +.folded #adminmenu li.current.menu-top, +#adminmenu .wp-menu-arrow, +#adminmenu .wp-has-current-submenu .wp-submenu .wp-submenu-head { + background-color: #777; /* Fallback */ + background-image: -ms-linear-gradient(bottom, #6d6d6d, #808080); /* IE10 */ + background-image: -moz-linear-gradient(bottom, #6d6d6d, #808080); /* Firefox */ + background-image: -o-linear-gradient(bottom, #6d6d6d, #808080); /* Opera */ + background-image: -webkit-gradient(linear, left bottom, left top, from(#6d6d6d), to(#808080)); /* old Webkit */ + background-image: -webkit-linear-gradient(bottom, #6d6d6d, #808080); /* new Webkit */ + background-image: linear-gradient(bottom, #6d6d6d, #808080); /* proposed W3C Markup */ +} + +#adminmenu li.wp-has-current-submenu a.wp-has-current-submenu, +#adminmenu li.current a.menu-top, +#adminmenu .wp-has-current-submenu .wp-submenu .wp-submenu-head { + text-shadow: 0 -1px 0 #333; + color: #fff; + border-top-color: #808080; + border-bottom-color: #6d6d6d; +} + +.folded #adminmenu li.wp-has-current-submenu, +.folded #adminmenu li.current.menu-top { + border-top-color: #808080; + border-bottom-color: #6d6d6d; +} + +#adminmenu .wp-submenu a:hover { + background-color: #EAF2FA !important; + color: #333 !important; +} + +#adminmenu .wp-submenu li.current, +#adminmenu .wp-submenu li.current a, +#adminmenu .wp-submenu li.current a:hover { + color: #333; +} + +#adminmenu .wp-submenu ul { + background-color: #fff; +} + +.folded #adminmenu .wp-submenu-wrap, +.folded #adminmenu .wp-submenu ul { + border-color: #dfdfdf; +} + +.folded #adminmenu .wp-submenu-wrap { + -moz-box-shadow: 2px 2px 5px rgba( 0, 0, 0, 0.4 ); + -webkit-box-shadow: 2px 2px 5px rgba( 0, 0, 0, 0.4 ); + box-shadow: 2px 2px 5px rgba( 0, 0, 0, 0.4 ); +} + +#adminmenu .wp-submenu .wp-submenu-head { + border-right-color: #dfdfdf; + background-color: #ececec; +} + +#adminmenu div.wp-submenu { + background-color: transparent; +} + +/* collapse menu button */ +#collapse-menu { + color: #aaa; +} + +#collapse-menu:hover { + color: #999; +} + +#collapse-button { + border-color: #ccc; + background-color: #f4f4f4; /* Fallback */ + background-image: -ms-linear-gradient(bottom, #dfdfdf, #fff); /* IE10 */ + background-image: -moz-linear-gradient(bottom, #dfdfdf, #fff); /* Firefox */ + background-image: -o-linear-gradient(bottom, #dfdfdf, #fff); /* Opera */ + background-image: -webkit-gradient(linear, left bottom, left top, from(#dfdfdf), to(#fff)); /* old Webkit */ + background-image: -webkit-linear-gradient(bottom, #dfdfdf, #fff); /* new Webkit */ + background-image: linear-gradient(bottom, #dfdfdf, #fff); /* proposed W3C Markup */ +} +#collapse-menu:hover #collapse-button { + border-color: #aaa; +} +#collapse-button div { + background: transparent url(../images/arrows.png) no-repeat 0 -72px; +} +.folded #collapse-button div { + background-position: 0 -108px; +} + +/* menu and screen icons */ +#adminmenu .menu-icon-dashboard div.wp-menu-image { + background: transparent url('../images/menu.png?ver=20100531') no-repeat scroll -60px -33px; +} + +#adminmenu .menu-icon-dashboard:hover div.wp-menu-image, +#adminmenu .menu-icon-dashboard.wp-has-current-submenu div.wp-menu-image, +#adminmenu .menu-icon-dashboard.current div.wp-menu-image { + background: transparent url('../images/menu.png?ver=20100531') no-repeat scroll -60px -1px; +} + +#adminmenu .menu-icon-post div.wp-menu-image { + background: transparent url('../images/menu.png?ver=20100531') no-repeat scroll -271px -33px; +} + +#adminmenu .menu-icon-post:hover div.wp-menu-image, +#adminmenu .menu-icon-post.wp-has-current-submenu div.wp-menu-image { + background: transparent url('../images/menu.png?ver=20100531') no-repeat scroll -271px -1px; +} + +#adminmenu .menu-icon-media div.wp-menu-image { + background: transparent url('../images/menu.png?ver=20100531') no-repeat scroll -120px -33px; +} + +#adminmenu .menu-icon-media:hover div.wp-menu-image, +#adminmenu .menu-icon-media.wp-has-current-submenu div.wp-menu-image { + background: transparent url('../images/menu.png?ver=20100531') no-repeat scroll -120px -1px; +} + +#adminmenu .menu-icon-links div.wp-menu-image { + background: transparent url('../images/menu.png?ver=20100531') no-repeat scroll -90px -33px; +} + +#adminmenu .menu-icon-links:hover div.wp-menu-image, +#adminmenu .menu-icon-links.wp-has-current-submenu div.wp-menu-image { + background: transparent url('../images/menu.png?ver=20100531') no-repeat scroll -90px -1px; +} + +#adminmenu .menu-icon-page div.wp-menu-image { + background: transparent url('../images/menu.png?ver=20100531') no-repeat scroll -150px -33px; +} + +#adminmenu .menu-icon-page:hover div.wp-menu-image, +#adminmenu .menu-icon-page.wp-has-current-submenu div.wp-menu-image { + background: transparent url('../images/menu.png?ver=20100531') no-repeat scroll -150px -1px; +} + +#adminmenu .menu-icon-comments div.wp-menu-image { + background: transparent url('../images/menu.png?ver=20100531') no-repeat scroll -30px -33px; +} + +#adminmenu .menu-icon-comments:hover div.wp-menu-image, +#adminmenu .menu-icon-comments.wp-has-current-submenu div.wp-menu-image, +#adminmenu .menu-icon-comments.current div.wp-menu-image { + background: transparent url('../images/menu.png?ver=20100531') no-repeat scroll -30px -1px; +} + +#adminmenu .menu-icon-appearance div.wp-menu-image { + background: transparent url('../images/menu.png?ver=20100531') no-repeat scroll 0 -33px; +} + +#adminmenu .menu-icon-appearance:hover div.wp-menu-image, +#adminmenu .menu-icon-appearance.wp-has-current-submenu div.wp-menu-image { + background: transparent url('../images/menu.png?ver=20100531') no-repeat scroll 0 -1px; +} + +#adminmenu .menu-icon-plugins div.wp-menu-image { + background: transparent url('../images/menu.png?ver=20100531') no-repeat scroll -180px -33px; +} + +#adminmenu .menu-icon-plugins:hover div.wp-menu-image, +#adminmenu .menu-icon-plugins.wp-has-current-submenu div.wp-menu-image { + background: transparent url('../images/menu.png?ver=20100531') no-repeat scroll -180px -1px; +} + +#adminmenu .menu-icon-users div.wp-menu-image { + background: transparent url('../images/menu.png?ver=20100531') no-repeat scroll -300px -33px; +} + +#adminmenu .menu-icon-users:hover div.wp-menu-image, +#adminmenu .menu-icon-users.wp-has-current-submenu div.wp-menu-image, +#adminmenu .menu-icon-users.current div.wp-menu-image { + background: transparent url('../images/menu.png?ver=20100531') no-repeat scroll -300px -1px; +} + +#adminmenu .menu-icon-tools div.wp-menu-image { + background: transparent url('../images/menu.png?ver=20100531') no-repeat scroll -210px -33px; +} + +#adminmenu .menu-icon-tools:hover div.wp-menu-image, +#adminmenu .menu-icon-tools.wp-has-current-submenu div.wp-menu-image, +#adminmenu .menu-icon-tools.current div.wp-menu-image { + background: transparent url('../images/menu.png?ver=20100531') no-repeat scroll -210px -1px; +} + +#icon-options-general, +#adminmenu .menu-icon-settings div.wp-menu-image { + background: transparent url('../images/menu.png?ver=20100531') no-repeat scroll -240px -33px; +} + +#adminmenu .menu-icon-settings:hover div.wp-menu-image, +#adminmenu .menu-icon-settings.wp-has-current-submenu div.wp-menu-image { + background: transparent url('../images/menu.png?ver=20100531') no-repeat scroll -240px -1px; +} + +#adminmenu .menu-icon-site div.wp-menu-image { + background: transparent url('../images/menu.png?ver=20100531') no-repeat scroll -360px -33px; +} + +#adminmenu .menu-icon-site:hover div.wp-menu-image, +#adminmenu .menu-icon-site.wp-has-current-submenu div.wp-menu-image { + background: transparent url('../images/menu.png?ver=20100531') no-repeat scroll -360px -1px; +} +/* end menu and screen icons */ + +/* Screen Icons */ +#icon-edit, +#icon-post { + background: transparent url(../images/icons32.png?ver=20100531) no-repeat -552px -5px; +} + +#icon-index { + background: transparent url(../images/icons32.png?ver=20100531) no-repeat -137px -5px; +} + +#icon-upload { + background: transparent url(../images/icons32.png?ver=20100531) no-repeat -251px -5px; +} + +#icon-link-manager, +#icon-link, +#icon-link-category { + background: transparent url(../images/icons32.png?ver=20100531) no-repeat -190px -5px; +} + +#icon-edit-pages, +#icon-page { + background: transparent url(../images/icons32.png?ver=20100531) no-repeat -312px -5px; +} + +#icon-edit-comments { + background: transparent url(../images/icons32.png?ver=20100531) no-repeat -72px -5px; +} + +#icon-themes { + background: transparent url(../images/icons32.png?ver=20100531) no-repeat -11px -5px; +} + +#icon-plugins { + background: transparent url(../images/icons32.png?ver=20100531) no-repeat -370px -5px; +} + +#icon-users, +#icon-profile, +#icon-user-edit { + background: transparent url(../images/icons32.png?ver=20100531) no-repeat -600px -5px; +} + +#icon-tools, +#icon-admin { + background: transparent url(../images/icons32.png?ver=20100531) no-repeat -432px -5px; +} + +#icon-options-general { + background: transparent url(../images/icons32.png?ver=20100531) no-repeat -492px -5px; +} + +#icon-ms-admin { + background: transparent url(../images/icons32.png?ver=20100531) no-repeat -659px -5px; +} +/* end screen icons */ + + +/* Diff */ +table.diff .diff-deletedline { + background-color: #fdd; +} + +table.diff .diff-deletedline del { + background-color: #f99; +} + +table.diff .diff-addedline { + background-color: #dfd; +} + +table.diff .diff-addedline ins { + background-color: #9f9; +} + +#att-info { + background-color: #E4F2FD; +} + +/* edit image */ +#sidemenu a { + background-color: #f9f9f9; + border-color: #f9f9f9; + border-bottom-color: #dfdfdf; +} + +#sidemenu a.current { + background-color: #fff; + border-color: #dfdfdf #dfdfdf #fff; + color: #D54E21; +} + +#screen-options-wrap, +#contextual-help-wrap { + background-color: #f1f1f1; + border-color: #dfdfdf; +} + +#screen-options-link-wrap, +#contextual-help-link-wrap { + background-color: #e3e3e3; /* Fallback */ + border-right: 1px solid transparent; + border-left: 1px solid transparent; + border-bottom: 1px solid transparent; + background-image: -ms-linear-gradient(bottom, #dfdfdf, #f1f1f1); /* IE10 */ + background-image: -moz-linear-gradient(bottom, #dfdfdf, #f1f1f1); /* Firefox */ + background-image: -o-linear-gradient(bottom, #dfdfdf, #f1f1f1); /* Opera */ + background-image: -webkit-gradient(linear, left bottom, left top, from(#dfdfdf), to(#f1f1f1)); /* old Webkit */ + background-image: -webkit-linear-gradient(bottom, #dfdfdf, #f1f1f1); /* new Webkit */ + background-image: linear-gradient(bottom, #dfdfdf, #f1f1f1); /* proposed W3C Markup */ +} + +#screen-meta-links a.show-settings { + color: #777; +} + +#screen-meta-links a.show-settings:hover { + color: #000; +} + +#replysubmit { + background-color: #f1f1f1; + border-top-color: #ddd; +} + +#replyerror { + border-color: #ddd; + background-color: #f9f9f9; +} + +#edithead, +#replyhead { + background-color: #f1f1f1; +} + +#ed_reply_toolbar { + background-color: #e9e9e9; +} + +/* table vim shortcuts */ +.vim-current, +.vim-current th, +.vim-current td { + background-color: #E4F2FD !important; +} + +/* Install Plugins */ +.star-average, +.star.star-rating { + background-color: #fc0; +} + +div.star.select:hover { + background-color: #d00; +} + +div.star img { + border-left: 1px solid #fff; + border-right: 1px solid #fff; +} + +.widefat div.star img { + border-left: 1px solid #f9f9f9; + border-right: 1px solid #f9f9f9; +} + +#plugin-information .fyi ul { + background-color: #eaf3fa; +} + +#plugin-information .fyi h2.mainheader { + background-color: #cee1ef; +} + +#plugin-information pre, +#plugin-information code { + background-color: #ededff; +} + +#plugin-information pre { + border: 1px solid #ccc; +} + +/* inline editor */ +.inline-edit-row fieldset input[type="text"], +.inline-edit-row fieldset textarea, +#bulk-titles, +#replyrow input { + border-color: #ddd; +} + +.inline-editor div.title { + background-color: #EAF3FA; +} + +.inline-editor ul.cat-checklist { + background-color: #fff; + border-color: #ddd; +} + +.inline-editor .categories .catshow, +.inline-editor .categories .cathide { + color: #21759b; +} + +.inline-editor .quick-edit-save { + background-color: #f1f1f1; +} + +#replyrow #ed_reply_toolbar input:hover { + border-color: #aaa; + background: #ddd; +} + +fieldset.inline-edit-col-right .inline-edit-col { + border-color: #dfdfdf; +} + +.attention { + color: #D54E21; +} + +.meta-box-sortables .postbox:hover .handlediv { + background: transparent url(../images/arrows.png) no-repeat 6px 7px; +} + +.tablenav .tablenav-pages { + color: #555; +} + +.tablenav .tablenav-pages a { + border-color: #e3e3e3; + background: #eee url('../images/menu-bits.gif?ver=20100610') repeat-x scroll left -379px; +} + +.tablenav .tablenav-pages a:hover, +.tablenav .tablenav-pages a:focus { + color: #d54e21; +} + +.tablenav .tablenav-pages a.disabled, +.tablenav .tablenav-pages a.disabled:hover, +.tablenav .tablenav-pages a.disabled:focus { + color: #aaa; +} + +.tablenav .tablenav-pages .current { + background: #dfdfdf; + border-color: #d3d3d3; +} + +#availablethemes, +#availablethemes td { + border-color: #ddd; +} + +#current-theme img { + border-color: #999; +} + +#TB_window #TB_title a.tb-theme-preview-link, +#TB_window #TB_title a.tb-theme-preview-link:visited { + color: #999; +} + +#TB_window #TB_title a.tb-theme-preview-link:hover, +#TB_window #TB_title a.tb-theme-preview-link:focus { + color: #ccc; +} + +.misc-pub-section { + border-top-color: #fff; + border-bottom-color: #dfdfdf; +} + +#minor-publishing { + border-bottom-color: #dfdfdf; +} + +#post-body .misc-pub-section { + border-right-color: #eee; +} + +.post-com-count span { + background-color: #bbb; +} + +.form-table .color-palette td { + border-color: #fff; +} + +.sortable-placeholder { + border-color: #bbb; + background-color: #f5f5f5; +} + +#post-body ul.category-tabs li.tabs a, +#post-body ul.add-menu-item-tabs li.tabs a, +body.press-this ul.category-tabs li.tabs a { + color: #333; +} + +#wp_editimgbtn, +#wp_delimgbtn, +#wp_editgallery, +#wp_delgallery { + border-color: #999; + background-color: #eee; +} + +#wp_editimgbtn:hover, +#wp_delimgbtn:hover, +#wp_editgallery:hover, +#wp_delgallery:hover { + border-color: #555; + background-color: #ccc; +} + +#favorite-first { + border-color: #c0c0c0; + background: #f1f1f1; /* fallback color */ + background:-moz-linear-gradient(bottom, #e7e7e7, #fff); + background:-webkit-gradient(linear, left bottom, left top, from(#e7e7e7), to(#fff)); +} + +#favorite-inside { + border-color: #c0c0c0; + background-color: #fff; +} + +#favorite-toggle { + background: transparent url(../images/arrows.png) no-repeat 4px 2px; + border-color: #dfdfdf; + -moz-box-shadow: inset 1px 0 0 #fff; + -webkit-box-shadow: inset 1px 0 0 #fff; + box-shadow: inset 1px 0 0 #fff; +} + +#favorite-actions a { + color: #464646; +} + +#favorite-actions a:hover { + color: #000; +} + +#favorite-inside a:hover { + text-decoration: underline; +} + +#screen-meta a.show-settings, +.toggle-arrow { + background: transparent url(../images/arrows.png) no-repeat right 3px; +} + +#screen-meta .screen-meta-active a.show-settings { + background: transparent url(../images/arrows.png) no-repeat right -33px; +} + +.view-switch #view-switch-list { + background: transparent url(../images/list.png) no-repeat 0 0; +} + +.view-switch .current #view-switch-list { + background: transparent url(../images/list.png) no-repeat -40px 0; +} + +.view-switch #view-switch-excerpt { + background: transparent url(../images/list.png) no-repeat -20px 0; +} + +.view-switch .current #view-switch-excerpt { + background: transparent url(../images/list.png) no-repeat -60px 0; +} + +#header-logo { + background: transparent url(../images/wp-logo.png?ver=20110504) no-repeat scroll center center; +} + +.popular-tags, +.feature-filter { + background-color: #fff; + border-color: #DFDFDF; +} + +#theme-information .action-button { + border-top-color: #DFDFDF; +} + +.theme-listing br.line { + border-bottom-color: #ccc; +} + +div.widgets-sortables, +#widgets-left .inactive { + background-color: #fcfcfc; + border-color: #dfdfdf; +} + +#available-widgets .widget-holder { + background-color: #fcfcfc; + border-color: #dfdfdf; +} + +#available-widgets .widget-description { + color: #555; +} + +.sidebar-name { + color: #464646; + text-shadow: #fff 0 1px 0; + border-color: #dfdfdf; + -moz-box-shadow: inset 0 1px 0 #fff; + -webkit-box-shadow: inset 0 1px 0 #fff; + box-shadow: inset 0 1px 0 #fff; +} + +.sidebar-name:hover, +#removing-widget { + color: #d54e21; +} + +#removing-widget span { + color: black; +} + +.sidebar-name-arrow { + background: transparent url(../images/arrows.png) no-repeat 5px 9px; +} + +.sidebar-name:hover .sidebar-name-arrow { + background: transparent url(../images/arrows-dark.png) no-repeat 5px 9px; +} + +.in-widget-title { + color: #606060; +} + +.deleting .widget-title * { + color: #aaa; +} + +.imgedit-menu div { + border-color: #d5d5d5; + background-color: #f1f1f1; +} + +.imgedit-menu div:hover { + border-color: #c1c1c1; + background-color: #eaeaea; +} + +.imgedit-menu div.disabled { + border-color: #ccc; + background-color: #ddd; + filter: alpha(opacity=50); + opacity: 0.5; +} + +#dashboard_recent_comments div.undo { + border-top-color: #dfdfdf; +} + +.comment-ays, +.comment-ays th { + border-color: #ddd; +} + +.comment-ays th { + background-color: #f1f1f1; +} + +/* added from nav-menu.css */ +#menu-management .menu-edit { + border-color: #dfdfdf; +} + +#post-body { + background: #fff; + border-top-color: #fff; + border-bottom-color: #dfdfdf; +} + +#nav-menu-header { + border-bottom-color: #dfdfdf; +} + +#nav-menu-footer { + border-top-color: #fff; +} + +#menu-management .nav-tabs-arrow a { + color: #C1C1C1; +} + +#menu-management .nav-tabs-arrow a:hover { + color: #D54E21; +} + +#menu-management .nav-tabs-arrow a:active { + color: #464646; +} + +#menu-management .nav-tab-active { + border-color: #dfdfdf; +} + +#menu-management .nav-tab { + background: #fbfbfb; + border-color: #dfdfdf; +} + +.js .input-with-default-title { + color: #aaa; +} + +#cancel-save { + color: #ff0000; +} + +#cancel-save:hover { + background-color: #FF0000; + color: #fff; +} + +.list-container { + border-color: #DFDFDF; +} + +.menu-item-handle { + border-color: #dfdfdf; +} + +.menu li.deleting .menu-item-handle { + background-color: #f66; + text-shadow: #ccc; +} + +.item-type { /* Menu item controls */ + color: #999999; +} + +.item-controls .menu-item-delete:hover { + color: #ff0000; +} + +.item-edit { + background: transparent url(../images/arrows.png) no-repeat 8px 10px; + border-bottom-color: #eee; +} + +.item-edit:hover { + background: transparent url(../images/arrows-dark.png) no-repeat 8px 10px; +} + +.menu-item-settings { /* Menu editing */ + border-color: #dfdfdf; +} + +.link-to-original { + color: #777; + border-color: #dfdfdf; +} + +#cancel-save:hover { + color: #fff !important; +} + +#update-menu-item { + color: #fff !important; +} + +#update-menu-item:hover, +#update-menu-item:active, +#update-menu-item:focus { + color: #eaf2fa !important; + border-color: #13455b !important; +} + +.submitbox .submitcancel { + color: #21759B; + border-bottom-color: #21759B; +} + +.submitbox .submitcancel:hover { + background: #21759B; + color: #fff; +} +/* end added from nav-menu.css */ + +#menu-management .nav-tab-active, +.menu-item-handle, +.menu-item-settings { + -moz-box-shadow: inset 0 1px 0 #fff; + -webkit-box-shadow: inset 0 1px 0 #fff; + box-shadow: inset 0 1px 0 #fff; +} + +#menu-management .nav-tab-active { + background: #f9f9f9; + border-bottom-color: #f9f9f9; +} + +/* custom header & background pages */ +#upload-form label { + color: #777; +} +/* custom header & background pages */ + +/* full screen */ +.fullscreen-overlay { + background: #fff; +} + +.wp-fullscreen-focus #wp-fullscreen-title, +.wp-fullscreen-focus #wp-fullscreen-container { + border-color: #ccc; +} + +#fullscreen-topbar { + border-bottom-color: #DFDFDF; +} diff --git a/src/wp-admin/css/dashboard-rtl.css b/src/wp-admin/css/dashboard-rtl.css new file mode 100644 index 0000000..14d25ae --- /dev/null +++ b/src/wp-admin/css/dashboard-rtl.css @@ -0,0 +1 @@ +#dashboard-widgets-wrap .has-sidebar{margin-right:0;margin-left:-51%;}#dashboard-widgets-wrap .has-sidebar .has-sidebar-content{margin-right:0;margin-left:51%;}.view-all{right:auto;left:0;}#dashboard_right_now p.sub,#dashboard-widgets h4,#dashboard_quick_press h4,a.rsswidget,#dashboard_plugins h4,#dashboard_plugins h5,#dashboard_recent_comments .comment-meta .approve{font-family:Tahoma,Arial;}#dashboard_right_now p.sub{left:auto;right:15px;}#dashboard_right_now td.b{padding-right:0;padding-left:6px;text-align:left;font-family:Tahoma,Arial;}#dashboard_right_now .t{padding-right:0;padding-left:12px;}#dashboard_right_now .table_content{float:right;}#dashboard_right_now .table_discussion{float:left;}#dashboard_right_now .versions a{font-family:Tahoma,Arial;}#dashboard_right_now a.button{float:left;clear:left;}#dashboard_plugins .inside span{padding-left:0;padding-right:5px;}#dashboard-widgets h3 .postbox-title-action{right:auto;left:30px;}#the-comment-list .pingback{padding-left:0!important;padding-right:9px!important;}#the-comment-list .comment-item{padding:1em 70px 1em 10px;}#the-comment-list .comment-item .avatar{float:right;margin-left:0;margin-right:-60px;}.rss-widget cite{text-align:left;}.rss-widget span.rss-date{font-family:Tahoma,Arial;margin-left:0;margin-right:3px;}#dashboard_quick_press h4{float:right;text-align:left;}#dashboard_quick_press h4 label{margin-right:0;margin-left:10px;}#dashboard_quick_press .input-text-wrap,#dashboard_quick_press .textarea-wrap{margin:0 5em 1em 0;}#dashboard_quick_press #media-buttons{margin:0 5em .5em 0;padding:0 10px 0 0;}#dashboard-widgets #dashboard_quick_press form p.submit{margin-left:0;margin-right:4.6em;}#dashboard-widgets #dashboard_quick_press form p.submit input{float:right;}#dashboard-widgets #dashboard_quick_press form p.submit #save-post{margin:0 10px 0 1em;}#dashboard-widgets #dashboard_quick_press form p.submit #publish{float:left;}#dashboard-widgets #dashboard_quick_press form p.submit img.waiting{margin:4px 0 0 6px;}#dashboard_recent_drafts h4 abbr{font-family:Tahoma,Arial;margin-left:0;margin-right:3px;} \ No newline at end of file diff --git a/src/wp-admin/css/dashboard-rtl.dev.css b/src/wp-admin/css/dashboard-rtl.dev.css new file mode 100644 index 0000000..8617bfa --- /dev/null +++ b/src/wp-admin/css/dashboard-rtl.dev.css @@ -0,0 +1,110 @@ +#dashboard-widgets-wrap .has-sidebar { + margin-right: 0; + margin-left: -51%; +} +#dashboard-widgets-wrap .has-sidebar .has-sidebar-content { + margin-right: 0; + margin-left: 51%; +} +.view-all { + right: auto; + left: 0; +} +#dashboard_right_now p.sub, #dashboard-widgets h4, #dashboard_quick_press h4, a.rsswidget, #dashboard_plugins h4, #dashboard_plugins h5, #dashboard_recent_comments .comment-meta .approve { + font-family: Tahoma, Arial; +} +#dashboard_right_now p.sub { + left:auto; + right:15px; +} +#dashboard_right_now td.b { + padding-right: 0; + padding-left: 6px; + text-align: left; + font-family: Tahoma, Arial; +} +#dashboard_right_now .t { + padding-right: 0; + padding-left: 12px; +} +#dashboard_right_now .table_content { + float:right; +} +#dashboard_right_now .table_discussion { + float:left; +} +#dashboard_right_now .versions a { + font-family: Tahoma, Arial; +} +#dashboard_right_now a.button { + float: left; + clear: left; +} +#dashboard_plugins .inside span { + padding-left: 0; + padding-right: 5px; +} +#dashboard-widgets h3 .postbox-title-action { + right: auto; + left: 30px; +} +#the-comment-list .pingback { + padding-left: 0 !important; + padding-right: 9px !important; +} +/* Recent Comments */ +#the-comment-list .comment-item { + padding: 1em 70px 1em 10px; +} +#the-comment-list .comment-item .avatar { + float: right; + margin-left: 0; + margin-right: -60px; +} +/* Feeds */ +.rss-widget cite { + text-align: left; +} +.rss-widget span.rss-date { + font-family: Tahoma, Arial; + margin-left: 0; + margin-right: 3px; +} +/* QuickPress */ +#dashboard_quick_press h4 { + float: right; + text-align: left; +} +#dashboard_quick_press h4 label { + margin-right: 0; + margin-left: 10px; +} +#dashboard_quick_press .input-text-wrap, #dashboard_quick_press .textarea-wrap { + margin: 0 5em 1em 0; +} +#dashboard_quick_press #media-buttons { + margin: 0 5em .5em 0; + padding: 0 10px 0 0; +} +#dashboard-widgets #dashboard_quick_press form p.submit { + margin-left: 0; + margin-right: 4.6em; +} +#dashboard-widgets #dashboard_quick_press form p.submit input { + float: right; +} +#dashboard-widgets #dashboard_quick_press form p.submit #save-post { + margin: 0 10px 0 1em; +} +#dashboard-widgets #dashboard_quick_press form p.submit #publish { + float: left; +} +#dashboard-widgets #dashboard_quick_press form p.submit img.waiting { + margin: 4px 0 0 6px; +} +/* Recent Drafts */ +#dashboard_recent_drafts h4 abbr { + font-family: Tahoma, Arial; + margin-left:0; + margin-right: 3px; +} \ No newline at end of file diff --git a/src/wp-admin/css/dashboard.css b/src/wp-admin/css/dashboard.css new file mode 100644 index 0000000..e30d686 --- /dev/null +++ b/src/wp-admin/css/dashboard.css @@ -0,0 +1 @@ +.postbox p,.postbox ul,.postbox ol,.postbox blockquote,#wp-version-message{font-size:12px;}.edit-box{display:none;}h3:hover .edit-box{display:inline;}form .input-text-wrap{background:#fff;border-style:solid;border-width:1px;padding:2px 3px;border-color:#ccc;}#dashboard-widgets form .input-text-wrap input{border:0 none;outline:none;margin:0;padding:0;width:99%;color:#333;}form .textarea-wrap{background:#fff;border-style:solid;border-width:1px;padding:2px;border-color:#ccc;}#dashboard-widgets form .textarea-wrap textarea{border:0 none;padding:0;outline:none;width:99%;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box;}#dashboard-widgets .postbox form .submit{float:none;margin:.5em 0 0;padding:0;border:none;}#dashboard-widgets-wrap #dashboard-widgets .postbox form .submit input{margin:0;}#dashboard-widgets-wrap #dashboard-widgets .postbox form .submit #publish{min-width:0;}div.postbox div.inside{margin:10px 0;position:relative;}#dashboard-widgets a{text-decoration:none;}#dashboard-widgets h3 a{text-decoration:underline;}#dashboard-widgets h3 .postbox-title-action{position:absolute;right:30px;padding:0;top:8px;}#dashboard-widgets h4{font-family:Georgia,"Times New Roman","Bitstream Charter",Times,serif;font-weight:normal;font-size:13px;margin:0 0 .2em;padding:0;}#dashboard_right_now p.sub,#dashboard_right_now .table,#dashboard_right_now .versions{margin:-12px;}#dashboard_right_now .inside{font-size:12px;padding-top:20px;}#dashboard_right_now p.sub{padding:5px 0 15px;color:#8f8f8f;font-size:14px;position:absolute;top:-17px;left:15px;}#dashboard_right_now .table{margin:0;padding:0;position:relative;}#dashboard_right_now .table_content{float:left;border-top:#ececec 1px solid;width:45%;}#dashboard_right_now .table_discussion{float:right;border-top:#ececec 1px solid;width:45%;}#dashboard_right_now table td{padding:3px 0;white-space:nowrap;}#dashboard_right_now table tr.first td{border-top:none;}#dashboard_right_now td.b{padding-right:6px;text-align:right;font-family:Georgia,"Times New Roman","Bitstream Charter",Times,serif;font-size:14px;width:1%;}#dashboard_right_now td.b a{font-size:18px;}#dashboard_right_now td.b a:hover{color:#d54e21;}#dashboard_right_now .t{font-size:12px;padding-right:12px;padding-top:6px;color:#777;}#dashboard_right_now .t a{white-space:nowrap;}#dashboard_right_now .spam{color:red;}#dashboard_right_now .waiting{color:#e66f00;}#dashboard_right_now .approved{color:green;}#dashboard_right_now .versions{padding:6px 10px 12px;clear:both;}#dashboard_right_now .versions .b{font-weight:bold;}#dashboard_right_now a.button{float:right;clear:right;position:relative;top:-5px;}#dashboard_recent_comments h3{margin-bottom:0;}#dashboard_recent_comments .inside{margin-top:0;}#dashboard_recent_comments .comment-meta .approve{font-style:italic;font-family:sans-serif;font-size:10px;}#dashboard_recent_comments .subsubsub{float:none;}#the-comment-list{position:relative;}#the-comment-list .comment-item{padding:1em 10px;border-top:1px solid;}#the-comment-list .pingback{padding-left:9px!important;}#the-comment-list .comment-item,#the-comment-list #replyrow{margin:0 -10px;}#the-comment-list .comment-item:first-child{border-top:none;}#the-comment-list .comment-item .avatar{float:left;margin:0 10px 5px 0;}#the-comment-list .comment-item h4{line-height:1.7em;margin-top:-0.4em;color:#777;}#the-comment-list .comment-item h4 cite{font-style:normal;font-weight:normal;}#the-comment-list .comment-item blockquote,#the-comment-list .comment-item blockquote p{margin:0;padding:0;display:inline;}#dashboard_recent_comments #the-comment-list .trackback blockquote,#dashboard_recent_comments #the-comment-list .pingback blockquote{display:block;}#the-comment-list .comment-item p.row-actions{margin:3px 0 0;padding:0;font-size:12px;}#dashboard_quick_press h4{font-family:sans-serif;float:left;width:5.5em;clear:both;font-weight:normal;text-align:right;padding-top:5px;font-size:12px;}#dashboard_quick_press h4 label{margin-right:10px;}#dashboard_quick_press .input-text-wrap,#dashboard_quick_press .textarea-wrap{margin:0 0 1em 5em;}#dashboard_quick_press #media-buttons{margin:0 0 .5em 5em;padding:0 0 0 10px;font-size:12px;line-height:17px;color:#777;}#dashboard_quick_press #media-buttons a{vertical-align:bottom;}#dashboard-widgets #dashboard_quick_press form p.submit{margin-left:4.6em;}#dashboard-widgets #dashboard_quick_press form p.submit input{float:left;}#dashboard-widgets #dashboard_quick_press form p.submit #save-post{margin:0 1em 0 10px;}#dashboard-widgets #dashboard_quick_press form p.submit #publish{float:right;}#dashboard-widgets #dashboard_quick_press form p.submit img.waiting{vertical-align:middle;visibility:hidden;margin:4px 6px 0 0;}#dashboard_recent_drafts ul{margin:0;padding:0;list-style:none;}#dashboard_recent_drafts ul li{margin-bottom:1em;}#dashboard_recent_drafts h4{line-height:1.7em;}#dashboard_recent_drafts h4 abbr{font-weight:normal;font-family:sans-serif;font-size:12px;color:#999;margin-left:3px;}#dashboard_recent_drafts p{margin:0;padding:0;}.rss-widget ul{margin:0;padding:0;list-style:none;}a.rsswidget{font-size:13px;font-family:Georgia,"Times New Roman","Bitstream Charter",Times,serif;line-height:1.7em;}.rss-widget ul li{line-height:1.5em;margin-bottom:12px;}.rss-widget span.rss-date{color:#999;font-size:12px;margin-left:3px;}.rss-widget cite{display:block;text-align:right;margin:0 0 1em;padding:0;}.rss-widget cite:before{content:'\2014';}#dashboard_plugins h4{line-height:1.7em;}#dashboard_plugins h5{font-family:Georgia,"Times New Roman","Bitstream Charter",Times,serif;font-weight:normal;font-size:13px;margin:0;display:inline;line-height:1.4em;}#dashboard_plugins h5 a{line-height:1.4em;}#dashboard_plugins .inside span{font-size:12px;padding-left:5px;}#dashboard_plugins p{margin:.3em 0 1.4em;line-height:1.4em;}.dashboard-comment-wrap{overflow:hidden;word-wrap:break-word;}#dashboard_browser_nag a.update-browser-link{font-size:1.2em;font-weight:bold;}#dashboard_browser_nag a{text-decoration:underline;}#dashboard_browser_nag p.browser-update-nag.has-browser-icon{padding-right:125px;}#dashboard_browser_nag .browser-icon{margin-top:-35px;}#dashboard_browser_nag.postbox.browser-insecure{background-color:#ac1b1b;border-color:#ac1b1b;}#dashboard_browser_nag.postbox{background-color:#e29808;background-image:none;border-color:#edc048;-moz-box-shadow:none;-webkit-box-shadow:none;box-shadow:none;color:#fff;}#dashboard_browser_nag.postbox.browser-insecure h3{border-bottom-color:#cd5a5a;color:#fff;}#dashboard_browser_nag.postbox h3{border-bottom-color:#f6e2ac;text-shadow:none;-moz-box-shadow:none;-webkit-box-shadow:none;box-shadow:none;background:transparent none;color:#fff;}#dashboard_browser_nag a{color:#fff;}#dashboard_browser_nag.browser-insecure a.browse-happy-link,#dashboard_browser_nag.browser-insecure a.update-browser-link{text-shadow:#871b15 0 1px 0;}#dashboard_browser_nag a.browse-happy-link,#dashboard_browser_nag a.update-browser-link{text-shadow:#d29a04 0 1px 0;} \ No newline at end of file diff --git a/src/wp-admin/css/dashboard.dev.css b/src/wp-admin/css/dashboard.dev.css new file mode 100644 index 0000000..8371941 --- /dev/null +++ b/src/wp-admin/css/dashboard.dev.css @@ -0,0 +1,486 @@ +.postbox p, +.postbox ul, +.postbox ol, +.postbox blockquote, +#wp-version-message { + font-size: 12px; +} + +.edit-box { + display: none; +} + +h3:hover .edit-box { + display: inline; +} + +form .input-text-wrap { + background: #fff; + border-style: solid; + border-width: 1px; + padding: 2px 3px; + border-color: #ccc; +} + +#dashboard-widgets form .input-text-wrap input { + border: 0 none; + outline: none; + margin: 0; + padding: 0; + width: 99%; + color: #333; +} + +form .textarea-wrap { + background: #fff; + border-style: solid; + border-width: 1px; + padding: 2px; + border-color: #ccc; +} + +#dashboard-widgets form .textarea-wrap textarea { + border: 0 none; + padding: 0; + outline: none; + width: 99%; + -moz-box-sizing: border-box; + -webkit-box-sizing: border-box; + box-sizing: border-box; +} + +#dashboard-widgets .postbox form .submit { + float: none; + margin: .5em 0 0; + padding: 0; + border: none; +} + +#dashboard-widgets-wrap #dashboard-widgets .postbox form .submit input { + margin: 0; +} + +#dashboard-widgets-wrap #dashboard-widgets .postbox form .submit #publish { + min-width: 0; +} + +div.postbox div.inside { + margin: 10px 0; + position: relative; +} + +#dashboard-widgets a { + text-decoration: none; +} + +#dashboard-widgets h3 a { + text-decoration: underline; +} + +#dashboard-widgets h3 .postbox-title-action { + position: absolute; + right: 30px; + padding: 0; + top: 8px; +} + +#dashboard-widgets h4 { + font-family: Georgia, "Times New Roman", "Bitstream Charter", Times, serif; + font-weight: normal; + font-size: 13px; + margin: 0 0 .2em; + padding: 0; +} + +/* Right Now */ + +#dashboard_right_now p.sub, +#dashboard_right_now .table, #dashboard_right_now .versions { + margin: -12px; +} + +#dashboard_right_now .inside { + font-size: 12px; + padding-top: 20px; +} + +#dashboard_right_now p.sub { + padding: 5px 0 15px; + color: #8f8f8f; + font-size: 14px; + position: absolute; + top: -17px; + left: 15px; +} + +#dashboard_right_now .table { + margin: 0; + padding: 0; + position: relative; +} + +#dashboard_right_now .table_content { + float: left; + border-top: #ececec 1px solid; + width: 45%; +} + +#dashboard_right_now .table_discussion { + float: right; + border-top: #ececec 1px solid; + width: 45%; +} + +#dashboard_right_now table td { + padding: 3px 0; + white-space: nowrap; +} + +#dashboard_right_now table tr.first td { + border-top: none; +} + +#dashboard_right_now td.b { + padding-right: 6px; + text-align: right; + font-family: Georgia, "Times New Roman", "Bitstream Charter", Times, serif; + font-size: 14px; + width: 1%; +} + +#dashboard_right_now td.b a { + font-size: 18px; +} + +#dashboard_right_now td.b a:hover { + color: #d54e21; +} + +#dashboard_right_now .t { + font-size: 12px; + padding-right: 12px; + padding-top: 6px; + color: #777; +} + +#dashboard_right_now .t a { + white-space: nowrap; +} + +#dashboard_right_now .spam { + color: red; +} + +#dashboard_right_now .waiting { + color: #e66f00; +} + +#dashboard_right_now .approved { + color: green; +} + +#dashboard_right_now .versions { + padding: 6px 10px 12px; + clear: both; +} + +#dashboard_right_now .versions .b { + font-weight: bold; +} + +#dashboard_right_now a.button { + float: right; + clear: right; + position: relative; + top: -5px; +} + +/* Recent Comments */ + +#dashboard_recent_comments h3 { + margin-bottom: 0; +} + +#dashboard_recent_comments .inside { + margin-top: 0; +} + +#dashboard_recent_comments .comment-meta .approve { + font-style: italic; + font-family: sans-serif; + font-size: 10px; +} + +#dashboard_recent_comments .subsubsub { + float: none; +} + +#the-comment-list { + position: relative; +} + +#the-comment-list .comment-item { + padding: 1em 10px; + border-top: 1px solid; +} + +#the-comment-list .pingback { + padding-left: 9px !important; +} + +#the-comment-list .comment-item, +#the-comment-list #replyrow { + margin: 0 -10px; +} + +#the-comment-list .comment-item:first-child { + border-top: none; +} + +#the-comment-list .comment-item .avatar { + float: left; + margin: 0 10px 5px 0; +} + +#the-comment-list .comment-item h4 { + line-height: 1.7em; + margin-top: -0.4em; + color: #777; +} + +#the-comment-list .comment-item h4 cite { + font-style: normal; + font-weight: normal; +} + +#the-comment-list .comment-item blockquote, +#the-comment-list .comment-item blockquote p { + margin: 0; + padding: 0; + display: inline; +} + +#dashboard_recent_comments #the-comment-list .trackback blockquote, +#dashboard_recent_comments #the-comment-list .pingback blockquote { + display: block; +} + +#the-comment-list .comment-item p.row-actions { + margin: 3px 0 0; + padding: 0; + font-size: 12px; +} + +/* QuickPress */ + +#dashboard_quick_press h4 { + font-family: sans-serif; + float: left; + width: 5.5em; + clear: both; + font-weight: normal; + text-align: right; + padding-top: 5px; + font-size: 12px; +} + +#dashboard_quick_press h4 label { + margin-right: 10px; +} + +#dashboard_quick_press .input-text-wrap, +#dashboard_quick_press .textarea-wrap { + margin: 0 0 1em 5em; +} + +#dashboard_quick_press #media-buttons { + margin: 0 0 .5em 5em; + padding: 0 0 0 10px; + font-size: 12px; + line-height: 17px; + color: #777; +} + +#dashboard_quick_press #media-buttons a { + vertical-align: bottom; +} + +#dashboard-widgets #dashboard_quick_press form p.submit { + margin-left: 4.6em; +} + +#dashboard-widgets #dashboard_quick_press form p.submit input { + float: left; +} + +#dashboard-widgets #dashboard_quick_press form p.submit #save-post { + margin: 0 1em 0 10px; +} + +#dashboard-widgets #dashboard_quick_press form p.submit #publish { + float: right; +} + +#dashboard-widgets #dashboard_quick_press form p.submit img.waiting { + vertical-align: middle; + visibility: hidden; + margin: 4px 6px 0 0; +} + +/* Recent Drafts */ +#dashboard_recent_drafts ul { + margin: 0; + padding: 0; + list-style: none; +} + +#dashboard_recent_drafts ul li { + margin-bottom: 1em; +} + +#dashboard_recent_drafts h4 { + line-height: 1.7em; +} + +#dashboard_recent_drafts h4 abbr { + font-weight: normal; + font-family: sans-serif; + font-size: 12px; + color: #999; + margin-left: 3px; +} + +#dashboard_recent_drafts p { + margin: 0; + padding: 0; +} + +/* Feeds */ + +.rss-widget ul { + margin: 0; + padding: 0; + list-style: none; +} + +a.rsswidget { + font-size: 13px; + font-family: Georgia, "Times New Roman", "Bitstream Charter", Times, serif; + line-height: 1.7em; +} + +.rss-widget ul li { + line-height: 1.5em; + margin-bottom: 12px; +} + +.rss-widget span.rss-date { + color: #999; + font-size: 12px; + margin-left: 3px; +} + +.rss-widget cite { + display: block; + text-align: right; + margin: 0 0 1em; + padding: 0; +} + +.rss-widget cite:before { + content: '\2014'; +} + +/* Plugins */ +#dashboard_plugins h4 { + line-height: 1.7em; +} +#dashboard_plugins h5 { + font-family: Georgia, "Times New Roman", "Bitstream Charter", Times, serif; + font-weight: normal; + font-size: 13px; + margin: 0; + display: inline; + line-height: 1.4em; +} + +#dashboard_plugins h5 a { + line-height: 1.4em; +} + +#dashboard_plugins .inside span { + font-size: 12px; + padding-left: 5px; +} + +#dashboard_plugins p { + margin: 0.3em 0 1.4em; + line-height: 1.4em; +} + +.dashboard-comment-wrap { + overflow: hidden; + word-wrap: break-word; +} + +/* Browser Nag */ +#dashboard_browser_nag a.update-browser-link { + font-size: 1.2em; + font-weight: bold; +} + +#dashboard_browser_nag a { + text-decoration: underline; +} + +#dashboard_browser_nag p.browser-update-nag.has-browser-icon { + padding-right: 125px; +} + +#dashboard_browser_nag .browser-icon { + margin-top: -35px; +} + +#dashboard_browser_nag.postbox.browser-insecure { + background-color: #ac1b1b; + border-color: #ac1b1b; +} + +#dashboard_browser_nag.postbox { + background-color: #e29808; + background-image: none; + border-color: #edc048; + -moz-box-shadow: none; + -webkit-box-shadow: none; + box-shadow: none; + color: #fff; +} + +#dashboard_browser_nag.postbox.browser-insecure h3 { + border-bottom-color: #cd5a5a; + color: #fff; +} + +#dashboard_browser_nag.postbox h3 { + border-bottom-color: #f6e2ac; + text-shadow: none; + -moz-box-shadow: none; + -webkit-box-shadow: none; + box-shadow: none; + background: transparent none; + color: #fff; +} + +#dashboard_browser_nag a { + color: #fff; +} + +#dashboard_browser_nag.browser-insecure a.browse-happy-link, +#dashboard_browser_nag.browser-insecure a.update-browser-link { + text-shadow: #871b15 0 1px 0; +} + +#dashboard_browser_nag a.browse-happy-link, +#dashboard_browser_nag a.update-browser-link { + text-shadow: #d29a04 0 1px 0; +} diff --git a/src/wp-admin/css/farbtastic-rtl.css b/src/wp-admin/css/farbtastic-rtl.css new file mode 100644 index 0000000..7a8badb --- /dev/null +++ b/src/wp-admin/css/farbtastic-rtl.css @@ -0,0 +1,7 @@ +.farbtastic .color, .farbtastic .overlay { + left: 0; + right: 47px; +} +.farbtastic .marker { + margin: -8px -8px 0 0; +} diff --git a/src/wp-admin/css/farbtastic.css b/src/wp-admin/css/farbtastic.css new file mode 100644 index 0000000..71ad3c1 --- /dev/null +++ b/src/wp-admin/css/farbtastic.css @@ -0,0 +1,32 @@ +.farbtastic { + position: relative; +} +.farbtastic * { + position: absolute; + cursor: crosshair; +} +.farbtastic, .farbtastic .wheel { + width: 195px; + height: 195px; +} +.farbtastic .color, .farbtastic .overlay { + top: 47px; + left: 47px; + width: 101px; + height: 101px; +} +.farbtastic .wheel { + background: url(../images/wheel.png) no-repeat; + width: 195px; + height: 195px; +} +.farbtastic .overlay { + background: url(../images/mask.png) no-repeat; +} +.farbtastic .marker { + width: 17px; + height: 17px; + margin: -8px 0 0 -8px; + overflow: hidden; + background: url(../images/marker.png) no-repeat; +} \ No newline at end of file diff --git a/src/wp-admin/css/global-rtl.css b/src/wp-admin/css/global-rtl.css new file mode 100644 index 0000000..0a5a8b7 --- /dev/null +++ b/src/wp-admin/css/global-rtl.css @@ -0,0 +1 @@ +#wpcontent{margin-left:0;margin-right:165px;}.wp-admin #footer{margin-left:15px;margin-right:165px;}.js.folded #wpcontent{margin-left:0;margin-right:52px;}.js.folded.wp-admin #footer{margin-left:15px;margin-right:52px;}#wpbody-content{float:right;}#adminmenuwrap{float:right;}#adminmenu{clear:right;}.inner-sidebar{float:left;clear:left;}.has-right-sidebar #post-body{float:right;clear:right;margin-right:0;margin-left:-340px;}.has-right-sidebar #post-body-content{margin-right:0;margin-left:300px;}#col-right{float:left;clear:left;}.alignleft{float:right;}.alignright{float:left;}.textleft{text-align:right;}.textright{text-align:left;}.screen-reader-text,.screen-reader-text span{left:auto;right:-1000em;}body,td,textarea,input,select{font-family:Tahoma,Arial,sans-serif;}ul.ul-disc,ul.ul-square,ol.ol-decimal{margin-left:0;margin-right:1.8em;}.subsubsub{float:right;}.widefat thead th:first-of-type{-moz-border-radius-topleft:0;-moz-border-radius-topright:3px;-khtml-border-top-left-radius:0;-khtml-border-top-right-radius:3px;-webkit-border-top-left-radius:0;-webkit-border-top-right-radius:3px;border-top-left-radius:0;border-top-right-radius:3px;}.widefat thead th:last-of-type{-moz-border-radius-topright:0;-moz-border-radius-topleft:3px;-khtml-border-top-right-radius:0;-khtml-border-top-left-radius:3px;-webkit-border-top-right-radius:0;-webkit-border-top-left-radius:3px;border-top-right-radius:0;border-top-left-radius:3px;}.widefat tfoot th:first-of-type{-moz-border-radius-bottomleft:0;-moz-border-radius-bottomright:3px;-khtml-border-bottom-left-radius:0;-khtml-border-bottom-right-radius:3px;-webkit-border-bottom-left-radius:0;-webkit-border-bottom-right-radius:3px;border-bottom-left-radius:0;border-bottom-right-radius:3px;}.widefat tfoot th:last-of-type{-moz-border-radius-bottomright:0;-moz-border-radius-bottomleft:3px;-khtml-border-bottom-right-radius:0;-khtml-border-bottom-left-radius:3px;-webkit-border-bottom-right-radius:0;-webkit-border-bottom-left-radius:3px;border-bottom-right-radius:0;border-bottom-left-radius:3px;}.widefat th{text-align:right;}.widefat th input{margin:0 8px 0 0;}.wrap{margin:0 0 0 15px;}.wrap h2,.subtitle{font-family:Tahoma,Arial,sans-serif;}.wrap h2{padding:9px 0 4px 15px;}.subtitle{padding-left:0;padding-right:25px;}.wrap .add-new-h2{font-family:Tahoma,Arial,sans-serif;margin-left:0;margin-right:4px;}.wrap h2.long-header{padding-left:0;} \ No newline at end of file diff --git a/src/wp-admin/css/global-rtl.dev.css b/src/wp-admin/css/global-rtl.dev.css new file mode 100644 index 0000000..7907b6b --- /dev/null +++ b/src/wp-admin/css/global-rtl.dev.css @@ -0,0 +1,181 @@ + +/* 2 column liquid layout */ + +#wpcontent { + margin-left: 0; + margin-right: 165px; +} + +.wp-admin #footer { + margin-left: 15px; + margin-right: 165px; +} + +.js.folded #wpcontent { + margin-left: 0; + margin-right: 52px; +} + +.js.folded.wp-admin #footer { + margin-left: 15px; + margin-right: 52px; +} + +#wpbody-content { + float: right; +} + +#adminmenuwrap { + float: right; +} + +#adminmenu { + clear: right; +} + +/* inner 2 column liquid layout */ +.inner-sidebar { + float: left; + clear: left; +} + +.has-right-sidebar #post-body { + float: right; + clear: right; + margin-right: 0; + margin-left: -340px; +} + +.has-right-sidebar #post-body-content { + margin-right: 0; + margin-left: 300px; +} + +/* 2 columns main area */ + +#col-right { + float: left; + clear: left; +} + +/* utility classes*/ +.alignleft { + float: right; +} + +.alignright { + float: left; +} + +.textleft { + text-align: right; +} + +.textright { + text-align: left; +} + +/* Hide visually but not from screen readers */ +.screen-reader-text, .screen-reader-text span { + left: auto; + right: -1000em; +} + +/* styles for use by people extending the WordPress interface */ + +body, +td, +textarea, +input, +select { + font-family: Tahoma, Arial, sans-serif; +} + +ul.ul-disc, +ul.ul-square, +ol.ol-decimal { + margin-left: 0; + margin-right: 1.8em; +} + +.subsubsub { + float: right; +} + +.widefat thead th:first-of-type { + -moz-border-radius-topleft: 0; + -moz-border-radius-topright: 3px; + -khtml-border-top-left-radius: 0; + -khtml-border-top-right-radius: 3px; + -webkit-border-top-left-radius: 0; + -webkit-border-top-right-radius: 3px; + border-top-left-radius: 0; + border-top-right-radius: 3px; +} + +.widefat thead th:last-of-type { + -moz-border-radius-topright: 0; + -moz-border-radius-topleft: 3px; + -khtml-border-top-right-radius: 0; + -khtml-border-top-left-radius: 3px; + -webkit-border-top-right-radius: 0; + -webkit-border-top-left-radius: 3px; + border-top-right-radius: 0; + border-top-left-radius: 3px; +} +.widefat tfoot th:first-of-type { + -moz-border-radius-bottomleft: 0; + -moz-border-radius-bottomright: 3px; + -khtml-border-bottom-left-radius: 0; + -khtml-border-bottom-right-radius: 3px; + -webkit-border-bottom-left-radius: 0; + -webkit-border-bottom-right-radius: 3px; + border-bottom-left-radius: 0; + border-bottom-right-radius: 3px; +} +.widefat tfoot th:last-of-type { + -moz-border-radius-bottomright: 0; + -moz-border-radius-bottomleft: 3px; + -khtml-border-bottom-right-radius: 0; + -khtml-border-bottom-left-radius: 3px; + -webkit-border-bottom-right-radius: 0; + -webkit-border-bottom-left-radius: 3px; + border-bottom-right-radius: 0; + border-bottom-left-radius: 3px; +} + +.widefat th { + text-align: right; +} + +.widefat th input { + margin: 0 8px 0 0; +} + +.wrap { + margin: 0 0 0 15px; +} + + +.wrap h2, +.subtitle { + font-family: Tahoma, Arial, sans-serif; +} +.wrap h2 { + padding: 9px 0 4px 15px; +} + +.subtitle { + padding-left: 0; + padding-right: 25px; +} + +.wrap .add-new-h2 { + font-family: Tahoma, Arial, sans-serif; + margin-left: 0; + margin-right: 4px; +} + +.wrap h2.long-header { + padding-left: 0; +} diff --git a/src/wp-admin/css/global.css b/src/wp-admin/css/global.css new file mode 100644 index 0000000..739d365 --- /dev/null +++ b/src/wp-admin/css/global.css @@ -0,0 +1 @@ +html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,font,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td{margin:0;padding:0;border:0;outline:0;background:transparent;}body{line-height:1;}ol,ul{list-style:none;}blockquote,q{quotes:none;}blockquote:before,blockquote:after,q:before,q:after{content:'';content:none;}ins{text-decoration:none;}del{text-decoration:line-through;}#wpwrap{height:auto;min-height:100%;width:100%;position:relative;}#wpcontent{height:100%;}#wpcontent,#footer{margin-left:165px;}#wpbody-content{padding-bottom:65px;}.js.folded #wpcontent,.js.folded #footer{margin-left:52px;}#wpbody-content{float:left;width:100%;}#adminmenuback,#adminmenuwrap,#adminmenu,.js.folded #adminmenu .wp-submenu.sub-open,.js.folded #adminmenu .wp-submenu-wrap{width:145px;}#adminmenuback{position:absolute;top:0;bottom:0;z-index:-1;}#adminmenuwrap{float:left;}#adminmenu{clear:left;padding:0;list-style:none;}.js.folded #adminmenuback,.js.folded #adminmenuwrap,.js.folded #adminmenu,.js.folded #adminmenu li.menu-top{width:32px;}#footer{position:relative;}.inner-sidebar{float:right;clear:right;display:none;width:281px;position:relative;}.inner-sidebar #side-sortables{width:280px;min-height:300px;}.has-right-sidebar .inner-sidebar{display:block;}.has-right-sidebar #post-body{float:left;clear:left;width:100%;margin-right:-340px;}.has-right-sidebar #post-body-content{margin-right:300px;}#col-container{overflow:hidden;padding:0;margin:0;}#col-left{padding:0;margin:0;overflow:hidden;width:39%;}#col-right{float:right;clear:right;overflow:hidden;padding:0;margin:0;width:59%;}.alignleft{float:left;}.alignright{float:right;}.textleft{text-align:left;}.textright{text-align:right;}.clear{clear:both;}.screen-reader-text,.screen-reader-text span{position:absolute;left:-1000em;height:1px;width:1px;overflow:hidden;}.hidden,.js .closed .inside,.js .hide-if-js,.no-js .hide-if-no-js{display:none;}input[type="text"],input[type="password"],textarea{-moz-box-sizing:border-box;-webkit-box-sizing:border-box;-ms-box-sizing:border-box;box-sizing:border-box;}input[type="checkbox"],input[type="radio"]{vertical-align:middle;}html,body{height:100%;}body,td,textarea,input,select{font-family:sans-serif;font-size:13px;}body,textarea{line-height:1.4em;}input,select{line-height:15px;}p{margin:1em 0;}blockquote{margin:1em;}label{cursor:pointer;}li,dd{margin-bottom:6px;}p,li,dl,dd,dt{line-height:140%;}textarea,input,select{margin:1px;padding:3px;}h1{display:block;font-size:2em;font-weight:bold;margin:.67em 0;}h2{display:block;font-size:1.5em;font-weight:bold;margin:.83em 0;}h3{display:block;font-size:1.17em;font-weight:bold;margin:1em 0;}h4{display:block;font-size:1em;font-weight:bold;margin:1.33em 0;}h5{display:block;font-size:.83em;font-weight:bold;margin:1.67em 0;}h6{display:block;font-size:.67em;font-weight:bold;margin:2.33em 0;}ul.ul-disc{list-style:disc outside;}ul.ul-square{list-style:square outside;}ol.ol-decimal{list-style:decimal outside;}ul.ul-disc,ul.ul-square,ol.ol-decimal{margin-left:1.8em;}ul.ul-disc>li,ul.ul-square>li,ol.ol-decimal>li{margin:0 0 .5em;}.subsubsub{list-style:none;margin:8px 0 5px;padding:0;white-space:nowrap;font-size:12px;float:left;}.subsubsub a{line-height:2;padding:.2em;text-decoration:none;}.subsubsub a .count,.subsubsub a.current .count{color:#999;font-weight:normal;}.subsubsub a.current{font-weight:bold;background:none;border:none;}.subsubsub li{display:inline;margin:0;padding:0;}.widefat{border-width:1px;border-style:solid;border-spacing:0;width:100%;clear:both;margin:0;-moz-border-radius:3px;-khtml-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;}.widefat *{word-wrap:break-word;}.widefat a{text-decoration:none;}.widefat thead th:first-of-type{-moz-border-radius-topleft:3px;-khtml-border-top-left-radius:3px;-webkit-border-top-left-radius:3px;border-top-left-radius:3px;}.widefat thead th:last-of-type{-moz-border-radius-topright:3px;-khtml-border-top-right-radius:3px;-webkit-border-top-right-radius:3px;border-top-right-radius:3px;}.widefat tfoot th:first-of-type{-moz-border-radius-bottomleft:3px;-khtml-border-bottom-left-radius:3px;-webkit-border-bottom-left-radius:3px;border-bottom-left-radius:3px;}.widefat tfoot th:last-of-type{-moz-border-radius-bottomright:3px;-khtml-border-bottom-right-radius:3px;-webkit-border-bottom-right-radius:3px;border-bottom-right-radius:3px;}.widefat td,.widefat th{border-width:1px 0;border-style:solid;}.widefat tfoot th{border-bottom:none;}.widefat .no-items td{border-bottom-width:0;}.widefat td{font-size:12px;padding:4px 7px 2px;vertical-align:top;}.widefat td p,.widefat td ol,.widefat td ul{font-size:12px;}.widefat th{padding:7px 7px 8px;text-align:left;line-height:1.3em;font-size:14px;}.widefat th input{margin:0 0 0 8px;padding:0;vertical-align:text-top;}.widefat .check-column{width:2.2em;padding:11px 0 0;vertical-align:top;}.widefat tbody th.check-column{padding:9px 0 22px;}.widefat .num,.column-comments,.column-links,.column-posts{text-align:center;}.widefat th#comments{vertical-align:middle;}.wrap{margin:0 15px 0 0;}div.updated,div.error{border-width:1px;border-style:solid;padding:0 .6em;margin:5px 15px 2px;-moz-border-radius:3px;-khtml-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;}div.updated p,div.error p{margin:.5em 0;padding:2px;}.wrap div.updated,.wrap div.error{margin:5px 0 15px;}.wrap h2,.subtitle{font-family:"HelveticaNeue-Light","Helvetica Neue Light","Helvetica Neue",sans-serif;font-weight:normal;margin:0;text-shadow:rgba(255,255,255,1) 0 1px 0;}.wrap h2{font-size:23px;padding:9px 15px 4px 0;line-height:29px;}.subtitle{font-size:14px;padding-left:25px;}.wrap .add-new-h2{font-family:sans-serif;margin-left:4px;padding:3px 8px;position:relative;top:-3px;-moz-border-radius:3px;-khtml-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;text-decoration:none;font-size:12px;}.wrap h2.long-header{padding-right:0;}.fade-1000{opacity:0;-moz-transition-property:opacity;-moz-transition-duration:1s;-webkit-transition-property:opacity;-webkit-transition-duration:1s;-o-transition-property:opacity;-o-transition-duration:1s;transition-property:opacity;transition-duration:1s;}.fade-600{opacity:0;-moz-transition-property:opacity;-moz-transition-duration:.6s;-webkit-transition-property:opacity;-webkit-transition-duration:.6s;-o-transition-property:opacity;-o-transition-duration:.6s;transition-property:opacity;transition-duration:.6s;}.fade-400{opacity:0;-moz-transition-property:opacity;-moz-transition-duration:.4s;-webkit-transition-property:opacity;-webkit-transition-duration:.4s;-o-transition-property:opacity;-o-transition-duration:.4s;transition-property:opacity;transition-duration:.4s;}.fade-300{opacity:0;-moz-transition-property:opacity;-moz-transition-duration:.3s;-webkit-transition-property:opacity;-webkit-transition-duration:.3s;-o-transition-property:opacity;-o-transition-duration:.3s;transition-property:opacity;transition-duration:.3s;}.fade-trigger{opacity:1;} \ No newline at end of file diff --git a/src/wp-admin/css/global.dev.css b/src/wp-admin/css/global.dev.css new file mode 100644 index 0000000..1a74f12 --- /dev/null +++ b/src/wp-admin/css/global.dev.css @@ -0,0 +1,607 @@ +/* http://meyerweb.com/eric/tools/css/reset/ */ +/* v1.0 | 20080212 */ + +html, body, div, span, applet, object, iframe, +h1, h2, h3, h4, h5, h6, p, blockquote, pre, +a, abbr, acronym, address, big, cite, code, +del, dfn, em, font, img, ins, kbd, q, s, samp, +small, strike, strong, sub, sup, tt, var, +b, u, i, center, +dl, dt, dd, ol, ul, li, +fieldset, form, label, legend, +table, caption, tbody, tfoot, thead, tr, th, td { + margin: 0; + padding: 0; + border: 0; + outline: 0; +/* font-size: 100%; + vertical-align: baseline; */ + background: transparent; +} +body { + line-height: 1; +} +ol, ul { + list-style: none; +} +blockquote, q { + quotes: none; +} +blockquote:before, blockquote:after, +q:before, q:after { + content: ''; + content: none; +} + +/* remember to define focus styles! */ +/* +:focus { + outline: 0; +} +*/ +/* remember to highlight inserts somehow! */ +ins { + text-decoration: none; +} +del { + text-decoration: line-through; +} + +/* tables still need 'cellspacing="0"' in the markup */ +/* +table { + border-collapse: collapse; + border-spacing: 0; +} +*/ +/* end reset css */ + + +/* 2 column liquid layout */ +#wpwrap { + height: auto; + min-height: 100%; + width: 100%; + position: relative; +} + +#wpcontent { + height: 100%; +} + +#wpcontent, +#footer { + margin-left: 165px; +} + +#wpbody-content { + padding-bottom: 65px; +} + +.js.folded #wpcontent, +.js.folded #footer { + margin-left: 52px; +} + +#wpbody-content { + float: left; + width: 100%; +} + +#adminmenuback, +#adminmenuwrap, +#adminmenu, +.js.folded #adminmenu .wp-submenu.sub-open, +.js.folded #adminmenu .wp-submenu-wrap { + width: 145px; +} + +#adminmenuback { + position: absolute; + top: 0; + bottom: 0; + z-index: -1; +} + +#adminmenuwrap { + float: left; +} + +#adminmenu { + clear: left; + padding: 0; + list-style: none; +} + +.js.folded #adminmenuback, +.js.folded #adminmenuwrap, +.js.folded #adminmenu, +.js.folded #adminmenu li.menu-top { + width: 32px; +} + +#footer { + position: relative; +} + +/* inner 2 column liquid layout */ +.inner-sidebar { + float: right; + clear: right; + display: none; + width: 281px; + position: relative; +} + +.inner-sidebar #side-sortables { + width: 280px; + min-height: 300px; +} + +.has-right-sidebar .inner-sidebar { + display: block; +} + +.has-right-sidebar #post-body { + float: left; + clear: left; + width: 100%; + margin-right: -340px; +} + +.has-right-sidebar #post-body-content { + margin-right: 300px; +} + +/* 2 columns main area */ + +#col-container { + overflow: hidden; + padding: 0; + margin: 0; +} + +#col-left { + padding: 0; + margin: 0; + overflow: hidden; + width: 39%; +} + +#col-right { + float: right; + clear: right; + overflow: hidden; + padding: 0; + margin: 0; + width: 59%; +} + +/* utility classes */ +.alignleft { + float: left; +} + +.alignright { + float: right; +} + +.textleft { + text-align: left; +} + +.textright { + text-align: right; +} + +.clear { + clear: both; +} + +/* Hide visually but not from screen readers */ +.screen-reader-text, +.screen-reader-text span { + position: absolute; + left: -1000em; + height: 1px; + width: 1px; + overflow: hidden; +} + +.hidden, +.js .closed .inside, +.js .hide-if-js, +.no-js .hide-if-no-js { + display: none; +} + +/* include margin and padding in the width calculation of input and textarea */ +input[type="text"], +input[type="password"], +textarea { + -moz-box-sizing: border-box; + -webkit-box-sizing: border-box; + -ms-box-sizing: border-box; /* ie8 only */ + box-sizing: border-box; +} + +input[type="checkbox"], +input[type="radio"] { + vertical-align: middle; +} + +/* styles for use by people extending the WordPress interface */ +html, +body { + height: 100%; +} + +body, +td, +textarea, +input, +select { + font-family: sans-serif; + font-size: 13px; +} + +body, +textarea { + line-height: 1.4em; +} + +input, +select { + line-height: 15px; +} + +p { + margin: 1em 0; +} + +blockquote { + margin: 1em; +} + +label { + cursor: pointer; +} + +li, +dd { + margin-bottom: 6px; +} + +p, +li, +dl, +dd, +dt { + line-height: 140%; +} + +textarea, +input, +select { + margin: 1px; + padding: 3px; +} + +h1 { + display: block; + font-size: 2em; + font-weight: bold; + margin: .67em 0; +} + +h2 { + display: block; + font-size: 1.5em; + font-weight: bold; + margin: .83em 0; +} + +h3 { + display: block; + font-size: 1.17em; + font-weight: bold; + margin: 1em 0; +} + +h4 { + display: block; + font-size: 1em; + font-weight: bold; + margin: 1.33em 0; +} + +h5 { + display: block; + font-size: 0.83em; + font-weight: bold; + margin: 1.67em 0; +} + +h6 { + display: block; + font-size: 0.67em; + font-weight: bold; + margin: 2.33em 0; +} + +ul.ul-disc { + list-style: disc outside; +} + +ul.ul-square { + list-style: square outside; +} + +ol.ol-decimal { + list-style: decimal outside; +} + +ul.ul-disc, +ul.ul-square, +ol.ol-decimal { + margin-left: 1.8em; +} + +ul.ul-disc > li, +ul.ul-square > li, +ol.ol-decimal > li { + margin: 0 0 0.5em; +} + +.subsubsub { + list-style: none; + margin: 8px 0 5px; + padding: 0; + white-space: nowrap; + font-size: 12px; + float: left; +} + +.subsubsub a { + line-height: 2; + padding: .2em; + text-decoration: none; +} + +.subsubsub a .count, .subsubsub a.current .count { + color: #999; + font-weight: normal; +} + +.subsubsub a.current { + font-weight: bold; + background: none; + border: none; +} + +.subsubsub li { + display: inline; + margin: 0; + padding: 0; +} + +.widefat { + border-width: 1px; + border-style: solid; + border-spacing: 0; + width: 100%; + clear: both; + margin: 0; + -moz-border-radius: 3px; + -khtml-border-radius: 3px; + -webkit-border-radius: 3px; + border-radius: 3px; +} + +.widefat * { + word-wrap: break-word; +} + +.widefat a { + text-decoration: none; +} + +.widefat thead th:first-of-type { + -moz-border-radius-topleft: 3px; + -khtml-border-top-left-radius: 3px; + -webkit-border-top-left-radius: 3px; + border-top-left-radius: 3px; +} +.widefat thead th:last-of-type { + -moz-border-radius-topright: 3px; + -khtml-border-top-right-radius: 3px; + -webkit-border-top-right-radius: 3px; + border-top-right-radius: 3px; +} +.widefat tfoot th:first-of-type { + -moz-border-radius-bottomleft: 3px; + -khtml-border-bottom-left-radius: 3px; + -webkit-border-bottom-left-radius: 3px; + border-bottom-left-radius: 3px; +} +.widefat tfoot th:last-of-type { + -moz-border-radius-bottomright: 3px; + -khtml-border-bottom-right-radius: 3px; + -webkit-border-bottom-right-radius: 3px; + border-bottom-right-radius: 3px; +} + +.widefat td, +.widefat th { + border-width: 1px 0; + border-style: solid; +} +.widefat tfoot th { + border-bottom: none; +} + +.widefat .no-items td { + border-bottom-width: 0; +} + +.widefat td { + font-size: 12px; + padding: 4px 7px 2px; + vertical-align: top; +} + +.widefat td p, +.widefat td ol, +.widefat td ul { + font-size: 12px; +} + +.widefat th { + padding: 7px 7px 8px; + text-align: left; + line-height: 1.3em; + font-size: 14px; +} + +.widefat th input { + margin: 0 0 0 8px; + padding: 0; + vertical-align: text-top; +} + +.widefat .check-column { + width: 2.2em; + padding: 11px 0 0; + vertical-align: top; +} + +.widefat tbody th.check-column { + padding: 9px 0 22px; +} + +.widefat .num, +.column-comments, +.column-links, +.column-posts { + text-align: center; +} + +.widefat th#comments { + vertical-align: middle; +} + +.wrap { + margin: 0 15px 0 0; +} + +div.updated, +div.error { + border-width: 1px; + border-style: solid; + padding: 0 0.6em; + margin: 5px 15px 2px; + -moz-border-radius: 3px; + -khtml-border-radius: 3px; + -webkit-border-radius: 3px; + border-radius: 3px; +} + +div.updated p, +div.error p { + margin: 0.5em 0; + padding: 2px; +} + +.wrap div.updated, +.wrap div.error { + margin: 5px 0 15px; +} + +.wrap h2, +.subtitle { + font-family: "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", sans-serif; + font-weight: normal; + margin: 0; + text-shadow: rgba(255,255,255,1) 0 1px 0; +} +.wrap h2 { + font-size: 23px; + padding: 9px 15px 4px 0; + line-height: 29px; +} +.subtitle { + font-size: 14px; + padding-left: 25px; +} +.wrap .add-new-h2 { + font-family: sans-serif; + margin-left: 4px; + padding: 3px 8px; + position: relative; + top: -3px; + -moz-border-radius: 3px; + -khtml-border-radius: 3px; + -webkit-border-radius: 3px; + border-radius: 3px; + text-decoration: none; + font-size: 12px; +} + +.wrap h2.long-header { + padding-right: 0; +} + + +/* =CSS 3 transitions +-------------------------------------------------------------- */ +.fade-1000 { + opacity: 0; + -moz-transition-property: opacity; + -moz-transition-duration: 1s; + -webkit-transition-property: opacity; + -webkit-transition-duration: 1s; + -o-transition-property: opacity; + -o-transition-duration: 1s; + transition-property: opacity; + transition-duration: 1s; +} + +.fade-600 { + opacity: 0; + -moz-transition-property: opacity; + -moz-transition-duration: 0.6s; + -webkit-transition-property: opacity; + -webkit-transition-duration: 0.6s; + -o-transition-property: opacity; + -o-transition-duration: 0.6s; + transition-property: opacity; + transition-duration: 0.6s; +} + +.fade-400 { + opacity: 0; + -moz-transition-property: opacity; + -moz-transition-duration: 0.4s; + -webkit-transition-property: opacity; + -webkit-transition-duration: 0.4s; + -o-transition-property: opacity; + -o-transition-duration: 0.4s; + transition-property: opacity; + transition-duration: 0.4s; +} + +.fade-300 { + opacity: 0; + -moz-transition-property: opacity; + -moz-transition-duration: 0.3s; + -webkit-transition-property: opacity; + -webkit-transition-duration: 0.3s; + -o-transition-property: opacity; + -o-transition-duration: 0.3s; + transition-property: opacity; + transition-duration: 0.3s; +} + +.fade-trigger { + opacity: 1; +} diff --git a/src/wp-admin/css/ie-rtl.css b/src/wp-admin/css/ie-rtl.css new file mode 100644 index 0000000..40f5b76 --- /dev/null +++ b/src/wp-admin/css/ie-rtl.css @@ -0,0 +1 @@ +html{direction:ltr;}body{direction:rtl;}* html #wpcontent #adminmenu .wp-has-submenu .wp-menu-toggle{background:url(../images/menu-bits-rtl.gif?ver=20100531) no-repeat scroll right -109px;}* html #wpcontent #adminmenu li.wp-has-current-submenu .wp-menu-toggle{background:url(../images/menu-bits-rtl.gif?ver=20100531) no-repeat scroll right -206px;}* html #adminmenu{margin-left:0;margin-right:-80px;}* html div.folded #adminmenu{margin-left:0;margin-right:-22px;}#wpcontent #adminmenu .wp-submenu li.wp-submenu-head{padding:3px 10px 4px 4px;}.inline-edit-row fieldset label span.title{float:right;}.inline-edit-row fieldset label span.input-text-wrap{margin-right:0;}p.search-box{float:left;}* html #poststuff h2{margin-right:0;}#bh{margin:7px 10px 0 0;float:left;}#user_info+div#favorite-actions{right:auto;left:15px;}#wphead-info{float:left;}div#dashboard-widgets{padding-right:0;padding-left:1px;}.tagchecklist span a{margin:4px -9px 0 0;}.widefat th input{margin:0 5px 0 0;}#TB_window{width:670px;position:absolute;top:50%;left:50%;margin-right:335px!important;}#dashboard_plugins{direction:ltr;}#dashboard_plugins h3.hndle{direction:rtl;}#dashboard_incoming_links ul li,#dashboard_secondary ul li,#dashboard_primary ul li,p.row-actions{width:100%;}#favorite-inside{position:absolute;right:0;}#post-status-info{height:25px;}#screen-meta{position:static;}p.submit{height:22px;}.inner-sidebar{position:static;}form#widgets-filter{position:static;}* html .meta-box-sortables .postbox .handlediv{background:transparent url(../images/menu-bits-rtl-vs.gif) no-repeat scroll right -111px;}.menu-max-depth-0 #menu-management{width:460px;}.menu-max-depth-1 #menu-management{width:490px;}.menu-max-depth-2 #menu-management{width:520px;}.menu-max-depth-3 #menu-management{width:550px;}.menu-max-depth-4 #menu-management{width:580px;}.menu-max-depth-5 #menu-management{width:610px;}.menu-max-depth-6 #menu-management{width:640px;}.menu-max-depth-7 #menu-management{width:670px;}.menu-max-depth-8 #menu-management{width:700px;}.menu-max-depth-9 #menu-management{width:730px;}.menu-max-depth-10 #menu-management{width:760px;}.menu-max-depth-11 #menu-management{width:790px;}.menu-item-depth-0{margin-left:0;}.menu-item-depth-1{margin-left:-30px;}.menu-item-depth-2{margin-left:-60px;}.menu-item-depth-3{margin-left:-90px;}.menu-item-depth-4{margin-left:-120px;}.menu-item-depth-5{margin-left:-150px;}.menu-item-depth-6{margin-left:-180px;}.menu-item-depth-7{margin-left:-210px;}.menu-item-depth-8{margin-left:-240px;}.menu-item-depth-9{margin-left:-270px;}.menu-item-depth-10{margin-left:-300px;}.menu-item-depth-11{margin-left:-330px;}#menu-to-edit li dl{padding:0!important;margin:0!important;}.ui-sortable-helper .menu-item-transport{margin-top:13px;}.ui-sortable-helper .menu-item-transport .menu-item-transport{margin-top:0;}.sortable-placeholder{margin-top:0!important;margin-left:0!important;margin-bottom:13px!important;padding:0!important;}.auto-add-pages{clear:both;float:none;}#nav-menus-frame .open-label span{float:none;display:inline-block;}#nav-menus-frame .delete-action{float:none;} \ No newline at end of file diff --git a/src/wp-admin/css/ie-rtl.dev.css b/src/wp-admin/css/ie-rtl.dev.css new file mode 100644 index 0000000..c35fc89 --- /dev/null +++ b/src/wp-admin/css/ie-rtl.dev.css @@ -0,0 +1,156 @@ +html { + direction: ltr; +} +body { + direction: rtl; +} +* html #wpcontent #adminmenu .wp-has-submenu .wp-menu-toggle { + background: url(../images/menu-bits-rtl.gif?ver=20100531) no-repeat scroll right -109px; +} + +* html #wpcontent #adminmenu li.wp-has-current-submenu .wp-menu-toggle { + background: url(../images/menu-bits-rtl.gif?ver=20100531) no-repeat scroll right -206px; +} +* html #adminmenu { + margin-left:0; + margin-right: -80px; +} +* html div.folded #adminmenu { + margin-left: 0; + margin-right: -22px; +} +#wpcontent #adminmenu .wp-submenu li.wp-submenu-head { + padding: 3px 10px 4px 4px; +} +.inline-edit-row fieldset label span.title { + float: right; +} +.inline-edit-row fieldset label span.input-text-wrap { + margin-right: 0; +} +p.search-box { + float: left; +} +* html #poststuff h2 { + margin-right: 0; +} +#bh { + margin: 7px 10px 0 0; + float: left; +} +#user_info + div#favorite-actions { + right: auto; + left: 15px; +} +#wphead-info { + float: left; +} +/* without this dashboard widgets appear in one column for some screen widths */ +div#dashboard-widgets { + padding-right: 0; + padding-left: 1px; +} +.tagchecklist span a { + margin: 4px -9px 0 0; +} +.widefat th input { + margin: 0 5px 0 0; +} +/* ---------- add by navid */ +#TB_window { + width: 670px; + position: absolute; + top: 50%; + left: 50%; + margin-right: 335px !important; +} +#dashboard_plugins { + direction: ltr; +} +#dashboard_plugins h3.hndle { + direction: rtl; +} +#dashboard_incoming_links ul li, +#dashboard_secondary ul li, +#dashboard_primary ul li, +p.row-actions { + width: 100%; +} +#favorite-inside { + position: absolute; + right:0; +} +#post-status-info { + height: 25px; +} +#screen-meta { + position: static; +} +p.submit { /* quick edit and reply in edit-comments.php */ + height:22px; +} +.inner-sidebar { /* fix edit single comment */ + position: static; +} +form#widgets-filter { /* fix widget page */ + position: static; +} + +* html .meta-box-sortables .postbox .handlediv { + background: transparent url(../images/menu-bits-rtl-vs.gif) no-repeat scroll right -111px; +} + +/* nav menus */ +.menu-max-depth-0 #menu-management { width: 460px; } +.menu-max-depth-1 #menu-management { width: 490px; } +.menu-max-depth-2 #menu-management { width: 520px; } +.menu-max-depth-3 #menu-management { width: 550px; } +.menu-max-depth-4 #menu-management { width: 580px; } +.menu-max-depth-5 #menu-management { width: 610px; } +.menu-max-depth-6 #menu-management { width: 640px; } +.menu-max-depth-7 #menu-management { width: 670px; } +.menu-max-depth-8 #menu-management { width: 700px; } +.menu-max-depth-9 #menu-management { width: 730px; } +.menu-max-depth-10 #menu-management { width: 760px; } +.menu-max-depth-11 #menu-management { width: 790px; } + +.menu-item-depth-0 { margin-left: 0px; } +.menu-item-depth-1 { margin-left: -30px; } +.menu-item-depth-2 { margin-left: -60px; } +.menu-item-depth-3 { margin-left: -90px; } +.menu-item-depth-4 { margin-left: -120px; } +.menu-item-depth-5 { margin-left: -150px; } +.menu-item-depth-6 { margin-left: -180px; } +.menu-item-depth-7 { margin-left: -210px; } +.menu-item-depth-8 { margin-left: -240px; } +.menu-item-depth-9 { margin-left: -270px; } +.menu-item-depth-10 { margin-left: -300px; } +.menu-item-depth-11 { margin-left: -330px; } + +#menu-to-edit li dl { + padding: 0 !important; + margin: 0 !important; +} +.ui-sortable-helper .menu-item-transport { + margin-top: 13px; +} + .ui-sortable-helper .menu-item-transport .menu-item-transport { + margin-top: 0; + } +.sortable-placeholder { + margin-top: 0 !important; + margin-left: 0 !important; + margin-bottom: 13px !important; + padding: 0 !important; +} +.auto-add-pages { + clear: both; + float: none; +} +#nav-menus-frame .open-label span { + float: none; + display: inline-block; +} +#nav-menus-frame .delete-action { + float: none; +} diff --git a/src/wp-admin/css/ie.css b/src/wp-admin/css/ie.css new file mode 100644 index 0000000..00e1af7 --- /dev/null +++ b/src/wp-admin/css/ie.css @@ -0,0 +1 @@ +#wp-fullscreen-title{width:97%;}#wp_mce_fullscreen_ifr{background-color:#f9f9f9;}#wp-fullscreen-tagline{color:#888;font-size:14px;}#adminmenuback{left:0;}#adminmenu li.wp-menu-separator,#adminmenu li.wp-menu-separator-last{font-size:1px;line-height:1;}#adminmenu a.menu-top{border-bottom:0 none;border-top:1px solid #ddd;}#adminmenu .separator{font-size:1px;line-height:1px;}#wpbody-content input.button,#wpbody-content input.button-primary,#wpbody-content input.button-secondary,#wpbody-content input.button-highlighted{overflow:visible;}#dashboard-widgets #dashboard_quick_press form p.submit #publish{float:none;}#dashboard-widgets h3 a{height:14px;line-height:14px;}.tablenav-pages .current-page{vertical-align:middle;}#wpbody-content .postbox{border:1px solid #dfdfdf;}#wpbody-content .postbox h3{margin-bottom:-1px;}* html .meta-box-sortables .postbox .handlediv{background:transparent url(../images/menu-bits-vs.gif) no-repeat scroll left -111px;}* html .edit-box{display:inline;}* html .inner-sidebar #side-sortables,* html .postbox-container .meta-box-sortables{height:300px;}* html #wpbody-content #screen-options-link-wrap{display:inline-block;width:150px;text-align:center;}* html #wpbody-content #contextual-help-link-wrap{display:inline-block;width:100px;text-align:center;}* html #adminmenu{margin-left:-80px;}* html .folded #adminmenu{margin-left:-22px;}* html #wpcontent #adminmenu li.menu-top{display:inline;padding:0;margin:0;}* html #footer{margin:0;}.js.folded #adminmenu li.menu-top{display:block;zoom:100%;}ul#adminmenu{z-index:99;}#adminmenu li.menu-top a.menu-top{min-width:auto;width:auto;}#wpcontent #adminmenu li.wp-has-current-submenu a.wp-has-submenu{font-style:normal;}* html #wpcontent #adminmenu .wp-menu-open .wp-menu-toggle{background:none;}* html #wpcontent #adminmenu .wp-has-submenu .wp-menu-toggle{background:url(../images/menu-bits.gif?ver=20100610) no-repeat scroll left -109px;}* html #wpcontent #adminmenu li.wp-has-current-submenu .wp-menu-toggle{background:url(../images/menu-bits.gif?ver=20100610) no-repeat scroll left -206px;}* html #adminmenu div.wp-menu-image{height:29px;}#wpcontent #adminmenu .wp-submenu li{padding:0;}#adminmenu,.major-publishing-actions,.wp-submenu,.wp-submenu li,.wp-menu-toggle,#template,#template div,#editcat,#addcat,* html .stuffbox h3{zoom:100%;}#wpcontent #adminmenu .wp-submenu li.wp-submenu-head{padding:3px 4px 4px 10px;zoom:100%;}.js.folded #adminmenu .menu-top{height:30px;}.js.folded #adminmenu .wp-submenu{margin:-1px 0 0 0;}.wp-menu-arrow{height:28px;}.submitbox{margin-top:10px;}#wpbody-content .quick-edit-row-post .inline-edit-col-left{width:39%;}#wpbody-content .inline-edit-row-post .inline-edit-col-center{width:19%;}#wpbody-content .quick-edit-row-page .inline-edit-col-left{width:49%;}#wpbody-content .bulk-edit-row .inline-edit-col-left{width:29%;}.inline-edit-row p.submit{zoom:100%;}.inline-edit-row fieldset label span.title{display:block;float:left;width:5em;}.inline-edit-row fieldset label span.input-text-wrap{margin-left:0;zoom:100%;}#wpbody-content .inline-edit-row fieldset label span.input-text-wrap input{line-height:130%;}#wpbody-content .inline-edit-row .input-text-wrap input{width:95%;}#wpbody-content .inline-edit-row .input-text-wrap input.inline-edit-password-input{width:8em;}* html .row-actions{visibility:visible;}#wphead-info{float:right;}#titlediv #title{width:98%;}a.button{line-height:1.4em;margin:1px;padding:2px 6px;}* html div.widget-liquid-left,* html div.widget-liquid-right{display:block;position:relative;}#screen-options-wrap{overflow:hidden;}#favorite-actions{z-index:12;}#favorite-inside,#favorite-inside a,.favorite-action{zoom:100%;}#the-comment-list .comment-item,#post-status-info,#wpwrap,#wpcontent,#wrap,#postdivrich,#postdiv,#poststuff,.metabox-holder,#titlediv,#post-body,#editorcontainer,.tablenav,.widget-liquid-left,.widget-liquid-right,#widgets-left,.widgets-sortables,#dragHelper,.widget .widget-top,.widget,.widget-control-actions,.tagchecklist,#col-container,#col-left,#col-right,.fileedit-sub{display:block;zoom:100%;}p.search-box{position:static;float:right;margin:-3px 0 4px;}* html #editorcontainer{padding:0;}#editorcontainer #content{overflow:auto;margin:auto;width:98%;}form#template div{width:100%;}#ed_toolbar input,#ed_reply_toolbar input{overflow:visible;padding:0 4px;}#poststuff h2{font-size:1.6em;}* html #poststuff h2{margin-left:0;}#bh{margin:7px 10px 0 0;float:right;}div#dashboard-widgets{padding-right:1px;}.tagchecklist span,.tagchecklist span a{display:inline-block;display:block;}.tagchecklist span a{margin:4px 0 0 -9px;}.tablenav .button-secondary,.nav .button-secondary{padding-top:2px;padding-bottom:2px;}.tablenav select{font-size:13px;display:inline-block;vertical-align:top;margin-top:2px;}.tablenav .actions select{width:155px;}table.ie-fixed{table-layout:fixed;}.widefat tr,.widefat th{margin-bottom:0;border-spacing:0;}.widefat th input{margin:0 0 0 5px;}.widefat .check-column{padding:6px 0 2px;}.widefat tbody th.check-column{padding:4px 0 22px;}.widefat{empty-cells:show;border-collapse:collapse;}.tablenav a.button-secondary{display:inline-block;padding:2px 5px;}* html .stuffbox,* html .stuffbox input,* html .stuffbox textarea{border:1px solid #DFDFDF;}* html .feature-filter .feature-group li{width:145px;}* html .widget-top .widget-title-action a{background:url("../images/menu-bits.gif?ver=20100610") no-repeat scroll 0 -110px;}* html div.widget-liquid-left{width:99%;}#wp_inactive_widgets{padding-bottom:8px;}* html .widgets-sortables{height:50px;}* html a#content_resize{right:-2px;}* html .widget-title h4{width:205px;}* html #removing-widget .in-widget-title{display:none;}#available-widgets .widget-holder{padding-bottom:65px;}#widgets-left .inactive{padding-bottom:10px;}.widget-liquid-right .widget,#wp_inactive_widgets .widget{position:relative;}* html .media-item .pinkynail{height:32px;width:40px;}#wpcontent .button-primary-disabled{color:#9FD0D5;background:#298CBA;}#wpcontent #ajax-loading,#wpcontent .ajax-loading{vertical-align:baseline;}* html .describe .field input.text,* html .describe .field textarea{width:440px;}#the-comment-list .unapproved tr,#the-comment-list .unapproved td{background-color:#ffffe0;}.imgedit-submit{width:300px;}* html input{border:1px solid #dfdfdf;}#nav-menu-header,#nav-menus-frame,#wpbody,.menu li{zoom:100%;}#update-nav-menu #post-body{overflow:hidden;}.menu li{min-width:100%;}.menu li.sortable-placeholder{min-width:400px;} \ No newline at end of file diff --git a/src/wp-admin/css/ie.dev.css b/src/wp-admin/css/ie.dev.css new file mode 100644 index 0000000..a41d08f --- /dev/null +++ b/src/wp-admin/css/ie.dev.css @@ -0,0 +1,494 @@ +/* Fixes for IE bugs */ + +#wp-fullscreen-title { + width: 97%; +} + +#wp_mce_fullscreen_ifr { + background-color: #f9f9f9; +} + +#wp-fullscreen-tagline { + color: #888; + font-size: 14px; +} + +#adminmenuback { + left: 0; +} + +#adminmenu li.wp-menu-separator, +#adminmenu li.wp-menu-separator-last { + font-size: 1px; + line-height: 1; +} + +#adminmenu a.menu-top { + border-bottom: 0 none; + border-top: 1px solid #ddd; +} + +#adminmenu .separator { + font-size: 1px; + line-height: 1px; +} + +#wpbody-content input.button, +#wpbody-content input.button-primary, +#wpbody-content input.button-secondary, +#wpbody-content input.button-highlighted { + overflow: visible; +} + +#dashboard-widgets #dashboard_quick_press form p.submit #publish { + float: none; +} + +#dashboard-widgets h3 a { + height: 14px; + line-height: 14px; +} + +.tablenav-pages .current-page { + vertical-align: middle; +} + +#wpbody-content .postbox { + border: 1px solid #dfdfdf; +} + +#wpbody-content .postbox h3 { + margin-bottom: -1px; +} + +* html .meta-box-sortables .postbox .handlediv { + background: transparent url(../images/menu-bits-vs.gif) no-repeat scroll left -111px; +} + +* html .edit-box { + display: inline; +} + +* html .inner-sidebar #side-sortables, +* html .postbox-container .meta-box-sortables { + height: 300px; +} + +* html #wpbody-content #screen-options-link-wrap { + display: inline-block; + width: 150px; + text-align: center; +} + +* html #wpbody-content #contextual-help-link-wrap { + display: inline-block; + width: 100px; + text-align: center; +} + +* html #adminmenu { + margin-left: -80px; +} + +* html .folded #adminmenu { + margin-left: -22px; +} + +* html #wpcontent #adminmenu li.menu-top { + display: inline; + padding: 0; + margin: 0; +} + +* html #footer { + margin: 0; +} + +.js.folded #adminmenu li.menu-top { + display: block; + zoom: 100%; +} + +ul#adminmenu { + z-index: 99; +} + +#adminmenu li.menu-top a.menu-top { + min-width: auto; + width: auto; +} + +#wpcontent #adminmenu li.wp-has-current-submenu a.wp-has-submenu { + font-style: normal; +} + +* html #wpcontent #adminmenu .wp-menu-open .wp-menu-toggle { + background: none; +} + +* html #wpcontent #adminmenu .wp-has-submenu .wp-menu-toggle { + background: url(../images/menu-bits.gif?ver=20100610) no-repeat scroll left -109px; +} + +* html #wpcontent #adminmenu li.wp-has-current-submenu .wp-menu-toggle { + background: url(../images/menu-bits.gif?ver=20100610) no-repeat scroll left -206px; +} + +* html #adminmenu div.wp-menu-image { + height: 29px; +} + +#wpcontent #adminmenu .wp-submenu li { + padding: 0; +} + +#adminmenu, +.major-publishing-actions, +.wp-submenu, +.wp-submenu li, +.wp-menu-toggle, +#template, +#template div, +#editcat, +#addcat, +* html .stuffbox h3 { + zoom: 100%; +} + +#wpcontent #adminmenu .wp-submenu li.wp-submenu-head { + padding: 3px 4px 4px 10px; + zoom: 100%; +} + +.js.folded #adminmenu .menu-top { + height: 30px; +} + +.js.folded #adminmenu .wp-submenu { + margin: -1px 0 0 0; +} + +.wp-menu-arrow { + height: 28px; +} + +.submitbox { + margin-top: 10px; +} + +/* Inline Editor */ +#wpbody-content .quick-edit-row-post .inline-edit-col-left { + width: 39%; +} + +#wpbody-content .inline-edit-row-post .inline-edit-col-center { + width: 19%; +} + +#wpbody-content .quick-edit-row-page .inline-edit-col-left { + width: 49%; +} + +#wpbody-content .bulk-edit-row .inline-edit-col-left { + width: 29%; +} + +.inline-edit-row p.submit { + zoom: 100%; +} + +.inline-edit-row fieldset label span.title { + display: block; + float: left; + width: 5em; +} + +.inline-edit-row fieldset label span.input-text-wrap { + margin-left: 0; + zoom: 100%; +} + +#wpbody-content .inline-edit-row fieldset label span.input-text-wrap input { + line-height: 130%; +} + +#wpbody-content .inline-edit-row .input-text-wrap input { + width: 95%; +} + +#wpbody-content .inline-edit-row .input-text-wrap input.inline-edit-password-input { + width: 8em; +} +/* end Inline Editor */ + +* html .row-actions { + visibility: visible; +} + +#wphead-info { + float: right; +} + +#titlediv #title { + width: 98%; +} + +a.button { + line-height: 1.4em; + margin: 1px; + padding: 2px 6px; +} + +* html div.widget-liquid-left, +* html div.widget-liquid-right { + display: block; + position: relative; +} + +#screen-options-wrap { + overflow: hidden; +} + +#favorite-actions { + z-index: 12; +} + +#favorite-inside, +#favorite-inside a, +.favorite-action { + zoom: 100%; +} + +#the-comment-list .comment-item, +#post-status-info, +#wpwrap, +#wpcontent, +#wrap, +#postdivrich, +#postdiv, +#poststuff, +.metabox-holder, +#titlediv, +#post-body, +#editorcontainer, +.tablenav, +.widget-liquid-left, +.widget-liquid-right, +#widgets-left, +.widgets-sortables, +#dragHelper, +.widget .widget-top, +.widget, +.widget-control-actions, +.tagchecklist, +#col-container, +#col-left, +#col-right, +.fileedit-sub { + display: block; + zoom: 100%; +} + +p.search-box { + position: static; + float: right; + margin: -3px 0 4px; +} + +* html #editorcontainer { + padding: 0; +} + +#editorcontainer #content { + overflow: auto; + margin: auto; + width: 98%; +} + +form#template div { + width: 100%; +} + +#ed_toolbar input, +#ed_reply_toolbar input { + overflow: visible; + padding: 0 4px; +} + +#poststuff h2 { + font-size: 1.6em; +} + +* html #poststuff h2 { + margin-left: 0; +} + +#bh { + margin: 7px 10px 0 0; + float: right; +} + +/* without this dashboard widgets appear in one column for some screen widths */ +div#dashboard-widgets { + padding-right: 1px; +} + +.tagchecklist span, .tagchecklist span a { + display: inline-block; + display: block; +} + +.tagchecklist span a { + margin: 4px 0 0 -9px; +} + +.tablenav .button-secondary, +.nav .button-secondary { + padding-top: 2px; + padding-bottom: 2px; +} + +.tablenav select { + font-size: 13px; + display: inline-block; + vertical-align: top; + margin-top: 2px; +} + +.tablenav .actions select { + width: 155px; +} + +table.ie-fixed { + table-layout: fixed; +} + +.widefat tr, .widefat th { + margin-bottom: 0; + border-spacing: 0; +} + +.widefat th input { + margin: 0 0 0 5px; +} + +.widefat .check-column { + padding: 6px 0 2px; +} + +.widefat tbody th.check-column { + padding: 4px 0 22px; +} + +.widefat { + empty-cells: show; + border-collapse: collapse; +} + +.tablenav a.button-secondary { + display: inline-block; + padding: 2px 5px; +} + +* html .stuffbox, +* html .stuffbox input, +* html .stuffbox textarea { + border: 1px solid #DFDFDF; +} + +* html .feature-filter .feature-group li { + width: 145px; +} + +* html .widget-top .widget-title-action a { + background: url("../images/menu-bits.gif?ver=20100610") no-repeat scroll 0 -110px; +} + +* html div.widget-liquid-left { + width: 99%; +} + +#wp_inactive_widgets { + padding-bottom: 8px; +} + +* html .widgets-sortables { + height: 50px; +} + +* html a#content_resize { + right: -2px; +} + +* html .widget-title h4 { + width: 205px; +} + +* html #removing-widget .in-widget-title { + display: none; +} + +#available-widgets .widget-holder { + padding-bottom: 65px; +} + +#widgets-left .inactive { + padding-bottom: 10px; +} + +.widget-liquid-right .widget, +#wp_inactive_widgets .widget { + position: relative; +} + +* html .media-item .pinkynail { + height: 32px; + width: 40px; +} + +#wpcontent .button-primary-disabled { + color: #9FD0D5; + background: #298CBA; +} + +#wpcontent #ajax-loading, +#wpcontent .ajax-loading { + vertical-align: baseline; +} + +* html .describe .field input.text, +* html .describe .field textarea { + width: 440px; +} + +#the-comment-list .unapproved tr, +#the-comment-list .unapproved td { + background-color: #ffffe0; +} + +.imgedit-submit { + width: 300px; +} + +* html input { + border: 1px solid #dfdfdf; +} + +#nav-menu-header, +#nav-menus-frame, +#wpbody, +.menu li { + zoom:100%; +} + +#update-nav-menu #post-body { + overflow:hidden; +} + +.menu li { + min-width:100%; +} + +.menu li.sortable-placeholder { + min-width:400px; +} diff --git a/src/wp-admin/css/install-rtl.css b/src/wp-admin/css/install-rtl.css new file mode 100644 index 0000000..e422ece --- /dev/null +++ b/src/wp-admin/css/install-rtl.css @@ -0,0 +1 @@ +body{font-family:Tahoma,arial;}h1{font-family:arial;margin:5px -4px 0 0;}ul,ol{padding:5px 22px 5px 5px;}.step,th{text-align:right;}.submit input,.button,.button-secondary{font-family:Tahoma,arial;margin-right:0;}.form-table th{text-align:right;}#user_login,#admin_email,#pass1,#pass2{direction:ltr;} \ No newline at end of file diff --git a/src/wp-admin/css/install-rtl.dev.css b/src/wp-admin/css/install-rtl.dev.css new file mode 100644 index 0000000..9e0be99 --- /dev/null +++ b/src/wp-admin/css/install-rtl.dev.css @@ -0,0 +1,23 @@ +body { + font-family: Tahoma, arial; +} +h1 { + font-family: arial; + margin: 5px -4px 0 0; +} +ul, ol { + padding: 5px 22px 5px 5px; +} +.step, th { + text-align: right; +} +.submit input, .button, .button-secondary { + font-family: Tahoma, arial; + margin-right: 0; +} +.form-table th { + text-align: right; +} +#user_login, #admin_email, #pass1, #pass2 { + direction: ltr; +} \ No newline at end of file diff --git a/src/wp-admin/css/install.css b/src/wp-admin/css/install.css new file mode 100644 index 0000000..fa76872 --- /dev/null +++ b/src/wp-admin/css/install.css @@ -0,0 +1 @@ +html{background:#f9f9f9;}body{background:#fff;color:#333;font-family:sans-serif;margin:2em auto;width:700px;padding:1em 2em;-moz-border-radius:11px;-khtml-border-radius:11px;-webkit-border-radius:11px;border-radius:11px;border:1px solid #dfdfdf;}a{color:#2583ad;text-decoration:none;}a:hover{color:#d54e21;}h1{border-bottom:1px solid #dadada;clear:both;color:#666;font:24px Georgia,"Times New Roman",Times,serif;margin:5px 0 0 -4px;padding:0;padding-bottom:7px;}h2{font-size:16px;}p,li,dd,dt{padding-bottom:2px;font-size:12px;line-height:18px;}code,.code{font-size:13px;}ul,ol,dl{padding:5px 5px 5px 22px;}a img{border:0;}abbr{border:0;font-variant:normal;}#logo{margin:6px 0 14px 0;border-bottom:none;text-align:center;}.step{margin:20px 0 15px;}.step,th{text-align:left;padding:0;}.submit input,.button,.button-secondary{font-family:sans-serif;text-decoration:none;font-size:14px!important;line-height:16px;padding:6px 12px;cursor:pointer;border:1px solid #bbb;color:#464646;-moz-border-radius:15px;-khtml-border-radius:15px;-webkit-border-radius:15px;border-radius:15px;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;-khtml-box-sizing:content-box;box-sizing:content-box;}.button:hover,.button-secondary:hover,.submit input:hover{color:#000;border-color:#666;}.button,.submit input,.button-secondary{background:#f2f2f2 url(../images/white-grad.png) repeat-x scroll left top;}.button:active,.submit input:active,.button-secondary:active{background:#eee url(../images/white-grad-active.png) repeat-x scroll left top;}textarea{border:1px solid #bbb;-moz-border-radius:3px;-khtml-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;}.form-table{border-collapse:collapse;margin-top:1em;width:100%;}.form-table td{margin-bottom:9px;padding:10px;border-bottom:8px solid #fff;font-size:12px;}.form-table th{font-size:13px;text-align:left;padding:16px 10px 10px 10px;border-bottom:8px solid #fff;width:130px;vertical-align:top;}.form-table tr{background:#f3f3f3;}.form-table code{line-height:18px;font-size:18px;}.form-table p{margin:4px 0 0 0;font-size:11px;}.form-table input{line-height:20px;font-size:15px;padding:2px;}.form-table th p{font-weight:normal;}#error-page{margin-top:50px;}#error-page p{font-size:12px;line-height:18px;margin:25px 0 20px;}#error-page code,.code{font-family:Consolas,Monaco,monospace;}#pass-strength-result{background-color:#eee;border-color:#ddd!important;border-style:solid;border-width:1px;margin:5px 5px 5px 1px;padding:5px;text-align:center;width:200px;display:none;}#pass-strength-result.bad{background-color:#ffb78c;border-color:#ff853c!important;}#pass-strength-result.good{background-color:#ffec8b;border-color:#fc0!important;}#pass-strength-result.short{background-color:#ffa0a0;border-color:#f04040!important;}#pass-strength-result.strong{background-color:#c3ff88;border-color:#8dff1c!important;}.message{border:1px solid #e6db55;padding:.3em .6em;margin:5px 0 15px;background-color:#ffffe0;} \ No newline at end of file diff --git a/src/wp-admin/css/install.dev.css b/src/wp-admin/css/install.dev.css new file mode 100644 index 0000000..d1a389f --- /dev/null +++ b/src/wp-admin/css/install.dev.css @@ -0,0 +1,213 @@ +html { + background: #f9f9f9; +} + +body { + background: #fff; + color: #333; + font-family: sans-serif; + margin: 2em auto; + width: 700px; + padding: 1em 2em; + -moz-border-radius: 11px; + -khtml-border-radius: 11px; + -webkit-border-radius: 11px; + border-radius: 11px; + border: 1px solid #dfdfdf; +} + +a { + color: #2583ad; + text-decoration: none; +} + +a:hover { + color: #d54e21; +} + +h1 { + border-bottom: 1px solid #dadada; + clear: both; + color: #666; + font: 24px Georgia, "Times New Roman", Times, serif; + margin: 5px 0 0 -4px; + padding: 0; + padding-bottom: 7px; +} + +h2 { + font-size: 16px; +} + +p, li, dd, dt { + padding-bottom: 2px; + font-size: 12px; + line-height: 18px; +} + +code, .code { + font-size: 13px; +} + +ul, ol, dl { + padding: 5px 5px 5px 22px; +} + +a img { + border:0 +} +abbr { + border: 0; + font-variant: normal; +} +#logo { + margin: 6px 0 14px 0; + border-bottom: none; + text-align:center +} +.step { + margin: 20px 0 15px; +} +.step, th { + text-align: left; + padding: 0; +} + +.submit input, .button, .button-secondary { + font-family: sans-serif; + text-decoration: none; + font-size: 14px !important; + line-height: 16px; + padding: 6px 12px; + cursor: pointer; + border: 1px solid #bbb; + color: #464646; + -moz-border-radius: 15px; + -khtml-border-radius: 15px; + -webkit-border-radius: 15px; + border-radius: 15px; + -moz-box-sizing: content-box; + -webkit-box-sizing: content-box; + -khtml-box-sizing: content-box; + box-sizing: content-box; +} + +.button:hover, .button-secondary:hover, .submit input:hover { + color: #000; + border-color: #666; +} + +.button, .submit input, .button-secondary { + background: #f2f2f2 url(../images/white-grad.png) repeat-x scroll left top; +} + +.button:active, .submit input:active, .button-secondary:active { + background: #eee url(../images/white-grad-active.png) repeat-x scroll left top; +} + +textarea { + border: 1px solid #bbb; + -moz-border-radius: 3px; + -khtml-border-radius: 3px; + -webkit-border-radius: 3px; + border-radius: 3px; +} + +.form-table { + border-collapse: collapse; + margin-top: 1em; + width: 100%; +} + +.form-table td { + margin-bottom: 9px; + padding: 10px; + border-bottom: 8px solid #fff; + font-size: 12px; +} + +.form-table th { + font-size: 13px; + text-align: left; + padding: 16px 10px 10px 10px; + border-bottom: 8px solid #fff; + width: 130px; + vertical-align: top; +} + +.form-table tr { + background: #f3f3f3; +} + +.form-table code { + line-height: 18px; + font-size: 18px; +} + +.form-table p { + margin: 4px 0 0 0; + font-size: 11px; +} + +.form-table input { + line-height: 20px; + font-size: 15px; + padding: 2px; +} + +.form-table th p { + font-weight: normal; +} + +#error-page { + margin-top: 50px; +} + +#error-page p { + font-size: 12px; + line-height: 18px; + margin: 25px 0 20px; +} + +#error-page code, .code { + font-family: Consolas, Monaco, monospace; +} + +#pass-strength-result { + background-color: #eee; + border-color: #ddd !important; + border-style: solid; + border-width: 1px; + margin: 5px 5px 5px 1px; + padding: 5px; + text-align: center; + width: 200px; + display: none; +} + +#pass-strength-result.bad { + background-color: #ffb78c; + border-color: #ff853c !important; +} + +#pass-strength-result.good { + background-color: #ffec8b; + border-color: #ffcc00 !important; +} + +#pass-strength-result.short { + background-color: #ffa0a0; + border-color: #f04040 !important; +} + +#pass-strength-result.strong { + background-color: #c3ff88; + border-color: #8dff1c !important; +} + +.message { + border: 1px solid #e6db55; + padding: 0.3em 0.6em; + margin: 5px 0 15px; + background-color: #ffffe0; +} diff --git a/src/wp-admin/css/login-rtl.css b/src/wp-admin/css/login-rtl.css new file mode 100644 index 0000000..11040fa --- /dev/null +++ b/src/wp-admin/css/login-rtl.css @@ -0,0 +1 @@ +body{font-family:Tahoma,arial;}form{margin-right:8px;margin-left:0;}form .forgetmenot{float:right;}#login form .submit input{font-family:Tahoma,arial;}form .submit{float:left;}#backtoblog a{padding:8px 15px 0 0;}#login_error,.message{margin:0 8px 16px 0;}#nav{margin:0 8px 0 0;}#user_pass,#user_login,#user_email{margin-left:6px;margin-right:0;direction:ltr;}h1 a{text-decoration:none;} \ No newline at end of file diff --git a/src/wp-admin/css/login-rtl.dev.css b/src/wp-admin/css/login-rtl.dev.css new file mode 100644 index 0000000..954b320 --- /dev/null +++ b/src/wp-admin/css/login-rtl.dev.css @@ -0,0 +1,29 @@ +body { + font-family: Tahoma, arial; +} +form { + margin-right: 8px; + margin-left: 0; +} +form .forgetmenot { + float: right; +} +#login form .submit input { + font-family: Tahoma, arial; +} +form .submit { float: left; } +#backtoblog a { + padding: 8px 15px 0 0; +} +#login_error, .message { + margin: 0 8px 16px 0; +} +#nav { margin: 0 8px 0 0; } +#user_pass, #user_login, #user_email { + margin-left: 6px; + margin-right: 0; + direction:ltr; +} +h1 a { + text-decoration: none; +} diff --git a/src/wp-admin/css/login.css b/src/wp-admin/css/login.css new file mode 100644 index 0000000..d0e6f3d --- /dev/null +++ b/src/wp-admin/css/login.css @@ -0,0 +1 @@ +*{margin:0;padding:0;}html{background:#fbfbfb!important;}body{padding-top:30px;font-family:sans-serif;font-size:12px;}form{margin-left:8px;padding:26px 24px 46px;font-weight:normal;-moz-border-radius:3px;-khtml-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;background:#fff;border:1px solid #e5e5e5;-moz-box-shadow:rgba(200,200,200,0.7) 0 4px 10px -1px;-webkit-box-shadow:rgba(200,200,200,0.7) 0 4px 10px -1px;-khtml-box-shadow:rgba(200,200,200,0.7) 0 4px 10px -1px;box-shadow:rgba(200,200,200,0.7) 0 4px 10px -1px;}form .forgetmenot{font-weight:normal;float:left;margin-bottom:0;}.button-primary{font-family:sans-serif;padding:3px 10px;border:none;font-size:13px;border-width:1px;border-style:solid;-moz-border-radius:11px;-khtml-border-radius:11px;-webkit-border-radius:11px;border-radius:11px;cursor:pointer;text-decoration:none;margin-top:-3px;}#login form p{margin-bottom:0;}label{color:#777;font-size:14px;}form .forgetmenot label{font-size:12px;line-height:19px;}form .submit,.alignright{float:right;}form p{margin-bottom:24px;}h1 a{background:url(../images/logo-login.png) no-repeat top center;width:326px;height:67px;text-indent:-9999px;overflow:hidden;padding-bottom:15px;display:block;}#login{width:320px;margin:7em auto;}#login_error,.message{margin:0 0 16px 8px;border-width:1px;border-style:solid;padding:12px;-moz-border-radius:3px;-khtml-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;}#nav,#backtoblog{text-shadow:rgba(255,255,255,1) 0 1px 0;margin:0 0 0 16px;padding:16px 16px 0;}#backtoblog{padding:12px 16px 0;}body form .input{font-family:"HelveticaNeue-Light","Helvetica Neue Light","Helvetica Neue",sans-serif;font-weight:200;font-size:24px;width:97%;padding:3px;margin-top:2px;margin-right:6px;margin-bottom:16px;border:1px solid #e5e5e5;background:#fbfbfb;outline:none;-moz-box-shadow:inset 1px 1px 2px rgba(200,200,200,0.2);-webkit-box-shadow:inset 1px 1px 2px rgba(200,200,200,0.2);box-shadow:inset 1px 1px 2px rgba(200,200,200,0.2);}input{color:#555;}.clear{clear:both;}#pass-strength-result{font-weight:bold;border-style:solid;border-width:1px;margin:12px 0 6px;padding:6px 5px;text-align:center;} \ No newline at end of file diff --git a/src/wp-admin/css/login.dev.css b/src/wp-admin/css/login.dev.css new file mode 100644 index 0000000..3dc5b79 --- /dev/null +++ b/src/wp-admin/css/login.dev.css @@ -0,0 +1,144 @@ +* { margin: 0; padding: 0; } + +html { + background: #fbfbfb !important; +} + +body { + padding-top: 30px; + font-family: sans-serif; + font-size: 12px; +} + +form { + margin-left: 8px; + padding: 26px 24px 46px; + font-weight: normal; + -moz-border-radius: 3px; + -khtml-border-radius: 3px; + -webkit-border-radius: 3px; + border-radius: 3px; + background: #fff; + border: 1px solid #e5e5e5; + -moz-box-shadow: rgba(200, 200, 200, 0.7) 0px 4px 10px -1px; + -webkit-box-shadow: rgba(200, 200, 200, 0.7) 0px 4px 10px -1px; + -khtml-box-shadow: rgba(200, 200, 200, 0.7) 0px 4px 10px -1px; + box-shadow: rgba(200, 200, 200, 0.7) 0px 4px 10px -1px; +} + +form .forgetmenot { + font-weight: normal; + float: left; + margin-bottom: 0; +} + +.button-primary { + font-family: sans-serif; + padding: 3px 10px; + border: none; + font-size: 13px; + border-width: 1px; + border-style: solid; + -moz-border-radius: 11px; + -khtml-border-radius: 11px; + -webkit-border-radius: 11px; + border-radius: 11px; + cursor: pointer; + text-decoration: none; + margin-top: -3px; +} + +#login form p { + margin-bottom: 0; +} + +label { + color: #777; + font-size: 14px; +} + +form .forgetmenot label { + font-size: 12px; + line-height: 19px; +} + +form .submit, +.alignright { + float: right; +} + +form p { + margin-bottom: 24px; +} + +h1 a { + background: url(../images/logo-login.png) no-repeat top center; + width: 326px; + height: 67px; + text-indent: -9999px; + overflow: hidden; + padding-bottom: 15px; + display: block; +} + +#login { + width: 320px; + margin: 7em auto; +} + +#login_error, +.message { + margin: 0 0 16px 8px; + border-width: 1px; + border-style: solid; + padding: 12px; + -moz-border-radius: 3px; + -khtml-border-radius: 3px; + -webkit-border-radius: 3px; + border-radius: 3px; +} + +#nav, +#backtoblog { + text-shadow: rgba(255,255,255,1) 0 1px 0; + margin: 0 0 0 16px; + padding: 16px 16px 0; +} +#backtoblog { + padding: 12px 16px 0; +} + +body form .input { + font-family: "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", sans-serif; + font-weight: 200; + font-size: 24px; + width: 97%; + padding: 3px; + margin-top: 2px; + margin-right: 6px; + margin-bottom: 16px; + border: 1px solid #e5e5e5; + background: #fbfbfb; + outline: none; + -moz-box-shadow: inset 1px 1px 2px rgba(200, 200, 200, 0.2); + -webkit-box-shadow: inset 1px 1px 2px rgba(200, 200, 200, 0.2); + box-shadow: inset 1px 1px 2px rgba(200, 200, 200, 0.2); +} + +input { + color: #555; +} + +.clear { + clear: both; +} + +#pass-strength-result { + font-weight: bold; + border-style: solid; + border-width: 1px; + margin: 12px 0 6px; + padding: 6px 5px; + text-align: center; +} + diff --git a/src/wp-admin/css/media-rtl.css b/src/wp-admin/css/media-rtl.css new file mode 100644 index 0000000..19d7366 --- /dev/null +++ b/src/wp-admin/css/media-rtl.css @@ -0,0 +1 @@ +body#media-upload ul#sidemenu{left:auto;right:0;}#search-filter{text-align:left;}.align .field label{padding:0 28px 0 0;margin:0 0 0 1em;}.image-align-none-label,.image-align-left-label,.image-align-center-label,.image-align-right-label{background-position:center right;}tr.image-size div.image-size-item{float:right;}tr.image-size label{margin:0 1em 0 0;}.crunching{text-align:left;margin-right:0;margin-left:5px;}button.dismiss{right:auto;left:5px;}.file-error{margin:0 50px 5px 0;}.progress{left:auto;right:0;}.describe td{padding:0 0 0 5px;}.bar{border-right-width:0;border-left-width:3px;border-right-style:none;border-left-style:solid;}#media-upload .media-upload-form p{margin:0 0 1em 1em;}#media-upload .describe th.label{text-align:right;}.menu_order{float:left;}.media-upload-form label.form-help,td.help,#media-upload p.help,#media-upload label.help{font-family:Tahoma,Arial;}#gallery-settings #basic th.label{padding:5px 0 5px 5px;}#gallery-settings .title,h3.media-title{font-family:Tahoma,Arial;}#gallery-settings .describe th.label{text-align:right;}#gallery-settings label,#gallery-settings legend{margin-right:0;margin-left:15px;}#gallery-settings .align .field label{margin:0 0 0 1.5em;}#sort-buttons{margin:3px 0 -8px 25px;text-align:left;}#sort-buttons #asc,#sort-buttons #showall{padding-left:0;padding-right:5px;}#sort-buttons span{margin-right:0;margin-left:25px;} \ No newline at end of file diff --git a/src/wp-admin/css/media-rtl.dev.css b/src/wp-admin/css/media-rtl.dev.css new file mode 100644 index 0000000..efa1e2e --- /dev/null +++ b/src/wp-admin/css/media-rtl.dev.css @@ -0,0 +1,92 @@ +body#media-upload ul#sidemenu { + left: auto; + right: 0; +} +#search-filter { + text-align: left; +} +/* specific to the image upload form */ +.align .field label { + padding: 0 28px 0 0; + margin: 0 0 0 1em; +} +.image-align-none-label, .image-align-left-label, .image-align-center-label, .image-align-right-label { + background-position: center right; +} +tr.image-size div.image-size-item { + float: right; +} +tr.image-size label { + margin: 0 1em 0 0; +} +.crunching { + text-align: left; + margin-right: 0; + margin-left: 5px; +} +button.dismiss { + right: auto; + left: 5px; +} +.file-error { + margin: 0 50px 5px 0; +} +.progress { + left: auto; + right: 0; +} +.describe td { + padding: 0 0 0 5px; +} +.bar { + border-right-width: 0; + border-left-width: 3px; + border-right-style: none; + border-left-style: solid; +} + +/* Specific to Uploader */ +#media-upload .media-upload-form p { + margin: 0 0 1em 1em; +} +#media-upload .describe th.label { + text-align: right; +} +.menu_order { + float: left; +} +.media-upload-form label.form-help, td.help, #media-upload p.help, #media-upload label.help { + font-family: Tahoma, Arial; +} +#gallery-settings #basic th.label { + padding: 5px 0 5px 5px; +} +#gallery-settings .title, h3.media-title { + font-family: Tahoma, Arial; +} +#gallery-settings .describe th.label { + text-align: right; +} +#gallery-settings label, +#gallery-settings legend { + margin-right: 0; + margin-left: 15px; +} +#gallery-settings .align .field label { + margin: 0 0 0 1.5em; +} +#sort-buttons { + margin: 3px 0 -8px 25px; + text-align: left; +} + +#sort-buttons #asc, +#sort-buttons #showall { + padding-left: 0; + padding-right: 5px; +} + +#sort-buttons span { + margin-right: 0; + margin-left: 25px; +} diff --git a/src/wp-admin/css/media.css b/src/wp-admin/css/media.css new file mode 100644 index 0000000..157ecdf --- /dev/null +++ b/src/wp-admin/css/media.css @@ -0,0 +1 @@ +div#media-upload-header{margin:0;padding:0 5px;font-weight:bold;position:relative;border-bottom-width:1px;border-bottom-style:solid;}body#media-upload ul#sidemenu{font-weight:normal;margin:0 5px;left:0;bottom:-1px;float:none;overflow:hidden;}div#media-upload-error{margin:1em;font-weight:bold;}form{margin:1em;}#search-filter{text-align:right;}th{position:relative;}.media-upload-form label.form-help,td.help{font-family:sans-serif;font-style:italic;font-weight:normal;}.media-upload-form p.help{margin:0;padding:0;}.media-upload-form fieldset{width:100%;border:none;text-align:justify;margin:0 0 1em 0;padding:0;}.image-align-none-label{background:url(../images/align-none.png) no-repeat center left;}.image-align-left-label{background:url(../images/align-left.png) no-repeat center left;}.image-align-center-label{background:url(../images/align-center.png) no-repeat center left;}.image-align-right-label{background:url(../images/align-right.png) no-repeat center left;}tr.image-size td{width:460px;}tr.image-size div.image-size-item{float:left;width:25%;margin:0;}#library-form .progress,#gallery-form .progress,.insert-gallery,.describe.startopen,.describe.startclosed{display:none;}.media-item .thumbnail{max-width:128px;max-height:128px;}thead.media-item-info tr{background-color:transparent;}thead.media-item-info th,thead.media-item-info td{border:none;margin:0;}.form-table thead.media-item-info{border:8px solid #fff;}abbr.required{text-decoration:none;border:none;}.describe label{display:inline;}.describe td{vertical-align:middle;padding:0 5px 8px 0;}.describe td.error{padding:2px 8px;}.describe td.A1{width:132px;}.describe input[type="text"],.describe textarea{width:460px;border-width:1px;border-style:solid;}.hidden{height:0;width:0;overflow:hidden;border:none;}#media-upload p.ml-submit{padding:1em 0;}#media-upload p.help,#media-upload label.help{font-family:sans-serif;font-style:italic;font-weight:normal;}#media-upload tr.image-size td.field{text-align:center;}#media-upload #media-items{border-width:1px;border-style:solid;border-bottom:none;width:623px;}#media-upload .media-item{border-bottom-width:1px;border-bottom-style:solid;min-height:36px;width:100%;}#media-upload .ui-sortable .media-item{cursor:move;}.filename{line-height:36px;padding:0 10px;overflow:hidden;}#media-upload .describe{width:100%;clear:both;cursor:default;}#media-upload .slidetoggle{border-top-width:1px;border-top-style:solid;}#media-upload .describe th.label{padding-top:.2em;text-align:left;min-width:120px;}#media-upload tr.align td.field{text-align:center;}#media-upload tr.image-size{margin-bottom:1em;height:3em;}#media-upload #filter{width:623px;}#media-upload #filter .subsubsub{margin:8px 0;}#filter .tablenav select{border-style:solid;border-width:1px;padding:2px;vertical-align:top;width:auto;}#media-upload .del-attachment{display:none;margin:5px 0;}.menu_order{float:right;font-size:11px;margin:10px 10px 0;}.menu_order_input{border:1px solid #ddd;font-size:10px;padding:1px;width:23px;}.ui-sortable-helper{background-color:#fff;border:1px solid #aaa;opacity:.6;filter:alpha(opacity=60);}#media-upload th.order-head{width:20%;text-align:center;}#media-upload th.actions-head{width:25%;text-align:center;}#media-upload a.wp-post-thumbnail{margin:0 20px;}#media-items a.delete{display:block;float:right;}#media-upload .widefat{width:626px;border-style:solid solid none;}.sorthelper{height:37px;width:623px;display:block;}#gallery-settings th.label{width:160px;}#gallery-settings #basic th.label{padding:5px 5px 5px 0;}#gallery-settings .title{clear:both;padding:0 0 3px;font-size:1.6em;border-bottom:1px solid #DADADA;}h3.media-title{font-size:1.6em;}h4.media-sub-title{border-bottom:1px solid #DADADA;font-size:1.3em;margin:12px;padding:0 0 3px;}#gallery-settings .title,h3.media-title,h4.media-sub-title{font-family:Georgia,"Times New Roman",Times,serif;font-weight:normal;color:#5A5A5A;}#gallery-settings .describe td{vertical-align:middle;height:3em;}#gallery-settings .describe th.label{padding-top:.5em;text-align:left;}#gallery-settings .describe{padding:5px;width:615px;clear:both;cursor:default;}#gallery-settings .describe select{width:15em;}#gallery-settings .describe select option,#gallery-settings .describe td{padding:0;}#gallery-settings label,#gallery-settings legend{font-size:13px;color:#464646;margin-right:15px;}#gallery-settings .align .field label{margin:0 1.5em 0 0;}#gallery-settings p.ml-submit{border-top:1px solid #dfdfdf;}#gallery-settings select#columns{width:6em;}#sort-buttons{font-size:.8em;margin:3px 25px -8px 0;text-align:right;max-width:625px;}#sort-buttons a{text-decoration:none;}#sort-buttons #asc,#sort-buttons #showall{padding-left:5px;}#sort-buttons span{margin-right:25px;} \ No newline at end of file diff --git a/src/wp-admin/css/media.dev.css b/src/wp-admin/css/media.dev.css new file mode 100644 index 0000000..f439f49 --- /dev/null +++ b/src/wp-admin/css/media.dev.css @@ -0,0 +1,382 @@ +div#media-upload-header { + margin: 0; + padding: 0 5px; + font-weight: bold; + position: relative; + border-bottom-width: 1px; + border-bottom-style: solid; +} + +body#media-upload ul#sidemenu { + font-weight: normal; + margin: 0 5px; + left: 0; + bottom: -1px; + float: none; + overflow: hidden; +} + +div#media-upload-error { + margin: 1em; + font-weight: bold; +} + +form { + margin: 1em; +} + +#search-filter { + text-align: right; +} + +th { + position: relative; +} + +.media-upload-form label.form-help, td.help { + font-family: sans-serif; + font-style: italic; + font-weight: normal; +} + +.media-upload-form p.help { + margin: 0; + padding: 0; +} + +.media-upload-form fieldset { + width: 100%; + border: none; + text-align: justify; + margin: 0 0 1em 0; + padding: 0; +} + +/* specific to the image upload form */ + + +.image-align-none-label { + background: url(../images/align-none.png) no-repeat center left; +} + +.image-align-left-label { + background: url(../images/align-left.png) no-repeat center left; +} + +.image-align-center-label { + background: url(../images/align-center.png) no-repeat center left; +} + +.image-align-right-label { + background: url(../images/align-right.png) no-repeat center left; +} + +tr.image-size td { + width: 460px; +} + +tr.image-size div.image-size-item { + float: left; + width: 25%; + margin: 0; +} + +#library-form .progress, +#gallery-form .progress, +.insert-gallery, +.describe.startopen, +.describe.startclosed { + display: none; +} + +.media-item .thumbnail { + max-width: 128px; + max-height: 128px; +} + +thead.media-item-info tr { + background-color: transparent; +} + +thead.media-item-info th, +thead.media-item-info td { + border: none; + margin: 0; +} + +.form-table thead.media-item-info { + border: 8px solid #fff; +} + +abbr.required { + text-decoration: none; + border: none; +} + +.describe label { + display: inline; +} + +.describe td { + vertical-align: middle; + padding: 0 5px 8px 0; +} + +.describe td.error { + padding: 2px 8px; +} + +.describe td.A1 { + width: 132px; +} + +.describe input[type="text"], +.describe textarea { + width: 460px; + border-width: 1px; + border-style: solid; +} + +.hidden { + height: 0; + width: 0; + overflow: hidden; + border: none; +} + +/* Specific to Uploader */ + +#media-upload p.ml-submit { + padding: 1em 0; +} + +#media-upload p.help, +#media-upload label.help { + font-family: sans-serif; + font-style: italic; + font-weight: normal; +} + +#media-upload tr.image-size td.field { + text-align: center; +} + +#media-upload #media-items { + border-width: 1px; + border-style: solid; + border-bottom: none; + width: 623px; +} + +#media-upload .media-item { + border-bottom-width: 1px; + border-bottom-style: solid; + min-height: 36px; + width: 100%; +} + +#media-upload .ui-sortable .media-item { + cursor: move; +} + +.filename { + line-height: 36px; + padding: 0 10px; + overflow: hidden; +} + +#media-upload .describe { + width: 100%; + clear: both; + cursor: default; +} + +#media-upload .slidetoggle { + border-top-width: 1px; + border-top-style: solid; +} + +#media-upload .describe th.label { + padding-top: .2em; + text-align: left; + min-width: 120px; +} + +#media-upload tr.align td.field { + text-align: center; +} + +#media-upload tr.image-size { + margin-bottom: 1em; + height: 3em; +} + +#media-upload #filter { + width: 623px; +} + +#media-upload #filter .subsubsub { + margin: 8px 0; +} + +#filter .tablenav select { + border-style: solid; + border-width: 1px; + padding: 2px; + vertical-align: top; + width: auto; +} + +#media-upload .del-attachment { + display: none; + margin: 5px 0; +} + +.menu_order { + float: right; + font-size: 11px; + margin: 10px 10px 0; +} + +.menu_order_input { + border: 1px solid #ddd; + font-size: 10px; + padding: 1px; + width: 23px; +} + +.ui-sortable-helper { + background-color: #fff; + border: 1px solid #aaa; + opacity: 0.6; + filter: alpha(opacity=60); +} + +#media-upload th.order-head { + width: 20%; + text-align: center; +} + +#media-upload th.actions-head { + width: 25%; + text-align: center; +} + +#media-upload a.wp-post-thumbnail { + margin: 0 20px; +} + +#media-items a.delete { + display: block; + float: right; +} + +#media-upload .widefat { + width: 626px; + border-style: solid solid none; +} + +.sorthelper { + height: 37px; + width: 623px; + display: block; +} + +#gallery-settings th.label { + width: 160px; +} + +#gallery-settings #basic th.label { + padding: 5px 5px 5px 0; +} + +#gallery-settings .title { + clear: both; + padding: 0 0 3px; + font-size: 1.6em; + border-bottom: 1px solid #DADADA; +} + +h3.media-title { + font-size: 1.6em; +} + +h4.media-sub-title { + border-bottom: 1px solid #DADADA; + font-size: 1.3em; + margin: 12px; + padding: 0 0 3px; +} + +#gallery-settings .title, +h3.media-title, +h4.media-sub-title { + font-family: Georgia,"Times New Roman",Times,serif; + font-weight: normal; + color: #5A5A5A; +} + +#gallery-settings .describe td { + vertical-align: middle; + height: 3em; +} + +#gallery-settings .describe th.label { + padding-top: .5em; + text-align: left; +} + +#gallery-settings .describe { + padding: 5px; + width: 615px; + clear: both; + cursor: default; +} + +#gallery-settings .describe select { + width: 15em; +} + +#gallery-settings .describe select option, +#gallery-settings .describe td { + padding: 0; +} + +#gallery-settings label, +#gallery-settings legend { + font-size: 13px; + color: #464646; + margin-right: 15px; +} + +#gallery-settings .align .field label { + margin: 0 1.5em 0 0; +} + +#gallery-settings p.ml-submit { + border-top: 1px solid #dfdfdf; +} + +#gallery-settings select#columns { + width: 6em; +} + +#sort-buttons { + font-size: 0.8em; + margin: 3px 25px -8px 0; + text-align: right; + max-width: 625px; +} + +#sort-buttons a { + text-decoration: none; +} + +#sort-buttons #asc, +#sort-buttons #showall { + padding-left: 5px; +} + +#sort-buttons span { + margin-right: 25px; +} diff --git a/src/wp-admin/css/ms.css b/src/wp-admin/css/ms.css new file mode 100644 index 0000000..29d9d54 --- /dev/null +++ b/src/wp-admin/css/ms.css @@ -0,0 +1 @@ +#dashboard_right_now p.musub{margin-top:12px;border-top:1px solid #ececec;padding-left:16px;position:static;}.rtl #dashboard_right_now p.musub{padding-left:0;padding-right:16px;}#dashboard_right_now td.b a.musublink{font-size:16px;}#dashboard_right_now div.musubtable{border-top:none;}#dashboard_right_now div.musubtable .t{white-space:normal;}.wp-list-table .site-deleted{background:#ff8573;}.wp-list-table .site-spammed{background:#faafaa;}.wp-list-table .site-archived{background:#ffebe8;}.wp-list-table .site-mature{background:#fecac2;} \ No newline at end of file diff --git a/src/wp-admin/css/ms.dev.css b/src/wp-admin/css/ms.dev.css new file mode 100644 index 0000000..5a5e749 --- /dev/null +++ b/src/wp-admin/css/ms.dev.css @@ -0,0 +1,38 @@ +/* Dashboard: MS Specific Data */ +#dashboard_right_now p.musub { + margin-top: 12px; + border-top: 1px solid #ececec; + padding-left: 16px; + position: static; +} + +.rtl #dashboard_right_now p.musub { + padding-left: 0; + padding-right: 16px; +} + +#dashboard_right_now td.b a.musublink { + font-size: 16px; +} + +#dashboard_right_now div.musubtable { + border-top: none; +} + +#dashboard_right_now div.musubtable .t { + white-space: normal; +} + +/* Background Color for Site Status */ +.wp-list-table .site-deleted { + background: #ff8573; +} +.wp-list-table .site-spammed { + background: #faafaa; +} +.wp-list-table .site-archived { + background: #ffebe8; +} +.wp-list-table .site-mature { + background: #fecac2; +} diff --git a/src/wp-admin/css/nav-menu-rtl.css b/src/wp-admin/css/nav-menu-rtl.css new file mode 100644 index 0000000..639f5e9 --- /dev/null +++ b/src/wp-admin/css/nav-menu-rtl.css @@ -0,0 +1 @@ +#nav-menus-frame{margin-right:300px;margin-left:0;}#wpbody-content #menu-settings-column{margin-right:-300px;margin-left:0;float:right;}#menu-management-liquid{float:right;}#menu-management{margin-left:20px;margin-right:0;}#post-body{padding:0 10px 10px 0;}.post-body-plain{padding:10px 0 0 10px;}#menu-management .nav-tabs-arrow-left{right:0;left:auto;}#menu-management .nav-tabs-arrow-right{left:0;right:auto;text-align:left;font-family:Tahoma,Arial,sans-serif;}#menu-management .nav-tabs{padding-right:20px;padding-left:10px;}.js #menu-management .nav-tabs{float:right;margin-right:0;margin-left:-400px;}#select-nav-menu-container{text-align:left;}#wpbody .open-label{float:right;}#wpbody .open-label span{padding-left:10px;padding-right:0;}.js .input-with-default-title{font-style:normal;font-weight:bold;}.postbox .howto input{float:left;}#nav-menu-theme-locations .button-controls{text-align:left;}.meta-sep,.submitdelete,.submitcancel{float:right;}#cancel-save{margin-left:0;margin-right:20px;}.list-controls{float:right;}.add-to-menu{float:left;}#add-custom-link label span{float:right;padding-left:5px;padding-right:0;}.howto span{float:right;}.list li .menu-item-title input{margin-left:3px;margin-right:0;}.menu-item-handle{padding-right:10px;padding-left:0;}.menu-item-edit-active .menu-item-handle{-moz-border-radius:3px 3px 0 0;-webkit-border-bottom-left-radius:0;-webkit-border-bottom-right-radius:0;-khtml-border-bottom-left-radius:0;-khtml-border-bottom-right-radius:0;border-bottom-left-radius:0;border-bottom-right-radius:0;}.menu-item-handle .item-title{margin-left:13em;margin-right:0;}.menu-item-depth-0{margin-right:0;margin-left:0;}.menu-item-depth-1{margin-right:30px;margin-left:0;}.menu-item-depth-2{margin-right:60px;margin-left:0;}.menu-item-depth-3{margin-right:90px;margin-left:0;}.menu-item-depth-4{margin-right:120px;margin-left:0;}.menu-item-depth-5{margin-right:150px;margin-left:0;}.menu-item-depth-6{margin-right:180px;margin-left:0;}.menu-item-depth-7{margin-right:210px;margin-left:0;}.menu-item-depth-8{margin-right:240px;margin-left:0;}.menu-item-depth-9{margin-right:270px;margin-left:0;}.menu-item-depth-10{margin-right:300px;margin-left:0;}.menu-item-depth-11{margin-right:330px;margin-left:0;}.menu-item-depth-0 .menu-item-transport{margin-right:0;margin-left:0;}.menu-item-depth-1 .menu-item-transport{margin-right:-30px;margin-left:0;}.menu-item-depth-2 .menu-item-transport{margin-right:-60px;margin-left:0;}.menu-item-depth-3 .menu-item-transport{margin-right:-90px;margin-left:0;}.menu-item-depth-4 .menu-item-transport{margin-right:-120px;margin-left:0;}.menu-item-depth-5 .menu-item-transport{margin-right:-150px;margin-left:0;}.menu-item-depth-6 .menu-item-transport{margin-right:-180px;margin-left:0;}.menu-item-depth-7 .menu-item-transport{margin-right:-210px;margin-left:0;}.menu-item-depth-8 .menu-item-transport{margin-right:-240px;margin-left:0;}.menu-item-depth-9 .menu-item-transport{margin-right:-270px;margin-left:0;}.menu-item-depth-10 .menu-item-transport{margin-right:-300px;margin-left:0;}.menu-item-depth-11 .menu-item-transport{margin-right:-330px;margin-left:0;}.item-type{padding-left:10px;padding-right:0;}.item-controls{left:20px;right:auto;}.item-controls .item-order{padding-left:10px;padding-right:0;}.item-edit{left:-20px;right:auto;-moz-border-radius-bottomright:3px;-moz-border-radius-bottomleft:0;-webkit-border-bottom-right-radius:3px;-webkit-border-bottom-left-radius:0;-khtml-border-bottom-right-radius:3px;-khtml-border-bottom-left-radius:0;border-bottom-right-radius:3px;border-bottom-left-radius:0;}.menu-item-settings{padding:10px 10px 10px 0;border-width:0 1px 1px 1px;}.link-to-original{font-style:normal;font-weight:bold;}.link-to-original a{padding-right:4px;padding-left:0;}.menu-item-settings .description-thin,.menu-item-settings .description-wide{margin-left:10px;margin-right:0;float:right;}.major-publishing-actions .publishing-action{text-align:left;float:left;}.major-publishing-actions .delete-action{text-align:right;float:right;padding-left:15px;padding-right:0;}.menu-name-label{margin-left:15px;margin-right:0;}.auto-add-pages{float:right;} \ No newline at end of file diff --git a/src/wp-admin/css/nav-menu-rtl.dev.css b/src/wp-admin/css/nav-menu-rtl.dev.css new file mode 100644 index 0000000..69d8797 --- /dev/null +++ b/src/wp-admin/css/nav-menu-rtl.dev.css @@ -0,0 +1,210 @@ +#nav-menus-frame { + margin-right: 300px; + margin-left: 0; +} + +#wpbody-content #menu-settings-column { + margin-right: -300px; + margin-left: 0; + float: right; +} + +/* Menu Container */ +#menu-management-liquid { + float: right; +} +#menu-management { + margin-left: 20px; + margin-right: 0; +} + + + #post-body { + padding:0 10px 10px 0; + } + + .post-body-plain { + padding: 10px 0 0 10px; + } + +/* Menu Tabs */ + + #menu-management .nav-tabs-arrow-left { + right: 0; + left:auto; + } + #menu-management .nav-tabs-arrow-right { + left: 0; + right:auto; + text-align: left; + font-family: Tahoma, Arial, sans-serif; + } + +#menu-management .nav-tabs { + padding-right: 20px; + padding-left: 10px; +} +.js #menu-management .nav-tabs { + float: right; + margin-right: 0px; + margin-left: -400px; +} + +#select-nav-menu-container { + text-align: left; +} + +#wpbody .open-label { + float:right; +} + +#wpbody .open-label span { + padding-left: 10px; + padding-right:0; +} + + .js .input-with-default-title { + font-style: normal; + font-weight:bold; + } + +/* Add Menu Item Boxes */ +.postbox .howto input { + float: left; +} +#nav-menu-theme-locations .button-controls { + text-align: left; +} + +/* Button Primary Actions */ + +.meta-sep, +.submitdelete, +.submitcancel { + float:right; +} + +#cancel-save { + margin-left: 0; + margin-right: 20px; +} + +/* Button Secondary Actions */ +.list-controls { + float: right; +} +.add-to-menu { + float: left; +} + +/* Custom Links */ +#add-custom-link label span { float: right; padding-left: 5px; padding-right:0;} +.howto span { float: right; } + +.list li .menu-item-title input { margin-left: 3px; margin-right: 0 } + +/* Nav Menu */ +.menu-item-handle { + padding-right: 10px; + padding-left: 0; +} +.menu-item-edit-active .menu-item-handle { + -moz-border-radius: 3px 3px 0 0; + -webkit-border-bottom-left-radius: 0; + -webkit-border-bottom-right-radius: 0; + -khtml-border-bottom-left-radius: 0; + -khtml-border-bottom-right-radius: 0; + border-bottom-left-radius: 0; + border-bottom-right-radius: 0; +} +.menu-item-handle .item-title { + margin-left:13em; + margin-right:0; +} + + +/* WARNING: The factor of 30px is hardcoded into the nav-menus javascript. */ +.menu-item-depth-0 { margin-right: 0px; margin-left:0;} +.menu-item-depth-1 { margin-right: 30px; margin-left:0;} +.menu-item-depth-2 { margin-right: 60px; margin-left:0;} +.menu-item-depth-3 { margin-right: 90px; margin-left:0;} +.menu-item-depth-4 { margin-right: 120px; margin-left:0;} +.menu-item-depth-5 { margin-right: 150px; margin-left:0;} +.menu-item-depth-6 { margin-right: 180px; margin-left:0;} +.menu-item-depth-7 { margin-right: 210px; margin-left:0;} +.menu-item-depth-8 { margin-right: 240px; margin-left:0;} +.menu-item-depth-9 { margin-right: 270px; margin-left:0;} +.menu-item-depth-10 { margin-right: 300px; margin-left:0;} +.menu-item-depth-11 { margin-right: 330px; margin-left:0;} + +.menu-item-depth-0 .menu-item-transport { margin-right: 0px; margin-left:0;} +.menu-item-depth-1 .menu-item-transport { margin-right: -30px; margin-left:0;} +.menu-item-depth-2 .menu-item-transport { margin-right: -60px; margin-left:0;} +.menu-item-depth-3 .menu-item-transport { margin-right: -90px; margin-left:0;} +.menu-item-depth-4 .menu-item-transport { margin-right: -120px; margin-left:0;} +.menu-item-depth-5 .menu-item-transport { margin-right: -150px; margin-left:0;} +.menu-item-depth-6 .menu-item-transport { margin-right: -180px; margin-left:0;} +.menu-item-depth-7 .menu-item-transport { margin-right: -210px; margin-left:0;} +.menu-item-depth-8 .menu-item-transport { margin-right: -240px; margin-left:0;} +.menu-item-depth-9 .menu-item-transport { margin-right: -270px; margin-left:0;} +.menu-item-depth-10 .menu-item-transport { margin-right: -300px; margin-left:0;} +.menu-item-depth-11 .menu-item-transport { margin-right: -330px; margin-left:0;} + +/* Menu item controls */ +.item-type { padding-left: 10px; padding-right:0;} +.item-controls { left: 20px; right: auto;} +.item-controls .item-order { padding-left: 10px; padding-right: 0;} + +.item-edit { + left: -20px; + right:auto; + -moz-border-radius-bottomright: 3px; + -moz-border-radius-bottomleft: 0; + -webkit-border-bottom-right-radius: 3px; + -webkit-border-bottom-left-radius: 0; + -khtml-border-bottom-right-radius: 3px; + -khtml-border-bottom-left-radius: 0; + border-bottom-right-radius: 3px; + border-bottom-left-radius: 0; +} + +/* Menu editing */ +.menu-item-settings { + padding: 10px 10px 10px 0; + border-width: 0 1px 1px 1px; +} + +.link-to-original { + font-style: normal; + font-weight: bold; +} + .link-to-original a { + padding-right: 4px; + padding-left:0; + } + +.menu-item-settings .description-thin, +.menu-item-settings .description-wide { + margin-left: 10px; + margin-right:0; + float: right; +} + +/* Major/minor publishing actions (classes) */ +.major-publishing-actions .publishing-action { + text-align: left; + float: left; +} +.major-publishing-actions .delete-action { + text-align: right; + float: right; + padding-left: 15px; + padding-right:0; +} +.menu-name-label { + margin-left: 15px; + margin-right:0; +} +.auto-add-pages { + float: right; +} \ No newline at end of file diff --git a/src/wp-admin/css/nav-menu.css b/src/wp-admin/css/nav-menu.css new file mode 100644 index 0000000..a1f5677 --- /dev/null +++ b/src/wp-admin/css/nav-menu.css @@ -0,0 +1 @@ +html,body{min-width:950px;}#nav-menus-frame{margin-left:300px;}#wpbody-content #menu-settings-column{display:inline;width:281px;margin-left:-300px;clear:both;float:left;padding-top:24px;}.no-js #wpbody-content #menu-settings-column{padding-top:31px;}#menu-settings-column .inside{clear:both;}.metabox-holder-disabled .postbox{opacity:.5;filter:alpha(opacity=50);}.metabox-holder-disabled .button-controls .select-all{display:none;}#wpbody{position:relative;}#menu-management-liquid{float:left;min-width:100%;}#menu-management{position:relative;margin-right:20px;margin-top:-3px;width:100%;}#menu-management .menu-edit{border:1px solid;-moz-border-radius:3px;-webkit-border-radius:3px;-khtml-border-radius:3px;border-radius:3px;margin-bottom:20px;}#post-body{padding:10px;border-width:1px 0;border-style:solid;}#nav-menu-header,#nav-menu-footer{padding:0 10px;}#nav-menu-header{border-bottom:1px solid;}#nav-menu-footer{border-top:1px solid;}#post-body div.updated,#post-body div.error{margin:0;}#post-body-content{position:relative;}#menu-management .menu-add-new abbr{font-weight:bold;}#menu-management .nav-tabs-nav{margin:0 20px;}#menu-management .nav-tabs-arrow{width:10px;padding:0 5px 4px;cursor:pointer;position:absolute;top:0;line-height:22px;font-size:18px;text-shadow:0 1px 0 #fff;}#menu-management .nav-tabs-arrow-left{left:0;}#menu-management .nav-tabs-arrow-right{right:0;text-align:right;}#menu-management .nav-tabs-wrapper{width:100%;height:28px;margin-bottom:-1px;overflow:hidden;}#menu-management .nav-tabs{padding-left:20px;padding-right:10px;}.js #menu-management .nav-tabs{float:left;margin-left:0;margin-right:-400px;}#menu-management .nav-tab{margin-bottom:0;font-size:14px;font-family:Georgia,"Times New Roman","Bitstream Charter",Times,serif;}#select-nav-menu-container{text-align:right;padding:0 10px 3px 10px;margin-bottom:5px;}#select-nav-menu{width:100px;display:inline;}#menu-name-label{margin-top:-2px;}#wpbody .open-label{display:block;float:left;}#wpbody .open-label span{padding-right:10px;}.js .input-with-default-title{font-style:italic;}#menu-management .inside{padding:0 10px;}.postbox .howto input{width:180px;float:right;}.customlinkdiv .howto input{width:200px;}#nav-menu-theme-locations .howto select{width:100%;}#nav-menu-theme-locations .button-controls{text-align:right;}.add-menu-item-view-all{height:400px;}#menu-container .submit{margin:0 0 10px;padding:0;}.meta-sep,.submitdelete,.submitcancel{display:block;float:left;font-size:12px;margin:4px 0;line-height:15px;}.meta-sep{padding:0 2px;}#cancel-save{text-decoration:underline;font-size:12px;margin-left:20px;margin-top:5px;}.list-controls{float:left;margin-top:5px;}.add-to-menu{float:right;}.postbox img.waiting{display:none;vertical-align:middle;}.button-controls{clear:both;margin:10px 0;}.show-all,.hide-all{cursor:pointer;}.hide-all{display:none;}#menu-name{width:270px;}#manage-menu .inside{padding:0;}#available-links dt{display:block;}#add-custom-link .howto{font-size:12px;}#add-custom-link label span{display:block;float:left;margin-top:5px;padding-right:5px;}.menu-item-textbox{width:180px;}.howto span{margin-top:4px;display:block;float:left;}.quick-search{width:190px;}.list-wrap{display:none;clear:both;margin-bottom:10px;}.list-container{max-height:200px;overflow-y:auto;padding:10px 10px 5px;border:1px solid;-moz-border-radius:3px;}.postbox p.submit{margin-bottom:0;}.list li{display:none;margin:0;margin-bottom:5px;}.list li .menu-item-title{cursor:pointer;display:block;}.list li .menu-item-title input{margin-right:3px;margin-top:-3px;}#menu-container .inside{padding-bottom:10px;}.menu{padding-top:1em;}#menu-to-edit{padding:1em 0;}.menu ul{width:100%;}.menu li{margin-bottom:0;position:relative;}.menu-item-bar{clear:both;line-height:1.5em;position:relative;margin-top:13px;}.menu-item-handle{border:1px solid #dfdfdf;position:relative;padding-left:10px;height:auto;width:400px;line-height:35px;text-shadow:0 1px 0 #FFF;overflow:hidden;word-wrap:break-word;border-radius:3px;-webkit-border-radius:3px;-moz-border-radius:3px;-khtml-border-radius:3px;}#menu-to-edit .menu-item-invalid .menu-item-handle{background-color:#f6c9cc;background-image:-ms-linear-gradient(bottom,#f6c9cc,#fdf8ff);background-image:-moz-linear-gradient(bottom,#f6c9cc,#fdf8ff);background-image:-o-linear-gradient(bottom,#f6c9cc,#fdf8ff);background-image:-webkit-gradient(linear,left bottom,left top,from(#f6c9cc),to(#fdf8ff));background-image:-webkit-linear-gradient(bottom,#f6c9cc,#fdf8ff);background-image:linear-gradient(bottom,#f6c9cc,#fdf8ff);}.menu-item-edit-active .menu-item-handle{-moz-border-radius:3px 3px 0 0;-webkit-border-bottom-right-radius:0;-webkit-border-bottom-left-radius:0;-khtml-border-bottom-right-radius:0;-khtml-border-bottom-left-radius:0;border-bottom-right-radius:0;border-bottom-left-radius:0;}.no-js .menu-item-edit-active .item-edit{display:none;}.js .menu-item-handle{cursor:move;}.menu li.deleting .menu-item-handle{background-image:none;text-shadow:0;}.menu-item-handle .item-title{font-size:12px;font-weight:bold;padding:7px 0;line-height:20px;display:block;margin-right:13em;}li.menu-item.ui-sortable-helper dl{margin-top:0;}li.menu-item.ui-sortable-helper .menu-item-transport dl{margin-top:13px;}.menu .sortable-placeholder{height:35px;width:410px;margin-top:13px;}.menu-item-depth-0{margin-left:0;}.menu-item-depth-1{margin-left:30px;}.menu-item-depth-2{margin-left:60px;}.menu-item-depth-3{margin-left:90px;}.menu-item-depth-4{margin-left:120px;}.menu-item-depth-5{margin-left:150px;}.menu-item-depth-6{margin-left:180px;}.menu-item-depth-7{margin-left:210px;}.menu-item-depth-8{margin-left:240px;}.menu-item-depth-9{margin-left:270px;}.menu-item-depth-10{margin-left:300px;}.menu-item-depth-11{margin-left:330px;}.menu-item-depth-0 .menu-item-transport{margin-left:0;}.menu-item-depth-1 .menu-item-transport{margin-left:-30px;}.menu-item-depth-2 .menu-item-transport{margin-left:-60px;}.menu-item-depth-3 .menu-item-transport{margin-left:-90px;}.menu-item-depth-4 .menu-item-transport{margin-left:-120px;}.menu-item-depth-5 .menu-item-transport{margin-left:-150px;}.menu-item-depth-6 .menu-item-transport{margin-left:-180px;}.menu-item-depth-7 .menu-item-transport{margin-left:-210px;}.menu-item-depth-8 .menu-item-transport{margin-left:-240px;}.menu-item-depth-9 .menu-item-transport{margin-left:-270px;}.menu-item-depth-10 .menu-item-transport{margin-left:-300px;}.menu-item-depth-11 .menu-item-transport{margin-left:-330px;}body.menu-max-depth-0{min-width:950px!important;}body.menu-max-depth-1{min-width:980px!important;}body.menu-max-depth-2{min-width:1010px!important;}body.menu-max-depth-3{min-width:1040px!important;}body.menu-max-depth-4{min-width:1070px!important;}body.menu-max-depth-5{min-width:1100px!important;}body.menu-max-depth-6{min-width:1130px!important;}body.menu-max-depth-7{min-width:1160px!important;}body.menu-max-depth-8{min-width:1190px!important;}body.menu-max-depth-9{min-width:1220px!important;}body.menu-max-depth-10{min-width:1250px!important;}body.menu-max-depth-11{min-width:1280px!important;}.item-type{font-size:12px;padding-right:10px;}.item-controls{font-size:12px;position:absolute;right:20px;top:-1px;}.item-controls a{text-decoration:none;}.item-controls a:hover{cursor:pointer;}.item-controls .item-order{padding-right:10px;}.item-controls .item-order a{font-weight:bold;}body.js .item-order{display:none;}.item-edit{position:absolute;right:-20px;top:0;display:block;width:30px;height:36px;overflow:hidden;text-indent:-999em;border-bottom:1px solid;-moz-border-radius-bottomleft:3px;-webkit-border-bottom-left-radius:3px;-khtml-border-bottom-left-radius:3px;border-bottom-left-radius:3px;}.menu-instructions-inactive{display:none;}.menu-item-settings{display:block;width:400px;padding:10px 0 10px 10px;border:solid;border-width:0 1px 1px 1px;-moz-border-radius:0 0 3px 3px;-webkit-border-bottom-right-radius:3px;-webkit-border-bottom-left-radius:3px;-khtml-border-bottom-right-radius:3px;-khtml-border-bottom-left-radius:3px;}.menu-item-edit-active .menu-item-settings{display:block;}.menu-item-edit-inactive .menu-item-settings{display:none;}.add-menu-item-pagelinks{margin:.5em auto;text-align:center;}.link-to-original{display:block;margin:0 0 10px;padding:3px 5px 5px;font-size:12px;font-style:italic;border:1px solid;border-radius:3px;-webkit-border-radius:3px;-moz-border-radius:3px;-khtml-border-radius:3px;}.link-to-original a{padding-left:4px;font-style:normal;}.hidden-field{display:none;}.menu-item-settings .description-thin,.menu-item-settings .description-wide{margin-right:10px;float:left;}.description-thin{width:190px;height:40px;}.description-wide{width:390px;}.menu-item-actions{padding-top:15px;}#cancel-save{cursor:pointer;}.major-publishing-actions{clear:both;padding:3px 0 5px;}.major-publishing-actions .publishing-action{text-align:right;float:right;line-height:23px;margin:5px 0 1px;}.major-publishing-actions .delete-action{vertical-align:middle;text-align:left;float:left;padding-right:15px;margin-top:5px;}.menu-name-label span,.auto-add-pages label{font-size:12px;font-style:normal;}.menu-name-label{margin-right:15px;}.auto-add-pages input{margin-top:0;}.auto-add-pages{margin-top:4px;float:left;}.submitbox .submitcancel{border-bottom:1px solid;padding:1px 2px;text-decoration:none;}.major-publishing-actions .form-invalid{padding-left:4px;margin-left:-4px;border-radius:3px;-webkit-border-radius:3px;-moz-border-radius:3px;-khtml-border-radius:3px;}#menu-item-name-wrap:after,#menu-item-url-wrap:after,#menu-name-label:after,#menu-settings-column .inside:after,#nav-menus-frame:after,#post-body-content:after,.button-controls:after,.major-publishing-actions:after,.menu-item-settings:after{clear:both;content:".";display:block;height:0;visibility:hidden;}#nav-menus-frame,.button-controls,#menu-item-url-wrap,#menu-item-name-wrap{display:block;} \ No newline at end of file diff --git a/src/wp-admin/css/nav-menu.dev.css b/src/wp-admin/css/nav-menu.dev.css new file mode 100644 index 0000000..7224ee3 --- /dev/null +++ b/src/wp-admin/css/nav-menu.dev.css @@ -0,0 +1,705 @@ +/** + * WordPress Administration Custom Navigation + * Interface CSS + * + * @version 2.0.0 + * + * @package WordPress + * @subpackage Administration + */ + +html, +body { + min-width: 950px; +} + +#nav-menus-frame { + margin-left: 300px; +} + +#wpbody-content #menu-settings-column { + display:inline; + width:281px; + margin-left: -300px; + clear: both; + float: left; + padding-top: 24px; +} + .no-js #wpbody-content #menu-settings-column { + padding-top: 31px; + } + +#menu-settings-column .inside { + clear: both; +} + +.metabox-holder-disabled .postbox { + opacity: 0.5; + filter: alpha(opacity=50); +} + +.metabox-holder-disabled .button-controls .select-all { + display: none; +} +#wpbody { + position: relative; +} + +/* Menu Container */ +#menu-management-liquid { + float: left; + min-width: 100%; +} + +#menu-management { + position: relative; + margin-right: 20px; + margin-top: -3px; + width: 100%; +} + +#menu-management .menu-edit { + border: 1px solid; + -moz-border-radius: 3px; + -webkit-border-radius: 3px; + -khtml-border-radius: 3px; + border-radius: 3px; + margin-bottom: 20px; +} + +#post-body { + padding: 10px; + border-width: 1px 0; + border-style: solid; +} + +#nav-menu-header, +#nav-menu-footer { + padding: 0 10px; +} + +#nav-menu-header { + border-bottom: 1px solid; +} + +#nav-menu-footer { + border-top: 1px solid; +} + +#post-body div.updated, #post-body div.error { + margin: 0; +} + +#post-body-content { + position: relative; +} + +#menu-management .menu-add-new abbr { + font-weight:bold; +} + +/* Menu Tabs */ + +#menu-management .nav-tabs-nav { + margin: 0 20px; +} + +#menu-management .nav-tabs-arrow { + width: 10px; + padding: 0 5px 4px; + cursor: pointer; + position: absolute; + top: 0; + line-height: 22px; + font-size: 18px; + text-shadow: 0 1px 0 #fff; +} + +#menu-management .nav-tabs-arrow a:hover{ +} + +#menu-management .nav-tabs-arrow a:active { +} + +#menu-management .nav-tabs-arrow-left { + left: 0; +} + +#menu-management .nav-tabs-arrow-right { + right: 0; + text-align: right; +} + +#menu-management .nav-tabs-wrapper { + width: 100%; + height: 28px; + margin-bottom: -1px; + overflow: hidden; +} + +#menu-management .nav-tabs { + padding-left: 20px; + padding-right: 10px; +} + +.js #menu-management .nav-tabs { + float: left; + margin-left: 0px; + margin-right: -400px; +} + +#menu-management .nav-tab { + margin-bottom: 0; + font-size: 14px; + font-family: Georgia, "Times New Roman", "Bitstream Charter", Times, serif; +} + + +#select-nav-menu-container { + text-align: right; + padding: 0 10px 3px 10px; + margin-bottom: 5px; +} + +#select-nav-menu { + width: 100px; + display: inline; +} + +#menu-name-label { + margin-top: -2px; +} + +#wpbody .open-label { + display: block; + float:left; +} + +#wpbody .open-label span { + padding-right: 10px; +} + +.js .input-with-default-title { + font-style: italic; +} + +#menu-management .inside { + padding: 0 10px; +} + +/* Add Menu Item Boxes */ +.postbox .howto input { + width: 180px; + float: right; +} + +.customlinkdiv .howto input { + width: 200px; +} + +#nav-menu-theme-locations .howto select { + width: 100%; +} + +#nav-menu-theme-locations .button-controls { + text-align: right; +} + +.add-menu-item-view-all { + height: 400px; +} + +/* Button Primary Actions */ +#menu-container .submit { + margin: 0px 0px 10px; + padding: 0px; +} + +.meta-sep, +.submitdelete, +.submitcancel { + display:block; + float:left; + font-size: 12px; + margin: 4px 0; + line-height: 15px; +} + +.meta-sep { + padding: 0 2px; +} + +#cancel-save { + text-decoration: underline; + font-size: 12px; + margin-left: 20px; + margin-top: 5px; +} + +/* Button Secondary Actions */ +.list-controls { + float: left; + margin-top: 5px; +} + +.add-to-menu { + float: right; +} + +.postbox img.waiting { + display: none; + vertical-align: middle; +} + +.button-controls { + clear:both; + margin: 10px 0; +} + +.show-all, .hide-all { + cursor: pointer; +} + +.hide-all { + display: none; +} + +/* Create Menu */ +#menu-name { + width: 270px; +} + +#manage-menu .inside { + padding: 0px 0px; +} + +/* Custom Links */ +#available-links dt { + display: block; +} + +#add-custom-link .howto { + font-size: 12px; +} + +#add-custom-link label span { + display: block; + float: left; + margin-top: 5px; + padding-right: 5px; +} + +.menu-item-textbox { + width: 180px; +} + +.howto span { + margin-top: 4px; + display: block; + float: left; +} + +/* Menu item types */ +.quick-search { + width: 190px; +} + +.list-wrap { + display: none; + clear: both; + margin-bottom: 10px; +} + +.list-container { + max-height: 200px; + overflow-y: auto; + padding: 10px 10px 5px; + border: 1px solid; + -moz-border-radius: 3px; +} + +.postbox p.submit { + margin-bottom: 0; +} + +/* Listings */ +.list li { + display: none; + margin: 0; + margin-bottom: 5px; +} + +.list li .menu-item-title { + cursor: pointer; + display: block; +} + +.list li .menu-item-title input { + margin-right: 3px; + margin-top: -3px; +} + +/* Nav Menu */ +#menu-container .inside { + padding-bottom: 10px; +} + +.menu { + padding-top:1em; +} + +#menu-to-edit { + padding: 1em 0; +} + +.menu ul { + width: 100%; +} + +.menu ul.sub-menu { +} + +.menu li { + margin-bottom: 0; + position:relative; +} + +.menu-item-bar { + clear:both; + line-height:1.5em; + position:relative; + margin-top: 13px; +} + +.menu-item-handle { + border: 1px solid #dfdfdf; + position: relative; + padding-left: 10px; + height: auto; + width: 400px; + line-height: 35px; + text-shadow: 0 1px 0 #FFFFFF; + overflow: hidden; + word-wrap: break-word; + border-radius: 3px; + -webkit-border-radius: 3px; + -moz-border-radius: 3px; + -khtml-border-radius: 3px; +} + +#menu-to-edit .menu-item-invalid .menu-item-handle { + background-color: #f6c9cc; /* Fallback */ + background-image: -ms-linear-gradient(bottom, #f6c9cc, #fdf8ff); /* IE10 */ + background-image: -moz-linear-gradient(bottom, #f6c9cc, #fdf8ff); /* Firefox */ + background-image: -o-linear-gradient(bottom, #f6c9cc, #fdf8ff); /* Opera */ + background-image: -webkit-gradient(linear, left bottom, left top, from(#f6c9cc), to(#fdf8ff)); /* old Webkit */ + background-image: -webkit-linear-gradient(bottom, #f6c9cc, #fdf8ff); /* new Webkit */ + background-image: linear-gradient(bottom, #f6c9cc, #fdf8ff); /* proposed W3C Markup */ +} + +.menu-item-edit-active .menu-item-handle { + -moz-border-radius: 3px 3px 0 0; + -webkit-border-bottom-right-radius: 0; + -webkit-border-bottom-left-radius: 0; + -khtml-border-bottom-right-radius: 0; + -khtml-border-bottom-left-radius: 0; + border-bottom-right-radius: 0; + border-bottom-left-radius: 0; +} + +.no-js .menu-item-edit-active .item-edit { + display: none; +} + +.js .menu-item-handle { + cursor: move; +} + +.menu li.deleting .menu-item-handle { + background-image: none; + text-shadow: 0 0 0; +} + +.menu-item-handle .item-title { + font-size: 12px; + font-weight: bold; + padding: 7px 0; + line-height: 20px; + display:block; + margin-right:13em; +} + +/* Sortables */ +li.menu-item.ui-sortable-helper dl { + margin-top: 0; +} + +li.menu-item.ui-sortable-helper .menu-item-transport dl { + margin-top: 13px; +} + +.menu .sortable-placeholder { + height: 35px; + width: 410px; + margin-top: 13px; +} + +/* WARNING: The factor of 30px is hardcoded into the nav-menus javascript. */ +.menu-item-depth-0 { margin-left: 0px; } +.menu-item-depth-1 { margin-left: 30px; } +.menu-item-depth-2 { margin-left: 60px; } +.menu-item-depth-3 { margin-left: 90px; } +.menu-item-depth-4 { margin-left: 120px; } +.menu-item-depth-5 { margin-left: 150px; } +.menu-item-depth-6 { margin-left: 180px; } +.menu-item-depth-7 { margin-left: 210px; } +.menu-item-depth-8 { margin-left: 240px; } +.menu-item-depth-9 { margin-left: 270px; } +.menu-item-depth-10 { margin-left: 300px; } +.menu-item-depth-11 { margin-left: 330px; } + +.menu-item-depth-0 .menu-item-transport { margin-left: 0px; } +.menu-item-depth-1 .menu-item-transport { margin-left: -30px; } +.menu-item-depth-2 .menu-item-transport { margin-left: -60px; } +.menu-item-depth-3 .menu-item-transport { margin-left: -90px; } +.menu-item-depth-4 .menu-item-transport { margin-left: -120px; } +.menu-item-depth-5 .menu-item-transport { margin-left: -150px; } +.menu-item-depth-6 .menu-item-transport { margin-left: -180px; } +.menu-item-depth-7 .menu-item-transport { margin-left: -210px; } +.menu-item-depth-8 .menu-item-transport { margin-left: -240px; } +.menu-item-depth-9 .menu-item-transport { margin-left: -270px; } +.menu-item-depth-10 .menu-item-transport { margin-left: -300px; } +.menu-item-depth-11 .menu-item-transport { margin-left: -330px; } + +body.menu-max-depth-0 { min-width: 950px !important; } +body.menu-max-depth-1 { min-width: 980px !important; } +body.menu-max-depth-2 { min-width: 1010px !important; } +body.menu-max-depth-3 { min-width: 1040px !important; } +body.menu-max-depth-4 { min-width: 1070px !important; } +body.menu-max-depth-5 { min-width: 1100px !important; } +body.menu-max-depth-6 { min-width: 1130px !important; } +body.menu-max-depth-7 { min-width: 1160px !important; } +body.menu-max-depth-8 { min-width: 1190px !important; } +body.menu-max-depth-9 { min-width: 1220px !important; } +body.menu-max-depth-10 { min-width: 1250px !important; } +body.menu-max-depth-11 { min-width: 1280px !important; } + +/* Menu item controls */ +.item-type { + font-size: 12px; + padding-right: 10px; +} + +.item-controls { + font-size: 12px; + position: absolute; + right: 20px; + top: -1px; +} + +.item-controls a { + text-decoration: none; +} + +.item-controls a:hover { + cursor: pointer; +} + +.item-controls .item-order { + padding-right: 10px; +} + +.item-controls .item-order a { + font-weight:bold; +} + +body.js .item-order { + display:none; +} + +.item-controls .menu-item-delete:hover { +} + +.item-edit { + position: absolute; + right: -20px; + top: 0; + display: block; + width:30px; + height: 36px; + overflow: hidden; + text-indent:-999em; + border-bottom: 1px solid; + -moz-border-radius-bottomleft: 3px; + -webkit-border-bottom-left-radius: 3px; + -khtml-border-bottom-left-radius: 3px; + border-bottom-left-radius: 3px; +} + +.item-edit:hover { +} + +/* Menu editing */ +.menu-instructions-inactive { + display: none; +} + +.menu-item-settings { + display:block; + width: 400px; + padding: 10px 0 10px 10px; + border: solid; + border-width: 0 1px 1px 1px; + -moz-border-radius: 0 0 3px 3px; + -webkit-border-bottom-right-radius: 3px; + -webkit-border-bottom-left-radius: 3px; + -khtml-border-bottom-right-radius: 3px; + -khtml-border-bottom-left-radius: 3px; +} + +.menu-item-edit-active .menu-item-settings { + display:block; +} + +.menu-item-edit-inactive .menu-item-settings { + display:none; +} + +.add-menu-item-pagelinks { + margin:.5em auto; + text-align:center; +} + +.link-to-original { + display: block; + margin: 0 0 10px; + padding: 3px 5px 5px; + font-size: 12px; + font-style: italic; + border: 1px solid; + border-radius: 3px; + -webkit-border-radius: 3px; + -moz-border-radius: 3px; + -khtml-border-radius: 3px; +} + +.link-to-original a { + padding-left: 4px; + font-style: normal; +} + +.hidden-field { + display: none; +} + +.menu-item-settings .description-thin, +.menu-item-settings .description-wide { + margin-right: 10px; + float: left; +} + +.description-thin { + width: 190px; + height: 40px; +} + +.description-wide { + width: 390px; +} + +.menu-item-actions { + padding-top: 15px; +} + +#cancel-save { + cursor: pointer; +} + +#cancel-save:hover { +} + +#update-menu-item { +} + +#update-menu-item:hover, +#update-menu-item:active, +#update-menu-item:focus { +} + +/* Major/minor publishing actions (classes) */ +.major-publishing-actions { + clear:both; + padding: 3px 0 5px; +} + +.major-publishing-actions .publishing-action { + text-align: right; + float: right; + line-height: 23px; + margin: 5px 0 1px; +} + +.major-publishing-actions .delete-action { + vertical-align: middle; + text-align: left; + float: left; + padding-right: 15px; + margin-top: 5px; +} + +.menu-name-label span, .auto-add-pages label { + font-size: 12px; + font-style: normal; +} + +.menu-name-label { + margin-right: 15px; +} + +.auto-add-pages input { + margin-top: 0; +} + +.auto-add-pages { + margin-top: 4px; + float: left; +} + +.submitbox .submitcancel { + border-bottom: 1px solid; + padding: 1px 2px; + text-decoration: none; +} + +.submitbox .submitcancel:hover { +} + +.major-publishing-actions .form-invalid { + padding-left: 4px; + margin-left: -4px; + border-radius: 3px; + -webkit-border-radius: 3px; + -moz-border-radius: 3px; + -khtml-border-radius: 3px; +} + +/* Clearfix */ +#menu-item-name-wrap:after, +#menu-item-url-wrap:after, +#menu-name-label:after, +#menu-settings-column .inside:after, +#nav-menus-frame:after, +#post-body-content:after, +.button-controls:after, +.major-publishing-actions:after, +.menu-item-settings:after { + clear: both; + content: "."; + display: block; + height: 0; + visibility: hidden; +} + +#nav-menus-frame, .button-controls, #menu-item-url-wrap, #menu-item-name-wrap { + display: block; +} diff --git a/src/wp-admin/css/plugin-install-rtl.css b/src/wp-admin/css/plugin-install-rtl.css new file mode 100644 index 0000000..f1ade77 --- /dev/null +++ b/src/wp-admin/css/plugin-install-rtl.css @@ -0,0 +1 @@ +div.star{left:auto;right:0;letter-spacing:0;}.star img,div.star a,div.star a:hover,div.star a:visited{right:auto;left:0;}#plugin-information ul#sidemenu{left:auto;right:0;}#plugin-information h2{margin-right:0;margin-left:200px;}#plugin-information .fyi{margin-left:5px;margin-right:20px;}#plugin-information .fyi h2{margin-left:0;}#plugin-information .fyi ul{padding:10px 7px 10px 5px;}#plugin-information #section-screenshots li p{padding-left:0;padding-right:20px;}#plugin-information .updated,#plugin-information pre{margin-right:0;margin-left:215px;}#plugin-information .updated,#plugin-information .error{clear:none;direction:rtl;}#section-description{direction:ltr;} \ No newline at end of file diff --git a/src/wp-admin/css/plugin-install-rtl.dev.css b/src/wp-admin/css/plugin-install-rtl.dev.css new file mode 100644 index 0000000..9a6dd11 --- /dev/null +++ b/src/wp-admin/css/plugin-install-rtl.dev.css @@ -0,0 +1,43 @@ +div.star { + left: auto; + right: 0; + letter-spacing: 0; +} +.star img, div.star a, div.star a:hover, div.star a:visited { + right: auto; + left: 0; +} +#plugin-information ul#sidemenu { + left: auto; + right: 0; +} +#plugin-information h2 { + margin-right: 0; + margin-left: 200px; +} +#plugin-information .fyi { + margin-left: 5px; + margin-right: 20px; +} +#plugin-information .fyi h2 { + margin-left: 0; +} +#plugin-information .fyi ul { + padding: 10px 7px 10px 5px; +} +#plugin-information #section-screenshots li p { + padding-left: 0; + padding-right: 20px; +} +#plugin-information .updated, +#plugin-information pre { + margin-right: 0; + margin-left: 215px; +} +#plugin-information .updated, #plugin-information .error { + clear: none; + direction: rtl; +} +#section-description { + direction: ltr; +} diff --git a/src/wp-admin/css/plugin-install.css b/src/wp-admin/css/plugin-install.css new file mode 100644 index 0000000..939408f --- /dev/null +++ b/src/wp-admin/css/plugin-install.css @@ -0,0 +1 @@ +div.star-holder{position:relative;height:19px;width:100px;font-size:19px;}div.action-links{font-weight:normal;margin:6px 0 0;}div.star{height:100%;position:absolute;top:0;left:0;background-color:transparent;letter-spacing:1ex;border:none;}.star1{width:20%;}.star2{width:40%;}.star3{width:60%;}.star4{width:80%;}.star5{width:100%;}.star img,div.star a,div.star a:hover,div.star a:visited{display:block;position:absolute;right:0;border:none;text-decoration:none;}div.star img{width:19px;height:19px;}#plugin-information-header{margin:0;padding:0 5px;font-weight:bold;position:relative;border-bottom-width:1px;border-bottom-style:solid;height:2.5em;}#plugin-information ul#sidemenu{font-weight:normal;margin:0 5px;position:absolute;left:0;bottom:-1px;}#plugin-information p.action-button{width:100%;padding-bottom:0;margin-bottom:0;margin-top:10px;-moz-border-radius:3px 0 0 3px;-webkit-border-top-left-radius:3px;-khtml-border-top-left-radius:3px;border-top-left-radius:3px;-webkit-border-bottom-left-radius:3px;-khtml-border-bottom-left-radius:3px;border-bottom-left-radius:3px;}#plugin-information .action-button a{text-align:center;font-weight:bold;text-decoration:none;display:block;line-height:2em;}#plugin-information h2{clear:none!important;margin-right:200px;}#plugin-information .fyi{margin:0 10px 50px;width:210px;}#plugin-information .fyi h2{font-size:.9em;margin-bottom:0;margin-right:0;}#plugin-information .fyi h2.mainheader{padding:5px;-moz-border-radius-topleft:3px;-webkit-border-top-left-radius:3px;-khtml-border-top-left-radius:3px;border-top-left-radius:3px;}#plugin-information .fyi ul{padding:10px 5px 10px 7px;margin:0;list-style:none;-moz-border-radius-bottomleft:3px;-webkit-border-bottom-left-radius:3px;-khtml-border-bottom-left-radius:3px;border-bottom-left-radius:3px;}#plugin-information .fyi li{margin-right:0;}#plugin-information #section-holder{padding:10px;}#plugin-information .section ul,#plugin-information .section ol{margin-left:16px;list-style-type:square;list-style-image:none;}#plugin-information #section-screenshots li img{vertical-align:text-top;}#plugin-information #section-screenshots li p{font-style:italic;padding-left:20px;padding-bottom:2em;}#plugin-information .updated,#plugin-information pre{margin-right:215px;}#plugin-information pre{padding:7px;} \ No newline at end of file diff --git a/src/wp-admin/css/plugin-install.dev.css b/src/wp-admin/css/plugin-install.dev.css new file mode 100644 index 0000000..2204257 --- /dev/null +++ b/src/wp-admin/css/plugin-install.dev.css @@ -0,0 +1,150 @@ +/* NOTE: the following CSS rules(.star*) are taken more or less straight from the bbPress rating plugin. */ +div.star-holder { + position: relative; + height: 19px; + width: 100px; + font-size: 19px; +} + +div.action-links { + font-weight: normal; + margin: 6px 0 0; +} + +div.star { + height: 100%; + position: absolute; + top: 0; + left: 0; + background-color: transparent; + letter-spacing: 1ex; + border: none; +} + +.star1 { width: 20%; } +.star2 { width: 40%; } +.star3 { width: 60%; } +.star4 { width: 80%; } +.star5 { width: 100%; } + +.star img, div.star a, div.star a:hover, div.star a:visited { + display: block; + position: absolute; + right: 0; + border: none; + text-decoration: none; +} + +div.star img { + width: 19px; + height: 19px; +} + +/* Header on thickbox */ +#plugin-information-header { + margin: 0; + padding: 0 5px; + font-weight: bold; + position: relative; + border-bottom-width: 1px; + border-bottom-style: solid; + height: 2.5em; +} +#plugin-information ul#sidemenu { + font-weight: normal; + margin: 0 5px; + position: absolute; + left: 0; + bottom: -1px; +} + +/* Install sidemenu */ +#plugin-information p.action-button { + width: 100%; + padding-bottom: 0; + margin-bottom: 0; + margin-top: 10px; + -moz-border-radius: 3px 0 0 3px; + -webkit-border-top-left-radius: 3px; + -khtml-border-top-left-radius: 3px; + border-top-left-radius: 3px; + -webkit-border-bottom-left-radius: 3px; + -khtml-border-bottom-left-radius: 3px; + border-bottom-left-radius: 3px; +} + +#plugin-information .action-button a { + text-align: center; + font-weight: bold; + text-decoration: none; + display: block; + line-height: 2em; +} + +#plugin-information h2 { + clear: none !important; + margin-right: 200px; +} + +#plugin-information .fyi { + margin: 0 10px 50px; + width: 210px; +} + +#plugin-information .fyi h2 { + font-size: 0.9em; + margin-bottom: 0; + margin-right: 0; +} + +#plugin-information .fyi h2.mainheader { + padding: 5px; + -moz-border-radius-topleft: 3px; + -webkit-border-top-left-radius: 3px; + -khtml-border-top-left-radius: 3px; + border-top-left-radius: 3px; +} + +#plugin-information .fyi ul { + padding: 10px 5px 10px 7px; + margin: 0; + list-style: none; + -moz-border-radius-bottomleft: 3px; + -webkit-border-bottom-left-radius: 3px; + -khtml-border-bottom-left-radius: 3px; + border-bottom-left-radius: 3px; +} + +#plugin-information .fyi li { + margin-right: 0; +} + +#plugin-information #section-holder { + padding: 10px; +} + +#plugin-information .section ul, +#plugin-information .section ol { + margin-left: 16px; + list-style-type: square; + list-style-image: none; +} + +#plugin-information #section-screenshots li img { + vertical-align: text-top; +} + +#plugin-information #section-screenshots li p { + font-style: italic; + padding-left: 20px; + padding-bottom: 2em; +} + +#plugin-information .updated, +#plugin-information pre { + margin-right: 215px; +} + +#plugin-information pre { + padding: 7px; +} diff --git a/src/wp-admin/css/press-this-rtl.css b/src/wp-admin/css/press-this-rtl.css new file mode 100644 index 0000000..a19d20c --- /dev/null +++ b/src/wp-admin/css/press-this-rtl.css @@ -0,0 +1 @@ +body{font-family:Tahoma,Arial;}#poststuff #edButtonPreview,#poststuff #edButtonHTML{float:left;}#poststuff #edButtonHTML{margin-left:15px;margin-right:5px;}#header-logo,#wphead h1{float:right;}div#poststuff{padding-left:0;padding-right:10px;}.posting{margin-left:212px;margin-right:0;position:relative;}#side-info-column{float:left;right:auto;left:0;}h3.tb{margin-left:0;margin-right:5px;}#publish{float:left;}.postbox .handlediv{float:left;}.actions{float:left;}.actions li{float:right;margin-right:0;margin-left:10px;}#extra-fields .actions{margin:-23px 0 0 -7px;}#img_container a{float:right;}#category-add input,#category-add select{font-family:Tahoma,Arial;}.inline-editor ul.cat-checklist ul,.categorydiv ul.categorychecklist ul,#linkcategorydiv ul.categorychecklist ul{margin-left:0;margin-right:18px;}.category-tabs li{padding-left:0;padding-right:8px;}#tagsdiv #newtag{margin-right:0;margin-left:5px;}#tagadd{margin-left:0;margin-right:3px;}#tagchecklist span{margin-left:.5em;margin-right:10px;float:right;}#tagchecklist span a{margin:6px -9px 0 0;float:right;}#content{margin-left:0;margin-right:1%;}.submit input,.button,.button-primary,.button-secondary,.button-highlighted,#postcustomstuff .submit input{font-family:Tahoma,Arial,sans-serif;}.ac_results li{text-align:right;}#TB_ajaxContent #options{right:auto;left:25px;}#post_status{margin-left:0;margin-right:10px;}#footer{padding:10px 60px 0 0;} \ No newline at end of file diff --git a/src/wp-admin/css/press-this-rtl.dev.css b/src/wp-admin/css/press-this-rtl.dev.css new file mode 100644 index 0000000..fbb1456 --- /dev/null +++ b/src/wp-admin/css/press-this-rtl.dev.css @@ -0,0 +1,140 @@ +body { + font-family: Tahoma, Arial; +} + +#poststuff #edButtonPreview, +#poststuff #edButtonHTML { + float: left; +} + +#poststuff #edButtonHTML { + margin-left: 15px; + margin-right: 5px; +} + +#header-logo, +#wphead h1 { + float: right; +} + +/* Editor/Main Column */ +div#poststuff { + padding-left: 0; + padding-right: 10px; +} + +.posting { + margin-left: 212px; + margin-right: 0; + position: relative; +} + +#side-info-column { + float: left; + right: auto; + left: 0; +} + +h3.tb { + margin-left: 0; + margin-right: 5px; +} + +#publish { + float: left; +} + +.postbox .handlediv { + float: left; +} + +.actions { + float: left; +} + +.actions li { + float: right; + margin-right: 0; + margin-left: 10px; +} + +#extra-fields .actions { + margin: -23px 0 0 -7px; +} + +/* Photo Styles */ +#img_container a { + float: right; +} + +#category-add input, +#category-add select { + font-family: Tahoma, Arial; +} + +.inline-editor ul.cat-checklist ul, +.categorydiv ul.categorychecklist ul, +#linkcategorydiv ul.categorychecklist ul { + margin-left: 0; + margin-right: 18px; +} + +/* Categories */ +.category-tabs li { + padding-left: 0; + padding-right: 8px; +} + +/* Tags */ +#tagsdiv #newtag { + margin-right: 0; + margin-left: 5px; +} + +#tagadd { + margin-left: 0; + margin-right: 3px; +} + +#tagchecklist span { + margin-left: .5em; + margin-right: 10px; + float: right; +} +#tagchecklist span a { + margin: 6px -9px 0 0; + float: right; +} + +#content { + margin-left: 0; + margin-right: 1%; +} + +.submit input, +.button, +.button-primary, +.button-secondary, +.button-highlighted, +#postcustomstuff .submit input { + font-family: Tahoma, Arial, sans-serif; +} + +.ac_results li { + text-align: right; +} + +#TB_ajaxContent #options { + right: auto; + left: 25px; +} + +#post_status { + margin-left: 0; + margin-right: 10px; +} + +/* Footer */ +#footer { + padding: 10px 60px 0 0; +} diff --git a/src/wp-admin/css/press-this.css b/src/wp-admin/css/press-this.css new file mode 100644 index 0000000..fd1970a --- /dev/null +++ b/src/wp-admin/css/press-this.css @@ -0,0 +1 @@ +body{font-size:13px;font-family:sans-serif;color:#333;margin:0;padding:0;min-width:675px;min-height:400px;}img{border:none;}#wphead{height:32px;margin-right:5px;margin-bottom:5px;}#header-logo{float:left;margin:7px 7px 0;-webkit-user-select:none;-moz-user-select:none;-khtml-user-select:none;user-select:none;}#wphead h1{font:normal 16px Georgia,"Times New Roman","Bitstream Charter",Times,serif;padding:6px 0 0;margin:0;float:left;}#wphead h1 a{text-decoration:none;}#wphead h1 a:hover{text-decoration:underline;}.tagchecklist span a{background:transparent url(../images/xit.gif) no-repeat 0 0;}#edButtonPreview,#edButtonHTML{height:18px;margin:5px 5px 0 0;padding:4px 5px 2px;float:right;cursor:pointer;border-width:1px;border-style:solid;-moz-border-radius:3px 3px 0 0;-webkit-border-top-right-radius:3px;-webkit-border-top-left-radius:3px;-khtml-border-top-right-radius:3px;-khtml-border-top-left-radius:3px;border-top-right-radius:3px;border-top-left-radius:3px;}#poststuff #edButtonHTML{margin-right:15px;}#media-buttons{cursor:default;padding:8px 8px 0;}#media-buttons a{cursor:pointer;padding:0 0 5px 10px;}#media-buttons img,#submitpost #ajax-loading,#submitpost .ajax-loading{vertical-align:middle;}.howto{margin-top:2px;margin-bottom:3px;font-size:12px;font-style:italic;display:block;}input.text{outline-color:-moz-use-text-color;outline-style:none;outline-width:medium;width:100%;}#message{-moz-border-radius:3px;-khtml-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;}div#poststuff{margin:0 10px 10px;}#poststuff #editor-toolbar{height:30px;}div.zerosize{border:0 none;height:0;margin:0;overflow:hidden;padding:0;width:0;}.posting{margin-right:212px;position:relative;}#side-info-column{float:right;width:200px;position:relative;right:0;}#side-info-column .sleeve{padding-top:5px;}#poststuff .inside{font-size:12px;margin:8px;}#submitdiv .inside{margin:0;}#submitdiv .inside p{padding:5px 8px;margin:0;}#submitdiv #publishing-actions{padding-left:6px;border-bottom:1px solid #dfdfdf;-webkit-box-shadow:0 1px 0 #fff;-moz-box-shadow:0 1px 0 #fff;box-shadow:0 1px 0 #fff;}#publish{float:right;}#poststuff h2,#poststuff h3{font-size:13px;font-family:Georgia,"Times New Roman","Bitstream Charter",Times,serif;font-weight:normal;line-height:1;margin:0;padding:7px 9px;border-width:0 0 1px 0;border-style:solid;}#poststuff h2{border-color:#dfdfdf;}#tagsdiv-post_tag h3,#categorydiv h3{cursor:pointer;}h3.tb{text-shadow:0 1px 0 #fff;font-weight:bold;font-size:12px;margin-left:5px;}#TB_window{border:1px solid #333;-moz-border-radius:3px;-khtml-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;}.postbox,.stuffbox{margin-bottom:10px;border-width:1px;border-style:solid;line-height:1;-moz-border-radius:3px;-khtml-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;}.postbox:hover .handlediv,.stuffbox:hover .handlediv{background:transparent url(../images/arrows.png) no-repeat 6px 7px;}.postbox .handlediv{float:right;width:27px;height:30px;cursor:pointer;}#title,.tbtitle{font-family:sans-serif;-moz-border-radius:3px;-khtml-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;border-style:solid;border-width:1px;font-size:1.7em;outline:none;padding:3px 4px;border-color:#dfdfdf;}.tbtitle{font-size:12px;padding:3px;}#title{width:97%;}.editor-container{-moz-border-radius:3px;-khtml-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;border:1px solid #ccc;background-color:#fff;}.actions{float:right;margin:-19px 0 0;}#extra-fields .actions{margin:-23px -7px 0 0;}.actions li{float:left;list-style:none;margin-right:10px;}#extra-fields .button{margin-right:5px;padding:3px 6px;border-radius:10px;-webkit-border-radius:10px;-khtml-border-radius:10px;-moz-border-radius:10px;}#photo_saving{margin:0 8px 8px;vertical-align:middle;}#img_container_container{overflow:auto;}#extra-fields{margin-top:10px;position:relative;}#waiting{margin-top:10px;}#extra-fields .postbox{margin-bottom:5px;}#extra-fields .titlewrap{padding:0;overflow:auto;height:100px;}#img_container a{display:block;float:left;overflow:hidden;vertical-align:center;}#img_container img,#img_container a{width:68px;height:68px;}#img_container img{border:none;background-color:#f4f4f4;cursor:pointer;}#img_container a,#img_container a:link,#img_container a:visited{border:1px solid #ccc;display:block;position:relative;}#img_container a:hover,#img_container a:active{border-color:#000;z-index:1000;border-width:2px;margin:-1px;}#embed-code{width:100%;height:98px;}.wp-hidden-children .wp-hidden-child{display:none;}.category-add input{width:94%;font-family:sans-serif;font-size:12px;margin:1px;}select{width:100%;-x-system-font:none;border-style:solid;border-width:1px;font-family:sans-serif;font-size:12px;height:2em;line-height:20px;padding:2px;margin:1px;vertical-align:top;}.category-add input.category-add-sumbit{width:auto;}.categorydiv div.tabs-panel,#linkcategorydiv div.tabs-panel{height:100px;overflow:auto;padding:.5em .9em;border-style:solid;border-width:1px;}.category-tabs li{display:inline;padding-right:8px;}.category-tabs a{text-decoration:none;}.categorydiv ul,#linkcategorydiv ul{list-style:none;padding:0;margin:0;}.inline-editor ul.cat-checklist ul,.categorydiv ul.categorychecklist ul,#linkcategorydiv ul.categorychecklist ul{margin-left:18px;}ul.categorychecklist li{margin:0;padding:0;line-height:19px;}.categorydiv .tabs-panel{border-width:3px;border-style:solid;}ul.category-tabs{margin-top:12px;margin-bottom:5px;}ul.category-tabs li.tabs{border-style:solid solid none;border-width:1px 1px 0;}ul.category-tabs li{padding:5px 8px;-moz-border-radius:3px 3px 0 0;-webkit-border-top-left-radius:3px;-webkit-border-top-right-radius:3px;-khtml-border-top-left-radius:3px;-khtml-border-top-right-radius:3px;border-top-left-radius:3px;border-top-right-radius:3px;}.screen-reader-text{display:none;}.tagsdiv .newtag{margin-right:5px;}.jaxtag{clear:both;margin:0;}.tagadd{margin-left:3px;}.tagchecklist{margin-top:3px;margin-bottom:1em;font-size:12px;overflow:auto;}.tagchecklist strong{position:absolute;font-size:.75em;}.tagchecklist span{margin-right:.5em;margin-left:10px;display:block;float:left;font-size:12px;line-height:1.8em;white-space:nowrap;cursor:default;}.tagchecklist span a{margin:6px 0 0 -9px;cursor:pointer;width:10px;height:10px;display:block;float:left;text-indent:-9999px;overflow:hidden;position:absolute;}#content{margin:5px 0;padding:0 5px;border:0 none;height:365px;width:97%!important;font-family:Consolas,Monaco,monospace;font-size:13px;line-height:19px;background:transparent;}* html .postdivrich{zoom:1;}#saving{display:inline;vertical-align:middle;}.submit input,.button,.button-primary,.button-secondary,.button-highlighted,#postcustomstuff .submit input{font-family:sans-serif;text-decoration:none;font-size:12px!important;line-height:16px;padding:2px 8px;margin:2px;cursor:pointer;border-width:1px;border-style:solid;-moz-border-radius:11px;-khtml-border-radius:11px;-webkit-border-radius:11px;border-radius:11px;}.button-primary{background:#21759B url(../images/button-grad.png) repeat-x scroll left top;border-color:#21759B;color:#fff;}.ac_results{padding:0;margin:0;list-style:none;position:absolute;z-index:10000;display:none;border-width:1px;border-style:solid;}.ac_results li{padding:2px 5px;white-space:nowrap;text-align:left;}.ac_over{cursor:pointer;}.ac_match{text-decoration:underline;}#TB_ajaxContent #options{position:absolute;top:20px;right:25px;padding:5px;}#TB_ajaxContent h3{margin-bottom:.25em;}.updated{margin:10px 0;padding:0;border-width:1px;border-style:solid;width:99%;}.updated p,.error p{margin:.6em 0;padding:0 .6em;}.error a{text-decoration:underline;}.updated a{text-decoration:none;padding-bottom:2px;}#post_status{margin-left:10px;margin-bottom:1em;display:block;}#footer{height:65px;display:block;width:640px;padding:10px 0 0 60px;margin:0;position:absolute;bottom:0;font-size:12px;}#footer p{margin:0;padding:7px 0;}#footer p a{text-decoration:none;}#footer p a:hover{text-decoration:underline;}.centered{text-align:center;}.hidden{display:none;}.postbox input[type="text"],.postbox textarea,.stuffbox input[type="text"],.stuffbox textarea{border-width:1px;border-style:solid;}.taghint{color:#aaa;margin:-17px 0 0 7px;visibility:hidden;}input.newtag ~ div.taghint{visibility:visible;}input.newtag:focus ~ div.taghint{visibility:hidden;}#mce_fullscreen_container{background:#fff;} \ No newline at end of file diff --git a/src/wp-admin/css/press-this.dev.css b/src/wp-admin/css/press-this.dev.css new file mode 100644 index 0000000..416227c --- /dev/null +++ b/src/wp-admin/css/press-this.dev.css @@ -0,0 +1,678 @@ +body { + font-size: 13px; + font-family: sans-serif; + color: #333; + margin: 0; + padding: 0; + min-width: 675px; + min-height: 400px; +} + +img { + border: none; +} + +/* Header */ +#wphead { + height: 32px; + margin-right: 5px; + margin-bottom: 5px; +} + +#header-logo { + float: left; + margin: 7px 7px 0; + -webkit-user-select: none; + -moz-user-select: none; + -khtml-user-select: none; + user-select: none; +} + +#wphead h1 { + font: normal 16px Georgia, "Times New Roman", "Bitstream Charter", Times, serif; + padding: 6px 0 0; + margin: 0; + float: left; +} + +#wphead h1 a { + text-decoration: none; +} +#wphead h1 a:hover { + text-decoration: underline; +} + +.tagchecklist span a { + background: transparent url(../images/xit.gif) no-repeat 0 0; +} + +#edButtonPreview, +#edButtonHTML { + height: 18px; + margin: 5px 5px 0 0; + padding: 4px 5px 2px; + float: right; + cursor: pointer; + border-width: 1px; + border-style: solid; + -moz-border-radius: 3px 3px 0 0; + -webkit-border-top-right-radius: 3px; + -webkit-border-top-left-radius: 3px; + -khtml-border-top-right-radius: 3px; + -khtml-border-top-left-radius: 3px; + border-top-right-radius: 3px; + border-top-left-radius: 3px; +} + +#poststuff #edButtonHTML { + margin-right: 15px; +} + +#media-buttons { + cursor: default; + padding: 8px 8px 0; +} + +#media-buttons a { + cursor: pointer; + padding: 0 0 5px 10px; +} + +#media-buttons img, +#submitpost #ajax-loading, +#submitpost .ajax-loading { + vertical-align: middle; +} + +.howto { + margin-top: 2px; + margin-bottom: 3px; + font-size: 12px; + font-style: italic; + display: block; +} + +input.text { + outline-color: -moz-use-text-color; + outline-style: none; + outline-width: medium; + width: 100%; +} + +#message { + -moz-border-radius: 3px; + -khtml-border-radius: 3px; + -webkit-border-radius: 3px; + border-radius: 3px; +} + +/* Editor/Main Column */ +div#poststuff { + margin: 0 10px 10px; +} + +#poststuff #editor-toolbar { + height: 30px; +} + +div.zerosize { + border: 0 none; + height: 0; + margin: 0; + overflow: hidden; + padding: 0; + width: 0; +} + +.posting { + margin-right: 212px; + position: relative; +} + +#side-info-column { + float: right; + width: 200px; + position: relative; + right: 0; +} + +#side-info-column .sleeve { + padding-top: 5px; +} + +#poststuff .inside { + font-size: 12px; + margin: 8px; +} + +#submitdiv .inside { + margin: 0; +} + +#submitdiv .inside p { + padding: 5px 8px; + margin: 0; +} + +#submitdiv #publishing-actions { + padding-left: 6px; + border-bottom: 1px solid #dfdfdf; + -webkit-box-shadow: 0 1px 0 #fff; + -moz-box-shadow: 0 1px 0 #fff; + box-shadow: 0 1px 0 #fff; +} + +#publish { + float: right; +} + +#poststuff h2,#poststuff h3 { + font-size: 13px; + font-family: Georgia, "Times New Roman", "Bitstream Charter", Times, serif; + font-weight: normal; + line-height: 1; + margin: 0; + padding: 7px 9px; + border-width: 0 0 1px 0; + border-style: solid; +} + +#poststuff h2 { + border-color: #dfdfdf; +} + +#tagsdiv-post_tag h3, +#categorydiv h3 { + cursor: pointer; +} + +h3.tb { + text-shadow: 0 1px 0 #fff; + font-weight: bold; + font-size: 12px; + margin-left: 5px; +} + +#TB_window { + border: 1px solid #333; + -moz-border-radius: 3px; + -khtml-border-radius: 3px; + -webkit-border-radius: 3px; + border-radius: 3px; +} + +.postbox, +.stuffbox { + margin-bottom: 10px; + border-width: 1px; + border-style: solid; + line-height: 1; + -moz-border-radius: 3px; + -khtml-border-radius: 3px; + -webkit-border-radius: 3px; + border-radius: 3px; +} + +.postbox:hover .handlediv, +.stuffbox:hover .handlediv { + background: transparent url(../images/arrows.png) no-repeat 6px 7px; +} + +.postbox .handlediv { + float: right; + width: 27px; + height: 30px; + cursor: pointer; +} + +#title, +.tbtitle { + font-family: sans-serif; + -moz-border-radius: 3px; + -khtml-border-radius: 3px; + -webkit-border-radius: 3px; + border-radius: 3px; + border-style: solid; + border-width: 1px; + font-size: 1.7em; + outline: none; + padding: 3px 4px; + border-color: #dfdfdf; +} + +.tbtitle { + font-size: 12px; + padding: 3px; +} + +#title { + width: 97%; +} + +.editor-container { + -moz-border-radius: 3px; + -khtml-border-radius: 3px; + -webkit-border-radius: 3px; + border-radius: 3px; + border: 1px solid #ccc; + background-color: #fff; +} + +.actions { + float: right; + margin: -19px 0 0; +} + +#extra-fields .actions { + margin: -23px -7px 0 0; +} + +.actions li { + float: left; + list-style: none; + margin-right: 10px; +} + +#extra-fields .button { + margin-right: 5px; + padding: 3px 6px; + border-radius: 10px; + -webkit-border-radius: 10px; + -khtml-border-radius: 10px; + -moz-border-radius: 10px; +} + +/* Photo Styles */ +#photo_saving { + margin: 0 8px 8px; + vertical-align: middle; +} + +#img_container_container { + overflow: auto; +} + +#extra-fields { + margin-top: 10px; + position: relative; +} + +#waiting { + margin-top: 10px; +} + +#extra-fields .postbox { + margin-bottom: 5px; +} + +#extra-fields .titlewrap { + padding: 0; + overflow: auto; + height: 100px; +} + +#img_container a { + display: block; + float: left; + overflow: hidden; + vertical-align: center; +} + +#img_container img, +#img_container a { + width: 68px; + height: 68px; +} + +#img_container img { + border: none; + background-color: #f4f4f4; + cursor: pointer; +} + +#img_container a, +#img_container a:link, +#img_container a:visited { + border: 1px solid #ccc; + display: block; + position: relative; +} + +#img_container a:hover, +#img_container a:active { + border-color: #000; + z-index: 1000; + border-width: 2px; + margin: -1px; +} + +/* Video */ +#embed-code { + width: 100%; + height: 98px; +} + +/* Submit Column */ +.wp-hidden-children +.wp-hidden-child { + display: none; +} + +/* Categories */ + +.category-add input { + width: 94%; + font-family: sans-serif; + font-size: 12px; + margin: 1px; +} + +select { + width: 100%; + -x-system-font: none; + border-style: solid; + border-width: 1px; + font-family: sans-serif; + font-size: 12px; + height: 2em; + line-height: 20px; + padding: 2px; + margin: 1px; + vertical-align: top; +} + +.category-add input.category-add-sumbit { + width: auto; +} + +.categorydiv div.tabs-panel, +#linkcategorydiv div.tabs-panel { + height: 100px; + overflow: auto; + padding: 0.5em 0.9em; + border-style: solid; + border-width: 1px; +} + +.category-tabs li { + display: inline; + padding-right: 8px; +} + +.category-tabs a { + text-decoration: none; +} + +.categorydiv ul, +#linkcategorydiv ul { + list-style: none; + padding: 0; + margin: 0; +} + +.inline-editor ul.cat-checklist ul, +.categorydiv ul.categorychecklist ul, +#linkcategorydiv ul.categorychecklist ul { + margin-left: 18px; +} + +ul.categorychecklist li { + margin: 0; + padding: 0; + line-height: 19px; +} + +.categorydiv .tabs-panel { + border-width: 3px; + border-style: solid; +} + +ul.category-tabs { + margin-top: 12px; + margin-bottom: 5px; +} + +ul.category-tabs li.tabs { + border-style: solid solid none; + border-width: 1px 1px 0; +} + +ul.category-tabs li { + padding: 5px 8px; + -moz-border-radius: 3px 3px 0 0; + -webkit-border-top-left-radius: 3px; + -webkit-border-top-right-radius: 3px; + -khtml-border-top-left-radius: 3px; + -khtml-border-top-right-radius: 3px; + border-top-left-radius: 3px; + border-top-right-radius: 3px; +} + +/* Tags */ +.screen-reader-text { + display: none; +} + +.tagsdiv .newtag { + margin-right: 5px; +} + +.jaxtag { + clear: both; + margin: 0; +} + +.tagadd { + margin-left: 3px; +} + +.tagchecklist { + margin-top: 3px; + margin-bottom: 1em; + font-size: 12px; + overflow: auto; +} + +.tagchecklist strong { + position: absolute; + font-size: .75em; +} + +.tagchecklist span { + margin-right: .5em; + margin-left: 10px; + display: block; + float: left; + font-size: 12px; + line-height: 1.8em; + white-space: nowrap; + cursor: default; +} + +.tagchecklist span a { + margin: 6px 0 0 -9px; + cursor: pointer; + width: 10px; + height: 10px; + display: block; + float: left; + text-indent: -9999px; + overflow: hidden; + position: absolute; +} + +#content { + margin: 5px 0; + padding: 0 5px; + border: 0 none; + height: 365px; + width: 97% !important; + font-family: Consolas, Monaco, monospace; + font-size: 13px; + line-height: 19px; + background: transparent; +} + +* html .postdivrich { + zoom: 1; +} + +/* Submit */ +#saving { + display: inline; + vertical-align: middle; +} + +.submit input, +.button, +.button-primary, +.button-secondary, +.button-highlighted, +#postcustomstuff .submit input { + font-family: sans-serif; + text-decoration: none; + font-size: 12px !important; + line-height: 16px; + padding: 2px 8px; + margin: 2px; + cursor: pointer; + border-width: 1px; + border-style: solid; + -moz-border-radius: 11px; + -khtml-border-radius: 11px; + -webkit-border-radius: 11px; + border-radius: 11px; +} + +.button-primary { + background: #21759B url(../images/button-grad.png) repeat-x scroll left top; + border-color: #21759B; + color: #fff; +} + +.ac_results { + padding: 0; + margin: 0; + list-style: none; + position: absolute; + z-index: 10000; + display: none; + border-width: 1px; + border-style: solid; +} + +.ac_results li { + padding: 2px 5px; + white-space: nowrap; + text-align: left; +} + +.ac_over { + cursor: pointer; +} + +.ac_match { + text-decoration: underline; +} + +#TB_ajaxContent #options { + position: absolute; + top: 20px; + right: 25px; + padding: 5px; +} + +#TB_ajaxContent h3 { + margin-bottom: .25em; +} + +.updated { + margin: 10px 0; + padding: 0; + border-width: 1px; + border-style: solid; + width: 99%; +} + +.updated p, +.error p { + margin: 0.6em 0; + padding: 0 0.6em; +} + +.error a { + text-decoration: underline; +} + +.updated a { + text-decoration: none; + padding-bottom: 2px; +} + +#post_status { + margin-left: 10px; + margin-bottom: 1em; + display: block; +} + +/* Footer */ +#footer { + height: 65px; + display: block; + width: 640px; + padding: 10px 0 0 60px; + margin: 0; + position: absolute; + bottom: 0; + font-size: 12px; +} + +#footer p { + margin: 0; + padding: 7px 0; +} + +#footer p a { + text-decoration: none; +} + +#footer p a:hover { + text-decoration: underline; +} + +/* Utility Classes */ +.centered { + text-align: center; +} + +.hidden { + display: none; +} + +.postbox input[type="text"], +.postbox textarea, +.stuffbox input[type="text"], +.stuffbox textarea { + border-width: 1px; + border-style: solid; +} + +/* tag hints */ +.taghint { + color: #aaa; + margin: -17px 0 0 7px; + visibility: hidden; +} + +input.newtag ~ div.taghint { + visibility: visible; +} + +input.newtag:focus ~ div.taghint { + visibility: hidden; +} + +/* TinyMCE */ +#mce_fullscreen_container { + background: #fff; +} diff --git a/src/wp-admin/css/theme-editor-rtl.css b/src/wp-admin/css/theme-editor-rtl.css new file mode 100644 index 0000000..23023df --- /dev/null +++ b/src/wp-admin/css/theme-editor-rtl.css @@ -0,0 +1 @@ +#templateside{float: left;} diff --git a/src/wp-admin/css/theme-editor-rtl.dev.css b/src/wp-admin/css/theme-editor-rtl.dev.css new file mode 100644 index 0000000..a4dcb46 --- /dev/null +++ b/src/wp-admin/css/theme-editor-rtl.dev.css @@ -0,0 +1,3 @@ +#templateside { + float: left; +} diff --git a/src/wp-admin/css/theme-editor.css b/src/wp-admin/css/theme-editor.css new file mode 100644 index 0000000..fe03629 --- /dev/null +++ b/src/wp-admin/css/theme-editor.css @@ -0,0 +1 @@ +.alignleft h3{margin:0;}h3 span{font-weight:normal;}#template textarea{font-family:Consolas,Monaco,monospace;font-size:12px;width:97%;background:#f9f9f9;outline:none;}#template p{width:97%;}#templateside{float:right;width:190px;word-wrap:break-word;}#templateside h3,#postcustomstuff p.submit{margin:0;}#templateside h4{margin:1em 0 0;}#templateside ol,#templateside ul{margin:.5em;padding:0;}#templateside li{margin:4px 0;}#templateside ul li a span.highlight{display:block;}.nonessential{font-size:11px;font-style:italic;padding-left:12px;}.highlight{padding:3px 3px 3px 12px;margin-left:-12px;font-weight:bold;-moz-border-radius:3px;-khtml-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;}div.tablenav{margin-right:210px;}#documentation{margin-top:10px;}#documentation label{line-height:22px;vertical-align:top;font-weight:bold;}.fileedit-sub{padding:10px 0 8px;line-height:180%;} \ No newline at end of file diff --git a/src/wp-admin/css/theme-editor.dev.css b/src/wp-admin/css/theme-editor.dev.css new file mode 100644 index 0000000..b06837b --- /dev/null +++ b/src/wp-admin/css/theme-editor.dev.css @@ -0,0 +1,82 @@ +.alignleft h3 { + margin: 0; +} + +h3 span { + font-weight: normal; +} + +#template textarea { + font-family: Consolas, Monaco, monospace; + font-size: 12px; + width: 97%; + background: #f9f9f9; + outline: none; +} + +#template p { + width: 97%; +} + +#templateside { + float: right; + width: 190px; + word-wrap: break-word; +} + +#templateside h3, +#postcustomstuff p.submit { + margin: 0; +} + +#templateside h4 { + margin: 1em 0 0; +} + +#templateside ol, +#templateside ul { + margin: .5em; + padding: 0; +} + +#templateside li { + margin: 4px 0; +} + +#templateside ul li a span.highlight { + display:block; +} + +.nonessential { + font-size: 11px; + font-style: italic; + padding-left: 12px; +} + +.highlight { + padding: 3px 3px 3px 12px; + margin-left: -12px; + font-weight: bold; + -moz-border-radius: 3px; + -khtml-border-radius: 3px; + -webkit-border-radius: 3px; + border-radius: 3px; +} + +div.tablenav { + margin-right: 210px; +} + +#documentation { + margin-top: 10px; +} +#documentation label { + line-height: 22px; + vertical-align: top; + font-weight: bold; +} + +.fileedit-sub { + padding: 10px 0 8px; + line-height: 180%; +} diff --git a/src/wp-admin/css/theme-install-rtl.css b/src/wp-admin/css/theme-install-rtl.css new file mode 100644 index 0000000..3dd959c --- /dev/null +++ b/src/wp-admin/css/theme-install-rtl.css @@ -0,0 +1 @@ +div.star{left:auto;right:0;}.star img,div.star a,div.star a:hover,div.star a:visited{right:auto;left:0;}.theme-listing .theme-item h3{font-style:normal;}#theme-information .theme-preview-img{float:right;margin:5px 15px 10px 25px;}#theme-information .action-button #cancel{float:right;}#theme-information .action-button #install{float:left;}.feature-filter .feature-group{float:right;}.feature-filter .feature-name{float:right;text-align:left;}.feature-filter .feature-group li{float:right;padding-right:0;padding-left:25px;} \ No newline at end of file diff --git a/src/wp-admin/css/theme-install-rtl.dev.css b/src/wp-admin/css/theme-install-rtl.dev.css new file mode 100644 index 0000000..1194688 --- /dev/null +++ b/src/wp-admin/css/theme-install-rtl.dev.css @@ -0,0 +1,41 @@ +div.star { + left:auto; + right: 0; +} + +.star img, div.star a, div.star a:hover, div.star a:visited { + right: auto; + left: 0; +} + +.theme-listing .theme-item h3 { + font-style: normal; +} + +#theme-information .theme-preview-img { + float: right; + margin: 5px 15px 10px 25px; +} + +#theme-information .action-button #cancel { + float: right; +} + +#theme-information .action-button #install { + float: left; +} + +.feature-filter .feature-group { + float: right; +} + +.feature-filter .feature-name { + float: right; + text-align: left; +} + +.feature-filter .feature-group li { + float: right; + padding-right: 0; + padding-left: 25px; +} \ No newline at end of file diff --git a/src/wp-admin/css/theme-install.css b/src/wp-admin/css/theme-install.css new file mode 100644 index 0000000..e96844e --- /dev/null +++ b/src/wp-admin/css/theme-install.css @@ -0,0 +1 @@ +div.star-holder{position:relative;height:19px;width:100px;font-size:19px;}div.star{height:100%;position:absolute;top:0;left:0;background-color:transparent;letter-spacing:1ex;border:none;}.star1{width:20%;}.star2{width:40%;}.star3{width:60%;}.star4{width:80%;}.star5{width:100%;}.star img,div.star a,div.star a:hover,div.star a:visited{display:block;position:absolute;right:0;border:none;text-decoration:none;}div.star img{width:19px;height:19px;border-left:1px solid #fff;border-right:1px solid #fff;}.theme-listing .theme-item{display:inline-block;width:200px;border:thin solid #ccc;vertical-align:top;}.theme-listing .theme-item h3{text-align:center;font-size:14px;font-style:italic;margin:0;padding:0;}.theme-listing .theme-item img{max-width:150px;max-height:150px;}.theme-listing .theme-item-info span{display:none;}.theme-listing .theme-item:hover .theme-item-info span{display:inline;}.theme-listing .theme-item:hover .theme-item-info span.dots{display:none;}.theme-listing .theme-item-info span.action-links{font-weight:bold;text-align:center;}.theme-listing br.line{border-bottom-width:1px;border-bottom-style:solid;margin-bottom:3px;}.available-theme{padding:20px 15px;}#theme-information .theme-preview-img{float:left;margin:5px 25px 10px 15px;width:300px;}#theme-information .action-button{border-top-width:1px;border-top-style:solid;margin:10px 5px 0;}#theme-information .action-button #cancel{float:left;margin:10px 15px;}#theme-information .action-button #install{float:right;margin:10px 15px;}#theme-information .available-theme h3{margin:1em 0;}body#theme-information{height:auto;}.feature-filter{-moz-border-radius:3px;-khtml-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;border-width:1px;border-style:solid;padding:8px 12px 0;}.feature-filter .feature-group{float:left;margin-bottom:20px;width:725px;}.feature-filter .feature-name{float:left;text-align:right;width:95px;}.feature-filter .feature-group li{display:inline;float:left;list-style-type:none;padding-right:25px;min-width:145px;}.feature-container{width:100%;overflow:auto;margin-bottom:10px;}.feature-group{margin-bottom:0!important;} \ No newline at end of file diff --git a/src/wp-admin/css/theme-install.dev.css b/src/wp-admin/css/theme-install.dev.css new file mode 100644 index 0000000..70dee71 --- /dev/null +++ b/src/wp-admin/css/theme-install.dev.css @@ -0,0 +1,155 @@ +/* NOTE: the following CSS rules(.star*) are taken more or less straight from the bbPress rating plugin. */ +div.star-holder { + position: relative; + height: 19px; + width: 100px; + font-size: 19px; +} + +div.star { + height: 100%; + position: absolute; + top: 0; + left: 0; + background-color: transparent; + letter-spacing: 1ex; + border: none; +} + +.star1 { width: 20%; } +.star2 { width: 40%; } +.star3 { width: 60%; } +.star4 { width: 80%; } +.star5 { width: 100%; } + +.star img, div.star a, div.star a:hover, div.star a:visited { + display: block; + position: absolute; + right: 0; + border: none; + text-decoration: none; +} + +div.star img { + width: 19px; + height: 19px; + border-left: 1px solid #fff; + border-right: 1px solid #fff; +} + +.theme-listing .theme-item { + display: inline-block; + width: 200px; + border: thin solid #ccc; + vertical-align: top; +} + +.theme-listing .theme-item h3 { + text-align: center; + font-size: 14px; + font-style: italic; + margin: 0; + padding: 0; +} + +.theme-listing .theme-item img { + max-width: 150px; + max-height: 150px; +} + +.theme-listing .theme-item-info span { + display: none; +} + +.theme-listing .theme-item:hover .theme-item-info span { + display: inline; +} + +.theme-listing .theme-item:hover .theme-item-info span.dots { + display: none; +} + +.theme-listing .theme-item-info span.action-links { + font-weight: bold; + text-align: center; +} + +.theme-listing br.line { + border-bottom-width: 1px; + border-bottom-style: solid; + margin-bottom: 3px; +} + +.available-theme { + padding: 20px 15px; +} + +#theme-information .theme-preview-img { + float: left; + margin: 5px 25px 10px 15px; + width: 300px; +} + +#theme-information .action-button { + border-top-width: 1px; + border-top-style: solid; + margin: 10px 5px 0; +} + +#theme-information .action-button #cancel { + float: left; + margin: 10px 15px; +} + +#theme-information .action-button #install { + float: right; + margin: 10px 15px; +} + +#theme-information .available-theme h3 { + margin: 1em 0; +} + +body#theme-information { + height: auto; +} + +.feature-filter { + -moz-border-radius: 3px; + -khtml-border-radius: 3px; + -webkit-border-radius: 3px; + border-radius: 3px; + border-width: 1px; + border-style: solid; + padding: 8px 12px 0; +} + +.feature-filter .feature-group { + float: left; + margin-bottom: 20px; + width: 725px; +} + +.feature-filter .feature-name { + float: left; + text-align: right; + width: 95px; +} + +.feature-filter .feature-group li { + display: inline; + float: left; + list-style-type: none; + padding-right: 25px; + min-width: 145px; +} + +.feature-container { +width: 100%; +overflow: auto; +margin-bottom: 10px; +} + +.feature-group { + margin-bottom: 0px !important; +} \ No newline at end of file diff --git a/src/wp-admin/css/widgets-rtl.css b/src/wp-admin/css/widgets-rtl.css new file mode 100644 index 0000000..1f8b2a5 --- /dev/null +++ b/src/wp-admin/css/widgets-rtl.css @@ -0,0 +1 @@ +div.widget-liquid-left{float:right;clear:right;margin-right:0;margin-left:-325px;}div#widgets-left{margin-right:5px;margin-left:325px;}div.widget-liquid-right{float:left;clear:left;}#wp_inactive_widgets .widget{float:right;}div.sidebar-name h3{font-family:Tahoma,Arial,sans-serif;}#widget-list .widget{float:right;}#wp_inactive_widgets .widget-placeholder{float:right;}.widget-top .widget-title-action{float:left;}.widget-control-edit{padding:0 0 0 8px;}.sidebar-name-arrow{float:left;} \ No newline at end of file diff --git a/src/wp-admin/css/widgets-rtl.dev.css b/src/wp-admin/css/widgets-rtl.dev.css new file mode 100644 index 0000000..672f669 --- /dev/null +++ b/src/wp-admin/css/widgets-rtl.dev.css @@ -0,0 +1,47 @@ +/* 2 column liquid layout */ +div.widget-liquid-left { + float: right; + clear: right; + margin-right: 0; + margin-left: -325px; +} + +div#widgets-left { + margin-right: 5px; + margin-left: 325px; +} + +div.widget-liquid-right { + float: left; + clear: left; +} + +#wp_inactive_widgets .widget { + float: right; +} + +div.sidebar-name h3 { + font-family: Tahoma, Arial, sans-serif; +} + +#widget-list .widget { + float: right; +} + +#wp_inactive_widgets .widget-placeholder { + float: right; +} + +.widget-top .widget-title-action { + float: left; +} + +.widget-control-edit { + padding: 0 0 0 8px; +} + + +.sidebar-name-arrow { + float: left; +} + diff --git a/src/wp-admin/css/widgets.css b/src/wp-admin/css/widgets.css new file mode 100644 index 0000000..729bcaf --- /dev/null +++ b/src/wp-admin/css/widgets.css @@ -0,0 +1 @@ +html,body{min-width:950px;}div.widget-liquid-left{float:left;clear:left;width:100%;margin-right:-325px;}div#widgets-left{margin-left:5px;margin-right:325px;}div#widgets-right{width:285px;margin:0 auto;}div.widget-liquid-right{float:right;clear:right;width:300px;}.widget-liquid-right .widget,#wp_inactive_widgets .widget,.widget-liquid-right .sidebar-description{width:250px;margin:0 auto 20px;overflow:hidden;}.widget-liquid-right .sidebar-description{margin-bottom:10px;}#wp_inactive_widgets .widget{margin:0 10px 20px;float:left;}div.sidebar-name h3{font-family:Georgia,"Times New Roman","Bitstream Charter",Times,serif;font-weight:normal;font-size:15px;margin:0;padding:8px 10px;overflow:hidden;white-space:nowrap;}div.sidebar-name{cursor:pointer;font-size:13px;border-width:1px;border-style:solid;-moz-border-radius-topleft:3px;-moz-border-radius-topright:3px;-webkit-border-top-right-radius:3px;-webkit-border-top-left-radius:3px;-khtml-border-top-right-radius:3px;-khtml-border-top-left-radius:3px;border-top-right-radius:3px;border-top-left-radius:3px;}.js .closed .sidebar-name{-moz-border-radius-bottomleft:3px;-moz-border-radius-bottomright:3px;-webkit-border-bottom-right-radius:3px;-webkit-border-bottom-left-radius:3px;-khtml-border-bottom-right-radius:3px;-khtml-border-bottom-left-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;}.widget-liquid-right .widgets-sortables,#widgets-left .widget-holder{border-width:0 1px 1px;border-style:none solid solid;-moz-border-radius-bottomleft:3px;-moz-border-radius-bottomright:3px;-webkit-border-bottom-right-radius:3px;-webkit-border-bottom-left-radius:3px;-khtml-border-bottom-right-radius:3px;-khtml-border-bottom-left-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;}.js .closed .widgets-sortables,.js .closed .widget-holder{display:none;}.widget-liquid-right .widgets-sortables{padding:15px 0 0;}#available-widgets .widget-holder{padding:7px 5px 0;}#available-widgets .widget{-moz-box-shadow:none;-webkit-box-shadow:none;box-shadow:none;}#wp_inactive_widgets{padding:5px 5px 0;}#widget-list .widget{width:250px;margin:0 10px 15px;border:0 none;background:transparent;float:left;}#widget-list .widget-description{padding:5px 8px;}#widget-list .widget-top{border-width:1px;border-style:solid;-moz-border-radius:3px;-khtml-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;}.widget-placeholder{border-width:1px;border-style:dashed;margin:0 auto 20px;height:26px;width:250px;}#wp_inactive_widgets .widget-placeholder{margin:0 10px 20px;float:left;}div.widgets-holder-wrap{padding:0;margin:10px 0 20px;}#widgets-left #available-widgets{background-color:transparent;border:0 none;}ul#widget-list{list-style:none;margin:0;padding:0;min-height:100px;}.widget .widget-top{margin-bottom:-1px;font-size:12px;font-weight:bold;height:26px;overflow:hidden;}.widget-top .widget-title{padding:7px 9px;}.widget-top .widget-title-action{float:right;}a.widget-action{display:block;width:24px;height:26px;}#available-widgets a.widget-action{display:none;}.widget-top a.widget-action{background:transparent url(../images/arrows.png) no-repeat 4px 6px;}.widget-top a.widget-action:hover{background:transparent url(../images/arrows-dark.png) no-repeat 4px 6px;}.widget .widget-inside,.widget .widget-description{padding:12px 12px 10px;font-size:12px;line-height:16px;}.widget-inside,.widget-description{display:none;}#available-widgets .widget-description{display:block;}.widget .widget-inside p{margin:0 0 1em;padding:0;}.widget-title h4{margin:0;line-height:1;overflow:hidden;white-space:nowrap;}.widgets-sortables{min-height:90px;}.widget-control-actions{margin-top:8px;}.widget-control-actions a{text-decoration:none;}.widget-control-actions a:hover{text-decoration:underline;}.widget-control-actions .ajax-feedback{padding-bottom:3px;}.widget-control-actions div.alignleft{margin-top:6px;}div#sidebar-info{padding:0 1em;margin-bottom:1em;font-size:12px;}.widget-title a,.widget-title a:hover{text-decoration:none;border-bottom:none;}.widget-control-edit{display:block;font-size:12px;font-weight:normal;line-height:26px;padding:0 8px 0 0;}a.widget-control-edit{text-decoration:none;}.widget-control-edit .add,.widget-control-edit .edit{display:none;}#available-widgets .widget-control-edit .add,#widgets-right .widget-control-edit .edit,#wp_inactive_widgets .widget-control-edit .edit{display:inline;}.editwidget{margin:0 auto 15px;}.editwidget .widget-inside{display:block;border-width:1px;border-style:solid;padding:10px;-moz-border-radius:3px;-khtml-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;}.inactive p.description{margin:5px 15px 8px;}#available-widgets p.description{margin:0 12px 12px;}.widget-position{margin-top:8px;}.inactive{padding-top:2px;}.sidebar-name-arrow{float:right;height:29px;width:26px;}.widget-title .in-widget-title{font-size:12px;white-space:nowrap;}#removing-widget{display:none;font-weight:normal;padding-left:15px;font-size:12px;line-height:1;}.widget-control-noform,#access-off,.widgets_access .widget-action,.widgets_access .sidebar-name-arrow,.widgets_access #access-on,.widgets_access .widget-holder .description{display:none;}.widgets_access .widget-holder,.widgets_access #widget-list{padding-top:10px;}.widgets_access #access-off{display:inline;}.widgets_access #wpbody-content .widget-title-action,.widgets_access #wpbody-content .widget-control-edit,.widgets_access .closed .widgets-sortables,.widgets_access .closed .widget-holder{display:block;}.widgets_access .closed .sidebar-name{-moz-border-radius-bottomleft:0;-moz-border-radius-bottomright:0;-webkit-border-bottom-right-radius:0;-webkit-border-bottom-left-radius:0;-khtml-border-bottom-right-radius:0;-khtml-border-bottom-left-radius:0;border-bottom-right-radius:0;border-bottom-left-radius:0;}.widgets_access .sidebar-name,.widgets_access .widget .widget-top{cursor:default;} \ No newline at end of file diff --git a/src/wp-admin/css/widgets.dev.css b/src/wp-admin/css/widgets.dev.css new file mode 100644 index 0000000..8b4736f --- /dev/null +++ b/src/wp-admin/css/widgets.dev.css @@ -0,0 +1,382 @@ +html, +body { + min-width: 950px; +} + +/* 2 column liquid layout */ +div.widget-liquid-left { + float: left; + clear: left; + width: 100%; + margin-right: -325px; +} + +div#widgets-left { + margin-left: 5px; + margin-right: 325px; +} + +div#widgets-right { + width: 285px; + margin: 0 auto; +} + +div.widget-liquid-right { + float: right; + clear: right; + width: 300px; +} + +.widget-liquid-right .widget, +#wp_inactive_widgets .widget, +.widget-liquid-right .sidebar-description { + width: 250px; + margin: 0 auto 20px; + overflow: hidden; +} + +.widget-liquid-right .sidebar-description { + margin-bottom: 10px; +} + +#wp_inactive_widgets .widget { + margin: 0 10px 20px; + float: left; +} + +div.sidebar-name h3 { + font-family: Georgia, "Times New Roman", "Bitstream Charter", Times, serif; + font-weight: normal; + font-size: 15px; + margin: 0; + padding: 8px 10px; + overflow: hidden; + white-space: nowrap; +} + +div.sidebar-name { + cursor: pointer; + font-size: 13px; + border-width: 1px; + border-style: solid; + -moz-border-radius-topleft: 3px; + -moz-border-radius-topright: 3px; + -webkit-border-top-right-radius: 3px; + -webkit-border-top-left-radius: 3px; + -khtml-border-top-right-radius: 3px; + -khtml-border-top-left-radius: 3px; + border-top-right-radius: 3px; + border-top-left-radius: 3px; +} + +.js .closed .sidebar-name { + -moz-border-radius-bottomleft: 3px; + -moz-border-radius-bottomright: 3px; + -webkit-border-bottom-right-radius: 3px; + -webkit-border-bottom-left-radius: 3px; + -khtml-border-bottom-right-radius: 3px; + -khtml-border-bottom-left-radius: 3px; + border-bottom-right-radius: 3px; + border-bottom-left-radius: 3px; +} + +.widget-liquid-right .widgets-sortables, +#widgets-left .widget-holder { + border-width: 0 1px 1px; + border-style: none solid solid; + -moz-border-radius-bottomleft: 3px; + -moz-border-radius-bottomright: 3px; + -webkit-border-bottom-right-radius: 3px; + -webkit-border-bottom-left-radius: 3px; + -khtml-border-bottom-right-radius: 3px; + -khtml-border-bottom-left-radius: 3px; + border-bottom-right-radius: 3px; + border-bottom-left-radius: 3px; +} + +.js .closed .widgets-sortables, +.js .closed .widget-holder { + display: none; +} + +.widget-liquid-right .widgets-sortables { + padding: 15px 0 0; +} + +#available-widgets .widget-holder { + padding: 7px 5px 0; +} + +#available-widgets .widget { + -moz-box-shadow: none; + -webkit-box-shadow: none; + box-shadow: none; +} + +#wp_inactive_widgets { + padding: 5px 5px 0; +} + +#widget-list .widget { + width: 250px; + margin: 0 10px 15px; + border: 0 none; + background: transparent; + float: left; +} + +#widget-list .widget-description { + padding: 5px 8px; +} + +#widget-list .widget-top { + border-width: 1px; + border-style: solid; + -moz-border-radius: 3px; + -khtml-border-radius: 3px; + -webkit-border-radius: 3px; + border-radius: 3px; +} + +.widget-placeholder { + border-width: 1px; + border-style: dashed; + margin: 0 auto 20px; + height: 26px; + width: 250px; +} + +#wp_inactive_widgets .widget-placeholder { + margin: 0 10px 20px; + float: left; +} + +div.widgets-holder-wrap { + padding: 0; + margin: 10px 0 20px; +} + +#widgets-left #available-widgets { + background-color: transparent; + border: 0 none; +} + +ul#widget-list { + list-style: none; + margin: 0; + padding: 0; + min-height: 100px; +} + +.widget .widget-top { + margin-bottom: -1px; + font-size: 12px; + font-weight: bold; + height: 26px; + overflow: hidden; +} + +.widget-top .widget-title { + padding: 7px 9px; +} + +.widget-top .widget-title-action { + float: right; +} + +a.widget-action { + display: block; + width: 24px; + height: 26px; +} + +#available-widgets a.widget-action { + display: none; +} + +.widget-top a.widget-action { + background: transparent url(../images/arrows.png) no-repeat 4px 6px; +} + +.widget-top a.widget-action:hover { + background: transparent url(../images/arrows-dark.png) no-repeat 4px 6px; +} + +.widget .widget-inside, +.widget .widget-description { + padding: 12px 12px 10px; + font-size: 12px; + line-height: 16px; +} + +.widget-inside, +.widget-description { + display: none; +} + +#available-widgets .widget-description { + display: block; +} + +.widget .widget-inside p { + margin: 0 0 1em; + padding: 0; +} + +.widget-title h4 { + margin: 0; + line-height: 1; + overflow: hidden; + white-space: nowrap; +} + +.widgets-sortables { + min-height: 90px; +} + +.widget-control-actions { + margin-top: 8px; +} + +.widget-control-actions a { + text-decoration: none; +} + +.widget-control-actions a:hover { + text-decoration: underline; +} + +.widget-control-actions .ajax-feedback { + padding-bottom: 3px; +} + +.widget-control-actions div.alignleft { + margin-top: 6px; +} + +div#sidebar-info { + padding: 0 1em; + margin-bottom: 1em; + font-size: 12px; +} + +.widget-title a, +.widget-title a:hover { + text-decoration: none; + border-bottom: none; +} + +.widget-control-edit { + display: block; + font-size: 12px; + font-weight: normal; + line-height: 26px; + padding: 0 8px 0 0; +} + +a.widget-control-edit { + text-decoration: none; +} + +.widget-control-edit .add, +.widget-control-edit .edit { + display: none; +} + +#available-widgets .widget-control-edit .add, +#widgets-right .widget-control-edit .edit, +#wp_inactive_widgets .widget-control-edit .edit { + display: inline; +} + +.editwidget { + margin: 0 auto 15px; +} + +.editwidget .widget-inside { + display: block; + border-width: 1px; + border-style: solid; + padding: 10px; + -moz-border-radius: 3px; + -khtml-border-radius: 3px; + -webkit-border-radius: 3px; + border-radius: 3px; +} + +.inactive p.description { + margin: 5px 15px 8px; +} + +#available-widgets p.description { + margin: 0 12px 12px; +} + +.widget-position { + margin-top: 8px; +} + +.inactive { + padding-top: 2px; +} + +.sidebar-name-arrow { + float: right; + height: 29px; + width: 26px; +} + +.widget-title .in-widget-title { + font-size: 12px; + white-space: nowrap; +} + +#removing-widget { + display: none; + font-weight: normal; + padding-left: 15px; + font-size: 12px; + line-height: 1; +} + +.widget-control-noform, +#access-off, +.widgets_access .widget-action, +.widgets_access .sidebar-name-arrow, +.widgets_access #access-on, +.widgets_access .widget-holder .description { + display: none; +} + +.widgets_access .widget-holder, +.widgets_access #widget-list { + padding-top: 10px; +} + +.widgets_access #access-off { + display: inline; +} + +.widgets_access #wpbody-content .widget-title-action, +.widgets_access #wpbody-content .widget-control-edit, +.widgets_access .closed .widgets-sortables, +.widgets_access .closed .widget-holder { + display: block; +} + +.widgets_access .closed .sidebar-name { + -moz-border-radius-bottomleft: 0; + -moz-border-radius-bottomright: 0; + -webkit-border-bottom-right-radius: 0; + -webkit-border-bottom-left-radius: 0; + -khtml-border-bottom-right-radius: 0; + -khtml-border-bottom-left-radius: 0; + border-bottom-right-radius: 0; + border-bottom-left-radius: 0; +} + +.widgets_access .sidebar-name, +.widgets_access .widget .widget-top { + cursor: default; +} + diff --git a/src/wp-admin/css/wp-admin-rtl.css b/src/wp-admin/css/wp-admin-rtl.css new file mode 100644 index 0000000..f9ea458 --- /dev/null +++ b/src/wp-admin/css/wp-admin-rtl.css @@ -0,0 +1 @@ +ol{margin-left:0;margin-right:2em;}.code,code{font-family:Tahoma,Arial,sans-serif;}.quicktags,.search{font:12px Tahoma,Arial,sans-serif;}.icon32{float:right;margin:7px 0 0 8px;}.howto{font-style:normal;font-family:Tahoma,Arial,sans-serif;}p.install-help{font-style:normal;}#doaction,#doaction2,#post-query-submit{margin-right:0;margin-left:8px;}#timezone_string option{margin-left:0;margin-right:1em;}#pass-strength-result{float:right;margin:13px 1px 5px 5px;}p.search-box{float:left;}#delete-action{text-align:right;float:right;}#publishing-action{text-align:left;float:left;}#post-body .misc-pub-section{border-right:0;border-left-width:1px;border-left-style:solid;float:right;}#post-body .misc-pub-section-last{border-left:0;}#minor-publishing-actions{padding:10px 8px 2px 10px;text-align:left;}#save-post{float:right;}#minor-publishing .ajax-loading{padding:3px 4px 0 0;float:right;}.preview{float:left;}#sticky-span{margin-left:0;margin-right:18px;}.side-info ul{padding-left:0;padding-right:18px;}td.action-links,th.action-links{text-align:left;}.describe .del-link{padding-left:0;padding-right:5px;}.plugin-update .update-message{margin:0 31px 8px 10px;}form.upgrade .hint{font-style:normal;}#ajax-response.alignleft{margin-left:0;margin-right:2em;}#quicktags{background-position:right top;}#ed_reply_toolbar input{margin:1px 1px 1px 2px;}#wp-fullscreen-body{right:0;left:auto;}#wp-fullscreen-tagline{float:left;}#fullscreen-topbar{left:auto;right:0;}#wp-fullscreen-mode-bar,#wp-fullscreen-button-bar,#wp-fullscreen-close,#wp-fullscreen-count{float:right;}#wp-fullscreen-save{float:left;}#wp-fullscreen-save{padding:2px 5px 0 2px;}#wp-fullscreen-buttons>div{float:right;}#wp-fullscreen-mode-bar{padding:1px 0 0 14px;}#wp-fullscreen-modes a{float:right;border-width:1px 0 1px 1px;}#wp-fullscreen-modes a:first-child{border-width:1px;-moz-border-radius:3px 3px 0 0;-webkit-border-top-left-radius:0;-webkit-border-top-right-radius:3px;-webkit-border-bottom-left-radius:0;-webkit-border-bottom-right-radius:3px;-khtml-border-top-left-radius:0;-khtml-border-top-right-radius:3px;-khtml-border-bottom-left-radius:0;-khtml-border-bottom-right-radius:3px;border-top-left-radius:0;border-top-right-radius:3px;border-bottom-right-left:0;border-bottom-right-radius:3px;}#wp-fullscreen-modes a:last-child{-moz-border-radius:0 0 3px 3px;-webkit-border-top-right-radius:0;-webkit-border-top-left-radius:3px;-webkit-border-bottom-right-radius:0;-webkit-border-bottom-left-radius:3px;-khtml-border-top-right-radius:0;-khtml-border-top-left-radius:3px;-khtml-border-bottom-right-radius:0;-khtml-border-bottom-left-radius:3px;border-top-right-radius:0;border-top-left-radius:3px;border-bottom-right-radius:0;border-bottom-left-radius:3px;}#wp-fullscreen-save img,#wp-fullscreen-save span{padding-right:0;padding-left:4px;}#wphead-info{margin:0 15px 0 0;}#user_info{float:left;padding:0 6px 0 2px;}#user_info.active{margin-right:0;margin-left:-1px;}#user_info .hide-if-no-js p{margin:0 0 0 20px;}#user_info_arrow{right:auto;left:3px;}#user_info_links_wrap{right:auto;left:0;}#wphead{height:32px;margin-left:15px;margin-right:2px;}#header-logo{float:right;}#wphead h1{font:Tahoma,Arial,sans-serif;float:right;}#favorite-actions{margin:0 15px 0 12px;}#favorite-first a{padding:2px 12px 2px 0;}#favorite-inside a{padding:3px 10px 3px 5px;}#favorite-toggle{right:auto;left:0;}#screen-meta-links{margin:0 0 0 19px;}#screen-meta .screen-reader-text{visibility:hidden;}#screen-options-link-wrap,#contextual-help-link-wrap{float:left;margin:0 6px 0 0;font-family:Tahoma,Arial,sans-serif;}#contextual-help-wrap li{list-style-type:disc;margin-left:auto;margin-right:18px;}.toggle-arrow{background-position:top right;}.toggle-arrow-active{background-position:bottom right;}#screen-meta a.show-settings{padding:0 6px 0 16px;}#screen-options-wrap,#contextual-help-wrap{margin:0 0 0 15px;}.metabox-prefs label{padding-right:auto;padding-left:15px;}.metabox-prefs label input{margin:0 2px 0 5px;}#adminmenushadow{right:auto;left:0;}#adminmenu div.wp-menu-image{float:right;}#adminmenu .wp-submenu a{padding-left:0;padding-right:12px;}#adminmenu li.wp-has-current-submenu .wp-menu-arrow,#adminmenu li.menu-top.current .wp-menu-arrow{right:auto;left:-9px;}#adminmenu .wp-menu-arrow div{background:url(../images/menu-arrow-frame-rtl.png) top left no-repeat;}#adminmenu .wp-menu-image img{float:right;}.js.folded #adminmenu .wp-submenu{display:block;left:auto;right:26px;}.js.folded #adminmenu .wp-submenu.sub-open{padding:0 0 8px 8px;}#adminmenu .wp-submenu .wp-submenu-head{padding:6px 10px 5px 4px;}.js.folded #adminmenu .wp-submenu-wrap{-webkit-border-bottom-right-radius:0;-webkit-border-bottom-left-radius:3px;-webkit-border-top-right-radius:0;-webkit-border-top-left-radius:3px;-khtml-border-bottom-right-radius:0;-khtml-border-bottom-left-radius:3px;-khtml-border-top-left-radius:0;-khtml-border-top-left-radius:3px;-moz-border-radius-bottomright:0;-moz-border-radius-bottomleft:3px;-moz-border-radius-topright:0;-moz-border-radius-topleft:3px;border-bottom-right-radius:0;border-bottom-left-radius:3px;border-top-right-radius:0;border-top-left-radius:3px;border-width:0 0 1px 1px;}.js.folded #adminmenu .wp-submenu ul{border-width:0 1px 0 0;}.js.folded #adminmenu .wp-submenu a{padding-left:0;padding-right:10px;}.js.folded #adminmenu a.wp-has-submenu{margin-left:0;margin-right:40px;}#adminmenu .wp-menu-toggle{clear:left;float:left;padding:1px 0 0 2px;}#adminmenu .wp-menu-image img{padding:6px 1px 0 0;}#adminmenu .awaiting-mod,#adminmenu span.update-plugins,#sidemenu li a span.update-plugins{font-family:Tahoma,Arial,sans-serif;margin-left:0;margin-right:7px;}.post-com-count-wrapper{font-family:Tahoma,Arial,sans-serif;}.column-response .post-com-count{float:right;margin-right:0;margin-left:5px;}.response-links{float:right;}#collapse-button{float:right;}.widefat th{font-family:Tahoma,Arial,sans-serif;}.widefat td p{margin:2px 0 .8em;}.postbox-container{float:right;padding-right:0;padding-left:.5%;}.postbox .handlediv{float:left;}#the-comment-list p.comment-author img{float:right;margin-right:0;margin-left:8px;}.fixed .column-comments{text-align:right;}.fixed .column-comments .vers{padding-left:0;padding-right:3px;}.fixed .column-comments a{float:right;}.sorting-indicator{margin-left:0;margin-right:7px;}th.sortable a span,th.sorted a span{float:right;}.tablenav-pages a{margin-right:0;margin-left:1px;}.tablenav-pages .next-page{margin-left:0;margin-right:2px;}.tablenav a.button-secondary{margin:3px 0 0 8px;}.tablenav .tablenav-pages{float:left;}.tablenav .displaying-num{margin-right:0;margin-left:10px;font-family:Tahoma,Arial,sans-serif;font-style:bold;}.tablenav .actions{padding:2px 0 0 8px;}.tablenav .delete{margin-right:0;margin-left:20px;}.view-switch{float:left;}.filter{float:right;margin:-5px 10px 0 0;}.filter .subsubsub{margin-left:0;margin-right:-10px;}#posts-filter fieldset{float:right;margin:0 0 1em 1.5ex;}#posts-filter fieldset legend{padding:0 1px .2em 0;}#wpbody-content .inline-edit-row fieldset{float:right;}#wpbody-content .quick-edit-row-page fieldset.inline-edit-col-right .inline-edit-col{border-width:0 1px 0 0;}#wpbody-content .bulk-edit-row .inline-edit-col-bottom{float:left;}.inline-edit-row fieldset label span.title{float:right;}.inline-edit-row fieldset label span.input-text-wrap{margin-left:0;margin-right:5em;}.quick-edit-row-post fieldset.inline-edit-col-right label span.title{padding-right:0;padding-left:.5em;}#wpbody-content .quick-edit-row fieldset .inline-edit-group label.alignleft:first-child{margin-right:0;margin-left:.5em;}.inline-edit-row fieldset span.title,.inline-edit-row fieldset span.checkbox-title{font-family:Tahoma,Arial,sans-serif;font-style:normal;}.inline-edit-row fieldset .inline-edit-date{float:right;}.inline-edit-row fieldset ul.cat-checklist label,.inline-edit-row .catshow,.inline-edit-row .cathide,.inline-edit-row #bulk-titles div{font-family:Tahoma,Arial,sans-serif;}.quick-edit-row-post fieldset label.inline-edit-status{float:right;}#bulk-titles div a{float:right;margin:3px -2px 0 3px;overflow:hidden;text-indent:-9999px;}#titlediv #title-prompt-text,#wp-fullscreen-title-prompt-text{right:0;}#sample-permalink{direction:ltr;}#sample-permalink #editable-post-name{unicode-bidi:embed;}#wp-fullscreen-title-prompt-text{left:auto;right:0;}.postarea h3 label{float:right;}.postarea #add-media-button{float:left;right:auto;left:10px;}#edButtonPreview,#edButtonHTML{margin:5px 0 0 5px;float:left;}#poststuff #edButtonHTML{margin-right:0;margin-left:15px;}#media-buttons a{padding:0 10px 5px 0;}.submitbox .submit{text-align:right;}.inside-submitbox #post_status{margin:2px -2px 2px 0;}.submitbox .submit input{margin-right:0;margin-left:4px;}#normal-sortables .postbox .submit{float:left;}#post-body ul.category-tabs,#post-body ul.add-menu-item-tabs{float:right;text-align:left;margin:0 5px 0 -120px;}#post-body ul.category-tabs li.tabs,#post-body ul.add-menu-item-tabs li.tabs{-moz-border-radius:3px 3px 0 0;-webkit-border-top-left-radius:0;-webkit-border-top-right-radius:3px;-webkit-border-bottom-left-radius:0;-webkit-border-bottom-right-radius:3px;-khtml-border-top-left-radius:0;-khtml-border-top-right-radius:3px;-khtml-border-bottom-left-radius:0;-khtml-border-bottom-right-radius:3px;border-top-left-radius:0;border-top-right-radius:3px;border-bottom-left-radius:0;border-bottom-right-radius:3px;}#post-body .categorydiv div.tabs-panel,.taxonomy div.tabs-panel,#post-body #linkcategorydiv div.tabs-panel{margin:0 125px 0 5px;}#side-sortables .comments-box thead th,#normal-sortables .comments-box thead th{font-style:normal;}#commentsdiv img.waiting{padding-left:0;padding-right:5px;}#post-body .category-tabs li.tabs,#post-body .add-menu-item-tabs li.tabs{border-width:1px 1px 1px 0;margin-right:0;margin-left:-1px;}#posts-filter fieldset{float:right;margin:0 0 1em 1.5ex;}#posts-filter fieldset legend{padding:0 1px .2em 0;}#post-body .tagsdiv #newtag{margin-right:0;margin-left:5px;}.autosave-info{padding:2px 2px 2px 15px;text-align:left;}#post-body .wp_themeSkin .mceStatusbar a.mceResize{background:transparent url(../images/resize-rtl.gif) no-repeat scroll left bottom;cursor:sw-resize;}.curtime #timestamp{background-position:right top;padding-left:0;padding-right:18px;}#postcustomstuff table input,#postcustomstuff table select,#postcustomstuff table textarea{margin:8px 8px 8px 0;}table.diff td,table.diff th{font-family:Consolas,Monaco,monospace;}.category-adder{margin-left:0;margin-right:120px;}#post-body ul.category-tabs,#post-body ul.add-menu-item-tabs{float:right;text-align:left;margin:0 5px 0 -120px;}#post-body ul.category-tabs li.tabs,#post-body ul.add-menu-item-tabs li.tabs{-moz-border-radius:3px 3px 0 0;-webkit-border-top-left-radius:0;-webkit-border-top-right-radius:3px;-webkit-border-bottom-left-radius:0;-webkit-border-bottom-right-radius:3px;-khtml-border-top-left-radius:0;-khtml-border-top-right-radius:3px;-khtml-border-bottom-left-radius:0;-khtml-border-bottom-right-radius:3px;border-top-left-radius:0;border-top-right-radius:3px;border-bottom-left-radius:0;border-bottom-right-radius:3px;}#front-page-warning,#front-static-pages ul,ul.export-filters,.inline-editor ul.cat-checklist ul,.categorydiv ul.categorychecklist ul,.customlinkdiv ul.categorychecklist ul,.posttypediv ul.categorychecklist ul,.taxonomydiv ul.categorychecklist ul,#linkcategorydiv ul.categorychecklist ul{margin-left:0;margin-right:18px;}#post-body .category-tabs li.tabs,#post-body .add-menu-item-tabs li.tabs{border-style:solid solid solid none;border-width:1px 1px 1px 0;margin-right:0;margin-left:-1px;}p.help,p.description,span.description,.form-wrap p{font-style:normal;font-family:Tahoma,Arial,sans-serif;}.taghint{margin:15px 12px -24px 0;}#poststuff .tagsdiv .howto{margin:0 8px 6px 0;}.ac_results li{text-align:right;}#wpbody-content .describe th{text-align:right;}.describe .media-item-info .A1B1{padding:0 10px 0 0;}.media-upload-form td label{margin-left:6px;margin-right:2px;}.media-upload-form .align .field label{padding:0 22px 0 0;margin:0 0 0 1em;}.media-upload-form tr.image-size label{margin:0 3px 0 0;}#wpbody-content .describe p.help{padding:0 5px 0 0;}.media-item .error-div a.dismiss,.describe-toggle-on,.describe-toggle-off{float:left;margin-right:0;margin-left:20px;}.media-item .error-div{padding-left:0;padding-right:10px;}.media-item .pinkynail{float:right;}.crunching{text-align:left;margin-right:0;margin-left:5px;}.bar{border-right-width:0;border-left-width:3px;border-right-style:none;border-left-style:solid;}#find-posts-response .found-radio{padding:5px 8px 0 0;}.find-box-search label{padding-right:0;padding-left:6px;}.find-box #resize-se{right:auto;left:1px;}form.upgrade .hint{font-style:normal;}.imgedit-menu div{float:right;}.imgedit-help{font-style:normal;}.imgedit-submit-btn{margin-left:0;margin-right:20px;}.form-table th{text-align:right;}.form-table input.tog{margin-right:0;margin-left:2px;float:right;}.form-table table.color-palette{float:right;}#replysubmit img.waiting,.inline-edit-save img.waiting{float:left;}#replysubmit .button{margin-right:0;margin-left:5px;}#edithead .inside{float:right;padding:3px 5px 2px 0;}.comment-ays th{border-right-style:none;border-left-style:solid;border-right-width:0;border-left-width:1px;}.spam-undo-inside .avatar,.trash-undo-inside .avatar{margin-left:8px;}#comment-status-radio input{margin:2px 0 5px 3px;}td.available-theme{text-align:right;}#current-theme img{float:right;margin-right:0;margin-left:1em;}#broken-themes{text-align:right;}.appearance_page_custom-header .available-headers .default-header{float:right;margin:0 0 20px 20px;}.appearance_page_custom-header .random-header{margin:0 0 20px 20px;}.appearance_page_custom-header .available-headers label input,.appearance_page_custom-header .random-header label input{margin-right:0;margin-left:10px;}.nav-tab{margin:0 0 -1px 6px;}h2 .nav-tab{font-family:Tahoma,Arial,sans-serif;}.plugins .desc ul,.plugins .desc ol{margin:0 2em 0 0;}#wpbody-content .plugins .plugin-title,#wpbody-content .plugins .theme-title{padding-right:0;padding-left:12px;}#profile-page .form-table #rich_editing{margin-right:0;margin-left:5px;}#your-profile legend{font-family:Tahoma,Arial,sans-serif;}#utc-time,#local-time{padding-left:0;padding-right:25px;font-style:normal;font-family:Tahoma,Arial,sans-serif;}#footer{margin-right:0;margin-left:15px;}#template div{margin-right:0;margin-left:190px;}.column-author img,.column-username img{float:right;margin-right:0;margin-left:10px;}.tagchecklist{margin-left:0;margin-right:14px;}.tagchecklist strong{margin-left:0;margin-right:-8px;}.tagchecklist span{margin-right:0;margin-left:25px;float:right;}.tagchecklist span a{margin:6px -9px 0 0;float:right;}#poststuff h2{clear:right;}#poststuff h3,.metabox-holder h3{font-family:Tahoma,Arial,sans-serif;}.tool-box .title{font-family:Tahoma,Arial,sans-serif;}#sidemenu{margin:-30px 315px 0 15px;float:left;padding-left:0;padding-right:10px;}#sidemenu a{float:right;}table .vers,table .column-visible,table .column-rating{text-align:right;}* html #template div{margin-left:0;}.list-ajax-loading{float:left;margin-right:0;margin-left:9px;}#editorcontainer .wp_themeSkin .mceStatusbar{padding-left:0;padding-right:5px;}#editorcontainer .wp_themeSkin .mceStatusbar div{float:right;}#editorcontainer .wp_themeSkin .mceStatusbar a.mceResize{float:left;} \ No newline at end of file diff --git a/src/wp-admin/css/wp-admin-rtl.dev.css b/src/wp-admin/css/wp-admin-rtl.dev.css new file mode 100644 index 0000000..e208a16 --- /dev/null +++ b/src/wp-admin/css/wp-admin-rtl.dev.css @@ -0,0 +1,1336 @@ +/*------------------------------------------------------------------------------ + + +Hello, this is the RTL version of the main WordPress admin CSS file. +All the important stuff is in here. + + +TABLE OF CONTENTS: +------------------ + 1.0 - Text Elements + 2.0 - Forms + 3.0 - Actions + 4.0 - Notifications + 5.0 - TinyMCE + 6.0 - Admin Header + 6.1 - Favorites Menu + 6.2 - Screen Options Tabs + 7.0 - Main Navigation + 8.0 - Layout Blocks + 9.0 - Dashboard +10.0 - List Posts + 10.1 - Inline Editing +11.0 - Write/Edit Post Screen + 11.1 - Custom Fields + 11.2 - Post Revisions +12.0 - Categories +13.0 - Tags +14.0 - Media Screen + 14.1 - Media Uploader + 14.2 - Image Editor +15.0 - Comments Screen +16.0 - Themes + 16.1 - Custom Header + 16.2 - Custom Background + 16.3 - Tabbed Admin Screen Interface +17.0 - Plugins +18.0 - Users +19.0 - Tools +20.0 - Settings +21.0 - Admin Footer +22.0 - Misc +23.0 - Dead +24.0 - TinyMCE tweaks + + +------------------------------------------------------------------------------*/ + + + + +/*------------------------------------------------------------------------------ + 1.0 - Text Styles +------------------------------------------------------------------------------*/ + +ol { + margin-left: 0; + margin-right: 2em; +} + +.code, code { + font-family: Tahoma, Arial, sans-serif; +} + + +.quicktags, .search { + font: 12px Tahoma, Arial, sans-serif; +} + +.icon32 { + float: right; + margin: 7px 0 0 8px; +} + +.howto { + font-style: normal; + font-family: Tahoma, Arial, sans-serif; +} + +p.install-help { + font-style: normal; +} + + +/*------------------------------------------------------------------------------ + 2.0 - Forms +------------------------------------------------------------------------------*/ + +#doaction, +#doaction2, +#post-query-submit { + margin-right: 0; + margin-left: 8px; +} + +#timezone_string option { + margin-left: 0; + margin-right: 1em; +} + +#pass-strength-result { + float: right; + margin: 13px 1px 5px 5px; +} + +p.search-box { + float: left; +} + + +/*------------------------------------------------------------------------------ + 3.0 - Actions +------------------------------------------------------------------------------*/ + +#delete-action { + text-align: right; + float: right; +} + +#publishing-action { + text-align: left; + float: left; +} + +#post-body .misc-pub-section { + border-right:0; + border-left-width: 1px; + border-left-style: solid; + float: right; +} + +#post-body .misc-pub-section-last { + border-left: 0; +} + +#minor-publishing-actions { + padding: 10px 8px 2px 10px; + text-align: left; +} + +#save-post { + float: right; +} + +#minor-publishing .ajax-loading { + padding: 3px 4px 0 0; + float: right; +} + +.preview { + float: left; +} + +#sticky-span { + margin-left: 0; + margin-right: 18px; +} + +.side-info ul { + padding-left: 0; + padding-right: 18px; +} + +td.action-links, +th.action-links { + text-align: left; +} + +.describe .del-link { + padding-left: 0; + padding-right: 5px; +} + + +/*------------------------------------------------------------------------------ + 4.0 - Notifications +------------------------------------------------------------------------------*/ + +.plugin-update .update-message { + margin: 0 31px 8px 10px; +} + +form.upgrade .hint { + font-style: normal; +} + +#ajax-response.alignleft { + margin-left: 0; + margin-right: 2em; +} + + +/*------------------------------------------------------------------------------ + 5.0 - TinyMCE +------------------------------------------------------------------------------*/ + +#quicktags { + background-position: right top; +} + +#ed_reply_toolbar input { + margin: 1px 1px 1px 2px; +} + +/* Distraction Free Writing mode + * =Overlay Styles +-------------------------------------------------------------- */ + +/* No RTL for now, this space intentionally left blank */ + +/* =Overlay Body +-------------------------------------------------------------- */ +#wp-fullscreen-body { + right: 0; + left:auto; +} + +#wp-fullscreen-tagline { + float: left; +} + +/* =Top bar +-------------------------------------------------------------- */ +#fullscreen-topbar { + left:auto; + right: 0; +} + +#wp-fullscreen-mode-bar, +#wp-fullscreen-button-bar, +#wp-fullscreen-close, +#wp-fullscreen-count { + float: right; +} + +#wp-fullscreen-save { + float: left; +} + +#wp-fullscreen-save { + padding: 2px 5px 0 2px; +} + +#wp-fullscreen-buttons > div { + float: right; +} + +#wp-fullscreen-mode-bar { + padding: 1px 0 0 14px; +} + +#wp-fullscreen-modes a { + float: right; + border-width: 1px 0 1px 1px; +} + +#wp-fullscreen-modes a:first-child { + border-width: 1px; + -moz-border-radius: 3px 3px 0 0; + -webkit-border-top-left-radius: 0; + -webkit-border-top-right-radius: 3px; + -webkit-border-bottom-left-radius: 0; + -webkit-border-bottom-right-radius: 3px; + -khtml-border-top-left-radius: 0; + -khtml-border-top-right-radius: 3px; + -khtml-border-bottom-left-radius: 0; + -khtml-border-bottom-right-radius: 3px; + border-top-left-radius: 0; + border-top-right-radius: 3px; + border-bottom-right-left: 0; + border-bottom-right-radius: 3px; +} + +#wp-fullscreen-modes a:last-child { + -moz-border-radius: 0 0 3px 3px; + -webkit-border-top-right-radius: 0; + -webkit-border-top-left-radius: 3px; + -webkit-border-bottom-right-radius: 0; + -webkit-border-bottom-left-radius: 3px; + -khtml-border-top-right-radius: 0; + -khtml-border-top-left-radius: 3px; + -khtml-border-bottom-right-radius: 0; + -khtml-border-bottom-left-radius: 3px; + border-top-right-radius: 0; + border-top-left-radius: 3px; + border-bottom-right-radius: 0; + border-bottom-left-radius: 3px; +} + +#wp-fullscreen-save img, +#wp-fullscreen-save span { + padding-right: 0; + padding-left: 4px; +} + +/* =Thickbox Adjustments +-------------------------------------------------------------- */ +/* No RTL for now, this space intentionally left blank */ + + +/* =TinyMCE Adjustments +-------------------------------------------------------------- */ +/* No RTL for now, this space intentionally left blank */ + + + +/*------------------------------------------------------------------------------ + 6.0 - Admin Header +------------------------------------------------------------------------------*/ +#wphead-info { + margin: 0 15px 0 0; +} + +#user_info { + float: left; + padding: 0 6px 0 2px; +} + +#user_info.active { + margin-right: 0; + margin-left: -1px; +} + +#user_info .hide-if-no-js p { + margin: 0 0 0 20px; +} + +#user_info_arrow { + right: auto; + left: 3px; +} + +#user_info_links_wrap { + right: auto; + left: 0; +} + +#wphead { + height: 32px; + margin-left: 15px; + margin-right: 2px; +} + +#header-logo { + float: right; +} + +#wphead h1 { + font: Tahoma, Arial, sans-serif; + float: right; +} + +/*------------------------------------------------------------------------------ + 6.1 - Favorites Menu +------------------------------------------------------------------------------*/ + +#favorite-actions { + margin: 0 15px 0 12px; +} + +#favorite-first a { + padding: 2px 12px 2px 0; +} + +#favorite-inside a { + padding: 3px 10px 3px 5px; +} + +#favorite-toggle { + right: auto; + left: 0; +} + + +/*------------------------------------------------------------------------------ + 6.2 - Screen Options Tabs +------------------------------------------------------------------------------*/ + +#screen-meta-links { + margin: 0 0 0 19px; +} + +#screen-meta .screen-reader-text { + visibility: hidden; +} + +#screen-options-link-wrap, +#contextual-help-link-wrap { + float: left; + margin: 0 6px 0 0; + font-family: Tahoma, Arial, sans-serif; +} + +#contextual-help-wrap li { + list-style-type: disc; + margin-left: auto; + margin-right: 18px; +} +.toggle-arrow { + background-position: top right; +} +.toggle-arrow-active { + background-position: bottom right; +} +#screen-meta a.show-settings { + padding: 0 6px 0 16px; +} + +#screen-options-wrap, +#contextual-help-wrap { + margin: 0 0 0 15px; +} + +.metabox-prefs label { + padding-right: auto; + padding-left: 15px; +} + +.metabox-prefs label input { + margin: 0 2px 0 5px; +} + +/*------------------------------------------------------------------------------ + 7.0 - Main Navigation (Right Menu) (RTL: Left Menu) +------------------------------------------------------------------------------*/ + +#adminmenushadow { + right: auto; + left: 0; +} + +#adminmenu div.wp-menu-image { + float: right; +} + +#adminmenu .wp-submenu a { + padding-left: 0; + padding-right: 12px; +} + +#adminmenu li.wp-has-current-submenu .wp-menu-arrow, +#adminmenu li.menu-top.current .wp-menu-arrow { + right: auto; + left: -9px; +} +#adminmenu .wp-menu-arrow div { + background: url(../images/menu-arrow-frame-rtl.png) top left no-repeat; +} + +#adminmenu .wp-menu-image img { + float: right; +} + +.js.folded #adminmenu .wp-submenu { + display: block; + left: auto; + right: 26px; +} + +.js.folded #adminmenu .wp-submenu.sub-open { + padding: 0 0 8px 8px; +} + +#adminmenu .wp-submenu .wp-submenu-head { + padding: 6px 10px 5px 4px; +} + +.js.folded #adminmenu .wp-submenu-wrap { + -webkit-border-bottom-right-radius: 0; + -webkit-border-bottom-left-radius: 3px; + -webkit-border-top-right-radius: 0; + -webkit-border-top-left-radius: 3px; + -khtml-border-bottom-right-radius: 0; + -khtml-border-bottom-left-radius: 3px; + -khtml-border-top-left-radius: 0; + -khtml-border-top-left-radius: 3px; + -moz-border-radius-bottomright: 0; + -moz-border-radius-bottomleft: 3px; + -moz-border-radius-topright: 0; + -moz-border-radius-topleft: 3px; + border-bottom-right-radius: 0; + border-bottom-left-radius: 3px; + border-top-right-radius: 0; + border-top-left-radius: 3px; + border-width: 0 0 1px 1px; +} + +.js.folded #adminmenu .wp-submenu ul { + border-width: 0 1px 0 0; +} + +.js.folded #adminmenu .wp-submenu a { + padding-left: 0; + padding-right: 10px; +} + +.js.folded #adminmenu a.wp-has-submenu { + margin-left: 0; + margin-right: 40px; +} + +#adminmenu .wp-menu-toggle { + clear: left; + float: left; + padding: 1px 0 0 2px; +} + +#adminmenu .wp-menu-image img { + padding: 6px 1px 0 0; +} + +#adminmenu .awaiting-mod, +#adminmenu span.update-plugins, +#sidemenu li a span.update-plugins { + font-family: Tahoma, Arial, sans-serif; + margin-left: 0; + margin-right: 7px; +} + +.post-com-count-wrapper { + font-family: Tahoma, Arial, sans-serif; +} + +.column-response .post-com-count { + float: right; + margin-right: 0; + margin-left: 5px; +} + +.response-links { + float: right; +} + +#collapse-button { + float: right; +} + +/*------------------------------------------------------------------------------ + 8.0 - Layout Blocks +------------------------------------------------------------------------------*/ + +.widefat th { + font-family: Tahoma, Arial, sans-serif; +} + +.widefat td p { + margin: 2px 0 0.8em; +} + +.postbox-container { + float: right; + padding-right: 0; + padding-left: 0.5%; +} + +.postbox .handlediv { + float: left; +} + +/*------------------------------------------------------------------------------ + 9.0 - Dashboard +------------------------------------------------------------------------------*/ + +#the-comment-list p.comment-author img { + float: right; + margin-right: 0; + margin-left: 8px; +} + +/*------------------------------------------------------------------------------ + 10.0 - List Posts (/Pages/etc) +------------------------------------------------------------------------------*/ + +.fixed .column-comments { + text-align: right; +} +.fixed .column-comments .vers { + padding-left: 0; + padding-right: 3px; +} +.fixed .column-comments a { + float: right; +} +.sorting-indicator { + margin-left: 0; + margin-right: 7px; +} +th.sortable a span, +th.sorted a span { + float: right; +} + +/* Bulk Actions */ + +.tablenav-pages a { + margin-right: 0; + margin-left: 1px; +} +.tablenav-pages .next-page { + margin-left: 0; + margin-right: 2px; +} + +.tablenav a.button-secondary { + margin: 3px 0 0 8px; +} + +.tablenav .tablenav-pages { + float: left; +} + +.tablenav .displaying-num { + margin-right: 0; + margin-left: 10px; + font-family: Tahoma, Arial, sans-serif; + font-style: bold; +} + +.tablenav .actions { + padding: 2px 0 0 8px; +} + +.tablenav .delete { + margin-right: 0; + margin-left: 20px; +} + +.view-switch { + float: left; +} + +.filter { + float: right; + margin: -5px 10px 0 0; +} + +.filter .subsubsub { + margin-left: 0; + margin-right: -10px; +} + +#posts-filter fieldset { + float: right; + margin: 0 0 1em 1.5ex; +} + +#posts-filter fieldset legend { + padding: 0 1px .2em 0; +} + +/*------------------------------------------------------------------------------ + 10.1 - Inline Editing +------------------------------------------------------------------------------*/ + +#wpbody-content .inline-edit-row fieldset { + float: right; +} + +#wpbody-content .quick-edit-row-page fieldset.inline-edit-col-right .inline-edit-col { + border-width: 0 1px 0 0; +} + +#wpbody-content .bulk-edit-row .inline-edit-col-bottom { + float: left; +} + +.inline-edit-row fieldset label span.title { + float: right; +} + +.inline-edit-row fieldset label span.input-text-wrap { + margin-left: 0; + margin-right: 5em; +} + +.quick-edit-row-post fieldset.inline-edit-col-right label span.title { + padding-right: 0; + padding-left: 0.5em; +} + +#wpbody-content .quick-edit-row fieldset .inline-edit-group label.alignleft:first-child { + margin-right: 0; + margin-left: 0.5em +} + +/* Styling */ + +.inline-edit-row fieldset span.title, +.inline-edit-row fieldset span.checkbox-title { + font-family: Tahoma, Arial, sans-serif; + font-style: normal; +} + +.inline-edit-row fieldset .inline-edit-date { + float: right; +} + +.inline-edit-row fieldset ul.cat-checklist label, +.inline-edit-row .catshow, +.inline-edit-row .cathide, +.inline-edit-row #bulk-titles div { + font-family: Tahoma, Arial, sans-serif; +} + +.quick-edit-row-post fieldset label.inline-edit-status { + float: right; +} + +#bulk-titles div a { + float: right; + margin: 3px -2px 0 3px; + overflow: hidden; + text-indent: -9999px; +} + + +/*------------------------------------------------------------------------------ + 11.0 - Write/Edit Post Screen +------------------------------------------------------------------------------*/ + +#titlediv #title-prompt-text, +#wp-fullscreen-title-prompt-text { + right:0; +} + +#sample-permalink { + direction:ltr; +} + +#sample-permalink #editable-post-name { + unicode-bidi:embed; +} +#wp-fullscreen-title-prompt-text { + left: auto; + right: 0; +} + +.postarea h3 label { + float: right; +} + +.postarea #add-media-button { + float: left; + right: auto; + left: 10px; +} + + +#edButtonPreview, +#edButtonHTML { + margin: 5px 0 0 5px; + float: left; +} + +#poststuff #edButtonHTML { + margin-right: 0; + margin-left: 15px; +} + +#media-buttons a { + padding: 0 10px 5px 0; +} + +.submitbox .submit { + text-align: right; +} + +.inside-submitbox #post_status { + margin: 2px -2px 2px 0; +} + +.submitbox .submit input { + margin-right: 0; + margin-left: 4px; +} + +#normal-sortables .postbox .submit { + float: left; +} + + +#post-body ul.category-tabs, +#post-body ul.add-menu-item-tabs { + float: right; + text-align: left; + /* Negative margin for the sake of those without JS: all tabs display */ + margin: 0 5px 0 -120px; +} + + +#post-body ul.category-tabs li.tabs, +#post-body ul.add-menu-item-tabs li.tabs { + -moz-border-radius: 3px 3px 0 0; + -webkit-border-top-left-radius: 0; + -webkit-border-top-right-radius: 3px; + -webkit-border-bottom-left-radius: 0; + -webkit-border-bottom-right-radius: 3px; + -khtml-border-top-left-radius: 0; + -khtml-border-top-right-radius: 3px; + -khtml-border-bottom-left-radius: 0; + -khtml-border-bottom-right-radius: 3px; + border-top-left-radius: 0; + border-top-right-radius: 3px; + border-bottom-left-radius: 0; + border-bottom-right-radius: 3px; +} + +#post-body .categorydiv div.tabs-panel, +.taxonomy div.tabs-panel, +#post-body #linkcategorydiv div.tabs-panel { + margin: 0 125px 0 5px; +} + +#side-sortables .comments-box thead th, +#normal-sortables .comments-box thead th { + font-style: normal; +} + +#commentsdiv img.waiting { + padding-left: 0; + padding-right: 5px; +} + +#post-body .category-tabs li.tabs, +#post-body .add-menu-item-tabs li.tabs { + border-width: 1px 1px 1px 0; + margin-right: 0; + margin-left: -1px; +} + +/* positioning etc. */ + +#posts-filter fieldset { + float: right; + margin: 0 0 1em 1.5ex; +} + +#posts-filter fieldset legend { + padding: 0 1px .2em 0; +} + +/* Global classes */ + +#post-body .tagsdiv #newtag { + margin-right: 0; + margin-left: 5px; +} + +.autosave-info { + padding: 2px 2px 2px 15px; + text-align: left; +} + +#post-body .wp_themeSkin .mceStatusbar a.mceResize { + background: transparent url(../images/resize-rtl.gif) no-repeat scroll left bottom; + cursor: sw-resize; +} + +.curtime #timestamp { + background-position: right top; + padding-left: 0; + padding-right: 18px; +} + +/*------------------------------------------------------------------------------ + 11.1 - Custom Fields +------------------------------------------------------------------------------*/ + +#postcustomstuff table input, +#postcustomstuff table select, +#postcustomstuff table textarea { + margin: 8px 8px 8px 0; +} + +/*------------------------------------------------------------------------------ + 11.2 - Post Revisions +------------------------------------------------------------------------------*/ + +table.diff td, table.diff th { + font-family: Consolas, Monaco, monospace; +} + +/*------------------------------------------------------------------------------ + 12.0 - Categories +------------------------------------------------------------------------------*/ + +.category-adder { + margin-left: 0; + margin-right: 120px; +} + + +#post-body ul.category-tabs, +#post-body ul.add-menu-item-tabs { + float: right; + text-align: left; + /* Negative margin for the sake of those without JS: all tabs display */ + margin: 0 5px 0 -120px; +} + +#post-body ul.category-tabs li.tabs, +#post-body ul.add-menu-item-tabs li.tabs { + -moz-border-radius: 3px 3px 0 0; + -webkit-border-top-left-radius: 0; + -webkit-border-top-right-radius: 3px; + -webkit-border-bottom-left-radius: 0; + -webkit-border-bottom-right-radius: 3px; + -khtml-border-top-left-radius: 0; + -khtml-border-top-right-radius: 3px; + -khtml-border-bottom-left-radius: 0; + -khtml-border-bottom-right-radius: 3px; + border-top-left-radius: 0; + border-top-right-radius: 3px; + border-bottom-left-radius: 0; + border-bottom-right-radius: 3px; +} + +#front-page-warning, +#front-static-pages ul, +ul.export-filters, +.inline-editor ul.cat-checklist ul, +.categorydiv ul.categorychecklist ul, +.customlinkdiv ul.categorychecklist ul, +.posttypediv ul.categorychecklist ul, +.taxonomydiv ul.categorychecklist ul, +#linkcategorydiv ul.categorychecklist ul { + margin-left: 0; + margin-right: 18px; +} + +#post-body .category-tabs li.tabs, +#post-body .add-menu-item-tabs li.tabs { + border-style: solid solid solid none; + border-width: 1px 1px 1px 0; + margin-right: 0; + margin-left: -1px; +} + +p.help, +p.description, +span.description, +.form-wrap p { + font-style: normal; + font-family: Tahoma, Arial, sans-serif; +} + +/*------------------------------------------------------------------------------ + 13.0 - Tags +------------------------------------------------------------------------------*/ + +.taghint { + margin: 15px 12px -24px 0; +} + +#poststuff .tagsdiv .howto { + margin: 0 8px 6px 0; +} + +.ac_results li { + text-align: right; +} + +/*------------------------------------------------------------------------------ + 14.0 - Media Screen +------------------------------------------------------------------------------*/ + +#wpbody-content .describe th { + text-align: right; + +} + +.describe .media-item-info .A1B1 { + padding: 0 10px 0 0; +} + +.media-upload-form td label { + margin-left: 6px; + margin-right: 2px; +} + +.media-upload-form .align .field label { + padding: 0 22px 0 0; + margin: 0 0 0 1em; +} + +.media-upload-form tr.image-size label { + margin: 0 3px 0 0; +} + +#wpbody-content .describe p.help { + padding: 0 5px 0 0; +} + +.media-item .error-div a.dismiss, +.describe-toggle-on, +.describe-toggle-off { + float: left; + margin-right: 0; + margin-left: 20px; +} + +.media-item .error-div { + padding-left: 0; + padding-right: 10px; +} + +.media-item .pinkynail { + float: right; +} + +.crunching { + text-align: left; + margin-right: 0; + margin-left: 5px; +} + +.bar { + border-right-width: 0; + border-left-width: 3px; + border-right-style: none; + border-left-style: solid; +} + +/*------------------------------------------------------------------------------ + 14.1 - Media Uploader +------------------------------------------------------------------------------*/ + +#find-posts-response .found-radio { + padding: 5px 8px 0 0; +} + + +.find-box-search label { + padding-right: 0; + padding-left: 6px; +} + +.find-box #resize-se { + right: auto; + left: 1px; +} + + +form.upgrade .hint { + font-style: normal; +} + + +/*------------------------------------------------------------------------------ + 14.2 - Image Editor +------------------------------------------------------------------------------*/ + +.imgedit-menu div { + float: right; +} + +.imgedit-help { + font-style: normal; +} + +.imgedit-submit-btn { + margin-left: 0; + margin-right: 20px; +} + + +/*------------------------------------------------------------------------------ + 15.0 - Comments Screen +------------------------------------------------------------------------------*/ + +.form-table th { + text-align: right; +} + +.form-table input.tog { + margin-right: 0; + margin-left: 2px; + float: right; +} + +.form-table table.color-palette { + float: right; +} + +/* reply to comments */ + +#replysubmit img.waiting, +.inline-edit-save img.waiting { + float: left; +} + +#replysubmit .button { + margin-right: 0; + margin-left: 5px; +} + +#edithead .inside { + float: right; + padding: 3px 5px 2px 0; +} + +.comment-ays th { + border-right-style: none; + border-left-style: solid; + border-right-width: 0; + border-left-width: 1px; +} + +.spam-undo-inside .avatar, +.trash-undo-inside .avatar { + margin-left: 8px; +} + +#comment-status-radio input { + margin: 2px 0 5px 3px; +} + + + +/*------------------------------------------------------------------------------ + 16.0 - Themes +------------------------------------------------------------------------------*/ + +td.available-theme { + text-align: right; +} + +#current-theme img { + float: right; + margin-right: 0; + margin-left: 1em; +} + +#broken-themes { + text-align: right; +} + +/*------------------------------------------------------------------------------ + 16.1 - Custom Header Screen +------------------------------------------------------------------------------*/ + +.appearance_page_custom-header .available-headers .default-header { + float: right; + margin: 0 0 20px 20px; +} + +.appearance_page_custom-header .random-header { + margin: 0 0 20px 20px; +} + +.appearance_page_custom-header .available-headers label input, +.appearance_page_custom-header .random-header label input { + margin-right: 0; + margin-left: 10px; +} + +/*------------------------------------------------------------------------------ + 16.2 - Custom Background Screen +------------------------------------------------------------------------------*/ + +/* No RTL for now, this space intentionally left blank */ + + +/*------------------------------------------------------------------------------ + 16.3 - Tabbed Admin Screen Interface (Experimental) +------------------------------------------------------------------------------*/ + +.nav-tab { + margin: 0 0 -1px 6px; +} + +h2 .nav-tab { + font-family: Tahoma, Arial, sans-serif; +} + + +/*------------------------------------------------------------------------------ + 17.0 - Plugins +------------------------------------------------------------------------------*/ + +.plugins .desc ul, +.plugins .desc ol { + margin: 0 2em 0 0; +} + +#wpbody-content .plugins .plugin-title, #wpbody-content .plugins .theme-title { + padding-right: 0; + padding-left: 12px; +} + + +/*------------------------------------------------------------------------------ + 18.0 - Users +------------------------------------------------------------------------------*/ + +#profile-page .form-table #rich_editing { + margin-right: 0; + margin-left: 5px +} + +#your-profile legend { + font-family: Tahoma, Arial, sans-serif; +} + +/*------------------------------------------------------------------------------ + 19.0 - Tools +------------------------------------------------------------------------------*/ + +/* Intentionally didn't RTLized the new press-this button; + +/*------------------------------------------------------------------------------ + 20.0 - Settings +------------------------------------------------------------------------------*/ + +#utc-time, #local-time { + padding-left: 0; + padding-right: 25px; + font-style: normal; + font-family: Tahoma, Arial, sans-serif; +} + +/*------------------------------------------------------------------------------ + 21.0 - Admin Footer +------------------------------------------------------------------------------*/ + +#footer { + margin-right: 0; + margin-left: 15px; +} + +/*------------------------------------------------------------------------------ + 22.0 - Misc +------------------------------------------------------------------------------*/ + +#template div { + margin-right: 0; + margin-left: 190px; +} + +.column-author img, .column-username img { + float: right; + margin-right: 0; + margin-left: 10px; +} + +.tagchecklist { + margin-left: 0; + margin-right: 14px; +} + +.tagchecklist strong { + margin-left: 0; + margin-right: -8px; +} + +.tagchecklist span { + margin-right: 0; + margin-left: 25px; + float: right; + +} +.tagchecklist span a { + margin: 6px -9px 0pt 0pt; + float: right; +} + +#poststuff h2 { + clear: right; +} + +#poststuff h3, +.metabox-holder h3 { + font-family: Tahoma, Arial, sans-serif; +} + +.tool-box .title { + font-family: Tahoma, Arial, sans-serif; +} + +#sidemenu { + margin: -30px 315px 0 15px; + float: left; + padding-left: 0; + padding-right: 10px; +} +#sidemenu a { + float: right; +} + +table .vers, +table .column-visible, +table .column-rating { + text-align: right; +} + + +/*------------------------------------------------------------------------------ + 23.0 - Dead +------------------------------------------------------------------------------*/ + +/* - Not used anywhere in WordPress - verify and then deprecate +------------------------------------------------------------------------------*/ + +/* No RTL for now, this space intentionally left blank */ + + +/* - Only used once or twice in all of WP - deprecate for global style +------------------------------------------------------------------------------*/ + +* html #template div {margin-left: 0;} + +.list-ajax-loading { + float: left; + margin-right: 0; + margin-left: 9px; +} + +/* - Used - but could/should be deprecated with a CSS reset +------------------------------------------------------------------------------*/ +/* No RTL for now, this space intentionally left blank */ + + +/*------------------------------------------------------------------------------ + 24.0 - TinyMCE tweaks + Small tweaks for until tinymce css files are proprely RTLized +------------------------------------------------------------------------------*/ +#editorcontainer .wp_themeSkin .mceStatusbar { + padding-left: 0; + padding-right: 5px; +} +#editorcontainer .wp_themeSkin .mceStatusbar div { + float: right; +} + +#editorcontainer .wp_themeSkin .mceStatusbar a.mceResize { + float: left; +} diff --git a/src/wp-admin/css/wp-admin.css b/src/wp-admin/css/wp-admin.css new file mode 100644 index 0000000..3468a62 --- /dev/null +++ b/src/wp-admin/css/wp-admin.css @@ -0,0 +1 @@ +p,ul,ol,blockquote,input,select{font-size:12px;}ol{list-style-type:decimal;margin-left:2em;}.code,code{font-family:Consolas,Monaco,monospace;}kbd,code{padding:1px 3px;margin:0 1px;font-size:11px;}.quicktags,.search{font:12px Georgia,"Times New Roman","Bitstream Charter",Times,serif;}.icon32{float:left;height:34px;margin:7px 8px 0 0;width:36px;}.key-labels label{line-height:24px;}.pre{white-space:pre-wrap;white-space:-moz-pre-wrap!important;white-space:-pre-wrap;white-space:-o-pre-wrap;word-wrap:break-word;}.howto{font-style:italic;display:block;font-family:sans-serif;}p.install-help{margin:8px 0;font-style:italic;}textarea,input[type="text"],input[type="password"],input[type="file"],input[type="button"],input[type="submit"],input[type="reset"],select{border-width:1px;border-style:solid;-moz-border-radius:3px;-khtml-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;}select option{padding:2px;}.submit{padding:1.5em 0;margin:5px 0;-moz-border-radius:0 0 3px 3px;-webkit-border-bottom-left-radius:3px;-webkit-border-bottom-right-radius:3px;-khtml-border-bottom-left-radius:3px;-khtml-border-bottom-right-radius:3px;border-bottom-left-radius:3px;border-bottom-right-radius:3px;}form p.submit a.cancel:hover{text-decoration:none;}.submit input,.button,input.button,.button-primary,input.button-primary,.button-secondary,input.button-secondary,.button-highlighted,input.button-highlighted,#postcustomstuff .submit input{text-decoration:none;font-size:12px!important;line-height:13px;padding:3px 8px;cursor:pointer;border-width:1px;border-style:solid;-moz-border-radius:11px;-khtml-border-radius:11px;-webkit-border-radius:11px;border-radius:11px;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;-khtml-box-sizing:content-box;box-sizing:content-box;}#minor-publishing-actions input,#major-publishing-actions input,#minor-publishing-actions .preview{min-width:80px;text-align:center;}textarea.all-options,input.all-options{width:250px;}input.large-text,textarea.large-text{width:99%;}input.regular-text,#adduser .form-field input{width:25em;}input.small-text{width:50px;}#doaction,#doaction2,#post-query-submit{margin-right:8px;}.tablenav select[name="action"],.tablenav select[name="action2"]{width:130px;}.tablenav select[name="m"]{width:155px;}.tablenav select#cat{width:170px;}#wpcontent select{padding:2px;height:2em;font-size:12px;}#wpcontent option{padding:2px;}#timezone_string option{margin-left:1em;}label,#your-profile label+a{vertical-align:middle;}#misc-publishing-actions label{vertical-align:baseline;}#pass-strength-result{border-style:solid;border-width:1px;float:left;margin:13px 5px 5px 1px;padding:3px 5px;text-align:center;width:200px;display:none;}.indicator-hint{padding-top:8px;}p.search-box{float:right;margin:0;}#major-publishing-actions{padding:10px 10px 8px;clear:both;border-top:none;}#delete-action{line-height:25px;vertical-align:middle;text-align:left;float:left;}#publishing-action{text-align:right;float:right;line-height:23px;}#post-body #minor-publishing{padding-bottom:10px;}#post-body #misc-publishing-actions{padding:0;}#post-body .misc-pub-section{border-right-width:1px;border-right-style:solid;border-bottom:0 none;min-height:30px;float:left;max-width:32%;}#post-body .misc-pub-section-last{border-right:0;}#misc-publishing-actions{padding:6px 0 16px 0;}.misc-pub-section{padding:6px 10px;border-width:1px 0;border-style:solid;}.misc-pub-section:first-child{border-top-width:0;}.misc-pub-section-last{border-bottom-width:0;}#minor-publishing-actions{padding:10px 10px 2px 8px;text-align:right;}#minor-publishing{border-bottom-width:1px;border-bottom-style:solid;-webkit-box-shadow:0 1px 0 #fff;-moz-box-shadow:0 1px 0 #fff;box-shadow:0 1px 0 #fff;}#save-post{float:left;}#minor-publishing .ajax-loading{padding:3px 0 0 4px;float:left;}.preview{float:right;}#sticky-span{margin-left:18px;}#post-status-display,#post-visibility-display{font-weight:bold;}.side-info{margin:0;padding:4px;font-size:11px;}.side-info h5{padding-bottom:7px;font-size:14px;margin:12px 2px 5px;border-bottom-width:1px;border-bottom-style:solid;}.side-info ul{margin:0;padding-left:18px;list-style:square;}a.button,a.button-primary,a.button-secondary{line-height:15px;padding:3px 10px;white-space:nowrap;-webkit-border-radius:10px;}.approve{display:none;}.unapproved .approve,.spam .approve,.trash .approve{display:inline;}.unapproved .unapprove{display:none;}td.action-links,th.action-links{text-align:right;}.describe .del-link{padding-left:5px;}#update-nag,.update-nag{line-height:19px;padding:5px 0;font-size:12px;text-align:center;margin:0 15px;border-width:1px;border-style:solid;border-top-width:0;border-top-style:none;-moz-border-radius:0 0 3px 3px;-webkit-border-bottom-right-radius:3px;-webkit-border-bottom-left-radius:3px;-khtml-border-bottom-right-radius:3px;-khtml-border-bottom-left-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;}.plugins .plugin-update{padding:0;}.plugin-update .update-message{margin:0 10px 8px 31px;font-weight:bold;}ul#dismissed-updates{display:none;}form.upgrade{margin-top:8px;}form.upgrade .hint{font-style:italic;font-size:85%;margin:-0.5em 0 2em 0;}.ajax-feedback{visibility:hidden;vertical-align:bottom;}#ajax-response.alignleft{margin-left:2em;}#editorcontainer #content{font-family:Consolas,Monaco,monospace;padding:6px;line-height:150%;border:0 none;outline:none;resize:vertical;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;-khtml-box-sizing:border-box;box-sizing:border-box;}#editorcontainer,#quicktags{border-style:solid;border-width:1px;border-collapse:separate;-moz-border-radius:3px 3px 0 0;-webkit-border-top-right-radius:3px;-webkit-border-top-left-radius:3px;-khtml-border-top-right-radius:3px;-khtml-border-top-left-radius:3px;border-top-right-radius:3px;border-top-left-radius:3px;}#quicktags{padding:0;margin-bottom:-3px;border-bottom-width:3px;background-image:url("../images/ed-bg.gif");background-position:left top;background-repeat:repeat-x;}#quicktags #ed_toolbar{padding:2px 4px 0;}#ed_toolbar input,#ed_reply_toolbar input{margin:3px 1px 4px;line-height:18px;display:inline-block;min-width:26px;padding:2px 4px;font-size:12px;}#ed_reply_toolbar input{margin:1px 2px 1px 1px;}#quicktags #ed_link,#ed_reply_toolbar #ed_reply_link{text-decoration:underline;}#quicktags #ed_del,#ed_reply_toolbar #ed_reply_del{text-decoration:line-through;}#quicktags #ed_em,#ed_reply_toolbar #ed_reply_em{font-style:italic;}#wp_editbtns,#wp_gallerybtns{padding:2px;position:absolute;display:none;z-index:999998;}#wp_editimgbtn,#wp_delimgbtn,#wp_editgallery,#wp_delgallery{margin:2px;padding:2px;border-width:1px;border-style:solid;-moz-border-radius:3px;-khtml-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;}.fullscreen-overlay{z-index:149999;display:none;position:fixed;top:0;bottom:0;left:0;right:0;filter:inherit;}.fullscreen-active .fullscreen-overlay,.fullscreen-active #wp-fullscreen-body{display:block;}.fullscreen-fader{z-index:200000;}.fullscreen-active .fullscreen-fader{display:none;}#wp-fullscreen-body{width:100%;z-index:150005;display:none;position:absolute;top:0;left:0;}#wp-fullscreen-wrap{margin:0 auto 50px;position:relative;padding-top:60px;}#wp-fullscreen-title{font-size:1.7em;line-height:100%;outline:medium none;padding:6px 7px;width:100%;margin-bottom:30px;}#wp-fullscreen-container{padding:4px 10px 50px;}#wp-fullscreen-title,#wp-fullscreen-container{-moz-border-radius:0;-khtml-border-radius:0;-webkit-border-radius:0;border-radius:0;border:1px dashed transparent;background:transparent;-moz-transition-property:border-color;-moz-transition-duration:.6s;-webkit-transition-property:border-color;-webkit-transition-duration:.6s;-o-transition-property:border-color;-o-transition-duration:.6s;transition-property:border-color;transition-duration:.6s;}#wp_mce_fullscreen{width:100%;min-height:300px;border:0;background:transparent;font-family:Consolas,Monaco,monospace;line-height:1.6em;padding:0;overflow-y:hidden;outline:none;resize:none;}#wp-fullscreen-tagline{color:#BBB;font-size:18px;float:right;padding-top:5px;}#fullscreen-topbar{position:fixed;top:0;left:0;z-index:150050;border-bottom-style:solid;border-bottom-width:1px;min-width:800px;width:100%;height:40px;}#wp-fullscreen-toolbar{padding:6px 10px 0;clear:both;max-width:1100px;min-width:820px;margin:0 auto;}#wp-fullscreen-mode-bar,#wp-fullscreen-button-bar,#wp-fullscreen-close,#wp-fullscreen-count{float:left;}#wp-fullscreen-save{float:right;}#wp-fullscreen-save{padding:2px 2px 0 5px;}#wp-fullscreen-count,#wp-fullscreen-close{padding-top:5px;}#wp-fullscreen-central-toolbar{margin:auto;padding:0;}#wp-fullscreen-buttons>div{float:left;}#wp-fullscreen-mode-bar{padding:1px 14px 0 0;}#wp-fullscreen-modes a{display:block;font-size:11px;text-decoration:none;float:left;margin:1px 0 0 0;padding:2px 6px 2px;border-width:1px 1px 1px 0;border-style:solid;border-color:#bbb;color:#777;text-shadow:0 1px 0 #fff;background-color:#f4f4f4;background-image:-moz-linear-gradient(bottom,#e4e4e4,#f9f9f9);background-image:-webkit-gradient(linear,left bottom,left top,from(#e4e4e4),to(#f9f9f9));}#wp-fullscreen-modes a:hover,.wp-html-mode #wp-fullscreen-modes a:last-child,.wp-tmce-mode #wp-fullscreen-modes a:first-child{color:#333;border-color:#999;background-color:#eee;background-image:-moz-linear-gradient(bottom,#f9f9f9,#e0e0e0);background-image:-webkit-gradient(linear,left bottom,left top,from(#f9f9f9),to(#e0e0e0));}#wp-fullscreen-modes a:first-child{border-width:1px;-moz-border-radius:3px 0 0 3px;-webkit-border-top-left-radius:3px;-webkit-border-bottom-left-radius:3px;-khtml-border-top-left-radius:3px;-khtml-border-bottom-left-radius:3px;border-top-left-radius:3px;border-bottom-left-radius:3px;}#wp-fullscreen-modes a:last-child{-moz-border-radius:0 3px 3px 0;-webkit-border-top-right-radius:3px;-webkit-border-bottom-right-radius:3px;-khtml-border-top-right-radius:3px;-khtml-border-bottom-right-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;}#wp-fullscreen-buttons .active a{background:inherit;}#wp-fullscreen-buttons .hidden{display:none;}#wp-fullscreen-buttons .disabled{opacity:.5;}.wp-html-mode #wp-fullscreen-buttons div{display:none;}.wp-html-mode #wp-fullscreen-buttons div.wp-fullscreen-both{display:block;}#fullscreen-topbar.fullscreen-make-sticky{display:block!important;}#wp-fullscreen-save img{vertical-align:middle;}#wp-fullscreen-save img,#wp-fullscreen-save span{padding-right:4px;display:none;}#wp-fullscreen-buttons .mce_image .mce_image{background-image:url("../images/menu.png?ver=20100531");background-position:-124px -38px;}#wp-fullscreen-buttons .mce_image .mce_image:hover{background-position:-124px -6px;}.fullscreen-active #TB_overlay{z-index:150100;}.fullscreen-active #TB_window{z-index:150102;}#wp_mce_fullscreen_ifr{background:transparent;}#wp_mce_fullscreen_parent #wp_mce_fullscreen_tbl tr.mceFirst{display:none;}#wp-fullscreen-container .wp_themeSkin table td{vertical-align:top;}#wphead-info{margin:0 0 0 15px;}#user_info{float:right;font-size:12px;line-height:26px;height:25px;position:relative;z-index:49;border-style:solid;border-width:0;margin-top:3px;padding:0 2px 0 6px;}#user_info.active{border-width:1px;margin-right:-1px;margin-top:2px;-moz-border-radius:3px 3px 0 0;-webkit-border-top-right-radius:3px;-webkit-border-top-left-radius:3px;-khtml-border-top-right-radius:3px;-khtml-border-top-left-radius:3px;border-top-right-radius:3px;border-top-left-radius:3px;}#user_info p{margin:0;padding:0;line-height:25px;cursor:pointer;}#user_info .hide-if-no-js p{margin:0 20px 0 0;}#user_info:hover .hide-if-no-js p{text-decoration:underline;}#user_info.active .hide-if-no-js p{text-decoration:none;}#user_info_arrow{height:22px;width:22px;position:absolute;right:3px;top:0;cursor:pointer;}#user_info_links_wrap{min-width:100px;width:100%;position:absolute;top:25px;right:0;padding:0;text-shadow:rgba(255,255,255,0.7) 0 1px 0;}#user_info_links{position:absolute;left:-1px;right:-1px;overflow:hidden;}#user_info.active #user_info_links ul{margin-top:0;-moz-transition:margin-top 200ms;-webkit-transition:margin-top 200ms;-o-transition:margin-top 200ms;transition:margin-top 200ms;}#user_info_links ul{border-width:1px;border-style:solid;margin-top:-1000px;-moz-transition:margin-top 500ms ease-in;-webkit-transition:margin-top 500ms ease-in;-o-transition:margin-top 500ms ease-in;transition:margin-top 500ms ease-in;}#user_info_links,#user_info_links ul,#user_info_links li:last-child{-moz-border-radius:0 0 3px 3px;-webkit-border-bottom-right-radius:3px;-webkit-border-bottom-left-radius:3px;-khtml-border-bottom-right-radius:3px;-khtml-border-bottom-left-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;}#user_info_links li{display:block;margin:0;}#user_info_links a{display:block;padding:6px 8px;}#wphead{height:32px;margin-right:20px;margin-left:2px;}#wphead a,#adminmenu a,#sidemenu a,#taglist a,#catlist a,#show-settings a{text-decoration:none;}#header-logo{float:left;margin:7px 0;-webkit-user-select:none;-moz-user-select:none;-khtml-user-select:none;user-select:none;}#wphead h1{font:normal 16px Georgia,"Times New Roman","Bitstream Charter",Times,serif;padding:6px 8px 5px;margin:0;float:left;}#wphead h1 a:hover{text-decoration:none;}#wphead h1 a:hover #site-title{text-decoration:underline;}#favorite-actions{margin:0 12px 0 15px;min-width:130px;position:relative;display:inline-block;top:-1px;}#favorite-first{-moz-border-radius:12px;-khtml-border-radius:12px;-webkit-border-radius:12px;border-radius:12px;line-height:15px;padding:0 30px 0 0;border-width:1px;border-style:solid;}#favorite-inside{margin:0;padding:2px 1px;border-width:1px;border-style:solid;position:absolute;z-index:11;display:none;-moz-border-radius:0 0 12px 12px;-webkit-border-bottom-right-radius:12px;-webkit-border-bottom-left-radius:12px;-khtml-border-bottom-right-radius:12px;-khtml-border-bottom-left-radius:12px;border-bottom-right-radius:12px;border-bottom-left-radius:12px;}#favorite-first a{padding:2px 0 2px 12px;}#favorite-actions a{display:block;text-decoration:none;font-size:11px;}#favorite-inside a{padding:3px 5px 3px 10px;line-height:20px;}#favorite-toggle{height:18px;position:absolute;right:0;top:1px;width:28px;border-width:0 0 0 1px;border-style:solid;}#favorite-actions .slide-down{-moz-border-radius:12px 12px 0 0;-webkit-border-bottom-right-radius:0;-webkit-border-bottom-left-radius:0;-khtml-border-bottom-right-radius:0;-khtml-border-bottom-left-radius:0;border-bottom-right-radius:0;border-bottom-left-radius:0;border-bottom:none;}#screen-meta{position:relative;clear:both;}#screen-meta-links{margin:0 24px 0 0;}#screen-meta .screen-reader-text{visibility:hidden;}#screen-options-link-wrap,#contextual-help-link-wrap{float:right;height:22px;padding:0;margin:0 0 0 6px;font-family:sans-serif;-moz-border-radius-bottomleft:3px;-moz-border-radius-bottomright:3px;-webkit-border-bottom-left-radius:3px;-webkit-border-bottom-right-radius:3px;border-bottom-left-radius:3px;border-bottom-right-radius:3px;}#contextual-help-wrap li{list-style-type:disc;margin-left:18px;}.toggle-arrow{background-repeat:no-repeat;background-position:top left;background-color:transparent;height:22px;line-height:22px;display:block;}.toggle-arrow-active{background-position:bottom left;}#screen-meta a.show-settings{text-decoration:none;z-index:1;padding:0 16px 0 6px;height:22px;line-height:22px;font-size:12px;display:block;text-shadow:rgba(255,255,255,0.7) 0 1px 0;}#screen-meta a.show-settings:hover{text-decoration:none;}#screen-options-wrap h5,#contextual-help-wrap h5{margin:8px 0;font-size:13px;}#screen-options-wrap,#contextual-help-wrap{border-style:none solid solid;border-top:0 none;border-width:0 1px 1px;margin:0 20px 0 0;padding:8px 12px 12px;}.metabox-prefs label{display:inline-block;padding-right:15px;white-space:nowrap;line-height:30px;}.metabox-prefs label input{margin:0 5px 0 2px;}.metabox-prefs label a{display:none;}#adminmenuback,#adminmenuwrap{border-width:0 1px 0 0;border-style:solid;}#adminmenuwrap{position:relative;}#adminmenushadow{position:absolute;top:0;right:0;bottom:0;width:6px;z-index:20;}#adminmenu *{-webkit-user-select:none;-moz-user-select:none;-khtml-user-select:none;user-select:none;}#adminmenu .wp-submenu{display:none;list-style:none;padding:0;margin:0;position:relative;z-index:2;}#adminmenu .wp-submenu a{font-size:12px;line-height:18px;}#adminmenu .wp-submenu li.current,#adminmenu .wp-submenu li.current a,#adminmenu .wp-submenu li.current a:hover{font-weight:bold;}#adminmenu a.menu-top,#adminmenu .wp-submenu-head{font-size:13px;line-height:18px;}#adminmenu div.wp-submenu-head{display:none;}.js.folded #adminmenu div.wp-submenu-head{display:block;}.js.folded #adminmenu a.menu-top,body.no-js #adminmenu .wp-menu-toggle,.js.folded #adminmenu div.wp-menu-toggle{display:none;}body.js #adminmenu li.wp-menu-open .wp-submenu,body.no-js #adminmenu .open-if-no-js .wp-submenu,body.no-js #adminmenu li.wp-has-current-submenu .wp-submenu{display:block;}#adminmenu div.wp-menu-image{float:left;width:28px;height:28px;}.js.folded #adminmenu div.wp-menu-image{width:32px;}#adminmenu li{margin:0;padding:0;cursor:pointer;}#adminmenu a{display:block;line-height:18px;padding:2px 5px;}#adminmenu li.menu-top{min-height:26px;position:relative;}#adminmenu a.menu-top{font-weight:bold;line-height:18px;min-width:10em;padding:5px 5px;border-width:1px 0 1px;border-style:solid;}#adminmenu li.wp-menu-open{border-width:0 0 1px;border-style:solid;}#adminmenu .wp-submenu a{margin:0;padding-left:12px;}.wp-menu-arrow{display:none;}#adminmenu li.wp-has-current-submenu .wp-menu-arrow,#adminmenu li.menu-top.current .wp-menu-arrow{display:block;position:absolute;right:-9px;top:0;cursor:auto;z-index:25;}#adminmenu .wp-menu-arrow div{width:15px;height:30px;background:url(../images/menu-arrow-frame.png) top right no-repeat;}#adminmenu .wp-submenu li{padding:0;margin:0;}.js.folded #adminmenu li.menu-top{width:32px;height:29px;border-width:1px 0;border-style:solid;}#adminmenu .wp-menu-image img{float:left;padding:8px 6px 0;opacity:.6;filter:alpha(opacity=60);}#adminmenu li.menu-top:hover .wp-menu-image img,#adminmenu li.wp-has-current-submenu .wp-menu-image img{opacity:1;filter:alpha(opacity=100);}#adminmenu li.wp-menu-separator{height:3px;padding:0;margin:0;border-width:1px 0;border-style:solid;cursor:inherit;}#adminmenu div.separator{height:1px;padding:0;border-width:1px 0 0 0;border-style:solid;}.js.folded #adminmenu .wp-submenu{display:block;position:absolute;top:-5px;left:26px;z-index:999;width:0;padding:0;overflow:hidden;-moz-transition:width 200ms ease-out;-webkit-transition:width 200ms ease-out;-o-transition:width 200ms ease-out;transition:width 200ms ease-out;}.js.folded #adminmenu .wp-submenu.sub-open{padding:0 8px 8px 0;}#adminmenu .wp-submenu .wp-submenu-head{padding:6px 4px 5px 10px;cursor:default;border-width:1px 0;border-style:solid;}.js.folded #adminmenu .wp-submenu-wrap{margin-top:4px;border-width:0 1px 1px 0;border-style:solid;position:relative;-webkit-border-bottom-right-radius:3px;-webkit-border-top-right-radius:3px;-khtml-border-bottom-right-radius:3px;-khtml-border-top-right-radius:3px;-moz-border-radius-bottomright:3px;-moz-border-radius-topright:3px;border-bottom-right-radius:3px;border-top-right-radius:3px;}.js.folded #adminmenu .wp-submenu ul{border-width:0 0 0 1px;border-style:solid;}.js.folded #adminmenu .wp-submenu a{padding-left:10px;}.js.folded #adminmenu a.wp-has-submenu{margin-left:40px;}#adminmenu .wp-menu-toggle{width:18px;clear:right;float:right;margin:1px 0 0;height:27px;padding:1px 2px 0 0;cursor:pointer;}#adminmenu .wp-menu-image a{height:24px;}#adminmenu .wp-menu-image img{padding:6px 0 0 1px;}#adminmenu .awaiting-mod,#adminmenu span.update-plugins,#sidemenu li a span.update-plugins{position:absolute;font-family:sans-serif;font-size:9px;line-height:17px;font-weight:bold;margin-top:1px;margin-left:7px;-moz-border-radius:10px;-khtml-border-radius:10px;-webkit-border-radius:10px;border-radius:10px;}#adminmenu li .awaiting-mod span,#adminmenu li span.update-plugins span,#sidemenu li a span.update-plugins span{display:block;padding:0 6px;}#adminmenu li span.count-0,#sidemenu li a .count-0{display:none;}.post-com-count-wrapper{min-width:22px;font-family:sans-serif;}.post-com-count{height:1.3em;line-height:1.1em;display:block;text-decoration:none;padding:0 0 6px;cursor:pointer;background-position:center -80px;background-repeat:no-repeat;}.post-com-count span{font-size:11px;font-weight:bold;height:1.4em;line-height:1.4em;min-width:.7em;padding:0 6px;display:inline-block;cursor:pointer;-moz-border-radius:5px;-khtml-border-radius:5px;-webkit-border-radius:5px;border-radius:5px;}strong .post-com-count{background-position:center -55px;}.post-com-count:hover{background-position:center -3px;}.column-response .post-com-count{float:left;margin-right:5px;text-align:center;}.response-links{float:left;}#the-comment-list .attachment-80x60{padding:4px 8px;}#collapse-menu{font-size:12px;line-height:34px;}.js.folded #collapse-menu span{display:none;}#collapse-button,#collapse-button div{width:15px;height:15px;}#collapse-button{float:left;margin:8px 6px;border-width:1px;border-style:solid;-moz-border-radius:10px;-khtml-border-radius:10px;-webkit-border-radius:10px;border-radius:10px;}body.wp-admin{min-width:785px;}body.admin-bar #wphead,body.admin-bar #adminmenu{padding-top:28px;}.narrow{width:70%;margin-bottom:40px;}.narrow p{line-height:150%;}.widefat th,.widefat td{overflow:hidden;}.widefat th{font-family:Georgia,"Times New Roman","Bitstream Charter",Times,serif;font-weight:normal;}.widefat td p{margin:2px 0 .8em;}.widefat .column-comment p{margin:.6em 0;}.postbox-container{float:left;padding-right:.5%;}.postbox-container .meta-box-sortables{min-height:300px;}.postbox .hndle{cursor:move;}.hndle a{font-size:11px;font-weight:normal;}.postbox .handlediv{float:right;width:27px;height:30px;cursor:pointer;}.sortable-placeholder{border-width:1px;border-style:dashed;margin-bottom:20px;}.widget,.postbox,.stuffbox{margin-bottom:20px;padding:0;border-width:1px;border-style:solid;line-height:1;}.widget .widget-top,.postbox h3,.stuffbox h3{margin-top:1px;border-bottom-width:1px;border-style:solid;cursor:move;-webkit-user-select:none;-moz-user-select:none;-khtml-user-select:none;user-select:none;}.postbox .inside,.stuffbox .inside{padding:0 10px;}.postbox.closed h3{border:none;-moz-box-shadow:none;-webkit-box-shadow:none;box-shadow:none;}.postbox table.form-table{margin-bottom:0;}.postbox input[type="text"],.postbox textarea,.stuffbox input[type="text"],.stuffbox textarea{border-width:1px;border-style:solid;}.temp-border{border:1px dotted #ccc;}.columns-prefs label{padding:0 5px;}#wpbody-content .metabox-holder{padding-top:10px;}#dashboard-widgets .meta-box-sortables{margin:0 5px;}#dashboard_recent_comments div.undo{border-top-style:solid;border-top-width:1px;margin:0 -10px;padding:3px 8px;font-size:11px;}#the-comment-list td.comment p.comment-author{margin-top:0;margin-left:0;}#the-comment-list p.comment-author img{float:left;margin-right:8px;}#the-comment-list p.comment-author strong a{border:none;}#the-comment-list td{vertical-align:top;}#the-comment-list td.comment{word-wrap:break-word;}table.fixed{table-layout:fixed;}.fixed .column-rating,.fixed .column-visible{width:8%;}.fixed .column-date,.fixed .column-parent,.fixed .column-links{width:10%;}.fixed .column-response,.fixed .column-author,.fixed .column-categories,.fixed .column-tags,.fixed .column-rel,.fixed .column-role{width:15%;}.fixed .column-comments{width:4em;padding:8px 0;text-align:left;}.fixed .column-comments .vers{padding-left:3px;}.fixed .column-comments a{float:left;}.fixed .column-slug{width:25%;}.fixed .column-posts{width:10%;}.fixed .column-icon{width:80px;}#commentsdiv .fixed .column-author,#comments-form .fixed .column-author{width:20%;}#commentsdiv.postbox .inside{line-height:1.4em;margin:0;padding:0;}#commentsdiv.postbox .inside .row-actions{line-height:18px;}#commentsdiv.postbox .inside td{padding:1em 10px;}#commentsdiv.postbox .inside .column-author{width:33%;}#commentsdiv.postbox .inside p{margin:6px 10px 8px;}#commentsdiv.postbox .column-comment p{margin:.6em 0;}#commentsdiv.postbox #replyrow td{padding:0;}.sorting-indicator{display:none;width:7px;height:4px;margin-top:8px;margin-left:7px;background-image:url(../images/sort.gif);background-repeat:no-repeat;}.fixed .column-comments .sorting-indicator{margin-top:3px;}.widefat th.sortable,.widefat th.sorted{padding:0;}th.sortable a,th.sorted a{display:block;overflow:hidden;padding:7px 7px 8px;}.fixed .column-comments.sortable a,.fixed .column-comments.sorted a{padding:8px 0;}th.sortable a span,th.sorted a span{float:left;cursor:pointer;}th.sorted.asc .sorting-indicator,th.desc:hover span.sorting-indicator{display:block;background-position:0 0;}th.sorted.desc .sorting-indicator,th.asc:hover span.sorting-indicator{display:block;background-position:-7px 0;}.tablenav-pages a{border-bottom-style:solid;border-bottom-width:2px;font-weight:bold;margin-right:1px;padding:0 2px;}.tablenav-pages .current-page{text-align:center;}.tablenav-pages .next-page{margin-left:2px;}.tablenav a.button-secondary{display:block;margin:3px 8px 0 0;}.tablenav{clear:both;height:30px;margin:6px 0 4px;vertical-align:middle;}.tablenav .tablenav-pages{float:right;display:block;cursor:default;height:30px;line-height:30px;font-size:12px;}.tablenav .no-pages,.tablenav .one-page .pagination-links{display:none;}.tablenav .tablenav-pages a,.tablenav-pages span.current{text-decoration:none;border:none;padding:3px 6px;border-width:1px;border-style:solid;-moz-border-radius:3px;-khtml-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;}.tablenav .tablenav-pages a.disabled:hover{cursor:default;}.tablenav .tablenav-pages a.disabled:active{cursor:default;}.tablenav .displaying-num{margin-right:10px;font-size:12px;font-family:Georgia,"Times New Roman","Bitstream Charter",Times,serif;font-style:italic;}.tablenav .actions{padding:2px 8px 0 0;}.tablenav .delete{margin-right:20px;}.view-switch{float:right;margin:6px 8px 0;}.view-switch a{text-decoration:none;}.filter{float:left;margin:-5px 0 0 10px;}.filter .subsubsub{margin-left:-10px;margin-top:13px;}.screen-per-page{width:3em;}#posts-filter fieldset{float:left;margin:0 1.5ex 1em 0;padding:0;}#posts-filter fieldset legend{padding:0 0 .2em 1px;}span.post-state-format{font-weight:normal;}tr.inline-edit-row td{padding:0 .5em;}#wpbody-content .inline-edit-row fieldset{font-size:12px;float:left;margin:0;padding:0;width:100%;}#wpbody-content .inline-edit-row fieldset .inline-edit-col{padding:0 .5em;}#wpbody-content .quick-edit-row-page fieldset.inline-edit-col-right .inline-edit-col{border-width:0 0 0 1px;border-style:none none none solid;}#wpbody-content .quick-edit-row-post .inline-edit-col-left{width:40%;}#wpbody-content .quick-edit-row-post .inline-edit-col-right{width:39%;}#wpbody-content .inline-edit-row-post .inline-edit-col-center{width:20%;}#wpbody-content .quick-edit-row-page .inline-edit-col-left{width:50%;}#wpbody-content .quick-edit-row-page .inline-edit-col-right,#wpbody-content .bulk-edit-row-post .inline-edit-col-right{width:49%;}#wpbody-content .bulk-edit-row .inline-edit-col-left{width:30%;}#wpbody-content .bulk-edit-row-page .inline-edit-col-right{width:69%;}#wpbody-content .bulk-edit-row .inline-edit-col-bottom{float:right;width:69%;}#wpbody-content .inline-edit-row-page .inline-edit-col-right{margin-top:27px;}.inline-edit-row fieldset .inline-edit-group{clear:both;}.inline-edit-row fieldset .inline-edit-group:after{content:".";display:block;height:0;clear:both;visibility:hidden;}.inline-edit-row p.submit{clear:both;padding:.5em;margin:.5em 0 0;}.inline-edit-row span.error{line-height:22px;margin:0 15px;padding:3px 5px;}.inline-edit-row h4{margin:.2em 0;padding:0;line-height:23px;}.inline-edit-row fieldset span.title,.inline-edit-row fieldset span.checkbox-title{margin:0;padding:0;line-height:27px;}.inline-edit-row fieldset label,.inline-edit-row fieldset span.inline-edit-categories-label{display:block;margin:.2em 0;}.inline-edit-row fieldset label.inline-edit-tags{margin-top:0;}.inline-edit-row fieldset label.inline-edit-tags span.title{margin:.2em 0;}.inline-edit-row fieldset label span.title{display:block;float:left;width:5em;}.inline-edit-row fieldset label span.input-text-wrap{display:block;margin-left:5em;}.quick-edit-row-post fieldset.inline-edit-col-right label span.title{width:auto;padding-right:.5em;}.inline-edit-row .input-text-wrap input[type=text]{width:100%;}.inline-edit-row fieldset label input[type=checkbox]{vertical-align:text-bottom;}.inline-edit-row fieldset label textarea{width:100%;height:4em;}#wpbody-content .bulk-edit-row fieldset .inline-edit-group label{max-width:50%;}#wpbody-content .quick-edit-row fieldset .inline-edit-group label.alignleft:first-child{margin-right:.5em;}.inline-edit-col-right .input-text-wrap input.inline-edit-menu-order-input{width:6em;}.inline-edit-row h4{text-transform:uppercase;}.inline-edit-row fieldset span.title,.inline-edit-row fieldset span.checkbox-title{font-family:Georgia,"Times New Roman","Bitstream Charter",Times,serif;font-style:italic;line-height:1.8em;}.inline-edit-row fieldset input[type="text"],.inline-edit-row fieldset textarea{border-style:solid;border-width:1px;}.inline-edit-row fieldset .inline-edit-date{float:left;}.inline-edit-row fieldset input[name=jj],.inline-edit-row fieldset input[name=hh],.inline-edit-row fieldset input[name=mn]{font-size:12px;width:2.1em;}.inline-edit-row fieldset input[name=aa]{font-size:12px;width:3.5em;}.inline-edit-row fieldset label input.inline-edit-password-input{width:8em;}.inline-edit-row .catshow,.inline-edit-row .cathide{cursor:pointer;}ul.cat-checklist{height:12em;border-style:solid;border-width:1px;overflow-y:scroll;padding:0 5px;margin:0;}#bulk-titles{display:block;height:12em;border-style:solid;border-width:1px;overflow-y:scroll;padding:0 5px;margin:0 0 5px;}.inline-edit-row fieldset ul.cat-checklist li,.inline-edit-row fieldset ul.cat-checklist input{margin:0;}.inline-edit-row fieldset ul.cat-checklist label,.inline-edit-row .catshow,.inline-edit-row .cathide,.inline-edit-row #bulk-titles div{font-family:sans-serif;font-style:normal;font-size:11px;}table .inline-edit-row fieldset ul.cat-hover{height:auto;max-height:30em;overflow-y:auto;position:absolute;}.inline-edit-row fieldset label input.inline-edit-menu-order-input{width:3em;}.inline-edit-row fieldset label input.inline-edit-slug-input{width:75%;}.quick-edit-row-post fieldset label.inline-edit-status{float:left;}#bulk-titles{line-height:140%;}#bulk-titles div{margin:.2em .3em;}#bulk-titles div a{cursor:pointer;display:block;float:left;height:10px;margin:3px 3px 0 -2px;overflow:hidden;position:relative;text-indent:-9999px;width:10px;}#titlediv{position:relative;margin-bottom:20px;}#titlediv label{cursor:text;}#titlediv div.inside{margin:0;}#poststuff #titlewrap{border:0;padding:0;}#titlediv #title{padding:3px 4px;border-width:1px;border-style:solid;-moz-border-radius:3px;-khtml-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;font-size:1.7em;line-height:100%;width:100%;outline:none;}#titlediv #title-prompt-text,#wp-fullscreen-title-prompt-text{color:#bbb;position:absolute;font-size:1.7em;padding:8px;}#wp-fullscreen-title-prompt-text{left:0;padding:11px;}#poststuff .inside-submitbox,#side-sortables .inside-submitbox{margin:0 3px;font-size:11px;}input#link_description,input#link_url{width:98%;}#pending{background:0 none;border:0 none;padding:0;font-size:11px;margin-top:-1px;}#edit-slug-box{height:1em;margin-top:8px;padding:0 7px;}#editable-post-name-full{display:none;}#editable-post-name input{width:16em;}.postarea h3 label{float:left;}.postarea #add-media-button{float:right;margin:7px 0 0;position:relative;right:10px;}#poststuff #editor-toolbar{height:30px;}.wp_themeSkin tr.mceFirst td.mceToolbar{border-width:0 0 1px;border-style:none none solid;}#edButtonPreview,#edButtonHTML{height:18px;margin:5px 5px 0 0;padding:4px 5px 2px;float:right;cursor:pointer;border-width:1px;border-style:solid;-moz-border-radius:3px 3px 0 0;-webkit-border-top-right-radius:3px;-webkit-border-top-left-radius:3px;-khtml-border-top-right-radius:3px;-khtml-border-top-left-radius:3px;border-top-right-radius:3px;border-top-left-radius:3px;}.js .theEditor{color:white;}#poststuff #edButtonHTML{margin-right:15px;}#media-buttons{cursor:default;padding:8px 8px 0;}#media-buttons a{cursor:pointer;padding:0 0 5px 10px;}#media-buttons img,#submitpost #ajax-loading,#submitpost .ajax-loading{vertical-align:middle;}#wpcontent .ajax-loading{visibility:hidden;}.submitbox .submit{text-align:left;padding:12px 10px 10px;font-size:11px;}.submitbox .submitdelete{border-bottom-width:1px;border-bottom-style:solid;text-decoration:none;padding:1px 2px;}.inside-submitbox #post_status{margin:2px 0 2px -2px;}.submitbox .submit a:hover{border-bottom-width:1px;border-bottom-style:solid;}.submitbox .submit input{margin-bottom:8px;margin-right:4px;padding:6px;}#post-status-select,#post-format{line-height:2.5em;margin-top:3px;}#post-body #normal-sortables{min-height:50px;}#post-body #advanced-sortables{min-height:20px;}.postbox{-moz-border-radius:3px;-webkit-border-radius:3px;-khtml-border-radius:3px;border-radius:3px;position:relative;min-width:255px;}#trackback_url{width:99%;}#normal-sortables .postbox .submit{background:transparent none;border:0 none;float:right;padding:0 12px;margin:0;}#side-sortables .category-add input{width:94%;}#side-sortables .category-add select{width:100%;}#side-sortables .category-add input.category-add-sumbit,#post-body .category-add input.category-add input.category-add-sumbit{width:auto;}#post-body ul.category-tabs,#post-body ul.add-menu-item-tabs{float:left;width:120px;text-align:right;margin:0 -120px 0 5px;padding:0;}#post-body ul.category-tabs li,#post-body ul.add-menu-item-tabs li{padding:8px;}#post-body ul.category-tabs li.tabs,#post-body ul.add-menu-item-tabs li.tabs{-moz-border-radius:3px 0 0 3px;-webkit-border-top-left-radius:3px;-webkit-border-bottom-left-radius:3px;-khtml-border-top-left-radius:3px;-khtml-border-bottom-left-radius:3px;border-top-left-radius:3px;border-bottom-left-radius:3px;}#post-body ul.category-tabs li.tabs a,#post-body ul.add-menu-item-tabs li.tabs a{font-weight:bold;text-decoration:none;}.wp-tab-panel,.categorydiv div.tabs-panel,.customlinkdiv div.tabs-panel,.posttypediv div.tabs-panel,.taxonomydiv div.tabs-panel,#linkcategorydiv div.tabs-panel{height:200px;overflow:auto;padding:.5em .9em;border-style:solid;border-width:1px;}.nav-menus-php .customlinkdiv div.tabs-panel,.nav-menus-php .posttypediv div.tabs-panel,.nav-menus-php .taxonomydiv div.tabs-panel{height:auto;max-height:205px;}div.tabs-panel-active{display:block;}div.tabs-panel-inactive{display:none;}#post-body .categorydiv div.tabs-panel,.taxonomy div.tabs-panel,#post-body #linkcategorydiv div.tabs-panel{margin:0 5px 0 125px;}#side-sortables .category-tabs li,#side-sortables .add-menu-item-tabs li,.wp-tab-bar li{display:inline;line-height:1.35em;}#side-sortables .category-tabs a,#side-sortables .add-menu-item-tabs a,.wp-tab-bar a{text-decoration:none;}#side-sortables .category-tabs,#side-sortables .add-menu-item-tabs,.wp-tab-bar{margin-bottom:3px;}.categorydiv ul,.customlinkdiv ul,.posttypediv ul,.taxonomydiv ul,#linkcategorydiv ul{list-style:none;padding:0;margin:0;}#normal-sortables .postbox #replyrow .submit{float:none;margin:0;padding:3px 7px;}#side-sortables .submitbox .submit input,#side-sortables .submitbox .submit .preview,#side-sortables .submitbox .submit a.preview:hover{border:0 none;}#side-sortables .inside-submitbox .insidebox,.stuffbox .insidebox{margin:11px 0;}#side-sortables .comments-box,#normal-sortables .comments-box{border:0 none;}ul.category-tabs,ul.add-menu-item-tabs,ul.wp-tab-bar{margin-top:12px;}#side-sortables .comments-box thead th,#normal-sortables .comments-box thead th{background:transparent;padding:0 7px 4px;font-style:italic;}ul.category-tabs li.tabs,ul.add-menu-item-tabs li.tabs,.wp-tab-active{border-style:solid solid none;border-width:1px 1px 0;}#commentsdiv img.waiting{padding-left:5px;}#post-body .category-tabs li.tabs,#post-body .add-menu-item-tabs li.tabs{border-style:solid none solid solid;border-width:1px 0 1px 1px;margin-right:-1px;}ul.category-tabs li,ul.add-menu-item-tabs li,ul.wp-tab-bar li{padding:5px;-moz-border-radius:3px 3px 0 0;-webkit-border-top-left-radius:3px;-webkit-border-top-right-radius:3px;-khtml-border-top-left-radius:3px;-khtml-border-top-right-radius:3px;border-top-left-radius:3px;border-top-right-radius:3px;}form#tags-filter{position:relative;}.screen-per-page{width:3em;}#posts-filter fieldset{float:left;margin:0 1.5ex 1em 0;padding:0;}#posts-filter fieldset legend{padding:0 0 .2em 1px;}td.post-title strong,td.plugin-title strong{display:block;margin-bottom:.2em;}td.post-title p,td.plugin-title p{margin:6px 0;}.wp-hidden-children .wp-hidden-child,.ui-tabs-hide{display:none;}.commentlist .avatar{vertical-align:text-top;}#post-body .tagsdiv #newtag{margin-right:5px;width:16em;}#side-sortables input#post_password{width:94%;}#side-sortables .tagsdiv #newtag{width:68%;}#post-status-info{border-width:0 1px 1px;border-style:none solid solid;width:100%;-moz-border-radius:0 0 3px 3px;-webkit-border-bottom-left-radius:3px;-webkit-border-bottom-right-radius:3px;-khtml-border-bottom-left-radius:3px;-khtml-border-bottom-right-radius:3px;border-bottom-left-radius:3px;border-bottom-right-radius:3px;}#post-status-info td{font-size:12px;}.autosave-info{padding:2px 15px 2px 2px;text-align:right;}#editorcontent #post-status-info{border:none;}#post-body .wp_themeSkin .mceStatusbar a.mceResize{display:block;background:transparent url(../images/resize.gif) no-repeat scroll right bottom;width:12px;cursor:se-resize;margin:0 2px;position:relative;top:22px;}#wp-word-count{display:block;padding:2px 7px;}#timestampdiv select{height:20px;line-height:14px;padding:0;vertical-align:top;}#jj,#hh,#mn{width:2em;padding:1px;font-size:12px;}#aa{width:3.4em;padding:1px;font-size:12px;}.curtime #timestamp{background-repeat:no-repeat;background-position:left top;padding-left:18px;}#timestampdiv{padding-top:5px;line-height:23px;}#timestampdiv p{margin:8px 0 6px;}#timestampdiv input{border-width:1px;border-style:solid;}#postcustomstuff table,#postcustomstuff input,#postcustomstuff textarea{border-width:1px;border-style:solid;-moz-border-radius:3px;-khtml-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;}#postcustomstuff .updatemeta,#postcustomstuff .deletemeta{margin:auto;}#postcustomstuff thead th{padding:5px 8px 8px;}#postcustom #postcustomstuff .submit{border:0 none;float:none;padding:5px 8px;}#side-sortables #postcustom #postcustomstuff .submit{padding:0 5px;}#side-sortables #postcustom #postcustomstuff td.left input{margin:3px 3px 0;}#side-sortables #postcustom #postcustomstuff #the-list textarea{height:85px;margin:3px;}#postcustomstuff table{margin:0;width:100%;border-width:1px;border-style:solid;border-spacing:0;}#postcustomstuff table input,#postcustomstuff table select,#postcustomstuff table textarea{width:95%;margin:8px 0 8px 8px;}#postcustomstuff th.left,#postcustomstuff td.left{width:38%;}#postcustomstuff .submit input{width:auto;}#postcustomstuff #newmeta .submit{padding:0 8px;}#postcustomstuff table #addmetasub{width:auto;}#postcustomstuff #newmetaleft{vertical-align:top;}#postcustomstuff #newmetaleft a{padding:0 10px;text-decoration:none;}table.diff{width:100%;}table.diff col.content{width:50%;}table.diff tr{background-color:transparent;}table.diff td,table.diff th{padding:.5em;font-family:Consolas,Monaco,monospace;border:none;}table.diff .diff-deletedline del,table.diff .diff-addedline ins{text-decoration:none;}.category-adder{margin-left:120px;padding:4px 0;}.category-adder h4{margin:0 0 8px;}#side-sortables .category-adder{margin:0;}#post-body .category-add input,.category-add select{width:30%;}#side-sortables .category-add select{width:100%;}#side-sortables .category-add input.category-add-sumbit,#post-body .category-add input.category-add input.category-add-sumbit{width:auto;}#post-body ul.category-tabs,#post-body ul.add-menu-item-tabs{float:left;width:120px;text-align:right;margin:0 -120px 0 5px;padding:0;}#post-body ul.category-tabs li,#post-body ul.add-menu-item-tabs li{padding:8px;}#post-body ul.category-tabs li.tabs,#post-body ul.add-menu-item-tabs li.tabs{-moz-border-radius:3px 0 0 3px;-webkit-border-top-left-radius:3px;-webkit-border-bottom-left-radius:3px;-khtml-border-top-left-radius:3px;-khtml-border-bottom-left-radius:3px;border-top-left-radius:3px;border-bottom-left-radius:3px;}#post-body ul.category-tabs li.tabs a,#post-body ul.add-menu-item-tabs li.tabs a{font-weight:bold;text-decoration:none;}.categorydiv div.tabs-panel,.customlinkdiv div.tabs-panel,.posttypediv div.tabs-panel,.taxonomydiv div.tabs-panel,#linkcategorydiv div.tabs-panel{height:200px;overflow:auto;padding:.5em .9em;border-style:solid;border-width:1px;}.nav-menus-php .customlinkdiv div.tabs-panel,.nav-menus-php .posttypediv div.tabs-panel,.nav-menus-php .taxonomydiv div.tabs-panel{height:auto;max-height:205px;}div.tabs-panel-active{display:block;}div.tabs-panel-inactive{display:none;}#post-body .categorydiv div.tabs-panel,.taxonomy div.tabs-panel,#post-body #linkcategorydiv div.tabs-panel{margin:0 5px 0 125px;}.categorydiv ul,.customlinkdiv ul,.posttypediv ul,.taxonomydiv ul,#linkcategorydiv ul{list-style:none;padding:0;margin:0;}#front-page-warning,#front-static-pages ul,ul.export-filters,.inline-editor ul.cat-checklist ul,.categorydiv ul.categorychecklist ul,.customlinkdiv ul.categorychecklist ul,.posttypediv ul.categorychecklist ul,.taxonomydiv ul.categorychecklist ul,#linkcategorydiv ul.categorychecklist ul{margin-left:18px;}ul.categorychecklist li{margin:0;padding:0;line-height:19px;word-wrap:break-word;}.categorydiv .tabs-panel,.customlinkdiv .tabs-panel,.posttypediv .tabs-panel,.taxonomydiv .tabs-panel{border-width:3px;border-style:solid;}ul.category-tabs,ul.add-menu-item-tabs{margin-top:12px;}ul.category-tabs li.tabs,ul.add-menu-item-tabs li.tabs{border-style:solid solid none;border-width:1px 1px 0;}#post-body .category-tabs li.tabs,#post-body .add-menu-item-tabs li.tabs{border-style:solid none solid solid;border-width:1px 0 1px 1px;margin-right:-1px;}ul.category-tabs li,ul.add-menu-item-tabs li{padding:5px;-moz-border-radius:3px 3px 0 0;-webkit-border-top-left-radius:3px;-webkit-border-top-right-radius:3px;-khtml-border-top-left-radius:3px;-khtml-border-top-right-radius:3px;border-top-left-radius:3px;border-top-right-radius:3px;}.form-wrap{margin:10px 0;width:97%;}.form-wrap p,.form-wrap label{font-size:11px;}.form-wrap label{display:block;padding:2px;font-size:12px;}.form-field input,.form-field textarea{border-style:solid;border-width:1px;width:95%;}p.description,.form-wrap p{margin:2px 0 5px;}p.help,p.description,span.description,.form-wrap p{font-size:12px;font-style:italic;font-family:sans-serif;}.form-wrap .form-field{margin:0 0 10px;padding:8px;}.col-wrap h3{margin:12px 0;font-size:1.1em;}.col-wrap p.submit{margin-top:-10px;}.taghint{color:#aaa;margin:15px 0 -24px 12px;}#poststuff .tagsdiv .howto{margin:0 0 6px 8px;}.ajaxtag .newtag{position:relative;}.tagsdiv .newtag{width:180px;}.tagsdiv .the-tags{display:block;height:60px;margin:0 auto;overflow:auto;width:260px;}#post-body-content .tagsdiv .the-tags{margin:0 5px;}p.popular-tags{-moz-border-radius:8px;-khtml-border-radius:8px;-webkit-border-radius:8px;border-radius:8px;border-width:1px;border-style:solid;line-height:2em;padding:8px 12px 12px;text-align:justify;}p.popular-tags a{padding:0 3px;}.tagcloud{width:97%;margin:0 0 40px;text-align:justify;}.tagcloud h3{margin:2px 0 12px;}.ac_results{padding:0;margin:0;list-style:none;position:absolute;z-index:10000;display:none;border-width:1px;border-style:solid;}.ac_results li{padding:2px 5px;white-space:nowrap;text-align:left;}.ac_over{cursor:pointer;}.ac_match{text-decoration:underline;}#wpbody-content #media-items .describe{border-collapse:collapse;width:100%;border-top-style:solid;border-top-width:1px;clear:both;cursor:default;padding:5px;}#wpbody-content .describe th{vertical-align:top;text-align:left;padding:10px;width:140px;}#wpbody-content .describe .media-item-info tr{background-color:transparent;}#wpbody-content .describe .media-item-info td{padding:4px 10px 0;}.describe .media-item-info .A1B1{padding:0 0 0 10px;}#wpbody-content .filename{padding:0 10px;}#wpbody-content .media-item .thumbnail{max-height:128px;max-width:128px;}#wpbody-content #async-upload-wrap a{display:none;}.media-upload-form td label{margin-right:6px;margin-left:2px;}.media-upload-form .align .field label{display:inline;padding:0 0 0 22px;margin:0 1em 0 0;font-weight:bold;}.media-upload-form tr.image-size label{margin:0 0 0 3px;font-weight:bold;}.media-upload-form th.label label{font-weight:bold;margin:.5em;font-size:13px;}.media-upload-form th.label label span{padding:0 5px;}abbr.required{border:medium none;text-decoration:none;}#wpbody-content .describe input[type="text"],#wpbody-content .describe textarea{width:460px;}#wpbody-content .describe p.help{margin:0;padding:0 0 0 5px;}.media-item .error-div a.dismiss,.describe-toggle-on,.describe-toggle-off{display:block;line-height:36px;float:right;margin-right:20px;}.describe-toggle-off{display:none;}#wpbody-content .media-item{border-bottom-style:solid;border-bottom-width:1px;min-height:36px;position:relative;width:100%;}#wpbody-content .media-single .media-item{border-bottom-style:none;border-bottom-width:0;}#wpbody-content #media-items{border-style:solid solid none;border-width:1px;width:670px;}#wpbody-content #media-items .filename{line-height:36px;overflow:hidden;}.media-item .error-div{padding-left:10px;}.media-item .pinkynail{float:left;margin:2px;max-width:40px;max-height:32px;}.media-item .startopen,.media-item .startclosed{display:none;}.media-item .original{position:relative;height:34px;width:503px;}.media-item .percent{font-weight:bold;}.crunching{display:block;line-height:32px;text-align:right;margin-right:5px;}.progress{position:relative;margin-bottom:-36px;height:36px;}.bar{width:0;height:100%;border-right-width:3px;border-right-style:solid;}.upload-php .fixed .column-parent{width:25%;}.find-box{width:500px;height:300px;overflow:hidden;padding:33px 5px 40px;position:absolute;z-index:1000;}.find-box-head{cursor:move;font-weight:bold;height:2em;line-height:2em;padding:1px 12px;position:absolute;top:5px;width:100%;}.find-box-inside{overflow:auto;width:100%;height:100%;}.find-box-search{padding:12px;border-width:1px;border-style:none none solid;}#find-posts-response{margin:8px 0;padding:0 1px;}#find-posts-response table{width:100%;}#find-posts-response .found-radio{padding:5px 0 0 8px;width:15px;}.find-box-buttons{width:480px;margin:8px;}.find-box-search label{padding-right:6px;}.find-box #resize-se{position:absolute;right:1px;bottom:1px;}ul#dismissed-updates{display:none;}form.upgrade{margin-top:8px;}form.upgrade .hint{font-style:italic;font-size:85%;margin:-0.5em 0 2em 0;}#poststuff .inside .the-tagcloud{margin:5px 0 10px;padding:8px;border-width:1px;border-style:solid;line-height:1.8em;word-spacing:3px;-moz-border-radius:6px;-khtml-border-radius:6px;-webkit-border-radius:6px;border-radius:6px;}br.clear{height:2px;line-height:2px;}.swfupload{margin:5px 10px;vertical-align:middle;}.describe .image-editor{vertical-align:top;}.imgedit-wrap{position:relative;}.imgedit-settings p{margin:8px 0;}.describe .imgedit-wrap table td{vertical-align:top;padding-top:0;}.imgedit-wrap p,.describe .imgedit-wrap table td{font-size:11px;line-height:18px;}.describe .imgedit-wrap table td.imgedit-settings{padding:0 5px;}td.imgedit-settings input{vertical-align:middle;}.imgedit-wait{position:absolute;top:0;background:#FFF url(../images/wpspin_light.gif) no-repeat scroll 22px 10px;opacity:.7;filter:alpha(opacity=70);width:100%;height:500px;display:none;}.media-disabled,.imgedit-settings .disabled{color:grey;}.imgedit-wait-spin{padding:0 4px 4px;vertical-align:bottom;visibility:hidden;}.imgedit-menu{margin:0 0 12px;min-width:300px;}.imgedit-menu div{float:left;width:32px;height:32px;-moz-border-radius:3px;-khtml-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;border-width:1px;border-style:solid;}.imgedit-crop-wrap{position:relative;}.imgedit-crop{background:transparent url(../images/imgedit-icons.png) no-repeat scroll -9px -31px;margin:0 8px 0 0;}.imgedit-crop.disabled:hover{background-position:-9px -31px;}.imgedit-crop:hover{background-position:-9px -1px;}.imgedit-rleft{background:transparent url(../images/imgedit-icons.png) no-repeat scroll -46px -31px;margin:0 3px;}.imgedit-rleft.disabled:hover{background-position:-46px -31px;}.imgedit-rleft:hover{background-position:-46px -1px;}.imgedit-rright{background:transparent url(../images/imgedit-icons.png) no-repeat scroll -77px -31px;margin:0 8px 0 3px;}.imgedit-rright.disabled:hover{background-position:-77px -31px;}.imgedit-rright:hover{background-position:-77px -1px;}.imgedit-flipv{background:transparent url(../images/imgedit-icons.png) no-repeat scroll -115px -31px;margin:0 3px;}.imgedit-flipv.disabled:hover{background-position:-115px -31px;}.imgedit-flipv:hover{background-position:-115px -1px;}.imgedit-fliph{background:transparent url(../images/imgedit-icons.png) no-repeat scroll -147px -31px;margin:0 8px 0 3px;}.imgedit-fliph.disabled:hover{background-position:-147px -31px;}.imgedit-fliph:hover{background-position:-147px -1px;}.imgedit-undo{background:transparent url(../images/imgedit-icons.png) no-repeat scroll -184px -31px;margin:0 3px;}.imgedit-undo.disabled:hover{background-position:-184px -31px;}.imgedit-undo:hover{background-position:-184px -1px;}.imgedit-redo{background:transparent url(../images/imgedit-icons.png) no-repeat scroll -215px -31px;margin:0 8px 0 3px;}.imgedit-redo.disabled:hover{background-position:-215px -31px;}.imgedit-redo:hover{background-position:-215px -1px;}.imgedit-applyto img{margin:0 8px 0 0;}.imgedit-group-top{margin:5px 0;}.imgedit-applyto .imgedit-label{padding:2px 0 0;display:block;}.imgedit-help{display:none;font-style:italic;margin-bottom:8px;}.imgedit-help ul li{font-size:11px;}a.imgedit-help-toggle{text-decoration:none;}#wpbody-content .imgedit-response div{width:600px;margin:8px;}.form-table td.imgedit-response{padding:0;}.imgedit-submit{margin:8px 0;}.imgedit-submit-btn{margin-left:20px;}.imgedit-wrap .nowrap{white-space:nowrap;}span.imgedit-scale-warn{color:red;font-size:20px;font-style:normal;visibility:hidden;vertical-align:middle;}.imgedit-group{border-width:1px;border-style:solid;-moz-border-radius:8px;-khtml-border-radius:8px;-webkit-border-radius:8px;border-radius:8px;margin-bottom:8px;padding:2px 10px;}.form-table{border-collapse:collapse;margin-top:.5em;width:100%;margin-bottom:-8px;clear:both;}.form-table td{margin-bottom:9px;padding:8px 10px;line-height:20px;font-size:12px;}.form-table th,.form-wrap label{font-weight:normal;text-shadow:rgba(255,255,255,1) 0 1px 0;}.form-table th{vertical-align:top;text-align:left;padding:10px;width:200px;}.form-table th.th-full{width:auto;}.form-table div.color-option{display:block;clear:both;margin-top:12px;}.form-table input.tog{margin-top:2px;margin-right:2px;float:left;}.form-table td p{margin-top:4px;}.form-table table.color-palette{vertical-align:bottom;float:left;margin:-12px 3px 11px;}.form-table .color-palette td{border-width:1px 1px 0;border-style:solid solid none;height:10px;line-height:20px;width:10px;}.commentlist li{padding:1em 1em .2em;margin:0;border-bottom-width:1px;border-bottom-style:solid;}.commentlist li li{border-bottom:0;padding:0;}.commentlist p{padding:0;margin:0 0 .8em;}#replyrow{font-size:11px;}#replyrow input{border-width:1px;border-style:solid;}#replyrow td{padding:2px;}#replyrow #editorcontainer{border:0 none;}#replysubmit{margin:0;padding:3px 7px;text-align:center;}#replysubmit img.waiting,.inline-edit-save img.waiting{padding:4px 10px 0;vertical-align:top;float:right;}#replysubmit .button{margin-right:5px;}#replysubmit .error{color:red;line-height:21px;text-align:center;vertical-align:center;}#replyrow #editor-toolbar{display:none;}#replyhead{font-size:12px;font-weight:bold;padding:2px 10px 4px;}#edithead .inside{float:left;padding:3px 0 2px 5px;margin:0;text-align:center;font-size:11px;}#edithead .inside input{width:180px;font-size:11px;}#edithead label{padding:2px 0;}#replycontainer{padding:5px;border:0 none;height:120px;overflow:hidden;position:relative;}#replycontent{resize:none;margin:0;width:100%;height:100%;padding:0;line-height:150%;border:0 none;outline:none;font-size:12px;}#replyrow #ed_reply_toolbar{margin:0;padding:2px 3px;}.comment-ays{margin-bottom:0;border-style:solid;border-width:1px;}.comment-ays th{border-right-style:solid;border-right-width:1px;}.trash-undo-inside,.spam-undo-inside{margin:1px 8px 1px 0;line-height:16px;}.spam-undo-inside .avatar,.trash-undo-inside .avatar{height:20px;width:20px;margin-right:8px;vertical-align:middle;}.stuffbox .editcomment{clear:none;}#comment-status-radio p{margin:3px 0 5px;}#comment-status-radio input{margin:2px 3px 5px 0;vertical-align:middle;}#comment-status-radio label{padding:5px 0;}.commentlist .avatar{vertical-align:text-top;}.theme-install-php .tablenav{height:auto;}table#availablethemes{border-spacing:0;border-width:1px 0;border-style:solid none;margin:10px auto;width:100%;}table#availablethemes .no-items td{border-width:0;padding:5px;}td.available-theme{vertical-align:top;width:240px;margin:0;padding:20px;text-align:left;}table#availablethemes td{border-width:0 1px 1px;border-style:none solid solid;}table#availablethemes td.right,table#availablethemes td.left{border-right:0 none;border-left:0 none;}table#availablethemes td.bottom{border-bottom:0 none;}.available-theme a.screenshot{width:240px;height:180px;display:block;border-width:1px;border-style:solid;margin-bottom:10px;overflow:hidden;}.available-theme img{width:240px;}.available-theme h3{margin:15px 0 5px;}#current-theme{margin:1em 0 1.5em;}#current-theme a{border-bottom:none;}#current-theme h3{font-size:17px;font-weight:normal;margin:0;}#current-theme .theme-description{margin-top:5px;}#current-theme img{float:left;border-width:1px;border-style:solid;margin-right:1em;margin-bottom:1.5em;width:150px;}.theme-options span{text-transform:uppercase;font-size:13px;}.theme-options a{font-size:15px;}#TB_window #TB_title a.tb-theme-preview-link,#TB_window #TB_title a.tb-theme-preview-link:visited{font-weight:bold;text-decoration:none;}#TB_window #TB_title{background-color:#222;color:#cfcfcf;}#broken-themes{text-align:left;width:50%;border-spacing:3px;padding:3px;}.theme-install-php h4{margin:2.5em 0 8px;}.appearance_page_custom-header #headimg{border:1px solid #DFDFDF;min-height:100px;width:100%;}.appearance_page_custom-header #upload-form p label{font-size:12px;}.appearance_page_custom-header .available-headers .default-header{float:left;margin:0 20px 20px 0;}.appearance_page_custom-header .random-header{clear:both;margin:0 20px 20px 0;vertical-align:middle;}.appearance_page_custom-header .available-headers label input,.appearance_page_custom-header .random-header label input{margin-right:10px;}.appearance_page_custom-header .available-headers label img{vertical-align:middle;}div#custom-background-image{min-height:100px;border:1px solid #dfdfdf;}div#custom-background-image img{max-width:400px;max-height:300px;}.nav-tab{border-style:solid;border-color:#dfdfdf #dfdfdf #fff;border-width:1px 1px 0;color:#aaa;text-shadow:rgba(255,255,255,1) 0 1px 0;font-size:12px;line-height:16px;display:inline-block;padding:4px 14px 6px;text-decoration:none;margin:0 6px -1px 0;-moz-border-radius:3px 3px 0 0;-webkit-border-top-left-radius:3px;-webkit-border-top-right-radius:3px;-khtml-border-top-left-radius:3px;-khtml-border-top-right-radius:3px;border-top-left-radius:3px;border-top-right-radius:3px;}.nav-tab-active{border-width:1px;color:#464646;}.nav-tab:hover,.nav-tab-active{border-color:#ccc #ccc #fff;}h2.nav-tab-wrapper,h3.nav-tab-wrapper{border-bottom:1px solid #ccc;padding-bottom:0;}h2 .nav-tab{padding:4px 10px 6px;font-family:"HelveticaNeue-Light","Helvetica Neue Light","Helvetica Neue",sans-serif;font-weight:200;font-size:20px;line-height:24px;}.plugins .name,#pass-strength-result.strong,#pass-strength-result.short,.button-highlighted,input.button-highlighted,#quicktags #ed_strong,#ed_reply_toolbar #ed_reply_strong{font-weight:bold;}.plugins p{margin:0 4px;padding:0;}.plugins .desc p{margin:0 0 8px;}.plugins td.desc{line-height:1.5em;}.plugins .desc ul,.plugins .desc ol{margin:0 0 0 2em;}.plugins .desc ul{list-style-type:disc;}.plugins .row-actions-visible{padding:0;}.plugins tbody th.check-column{padding:7px 0;}.plugins .inactive td,.plugins .inactive th,.plugins .active td,.plugins .active th{border-top-style:solid;border-top-width:1px;padding:5px 7px 0;}#wpbody-content .plugins .plugin-title,#wpbody-content .plugins .theme-title{padding-right:12px;white-space:nowrap;}.plugins .second,.plugins .row-actions-visible{padding:0 0 5px;}.plugins-php .widefat tfoot th,.plugins-php .widefat tfoot td{border-top-style:solid;border-top-width:1px;}.plugin-update-tr .update-message{margin:5px;padding:3px 5px;border-width:1px;border-style:solid;-moz-border-radius:3px;-khtml-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;}.plugin-install-php h4{margin:2.5em 0 8px;}#profile-page .form-table textarea{width:500px;margin-bottom:6px;}#profile-page .form-table #rich_editing{margin-right:5px;}#your-profile legend{font-family:Georgia,"Times New Roman","Bitstream Charter",Times,serif;font-size:22px;}#your-profile #rich_editing{border:none;}#display_name{width:15em;}#createuser .form-field input{width:25em;}.pressthis{margin:20px 0;}.pressthis a{display:inline-block;width:113px;position:relative;cursor:move;color:#333;background:#dfdfdf;-webkit-gradient(linear,left bottom,left top,color-stop(0.07,#e6e6e6),color-stop(0.77,#d8d8d8));-moz-linear-gradient(center bottom,#e6e6e6 7%,#d8d8d8 77%);background-repeat:no-repeat;background-image-position:10px 8px;border-radius:5px;-webkit-border-radius:5px;-moz-border-radius:5px;-o-border-radius:5px;border:1px #b4b4b4 solid;font:normal normal normal 14px/16px Georgia,"Times New Roman","Bitstream Charter",Times,serif;text-decoration:none;text-shadow:#fff 0 1px 0;-webkit-text-shadow:#fff 0 1px 0;-moz-text-shadow:#fff 0 1px 0;-o-text-shadow:#fff 0 1px 0;}.pressthis a:hover,.pressthis a:active{color:#333;}.pressthis a:hover:after{transform:skew(20deg) rotate(9deg);-webkit-transform:skew(20deg) rotate(9deg);-moz-transform:skew(20deg) rotate(9deg);box-shadow:0 10px 8px rgba(0,0,0,0.7);-webkit-box-shadow:0 10px 8px rgba(0,0,0,0.7);-moz-box-shadow:0 10px 8px rgba(0,0,0,0.7);}.pressthis a span{background:url(../images/press-this.png) no-repeat -45px 5px;padding:8px 0 8px 32px;display:inline-block;}.pressthis a:after{content:'';width:70%;height:55%;z-index:-1;position:absolute;right:10px;bottom:9px;background:transparent;transform:skew(20deg) rotate(6deg);-webkit-transform:skew(20deg) rotate(6deg);-moz-transform:skew(20deg) rotate(6deg);box-shadow:0 10px 8px rgba(0,0,0,0.6);-webkit-box-shadow:0 10px 8px rgba(0,0,0,0.6);-moz-box-shadow:0 10px 8px rgba(0,0,0,0.6);}#utc-time,#local-time{padding-left:25px;font-style:italic;font-family:sans-serif;}.defaultavatarpicker .avatar{margin:2px 0;vertical-align:middle;}#footer{position:absolute;bottom:0;left:0;right:0;padding:10px 0;margin-right:20px;border-top:1px;border-style:solid;}#footer,#footer a{font-size:12px;}#footer p{margin:0;line-height:20px;}#footer a{text-decoration:none;}#footer a:hover{text-decoration:underline;}#excerpt,.attachmentlinks{margin:0;height:4em;width:98%;}#template div{margin-right:190px;}p.pagenav{margin:0;display:inline;}.pagenav span{font-weight:bold;margin:0 6px;}.row-title{font-size:13px!important;font-weight:bold;}.column-author img,.column-username img{float:left;margin-right:10px;margin-top:1px;}.row-actions{visibility:hidden;padding:2px 0 0;}tr:hover .row-actions,div.comment-item:hover .row-actions{visibility:visible;}.row-actions-visible{padding:2px 0 0;}.form-table .pre{padding:8px;margin:0;}table.form-table td .updated{font-size:13px;}.tagchecklist{margin-left:14px;font-size:12px;overflow:auto;}.tagchecklist strong{margin-left:-8px;position:absolute;}.tagchecklist span{margin-right:25px;display:block;float:left;font-size:11px;line-height:1.8em;white-space:nowrap;cursor:default;}.tagchecklist span a{margin:6px 0 0 -9px;cursor:pointer;width:10px;height:10px;display:block;float:left;text-indent:-9999px;overflow:hidden;position:absolute;}#poststuff h2{margin-top:20px;font-size:1.5em;margin-bottom:15px;padding:0 0 3px;clear:left;}#poststuff h3,.metabox-holder h3{font-size:15px;font-family:Georgia,"Times New Roman","Bitstream Charter",Times,serif;font-weight:normal;padding:7px 10px;margin:0;line-height:1;}#poststuff .inside,#poststuff .inside p{font-size:12px;margin:6px 0 8px;}#poststuff .inside .submitbox p{margin:1em 0;}#post-visibility-select,#post-formats-select{line-height:1.5em;margin-top:3px;}#poststuff #submitdiv .inside{margin:0;padding:0;}#titlediv,#poststuff .postarea{margin-bottom:20px;}td.post-title strong,td.plugin-title strong{display:block;margin-bottom:.2em;}td.post-title p,td.plugin-title p{margin:6px 0;}.wp-hidden-children .wp-hidden-child,.ui-tabs-hide{display:none;}#templateside ul li a{text-decoration:none;}.tool-box{margin:15px 0 35px;}.tool-box .buttons{margin:15px 0;}.tool-box .title{margin:8px 0;font:18px/24px Georgia,"Times New Roman","Bitstream Charter",Times,serif;}.pressthis a{font-size:1.2em;}#sidemenu{margin:-30px 15px 0 315px;list-style:none;position:relative;float:right;padding-left:10px;font-size:12px;}#sidemenu a{padding:0 7px;display:block;float:left;line-height:28px;border-top-width:1px;border-top-style:solid;border-bottom-width:1px;border-bottom-style:solid;}#sidemenu li{display:inline;line-height:200%;list-style:none;text-align:center;white-space:nowrap;margin:0;padding:0;}#sidemenu a.current{font-weight:normal;padding-left:6px;padding-right:6px;-moz-border-radius:3px 3px 0 0;-webkit-border-top-left-radius:3px;-webkit-border-top-right-radius:3px;-khtml-border-top-left-radius:3px;-khtml-border-top-right-radius:3px;border-top-left-radius:3px;border-top-right-radius:3px;border-width:1px;border-style:solid;}#sidemenu li a .count-0{display:none;}#poststuff .inside .the-tagcloud{margin:5px 0 10px;padding:8px;border-width:1px;border-style:solid;line-height:1.8em;word-spacing:3px;-moz-border-radius:3px;-khtml-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;}.plugin-install #description,.plugin-install-network #description{width:60%;}table .vers,table .column-visible,table .column-rating{text-align:left;}body.iframe{height:98%;}.anchors{margin:10px 20px 10px 20px;}div.nav{height:2em;padding:7px 10px;vertical-align:text-top;margin:5px 0;}.nav .button-secondary{padding:2px 4px;}.settings-toggle{text-align:right;margin:5px 7px 15px 0;font-size:12px;}.settings-toggle h3{margin:0;}form#tags-filter{position:relative;}td.media-icon{text-align:center;width:80px;padding-top:8px;padding-bottom:8px;}td.media-icon img{max-width:80px;max-height:60px;}.screen-per-page{width:3em;}.list-ajax-loading{float:right;margin-right:9px;margin-top:-1px;}.tablenav .list-ajax-loading{margin-top:7px;}#howto{font-size:11px;margin:0 5px;display:block;}.import-system{font-size:16px;}#namediv table{width:100%;}#namediv td.first{width:10px;white-space:nowrap;}#namediv input{width:98%;}#namediv p{margin:10px 0;}#submitdiv h3{margin-bottom:0!important;}.zerosize{height:0;width:0;margin:0;border:0;padding:0;overflow:hidden;position:absolute;}br.clear{height:2px;line-height:2px;}.checkbox{border:none;margin:0;padding:0;}#content{margin:0;width:100%;}fieldset{border:0;padding:0;margin:0;}.post-categories{display:inline;margin:0;padding:0;}.post-categories li{display:inline;} \ No newline at end of file diff --git a/src/wp-admin/css/wp-admin.dev.css b/src/wp-admin/css/wp-admin.dev.css new file mode 100644 index 0000000..82a0c68 --- /dev/null +++ b/src/wp-admin/css/wp-admin.dev.css @@ -0,0 +1,4709 @@ +/*------------------------------------------------------------------------------ + + +Hello, this is the main WordPress admin CSS file. +All the important stuff is in here. + + +TABLE OF CONTENTS: +------------------ + 1.0 - Text Elements + 2.0 - Forms + 3.0 - Actions + 4.0 - Notifications + 5.0 - TinyMCE + 6.0 - Admin Header + 6.1 - Favorites Menu + 6.2 - Screen Options Tabs + 7.0 - Main Navigation + 8.0 - Layout Blocks + 9.0 - Dashboard +10.0 - List Posts + 10.1 - Inline Editing +11.0 - Write/Edit Post Screen + 11.1 - Custom Fields + 11.2 - Post Revisions +12.0 - Categories +13.0 - Tags +14.0 - Media Screen + 14.1 - Media Uploader + 14.2 - Image Editor +15.0 - Comments Screen +16.0 - Themes + 16.1 - Custom Header + 16.2 - Custom Background + 16.3 - Tabbed Admin Screen Interface +17.0 - Plugins +18.0 - Users +19.0 - Tools +20.0 - Settings +21.0 - Admin Footer +22.0 - Misc +23.0 - Dead + + +------------------------------------------------------------------------------*/ + + + + +/*------------------------------------------------------------------------------ + 1.0 - Text Styles +------------------------------------------------------------------------------*/ + +p, +ul, +ol, +blockquote, +input, +select { + font-size: 12px; +} + +ol { + list-style-type: decimal; + margin-left: 2em; +} + +.code, code { + font-family: Consolas, Monaco, monospace; +} + +kbd, code { + padding: 1px 3px; + margin: 0 1px; + font-size: 11px; +} + +.quicktags, .search { + font: 12px Georgia, "Times New Roman", "Bitstream Charter", Times, serif; +} + +.icon32 { + float: left; + height: 34px; + margin: 7px 8px 0 0; + width: 36px; +} + +.key-labels label { + line-height: 24px; +} + +.pre { + /* http://www.longren.org/2006/09/27/wrapping-text-inside-pre-tags/ */ + white-space: pre-wrap; /* css-3 */ + white-space: -moz-pre-wrap !important; /* Mozilla, since 1999 */ + white-space: -pre-wrap; /* Opera 4-6 */ + white-space: -o-pre-wrap; /* Opera 7 */ + word-wrap: break-word; /* Internet Explorer 5.5+ */ +} + +.howto { + font-style: italic; + display: block; + font-family: sans-serif; +} + +p.install-help { + margin: 8px 0; + font-style: italic; +} + + +/*------------------------------------------------------------------------------ + 2.0 - Forms +------------------------------------------------------------------------------*/ + +textarea, +input[type="text"], +input[type="password"], +input[type="file"], +input[type="button"], +input[type="submit"], +input[type="reset"], +select { + border-width: 1px; + border-style: solid; + -moz-border-radius: 3px; + -khtml-border-radius: 3px; + -webkit-border-radius: 3px; + border-radius: 3px; +} + +select option { + padding: 2px; +} + +.submit { + padding: 1.5em 0; + margin: 5px 0; + -moz-border-radius: 0 0 3px 3px; + -webkit-border-bottom-left-radius: 3px; + -webkit-border-bottom-right-radius: 3px; + -khtml-border-bottom-left-radius: 3px; + -khtml-border-bottom-right-radius: 3px; + border-bottom-left-radius: 3px; + border-bottom-right-radius: 3px; +} + +form p.submit a.cancel:hover { + text-decoration: none; +} + +.submit input, +.button, +input.button, +.button-primary, +input.button-primary, +.button-secondary, +input.button-secondary, +.button-highlighted, +input.button-highlighted, +#postcustomstuff .submit input { + text-decoration: none; + font-size: 12px !important; + line-height: 13px; + padding: 3px 8px; + cursor: pointer; + border-width: 1px; + border-style: solid; + -moz-border-radius: 11px; + -khtml-border-radius: 11px; + -webkit-border-radius: 11px; + border-radius: 11px; + -moz-box-sizing: content-box; + -webkit-box-sizing: content-box; + -khtml-box-sizing: content-box; + box-sizing: content-box; +} + +#minor-publishing-actions input, +#major-publishing-actions input, +#minor-publishing-actions .preview { + min-width: 80px; + text-align: center; +} + +textarea.all-options, input.all-options { + width: 250px; +} + +input.large-text, +textarea.large-text { + width: 99%; +} + +input.regular-text, +#adduser .form-field input { + width: 25em; +} + +input.small-text { + width: 50px; +} + +#doaction, +#doaction2, +#post-query-submit { + margin-right: 8px; +} + +.tablenav select[name="action"], +.tablenav select[name="action2"] { + width: 130px; +} + +.tablenav select[name="m"] { + width: 155px; +} + +.tablenav select#cat { + width: 170px; +} + +#wpcontent select { + padding: 2px; + height: 2em; + font-size: 12px; +} + +#wpcontent option { + padding: 2px; +} + +#timezone_string option { + margin-left: 1em; +} + +label, +#your-profile label + a { + vertical-align: middle; +} + +#misc-publishing-actions label { + vertical-align: baseline; +} + +#pass-strength-result { + border-style: solid; + border-width: 1px; + float: left; + margin: 13px 5px 5px 1px; + padding: 3px 5px; + text-align: center; + width: 200px; + display: none; +} +.indicator-hint { + padding-top: 8px; +} + +p.search-box { + float: right; + margin: 0; +} + + +/*------------------------------------------------------------------------------ + 3.0 - Actions +------------------------------------------------------------------------------*/ + +#major-publishing-actions { + padding: 10px 10px 8px; + clear: both; + border-top: none; +} + +#delete-action { + line-height: 25px; + vertical-align: middle; + text-align: left; + float: left; +} + +#publishing-action { + text-align: right; + float: right; + line-height: 23px; +} + +#post-body #minor-publishing { + padding-bottom: 10px; +} + +#post-body #misc-publishing-actions { + padding: 0; +} + +#post-body .misc-pub-section { + border-right-width: 1px; + border-right-style: solid; + border-bottom: 0 none; + min-height: 30px; + float: left; + max-width: 32%; +} + +#post-body .misc-pub-section-last { + border-right: 0; +} + +#misc-publishing-actions { + padding: 6px 0 16px 0; +} + +.misc-pub-section { + padding: 6px 10px; + border-width: 1px 0; + border-style: solid; +} + +.misc-pub-section:first-child { + border-top-width: 0; +} +.misc-pub-section-last { + border-bottom-width: 0; +} + +#minor-publishing-actions { + padding: 10px 10px 2px 8px; + text-align: right; +} + +#minor-publishing { + border-bottom-width: 1px; + border-bottom-style: solid; + -webkit-box-shadow: 0 1px 0 #fff; + -moz-box-shadow: 0 1px 0 #fff; + box-shadow: 0 1px 0 #fff; +} + +#save-post { + float: left; +} + +#minor-publishing .ajax-loading { + padding: 3px 0 0 4px; + float: left; +} + +.preview { + float: right; +} + + + +#sticky-span { + margin-left: 18px; +} + +#post-status-display, +#post-visibility-display { + font-weight: bold; +} + +.side-info { + margin: 0; + padding: 4px; + font-size: 11px; +} + +.side-info h5 { + padding-bottom: 7px; + font-size: 14px; + margin: 12px 2px 5px; + border-bottom-width: 1px; + border-bottom-style: solid; +} + +.side-info ul { + margin: 0; + padding-left: 18px; + list-style: square; +} + +a.button, +a.button-primary, +a.button-secondary { + line-height: 15px; + padding: 3px 10px; + white-space: nowrap; + -webkit-border-radius: 10px; +} + +.approve { + display: none; +} + +.unapproved .approve, +.spam .approve, +.trash .approve { + display: inline; +} + +.unapproved .unapprove { + display: none; +} + +td.action-links, +th.action-links { + text-align: right; +} + +.describe .del-link { + padding-left: 5px; +} + + +/*------------------------------------------------------------------------------ + 4.0 - Notifications +------------------------------------------------------------------------------*/ + +#update-nag, .update-nag { + line-height: 19px; + padding: 5px 0; + font-size: 12px; + text-align: center; + margin: 0 15px; + border-width: 1px; + border-style: solid; + border-top-width: 0; + border-top-style: none; + -moz-border-radius: 0 0 3px 3px; + -webkit-border-bottom-right-radius: 3px; + -webkit-border-bottom-left-radius: 3px; + -khtml-border-bottom-right-radius: 3px; + -khtml-border-bottom-left-radius: 3px; + border-bottom-right-radius: 3px; + border-bottom-left-radius: 3px; +} + +.plugins .plugin-update { + padding: 0; +} + +.plugin-update .update-message { + margin: 0 10px 8px 31px; + font-weight: bold; +} + +ul#dismissed-updates { + display: none; +} +form.upgrade { + margin-top: 8px; +} + +form.upgrade .hint { + font-style: italic; + font-size: 85%; + margin: -0.5em 0 2em 0; +} + +.ajax-feedback { + visibility: hidden; + vertical-align: bottom; +} + +#ajax-response.alignleft { + margin-left: 2em; +} + + +/*------------------------------------------------------------------------------ + 5.0 - TinyMCE +------------------------------------------------------------------------------*/ + +#editorcontainer #content { + font-family: Consolas, Monaco, monospace; + padding: 6px; + line-height: 150%; + border: 0 none; + outline: none; + resize: vertical; + -moz-box-sizing: border-box; + -webkit-box-sizing: border-box; + -khtml-box-sizing: border-box; + box-sizing: border-box; +} + +#editorcontainer, +#quicktags { + border-style: solid; + border-width: 1px; + border-collapse: separate; + -moz-border-radius: 3px 3px 0 0; + -webkit-border-top-right-radius: 3px; + -webkit-border-top-left-radius: 3px; + -khtml-border-top-right-radius: 3px; + -khtml-border-top-left-radius: 3px; + border-top-right-radius: 3px; + border-top-left-radius: 3px; +} + +#quicktags { + padding: 0; + margin-bottom: -3px; + border-bottom-width: 3px; + background-image: url("../images/ed-bg.gif"); + background-position: left top; + background-repeat: repeat-x; +} + +#quicktags #ed_toolbar { + padding: 2px 4px 0; +} + +#ed_toolbar input, +#ed_reply_toolbar input { + margin: 3px 1px 4px; + line-height: 18px; + display: inline-block; + min-width: 26px; + padding: 2px 4px; + font-size: 12px; +} + +#ed_reply_toolbar input { + margin: 1px 2px 1px 1px; +} + +#quicktags #ed_link, +#ed_reply_toolbar #ed_reply_link { + text-decoration: underline; +} + +#quicktags #ed_del, +#ed_reply_toolbar #ed_reply_del { + text-decoration: line-through; +} + +#quicktags #ed_em, +#ed_reply_toolbar #ed_reply_em { + font-style: italic; +} + +#wp_editbtns, +#wp_gallerybtns { + padding: 2px; + position: absolute; + display: none; + z-index: 999998; +} + +#wp_editimgbtn, +#wp_delimgbtn, +#wp_editgallery, +#wp_delgallery { + margin: 2px; + padding: 2px; + border-width: 1px; + border-style: solid; + -moz-border-radius: 3px; + -khtml-border-radius: 3px; + -webkit-border-radius: 3px; + border-radius: 3px; +} + +/* Distraction Free Writing mode + * =Overlay Styles +-------------------------------------------------------------- */ +.fullscreen-overlay { + z-index: 149999; + display: none; + position: fixed; + top: 0; + bottom: 0; + left: 0; + right: 0; + filter: inherit; +} + +.fullscreen-active .fullscreen-overlay, +.fullscreen-active #wp-fullscreen-body { + display: block; +} + +.fullscreen-fader { + z-index: 200000; +} + +.fullscreen-active .fullscreen-fader { + display: none; +} + +/* =Overlay Body +-------------------------------------------------------------- */ +#wp-fullscreen-body { + width: 100%; + z-index: 150005; + display: none; + position: absolute; + top: 0; + left: 0; +} + +#wp-fullscreen-wrap { + margin: 0 auto 50px; + position: relative; + padding-top: 60px; +} + +#wp-fullscreen-title { + font-size: 1.7em; + line-height: 100%; + outline: medium none; + padding: 6px 7px; + width: 100%; + margin-bottom: 30px; +} + +#wp-fullscreen-container { + padding: 4px 10px 50px; +} + +#wp-fullscreen-title, +#wp-fullscreen-container { + -moz-border-radius: 0; + -khtml-border-radius: 0; + -webkit-border-radius: 0; + border-radius: 0; + border: 1px dashed transparent; + background: transparent; + -moz-transition-property: border-color; + -moz-transition-duration: 0.6s; + -webkit-transition-property: border-color; + -webkit-transition-duration: 0.6s; + -o-transition-property: border-color; + -o-transition-duration: 0.6s; + transition-property: border-color; + transition-duration: 0.6s; +} + + +#wp_mce_fullscreen { + width: 100%; + min-height: 300px; + border: 0; + background: transparent; + font-family: Consolas, Monaco, monospace; + line-height: 1.6em; + padding: 0; + overflow-y: hidden; + outline: none; + resize: none; +} + +#wp-fullscreen-tagline { + color: #BBBBBB; + font-size: 18px; + float: right; + padding-top: 5px; +} + +/* =Top bar +-------------------------------------------------------------- */ +#fullscreen-topbar { + position: fixed; + top: 0; + left: 0; + z-index: 150050; + border-bottom-style: solid; + border-bottom-width: 1px; + min-width: 800px; + width: 100%; + height: 40px; +} + +#wp-fullscreen-toolbar { + padding: 6px 10px 0; + clear: both; + max-width: 1100px; + min-width: 820px; + margin: 0 auto; +} + +#wp-fullscreen-mode-bar, +#wp-fullscreen-button-bar, +#wp-fullscreen-close, +#wp-fullscreen-count { + float: left; +} + +#wp-fullscreen-save { + float: right; +} + +#wp-fullscreen-save { + padding: 2px 2px 0 5px; +} + +#wp-fullscreen-count, +#wp-fullscreen-close { + padding-top: 5px; +} + +#wp-fullscreen-central-toolbar { + margin: auto; + padding: 0; +} + +#wp-fullscreen-buttons > div { + float: left; +} + +#wp-fullscreen-mode-bar { + padding: 1px 14px 0 0; +} + +#wp-fullscreen-modes a { + display: block; + font-size: 11px; + text-decoration: none; + float: left; + margin: 1px 0 0 0; + padding: 2px 6px 2px; + border-width: 1px 1px 1px 0; + border-style: solid; + border-color: #bbb; + color: #777; + text-shadow: 0 1px 0 #fff; + background-color: #f4f4f4; + background-image: -moz-linear-gradient(bottom, #e4e4e4, #f9f9f9); + background-image: -webkit-gradient(linear, left bottom, left top, from(#e4e4e4), to(#f9f9f9)); +} + +#wp-fullscreen-modes a:hover, +.wp-html-mode #wp-fullscreen-modes a:last-child, +.wp-tmce-mode #wp-fullscreen-modes a:first-child { + color: #333; + border-color: #999; + background-color: #eee; + background-image: -moz-linear-gradient(bottom, #f9f9f9, #e0e0e0); + background-image: -webkit-gradient(linear, left bottom, left top, from(#f9f9f9), to(#e0e0e0)); +} + +#wp-fullscreen-modes a:first-child { + border-width: 1px; + -moz-border-radius: 3px 0 0 3px; + -webkit-border-top-left-radius: 3px; + -webkit-border-bottom-left-radius: 3px; + -khtml-border-top-left-radius: 3px; + -khtml-border-bottom-left-radius: 3px; + border-top-left-radius: 3px; + border-bottom-left-radius: 3px; +} + +#wp-fullscreen-modes a:last-child { + -moz-border-radius: 0 3px 3px 0; + -webkit-border-top-right-radius: 3px; + -webkit-border-bottom-right-radius: 3px; + -khtml-border-top-right-radius: 3px; + -khtml-border-bottom-right-radius: 3px; + border-top-right-radius: 3px; + border-bottom-right-radius: 3px; +} + +#wp-fullscreen-buttons .active a { + background: inherit; +} + +#wp-fullscreen-buttons .hidden { + display: none; +} + +#wp-fullscreen-buttons .disabled { + opacity: 0.5; +} + +.wp-html-mode #wp-fullscreen-buttons div { + display: none; +} + +.wp-html-mode #wp-fullscreen-buttons div.wp-fullscreen-both { + display: block; +} + +#fullscreen-topbar.fullscreen-make-sticky { + display: block !important; +} + +#wp-fullscreen-save img { + vertical-align: middle; +} + +#wp-fullscreen-save img, +#wp-fullscreen-save span { + padding-right: 4px; + display: none; +} + +#wp-fullscreen-buttons .mce_image .mce_image { + background-image: url("../images/menu.png?ver=20100531"); + background-position: -124px -38px; +} + +#wp-fullscreen-buttons .mce_image .mce_image:hover { + background-position: -124px -6px; +} + +/* =Thickbox Adjustments +-------------------------------------------------------------- */ +.fullscreen-active #TB_overlay { + z-index: 150100; +} + +.fullscreen-active #TB_window { + z-index: 150102; +} + +/* =TinyMCE Adjustments +-------------------------------------------------------------- */ +#wp_mce_fullscreen_ifr { + background: transparent; +} + +#wp_mce_fullscreen_parent #wp_mce_fullscreen_tbl tr.mceFirst { + display : none; +} + +#wp-fullscreen-container .wp_themeSkin table td { + vertical-align: top; +} + + +/*------------------------------------------------------------------------------ + 6.0 - Admin Header +------------------------------------------------------------------------------*/ +#wphead-info { + margin: 0 0 0 15px; +} + +#user_info { + float: right; + font-size: 12px; + line-height: 26px; + height: 25px; + position: relative; + z-index: 49; + border-style: solid; + border-width: 0; + margin-top: 3px; + padding: 0 2px 0 6px; +} + +#user_info.active { + border-width: 1px; + margin-right: -1px; + margin-top: 2px; + -moz-border-radius: 3px 3px 0 0; + -webkit-border-top-right-radius: 3px; + -webkit-border-top-left-radius: 3px; + -khtml-border-top-right-radius: 3px; + -khtml-border-top-left-radius: 3px; + border-top-right-radius: 3px; + border-top-left-radius: 3px; +} + +#user_info p { + margin: 0; + padding: 0; + line-height: 25px; + cursor: pointer; +} + +#user_info .hide-if-no-js p { + margin: 0 20px 0 0; +} + +#user_info:hover .hide-if-no-js p { + text-decoration: underline; +} +#user_info.active .hide-if-no-js p { + text-decoration: none; +} + +#user_info_arrow { + height: 22px; + width: 22px; + position: absolute; + right: 3px; + top: 0; + cursor: pointer; +} + +#user_info_links_wrap { + min-width: 100px; + width: 100%; + position: absolute; + top: 25px; + right: 0; + padding: 0; + text-shadow: rgba(255,255,255,0.7) 0 1px 0; +} + +#user_info_links { + position: absolute; + left: -1px; + right: -1px; + overflow: hidden; +} + +#user_info.active #user_info_links ul { + margin-top: 0; + -moz-transition: margin-top 200ms; + -webkit-transition: margin-top 200ms; + -o-transition: margin-top 200ms; + transition: margin-top 200ms; +} + +#user_info_links ul { + border-width: 1px; + border-style: solid; + margin-top: -1000px; + -moz-transition: margin-top 500ms ease-in; + -webkit-transition: margin-top 500ms ease-in; + -o-transition: margin-top 500ms ease-in; + transition: margin-top 500ms ease-in; +} + +#user_info_links, +#user_info_links ul, +#user_info_links li:last-child { + -moz-border-radius: 0 0 3px 3px; + -webkit-border-bottom-right-radius: 3px; + -webkit-border-bottom-left-radius: 3px; + -khtml-border-bottom-right-radius: 3px; + -khtml-border-bottom-left-radius: 3px; + border-bottom-right-radius: 3px; + border-bottom-left-radius: 3px; +} + +#user_info_links li { + display: block; + margin: 0; +} + +#user_info_links a { + display: block; + padding: 6px 8px; +} + +#wphead { + height: 32px; + margin-right: 20px; + margin-left: 2px; +} + +#wphead a, +#adminmenu a, +#sidemenu a, +#taglist a, +#catlist a, +#show-settings a { + text-decoration: none; +} + +#header-logo { + float: left; + margin: 7px 0; + -webkit-user-select: none; + -moz-user-select: none; + -khtml-user-select: none; + user-select: none; +} + +#wphead h1 { + font: normal 16px Georgia, "Times New Roman", "Bitstream Charter", Times, serif; + padding: 6px 8px 5px; + margin: 0; + float: left; +} + +#wphead h1 a:hover { + text-decoration:none; +} +#wphead h1 a:hover #site-title { + text-decoration:underline; +} + + +/*------------------------------------------------------------------------------ + 6.1 - Favorites Menu +------------------------------------------------------------------------------*/ + +#favorite-actions { + margin: 0 12px 0 15px; + min-width: 130px; + position: relative; + display: inline-block; + top: -1px; +} + +#favorite-first { + -moz-border-radius: 12px; + -khtml-border-radius: 12px; + -webkit-border-radius: 12px; + border-radius: 12px; + line-height: 15px; + padding: 0 30px 0 0; + border-width: 1px; + border-style: solid; +} + +#favorite-inside { + margin: 0; + padding: 2px 1px; + border-width: 1px; + border-style: solid; + position: absolute; + z-index: 11; + display: none; + -moz-border-radius: 0 0 12px 12px; + -webkit-border-bottom-right-radius: 12px; + -webkit-border-bottom-left-radius: 12px; + -khtml-border-bottom-right-radius: 12px; + -khtml-border-bottom-left-radius: 12px; + border-bottom-right-radius: 12px; + border-bottom-left-radius: 12px; +} + +#favorite-first a { + padding: 2px 0 2px 12px; +} + +#favorite-actions a { + display: block; + text-decoration: none; + font-size: 11px; +} + +#favorite-inside a { + padding: 3px 5px 3px 10px; + line-height: 20px; +} + +#favorite-toggle { + height: 18px; + position: absolute; + right: 0; + top: 1px; + width: 28px; + border-width: 0 0 0 1px; + border-style: solid; +} + +#favorite-actions .slide-down { + -moz-border-radius: 12px 12px 0 0; + -webkit-border-bottom-right-radius: 0; + -webkit-border-bottom-left-radius: 0; + -khtml-border-bottom-right-radius: 0; + -khtml-border-bottom-left-radius: 0; + border-bottom-right-radius: 0; + border-bottom-left-radius: 0; + border-bottom: none; +} + + +/*------------------------------------------------------------------------------ + 6.2 - Screen Options Tabs +------------------------------------------------------------------------------*/ + +#screen-meta { + position: relative; + clear: both; +} + +#screen-meta-links { + margin: 0 24px 0 0; +} + +#screen-meta .screen-reader-text { + visibility: hidden; +} + +#screen-options-link-wrap, +#contextual-help-link-wrap { + float: right; + height: 22px; + padding: 0; + margin: 0 0 0 6px; + font-family: sans-serif; + -moz-border-radius-bottomleft: 3px; + -moz-border-radius-bottomright: 3px; + -webkit-border-bottom-left-radius: 3px; + -webkit-border-bottom-right-radius: 3px; + border-bottom-left-radius: 3px; + border-bottom-right-radius: 3px; +} + +#contextual-help-wrap li { + list-style-type: disc; + margin-left: 18px; +} +.toggle-arrow { + background-repeat: no-repeat; + background-position: top left; + background-color: transparent; + height: 22px; + line-height: 22px; + display: block; +} +.toggle-arrow-active { + background-position: bottom left; +} +#screen-meta a.show-settings { + text-decoration: none; + z-index: 1; + padding: 0 16px 0 6px; + height: 22px; + line-height: 22px; + font-size: 12px; + display: block; + text-shadow: rgba(255,255,255,0.7) 0 1px 0; +} + +#screen-meta a.show-settings:hover { + text-decoration: none; +} + +#screen-options-wrap h5, +#contextual-help-wrap h5 { + margin: 8px 0; + font-size: 13px; +} + +#screen-options-wrap, +#contextual-help-wrap { + border-style: none solid solid; + border-top: 0 none; + border-width: 0 1px 1px; + margin: 0 20px 0 0; + padding: 8px 12px 12px; +} + +.metabox-prefs label { + display: inline-block; + padding-right: 15px; + white-space: nowrap; + line-height: 30px; +} + +.metabox-prefs label input { + margin: 0 5px 0 2px; +} + +.metabox-prefs label a { + display: none; +} + + +/*------------------------------------------------------------------------------ + 7.0 - Main Navigation (Left Menu) +------------------------------------------------------------------------------*/ + +#adminmenuback, +#adminmenuwrap { + border-width: 0 1px 0 0; + border-style: solid; +} +#adminmenuwrap { + position: relative; +} + +#adminmenushadow { + position: absolute; + top: 0; + right: 0; + bottom: 0; + width: 6px; + z-index: 20; +} + +/* side admin menu */ +#adminmenu * { + -webkit-user-select: none; + -moz-user-select: none; + -khtml-user-select: none; + user-select: none; +} + +#adminmenu .wp-submenu { + display: none; + list-style: none; + padding: 0; + margin: 0; + position: relative; + z-index: 2; +} + +#adminmenu .wp-submenu a { + font-size: 12px; + line-height: 18px; +} + +#adminmenu .wp-submenu li.current, +#adminmenu .wp-submenu li.current a, +#adminmenu .wp-submenu li.current a:hover { + font-weight: bold; +} + +#adminmenu a.menu-top, +#adminmenu .wp-submenu-head { + font-size: 13px; + line-height: 18px; +} + +#adminmenu div.wp-submenu-head { + display: none; +} + +.js.folded #adminmenu div.wp-submenu-head { + display: block; +} + +.js.folded #adminmenu a.menu-top, +body.no-js #adminmenu .wp-menu-toggle, +.js.folded #adminmenu div.wp-menu-toggle { + display: none; +} + +body.js #adminmenu li.wp-menu-open .wp-submenu, +body.no-js #adminmenu .open-if-no-js .wp-submenu, +body.no-js #adminmenu li.wp-has-current-submenu .wp-submenu { + display: block; +} + +#adminmenu div.wp-menu-image { + float: left; + width: 28px; + height: 28px; +} +.js.folded #adminmenu div.wp-menu-image { + width: 32px; +} + +#adminmenu li { + margin: 0; + padding: 0; + cursor: pointer; +} + +#adminmenu a { + display: block; + line-height: 18px; + padding: 2px 5px; +} + +#adminmenu li.menu-top { + min-height: 26px; + position: relative; +} + +#adminmenu a.menu-top { + font-weight: bold; + line-height: 18px; + min-width: 10em; + padding: 5px 5px; + border-width: 1px 0 1px; + border-style: solid; +} + +#adminmenu li.wp-menu-open { + border-width: 0 0 1px; + border-style: solid; +} + +#adminmenu .wp-submenu a { + margin: 0; + padding-left: 12px; +} + +.wp-menu-arrow { + display: none; +} +#adminmenu li.wp-has-current-submenu .wp-menu-arrow, +#adminmenu li.menu-top.current .wp-menu-arrow { + display: block; + position: absolute; + right: -9px; + top: 0; + cursor: auto; + z-index: 25; +} +#adminmenu .wp-menu-arrow div { + width: 15px; + height: 30px; + background: url(../images/menu-arrow-frame.png) top right no-repeat; +} + +#adminmenu .wp-submenu li { + padding: 0; + margin: 0; +} + +.js.folded #adminmenu li.menu-top { + width: 32px; + height: 29px; + border-width: 1px 0; + border-style: solid; +} + +#adminmenu .wp-menu-image img { + float: left; + padding: 8px 6px 0; + opacity: 0.6; + filter: alpha(opacity=60); +} + +#adminmenu li.menu-top:hover .wp-menu-image img, +#adminmenu li.wp-has-current-submenu .wp-menu-image img { + opacity: 1; + filter: alpha(opacity=100); +} + +#adminmenu li.wp-menu-separator { + height: 3px; + padding: 0; + margin: 0; + border-width: 1px 0; + border-style: solid; + cursor: inherit; +} + +#adminmenu div.separator { + height: 1px; + padding: 0; + border-width: 1px 0 0 0; + border-style: solid; +} + +.js.folded #adminmenu .wp-submenu { + display: block; + position: absolute; + top: -5px; + left: 26px; + z-index: 999; + width: 0; + padding: 0; + overflow: hidden; + -moz-transition: width 200ms ease-out; + -webkit-transition: width 200ms ease-out; + -o-transition: width 200ms ease-out; + transition: width 200ms ease-out; +} +.js.folded #adminmenu .wp-submenu.sub-open { + padding: 0 8px 8px 0; +} + +#adminmenu .wp-submenu .wp-submenu-head { + padding: 6px 4px 5px 10px; + cursor: default; + border-width: 1px 0; + border-style: solid; +} + +.js.folded #adminmenu .wp-submenu-wrap { + margin-top: 4px; + border-width: 0 1px 1px 0; + border-style: solid; + position: relative; + -webkit-border-bottom-right-radius: 3px; + -webkit-border-top-right-radius: 3px; + -khtml-border-bottom-right-radius: 3px; + -khtml-border-top-right-radius: 3px; + -moz-border-radius-bottomright: 3px; + -moz-border-radius-topright: 3px; + border-bottom-right-radius: 3px; + border-top-right-radius: 3px; +} + +.js.folded #adminmenu .wp-submenu ul { + border-width: 0 0 0 1px; + border-style: solid; +} + +.js.folded #adminmenu .wp-submenu a { + padding-left: 10px; +} + +.js.folded #adminmenu a.wp-has-submenu { + margin-left: 40px; +} + +#adminmenu .wp-menu-toggle { + width: 18px; + clear: right; + float: right; + margin: 1px 0 0; + height: 27px; + padding: 1px 2px 0 0; + cursor: pointer; +} + +#adminmenu .wp-menu-image a { + height: 24px; +} + +#adminmenu .wp-menu-image img { + padding: 6px 0 0 1px; +} + +#adminmenu .awaiting-mod, +#adminmenu span.update-plugins, +#sidemenu li a span.update-plugins { + position: absolute; + font-family: sans-serif; + font-size: 9px; + line-height: 17px; + font-weight: bold; + margin-top: 1px; + margin-left: 7px; + -moz-border-radius: 10px; + -khtml-border-radius: 10px; + -webkit-border-radius: 10px; + border-radius: 10px; +} + +#adminmenu li .awaiting-mod span, +#adminmenu li span.update-plugins span, +#sidemenu li a span.update-plugins span { + display: block; + padding: 0 6px; +} + +#adminmenu li span.count-0, +#sidemenu li a .count-0 { + display: none; +} + +.post-com-count-wrapper { + min-width: 22px; + font-family: sans-serif; +} + +.post-com-count { + height: 1.3em; + line-height: 1.1em; + display: block; + text-decoration: none; + padding: 0 0 6px; + cursor: pointer; + background-position: center -80px; + background-repeat: no-repeat; +} + +.post-com-count span { + font-size: 11px; + font-weight: bold; + height: 1.4em; + line-height: 1.4em; + min-width: 0.7em; + padding: 0 6px; + display: inline-block; + cursor: pointer; + -moz-border-radius: 5px; + -khtml-border-radius: 5px; + -webkit-border-radius: 5px; + border-radius: 5px; +} + +strong .post-com-count { + background-position: center -55px; +} + +.post-com-count:hover { + background-position: center -3px; +} + +.column-response .post-com-count { + float: left; + margin-right: 5px; + text-align: center; +} + +.response-links { + float: left; +} + +#the-comment-list .attachment-80x60 { + padding: 4px 8px; +} + +#collapse-menu { + font-size: 12px; + line-height: 34px; +} + +.js.folded #collapse-menu span { + display: none; +} + +#collapse-button, +#collapse-button div { + width: 15px; + height: 15px; +} + +#collapse-button { + float: left; + margin: 8px 6px; + border-width: 1px; + border-style: solid; + -moz-border-radius: 10px; + -khtml-border-radius: 10px; + -webkit-border-radius: 10px; + border-radius: 10px; +} + + +/*------------------------------------------------------------------------------ + 8.0 - Layout Blocks +------------------------------------------------------------------------------*/ + +body.wp-admin { + min-width: 785px; +} + +body.admin-bar #wphead, +body.admin-bar #adminmenu { + padding-top: 28px; +} + +.narrow { + width: 70%; + margin-bottom: 40px; +} + +.narrow p { + line-height: 150%; +} + +.widefat th, +.widefat td { + overflow: hidden; +} + +.widefat th { + font-family: Georgia, "Times New Roman", "Bitstream Charter", Times, serif; + font-weight: normal; +} + +.widefat td p { + margin: 2px 0 0.8em; +} + +.widefat .column-comment p { + margin: 0.6em 0; +} + +.postbox-container { + float: left; + padding-right: 0.5%; +} + +.postbox-container .meta-box-sortables { + min-height: 300px; +} + +.postbox .hndle { + cursor: move; +} + +.hndle a { + font-size: 11px; + font-weight: normal; +} + +.postbox .handlediv { + float: right; + width: 27px; + height: 30px; + cursor: pointer; +} + +.sortable-placeholder { + border-width: 1px; + border-style: dashed; + margin-bottom: 20px; +} + +.widget, +.postbox, +.stuffbox { + margin-bottom: 20px; + padding: 0; + border-width: 1px; + border-style: solid; + line-height: 1; +} + +.widget .widget-top, +.postbox h3, +.stuffbox h3 { + margin-top: 1px; + border-bottom-width: 1px; + border-style: solid; + cursor: move; + -webkit-user-select: none; + -moz-user-select: none; + -khtml-user-select: none; + user-select: none; +} + +.postbox .inside, +.stuffbox .inside { + padding: 0 10px; +} + +.postbox.closed h3 { + border: none; + -moz-box-shadow: none; + -webkit-box-shadow: none; + box-shadow: none; +} + +.postbox table.form-table { + margin-bottom: 0; +} + +.postbox input[type="text"], +.postbox textarea, +.stuffbox input[type="text"], +.stuffbox textarea { + border-width: 1px; + border-style: solid; +} + +.temp-border { + border: 1px dotted #ccc; +} + +.columns-prefs label { + padding: 0 5px; +} + + +/*------------------------------------------------------------------------------ + 9.0 - Dashboard +------------------------------------------------------------------------------*/ + +#wpbody-content .metabox-holder { + padding-top: 10px; +} + +#dashboard-widgets .meta-box-sortables { + margin: 0 5px; +} + +#dashboard_recent_comments div.undo { + border-top-style: solid; + border-top-width: 1px; + margin: 0 -10px; + padding: 3px 8px; + font-size: 11px; +} + +#the-comment-list td.comment p.comment-author { + margin-top: 0; + margin-left: 0; +} + +#the-comment-list p.comment-author img { + float: left; + margin-right: 8px; +} + +#the-comment-list p.comment-author strong a { + border: none; +} + +#the-comment-list td { + vertical-align: top; +} + +#the-comment-list td.comment { + word-wrap: break-word; +} + + +/*------------------------------------------------------------------------------ + 10.0 - List Posts (/Pages/etc) +------------------------------------------------------------------------------*/ + +table.fixed { + table-layout: fixed; +} +.fixed .column-rating, +.fixed .column-visible { + width: 8%; +} +.fixed .column-date, +.fixed .column-parent, +.fixed .column-links { + width: 10%; +} +.fixed .column-response, +.fixed .column-author, +.fixed .column-categories, +.fixed .column-tags, +.fixed .column-rel, +.fixed .column-role { + width: 15%; +} +.fixed .column-comments { + width: 4em; + padding: 8px 0; + text-align: left; +} +.fixed .column-comments .vers { + padding-left: 3px; +} +.fixed .column-comments a { + float: left; +} +.fixed .column-slug { + width: 25%; +} +.fixed .column-posts { + width: 10%; +} +.fixed .column-icon { + width: 80px; +} +#commentsdiv .fixed .column-author, +#comments-form .fixed .column-author { + width: 20%; +} +#commentsdiv.postbox .inside { + line-height: 1.4em; + margin: 0; + padding: 0; +} +#commentsdiv.postbox .inside .row-actions { + line-height:18px; +} +#commentsdiv.postbox .inside td { + padding:1em 10px; +} +#commentsdiv.postbox .inside .column-comment p { +} +#commentsdiv.postbox .inside .column-author { + width:33%; +} +#commentsdiv.postbox .inside p { + margin:6px 10px 8px; +} +#commentsdiv.postbox .column-comment p { + margin:0.6em 0; +} +#commentsdiv.postbox #replyrow td { + padding:0; +} +.sorting-indicator { + display: none; + width: 7px; + height: 4px; + margin-top: 8px; + margin-left: 7px; + background-image: url(../images/sort.gif); + background-repeat: no-repeat; +} +.fixed .column-comments .sorting-indicator { + margin-top: 3px; +} +.widefat th.sortable, +.widefat th.sorted { + padding: 0; +} +th.sortable a, +th.sorted a { + display: block; + overflow: hidden; + padding: 7px 7px 8px; +} +.fixed .column-comments.sortable a, +.fixed .column-comments.sorted a { + padding: 8px 0; +} +th.sortable a span, +th.sorted a span { + float: left; + cursor: pointer; +} +th.sorted.asc .sorting-indicator, +th.desc:hover span.sorting-indicator { + display: block; + background-position: 0 0; +} +th.sorted.desc .sorting-indicator, +th.asc:hover span.sorting-indicator { + display: block; + background-position: -7px 0; +} + +/* Bulk Actions */ + +.tablenav-pages a { + border-bottom-style: solid; + border-bottom-width: 2px; + font-weight: bold; + margin-right: 1px; + padding: 0 2px; +} +.tablenav-pages .current-page { + text-align: center; +} +.tablenav-pages .next-page { + margin-left: 2px; +} + +.tablenav a.button-secondary { + display: block; + margin: 3px 8px 0 0; +} + +.tablenav { + clear: both; + height: 30px; + margin: 6px 0 4px; + vertical-align: middle; +} + +.tablenav .tablenav-pages { + float: right; + display: block; + cursor: default; + height: 30px; + line-height: 30px; + font-size: 12px; +} + +.tablenav .no-pages, +.tablenav .one-page .pagination-links { + display: none; +} + +.tablenav .tablenav-pages a, +.tablenav-pages span.current { + text-decoration: none; + border: none; + padding: 3px 6px; + border-width: 1px; + border-style: solid; + -moz-border-radius: 3px; + -khtml-border-radius: 3px; + -webkit-border-radius: 3px; + border-radius: 3px; +} + +.tablenav .tablenav-pages a.disabled:hover { + cursor: default; +} + +.tablenav .tablenav-pages a.disabled:active { + cursor: default; +} + +.tablenav .displaying-num { + margin-right: 10px; + font-size: 12px; + font-family: Georgia, "Times New Roman", "Bitstream Charter", Times, serif; + font-style: italic; +} + +.tablenav .actions { + padding: 2px 8px 0 0; +} + +.tablenav .delete { + margin-right: 20px; +} + +.view-switch { + float: right; + margin: 6px 8px 0; +} + +.view-switch a { + text-decoration: none; +} + +.filter { + float: left; + margin: -5px 0 0 10px; +} + +.filter .subsubsub { + margin-left: -10px; + margin-top: 13px; +} +.screen-per-page { + width: 3em; +} + +#posts-filter fieldset { + float: left; + margin: 0 1.5ex 1em 0; + padding: 0; +} + +#posts-filter fieldset legend { + padding: 0 0 .2em 1px; +} + +span.post-state-format { + font-weight: normal; +} + + +/*------------------------------------------------------------------------------ + 10.1 - Inline Editing +------------------------------------------------------------------------------*/ + +/* +.quick-edit* is for Quick Edit +.bulk-edit* is for Bulk Edit +.inline-edit* is for everything +*/ + +/* Layout */ +tr.inline-edit-row td { + padding: 0 0.5em; +} + +#wpbody-content .inline-edit-row fieldset { + font-size: 12px; + float: left; + margin: 0; + padding: 0; + width: 100%; +} + +#wpbody-content .inline-edit-row fieldset .inline-edit-col { + padding: 0 0.5em; +} + +#wpbody-content .quick-edit-row-page fieldset.inline-edit-col-right .inline-edit-col { + border-width: 0 0 0 1px; + border-style: none none none solid; +} + +#wpbody-content .quick-edit-row-post .inline-edit-col-left { + width: 40%; +} + +#wpbody-content .quick-edit-row-post .inline-edit-col-right { + width: 39%; +} + +#wpbody-content .inline-edit-row-post .inline-edit-col-center { + width: 20%; +} + +#wpbody-content .quick-edit-row-page .inline-edit-col-left { + width: 50%; +} + +#wpbody-content .quick-edit-row-page .inline-edit-col-right, +#wpbody-content .bulk-edit-row-post .inline-edit-col-right { + width: 49%; +} + +#wpbody-content .bulk-edit-row .inline-edit-col-left { + width: 30%; +} + +#wpbody-content .bulk-edit-row-page .inline-edit-col-right { + width: 69%; +} + +#wpbody-content .bulk-edit-row .inline-edit-col-bottom { + float: right; + width: 69%; +} + +#wpbody-content .inline-edit-row-page .inline-edit-col-right { + margin-top: 27px; +} + +.inline-edit-row fieldset .inline-edit-group { + clear: both; +} + +.inline-edit-row fieldset .inline-edit-group:after { + content: "."; + display: block; + height: 0; + clear: both; + visibility: hidden; +} + +.inline-edit-row p.submit { + clear: both; + padding: 0.5em; + margin: 0.5em 0 0; +} + +.inline-edit-row span.error { + line-height: 22px; + margin: 0 15px; + padding: 3px 5px; +} + +/* Positioning */ +.inline-edit-row h4 { + margin: .2em 0; + padding: 0; + line-height: 23px; +} +.inline-edit-row fieldset span.title, +.inline-edit-row fieldset span.checkbox-title { + margin: 0; + padding: 0; + line-height: 27px; +} + +.inline-edit-row fieldset label, +.inline-edit-row fieldset span.inline-edit-categories-label { + display: block; + margin: .2em 0; +} + +.inline-edit-row fieldset label.inline-edit-tags { + margin-top: 0; +} + +.inline-edit-row fieldset label.inline-edit-tags span.title { + margin: .2em 0; +} + +.inline-edit-row fieldset label span.title { + display: block; + float: left; + width: 5em; +} + +.inline-edit-row fieldset label span.input-text-wrap { + display: block; + margin-left: 5em; +} + +.quick-edit-row-post fieldset.inline-edit-col-right label span.title { + width: auto; + padding-right: 0.5em; +} + +.inline-edit-row .input-text-wrap input[type=text] { + width: 100%; +} + +.inline-edit-row fieldset label input[type=checkbox] { + vertical-align: text-bottom; +} + +.inline-edit-row fieldset label textarea { + width: 100%; + height: 4em; +} + +#wpbody-content .bulk-edit-row fieldset .inline-edit-group label { + max-width: 50%; +} + +#wpbody-content .quick-edit-row fieldset .inline-edit-group label.alignleft:first-child { + margin-right: 0.5em +} + +.inline-edit-col-right .input-text-wrap input.inline-edit-menu-order-input { + width: 6em; +} + + +/* Styling */ +.inline-edit-row h4 { + text-transform: uppercase; +} + +.inline-edit-row fieldset span.title, +.inline-edit-row fieldset span.checkbox-title { + font-family: Georgia, "Times New Roman", "Bitstream Charter", Times, serif; + font-style: italic; + line-height: 1.8em; +} + +/* Specific Elements */ +.inline-edit-row fieldset input[type="text"], +.inline-edit-row fieldset textarea { + border-style: solid; + border-width: 1px; +} + +.inline-edit-row fieldset .inline-edit-date { + float: left; +} + +.inline-edit-row fieldset input[name=jj], +.inline-edit-row fieldset input[name=hh], +.inline-edit-row fieldset input[name=mn] { + font-size: 12px; + width: 2.1em; +} + +.inline-edit-row fieldset input[name=aa] { + font-size: 12px; + width: 3.5em; +} + +.inline-edit-row fieldset label input.inline-edit-password-input { + width: 8em; +} + +.inline-edit-row .catshow, +.inline-edit-row .cathide { + cursor: pointer; +} + +ul.cat-checklist { + height: 12em; + border-style: solid; + border-width: 1px; + overflow-y: scroll; + padding: 0 5px; + margin: 0; +} + +#bulk-titles { + display: block; + height: 12em; + border-style: solid; + border-width: 1px; + overflow-y: scroll; + padding: 0 5px; + margin: 0 0 5px; +} + +.inline-edit-row fieldset ul.cat-checklist li, +.inline-edit-row fieldset ul.cat-checklist input { + margin: 0; +} + +.inline-edit-row fieldset ul.cat-checklist label, +.inline-edit-row .catshow, +.inline-edit-row .cathide, +.inline-edit-row #bulk-titles div { + font-family: sans-serif; + font-style: normal; + font-size: 11px; +} + +table .inline-edit-row fieldset ul.cat-hover { + height: auto; + max-height: 30em; + overflow-y: auto; + position: absolute; +} + +.inline-edit-row fieldset label input.inline-edit-menu-order-input { + width: 3em; +} + +.inline-edit-row fieldset label input.inline-edit-slug-input { + width: 75%; +} + +.quick-edit-row-post fieldset label.inline-edit-status { + float: left; +} + +#bulk-titles { + line-height: 140%; +} +#bulk-titles div { + margin: 0.2em 0.3em; +} + +#bulk-titles div a { + cursor: pointer; + display: block; + float: left; + height: 10px; + margin: 3px 3px 0 -2px; + overflow: hidden; + position: relative; + text-indent: -9999px; + width: 10px; +} + + +/*------------------------------------------------------------------------------ + 11.0 - Write/Edit Post Screen +------------------------------------------------------------------------------*/ + +#titlediv { + position: relative; + margin-bottom: 20px; +} +#titlediv label { cursor: text; } + +#titlediv div.inside { + margin: 0; +} + +#poststuff #titlewrap { + border: 0; + padding: 0; + +} + +#titlediv #title { + padding: 3px 4px; + border-width: 1px; + border-style: solid; + -moz-border-radius: 3px; + -khtml-border-radius: 3px; + -webkit-border-radius: 3px; + border-radius: 3px; + font-size: 1.7em; + line-height: 100%; + width: 100%; + outline: none; +} + +#titlediv #title-prompt-text, +#wp-fullscreen-title-prompt-text { + color: #bbb; + position: absolute; + font-size: 1.7em; + padding: 8px; +} + +#wp-fullscreen-title-prompt-text { + left: 0; + padding: 11px; +} + +#poststuff .inside-submitbox, +#side-sortables .inside-submitbox { + margin: 0 3px; + font-size: 11px; +} + +input#link_description, +input#link_url { + width: 98%; +} + +#pending { + background: 0 none; + border: 0 none; + padding: 0; + font-size: 11px; + margin-top: -1px; +} + +#edit-slug-box { + height: 1em; + margin-top: 8px; + padding: 0 7px; +} + +#editable-post-name-full { + display: none; +} + +#editable-post-name input { + width: 16em; +} + +.postarea h3 label { + float: left; +} + +.postarea #add-media-button { + float: right; + margin: 7px 0pt 0pt; + position: relative; + right: 10px; +} + +#poststuff #editor-toolbar { + height: 30px; +} + +.wp_themeSkin tr.mceFirst td.mceToolbar { + border-width: 0 0 1px; + border-style: none none solid; +} + +#edButtonPreview, +#edButtonHTML { + height: 18px; + margin: 5px 5px 0 0; + padding: 4px 5px 2px; + float: right; + cursor: pointer; + border-width: 1px; + border-style: solid; + -moz-border-radius: 3px 3px 0 0; + -webkit-border-top-right-radius: 3px; + -webkit-border-top-left-radius: 3px; + -khtml-border-top-right-radius: 3px; + -khtml-border-top-left-radius: 3px; + border-top-right-radius: 3px; + border-top-left-radius: 3px; +} + +.js .theEditor { + color: white; +} + +#poststuff #edButtonHTML { + margin-right: 15px; +} + +#media-buttons { + cursor: default; + padding: 8px 8px 0; +} + +#media-buttons a { + cursor: pointer; + padding: 0 0 5px 10px; +} + +#media-buttons img, +#submitpost #ajax-loading, +#submitpost .ajax-loading { + vertical-align: middle; +} + +#wpcontent .ajax-loading { + visibility: hidden; +} + +.submitbox .submit { + text-align: left; + padding: 12px 10px 10px; + font-size: 11px; +} + +.submitbox .submitdelete { + border-bottom-width: 1px; + border-bottom-style: solid; + text-decoration: none; + padding: 1px 2px; +} + +.inside-submitbox #post_status { + margin: 2px 0 2px -2px; +} + +.submitbox .submit a:hover { + border-bottom-width: 1px; + border-bottom-style: solid; +} + +.submitbox .submit input { + margin-bottom: 8px; + margin-right: 4px; + padding: 6px; +} + +#post-status-select, #post-format { + line-height: 2.5em; + margin-top: 3px; +} + +/* Post Screen */ +#post-body #normal-sortables { + min-height: 50px; +} + +#post-body #advanced-sortables { + min-height: 20px; +} + +.postbox { + -moz-border-radius: 3px; + -webkit-border-radius: 3px; + -khtml-border-radius: 3px; + border-radius: 3px; + position: relative; + min-width: 255px; +} + +#trackback_url { + width: 99%; +} + +#normal-sortables .postbox .submit { + background: transparent none; + border: 0 none; + float: right; + padding: 0 12px; + margin:0; +} + +#side-sortables .category-add input { + width: 94%; +} + +#side-sortables .category-add select { + width: 100%; +} + +#side-sortables .category-add input.category-add-sumbit, +#post-body .category-add input.category-add input.category-add-sumbit { + width: auto; +} + +#post-body ul.category-tabs, +#post-body ul.add-menu-item-tabs { + float: left; + width: 120px; + text-align: right; + /* Negative margin for the sake of those without JS: all tabs display */ + margin: 0 -120px 0 5px; + padding: 0; +} + +#post-body ul.category-tabs li, +#post-body ul.add-menu-item-tabs li { + padding: 8px; +} + +#post-body ul.category-tabs li.tabs, +#post-body ul.add-menu-item-tabs li.tabs { + -moz-border-radius: 3px 0 0 3px; + -webkit-border-top-left-radius: 3px; + -webkit-border-bottom-left-radius: 3px; + -khtml-border-top-left-radius: 3px; + -khtml-border-bottom-left-radius: 3px; + border-top-left-radius: 3px; + border-bottom-left-radius: 3px; +} + +#post-body ul.category-tabs li.tabs a, +#post-body ul.add-menu-item-tabs li.tabs a { + font-weight: bold; + text-decoration: none; +} + +.wp-tab-panel, +.categorydiv div.tabs-panel, +.customlinkdiv div.tabs-panel, +.posttypediv div.tabs-panel, +.taxonomydiv div.tabs-panel, +#linkcategorydiv div.tabs-panel { + height: 200px; + overflow: auto; + padding: 0.5em 0.9em; + border-style: solid; + border-width: 1px; +} + +.nav-menus-php .customlinkdiv div.tabs-panel, +.nav-menus-php .posttypediv div.tabs-panel, +.nav-menus-php .taxonomydiv div.tabs-panel { + height: auto; + max-height: 205px; +} + +div.tabs-panel-active { + display:block; +} + +div.tabs-panel-inactive { + display:none; +} + +#post-body .categorydiv div.tabs-panel, +.taxonomy div.tabs-panel, +#post-body #linkcategorydiv div.tabs-panel { + margin: 0 5px 0 125px; +} + +#side-sortables .category-tabs li, +#side-sortables .add-menu-item-tabs li, +.wp-tab-bar li { + display: inline; + line-height: 1.35em; +} + +#side-sortables .category-tabs a, +#side-sortables .add-menu-item-tabs a, +.wp-tab-bar a { + text-decoration: none; +} + +#side-sortables .category-tabs, +#side-sortables .add-menu-item-tabs, +.wp-tab-bar { + margin-bottom: 3px; +} + +.categorydiv ul, +.customlinkdiv ul, +.posttypediv ul, +.taxonomydiv ul, +#linkcategorydiv ul { + list-style: none; + padding: 0; + margin: 0; +} + +#normal-sortables .postbox #replyrow .submit { + float: none; + margin: 0; + padding: 3px 7px; +} + +#side-sortables .submitbox .submit input, +#side-sortables .submitbox .submit .preview, +#side-sortables .submitbox .submit a.preview:hover { + border: 0 none; +} + +#side-sortables .inside-submitbox .insidebox, +.stuffbox .insidebox { + margin: 11px 0; +} + +#side-sortables .comments-box, +#normal-sortables .comments-box { + border: 0 none; +} +ul.category-tabs, +ul.add-menu-item-tabs, +ul.wp-tab-bar { + margin-top: 12px; +} + +#side-sortables .comments-box thead th, +#normal-sortables .comments-box thead th { + background: transparent; + padding: 0 7px 4px; + font-style: italic; +} + +ul.category-tabs li.tabs, +ul.add-menu-item-tabs li.tabs, +.wp-tab-active { + border-style: solid solid none; + border-width: 1px 1px 0; +} + +#commentsdiv img.waiting { + padding-left: 5px; +} + +#post-body .category-tabs li.tabs, +#post-body .add-menu-item-tabs li.tabs { + border-style: solid none solid solid; + border-width: 1px 0 1px 1px; + margin-right: -1px; +} + +ul.category-tabs li, +ul.add-menu-item-tabs li, +ul.wp-tab-bar li { + padding: 5px; + -moz-border-radius: 3px 3px 0 0; + -webkit-border-top-left-radius: 3px; + -webkit-border-top-right-radius: 3px; + -khtml-border-top-left-radius: 3px; + -khtml-border-top-right-radius: 3px; + border-top-left-radius: 3px; + border-top-right-radius: 3px; +} + +/* positioning etc. */ + +form#tags-filter { + position: relative; +} + +.screen-per-page { + width: 3em; +} + +#posts-filter fieldset { + float: left; + margin: 0 1.5ex 1em 0; + padding: 0; +} + +#posts-filter fieldset legend { + padding: 0 0 .2em 1px; +} + +/* Edit posts */ + +td.post-title strong, td.plugin-title strong { + display: block; + margin-bottom: .2em; +} + +td.post-title p, td.plugin-title p { + margin: 6px 0; +} + +/* Global classes */ + +.wp-hidden-children .wp-hidden-child, +.ui-tabs-hide { + display: none; +} + +.commentlist .avatar { + vertical-align: text-top; +} + +#post-body .tagsdiv #newtag { + margin-right: 5px; + width: 16em; +} + +#side-sortables input#post_password { + width: 94% +} + +#side-sortables .tagsdiv #newtag { + width: 68%; +} + +#post-status-info { + border-width: 0 1px 1px; + border-style: none solid solid; + width: 100%; + -moz-border-radius: 0 0 3px 3px; + -webkit-border-bottom-left-radius: 3px; + -webkit-border-bottom-right-radius: 3px; + -khtml-border-bottom-left-radius: 3px; + -khtml-border-bottom-right-radius: 3px; + border-bottom-left-radius: 3px; + border-bottom-right-radius: 3px; +} + +#post-status-info td { + font-size: 12px; +} + +.autosave-info { + padding: 2px 15px 2px 2px; + text-align: right; +} + +#editorcontent #post-status-info { + border: none; +} + +#post-body .wp_themeSkin .mceStatusbar a.mceResize { + display: block; + background: transparent url(../images/resize.gif) no-repeat scroll right bottom; + width: 12px; + cursor: se-resize; + margin: 0 2px; + position: relative; + top: 22px; +} + +#wp-word-count { + display: block; + padding: 2px 7px; +} + +#timestampdiv select { + height: 20px; + line-height: 14px; + padding: 0; + vertical-align: top; +} + +#jj, #hh, #mn { + width: 2em; + padding: 1px; + font-size: 12px; +} + +#aa { + width: 3.4em; + padding: 1px; + font-size: 12px; +} + +.curtime #timestamp { + background-repeat: no-repeat; + background-position: left top; + padding-left: 18px; +} + +#timestampdiv { + padding-top: 5px; + line-height: 23px; +} + +#timestampdiv p { + margin: 8px 0 6px; +} + +#timestampdiv input { + border-width: 1px; + border-style: solid; +} + + +/*------------------------------------------------------------------------------ + 11.1 - Custom Fields +------------------------------------------------------------------------------*/ + +#postcustomstuff table, +#postcustomstuff input, +#postcustomstuff textarea { + border-width: 1px; + border-style: solid; + -moz-border-radius: 3px; + -khtml-border-radius: 3px; + -webkit-border-radius: 3px; + border-radius: 3px; +} + +#postcustomstuff .updatemeta, +#postcustomstuff .deletemeta { + margin: auto; +} + +#postcustomstuff thead th { + padding: 5px 8px 8px; +} + +#postcustom #postcustomstuff .submit { + border: 0 none; + float: none; + padding: 5px 8px; +} + +#side-sortables #postcustom #postcustomstuff .submit { + padding: 0 5px; +} + +#side-sortables #postcustom #postcustomstuff td.left input { + margin: 3px 3px 0; +} + +#side-sortables #postcustom #postcustomstuff #the-list textarea { + height: 85px; + margin: 3px; +} + +#postcustomstuff table { + margin: 0; + width: 100%; + border-width: 1px; + border-style: solid; + border-spacing: 0; +} + +#postcustomstuff table input, +#postcustomstuff table select, +#postcustomstuff table textarea { + width: 95%; + margin: 8px 0 8px 8px; +} + +#postcustomstuff th.left, +#postcustomstuff td.left { + width: 38%; +} + +#postcustomstuff .submit input { + width: auto; +} + +#postcustomstuff #newmeta .submit { + padding: 0 8px; +} + +#postcustomstuff table #addmetasub { + width: auto; +} + +#postcustomstuff #newmetaleft { + vertical-align: top; +} + +#postcustomstuff #newmetaleft a { + padding: 0 10px; + text-decoration: none; +} + + +/*------------------------------------------------------------------------------ + 11.2 - Post Revisions +------------------------------------------------------------------------------*/ + +table.diff { + width: 100%; +} + +table.diff col.content { + width: 50%; +} + +table.diff tr { + background-color: transparent; +} + +table.diff td, table.diff th { + padding: .5em; + font-family: Consolas, Monaco, monospace; + border: none; +} + +table.diff .diff-deletedline del, table.diff .diff-addedline ins { + text-decoration: none; +} + + +/*------------------------------------------------------------------------------ + 12.0 - Categories +------------------------------------------------------------------------------*/ + +.category-adder { + margin-left: 120px; + padding: 4px 0; +} + +.category-adder h4 { + margin: 0 0 8px; +} + +#side-sortables .category-adder { + margin: 0; +} + +#post-body .category-add input, .category-add select { + width: 30%; +} + +#side-sortables .category-add select { + width: 100%; +} + +#side-sortables .category-add input.category-add-sumbit, #post-body .category-add input.category-add input.category-add-sumbit { + width: auto; +} + +#post-body ul.category-tabs, +#post-body ul.add-menu-item-tabs { + float: left; + width: 120px; + text-align: right; + /* Negative margin for the sake of those without JS: all tabs display */ + margin: 0 -120px 0 5px; + padding: 0; +} + +#post-body ul.category-tabs li, +#post-body ul.add-menu-item-tabs li { + padding: 8px; +} + +#post-body ul.category-tabs li.tabs, +#post-body ul.add-menu-item-tabs li.tabs { + -moz-border-radius: 3px 0 0 3px; + -webkit-border-top-left-radius: 3px; + -webkit-border-bottom-left-radius: 3px; + -khtml-border-top-left-radius: 3px; + -khtml-border-bottom-left-radius: 3px; + border-top-left-radius: 3px; + border-bottom-left-radius: 3px; +} + +#post-body ul.category-tabs li.tabs a, +#post-body ul.add-menu-item-tabs li.tabs a { + font-weight: bold; + text-decoration: none; +} + +.categorydiv div.tabs-panel, +.customlinkdiv div.tabs-panel, +.posttypediv div.tabs-panel, +.taxonomydiv div.tabs-panel, +#linkcategorydiv div.tabs-panel { + height: 200px; + overflow: auto; + padding: 0.5em 0.9em; + border-style: solid; + border-width: 1px; +} + +.nav-menus-php .customlinkdiv div.tabs-panel, +.nav-menus-php .posttypediv div.tabs-panel, +.nav-menus-php .taxonomydiv div.tabs-panel { + height: auto; + max-height: 205px; +} + +div.tabs-panel-active { + display:block; +} + +div.tabs-panel-inactive { + display:none; +} + +#post-body .categorydiv div.tabs-panel, +.taxonomy div.tabs-panel, +#post-body #linkcategorydiv div.tabs-panel { + margin: 0 5px 0 125px; +} + +.categorydiv ul, +.customlinkdiv ul, +.posttypediv ul, +.taxonomydiv ul, +#linkcategorydiv ul { + list-style: none; + padding: 0; + margin: 0; +} + +#front-page-warning, +#front-static-pages ul, +ul.export-filters, +.inline-editor ul.cat-checklist ul, +.categorydiv ul.categorychecklist ul, +.customlinkdiv ul.categorychecklist ul, +.posttypediv ul.categorychecklist ul, +.taxonomydiv ul.categorychecklist ul, +#linkcategorydiv ul.categorychecklist ul { + margin-left: 18px; +} + +ul.categorychecklist li { + margin: 0; + padding: 0; + line-height: 19px; + word-wrap: break-word; +} + +.categorydiv .tabs-panel, +.customlinkdiv .tabs-panel, +.posttypediv .tabs-panel, +.taxonomydiv .tabs-panel { + border-width: 3px; + border-style: solid; +} + +ul.category-tabs, +ul.add-menu-item-tabs { + margin-top: 12px; +} + +ul.category-tabs li.tabs, +ul.add-menu-item-tabs li.tabs { + border-style: solid solid none; + border-width: 1px 1px 0; +} + +#post-body .category-tabs li.tabs, +#post-body .add-menu-item-tabs li.tabs { + border-style: solid none solid solid; + border-width: 1px 0 1px 1px; + margin-right: -1px; +} + +ul.category-tabs li, +ul.add-menu-item-tabs li { + padding: 5px; + -moz-border-radius: 3px 3px 0 0; + -webkit-border-top-left-radius: 3px; + -webkit-border-top-right-radius: 3px; + -khtml-border-top-left-radius: 3px; + -khtml-border-top-right-radius: 3px; + border-top-left-radius: 3px; + border-top-right-radius: 3px; +} + +.form-wrap { + margin: 10px 0; + width: 97%; +} + +.form-wrap p, +.form-wrap label { + font-size: 11px; +} + +.form-wrap label { + display: block; + padding: 2px; + font-size: 12px; +} + +.form-field input, +.form-field textarea { + border-style: solid; + border-width: 1px; + width: 95%; +} + +p.description, +.form-wrap p { + margin: 2px 0 5px; +} + +p.help, +p.description, +span.description, +.form-wrap p { + font-size: 12px; + font-style: italic; + font-family: sans-serif; +} + +.form-wrap .form-field { + margin: 0 0 10px; + padding: 8px; +} + +.col-wrap h3 { + margin: 12px 0; + font-size: 1.1em; +} + +.col-wrap p.submit { + margin-top: -10px; +} + + +/*------------------------------------------------------------------------------ + 13.0 - Tags +------------------------------------------------------------------------------*/ + +.taghint { + color: #aaa; + margin: 15px 0 -24px 12px; +} + +#poststuff .tagsdiv .howto { + margin: 0 0 6px 8px; +} + +.ajaxtag .newtag { + position: relative; +} + +.tagsdiv .newtag { + width: 180px; +} + +.tagsdiv .the-tags { + display: block; + height: 60px; + margin: 0 auto; + overflow: auto; + width: 260px; +} + +#post-body-content .tagsdiv .the-tags { + margin: 0 5px; +} + +p.popular-tags { + -moz-border-radius: 8px; + -khtml-border-radius: 8px; + -webkit-border-radius: 8px; + border-radius: 8px; + border-width: 1px; + border-style: solid; + line-height: 2em; + padding: 8px 12px 12px; + text-align: justify; +} + +p.popular-tags a { + padding: 0 3px; +} + +.tagcloud { + width: 97%; + margin: 0 0 40px; + text-align: justify; +} + +.tagcloud h3 { + margin: 2px 0 12px; +} + +.ac_results { + padding: 0; + margin: 0; + list-style: none; + position: absolute; + z-index: 10000; + display: none; + border-width: 1px; + border-style: solid; +} + +.ac_results li { + padding: 2px 5px; + white-space: nowrap; + text-align: left; +} + +.ac_over { + cursor: pointer; +} + +.ac_match { + text-decoration: underline; +} + + +/*------------------------------------------------------------------------------ + 14.0 - Media Screen +------------------------------------------------------------------------------*/ + +#wpbody-content #media-items .describe { + border-collapse: collapse; + width: 100%; + border-top-style: solid; + border-top-width: 1px; + clear: both; + cursor: default; + padding: 5px; +} + +#wpbody-content .describe th { + vertical-align: top; + text-align: left; + padding: 10px; + width: 140px; +} + +#wpbody-content .describe .media-item-info tr { + background-color: transparent; +} + +#wpbody-content .describe .media-item-info td { + padding: 4px 10px 0; +} + +.describe .media-item-info .A1B1 { + padding: 0 0 0 10px; +} + +#wpbody-content .filename { + padding: 0 10px; +} + +#wpbody-content .media-item .thumbnail { + max-height: 128px; + max-width: 128px; +} + +#wpbody-content #async-upload-wrap a { + display: none; +} + +.media-upload-form td label { + margin-right: 6px; + margin-left: 2px; +} + +.media-upload-form .align .field label { + display: inline; + padding: 0 0 0 22px; + margin: 0 1em 0 0; + font-weight: bold; +} + +.media-upload-form tr.image-size label { + margin: 0 0 0 3px; + font-weight: bold; +} + +.media-upload-form th.label label { + font-weight: bold; + margin: 0.5em; + font-size: 13px; +} + +.media-upload-form th.label label span { + padding: 0 5px; +} + +abbr.required { + border: medium none; + text-decoration: none; +} + +#wpbody-content .describe input[type="text"], +#wpbody-content .describe textarea { + width: 460px; +} + +#wpbody-content .describe p.help { + margin: 0; + padding: 0 0 0 5px; +} + +.media-item .error-div a.dismiss, +.describe-toggle-on, +.describe-toggle-off { + display: block; + line-height: 36px; + float: right; + margin-right: 20px; +} + +.describe-toggle-off { + display: none; +} + +#wpbody-content .media-item { + border-bottom-style: solid; + border-bottom-width: 1px; + min-height: 36px; + position: relative; + width: 100%; +} + +#wpbody-content .media-single .media-item { + border-bottom-style: none; + border-bottom-width: 0; +} + +#wpbody-content #media-items { + border-style: solid solid none; + border-width: 1px; + width: 670px; +} + +#wpbody-content #media-items .filename { + line-height: 36px; + overflow: hidden; +} + +.media-item .error-div { + padding-left: 10px; +} + +.media-item .pinkynail { + float: left; + margin: 2px; + max-width: 40px; + max-height: 32px; +} + +.media-item .startopen, +.media-item .startclosed { + display: none; +} + +.media-item .original { + position: relative; + height: 34px; + width: 503px; +} + +.media-item .percent { + font-weight: bold; +} + +.crunching { + display: block; + line-height: 32px; + text-align: right; + margin-right: 5px; +} + +.progress { + position: relative; + margin-bottom: -36px; + height: 36px; +} + +.bar { + width: 0; + height: 100%; + border-right-width: 3px; + border-right-style: solid; +} + +.upload-php .fixed .column-parent { + width: 25%; +} + + +/*------------------------------------------------------------------------------ + 14.1 - Media Uploader +------------------------------------------------------------------------------*/ + +.find-box { + width: 500px; + height: 300px; + overflow: hidden; + padding: 33px 5px 40px; + position: absolute; + z-index: 1000; +} + +.find-box-head { + cursor: move; + font-weight: bold; + height: 2em; + line-height: 2em; + padding: 1px 12px; + position: absolute; + top: 5px; + width: 100%; +} + +.find-box-inside { + overflow: auto; + width: 100%; + height: 100%; +} + +.find-box-search { + padding: 12px; + border-width: 1px; + border-style: none none solid; +} + +#find-posts-response { + margin: 8px 0; + padding: 0 1px; +} + +#find-posts-response table { + width: 100%; +} + +#find-posts-response .found-radio { + padding: 5px 0 0 8px; + width: 15px; +} + +.find-box-buttons { + width: 480px; + margin: 8px; +} + +.find-box-search label { + padding-right: 6px; +} + +.find-box #resize-se { + position: absolute; + right: 1px; + bottom: 1px; +} + +ul#dismissed-updates { + display: none; +} + +form.upgrade { + margin-top: 8px; +} + +form.upgrade .hint { + font-style: italic; + font-size: 85%; + margin: -0.5em 0 2em 0; +} + +#poststuff .inside .the-tagcloud { + margin: 5px 0 10px; + padding: 8px; + border-width: 1px; + border-style: solid; + line-height: 1.8em; + word-spacing: 3px; + -moz-border-radius: 6px; + -khtml-border-radius: 6px; + -webkit-border-radius: 6px; + border-radius: 6px; +} + +br.clear { + height: 2px; + line-height: 2px; +} + +.swfupload { + margin: 5px 10px; + vertical-align: middle; +} + + +/*------------------------------------------------------------------------------ + 14.2 - Image Editor +------------------------------------------------------------------------------*/ + +.describe .image-editor { + vertical-align: top; +} + +.imgedit-wrap { + position: relative; +} + +.imgedit-settings p { + margin: 8px 0; +} + +.describe .imgedit-wrap table td { + vertical-align: top; + padding-top: 0; +} + +.imgedit-wrap p, +.describe .imgedit-wrap table td { + font-size: 11px; + line-height: 18px; +} + +.describe .imgedit-wrap table td.imgedit-settings { + padding: 0 5px; +} + +td.imgedit-settings input { + vertical-align: middle; +} + +.imgedit-wait { + position: absolute; + top: 0; + background: #FFFFFF url(../images/wpspin_light.gif) no-repeat scroll 22px 10px; + opacity: 0.7; + filter: alpha(opacity=70); + width: 100%; + height: 500px; + display: none; +} + +.media-disabled, +.imgedit-settings .disabled { + color: grey; +} + +.imgedit-wait-spin { + padding: 0 4px 4px; + vertical-align: bottom; + visibility: hidden; +} + +.imgedit-menu { + margin: 0 0 12px; + min-width: 300px; +} + +.imgedit-menu div { + float: left; + width: 32px; + height: 32px; + -moz-border-radius: 3px; + -khtml-border-radius: 3px; + -webkit-border-radius: 3px; + border-radius: 3px; + border-width: 1px; + border-style: solid; +} + +.imgedit-crop-wrap { + position: relative; +} + +.imgedit-crop { + background: transparent url(../images/imgedit-icons.png) no-repeat scroll -9px -31px; + margin: 0 8px 0 0; +} + +.imgedit-crop.disabled:hover { + background-position: -9px -31px; +} + +.imgedit-crop:hover { + background-position: -9px -1px; +} + +.imgedit-rleft { + background: transparent url(../images/imgedit-icons.png) no-repeat scroll -46px -31px; + margin: 0 3px; +} + +.imgedit-rleft.disabled:hover { + background-position: -46px -31px; +} + +.imgedit-rleft:hover { + background-position: -46px -1px; +} + +.imgedit-rright { + background: transparent url(../images/imgedit-icons.png) no-repeat scroll -77px -31px; + margin: 0 8px 0 3px; +} + +.imgedit-rright.disabled:hover { + background-position: -77px -31px; +} + +.imgedit-rright:hover { + background-position: -77px -1px; +} + +.imgedit-flipv { + background: transparent url(../images/imgedit-icons.png) no-repeat scroll -115px -31px; + margin: 0 3px; +} + +.imgedit-flipv.disabled:hover { + background-position: -115px -31px; +} + +.imgedit-flipv:hover { + background-position: -115px -1px; +} + +.imgedit-fliph { + background: transparent url(../images/imgedit-icons.png) no-repeat scroll -147px -31px; + margin: 0 8px 0 3px; +} + +.imgedit-fliph.disabled:hover { + background-position: -147px -31px; +} + +.imgedit-fliph:hover { + background-position: -147px -1px; +} + +.imgedit-undo { + background: transparent url(../images/imgedit-icons.png) no-repeat scroll -184px -31px; + margin: 0 3px; +} + +.imgedit-undo.disabled:hover { + background-position: -184px -31px; +} + +.imgedit-undo:hover { + background-position: -184px -1px; +} + +.imgedit-redo { + background: transparent url(../images/imgedit-icons.png) no-repeat scroll -215px -31px; + margin: 0 8px 0 3px; +} + +.imgedit-redo.disabled:hover { + background-position: -215px -31px; +} + +.imgedit-redo:hover { + background-position: -215px -1px; +} + +.imgedit-applyto img { + margin: 0 8px 0 0; +} + +.imgedit-group-top { + margin: 5px 0; +} + +.imgedit-applyto .imgedit-label { + padding: 2px 0 0; + display: block; +} + +.imgedit-help { + display: none; + font-style: italic; + margin-bottom: 8px; +} + +.imgedit-help ul li { + font-size: 11px; +} + +a.imgedit-help-toggle { + text-decoration: none; +} + +#wpbody-content .imgedit-response div { + width: 600px; + margin: 8px; +} + +.form-table td.imgedit-response { + padding: 0; +} + +.imgedit-submit { + margin: 8px 0; +} + +.imgedit-submit-btn { + margin-left: 20px; +} + +.imgedit-wrap .nowrap { + white-space: nowrap; +} + +span.imgedit-scale-warn { + color: red; + font-size: 20px; + font-style: normal; + visibility: hidden; + vertical-align: middle; +} + +.imgedit-group { + border-width: 1px; + border-style: solid; + -moz-border-radius: 8px; + -khtml-border-radius: 8px; + -webkit-border-radius: 8px; + border-radius: 8px; + margin-bottom: 8px; + padding: 2px 10px; +} + + +/*------------------------------------------------------------------------------ + 15.0 - Comments Screen +------------------------------------------------------------------------------*/ + +.form-table { + border-collapse: collapse; + margin-top: 0.5em; + width: 100%; + margin-bottom: -8px; + clear: both; +} + +.form-table td { + margin-bottom: 9px; + padding: 8px 10px; + line-height: 20px; + font-size: 12px; +} + +.form-table th, +.form-wrap label { + font-weight: normal; + text-shadow: rgba(255,255,255,1) 0 1px 0; +} + +.form-table th { + vertical-align: top; + text-align: left; + padding: 10px; + width: 200px; +} + +.form-table th.th-full { + width: auto; +} + +.form-table div.color-option { + display: block; + clear: both; + margin-top: 12px; +} + +.form-table input.tog { + margin-top: 2px; + margin-right: 2px; + float: left; +} + +.form-table td p { + margin-top: 4px; +} + +.form-table table.color-palette { + vertical-align: bottom; + float: left; + margin: -12px 3px 11px; +} + +.form-table .color-palette td { + border-width: 1px 1px 0; + border-style: solid solid none; + height: 10px; + line-height: 20px; + width: 10px; +} + +.commentlist li { + padding: 1em 1em .2em; + margin: 0; + border-bottom-width: 1px; + border-bottom-style: solid; +} + +.commentlist li li { + border-bottom: 0; + padding: 0; +} + +.commentlist p { + padding: 0; + margin: 0 0 .8em; +} + +/* reply to comments */ +#replyrow { + font-size: 11px; +} + +#replyrow input { + border-width: 1px; + border-style: solid; +} + +#replyrow td { + padding: 2px; +} + +#replyrow #editorcontainer { + border: 0 none; +} + +#replysubmit { + margin: 0; + padding: 3px 7px; + text-align:center; +} + +#replysubmit img.waiting, +.inline-edit-save img.waiting { + padding: 4px 10px 0; + vertical-align: top; + float: right; +} + +#replysubmit .button { + margin-right: 5px; +} + +#replysubmit .error { + color:red; + line-height:21px; + text-align:center; + vertical-align:center; +} + +#replyrow #editor-toolbar { + display: none; +} + +#replyhead { + font-size: 12px; + font-weight: bold; + padding: 2px 10px 4px; +} + +#edithead .inside { + float: left; + padding: 3px 0 2px 5px; + margin: 0; + text-align: center; + font-size: 11px; +} + +#edithead .inside input { + width: 180px; + font-size: 11px; +} + +#edithead label { + padding: 2px 0; +} + +#replycontainer { + padding: 5px; + border: 0 none; + height: 120px; + overflow: hidden; + position: relative; +} + +#replycontent { + resize: none; + margin: 0; + width: 100%; + height: 100%; + padding: 0; + line-height: 150%; + border: 0 none; + outline: none; + font-size: 12px; +} + +#replyrow #ed_reply_toolbar { + margin: 0; + padding: 2px 3px; +} + +.comment-ays { + margin-bottom: 0; + border-style: solid; + border-width: 1px; +} + +.comment-ays th { + border-right-style: solid; + border-right-width: 1px; +} + +.trash-undo-inside, +.spam-undo-inside { + margin: 1px 8px 1px 0; + line-height: 16px; +} + +.spam-undo-inside .avatar, +.trash-undo-inside .avatar { + height: 20px; + width: 20px; + margin-right: 8px; + vertical-align: middle; +} + +.stuffbox .editcomment { + clear: none; +} + +#comment-status-radio p { + margin: 3px 0 5px; +} + +#comment-status-radio input { + margin: 2px 3px 5px 0; + vertical-align: middle; +} + +#comment-status-radio label { + padding: 5px 0; +} + +.commentlist .avatar { + vertical-align: text-top; +} + + +/*------------------------------------------------------------------------------ + 16.0 - Themes +------------------------------------------------------------------------------*/ + +.theme-install-php .tablenav { + height:auto; +} + +table#availablethemes { + border-spacing: 0; + border-width: 1px 0; + border-style: solid none; + margin: 10px auto; + width: 100%; +} + +table#availablethemes .no-items td{ + border-width:0; + padding:5px; +} + +td.available-theme { + vertical-align: top; + width: 240px; + margin: 0; + padding: 20px; + text-align: left; +} + +table#availablethemes td { + border-width: 0 1px 1px; + border-style: none solid solid; +} + +table#availablethemes td.right, +table#availablethemes td.left { + border-right: 0 none; + border-left: 0 none; +} + +table#availablethemes td.bottom { + border-bottom: 0 none; +} + +.available-theme a.screenshot { + width: 240px; + height: 180px; + display: block; + border-width: 1px; + border-style: solid; + margin-bottom: 10px; + overflow: hidden; +} + +.available-theme img { + width: 240px; +} + +.available-theme h3 { + margin: 15px 0 5px; +} + +#current-theme { + margin: 1em 0 1.5em; +} + +#current-theme a { + border-bottom: none; +} + +#current-theme h3 { + font-size: 17px; + font-weight: normal; + margin: 0; +} + +#current-theme .theme-description { + margin-top: 5px; +} + +#current-theme img { + float: left; + border-width: 1px; + border-style: solid; + margin-right: 1em; + margin-bottom: 1.5em; + width: 150px; +} + +.theme-options span { + text-transform: uppercase; + font-size: 13px; +} + +.theme-options a { + font-size: 15px; +} + +#TB_window #TB_title a.tb-theme-preview-link, +#TB_window #TB_title a.tb-theme-preview-link:visited { + font-weight: bold; + text-decoration: none; +} + +#TB_window #TB_title { + background-color: #222; + color: #cfcfcf; +} + +#broken-themes { + text-align: left; + width: 50%; + border-spacing: 3px; + padding: 3px; +} + +.theme-install-php h4 { + margin: 2.5em 0 8px; +} + + +/*------------------------------------------------------------------------------ + 16.1 - Custom Header Screen +------------------------------------------------------------------------------*/ + +.appearance_page_custom-header #headimg { + border: 1px solid #DFDFDF; + min-height: 100px; + width: 100%; +} + +.appearance_page_custom-header #upload-form p label { + font-size: 12px; +} + +.appearance_page_custom-header .available-headers .default-header { + float: left; + margin: 0 20px 20px 0; +} + +.appearance_page_custom-header .random-header { + clear: both; + margin: 0 20px 20px 0; + vertical-align: middle; +} + +.appearance_page_custom-header .available-headers label input, +.appearance_page_custom-header .random-header label input { + margin-right: 10px; +} + +.appearance_page_custom-header .available-headers label img { + vertical-align: middle; +} + + +/*------------------------------------------------------------------------------ + 16.2 - Custom Background Screen +------------------------------------------------------------------------------*/ + +div#custom-background-image { + min-height: 100px; + border: 1px solid #dfdfdf; +} + +div#custom-background-image img { + max-width: 400px; + max-height: 300px; +} + + +/*------------------------------------------------------------------------------ + 16.3 - Tabbed Admin Screen Interface (Experimental) +------------------------------------------------------------------------------*/ + +.nav-tab { + border-style: solid; + border-color: #dfdfdf #dfdfdf #fff; + border-width: 1px 1px 0; + color: #aaa; + text-shadow: rgba(255,255,255,1) 0 1px 0; + font-size: 12px; + line-height: 16px; + display: inline-block; + padding: 4px 14px 6px; + text-decoration: none; + margin: 0 6px -1px 0; + -moz-border-radius: 3px 3px 0 0; + -webkit-border-top-left-radius: 3px; + -webkit-border-top-right-radius: 3px; + -khtml-border-top-left-radius: 3px; + -khtml-border-top-right-radius: 3px; + border-top-left-radius: 3px; + border-top-right-radius: 3px; +} + +.nav-tab-active { + border-width: 1px; + color: #464646; +} + +.nav-tab:hover, +.nav-tab-active { + border-color: #ccc #ccc #fff; +} + +h2.nav-tab-wrapper, h3.nav-tab-wrapper { + border-bottom: 1px solid #ccc; + padding-bottom: 0; +} + +h2 .nav-tab { + padding: 4px 10px 6px; + font-family: "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", sans-serif; + font-weight: 200; + font-size: 20px; + line-height: 24px; + +} + + +/*------------------------------------------------------------------------------ + 17.0 - Plugins +------------------------------------------------------------------------------*/ + +.plugins .name, +#pass-strength-result.strong, +#pass-strength-result.short, +.button-highlighted, +input.button-highlighted, +#quicktags #ed_strong, +#ed_reply_toolbar #ed_reply_strong { + font-weight: bold; +} + +.plugins p { + margin: 0 4px; + padding: 0; +} + +.plugins .desc p { + margin: 0 0 8px; +} + +.plugins td.desc { + line-height: 1.5em; +} + +.plugins .desc ul, +.plugins .desc ol { + margin: 0 0 0 2em; +} + +.plugins .desc ul { + list-style-type: disc; +} + +.plugins .row-actions-visible { + padding: 0; +} + +.plugins tbody th.check-column { + padding: 7px 0; +} + +.plugins .inactive td, +.plugins .inactive th, +.plugins .active td, +.plugins .active th { + border-top-style: solid; + border-top-width: 1px; + padding: 5px 7px 0; +} + +#wpbody-content .plugins .plugin-title, #wpbody-content .plugins .theme-title { + padding-right: 12px; + white-space:nowrap; +} + +.plugins .second, .plugins .row-actions-visible { + padding: 0 0 5px; +} + +.plugins-php .widefat tfoot th, +.plugins-php .widefat tfoot td { + border-top-style: solid; + border-top-width: 1px; +} + +.plugin-update-tr .update-message { + margin: 5px; + padding: 3px 5px; + border-width: 1px; + border-style: solid; + -moz-border-radius: 3px; + -khtml-border-radius: 3px; + -webkit-border-radius: 3px; + border-radius: 3px; +} + +.plugin-install-php h4 { + margin: 2.5em 0 8px; +} + + +/*------------------------------------------------------------------------------ + 18.0 - Users +------------------------------------------------------------------------------*/ + +#profile-page .form-table textarea { + width: 500px; + margin-bottom: 6px; +} + +#profile-page .form-table #rich_editing { + margin-right: 5px +} + +#your-profile legend { + font-family: Georgia, "Times New Roman", "Bitstream Charter", Times, serif; + font-size: 22px; +} + +#your-profile #rich_editing { + border: none; +} + +#display_name { + width: 15em; +} + +#createuser .form-field input { + width: 25em; +} + +/*------------------------------------------------------------------------------ + 19.0 - Tools +------------------------------------------------------------------------------*/ + +.pressthis { + margin: 20px 0; +} + +.pressthis a { + display: inline-block; + width: 113px; + position: relative; + cursor: move; + color: #333; + background: #dfdfdf; + -webkit-gradient( + linear, + left bottom, + left top, + color-stop(0.07, rgb(230,230,230)), + color-stop(0.77, rgb(216,216,216)) + ); + -moz-linear-gradient( + center bottom, + rgb(230,230,230) 7%, + rgb(216,216,216) 77% + ); + background-repeat: no-repeat; + background-image-position: 10px 8px; + border-radius: 5px; + -webkit-border-radius: 5px; + -moz-border-radius: 5px; + -o-border-radius: 5px; + border: 1px #b4b4b4 solid; + font: normal normal normal 14px/16px Georgia, "Times New Roman", "Bitstream Charter", Times, serif; + text-decoration: none; + text-shadow: #fff 0 1px 0px; + -webkit-text-shadow: #fff 0 1px 0px; + -moz-text-shadow: #fff 0 1px 0px; + -o-text-shadow: #fff 0 1px 0px; +} + +.pressthis a:hover, +.pressthis a:active { + color: #333 +} + +.pressthis a:hover:after { + transform: skew(20deg) rotate(9deg); + -webkit-transform: skew(20deg) rotate(9deg); + -moz-transform: skew(20deg) rotate(9deg); + box-shadow: 0 10px 8px rgba(0, 0, 0, 0.7); + -webkit-box-shadow: 0 10px 8px rgba(0, 0, 0, 0.7); + -moz-box-shadow: 0 10px 8px rgba(0, 0, 0, 0.7); +} + +.pressthis a span { + background: url(../images/press-this.png) no-repeat -45px 5px ; + padding: 8px 0 8px 32px; + display: inline-block; +} + +.pressthis a:after { + content: ''; + width: 70%; + height: 55%; + z-index: -1; + position: absolute; + right: 10px; + bottom: 9px; + background: transparent; + transform: skew(20deg) rotate(6deg); + -webkit-transform: skew(20deg) rotate(6deg); + -moz-transform: skew(20deg) rotate(6deg); + box-shadow: 0 10px 8px rgba(0, 0, 0, 0.6); + -webkit-box-shadow: 0 10px 8px rgba(0, 0, 0, 0.6); + -moz-box-shadow: 0 10px 8px rgba(0, 0, 0, 0.6); +} + + +/*------------------------------------------------------------------------------ + 20.0 - Settings +------------------------------------------------------------------------------*/ + +#utc-time, #local-time { + padding-left: 25px; + font-style: italic; + font-family: sans-serif; +} + +.defaultavatarpicker .avatar { + margin: 2px 0; + vertical-align: middle; +} + + +/*------------------------------------------------------------------------------ + 21.0 - Admin Footer +------------------------------------------------------------------------------*/ + +#footer { + position: absolute; + bottom: 0; + left: 0; + right: 0; + padding: 10px 0; + margin-right: 20px; + border-top: 1px; + border-style: solid; +} + +#footer, +#footer a { + font-size: 12px; +} + +#footer p { + margin: 0; + line-height: 20px; +} + +#footer a { + text-decoration: none; +} + +#footer a:hover { + text-decoration: underline; +} + + +/*------------------------------------------------------------------------------ + 22.0 - Misc +------------------------------------------------------------------------------*/ + +#excerpt, .attachmentlinks { + margin: 0; + height: 4em; + width: 98%; +} + +#template div { + margin-right: 190px; +} + +p.pagenav { + margin: 0; + display: inline; +} + +.pagenav span { + font-weight: bold; + margin: 0 6px; +} + +.row-title { + font-size: 13px !important; + font-weight: bold; +} + +.column-author img, .column-username img { + float: left; + margin-right: 10px; + margin-top: 1px; +} + +.row-actions { + visibility: hidden; + padding: 2px 0 0; +} + +tr:hover .row-actions, +div.comment-item:hover .row-actions { + visibility: visible; +} + +.row-actions-visible { + padding: 2px 0 0; +} + +.form-table .pre { + padding: 8px; + margin: 0; +} + +table.form-table td .updated { + font-size: 13px; +} + + +.tagchecklist { + margin-left: 14px; + font-size: 12px; + overflow: auto; +} +.tagchecklist strong { + margin-left: -8px; + position: absolute; +} +.tagchecklist span { + margin-right: 25px; + display: block; + float: left; + font-size: 11px; + line-height: 1.8em; + white-space: nowrap; + cursor: default; +} +.tagchecklist span a { + margin: 6px 0pt 0pt -9px; + cursor: pointer; + width: 10px; + height: 10px; + display: block; + float: left; + text-indent: -9999px; + overflow: hidden; + position: absolute; +} + +#poststuff h2 { + margin-top: 20px; + font-size: 1.5em; + margin-bottom: 15px; + padding: 0 0 3px; + clear: left; +} + +#poststuff h3, +.metabox-holder h3 { + font-size: 15px; + font-family: Georgia, "Times New Roman", "Bitstream Charter", Times, serif; + font-weight: normal; + padding: 7px 10px; + margin: 0; + line-height: 1; +} + +#poststuff .inside, +#poststuff .inside p { + font-size: 12px; + margin: 6px 0 8px; +} + +#poststuff .inside .submitbox p { + margin: 1em 0; +} + +#post-visibility-select, #post-formats-select { + line-height: 1.5em; + margin-top: 3px; +} + +#poststuff #submitdiv .inside { + margin: 0; + padding: 0; +} + +#titlediv, #poststuff .postarea { + margin-bottom: 20px; +} + +td.post-title strong, td.plugin-title strong { + display: block; + margin-bottom: .2em; +} + +td.post-title p, td.plugin-title p { + margin: 6px 0; +} + +.wp-hidden-children .wp-hidden-child, +.ui-tabs-hide { + display: none; +} + +#templateside ul li a { + text-decoration: none; +} + +.tool-box { + margin: 15px 0 35px; +} +.tool-box .buttons { + margin: 15px 0; +} +.tool-box .title { + margin: 8px 0; + font: 18px/24px Georgia, "Times New Roman", "Bitstream Charter", Times, serif; +} + +.pressthis a { + font-size: 1.2em; +} + +#sidemenu { + margin: -30px 15px 0 315px; + list-style: none; + position: relative; + float: right; + padding-left: 10px; + font-size: 12px; +} + +#sidemenu a { + padding: 0 7px; + display: block; + float: left; + line-height: 28px; + border-top-width: 1px; + border-top-style: solid; + border-bottom-width: 1px; + border-bottom-style: solid; +} + +#sidemenu li { + display: inline; + line-height: 200%; + list-style: none; + text-align: center; + white-space: nowrap; + margin: 0; + padding: 0; +} + +#sidemenu a.current { + font-weight: normal; + padding-left: 6px; + padding-right: 6px; + -moz-border-radius: 3px 3px 0 0; + -webkit-border-top-left-radius: 3px; + -webkit-border-top-right-radius: 3px; + -khtml-border-top-left-radius: 3px; + -khtml-border-top-right-radius: 3px; + border-top-left-radius: 3px; + border-top-right-radius: 3px; + border-width: 1px; + border-style: solid; +} + +#sidemenu li a .count-0 { + display: none; +} + +#poststuff .inside .the-tagcloud { + margin: 5px 0 10px; + padding: 8px; + border-width: 1px; + border-style: solid; + line-height: 1.8em; + word-spacing: 3px; + -moz-border-radius: 3px; + -khtml-border-radius: 3px; + -webkit-border-radius: 3px; + border-radius: 3px; +} + +.plugin-install #description, .plugin-install-network #description { + width: 60%; +} + +table .vers, +table .column-visible, +table .column-rating { + text-align: left; +} + + +/* Scrollbar fix for bulk upgrade iframe */ +body.iframe { + height: 98%; +} + + +/*------------------------------------------------------------------------------ + 23.0 - Dead +------------------------------------------------------------------------------*/ + +/* - Not used anywhere in WordPress - verify and then deprecate +------------------------------------------------------------------------------*/ +.anchors { + margin: 10px 20px 10px 20px; +} + +div.nav { + height: 2em; + padding: 7px 10px; + vertical-align: text-top; + margin: 5px 0; +} + +.nav .button-secondary { + padding: 2px 4px; +} + +.settings-toggle { + text-align: right; + margin: 5px 7px 15px 0; + font-size: 12px; +} + +.settings-toggle h3 { + margin: 0; +} + +form#tags-filter { + position: relative; +} + +/* - Only used once or twice in all of WP - deprecate for global style +------------------------------------------------------------------------------*/ +td.media-icon { + text-align: center; + width: 80px; + padding-top: 8px; + padding-bottom: 8px; +} + +td.media-icon img { + max-width: 80px; + max-height: 60px; +} + +.screen-per-page { + width: 3em; +} + +.list-ajax-loading { + float: right; + margin-right: 9px; + margin-top: -1px; +} + +.tablenav .list-ajax-loading { + margin-top: 7px; +} + +#howto { + font-size: 11px; + margin: 0 5px; + display: block; +} + +.import-system {font-size: 16px;} +#namediv table { + width: 100%; +} + +#namediv td.first { + width: 10px; + white-space: nowrap; +} + +#namediv input { + width: 98%; +} + +#namediv p { + margin: 10px 0; +} + +#submitdiv h3 { + margin-bottom: 0 !important; +} + +/* - Used - but could/should be deprecated with a CSS reset +------------------------------------------------------------------------------*/ +.zerosize { + height: 0; + width: 0; + margin: 0; + border: 0; + padding: 0; + overflow: hidden; + position: absolute; +} + +br.clear { + height: 2px; + line-height: 2px; +} + +.checkbox { + border: none; + margin: 0; + padding: 0; +} + +#content { + margin: 0; + width: 100%; +} + +fieldset { + border: 0; + padding: 0; + margin: 0; +} + +.post-categories { + display: inline; + margin: 0; + padding: 0; +} + +.post-categories li { + display: inline; +} diff --git a/src/wp-admin/custom-background.php b/src/wp-admin/custom-background.php new file mode 100644 index 0000000..62ebacf --- /dev/null +++ b/src/wp-admin/custom-background.php @@ -0,0 +1,361 @@ +admin_header_callback = $admin_header_callback; + $this->admin_image_div_callback = $admin_image_div_callback; + } + + /** + * Set up the hooks for the Custom Background admin page. + * + * @since 3.0.0 + */ + function init() { + if ( ! current_user_can('edit_theme_options') ) + return; + + $this->page = $page = add_theme_page(__('Background'), __('Background'), 'edit_theme_options', 'custom-background', array(&$this, 'admin_page')); + + add_action("load-$page", array(&$this, 'admin_load')); + add_action("load-$page", array(&$this, 'take_action'), 49); + add_action("load-$page", array(&$this, 'handle_upload'), 49); + + if ( $this->admin_header_callback ) + add_action("admin_head-$page", $this->admin_header_callback, 51); + } + + /** + * Set up the enqueue for the CSS & JavaScript files. + * + * @since 3.0.0 + */ + function admin_load() { + add_contextual_help( $this->page, '

' . __( 'You can customize the look of your site without touching any of your theme’s code by using a custom background. Your background can be an image or a color.' ) . '

' . + '

' . __( 'To use a background image, simply upload it, then choose your display options below. You can display a single instance of your image, or tile it to fill the screen. You can have your background fixed in place, so your site content moves on top of it, or you can have it scroll with your site.' ) . '

' . + '

' . __( 'You can also choose a background color. If you know the hexadecimal code for the color you want, enter it in the Color field. If not, click on the Select a Color link, and a color picker will allow you to choose the exact shade you want.' ) . '

' . + '

' . __( 'Don’t forget to click on the Save Changes button when you are finished.' ) . '

' . + '

' . __( 'For more information:' ) . '

' . + '

' . __( 'Documentation on Custom Background' ) . '

' . + '

' . __( 'Support Forums' ) . '

' ); + wp_enqueue_script('custom-background'); + wp_enqueue_style('farbtastic'); + } + + /** + * Execute custom background modification. + * + * @since 3.0.0 + */ + function take_action() { + + if ( empty($_POST) ) + return; + + if ( isset($_POST['reset-background']) ) { + check_admin_referer('custom-background-reset', '_wpnonce-custom-background-reset'); + remove_theme_mod('background_image'); + remove_theme_mod('background_image_thumb'); + $this->updated = true; + return; + } + + if ( isset($_POST['remove-background']) ) { + // @TODO: Uploaded files are not removed here. + check_admin_referer('custom-background-remove', '_wpnonce-custom-background-remove'); + set_theme_mod('background_image', ''); + set_theme_mod('background_image_thumb', ''); + $this->updated = true; + return; + } + + if ( isset($_POST['background-repeat']) ) { + check_admin_referer('custom-background'); + if ( in_array($_POST['background-repeat'], array('repeat', 'no-repeat', 'repeat-x', 'repeat-y')) ) + $repeat = $_POST['background-repeat']; + else + $repeat = 'repeat'; + set_theme_mod('background_repeat', $repeat); + } + + if ( isset($_POST['background-position-x']) ) { + check_admin_referer('custom-background'); + if ( in_array($_POST['background-position-x'], array('center', 'right', 'left')) ) + $position = $_POST['background-position-x']; + else + $position = 'left'; + set_theme_mod('background_position_x', $position); + } + + if ( isset($_POST['background-attachment']) ) { + check_admin_referer('custom-background'); + if ( in_array($_POST['background-attachment'], array('fixed', 'scroll')) ) + $attachment = $_POST['background-attachment']; + else + $attachment = 'fixed'; + set_theme_mod('background_attachment', $attachment); + } + + if ( isset($_POST['background-color']) ) { + check_admin_referer('custom-background'); + $color = preg_replace('/[^0-9a-fA-F]/', '', $_POST['background-color']); + if ( strlen($color) == 6 || strlen($color) == 3 ) + set_theme_mod('background_color', $color); + else + set_theme_mod('background_color', ''); + } + + $this->updated = true; + } + + /** + * Display the custom background page. + * + * @since 3.0.0 + */ + function admin_page() { +?> +
+ +

+updated) ) { ?> +
+

Visit your site to see how it looks.' ), home_url( '/' ) ); ?>

+
+admin_image_div_callback ) { + call_user_func($this->admin_image_div_callback); + } else { +?> +

+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ +
+ + +
+ +
+
+ +
+ +
+
+
+ +
+ +
+
+
+ + + +
+
+ +

+
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + + +
+ + +
+ + + class="hide-if-no-js" id="clearcolor"> () + +
+ + + +
+ +
+ false); + $file = wp_handle_upload($_FILES['import'], $overrides); + + if ( isset($file['error']) ) + wp_die( $file['error'] ); + + $url = $file['url']; + $type = $file['type']; + $file = $file['file']; + $filename = basename($file); + + // Construct the object array + $object = array( + 'post_title' => $filename, + 'post_content' => $url, + 'post_mime_type' => $type, + 'guid' => $url, + 'context' => 'custom-background' + ); + + // Save the data + $id = wp_insert_attachment($object, $file); + + // Add the meta-data + wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $file ) ); + update_post_meta( $id, '_wp_attachment_is_custom_background', get_option('stylesheet' ) ); + + set_theme_mod('background_image', esc_url($url)); + + $thumbnail = wp_get_attachment_image_src( $id, 'thumbnail' ); + set_theme_mod('background_image_thumb', esc_url( $thumbnail[0] ) ); + + do_action('wp_create_file_in_uploads', $file, $id); // For replication + $this->updated = true; + } + +} +?> diff --git a/src/wp-admin/custom-header.php b/src/wp-admin/custom-header.php new file mode 100644 index 0000000..24ec9b8 --- /dev/null +++ b/src/wp-admin/custom-header.php @@ -0,0 +1,791 @@ +admin_header_callback = $admin_header_callback; + $this->admin_image_div_callback = $admin_image_div_callback; + } + + /** + * Set up the hooks for the Custom Header admin page. + * + * @since 2.1.0 + */ + function init() { + if ( ! current_user_can('edit_theme_options') ) + return; + + $this->page = $page = add_theme_page(__('Header'), __('Header'), 'edit_theme_options', 'custom-header', array(&$this, 'admin_page')); + + add_action("admin_print_scripts-$page", array(&$this, 'js_includes')); + add_action("admin_print_styles-$page", array(&$this, 'css_includes')); + add_action("admin_head-$page", array(&$this, 'help') ); + add_action("admin_head-$page", array(&$this, 'take_action'), 50); + add_action("admin_head-$page", array(&$this, 'js'), 50); + add_action("admin_head-$page", $this->admin_header_callback, 51); + } + + /** + * Adds contextual help. + * + * @since 3.0.0 + */ + function help() { + add_contextual_help( $this->page, '

' . __( 'You can set a custom image header for your site. Simply upload the image and crop it, and the new header will go live immediately.' ) . '

' . + '

' . __( 'If you want to discard your custom header and go back to the default included in your theme, click on the buttons to remove the custom image and restore the original header image.' ) . '

' . + '

' . __( 'Some themes come with additional header images bundled. If you see multiple images displayed, select the one you’d like and click the Save Changes button.' ) . '

' . + '

' . __( 'For more information:' ) . '

' . + '

' . __( 'Documentation on Custom Header' ) . '

' . + '

' . __( 'Support Forums' ) . '

' ); + } + + /** + * Get the current step. + * + * @since 2.6.0 + * + * @return int Current step + */ + function step() { + if ( ! isset( $_GET['step'] ) ) + return 1; + + $step = (int) $_GET['step']; + if ( $step < 1 || 3 < $step ) + $step = 1; + + return $step; + } + + /** + * Set up the enqueue for the JavaScript files. + * + * @since 2.1.0 + */ + function js_includes() { + $step = $this->step(); + + if ( ( 1 == $step || 3 == $step ) && $this->header_text() ) + wp_enqueue_script('farbtastic'); + elseif ( 2 == $step ) + wp_enqueue_script('imgareaselect'); + } + + /** + * Set up the enqueue for the CSS files + * + * @since 2.7 + */ + function css_includes() { + $step = $this->step(); + + if ( ( 1 == $step || 3 == $step ) && $this->header_text() ) + wp_enqueue_style('farbtastic'); + elseif ( 2 == $step ) + wp_enqueue_style('imgareaselect'); + } + + /** + * Check if header text is allowed + * + * @since 3.0.0 + */ + function header_text() { + if ( defined( 'NO_HEADER_TEXT' ) && NO_HEADER_TEXT ) + return false; + + return true; + } + + /** + * Execute custom header modification. + * + * @since 2.6.0 + */ + function take_action() { + if ( ! current_user_can('edit_theme_options') ) + return; + + if ( empty( $_POST ) ) + return; + + $this->updated = true; + + if ( isset( $_POST['resetheader'] ) ) { + check_admin_referer( 'custom-header-options', '_wpnonce-custom-header-options' ); + remove_theme_mod( 'header_image' ); + return; + } + + if ( isset( $_POST['resettext'] ) ) { + check_admin_referer( 'custom-header-options', '_wpnonce-custom-header-options' ); + remove_theme_mod('header_textcolor'); + return; + } + + if ( isset( $_POST['removeheader'] ) ) { + check_admin_referer( 'custom-header-options', '_wpnonce-custom-header-options' ); + set_theme_mod( 'header_image', 'remove-header' ); + return; + } + + if ( isset( $_POST['text-color'] ) ) { + check_admin_referer( 'custom-header-options', '_wpnonce-custom-header-options' ); + $_POST['text-color'] = str_replace( '#', '', $_POST['text-color'] ); + if ( 'blank' == $_POST['text-color'] ) { + set_theme_mod( 'header_textcolor', 'blank' ); + } else { + $color = preg_replace('/[^0-9a-fA-F]/', '', $_POST['text-color']); + if ( strlen($color) == 6 || strlen($color) == 3 ) + set_theme_mod('header_textcolor', $color); + } + } + + if ( isset( $_POST['default-header'] ) ) { + check_admin_referer( 'custom-header-options', '_wpnonce-custom-header-options' ); + if ( 'random-default-image' == $_POST['default-header'] ) { + set_theme_mod( 'header_image', 'random-default-image' ); + } elseif ( 'random-uploaded-image' == $_POST['default-header'] ) { + set_theme_mod( 'header_image', 'random-uploaded-image' ); + } else { + $this->process_default_headers(); + $uploaded = get_uploaded_header_images(); + if ( isset( $uploaded[$_POST['default-header']] ) ) + set_theme_mod( 'header_image', esc_url( $uploaded[$_POST['default-header']]['url'] ) ); + elseif ( isset( $this->default_headers[$_POST['default-header']] ) ) + set_theme_mod( 'header_image', esc_url( $this->default_headers[$_POST['default-header']]['url'] ) ); + } + } + } + + /** + * Process the default headers + * + * @since 3.0.0 + */ + function process_default_headers() { + global $_wp_default_headers; + + if ( !empty($this->headers) ) + return; + + if ( !isset($_wp_default_headers) ) + return; + + $this->default_headers = $_wp_default_headers; + foreach ( array_keys($this->default_headers) as $header ) { + $this->default_headers[$header]['url'] = sprintf( $this->default_headers[$header]['url'], get_template_directory_uri(), get_stylesheet_directory_uri() ); + $this->default_headers[$header]['thumbnail_url'] = sprintf( $this->default_headers[$header]['thumbnail_url'], get_template_directory_uri(), get_stylesheet_directory_uri() ); + } + + } + + /** + * Display UI for selecting one of several default headers. + * + * Show the random image option if this theme has multiple header images. + * Random image option is on by default if no header has been set. + * + * @since 3.0.0 + */ + function show_header_selector( $type = 'default' ) { + if ( 'default' == $type ) { + $headers = $this->default_headers; + } else { + $headers = get_uploaded_header_images(); + $type = 'uploaded'; + } + + if ( 1 < count( $headers ) ) { + echo '
'; + echo ''; + echo '
'; + } + + echo '
'; + foreach ( $headers as $header_key => $header ) { + $header_thumbnail = $header['thumbnail_url']; + $header_url = $header['url']; + $header_desc = empty( $header['description'] ) ? '' : $header['description']; + echo '
'; + echo ''; + echo '
'; + } + echo '
'; + } + + /** + * Execute Javascript depending on step. + * + * @since 2.1.0 + */ + function js() { + $step = $this->step(); + if ( ( 1 == $step || 3 == $step ) && $this->header_text() ) + $this->js_1(); + elseif ( 2 == $step ) + $this->js_2(); + } + + /** + * Display Javascript based on Step 1 and 3. + * + * @since 2.6.0 + */ + function js_1() { ?> + + + +process_default_headers(); +?> + +
+ +

+ +updated ) ) { ?> +
+

Visit your site to see how it looks.' ), home_url( '/' ) ); ?>

+
+ + + + + + + + + + + + + + + + + +
+ admin_image_div_callback ) { + call_user_func( $this->admin_image_div_callback ); + } else { + ?> +
+ header_text() ) + $style = ' style="display:none;"'; + else + $style = ' style="color:#' . get_theme_mod( 'header_textcolor', HEADER_TEXTCOLOR ) . ';"'; + ?> +

onclick="return false;" href="">

+
>
+
+ +
+


+ %1$d × %2$d pixels will be used as-is.' ), HEADER_IMAGE_WIDTH, HEADER_IMAGE_HEIGHT ); ?>

+
+

+
+ + + + +

+
+
+ +
+ + + + + + + + default_headers ) ) : ?> + + + + + + + + + + + + + + + + +
+

+ show_header_selector( 'uploaded' ); + ?> +
+ +

+ +

+ + show_header_selector( 'default' ); + ?> +
+

+ +
+

+ +
+ + header_text() ) : ?> + + + + + + + + + + + + + + + + + + + + +
+

+ + + +

+
+

+ + #blank as text color.' );?> + +

+ +
+

+ +
+ + + +
+
+ + false); + $file = wp_handle_upload($_FILES['import'], $overrides); + + if ( isset($file['error']) ) + wp_die( $file['error'], __( 'Image Upload Error' ) ); + + $url = $file['url']; + $type = $file['type']; + $file = $file['file']; + $filename = basename($file); + + // Construct the object array + $object = array( + 'post_title' => $filename, + 'post_content' => $url, + 'post_mime_type' => $type, + 'guid' => $url, + 'context' => 'custom-header' + ); + + // Save the data + $id = wp_insert_attachment($object, $file); + + list($width, $height, $type, $attr) = getimagesize( $file ); + + if ( $width == HEADER_IMAGE_WIDTH && $height == HEADER_IMAGE_HEIGHT ) { + // Add the meta-data + wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $file ) ); + update_post_meta( $id, '_wp_attachment_is_custom_header', get_option('stylesheet' ) ); + + set_theme_mod('header_image', esc_url($url)); + do_action('wp_create_file_in_uploads', $file, $id); // For replication + return $this->finished(); + } elseif ( $width > HEADER_IMAGE_WIDTH ) { + $oitar = $width / HEADER_IMAGE_WIDTH; + $image = wp_crop_image($file, 0, 0, $width, $height, HEADER_IMAGE_WIDTH, $height / $oitar, false, str_replace(basename($file), 'midsize-'.basename($file), $file)); + if ( is_wp_error( $image ) ) + wp_die( __( 'Image could not be processed. Please go back and try again.' ), __( 'Image Processing Error' ) ); + + $image = apply_filters('wp_create_file_in_uploads', $image, $id); // For replication + + $url = str_replace(basename($url), basename($image), $url); + $width = $width / $oitar; + $height = $height / $oitar; + } else { + $oitar = 1; + } + ?> + +
+ +

+ +
+

+

+ +
+ +
+ + + + + + + + + + +

+
+
+ 1 ) { + $_POST['x1'] = $_POST['x1'] * $_POST['oitar']; + $_POST['y1'] = $_POST['y1'] * $_POST['oitar']; + $_POST['width'] = $_POST['width'] * $_POST['oitar']; + $_POST['height'] = $_POST['height'] * $_POST['oitar']; + } + + $attachment_id = absint( $_POST['attachment_id'] ); + $original = get_attached_file($attachment_id); + + $cropped = wp_crop_image( $attachment_id, (int) $_POST['x1'], (int) $_POST['y1'], (int) $_POST['width'], (int) $_POST['height'], HEADER_IMAGE_WIDTH, HEADER_IMAGE_HEIGHT ); + if ( is_wp_error( $cropped ) ) + wp_die( __( 'Image could not be processed. Please go back and try again.' ), __( 'Image Processing Error' ) ); + + $cropped = apply_filters('wp_create_file_in_uploads', $cropped, $attachment_id); // For replication + + $parent = get_post($attachment_id); + $parent_url = $parent->guid; + $url = str_replace(basename($parent_url), basename($cropped), $parent_url); + + // Construct the object array + $object = array( + 'ID' => $attachment_id, + 'post_title' => basename($cropped), + 'post_content' => $url, + 'post_mime_type' => 'image/jpeg', + 'guid' => $url, + 'context' => 'custom-header' + ); + + // Update the attachment + wp_insert_attachment($object, $cropped); + wp_update_attachment_metadata( $attachment_id, wp_generate_attachment_metadata( $attachment_id, $cropped ) ); + update_post_meta( $attachment_id, '_wp_attachment_is_custom_header', get_option('stylesheet' ) ); + + set_theme_mod('header_image', $url); + + // cleanup + $medium = str_replace(basename($original), 'midsize-'.basename($original), $original); + @unlink( apply_filters( 'wp_delete_file', $medium ) ); + @unlink( apply_filters( 'wp_delete_file', $original ) ); + + return $this->finished(); + } + + /** + * Display last step of custom header image page. + * + * @since 2.1.0 + */ + function finished() { + $this->updated = true; + $this->step_1(); + } + + /** + * Display the page based on the current step. + * + * @since 2.1.0 + */ + function admin_page() { + if ( ! current_user_can('edit_theme_options') ) + wp_die(__('You do not have permission to customize headers.')); + $step = $this->step(); + if ( 1 == $step ) + $this->step_1(); + elseif ( 2 == $step ) + $this->step_2(); + elseif ( 3 == $step ) + $this->step_3(); + } + +} +?> diff --git a/src/wp-admin/edit-comments.php b/src/wp-admin/edit-comments.php new file mode 100644 index 0000000..cce196b --- /dev/null +++ b/src/wp-admin/edit-comments.php @@ -0,0 +1,242 @@ +get_pagenum(); + +$doaction = $wp_list_table->current_action(); + +if ( $doaction ) { + check_admin_referer( 'bulk-comments' ); + + if ( 'delete_all' == $doaction && !empty( $_REQUEST['pagegen_timestamp'] ) ) { + $comment_status = $wpdb->escape( $_REQUEST['comment_status'] ); + $delete_time = $wpdb->escape( $_REQUEST['pagegen_timestamp'] ); + $comment_ids = $wpdb->get_col( "SELECT comment_ID FROM $wpdb->comments WHERE comment_approved = '$comment_status' AND '$delete_time' > comment_date_gmt" ); + $doaction = 'delete'; + } elseif ( isset( $_REQUEST['delete_comments'] ) ) { + $comment_ids = $_REQUEST['delete_comments']; + $doaction = ( $_REQUEST['action'] != -1 ) ? $_REQUEST['action'] : $_REQUEST['action2']; + } elseif ( isset( $_REQUEST['ids'] ) ) { + $comment_ids = array_map( 'absint', explode( ',', $_REQUEST['ids'] ) ); + } elseif ( wp_get_referer() ) { + wp_redirect( wp_get_referer() ); + exit; + } + + $approved = $unapproved = $spammed = $unspammed = $trashed = $untrashed = $deleted = 0; + + $redirect_to = remove_query_arg( array( 'trashed', 'untrashed', 'deleted', 'spammed', 'unspammed', 'approved', 'unapproved', 'ids' ), wp_get_referer() ); + $redirect_to = add_query_arg( 'paged', $pagenum, $redirect_to ); + + foreach ( $comment_ids as $comment_id ) { // Check the permissions on each + if ( !current_user_can( 'edit_comment', $comment_id ) ) + continue; + + switch ( $doaction ) { + case 'approve' : + wp_set_comment_status( $comment_id, 'approve' ); + $approved++; + break; + case 'unapprove' : + wp_set_comment_status( $comment_id, 'hold' ); + $unapproved++; + break; + case 'spam' : + wp_spam_comment( $comment_id ); + $spammed++; + break; + case 'unspam' : + wp_unspam_comment( $comment_id ); + $unspammed++; + break; + case 'trash' : + wp_trash_comment( $comment_id ); + $trashed++; + break; + case 'untrash' : + wp_untrash_comment( $comment_id ); + $untrashed++; + break; + case 'delete' : + wp_delete_comment( $comment_id ); + $deleted++; + break; + } + } + + if ( $approved ) + $redirect_to = add_query_arg( 'approved', $approved, $redirect_to ); + if ( $unapproved ) + $redirect_to = add_query_arg( 'unapproved', $unapproved, $redirect_to ); + if ( $spammed ) + $redirect_to = add_query_arg( 'spammed', $spammed, $redirect_to ); + if ( $unspammed ) + $redirect_to = add_query_arg( 'unspammed', $unspammed, $redirect_to ); + if ( $trashed ) + $redirect_to = add_query_arg( 'trashed', $trashed, $redirect_to ); + if ( $untrashed ) + $redirect_to = add_query_arg( 'untrashed', $untrashed, $redirect_to ); + if ( $deleted ) + $redirect_to = add_query_arg( 'deleted', $deleted, $redirect_to ); + if ( $trashed || $spammed ) + $redirect_to = add_query_arg( 'ids', join( ',', $comment_ids ), $redirect_to ); + + wp_redirect( $redirect_to ); + exit; +} elseif ( ! empty( $_GET['_wp_http_referer'] ) ) { + wp_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce' ), stripslashes( $_SERVER['REQUEST_URI'] ) ) ); + exit; +} + +$wp_list_table->prepare_items(); + +wp_enqueue_script('admin-comments'); +enqueue_comment_hotkeys_js(); + +if ( $post_id ) + $title = sprintf(__('Comments on “%s”'), wp_html_excerpt(_draft_or_post_title($post_id), 50)); +else + $title = __('Comments'); + +add_screen_option( 'per_page', array('label' => _x( 'Comments', 'comments per page (screen options)' )) ); + +add_contextual_help( $current_screen, '

' . __( 'You can manage comments made on your site similar to the way you manage Posts and other content. This screen is customizable in the same ways as other management screens, and you can act on comments using the on-hover action links or the Bulk Actions.' ) . '

' . + '

' . __( 'A yellow row means the comment is waiting for you to moderate it.' ) . '

' . + '

' . __( 'In the Author column, in addition to the author’s name, email address, and blog URL, the commenter’s IP address is shown. Clicking on this link will show you all the comments made from this IP address.' ) . '

' . + '

' . __( 'In the Comment column, above each comment it says “Submitted on,” followed by the date and time the comment was left on your site. Clicking on the date/time link will take you to that comment on your live site. Hovering over any comment gives you options to approve, reply (and approve), quick edit, edit, spam mark, or trash that comment.' ) . '

' . + '

' . __( 'In the In Response To column, there are three elements. The text is the name of the post that inspired the comment, and links to the post editor for that entry. The “#” permalink symbol below leads to that post on your live site. The small bubble with the number in it shows how many comments that post has received. If the bubble is gray, you have moderated all comments for that post. If it is blue, there are pending comments. Clicking the bubble will filter the comments screen to show only comments on that post.' ) . '

' . + '

' . __( 'Many people take advantage of keyboard shortcuts to moderate their comments more quickly. Use the link below to learn more.' ) . '

' . + '

' . __( 'For more information:' ) . '

' . + '

' . __( 'Documentation on Comments' ) . '

' . + '

' . __( 'Documentation on Comment Spam' ) . '

' . + '

' . __( 'Documentation on Keyboard Shortcuts' ) . '

' . + '

' . __( 'Support Forums' ) . '

' +); +require_once('./admin-header.php'); +?> + +
+ +

%s', + get_edit_post_link($post_id), + wp_html_excerpt(_draft_or_post_title($post_id), 50) + ) + ); +else + echo __('Comments'); + +if ( isset($_REQUEST['s']) && $_REQUEST['s'] ) + printf( '' . sprintf( __( 'Search results for “%s”' ), wp_html_excerpt( esc_html( stripslashes( $_REQUEST['s'] ) ), 50 ) ) . '' ); ?> +

+ +

' . $error_msg . '

'; +} + +if ( isset($_REQUEST['approved']) || isset($_REQUEST['deleted']) || isset($_REQUEST['trashed']) || isset($_REQUEST['untrashed']) || isset($_REQUEST['spammed']) || isset($_REQUEST['unspammed']) || isset($_REQUEST['same']) ) { + $approved = isset( $_REQUEST['approved'] ) ? (int) $_REQUEST['approved'] : 0; + $deleted = isset( $_REQUEST['deleted'] ) ? (int) $_REQUEST['deleted'] : 0; + $trashed = isset( $_REQUEST['trashed'] ) ? (int) $_REQUEST['trashed'] : 0; + $untrashed = isset( $_REQUEST['untrashed'] ) ? (int) $_REQUEST['untrashed'] : 0; + $spammed = isset( $_REQUEST['spammed'] ) ? (int) $_REQUEST['spammed'] : 0; + $unspammed = isset( $_REQUEST['unspammed'] ) ? (int) $_REQUEST['unspammed'] : 0; + $same = isset( $_REQUEST['same'] ) ? (int) $_REQUEST['same'] : 0; + + if ( $approved > 0 || $deleted > 0 || $trashed > 0 || $untrashed > 0 || $spammed > 0 || $unspammed > 0 || $same > 0 ) { + if ( $approved > 0 ) + $messages[] = sprintf( _n( '%s comment approved', '%s comments approved', $approved ), $approved ); + + if ( $spammed > 0 ) { + $ids = isset($_REQUEST['ids']) ? $_REQUEST['ids'] : 0; + $messages[] = sprintf( _n( '%s comment marked as spam.', '%s comments marked as spam.', $spammed ), $spammed ) . ' ' . __('Undo') . '
'; + } + + if ( $unspammed > 0 ) + $messages[] = sprintf( _n( '%s comment restored from the spam', '%s comments restored from the spam', $unspammed ), $unspammed ); + + if ( $trashed > 0 ) { + $ids = isset($_REQUEST['ids']) ? $_REQUEST['ids'] : 0; + $messages[] = sprintf( _n( '%s comment moved to the Trash.', '%s comments moved to the Trash.', $trashed ), $trashed ) . ' ' . __('Undo') . '
'; + } + + if ( $untrashed > 0 ) + $messages[] = sprintf( _n( '%s comment restored from the Trash', '%s comments restored from the Trash', $untrashed ), $untrashed ); + + if ( $deleted > 0 ) + $messages[] = sprintf( _n( '%s comment permanently deleted', '%s comments permanently deleted', $deleted ), $deleted ); + + if ( $same > 0 && $comment = get_comment( $same ) ) { + switch ( $comment->comment_approved ) { + case '1' : + $messages[] = __('This comment is already approved.') . ' ' . __( 'Edit comment' ) . ''; + break; + case 'trash' : + $messages[] = __( 'This comment is already in the Trash.' ) . ' ' . __( 'View Trash' ) . ''; + break; + case 'spam' : + $messages[] = __( 'This comment is already marked as spam.' ) . ' ' . __( 'Edit comment' ) . ''; + break; + } + } + + echo '

' . implode( "
\n", $messages ) . '

'; + } +} +?> + +views(); ?> + +
+ +search_box( __( 'Search Comments' ), 'comment' ); ?> + + + + + + + + + + + + + + + +display(); ?> +
+
+ +
+ + diff --git a/src/wp-admin/edit-form-advanced.php b/src/wp-admin/edit-form-advanced.php new file mode 100644 index 0000000..aed7b64 --- /dev/null +++ b/src/wp-admin/edit-form-advanced.php @@ -0,0 +1,315 @@ + '', // Unused. Messages start at index 1. + 1 => sprintf( __('Post updated. View post'), esc_url( get_permalink($post_ID) ) ), + 2 => __('Custom field updated.'), + 3 => __('Custom field deleted.'), + 4 => __('Post updated.'), + /* translators: %s: date and time of the revision */ + 5 => isset($_GET['revision']) ? sprintf( __('Post restored to revision from %s'), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false, + 6 => sprintf( __('Post published. View post'), esc_url( get_permalink($post_ID) ) ), + 7 => __('Post saved.'), + 8 => sprintf( __('Post submitted. Preview post'), esc_url( add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ) ), + 9 => sprintf( __('Post scheduled for: %1$s. Preview post'), + // translators: Publish box date format, see http://php.net/date + date_i18n( __( 'M j, Y @ G:i' ), strtotime( $post->post_date ) ), esc_url( get_permalink($post_ID) ) ), + 10 => sprintf( __('Post draft updated. Preview post'), esc_url( add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ) ), +); +$messages['page'] = array( + 0 => '', // Unused. Messages start at index 1. + 1 => sprintf( __('Page updated. View page'), esc_url( get_permalink($post_ID) ) ), + 2 => __('Custom field updated.'), + 3 => __('Custom field deleted.'), + 4 => __('Page updated.'), + 5 => isset($_GET['revision']) ? sprintf( __('Page restored to revision from %s'), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false, + 6 => sprintf( __('Page published. View page'), esc_url( get_permalink($post_ID) ) ), + 7 => __('Page saved.'), + 8 => sprintf( __('Page submitted. Preview page'), esc_url( add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ) ), + 9 => sprintf( __('Page scheduled for: %1$s. Preview page'), date_i18n( __( 'M j, Y @ G:i' ), strtotime( $post->post_date ) ), esc_url( get_permalink($post_ID) ) ), + 10 => sprintf( __('Page draft updated. Preview page'), esc_url( add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ) ), +); + +$messages = apply_filters( 'post_updated_messages', $messages ); + +$message = false; +if ( isset($_GET['message']) ) { + $_GET['message'] = absint( $_GET['message'] ); + if ( isset($messages[$post_type][$_GET['message']]) ) + $message = $messages[$post_type][$_GET['message']]; + elseif ( !isset($messages[$post_type]) && isset($messages['post'][$_GET['message']]) ) + $message = $messages['post'][$_GET['message']]; +} + +$notice = false; +$form_extra = ''; +if ( 'auto-draft' == $post->post_status ) { + if ( 'edit' == $action ) + $post->post_title = ''; + $autosave = false; + $form_extra .= ""; +} else { + $autosave = wp_get_post_autosave( $post_ID ); +} + +$form_action = 'editpost'; +$nonce_action = 'update-' . $post_type . '_' . $post_ID; +$form_extra .= ""; + +// Detect if there exists an autosave newer than the post and if that autosave is different than the post +if ( $autosave && mysql2date( 'U', $autosave->post_modified_gmt, false ) > mysql2date( 'U', $post->post_modified_gmt, false ) ) { + foreach ( _wp_post_revision_fields() as $autosave_field => $_autosave_field ) { + if ( normalize_whitespace( $autosave->$autosave_field ) != normalize_whitespace( $post->$autosave_field ) ) { + $notice = sprintf( __( 'There is an autosave of this post that is more recent than the version below. View the autosave' ), get_edit_post_link( $autosave->ID ) ); + break; + } + } + unset($autosave_field, $_autosave_field); +} + +$post_type_object = get_post_type_object($post_type); + +// All meta boxes should be defined and added before the first do_meta_boxes() call (or potentially during the do_meta_boxes action). +require_once('./includes/meta-boxes.php'); + +add_meta_box('submitdiv', __('Publish'), 'post_submit_meta_box', $post_type, 'side', 'core'); + +if ( current_theme_supports( 'post-formats' ) && post_type_supports( $post_type, 'post-formats' ) ) + add_meta_box( 'formatdiv', _x( 'Format', 'post format' ), 'post_format_meta_box', $post_type, 'side', 'core' ); + +// all taxonomies +foreach ( get_object_taxonomies($post_type) as $tax_name ) { + $taxonomy = get_taxonomy($tax_name); + if ( ! $taxonomy->show_ui ) + continue; + + $label = $taxonomy->labels->name; + + if ( !is_taxonomy_hierarchical($tax_name) ) + add_meta_box('tagsdiv-' . $tax_name, $label, 'post_tags_meta_box', $post_type, 'side', 'core', array( 'taxonomy' => $tax_name )); + else + add_meta_box($tax_name . 'div', $label, 'post_categories_meta_box', $post_type, 'side', 'core', array( 'taxonomy' => $tax_name )); +} + +if ( post_type_supports($post_type, 'page-attributes') ) + add_meta_box('pageparentdiv', 'page' == $post_type ? __('Page Attributes') : __('Attributes'), 'page_attributes_meta_box', $post_type, 'side', 'core'); + +if ( current_theme_supports( 'post-thumbnails', $post_type ) && post_type_supports( $post_type, 'thumbnail' ) + && ( ! is_multisite() || ( ( $mu_media_buttons = get_site_option( 'mu_media_buttons', array() ) ) && ! empty( $mu_media_buttons['image'] ) ) ) ) + add_meta_box('postimagediv', __('Featured Image'), 'post_thumbnail_meta_box', $post_type, 'side', 'low'); + +if ( post_type_supports($post_type, 'excerpt') ) + add_meta_box('postexcerpt', __('Excerpt'), 'post_excerpt_meta_box', $post_type, 'normal', 'core'); + +if ( post_type_supports($post_type, 'trackbacks') ) + add_meta_box('trackbacksdiv', __('Send Trackbacks'), 'post_trackback_meta_box', $post_type, 'normal', 'core'); + +if ( post_type_supports($post_type, 'custom-fields') ) + add_meta_box('postcustom', __('Custom Fields'), 'post_custom_meta_box', $post_type, 'normal', 'core'); + +do_action('dbx_post_advanced'); +if ( post_type_supports($post_type, 'comments') ) + add_meta_box('commentstatusdiv', __('Discussion'), 'post_comment_status_meta_box', $post_type, 'normal', 'core'); + +if ( ('publish' == $post->post_status || 'private' == $post->post_status) && post_type_supports($post_type, 'comments') ) + add_meta_box('commentsdiv', __('Comments'), 'post_comment_meta_box', $post_type, 'normal', 'core'); + +if ( !( 'pending' == $post->post_status && !current_user_can( $post_type_object->cap->publish_posts ) ) ) + add_meta_box('slugdiv', __('Slug'), 'post_slug_meta_box', $post_type, 'normal', 'core'); + +if ( post_type_supports($post_type, 'author') ) { + if ( is_super_admin() || current_user_can( $post_type_object->cap->edit_others_posts ) ) + add_meta_box('authordiv', __('Author'), 'post_author_meta_box', $post_type, 'normal', 'core'); +} + +if ( post_type_supports($post_type, 'revisions') && 0 < $post_ID && wp_get_post_revisions( $post_ID ) ) + add_meta_box('revisionsdiv', __('Revisions'), 'post_revisions_meta_box', $post_type, 'normal', 'core'); + +do_action('add_meta_boxes', $post_type, $post); +do_action('add_meta_boxes_' . $post_type, $post); + +do_action('do_meta_boxes', $post_type, 'normal', $post); +do_action('do_meta_boxes', $post_type, 'advanced', $post); +do_action('do_meta_boxes', $post_type, 'side', $post); + +add_screen_option('layout_columns', array('max' => 2) ); + +if ( 'post' == $post_type ) { + add_contextual_help($current_screen, + '

' . __('The title field and the big Post Editing Area are fixed in place, but you can reposition all the other boxes using drag and drop, and can minimize or expand them by clicking the title bar of each box. Use the Screen Options tab to unhide more boxes (Excerpt, Send Trackbacks, Custom Fields, Discussion, Slug, Author) or to choose a 1- or 2-column layout for this screen.') . '

' . + '

' . __('Title - Enter a title for your post. After you enter a title, you’ll see the permalink below, which you can edit.') . '

' . + '

' . __('Post editor - Enter the text for your post. There are two modes of editing: Visual and HTML. Choose the mode by clicking on the appropriate tab. Visual mode gives you a WYSIWYG editor. Click the last icon in the row to get a second row of controls. The HTML mode allows you to enter raw HTML along with your post text. You can insert media files by clicking the icons above the post editor and following the directions. You can go the distraction-free writing screen, new in 3.2, via the Fullscreen icon in Visual mode (second to last in the top row) or the Fullscreen button in HTML mode (last in the row). Once there, you can make buttons visible by hovering over the top area. Exit Fullscreen back to the regular post editor.') . '

' . + '

' . __('Publish - You can set the terms of publishing your post in the Publish box. For Status, Visibility, and Publish (immediately), click on the Edit link to reveal more options. Visibility includes options for password-protecting a post or making it stay at the top of your blog indefinitely (sticky). Publish (immediately) allows you to set a future or past date and time, so you can schedule a post to be published in the future or backdate a post.') . '

' . + ( ( current_theme_supports( 'post-formats' ) && post_type_supports( 'post', 'post-formats' ) ) ? '

' . __( 'Post Format - This designates how your theme will display a specific post. For example, you could have a standard blog post with a title and paragraphs, or a short aside that omits the title and contains a short text blurb. Please refer to the Codex for descriptions of each post format. Your theme could enable all or some of 10 possible formats.' ) . '

' : '' ) . + '

' . __('Featured Image - This allows you to associate an image with your post without inserting it. This is usually useful only if your theme makes use of the featured image as a post thumbnail on the home page, a custom header, etc.') . '

' . + '

' . __('Send Trackbacks - Trackbacks are a way to notify legacy blog systems that you’ve linked to them. Enter the URL(s) you want to send trackbacks. If you link to other WordPress sites they’ll be notified automatically using pingbacks, and this field is unnecessary.') . '

' . + '

' . __('Discussion - You can turn comments and pings on or off, and if there are comments on the post, you can see them here and moderate them.') . '

' . + '

' . sprintf(__('You can also create posts with the Press This bookmarklet.'), 'options-writing.php') . '

' . + '

' . __('For more information:') . '

' . + '

' . __('Documentation on Writing and Editing Posts') . '

' . + '

' . __('Support Forums') . '

' + ); +} elseif ( 'page' == $post_type ) { + add_contextual_help($current_screen, '

' . __('Pages are similar to Posts in that they have a title, body text, and associated metadata, but they are different in that they are not part of the chronological blog stream, kind of like permanent posts. Pages are not categorized or tagged, but can have a hierarchy. You can nest Pages under other Pages by making one the “Parent” of the other, creating a group of Pages.') . '

' . + '

' . __('Creating a Page is very similar to creating a Post, and the screens can be customized in the same way using drag and drop, the Screen Options tab, and expanding/collapsing boxes as you choose. This screen also has the new in 3.2 distraction-free writing space, available in both the Visual and HTML modes via the Fullscreen buttons. The Page editor mostly works the same as the Post editor, but there are some Page-specific features in the Page Attributes box:') . '

' . + '

' . __('Parent - You can arrange your pages in hierarchies. For example, you could have an “About” page that has “Life Story” and “My Dog” pages under it. There are no limits to how many levels you can nest pages.') . '

' . + '

' . __('Template - Some themes have custom templates you can use for certain pages that might have additional features or custom layouts. If so, you’ll see them in this dropdown menu.') . '

' . + '

' . __('Order - Pages are usually ordered alphabetically, but you can choose your own order by entering a number (1 for first, etc.) in this field.') . '

' . + '

' . __('For more information:') . '

' . + '

' . __('Documentation on Adding New Pages') . '

' . + '

' . __('Documentation on Editing Pages') . '

' . + '

' . __('Support Forums') . '

' + ); +} + +require_once('./admin-header.php'); +?> + +
+ +

labels->add_new); ?>

+ +

+ + +

+ +
> + + + + + + + + +post_status ) + wp_original_referer_field(true, 'previous'); + +echo $form_extra; + +wp_nonce_field( 'autosave', 'autosavenonce', false ); +wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false ); +wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); +?> + +
+
+ + +
+ +
+
+ +
+
+ + +
+
+public ? get_sample_permalink_html($post->ID) : ''; +$shortlink = wp_get_shortlink($post->ID, 'post'); +if ( !empty($shortlink) ) + $sample_permalink_html .= '' . __('Get Shortlink') . ''; + +if ( $post_type_object->public && ! ( 'pending' == $post->post_status && !current_user_can( $post_type_object->cap->publish_posts ) ) ) { ?> +
+ ID) && ! empty($sample_permalink_html) && 'auto-draft' != $post->post_status ) + echo $sample_permalink_html; + ?> +
+ +
+ +
+ + + +
+ +post_content); ?> + + + + +
0' ); ?> +   +post_status ) { + echo ''; + if ( $last_id = get_post_meta($post_ID, '_edit_last', true) ) { + $last_user = get_userdata($last_id); + printf(__('Last edited by %1$s on %2$s at %3$s'), esc_html( $last_user->display_name ), mysql2date(get_option('date_format'), $post->post_modified), mysql2date(get_option('time_format'), $post->post_modified)); + } else { + printf(__('Last edited on %1$s at %2$s'), mysql2date(get_option('date_format'), $post->post_modified), mysql2date(get_option('time_format'), $post->post_modified)); + } + echo ''; + } ?> +
+ +
+ + + +
+
+
+
+
+
+ + + +post_title) && '' == $post->post_title) || (isset($_GET['message']) && 2 > $_GET['message'])) : ?> + + diff --git a/src/wp-admin/edit-form-comment.php b/src/wp-admin/edit-form-comment.php new file mode 100644 index 0000000..6767ffe --- /dev/null +++ b/src/wp-admin/edit-form-comment.php @@ -0,0 +1,147 @@ +comment_ID); +$form_action = 'editedcomment'; +$form_extra = "' />\n\ncomment_ID) ?> +
+ +

+ +
+ + + +
+
+

+
+
+
+ +
+
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+%1$s'); +$date = date_i18n( $datef, strtotime( $comment->comment_date ) ); +?> +  +
+
+
+
+
+ +
+
+comment_ID&_wp_original_http_referer=" . urlencode(wp_get_referer()), 'delete-comment_' . $comment->comment_ID) . "'>" . ( !EMPTY_TRASH_DAYS ? __('Delete Permanently') : __('Move to Trash') ) . "\n"; ?> +
+
+ '4' ) ); ?> +
+
+
+
+
+
+
+ +
+
+
+

+
+ + + + + + + + + + + + + + + +
+ comment_author_email ) { + printf( __( 'E-mail (%s):' ), get_comment_author_email_link( __( 'send e-mail' ), '', '' ) ); + } else { + _e( 'E-mail:' ); + } +?>
+ comment_author_url ) && 'http://' != $comment->comment_author_url ) { + $link = '' . __('visit site') . ''; + printf( __( 'URL (%s):' ), apply_filters('get_comment_author_link', $link ) ); + } else { + _e( 'URL:' ); + } ?>
+
+
+
+ +
+comment_content, 'content', 'newcomment_author_url', false, 4, false); ?> + +
+ + + + + + + + +
+
+
+
+ + + diff --git a/src/wp-admin/edit-link-form.php b/src/wp-admin/edit-link-form.php new file mode 100644 index 0000000..2835787 --- /dev/null +++ b/src/wp-admin/edit-link-form.php @@ -0,0 +1,129 @@ +Links / Edit Link' ), 'link-manager.php' ); + $submit_text = __('Update Link'); + $form = ' diff --git a/src/wp-admin/edit-tag-form.php b/src/wp-admin/edit-tag-form.php new file mode 100644 index 0000000..92f074a --- /dev/null +++ b/src/wp-admin/edit-tag-form.php @@ -0,0 +1,93 @@ + +

+ + +
+ +

labels->edit_item; ?>

+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+

+

+ 0, 'hide_if_empty' => false, 'name' => 'parent', 'orderby' => 'name', 'taxonomy' => $taxonomy, 'selected' => $tag->parent, 'exclude_tree' => $tag->term_id, 'hierarchical' => true, 'show_option_none' => __('None'))); ?>
+ + + +

+
+ +
+
diff --git a/src/wp-admin/edit-tags.php b/src/wp-admin/edit-tags.php new file mode 100644 index 0000000..12867a2 --- /dev/null +++ b/src/wp-admin/edit-tags.php @@ -0,0 +1,394 @@ +cap->manage_terms ) ) + wp_die( __( 'Cheatin’ uh?' ) ); + +$wp_list_table = _get_list_table('WP_Terms_List_Table'); +$pagenum = $wp_list_table->get_pagenum(); + +$title = $tax->labels->name; + +if ( 'post' != $post_type ) { + $parent_file = "edit.php?post_type=$post_type"; + $submenu_file = "edit-tags.php?taxonomy=$taxonomy&post_type=$post_type"; +} else if ( 'link_category' == $tax->name ) { + $parent_file = 'link-manager.php'; + $submenu_file = 'edit-tags.php?taxonomy=link_category'; +} else { + $parent_file = 'edit.php'; + $submenu_file = "edit-tags.php?taxonomy=$taxonomy"; +} + +add_screen_option( 'per_page', array('label' => $title, 'default' => 20, 'option' => 'edit_' . $tax->name . '_per_page') ); + +switch ( $wp_list_table->current_action() ) { + +case 'add-tag': + + check_admin_referer( 'add-tag', '_wpnonce_add-tag' ); + + if ( !current_user_can( $tax->cap->edit_terms ) ) + wp_die( __( 'Cheatin’ uh?' ) ); + + $ret = wp_insert_term( $_POST['tag-name'], $taxonomy, $_POST ); + $location = 'edit-tags.php?taxonomy=' . $taxonomy; + if ( 'post' != $post_type ) + $location .= '&post_type=' . $post_type; + + if ( $referer = wp_get_original_referer() ) { + if ( false !== strpos( $referer, 'edit-tags.php' ) ) + $location = $referer; + } + + if ( $ret && !is_wp_error( $ret ) ) + $location = add_query_arg( 'message', 1, $location ); + else + $location = add_query_arg( 'message', 4, $location ); + wp_redirect( $location ); + exit; +break; + +case 'delete': + $location = 'edit-tags.php?taxonomy=' . $taxonomy; + if ( 'post' != $post_type ) + $location .= '&post_type=' . $post_type; + if ( $referer = wp_get_referer() ) { + if ( false !== strpos( $referer, 'edit-tags.php' ) ) + $location = $referer; + } + + if ( !isset( $_REQUEST['tag_ID'] ) ) { + wp_redirect( $location ); + exit; + } + + $tag_ID = (int) $_REQUEST['tag_ID']; + check_admin_referer( 'delete-tag_' . $tag_ID ); + + if ( !current_user_can( $tax->cap->delete_terms ) ) + wp_die( __( 'Cheatin’ uh?' ) ); + + wp_delete_term( $tag_ID, $taxonomy ); + + $location = add_query_arg( 'message', 2, $location ); + wp_redirect( $location ); + exit; + +break; + +case 'bulk-delete': + check_admin_referer( 'bulk-tags' ); + + if ( !current_user_can( $tax->cap->delete_terms ) ) + wp_die( __( 'Cheatin’ uh?' ) ); + + $tags = (array) $_REQUEST['delete_tags']; + foreach ( $tags as $tag_ID ) { + wp_delete_term( $tag_ID, $taxonomy ); + } + + $location = 'edit-tags.php?taxonomy=' . $taxonomy; + if ( 'post' != $post_type ) + $location .= '&post_type=' . $post_type; + if ( $referer = wp_get_referer() ) { + if ( false !== strpos( $referer, 'edit-tags.php' ) ) + $location = $referer; + } + + $location = add_query_arg( 'message', 6, $location ); + wp_redirect( $location ); + exit; + +break; + +case 'edit': + $title = $tax->labels->edit_item; + + require_once ( 'admin-header.php' ); + $tag_ID = (int) $_REQUEST['tag_ID']; + + $tag = get_term( $tag_ID, $taxonomy, OBJECT, 'edit' ); + include( './edit-tag-form.php' ); + +break; + +case 'editedtag': + $tag_ID = (int) $_POST['tag_ID']; + check_admin_referer( 'update-tag_' . $tag_ID ); + + if ( !current_user_can( $tax->cap->edit_terms ) ) + wp_die( __( 'Cheatin’ uh?' ) ); + + $ret = wp_update_term( $tag_ID, $taxonomy, $_POST ); + + $location = 'edit-tags.php?taxonomy=' . $taxonomy; + if ( 'post' != $post_type ) + $location .= '&post_type=' . $post_type; + + if ( $referer = wp_get_original_referer() ) { + if ( false !== strpos( $referer, 'edit-tags.php' ) ) + $location = $referer; + } + + if ( $ret && !is_wp_error( $ret ) ) + $location = add_query_arg( 'message', 3, $location ); + else + $location = add_query_arg( 'message', 5, $location ); + + wp_redirect( $location ); + exit; +break; + +default: +if ( ! empty($_REQUEST['_wp_http_referer']) ) { + $location = remove_query_arg( array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI']) ); + + if ( ! empty( $_REQUEST['paged'] ) ) + $location = add_query_arg( 'paged', (int) $_REQUEST['paged'] ); + + wp_redirect( $location ); + exit; +} + +$wp_list_table->prepare_items(); +$total_pages = $wp_list_table->get_pagination_arg( 'total_pages' ); + +if ( $pagenum > $total_pages && $total_pages > 0 ) { + wp_redirect( add_query_arg( 'paged', $total_pages ) ); + exit; +} + +wp_enqueue_script('admin-tags'); +if ( current_user_can($tax->cap->edit_terms) ) + wp_enqueue_script('inline-edit-tax'); + +if ( 'category' == $taxonomy || 'link_category' == $taxonomy || 'post_tag' == $taxonomy ) { + $help =''; + if ( 'category' == $taxonomy ) + $help = '

' . sprintf(__( 'You can use categories to define sections of your site and group related posts. The default category is “Uncategorized” until you change it in your writing settings.' ) , 'options-writing.php' ) . '

'; + elseif ( 'link_category' == $taxonomy ) + $help = '

' . __( 'You can create groups of links by using link categories. Link category names must be unique and link categories are separate from the categories you use for posts.' ) . '

'; + else + $help = '

' . __( 'You can assign keywords to your posts using Post Tags. Unlike categories, tags have no hierarchy, meaning there’s no relationship from one tag to another.' ) . '

'; + + if ( 'link_category' == $taxonomy ) + $help .= '

' . __( 'You can delete link categories in the Bulk Action pulldown, but that action does not delete the links within the category. Instead, it moves them to the default link category.' ) . '

'; + else + $help .='

' . __( 'What’s the difference between categories and tags? Normally, tags are ad-hoc keywords that identify important information in your post (names, subjects, etc) that may or may not recur in other posts, while categories are pre-determined sections. If you think of your site like a book, the categories are like the Table of Contents and the tags are like the terms in the index.' ) . '

'; + + if ( 'category' == $taxonomy ) + $help .= '

' . __( 'When adding a new category on this screen, you’ll fill in the following fields:' ) . '

'; + elseif ( 'post_tag' == $taxonomy ) + $help .= '

' . __( 'When adding a new tag on this screen, you’ll fill in the following fields:' ) . '

'; + + if ( 'category' == $taxonomy || 'post_tag' == $taxonomy ) + + $help .= '' . + '

' . __( 'You can change the display of this screen using the Screen Options tab to set how many items are displayed per screen and to display/hide columns in the table.' ) . '

' . + '

' . __( 'For more information:' ) . '

'; + + if ( 'category' == $taxonomy ) + $help .= '

' . __( 'Documentation on Categories' ) . '

'; + elseif ( 'link_category' == $taxonomy ) + $help .= '

' . __( 'Documentation on Link Categories' ) . '

'; + else + $help .= '

' . __( 'Documentation on Post Tags' ) . '

'; + + $help .= '

' . __('Support Forums') . '

'; + + add_contextual_help($current_screen, $help); + unset($help); +} + +require_once ('admin-header.php'); + +if ( !current_user_can($tax->cap->edit_terms) ) + wp_die( __('You are not allowed to edit this item.') ); + +$messages[1] = __('Item added.'); +$messages[2] = __('Item deleted.'); +$messages[3] = __('Item updated.'); +$messages[4] = __('Item not added.'); +$messages[5] = __('Item not updated.'); +$messages[6] = __('Items deleted.'); + +?> + +
+ +

' . __('Search results for “%s”') . '', esc_html( stripslashes($_REQUEST['s']) ) ); ?> +

+ + +

+ +
+ +
+ + + +search_box( $tax->labels->search_items, 'tag' ); ?> + +
+
+ +
+ +
+
+
+ + + +display(); ?> + +
+
+ + +
+

Note:
Deleting a category does not delete the posts in that category. Instead, posts that were only assigned to the deleted category are set to the category %s.'), apply_filters('the_category', get_cat_name(get_option('default_category')))) ?>

+ +

category to tag converter.'), 'import.php') ?>

+ +
+ +
+

tag to category converter'), 'import.php') ;?>.

+
+ + +
+
+ +
+
+ +labels->popular_items ) ) { + if ( current_user_can( $tax->cap->edit_terms ) ) + $tag_cloud = wp_tag_cloud( array( 'taxonomy' => $taxonomy, 'echo' => false, 'link' => 'edit' ) ); + else + $tag_cloud = wp_tag_cloud( array( 'taxonomy' => $taxonomy, 'echo' => false ) ); + + if ( $tag_cloud ) : + ?> +
+

labels->popular_items; ?>

+ +
+cap->edit_terms) ) { + // Back compat hooks. Deprecated in preference to {$taxonomy}_pre_add_form + if ( 'category' == $taxonomy ) + do_action('add_category_form_pre', (object)array('parent' => 0) ); + elseif ( 'link_category' == $taxonomy ) + do_action('add_link_category_form_pre', (object)array('parent' => 0) ); + else + do_action('add_tag_form_pre', $taxonomy); + + do_action($taxonomy . '_pre_add_form', $taxonomy); +?> + +
+

labels->add_new_item; ?>

+
+ + + + + + +
+ + +

+
+ +
+ + +

+
+ + +
+ + 0, 'hide_if_empty' => false, 'taxonomy' => $taxonomy, 'name' => 'parent', 'orderby' => 'name', 'hierarchical' => true, 'show_option_none' => __('None'))); ?> + +

+ +
+ +
+ + +

+
+ +labels->add_new_item, 'button' ); + +// Back compat hooks. Deprecated in preference to {$taxonomy}_add_form +if ( 'category' == $taxonomy ) + do_action('edit_category_form', (object)array('parent' => 0) ); +elseif ( 'link_category' == $taxonomy ) + do_action('edit_link_category_form', (object)array('parent' => 0) ); +else + do_action('add_tag_form', $taxonomy); + +do_action($taxonomy . '_add_form', $taxonomy); +?> +
+ + +
+
+ +
+
+ +inline_edit(); ?> + + diff --git a/src/wp-admin/edit.php b/src/wp-admin/edit.php new file mode 100644 index 0000000..933219e --- /dev/null +++ b/src/wp-admin/edit.php @@ -0,0 +1,263 @@ + true ) ) ) ) + $post_type = $_GET['post_type']; +else + wp_die( __('Invalid post type') ); + +$_GET['post_type'] = $post_type; + +$post_type_object = get_post_type_object( $post_type ); + +if ( !current_user_can($post_type_object->cap->edit_posts) ) + wp_die(__('Cheatin’ uh?')); + +$wp_list_table = _get_list_table('WP_Posts_List_Table'); +$pagenum = $wp_list_table->get_pagenum(); + +// Back-compat for viewing comments of an entry +foreach ( array( 'p', 'attachment_id', 'page_id' ) as $_redirect ) { + if ( ! empty( $_REQUEST[ $_redirect ] ) ) { + wp_redirect( admin_url( 'edit-comments.php?p=' . absint( $_REQUEST[ $_redirect ] ) ) ); + exit; + } +} +unset( $_redirect ); + +if ( 'post' != $post_type ) { + $parent_file = "edit.php?post_type=$post_type"; + $submenu_file = "edit.php?post_type=$post_type"; + $post_new_file = "post-new.php?post_type=$post_type"; +} else { + $parent_file = 'edit.php'; + $submenu_file = 'edit.php'; + $post_new_file = 'post-new.php'; +} + +$doaction = $wp_list_table->current_action(); + +if ( $doaction ) { + check_admin_referer('bulk-posts'); + + $sendback = remove_query_arg( array('trashed', 'untrashed', 'deleted', 'ids'), wp_get_referer() ); + $sendback = add_query_arg( 'paged', $pagenum, $sendback ); + if ( strpos($sendback, 'post.php') !== false ) + $sendback = admin_url($post_new_file); + + if ( 'delete_all' == $doaction ) { + $post_status = preg_replace('/[^a-z0-9_-]+/i', '', $_REQUEST['post_status']); + if ( get_post_status_object($post_status) ) // Check the post status exists first + $post_ids = $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type=%s AND post_status = %s", $post_type, $post_status ) ); + $doaction = 'delete'; + } elseif ( isset( $_REQUEST['media'] ) ) { + $post_ids = $_REQUEST['media']; + } elseif ( isset( $_REQUEST['ids'] ) ) { + $post_ids = explode( ',', $_REQUEST['ids'] ); + } elseif ( !empty( $_REQUEST['post'] ) ) { + $post_ids = array_map('intval', $_REQUEST['post']); + } + + if ( !isset( $post_ids ) ) { + wp_redirect( $sendback ); + exit; + } + + switch ( $doaction ) { + case 'trash': + $trashed = 0; + foreach( (array) $post_ids as $post_id ) { + if ( !current_user_can($post_type_object->cap->delete_post, $post_id) ) + wp_die( __('You are not allowed to move this item to the Trash.') ); + + if ( !wp_trash_post($post_id) ) + wp_die( __('Error in moving to Trash.') ); + + $trashed++; + } + $sendback = add_query_arg( array('trashed' => $trashed, 'ids' => join(',', $post_ids) ), $sendback ); + break; + case 'untrash': + $untrashed = 0; + foreach( (array) $post_ids as $post_id ) { + if ( !current_user_can($post_type_object->cap->delete_post, $post_id) ) + wp_die( __('You are not allowed to restore this item from the Trash.') ); + + if ( !wp_untrash_post($post_id) ) + wp_die( __('Error in restoring from Trash.') ); + + $untrashed++; + } + $sendback = add_query_arg('untrashed', $untrashed, $sendback); + break; + case 'delete': + $deleted = 0; + foreach( (array) $post_ids as $post_id ) { + $post_del = & get_post($post_id); + + if ( !current_user_can($post_type_object->cap->delete_post, $post_id) ) + wp_die( __('You are not allowed to delete this item.') ); + + if ( $post_del->post_type == 'attachment' ) { + if ( ! wp_delete_attachment($post_id) ) + wp_die( __('Error in deleting...') ); + } else { + if ( !wp_delete_post($post_id) ) + wp_die( __('Error in deleting...') ); + } + $deleted++; + } + $sendback = add_query_arg('deleted', $deleted, $sendback); + break; + case 'edit': + if ( isset($_REQUEST['bulk_edit']) ) { + $done = bulk_edit_posts($_REQUEST); + + if ( is_array($done) ) { + $done['updated'] = count( $done['updated'] ); + $done['skipped'] = count( $done['skipped'] ); + $done['locked'] = count( $done['locked'] ); + $sendback = add_query_arg( $done, $sendback ); + } + } + break; + } + + $sendback = remove_query_arg( array('action', 'action2', 'tags_input', 'post_author', 'comment_status', 'ping_status', '_status', 'post', 'bulk_edit', 'post_view'), $sendback ); + + wp_redirect($sendback); + exit(); +} elseif ( ! empty($_REQUEST['_wp_http_referer']) ) { + wp_redirect( remove_query_arg( array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI']) ) ); + exit; +} + +$wp_list_table->prepare_items(); + +wp_enqueue_script('inline-edit-post'); + +$title = $post_type_object->labels->name; + +if ( 'post' == $post_type ) { + add_contextual_help($current_screen, + '

' . __('You can customize the display of this screen in a number of ways:') . '

' . + '' . + '

' . __('Hovering over a row in the posts list will display action links that allow you to manage your post. You can perform the following actions:') . '

' . + '' . + '

' . __('You can also edit multiple posts at once. Select the posts you want to edit using the checkboxes, select Edit from the Bulk Actions menu and click Apply. You will be able to change the metadata (categories, author, etc.) for all selected posts at once. To remove a post from the grouping, just click the x next to its name in the Bulk Edit area that appears.') . '

' . + '

' . __('For more information:') . '

' . + '

' . __('Documentation on Managing Posts') . '

' . + '

' . __('Support Forums') . '

' + ); +} elseif ( 'page' == $post_type ) { + add_contextual_help($current_screen, + '

' . __('Pages are similar to Posts in that they have a title, body text, and associated metadata, but they are different in that they are not part of the chronological blog stream, kind of like permanent posts. Pages are not categorized or tagged, but can have a hierarchy. You can nest Pages under other Pages by making one the “Parent” of the other, creating a group of Pages.') . '

' . + '

' . __('Managing Pages is very similar to managing Posts, and the screens can be customized in the same way.') . '

' . + '

' . __('You can also perform the same types of actions, including narrowing the list by using the filters, acting on a Page using the action links that appear when you hover over a row, or using the Bulk Actions menu to edit the metadata for multiple Pages at once.') . '

' . + '

' . __('For more information:') . '

' . + '

' . __('Documentation on Managing Pages') . '

' . + '

' . __('Support Forums') . '

' + ); +} + +add_screen_option( 'per_page', array('label' => $title, 'default' => 20) ); + +require_once('./admin-header.php'); +?> +
+ +

labels->name ); ?> labels->add_new); ?> ' . __('Search results for “%s”') . '', get_search_query() ); ?> +

+ + +

|

+ + + +

+' . __('Undo') . '
'; + unset($_REQUEST['trashed']); +} + +if ( isset($_REQUEST['untrashed']) && (int) $_REQUEST['untrashed'] ) { + printf( _n( 'Item restored from the Trash.', '%s items restored from the Trash.', $_REQUEST['untrashed'] ), number_format_i18n( $_REQUEST['untrashed'] ) ); + unset($_REQUEST['undeleted']); +} + +$_SERVER['REQUEST_URI'] = remove_query_arg( array('locked', 'skipped', 'updated', 'deleted', 'trashed', 'untrashed'), $_SERVER['REQUEST_URI'] ); +?> +

+ + +views(); ?> + +
+ +search_box( $post_type_object->labels->search_items, 'post' ); ?> + + + + + + + +display(); ?> + +
+ +has_items() ) + $wp_list_table->inline_edit(); +?> + +
+
+
+ + + +' . __('You can export a file of your site’s content in order to import it into another installation or platform. The export file will be an XML file format called WXR. Posts, pages, comments, custom fields, categories, and tags can be included. You can choose for the WXR file to include only certain posts or pages by setting the dropdown filters to limit the export by category, author, date range by month, or publishing status.') . '

' . + '

' . __('Once generated, your WXR file can be imported by another WordPress site or by another blogging platform able to access this format.') . '

' . + '

' . __('For more information:') . '

' . + '

' . __('Documentation on Export') . '

' . + '

' . __('Support Forums') . '

' +); + +if ( isset( $_GET['download'] ) ) { + $args = array(); + + if ( ! isset( $_GET['content'] ) || 'all' == $_GET['content'] ) { + $args['content'] = 'all'; + } else if ( 'posts' == $_GET['content'] ) { + $args['content'] = 'post'; + + if ( $_GET['cat'] ) + $args['category'] = (int) $_GET['cat']; + + if ( $_GET['post_author'] ) + $args['author'] = (int) $_GET['post_author']; + + if ( $_GET['post_start_date'] || $_GET['post_end_date'] ) { + $args['start_date'] = $_GET['post_start_date']; + $args['end_date'] = $_GET['post_end_date']; + } + + if ( $_GET['post_status'] ) + $args['status'] = $_GET['post_status']; + } else if ( 'pages' == $_GET['content'] ) { + $args['content'] = 'page'; + + if ( $_GET['page_author'] ) + $args['author'] = (int) $_GET['page_author']; + + if ( $_GET['page_start_date'] || $_GET['page_end_date'] ) { + $args['start_date'] = $_GET['page_start_date']; + $args['end_date'] = $_GET['page_end_date']; + } + + if ( $_GET['page_status'] ) + $args['status'] = $_GET['page_status']; + } else { + $args['content'] = $_GET['content']; + } + + export_wp( $args ); + die(); +} + +require_once ('admin-header.php'); + +function export_date_options() { + global $wpdb, $wp_locale; + + $months = $wpdb->get_results( " + SELECT DISTINCT YEAR( post_date ) AS year, MONTH( post_date ) AS month + FROM $wpdb->posts + WHERE post_type = 'post' AND post_status != 'auto-draft' + ORDER BY post_date DESC + " ); + + $month_count = count( $months ); + if ( !$month_count || ( 1 == $month_count && 0 == $months[0]->month ) ) + return; + + foreach ( $months as $date ) { + if ( 0 == $date->year ) + continue; + + $month = zeroise( $date->month, 2 ); + echo ''; + } +} +?> + +
+ +

+ +

+

+

+ +

+
+ +

+

+ +

+
    +
  • + + __('All') ) ); ?> +
  • +
  • + +get_col( "SELECT DISTINCT post_author FROM {$wpdb->posts} WHERE post_type = 'post'" ); + wp_dropdown_users( array( 'include' => $authors, 'name' => 'post_author', 'multi' => true, 'show_option_all' => __('All') ) ); +?> +
  • +
  • + + + +
  • +
  • + + +
  • +
+ +

+
    +
  • + +get_col( "SELECT DISTINCT post_author FROM {$wpdb->posts} WHERE post_type = 'page'" ); + wp_dropdown_users( array( 'include' => $authors, 'name' => 'page_author', 'multi' => true, 'show_option_all' => __('All') ) ); +?> +
  • +
  • + + + +
  • +
  • + + +
  • +
+ + false, 'can_export' => true ), 'objects' ) as $post_type ) : ?> +

+ + + +
+
+ + diff --git a/src/wp-admin/freedoms.php b/src/wp-admin/freedoms.php new file mode 100644 index 0000000..cf7309a --- /dev/null +++ b/src/wp-admin/freedoms.php @@ -0,0 +1,42 @@ + +
+ +

+ +

license, the GPL.' ), 'http://wordpress.org/about/license/' ); ?>

+ +
    +
  1. +
  2. +
  3. +
  4. +
+ +

check out our trademark guidelines first.' ), 'http://wordpressfoundation.org/trademark-policy/' ); ?>

+ +

plugins and themes there. If you get a plugin or theme from another source, make sure to ask them if it’s GPL first. If they don’t respect the WordPress license, we don’t recommend them.' ), $plugins_url, $themes_url, 'http://wordpress.org/about/license/' ); ?>

+ +

Free Software Foundation.' ); ?>

+ +
+ diff --git a/src/wp-admin/gears-manifest.php b/src/wp-admin/gears-manifest.php new file mode 100644 index 0000000..8feb485 --- /dev/null +++ b/src/wp-admin/gears-manifest.php @@ -0,0 +1,51 @@ + +{ +"betaManifestVersion" : 1, +"version" : "", +"entries" : [ + + +]} diff --git a/src/wp-admin/images/align-center.png b/src/wp-admin/images/align-center.png new file mode 100644 index 0000000..a412226 Binary files /dev/null and b/src/wp-admin/images/align-center.png differ diff --git a/src/wp-admin/images/align-left.png b/src/wp-admin/images/align-left.png new file mode 100644 index 0000000..2e433fc Binary files /dev/null and b/src/wp-admin/images/align-left.png differ diff --git a/src/wp-admin/images/align-none.png b/src/wp-admin/images/align-none.png new file mode 100644 index 0000000..5fb9af2 Binary files /dev/null and b/src/wp-admin/images/align-none.png differ diff --git a/src/wp-admin/images/align-right.png b/src/wp-admin/images/align-right.png new file mode 100644 index 0000000..9b92578 Binary files /dev/null and b/src/wp-admin/images/align-right.png differ diff --git a/src/wp-admin/images/archive-link.png b/src/wp-admin/images/archive-link.png new file mode 100644 index 0000000..4c70895 Binary files /dev/null and b/src/wp-admin/images/archive-link.png differ diff --git a/src/wp-admin/images/arrows-dark-vs.png b/src/wp-admin/images/arrows-dark-vs.png new file mode 100644 index 0000000..0d1dc7a Binary files /dev/null and b/src/wp-admin/images/arrows-dark-vs.png differ diff --git a/src/wp-admin/images/arrows-dark.png b/src/wp-admin/images/arrows-dark.png new file mode 100644 index 0000000..29f814d Binary files /dev/null and b/src/wp-admin/images/arrows-dark.png differ diff --git a/src/wp-admin/images/arrows-vs.png b/src/wp-admin/images/arrows-vs.png new file mode 100644 index 0000000..d2536b9 Binary files /dev/null and b/src/wp-admin/images/arrows-vs.png differ diff --git a/src/wp-admin/images/arrows.png b/src/wp-admin/images/arrows.png new file mode 100644 index 0000000..775a7a0 Binary files /dev/null and b/src/wp-admin/images/arrows.png differ diff --git a/src/wp-admin/images/blue-grad.png b/src/wp-admin/images/blue-grad.png new file mode 100644 index 0000000..868a657 Binary files /dev/null and b/src/wp-admin/images/blue-grad.png differ diff --git a/src/wp-admin/images/bubble_bg-rtl.gif b/src/wp-admin/images/bubble_bg-rtl.gif new file mode 100644 index 0000000..5cfbefe Binary files /dev/null and b/src/wp-admin/images/bubble_bg-rtl.gif differ diff --git a/src/wp-admin/images/bubble_bg.gif b/src/wp-admin/images/bubble_bg.gif new file mode 100644 index 0000000..315ab52 Binary files /dev/null and b/src/wp-admin/images/bubble_bg.gif differ diff --git a/src/wp-admin/images/button-grad-active.png b/src/wp-admin/images/button-grad-active.png new file mode 100644 index 0000000..0177e5b Binary files /dev/null and b/src/wp-admin/images/button-grad-active.png differ diff --git a/src/wp-admin/images/button-grad.png b/src/wp-admin/images/button-grad.png new file mode 100644 index 0000000..3f96366 Binary files /dev/null and b/src/wp-admin/images/button-grad.png differ diff --git a/src/wp-admin/images/comment-grey-bubble.png b/src/wp-admin/images/comment-grey-bubble.png new file mode 100644 index 0000000..6f1e765 Binary files /dev/null and b/src/wp-admin/images/comment-grey-bubble.png differ diff --git a/src/wp-admin/images/date-button.gif b/src/wp-admin/images/date-button.gif new file mode 100644 index 0000000..7ee32cb Binary files /dev/null and b/src/wp-admin/images/date-button.gif differ diff --git a/src/wp-admin/images/ed-bg-vs.gif b/src/wp-admin/images/ed-bg-vs.gif new file mode 100644 index 0000000..be41c6c Binary files /dev/null and b/src/wp-admin/images/ed-bg-vs.gif differ diff --git a/src/wp-admin/images/ed-bg.gif b/src/wp-admin/images/ed-bg.gif new file mode 100644 index 0000000..a00467c Binary files /dev/null and b/src/wp-admin/images/ed-bg.gif differ diff --git a/src/wp-admin/images/fade-butt.png b/src/wp-admin/images/fade-butt.png new file mode 100644 index 0000000..42f08b7 Binary files /dev/null and b/src/wp-admin/images/fade-butt.png differ diff --git a/src/wp-admin/images/fav-arrow-rtl.gif b/src/wp-admin/images/fav-arrow-rtl.gif new file mode 100644 index 0000000..e9aeba0 Binary files /dev/null and b/src/wp-admin/images/fav-arrow-rtl.gif differ diff --git a/src/wp-admin/images/fav-arrow.gif b/src/wp-admin/images/fav-arrow.gif new file mode 100644 index 0000000..28fc6bb Binary files /dev/null and b/src/wp-admin/images/fav-arrow.gif differ diff --git a/src/wp-admin/images/fav-vs.png b/src/wp-admin/images/fav-vs.png new file mode 100644 index 0000000..51a2186 Binary files /dev/null and b/src/wp-admin/images/fav-vs.png differ diff --git a/src/wp-admin/images/fav.png b/src/wp-admin/images/fav.png new file mode 100644 index 0000000..f3cbe54 Binary files /dev/null and b/src/wp-admin/images/fav.png differ diff --git a/src/wp-admin/images/generic.png b/src/wp-admin/images/generic.png new file mode 100644 index 0000000..3bcbc04 Binary files /dev/null and b/src/wp-admin/images/generic.png differ diff --git a/src/wp-admin/images/gray-grad.png b/src/wp-admin/images/gray-grad.png new file mode 100644 index 0000000..99c45ce Binary files /dev/null and b/src/wp-admin/images/gray-grad.png differ diff --git a/src/wp-admin/images/gray-star.png b/src/wp-admin/images/gray-star.png new file mode 100644 index 0000000..a32b058 Binary files /dev/null and b/src/wp-admin/images/gray-star.png differ diff --git a/src/wp-admin/images/icons32-vs.png b/src/wp-admin/images/icons32-vs.png new file mode 100644 index 0000000..d910bc1 Binary files /dev/null and b/src/wp-admin/images/icons32-vs.png differ diff --git a/src/wp-admin/images/icons32.png b/src/wp-admin/images/icons32.png new file mode 100644 index 0000000..d94e38a Binary files /dev/null and b/src/wp-admin/images/icons32.png differ diff --git a/src/wp-admin/images/imgedit-icons.png b/src/wp-admin/images/imgedit-icons.png new file mode 100644 index 0000000..5f1f585 Binary files /dev/null and b/src/wp-admin/images/imgedit-icons.png differ diff --git a/src/wp-admin/images/list.png b/src/wp-admin/images/list.png new file mode 100644 index 0000000..827556e Binary files /dev/null and b/src/wp-admin/images/list.png differ diff --git a/src/wp-admin/images/loading-publish.gif b/src/wp-admin/images/loading-publish.gif new file mode 100644 index 0000000..4282004 Binary files /dev/null and b/src/wp-admin/images/loading-publish.gif differ diff --git a/src/wp-admin/images/loading.gif b/src/wp-admin/images/loading.gif new file mode 100644 index 0000000..85b99d4 Binary files /dev/null and b/src/wp-admin/images/loading.gif differ diff --git a/src/wp-admin/images/logo-ghost.png b/src/wp-admin/images/logo-ghost.png new file mode 100644 index 0000000..58335f7 Binary files /dev/null and b/src/wp-admin/images/logo-ghost.png differ diff --git a/src/wp-admin/images/logo-login.png b/src/wp-admin/images/logo-login.png new file mode 100644 index 0000000..497f683 Binary files /dev/null and b/src/wp-admin/images/logo-login.png differ diff --git a/src/wp-admin/images/logo.gif b/src/wp-admin/images/logo.gif new file mode 100644 index 0000000..8024d48 Binary files /dev/null and b/src/wp-admin/images/logo.gif differ diff --git a/src/wp-admin/images/marker.png b/src/wp-admin/images/marker.png new file mode 100644 index 0000000..3929bbb Binary files /dev/null and b/src/wp-admin/images/marker.png differ diff --git a/src/wp-admin/images/mask.png b/src/wp-admin/images/mask.png new file mode 100644 index 0000000..b0a4d40 Binary files /dev/null and b/src/wp-admin/images/mask.png differ diff --git a/src/wp-admin/images/media-button-image.gif b/src/wp-admin/images/media-button-image.gif new file mode 100644 index 0000000..5e7e426 Binary files /dev/null and b/src/wp-admin/images/media-button-image.gif differ diff --git a/src/wp-admin/images/media-button-music.gif b/src/wp-admin/images/media-button-music.gif new file mode 100644 index 0000000..0254a08 Binary files /dev/null and b/src/wp-admin/images/media-button-music.gif differ diff --git a/src/wp-admin/images/media-button-other.gif b/src/wp-admin/images/media-button-other.gif new file mode 100644 index 0000000..414a957 Binary files /dev/null and b/src/wp-admin/images/media-button-other.gif differ diff --git a/src/wp-admin/images/media-button-video.gif b/src/wp-admin/images/media-button-video.gif new file mode 100644 index 0000000..50ac6e0 Binary files /dev/null and b/src/wp-admin/images/media-button-video.gif differ diff --git a/src/wp-admin/images/menu-arrow-frame-rtl.png b/src/wp-admin/images/menu-arrow-frame-rtl.png new file mode 100644 index 0000000..b0e120b Binary files /dev/null and b/src/wp-admin/images/menu-arrow-frame-rtl.png differ diff --git a/src/wp-admin/images/menu-arrow-frame.png b/src/wp-admin/images/menu-arrow-frame.png new file mode 100644 index 0000000..33d19d8 Binary files /dev/null and b/src/wp-admin/images/menu-arrow-frame.png differ diff --git a/src/wp-admin/images/menu-arrows.gif b/src/wp-admin/images/menu-arrows.gif new file mode 100644 index 0000000..ec854c1 Binary files /dev/null and b/src/wp-admin/images/menu-arrows.gif differ diff --git a/src/wp-admin/images/menu-bits-rtl-vs.gif b/src/wp-admin/images/menu-bits-rtl-vs.gif new file mode 100644 index 0000000..422cc8d Binary files /dev/null and b/src/wp-admin/images/menu-bits-rtl-vs.gif differ diff --git a/src/wp-admin/images/menu-bits-rtl.gif b/src/wp-admin/images/menu-bits-rtl.gif new file mode 100644 index 0000000..b193af0 Binary files /dev/null and b/src/wp-admin/images/menu-bits-rtl.gif differ diff --git a/src/wp-admin/images/menu-bits-vs.gif b/src/wp-admin/images/menu-bits-vs.gif new file mode 100644 index 0000000..30f0bc8 Binary files /dev/null and b/src/wp-admin/images/menu-bits-vs.gif differ diff --git a/src/wp-admin/images/menu-bits.gif b/src/wp-admin/images/menu-bits.gif new file mode 100644 index 0000000..218e184 Binary files /dev/null and b/src/wp-admin/images/menu-bits.gif differ diff --git a/src/wp-admin/images/menu-dark-rtl-vs.gif b/src/wp-admin/images/menu-dark-rtl-vs.gif new file mode 100644 index 0000000..14ed2ab Binary files /dev/null and b/src/wp-admin/images/menu-dark-rtl-vs.gif differ diff --git a/src/wp-admin/images/menu-dark-rtl.gif b/src/wp-admin/images/menu-dark-rtl.gif new file mode 100644 index 0000000..7bfd25d Binary files /dev/null and b/src/wp-admin/images/menu-dark-rtl.gif differ diff --git a/src/wp-admin/images/menu-dark-vs.gif b/src/wp-admin/images/menu-dark-vs.gif new file mode 100644 index 0000000..0b448aa Binary files /dev/null and b/src/wp-admin/images/menu-dark-vs.gif differ diff --git a/src/wp-admin/images/menu-dark.gif b/src/wp-admin/images/menu-dark.gif new file mode 100644 index 0000000..739b888 Binary files /dev/null and b/src/wp-admin/images/menu-dark.gif differ diff --git a/src/wp-admin/images/menu-shadow-rtl.png b/src/wp-admin/images/menu-shadow-rtl.png new file mode 100644 index 0000000..a750771 Binary files /dev/null and b/src/wp-admin/images/menu-shadow-rtl.png differ diff --git a/src/wp-admin/images/menu-shadow.png b/src/wp-admin/images/menu-shadow.png new file mode 100644 index 0000000..b0883a8 Binary files /dev/null and b/src/wp-admin/images/menu-shadow.png differ diff --git a/src/wp-admin/images/menu-vs.png b/src/wp-admin/images/menu-vs.png new file mode 100644 index 0000000..76372bc Binary files /dev/null and b/src/wp-admin/images/menu-vs.png differ diff --git a/src/wp-admin/images/menu.png b/src/wp-admin/images/menu.png new file mode 100644 index 0000000..fa6ed84 Binary files /dev/null and b/src/wp-admin/images/menu.png differ diff --git a/src/wp-admin/images/no.png b/src/wp-admin/images/no.png new file mode 100644 index 0000000..e2db55f Binary files /dev/null and b/src/wp-admin/images/no.png differ diff --git a/src/wp-admin/images/press-this.png b/src/wp-admin/images/press-this.png new file mode 100644 index 0000000..26c9697 Binary files /dev/null and b/src/wp-admin/images/press-this.png differ diff --git a/src/wp-admin/images/required.gif b/src/wp-admin/images/required.gif new file mode 100644 index 0000000..119350f Binary files /dev/null and b/src/wp-admin/images/required.gif differ diff --git a/src/wp-admin/images/resize-rtl.gif b/src/wp-admin/images/resize-rtl.gif new file mode 100644 index 0000000..95e7b32 Binary files /dev/null and b/src/wp-admin/images/resize-rtl.gif differ diff --git a/src/wp-admin/images/resize.gif b/src/wp-admin/images/resize.gif new file mode 100644 index 0000000..6a1b41c Binary files /dev/null and b/src/wp-admin/images/resize.gif differ diff --git a/src/wp-admin/images/screen-options-toggle-vs.gif b/src/wp-admin/images/screen-options-toggle-vs.gif new file mode 100644 index 0000000..3b9b8af Binary files /dev/null and b/src/wp-admin/images/screen-options-toggle-vs.gif differ diff --git a/src/wp-admin/images/screen-options-toggle.gif b/src/wp-admin/images/screen-options-toggle.gif new file mode 100644 index 0000000..ed0a5fd Binary files /dev/null and b/src/wp-admin/images/screen-options-toggle.gif differ diff --git a/src/wp-admin/images/se.png b/src/wp-admin/images/se.png new file mode 100644 index 0000000..c9d8fdd Binary files /dev/null and b/src/wp-admin/images/se.png differ diff --git a/src/wp-admin/images/sort.gif b/src/wp-admin/images/sort.gif new file mode 100644 index 0000000..2a5a6e8 Binary files /dev/null and b/src/wp-admin/images/sort.gif differ diff --git a/src/wp-admin/images/star.png b/src/wp-admin/images/star.png new file mode 100644 index 0000000..4ca5261 Binary files /dev/null and b/src/wp-admin/images/star.png differ diff --git a/src/wp-admin/images/toggle-arrow-rtl.gif b/src/wp-admin/images/toggle-arrow-rtl.gif new file mode 100644 index 0000000..c96b944 Binary files /dev/null and b/src/wp-admin/images/toggle-arrow-rtl.gif differ diff --git a/src/wp-admin/images/toggle-arrow.gif b/src/wp-admin/images/toggle-arrow.gif new file mode 100644 index 0000000..86cb448 Binary files /dev/null and b/src/wp-admin/images/toggle-arrow.gif differ diff --git a/src/wp-admin/images/upload-classic.png b/src/wp-admin/images/upload-classic.png new file mode 100644 index 0000000..beda3e4 Binary files /dev/null and b/src/wp-admin/images/upload-classic.png differ diff --git a/src/wp-admin/images/upload-fresh.png b/src/wp-admin/images/upload-fresh.png new file mode 100644 index 0000000..92fd355 Binary files /dev/null and b/src/wp-admin/images/upload-fresh.png differ diff --git a/src/wp-admin/images/wheel.png b/src/wp-admin/images/wheel.png new file mode 100644 index 0000000..97b343d Binary files /dev/null and b/src/wp-admin/images/wheel.png differ diff --git a/src/wp-admin/images/white-grad-active.png b/src/wp-admin/images/white-grad-active.png new file mode 100644 index 0000000..0478015 Binary files /dev/null and b/src/wp-admin/images/white-grad-active.png differ diff --git a/src/wp-admin/images/white-grad.png b/src/wp-admin/images/white-grad.png new file mode 100644 index 0000000..aaf57aa Binary files /dev/null and b/src/wp-admin/images/white-grad.png differ diff --git a/src/wp-admin/images/widgets-arrow-vs.gif b/src/wp-admin/images/widgets-arrow-vs.gif new file mode 100644 index 0000000..c6398e6 Binary files /dev/null and b/src/wp-admin/images/widgets-arrow-vs.gif differ diff --git a/src/wp-admin/images/widgets-arrow.gif b/src/wp-admin/images/widgets-arrow.gif new file mode 100644 index 0000000..69e0352 Binary files /dev/null and b/src/wp-admin/images/widgets-arrow.gif differ diff --git a/src/wp-admin/images/wordpress-logo.png b/src/wp-admin/images/wordpress-logo.png new file mode 100644 index 0000000..7421f21 Binary files /dev/null and b/src/wp-admin/images/wordpress-logo.png differ diff --git a/src/wp-admin/images/wp-logo-vs.png b/src/wp-admin/images/wp-logo-vs.png new file mode 100644 index 0000000..13f3fa6 Binary files /dev/null and b/src/wp-admin/images/wp-logo-vs.png differ diff --git a/src/wp-admin/images/wp-logo.png b/src/wp-admin/images/wp-logo.png new file mode 100644 index 0000000..224f7c8 Binary files /dev/null and b/src/wp-admin/images/wp-logo.png differ diff --git a/src/wp-admin/images/wpspin_dark.gif b/src/wp-admin/images/wpspin_dark.gif new file mode 100644 index 0000000..daebe0d Binary files /dev/null and b/src/wp-admin/images/wpspin_dark.gif differ diff --git a/src/wp-admin/images/wpspin_light.gif b/src/wp-admin/images/wpspin_light.gif new file mode 100644 index 0000000..e10b97f Binary files /dev/null and b/src/wp-admin/images/wpspin_light.gif differ diff --git a/src/wp-admin/images/xit.gif b/src/wp-admin/images/xit.gif new file mode 100644 index 0000000..6f1cc4f Binary files /dev/null and b/src/wp-admin/images/xit.gif differ diff --git a/src/wp-admin/images/yes.png b/src/wp-admin/images/yes.png new file mode 100644 index 0000000..2f86f0a Binary files /dev/null and b/src/wp-admin/images/yes.png differ diff --git a/src/wp-admin/import.php b/src/wp-admin/import.php new file mode 100644 index 0000000..0200e56 --- /dev/null +++ b/src/wp-admin/import.php @@ -0,0 +1,147 @@ +' . __('This screen lists links to plugins to import data from blogging/content management platforms. Choose the platform you want to import from, and click Install Now when you are prompted in the popup window. If your platform is not listed, click the link to search the plugin directory for other importer plugins to see if there is one for your platform.') . '

' . + '

' . __('In previous versions of WordPress, all the importers were built-in, but they have been turned into plugins as of version 3.0 since most people only use them once or infrequently.') . '

' . + '

' . __('For more information:') . '

' . + '

' . __('Documentation on Import') . '

' . + '

' . __('Support Forums') . '

' +); + +$popular_importers = array(); +if ( current_user_can('install_plugins') ) + $popular_importers = array( + 'blogger' => array( __('Blogger'), __('Install the Blogger importer to import posts, comments, and users from a Blogger blog.'), 'install' ), + 'wpcat2tag' => array(__('Categories and Tags Converter'), __('Install the category/tag converter to convert existing categories to tags or tags to categories, selectively.'), 'install', 'wp-cat2tag' ), + 'livejournal' => array( __( 'LiveJournal' ), __( 'Install the LiveJournal importer to import posts from LiveJournal using their API.' ), 'install' ), + 'movabletype' => array( __('Movable Type and TypePad'), __('Install the Movable Type importer to import posts and comments from a Movable Type or TypePad blog.'), 'install', 'mt' ), + 'opml' => array( __('Blogroll'), __('Install the blogroll importer to import links in OPML format.'), 'install' ), + 'rss' => array( __('RSS'), __('Install the RSS importer to import posts from an RSS feed.'), 'install' ), + 'wordpress' => array( 'WordPress', __('Install the WordPress importer to import posts, pages, comments, custom fields, categories, and tags from a WordPress export file.'), 'install' ) + ); + +if ( ! empty( $_GET['invalid'] ) && !empty($popular_importers[$_GET['invalid']][3]) ) { + wp_redirect( admin_url('import.php?import=' . $popular_importers[$_GET['invalid']][3]) ); + exit; +} + +add_thickbox(); +wp_enqueue_script( 'plugin-install' ); +wp_admin_css( 'plugin-install' ); + +require_once ('admin-header.php'); +$parent_file = 'tools.php'; +?> + +
+ +

+ +

%s importer is invalid or is not installed.'), esc_html( $_GET['invalid'] ) ); ?>

+ +

+ + $pop_data ) { + if ( isset($importers[$pop_importer] ) ) + continue; + if ( isset( $pop_data[3] ) && isset( $importers[ $pop_data[3] ] ) ) + continue; + + $importers[$pop_importer] = $popular_importers[$pop_importer]; +} + +if (empty ($importers)) { + echo '

'.__('No importers are available.').'

'; // TODO: make more helpful +} else { + uasort($importers, create_function('$a, $b', 'return strcmp($a[0], $b[0]);')); +?> + + + $data) { + $style = ('class="alternate"' == $style || 'class="alternate active"' == $style) ? '' : 'alternate'; + $action = ''; + if ( 'install' == $data[2] ) { + $plugin_slug = $id . '-importer'; + if ( file_exists( WP_PLUGIN_DIR . '/' . $plugin_slug ) ) { + // Looks like Importer is installed, But not active + $plugins = get_plugins( '/' . $plugin_slug ); + if ( !empty($plugins) ) { + $keys = array_keys($plugins); + $plugin_file = $plugin_slug . '/' . $keys[0]; + $action = '' . $data[0] . ''; + } + } + if ( empty($action) ) + $action = '' . $data[0] . ''; + } else { + $action = "{$data[0]}"; + } + + if ($style != '') + $style = 'class="'.$style.'"'; + echo " + + + + "; + } +?> + +
$action{$data[1]}
+' . sprintf( __('If the importer you need is not listed, search the plugins directory to see if an importer is available.'), esc_url( network_admin_url( 'plugin-install.php?tab=search&type=tag&s=importer' ) ) ) . '

'; +?> + +
+ + diff --git a/src/wp-admin/includes/admin.php b/src/wp-admin/includes/admin.php new file mode 100644 index 0000000..37f5c8e --- /dev/null +++ b/src/wp-admin/includes/admin.php @@ -0,0 +1,64 @@ + diff --git a/src/wp-admin/includes/bookmark.php b/src/wp-admin/includes/bookmark.php new file mode 100644 index 0000000..0ed560c --- /dev/null +++ b/src/wp-admin/includes/bookmark.php @@ -0,0 +1,269 @@ +link_url = esc_url( $_GET['linkurl'] ); + else + $link->link_url = ''; + + if ( isset( $_GET['name'] ) ) + $link->link_name = esc_attr( $_GET['name'] ); + else + $link->link_name = ''; + + $link->link_visible = 'Y'; + + return $link; +} + +/** + * Delete link specified from database + * + * @since 2.0.0 + * + * @param int $link_id ID of the link to delete + * @return bool True + */ +function wp_delete_link( $link_id ) { + global $wpdb; + + do_action( 'delete_link', $link_id ); + + wp_delete_object_term_relationships( $link_id, 'link_category' ); + + $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->links WHERE link_id = %d", $link_id ) ); + + do_action( 'deleted_link', $link_id ); + + clean_bookmark_cache( $link_id ); + + return true; +} + +/** + * Retrieves the link categories associated with the link specified. + * + * @since 2.1.0 + * + * @param int $link_id Link ID to look up + * @return array The requested link's categories + */ +function wp_get_link_cats( $link_id = 0 ) { + + $cats = wp_get_object_terms( $link_id, 'link_category', array('fields' => 'ids') ); + + return array_unique( $cats ); +} + +/** + * Retrieve link data based on ID. + * + * @since 2.0.0 + * + * @param int $link_id ID of link to retrieve + * @return object Link for editing + */ +function get_link_to_edit( $link_id ) { + return get_bookmark( $link_id, OBJECT, 'edit' ); +} + +/** + * This function inserts/updates links into/in the database. + * + * @since 2.0.0 + * + * @param array $linkdata Elements that make up the link to insert. + * @param bool $wp_error Optional. If true return WP_Error object on failure. + * @return int|WP_Error Value 0 or WP_Error on failure. The link ID on success. + */ +function wp_insert_link( $linkdata, $wp_error = false ) { + global $wpdb; + + $defaults = array( 'link_id' => 0, 'link_name' => '', 'link_url' => '', 'link_rating' => 0 ); + + $linkdata = wp_parse_args( $linkdata, $defaults ); + $linkdata = sanitize_bookmark( $linkdata, 'db' ); + + extract( stripslashes_deep( $linkdata ), EXTR_SKIP ); + + $update = false; + + if ( !empty( $link_id ) ) + $update = true; + + if ( trim( $link_name ) == '' ) { + if ( trim( $link_url ) != '' ) { + $link_name = $link_url; + } else { + return 0; + } + } + + if ( trim( $link_url ) == '' ) + return 0; + + if ( empty( $link_rating ) ) + $link_rating = 0; + + if ( empty( $link_image ) ) + $link_image = ''; + + if ( empty( $link_target ) ) + $link_target = ''; + + if ( empty( $link_visible ) ) + $link_visible = 'Y'; + + if ( empty( $link_owner ) ) + $link_owner = get_current_user_id(); + + if ( empty( $link_notes ) ) + $link_notes = ''; + + if ( empty( $link_description ) ) + $link_description = ''; + + if ( empty( $link_rss ) ) + $link_rss = ''; + + if ( empty( $link_rel ) ) + $link_rel = ''; + + // Make sure we set a valid category + if ( ! isset( $link_category ) || 0 == count( $link_category ) || !is_array( $link_category ) ) { + $link_category = array( get_option( 'default_link_category' ) ); + } + + if ( $update ) { + if ( false === $wpdb->update( $wpdb->links, compact('link_url', 'link_name', 'link_image', 'link_target', 'link_description', 'link_visible', 'link_rating', 'link_rel', 'link_notes', 'link_rss'), compact('link_id') ) ) { + if ( $wp_error ) + return new WP_Error( 'db_update_error', __( 'Could not update link in the database' ), $wpdb->last_error ); + else + return 0; + } + } else { + if ( false === $wpdb->insert( $wpdb->links, compact('link_url', 'link_name', 'link_image', 'link_target', 'link_description', 'link_visible', 'link_owner', 'link_rating', 'link_rel', 'link_notes', 'link_rss') ) ) { + if ( $wp_error ) + return new WP_Error( 'db_insert_error', __( 'Could not insert link into the database' ), $wpdb->last_error ); + else + return 0; + } + $link_id = (int) $wpdb->insert_id; + } + + wp_set_link_cats( $link_id, $link_category ); + + if ( $update ) + do_action( 'edit_link', $link_id ); + else + do_action( 'add_link', $link_id ); + + clean_bookmark_cache( $link_id ); + + return $link_id; +} + +/** + * Update link with the specified link categories. + * + * @since 2.1.0 + * + * @param int $link_id ID of link to update + * @param array $link_categories Array of categories to + */ +function wp_set_link_cats( $link_id = 0, $link_categories = array() ) { + // If $link_categories isn't already an array, make it one: + if ( !is_array( $link_categories ) || 0 == count( $link_categories ) ) + $link_categories = array( get_option( 'default_link_category' ) ); + + $link_categories = array_map( 'intval', $link_categories ); + $link_categories = array_unique( $link_categories ); + + wp_set_object_terms( $link_id, $link_categories, 'link_category' ); + + clean_bookmark_cache( $link_id ); +} + +/** + * Update a link in the database. + * + * @since 2.0.0 + * + * @param array $linkdata Link data to update. + * @return int|WP_Error Value 0 or WP_Error on failure. The updated link ID on success. + */ +function wp_update_link( $linkdata ) { + $link_id = (int) $linkdata['link_id']; + + $link = get_bookmark( $link_id, ARRAY_A ); + + // Escape data pulled from DB. + $link = add_magic_quotes( $link ); + + // Passed link category list overwrites existing category list if not empty. + if ( isset( $linkdata['link_category'] ) && is_array( $linkdata['link_category'] ) + && 0 != count( $linkdata['link_category'] ) ) + $link_cats = $linkdata['link_category']; + else + $link_cats = $link['link_category']; + + // Merge old and new fields with new fields overwriting old ones. + $linkdata = array_merge( $link, $linkdata ); + $linkdata['link_category'] = $link_cats; + + return wp_insert_link( $linkdata ); +} + +?> diff --git a/src/wp-admin/includes/class-ftp-pure.php b/src/wp-admin/includes/class-ftp-pure.php new file mode 100644 index 0000000..c947f44 --- /dev/null +++ b/src/wp-admin/includes/class-ftp-pure.php @@ -0,0 +1,190 @@ +__construct($verb, $le); + } + + function __construct($verb=FALSE, $le=FALSE) { + parent::__construct(false, $verb, $le); + } + +// +// +// + + function _settimeout($sock) { + if(!@stream_set_timeout($sock, $this->_timeout)) { + $this->PushError('_settimeout','socket set send timeout'); + $this->_quit(); + return FALSE; + } + return TRUE; + } + + function _connect($host, $port) { + $this->SendMSG("Creating socket"); + $sock = @fsockopen($host, $port, $errno, $errstr, $this->_timeout); + if (!$sock) { + $this->PushError('_connect','socket connect failed', $errstr." (".$errno.")"); + return FALSE; + } + $this->_connected=true; + return $sock; + } + + function _readmsg($fnction="_readmsg"){ + if(!$this->_connected) { + $this->PushError($fnction, 'Connect first'); + return FALSE; + } + $result=true; + $this->_message=""; + $this->_code=0; + $go=true; + do { + $tmp=@fgets($this->_ftp_control_sock, 512); + if($tmp===false) { + $go=$result=false; + $this->PushError($fnction,'Read failed'); + } else { + $this->_message.=$tmp; + if(preg_match("/^([0-9]{3})(-(.*[".CRLF."]{1,2})+\\1)? [^".CRLF."]+[".CRLF."]{1,2}$/", $this->_message, $regs)) $go=false; + } + } while($go); + if($this->LocalEcho) echo "GET < ".rtrim($this->_message, CRLF).CRLF; + $this->_code=(int)$regs[1]; + return $result; + } + + function _exec($cmd, $fnction="_exec") { + if(!$this->_ready) { + $this->PushError($fnction,'Connect first'); + return FALSE; + } + if($this->LocalEcho) echo "PUT > ",$cmd,CRLF; + $status=@fputs($this->_ftp_control_sock, $cmd.CRLF); + if($status===false) { + $this->PushError($fnction,'socket write failed'); + return FALSE; + } + $this->_lastaction=time(); + if(!$this->_readmsg($fnction)) return FALSE; + return TRUE; + } + + function _data_prepare($mode=FTP_ASCII) { + if(!$this->_settype($mode)) return FALSE; + if($this->_passive) { + if(!$this->_exec("PASV", "pasv")) { + $this->_data_close(); + return FALSE; + } + if(!$this->_checkCode()) { + $this->_data_close(); + return FALSE; + } + $ip_port = explode(",", ereg_replace("^.+ \\(?([0-9]{1,3},[0-9]{1,3},[0-9]{1,3},[0-9]{1,3},[0-9]+,[0-9]+)\\)?.*".CRLF."$", "\\1", $this->_message)); + $this->_datahost=$ip_port[0].".".$ip_port[1].".".$ip_port[2].".".$ip_port[3]; + $this->_dataport=(((int)$ip_port[4])<<8) + ((int)$ip_port[5]); + $this->SendMSG("Connecting to ".$this->_datahost.":".$this->_dataport); + $this->_ftp_data_sock=@fsockopen($this->_datahost, $this->_dataport, $errno, $errstr, $this->_timeout); + if(!$this->_ftp_data_sock) { + $this->PushError("_data_prepare","fsockopen fails", $errstr." (".$errno.")"); + $this->_data_close(); + return FALSE; + } + else $this->_ftp_data_sock; + } else { + $this->SendMSG("Only passive connections available!"); + return FALSE; + } + return TRUE; + } + + function _data_read($mode=FTP_ASCII, $fp=NULL) { + if(is_resource($fp)) $out=0; + else $out=""; + if(!$this->_passive) { + $this->SendMSG("Only passive connections available!"); + return FALSE; + } + while (!feof($this->_ftp_data_sock)) { + $block=fread($this->_ftp_data_sock, $this->_ftp_buff_size); + if($mode!=FTP_BINARY) $block=preg_replace("/\r\n|\r|\n/", $this->_eol_code[$this->OS_local], $block); + if(is_resource($fp)) $out+=fwrite($fp, $block, strlen($block)); + else $out.=$block; + } + return $out; + } + + function _data_write($mode=FTP_ASCII, $fp=NULL) { + if(is_resource($fp)) $out=0; + else $out=""; + if(!$this->_passive) { + $this->SendMSG("Only passive connections available!"); + return FALSE; + } + if(is_resource($fp)) { + while(!feof($fp)) { + $block=fread($fp, $this->_ftp_buff_size); + if(!$this->_data_write_block($mode, $block)) return false; + } + } elseif(!$this->_data_write_block($mode, $fp)) return false; + return TRUE; + } + + function _data_write_block($mode, $block) { + if($mode!=FTP_BINARY) $block=preg_replace("/\r\n|\r|\n/", $this->_eol_code[$this->OS_remote], $block); + do { + if(($t=@fwrite($this->_ftp_data_sock, $block))===FALSE) { + $this->PushError("_data_write","Can't write to socket"); + return FALSE; + } + $block=substr($block, $t); + } while(!empty($block)); + return true; + } + + function _data_close() { + @fclose($this->_ftp_data_sock); + $this->SendMSG("Disconnected data from remote host"); + return TRUE; + } + + function _quit($force=FALSE) { + if($this->_connected or $force) { + @fclose($this->_ftp_control_sock); + $this->_connected=false; + $this->SendMSG("Socket closed"); + } + } +} + +?> diff --git a/src/wp-admin/includes/class-ftp-sockets.php b/src/wp-admin/includes/class-ftp-sockets.php new file mode 100644 index 0000000..4026dd0 --- /dev/null +++ b/src/wp-admin/includes/class-ftp-sockets.php @@ -0,0 +1,250 @@ +__construct($verb, $le); + } + + function __construct($verb=FALSE, $le=FALSE) { + parent::__construct(true, $verb, $le); + } + +// +// +// + + function _settimeout($sock) { + if(!@socket_set_option($sock, SOL_SOCKET, SO_RCVTIMEO, array("sec"=>$this->_timeout, "usec"=>0))) { + $this->PushError('_connect','socket set receive timeout',socket_strerror(socket_last_error($sock))); + @socket_close($sock); + return FALSE; + } + if(!@socket_set_option($sock, SOL_SOCKET , SO_SNDTIMEO, array("sec"=>$this->_timeout, "usec"=>0))) { + $this->PushError('_connect','socket set send timeout',socket_strerror(socket_last_error($sock))); + @socket_close($sock); + return FALSE; + } + return true; + } + + function _connect($host, $port) { + $this->SendMSG("Creating socket"); + if(!($sock = @socket_create(AF_INET, SOCK_STREAM, SOL_TCP))) { + $this->PushError('_connect','socket create failed',socket_strerror(socket_last_error($sock))); + return FALSE; + } + if(!$this->_settimeout($sock)) return FALSE; + $this->SendMSG("Connecting to \"".$host.":".$port."\""); + if (!($res = @socket_connect($sock, $host, $port))) { + $this->PushError('_connect','socket connect failed',socket_strerror(socket_last_error($sock))); + @socket_close($sock); + return FALSE; + } + $this->_connected=true; + return $sock; + } + + function _readmsg($fnction="_readmsg"){ + if(!$this->_connected) { + $this->PushError($fnction,'Connect first'); + return FALSE; + } + $result=true; + $this->_message=""; + $this->_code=0; + $go=true; + do { + $tmp=@socket_read($this->_ftp_control_sock, 4096, PHP_BINARY_READ); + if($tmp===false) { + $go=$result=false; + $this->PushError($fnction,'Read failed', socket_strerror(socket_last_error($this->_ftp_control_sock))); + } else { + $this->_message.=$tmp; + $go = !preg_match("/^([0-9]{3})(-.+\\1)? [^".CRLF."]+".CRLF."$/Us", $this->_message, $regs); + } + } while($go); + if($this->LocalEcho) echo "GET < ".rtrim($this->_message, CRLF).CRLF; + $this->_code=(int)$regs[1]; + return $result; + } + + function _exec($cmd, $fnction="_exec") { + if(!$this->_ready) { + $this->PushError($fnction,'Connect first'); + return FALSE; + } + if($this->LocalEcho) echo "PUT > ",$cmd,CRLF; + $status=@socket_write($this->_ftp_control_sock, $cmd.CRLF); + if($status===false) { + $this->PushError($fnction,'socket write failed', socket_strerror(socket_last_error($this->stream))); + return FALSE; + } + $this->_lastaction=time(); + if(!$this->_readmsg($fnction)) return FALSE; + return TRUE; + } + + function _data_prepare($mode=FTP_ASCII) { + if(!$this->_settype($mode)) return FALSE; + $this->SendMSG("Creating data socket"); + $this->_ftp_data_sock = @socket_create(AF_INET, SOCK_STREAM, SOL_TCP); + if ($this->_ftp_data_sock < 0) { + $this->PushError('_data_prepare','socket create failed',socket_strerror(socket_last_error($this->_ftp_data_sock))); + return FALSE; + } + if(!$this->_settimeout($this->_ftp_data_sock)) { + $this->_data_close(); + return FALSE; + } + if($this->_passive) { + if(!$this->_exec("PASV", "pasv")) { + $this->_data_close(); + return FALSE; + } + if(!$this->_checkCode()) { + $this->_data_close(); + return FALSE; + } + $ip_port = explode(",", ereg_replace("^.+ \\(?([0-9]{1,3},[0-9]{1,3},[0-9]{1,3},[0-9]{1,3},[0-9]+,[0-9]+)\\)?.*".CRLF."$", "\\1", $this->_message)); + $this->_datahost=$ip_port[0].".".$ip_port[1].".".$ip_port[2].".".$ip_port[3]; + $this->_dataport=(((int)$ip_port[4])<<8) + ((int)$ip_port[5]); + $this->SendMSG("Connecting to ".$this->_datahost.":".$this->_dataport); + if(!@socket_connect($this->_ftp_data_sock, $this->_datahost, $this->_dataport)) { + $this->PushError("_data_prepare","socket_connect", socket_strerror(socket_last_error($this->_ftp_data_sock))); + $this->_data_close(); + return FALSE; + } + else $this->_ftp_temp_sock=$this->_ftp_data_sock; + } else { + if(!@socket_getsockname($this->_ftp_control_sock, $addr, $port)) { + $this->PushError("_data_prepare","can't get control socket information", socket_strerror(socket_last_error($this->_ftp_control_sock))); + $this->_data_close(); + return FALSE; + } + if(!@socket_bind($this->_ftp_data_sock,$addr)){ + $this->PushError("_data_prepare","can't bind data socket", socket_strerror(socket_last_error($this->_ftp_data_sock))); + $this->_data_close(); + return FALSE; + } + if(!@socket_listen($this->_ftp_data_sock)) { + $this->PushError("_data_prepare","can't listen data socket", socket_strerror(socket_last_error($this->_ftp_data_sock))); + $this->_data_close(); + return FALSE; + } + if(!@socket_getsockname($this->_ftp_data_sock, $this->_datahost, $this->_dataport)) { + $this->PushError("_data_prepare","can't get data socket information", socket_strerror(socket_last_error($this->_ftp_data_sock))); + $this->_data_close(); + return FALSE; + } + if(!$this->_exec('PORT '.str_replace('.',',',$this->_datahost.'.'.($this->_dataport>>8).'.'.($this->_dataport&0x00FF)), "_port")) { + $this->_data_close(); + return FALSE; + } + if(!$this->_checkCode()) { + $this->_data_close(); + return FALSE; + } + } + return TRUE; + } + + function _data_read($mode=FTP_ASCII, $fp=NULL) { + $NewLine=$this->_eol_code[$this->OS_local]; + if(is_resource($fp)) $out=0; + else $out=""; + if(!$this->_passive) { + $this->SendMSG("Connecting to ".$this->_datahost.":".$this->_dataport); + $this->_ftp_temp_sock=socket_accept($this->_ftp_data_sock); + if($this->_ftp_temp_sock===FALSE) { + $this->PushError("_data_read","socket_accept", socket_strerror(socket_last_error($this->_ftp_temp_sock))); + $this->_data_close(); + return FALSE; + } + } + + while(($block=@socket_read($this->_ftp_temp_sock, $this->_ftp_buff_size, PHP_BINARY_READ))!==false) { + if($block==="") break; + if($mode!=FTP_BINARY) $block=preg_replace("/\r\n|\r|\n/", $this->_eol_code[$this->OS_local], $block); + if(is_resource($fp)) $out+=fwrite($fp, $block, strlen($block)); + else $out.=$block; + } + return $out; + } + + function _data_write($mode=FTP_ASCII, $fp=NULL) { + $NewLine=$this->_eol_code[$this->OS_local]; + if(is_resource($fp)) $out=0; + else $out=""; + if(!$this->_passive) { + $this->SendMSG("Connecting to ".$this->_datahost.":".$this->_dataport); + $this->_ftp_temp_sock=socket_accept($this->_ftp_data_sock); + if($this->_ftp_temp_sock===FALSE) { + $this->PushError("_data_write","socket_accept", socket_strerror(socket_last_error($this->_ftp_temp_sock))); + $this->_data_close(); + return false; + } + } + if(is_resource($fp)) { + while(!feof($fp)) { + $block=fread($fp, $this->_ftp_buff_size); + if(!$this->_data_write_block($mode, $block)) return false; + } + } elseif(!$this->_data_write_block($mode, $fp)) return false; + return true; + } + + function _data_write_block($mode, $block) { + if($mode!=FTP_BINARY) $block=preg_replace("/\r\n|\r|\n/", $this->_eol_code[$this->OS_remote], $block); + do { + if(($t=@socket_write($this->_ftp_temp_sock, $block))===FALSE) { + $this->PushError("_data_write","socket_write", socket_strerror(socket_last_error($this->_ftp_temp_sock))); + $this->_data_close(); + return FALSE; + } + $block=substr($block, $t); + } while(!empty($block)); + return true; + } + + function _data_close() { + @socket_close($this->_ftp_temp_sock); + @socket_close($this->_ftp_data_sock); + $this->SendMSG("Disconnected data from remote host"); + return TRUE; + } + + function _quit() { + if($this->_connected) { + @socket_close($this->_ftp_control_sock); + $this->_connected=false; + $this->SendMSG("Socket closed"); + } + } +} +?> diff --git a/src/wp-admin/includes/class-ftp.php b/src/wp-admin/includes/class-ftp.php new file mode 100644 index 0000000..1e35e74 --- /dev/null +++ b/src/wp-admin/includes/class-ftp.php @@ -0,0 +1,906 @@ +__construct($port_mode); + } + + function __construct($port_mode=FALSE, $verb=FALSE, $le=FALSE) { + $this->LocalEcho=$le; + $this->Verbose=$verb; + $this->_lastaction=NULL; + $this->_error_array=array(); + $this->_eol_code=array(FTP_OS_Unix=>"\n", FTP_OS_Mac=>"\r", FTP_OS_Windows=>"\r\n"); + $this->AuthorizedTransferMode=array(FTP_AUTOASCII, FTP_ASCII, FTP_BINARY); + $this->OS_FullName=array(FTP_OS_Unix => 'UNIX', FTP_OS_Windows => 'WINDOWS', FTP_OS_Mac => 'MACOS'); + $this->AutoAsciiExt=array("ASP","BAT","C","CPP","CSS","CSV","JS","H","HTM","HTML","SHTML","INI","LOG","PHP3","PHTML","PL","PERL","SH","SQL","TXT"); + $this->_port_available=($port_mode==TRUE); + $this->SendMSG("Staring FTP client class".($this->_port_available?"":" without PORT mode support")); + $this->_connected=FALSE; + $this->_ready=FALSE; + $this->_can_restore=FALSE; + $this->_code=0; + $this->_message=""; + $this->_ftp_buff_size=4096; + $this->_curtype=NULL; + $this->SetUmask(0022); + $this->SetType(FTP_AUTOASCII); + $this->SetTimeout(30); + $this->Passive(!$this->_port_available); + $this->_login="anonymous"; + $this->_password="anon@ftp.com"; + $this->_features=array(); + $this->OS_local=FTP_OS_Unix; + $this->OS_remote=FTP_OS_Unix; + $this->features=array(); + if(strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') $this->OS_local=FTP_OS_Windows; + elseif(strtoupper(substr(PHP_OS, 0, 3)) === 'MAC') $this->OS_local=FTP_OS_Mac; + } + +// +// +// + + function parselisting($line) { + $is_windows = ($this->OS_remote == FTP_OS_Windows); + if ($is_windows && preg_match("/([0-9]{2})-([0-9]{2})-([0-9]{2}) +([0-9]{2}):([0-9]{2})(AM|PM) +([0-9]+|) +(.+)/",$line,$lucifer)) { + $b = array(); + if ($lucifer[3]<70) { $lucifer[3]+=2000; } else { $lucifer[3]+=1900; } // 4digit year fix + $b['isdir'] = ($lucifer[7]==""); + if ( $b['isdir'] ) + $b['type'] = 'd'; + else + $b['type'] = 'f'; + $b['size'] = $lucifer[7]; + $b['month'] = $lucifer[1]; + $b['day'] = $lucifer[2]; + $b['year'] = $lucifer[3]; + $b['hour'] = $lucifer[4]; + $b['minute'] = $lucifer[5]; + $b['time'] = @mktime($lucifer[4]+(strcasecmp($lucifer[6],"PM")==0?12:0),$lucifer[5],0,$lucifer[1],$lucifer[2],$lucifer[3]); + $b['am/pm'] = $lucifer[6]; + $b['name'] = $lucifer[8]; + } else if (!$is_windows && $lucifer=preg_split("/[ ]/",$line,9,PREG_SPLIT_NO_EMPTY)) { + //echo $line."\n"; + $lcount=count($lucifer); + if ($lcount<8) return ''; + $b = array(); + $b['isdir'] = $lucifer[0]{0} === "d"; + $b['islink'] = $lucifer[0]{0} === "l"; + if ( $b['isdir'] ) + $b['type'] = 'd'; + elseif ( $b['islink'] ) + $b['type'] = 'l'; + else + $b['type'] = 'f'; + $b['perms'] = $lucifer[0]; + $b['number'] = $lucifer[1]; + $b['owner'] = $lucifer[2]; + $b['group'] = $lucifer[3]; + $b['size'] = $lucifer[4]; + if ($lcount==8) { + sscanf($lucifer[5],"%d-%d-%d",$b['year'],$b['month'],$b['day']); + sscanf($lucifer[6],"%d:%d",$b['hour'],$b['minute']); + $b['time'] = @mktime($b['hour'],$b['minute'],0,$b['month'],$b['day'],$b['year']); + $b['name'] = $lucifer[7]; + } else { + $b['month'] = $lucifer[5]; + $b['day'] = $lucifer[6]; + if (preg_match("/([0-9]{2}):([0-9]{2})/",$lucifer[7],$l2)) { + $b['year'] = date("Y"); + $b['hour'] = $l2[1]; + $b['minute'] = $l2[2]; + } else { + $b['year'] = $lucifer[7]; + $b['hour'] = 0; + $b['minute'] = 0; + } + $b['time'] = strtotime(sprintf("%d %s %d %02d:%02d",$b['day'],$b['month'],$b['year'],$b['hour'],$b['minute'])); + $b['name'] = $lucifer[8]; + } + } + + return $b; + } + + function SendMSG($message = "", $crlf=true) { + if ($this->Verbose) { + echo $message.($crlf?CRLF:""); + flush(); + } + return TRUE; + } + + function SetType($mode=FTP_AUTOASCII) { + if(!in_array($mode, $this->AuthorizedTransferMode)) { + $this->SendMSG("Wrong type"); + return FALSE; + } + $this->_type=$mode; + $this->SendMSG("Transfer type: ".($this->_type==FTP_BINARY?"binary":($this->_type==FTP_ASCII?"ASCII":"auto ASCII") ) ); + return TRUE; + } + + function _settype($mode=FTP_ASCII) { + if($this->_ready) { + if($mode==FTP_BINARY) { + if($this->_curtype!=FTP_BINARY) { + if(!$this->_exec("TYPE I", "SetType")) return FALSE; + $this->_curtype=FTP_BINARY; + } + } elseif($this->_curtype!=FTP_ASCII) { + if(!$this->_exec("TYPE A", "SetType")) return FALSE; + $this->_curtype=FTP_ASCII; + } + } else return FALSE; + return TRUE; + } + + function Passive($pasv=NULL) { + if(is_null($pasv)) $this->_passive=!$this->_passive; + else $this->_passive=$pasv; + if(!$this->_port_available and !$this->_passive) { + $this->SendMSG("Only passive connections available!"); + $this->_passive=TRUE; + return FALSE; + } + $this->SendMSG("Passive mode ".($this->_passive?"on":"off")); + return TRUE; + } + + function SetServer($host, $port=21, $reconnect=true) { + if(!is_long($port)) { + $this->verbose=true; + $this->SendMSG("Incorrect port syntax"); + return FALSE; + } else { + $ip=@gethostbyname($host); + $dns=@gethostbyaddr($host); + if(!$ip) $ip=$host; + if(!$dns) $dns=$host; + // Validate the IPAddress PHP4 returns -1 for invalid, PHP5 false + // -1 === "255.255.255.255" which is the broadcast address which is also going to be invalid + $ipaslong = ip2long($ip); + if ( ($ipaslong == false) || ($ipaslong === -1) ) { + $this->SendMSG("Wrong host name/address \"".$host."\""); + return FALSE; + } + $this->_host=$ip; + $this->_fullhost=$dns; + $this->_port=$port; + $this->_dataport=$port-1; + } + $this->SendMSG("Host \"".$this->_fullhost."(".$this->_host."):".$this->_port."\""); + if($reconnect){ + if($this->_connected) { + $this->SendMSG("Reconnecting"); + if(!$this->quit(FTP_FORCE)) return FALSE; + if(!$this->connect()) return FALSE; + } + } + return TRUE; + } + + function SetUmask($umask=0022) { + $this->_umask=$umask; + umask($this->_umask); + $this->SendMSG("UMASK 0".decoct($this->_umask)); + return TRUE; + } + + function SetTimeout($timeout=30) { + $this->_timeout=$timeout; + $this->SendMSG("Timeout ".$this->_timeout); + if($this->_connected) + if(!$this->_settimeout($this->_ftp_control_sock)) return FALSE; + return TRUE; + } + + function connect($server=NULL) { + if(!empty($server)) { + if(!$this->SetServer($server)) return false; + } + if($this->_ready) return true; + $this->SendMsg('Local OS : '.$this->OS_FullName[$this->OS_local]); + if(!($this->_ftp_control_sock = $this->_connect($this->_host, $this->_port))) { + $this->SendMSG("Error : Cannot connect to remote host \"".$this->_fullhost." :".$this->_port."\""); + return FALSE; + } + $this->SendMSG("Connected to remote host \"".$this->_fullhost.":".$this->_port."\". Waiting for greeting."); + do { + if(!$this->_readmsg()) return FALSE; + if(!$this->_checkCode()) return FALSE; + $this->_lastaction=time(); + } while($this->_code<200); + $this->_ready=true; + $syst=$this->systype(); + if(!$syst) $this->SendMSG("Can't detect remote OS"); + else { + if(preg_match("/win|dos|novell/i", $syst[0])) $this->OS_remote=FTP_OS_Windows; + elseif(preg_match("/os/i", $syst[0])) $this->OS_remote=FTP_OS_Mac; + elseif(preg_match("/(li|u)nix/i", $syst[0])) $this->OS_remote=FTP_OS_Unix; + else $this->OS_remote=FTP_OS_Mac; + $this->SendMSG("Remote OS: ".$this->OS_FullName[$this->OS_remote]); + } + if(!$this->features()) $this->SendMSG("Can't get features list. All supported - disabled"); + else $this->SendMSG("Supported features: ".implode(", ", array_keys($this->_features))); + return TRUE; + } + + function quit($force=false) { + if($this->_ready) { + if(!$this->_exec("QUIT") and !$force) return FALSE; + if(!$this->_checkCode() and !$force) return FALSE; + $this->_ready=false; + $this->SendMSG("Session finished"); + } + $this->_quit(); + return TRUE; + } + + function login($user=NULL, $pass=NULL) { + if(!is_null($user)) $this->_login=$user; + else $this->_login="anonymous"; + if(!is_null($pass)) $this->_password=$pass; + else $this->_password="anon@anon.com"; + if(!$this->_exec("USER ".$this->_login, "login")) return FALSE; + if(!$this->_checkCode()) return FALSE; + if($this->_code!=230) { + if(!$this->_exec((($this->_code==331)?"PASS ":"ACCT ").$this->_password, "login")) return FALSE; + if(!$this->_checkCode()) return FALSE; + } + $this->SendMSG("Authentication succeeded"); + if(empty($this->_features)) { + if(!$this->features()) $this->SendMSG("Can't get features list. All supported - disabled"); + else $this->SendMSG("Supported features: ".implode(", ", array_keys($this->_features))); + } + return TRUE; + } + + function pwd() { + if(!$this->_exec("PWD", "pwd")) return FALSE; + if(!$this->_checkCode()) return FALSE; + return ereg_replace("^[0-9]{3} \"(.+)\".+", "\\1", $this->_message); + } + + function cdup() { + if(!$this->_exec("CDUP", "cdup")) return FALSE; + if(!$this->_checkCode()) return FALSE; + return true; + } + + function chdir($pathname) { + if(!$this->_exec("CWD ".$pathname, "chdir")) return FALSE; + if(!$this->_checkCode()) return FALSE; + return TRUE; + } + + function rmdir($pathname) { + if(!$this->_exec("RMD ".$pathname, "rmdir")) return FALSE; + if(!$this->_checkCode()) return FALSE; + return TRUE; + } + + function mkdir($pathname) { + if(!$this->_exec("MKD ".$pathname, "mkdir")) return FALSE; + if(!$this->_checkCode()) return FALSE; + return TRUE; + } + + function rename($from, $to) { + if(!$this->_exec("RNFR ".$from, "rename")) return FALSE; + if(!$this->_checkCode()) return FALSE; + if($this->_code==350) { + if(!$this->_exec("RNTO ".$to, "rename")) return FALSE; + if(!$this->_checkCode()) return FALSE; + } else return FALSE; + return TRUE; + } + + function filesize($pathname) { + if(!isset($this->_features["SIZE"])) { + $this->PushError("filesize", "not supported by server"); + return FALSE; + } + if(!$this->_exec("SIZE ".$pathname, "filesize")) return FALSE; + if(!$this->_checkCode()) return FALSE; + return ereg_replace("^[0-9]{3} ([0-9]+)".CRLF, "\\1", $this->_message); + } + + function abort() { + if(!$this->_exec("ABOR", "abort")) return FALSE; + if(!$this->_checkCode()) { + if($this->_code!=426) return FALSE; + if(!$this->_readmsg("abort")) return FALSE; + if(!$this->_checkCode()) return FALSE; + } + return true; + } + + function mdtm($pathname) { + if(!isset($this->_features["MDTM"])) { + $this->PushError("mdtm", "not supported by server"); + return FALSE; + } + if(!$this->_exec("MDTM ".$pathname, "mdtm")) return FALSE; + if(!$this->_checkCode()) return FALSE; + $mdtm = ereg_replace("^[0-9]{3} ([0-9]+)".CRLF, "\\1", $this->_message); + $date = sscanf($mdtm, "%4d%2d%2d%2d%2d%2d"); + $timestamp = mktime($date[3], $date[4], $date[5], $date[1], $date[2], $date[0]); + return $timestamp; + } + + function systype() { + if(!$this->_exec("SYST", "systype")) return FALSE; + if(!$this->_checkCode()) return FALSE; + $DATA = explode(" ", $this->_message); + return array($DATA[1], $DATA[3]); + } + + function delete($pathname) { + if(!$this->_exec("DELE ".$pathname, "delete")) return FALSE; + if(!$this->_checkCode()) return FALSE; + return TRUE; + } + + function site($command, $fnction="site") { + if(!$this->_exec("SITE ".$command, $fnction)) return FALSE; + if(!$this->_checkCode()) return FALSE; + return TRUE; + } + + function chmod($pathname, $mode) { + if(!$this->site( sprintf('CHMOD %o %s', $mode, $pathname), "chmod")) return FALSE; + return TRUE; + } + + function restore($from) { + if(!isset($this->_features["REST"])) { + $this->PushError("restore", "not supported by server"); + return FALSE; + } + if($this->_curtype!=FTP_BINARY) { + $this->PushError("restore", "can't restore in ASCII mode"); + return FALSE; + } + if(!$this->_exec("REST ".$from, "resore")) return FALSE; + if(!$this->_checkCode()) return FALSE; + return TRUE; + } + + function features() { + if(!$this->_exec("FEAT", "features")) return FALSE; + if(!$this->_checkCode()) return FALSE; + $f=preg_split("/[".CRLF."]+/", preg_replace("/[0-9]{3}[ -].*[".CRLF."]+/", "", $this->_message), -1, PREG_SPLIT_NO_EMPTY); + $this->_features=array(); + foreach($f as $k=>$v) { + $v=explode(" ", trim($v)); + $this->_features[array_shift($v)]=$v; + } + return true; + } + + function rawlist($pathname="", $arg="") { + return $this->_list(($arg?" ".$arg:"").($pathname?" ".$pathname:""), "LIST", "rawlist"); + } + + function nlist($pathname="") { + return $this->_list(($arg?" ".$arg:"").($pathname?" ".$pathname:""), "NLST", "nlist"); + } + + function is_exists($pathname) { + return $this->file_exists($pathname); + } + + function file_exists($pathname) { + $exists=true; + if(!$this->_exec("RNFR ".$pathname, "rename")) $exists=FALSE; + else { + if(!$this->_checkCode()) $exists=FALSE; + $this->abort(); + } + if($exists) $this->SendMSG("Remote file ".$pathname." exists"); + else $this->SendMSG("Remote file ".$pathname." does not exist"); + return $exists; + } + + function fget($fp, $remotefile,$rest=0) { + if($this->_can_restore and $rest!=0) fseek($fp, $rest); + $pi=pathinfo($remotefile); + if($this->_type==FTP_ASCII or ($this->_type==FTP_AUTOASCII and in_array(strtoupper($pi["extension"]), $this->AutoAsciiExt))) $mode=FTP_ASCII; + else $mode=FTP_BINARY; + if(!$this->_data_prepare($mode)) { + return FALSE; + } + if($this->_can_restore and $rest!=0) $this->restore($rest); + if(!$this->_exec("RETR ".$remotefile, "get")) { + $this->_data_close(); + return FALSE; + } + if(!$this->_checkCode()) { + $this->_data_close(); + return FALSE; + } + $out=$this->_data_read($mode, $fp); + $this->_data_close(); + if(!$this->_readmsg()) return FALSE; + if(!$this->_checkCode()) return FALSE; + return $out; + } + + function get($remotefile, $localfile=NULL, $rest=0) { + if(is_null($localfile)) $localfile=$remotefile; + if (@file_exists($localfile)) $this->SendMSG("Warning : local file will be overwritten"); + $fp = @fopen($localfile, "w"); + if (!$fp) { + $this->PushError("get","can't open local file", "Cannot create \"".$localfile."\""); + return FALSE; + } + if($this->_can_restore and $rest!=0) fseek($fp, $rest); + $pi=pathinfo($remotefile); + if($this->_type==FTP_ASCII or ($this->_type==FTP_AUTOASCII and in_array(strtoupper($pi["extension"]), $this->AutoAsciiExt))) $mode=FTP_ASCII; + else $mode=FTP_BINARY; + if(!$this->_data_prepare($mode)) { + fclose($fp); + return FALSE; + } + if($this->_can_restore and $rest!=0) $this->restore($rest); + if(!$this->_exec("RETR ".$remotefile, "get")) { + $this->_data_close(); + fclose($fp); + return FALSE; + } + if(!$this->_checkCode()) { + $this->_data_close(); + fclose($fp); + return FALSE; + } + $out=$this->_data_read($mode, $fp); + fclose($fp); + $this->_data_close(); + if(!$this->_readmsg()) return FALSE; + if(!$this->_checkCode()) return FALSE; + return $out; + } + + function fput($remotefile, $fp) { + if($this->_can_restore and $rest!=0) fseek($fp, $rest); + $pi=pathinfo($remotefile); + if($this->_type==FTP_ASCII or ($this->_type==FTP_AUTOASCII and in_array(strtoupper($pi["extension"]), $this->AutoAsciiExt))) $mode=FTP_ASCII; + else $mode=FTP_BINARY; + if(!$this->_data_prepare($mode)) { + return FALSE; + } + if($this->_can_restore and $rest!=0) $this->restore($rest); + if(!$this->_exec("STOR ".$remotefile, "put")) { + $this->_data_close(); + return FALSE; + } + if(!$this->_checkCode()) { + $this->_data_close(); + return FALSE; + } + $ret=$this->_data_write($mode, $fp); + $this->_data_close(); + if(!$this->_readmsg()) return FALSE; + if(!$this->_checkCode()) return FALSE; + return $ret; + } + + function put($localfile, $remotefile=NULL, $rest=0) { + if(is_null($remotefile)) $remotefile=$localfile; + if (!file_exists($localfile)) { + $this->PushError("put","can't open local file", "No such file or directory \"".$localfile."\""); + return FALSE; + } + $fp = @fopen($localfile, "r"); + + if (!$fp) { + $this->PushError("put","can't open local file", "Cannot read file \"".$localfile."\""); + return FALSE; + } + if($this->_can_restore and $rest!=0) fseek($fp, $rest); + $pi=pathinfo($localfile); + if($this->_type==FTP_ASCII or ($this->_type==FTP_AUTOASCII and in_array(strtoupper($pi["extension"]), $this->AutoAsciiExt))) $mode=FTP_ASCII; + else $mode=FTP_BINARY; + if(!$this->_data_prepare($mode)) { + fclose($fp); + return FALSE; + } + if($this->_can_restore and $rest!=0) $this->restore($rest); + if(!$this->_exec("STOR ".$remotefile, "put")) { + $this->_data_close(); + fclose($fp); + return FALSE; + } + if(!$this->_checkCode()) { + $this->_data_close(); + fclose($fp); + return FALSE; + } + $ret=$this->_data_write($mode, $fp); + fclose($fp); + $this->_data_close(); + if(!$this->_readmsg()) return FALSE; + if(!$this->_checkCode()) return FALSE; + return $ret; + } + + function mput($local=".", $remote=NULL, $continious=false) { + $local=realpath($local); + if(!@file_exists($local)) { + $this->PushError("mput","can't open local folder", "Cannot stat folder \"".$local."\""); + return FALSE; + } + if(!is_dir($local)) return $this->put($local, $remote); + if(empty($remote)) $remote="."; + elseif(!$this->file_exists($remote) and !$this->mkdir($remote)) return FALSE; + if($handle = opendir($local)) { + $list=array(); + while (false !== ($file = readdir($handle))) { + if ($file != "." && $file != "..") $list[]=$file; + } + closedir($handle); + } else { + $this->PushError("mput","can't open local folder", "Cannot read folder \"".$local."\""); + return FALSE; + } + if(empty($list)) return TRUE; + $ret=true; + foreach($list as $el) { + if(is_dir($local."/".$el)) $t=$this->mput($local."/".$el, $remote."/".$el); + else $t=$this->put($local."/".$el, $remote."/".$el); + if(!$t) { + $ret=FALSE; + if(!$continious) break; + } + } + return $ret; + + } + + function mget($remote, $local=".", $continious=false) { + $list=$this->rawlist($remote, "-lA"); + if($list===false) { + $this->PushError("mget","can't read remote folder list", "Can't read remote folder \"".$remote."\" contents"); + return FALSE; + } + if(empty($list)) return true; + if(!@file_exists($local)) { + if(!@mkdir($local)) { + $this->PushError("mget","can't create local folder", "Cannot create folder \"".$local."\""); + return FALSE; + } + } + foreach($list as $k=>$v) { + $list[$k]=$this->parselisting($v); + if($list[$k]["name"]=="." or $list[$k]["name"]=="..") unset($list[$k]); + } + $ret=true; + foreach($list as $el) { + if($el["type"]=="d") { + if(!$this->mget($remote."/".$el["name"], $local."/".$el["name"], $continious)) { + $this->PushError("mget", "can't copy folder", "Can't copy remote folder \"".$remote."/".$el["name"]."\" to local \"".$local."/".$el["name"]."\""); + $ret=false; + if(!$continious) break; + } + } else { + if(!$this->get($remote."/".$el["name"], $local."/".$el["name"])) { + $this->PushError("mget", "can't copy file", "Can't copy remote file \"".$remote."/".$el["name"]."\" to local \"".$local."/".$el["name"]."\""); + $ret=false; + if(!$continious) break; + } + } + @chmod($local."/".$el["name"], $el["perms"]); + $t=strtotime($el["date"]); + if($t!==-1 and $t!==false) @touch($local."/".$el["name"], $t); + } + return $ret; + } + + function mdel($remote, $continious=false) { + $list=$this->rawlist($remote, "-la"); + if($list===false) { + $this->PushError("mdel","can't read remote folder list", "Can't read remote folder \"".$remote."\" contents"); + return false; + } + + foreach($list as $k=>$v) { + $list[$k]=$this->parselisting($v); + if($list[$k]["name"]=="." or $list[$k]["name"]=="..") unset($list[$k]); + } + $ret=true; + + foreach($list as $el) { + if ( empty($el) ) + continue; + + if($el["type"]=="d") { + if(!$this->mdel($remote."/".$el["name"], $continious)) { + $ret=false; + if(!$continious) break; + } + } else { + if (!$this->delete($remote."/".$el["name"])) { + $this->PushError("mdel", "can't delete file", "Can't delete remote file \"".$remote."/".$el["name"]."\""); + $ret=false; + if(!$continious) break; + } + } + } + + if(!$this->rmdir($remote)) { + $this->PushError("mdel", "can't delete folder", "Can't delete remote folder \"".$remote."/".$el["name"]."\""); + $ret=false; + } + return $ret; + } + + function mmkdir($dir, $mode = 0777) { + if(empty($dir)) return FALSE; + if($this->is_exists($dir) or $dir == "/" ) return TRUE; + if(!$this->mmkdir(dirname($dir), $mode)) return false; + $r=$this->mkdir($dir, $mode); + $this->chmod($dir,$mode); + return $r; + } + + function glob($pattern, $handle=NULL) { + $path=$output=null; + if(PHP_OS=='WIN32') $slash='\\'; + else $slash='/'; + $lastpos=strrpos($pattern,$slash); + if(!($lastpos===false)) { + $path=substr($pattern,0,-$lastpos-1); + $pattern=substr($pattern,$lastpos); + } else $path=getcwd(); + if(is_array($handle) and !empty($handle)) { + while($dir=each($handle)) { + if($this->glob_pattern_match($pattern,$dir)) + $output[]=$dir; + } + } else { + $handle=@opendir($path); + if($handle===false) return false; + while($dir=readdir($handle)) { + if($this->glob_pattern_match($pattern,$dir)) + $output[]=$dir; + } + closedir($handle); + } + if(is_array($output)) return $output; + return false; + } + + function glob_pattern_match($pattern,$string) { + $out=null; + $chunks=explode(';',$pattern); + foreach($chunks as $pattern) { + $escape=array('$','^','.','{','}','(',')','[',']','|'); + while(strpos($pattern,'**')!==false) + $pattern=str_replace('**','*',$pattern); + foreach($escape as $probe) + $pattern=str_replace($probe,"\\$probe",$pattern); + $pattern=str_replace('?*','*', + str_replace('*?','*', + str_replace('*',".*", + str_replace('?','.{1,1}',$pattern)))); + $out[]=$pattern; + } + if(count($out)==1) return($this->glob_regexp("^$out[0]$",$string)); + else { + foreach($out as $tester) + if($this->my_regexp("^$tester$",$string)) return true; + } + return false; + } + + function glob_regexp($pattern,$probe) { + $sensitive=(PHP_OS!='WIN32'); + return ($sensitive? + ereg($pattern,$probe): + eregi($pattern,$probe) + ); + } + + function dirlist($remote) { + $list=$this->rawlist($remote, "-la"); + if($list===false) { + $this->PushError("dirlist","can't read remote folder list", "Can't read remote folder \"".$remote."\" contents"); + return false; + } + + $dirlist = array(); + foreach($list as $k=>$v) { + $entry=$this->parselisting($v); + if ( empty($entry) ) + continue; + + if($entry["name"]=="." or $entry["name"]=="..") + continue; + + $dirlist[$entry['name']] = $entry; + } + + return $dirlist; + } +// +// +// + function _checkCode() { + return ($this->_code<400 and $this->_code>0); + } + + function _list($arg="", $cmd="LIST", $fnction="_list") { + if(!$this->_data_prepare()) return false; + if(!$this->_exec($cmd.$arg, $fnction)) { + $this->_data_close(); + return FALSE; + } + if(!$this->_checkCode()) { + $this->_data_close(); + return FALSE; + } + $out=""; + if($this->_code<200) { + $out=$this->_data_read(); + $this->_data_close(); + if(!$this->_readmsg()) return FALSE; + if(!$this->_checkCode()) return FALSE; + if($out === FALSE ) return FALSE; + $out=preg_split("/[".CRLF."]+/", $out, -1, PREG_SPLIT_NO_EMPTY); +// $this->SendMSG(implode($this->_eol_code[$this->OS_local], $out)); + } + return $out; + } + +// +// +// +// Gnre une erreur pour traitement externe la classe + function PushError($fctname,$msg,$desc=false){ + $error=array(); + $error['time']=time(); + $error['fctname']=$fctname; + $error['msg']=$msg; + $error['desc']=$desc; + if($desc) $tmp=' ('.$desc.')'; else $tmp=''; + $this->SendMSG($fctname.': '.$msg.$tmp); + return(array_push($this->_error_array,$error)); + } + +// Rcupre une erreur externe + function PopError(){ + if(count($this->_error_array)) return(array_pop($this->_error_array)); + else return(false); + } +} + +$mod_sockets=TRUE; +if (!extension_loaded('sockets')) { + $prefix = (PHP_SHLIB_SUFFIX == 'dll') ? 'php_' : ''; + if(!@dl($prefix . 'sockets.' . PHP_SHLIB_SUFFIX)) $mod_sockets=FALSE; +} + +require_once "class-ftp-".($mod_sockets?"sockets":"pure").".php"; +?> diff --git a/src/wp-admin/includes/class-pclzip.php b/src/wp-admin/includes/class-pclzip.php new file mode 100644 index 0000000..5e6a619 --- /dev/null +++ b/src/wp-admin/includes/class-pclzip.php @@ -0,0 +1,5687 @@ +zipname = $p_zipname; + $this->zip_fd = 0; + $this->magic_quotes_status = -1; + + // ----- Return + return; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : + // create($p_filelist, $p_add_dir="", $p_remove_dir="") + // create($p_filelist, $p_option, $p_option_value, ...) + // Description : + // This method supports two different synopsis. The first one is historical. + // This method creates a Zip Archive. The Zip file is created in the + // filesystem. The files and directories indicated in $p_filelist + // are added in the archive. See the parameters description for the + // supported format of $p_filelist. + // When a directory is in the list, the directory and its content is added + // in the archive. + // In this synopsis, the function takes an optional variable list of + // options. See bellow the supported options. + // Parameters : + // $p_filelist : An array containing file or directory names, or + // a string containing one filename or one directory name, or + // a string containing a list of filenames and/or directory + // names separated by spaces. + // $p_add_dir : A path to add before the real path of the archived file, + // in order to have it memorized in the archive. + // $p_remove_dir : A path to remove from the real path of the file to archive, + // in order to have a shorter path memorized in the archive. + // When $p_add_dir and $p_remove_dir are set, $p_remove_dir + // is removed first, before $p_add_dir is added. + // Options : + // PCLZIP_OPT_ADD_PATH : + // PCLZIP_OPT_REMOVE_PATH : + // PCLZIP_OPT_REMOVE_ALL_PATH : + // PCLZIP_OPT_COMMENT : + // PCLZIP_CB_PRE_ADD : + // PCLZIP_CB_POST_ADD : + // Return Values : + // 0 on failure, + // The list of the added files, with a status of the add action. + // (see PclZip::listContent() for list entry format) + // -------------------------------------------------------------------------------- + function create($p_filelist) + { + $v_result=1; + + // ----- Reset the error handler + $this->privErrorReset(); + + // ----- Set default values + $v_options = array(); + $v_options[PCLZIP_OPT_NO_COMPRESSION] = FALSE; + + // ----- Look for variable options arguments + $v_size = func_num_args(); + + // ----- Look for arguments + if ($v_size > 1) { + // ----- Get the arguments + $v_arg_list = func_get_args(); + + // ----- Remove from the options list the first argument + array_shift($v_arg_list); + $v_size--; + + // ----- Look for first arg + if ((is_integer($v_arg_list[0])) && ($v_arg_list[0] > 77000)) { + + // ----- Parse the options + $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options, + array (PCLZIP_OPT_REMOVE_PATH => 'optional', + PCLZIP_OPT_REMOVE_ALL_PATH => 'optional', + PCLZIP_OPT_ADD_PATH => 'optional', + PCLZIP_CB_PRE_ADD => 'optional', + PCLZIP_CB_POST_ADD => 'optional', + PCLZIP_OPT_NO_COMPRESSION => 'optional', + PCLZIP_OPT_COMMENT => 'optional', + PCLZIP_OPT_TEMP_FILE_THRESHOLD => 'optional', + PCLZIP_OPT_TEMP_FILE_ON => 'optional', + PCLZIP_OPT_TEMP_FILE_OFF => 'optional' + //, PCLZIP_OPT_CRYPT => 'optional' + )); + if ($v_result != 1) { + return 0; + } + } + + // ----- Look for 2 args + // Here we need to support the first historic synopsis of the + // method. + else { + + // ----- Get the first argument + $v_options[PCLZIP_OPT_ADD_PATH] = $v_arg_list[0]; + + // ----- Look for the optional second argument + if ($v_size == 2) { + $v_options[PCLZIP_OPT_REMOVE_PATH] = $v_arg_list[1]; + } + else if ($v_size > 2) { + PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, + "Invalid number / type of arguments"); + return 0; + } + } + } + + // ----- Look for default option values + $this->privOptionDefaultThreshold($v_options); + + // ----- Init + $v_string_list = array(); + $v_att_list = array(); + $v_filedescr_list = array(); + $p_result_list = array(); + + // ----- Look if the $p_filelist is really an array + if (is_array($p_filelist)) { + + // ----- Look if the first element is also an array + // This will mean that this is a file description entry + if (isset($p_filelist[0]) && is_array($p_filelist[0])) { + $v_att_list = $p_filelist; + } + + // ----- The list is a list of string names + else { + $v_string_list = $p_filelist; + } + } + + // ----- Look if the $p_filelist is a string + else if (is_string($p_filelist)) { + // ----- Create a list from the string + $v_string_list = explode(PCLZIP_SEPARATOR, $p_filelist); + } + + // ----- Invalid variable type for $p_filelist + else { + PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid variable type p_filelist"); + return 0; + } + + // ----- Reformat the string list + if (sizeof($v_string_list) != 0) { + foreach ($v_string_list as $v_string) { + if ($v_string != '') { + $v_att_list[][PCLZIP_ATT_FILE_NAME] = $v_string; + } + else { + } + } + } + + // ----- For each file in the list check the attributes + $v_supported_attributes + = array ( PCLZIP_ATT_FILE_NAME => 'mandatory' + ,PCLZIP_ATT_FILE_NEW_SHORT_NAME => 'optional' + ,PCLZIP_ATT_FILE_NEW_FULL_NAME => 'optional' + ,PCLZIP_ATT_FILE_MTIME => 'optional' + ,PCLZIP_ATT_FILE_CONTENT => 'optional' + ,PCLZIP_ATT_FILE_COMMENT => 'optional' + ); + foreach ($v_att_list as $v_entry) { + $v_result = $this->privFileDescrParseAtt($v_entry, + $v_filedescr_list[], + $v_options, + $v_supported_attributes); + if ($v_result != 1) { + return 0; + } + } + + // ----- Expand the filelist (expand directories) + $v_result = $this->privFileDescrExpand($v_filedescr_list, $v_options); + if ($v_result != 1) { + return 0; + } + + // ----- Call the create fct + $v_result = $this->privCreate($v_filedescr_list, $p_result_list, $v_options); + if ($v_result != 1) { + return 0; + } + + // ----- Return + return $p_result_list; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : + // add($p_filelist, $p_add_dir="", $p_remove_dir="") + // add($p_filelist, $p_option, $p_option_value, ...) + // Description : + // This method supports two synopsis. The first one is historical. + // This methods add the list of files in an existing archive. + // If a file with the same name already exists, it is added at the end of the + // archive, the first one is still present. + // If the archive does not exist, it is created. + // Parameters : + // $p_filelist : An array containing file or directory names, or + // a string containing one filename or one directory name, or + // a string containing a list of filenames and/or directory + // names separated by spaces. + // $p_add_dir : A path to add before the real path of the archived file, + // in order to have it memorized in the archive. + // $p_remove_dir : A path to remove from the real path of the file to archive, + // in order to have a shorter path memorized in the archive. + // When $p_add_dir and $p_remove_dir are set, $p_remove_dir + // is removed first, before $p_add_dir is added. + // Options : + // PCLZIP_OPT_ADD_PATH : + // PCLZIP_OPT_REMOVE_PATH : + // PCLZIP_OPT_REMOVE_ALL_PATH : + // PCLZIP_OPT_COMMENT : + // PCLZIP_OPT_ADD_COMMENT : + // PCLZIP_OPT_PREPEND_COMMENT : + // PCLZIP_CB_PRE_ADD : + // PCLZIP_CB_POST_ADD : + // Return Values : + // 0 on failure, + // The list of the added files, with a status of the add action. + // (see PclZip::listContent() for list entry format) + // -------------------------------------------------------------------------------- + function add($p_filelist) + { + $v_result=1; + + // ----- Reset the error handler + $this->privErrorReset(); + + // ----- Set default values + $v_options = array(); + $v_options[PCLZIP_OPT_NO_COMPRESSION] = FALSE; + + // ----- Look for variable options arguments + $v_size = func_num_args(); + + // ----- Look for arguments + if ($v_size > 1) { + // ----- Get the arguments + $v_arg_list = func_get_args(); + + // ----- Remove form the options list the first argument + array_shift($v_arg_list); + $v_size--; + + // ----- Look for first arg + if ((is_integer($v_arg_list[0])) && ($v_arg_list[0] > 77000)) { + + // ----- Parse the options + $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options, + array (PCLZIP_OPT_REMOVE_PATH => 'optional', + PCLZIP_OPT_REMOVE_ALL_PATH => 'optional', + PCLZIP_OPT_ADD_PATH => 'optional', + PCLZIP_CB_PRE_ADD => 'optional', + PCLZIP_CB_POST_ADD => 'optional', + PCLZIP_OPT_NO_COMPRESSION => 'optional', + PCLZIP_OPT_COMMENT => 'optional', + PCLZIP_OPT_ADD_COMMENT => 'optional', + PCLZIP_OPT_PREPEND_COMMENT => 'optional', + PCLZIP_OPT_TEMP_FILE_THRESHOLD => 'optional', + PCLZIP_OPT_TEMP_FILE_ON => 'optional', + PCLZIP_OPT_TEMP_FILE_OFF => 'optional' + //, PCLZIP_OPT_CRYPT => 'optional' + )); + if ($v_result != 1) { + return 0; + } + } + + // ----- Look for 2 args + // Here we need to support the first historic synopsis of the + // method. + else { + + // ----- Get the first argument + $v_options[PCLZIP_OPT_ADD_PATH] = $v_add_path = $v_arg_list[0]; + + // ----- Look for the optional second argument + if ($v_size == 2) { + $v_options[PCLZIP_OPT_REMOVE_PATH] = $v_arg_list[1]; + } + else if ($v_size > 2) { + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid number / type of arguments"); + + // ----- Return + return 0; + } + } + } + + // ----- Look for default option values + $this->privOptionDefaultThreshold($v_options); + + // ----- Init + $v_string_list = array(); + $v_att_list = array(); + $v_filedescr_list = array(); + $p_result_list = array(); + + // ----- Look if the $p_filelist is really an array + if (is_array($p_filelist)) { + + // ----- Look if the first element is also an array + // This will mean that this is a file description entry + if (isset($p_filelist[0]) && is_array($p_filelist[0])) { + $v_att_list = $p_filelist; + } + + // ----- The list is a list of string names + else { + $v_string_list = $p_filelist; + } + } + + // ----- Look if the $p_filelist is a string + else if (is_string($p_filelist)) { + // ----- Create a list from the string + $v_string_list = explode(PCLZIP_SEPARATOR, $p_filelist); + } + + // ----- Invalid variable type for $p_filelist + else { + PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid variable type '".gettype($p_filelist)."' for p_filelist"); + return 0; + } + + // ----- Reformat the string list + if (sizeof($v_string_list) != 0) { + foreach ($v_string_list as $v_string) { + $v_att_list[][PCLZIP_ATT_FILE_NAME] = $v_string; + } + } + + // ----- For each file in the list check the attributes + $v_supported_attributes + = array ( PCLZIP_ATT_FILE_NAME => 'mandatory' + ,PCLZIP_ATT_FILE_NEW_SHORT_NAME => 'optional' + ,PCLZIP_ATT_FILE_NEW_FULL_NAME => 'optional' + ,PCLZIP_ATT_FILE_MTIME => 'optional' + ,PCLZIP_ATT_FILE_CONTENT => 'optional' + ,PCLZIP_ATT_FILE_COMMENT => 'optional' + ); + foreach ($v_att_list as $v_entry) { + $v_result = $this->privFileDescrParseAtt($v_entry, + $v_filedescr_list[], + $v_options, + $v_supported_attributes); + if ($v_result != 1) { + return 0; + } + } + + // ----- Expand the filelist (expand directories) + $v_result = $this->privFileDescrExpand($v_filedescr_list, $v_options); + if ($v_result != 1) { + return 0; + } + + // ----- Call the create fct + $v_result = $this->privAdd($v_filedescr_list, $p_result_list, $v_options); + if ($v_result != 1) { + return 0; + } + + // ----- Return + return $p_result_list; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : listContent() + // Description : + // This public method, gives the list of the files and directories, with their + // properties. + // The properties of each entries in the list are (used also in other functions) : + // filename : Name of the file. For a create or add action it is the filename + // given by the user. For an extract function it is the filename + // of the extracted file. + // stored_filename : Name of the file / directory stored in the archive. + // size : Size of the stored file. + // compressed_size : Size of the file's data compressed in the archive + // (without the headers overhead) + // mtime : Last known modification date of the file (UNIX timestamp) + // comment : Comment associated with the file + // folder : true | false + // index : index of the file in the archive + // status : status of the action (depending of the action) : + // Values are : + // ok : OK ! + // filtered : the file / dir is not extracted (filtered by user) + // already_a_directory : the file can not be extracted because a + // directory with the same name already exists + // write_protected : the file can not be extracted because a file + // with the same name already exists and is + // write protected + // newer_exist : the file was not extracted because a newer file exists + // path_creation_fail : the file is not extracted because the folder + // does not exist and can not be created + // write_error : the file was not extracted because there was a + // error while writing the file + // read_error : the file was not extracted because there was a error + // while reading the file + // invalid_header : the file was not extracted because of an archive + // format error (bad file header) + // Note that each time a method can continue operating when there + // is an action error on a file, the error is only logged in the file status. + // Return Values : + // 0 on an unrecoverable failure, + // The list of the files in the archive. + // -------------------------------------------------------------------------------- + function listContent() + { + $v_result=1; + + // ----- Reset the error handler + $this->privErrorReset(); + + // ----- Check archive + if (!$this->privCheckFormat()) { + return(0); + } + + // ----- Call the extracting fct + $p_list = array(); + if (($v_result = $this->privList($p_list)) != 1) + { + unset($p_list); + return(0); + } + + // ----- Return + return $p_list; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : + // extract($p_path="./", $p_remove_path="") + // extract([$p_option, $p_option_value, ...]) + // Description : + // This method supports two synopsis. The first one is historical. + // This method extract all the files / directories from the archive to the + // folder indicated in $p_path. + // If you want to ignore the 'root' part of path of the memorized files + // you can indicate this in the optional $p_remove_path parameter. + // By default, if a newer file with the same name already exists, the + // file is not extracted. + // + // If both PCLZIP_OPT_PATH and PCLZIP_OPT_ADD_PATH aoptions + // are used, the path indicated in PCLZIP_OPT_ADD_PATH is append + // at the end of the path value of PCLZIP_OPT_PATH. + // Parameters : + // $p_path : Path where the files and directories are to be extracted + // $p_remove_path : First part ('root' part) of the memorized path + // (if any similar) to remove while extracting. + // Options : + // PCLZIP_OPT_PATH : + // PCLZIP_OPT_ADD_PATH : + // PCLZIP_OPT_REMOVE_PATH : + // PCLZIP_OPT_REMOVE_ALL_PATH : + // PCLZIP_CB_PRE_EXTRACT : + // PCLZIP_CB_POST_EXTRACT : + // Return Values : + // 0 or a negative value on failure, + // The list of the extracted files, with a status of the action. + // (see PclZip::listContent() for list entry format) + // -------------------------------------------------------------------------------- + function extract() + { + $v_result=1; + + // ----- Reset the error handler + $this->privErrorReset(); + + // ----- Check archive + if (!$this->privCheckFormat()) { + return(0); + } + + // ----- Set default values + $v_options = array(); +// $v_path = "./"; + $v_path = ''; + $v_remove_path = ""; + $v_remove_all_path = false; + + // ----- Look for variable options arguments + $v_size = func_num_args(); + + // ----- Default values for option + $v_options[PCLZIP_OPT_EXTRACT_AS_STRING] = FALSE; + + // ----- Look for arguments + if ($v_size > 0) { + // ----- Get the arguments + $v_arg_list = func_get_args(); + + // ----- Look for first arg + if ((is_integer($v_arg_list[0])) && ($v_arg_list[0] > 77000)) { + + // ----- Parse the options + $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options, + array (PCLZIP_OPT_PATH => 'optional', + PCLZIP_OPT_REMOVE_PATH => 'optional', + PCLZIP_OPT_REMOVE_ALL_PATH => 'optional', + PCLZIP_OPT_ADD_PATH => 'optional', + PCLZIP_CB_PRE_EXTRACT => 'optional', + PCLZIP_CB_POST_EXTRACT => 'optional', + PCLZIP_OPT_SET_CHMOD => 'optional', + PCLZIP_OPT_BY_NAME => 'optional', + PCLZIP_OPT_BY_EREG => 'optional', + PCLZIP_OPT_BY_PREG => 'optional', + PCLZIP_OPT_BY_INDEX => 'optional', + PCLZIP_OPT_EXTRACT_AS_STRING => 'optional', + PCLZIP_OPT_EXTRACT_IN_OUTPUT => 'optional', + PCLZIP_OPT_REPLACE_NEWER => 'optional' + ,PCLZIP_OPT_STOP_ON_ERROR => 'optional' + ,PCLZIP_OPT_EXTRACT_DIR_RESTRICTION => 'optional', + PCLZIP_OPT_TEMP_FILE_THRESHOLD => 'optional', + PCLZIP_OPT_TEMP_FILE_ON => 'optional', + PCLZIP_OPT_TEMP_FILE_OFF => 'optional' + )); + if ($v_result != 1) { + return 0; + } + + // ----- Set the arguments + if (isset($v_options[PCLZIP_OPT_PATH])) { + $v_path = $v_options[PCLZIP_OPT_PATH]; + } + if (isset($v_options[PCLZIP_OPT_REMOVE_PATH])) { + $v_remove_path = $v_options[PCLZIP_OPT_REMOVE_PATH]; + } + if (isset($v_options[PCLZIP_OPT_REMOVE_ALL_PATH])) { + $v_remove_all_path = $v_options[PCLZIP_OPT_REMOVE_ALL_PATH]; + } + if (isset($v_options[PCLZIP_OPT_ADD_PATH])) { + // ----- Check for '/' in last path char + if ((strlen($v_path) > 0) && (substr($v_path, -1) != '/')) { + $v_path .= '/'; + } + $v_path .= $v_options[PCLZIP_OPT_ADD_PATH]; + } + } + + // ----- Look for 2 args + // Here we need to support the first historic synopsis of the + // method. + else { + + // ----- Get the first argument + $v_path = $v_arg_list[0]; + + // ----- Look for the optional second argument + if ($v_size == 2) { + $v_remove_path = $v_arg_list[1]; + } + else if ($v_size > 2) { + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid number / type of arguments"); + + // ----- Return + return 0; + } + } + } + + // ----- Look for default option values + $this->privOptionDefaultThreshold($v_options); + + // ----- Trace + + // ----- Call the extracting fct + $p_list = array(); + $v_result = $this->privExtractByRule($p_list, $v_path, $v_remove_path, + $v_remove_all_path, $v_options); + if ($v_result < 1) { + unset($p_list); + return(0); + } + + // ----- Return + return $p_list; + } + // -------------------------------------------------------------------------------- + + + // -------------------------------------------------------------------------------- + // Function : + // extractByIndex($p_index, $p_path="./", $p_remove_path="") + // extractByIndex($p_index, [$p_option, $p_option_value, ...]) + // Description : + // This method supports two synopsis. The first one is historical. + // This method is doing a partial extract of the archive. + // The extracted files or folders are identified by their index in the + // archive (from 0 to n). + // Note that if the index identify a folder, only the folder entry is + // extracted, not all the files included in the archive. + // Parameters : + // $p_index : A single index (integer) or a string of indexes of files to + // extract. The form of the string is "0,4-6,8-12" with only numbers + // and '-' for range or ',' to separate ranges. No spaces or ';' + // are allowed. + // $p_path : Path where the files and directories are to be extracted + // $p_remove_path : First part ('root' part) of the memorized path + // (if any similar) to remove while extracting. + // Options : + // PCLZIP_OPT_PATH : + // PCLZIP_OPT_ADD_PATH : + // PCLZIP_OPT_REMOVE_PATH : + // PCLZIP_OPT_REMOVE_ALL_PATH : + // PCLZIP_OPT_EXTRACT_AS_STRING : The files are extracted as strings and + // not as files. + // The resulting content is in a new field 'content' in the file + // structure. + // This option must be used alone (any other options are ignored). + // PCLZIP_CB_PRE_EXTRACT : + // PCLZIP_CB_POST_EXTRACT : + // Return Values : + // 0 on failure, + // The list of the extracted files, with a status of the action. + // (see PclZip::listContent() for list entry format) + // -------------------------------------------------------------------------------- + //function extractByIndex($p_index, options...) + function extractByIndex($p_index) + { + $v_result=1; + + // ----- Reset the error handler + $this->privErrorReset(); + + // ----- Check archive + if (!$this->privCheckFormat()) { + return(0); + } + + // ----- Set default values + $v_options = array(); +// $v_path = "./"; + $v_path = ''; + $v_remove_path = ""; + $v_remove_all_path = false; + + // ----- Look for variable options arguments + $v_size = func_num_args(); + + // ----- Default values for option + $v_options[PCLZIP_OPT_EXTRACT_AS_STRING] = FALSE; + + // ----- Look for arguments + if ($v_size > 1) { + // ----- Get the arguments + $v_arg_list = func_get_args(); + + // ----- Remove form the options list the first argument + array_shift($v_arg_list); + $v_size--; + + // ----- Look for first arg + if ((is_integer($v_arg_list[0])) && ($v_arg_list[0] > 77000)) { + + // ----- Parse the options + $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options, + array (PCLZIP_OPT_PATH => 'optional', + PCLZIP_OPT_REMOVE_PATH => 'optional', + PCLZIP_OPT_REMOVE_ALL_PATH => 'optional', + PCLZIP_OPT_EXTRACT_AS_STRING => 'optional', + PCLZIP_OPT_ADD_PATH => 'optional', + PCLZIP_CB_PRE_EXTRACT => 'optional', + PCLZIP_CB_POST_EXTRACT => 'optional', + PCLZIP_OPT_SET_CHMOD => 'optional', + PCLZIP_OPT_REPLACE_NEWER => 'optional' + ,PCLZIP_OPT_STOP_ON_ERROR => 'optional' + ,PCLZIP_OPT_EXTRACT_DIR_RESTRICTION => 'optional', + PCLZIP_OPT_TEMP_FILE_THRESHOLD => 'optional', + PCLZIP_OPT_TEMP_FILE_ON => 'optional', + PCLZIP_OPT_TEMP_FILE_OFF => 'optional' + )); + if ($v_result != 1) { + return 0; + } + + // ----- Set the arguments + if (isset($v_options[PCLZIP_OPT_PATH])) { + $v_path = $v_options[PCLZIP_OPT_PATH]; + } + if (isset($v_options[PCLZIP_OPT_REMOVE_PATH])) { + $v_remove_path = $v_options[PCLZIP_OPT_REMOVE_PATH]; + } + if (isset($v_options[PCLZIP_OPT_REMOVE_ALL_PATH])) { + $v_remove_all_path = $v_options[PCLZIP_OPT_REMOVE_ALL_PATH]; + } + if (isset($v_options[PCLZIP_OPT_ADD_PATH])) { + // ----- Check for '/' in last path char + if ((strlen($v_path) > 0) && (substr($v_path, -1) != '/')) { + $v_path .= '/'; + } + $v_path .= $v_options[PCLZIP_OPT_ADD_PATH]; + } + if (!isset($v_options[PCLZIP_OPT_EXTRACT_AS_STRING])) { + $v_options[PCLZIP_OPT_EXTRACT_AS_STRING] = FALSE; + } + else { + } + } + + // ----- Look for 2 args + // Here we need to support the first historic synopsis of the + // method. + else { + + // ----- Get the first argument + $v_path = $v_arg_list[0]; + + // ----- Look for the optional second argument + if ($v_size == 2) { + $v_remove_path = $v_arg_list[1]; + } + else if ($v_size > 2) { + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid number / type of arguments"); + + // ----- Return + return 0; + } + } + } + + // ----- Trace + + // ----- Trick + // Here I want to reuse extractByRule(), so I need to parse the $p_index + // with privParseOptions() + $v_arg_trick = array (PCLZIP_OPT_BY_INDEX, $p_index); + $v_options_trick = array(); + $v_result = $this->privParseOptions($v_arg_trick, sizeof($v_arg_trick), $v_options_trick, + array (PCLZIP_OPT_BY_INDEX => 'optional' )); + if ($v_result != 1) { + return 0; + } + $v_options[PCLZIP_OPT_BY_INDEX] = $v_options_trick[PCLZIP_OPT_BY_INDEX]; + + // ----- Look for default option values + $this->privOptionDefaultThreshold($v_options); + + // ----- Call the extracting fct + if (($v_result = $this->privExtractByRule($p_list, $v_path, $v_remove_path, $v_remove_all_path, $v_options)) < 1) { + return(0); + } + + // ----- Return + return $p_list; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : + // delete([$p_option, $p_option_value, ...]) + // Description : + // This method removes files from the archive. + // If no parameters are given, then all the archive is emptied. + // Parameters : + // None or optional arguments. + // Options : + // PCLZIP_OPT_BY_INDEX : + // PCLZIP_OPT_BY_NAME : + // PCLZIP_OPT_BY_EREG : + // PCLZIP_OPT_BY_PREG : + // Return Values : + // 0 on failure, + // The list of the files which are still present in the archive. + // (see PclZip::listContent() for list entry format) + // -------------------------------------------------------------------------------- + function delete() + { + $v_result=1; + + // ----- Reset the error handler + $this->privErrorReset(); + + // ----- Check archive + if (!$this->privCheckFormat()) { + return(0); + } + + // ----- Set default values + $v_options = array(); + + // ----- Look for variable options arguments + $v_size = func_num_args(); + + // ----- Look for arguments + if ($v_size > 0) { + // ----- Get the arguments + $v_arg_list = func_get_args(); + + // ----- Parse the options + $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options, + array (PCLZIP_OPT_BY_NAME => 'optional', + PCLZIP_OPT_BY_EREG => 'optional', + PCLZIP_OPT_BY_PREG => 'optional', + PCLZIP_OPT_BY_INDEX => 'optional' )); + if ($v_result != 1) { + return 0; + } + } + + // ----- Magic quotes trick + $this->privDisableMagicQuotes(); + + // ----- Call the delete fct + $v_list = array(); + if (($v_result = $this->privDeleteByRule($v_list, $v_options)) != 1) { + $this->privSwapBackMagicQuotes(); + unset($v_list); + return(0); + } + + // ----- Magic quotes trick + $this->privSwapBackMagicQuotes(); + + // ----- Return + return $v_list; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : deleteByIndex() + // Description : + // ***** Deprecated ***** + // delete(PCLZIP_OPT_BY_INDEX, $p_index) should be prefered. + // -------------------------------------------------------------------------------- + function deleteByIndex($p_index) + { + + $p_list = $this->delete(PCLZIP_OPT_BY_INDEX, $p_index); + + // ----- Return + return $p_list; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : properties() + // Description : + // This method gives the properties of the archive. + // The properties are : + // nb : Number of files in the archive + // comment : Comment associated with the archive file + // status : not_exist, ok + // Parameters : + // None + // Return Values : + // 0 on failure, + // An array with the archive properties. + // -------------------------------------------------------------------------------- + function properties() + { + + // ----- Reset the error handler + $this->privErrorReset(); + + // ----- Magic quotes trick + $this->privDisableMagicQuotes(); + + // ----- Check archive + if (!$this->privCheckFormat()) { + $this->privSwapBackMagicQuotes(); + return(0); + } + + // ----- Default properties + $v_prop = array(); + $v_prop['comment'] = ''; + $v_prop['nb'] = 0; + $v_prop['status'] = 'not_exist'; + + // ----- Look if file exists + if (@is_file($this->zipname)) + { + // ----- Open the zip file + if (($this->zip_fd = @fopen($this->zipname, 'rb')) == 0) + { + $this->privSwapBackMagicQuotes(); + + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive \''.$this->zipname.'\' in binary read mode'); + + // ----- Return + return 0; + } + + // ----- Read the central directory informations + $v_central_dir = array(); + if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1) + { + $this->privSwapBackMagicQuotes(); + return 0; + } + + // ----- Close the zip file + $this->privCloseFd(); + + // ----- Set the user attributes + $v_prop['comment'] = $v_central_dir['comment']; + $v_prop['nb'] = $v_central_dir['entries']; + $v_prop['status'] = 'ok'; + } + + // ----- Magic quotes trick + $this->privSwapBackMagicQuotes(); + + // ----- Return + return $v_prop; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : duplicate() + // Description : + // This method creates an archive by copying the content of an other one. If + // the archive already exist, it is replaced by the new one without any warning. + // Parameters : + // $p_archive : The filename of a valid archive, or + // a valid PclZip object. + // Return Values : + // 1 on success. + // 0 or a negative value on error (error code). + // -------------------------------------------------------------------------------- + function duplicate($p_archive) + { + $v_result = 1; + + // ----- Reset the error handler + $this->privErrorReset(); + + // ----- Look if the $p_archive is a PclZip object + if ((is_object($p_archive)) && (get_class($p_archive) == 'pclzip')) + { + + // ----- Duplicate the archive + $v_result = $this->privDuplicate($p_archive->zipname); + } + + // ----- Look if the $p_archive is a string (so a filename) + else if (is_string($p_archive)) + { + + // ----- Check that $p_archive is a valid zip file + // TBC : Should also check the archive format + if (!is_file($p_archive)) { + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_MISSING_FILE, "No file with filename '".$p_archive."'"); + $v_result = PCLZIP_ERR_MISSING_FILE; + } + else { + // ----- Duplicate the archive + $v_result = $this->privDuplicate($p_archive); + } + } + + // ----- Invalid variable + else + { + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid variable type p_archive_to_add"); + $v_result = PCLZIP_ERR_INVALID_PARAMETER; + } + + // ----- Return + return $v_result; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : merge() + // Description : + // This method merge the $p_archive_to_add archive at the end of the current + // one ($this). + // If the archive ($this) does not exist, the merge becomes a duplicate. + // If the $p_archive_to_add archive does not exist, the merge is a success. + // Parameters : + // $p_archive_to_add : It can be directly the filename of a valid zip archive, + // or a PclZip object archive. + // Return Values : + // 1 on success, + // 0 or negative values on error (see below). + // -------------------------------------------------------------------------------- + function merge($p_archive_to_add) + { + $v_result = 1; + + // ----- Reset the error handler + $this->privErrorReset(); + + // ----- Check archive + if (!$this->privCheckFormat()) { + return(0); + } + + // ----- Look if the $p_archive_to_add is a PclZip object + if ((is_object($p_archive_to_add)) && (get_class($p_archive_to_add) == 'pclzip')) + { + + // ----- Merge the archive + $v_result = $this->privMerge($p_archive_to_add); + } + + // ----- Look if the $p_archive_to_add is a string (so a filename) + else if (is_string($p_archive_to_add)) + { + + // ----- Create a temporary archive + $v_object_archive = new PclZip($p_archive_to_add); + + // ----- Merge the archive + $v_result = $this->privMerge($v_object_archive); + } + + // ----- Invalid variable + else + { + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid variable type p_archive_to_add"); + $v_result = PCLZIP_ERR_INVALID_PARAMETER; + } + + // ----- Return + return $v_result; + } + // -------------------------------------------------------------------------------- + + + + // -------------------------------------------------------------------------------- + // Function : errorCode() + // Description : + // Parameters : + // -------------------------------------------------------------------------------- + function errorCode() + { + if (PCLZIP_ERROR_EXTERNAL == 1) { + return(PclErrorCode()); + } + else { + return($this->error_code); + } + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : errorName() + // Description : + // Parameters : + // -------------------------------------------------------------------------------- + function errorName($p_with_code=false) + { + $v_name = array ( PCLZIP_ERR_NO_ERROR => 'PCLZIP_ERR_NO_ERROR', + PCLZIP_ERR_WRITE_OPEN_FAIL => 'PCLZIP_ERR_WRITE_OPEN_FAIL', + PCLZIP_ERR_READ_OPEN_FAIL => 'PCLZIP_ERR_READ_OPEN_FAIL', + PCLZIP_ERR_INVALID_PARAMETER => 'PCLZIP_ERR_INVALID_PARAMETER', + PCLZIP_ERR_MISSING_FILE => 'PCLZIP_ERR_MISSING_FILE', + PCLZIP_ERR_FILENAME_TOO_LONG => 'PCLZIP_ERR_FILENAME_TOO_LONG', + PCLZIP_ERR_INVALID_ZIP => 'PCLZIP_ERR_INVALID_ZIP', + PCLZIP_ERR_BAD_EXTRACTED_FILE => 'PCLZIP_ERR_BAD_EXTRACTED_FILE', + PCLZIP_ERR_DIR_CREATE_FAIL => 'PCLZIP_ERR_DIR_CREATE_FAIL', + PCLZIP_ERR_BAD_EXTENSION => 'PCLZIP_ERR_BAD_EXTENSION', + PCLZIP_ERR_BAD_FORMAT => 'PCLZIP_ERR_BAD_FORMAT', + PCLZIP_ERR_DELETE_FILE_FAIL => 'PCLZIP_ERR_DELETE_FILE_FAIL', + PCLZIP_ERR_RENAME_FILE_FAIL => 'PCLZIP_ERR_RENAME_FILE_FAIL', + PCLZIP_ERR_BAD_CHECKSUM => 'PCLZIP_ERR_BAD_CHECKSUM', + PCLZIP_ERR_INVALID_ARCHIVE_ZIP => 'PCLZIP_ERR_INVALID_ARCHIVE_ZIP', + PCLZIP_ERR_MISSING_OPTION_VALUE => 'PCLZIP_ERR_MISSING_OPTION_VALUE', + PCLZIP_ERR_INVALID_OPTION_VALUE => 'PCLZIP_ERR_INVALID_OPTION_VALUE', + PCLZIP_ERR_UNSUPPORTED_COMPRESSION => 'PCLZIP_ERR_UNSUPPORTED_COMPRESSION', + PCLZIP_ERR_UNSUPPORTED_ENCRYPTION => 'PCLZIP_ERR_UNSUPPORTED_ENCRYPTION' + ,PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE => 'PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE' + ,PCLZIP_ERR_DIRECTORY_RESTRICTION => 'PCLZIP_ERR_DIRECTORY_RESTRICTION' + ); + + if (isset($v_name[$this->error_code])) { + $v_value = $v_name[$this->error_code]; + } + else { + $v_value = 'NoName'; + } + + if ($p_with_code) { + return($v_value.' ('.$this->error_code.')'); + } + else { + return($v_value); + } + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : errorInfo() + // Description : + // Parameters : + // -------------------------------------------------------------------------------- + function errorInfo($p_full=false) + { + if (PCLZIP_ERROR_EXTERNAL == 1) { + return(PclErrorString()); + } + else { + if ($p_full) { + return($this->errorName(true)." : ".$this->error_string); + } + else { + return($this->error_string." [code ".$this->error_code."]"); + } + } + } + // -------------------------------------------------------------------------------- + + +// -------------------------------------------------------------------------------- +// ***** UNDER THIS LINE ARE DEFINED PRIVATE INTERNAL FUNCTIONS ***** +// ***** ***** +// ***** THESES FUNCTIONS MUST NOT BE USED DIRECTLY ***** +// -------------------------------------------------------------------------------- + + + + // -------------------------------------------------------------------------------- + // Function : privCheckFormat() + // Description : + // This method check that the archive exists and is a valid zip archive. + // Several level of check exists. (futur) + // Parameters : + // $p_level : Level of check. Default 0. + // 0 : Check the first bytes (magic codes) (default value)) + // 1 : 0 + Check the central directory (futur) + // 2 : 1 + Check each file header (futur) + // Return Values : + // true on success, + // false on error, the error code is set. + // -------------------------------------------------------------------------------- + function privCheckFormat($p_level=0) + { + $v_result = true; + + // ----- Reset the file system cache + clearstatcache(); + + // ----- Reset the error handler + $this->privErrorReset(); + + // ----- Look if the file exits + if (!is_file($this->zipname)) { + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_MISSING_FILE, "Missing archive file '".$this->zipname."'"); + return(false); + } + + // ----- Check that the file is readeable + if (!is_readable($this->zipname)) { + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, "Unable to read archive '".$this->zipname."'"); + return(false); + } + + // ----- Check the magic code + // TBC + + // ----- Check the central header + // TBC + + // ----- Check each file header + // TBC + + // ----- Return + return $v_result; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : privParseOptions() + // Description : + // This internal methods reads the variable list of arguments ($p_options_list, + // $p_size) and generate an array with the options and values ($v_result_list). + // $v_requested_options contains the options that can be present and those that + // must be present. + // $v_requested_options is an array, with the option value as key, and 'optional', + // or 'mandatory' as value. + // Parameters : + // See above. + // Return Values : + // 1 on success. + // 0 on failure. + // -------------------------------------------------------------------------------- + function privParseOptions(&$p_options_list, $p_size, &$v_result_list, $v_requested_options=false) + { + $v_result=1; + + // ----- Read the options + $i=0; + while ($i<$p_size) { + + // ----- Check if the option is supported + if (!isset($v_requested_options[$p_options_list[$i]])) { + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid optional parameter '".$p_options_list[$i]."' for this method"); + + // ----- Return + return PclZip::errorCode(); + } + + // ----- Look for next option + switch ($p_options_list[$i]) { + // ----- Look for options that request a path value + case PCLZIP_OPT_PATH : + case PCLZIP_OPT_REMOVE_PATH : + case PCLZIP_OPT_ADD_PATH : + // ----- Check the number of parameters + if (($i+1) >= $p_size) { + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'"); + + // ----- Return + return PclZip::errorCode(); + } + + // ----- Get the value + $v_result_list[$p_options_list[$i]] = PclZipUtilTranslateWinPath($p_options_list[$i+1], FALSE); + $i++; + break; + + case PCLZIP_OPT_TEMP_FILE_THRESHOLD : + // ----- Check the number of parameters + if (($i+1) >= $p_size) { + PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'"); + return PclZip::errorCode(); + } + + // ----- Check for incompatible options + if (isset($v_result_list[PCLZIP_OPT_TEMP_FILE_OFF])) { + PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Option '".PclZipUtilOptionText($p_options_list[$i])."' can not be used with option 'PCLZIP_OPT_TEMP_FILE_OFF'"); + return PclZip::errorCode(); + } + + // ----- Check the value + $v_value = $p_options_list[$i+1]; + if ((!is_integer($v_value)) || ($v_value<0)) { + PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Integer expected for option '".PclZipUtilOptionText($p_options_list[$i])."'"); + return PclZip::errorCode(); + } + + // ----- Get the value (and convert it in bytes) + $v_result_list[$p_options_list[$i]] = $v_value*1048576; + $i++; + break; + + case PCLZIP_OPT_TEMP_FILE_ON : + // ----- Check for incompatible options + if (isset($v_result_list[PCLZIP_OPT_TEMP_FILE_OFF])) { + PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Option '".PclZipUtilOptionText($p_options_list[$i])."' can not be used with option 'PCLZIP_OPT_TEMP_FILE_OFF'"); + return PclZip::errorCode(); + } + + $v_result_list[$p_options_list[$i]] = true; + break; + + case PCLZIP_OPT_TEMP_FILE_OFF : + // ----- Check for incompatible options + if (isset($v_result_list[PCLZIP_OPT_TEMP_FILE_ON])) { + PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Option '".PclZipUtilOptionText($p_options_list[$i])."' can not be used with option 'PCLZIP_OPT_TEMP_FILE_ON'"); + return PclZip::errorCode(); + } + // ----- Check for incompatible options + if (isset($v_result_list[PCLZIP_OPT_TEMP_FILE_THRESHOLD])) { + PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Option '".PclZipUtilOptionText($p_options_list[$i])."' can not be used with option 'PCLZIP_OPT_TEMP_FILE_THRESHOLD'"); + return PclZip::errorCode(); + } + + $v_result_list[$p_options_list[$i]] = true; + break; + + case PCLZIP_OPT_EXTRACT_DIR_RESTRICTION : + // ----- Check the number of parameters + if (($i+1) >= $p_size) { + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'"); + + // ----- Return + return PclZip::errorCode(); + } + + // ----- Get the value + if ( is_string($p_options_list[$i+1]) + && ($p_options_list[$i+1] != '')) { + $v_result_list[$p_options_list[$i]] = PclZipUtilTranslateWinPath($p_options_list[$i+1], FALSE); + $i++; + } + else { + } + break; + + // ----- Look for options that request an array of string for value + case PCLZIP_OPT_BY_NAME : + // ----- Check the number of parameters + if (($i+1) >= $p_size) { + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'"); + + // ----- Return + return PclZip::errorCode(); + } + + // ----- Get the value + if (is_string($p_options_list[$i+1])) { + $v_result_list[$p_options_list[$i]][0] = $p_options_list[$i+1]; + } + else if (is_array($p_options_list[$i+1])) { + $v_result_list[$p_options_list[$i]] = $p_options_list[$i+1]; + } + else { + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Wrong parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'"); + + // ----- Return + return PclZip::errorCode(); + } + $i++; + break; + + // ----- Look for options that request an EREG or PREG expression + case PCLZIP_OPT_BY_EREG : + // ereg() is deprecated starting with PHP 5.3. Move PCLZIP_OPT_BY_EREG + // to PCLZIP_OPT_BY_PREG + $p_options_list[$i] = PCLZIP_OPT_BY_PREG; + case PCLZIP_OPT_BY_PREG : + //case PCLZIP_OPT_CRYPT : + // ----- Check the number of parameters + if (($i+1) >= $p_size) { + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'"); + + // ----- Return + return PclZip::errorCode(); + } + + // ----- Get the value + if (is_string($p_options_list[$i+1])) { + $v_result_list[$p_options_list[$i]] = $p_options_list[$i+1]; + } + else { + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Wrong parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'"); + + // ----- Return + return PclZip::errorCode(); + } + $i++; + break; + + // ----- Look for options that takes a string + case PCLZIP_OPT_COMMENT : + case PCLZIP_OPT_ADD_COMMENT : + case PCLZIP_OPT_PREPEND_COMMENT : + // ----- Check the number of parameters + if (($i+1) >= $p_size) { + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, + "Missing parameter value for option '" + .PclZipUtilOptionText($p_options_list[$i]) + ."'"); + + // ----- Return + return PclZip::errorCode(); + } + + // ----- Get the value + if (is_string($p_options_list[$i+1])) { + $v_result_list[$p_options_list[$i]] = $p_options_list[$i+1]; + } + else { + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, + "Wrong parameter value for option '" + .PclZipUtilOptionText($p_options_list[$i]) + ."'"); + + // ----- Return + return PclZip::errorCode(); + } + $i++; + break; + + // ----- Look for options that request an array of index + case PCLZIP_OPT_BY_INDEX : + // ----- Check the number of parameters + if (($i+1) >= $p_size) { + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'"); + + // ----- Return + return PclZip::errorCode(); + } + + // ----- Get the value + $v_work_list = array(); + if (is_string($p_options_list[$i+1])) { + + // ----- Remove spaces + $p_options_list[$i+1] = strtr($p_options_list[$i+1], ' ', ''); + + // ----- Parse items + $v_work_list = explode(",", $p_options_list[$i+1]); + } + else if (is_integer($p_options_list[$i+1])) { + $v_work_list[0] = $p_options_list[$i+1].'-'.$p_options_list[$i+1]; + } + else if (is_array($p_options_list[$i+1])) { + $v_work_list = $p_options_list[$i+1]; + } + else { + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Value must be integer, string or array for option '".PclZipUtilOptionText($p_options_list[$i])."'"); + + // ----- Return + return PclZip::errorCode(); + } + + // ----- Reduce the index list + // each index item in the list must be a couple with a start and + // an end value : [0,3], [5-5], [8-10], ... + // ----- Check the format of each item + $v_sort_flag=false; + $v_sort_value=0; + for ($j=0; $j= $p_size) { + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'"); + + // ----- Return + return PclZip::errorCode(); + } + + // ----- Get the value + $v_result_list[$p_options_list[$i]] = $p_options_list[$i+1]; + $i++; + break; + + // ----- Look for options that request a call-back + case PCLZIP_CB_PRE_EXTRACT : + case PCLZIP_CB_POST_EXTRACT : + case PCLZIP_CB_PRE_ADD : + case PCLZIP_CB_POST_ADD : + /* for futur use + case PCLZIP_CB_PRE_DELETE : + case PCLZIP_CB_POST_DELETE : + case PCLZIP_CB_PRE_LIST : + case PCLZIP_CB_POST_LIST : + */ + // ----- Check the number of parameters + if (($i+1) >= $p_size) { + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'"); + + // ----- Return + return PclZip::errorCode(); + } + + // ----- Get the value + $v_function_name = $p_options_list[$i+1]; + + // ----- Check that the value is a valid existing function + if (!function_exists($v_function_name)) { + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Function '".$v_function_name."()' is not an existing function for option '".PclZipUtilOptionText($p_options_list[$i])."'"); + + // ----- Return + return PclZip::errorCode(); + } + + // ----- Set the attribute + $v_result_list[$p_options_list[$i]] = $v_function_name; + $i++; + break; + + default : + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, + "Unknown parameter '" + .$p_options_list[$i]."'"); + + // ----- Return + return PclZip::errorCode(); + } + + // ----- Next options + $i++; + } + + // ----- Look for mandatory options + if ($v_requested_options !== false) { + for ($key=reset($v_requested_options); $key=key($v_requested_options); $key=next($v_requested_options)) { + // ----- Look for mandatory option + if ($v_requested_options[$key] == 'mandatory') { + // ----- Look if present + if (!isset($v_result_list[$key])) { + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Missing mandatory parameter ".PclZipUtilOptionText($key)."(".$key.")"); + + // ----- Return + return PclZip::errorCode(); + } + } + } + } + + // ----- Look for default values + if (!isset($v_result_list[PCLZIP_OPT_TEMP_FILE_THRESHOLD])) { + + } + + // ----- Return + return $v_result; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : privOptionDefaultThreshold() + // Description : + // Parameters : + // Return Values : + // -------------------------------------------------------------------------------- + function privOptionDefaultThreshold(&$p_options) + { + $v_result=1; + + if (isset($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD]) + || isset($p_options[PCLZIP_OPT_TEMP_FILE_OFF])) { + return $v_result; + } + + // ----- Get 'memory_limit' configuration value + $v_memory_limit = ini_get('memory_limit'); + $v_memory_limit = trim($v_memory_limit); + $last = strtolower(substr($v_memory_limit, -1)); + + if($last == 'g') + //$v_memory_limit = $v_memory_limit*1024*1024*1024; + $v_memory_limit = $v_memory_limit*1073741824; + if($last == 'm') + //$v_memory_limit = $v_memory_limit*1024*1024; + $v_memory_limit = $v_memory_limit*1048576; + if($last == 'k') + $v_memory_limit = $v_memory_limit*1024; + + $p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] = floor($v_memory_limit*PCLZIP_TEMPORARY_FILE_RATIO); + + + // ----- Sanity check : No threshold if value lower than 1M + if ($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] < 1048576) { + unset($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD]); + } + + // ----- Return + return $v_result; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : privFileDescrParseAtt() + // Description : + // Parameters : + // Return Values : + // 1 on success. + // 0 on failure. + // -------------------------------------------------------------------------------- + function privFileDescrParseAtt(&$p_file_list, &$p_filedescr, $v_options, $v_requested_options=false) + { + $v_result=1; + + // ----- For each file in the list check the attributes + foreach ($p_file_list as $v_key => $v_value) { + + // ----- Check if the option is supported + if (!isset($v_requested_options[$v_key])) { + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid file attribute '".$v_key."' for this file"); + + // ----- Return + return PclZip::errorCode(); + } + + // ----- Look for attribute + switch ($v_key) { + case PCLZIP_ATT_FILE_NAME : + if (!is_string($v_value)) { + PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type ".gettype($v_value).". String expected for attribute '".PclZipUtilOptionText($v_key)."'"); + return PclZip::errorCode(); + } + + $p_filedescr['filename'] = PclZipUtilPathReduction($v_value); + + if ($p_filedescr['filename'] == '') { + PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid empty filename for attribute '".PclZipUtilOptionText($v_key)."'"); + return PclZip::errorCode(); + } + + break; + + case PCLZIP_ATT_FILE_NEW_SHORT_NAME : + if (!is_string($v_value)) { + PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type ".gettype($v_value).". String expected for attribute '".PclZipUtilOptionText($v_key)."'"); + return PclZip::errorCode(); + } + + $p_filedescr['new_short_name'] = PclZipUtilPathReduction($v_value); + + if ($p_filedescr['new_short_name'] == '') { + PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid empty short filename for attribute '".PclZipUtilOptionText($v_key)."'"); + return PclZip::errorCode(); + } + break; + + case PCLZIP_ATT_FILE_NEW_FULL_NAME : + if (!is_string($v_value)) { + PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type ".gettype($v_value).". String expected for attribute '".PclZipUtilOptionText($v_key)."'"); + return PclZip::errorCode(); + } + + $p_filedescr['new_full_name'] = PclZipUtilPathReduction($v_value); + + if ($p_filedescr['new_full_name'] == '') { + PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid empty full filename for attribute '".PclZipUtilOptionText($v_key)."'"); + return PclZip::errorCode(); + } + break; + + // ----- Look for options that takes a string + case PCLZIP_ATT_FILE_COMMENT : + if (!is_string($v_value)) { + PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type ".gettype($v_value).". String expected for attribute '".PclZipUtilOptionText($v_key)."'"); + return PclZip::errorCode(); + } + + $p_filedescr['comment'] = $v_value; + break; + + case PCLZIP_ATT_FILE_MTIME : + if (!is_integer($v_value)) { + PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type ".gettype($v_value).". Integer expected for attribute '".PclZipUtilOptionText($v_key)."'"); + return PclZip::errorCode(); + } + + $p_filedescr['mtime'] = $v_value; + break; + + case PCLZIP_ATT_FILE_CONTENT : + $p_filedescr['content'] = $v_value; + break; + + default : + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, + "Unknown parameter '".$v_key."'"); + + // ----- Return + return PclZip::errorCode(); + } + + // ----- Look for mandatory options + if ($v_requested_options !== false) { + for ($key=reset($v_requested_options); $key=key($v_requested_options); $key=next($v_requested_options)) { + // ----- Look for mandatory option + if ($v_requested_options[$key] == 'mandatory') { + // ----- Look if present + if (!isset($p_file_list[$key])) { + PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Missing mandatory parameter ".PclZipUtilOptionText($key)."(".$key.")"); + return PclZip::errorCode(); + } + } + } + } + + // end foreach + } + + // ----- Return + return $v_result; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : privFileDescrExpand() + // Description : + // This method look for each item of the list to see if its a file, a folder + // or a string to be added as file. For any other type of files (link, other) + // just ignore the item. + // Then prepare the information that will be stored for that file. + // When its a folder, expand the folder with all the files that are in that + // folder (recursively). + // Parameters : + // Return Values : + // 1 on success. + // 0 on failure. + // -------------------------------------------------------------------------------- + function privFileDescrExpand(&$p_filedescr_list, &$p_options) + { + $v_result=1; + + // ----- Create a result list + $v_result_list = array(); + + // ----- Look each entry + for ($i=0; $iprivCalculateStoredFilename($v_descr, $p_options); + + // ----- Add the descriptor in result list + $v_result_list[sizeof($v_result_list)] = $v_descr; + + // ----- Look for folder + if ($v_descr['type'] == 'folder') { + // ----- List of items in folder + $v_dirlist_descr = array(); + $v_dirlist_nb = 0; + if ($v_folder_handler = @opendir($v_descr['filename'])) { + while (($v_item_handler = @readdir($v_folder_handler)) !== false) { + + // ----- Skip '.' and '..' + if (($v_item_handler == '.') || ($v_item_handler == '..')) { + continue; + } + + // ----- Compose the full filename + $v_dirlist_descr[$v_dirlist_nb]['filename'] = $v_descr['filename'].'/'.$v_item_handler; + + // ----- Look for different stored filename + // Because the name of the folder was changed, the name of the + // files/sub-folders also change + if (($v_descr['stored_filename'] != $v_descr['filename']) + && (!isset($p_options[PCLZIP_OPT_REMOVE_ALL_PATH]))) { + if ($v_descr['stored_filename'] != '') { + $v_dirlist_descr[$v_dirlist_nb]['new_full_name'] = $v_descr['stored_filename'].'/'.$v_item_handler; + } + else { + $v_dirlist_descr[$v_dirlist_nb]['new_full_name'] = $v_item_handler; + } + } + + $v_dirlist_nb++; + } + + @closedir($v_folder_handler); + } + else { + // TBC : unable to open folder in read mode + } + + // ----- Expand each element of the list + if ($v_dirlist_nb != 0) { + // ----- Expand + if (($v_result = $this->privFileDescrExpand($v_dirlist_descr, $p_options)) != 1) { + return $v_result; + } + + // ----- Concat the resulting list + $v_result_list = array_merge($v_result_list, $v_dirlist_descr); + } + else { + } + + // ----- Free local array + unset($v_dirlist_descr); + } + } + + // ----- Get the result list + $p_filedescr_list = $v_result_list; + + // ----- Return + return $v_result; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : privCreate() + // Description : + // Parameters : + // Return Values : + // -------------------------------------------------------------------------------- + function privCreate($p_filedescr_list, &$p_result_list, &$p_options) + { + $v_result=1; + $v_list_detail = array(); + + // ----- Magic quotes trick + $this->privDisableMagicQuotes(); + + // ----- Open the file in write mode + if (($v_result = $this->privOpenFd('wb')) != 1) + { + // ----- Return + return $v_result; + } + + // ----- Add the list of files + $v_result = $this->privAddList($p_filedescr_list, $p_result_list, $p_options); + + // ----- Close + $this->privCloseFd(); + + // ----- Magic quotes trick + $this->privSwapBackMagicQuotes(); + + // ----- Return + return $v_result; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : privAdd() + // Description : + // Parameters : + // Return Values : + // -------------------------------------------------------------------------------- + function privAdd($p_filedescr_list, &$p_result_list, &$p_options) + { + $v_result=1; + $v_list_detail = array(); + + // ----- Look if the archive exists or is empty + if ((!is_file($this->zipname)) || (filesize($this->zipname) == 0)) + { + + // ----- Do a create + $v_result = $this->privCreate($p_filedescr_list, $p_result_list, $p_options); + + // ----- Return + return $v_result; + } + // ----- Magic quotes trick + $this->privDisableMagicQuotes(); + + // ----- Open the zip file + if (($v_result=$this->privOpenFd('rb')) != 1) + { + // ----- Magic quotes trick + $this->privSwapBackMagicQuotes(); + + // ----- Return + return $v_result; + } + + // ----- Read the central directory informations + $v_central_dir = array(); + if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1) + { + $this->privCloseFd(); + $this->privSwapBackMagicQuotes(); + return $v_result; + } + + // ----- Go to beginning of File + @rewind($this->zip_fd); + + // ----- Creates a temporay file + $v_zip_temp_name = PCLZIP_TEMPORARY_DIR.uniqid('pclzip-').'.tmp'; + + // ----- Open the temporary file in write mode + if (($v_zip_temp_fd = @fopen($v_zip_temp_name, 'wb')) == 0) + { + $this->privCloseFd(); + $this->privSwapBackMagicQuotes(); + + PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open temporary file \''.$v_zip_temp_name.'\' in binary write mode'); + + // ----- Return + return PclZip::errorCode(); + } + + // ----- Copy the files from the archive to the temporary file + // TBC : Here I should better append the file and go back to erase the central dir + $v_size = $v_central_dir['offset']; + while ($v_size != 0) + { + $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE); + $v_buffer = fread($this->zip_fd, $v_read_size); + @fwrite($v_zip_temp_fd, $v_buffer, $v_read_size); + $v_size -= $v_read_size; + } + + // ----- Swap the file descriptor + // Here is a trick : I swap the temporary fd with the zip fd, in order to use + // the following methods on the temporary fil and not the real archive + $v_swap = $this->zip_fd; + $this->zip_fd = $v_zip_temp_fd; + $v_zip_temp_fd = $v_swap; + + // ----- Add the files + $v_header_list = array(); + if (($v_result = $this->privAddFileList($p_filedescr_list, $v_header_list, $p_options)) != 1) + { + fclose($v_zip_temp_fd); + $this->privCloseFd(); + @unlink($v_zip_temp_name); + $this->privSwapBackMagicQuotes(); + + // ----- Return + return $v_result; + } + + // ----- Store the offset of the central dir + $v_offset = @ftell($this->zip_fd); + + // ----- Copy the block of file headers from the old archive + $v_size = $v_central_dir['size']; + while ($v_size != 0) + { + $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE); + $v_buffer = @fread($v_zip_temp_fd, $v_read_size); + @fwrite($this->zip_fd, $v_buffer, $v_read_size); + $v_size -= $v_read_size; + } + + // ----- Create the Central Dir files header + for ($i=0, $v_count=0; $iprivWriteCentralFileHeader($v_header_list[$i])) != 1) { + fclose($v_zip_temp_fd); + $this->privCloseFd(); + @unlink($v_zip_temp_name); + $this->privSwapBackMagicQuotes(); + + // ----- Return + return $v_result; + } + $v_count++; + } + + // ----- Transform the header to a 'usable' info + $this->privConvertHeader2FileInfo($v_header_list[$i], $p_result_list[$i]); + } + + // ----- Zip file comment + $v_comment = $v_central_dir['comment']; + if (isset($p_options[PCLZIP_OPT_COMMENT])) { + $v_comment = $p_options[PCLZIP_OPT_COMMENT]; + } + if (isset($p_options[PCLZIP_OPT_ADD_COMMENT])) { + $v_comment = $v_comment.$p_options[PCLZIP_OPT_ADD_COMMENT]; + } + if (isset($p_options[PCLZIP_OPT_PREPEND_COMMENT])) { + $v_comment = $p_options[PCLZIP_OPT_PREPEND_COMMENT].$v_comment; + } + + // ----- Calculate the size of the central header + $v_size = @ftell($this->zip_fd)-$v_offset; + + // ----- Create the central dir footer + if (($v_result = $this->privWriteCentralHeader($v_count+$v_central_dir['entries'], $v_size, $v_offset, $v_comment)) != 1) + { + // ----- Reset the file list + unset($v_header_list); + $this->privSwapBackMagicQuotes(); + + // ----- Return + return $v_result; + } + + // ----- Swap back the file descriptor + $v_swap = $this->zip_fd; + $this->zip_fd = $v_zip_temp_fd; + $v_zip_temp_fd = $v_swap; + + // ----- Close + $this->privCloseFd(); + + // ----- Close the temporary file + @fclose($v_zip_temp_fd); + + // ----- Magic quotes trick + $this->privSwapBackMagicQuotes(); + + // ----- Delete the zip file + // TBC : I should test the result ... + @unlink($this->zipname); + + // ----- Rename the temporary file + // TBC : I should test the result ... + //@rename($v_zip_temp_name, $this->zipname); + PclZipUtilRename($v_zip_temp_name, $this->zipname); + + // ----- Return + return $v_result; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : privOpenFd() + // Description : + // Parameters : + // -------------------------------------------------------------------------------- + function privOpenFd($p_mode) + { + $v_result=1; + + // ----- Look if already open + if ($this->zip_fd != 0) + { + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Zip file \''.$this->zipname.'\' already open'); + + // ----- Return + return PclZip::errorCode(); + } + + // ----- Open the zip file + if (($this->zip_fd = @fopen($this->zipname, $p_mode)) == 0) + { + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive \''.$this->zipname.'\' in '.$p_mode.' mode'); + + // ----- Return + return PclZip::errorCode(); + } + + // ----- Return + return $v_result; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : privCloseFd() + // Description : + // Parameters : + // -------------------------------------------------------------------------------- + function privCloseFd() + { + $v_result=1; + + if ($this->zip_fd != 0) + @fclose($this->zip_fd); + $this->zip_fd = 0; + + // ----- Return + return $v_result; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : privAddList() + // Description : + // $p_add_dir and $p_remove_dir will give the ability to memorize a path which is + // different from the real path of the file. This is usefull if you want to have PclTar + // running in any directory, and memorize relative path from an other directory. + // Parameters : + // $p_list : An array containing the file or directory names to add in the tar + // $p_result_list : list of added files with their properties (specially the status field) + // $p_add_dir : Path to add in the filename path archived + // $p_remove_dir : Path to remove in the filename path archived + // Return Values : + // -------------------------------------------------------------------------------- +// function privAddList($p_list, &$p_result_list, $p_add_dir, $p_remove_dir, $p_remove_all_dir, &$p_options) + function privAddList($p_filedescr_list, &$p_result_list, &$p_options) + { + $v_result=1; + + // ----- Add the files + $v_header_list = array(); + if (($v_result = $this->privAddFileList($p_filedescr_list, $v_header_list, $p_options)) != 1) + { + // ----- Return + return $v_result; + } + + // ----- Store the offset of the central dir + $v_offset = @ftell($this->zip_fd); + + // ----- Create the Central Dir files header + for ($i=0,$v_count=0; $iprivWriteCentralFileHeader($v_header_list[$i])) != 1) { + // ----- Return + return $v_result; + } + $v_count++; + } + + // ----- Transform the header to a 'usable' info + $this->privConvertHeader2FileInfo($v_header_list[$i], $p_result_list[$i]); + } + + // ----- Zip file comment + $v_comment = ''; + if (isset($p_options[PCLZIP_OPT_COMMENT])) { + $v_comment = $p_options[PCLZIP_OPT_COMMENT]; + } + + // ----- Calculate the size of the central header + $v_size = @ftell($this->zip_fd)-$v_offset; + + // ----- Create the central dir footer + if (($v_result = $this->privWriteCentralHeader($v_count, $v_size, $v_offset, $v_comment)) != 1) + { + // ----- Reset the file list + unset($v_header_list); + + // ----- Return + return $v_result; + } + + // ----- Return + return $v_result; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : privAddFileList() + // Description : + // Parameters : + // $p_filedescr_list : An array containing the file description + // or directory names to add in the zip + // $p_result_list : list of added files with their properties (specially the status field) + // Return Values : + // -------------------------------------------------------------------------------- + function privAddFileList($p_filedescr_list, &$p_result_list, &$p_options) + { + $v_result=1; + $v_header = array(); + + // ----- Recuperate the current number of elt in list + $v_nb = sizeof($p_result_list); + + // ----- Loop on the files + for ($j=0; ($jprivAddFile($p_filedescr_list[$j], $v_header, + $p_options); + if ($v_result != 1) { + return $v_result; + } + + // ----- Store the file infos + $p_result_list[$v_nb++] = $v_header; + } + } + + // ----- Return + return $v_result; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : privAddFile() + // Description : + // Parameters : + // Return Values : + // -------------------------------------------------------------------------------- + function privAddFile($p_filedescr, &$p_header, &$p_options) + { + $v_result=1; + + // ----- Working variable + $p_filename = $p_filedescr['filename']; + + // TBC : Already done in the fileAtt check ... ? + if ($p_filename == "") { + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid file list parameter (invalid or empty list)"); + + // ----- Return + return PclZip::errorCode(); + } + + // ----- Look for a stored different filename + /* TBC : Removed + if (isset($p_filedescr['stored_filename'])) { + $v_stored_filename = $p_filedescr['stored_filename']; + } + else { + $v_stored_filename = $p_filedescr['stored_filename']; + } + */ + + // ----- Set the file properties + clearstatcache(); + $p_header['version'] = 20; + $p_header['version_extracted'] = 10; + $p_header['flag'] = 0; + $p_header['compression'] = 0; + $p_header['crc'] = 0; + $p_header['compressed_size'] = 0; + $p_header['filename_len'] = strlen($p_filename); + $p_header['extra_len'] = 0; + $p_header['disk'] = 0; + $p_header['internal'] = 0; + $p_header['offset'] = 0; + $p_header['filename'] = $p_filename; +// TBC : Removed $p_header['stored_filename'] = $v_stored_filename; + $p_header['stored_filename'] = $p_filedescr['stored_filename']; + $p_header['extra'] = ''; + $p_header['status'] = 'ok'; + $p_header['index'] = -1; + + // ----- Look for regular file + if ($p_filedescr['type']=='file') { + $p_header['external'] = 0x00000000; + $p_header['size'] = filesize($p_filename); + } + + // ----- Look for regular folder + else if ($p_filedescr['type']=='folder') { + $p_header['external'] = 0x00000010; + $p_header['mtime'] = filemtime($p_filename); + $p_header['size'] = filesize($p_filename); + } + + // ----- Look for virtual file + else if ($p_filedescr['type'] == 'virtual_file') { + $p_header['external'] = 0x00000000; + $p_header['size'] = strlen($p_filedescr['content']); + } + + + // ----- Look for filetime + if (isset($p_filedescr['mtime'])) { + $p_header['mtime'] = $p_filedescr['mtime']; + } + else if ($p_filedescr['type'] == 'virtual_file') { + $p_header['mtime'] = time(); + } + else { + $p_header['mtime'] = filemtime($p_filename); + } + + // ------ Look for file comment + if (isset($p_filedescr['comment'])) { + $p_header['comment_len'] = strlen($p_filedescr['comment']); + $p_header['comment'] = $p_filedescr['comment']; + } + else { + $p_header['comment_len'] = 0; + $p_header['comment'] = ''; + } + + // ----- Look for pre-add callback + if (isset($p_options[PCLZIP_CB_PRE_ADD])) { + + // ----- Generate a local information + $v_local_header = array(); + $this->privConvertHeader2FileInfo($p_header, $v_local_header); + + // ----- Call the callback + // Here I do not use call_user_func() because I need to send a reference to the + // header. + $v_result = $p_options[PCLZIP_CB_PRE_ADD](PCLZIP_CB_PRE_ADD, $v_local_header); + if ($v_result == 0) { + // ----- Change the file status + $p_header['status'] = "skipped"; + $v_result = 1; + } + + // ----- Update the informations + // Only some fields can be modified + if ($p_header['stored_filename'] != $v_local_header['stored_filename']) { + $p_header['stored_filename'] = PclZipUtilPathReduction($v_local_header['stored_filename']); + } + } + + // ----- Look for empty stored filename + if ($p_header['stored_filename'] == "") { + $p_header['status'] = "filtered"; + } + + // ----- Check the path length + if (strlen($p_header['stored_filename']) > 0xFF) { + $p_header['status'] = 'filename_too_long'; + } + + // ----- Look if no error, or file not skipped + if ($p_header['status'] == 'ok') { + + // ----- Look for a file + if ($p_filedescr['type'] == 'file') { + // ----- Look for using temporary file to zip + if ( (!isset($p_options[PCLZIP_OPT_TEMP_FILE_OFF])) + && (isset($p_options[PCLZIP_OPT_TEMP_FILE_ON]) + || (isset($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD]) + && ($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] <= $p_header['size'])) ) ) { + $v_result = $this->privAddFileUsingTempFile($p_filedescr, $p_header, $p_options); + if ($v_result < PCLZIP_ERR_NO_ERROR) { + return $v_result; + } + } + + // ----- Use "in memory" zip algo + else { + + // ----- Open the source file + if (($v_file = @fopen($p_filename, "rb")) == 0) { + PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, "Unable to open file '$p_filename' in binary read mode"); + return PclZip::errorCode(); + } + + // ----- Read the file content + $v_content = @fread($v_file, $p_header['size']); + + // ----- Close the file + @fclose($v_file); + + // ----- Calculate the CRC + $p_header['crc'] = @crc32($v_content); + + // ----- Look for no compression + if ($p_options[PCLZIP_OPT_NO_COMPRESSION]) { + // ----- Set header parameters + $p_header['compressed_size'] = $p_header['size']; + $p_header['compression'] = 0; + } + + // ----- Look for normal compression + else { + // ----- Compress the content + $v_content = @gzdeflate($v_content); + + // ----- Set header parameters + $p_header['compressed_size'] = strlen($v_content); + $p_header['compression'] = 8; + } + + // ----- Call the header generation + if (($v_result = $this->privWriteFileHeader($p_header)) != 1) { + @fclose($v_file); + return $v_result; + } + + // ----- Write the compressed (or not) content + @fwrite($this->zip_fd, $v_content, $p_header['compressed_size']); + + } + + } + + // ----- Look for a virtual file (a file from string) + else if ($p_filedescr['type'] == 'virtual_file') { + + $v_content = $p_filedescr['content']; + + // ----- Calculate the CRC + $p_header['crc'] = @crc32($v_content); + + // ----- Look for no compression + if ($p_options[PCLZIP_OPT_NO_COMPRESSION]) { + // ----- Set header parameters + $p_header['compressed_size'] = $p_header['size']; + $p_header['compression'] = 0; + } + + // ----- Look for normal compression + else { + // ----- Compress the content + $v_content = @gzdeflate($v_content); + + // ----- Set header parameters + $p_header['compressed_size'] = strlen($v_content); + $p_header['compression'] = 8; + } + + // ----- Call the header generation + if (($v_result = $this->privWriteFileHeader($p_header)) != 1) { + @fclose($v_file); + return $v_result; + } + + // ----- Write the compressed (or not) content + @fwrite($this->zip_fd, $v_content, $p_header['compressed_size']); + } + + // ----- Look for a directory + else if ($p_filedescr['type'] == 'folder') { + // ----- Look for directory last '/' + if (@substr($p_header['stored_filename'], -1) != '/') { + $p_header['stored_filename'] .= '/'; + } + + // ----- Set the file properties + $p_header['size'] = 0; + //$p_header['external'] = 0x41FF0010; // Value for a folder : to be checked + $p_header['external'] = 0x00000010; // Value for a folder : to be checked + + // ----- Call the header generation + if (($v_result = $this->privWriteFileHeader($p_header)) != 1) + { + return $v_result; + } + } + } + + // ----- Look for post-add callback + if (isset($p_options[PCLZIP_CB_POST_ADD])) { + + // ----- Generate a local information + $v_local_header = array(); + $this->privConvertHeader2FileInfo($p_header, $v_local_header); + + // ----- Call the callback + // Here I do not use call_user_func() because I need to send a reference to the + // header. + $v_result = $p_options[PCLZIP_CB_POST_ADD](PCLZIP_CB_POST_ADD, $v_local_header); + if ($v_result == 0) { + // ----- Ignored + $v_result = 1; + } + + // ----- Update the informations + // Nothing can be modified + } + + // ----- Return + return $v_result; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : privAddFileUsingTempFile() + // Description : + // Parameters : + // Return Values : + // -------------------------------------------------------------------------------- + function privAddFileUsingTempFile($p_filedescr, &$p_header, &$p_options) + { + $v_result=PCLZIP_ERR_NO_ERROR; + + // ----- Working variable + $p_filename = $p_filedescr['filename']; + + + // ----- Open the source file + if (($v_file = @fopen($p_filename, "rb")) == 0) { + PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, "Unable to open file '$p_filename' in binary read mode"); + return PclZip::errorCode(); + } + + // ----- Creates a compressed temporary file + $v_gzip_temp_name = PCLZIP_TEMPORARY_DIR.uniqid('pclzip-').'.gz'; + if (($v_file_compressed = @gzopen($v_gzip_temp_name, "wb")) == 0) { + fclose($v_file); + PclZip::privErrorLog(PCLZIP_ERR_WRITE_OPEN_FAIL, 'Unable to open temporary file \''.$v_gzip_temp_name.'\' in binary write mode'); + return PclZip::errorCode(); + } + + // ----- Read the file by PCLZIP_READ_BLOCK_SIZE octets blocks + $v_size = filesize($p_filename); + while ($v_size != 0) { + $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE); + $v_buffer = @fread($v_file, $v_read_size); + //$v_binary_data = pack('a'.$v_read_size, $v_buffer); + @gzputs($v_file_compressed, $v_buffer, $v_read_size); + $v_size -= $v_read_size; + } + + // ----- Close the file + @fclose($v_file); + @gzclose($v_file_compressed); + + // ----- Check the minimum file size + if (filesize($v_gzip_temp_name) < 18) { + PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'gzip temporary file \''.$v_gzip_temp_name.'\' has invalid filesize - should be minimum 18 bytes'); + return PclZip::errorCode(); + } + + // ----- Extract the compressed attributes + if (($v_file_compressed = @fopen($v_gzip_temp_name, "rb")) == 0) { + PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open temporary file \''.$v_gzip_temp_name.'\' in binary read mode'); + return PclZip::errorCode(); + } + + // ----- Read the gzip file header + $v_binary_data = @fread($v_file_compressed, 10); + $v_data_header = unpack('a1id1/a1id2/a1cm/a1flag/Vmtime/a1xfl/a1os', $v_binary_data); + + // ----- Check some parameters + $v_data_header['os'] = bin2hex($v_data_header['os']); + + // ----- Read the gzip file footer + @fseek($v_file_compressed, filesize($v_gzip_temp_name)-8); + $v_binary_data = @fread($v_file_compressed, 8); + $v_data_footer = unpack('Vcrc/Vcompressed_size', $v_binary_data); + + // ----- Set the attributes + $p_header['compression'] = ord($v_data_header['cm']); + //$p_header['mtime'] = $v_data_header['mtime']; + $p_header['crc'] = $v_data_footer['crc']; + $p_header['compressed_size'] = filesize($v_gzip_temp_name)-18; + + // ----- Close the file + @fclose($v_file_compressed); + + // ----- Call the header generation + if (($v_result = $this->privWriteFileHeader($p_header)) != 1) { + return $v_result; + } + + // ----- Add the compressed data + if (($v_file_compressed = @fopen($v_gzip_temp_name, "rb")) == 0) + { + PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open temporary file \''.$v_gzip_temp_name.'\' in binary read mode'); + return PclZip::errorCode(); + } + + // ----- Read the file by PCLZIP_READ_BLOCK_SIZE octets blocks + fseek($v_file_compressed, 10); + $v_size = $p_header['compressed_size']; + while ($v_size != 0) + { + $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE); + $v_buffer = @fread($v_file_compressed, $v_read_size); + //$v_binary_data = pack('a'.$v_read_size, $v_buffer); + @fwrite($this->zip_fd, $v_buffer, $v_read_size); + $v_size -= $v_read_size; + } + + // ----- Close the file + @fclose($v_file_compressed); + + // ----- Unlink the temporary file + @unlink($v_gzip_temp_name); + + // ----- Return + return $v_result; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : privCalculateStoredFilename() + // Description : + // Based on file descriptor properties and global options, this method + // calculate the filename that will be stored in the archive. + // Parameters : + // Return Values : + // -------------------------------------------------------------------------------- + function privCalculateStoredFilename(&$p_filedescr, &$p_options) + { + $v_result=1; + + // ----- Working variables + $p_filename = $p_filedescr['filename']; + if (isset($p_options[PCLZIP_OPT_ADD_PATH])) { + $p_add_dir = $p_options[PCLZIP_OPT_ADD_PATH]; + } + else { + $p_add_dir = ''; + } + if (isset($p_options[PCLZIP_OPT_REMOVE_PATH])) { + $p_remove_dir = $p_options[PCLZIP_OPT_REMOVE_PATH]; + } + else { + $p_remove_dir = ''; + } + if (isset($p_options[PCLZIP_OPT_REMOVE_ALL_PATH])) { + $p_remove_all_dir = $p_options[PCLZIP_OPT_REMOVE_ALL_PATH]; + } + else { + $p_remove_all_dir = 0; + } + + + // ----- Look for full name change + if (isset($p_filedescr['new_full_name'])) { + // ----- Remove drive letter if any + $v_stored_filename = PclZipUtilTranslateWinPath($p_filedescr['new_full_name']); + } + + // ----- Look for path and/or short name change + else { + + // ----- Look for short name change + // Its when we cahnge just the filename but not the path + if (isset($p_filedescr['new_short_name'])) { + $v_path_info = pathinfo($p_filename); + $v_dir = ''; + if ($v_path_info['dirname'] != '') { + $v_dir = $v_path_info['dirname'].'/'; + } + $v_stored_filename = $v_dir.$p_filedescr['new_short_name']; + } + else { + // ----- Calculate the stored filename + $v_stored_filename = $p_filename; + } + + // ----- Look for all path to remove + if ($p_remove_all_dir) { + $v_stored_filename = basename($p_filename); + } + // ----- Look for partial path remove + else if ($p_remove_dir != "") { + if (substr($p_remove_dir, -1) != '/') + $p_remove_dir .= "/"; + + if ( (substr($p_filename, 0, 2) == "./") + || (substr($p_remove_dir, 0, 2) == "./")) { + + if ( (substr($p_filename, 0, 2) == "./") + && (substr($p_remove_dir, 0, 2) != "./")) { + $p_remove_dir = "./".$p_remove_dir; + } + if ( (substr($p_filename, 0, 2) != "./") + && (substr($p_remove_dir, 0, 2) == "./")) { + $p_remove_dir = substr($p_remove_dir, 2); + } + } + + $v_compare = PclZipUtilPathInclusion($p_remove_dir, + $v_stored_filename); + if ($v_compare > 0) { + if ($v_compare == 2) { + $v_stored_filename = ""; + } + else { + $v_stored_filename = substr($v_stored_filename, + strlen($p_remove_dir)); + } + } + } + + // ----- Remove drive letter if any + $v_stored_filename = PclZipUtilTranslateWinPath($v_stored_filename); + + // ----- Look for path to add + if ($p_add_dir != "") { + if (substr($p_add_dir, -1) == "/") + $v_stored_filename = $p_add_dir.$v_stored_filename; + else + $v_stored_filename = $p_add_dir."/".$v_stored_filename; + } + } + + // ----- Filename (reduce the path of stored name) + $v_stored_filename = PclZipUtilPathReduction($v_stored_filename); + $p_filedescr['stored_filename'] = $v_stored_filename; + + // ----- Return + return $v_result; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : privWriteFileHeader() + // Description : + // Parameters : + // Return Values : + // -------------------------------------------------------------------------------- + function privWriteFileHeader(&$p_header) + { + $v_result=1; + + // ----- Store the offset position of the file + $p_header['offset'] = ftell($this->zip_fd); + + // ----- Transform UNIX mtime to DOS format mdate/mtime + $v_date = getdate($p_header['mtime']); + $v_mtime = ($v_date['hours']<<11) + ($v_date['minutes']<<5) + $v_date['seconds']/2; + $v_mdate = (($v_date['year']-1980)<<9) + ($v_date['mon']<<5) + $v_date['mday']; + + // ----- Packed data + $v_binary_data = pack("VvvvvvVVVvv", 0x04034b50, + $p_header['version_extracted'], $p_header['flag'], + $p_header['compression'], $v_mtime, $v_mdate, + $p_header['crc'], $p_header['compressed_size'], + $p_header['size'], + strlen($p_header['stored_filename']), + $p_header['extra_len']); + + // ----- Write the first 148 bytes of the header in the archive + fputs($this->zip_fd, $v_binary_data, 30); + + // ----- Write the variable fields + if (strlen($p_header['stored_filename']) != 0) + { + fputs($this->zip_fd, $p_header['stored_filename'], strlen($p_header['stored_filename'])); + } + if ($p_header['extra_len'] != 0) + { + fputs($this->zip_fd, $p_header['extra'], $p_header['extra_len']); + } + + // ----- Return + return $v_result; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : privWriteCentralFileHeader() + // Description : + // Parameters : + // Return Values : + // -------------------------------------------------------------------------------- + function privWriteCentralFileHeader(&$p_header) + { + $v_result=1; + + // TBC + //for(reset($p_header); $key = key($p_header); next($p_header)) { + //} + + // ----- Transform UNIX mtime to DOS format mdate/mtime + $v_date = getdate($p_header['mtime']); + $v_mtime = ($v_date['hours']<<11) + ($v_date['minutes']<<5) + $v_date['seconds']/2; + $v_mdate = (($v_date['year']-1980)<<9) + ($v_date['mon']<<5) + $v_date['mday']; + + + // ----- Packed data + $v_binary_data = pack("VvvvvvvVVVvvvvvVV", 0x02014b50, + $p_header['version'], $p_header['version_extracted'], + $p_header['flag'], $p_header['compression'], + $v_mtime, $v_mdate, $p_header['crc'], + $p_header['compressed_size'], $p_header['size'], + strlen($p_header['stored_filename']), + $p_header['extra_len'], $p_header['comment_len'], + $p_header['disk'], $p_header['internal'], + $p_header['external'], $p_header['offset']); + + // ----- Write the 42 bytes of the header in the zip file + fputs($this->zip_fd, $v_binary_data, 46); + + // ----- Write the variable fields + if (strlen($p_header['stored_filename']) != 0) + { + fputs($this->zip_fd, $p_header['stored_filename'], strlen($p_header['stored_filename'])); + } + if ($p_header['extra_len'] != 0) + { + fputs($this->zip_fd, $p_header['extra'], $p_header['extra_len']); + } + if ($p_header['comment_len'] != 0) + { + fputs($this->zip_fd, $p_header['comment'], $p_header['comment_len']); + } + + // ----- Return + return $v_result; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : privWriteCentralHeader() + // Description : + // Parameters : + // Return Values : + // -------------------------------------------------------------------------------- + function privWriteCentralHeader($p_nb_entries, $p_size, $p_offset, $p_comment) + { + $v_result=1; + + // ----- Packed data + $v_binary_data = pack("VvvvvVVv", 0x06054b50, 0, 0, $p_nb_entries, + $p_nb_entries, $p_size, + $p_offset, strlen($p_comment)); + + // ----- Write the 22 bytes of the header in the zip file + fputs($this->zip_fd, $v_binary_data, 22); + + // ----- Write the variable fields + if (strlen($p_comment) != 0) + { + fputs($this->zip_fd, $p_comment, strlen($p_comment)); + } + + // ----- Return + return $v_result; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : privList() + // Description : + // Parameters : + // Return Values : + // -------------------------------------------------------------------------------- + function privList(&$p_list) + { + $v_result=1; + + // ----- Magic quotes trick + $this->privDisableMagicQuotes(); + + // ----- Open the zip file + if (($this->zip_fd = @fopen($this->zipname, 'rb')) == 0) + { + // ----- Magic quotes trick + $this->privSwapBackMagicQuotes(); + + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive \''.$this->zipname.'\' in binary read mode'); + + // ----- Return + return PclZip::errorCode(); + } + + // ----- Read the central directory informations + $v_central_dir = array(); + if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1) + { + $this->privSwapBackMagicQuotes(); + return $v_result; + } + + // ----- Go to beginning of Central Dir + @rewind($this->zip_fd); + if (@fseek($this->zip_fd, $v_central_dir['offset'])) + { + $this->privSwapBackMagicQuotes(); + + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size'); + + // ----- Return + return PclZip::errorCode(); + } + + // ----- Read each entry + for ($i=0; $i<$v_central_dir['entries']; $i++) + { + // ----- Read the file header + if (($v_result = $this->privReadCentralFileHeader($v_header)) != 1) + { + $this->privSwapBackMagicQuotes(); + return $v_result; + } + $v_header['index'] = $i; + + // ----- Get the only interesting attributes + $this->privConvertHeader2FileInfo($v_header, $p_list[$i]); + unset($v_header); + } + + // ----- Close the zip file + $this->privCloseFd(); + + // ----- Magic quotes trick + $this->privSwapBackMagicQuotes(); + + // ----- Return + return $v_result; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : privConvertHeader2FileInfo() + // Description : + // This function takes the file informations from the central directory + // entries and extract the interesting parameters that will be given back. + // The resulting file infos are set in the array $p_info + // $p_info['filename'] : Filename with full path. Given by user (add), + // extracted in the filesystem (extract). + // $p_info['stored_filename'] : Stored filename in the archive. + // $p_info['size'] = Size of the file. + // $p_info['compressed_size'] = Compressed size of the file. + // $p_info['mtime'] = Last modification date of the file. + // $p_info['comment'] = Comment associated with the file. + // $p_info['folder'] = true/false : indicates if the entry is a folder or not. + // $p_info['status'] = status of the action on the file. + // $p_info['crc'] = CRC of the file content. + // Parameters : + // Return Values : + // -------------------------------------------------------------------------------- + function privConvertHeader2FileInfo($p_header, &$p_info) + { + $v_result=1; + + // ----- Get the interesting attributes + $v_temp_path = PclZipUtilPathReduction($p_header['filename']); + $p_info['filename'] = $v_temp_path; + $v_temp_path = PclZipUtilPathReduction($p_header['stored_filename']); + $p_info['stored_filename'] = $v_temp_path; + $p_info['size'] = $p_header['size']; + $p_info['compressed_size'] = $p_header['compressed_size']; + $p_info['mtime'] = $p_header['mtime']; + $p_info['comment'] = $p_header['comment']; + $p_info['folder'] = (($p_header['external']&0x00000010)==0x00000010); + $p_info['index'] = $p_header['index']; + $p_info['status'] = $p_header['status']; + $p_info['crc'] = $p_header['crc']; + + // ----- Return + return $v_result; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : privExtractByRule() + // Description : + // Extract a file or directory depending of rules (by index, by name, ...) + // Parameters : + // $p_file_list : An array where will be placed the properties of each + // extracted file + // $p_path : Path to add while writing the extracted files + // $p_remove_path : Path to remove (from the file memorized path) while writing the + // extracted files. If the path does not match the file path, + // the file is extracted with its memorized path. + // $p_remove_path does not apply to 'list' mode. + // $p_path and $p_remove_path are commulative. + // Return Values : + // 1 on success,0 or less on error (see error code list) + // -------------------------------------------------------------------------------- + function privExtractByRule(&$p_file_list, $p_path, $p_remove_path, $p_remove_all_path, &$p_options) + { + $v_result=1; + + // ----- Magic quotes trick + $this->privDisableMagicQuotes(); + + // ----- Check the path + if ( ($p_path == "") + || ( (substr($p_path, 0, 1) != "/") + && (substr($p_path, 0, 3) != "../") + && (substr($p_path,1,2)!=":/"))) + $p_path = "./".$p_path; + + // ----- Reduce the path last (and duplicated) '/' + if (($p_path != "./") && ($p_path != "/")) + { + // ----- Look for the path end '/' + while (substr($p_path, -1) == "/") + { + $p_path = substr($p_path, 0, strlen($p_path)-1); + } + } + + // ----- Look for path to remove format (should end by /) + if (($p_remove_path != "") && (substr($p_remove_path, -1) != '/')) + { + $p_remove_path .= '/'; + } + $p_remove_path_size = strlen($p_remove_path); + + // ----- Open the zip file + if (($v_result = $this->privOpenFd('rb')) != 1) + { + $this->privSwapBackMagicQuotes(); + return $v_result; + } + + // ----- Read the central directory informations + $v_central_dir = array(); + if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1) + { + // ----- Close the zip file + $this->privCloseFd(); + $this->privSwapBackMagicQuotes(); + + return $v_result; + } + + // ----- Start at beginning of Central Dir + $v_pos_entry = $v_central_dir['offset']; + + // ----- Read each entry + $j_start = 0; + for ($i=0, $v_nb_extracted=0; $i<$v_central_dir['entries']; $i++) + { + + // ----- Read next Central dir entry + @rewind($this->zip_fd); + if (@fseek($this->zip_fd, $v_pos_entry)) + { + // ----- Close the zip file + $this->privCloseFd(); + $this->privSwapBackMagicQuotes(); + + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size'); + + // ----- Return + return PclZip::errorCode(); + } + + // ----- Read the file header + $v_header = array(); + if (($v_result = $this->privReadCentralFileHeader($v_header)) != 1) + { + // ----- Close the zip file + $this->privCloseFd(); + $this->privSwapBackMagicQuotes(); + + return $v_result; + } + + // ----- Store the index + $v_header['index'] = $i; + + // ----- Store the file position + $v_pos_entry = ftell($this->zip_fd); + + // ----- Look for the specific extract rules + $v_extract = false; + + // ----- Look for extract by name rule + if ( (isset($p_options[PCLZIP_OPT_BY_NAME])) + && ($p_options[PCLZIP_OPT_BY_NAME] != 0)) { + + // ----- Look if the filename is in the list + for ($j=0; ($j strlen($p_options[PCLZIP_OPT_BY_NAME][$j])) + && (substr($v_header['stored_filename'], 0, strlen($p_options[PCLZIP_OPT_BY_NAME][$j])) == $p_options[PCLZIP_OPT_BY_NAME][$j])) { + $v_extract = true; + } + } + // ----- Look for a filename + elseif ($v_header['stored_filename'] == $p_options[PCLZIP_OPT_BY_NAME][$j]) { + $v_extract = true; + } + } + } + + // ----- Look for extract by ereg rule + // ereg() is deprecated with PHP 5.3 + /* + else if ( (isset($p_options[PCLZIP_OPT_BY_EREG])) + && ($p_options[PCLZIP_OPT_BY_EREG] != "")) { + + if (ereg($p_options[PCLZIP_OPT_BY_EREG], $v_header['stored_filename'])) { + $v_extract = true; + } + } + */ + + // ----- Look for extract by preg rule + else if ( (isset($p_options[PCLZIP_OPT_BY_PREG])) + && ($p_options[PCLZIP_OPT_BY_PREG] != "")) { + + if (preg_match($p_options[PCLZIP_OPT_BY_PREG], $v_header['stored_filename'])) { + $v_extract = true; + } + } + + // ----- Look for extract by index rule + else if ( (isset($p_options[PCLZIP_OPT_BY_INDEX])) + && ($p_options[PCLZIP_OPT_BY_INDEX] != 0)) { + + // ----- Look if the index is in the list + for ($j=$j_start; ($j=$p_options[PCLZIP_OPT_BY_INDEX][$j]['start']) && ($i<=$p_options[PCLZIP_OPT_BY_INDEX][$j]['end'])) { + $v_extract = true; + } + if ($i>=$p_options[PCLZIP_OPT_BY_INDEX][$j]['end']) { + $j_start = $j+1; + } + + if ($p_options[PCLZIP_OPT_BY_INDEX][$j]['start']>$i) { + break; + } + } + } + + // ----- Look for no rule, which means extract all the archive + else { + $v_extract = true; + } + + // ----- Check compression method + if ( ($v_extract) + && ( ($v_header['compression'] != 8) + && ($v_header['compression'] != 0))) { + $v_header['status'] = 'unsupported_compression'; + + // ----- Look for PCLZIP_OPT_STOP_ON_ERROR + if ( (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR])) + && ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) { + + $this->privSwapBackMagicQuotes(); + + PclZip::privErrorLog(PCLZIP_ERR_UNSUPPORTED_COMPRESSION, + "Filename '".$v_header['stored_filename']."' is " + ."compressed by an unsupported compression " + ."method (".$v_header['compression'].") "); + + return PclZip::errorCode(); + } + } + + // ----- Check encrypted files + if (($v_extract) && (($v_header['flag'] & 1) == 1)) { + $v_header['status'] = 'unsupported_encryption'; + + // ----- Look for PCLZIP_OPT_STOP_ON_ERROR + if ( (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR])) + && ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) { + + $this->privSwapBackMagicQuotes(); + + PclZip::privErrorLog(PCLZIP_ERR_UNSUPPORTED_ENCRYPTION, + "Unsupported encryption for " + ." filename '".$v_header['stored_filename'] + ."'"); + + return PclZip::errorCode(); + } + } + + // ----- Look for real extraction + if (($v_extract) && ($v_header['status'] != 'ok')) { + $v_result = $this->privConvertHeader2FileInfo($v_header, + $p_file_list[$v_nb_extracted++]); + if ($v_result != 1) { + $this->privCloseFd(); + $this->privSwapBackMagicQuotes(); + return $v_result; + } + + $v_extract = false; + } + + // ----- Look for real extraction + if ($v_extract) + { + + // ----- Go to the file position + @rewind($this->zip_fd); + if (@fseek($this->zip_fd, $v_header['offset'])) + { + // ----- Close the zip file + $this->privCloseFd(); + + $this->privSwapBackMagicQuotes(); + + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size'); + + // ----- Return + return PclZip::errorCode(); + } + + // ----- Look for extraction as string + if ($p_options[PCLZIP_OPT_EXTRACT_AS_STRING]) { + + $v_string = ''; + + // ----- Extracting the file + $v_result1 = $this->privExtractFileAsString($v_header, $v_string, $p_options); + if ($v_result1 < 1) { + $this->privCloseFd(); + $this->privSwapBackMagicQuotes(); + return $v_result1; + } + + // ----- Get the only interesting attributes + if (($v_result = $this->privConvertHeader2FileInfo($v_header, $p_file_list[$v_nb_extracted])) != 1) + { + // ----- Close the zip file + $this->privCloseFd(); + $this->privSwapBackMagicQuotes(); + + return $v_result; + } + + // ----- Set the file content + $p_file_list[$v_nb_extracted]['content'] = $v_string; + + // ----- Next extracted file + $v_nb_extracted++; + + // ----- Look for user callback abort + if ($v_result1 == 2) { + break; + } + } + // ----- Look for extraction in standard output + elseif ( (isset($p_options[PCLZIP_OPT_EXTRACT_IN_OUTPUT])) + && ($p_options[PCLZIP_OPT_EXTRACT_IN_OUTPUT])) { + // ----- Extracting the file in standard output + $v_result1 = $this->privExtractFileInOutput($v_header, $p_options); + if ($v_result1 < 1) { + $this->privCloseFd(); + $this->privSwapBackMagicQuotes(); + return $v_result1; + } + + // ----- Get the only interesting attributes + if (($v_result = $this->privConvertHeader2FileInfo($v_header, $p_file_list[$v_nb_extracted++])) != 1) { + $this->privCloseFd(); + $this->privSwapBackMagicQuotes(); + return $v_result; + } + + // ----- Look for user callback abort + if ($v_result1 == 2) { + break; + } + } + // ----- Look for normal extraction + else { + // ----- Extracting the file + $v_result1 = $this->privExtractFile($v_header, + $p_path, $p_remove_path, + $p_remove_all_path, + $p_options); + if ($v_result1 < 1) { + $this->privCloseFd(); + $this->privSwapBackMagicQuotes(); + return $v_result1; + } + + // ----- Get the only interesting attributes + if (($v_result = $this->privConvertHeader2FileInfo($v_header, $p_file_list[$v_nb_extracted++])) != 1) + { + // ----- Close the zip file + $this->privCloseFd(); + $this->privSwapBackMagicQuotes(); + + return $v_result; + } + + // ----- Look for user callback abort + if ($v_result1 == 2) { + break; + } + } + } + } + + // ----- Close the zip file + $this->privCloseFd(); + $this->privSwapBackMagicQuotes(); + + // ----- Return + return $v_result; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : privExtractFile() + // Description : + // Parameters : + // Return Values : + // + // 1 : ... ? + // PCLZIP_ERR_USER_ABORTED(2) : User ask for extraction stop in callback + // -------------------------------------------------------------------------------- + function privExtractFile(&$p_entry, $p_path, $p_remove_path, $p_remove_all_path, &$p_options) + { + $v_result=1; + + // ----- Read the file header + if (($v_result = $this->privReadFileHeader($v_header)) != 1) + { + // ----- Return + return $v_result; + } + + + // ----- Check that the file header is coherent with $p_entry info + if ($this->privCheckFileHeaders($v_header, $p_entry) != 1) { + // TBC + } + + // ----- Look for all path to remove + if ($p_remove_all_path == true) { + // ----- Look for folder entry that not need to be extracted + if (($p_entry['external']&0x00000010)==0x00000010) { + + $p_entry['status'] = "filtered"; + + return $v_result; + } + + // ----- Get the basename of the path + $p_entry['filename'] = basename($p_entry['filename']); + } + + // ----- Look for path to remove + else if ($p_remove_path != "") + { + if (PclZipUtilPathInclusion($p_remove_path, $p_entry['filename']) == 2) + { + + // ----- Change the file status + $p_entry['status'] = "filtered"; + + // ----- Return + return $v_result; + } + + $p_remove_path_size = strlen($p_remove_path); + if (substr($p_entry['filename'], 0, $p_remove_path_size) == $p_remove_path) + { + + // ----- Remove the path + $p_entry['filename'] = substr($p_entry['filename'], $p_remove_path_size); + + } + } + + // ----- Add the path + if ($p_path != '') { + $p_entry['filename'] = $p_path."/".$p_entry['filename']; + } + + // ----- Check a base_dir_restriction + if (isset($p_options[PCLZIP_OPT_EXTRACT_DIR_RESTRICTION])) { + $v_inclusion + = PclZipUtilPathInclusion($p_options[PCLZIP_OPT_EXTRACT_DIR_RESTRICTION], + $p_entry['filename']); + if ($v_inclusion == 0) { + + PclZip::privErrorLog(PCLZIP_ERR_DIRECTORY_RESTRICTION, + "Filename '".$p_entry['filename']."' is " + ."outside PCLZIP_OPT_EXTRACT_DIR_RESTRICTION"); + + return PclZip::errorCode(); + } + } + + // ----- Look for pre-extract callback + if (isset($p_options[PCLZIP_CB_PRE_EXTRACT])) { + + // ----- Generate a local information + $v_local_header = array(); + $this->privConvertHeader2FileInfo($p_entry, $v_local_header); + + // ----- Call the callback + // Here I do not use call_user_func() because I need to send a reference to the + // header. + $v_result = $p_options[PCLZIP_CB_PRE_EXTRACT](PCLZIP_CB_PRE_EXTRACT, $v_local_header); + if ($v_result == 0) { + // ----- Change the file status + $p_entry['status'] = "skipped"; + $v_result = 1; + } + + // ----- Look for abort result + if ($v_result == 2) { + // ----- This status is internal and will be changed in 'skipped' + $p_entry['status'] = "aborted"; + $v_result = PCLZIP_ERR_USER_ABORTED; + } + + // ----- Update the informations + // Only some fields can be modified + $p_entry['filename'] = $v_local_header['filename']; + } + + + // ----- Look if extraction should be done + if ($p_entry['status'] == 'ok') { + + // ----- Look for specific actions while the file exist + if (file_exists($p_entry['filename'])) + { + + // ----- Look if file is a directory + if (is_dir($p_entry['filename'])) + { + + // ----- Change the file status + $p_entry['status'] = "already_a_directory"; + + // ----- Look for PCLZIP_OPT_STOP_ON_ERROR + // For historical reason first PclZip implementation does not stop + // when this kind of error occurs. + if ( (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR])) + && ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) { + + PclZip::privErrorLog(PCLZIP_ERR_ALREADY_A_DIRECTORY, + "Filename '".$p_entry['filename']."' is " + ."already used by an existing directory"); + + return PclZip::errorCode(); + } + } + // ----- Look if file is write protected + else if (!is_writeable($p_entry['filename'])) + { + + // ----- Change the file status + $p_entry['status'] = "write_protected"; + + // ----- Look for PCLZIP_OPT_STOP_ON_ERROR + // For historical reason first PclZip implementation does not stop + // when this kind of error occurs. + if ( (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR])) + && ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) { + + PclZip::privErrorLog(PCLZIP_ERR_WRITE_OPEN_FAIL, + "Filename '".$p_entry['filename']."' exists " + ."and is write protected"); + + return PclZip::errorCode(); + } + } + + // ----- Look if the extracted file is older + else if (filemtime($p_entry['filename']) > $p_entry['mtime']) + { + // ----- Change the file status + if ( (isset($p_options[PCLZIP_OPT_REPLACE_NEWER])) + && ($p_options[PCLZIP_OPT_REPLACE_NEWER]===true)) { + } + else { + $p_entry['status'] = "newer_exist"; + + // ----- Look for PCLZIP_OPT_STOP_ON_ERROR + // For historical reason first PclZip implementation does not stop + // when this kind of error occurs. + if ( (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR])) + && ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) { + + PclZip::privErrorLog(PCLZIP_ERR_WRITE_OPEN_FAIL, + "Newer version of '".$p_entry['filename']."' exists " + ."and option PCLZIP_OPT_REPLACE_NEWER is not selected"); + + return PclZip::errorCode(); + } + } + } + else { + } + } + + // ----- Check the directory availability and create it if necessary + else { + if ((($p_entry['external']&0x00000010)==0x00000010) || (substr($p_entry['filename'], -1) == '/')) + $v_dir_to_check = $p_entry['filename']; + else if (!strstr($p_entry['filename'], "/")) + $v_dir_to_check = ""; + else + $v_dir_to_check = dirname($p_entry['filename']); + + if (($v_result = $this->privDirCheck($v_dir_to_check, (($p_entry['external']&0x00000010)==0x00000010))) != 1) { + + // ----- Change the file status + $p_entry['status'] = "path_creation_fail"; + + // ----- Return + //return $v_result; + $v_result = 1; + } + } + } + + // ----- Look if extraction should be done + if ($p_entry['status'] == 'ok') { + + // ----- Do the extraction (if not a folder) + if (!(($p_entry['external']&0x00000010)==0x00000010)) + { + // ----- Look for not compressed file + if ($p_entry['compression'] == 0) { + + // ----- Opening destination file + if (($v_dest_file = @fopen($p_entry['filename'], 'wb')) == 0) + { + + // ----- Change the file status + $p_entry['status'] = "write_error"; + + // ----- Return + return $v_result; + } + + + // ----- Read the file by PCLZIP_READ_BLOCK_SIZE octets blocks + $v_size = $p_entry['compressed_size']; + while ($v_size != 0) + { + $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE); + $v_buffer = @fread($this->zip_fd, $v_read_size); + /* Try to speed up the code + $v_binary_data = pack('a'.$v_read_size, $v_buffer); + @fwrite($v_dest_file, $v_binary_data, $v_read_size); + */ + @fwrite($v_dest_file, $v_buffer, $v_read_size); + $v_size -= $v_read_size; + } + + // ----- Closing the destination file + fclose($v_dest_file); + + // ----- Change the file mtime + touch($p_entry['filename'], $p_entry['mtime']); + + + } + else { + // ----- TBC + // Need to be finished + if (($p_entry['flag'] & 1) == 1) { + PclZip::privErrorLog(PCLZIP_ERR_UNSUPPORTED_ENCRYPTION, 'File \''.$p_entry['filename'].'\' is encrypted. Encrypted files are not supported.'); + return PclZip::errorCode(); + } + + + // ----- Look for using temporary file to unzip + if ( (!isset($p_options[PCLZIP_OPT_TEMP_FILE_OFF])) + && (isset($p_options[PCLZIP_OPT_TEMP_FILE_ON]) + || (isset($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD]) + && ($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] <= $p_entry['size'])) ) ) { + $v_result = $this->privExtractFileUsingTempFile($p_entry, $p_options); + if ($v_result < PCLZIP_ERR_NO_ERROR) { + return $v_result; + } + } + + // ----- Look for extract in memory + else { + + + // ----- Read the compressed file in a buffer (one shot) + $v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']); + + // ----- Decompress the file + $v_file_content = @gzinflate($v_buffer); + unset($v_buffer); + if ($v_file_content === FALSE) { + + // ----- Change the file status + // TBC + $p_entry['status'] = "error"; + + return $v_result; + } + + // ----- Opening destination file + if (($v_dest_file = @fopen($p_entry['filename'], 'wb')) == 0) { + + // ----- Change the file status + $p_entry['status'] = "write_error"; + + return $v_result; + } + + // ----- Write the uncompressed data + @fwrite($v_dest_file, $v_file_content, $p_entry['size']); + unset($v_file_content); + + // ----- Closing the destination file + @fclose($v_dest_file); + + } + + // ----- Change the file mtime + @touch($p_entry['filename'], $p_entry['mtime']); + } + + // ----- Look for chmod option + if (isset($p_options[PCLZIP_OPT_SET_CHMOD])) { + + // ----- Change the mode of the file + @chmod($p_entry['filename'], $p_options[PCLZIP_OPT_SET_CHMOD]); + } + + } + } + + // ----- Change abort status + if ($p_entry['status'] == "aborted") { + $p_entry['status'] = "skipped"; + } + + // ----- Look for post-extract callback + elseif (isset($p_options[PCLZIP_CB_POST_EXTRACT])) { + + // ----- Generate a local information + $v_local_header = array(); + $this->privConvertHeader2FileInfo($p_entry, $v_local_header); + + // ----- Call the callback + // Here I do not use call_user_func() because I need to send a reference to the + // header. + $v_result = $p_options[PCLZIP_CB_POST_EXTRACT](PCLZIP_CB_POST_EXTRACT, $v_local_header); + + // ----- Look for abort result + if ($v_result == 2) { + $v_result = PCLZIP_ERR_USER_ABORTED; + } + } + + // ----- Return + return $v_result; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : privExtractFileUsingTempFile() + // Description : + // Parameters : + // Return Values : + // -------------------------------------------------------------------------------- + function privExtractFileUsingTempFile(&$p_entry, &$p_options) + { + $v_result=1; + + // ----- Creates a temporary file + $v_gzip_temp_name = PCLZIP_TEMPORARY_DIR.uniqid('pclzip-').'.gz'; + if (($v_dest_file = @fopen($v_gzip_temp_name, "wb")) == 0) { + fclose($v_file); + PclZip::privErrorLog(PCLZIP_ERR_WRITE_OPEN_FAIL, 'Unable to open temporary file \''.$v_gzip_temp_name.'\' in binary write mode'); + return PclZip::errorCode(); + } + + + // ----- Write gz file format header + $v_binary_data = pack('va1a1Va1a1', 0x8b1f, Chr($p_entry['compression']), Chr(0x00), time(), Chr(0x00), Chr(3)); + @fwrite($v_dest_file, $v_binary_data, 10); + + // ----- Read the file by PCLZIP_READ_BLOCK_SIZE octets blocks + $v_size = $p_entry['compressed_size']; + while ($v_size != 0) + { + $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE); + $v_buffer = @fread($this->zip_fd, $v_read_size); + //$v_binary_data = pack('a'.$v_read_size, $v_buffer); + @fwrite($v_dest_file, $v_buffer, $v_read_size); + $v_size -= $v_read_size; + } + + // ----- Write gz file format footer + $v_binary_data = pack('VV', $p_entry['crc'], $p_entry['size']); + @fwrite($v_dest_file, $v_binary_data, 8); + + // ----- Close the temporary file + @fclose($v_dest_file); + + // ----- Opening destination file + if (($v_dest_file = @fopen($p_entry['filename'], 'wb')) == 0) { + $p_entry['status'] = "write_error"; + return $v_result; + } + + // ----- Open the temporary gz file + if (($v_src_file = @gzopen($v_gzip_temp_name, 'rb')) == 0) { + @fclose($v_dest_file); + $p_entry['status'] = "read_error"; + PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open temporary file \''.$v_gzip_temp_name.'\' in binary read mode'); + return PclZip::errorCode(); + } + + + // ----- Read the file by PCLZIP_READ_BLOCK_SIZE octets blocks + $v_size = $p_entry['size']; + while ($v_size != 0) { + $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE); + $v_buffer = @gzread($v_src_file, $v_read_size); + //$v_binary_data = pack('a'.$v_read_size, $v_buffer); + @fwrite($v_dest_file, $v_buffer, $v_read_size); + $v_size -= $v_read_size; + } + @fclose($v_dest_file); + @gzclose($v_src_file); + + // ----- Delete the temporary file + @unlink($v_gzip_temp_name); + + // ----- Return + return $v_result; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : privExtractFileInOutput() + // Description : + // Parameters : + // Return Values : + // -------------------------------------------------------------------------------- + function privExtractFileInOutput(&$p_entry, &$p_options) + { + $v_result=1; + + // ----- Read the file header + if (($v_result = $this->privReadFileHeader($v_header)) != 1) { + return $v_result; + } + + + // ----- Check that the file header is coherent with $p_entry info + if ($this->privCheckFileHeaders($v_header, $p_entry) != 1) { + // TBC + } + + // ----- Look for pre-extract callback + if (isset($p_options[PCLZIP_CB_PRE_EXTRACT])) { + + // ----- Generate a local information + $v_local_header = array(); + $this->privConvertHeader2FileInfo($p_entry, $v_local_header); + + // ----- Call the callback + // Here I do not use call_user_func() because I need to send a reference to the + // header. +// eval('$v_result = '.$p_options[PCLZIP_CB_PRE_EXTRACT].'(PCLZIP_CB_PRE_EXTRACT, $v_local_header);'); + $v_result = $p_options[PCLZIP_CB_PRE_EXTRACT](PCLZIP_CB_PRE_EXTRACT, $v_local_header); + if ($v_result == 0) { + // ----- Change the file status + $p_entry['status'] = "skipped"; + $v_result = 1; + } + + // ----- Look for abort result + if ($v_result == 2) { + // ----- This status is internal and will be changed in 'skipped' + $p_entry['status'] = "aborted"; + $v_result = PCLZIP_ERR_USER_ABORTED; + } + + // ----- Update the informations + // Only some fields can be modified + $p_entry['filename'] = $v_local_header['filename']; + } + + // ----- Trace + + // ----- Look if extraction should be done + if ($p_entry['status'] == 'ok') { + + // ----- Do the extraction (if not a folder) + if (!(($p_entry['external']&0x00000010)==0x00000010)) { + // ----- Look for not compressed file + if ($p_entry['compressed_size'] == $p_entry['size']) { + + // ----- Read the file in a buffer (one shot) + $v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']); + + // ----- Send the file to the output + echo $v_buffer; + unset($v_buffer); + } + else { + + // ----- Read the compressed file in a buffer (one shot) + $v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']); + + // ----- Decompress the file + $v_file_content = gzinflate($v_buffer); + unset($v_buffer); + + // ----- Send the file to the output + echo $v_file_content; + unset($v_file_content); + } + } + } + + // ----- Change abort status + if ($p_entry['status'] == "aborted") { + $p_entry['status'] = "skipped"; + } + + // ----- Look for post-extract callback + elseif (isset($p_options[PCLZIP_CB_POST_EXTRACT])) { + + // ----- Generate a local information + $v_local_header = array(); + $this->privConvertHeader2FileInfo($p_entry, $v_local_header); + + // ----- Call the callback + // Here I do not use call_user_func() because I need to send a reference to the + // header. + $v_result = $p_options[PCLZIP_CB_POST_EXTRACT](PCLZIP_CB_POST_EXTRACT, $v_local_header); + + // ----- Look for abort result + if ($v_result == 2) { + $v_result = PCLZIP_ERR_USER_ABORTED; + } + } + + return $v_result; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : privExtractFileAsString() + // Description : + // Parameters : + // Return Values : + // -------------------------------------------------------------------------------- + function privExtractFileAsString(&$p_entry, &$p_string, &$p_options) + { + $v_result=1; + + // ----- Read the file header + $v_header = array(); + if (($v_result = $this->privReadFileHeader($v_header)) != 1) + { + // ----- Return + return $v_result; + } + + + // ----- Check that the file header is coherent with $p_entry info + if ($this->privCheckFileHeaders($v_header, $p_entry) != 1) { + // TBC + } + + // ----- Look for pre-extract callback + if (isset($p_options[PCLZIP_CB_PRE_EXTRACT])) { + + // ----- Generate a local information + $v_local_header = array(); + $this->privConvertHeader2FileInfo($p_entry, $v_local_header); + + // ----- Call the callback + // Here I do not use call_user_func() because I need to send a reference to the + // header. + $v_result = $p_options[PCLZIP_CB_PRE_EXTRACT](PCLZIP_CB_PRE_EXTRACT, $v_local_header); + if ($v_result == 0) { + // ----- Change the file status + $p_entry['status'] = "skipped"; + $v_result = 1; + } + + // ----- Look for abort result + if ($v_result == 2) { + // ----- This status is internal and will be changed in 'skipped' + $p_entry['status'] = "aborted"; + $v_result = PCLZIP_ERR_USER_ABORTED; + } + + // ----- Update the informations + // Only some fields can be modified + $p_entry['filename'] = $v_local_header['filename']; + } + + + // ----- Look if extraction should be done + if ($p_entry['status'] == 'ok') { + + // ----- Do the extraction (if not a folder) + if (!(($p_entry['external']&0x00000010)==0x00000010)) { + // ----- Look for not compressed file + // if ($p_entry['compressed_size'] == $p_entry['size']) + if ($p_entry['compression'] == 0) { + + // ----- Reading the file + $p_string = @fread($this->zip_fd, $p_entry['compressed_size']); + } + else { + + // ----- Reading the file + $v_data = @fread($this->zip_fd, $p_entry['compressed_size']); + + // ----- Decompress the file + if (($p_string = @gzinflate($v_data)) === FALSE) { + // TBC + } + } + + // ----- Trace + } + else { + // TBC : error : can not extract a folder in a string + } + + } + + // ----- Change abort status + if ($p_entry['status'] == "aborted") { + $p_entry['status'] = "skipped"; + } + + // ----- Look for post-extract callback + elseif (isset($p_options[PCLZIP_CB_POST_EXTRACT])) { + + // ----- Generate a local information + $v_local_header = array(); + $this->privConvertHeader2FileInfo($p_entry, $v_local_header); + + // ----- Swap the content to header + $v_local_header['content'] = $p_string; + $p_string = ''; + + // ----- Call the callback + // Here I do not use call_user_func() because I need to send a reference to the + // header. + $v_result = $p_options[PCLZIP_CB_POST_EXTRACT](PCLZIP_CB_POST_EXTRACT, $v_local_header); + + // ----- Swap back the content to header + $p_string = $v_local_header['content']; + unset($v_local_header['content']); + + // ----- Look for abort result + if ($v_result == 2) { + $v_result = PCLZIP_ERR_USER_ABORTED; + } + } + + // ----- Return + return $v_result; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : privReadFileHeader() + // Description : + // Parameters : + // Return Values : + // -------------------------------------------------------------------------------- + function privReadFileHeader(&$p_header) + { + $v_result=1; + + // ----- Read the 4 bytes signature + $v_binary_data = @fread($this->zip_fd, 4); + $v_data = unpack('Vid', $v_binary_data); + + // ----- Check signature + if ($v_data['id'] != 0x04034b50) + { + + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Invalid archive structure'); + + // ----- Return + return PclZip::errorCode(); + } + + // ----- Read the first 42 bytes of the header + $v_binary_data = fread($this->zip_fd, 26); + + // ----- Look for invalid block size + if (strlen($v_binary_data) != 26) + { + $p_header['filename'] = ""; + $p_header['status'] = "invalid_header"; + + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, "Invalid block size : ".strlen($v_binary_data)); + + // ----- Return + return PclZip::errorCode(); + } + + // ----- Extract the values + $v_data = unpack('vversion/vflag/vcompression/vmtime/vmdate/Vcrc/Vcompressed_size/Vsize/vfilename_len/vextra_len', $v_binary_data); + + // ----- Get filename + $p_header['filename'] = fread($this->zip_fd, $v_data['filename_len']); + + // ----- Get extra_fields + if ($v_data['extra_len'] != 0) { + $p_header['extra'] = fread($this->zip_fd, $v_data['extra_len']); + } + else { + $p_header['extra'] = ''; + } + + // ----- Extract properties + $p_header['version_extracted'] = $v_data['version']; + $p_header['compression'] = $v_data['compression']; + $p_header['size'] = $v_data['size']; + $p_header['compressed_size'] = $v_data['compressed_size']; + $p_header['crc'] = $v_data['crc']; + $p_header['flag'] = $v_data['flag']; + $p_header['filename_len'] = $v_data['filename_len']; + + // ----- Recuperate date in UNIX format + $p_header['mdate'] = $v_data['mdate']; + $p_header['mtime'] = $v_data['mtime']; + if ($p_header['mdate'] && $p_header['mtime']) + { + // ----- Extract time + $v_hour = ($p_header['mtime'] & 0xF800) >> 11; + $v_minute = ($p_header['mtime'] & 0x07E0) >> 5; + $v_seconde = ($p_header['mtime'] & 0x001F)*2; + + // ----- Extract date + $v_year = (($p_header['mdate'] & 0xFE00) >> 9) + 1980; + $v_month = ($p_header['mdate'] & 0x01E0) >> 5; + $v_day = $p_header['mdate'] & 0x001F; + + // ----- Get UNIX date format + $p_header['mtime'] = @mktime($v_hour, $v_minute, $v_seconde, $v_month, $v_day, $v_year); + + } + else + { + $p_header['mtime'] = time(); + } + + // TBC + //for(reset($v_data); $key = key($v_data); next($v_data)) { + //} + + // ----- Set the stored filename + $p_header['stored_filename'] = $p_header['filename']; + + // ----- Set the status field + $p_header['status'] = "ok"; + + // ----- Return + return $v_result; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : privReadCentralFileHeader() + // Description : + // Parameters : + // Return Values : + // -------------------------------------------------------------------------------- + function privReadCentralFileHeader(&$p_header) + { + $v_result=1; + + // ----- Read the 4 bytes signature + $v_binary_data = @fread($this->zip_fd, 4); + $v_data = unpack('Vid', $v_binary_data); + + // ----- Check signature + if ($v_data['id'] != 0x02014b50) + { + + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Invalid archive structure'); + + // ----- Return + return PclZip::errorCode(); + } + + // ----- Read the first 42 bytes of the header + $v_binary_data = fread($this->zip_fd, 42); + + // ----- Look for invalid block size + if (strlen($v_binary_data) != 42) + { + $p_header['filename'] = ""; + $p_header['status'] = "invalid_header"; + + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, "Invalid block size : ".strlen($v_binary_data)); + + // ----- Return + return PclZip::errorCode(); + } + + // ----- Extract the values + $p_header = unpack('vversion/vversion_extracted/vflag/vcompression/vmtime/vmdate/Vcrc/Vcompressed_size/Vsize/vfilename_len/vextra_len/vcomment_len/vdisk/vinternal/Vexternal/Voffset', $v_binary_data); + + // ----- Get filename + if ($p_header['filename_len'] != 0) + $p_header['filename'] = fread($this->zip_fd, $p_header['filename_len']); + else + $p_header['filename'] = ''; + + // ----- Get extra + if ($p_header['extra_len'] != 0) + $p_header['extra'] = fread($this->zip_fd, $p_header['extra_len']); + else + $p_header['extra'] = ''; + + // ----- Get comment + if ($p_header['comment_len'] != 0) + $p_header['comment'] = fread($this->zip_fd, $p_header['comment_len']); + else + $p_header['comment'] = ''; + + // ----- Extract properties + + // ----- Recuperate date in UNIX format + //if ($p_header['mdate'] && $p_header['mtime']) + // TBC : bug : this was ignoring time with 0/0/0 + if (1) + { + // ----- Extract time + $v_hour = ($p_header['mtime'] & 0xF800) >> 11; + $v_minute = ($p_header['mtime'] & 0x07E0) >> 5; + $v_seconde = ($p_header['mtime'] & 0x001F)*2; + + // ----- Extract date + $v_year = (($p_header['mdate'] & 0xFE00) >> 9) + 1980; + $v_month = ($p_header['mdate'] & 0x01E0) >> 5; + $v_day = $p_header['mdate'] & 0x001F; + + // ----- Get UNIX date format + $p_header['mtime'] = @mktime($v_hour, $v_minute, $v_seconde, $v_month, $v_day, $v_year); + + } + else + { + $p_header['mtime'] = time(); + } + + // ----- Set the stored filename + $p_header['stored_filename'] = $p_header['filename']; + + // ----- Set default status to ok + $p_header['status'] = 'ok'; + + // ----- Look if it is a directory + if (substr($p_header['filename'], -1) == '/') { + //$p_header['external'] = 0x41FF0010; + $p_header['external'] = 0x00000010; + } + + + // ----- Return + return $v_result; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : privCheckFileHeaders() + // Description : + // Parameters : + // Return Values : + // 1 on success, + // 0 on error; + // -------------------------------------------------------------------------------- + function privCheckFileHeaders(&$p_local_header, &$p_central_header) + { + $v_result=1; + + // ----- Check the static values + // TBC + if ($p_local_header['filename'] != $p_central_header['filename']) { + } + if ($p_local_header['version_extracted'] != $p_central_header['version_extracted']) { + } + if ($p_local_header['flag'] != $p_central_header['flag']) { + } + if ($p_local_header['compression'] != $p_central_header['compression']) { + } + if ($p_local_header['mtime'] != $p_central_header['mtime']) { + } + if ($p_local_header['filename_len'] != $p_central_header['filename_len']) { + } + + // ----- Look for flag bit 3 + if (($p_local_header['flag'] & 8) == 8) { + $p_local_header['size'] = $p_central_header['size']; + $p_local_header['compressed_size'] = $p_central_header['compressed_size']; + $p_local_header['crc'] = $p_central_header['crc']; + } + + // ----- Return + return $v_result; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : privReadEndCentralDir() + // Description : + // Parameters : + // Return Values : + // -------------------------------------------------------------------------------- + function privReadEndCentralDir(&$p_central_dir) + { + $v_result=1; + + // ----- Go to the end of the zip file + $v_size = filesize($this->zipname); + @fseek($this->zip_fd, $v_size); + if (@ftell($this->zip_fd) != $v_size) + { + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Unable to go to the end of the archive \''.$this->zipname.'\''); + + // ----- Return + return PclZip::errorCode(); + } + + // ----- First try : look if this is an archive with no commentaries (most of the time) + // in this case the end of central dir is at 22 bytes of the file end + $v_found = 0; + if ($v_size > 26) { + @fseek($this->zip_fd, $v_size-22); + if (($v_pos = @ftell($this->zip_fd)) != ($v_size-22)) + { + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Unable to seek back to the middle of the archive \''.$this->zipname.'\''); + + // ----- Return + return PclZip::errorCode(); + } + + // ----- Read for bytes + $v_binary_data = @fread($this->zip_fd, 4); + $v_data = @unpack('Vid', $v_binary_data); + + // ----- Check signature + if ($v_data['id'] == 0x06054b50) { + $v_found = 1; + } + + $v_pos = ftell($this->zip_fd); + } + + // ----- Go back to the maximum possible size of the Central Dir End Record + if (!$v_found) { + $v_maximum_size = 65557; // 0xFFFF + 22; + if ($v_maximum_size > $v_size) + $v_maximum_size = $v_size; + @fseek($this->zip_fd, $v_size-$v_maximum_size); + if (@ftell($this->zip_fd) != ($v_size-$v_maximum_size)) + { + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Unable to seek back to the middle of the archive \''.$this->zipname.'\''); + + // ----- Return + return PclZip::errorCode(); + } + + // ----- Read byte per byte in order to find the signature + $v_pos = ftell($this->zip_fd); + $v_bytes = 0x00000000; + while ($v_pos < $v_size) + { + // ----- Read a byte + $v_byte = @fread($this->zip_fd, 1); + + // ----- Add the byte + //$v_bytes = ($v_bytes << 8) | Ord($v_byte); + // Note we mask the old value down such that once shifted we can never end up with more than a 32bit number + // Otherwise on systems where we have 64bit integers the check below for the magic number will fail. + $v_bytes = ( ($v_bytes & 0xFFFFFF) << 8) | Ord($v_byte); + + // ----- Compare the bytes + if ($v_bytes == 0x504b0506) + { + $v_pos++; + break; + } + + $v_pos++; + } + + // ----- Look if not found end of central dir + if ($v_pos == $v_size) + { + + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, "Unable to find End of Central Dir Record signature"); + + // ----- Return + return PclZip::errorCode(); + } + } + + // ----- Read the first 18 bytes of the header + $v_binary_data = fread($this->zip_fd, 18); + + // ----- Look for invalid block size + if (strlen($v_binary_data) != 18) + { + + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, "Invalid End of Central Dir Record size : ".strlen($v_binary_data)); + + // ----- Return + return PclZip::errorCode(); + } + + // ----- Extract the values + $v_data = unpack('vdisk/vdisk_start/vdisk_entries/ventries/Vsize/Voffset/vcomment_size', $v_binary_data); + + // ----- Check the global size + if (($v_pos + $v_data['comment_size'] + 18) != $v_size) { + + // ----- Removed in release 2.2 see readme file + // The check of the file size is a little too strict. + // Some bugs where found when a zip is encrypted/decrypted with 'crypt'. + // While decrypted, zip has training 0 bytes + if (0) { + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, + 'The central dir is not at the end of the archive.' + .' Some trailing bytes exists after the archive.'); + + // ----- Return + return PclZip::errorCode(); + } + } + + // ----- Get comment + if ($v_data['comment_size'] != 0) { + $p_central_dir['comment'] = fread($this->zip_fd, $v_data['comment_size']); + } + else + $p_central_dir['comment'] = ''; + + $p_central_dir['entries'] = $v_data['entries']; + $p_central_dir['disk_entries'] = $v_data['disk_entries']; + $p_central_dir['offset'] = $v_data['offset']; + $p_central_dir['size'] = $v_data['size']; + $p_central_dir['disk'] = $v_data['disk']; + $p_central_dir['disk_start'] = $v_data['disk_start']; + + // TBC + //for(reset($p_central_dir); $key = key($p_central_dir); next($p_central_dir)) { + //} + + // ----- Return + return $v_result; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : privDeleteByRule() + // Description : + // Parameters : + // Return Values : + // -------------------------------------------------------------------------------- + function privDeleteByRule(&$p_result_list, &$p_options) + { + $v_result=1; + $v_list_detail = array(); + + // ----- Open the zip file + if (($v_result=$this->privOpenFd('rb')) != 1) + { + // ----- Return + return $v_result; + } + + // ----- Read the central directory informations + $v_central_dir = array(); + if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1) + { + $this->privCloseFd(); + return $v_result; + } + + // ----- Go to beginning of File + @rewind($this->zip_fd); + + // ----- Scan all the files + // ----- Start at beginning of Central Dir + $v_pos_entry = $v_central_dir['offset']; + @rewind($this->zip_fd); + if (@fseek($this->zip_fd, $v_pos_entry)) + { + // ----- Close the zip file + $this->privCloseFd(); + + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size'); + + // ----- Return + return PclZip::errorCode(); + } + + // ----- Read each entry + $v_header_list = array(); + $j_start = 0; + for ($i=0, $v_nb_extracted=0; $i<$v_central_dir['entries']; $i++) + { + + // ----- Read the file header + $v_header_list[$v_nb_extracted] = array(); + if (($v_result = $this->privReadCentralFileHeader($v_header_list[$v_nb_extracted])) != 1) + { + // ----- Close the zip file + $this->privCloseFd(); + + return $v_result; + } + + + // ----- Store the index + $v_header_list[$v_nb_extracted]['index'] = $i; + + // ----- Look for the specific extract rules + $v_found = false; + + // ----- Look for extract by name rule + if ( (isset($p_options[PCLZIP_OPT_BY_NAME])) + && ($p_options[PCLZIP_OPT_BY_NAME] != 0)) { + + // ----- Look if the filename is in the list + for ($j=0; ($j strlen($p_options[PCLZIP_OPT_BY_NAME][$j])) + && (substr($v_header_list[$v_nb_extracted]['stored_filename'], 0, strlen($p_options[PCLZIP_OPT_BY_NAME][$j])) == $p_options[PCLZIP_OPT_BY_NAME][$j])) { + $v_found = true; + } + elseif ( (($v_header_list[$v_nb_extracted]['external']&0x00000010)==0x00000010) /* Indicates a folder */ + && ($v_header_list[$v_nb_extracted]['stored_filename'].'/' == $p_options[PCLZIP_OPT_BY_NAME][$j])) { + $v_found = true; + } + } + // ----- Look for a filename + elseif ($v_header_list[$v_nb_extracted]['stored_filename'] == $p_options[PCLZIP_OPT_BY_NAME][$j]) { + $v_found = true; + } + } + } + + // ----- Look for extract by ereg rule + // ereg() is deprecated with PHP 5.3 + /* + else if ( (isset($p_options[PCLZIP_OPT_BY_EREG])) + && ($p_options[PCLZIP_OPT_BY_EREG] != "")) { + + if (ereg($p_options[PCLZIP_OPT_BY_EREG], $v_header_list[$v_nb_extracted]['stored_filename'])) { + $v_found = true; + } + } + */ + + // ----- Look for extract by preg rule + else if ( (isset($p_options[PCLZIP_OPT_BY_PREG])) + && ($p_options[PCLZIP_OPT_BY_PREG] != "")) { + + if (preg_match($p_options[PCLZIP_OPT_BY_PREG], $v_header_list[$v_nb_extracted]['stored_filename'])) { + $v_found = true; + } + } + + // ----- Look for extract by index rule + else if ( (isset($p_options[PCLZIP_OPT_BY_INDEX])) + && ($p_options[PCLZIP_OPT_BY_INDEX] != 0)) { + + // ----- Look if the index is in the list + for ($j=$j_start; ($j=$p_options[PCLZIP_OPT_BY_INDEX][$j]['start']) && ($i<=$p_options[PCLZIP_OPT_BY_INDEX][$j]['end'])) { + $v_found = true; + } + if ($i>=$p_options[PCLZIP_OPT_BY_INDEX][$j]['end']) { + $j_start = $j+1; + } + + if ($p_options[PCLZIP_OPT_BY_INDEX][$j]['start']>$i) { + break; + } + } + } + else { + $v_found = true; + } + + // ----- Look for deletion + if ($v_found) + { + unset($v_header_list[$v_nb_extracted]); + } + else + { + $v_nb_extracted++; + } + } + + // ----- Look if something need to be deleted + if ($v_nb_extracted > 0) { + + // ----- Creates a temporay file + $v_zip_temp_name = PCLZIP_TEMPORARY_DIR.uniqid('pclzip-').'.tmp'; + + // ----- Creates a temporary zip archive + $v_temp_zip = new PclZip($v_zip_temp_name); + + // ----- Open the temporary zip file in write mode + if (($v_result = $v_temp_zip->privOpenFd('wb')) != 1) { + $this->privCloseFd(); + + // ----- Return + return $v_result; + } + + // ----- Look which file need to be kept + for ($i=0; $izip_fd); + if (@fseek($this->zip_fd, $v_header_list[$i]['offset'])) { + // ----- Close the zip file + $this->privCloseFd(); + $v_temp_zip->privCloseFd(); + @unlink($v_zip_temp_name); + + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size'); + + // ----- Return + return PclZip::errorCode(); + } + + // ----- Read the file header + $v_local_header = array(); + if (($v_result = $this->privReadFileHeader($v_local_header)) != 1) { + // ----- Close the zip file + $this->privCloseFd(); + $v_temp_zip->privCloseFd(); + @unlink($v_zip_temp_name); + + // ----- Return + return $v_result; + } + + // ----- Check that local file header is same as central file header + if ($this->privCheckFileHeaders($v_local_header, + $v_header_list[$i]) != 1) { + // TBC + } + unset($v_local_header); + + // ----- Write the file header + if (($v_result = $v_temp_zip->privWriteFileHeader($v_header_list[$i])) != 1) { + // ----- Close the zip file + $this->privCloseFd(); + $v_temp_zip->privCloseFd(); + @unlink($v_zip_temp_name); + + // ----- Return + return $v_result; + } + + // ----- Read/write the data block + if (($v_result = PclZipUtilCopyBlock($this->zip_fd, $v_temp_zip->zip_fd, $v_header_list[$i]['compressed_size'])) != 1) { + // ----- Close the zip file + $this->privCloseFd(); + $v_temp_zip->privCloseFd(); + @unlink($v_zip_temp_name); + + // ----- Return + return $v_result; + } + } + + // ----- Store the offset of the central dir + $v_offset = @ftell($v_temp_zip->zip_fd); + + // ----- Re-Create the Central Dir files header + for ($i=0; $iprivWriteCentralFileHeader($v_header_list[$i])) != 1) { + $v_temp_zip->privCloseFd(); + $this->privCloseFd(); + @unlink($v_zip_temp_name); + + // ----- Return + return $v_result; + } + + // ----- Transform the header to a 'usable' info + $v_temp_zip->privConvertHeader2FileInfo($v_header_list[$i], $p_result_list[$i]); + } + + + // ----- Zip file comment + $v_comment = ''; + if (isset($p_options[PCLZIP_OPT_COMMENT])) { + $v_comment = $p_options[PCLZIP_OPT_COMMENT]; + } + + // ----- Calculate the size of the central header + $v_size = @ftell($v_temp_zip->zip_fd)-$v_offset; + + // ----- Create the central dir footer + if (($v_result = $v_temp_zip->privWriteCentralHeader(sizeof($v_header_list), $v_size, $v_offset, $v_comment)) != 1) { + // ----- Reset the file list + unset($v_header_list); + $v_temp_zip->privCloseFd(); + $this->privCloseFd(); + @unlink($v_zip_temp_name); + + // ----- Return + return $v_result; + } + + // ----- Close + $v_temp_zip->privCloseFd(); + $this->privCloseFd(); + + // ----- Delete the zip file + // TBC : I should test the result ... + @unlink($this->zipname); + + // ----- Rename the temporary file + // TBC : I should test the result ... + //@rename($v_zip_temp_name, $this->zipname); + PclZipUtilRename($v_zip_temp_name, $this->zipname); + + // ----- Destroy the temporary archive + unset($v_temp_zip); + } + + // ----- Remove every files : reset the file + else if ($v_central_dir['entries'] != 0) { + $this->privCloseFd(); + + if (($v_result = $this->privOpenFd('wb')) != 1) { + return $v_result; + } + + if (($v_result = $this->privWriteCentralHeader(0, 0, 0, '')) != 1) { + return $v_result; + } + + $this->privCloseFd(); + } + + // ----- Return + return $v_result; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : privDirCheck() + // Description : + // Check if a directory exists, if not it creates it and all the parents directory + // which may be useful. + // Parameters : + // $p_dir : Directory path to check. + // Return Values : + // 1 : OK + // -1 : Unable to create directory + // -------------------------------------------------------------------------------- + function privDirCheck($p_dir, $p_is_dir=false) + { + $v_result = 1; + + + // ----- Remove the final '/' + if (($p_is_dir) && (substr($p_dir, -1)=='/')) + { + $p_dir = substr($p_dir, 0, strlen($p_dir)-1); + } + + // ----- Check the directory availability + if ((is_dir($p_dir)) || ($p_dir == "")) + { + return 1; + } + + // ----- Extract parent directory + $p_parent_dir = dirname($p_dir); + + // ----- Just a check + if ($p_parent_dir != $p_dir) + { + // ----- Look for parent directory + if ($p_parent_dir != "") + { + if (($v_result = $this->privDirCheck($p_parent_dir)) != 1) + { + return $v_result; + } + } + } + + // ----- Create the directory + if (!@mkdir($p_dir, 0777)) + { + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_DIR_CREATE_FAIL, "Unable to create directory '$p_dir'"); + + // ----- Return + return PclZip::errorCode(); + } + + // ----- Return + return $v_result; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : privMerge() + // Description : + // If $p_archive_to_add does not exist, the function exit with a success result. + // Parameters : + // Return Values : + // -------------------------------------------------------------------------------- + function privMerge(&$p_archive_to_add) + { + $v_result=1; + + // ----- Look if the archive_to_add exists + if (!is_file($p_archive_to_add->zipname)) + { + + // ----- Nothing to merge, so merge is a success + $v_result = 1; + + // ----- Return + return $v_result; + } + + // ----- Look if the archive exists + if (!is_file($this->zipname)) + { + + // ----- Do a duplicate + $v_result = $this->privDuplicate($p_archive_to_add->zipname); + + // ----- Return + return $v_result; + } + + // ----- Open the zip file + if (($v_result=$this->privOpenFd('rb')) != 1) + { + // ----- Return + return $v_result; + } + + // ----- Read the central directory informations + $v_central_dir = array(); + if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1) + { + $this->privCloseFd(); + return $v_result; + } + + // ----- Go to beginning of File + @rewind($this->zip_fd); + + // ----- Open the archive_to_add file + if (($v_result=$p_archive_to_add->privOpenFd('rb')) != 1) + { + $this->privCloseFd(); + + // ----- Return + return $v_result; + } + + // ----- Read the central directory informations + $v_central_dir_to_add = array(); + if (($v_result = $p_archive_to_add->privReadEndCentralDir($v_central_dir_to_add)) != 1) + { + $this->privCloseFd(); + $p_archive_to_add->privCloseFd(); + + return $v_result; + } + + // ----- Go to beginning of File + @rewind($p_archive_to_add->zip_fd); + + // ----- Creates a temporay file + $v_zip_temp_name = PCLZIP_TEMPORARY_DIR.uniqid('pclzip-').'.tmp'; + + // ----- Open the temporary file in write mode + if (($v_zip_temp_fd = @fopen($v_zip_temp_name, 'wb')) == 0) + { + $this->privCloseFd(); + $p_archive_to_add->privCloseFd(); + + PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open temporary file \''.$v_zip_temp_name.'\' in binary write mode'); + + // ----- Return + return PclZip::errorCode(); + } + + // ----- Copy the files from the archive to the temporary file + // TBC : Here I should better append the file and go back to erase the central dir + $v_size = $v_central_dir['offset']; + while ($v_size != 0) + { + $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE); + $v_buffer = fread($this->zip_fd, $v_read_size); + @fwrite($v_zip_temp_fd, $v_buffer, $v_read_size); + $v_size -= $v_read_size; + } + + // ----- Copy the files from the archive_to_add into the temporary file + $v_size = $v_central_dir_to_add['offset']; + while ($v_size != 0) + { + $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE); + $v_buffer = fread($p_archive_to_add->zip_fd, $v_read_size); + @fwrite($v_zip_temp_fd, $v_buffer, $v_read_size); + $v_size -= $v_read_size; + } + + // ----- Store the offset of the central dir + $v_offset = @ftell($v_zip_temp_fd); + + // ----- Copy the block of file headers from the old archive + $v_size = $v_central_dir['size']; + while ($v_size != 0) + { + $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE); + $v_buffer = @fread($this->zip_fd, $v_read_size); + @fwrite($v_zip_temp_fd, $v_buffer, $v_read_size); + $v_size -= $v_read_size; + } + + // ----- Copy the block of file headers from the archive_to_add + $v_size = $v_central_dir_to_add['size']; + while ($v_size != 0) + { + $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE); + $v_buffer = @fread($p_archive_to_add->zip_fd, $v_read_size); + @fwrite($v_zip_temp_fd, $v_buffer, $v_read_size); + $v_size -= $v_read_size; + } + + // ----- Merge the file comments + $v_comment = $v_central_dir['comment'].' '.$v_central_dir_to_add['comment']; + + // ----- Calculate the size of the (new) central header + $v_size = @ftell($v_zip_temp_fd)-$v_offset; + + // ----- Swap the file descriptor + // Here is a trick : I swap the temporary fd with the zip fd, in order to use + // the following methods on the temporary fil and not the real archive fd + $v_swap = $this->zip_fd; + $this->zip_fd = $v_zip_temp_fd; + $v_zip_temp_fd = $v_swap; + + // ----- Create the central dir footer + if (($v_result = $this->privWriteCentralHeader($v_central_dir['entries']+$v_central_dir_to_add['entries'], $v_size, $v_offset, $v_comment)) != 1) + { + $this->privCloseFd(); + $p_archive_to_add->privCloseFd(); + @fclose($v_zip_temp_fd); + $this->zip_fd = null; + + // ----- Reset the file list + unset($v_header_list); + + // ----- Return + return $v_result; + } + + // ----- Swap back the file descriptor + $v_swap = $this->zip_fd; + $this->zip_fd = $v_zip_temp_fd; + $v_zip_temp_fd = $v_swap; + + // ----- Close + $this->privCloseFd(); + $p_archive_to_add->privCloseFd(); + + // ----- Close the temporary file + @fclose($v_zip_temp_fd); + + // ----- Delete the zip file + // TBC : I should test the result ... + @unlink($this->zipname); + + // ----- Rename the temporary file + // TBC : I should test the result ... + //@rename($v_zip_temp_name, $this->zipname); + PclZipUtilRename($v_zip_temp_name, $this->zipname); + + // ----- Return + return $v_result; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : privDuplicate() + // Description : + // Parameters : + // Return Values : + // -------------------------------------------------------------------------------- + function privDuplicate($p_archive_filename) + { + $v_result=1; + + // ----- Look if the $p_archive_filename exists + if (!is_file($p_archive_filename)) + { + + // ----- Nothing to duplicate, so duplicate is a success. + $v_result = 1; + + // ----- Return + return $v_result; + } + + // ----- Open the zip file + if (($v_result=$this->privOpenFd('wb')) != 1) + { + // ----- Return + return $v_result; + } + + // ----- Open the temporary file in write mode + if (($v_zip_temp_fd = @fopen($p_archive_filename, 'rb')) == 0) + { + $this->privCloseFd(); + + PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive file \''.$p_archive_filename.'\' in binary write mode'); + + // ----- Return + return PclZip::errorCode(); + } + + // ----- Copy the files from the archive to the temporary file + // TBC : Here I should better append the file and go back to erase the central dir + $v_size = filesize($p_archive_filename); + while ($v_size != 0) + { + $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE); + $v_buffer = fread($v_zip_temp_fd, $v_read_size); + @fwrite($this->zip_fd, $v_buffer, $v_read_size); + $v_size -= $v_read_size; + } + + // ----- Close + $this->privCloseFd(); + + // ----- Close the temporary file + @fclose($v_zip_temp_fd); + + // ----- Return + return $v_result; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : privErrorLog() + // Description : + // Parameters : + // -------------------------------------------------------------------------------- + function privErrorLog($p_error_code=0, $p_error_string='') + { + if (PCLZIP_ERROR_EXTERNAL == 1) { + PclError($p_error_code, $p_error_string); + } + else { + $this->error_code = $p_error_code; + $this->error_string = $p_error_string; + } + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : privErrorReset() + // Description : + // Parameters : + // -------------------------------------------------------------------------------- + function privErrorReset() + { + if (PCLZIP_ERROR_EXTERNAL == 1) { + PclErrorReset(); + } + else { + $this->error_code = 0; + $this->error_string = ''; + } + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : privDisableMagicQuotes() + // Description : + // Parameters : + // Return Values : + // -------------------------------------------------------------------------------- + function privDisableMagicQuotes() + { + $v_result=1; + + // ----- Look if function exists + if ( (!function_exists("get_magic_quotes_runtime")) + || (!function_exists("set_magic_quotes_runtime"))) { + return $v_result; + } + + // ----- Look if already done + if ($this->magic_quotes_status != -1) { + return $v_result; + } + + // ----- Get and memorize the magic_quote value + $this->magic_quotes_status = @get_magic_quotes_runtime(); + + // ----- Disable magic_quotes + if ($this->magic_quotes_status == 1) { + @set_magic_quotes_runtime(0); + } + + // ----- Return + return $v_result; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : privSwapBackMagicQuotes() + // Description : + // Parameters : + // Return Values : + // -------------------------------------------------------------------------------- + function privSwapBackMagicQuotes() + { + $v_result=1; + + // ----- Look if function exists + if ( (!function_exists("get_magic_quotes_runtime")) + || (!function_exists("set_magic_quotes_runtime"))) { + return $v_result; + } + + // ----- Look if something to do + if ($this->magic_quotes_status != -1) { + return $v_result; + } + + // ----- Swap back magic_quotes + if ($this->magic_quotes_status == 1) { + @set_magic_quotes_runtime($this->magic_quotes_status); + } + + // ----- Return + return $v_result; + } + // -------------------------------------------------------------------------------- + + } + // End of class + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : PclZipUtilPathReduction() + // Description : + // Parameters : + // Return Values : + // -------------------------------------------------------------------------------- + function PclZipUtilPathReduction($p_dir) + { + $v_result = ""; + + // ----- Look for not empty path + if ($p_dir != "") { + // ----- Explode path by directory names + $v_list = explode("/", $p_dir); + + // ----- Study directories from last to first + $v_skip = 0; + for ($i=sizeof($v_list)-1; $i>=0; $i--) { + // ----- Look for current path + if ($v_list[$i] == ".") { + // ----- Ignore this directory + // Should be the first $i=0, but no check is done + } + else if ($v_list[$i] == "..") { + $v_skip++; + } + else if ($v_list[$i] == "") { + // ----- First '/' i.e. root slash + if ($i == 0) { + $v_result = "/".$v_result; + if ($v_skip > 0) { + // ----- It is an invalid path, so the path is not modified + // TBC + $v_result = $p_dir; + $v_skip = 0; + } + } + // ----- Last '/' i.e. indicates a directory + else if ($i == (sizeof($v_list)-1)) { + $v_result = $v_list[$i]; + } + // ----- Double '/' inside the path + else { + // ----- Ignore only the double '//' in path, + // but not the first and last '/' + } + } + else { + // ----- Look for item to skip + if ($v_skip > 0) { + $v_skip--; + } + else { + $v_result = $v_list[$i].($i!=(sizeof($v_list)-1)?"/".$v_result:""); + } + } + } + + // ----- Look for skip + if ($v_skip > 0) { + while ($v_skip > 0) { + $v_result = '../'.$v_result; + $v_skip--; + } + } + } + + // ----- Return + return $v_result; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : PclZipUtilPathInclusion() + // Description : + // This function indicates if the path $p_path is under the $p_dir tree. Or, + // said in an other way, if the file or sub-dir $p_path is inside the dir + // $p_dir. + // The function indicates also if the path is exactly the same as the dir. + // This function supports path with duplicated '/' like '//', but does not + // support '.' or '..' statements. + // Parameters : + // Return Values : + // 0 if $p_path is not inside directory $p_dir + // 1 if $p_path is inside directory $p_dir + // 2 if $p_path is exactly the same as $p_dir + // -------------------------------------------------------------------------------- + function PclZipUtilPathInclusion($p_dir, $p_path) + { + $v_result = 1; + + // ----- Look for path beginning by ./ + if ( ($p_dir == '.') + || ((strlen($p_dir) >=2) && (substr($p_dir, 0, 2) == './'))) { + $p_dir = PclZipUtilTranslateWinPath(getcwd(), FALSE).'/'.substr($p_dir, 1); + } + if ( ($p_path == '.') + || ((strlen($p_path) >=2) && (substr($p_path, 0, 2) == './'))) { + $p_path = PclZipUtilTranslateWinPath(getcwd(), FALSE).'/'.substr($p_path, 1); + } + + // ----- Explode dir and path by directory separator + $v_list_dir = explode("/", $p_dir); + $v_list_dir_size = sizeof($v_list_dir); + $v_list_path = explode("/", $p_path); + $v_list_path_size = sizeof($v_list_path); + + // ----- Study directories paths + $i = 0; + $j = 0; + while (($i < $v_list_dir_size) && ($j < $v_list_path_size) && ($v_result)) { + + // ----- Look for empty dir (path reduction) + if ($v_list_dir[$i] == '') { + $i++; + continue; + } + if ($v_list_path[$j] == '') { + $j++; + continue; + } + + // ----- Compare the items + if (($v_list_dir[$i] != $v_list_path[$j]) && ($v_list_dir[$i] != '') && ( $v_list_path[$j] != '')) { + $v_result = 0; + } + + // ----- Next items + $i++; + $j++; + } + + // ----- Look if everything seems to be the same + if ($v_result) { + // ----- Skip all the empty items + while (($j < $v_list_path_size) && ($v_list_path[$j] == '')) $j++; + while (($i < $v_list_dir_size) && ($v_list_dir[$i] == '')) $i++; + + if (($i >= $v_list_dir_size) && ($j >= $v_list_path_size)) { + // ----- There are exactly the same + $v_result = 2; + } + else if ($i < $v_list_dir_size) { + // ----- The path is shorter than the dir + $v_result = 0; + } + } + + // ----- Return + return $v_result; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : PclZipUtilCopyBlock() + // Description : + // Parameters : + // $p_mode : read/write compression mode + // 0 : src & dest normal + // 1 : src gzip, dest normal + // 2 : src normal, dest gzip + // 3 : src & dest gzip + // Return Values : + // -------------------------------------------------------------------------------- + function PclZipUtilCopyBlock($p_src, $p_dest, $p_size, $p_mode=0) + { + $v_result = 1; + + if ($p_mode==0) + { + while ($p_size != 0) + { + $v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE); + $v_buffer = @fread($p_src, $v_read_size); + @fwrite($p_dest, $v_buffer, $v_read_size); + $p_size -= $v_read_size; + } + } + else if ($p_mode==1) + { + while ($p_size != 0) + { + $v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE); + $v_buffer = @gzread($p_src, $v_read_size); + @fwrite($p_dest, $v_buffer, $v_read_size); + $p_size -= $v_read_size; + } + } + else if ($p_mode==2) + { + while ($p_size != 0) + { + $v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE); + $v_buffer = @fread($p_src, $v_read_size); + @gzwrite($p_dest, $v_buffer, $v_read_size); + $p_size -= $v_read_size; + } + } + else if ($p_mode==3) + { + while ($p_size != 0) + { + $v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE); + $v_buffer = @gzread($p_src, $v_read_size); + @gzwrite($p_dest, $v_buffer, $v_read_size); + $p_size -= $v_read_size; + } + } + + // ----- Return + return $v_result; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : PclZipUtilRename() + // Description : + // This function tries to do a simple rename() function. If it fails, it + // tries to copy the $p_src file in a new $p_dest file and then unlink the + // first one. + // Parameters : + // $p_src : Old filename + // $p_dest : New filename + // Return Values : + // 1 on success, 0 on failure. + // -------------------------------------------------------------------------------- + function PclZipUtilRename($p_src, $p_dest) + { + $v_result = 1; + + // ----- Try to rename the files + if (!@rename($p_src, $p_dest)) { + + // ----- Try to copy & unlink the src + if (!@copy($p_src, $p_dest)) { + $v_result = 0; + } + else if (!@unlink($p_src)) { + $v_result = 0; + } + } + + // ----- Return + return $v_result; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : PclZipUtilOptionText() + // Description : + // Translate option value in text. Mainly for debug purpose. + // Parameters : + // $p_option : the option value. + // Return Values : + // The option text value. + // -------------------------------------------------------------------------------- + function PclZipUtilOptionText($p_option) + { + + $v_list = get_defined_constants(); + for (reset($v_list); $v_key = key($v_list); next($v_list)) { + $v_prefix = substr($v_key, 0, 10); + if (( ($v_prefix == 'PCLZIP_OPT') + || ($v_prefix == 'PCLZIP_CB_') + || ($v_prefix == 'PCLZIP_ATT')) + && ($v_list[$v_key] == $p_option)) { + return $v_key; + } + } + + $v_result = 'Unknown'; + + return $v_result; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : PclZipUtilTranslateWinPath() + // Description : + // Translate windows path by replacing '\' by '/' and optionally removing + // drive letter. + // Parameters : + // $p_path : path to translate. + // $p_remove_disk_letter : true | false + // Return Values : + // The path translated. + // -------------------------------------------------------------------------------- + function PclZipUtilTranslateWinPath($p_path, $p_remove_disk_letter=true) + { + if (stristr(php_uname(), 'windows')) { + // ----- Look for potential disk letter + if (($p_remove_disk_letter) && (($v_position = strpos($p_path, ':')) != false)) { + $p_path = substr($p_path, $v_position+1); + } + // ----- Change potential windows directory separator + if ((strpos($p_path, '\\') > 0) || (substr($p_path, 0,1) == '\\')) { + $p_path = strtr($p_path, '\\', '/'); + } + } + return $p_path; + } + // -------------------------------------------------------------------------------- + + +?> diff --git a/src/wp-admin/includes/class-wp-comments-list-table.php b/src/wp-admin/includes/class-wp-comments-list-table.php new file mode 100644 index 0000000..fd25129 --- /dev/null +++ b/src/wp-admin/includes/class-wp-comments-list-table.php @@ -0,0 +1,559 @@ + 'comments', + 'singular' => 'comment', + 'ajax' => true, + ) ); + } + + function ajax_user_can() { + return current_user_can('edit_posts'); + } + + function prepare_items() { + global $post_id, $comment_status, $search, $comment_type; + + $comment_status = isset( $_REQUEST['comment_status'] ) ? $_REQUEST['comment_status'] : 'all'; + if ( !in_array( $comment_status, array( 'all', 'moderated', 'approved', 'spam', 'trash' ) ) ) + $comment_status = 'all'; + + $comment_type = !empty( $_REQUEST['comment_type'] ) ? $_REQUEST['comment_type'] : ''; + + $search = ( isset( $_REQUEST['s'] ) ) ? $_REQUEST['s'] : ''; + + $user_id = ( isset( $_REQUEST['user_id'] ) ) ? $_REQUEST['user_id'] : ''; + + $orderby = ( isset( $_REQUEST['orderby'] ) ) ? $_REQUEST['orderby'] : ''; + $order = ( isset( $_REQUEST['order'] ) ) ? $_REQUEST['order'] : ''; + + $comments_per_page = $this->get_per_page( $comment_status ); + + $doing_ajax = defined( 'DOING_AJAX' ) && DOING_AJAX; + + if ( isset( $_REQUEST['number'] ) ) { + $number = (int) $_REQUEST['number']; + } + else { + $number = $comments_per_page + min( 8, $comments_per_page ); // Grab a few extra + } + + $page = $this->get_pagenum(); + + if ( isset( $_REQUEST['start'] ) ) { + $start = $_REQUEST['start']; + } else { + $start = ( $page - 1 ) * $comments_per_page; + } + + if ( $doing_ajax && isset( $_REQUEST['offset'] ) ) { + $start += $_REQUEST['offset']; + } + + $status_map = array( + 'moderated' => 'hold', + 'approved' => 'approve' + ); + + $args = array( + 'status' => isset( $status_map[$comment_status] ) ? $status_map[$comment_status] : $comment_status, + 'search' => $search, + 'user_id' => $user_id, + 'offset' => $start, + 'number' => $number, + 'post_id' => $post_id, + 'type' => $comment_type, + 'orderby' => $orderby, + 'order' => $order, + ); + + $_comments = get_comments( $args ); + + update_comment_cache( $_comments ); + + $this->items = array_slice( $_comments, 0, $comments_per_page ); + $this->extra_items = array_slice( $_comments, $comments_per_page ); + + $total_comments = get_comments( array_merge( $args, array('count' => true, 'offset' => 0, 'number' => 0) ) ); + + $_comment_post_ids = array(); + foreach ( $_comments as $_c ) { + $_comment_post_ids[] = $_c->comment_post_ID; + } + + $_comment_post_ids = array_unique( $_comment_post_ids ); + + $this->pending_count = get_pending_comments_num( $_comment_post_ids ); + + $this->set_pagination_args( array( + 'total_items' => $total_comments, + 'per_page' => $comments_per_page, + ) ); + } + + function get_per_page( $comment_status = 'all' ) { + $comments_per_page = $this->get_items_per_page( 'edit_comments_per_page' ); + $comments_per_page = apply_filters( 'comments_per_page', $comments_per_page, $comment_status ); + return $comments_per_page; + } + + function no_items() { + global $comment_status; + + if ( 'moderated' == $comment_status ) + _e( 'No comments awaiting moderation… yet.' ); + else + _e( 'No comments found.' ); + } + + function get_views() { + global $post_id, $comment_status; + + $status_links = array(); + $num_comments = ( $post_id ) ? wp_count_comments( $post_id ) : wp_count_comments(); + //, number_format_i18n($num_comments->moderated) ), "" . number_format_i18n($num_comments->moderated) . ""), + //, number_format_i18n($num_comments->spam) ), "" . number_format_i18n($num_comments->spam) . "") + $stati = array( + 'all' => _nx_noop('All', 'All', 'comments'), // singular not used + 'moderated' => _n_noop('Pending (%s)', 'Pending (%s)'), + 'approved' => _n_noop('Approved', 'Approved'), // singular not used + 'spam' => _n_noop('Spam (%s)', 'Spam (%s)'), + 'trash' => _n_noop('Trash (%s)', 'Trash (%s)') + ); + + if ( !EMPTY_TRASH_DAYS ) + unset($stati['trash']); + + $link = 'edit-comments.php'; + if ( !empty($comment_type) && 'all' != $comment_type ) + $link = add_query_arg( 'comment_type', $comment_type, $link ); + + foreach ( $stati as $status => $label ) { + $class = ( $status == $comment_status ) ? ' class="current"' : ''; + + if ( !isset( $num_comments->$status ) ) + $num_comments->$status = 10; + $link = add_query_arg( 'comment_status', $status, $link ); + if ( $post_id ) + $link = add_query_arg( 'p', absint( $post_id ), $link ); + /* + // I toyed with this, but decided against it. Leaving it in here in case anyone thinks it is a good idea. ~ Mark + if ( !empty( $_REQUEST['s'] ) ) + $link = add_query_arg( 's', esc_attr( stripslashes( $_REQUEST['s'] ) ), $link ); + */ + $status_links[$status] = "" . sprintf( + translate_nooped_plural( $label, $num_comments->$status ), + number_format_i18n( $num_comments->$status ) + ) . ''; + } + + $status_links = apply_filters( 'comment_status_links', $status_links ); + return $status_links; + } + + function get_bulk_actions() { + global $comment_status; + + $actions = array(); + if ( in_array( $comment_status, array( 'all', 'approved' ) ) ) + $actions['unapprove'] = __( 'Unapprove' ); + if ( in_array( $comment_status, array( 'all', 'moderated', 'spam' ) ) ) + $actions['approve'] = __( 'Approve' ); + if ( in_array( $comment_status, array( 'all', 'moderated', 'approved' ) ) ) + $actions['spam'] = _x( 'Mark as Spam', 'comment' ); + + if ( 'trash' == $comment_status ) + $actions['untrash'] = __( 'Restore' ); + elseif ( 'spam' == $comment_status ) + $actions['unspam'] = _x( 'Not Spam', 'comment' ); + + if ( in_array( $comment_status, array( 'trash', 'spam' ) ) || !EMPTY_TRASH_DAYS ) + $actions['delete'] = __( 'Delete Permanently' ); + else + $actions['trash'] = __( 'Move to Trash' ); + + return $actions; + } + + function extra_tablenav( $which ) { + global $comment_status, $comment_type; +?> +
+ + + 'post-query-submit' ) ); + } + + if ( ( 'spam' == $comment_status || 'trash' == $comment_status ) && current_user_can( 'moderate_comments' ) ) { + wp_nonce_field( 'bulk-destroy', '_destroy_nonce' ); + $title = ( 'spam' == $comment_status ) ? esc_attr__( 'Empty Spam' ) : esc_attr__( 'Empty Trash' ); + submit_button( $title, 'button-secondary apply', 'delete_all', false ); + } + do_action( 'manage_comments_nav', $comment_status ); + echo '
'; + } + + function current_action() { + if ( isset( $_REQUEST['delete_all'] ) || isset( $_REQUEST['delete_all2'] ) ) + return 'delete_all'; + + return parent::current_action(); + } + + function get_columns() { + global $post_id; + + $columns = array(); + + if ( $this->checkbox ) + $columns['cb'] = ''; + + $columns['author'] = __( 'Author' ); + $columns['comment'] = _x( 'Comment', 'column name' ); + + if ( !$post_id ) + $columns['response'] = _x( 'In Response To', 'column name' ); + + return $columns; + } + + function get_sortable_columns() { + return array( + 'author' => 'comment_author', + 'response' => 'comment_post_ID' + ); + } + + function display() { + extract( $this->_args ); + + wp_nonce_field( "fetch-list-" . get_class( $this ), '_ajax_fetch_list_nonce' ); + + $this->display_tablenav( 'top' ); + +?> + + + + print_column_headers(); ?> + + + + + + print_column_headers( false ); ?> + + + + + display_rows_or_placeholder(); ?> + + + + items = $this->extra_items; $this->display_rows(); ?> + +
+display_tablenav( 'bottom' ); + } + + function single_row( $a_comment ) { + global $post, $comment, $the_comment_status; + + $comment = $a_comment; + $the_comment_status = wp_get_comment_status( $comment->comment_ID ); + + $post = get_post( $comment->comment_post_ID ); + + $this->user_can = current_user_can( 'edit_comment', $comment->comment_ID ); + + echo ""; + echo $this->single_row_columns( $comment ); + echo ""; + } + + function column_cb( $comment ) { + if ( $this->user_can ) + echo ""; + } + + function column_comment( $comment ) { + global $post, $comment_status, $the_comment_status; + + $user_can = $this->user_can; + + $comment_url = esc_url( get_comment_link( $comment->comment_ID ) ); + + $ptime = date( 'G', strtotime( $comment->comment_date ) ); + if ( ( abs( time() - $ptime ) ) < 86400 ) + $ptime = sprintf( __( '%s ago' ), human_time_diff( $ptime ) ); + else + $ptime = mysql2date( __( 'Y/m/d \a\t g:i A' ), $comment->comment_date ); + + if ( $user_can ) { + $del_nonce = esc_html( '_wpnonce=' . wp_create_nonce( "delete-comment_$comment->comment_ID" ) ); + $approve_nonce = esc_html( '_wpnonce=' . wp_create_nonce( "approve-comment_$comment->comment_ID" ) ); + + $url = "comment.php?c=$comment->comment_ID"; + + $approve_url = esc_url( $url . "&action=approvecomment&$approve_nonce" ); + $unapprove_url = esc_url( $url . "&action=unapprovecomment&$approve_nonce" ); + $spam_url = esc_url( $url . "&action=spamcomment&$del_nonce" ); + $unspam_url = esc_url( $url . "&action=unspamcomment&$del_nonce" ); + $trash_url = esc_url( $url . "&action=trashcomment&$del_nonce" ); + $untrash_url = esc_url( $url . "&action=untrashcomment&$del_nonce" ); + $delete_url = esc_url( $url . "&action=deletecomment&$del_nonce" ); + } + + echo ''; + comment_text(); + if ( $user_can ) { ?> + + '', 'unapprove' => '', + 'reply' => '', + 'quickedit' => '', + 'edit' => '', + 'spam' => '', 'unspam' => '', + 'trash' => '', 'untrash' => '', 'delete' => '' + ); + + if ( $comment_status && 'all' != $comment_status ) { // not looking at all comments + if ( 'approved' == $the_comment_status ) + $actions['unapprove'] = "" . __( 'Unapprove' ) . ''; + else if ( 'unapproved' == $the_comment_status ) + $actions['approve'] = "" . __( 'Approve' ) . ''; + } else { + $actions['approve'] = "" . __( 'Approve' ) . ''; + $actions['unapprove'] = "" . __( 'Unapprove' ) . ''; + } + + if ( 'spam' != $the_comment_status && 'trash' != $the_comment_status ) { + $actions['spam'] = "" . /* translators: mark as spam link */ _x( 'Spam', 'verb' ) . ''; + } elseif ( 'spam' == $the_comment_status ) { + $actions['unspam'] = "" . _x( 'Not Spam', 'comment' ) . ''; + } elseif ( 'trash' == $the_comment_status ) { + $actions['untrash'] = "" . __( 'Restore' ) . ''; + } + + if ( 'spam' == $the_comment_status || 'trash' == $the_comment_status || !EMPTY_TRASH_DAYS ) { + $actions['delete'] = "" . __( 'Delete Permanently' ) . ''; + } else { + $actions['trash'] = "" . _x( 'Trash', 'verb' ) . ''; + } + + if ( 'trash' != $the_comment_status ) { + $actions['edit'] = "". __( 'Edit' ) . ''; + $actions['quickedit'] = '' . __( 'Quick Edit' ) . ''; + if ( 'spam' != $the_comment_status ) + $actions['reply'] = '' . __( 'Reply' ) . ''; + } + + $actions = apply_filters( 'comment_row_actions', array_filter( $actions ), $comment ); + + $i = 0; + echo '
'; + foreach ( $actions as $action => $link ) { + ++$i; + ( ( ( 'approve' == $action || 'unapprove' == $action ) && 2 === $i ) || 1 === $i ) ? $sep = '' : $sep = ' | '; + + // Reply and quickedit need a hide-if-no-js span when not added with ajax + if ( ( 'reply' == $action || 'quickedit' == $action ) && ! defined('DOING_AJAX') ) + $action .= ' hide-if-no-js'; + elseif ( ( $action == 'untrash' && $the_comment_status == 'trash' ) || ( $action == 'unspam' && $the_comment_status == 'spam' ) ) { + if ( '1' == get_comment_meta( $comment->comment_ID, '_wp_trash_meta_status', true ) ) + $action .= ' approve'; + else + $action .= ' unapprove'; + } + + echo "$sep$link"; + } + echo '
'; + } + } + + function column_author( $comment ) { + global $comment_status; + + $author_url = get_comment_author_url(); + if ( 'http://' == $author_url ) + $author_url = ''; + $author_url_display = preg_replace( '|http://(www\.)?|i', '', $author_url ); + if ( strlen( $author_url_display ) > 50 ) + $author_url_display = substr( $author_url_display, 0, 49 ) . '...'; + + echo ""; comment_author(); echo '
'; + if ( !empty( $author_url ) ) + echo "$author_url_display
"; + + if ( $this->user_can ) { + if ( !empty( $comment->comment_author_email ) ) { + comment_author_email_link(); + echo '
'; + } + echo ''; + comment_author_IP(); + echo ''; + } + } + + function column_date( $comment ) { + return get_comment_date( __( 'Y/m/d \a\t g:ia' ) ); + } + + function column_response( $comment ) { + global $post; + + if ( isset( $this->pending_count[$post->ID] ) ) { + $pending_comments = $this->pending_count[$post->ID]; + } else { + $_pending_count_temp = get_pending_comments_num( array( $post->ID ) ); + $pending_comments = $this->pending_count[$post->ID] = $_pending_count_temp[$post->ID]; + } + + if ( current_user_can( 'edit_post', $post->ID ) ) { + $post_link = ""; + $post_link .= get_the_title( $post->ID ) . ''; + } else { + $post_link = get_the_title( $post->ID ); + } + + echo ''; + if ( 'attachment' == $post->post_type && ( $thumb = wp_get_attachment_image( $post->ID, array( 80, 60 ), true ) ) ) + echo $thumb; + } + + function column_default( $comment, $column_name ) { + do_action( 'manage_comments_custom_column', $column_name, $comment->comment_ID ); + } +} + +/** + * Post Comments List Table class. + * + * @package WordPress + * @subpackage List_Table + * @since 3.1.0 + * @access private + * + * @see WP_Comments_Table + */ +class WP_Post_Comments_List_Table extends WP_Comments_List_Table { + + function get_column_info() { + $this->_column_headers = array( + array( + 'author' => __( 'Author' ), + 'comment' => _x( 'Comment', 'column name' ), + ), + array(), + array(), + ); + + return $this->_column_headers; + } + + function get_table_classes() { + $classes = parent::get_table_classes(); + $classes[] = 'comments-box'; + return $classes; + } + + function display( $output_empty = false ) { + extract( $this->_args ); + + wp_nonce_field( "fetch-list-" . get_class( $this ), '_ajax_fetch_list_nonce' ); +?> + + > + display_rows_or_placeholder(); ?> + + + diff --git a/src/wp-admin/includes/class-wp-filesystem-base.php b/src/wp-admin/includes/class-wp-filesystem-base.php new file mode 100644 index 0000000..fd3fdc3 --- /dev/null +++ b/src/wp-admin/includes/class-wp-filesystem-base.php @@ -0,0 +1,332 @@ +find_folder(ABSPATH); + //Perhaps the FTP folder is rooted at the WordPress install, Check for wp-includes folder in root, Could have some false positives, but rare. + if ( ! $folder && $this->is_dir('/wp-includes') ) + $folder = '/'; + return $folder; + } + /** + * Returns the path on the remote filesystem of WP_CONTENT_DIR + * + * @since 2.7 + * @access public + * @return string The location of the remote path. + */ + function wp_content_dir() { + return $this->find_folder(WP_CONTENT_DIR); + } + /** + * Returns the path on the remote filesystem of WP_PLUGIN_DIR + * + * @since 2.7 + * @access public + * + * @return string The location of the remote path. + */ + function wp_plugins_dir() { + return $this->find_folder(WP_PLUGIN_DIR); + } + /** + * Returns the path on the remote filesystem of the Themes Directory + * + * @since 2.7 + * @access public + * + * @return string The location of the remote path. + */ + function wp_themes_dir() { + return $this->wp_content_dir() . 'themes/'; + } + /** + * Returns the path on the remote filesystem of WP_LANG_DIR + * + * @since 3.2.0 + * @access public + * + * @return string The location of the remote path. + */ + function wp_lang_dir() { + return $this->find_folder(WP_LANG_DIR); + } + + /** + * Locates a folder on the remote filesystem. + * + * Deprecated; use WP_Filesystem::abspath() or WP_Filesystem::wp_*_dir() methods instead. + * + * @since 2.5 + * @deprecated 2.7 + * @access public + * + * @param string $base The folder to start searching from + * @param bool $echo True to display debug information + * @return string The location of the remote path. + */ + function find_base_dir($base = '.', $echo = false) { + _deprecated_function(__FUNCTION__, '2.7', 'WP_Filesystem::abspath() or WP_Filesystem::wp_*_dir()' ); + $this->verbose = $echo; + return $this->abspath(); + } + /** + * Locates a folder on the remote filesystem. + * + * Deprecated; use WP_Filesystem::abspath() or WP_Filesystem::wp_*_dir() methods instead. + * + * @since 2.5 + * @deprecated 2.7 + * @access public + * + * @param string $base The folder to start searching from + * @param bool $echo True to display debug information + * @return string The location of the remote path. + */ + function get_base_dir($base = '.', $echo = false) { + _deprecated_function(__FUNCTION__, '2.7', 'WP_Filesystem::abspath() or WP_Filesystem::wp_*_dir()' ); + $this->verbose = $echo; + return $this->abspath(); + } + + /** + * Locates a folder on the remote filesystem. + * + * Assumes that on Windows systems, Stripping off the Drive letter is OK + * Sanitizes \\ to / in windows filepaths. + * + * @since 2.7 + * @access public + * + * @param string $folder the folder to locate + * @return string The location of the remote path. + */ + function find_folder($folder) { + + if ( strpos($this->method, 'ftp') !== false ) { + $constant_overrides = array( 'FTP_BASE' => ABSPATH, 'FTP_CONTENT_DIR' => WP_CONTENT_DIR, 'FTP_PLUGIN_DIR' => WP_PLUGIN_DIR, 'FTP_LANG_DIR' => WP_LANG_DIR ); + foreach ( $constant_overrides as $constant => $dir ) + if ( defined($constant) && $folder === $dir ) + return trailingslashit(constant($constant)); + } elseif ( 'direct' == $this->method ) { + $folder = str_replace('\\', '/', $folder); //Windows path sanitiation + return trailingslashit($folder); + } + + $folder = preg_replace('|^([a-z]{1}):|i', '', $folder); //Strip out windows driveletter if its there. + $folder = str_replace('\\', '/', $folder); //Windows path sanitiation + + if ( isset($this->cache[ $folder ] ) ) + return $this->cache[ $folder ]; + + if ( $this->exists($folder) ) { //Folder exists at that absolute path. + $folder = trailingslashit($folder); + $this->cache[ $folder ] = $folder; + return $folder; + } + if ( $return = $this->search_for_folder($folder) ) + $this->cache[ $folder ] = $return; + return $return; + } + + /** + * Locates a folder on the remote filesystem. + * + * Expects Windows sanitized path + * + * @since 2.7 + * @access private + * + * @param string $folder the folder to locate + * @param string $base the folder to start searching from + * @param bool $loop if the function has recursed, Internal use only + * @return string The location of the remote path. + */ + function search_for_folder($folder, $base = '.', $loop = false ) { + if ( empty( $base ) || '.' == $base ) + $base = trailingslashit($this->cwd()); + + $folder = untrailingslashit($folder); + + $folder_parts = explode('/', $folder); + $last_path = $folder_parts[ count($folder_parts) - 1 ]; + + $files = $this->dirlist( $base ); + + foreach ( $folder_parts as $key ) { + if ( $key == $last_path ) + continue; //We want this to be caught by the next code block. + + //Working from /home/ to /user/ to /wordpress/ see if that file exists within the current folder, + // If its found, change into it and follow through looking for it. + // If it cant find WordPress down that route, it'll continue onto the next folder level, and see if that matches, and so on. + // If it reaches the end, and still cant find it, it'll return false for the entire function. + if ( isset($files[ $key ]) ){ + //Lets try that folder: + $newdir = trailingslashit(path_join($base, $key)); + if ( $this->verbose ) + printf( __('Changing to %s') . '
', $newdir ); + if ( $ret = $this->search_for_folder( $folder, $newdir, $loop) ) + return $ret; + } + } + + //Only check this as a last resort, to prevent locating the incorrect install. All above procedures will fail quickly if this is the right branch to take. + if (isset( $files[ $last_path ] ) ) { + if ( $this->verbose ) + printf( __('Found %s') . '
', $base . $last_path ); + return trailingslashit($base . $last_path); + } + if ( $loop ) + return false; //Prevent this function from looping again. + //As an extra last resort, Change back to / if the folder wasnt found. This comes into effect when the CWD is /home/user/ but WP is at /var/www/.... mainly dedicated setups. + return $this->search_for_folder($folder, '/', true); + + } + + /** + * Returns the *nix style file permissions for a file + * + * From the PHP documentation page for fileperms() + * + * @link http://docs.php.net/fileperms + * @since 2.5 + * @access public + * + * @param string $file string filename + * @return int octal representation of permissions + */ + function gethchmod($file){ + $perms = $this->getchmod($file); + if (($perms & 0xC000) == 0xC000) // Socket + $info = 's'; + elseif (($perms & 0xA000) == 0xA000) // Symbolic Link + $info = 'l'; + elseif (($perms & 0x8000) == 0x8000) // Regular + $info = '-'; + elseif (($perms & 0x6000) == 0x6000) // Block special + $info = 'b'; + elseif (($perms & 0x4000) == 0x4000) // Directory + $info = 'd'; + elseif (($perms & 0x2000) == 0x2000) // Character special + $info = 'c'; + elseif (($perms & 0x1000) == 0x1000) // FIFO pipe + $info = 'p'; + else // Unknown + $info = 'u'; + + // Owner + $info .= (($perms & 0x0100) ? 'r' : '-'); + $info .= (($perms & 0x0080) ? 'w' : '-'); + $info .= (($perms & 0x0040) ? + (($perms & 0x0800) ? 's' : 'x' ) : + (($perms & 0x0800) ? 'S' : '-')); + + // Group + $info .= (($perms & 0x0020) ? 'r' : '-'); + $info .= (($perms & 0x0010) ? 'w' : '-'); + $info .= (($perms & 0x0008) ? + (($perms & 0x0400) ? 's' : 'x' ) : + (($perms & 0x0400) ? 'S' : '-')); + + // World + $info .= (($perms & 0x0004) ? 'r' : '-'); + $info .= (($perms & 0x0002) ? 'w' : '-'); + $info .= (($perms & 0x0001) ? + (($perms & 0x0200) ? 't' : 'x' ) : + (($perms & 0x0200) ? 'T' : '-')); + return $info; + } + + /** + * Converts *nix style file permissions to a octal number. + * + * Converts '-rw-r--r--' to 0644 + * From "info at rvgate dot nl"'s comment on the PHP documentation for chmod() + * + * @link http://docs.php.net/manual/en/function.chmod.php#49614 + * @since 2.5 + * @access public + * + * @param string $mode string *nix style file permission + * @return int octal representation + */ + function getnumchmodfromh($mode) { + $realmode = ''; + $legal = array('', 'w', 'r', 'x', '-'); + $attarray = preg_split('//', $mode); + + for ($i=0; $i < count($attarray); $i++) + if ($key = array_search($attarray[$i], $legal)) + $realmode .= $legal[$key]; + + $mode = str_pad($realmode, 9, '-'); + $trans = array('-'=>'0', 'r'=>'4', 'w'=>'2', 'x'=>'1'); + $mode = strtr($mode,$trans); + + $newmode = ''; + $newmode .= $mode[0] + $mode[1] + $mode[2]; + $newmode .= $mode[3] + $mode[4] + $mode[5]; + $newmode .= $mode[6] + $mode[7] + $mode[8]; + return $newmode; + } + + /** + * Determines if the string provided contains binary characters. + * + * @since 2.7 + * @access private + * + * @param string $text String to test against + * @return bool true if string is binary, false otherwise + */ + function is_binary( $text ) { + return (bool) preg_match('|[^\x20-\x7E]|', $text); //chr(32)..chr(127) + } +} + +?> diff --git a/src/wp-admin/includes/class-wp-filesystem-direct.php b/src/wp-admin/includes/class-wp-filesystem-direct.php new file mode 100644 index 0000000..9703d73 --- /dev/null +++ b/src/wp-admin/includes/class-wp-filesystem-direct.php @@ -0,0 +1,364 @@ +method = 'direct'; + $this->errors = new WP_Error(); + } + /** + * connect filesystem. + * + * @return bool Returns true on success or false on failure (always true for WP_Filesystem_Direct). + */ + function connect() { + return true; + } + /** + * Reads entire file into a string + * + * @param string $file Name of the file to read. + * @return string|bool The function returns the read data or false on failure. + */ + function get_contents($file) { + return @file_get_contents($file); + } + /** + * Reads entire file into an array + * + * @param string $file Path to the file. + * @return array|bool the file contents in an array or false on failure. + */ + function get_contents_array($file) { + return @file($file); + } + /** + * Write a string to a file + * + * @param string $file Remote path to the file where to write the data. + * @param string $contents The data to write. + * @param int $mode (optional) The file permissions as octal number, usually 0644. + * @return bool False upon failure. + */ + function put_contents($file, $contents, $mode = false ) { + if ( ! ($fp = @fopen($file, 'w')) ) + return false; + @fwrite($fp, $contents); + @fclose($fp); + $this->chmod($file, $mode); + return true; + } + /** + * Gets the current working directory + * + * @return string|bool the current working directory on success, or false on failure. + */ + function cwd() { + return @getcwd(); + } + /** + * Change directory + * + * @param string $dir The new current directory. + * @return bool Returns true on success or false on failure. + */ + function chdir($dir) { + return @chdir($dir); + } + /** + * Changes file group + * + * @param string $file Path to the file. + * @param mixed $group A group name or number. + * @param bool $recursive (optional) If set True changes file group recursivly. Defaults to False. + * @return bool Returns true on success or false on failure. + */ + function chgrp($file, $group, $recursive = false) { + if ( ! $this->exists($file) ) + return false; + if ( ! $recursive ) + return @chgrp($file, $group); + if ( ! $this->is_dir($file) ) + return @chgrp($file, $group); + //Is a directory, and we want recursive + $file = trailingslashit($file); + $filelist = $this->dirlist($file); + foreach ($filelist as $filename) + $this->chgrp($file . $filename, $group, $recursive); + + return true; + } + /** + * Changes filesystem permissions + * + * @param string $file Path to the file. + * @param int $mode (optional) The permissions as octal number, usually 0644 for files, 0755 for dirs. + * @param bool $recursive (optional) If set True changes file group recursivly. Defaults to False. + * @return bool Returns true on success or false on failure. + */ + function chmod($file, $mode = false, $recursive = false) { + if ( ! $mode ) { + if ( $this->is_file($file) ) + $mode = FS_CHMOD_FILE; + elseif ( $this->is_dir($file) ) + $mode = FS_CHMOD_DIR; + else + return false; + } + + if ( ! $recursive || ! $this->is_dir($file) ) + return @chmod($file, $mode); + //Is a directory, and we want recursive + $file = trailingslashit($file); + $filelist = $this->dirlist($file); + foreach ( (array)$filelist as $filename => $filemeta) + $this->chmod($file . $filename, $mode, $recursive); + + return true; + } + /** + * Changes file owner + * + * @param string $file Path to the file. + * @param mixed $owner A user name or number. + * @param bool $recursive (optional) If set True changes file owner recursivly. Defaults to False. + * @return bool Returns true on success or false on failure. + */ + function chown($file, $owner, $recursive = false) { + if ( ! $this->exists($file) ) + return false; + if ( ! $recursive ) + return @chown($file, $owner); + if ( ! $this->is_dir($file) ) + return @chown($file, $owner); + //Is a directory, and we want recursive + $filelist = $this->dirlist($file); + foreach ($filelist as $filename) { + $this->chown($file . '/' . $filename, $owner, $recursive); + } + return true; + } + /** + * Gets file owner + * + * @param string $file Path to the file. + * @return string Username of the user. + */ + function owner($file) { + $owneruid = @fileowner($file); + if ( ! $owneruid ) + return false; + if ( ! function_exists('posix_getpwuid') ) + return $owneruid; + $ownerarray = posix_getpwuid($owneruid); + return $ownerarray['name']; + } + /** + * Gets file permissions + * + * FIXME does not handle errors in fileperms() + * + * @param string $file Path to the file. + * @return string Mode of the file (last 4 digits). + */ + function getchmod($file) { + return substr(decoct(@fileperms($file)),3); + } + function group($file) { + $gid = @filegroup($file); + if ( ! $gid ) + return false; + if ( ! function_exists('posix_getgrgid') ) + return $gid; + $grouparray = posix_getgrgid($gid); + return $grouparray['name']; + } + + function copy($source, $destination, $overwrite = false, $mode = false) { + if ( ! $overwrite && $this->exists($destination) ) + return false; + + $rtval = copy($source, $destination); + if ( $mode ) + $this->chmod($destination, $mode); + return $rtval; + } + + function move($source, $destination, $overwrite = false) { + if ( ! $overwrite && $this->exists($destination) ) + return false; + + // try using rename first. if that fails (for example, source is read only) try copy + if ( @rename($source, $destination) ) + return true; + + if ( $this->copy($source, $destination, $overwrite) && $this->exists($destination) ) { + $this->delete($source); + return true; + } else { + return false; + } + } + + function delete($file, $recursive = false, $type = false) { + if ( empty($file) ) //Some filesystems report this as /, which can cause non-expected recursive deletion of all files in the filesystem. + return false; + $file = str_replace('\\', '/', $file); //for win32, occasional problems deleting files otherwise + + if ( 'f' == $type || $this->is_file($file) ) + return @unlink($file); + if ( ! $recursive && $this->is_dir($file) ) + return @rmdir($file); + + //At this point its a folder, and we're in recursive mode + $file = trailingslashit($file); + $filelist = $this->dirlist($file, true); + + $retval = true; + if ( is_array($filelist) ) //false if no files, So check first. + foreach ($filelist as $filename => $fileinfo) + if ( ! $this->delete($file . $filename, $recursive, $fileinfo['type']) ) + $retval = false; + + if ( file_exists($file) && ! @rmdir($file) ) + $retval = false; + return $retval; + } + + function exists($file) { + return @file_exists($file); + } + + function is_file($file) { + return @is_file($file); + } + + function is_dir($path) { + return @is_dir($path); + } + + function is_readable($file) { + return @is_readable($file); + } + + function is_writable($file) { + return @is_writable($file); + } + + function atime($file) { + return @fileatime($file); + } + + function mtime($file) { + return @filemtime($file); + } + function size($file) { + return @filesize($file); + } + + function touch($file, $time = 0, $atime = 0) { + if ($time == 0) + $time = time(); + if ($atime == 0) + $atime = time(); + return @touch($file, $time, $atime); + } + + function mkdir($path, $chmod = false, $chown = false, $chgrp = false) { + // safe mode fails with a trailing slash under certain PHP versions. + $path = untrailingslashit($path); + if ( empty($path) ) + $path = '/'; + + if ( ! $chmod ) + $chmod = FS_CHMOD_DIR; + + if ( ! @mkdir($path) ) + return false; + $this->chmod($path, $chmod); + if ( $chown ) + $this->chown($path, $chown); + if ( $chgrp ) + $this->chgrp($path, $chgrp); + return true; + } + + function rmdir($path, $recursive = false) { + return $this->delete($path, $recursive); + } + + function dirlist($path, $include_hidden = true, $recursive = false) { + if ( $this->is_file($path) ) { + $limit_file = basename($path); + $path = dirname($path); + } else { + $limit_file = false; + } + + if ( ! $this->is_dir($path) ) + return false; + + $dir = @dir($path); + if ( ! $dir ) + return false; + + $ret = array(); + + while (false !== ($entry = $dir->read()) ) { + $struc = array(); + $struc['name'] = $entry; + + if ( '.' == $struc['name'] || '..' == $struc['name'] ) + continue; + + if ( ! $include_hidden && '.' == $struc['name'][0] ) + continue; + + if ( $limit_file && $struc['name'] != $limit_file) + continue; + + $struc['perms'] = $this->gethchmod($path.'/'.$entry); + $struc['permsn'] = $this->getnumchmodfromh($struc['perms']); + $struc['number'] = false; + $struc['owner'] = $this->owner($path.'/'.$entry); + $struc['group'] = $this->group($path.'/'.$entry); + $struc['size'] = $this->size($path.'/'.$entry); + $struc['lastmodunix']= $this->mtime($path.'/'.$entry); + $struc['lastmod'] = date('M j',$struc['lastmodunix']); + $struc['time'] = date('h:i:s',$struc['lastmodunix']); + $struc['type'] = $this->is_dir($path.'/'.$entry) ? 'd' : 'f'; + + if ( 'd' == $struc['type'] ) { + if ( $recursive ) + $struc['files'] = $this->dirlist($path . '/' . $struc['name'], $include_hidden, $recursive); + else + $struc['files'] = array(); + } + + $ret[ $struc['name'] ] = $struc; + } + $dir->close(); + unset($dir); + return $ret; + } +} +?> diff --git a/src/wp-admin/includes/class-wp-filesystem-ftpext.php b/src/wp-admin/includes/class-wp-filesystem-ftpext.php new file mode 100644 index 0000000..ff65d4c --- /dev/null +++ b/src/wp-admin/includes/class-wp-filesystem-ftpext.php @@ -0,0 +1,387 @@ +method = 'ftpext'; + $this->errors = new WP_Error(); + + //Check if possible to use ftp functions. + if ( ! extension_loaded('ftp') ) { + $this->errors->add('no_ftp_ext', __('The ftp PHP extension is not available')); + return false; + } + + // Set defaults: + //This Class uses the timeout on a per-connection basis, Others use it on a per-action basis. + + if ( ! defined('FS_TIMEOUT') ) + define('FS_TIMEOUT', 240); + + if ( empty($opt['port']) ) + $this->options['port'] = 21; + else + $this->options['port'] = $opt['port']; + + if ( empty($opt['hostname']) ) + $this->errors->add('empty_hostname', __('FTP hostname is required')); + else + $this->options['hostname'] = $opt['hostname']; + + if ( ! empty($opt['base']) ) + $this->wp_base = $opt['base']; + + // Check if the options provided are OK. + if ( empty($opt['username']) ) + $this->errors->add('empty_username', __('FTP username is required')); + else + $this->options['username'] = $opt['username']; + + if ( empty($opt['password']) ) + $this->errors->add('empty_password', __('FTP password is required')); + else + $this->options['password'] = $opt['password']; + + $this->options['ssl'] = false; + if ( isset($opt['connection_type']) && 'ftps' == $opt['connection_type'] ) + $this->options['ssl'] = true; + } + + function connect() { + if ( isset($this->options['ssl']) && $this->options['ssl'] && function_exists('ftp_ssl_connect') ) + $this->link = @ftp_ssl_connect($this->options['hostname'], $this->options['port'], FS_CONNECT_TIMEOUT); + else + $this->link = @ftp_connect($this->options['hostname'], $this->options['port'], FS_CONNECT_TIMEOUT); + + if ( ! $this->link ) { + $this->errors->add('connect', sprintf(__('Failed to connect to FTP Server %1$s:%2$s'), $this->options['hostname'], $this->options['port'])); + return false; + } + + if ( ! @ftp_login($this->link,$this->options['username'], $this->options['password']) ) { + $this->errors->add('auth', sprintf(__('Username/Password incorrect for %s'), $this->options['username'])); + return false; + } + + //Set the Connection to use Passive FTP + @ftp_pasv( $this->link, true ); + if ( @ftp_get_option($this->link, FTP_TIMEOUT_SEC) < FS_TIMEOUT ) + @ftp_set_option($this->link, FTP_TIMEOUT_SEC, FS_TIMEOUT); + + return true; + } + + function get_contents($file, $type = '', $resumepos = 0 ) { + if ( empty($type) ) + $type = FTP_BINARY; + + $tempfile = wp_tempnam($file); + $temp = fopen($tempfile, 'w+'); + + if ( ! $temp ) + return false; + + if ( ! @ftp_fget($this->link, $temp, $file, $type, $resumepos) ) + return false; + + fseek($temp, 0); //Skip back to the start of the file being written to + $contents = ''; + + while ( ! feof($temp) ) + $contents .= fread($temp, 8192); + + fclose($temp); + unlink($tempfile); + return $contents; + } + function get_contents_array($file) { + return explode("\n", $this->get_contents($file)); + } + + function put_contents($file, $contents, $mode = false ) { + $tempfile = wp_tempnam($file); + $temp = fopen($tempfile, 'w+'); + if ( ! $temp ) + return false; + + fwrite($temp, $contents); + fseek($temp, 0); //Skip back to the start of the file being written to + + $type = $this->is_binary($contents) ? FTP_BINARY : FTP_ASCII; + $ret = @ftp_fput($this->link, $file, $temp, $type); + + fclose($temp); + unlink($tempfile); + + $this->chmod($file, $mode); + + return $ret; + } + function cwd() { + $cwd = @ftp_pwd($this->link); + if ( $cwd ) + $cwd = trailingslashit($cwd); + return $cwd; + } + function chdir($dir) { + return @ftp_chdir($this->link, $dir); + } + function chgrp($file, $group, $recursive = false ) { + return false; + } + function chmod($file, $mode = false, $recursive = false) { + if ( ! $mode ) { + if ( $this->is_file($file) ) + $mode = FS_CHMOD_FILE; + elseif ( $this->is_dir($file) ) + $mode = FS_CHMOD_DIR; + else + return false; + } + + // chmod any sub-objects if recursive. + if ( $recursive && $this->is_dir($file) ) { + $filelist = $this->dirlist($file); + foreach ( (array)$filelist as $filename => $filemeta ) + $this->chmod($file . '/' . $filename, $mode, $recursive); + } + + // chmod the file or directory + if ( ! function_exists('ftp_chmod') ) + return (bool)@ftp_site($this->link, sprintf('CHMOD %o %s', $mode, $file)); + return (bool)@ftp_chmod($this->link, $mode, $file); + } + function chown($file, $owner, $recursive = false ) { + return false; + } + function owner($file) { + $dir = $this->dirlist($file); + return $dir[$file]['owner']; + } + function getchmod($file) { + $dir = $this->dirlist($file); + return $dir[$file]['permsn']; + } + function group($file) { + $dir = $this->dirlist($file); + return $dir[$file]['group']; + } + function copy($source, $destination, $overwrite = false, $mode = false) { + if ( ! $overwrite && $this->exists($destination) ) + return false; + $content = $this->get_contents($source); + if ( false === $content) + return false; + return $this->put_contents($destination, $content, $mode); + } + function move($source, $destination, $overwrite = false) { + return ftp_rename($this->link, $source, $destination); + } + + function delete($file, $recursive = false, $type = false) { + if ( empty($file) ) + return false; + if ( 'f' == $type || $this->is_file($file) ) + return @ftp_delete($this->link, $file); + if ( !$recursive ) + return @ftp_rmdir($this->link, $file); + + $filelist = $this->dirlist( trailingslashit($file) ); + if ( !empty($filelist) ) + foreach ( $filelist as $delete_file ) + $this->delete( trailingslashit($file) . $delete_file['name'], $recursive, $delete_file['type'] ); + return @ftp_rmdir($this->link, $file); + } + + function exists($file) { + $list = @ftp_nlist($this->link, $file); + return !empty($list); //empty list = no file, so invert. + } + function is_file($file) { + return $this->exists($file) && !$this->is_dir($file); + } + function is_dir($path) { + $cwd = $this->cwd(); + $result = @ftp_chdir($this->link, trailingslashit($path) ); + if ( $result && $path == $this->cwd() || $this->cwd() != $cwd ) { + @ftp_chdir($this->link, $cwd); + return true; + } + return false; + } + function is_readable($file) { + //Get dir list, Check if the file is readable by the current user?? + return true; + } + function is_writable($file) { + //Get dir list, Check if the file is writable by the current user?? + return true; + } + function atime($file) { + return false; + } + function mtime($file) { + return ftp_mdtm($this->link, $file); + } + function size($file) { + return ftp_size($this->link, $file); + } + function touch($file, $time = 0, $atime = 0) { + return false; + } + function mkdir($path, $chmod = false, $chown = false, $chgrp = false) { + if ( !@ftp_mkdir($this->link, $path) ) + return false; + $this->chmod($path, $chmod); + if ( $chown ) + $this->chown($path, $chown); + if ( $chgrp ) + $this->chgrp($path, $chgrp); + return true; + } + function rmdir($path, $recursive = false) { + return $this->delete($path, $recursive); + } + + function parselisting($line) { + static $is_windows; + if ( is_null($is_windows) ) + $is_windows = stripos( ftp_systype($this->link), 'win') !== false; + + if ( $is_windows && preg_match('/([0-9]{2})-([0-9]{2})-([0-9]{2}) +([0-9]{2}):([0-9]{2})(AM|PM) +([0-9]+|) +(.+)/', $line, $lucifer) ) { + $b = array(); + if ( $lucifer[3] < 70 ) + $lucifer[3] +=2000; + else + $lucifer[3] += 1900; // 4digit year fix + $b['isdir'] = ( $lucifer[7] == ''); + if ( $b['isdir'] ) + $b['type'] = 'd'; + else + $b['type'] = 'f'; + $b['size'] = $lucifer[7]; + $b['month'] = $lucifer[1]; + $b['day'] = $lucifer[2]; + $b['year'] = $lucifer[3]; + $b['hour'] = $lucifer[4]; + $b['minute'] = $lucifer[5]; + $b['time'] = @mktime($lucifer[4] + (strcasecmp($lucifer[6], "PM") == 0 ? 12 : 0), $lucifer[5], 0, $lucifer[1], $lucifer[2], $lucifer[3]); + $b['am/pm'] = $lucifer[6]; + $b['name'] = $lucifer[8]; + } elseif ( !$is_windows && $lucifer = preg_split('/[ ]/', $line, 9, PREG_SPLIT_NO_EMPTY)) { + //echo $line."\n"; + $lcount = count($lucifer); + if ( $lcount < 8 ) + return ''; + $b = array(); + $b['isdir'] = $lucifer[0]{0} === 'd'; + $b['islink'] = $lucifer[0]{0} === 'l'; + if ( $b['isdir'] ) + $b['type'] = 'd'; + elseif ( $b['islink'] ) + $b['type'] = 'l'; + else + $b['type'] = 'f'; + $b['perms'] = $lucifer[0]; + $b['number'] = $lucifer[1]; + $b['owner'] = $lucifer[2]; + $b['group'] = $lucifer[3]; + $b['size'] = $lucifer[4]; + if ( $lcount == 8 ) { + sscanf($lucifer[5], '%d-%d-%d', $b['year'], $b['month'], $b['day']); + sscanf($lucifer[6], '%d:%d', $b['hour'], $b['minute']); + $b['time'] = @mktime($b['hour'], $b['minute'], 0, $b['month'], $b['day'], $b['year']); + $b['name'] = $lucifer[7]; + } else { + $b['month'] = $lucifer[5]; + $b['day'] = $lucifer[6]; + if ( preg_match('/([0-9]{2}):([0-9]{2})/', $lucifer[7], $l2) ) { + $b['year'] = date("Y"); + $b['hour'] = $l2[1]; + $b['minute'] = $l2[2]; + } else { + $b['year'] = $lucifer[7]; + $b['hour'] = 0; + $b['minute'] = 0; + } + $b['time'] = strtotime( sprintf('%d %s %d %02d:%02d', $b['day'], $b['month'], $b['year'], $b['hour'], $b['minute']) ); + $b['name'] = $lucifer[8]; + } + } + + return $b; + } + + function dirlist($path = '.', $include_hidden = true, $recursive = false) { + if ( $this->is_file($path) ) { + $limit_file = basename($path); + $path = dirname($path) . '/'; + } else { + $limit_file = false; + } + + $pwd = @ftp_pwd($this->link); + if ( ! @ftp_chdir($this->link, $path) ) // Cant change to folder = folder doesnt exist + return false; + $list = @ftp_rawlist($this->link, '-a', false); + @ftp_chdir($this->link, $pwd); + + if ( empty($list) ) // Empty array = non-existent folder (real folder will show . at least) + return false; + + $dirlist = array(); + foreach ( $list as $k => $v ) { + $entry = $this->parselisting($v); + if ( empty($entry) ) + continue; + + if ( '.' == $entry['name'] || '..' == $entry['name'] ) + continue; + + if ( ! $include_hidden && '.' == $entry['name'][0] ) + continue; + + if ( $limit_file && $entry['name'] != $limit_file) + continue; + + $dirlist[ $entry['name'] ] = $entry; + } + + $ret = array(); + foreach ( (array)$dirlist as $struc ) { + if ( 'd' == $struc['type'] ) { + if ( $recursive ) + $struc['files'] = $this->dirlist($path . '/' . $struc['name'], $include_hidden, $recursive); + else + $struc['files'] = array(); + } + + $ret[ $struc['name'] ] = $struc; + } + return $ret; + } + + function __destruct() { + if ( $this->link ) + ftp_close($this->link); + } +} + +?> diff --git a/src/wp-admin/includes/class-wp-filesystem-ftpsockets.php b/src/wp-admin/includes/class-wp-filesystem-ftpsockets.php new file mode 100644 index 0000000..1dc170a --- /dev/null +++ b/src/wp-admin/includes/class-wp-filesystem-ftpsockets.php @@ -0,0 +1,327 @@ +method = 'ftpsockets'; + $this->errors = new WP_Error(); + + //Check if possible to use ftp functions. + if ( ! @include_once ABSPATH . 'wp-admin/includes/class-ftp.php' ) + return false; + $this->ftp = new ftp(); + + //Set defaults: + if ( empty($opt['port']) ) + $this->options['port'] = 21; + else + $this->options['port'] = $opt['port']; + + if ( empty($opt['hostname']) ) + $this->errors->add('empty_hostname', __('FTP hostname is required')); + else + $this->options['hostname'] = $opt['hostname']; + + if ( ! empty($opt['base']) ) + $this->wp_base = $opt['base']; + + // Check if the options provided are OK. + if ( empty ($opt['username']) ) + $this->errors->add('empty_username', __('FTP username is required')); + else + $this->options['username'] = $opt['username']; + + if ( empty ($opt['password']) ) + $this->errors->add('empty_password', __('FTP password is required')); + else + $this->options['password'] = $opt['password']; + } + + function connect() { + if ( ! $this->ftp ) + return false; + + $this->ftp->setTimeout(FS_CONNECT_TIMEOUT); + + if ( ! $this->ftp->SetServer($this->options['hostname'], $this->options['port']) ) { + $this->errors->add('connect', sprintf(__('Failed to connect to FTP Server %1$s:%2$s'), $this->options['hostname'], $this->options['port'])); + return false; + } + + if ( ! $this->ftp->connect() ) { + $this->errors->add('connect', sprintf(__('Failed to connect to FTP Server %1$s:%2$s'), $this->options['hostname'], $this->options['port'])); + return false; + } + + if ( ! $this->ftp->login($this->options['username'], $this->options['password']) ) { + $this->errors->add('auth', sprintf(__('Username/Password incorrect for %s'), $this->options['username'])); + return false; + } + + $this->ftp->SetType(FTP_AUTOASCII); + $this->ftp->Passive(true); + $this->ftp->setTimeout(FS_TIMEOUT); + return true; + } + + function get_contents($file, $type = '', $resumepos = 0) { + if ( ! $this->exists($file) ) + return false; + + if ( empty($type) ) + $type = FTP_AUTOASCII; + $this->ftp->SetType($type); + + $temp = wp_tempnam( $file ); + + if ( ! $temphandle = fopen($temp, 'w+') ) + return false; + + if ( ! $this->ftp->fget($temphandle, $file) ) { + fclose($temphandle); + unlink($temp); + return ''; //Blank document, File does exist, Its just blank. + } + + fseek($temphandle, 0); //Skip back to the start of the file being written to + $contents = ''; + + while ( ! feof($temphandle) ) + $contents .= fread($temphandle, 8192); + + fclose($temphandle); + unlink($temp); + return $contents; + } + + function get_contents_array($file) { + return explode("\n", $this->get_contents($file) ); + } + + function put_contents($file, $contents, $mode = false ) { + $temp = wp_tempnam( $file ); + if ( ! $temphandle = @fopen($temp, 'w+') ) { + unlink($temp); + return false; + } + + fwrite($temphandle, $contents); + fseek($temphandle, 0); //Skip back to the start of the file being written to + + $type = $this->is_binary($contents) ? FTP_BINARY : FTP_ASCII; + $this->ftp->SetType($type); + + $ret = $this->ftp->fput($file, $temphandle); + + fclose($temphandle); + unlink($temp); + + $this->chmod($file, $mode); + + return $ret; + } + + function cwd() { + $cwd = $this->ftp->pwd(); + if ( $cwd ) + $cwd = trailingslashit($cwd); + return $cwd; + } + + function chdir($file) { + return $this->ftp->chdir($file); + } + + function chgrp($file, $group, $recursive = false ) { + return false; + } + + function chmod($file, $mode = false, $recursive = false ) { + if ( ! $mode ) { + if ( $this->is_file($file) ) + $mode = FS_CHMOD_FILE; + elseif ( $this->is_dir($file) ) + $mode = FS_CHMOD_DIR; + else + return false; + } + + // chmod any sub-objects if recursive. + if ( $recursive && $this->is_dir($file) ) { + $filelist = $this->dirlist($file); + foreach ( (array)$filelist as $filename => $filemeta ) + $this->chmod($file . '/' . $filename, $mode, $recursive); + } + + // chmod the file or directory + return $this->ftp->chmod($file, $mode); + } + + function chown($file, $owner, $recursive = false ) { + return false; + } + + function owner($file) { + $dir = $this->dirlist($file); + return $dir[$file]['owner']; + } + + function getchmod($file) { + $dir = $this->dirlist($file); + return $dir[$file]['permsn']; + } + + function group($file) { + $dir = $this->dirlist($file); + return $dir[$file]['group']; + } + + function copy($source, $destination, $overwrite = false, $mode = false) { + if ( ! $overwrite && $this->exists($destination) ) + return false; + + $content = $this->get_contents($source); + if ( false === $content ) + return false; + + return $this->put_contents($destination, $content, $mode); + } + + function move($source, $destination, $overwrite = false ) { + return $this->ftp->rename($source, $destination); + } + + function delete($file, $recursive = false, $type = false) { + if ( empty($file) ) + return false; + if ( 'f' == $type || $this->is_file($file) ) + return $this->ftp->delete($file); + if ( !$recursive ) + return $this->ftp->rmdir($file); + + return $this->ftp->mdel($file); + } + + function exists($file) { + return $this->ftp->is_exists($file); + } + + function is_file($file) { + if ( $this->is_dir($file) ) + return false; + if ( $this->exists($file) ) + return true; + return false; + } + + function is_dir($path) { + $cwd = $this->cwd(); + if ( $this->chdir($path) ) { + $this->chdir($cwd); + return true; + } + return false; + } + + function is_readable($file) { + //Get dir list, Check if the file is writable by the current user?? + return true; + } + + function is_writable($file) { + //Get dir list, Check if the file is writable by the current user?? + return true; + } + + function atime($file) { + return false; + } + + function mtime($file) { + return $this->ftp->mdtm($file); + } + + function size($file) { + return $this->ftp->filesize($file); + } + + function touch($file, $time = 0, $atime = 0 ) { + return false; + } + + function mkdir($path, $chmod = false, $chown = false, $chgrp = false ) { + if ( ! $this->ftp->mkdir($path) ) + return false; + if ( ! $chmod ) + $chmod = FS_CHMOD_DIR; + $this->chmod($path, $chmod); + if ( $chown ) + $this->chown($path, $chown); + if ( $chgrp ) + $this->chgrp($path, $chgrp); + return true; + } + + function rmdir($path, $recursive = false ) { + $this->delete($path, $recursive); + } + + function dirlist($path = '.', $include_hidden = true, $recursive = false ) { + if ( $this->is_file($path) ) { + $limit_file = basename($path); + $path = dirname($path) . '/'; + } else { + $limit_file = false; + } + + $list = $this->ftp->dirlist($path); + if ( empty($list) && !$this->exists($path) ) + return false; + + $ret = array(); + foreach ( $list as $struc ) { + + if ( '.' == $struc['name'] || '..' == $struc['name'] ) + continue; + + if ( ! $include_hidden && '.' == $struc['name'][0] ) + continue; + + if ( $limit_file && $struc['name'] != $limit_file ) + continue; + + if ( 'd' == $struc['type'] ) { + if ( $recursive ) + $struc['files'] = $this->dirlist($path . '/' . $struc['name'], $include_hidden, $recursive); + else + $struc['files'] = array(); + } + + $ret[ $struc['name'] ] = $struc; + } + return $ret; + } + + function __destruct() { + $this->ftp->quit(); + } +} + +?> diff --git a/src/wp-admin/includes/class-wp-filesystem-ssh2.php b/src/wp-admin/includes/class-wp-filesystem-ssh2.php new file mode 100644 index 0000000..b809f45 --- /dev/null +++ b/src/wp-admin/includes/class-wp-filesystem-ssh2.php @@ -0,0 +1,383 @@ +method = 'ssh2'; + $this->errors = new WP_Error(); + + //Check if possible to use ssh2 functions. + if ( ! extension_loaded('ssh2') ) { + $this->errors->add('no_ssh2_ext', __('The ssh2 PHP extension is not available')); + return false; + } + if ( !function_exists('stream_get_contents') ) { + $this->errors->add('ssh2_php_requirement', __('The ssh2 PHP extension is available, however, we require the PHP5 function stream_get_contents()')); + return false; + } + + // Set defaults: + if ( empty($opt['port']) ) + $this->options['port'] = 22; + else + $this->options['port'] = $opt['port']; + + if ( empty($opt['hostname']) ) + $this->errors->add('empty_hostname', __('SSH2 hostname is required')); + else + $this->options['hostname'] = $opt['hostname']; + + if ( ! empty($opt['base']) ) + $this->wp_base = $opt['base']; + + // Check if the options provided are OK. + if ( !empty ($opt['public_key']) && !empty ($opt['private_key']) ) { + $this->options['public_key'] = $opt['public_key']; + $this->options['private_key'] = $opt['private_key']; + + $this->options['hostkey'] = array('hostkey' => 'ssh-rsa'); + + $this->keys = true; + } elseif ( empty ($opt['username']) ) { + $this->errors->add('empty_username', __('SSH2 username is required')); + } + + if ( !empty($opt['username']) ) + $this->options['username'] = $opt['username']; + + if ( empty ($opt['password']) ) { + if ( !$this->keys ) //password can be blank if we are using keys + $this->errors->add('empty_password', __('SSH2 password is required')); + } else { + $this->options['password'] = $opt['password']; + } + + } + + function connect() { + if ( ! $this->keys ) { + $this->link = @ssh2_connect($this->options['hostname'], $this->options['port']); + } else { + $this->link = @ssh2_connect($this->options['hostname'], $this->options['port'], $this->options['hostkey']); + } + + if ( ! $this->link ) { + $this->errors->add('connect', sprintf(__('Failed to connect to SSH2 Server %1$s:%2$s'), $this->options['hostname'], $this->options['port'])); + return false; + } + + if ( !$this->keys ) { + if ( ! @ssh2_auth_password($this->link, $this->options['username'], $this->options['password']) ) { + $this->errors->add('auth', sprintf(__('Username/Password incorrect for %s'), $this->options['username'])); + return false; + } + } else { + if ( ! @ssh2_auth_pubkey_file($this->link, $this->options['username'], $this->options['public_key'], $this->options['private_key'], $this->options['password'] ) ) { + $this->errors->add('auth', sprintf(__('Public and Private keys incorrect for %s'), $this->options['username'])); + return false; + } + } + + $this->sftp_link = ssh2_sftp($this->link); + + return true; + } + + function run_command( $command, $returnbool = false) { + + if ( ! $this->link ) + return false; + + if ( ! ($stream = ssh2_exec($this->link, $command)) ) { + $this->errors->add('command', sprintf(__('Unable to perform command: %s'), $command)); + } else { + stream_set_blocking( $stream, true ); + stream_set_timeout( $stream, FS_TIMEOUT ); + $data = stream_get_contents( $stream ); + fclose( $stream ); + + if ( $returnbool ) + return ( $data === false ) ? false : '' != trim($data); + else + return $data; + } + return false; + } + + function get_contents($file, $type = '', $resumepos = 0 ) { + $file = ltrim($file, '/'); + return file_get_contents('ssh2.sftp://' . $this->sftp_link . '/' . $file); + } + + function get_contents_array($file) { + $file = ltrim($file, '/'); + return file('ssh2.sftp://' . $this->sftp_link . '/' . $file); + } + + function put_contents($file, $contents, $mode = false ) { + $file = ltrim($file, '/'); + $ret = file_put_contents('ssh2.sftp://' . $this->sftp_link . '/' . $file, $contents); + + $this->chmod($file, $mode); + + return false !== $ret; + } + + function cwd() { + $cwd = $this->run_command('pwd'); + if ( $cwd ) + $cwd = trailingslashit($cwd); + return $cwd; + } + + function chdir($dir) { + return $this->run_command('cd ' . $dir, true); + } + + function chgrp($file, $group, $recursive = false ) { + if ( ! $this->exists($file) ) + return false; + if ( ! $recursive || ! $this->is_dir($file) ) + return $this->run_command(sprintf('chgrp %o %s', $mode, escapeshellarg($file)), true); + return $this->run_command(sprintf('chgrp -R %o %s', $mode, escapeshellarg($file)), true); + } + + function chmod($file, $mode = false, $recursive = false) { + if ( ! $this->exists($file) ) + return false; + + if ( ! $mode ) { + if ( $this->is_file($file) ) + $mode = FS_CHMOD_FILE; + elseif ( $this->is_dir($file) ) + $mode = FS_CHMOD_DIR; + else + return false; + } + + if ( ! $recursive || ! $this->is_dir($file) ) + return $this->run_command(sprintf('chmod %o %s', $mode, escapeshellarg($file)), true); + return $this->run_command(sprintf('chmod -R %o %s', $mode, escapeshellarg($file)), true); + } + + function chown($file, $owner, $recursive = false ) { + if ( ! $this->exists($file) ) + return false; + if ( ! $recursive || ! $this->is_dir($file) ) + return $this->run_command(sprintf('chown %o %s', $mode, escapeshellarg($file)), true); + return $this->run_command(sprintf('chown -R %o %s', $mode, escapeshellarg($file)), true); + } + + function owner($file) { + $owneruid = @fileowner('ssh2.sftp://' . $this->sftp_link . '/' . ltrim($file, '/')); + if ( ! $owneruid ) + return false; + if ( ! function_exists('posix_getpwuid') ) + return $owneruid; + $ownerarray = posix_getpwuid($owneruid); + return $ownerarray['name']; + } + + function getchmod($file) { + return substr(decoct(@fileperms( 'ssh2.sftp://' . $this->sftp_link . '/' . ltrim($file, '/') )),3); + } + + function group($file) { + $gid = @filegroup('ssh2.sftp://' . $this->sftp_link . '/' . ltrim($file, '/')); + if ( ! $gid ) + return false; + if ( ! function_exists('posix_getgrgid') ) + return $gid; + $grouparray = posix_getgrgid($gid); + return $grouparray['name']; + } + + function copy($source, $destination, $overwrite = false, $mode = false) { + if ( ! $overwrite && $this->exists($destination) ) + return false; + $content = $this->get_contents($source); + if ( false === $content) + return false; + return $this->put_contents($destination, $content, $mode); + } + + function move($source, $destination, $overwrite = false) { + return @ssh2_sftp_rename($this->link, $source, $destination); + } + + function delete($file, $recursive = false, $type = false) { + if ( 'f' == $type || $this->is_file($file) ) + return ssh2_sftp_unlink($this->sftp_link, $file); + if ( ! $recursive ) + return ssh2_sftp_rmdir($this->sftp_link, $file); + $filelist = $this->dirlist($file); + if ( is_array($filelist) ) { + foreach ( $filelist as $filename => $fileinfo) { + $this->delete($file . '/' . $filename, $recursive, $fileinfo['type']); + } + } + return ssh2_sftp_rmdir($this->sftp_link, $file); + } + + function exists($file) { + $file = ltrim($file, '/'); + return file_exists('ssh2.sftp://' . $this->sftp_link . '/' . $file); + } + + function is_file($file) { + $file = ltrim($file, '/'); + return is_file('ssh2.sftp://' . $this->sftp_link . '/' . $file); + } + + function is_dir($path) { + $path = ltrim($path, '/'); + return is_dir('ssh2.sftp://' . $this->sftp_link . '/' . $path); + } + + function is_readable($file) { + $file = ltrim($file, '/'); + return is_readable('ssh2.sftp://' . $this->sftp_link . '/' . $file); + } + + function is_writable($file) { + $file = ltrim($file, '/'); + return is_writable('ssh2.sftp://' . $this->sftp_link . '/' . $file); + } + + function atime($file) { + $file = ltrim($file, '/'); + return fileatime('ssh2.sftp://' . $this->sftp_link . '/' . $file); + } + + function mtime($file) { + $file = ltrim($file, '/'); + return filemtime('ssh2.sftp://' . $this->sftp_link . '/' . $file); + } + + function size($file) { + $file = ltrim($file, '/'); + return filesize('ssh2.sftp://' . $this->sftp_link . '/' . $file); + } + + function touch($file, $time = 0, $atime = 0) { + //Not implmented. + } + + function mkdir($path, $chmod = false, $chown = false, $chgrp = false) { + $path = untrailingslashit($path); + if ( ! $chmod ) + $chmod = FS_CHMOD_DIR; + if ( ! ssh2_sftp_mkdir($this->sftp_link, $path, $chmod, true) ) + return false; + if ( $chown ) + $this->chown($path, $chown); + if ( $chgrp ) + $this->chgrp($path, $chgrp); + return true; + } + + function rmdir($path, $recursive = false) { + return $this->delete($path, $recursive); + } + + function dirlist($path, $include_hidden = true, $recursive = false) { + if ( $this->is_file($path) ) { + $limit_file = basename($path); + $path = dirname($path); + } else { + $limit_file = false; + } + + if ( ! $this->is_dir($path) ) + return false; + + $ret = array(); + $dir = @dir('ssh2.sftp://' . $this->sftp_link .'/' . ltrim($path, '/') ); + + if ( ! $dir ) + return false; + + while (false !== ($entry = $dir->read()) ) { + $struc = array(); + $struc['name'] = $entry; + + if ( '.' == $struc['name'] || '..' == $struc['name'] ) + continue; //Do not care about these folders. + + if ( ! $include_hidden && '.' == $struc['name'][0] ) + continue; + + if ( $limit_file && $struc['name'] != $limit_file ) + continue; + + $struc['perms'] = $this->gethchmod($path.'/'.$entry); + $struc['permsn'] = $this->getnumchmodfromh($struc['perms']); + $struc['number'] = false; + $struc['owner'] = $this->owner($path.'/'.$entry); + $struc['group'] = $this->group($path.'/'.$entry); + $struc['size'] = $this->size($path.'/'.$entry); + $struc['lastmodunix']= $this->mtime($path.'/'.$entry); + $struc['lastmod'] = date('M j',$struc['lastmodunix']); + $struc['time'] = date('h:i:s',$struc['lastmodunix']); + $struc['type'] = $this->is_dir($path.'/'.$entry) ? 'd' : 'f'; + + if ( 'd' == $struc['type'] ) { + if ( $recursive ) + $struc['files'] = $this->dirlist($path . '/' . $struc['name'], $include_hidden, $recursive); + else + $struc['files'] = array(); + } + + $ret[ $struc['name'] ] = $struc; + } + $dir->close(); + unset($dir); + return $ret; + } +} diff --git a/src/wp-admin/includes/class-wp-importer.php b/src/wp-admin/includes/class-wp-importer.php new file mode 100644 index 0000000..2b4774b --- /dev/null +++ b/src/wp-admin/includes/class-wp-importer.php @@ -0,0 +1,307 @@ +prepare( "SELECT post_id, meta_value FROM $wpdb->postmeta WHERE meta_key = '%s' LIMIT %d,%d", $meta_key, $offset, $limit ); + $results = $wpdb->get_results( $sql ); + + // Increment offset + $offset = ( $limit + $offset ); + + if ( !empty( $results ) ) { + foreach ( $results as $r ) { + // Set permalinks into array + $hashtable[$r->meta_value] = intval( $r->post_id ); + } + } + } while ( count( $results ) == $limit ); + + // unset to save memory + unset( $results, $r ); + + return $hashtable; + } + + /** + * Return count of imported permalinks from WordPress database + * + * @param string $bid + * @return int + */ + function count_imported_posts( $importer_name, $bid ) { + global $wpdb; + + $count = 0; + + // Get count of permalinks + $meta_key = $importer_name . '_' . $bid . '_permalink'; + $sql = $wpdb->prepare( "SELECT COUNT( post_id ) AS cnt FROM $wpdb->postmeta WHERE meta_key = '%s'", $meta_key ); + + $result = $wpdb->get_results( $sql ); + + if ( !empty( $result ) ) + $count = intval( $result[0]->cnt ); + + // unset to save memory + unset( $results ); + + return $count; + } + + /** + * Set array with imported comments from WordPress database + * + * @param string $bid + * @return array + */ + function get_imported_comments( $bid ) { + global $wpdb; + + $hashtable = array(); + + $limit = 100; + $offset = 0; + + // Grab all comments in chunks + do { + $sql = $wpdb->prepare( "SELECT comment_ID, comment_agent FROM $wpdb->comments LIMIT %d,%d", $offset, $limit ); + $results = $wpdb->get_results( $sql ); + + // Increment offset + $offset = ( $limit + $offset ); + + if ( !empty( $results ) ) { + foreach ( $results as $r ) { + // Explode comment_agent key + list ( $ca_bid, $source_comment_id ) = explode( '-', $r->comment_agent ); + $source_comment_id = intval( $source_comment_id ); + + // Check if this comment came from this blog + if ( $bid == $ca_bid ) { + $hashtable[$source_comment_id] = intval( $r->comment_ID ); + } + } + } + } while ( count( $results ) == $limit ); + + // unset to save memory + unset( $results, $r ); + + return $hashtable; + } + + function set_blog( $blog_id ) { + if ( is_numeric( $blog_id ) ) { + $blog_id = (int) $blog_id; + } else { + $blog = 'http://' . preg_replace( '#^https?://#', '', $blog_id ); + if ( ( !$parsed = parse_url( $blog ) ) || empty( $parsed['host'] ) ) { + fwrite( STDERR, "Error: can not determine blog_id from $blog_id\n" ); + exit(); + } + if ( empty( $parsed['path'] ) ) + $parsed['path'] = '/'; + $blog = get_blog_details( array( 'domain' => $parsed['host'], 'path' => $parsed['path'] ) ); + if ( !$blog ) { + fwrite( STDERR, "Error: Could not find blog\n" ); + exit(); + } + $blog_id = (int) $blog->blog_id; + // Restore global $current_blog + global $current_blog; + $current_blog = $blog; + } + + if ( function_exists( 'is_multisite' ) ) { + if ( is_multisite() ) + switch_to_blog( $blog_id ); + } + + return $blog_id; + } + + function set_user( $user_id ) { + if ( is_numeric( $user_id ) ) { + $user_id = (int) $user_id; + } else { + $user_id = (int) username_exists( $user_id ); + } + + if ( !$user_id || !wp_set_current_user( $user_id ) ) { + fwrite( STDERR, "Error: can not find user\n" ); + exit(); + } + + return $user_id; + } + + /** + * Sort by strlen, longest string first + * + * @param string $a + * @param string $b + * @return int + */ + function cmpr_strlen( $a, $b ) { + return strlen( $b ) - strlen( $a ); + } + + /** + * GET URL + * + * @param string $url + * @param string $username + * @param string $password + * @param bool $head + * @return array + */ + function get_page( $url, $username = '', $password = '', $head = false ) { + // Increase the timeout + add_filter( 'http_request_timeout', array( &$this, 'bump_request_timeout' ) ); + + $headers = array(); + $args = array(); + if ( true === $head ) + $args['method'] = 'HEAD'; + if ( !empty( $username ) && !empty( $password ) ) + $headers['Authorization'] = 'Basic ' . base64_encode( "$username:$password" ); + + $args['headers'] = $headers; + + return wp_remote_request( $url, $args ); + } + + /** + * Bump up the request timeout for http requests + * + * @param int $val + * @return int + */ + function bump_request_timeout( $val ) { + return 60; + } + + /** + * Check if user has exceeded disk quota + * + * @return bool + */ + function is_user_over_quota() { + global $current_blog; + + if ( function_exists( 'upload_is_user_over_quota' ) ) { + if ( upload_is_user_over_quota( 1 ) ) { + echo "Sorry, you have used your upload quota.\n"; + return true; + } + } + + return false; + } + + /** + * Replace newlines, tabs, and multiple spaces with a single space + * + * @param string $string + * @return string + */ + function min_whitespace( $string ) { + return preg_replace( '|[\r\n\t ]+|', ' ', $string ); + } + + /** + * Reset global variables that grow out of control during imports + * + * @return void + */ + function stop_the_insanity() { + global $wpdb, $wp_actions; + // Or define( 'WP_IMPORTING', true ); + $wpdb->queries = array(); + // Reset $wp_actions to keep it from growing out of control + $wp_actions = array(); + } +} + +/** + * Returns value of command line params. + * Exits when a required param is not set. + * + * @param string $param + * @param bool $required + * @return mixed + */ +function get_cli_args( $param, $required = false ) { + $args = $_SERVER['argv']; + + $out = array(); + + $last_arg = null; + $return = null; + + $il = sizeof( $args ); + + for ( $i = 1, $il; $i < $il; $i++ ) { + if ( (bool) preg_match( "/^--(.+)/", $args[$i], $match ) ) { + $parts = explode( "=", $match[1] ); + $key = preg_replace( "/[^a-z0-9]+/", "", $parts[0] ); + + if ( isset( $parts[1] ) ) { + $out[$key] = $parts[1]; + } else { + $out[$key] = true; + } + + $last_arg = $key; + } else if ( (bool) preg_match( "/^-([a-zA-Z0-9]+)/", $args[$i], $match ) ) { + for ( $j = 0, $jl = strlen( $match[1] ); $j < $jl; $j++ ) { + $key = $match[1]{$j}; + $out[$key] = true; + } + + $last_arg = $key; + } else if ( $last_arg !== null ) { + $out[$last_arg] = $args[$i]; + } + } + + // Check array for specified param + if ( isset( $out[$param] ) ) { + // Set return value + $return = $out[$param]; + } + + // Check for missing required param + if ( !isset( $out[$param] ) && $required ) { + // Display message and exit + echo "\"$param\" parameter is required but was not specified\n"; + exit(); + } + + return $return; +} diff --git a/src/wp-admin/includes/class-wp-links-list-table.php b/src/wp-admin/includes/class-wp-links-list-table.php new file mode 100644 index 0000000..cbe3ed5 --- /dev/null +++ b/src/wp-admin/includes/class-wp-links-list-table.php @@ -0,0 +1,186 @@ + 'bookmarks', + ) ); + } + + function ajax_user_can() { + return current_user_can( 'manage_links' ); + } + + function prepare_items() { + global $cat_id, $s, $orderby, $order; + + wp_reset_vars( array( 'action', 'cat_id', 'linkurl', 'name', 'image', 'description', 'visible', 'target', 'category', 'link_id', 'submit', 'orderby', 'order', 'links_show_cat_id', 'rating', 'rel', 'notes', 'linkcheck[]', 's' ) ); + + $args = array( 'hide_invisible' => 0, 'hide_empty' => 0 ); + + if ( 'all' != $cat_id ) + $args['category'] = $cat_id; + if ( !empty( $s ) ) + $args['search'] = $s; + if ( !empty( $orderby ) ) + $args['orderby'] = $orderby; + if ( !empty( $order ) ) + $args['order'] = $order; + + $this->items = get_bookmarks( $args ); + } + + function no_items() { + _e( 'No links found.' ); + } + + function get_bulk_actions() { + $actions = array(); + $actions['delete'] = __( 'Delete' ); + + return $actions; + } + + function extra_tablenav( $which ) { + global $cat_id; + + if ( 'top' != $which ) + return; +?> +
+ $cat_id, + 'name' => 'cat_id', + 'taxonomy' => 'link_category', + 'show_option_all' => __( 'View all categories' ), + 'hide_empty' => true, + 'hierarchical' => 1, + 'show_count' => 0, + 'orderby' => 'name', + ); + wp_dropdown_categories( $dropdown_options ); + submit_button( __( 'Filter' ), 'secondary', false, false, array( 'id' => 'post-query-submit' ) ); +?> +
+ '', + 'name' => _x( 'Name', 'link name' ), + 'url' => __( 'URL' ), + 'categories' => __( 'Categories' ), + 'rel' => __( 'Relationship' ), + 'visible' => __( 'Visible' ), + 'rating' => __( 'Rating' ) + ); + } + + function get_sortable_columns() { + return array( + 'name' => 'name', + 'url' => 'url', + 'visible' => 'visible', + 'rating' => 'rating' + ); + } + + function display_rows() { + global $cat_id; + + $alt = 0; + + foreach ( $this->items as $link ) { + $link = sanitize_bookmark( $link ); + $link->link_name = esc_attr( $link->link_name ); + $link->link_category = wp_get_link_cats( $link->link_id ); + + $short_url = url_shorten( $link->link_url ); + + $visible = ( $link->link_visible == 'Y' ) ? __( 'Yes' ) : __( 'No' ); + $rating = $link->link_rating; + $style = ( $alt++ % 2 ) ? '' : ' class="alternate"'; + + $edit_link = get_edit_bookmark_link( $link ); +?> + > +get_column_info(); + + foreach ( $columns as $column_name => $column_display_name ) { + $class = "class='column-$column_name'"; + + $style = ''; + if ( in_array( $column_name, $hidden ) ) + $style = ' style="display:none;"'; + + $attributes = $class . $style; + + switch ( $column_name ) { + case 'cb': + echo ''; + break; + + case 'name': + echo "link_name ) ) . "'>$link->link_name
"; + + $actions = array(); + $actions['edit'] = '' . __( 'Edit' ) . ''; + $actions['delete'] = "link_id ) . "' onclick=\"if ( confirm( '" . esc_js( sprintf( __( "You are about to delete this link '%s'\n 'Cancel' to stop, 'OK' to delete." ), $link->link_name ) ) . "' ) ) { return true;}return false;\">" . __( 'Delete' ) . ""; + echo $this->row_actions( $actions ); + + echo ''; + break; + case 'url': + echo "link_name ) )."'>$short_url"; + break; + case 'categories': + ?>>link_category as $category ) { + $cat = get_term( $category, 'link_category', OBJECT, 'display' ); + if ( is_wp_error( $cat ) ) + echo $cat->get_error_message(); + $cat_name = $cat->name; + if ( $cat_id != $category ) + $cat_name = "$cat_name"; + $cat_names[] = $cat_name; + } + echo implode( ', ', $cat_names ); + ?>>link_rel ) ? '
' : $link->link_rel; ?>>> + >link_id ); ?> + + + diff --git a/src/wp-admin/includes/class-wp-list-table.php b/src/wp-admin/includes/class-wp-list-table.php new file mode 100644 index 0000000..6420ee7 --- /dev/null +++ b/src/wp-admin/includes/class-wp-list-table.php @@ -0,0 +1,908 @@ + '', + 'singular' => '', + 'ajax' => false + ) ); + + $screen = get_current_screen(); + + add_filter( "manage_{$screen->id}_columns", array( &$this, 'get_columns' ), 0 ); + + if ( !$args['plural'] ) + $args['plural'] = $screen->base; + + $this->_args = $args; + + if ( $args['ajax'] ) { + // wp_enqueue_script( 'list-table' ); + add_action( 'admin_footer', array( &$this, '_js_vars' ) ); + } + } + + /** + * Checks the current user's permissions + * @uses wp_die() + * + * @since 3.1.0 + * @access public + * @abstract + */ + function ajax_user_can() { + die( 'function WP_List_Table::ajax_user_can() must be over-ridden in a sub-class.' ); + } + + /** + * Prepares the list of items for displaying. + * @uses WP_List_Table::set_pagination_args() + * + * @since 3.1.0 + * @access public + * @abstract + */ + function prepare_items() { + die( 'function WP_List_Table::prepare_items() must be over-ridden in a sub-class.' ); + } + + /** + * An internal method that sets all the necessary pagination arguments + * + * @param array $args An associative array with information about the pagination + * @access protected + */ + function set_pagination_args( $args ) { + $args = wp_parse_args( $args, array( + 'total_items' => 0, + 'total_pages' => 0, + 'per_page' => 0, + ) ); + + if ( !$args['total_pages'] && $args['per_page'] > 0 ) + $args['total_pages'] = ceil( $args['total_items'] / $args['per_page'] ); + + // redirect if page number is invalid and headers are not already sent + if ( ! headers_sent() && ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX ) && $args['total_pages'] > 0 && $this->get_pagenum() > $args['total_pages'] ) { + wp_redirect( add_query_arg( 'paged', $args['total_pages'] ) ); + exit; + } + + $this->_pagination_args = $args; + } + + /** + * Access the pagination args + * + * @since 3.1.0 + * @access public + * + * @param string $key + * @return array + */ + function get_pagination_arg( $key ) { + if ( 'page' == $key ) + return $this->get_pagenum(); + + if ( isset( $this->_pagination_args[$key] ) ) + return $this->_pagination_args[$key]; + } + + /** + * Whether the table has items to display or not + * + * @since 3.1.0 + * @access public + * + * @return bool + */ + function has_items() { + return !empty( $this->items ); + } + + /** + * Message to be displayed when there are no items + * + * @since 3.1.0 + * @access public + */ + function no_items() { + _e( 'No items found.' ); + } + + /** + * Display the search box. + * + * @since 3.1.0 + * @access public + * + * @param string $text The search button text + * @param string $input_id The search input id + */ + function search_box( $text, $input_id ) { + if ( empty( $_REQUEST['s'] ) && !$this->has_items() ) + return; + + $input_id = $input_id . '-search-input'; + + if ( ! empty( $_REQUEST['orderby'] ) ) + echo ''; + if ( ! empty( $_REQUEST['order'] ) ) + echo ''; +?> + + link ) with the list + * of views available on this table. + * + * @since 3.1.0 + * @access protected + * + * @return array + */ + function get_views() { + return array(); + } + + /** + * Display the bulk actions dropdown. + * + * @since 3.1.0 + * @access public + */ + function views() { + $screen = get_current_screen(); + + $views = $this->get_views(); + $views = apply_filters( 'views_' . $screen->id, $views ); + + if ( empty( $views ) ) + return; + + echo "
    \n"; + foreach ( $views as $class => $view ) { + $views[ $class ] = "\t
  • $view"; + } + echo implode( " |
  • \n", $views ) . "\n"; + echo "
"; + } + + /** + * Get an associative array ( option_name => option_title ) with the list + * of bulk actions available on this table. + * + * @since 3.1.0 + * @access protected + * + * @return array + */ + function get_bulk_actions() { + return array(); + } + + /** + * Display the bulk actions dropdown. + * + * @since 3.1.0 + * @access public + */ + function bulk_actions() { + $screen = get_current_screen(); + + if ( is_null( $this->_actions ) ) { + $no_new_actions = $this->_actions = $this->get_bulk_actions(); + // This filter can currently only be used to remove actions. + $this->_actions = apply_filters( 'bulk_actions-' . $screen->id, $this->_actions ); + $this->_actions = array_intersect_assoc( $this->_actions, $no_new_actions ); + $two = ''; + } else { + $two = '2'; + } + + if ( empty( $this->_actions ) ) + return; + + echo "\n"; + + submit_button( __( 'Apply' ), 'button-secondary action', false, false, array( 'id' => "doaction$two" ) ); + echo "\n"; + } + + /** + * Get the current action selected from the bulk actions dropdown. + * + * @since 3.1.0 + * @access public + * + * @return string|bool The action name or False if no action was selected + */ + function current_action() { + if ( isset( $_REQUEST['action'] ) && -1 != $_REQUEST['action'] ) + return $_REQUEST['action']; + + if ( isset( $_REQUEST['action2'] ) && -1 != $_REQUEST['action2'] ) + return $_REQUEST['action2']; + + return false; + } + + /** + * Generate row actions div + * + * @since 3.1.0 + * @access protected + * + * @param array $actions The list of actions + * @param bool $always_visible Wether the actions should be always visible + * @return string + */ + function row_actions( $actions, $always_visible = false ) { + $action_count = count( $actions ); + $i = 0; + + if ( !$action_count ) + return ''; + + $out = '
'; + foreach ( $actions as $action => $link ) { + ++$i; + ( $i == $action_count ) ? $sep = '' : $sep = ' | '; + $out .= "$link$sep"; + } + $out .= '
'; + + return $out; + } + + /** + * Display a monthly dropdown for filtering items + * + * @since 3.1.0 + * @access protected + */ + function months_dropdown( $post_type ) { + global $wpdb, $wp_locale; + + $months = $wpdb->get_results( $wpdb->prepare( " + SELECT DISTINCT YEAR( post_date ) AS year, MONTH( post_date ) AS month + FROM $wpdb->posts + WHERE post_type = %s + ORDER BY post_date DESC + ", $post_type ) ); + + $month_count = count( $months ); + + if ( !$month_count || ( 1 == $month_count && 0 == $months[0]->month ) ) + return; + + $m = isset( $_GET['m'] ) ? (int) $_GET['m'] : 0; +?> + + __( 'List View' ), + 'excerpt' => __( 'Excerpt View' ) + ); + +?> + +
+ $title ) { + $class = ( $current_mode == $mode ) ? 'class="current"' : ''; + echo "$title\n"; + } + ?> +
+'; + + echo "" . number_format_i18n( get_comments_number() ) . ""; + + if ( $pending_comments ) + echo ''; + } + + /** + * Get the current page number + * + * @since 3.1.0 + * @access protected + * + * @return int + */ + function get_pagenum() { + $pagenum = isset( $_REQUEST['paged'] ) ? absint( $_REQUEST['paged'] ) : 0; + + if( isset( $this->_pagination_args['total_pages'] ) && $pagenum > $this->_pagination_args['total_pages'] ) + $pagenum = $this->_pagination_args['total_pages']; + + return max( 1, $pagenum ); + } + + /** + * Get number of items to display on a single page + * + * @since 3.1.0 + * @access protected + * + * @return int + */ + function get_items_per_page( $option, $default = 20 ) { + $per_page = (int) get_user_option( $option ); + if ( empty( $per_page ) || $per_page < 1 ) + $per_page = $default; + + return (int) apply_filters( $option, $per_page ); + } + + /** + * Display the pagination. + * + * @since 3.1.0 + * @access protected + */ + function pagination( $which ) { + if ( empty( $this->_pagination_args ) ) + return; + + extract( $this->_pagination_args ); + + $output = '' . sprintf( _n( '1 item', '%s items', $total_items ), number_format_i18n( $total_items ) ) . ''; + + $current = $this->get_pagenum(); + + $current_url = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; + + $current_url = remove_query_arg( array( 'hotkeys_highlight_last', 'hotkeys_highlight_first' ), $current_url ); + + $page_links = array(); + + $disable_first = $disable_last = ''; + if ( $current == 1 ) + $disable_first = ' disabled'; + if ( $current == $total_pages ) + $disable_last = ' disabled'; + + $page_links[] = sprintf( "%s", + 'first-page' . $disable_first, + esc_attr__( 'Go to the first page' ), + esc_url( remove_query_arg( 'paged', $current_url ) ), + '«' + ); + + $page_links[] = sprintf( "%s", + 'prev-page' . $disable_first, + esc_attr__( 'Go to the previous page' ), + esc_url( add_query_arg( 'paged', max( 1, $current-1 ), $current_url ) ), + '‹' + ); + + if ( 'bottom' == $which ) + $html_current_page = $current; + else + $html_current_page = sprintf( "", + esc_attr__( 'Current page' ), + esc_attr( 'paged' ), + $current, + strlen( $total_pages ) + ); + + $html_total_pages = sprintf( "%s", number_format_i18n( $total_pages ) ); + $page_links[] = '' . sprintf( _x( '%1$s of %2$s', 'paging' ), $html_current_page, $html_total_pages ) . ''; + + $page_links[] = sprintf( "%s", + 'next-page' . $disable_last, + esc_attr__( 'Go to the next page' ), + esc_url( add_query_arg( 'paged', min( $total_pages, $current+1 ), $current_url ) ), + '›' + ); + + $page_links[] = sprintf( "%s", + 'last-page' . $disable_last, + esc_attr__( 'Go to the last page' ), + esc_url( add_query_arg( 'paged', $total_pages, $current_url ) ), + '»' + ); + + $output .= "\n" . join( "\n", $page_links ) . ''; + + if ( $total_pages ) + $page_class = $total_pages < 2 ? ' one-page' : ''; + else + $page_class = ' no-pages'; + + $this->_pagination = "
$output
"; + + echo $this->_pagination; + } + + /** + * Get a list of columns. The format is: + * 'internal-name' => 'Title' + * + * @since 3.1.0 + * @access protected + * @abstract + * + * @return array + */ + function get_columns() { + die( 'function WP_List_Table::get_columns() must be over-ridden in a sub-class.' ); + } + + /** + * Get a list of sortable columns. The format is: + * 'internal-name' => 'orderby' + * or + * 'internal-name' => array( 'orderby', true ) + * + * The second format will make the initial sorting order be descending + * + * @since 3.1.0 + * @access protected + * + * @return array + */ + function get_sortable_columns() { + return array(); + } + + /** + * Get a list of all, hidden and sortable columns, with filter applied + * + * @since 3.1.0 + * @access protected + * + * @return array + */ + function get_column_info() { + if ( isset( $this->_column_headers ) ) + return $this->_column_headers; + + $screen = get_current_screen(); + + $columns = get_column_headers( $screen ); + $hidden = get_hidden_columns( $screen ); + + $_sortable = apply_filters( "manage_{$screen->id}_sortable_columns", $this->get_sortable_columns() ); + + $sortable = array(); + foreach ( $_sortable as $id => $data ) { + if ( empty( $data ) ) + continue; + + $data = (array) $data; + if ( !isset( $data[1] ) ) + $data[1] = false; + + $sortable[$id] = $data; + } + + $this->_column_headers = array( $columns, $hidden, $sortable ); + + return $this->_column_headers; + } + + /** + * Return number of visible columns + * + * @since 3.1.0 + * @access public + * + * @return int + */ + function get_column_count() { + list ( $columns, $hidden ) = $this->get_column_info(); + $hidden = array_intersect( array_keys( $columns ), array_filter( $hidden ) ); + return count( $columns ) - count( $hidden ); + } + + /** + * Print column headers, accounting for hidden and sortable columns. + * + * @since 3.1.0 + * @access protected + * + * @param bool $with_id Whether to set the id attribute or not + */ + function print_column_headers( $with_id = true ) { + $screen = get_current_screen(); + + list( $columns, $hidden, $sortable ) = $this->get_column_info(); + + $current_url = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; + $current_url = remove_query_arg( 'paged', $current_url ); + + if ( isset( $_GET['orderby'] ) ) + $current_orderby = $_GET['orderby']; + else + $current_orderby = ''; + + if ( isset( $_GET['order'] ) && 'desc' == $_GET['order'] ) + $current_order = 'desc'; + else + $current_order = 'asc'; + + foreach ( $columns as $column_key => $column_display_name ) { + $class = array( 'manage-column', "column-$column_key" ); + + $style = ''; + if ( in_array( $column_key, $hidden ) ) + $style = 'display:none;'; + + $style = ' style="' . $style . '"'; + + if ( 'cb' == $column_key ) + $class[] = 'check-column'; + elseif ( in_array( $column_key, array( 'posts', 'comments', 'links' ) ) ) + $class[] = 'num'; + + if ( isset( $sortable[$column_key] ) ) { + list( $orderby, $desc_first ) = $sortable[$column_key]; + + if ( $current_orderby == $orderby ) { + $order = 'asc' == $current_order ? 'desc' : 'asc'; + $class[] = 'sorted'; + $class[] = $current_order; + } else { + $order = $desc_first ? 'desc' : 'asc'; + $class[] = 'sortable'; + $class[] = $desc_first ? 'asc' : 'desc'; + } + + $column_display_name = '' . $column_display_name . ''; + } + + $id = $with_id ? "id='$column_key'" : ''; + + if ( !empty( $class ) ) + $class = "class='" . join( ' ', $class ) . "'"; + + echo "$column_display_name"; + } + } + + /** + * Display the table + * + * @since 3.1.0 + * @access public + */ + function display() { + extract( $this->_args ); + + $this->display_tablenav( 'top' ); + +?> + + + + print_column_headers(); ?> + + + + + + print_column_headers( false ); ?> + + + + > + display_rows_or_placeholder(); ?> + +
+display_tablenav( 'bottom' ); + } + + /** + * Get a list of CSS classes for the tag + * + * @since 3.1.0 + * @access protected + * + * @return array + */ + function get_table_classes() { + return array( 'widefat', 'fixed', $this->_args['plural'] ); + } + + /** + * Generate the table navigation above or below the table + * + * @since 3.1.0 + * @access protected + */ + function display_tablenav( $which ) { + if ( 'top' == $which ) + wp_nonce_field( 'bulk-' . $this->_args['plural'] ); +?> +
+ +
+ bulk_actions( $which ); ?> +
+extra_tablenav( $which ); + $this->pagination( $which ); +?> + +
+
+ part of the table + * + * @since 3.1.0 + * @access protected + */ + function display_rows_or_placeholder() { + if ( $this->has_items() ) { + $this->display_rows(); + } else { + list( $columns, $hidden ) = $this->get_column_info(); + echo ''; + } + } + + /** + * Generate the table rows + * + * @since 3.1.0 + * @access protected + */ + function display_rows() { + foreach ( $this->items as $item ) + $this->single_row( $item ); + } + + /** + * Generates content for a single row of the table + * + * @since 3.1.0 + * @access protected + * + * @param object $item The current item + */ + function single_row( $item ) { + static $row_class = ''; + $row_class = ( $row_class == '' ? ' class="alternate"' : '' ); + + echo ''; + echo $this->single_row_columns( $item ); + echo ''; + } + + /** + * Generates the columns for a single row of the table + * + * @since 3.1.0 + * @access protected + * + * @param object $item The current item + */ + function single_row_columns( $item ) { + list( $columns, $hidden ) = $this->get_column_info(); + + foreach ( $columns as $column_name => $column_display_name ) { + $class = "class='$column_name column-$column_name'"; + + $style = ''; + if ( in_array( $column_name, $hidden ) ) + $style = ' style="display:none;"'; + + $attributes = "$class$style"; + + if ( 'cb' == $column_name ) { + echo ''; + } + elseif ( method_exists( $this, 'column_' . $column_name ) ) { + echo ""; + } + else { + echo ""; + } + } + } + + /** + * Handle an incoming ajax request (called from admin-ajax.php) + * + * @since 3.1.0 + * @access public + */ + function ajax_response() { + $this->prepare_items(); + + extract( $this->_args ); + extract( $this->_pagination_args ); + + ob_start(); + if ( ! empty( $_REQUEST['no_placeholder'] ) ) + $this->display_rows(); + else + $this->display_rows_or_placeholder(); + + $rows = ob_get_clean(); + + $response = array( 'rows' => $rows ); + + if ( isset( $total_items ) ) + $response['total_items_i18n'] = sprintf( _n( '1 item', '%s items', $total_items ), number_format_i18n( $total_items ) ); + + if ( isset( $total_pages ) ) { + $response['total_pages'] = $total_pages; + $response['total_pages_i18n'] = number_format_i18n( $total_pages ); + } + + die( json_encode( $response ) ); + } + + /** + * Send required variables to JavaScript land + * + * @access private + */ + function _js_vars() { + $args = array( + 'class' => get_class( $this ), + 'screen' => get_current_screen() + ); + + printf( "\n", json_encode( $args ) ); + } +} +?> diff --git a/src/wp-admin/includes/class-wp-media-list-table.php b/src/wp-admin/includes/class-wp-media-list-table.php new file mode 100644 index 0000000..531fe60 --- /dev/null +++ b/src/wp-admin/includes/class-wp-media-list-table.php @@ -0,0 +1,374 @@ +detached = isset( $_REQUEST['detached'] ) || isset( $_REQUEST['find_detached'] ); + + parent::__construct( array( + 'plural' => 'media' + ) ); + } + + function ajax_user_can() { + return current_user_can('upload_files'); + } + + function prepare_items() { + global $lost, $wpdb, $wp_query, $post_mime_types, $avail_post_mime_types; + + $q = $_REQUEST; + + if ( !empty( $lost ) ) + $q['post__in'] = implode( ',', $lost ); + + list( $post_mime_types, $avail_post_mime_types ) = wp_edit_attachments_query( $q ); + + $this->is_trash = isset( $_REQUEST['status'] ) && 'trash' == $_REQUEST['status']; + + $this->set_pagination_args( array( + 'total_items' => $wp_query->found_posts, + 'total_pages' => $wp_query->max_num_pages, + 'per_page' => $wp_query->query_vars['posts_per_page'], + ) ); + } + + function get_views() { + global $wpdb, $post_mime_types, $avail_post_mime_types; + + $type_links = array(); + $_num_posts = (array) wp_count_attachments(); + $_total_posts = array_sum($_num_posts) - $_num_posts['trash']; + if ( !isset( $total_orphans ) ) + $total_orphans = $wpdb->get_var( "SELECT COUNT( * ) FROM $wpdb->posts WHERE post_type = 'attachment' AND post_status != 'trash' AND post_parent < 1" ); + $matches = wp_match_mime_types(array_keys($post_mime_types), array_keys($_num_posts)); + foreach ( $matches as $type => $reals ) + foreach ( $reals as $real ) + $num_posts[$type] = ( isset( $num_posts[$type] ) ) ? $num_posts[$type] + $_num_posts[$real] : $_num_posts[$real]; + + $class = ( empty($_GET['post_mime_type']) && !$this->detached && !isset($_GET['status']) ) ? ' class="current"' : ''; + $type_links['all'] = "" . sprintf( _nx( 'All (%s)', 'All (%s)', $_total_posts, 'uploaded files' ), number_format_i18n( $_total_posts ) ) . ''; + foreach ( $post_mime_types as $mime_type => $label ) { + $class = ''; + + if ( !wp_match_mime_types($mime_type, $avail_post_mime_types) ) + continue; + + if ( !empty($_GET['post_mime_type']) && wp_match_mime_types($mime_type, $_GET['post_mime_type']) ) + $class = ' class="current"'; + if ( !empty( $num_posts[$mime_type] ) ) + $type_links[$mime_type] = "" . sprintf( translate_nooped_plural( $label[2], $num_posts[$mime_type] ), number_format_i18n( $num_posts[$mime_type] )) . ''; + } + $type_links['detached'] = 'detached ? ' class="current"' : '' ) . '>' . sprintf( _nx( 'Unattached (%s)', 'Unattached (%s)', $total_orphans, 'detached files' ), number_format_i18n( $total_orphans ) ) . ''; + + if ( !empty($_num_posts['trash']) ) + $type_links['trash'] = '' . sprintf( _nx( 'Trash (%s)', 'Trash (%s)', $_num_posts['trash'], 'uploaded files' ), number_format_i18n( $_num_posts['trash'] ) ) . ''; + + return $type_links; + } + + function get_bulk_actions() { + $actions = array(); + $actions['delete'] = __( 'Delete Permanently' ); + if ( $this->detached ) + $actions['attach'] = __( 'Attach to a post' ); + + return $actions; + } + + function extra_tablenav( $which ) { + global $post_type; + $post_type_obj = get_post_type_object( $post_type ); +?> +
+detached && !$this->is_trash ) { + $this->months_dropdown( $post_type ); + + do_action( 'restrict_manage_posts' ); + submit_button( __( 'Filter' ), 'secondary', false, false, array( 'id' => 'post-query-submit' ) ); + } + + if ( $this->detached ) { + submit_button( __( 'Scan for lost attachments' ), 'secondary', 'find_detached', false ); + } elseif ( $this->is_trash && current_user_can( 'edit_others_posts' ) ) { + submit_button( __( 'Empty Trash' ), 'button-secondary apply', 'delete_all', false ); + } ?> +
+'; + $posts_columns['icon'] = ''; + /* translators: column name */ + $posts_columns['title'] = _x( 'File', 'column name' ); + $posts_columns['author'] = __( 'Author' ); + //$posts_columns['tags'] = _x( 'Tags', 'column name' ); + /* translators: column name */ + if ( !$this->detached ) { + $posts_columns['parent'] = _x( 'Attached to', 'column name' ); + $posts_columns['comments'] = 'Comments'; + } + /* translators: column name */ + $posts_columns['date'] = _x( 'Date', 'column name' ); + $posts_columns = apply_filters( 'manage_media_columns', $posts_columns, $this->detached ); + + return $posts_columns; + } + + function get_sortable_columns() { + return array( + 'title' => 'title', + 'author' => 'author', + 'parent' => 'parent', + 'comments' => 'comment_count', + 'date' => array( 'date', true ), + ); + } + + function display_rows() { + global $post, $id; + + add_filter( 'the_title','esc_html' ); + $alt = ''; + + while ( have_posts() ) : the_post(); + + if ( $this->is_trash && $post->post_status != 'trash' + || !$this->is_trash && $post->post_status == 'trash' ) + continue; + + $alt = ( 'alternate' == $alt ) ? '' : 'alternate'; + $post_owner = ( get_current_user_id() == $post->post_author ) ? 'self' : 'other'; + $att_title = _draft_or_post_title(); +?> + post_status ); ?>' valign="top"> +get_column_info(); +foreach ( $columns as $column_name => $column_display_name ) { + $class = "class='$column_name column-$column_name'"; + + $style = ''; + if ( in_array( $column_name, $hidden ) ) + $style = ' style="display:none;"'; + + $attributes = $class . $style; + + switch ( $column_name ) { + + case 'cb': +?> + + + + + + + + + + + +post_date && 'date' == $column_name ) { + $t_time = $h_time = __( 'Unpublished' ); + } else { + $t_time = get_the_time( __( 'Y/m/d g:i:s A' ) ); + $m_time = $post->post_date; + $time = get_post_time( 'G', true, $post, false ); + if ( ( abs( $t_diff = time() - $time ) ) < 86400 ) { + if ( $t_diff < 0 ) + $h_time = sprintf( __( '%s from now' ), human_time_diff( $time ) ); + else + $h_time = sprintf( __( '%s ago' ), human_time_diff( $time ) ); + } else { + $h_time = mysql2date( __( 'Y/m/d' ), $m_time ); + } + } +?> + +post_parent > 0 ) { + if ( get_post( $post->post_parent ) ) { + $title =_draft_or_post_title( $post->post_parent ); + } +?> + + + + + + + + + +detached ) { + if ( current_user_can( 'edit_post', $post->ID ) ) + $actions['edit'] = '' . __( 'Edit' ) . ''; + if ( current_user_can( 'delete_post', $post->ID ) ) + if ( EMPTY_TRASH_DAYS && MEDIA_TRASH ) { + $actions['trash'] = "ID ) . "'>" . __( 'Trash' ) . ""; + } else { + $delete_ays = !MEDIA_TRASH ? " onclick='return showNotice.warn();'" : ''; + $actions['delete'] = "ID ) . "'>" . __( 'Delete Permanently' ) . ""; + } + $actions['view'] = '' . __( 'View' ) . ''; + if ( current_user_can( 'edit_post', $post->ID ) ) + $actions['attach'] = ''.__( 'Attach' ).''; + } + else { + if ( current_user_can( 'edit_post', $post->ID ) && !$this->is_trash ) + $actions['edit'] = '' . __( 'Edit' ) . ''; + if ( current_user_can( 'delete_post', $post->ID ) ) { + if ( $this->is_trash ) + $actions['untrash'] = "ID ) . "'>" . __( 'Restore' ) . ""; + elseif ( EMPTY_TRASH_DAYS && MEDIA_TRASH ) + $actions['trash'] = "ID ) . "'>" . __( 'Trash' ) . ""; + if ( $this->is_trash || !EMPTY_TRASH_DAYS || !MEDIA_TRASH ) { + $delete_ays = ( !$this->is_trash && !MEDIA_TRASH ) ? " onclick='return showNotice.warn();'" : ''; + $actions['delete'] = "ID ) . "'>" . __( 'Delete Permanently' ) . ""; + } + } + if ( !$this->is_trash ) { + $title =_draft_or_post_title( $post->post_parent ); + $actions['view'] = '' . __( 'View' ) . ''; + } + } + + $actions = apply_filters( 'media_row_actions', $actions, $post, $this->detached ); + + return $actions; + } +} + +?> diff --git a/src/wp-admin/includes/class-wp-ms-sites-list-table.php b/src/wp-admin/includes/class-wp-ms-sites-list-table.php new file mode 100644 index 0000000..baefc82 --- /dev/null +++ b/src/wp-admin/includes/class-wp-ms-sites-list-table.php @@ -0,0 +1,340 @@ + 'sites', + ) ); + } + + function ajax_user_can() { + return current_user_can( 'manage_sites' ); + } + + function prepare_items() { + global $s, $mode, $wpdb, $current_site; + + $mode = ( empty( $_REQUEST['mode'] ) ) ? 'list' : $_REQUEST['mode']; + + $per_page = $this->get_items_per_page( 'sites_network_per_page' ); + + $pagenum = $this->get_pagenum(); + + $s = isset( $_REQUEST['s'] ) ? stripslashes( trim( $_REQUEST[ 's' ] ) ) : ''; + $wild = ''; + if ( false !== strpos($s, '*') ) { + $wild = '%'; + $s = trim($s, '*'); + } + + $like_s = esc_sql( like_escape( $s ) ); + + $large_network = false; + // If the network is large and a search is not being performed, show only the latest blogs with no paging in order + // to avoid expensive count queries. + if ( !$s && ( get_blog_count() >= 10000 ) ) { + if ( !isset($_REQUEST['orderby']) ) + $_GET['orderby'] = $_REQUEST['orderby'] = ''; + if ( !isset($_REQUEST['order']) ) + $_GET['order'] = $_REQUEST['order'] = 'DESC'; + $large_network = true; + } + + $query = "SELECT * FROM {$wpdb->blogs} WHERE site_id = '{$wpdb->siteid}' "; + + if ( empty($s) ) { + // Nothing to do. + } elseif ( preg_match('/^[0-9]+\./', $s) ) { + // IP address + $reg_blog_ids = $wpdb->get_col( "SELECT blog_id FROM {$wpdb->registration_log} WHERE {$wpdb->registration_log}.IP LIKE ( '{$like_s}$wild' )" ); + + if ( !$reg_blog_ids ) + $reg_blog_ids = array( 0 ); + + $query = "SELECT * + FROM {$wpdb->blogs} + WHERE site_id = '{$wpdb->siteid}' + AND {$wpdb->blogs}.blog_id IN (" . implode( ', ', $reg_blog_ids ) . ")"; + } else { + if ( is_numeric($s) ) { + $query .= " AND ( {$wpdb->blogs}.blog_id = '{$like_s}' )"; + } elseif ( is_subdomain_install() ) { + $blog_s = str_replace( '.' . $current_site->domain, '', $like_s ); + $blog_s .= $wild . '.' . $current_site->domain; + $query .= " AND ( {$wpdb->blogs}.domain LIKE '$blog_s' ) "; + } else { + if ( $like_s != trim('/', $current_site->path) ) + $blog_s = $current_site->path . $like_s . $wild . '/'; + else + $blog_s = $like_s; + $query .= " AND ( {$wpdb->blogs}.path LIKE '$blog_s' )"; + } + } + + $order_by = isset( $_REQUEST['orderby'] ) ? $_REQUEST['orderby'] : ''; + if ( $order_by == 'registered' ) { + $query .= ' ORDER BY registered '; + } elseif ( $order_by == 'lastupdated' ) { + $query .= ' ORDER BY last_updated '; + } elseif ( $order_by == 'blogname' ) { + if ( is_subdomain_install() ) + $query .= ' ORDER BY domain '; + else + $query .= ' ORDER BY path '; + } elseif ( $order_by == 'blog_id' ) { + $query .= ' ORDER BY blog_id '; + } else { + $order_by = null; + } + + if ( isset( $order_by ) ) { + $order = ( isset( $_REQUEST['order'] ) && 'DESC' == strtoupper( $_REQUEST['order'] ) ) ? "DESC" : "ASC"; + $query .= $order; + } + + // Don't do an unbounded count on large networks + if ( ! $large_network ) + $total = $wpdb->get_var( str_replace( 'SELECT *', 'SELECT COUNT( blog_id )', $query ) ); + + $query .= " LIMIT " . intval( ( $pagenum - 1 ) * $per_page ) . ", " . intval( $per_page ); + $this->items = $wpdb->get_results( $query, ARRAY_A ); + + if ( $large_network ) + $total = count($this->items); + + $this->set_pagination_args( array( + 'total_items' => $total, + 'per_page' => $per_page, + ) ); + } + + function no_items() { + _e( 'No sites found.' ); + } + + function get_bulk_actions() { + $actions = array(); + if ( current_user_can( 'delete_sites' ) ) + $actions['delete'] = __( 'Delete' ); + $actions['spam'] = _x( 'Mark as Spam', 'site' ); + $actions['notspam'] = _x( 'Not Spam', 'site' ); + + return $actions; + } + + function pagination( $which ) { + global $mode; + + parent::pagination( $which ); + + if ( 'top' == $which ) + $this->view_switcher( $mode ); + } + + function get_columns() { + $blogname_columns = ( is_subdomain_install() ) ? __( 'Domain' ) : __( 'Path' ); + $sites_columns = array( + 'cb' => '', + 'blogname' => $blogname_columns, + 'lastupdated' => __( 'Last Updated' ), + 'registered' => _x( 'Registered', 'site' ), + 'users' => __( 'Users' ) + ); + + if ( has_filter( 'wpmublogsaction' ) ) + $sites_columns['plugins'] = __( 'Actions' ); + + $sites_columns = apply_filters( 'wpmu_blogs_columns', $sites_columns ); + + return $sites_columns; + } + + function get_sortable_columns() { + return array( + 'blogname' => 'blogname', + 'lastupdated' => 'lastupdated', + 'registered' => 'blog_id', + ); + } + + function display_rows() { + global $current_site, $mode; + + $status_list = array( + 'archived' => array( 'site-archived', __( 'Archived' ) ), + 'spam' => array( 'site-spammed', _x( 'Spam', 'site' ) ), + 'deleted' => array( 'site-deleted', __( 'Deleted' ) ), + 'mature' => array( 'site-mature', __( 'Mature' ) ) + ); + + $class = ''; + foreach ( $this->items as $blog ) { + $class = ( 'alternate' == $class ) ? '' : 'alternate'; + reset( $status_list ); + + $blog_states = array(); + foreach ( $status_list as $status => $col ) { + if ( get_blog_status( $blog['blog_id'], $status ) == 1 ) { + $class = $col[0]; + $blog_states[] = $col[1]; + } + } + $blog_state = ''; + if ( ! empty( $blog_states ) ) { + $state_count = count( $blog_states ); + $i = 0; + $blog_state .= ' - '; + foreach ( $blog_states as $state ) { + ++$i; + ( $i == $state_count ) ? $sep = '' : $sep = ', '; + $blog_state .= "$state$sep"; + } + } + echo ""; + + $blogname = ( is_subdomain_install() ) ? str_replace( '.'.$current_site->domain, '', $blog['domain'] ) : $blog['path']; + + list( $columns, $hidden ) = $this->get_column_info(); + + foreach ( $columns as $column_name => $column_display_name ) { + $style = ''; + if ( in_array( $column_name, $hidden ) ) + $style = ' style="display:none;"'; + + switch ( $column_name ) { + case 'cb': ?> + + + + "; ?> + + ' . sprintf( _x( '%1$s – %2$s', '%1$s: site name. %2$s: site tagline.' ), get_blog_option( $blog['blog_id'], 'blogname' ), get_blog_option( $blog['blog_id'], 'blogdescription ' ) ) . '

'; + + // Preordered. + $actions = array( + 'edit' => '', 'backend' => '', + 'activate' => '', 'deactivate' => '', + 'archive' => '', 'unarchive' => '', + 'spam' => '', 'unspam' => '', + 'delete' => '', + 'visit' => '', + ); + + $actions['edit'] = '' . __( 'Edit' ) . ''; + $actions['backend'] = "" . __( 'Dashboard' ) . ''; + if ( $current_site->blog_id != $blog['blog_id'] ) { + if ( get_blog_status( $blog['blog_id'], 'deleted' ) == '1' ) + $actions['activate'] = '' . __( 'Activate' ) . ''; + else + $actions['deactivate'] = '' . __( 'Deactivate' ) . ''; + + if ( get_blog_status( $blog['blog_id'], 'archived' ) == '1' ) + $actions['unarchive'] = '' . __( 'Unarchive' ) . ''; + else + $actions['archive'] = '' . _x( 'Archive', 'verb; site' ) . ''; + + if ( get_blog_status( $blog['blog_id'], 'spam' ) == '1' ) + $actions['unspam'] = '' . _x( 'Not Spam', 'site' ) . ''; + else + $actions['spam'] = '' . _x( 'Spam', 'site' ) . ''; + + if ( current_user_can( 'delete_site', $blog['blog_id'] ) ) + $actions['delete'] = '' . __( 'Delete' ) . ''; + } + + $actions['visit'] = "" . __( 'Visit' ) . ''; + + $actions = apply_filters( 'manage_sites_action_links', array_filter( $actions ), $blog['blog_id'], $blogname ); + echo $this->row_actions( $actions ); + ?> + + "; + if ( 'list' == $mode ) + $date = 'Y/m/d'; + else + $date = 'Y/m/d \<\b\r \/\> g:i:s a'; + echo ( $blog['last_updated'] == '0000-00-00 00:00:00' ) ? __( 'Never' ) : mysql2date( $date, $blog['last_updated'] ); ?> + + "; + if ( $blog['registered'] == '0000-00-00 00:00:00' ) + echo '—'; + else + echo mysql2date( $date, $blog['registered'] ); + ?> + + "; + $blogusers = get_users( array( 'blog_id' => $blog['blog_id'], 'number' => 6) ); + if ( is_array( $blogusers ) ) { + $blogusers_warning = ''; + if ( count( $blogusers ) > 5 ) { + $blogusers = array_slice( $blogusers, 0, 5 ); + $blogusers_warning = __( 'Only showing first 5 users.' ) . ' ' . __( 'More' ) . ''; + } + foreach ( $blogusers as $user_object ) { + echo '' . esc_html( $user_object->user_login ) . ' '; + if ( 'list' != $mode ) + echo '( ' . $user_object->user_email . ' )'; + echo '
'; + } + if ( $blogusers_warning != '' ) + echo '' . $blogusers_warning . '
'; + } + ?> + + + "; + do_action( 'wpmublogsaction', $blog['blog_id'] ); ?> + + "; + do_action( 'manage_sites_custom_column', $column_name, $blog['blog_id'] ); + echo ""; + break; + } + } + ?> + + diff --git a/src/wp-admin/includes/class-wp-ms-themes-list-table.php b/src/wp-admin/includes/class-wp-ms-themes-list-table.php new file mode 100644 index 0000000..cd9841d --- /dev/null +++ b/src/wp-admin/includes/class-wp-ms-themes-list-table.php @@ -0,0 +1,361 @@ +get_pagenum(); + + $screen = get_current_screen(); + $this->is_site_themes = ( 'site-themes-network' == $screen->id ) ? true : false; + + if ( $this->is_site_themes ) + $this->site_id = isset( $_REQUEST['id'] ) ? intval( $_REQUEST['id'] ) : 0; + + parent::__construct( array( + 'plural' => 'themes' + ) ); + } + + function get_table_classes() { + return array( 'widefat', 'plugins' ); // todo: remove and add CSS for .themes + } + + function ajax_user_can() { + $menu_perms = get_site_option( 'menu_items', array() ); + + if ( empty( $menu_perms['themes'] ) && ! is_super_admin() ) + return false; + + if ( $this->is_site_themes && !current_user_can('manage_sites') ) + return false; + elseif ( !$this->is_site_themes && !current_user_can('manage_network_themes') ) + return false; + return true; + } + + function prepare_items() { + global $status, $themes, $totals, $page, $orderby, $order, $s; + + wp_reset_vars( array( 'orderby', 'order', 's' ) ); + + $themes = array( + 'all' => apply_filters( 'all_themes', get_themes() ), + 'search' => array(), + 'enabled' => array(), + 'disabled' => array(), + 'upgrade' => array() + ); + + $site_allowed_themes = get_site_allowed_themes(); + if ( !$this->is_site_themes ) { + $allowed_themes = $site_allowed_themes; + $themes_per_page = $this->get_items_per_page( 'themes_network_per_page' ); + } else { + $allowed_themes = wpmu_get_blog_allowedthemes( $this->site_id ); + $themes_per_page = $this->get_items_per_page( 'site_themes_network_per_page' ); + } + + $current = get_site_transient( 'update_themes' ); + + foreach ( (array) $themes['all'] as $key => $theme ) { + $theme_key = $theme['Stylesheet']; + + if ( isset( $allowed_themes [ $theme_key ] ) ) { + $themes['all'][$key]['enabled'] = true; + $themes['enabled'][$key] = $themes['all'][$key]; + } + else { + $themes['all'][$key]['enabled'] = false; + $themes['disabled'][$key] = $themes['all'][$key]; + } + if ( isset( $current->response[ $theme['Template'] ] ) ) + $themes['upgrade'][$key] = $themes['all'][$key]; + + if ( $this->is_site_themes && isset( $site_allowed_themes[$theme_key] ) ) { + unset( $themes['all'][$key] ); + unset( $themes['enabled'][$key] ); + unset( $themes['disabled'][$key] ); + } + } + + if ( !current_user_can( 'update_themes' ) || $this->is_site_themes ) + $themes['upgrade'] = array(); + + if ( $s ) { + $status = 'search'; + $themes['search'] = array_filter( $themes['all'], array( &$this, '_search_callback' ) ); + } + + $totals = array(); + foreach ( $themes as $type => $list ) + $totals[ $type ] = count( $list ); + + if ( empty( $themes[ $status ] ) && !in_array( $status, array( 'all', 'search' ) ) ) + $status = 'all'; + + $this->items = $themes[ $status ]; + $total_this_page = $totals[ $status ]; + + if ( $orderby ) { + $orderby = ucfirst( $orderby ); + $order = strtoupper( $order ); + + uasort( $this->items, array( &$this, '_order_callback' ) ); + } + + $start = ( $page - 1 ) * $themes_per_page; + + if ( $total_this_page > $themes_per_page ) + $this->items = array_slice( $this->items, $start, $themes_per_page ); + + $this->set_pagination_args( array( + 'total_items' => $total_this_page, + 'per_page' => $themes_per_page, + ) ); + } + + function _search_callback( $theme ) { + static $term; + if ( is_null( $term ) ) + $term = stripslashes( $_REQUEST['s'] ); + + $search_fields = array( 'Name', 'Title', 'Description', 'Author', 'Author Name', 'Author URI', 'Template', 'Stylesheet' ); + foreach ( $search_fields as $field ) + if ( stripos( $theme[ $field ], $term ) !== false ) + return true; + + return false; + } + + function _order_callback( $theme_a, $theme_b ) { + global $orderby, $order; + + $a = $theme_a[$orderby]; + $b = $theme_b[$orderby]; + + if ( $a == $b ) + return 0; + + if ( 'DESC' == $order ) + return ( $a < $b ) ? 1 : -1; + else + return ( $a < $b ) ? -1 : 1; + } + + function no_items() { + global $themes; + + if ( !empty( $themes['all'] ) ) + _e( 'No themes found.' ); + else + _e( 'You do not appear to have any themes available at this time.' ); + } + + function get_columns() { + global $status; + + return array( + 'cb' => '', + 'name' => __( 'Theme' ), + 'description' => __( 'Description' ), + ); + } + + function get_sortable_columns() { + return array( + 'name' => 'name', + ); + } + + function get_views() { + global $totals, $status; + + $status_links = array(); + foreach ( $totals as $type => $count ) { + if ( !$count ) + continue; + + switch ( $type ) { + case 'all': + $text = _nx( 'All (%s)', 'All (%s)', $count, 'themes' ); + break; + case 'enabled': + $text = _n( 'Enabled (%s)', 'Enabled (%s)', $count ); + break; + case 'disabled': + $text = _n( 'Disabled (%s)', 'Disabled (%s)', $count ); + break; + case 'upgrade': + $text = _n( 'Update Available (%s)', 'Update Available (%s)', $count ); + break; + } + + if ( $this->is_site_themes ) + $url = 'site-themes.php?id=' . $this->site_id; + else + $url = 'themes.php'; + + if ( 'search' != $type ) { + $status_links[$type] = sprintf( "%s", + esc_url( add_query_arg('theme_status', $type, $url) ), + ( $type == $status ) ? ' class="current"' : '', + sprintf( $text, number_format_i18n( $count ) ) + ); + } + } + + return $status_links; + } + + function get_bulk_actions() { + global $status; + + $actions = array(); + if ( 'enabled' != $status ) + $actions['enable-selected'] = $this->is_site_themes ? __( 'Enable' ) : __( 'Network Enable' ); + if ( 'disabled' != $status ) + $actions['disable-selected'] = $this->is_site_themes ? __( 'Disable' ) : __( 'Network Disable' ); + if ( ! $this->is_site_themes ) { + if ( current_user_can( 'delete_themes' ) ) + $actions['delete-selected'] = __( 'Delete' ); + if ( current_user_can( 'update_themes' ) ) + $actions['update-selected'] = __( 'Update' ); + } + return $actions; + } + + function bulk_actions( $which ) { + global $status; + parent::bulk_actions( $which ); + } + + function current_action() { + return parent::current_action(); + } + + function display_rows() { + foreach ( $this->items as $key => $theme ) + $this->single_row( $key, $theme ); + } + + function single_row( $key, $theme ) { + global $status, $page, $s; + + $context = $status; + + if ( $this->is_site_themes ) + $url = "site-themes.php?id={$this->site_id}&"; + else + $url = 'themes.php?'; + + // preorder + $actions = array( + 'enable' => '', + 'disable' => '', + 'edit' => '', + 'delete' => '' + ); + + $theme_key = $theme['Stylesheet']; + + if ( empty( $theme['enabled'] ) ) + $actions['enable'] = '' . ( $this->is_site_themes ? __( 'Enable' ) : __( 'Network Enable' ) ) . ''; + else + $actions['disable'] = '' . ( $this->is_site_themes ? __( 'Disable' ) : __( 'Network Disable' ) ) . ''; + + if ( current_user_can('edit_themes') ) + $actions['edit'] = '' . __('Edit') . ''; + + if ( empty( $theme['enabled'] ) && current_user_can( 'delete_themes' ) && ! $this->is_site_themes && $theme_key != get_option( 'stylesheet' ) && $theme_key != get_option( 'template' ) ) + $actions['delete'] = '' . __( 'Delete' ) . ''; + + $actions = apply_filters( 'theme_action_links', array_filter( $actions ), $theme_key, $theme, $context ); + $actions = apply_filters( "theme_action_links_$theme_key", $actions, $theme_key, $theme, $context ); + + $class = empty( $theme['enabled'] ) ? 'inactive' : 'active'; + $checkbox_id = "checkbox_" . md5($theme['Name']); + $checkbox = ""; + + $description = '

' . $theme['Description'] . '

'; + $theme_name = $theme['Name']; + + $id = sanitize_title( $theme_name ); + + echo ""; + + list( $columns, $hidden ) = $this->get_column_info(); + + foreach ( $columns as $column_name => $column_display_name ) { + $style = ''; + if ( in_array( $column_name, $hidden ) ) + $style = ' style="display:none;"'; + + switch ( $column_name ) { + case 'cb': + echo ""; + break; + case 'name': + echo ""; + break; + case 'description': + echo ""; + break; + + default: + echo ""; + } + } + + echo ""; + + if ( $this->is_site_themes ) + remove_action( "after_theme_row_$theme_key", 'wp_theme_update_row' ); + do_action( 'after_theme_row', $theme_key, $theme, $status ); + do_action( "after_theme_row_$theme_key", $theme_key, $theme, $status ); + } +} + +?> diff --git a/src/wp-admin/includes/class-wp-ms-users-list-table.php b/src/wp-admin/includes/class-wp-ms-users-list-table.php new file mode 100644 index 0000000..66c41c4 --- /dev/null +++ b/src/wp-admin/includes/class-wp-ms-users-list-table.php @@ -0,0 +1,277 @@ +get_items_per_page( 'users_network_per_page' ); + + $role = isset( $_REQUEST['role'] ) ? $_REQUEST['role'] : ''; + + $paged = $this->get_pagenum(); + + $args = array( + 'number' => $users_per_page, + 'offset' => ( $paged-1 ) * $users_per_page, + 'search' => $usersearch, + 'blog_id' => 0, + 'fields' => 'all_with_meta' + ); + + $args['search'] = ltrim($args['search'], '*'); + + if ( $role == 'super' ) { + $logins = implode( "', '", get_super_admins() ); + $args['include'] = $wpdb->get_col( "SELECT ID FROM $wpdb->users WHERE user_login IN ('$logins')" ); + } + + // If the network is large and a search is not being performed, show only the latest users with no paging in order + // to avoid expensive count queries. + if ( !$usersearch && ( get_blog_count() >= 10000 ) ) { + if ( !isset($_REQUEST['orderby']) ) + $_GET['orderby'] = $_REQUEST['orderby'] = 'id'; + if ( !isset($_REQUEST['order']) ) + $_GET['order'] = $_REQUEST['order'] = 'DESC'; + $args['count_total'] = false; + } + + if ( isset( $_REQUEST['orderby'] ) ) + $args['orderby'] = $_REQUEST['orderby']; + + if ( isset( $_REQUEST['order'] ) ) + $args['order'] = $_REQUEST['order']; + + $mode = empty( $_REQUEST['mode'] ) ? 'list' : $_REQUEST['mode']; + + // Query the user IDs for this page + $wp_user_search = new WP_User_Query( $args ); + + $this->items = $wp_user_search->get_results(); + + $this->set_pagination_args( array( + 'total_items' => $wp_user_search->get_total(), + 'per_page' => $users_per_page, + ) ); + } + + function get_bulk_actions() { + $actions = array(); + if ( current_user_can( 'delete_users' ) ) + $actions['delete'] = __( 'Delete' ); + $actions['spam'] = _x( 'Mark as Spam', 'user' ); + $actions['notspam'] = _x( 'Not Spam', 'user' ); + + return $actions; + } + + function no_items() { + _e( 'No users found.' ); + } + + function get_views() { + global $wp_roles, $role; + + $total_users = get_user_count(); + $super_admins = get_super_admins(); + $total_admins = count( $super_admins ); + + $current_role = false; + $class = $role != 'super' ? ' class="current"' : ''; + $role_links = array(); + $role_links['all'] = "" . sprintf( _nx( 'All (%s)', 'All (%s)', $total_users, 'users' ), number_format_i18n( $total_users ) ) . ''; + $class = $role == 'super' ? ' class="current"' : ''; + $role_links['super'] = "" . sprintf( _n( 'Super Admin (%s)', 'Super Admins (%s)', $total_admins ), number_format_i18n( $total_admins ) ) . ''; + + return $role_links; + } + + function pagination( $which ) { + global $mode; + + parent::pagination ( $which ); + + if ( 'top' == $which ) + $this->view_switcher( $mode ); + } + + function get_columns() { + $users_columns = array( + 'cb' => '', + 'username' => __( 'Username' ), + 'name' => __( 'Name' ), + 'email' => __( 'E-mail' ), + 'registered' => _x( 'Registered', 'user' ), + 'blogs' => __( 'Sites' ) + ); + $users_columns = apply_filters( 'wpmu_users_columns', $users_columns ); + + return $users_columns; + } + + function get_sortable_columns() { + return array( + 'username' => 'login', + 'name' => 'name', + 'email' => 'email', + 'registered' => 'id', + ); + } + + function display_rows() { + global $current_site, $mode; + + $alt = ''; + $super_admins = get_super_admins(); + foreach ( $this->items as $user ) { + $alt = ( 'alternate' == $alt ) ? '' : 'alternate'; + + $status_list = array( 'spam' => 'site-spammed', 'deleted' => 'site-deleted' ); + + foreach ( $status_list as $status => $col ) { + if ( $user->$status ) + $alt .= " $col"; + } + + ?> + + get_column_info(); + + foreach ( $columns as $column_name => $column_display_name ) : + $class = "class='$column_name column-$column_name'"; + + $style = ''; + if ( in_array( $column_name, $hidden ) ) + $style = ' style="display:none;"'; + + $attributes = "$class$style"; + + + switch ( $column_name ) { + case 'cb': ?> + + user_email, 32 ); + if ( get_current_user_id() == $user->ID ) { + $edit_link = esc_url( network_admin_url( 'profile.php' ) ); + } else { + $edit_link = esc_url( network_admin_url( add_query_arg( 'wp_http_referer', urlencode( stripslashes( $_SERVER['REQUEST_URI'] ) ), 'user-edit.php?user_id=' . $user->ID ) ) ); + } + + echo " + $user->first_name $user->last_name"; + break; + + case 'email': + echo ""; + break; + + case 'registered': + if ( 'list' == $mode ) + $date = 'Y/m/d'; + else + $date = 'Y/m/d \<\b\r \/\> g:i:s a'; + + echo ""; + break; + + case 'blogs': + $blogs = get_blogs_of_user( $user->ID, true ); + echo " + "; + echo apply_filters( 'manage_users_custom_column', '', $column_name, $user->ID ); + echo ""; + break; + } + endforeach + ?> + + diff --git a/src/wp-admin/includes/class-wp-plugin-install-list-table.php b/src/wp-admin/includes/class-wp-plugin-install-list-table.php new file mode 100644 index 0000000..1f809b3 --- /dev/null +++ b/src/wp-admin/includes/class-wp-plugin-install-list-table.php @@ -0,0 +1,244 @@ +get_pagenum(); + + $per_page = 30; + + // These are the tabs which are shown on the page + $tabs = array(); + $tabs['dashboard'] = __( 'Search' ); + if ( 'search' == $tab ) + $tabs['search'] = __( 'Search Results' ); + $tabs['upload'] = __( 'Upload' ); + $tabs['featured'] = _x( 'Featured','Plugin Installer' ); + $tabs['popular'] = _x( 'Popular','Plugin Installer' ); + $tabs['new'] = _x( 'Newest','Plugin Installer' ); + $tabs['updated'] = _x( 'Recently Updated','Plugin Installer' ); + + $nonmenu_tabs = array( 'plugin-information' ); //Valid actions to perform which do not have a Menu item. + + $tabs = apply_filters( 'install_plugins_tabs', $tabs ); + $nonmenu_tabs = apply_filters( 'install_plugins_nonmenu_tabs', $nonmenu_tabs ); + + // If a non-valid menu tab has been selected, And its not a non-menu action. + if ( empty( $tab ) || ( !isset( $tabs[ $tab ] ) && !in_array( $tab, (array) $nonmenu_tabs ) ) ) + $tab = key( $tabs ); + + $args = array( 'page' => $paged, 'per_page' => $per_page ); + + switch ( $tab ) { + case 'search': + $type = isset( $_REQUEST['type'] ) ? stripslashes( $_REQUEST['type'] ) : ''; + $term = isset( $_REQUEST['s'] ) ? stripslashes( $_REQUEST['s'] ) : ''; + + switch ( $type ) { + case 'tag': + $args['tag'] = sanitize_title_with_dashes( $term ); + break; + case 'term': + $args['search'] = $term; + break; + case 'author': + $args['author'] = $term; + break; + } + + add_action( 'install_plugins_table_header', 'install_search_form' ); + break; + + case 'featured': + case 'popular': + case 'new': + case 'updated': + $args['browse'] = $tab; + break; + + default: + $args = false; + } + + if ( !$args ) + return; + + $api = plugins_api( 'query_plugins', $args ); + + if ( is_wp_error( $api ) ) + wp_die( $api->get_error_message() . '

' . __( 'Try again' ) . '' ); + + $this->items = $api->plugins; + + $this->set_pagination_args( array( + 'total_items' => $api->info['results'], + 'per_page' => $per_page, + ) ); + } + + function no_items() { + _e( 'No plugins match your request.' ); + } + + function get_views() { + global $tabs, $tab; + + $display_tabs = array(); + foreach ( (array) $tabs as $action => $text ) { + $class = ( $action == $tab ) ? ' class="current"' : ''; + $href = self_admin_url('plugin-install.php?tab=' . $action); + $display_tabs['plugin-install-'.$action] = "$text"; + } + + return $display_tabs; + } + + function display_tablenav( $which ) { + if ( 'top' == $which ) { ?> +

+
+ +
+ pagination( $which ); ?> + +
+
+ +
+ pagination( $which ); ?> + +
+
+ _args ); + + return array( 'widefat', $plural ); + } + + function get_columns() { + return array( + 'name' => _x( 'Name', 'plugin name' ), + 'version' => __( 'Version' ), + 'rating' => __( 'Rating' ), + 'description' => __( 'Description' ), + ); + } + + function display_rows() { + $plugins_allowedtags = array( + 'a' => array( 'href' => array(),'title' => array(), 'target' => array() ), + 'abbr' => array( 'title' => array() ),'acronym' => array( 'title' => array() ), + 'code' => array(), 'pre' => array(), 'em' => array(),'strong' => array(), + 'ul' => array(), 'ol' => array(), 'li' => array(), 'p' => array(), 'br' => array() + ); + + list( $columns, $hidden ) = $this->get_column_info(); + + $style = array(); + foreach ( $columns as $column_name => $column_display_name ) { + $style[ $column_name ] = in_array( $column_name, $hidden ) ? 'style="display:none;"' : ''; + } + + foreach ( (array) $this->items as $plugin ) { + if ( is_object( $plugin ) ) + $plugin = (array) $plugin; + + $title = wp_kses( $plugin['name'], $plugins_allowedtags ); + //Limit description to 400char, and remove any HTML. + $description = strip_tags( $plugin['description'] ); + if ( strlen( $description ) > 400 ) + $description = mb_substr( $description, 0, 400 ) . '…'; + //remove any trailing entities + $description = preg_replace( '/&[^;\s]{0,6}$/', '', $description ); + //strip leading/trailing & multiple consecutive lines + $description = trim( $description ); + $description = preg_replace( "|(\r?\n)+|", "\n", $description ); + //\n =>
+ $description = nl2br( $description ); + $version = wp_kses( $plugin['version'], $plugins_allowedtags ); + + $name = strip_tags( $title . ' ' . $version ); + + $author = $plugin['author']; + if ( ! empty( $plugin['author'] ) ) + $author = ' ' . sprintf( __( 'By %s' ), $author ) . '.'; + + $author = wp_kses( $author, $plugins_allowedtags ); + + $action_links = array(); + $action_links[] = '' . __( 'Details' ) . ''; + + if ( current_user_can( 'install_plugins' ) || current_user_can( 'update_plugins' ) ) { + $status = install_plugin_install_status( $plugin ); + + switch ( $status['status'] ) { + case 'install': + if ( $status['url'] ) + $action_links[] = '' . __( 'Install Now' ) . ''; + break; + case 'update_available': + if ( $status['url'] ) + $action_links[] = '' . sprintf( __( 'Update Now' ), $status['version'] ) . ''; + break; + case 'latest_installed': + case 'newer_installed': + $action_links[] = '' . __( 'Installed' ) . ''; + break; + } + } + + $action_links = apply_filters( 'plugin_install_action_links', $action_links, $plugin ); + ?> + + + + + + + diff --git a/src/wp-admin/includes/class-wp-plugins-list-table.php b/src/wp-admin/includes/class-wp-plugins-list-table.php new file mode 100644 index 0000000..99ce212 --- /dev/null +++ b/src/wp-admin/includes/class-wp-plugins-list-table.php @@ -0,0 +1,458 @@ +get_pagenum(); + + parent::__construct( array( + 'plural' => 'plugins', + ) ); + } + + function get_table_classes() { + return array( 'widefat', $this->_args['plural'] ); + } + + function ajax_user_can() { + if ( is_multisite() ) { + $menu_perms = get_site_option( 'menu_items', array() ); + + if ( empty( $menu_perms['plugins'] ) && ! is_super_admin() ) + return false; + } + + return current_user_can('activate_plugins'); + } + + function prepare_items() { + global $status, $plugins, $totals, $page, $orderby, $order, $s; + + wp_reset_vars( array( 'orderby', 'order', 's' ) ); + + $plugins = array( + 'all' => apply_filters( 'all_plugins', get_plugins() ), + 'search' => array(), + 'active' => array(), + 'inactive' => array(), + 'recently_activated' => array(), + 'upgrade' => array(), + 'mustuse' => array(), + 'dropins' => array() + ); + + $screen = get_current_screen(); + + if ( ! is_multisite() || ( $screen->is_network && current_user_can('manage_network_plugins') ) ) { + if ( apply_filters( 'show_advanced_plugins', true, 'mustuse' ) ) + $plugins['mustuse'] = get_mu_plugins(); + if ( apply_filters( 'show_advanced_plugins', true, 'dropins' ) ) + $plugins['dropins'] = get_dropins(); + + $current = get_site_transient( 'update_plugins' ); + foreach ( (array) $plugins['all'] as $plugin_file => $plugin_data ) { + if ( isset( $current->response[ $plugin_file ] ) ) + $plugins['upgrade'][ $plugin_file ] = $plugin_data; + } + } + + set_transient( 'plugin_slugs', array_keys( $plugins['all'] ), 86400 ); + + $recently_activated = get_option( 'recently_activated', array() ); + + $one_week = 7*24*60*60; + foreach ( $recently_activated as $key => $time ) + if ( $time + $one_week < time() ) + unset( $recently_activated[$key] ); + update_option( 'recently_activated', $recently_activated ); + + foreach ( (array) $plugins['all'] as $plugin_file => $plugin_data ) { + // Filter into individual sections + if ( is_multisite() && is_network_only_plugin( $plugin_file ) && !$screen->is_network ) { + unset( $plugins['all'][ $plugin_file] ); + } elseif ( is_plugin_active_for_network($plugin_file) && !$screen->is_network ) { + unset( $plugins['all'][ $plugin_file ] ); + } elseif ( is_multisite() && is_network_only_plugin( $plugin_file ) && !current_user_can( 'manage_network_plugins' ) ) { + $plugins['network'][ $plugin_file ] = $plugin_data; + } elseif ( ( !$screen->is_network && is_plugin_active( $plugin_file ) ) + || ( $screen->is_network && is_plugin_active_for_network( $plugin_file ) ) ) { + $plugins['active'][ $plugin_file ] = $plugin_data; + } else { + if ( !$screen->is_network && isset( $recently_activated[ $plugin_file ] ) ) // Was the plugin recently activated? + $plugins['recently_activated'][ $plugin_file ] = $plugin_data; + $plugins['inactive'][ $plugin_file ] = $plugin_data; + } + } + + if ( !current_user_can( 'update_plugins' ) ) + $plugins['upgrade'] = array(); + + if ( $s ) { + $status = 'search'; + $plugins['search'] = array_filter( $plugins['all'], array( &$this, '_search_callback' ) ); + } + + $totals = array(); + foreach ( $plugins as $type => $list ) + $totals[ $type ] = count( $list ); + + if ( empty( $plugins[ $status ] ) && !in_array( $status, array( 'all', 'search' ) ) ) + $status = 'all'; + + $this->items = array(); + foreach ( $plugins[ $status ] as $plugin_file => $plugin_data ) { + // Translate, Don't Apply Markup, Sanitize HTML + $this->items[$plugin_file] = _get_plugin_data_markup_translate( $plugin_file, $plugin_data, false, true ); + } + + $total_this_page = $totals[ $status ]; + + if ( $orderby ) { + $orderby = ucfirst( $orderby ); + $order = strtoupper( $order ); + + uasort( $this->items, array( &$this, '_order_callback' ) ); + } + + $plugins_per_page = $this->get_items_per_page( str_replace( '-', '_', $screen->id . '_per_page' ), 999 ); + + $start = ( $page - 1 ) * $plugins_per_page; + + if ( $total_this_page > $plugins_per_page ) + $this->items = array_slice( $this->items, $start, $plugins_per_page ); + + $this->set_pagination_args( array( + 'total_items' => $total_this_page, + 'per_page' => $plugins_per_page, + ) ); + } + + function _search_callback( $plugin ) { + static $term; + if ( is_null( $term ) ) + $term = stripslashes( $_REQUEST['s'] ); + + foreach ( $plugin as $value ) + if ( stripos( $value, $term ) !== false ) + return true; + + return false; + } + + function _order_callback( $plugin_a, $plugin_b ) { + global $orderby, $order; + + $a = $plugin_a[$orderby]; + $b = $plugin_b[$orderby]; + + if ( $a == $b ) + return 0; + + if ( 'DESC' == $order ) + return ( $a < $b ) ? 1 : -1; + else + return ( $a < $b ) ? -1 : 1; + } + + function no_items() { + global $plugins; + + if ( !empty( $plugins['all'] ) ) + _e( 'No plugins found.' ); + else + _e( 'You do not appear to have any plugins available at this time.' ); + } + + function get_columns() { + global $status; + + return array( + 'cb' => !in_array( $status, array( 'mustuse', 'dropins' ) ) ? '' : '', + 'name' => __( 'Plugin' ), + 'description' => __( 'Description' ), + ); + } + + function get_sortable_columns() { + return array(); + } + + function get_views() { + global $totals, $status; + + $status_links = array(); + foreach ( $totals as $type => $count ) { + if ( !$count ) + continue; + + switch ( $type ) { + case 'all': + $text = _nx( 'All (%s)', 'All (%s)', $count, 'plugins' ); + break; + case 'active': + $text = _n( 'Active (%s)', 'Active (%s)', $count ); + break; + case 'recently_activated': + $text = _n( 'Recently Active (%s)', 'Recently Active (%s)', $count ); + break; + case 'inactive': + $text = _n( 'Inactive (%s)', 'Inactive (%s)', $count ); + break; + case 'network': + $text = _n( 'Network (%s)', 'Network (%s)', $count ); + break; + case 'mustuse': + $text = _n( 'Must-Use (%s)', 'Must-Use (%s)', $count ); + break; + case 'dropins': + $text = _n( 'Drop-ins (%s)', 'Drop-ins (%s)', $count ); + break; + case 'upgrade': + $text = _n( 'Update Available (%s)', 'Update Available (%s)', $count ); + break; + } + + if ( 'search' != $type ) { + $status_links[$type] = sprintf( "%s", + add_query_arg('plugin_status', $type, 'plugins.php'), + ( $type == $status ) ? ' class="current"' : '', + sprintf( $text, number_format_i18n( $count ) ) + ); + } + } + + return $status_links; + } + + function get_bulk_actions() { + global $status; + + $actions = array(); + + $screen = get_current_screen(); + + if ( 'active' != $status ) { + $action = $screen->is_network ? 'network-activate-selected' : 'activate-selected'; + $actions[ $action ] = __( 'Activate' ); + } + + if ( 'inactive' != $status && 'recent' != $status ) + $actions['deactivate-selected'] = __( 'Deactivate' ); + + if ( !is_multisite() || $screen->is_network ) { + if ( current_user_can( 'update_plugins' ) ) + $actions['update-selected'] = __( 'Update' ); + if ( current_user_can( 'delete_plugins' ) && ( 'active' != $status ) ) + $actions['delete-selected'] = __( 'Delete' ); + } + + return $actions; + } + + function bulk_actions( $which ) { + global $status; + + if ( in_array( $status, array( 'mustuse', 'dropins' ) ) ) + return; + + parent::bulk_actions( $which ); + } + + function extra_tablenav( $which ) { + global $status; + + if ( ! in_array($status, array('recently_activated', 'mustuse', 'dropins') ) ) + return; + + echo '
'; + + if ( 'recently_activated' == $status ) + submit_button( __( 'Clear List' ), 'secondary', 'clear-recent-list', false ); + elseif ( 'top' == $which && 'mustuse' == $status ) + echo '

' . sprintf( __( 'Files in the %s directory are executed automatically.' ), str_replace( ABSPATH, '/', WPMU_PLUGIN_DIR ) ) . '

'; + elseif ( 'top' == $which && 'dropins' == $status ) + echo '

' . sprintf( __( 'Drop-ins are advanced plugins in the %s directory that replace WordPress functionality when present.' ), str_replace( ABSPATH, '', WP_CONTENT_DIR ) ) . '

'; + + echo '
'; + } + + function current_action() { + if ( isset($_POST['clear-recent-list']) ) + return 'clear-recent-list'; + + return parent::current_action(); + } + + function display_rows() { + global $status; + + $screen = get_current_screen(); + + if ( is_multisite() && !$screen->is_network && in_array( $status, array( 'mustuse', 'dropins' ) ) ) + return; + + foreach ( $this->items as $plugin_file => $plugin_data ) + $this->single_row( $plugin_file, $plugin_data ); + } + + function single_row( $plugin_file, $plugin_data ) { + global $status, $page, $s; + + $context = $status; + + $screen = get_current_screen(); + + // preorder + $actions = array( + 'network_deactivate' => '', 'deactivate' => '', + 'network_only' => '', 'activate' => '', + 'network_activate' => '', + 'edit' => '', + 'delete' => '', + ); + + if ( 'mustuse' == $context ) { + $is_active = true; + } elseif ( 'dropins' == $context ) { + $dropins = _get_dropins(); + $plugin_name = $plugin_file; + if ( $plugin_file != $plugin_data['Name'] ) + $plugin_name .= '
' . $plugin_data['Name']; + if ( true === ( $dropins[ $plugin_file ][1] ) ) { // Doesn't require a constant + $is_active = true; + $description = '

' . $dropins[ $plugin_file ][0] . '

'; + } elseif ( constant( $dropins[ $plugin_file ][1] ) ) { // Constant is true + $is_active = true; + $description = '

' . $dropins[ $plugin_file ][0] . '

'; + } else { + $is_active = false; + $description = '

' . $dropins[ $plugin_file ][0] . ' ' . __('Inactive:') . ' ' . sprintf( __( 'Requires %s in wp-config.php.' ), "define('" . $dropins[ $plugin_file ][1] . "', true);" ) . '

'; + } + if ( $plugin_data['Description'] ) + $description .= '

' . $plugin_data['Description'] . '

'; + } else { + $is_active_for_network = is_plugin_active_for_network($plugin_file); + if ( $screen->is_network ) + $is_active = $is_active_for_network; + else + $is_active = is_plugin_active( $plugin_file ); + + if ( $is_active_for_network && !is_super_admin() && !$screen->is_network ) + return; + + if ( $screen->is_network ) { + if ( $is_active_for_network ) { + if ( current_user_can( 'manage_network_plugins' ) ) + $actions['network_deactivate'] = '' . __('Network Deactivate') . ''; + } else { + if ( current_user_can( 'manage_network_plugins' ) ) + $actions['network_activate'] = '' . __('Network Activate') . ''; + if ( current_user_can( 'delete_plugins' ) && ! is_plugin_active( $plugin_file ) ) + $actions['delete'] = '' . __('Delete') . ''; + } + } else { + if ( $is_active ) { + $actions['deactivate'] = '' . __('Deactivate') . ''; + } else { + $actions['activate'] = '' . __('Activate') . ''; + + if ( ! is_multisite() && current_user_can('delete_plugins') ) + $actions['delete'] = '' . __('Delete') . ''; + } // end if $is_active + } // end if $screen->is_network + + if ( ( ! is_multisite() || $screen->is_network ) && current_user_can('edit_plugins') && is_writable(WP_PLUGIN_DIR . '/' . $plugin_file) ) + $actions['edit'] = '' . __('Edit') . ''; + } // end if $context + + $prefix = $screen->is_network ? 'network_admin_' : ''; + $actions = apply_filters( $prefix . 'plugin_action_links', array_filter( $actions ), $plugin_file, $plugin_data, $context ); + $actions = apply_filters( $prefix . "plugin_action_links_$plugin_file", $actions, $plugin_file, $plugin_data, $context ); + + $class = $is_active ? 'active' : 'inactive'; + $checkbox_id = "checkbox_" . md5($plugin_data['Name']); + $checkbox = in_array( $status, array( 'mustuse', 'dropins' ) ) ? '' : ""; + if ( 'dropins' != $context ) { + $description = '

' . ( $plugin_data['Description'] ? $plugin_data['Description'] : ' ' ) . '

'; + $plugin_name = $plugin_data['Name']; + } + + $id = sanitize_title( $plugin_name ); + + echo ""; + + list( $columns, $hidden ) = $this->get_column_info(); + + foreach ( $columns as $column_name => $column_display_name ) { + $style = ''; + if ( in_array( $column_name, $hidden ) ) + $style = ' style="display:none;"'; + + switch ( $column_name ) { + case 'cb': + echo ""; + break; + case 'name': + echo ""; + break; + case 'description': + echo ""; + break; + default: + echo ""; + } + } + + echo ""; + + do_action( 'after_plugin_row', $plugin_file, $plugin_data, $status ); + do_action( "after_plugin_row_$plugin_file", $plugin_file, $plugin_data, $status ); + } +} + +?> diff --git a/src/wp-admin/includes/class-wp-posts-list-table.php b/src/wp-admin/includes/class-wp-posts-list-table.php new file mode 100644 index 0000000..bdd24a6 --- /dev/null +++ b/src/wp-admin/includes/class-wp-posts-list-table.php @@ -0,0 +1,1021 @@ + true ) ) ) ) + $post_type = $_REQUEST['post_type']; + else + wp_die( __( 'Invalid post type' ) ); + $_REQUEST['post_type'] = $post_type; + + $post_type_object = get_post_type_object( $post_type ); + + if ( !current_user_can( $post_type_object->cap->edit_others_posts ) ) { + $this->user_posts_count = $wpdb->get_var( $wpdb->prepare( " + SELECT COUNT( 1 ) FROM $wpdb->posts + WHERE post_type = %s AND post_status NOT IN ( 'trash', 'auto-draft' ) + AND post_author = %d + ", $post_type, get_current_user_id() ) ); + + if ( $this->user_posts_count && empty( $_REQUEST['post_status'] ) && empty( $_REQUEST['all_posts'] ) && empty( $_REQUEST['author'] ) && empty( $_REQUEST['show_sticky'] ) ) + $_GET['author'] = get_current_user_id(); + } + + if ( 'post' == $post_type && $sticky_posts = get_option( 'sticky_posts' ) ) { + $sticky_posts = implode( ', ', array_map( 'absint', (array) $sticky_posts ) ); + $this->sticky_posts_count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT( 1 ) FROM $wpdb->posts WHERE post_type = %s AND post_status != 'trash' AND ID IN ($sticky_posts)", $post_type ) ); + } + + parent::__construct( array( + 'plural' => 'posts', + ) ); + } + + function ajax_user_can() { + global $post_type_object; + + return current_user_can( $post_type_object->cap->edit_posts ); + } + + function prepare_items() { + global $post_type_object, $post_type, $avail_post_stati, $wp_query, $per_page, $mode; + + $avail_post_stati = wp_edit_posts_query(); + + $this->hierarchical_display = ( $post_type_object->hierarchical && 'menu_order title' == $wp_query->query['orderby'] ); + + $total_items = $this->hierarchical_display ? $wp_query->post_count : $wp_query->found_posts; + + $per_page = $this->get_items_per_page( 'edit_' . $post_type . '_per_page' ); + $per_page = apply_filters( 'edit_posts_per_page', $per_page, $post_type ); + + if ( $this->hierarchical_display ) + $total_pages = ceil( $total_items / $per_page ); + else + $total_pages = $wp_query->max_num_pages; + + $mode = empty( $_REQUEST['mode'] ) ? 'list' : $_REQUEST['mode']; + + $this->is_trash = isset( $_REQUEST['post_status'] ) && $_REQUEST['post_status'] == 'trash'; + + $this->set_pagination_args( array( + 'total_items' => $total_items, + 'total_pages' => $total_pages, + 'per_page' => $per_page + ) ); + } + + function has_items() { + return have_posts(); + } + + function no_items() { + global $post_type_object; + + if ( isset( $_REQUEST['post_status'] ) && 'trash' == $_REQUEST['post_status'] ) + echo $post_type_object->labels->not_found_in_trash; + else + echo $post_type_object->labels->not_found; + } + + function get_views() { + global $post_type, $post_type_object, $locked_post_status, $avail_post_stati; + + if ( !empty($locked_post_status) ) + return array(); + + $status_links = array(); + $num_posts = wp_count_posts( $post_type, 'readable' ); + $class = ''; + $allposts = ''; + + $current_user_id = get_current_user_id(); + + if ( $this->user_posts_count ) { + if ( isset( $_GET['author'] ) && ( $_GET['author'] == $current_user_id ) ) + $class = ' class="current"'; + $status_links['mine'] = "" . sprintf( _nx( 'Mine (%s)', 'Mine (%s)', $this->user_posts_count, 'posts' ), number_format_i18n( $this->user_posts_count ) ) . ''; + $allposts = '&all_posts=1'; + } + + $total_posts = array_sum( (array) $num_posts ); + + // Subtract post types that are not included in the admin all list. + foreach ( get_post_stati( array('show_in_admin_all_list' => false) ) as $state ) + $total_posts -= $num_posts->$state; + + $class = empty( $class ) && empty( $_REQUEST['post_status'] ) && empty( $_REQUEST['show_sticky'] ) ? ' class="current"' : ''; + $status_links['all'] = "" . sprintf( _nx( 'All (%s)', 'All (%s)', $total_posts, 'posts' ), number_format_i18n( $total_posts ) ) . ''; + + foreach ( get_post_stati(array('show_in_admin_status_list' => true), 'objects') as $status ) { + $class = ''; + + $status_name = $status->name; + + if ( !in_array( $status_name, $avail_post_stati ) ) + continue; + + if ( empty( $num_posts->$status_name ) ) + continue; + + if ( isset($_REQUEST['post_status']) && $status_name == $_REQUEST['post_status'] ) + $class = ' class="current"'; + + $status_links[$status_name] = "" . sprintf( translate_nooped_plural( $status->label_count, $num_posts->$status_name ), number_format_i18n( $num_posts->$status_name ) ) . ''; + } + + if ( ! empty( $this->sticky_posts_count ) ) { + $class = ! empty( $_REQUEST['show_sticky'] ) ? ' class="current"' : ''; + + $sticky_link = array( 'sticky' => "" . sprintf( _nx( 'Sticky (%s)', 'Sticky (%s)', $this->sticky_posts_count, 'posts' ), number_format_i18n( $this->sticky_posts_count ) ) . '' ); + + // Sticky comes after Publish, or if not listed, after All. + $split = 1 + array_search( ( isset( $status_links['publish'] ) ? 'publish' : 'all' ), array_keys( $status_links ) ); + $status_links = array_merge( array_slice( $status_links, 0, $split ), $sticky_link, array_slice( $status_links, $split ) ); + } + + return $status_links; + } + + function get_bulk_actions() { + $actions = array(); + + if ( $this->is_trash ) + $actions['untrash'] = __( 'Restore' ); + else + $actions['edit'] = __( 'Edit' ); + + if ( $this->is_trash || !EMPTY_TRASH_DAYS ) + $actions['delete'] = __( 'Delete Permanently' ); + else + $actions['trash'] = __( 'Move to Trash' ); + + return $actions; + } + + function extra_tablenav( $which ) { + global $post_type, $post_type_object, $cat; +?> +
+months_dropdown( $post_type ); + + if ( is_object_in_taxonomy( $post_type, 'category' ) ) { + $dropdown_options = array( + 'show_option_all' => __( 'View all categories' ), + 'hide_empty' => 0, + 'hierarchical' => 1, + 'show_count' => 0, + 'orderby' => 'name', + 'selected' => $cat + ); + wp_dropdown_categories( $dropdown_options ); + } + do_action( 'restrict_manage_posts' ); + submit_button( __( 'Filter' ), 'secondary', false, false, array( 'id' => 'post-query-submit' ) ); + } + + if ( $this->is_trash && current_user_can( $post_type_object->cap->edit_others_posts ) ) { + submit_button( __( 'Empty Trash' ), 'button-secondary apply', 'delete_all', false ); + } +?> +
+hierarchical ) + $this->view_switcher( $mode ); + } + + function get_table_classes() { + global $post_type_object; + + return array( 'widefat', 'fixed', $post_type_object->hierarchical ? 'pages' : 'posts' ); + } + + function get_columns() { + $screen = get_current_screen(); + + if ( empty( $screen ) ) + $post_type = 'post'; + else + $post_type = $screen->post_type; + + $posts_columns = array(); + + $posts_columns['cb'] = ''; + + /* translators: manage posts column name */ + $posts_columns['title'] = _x( 'Title', 'column name' ); + + if ( post_type_supports( $post_type, 'author' ) ) + $posts_columns['author'] = __( 'Author' ); + + if ( empty( $post_type ) || is_object_in_taxonomy( $post_type, 'category' ) ) + $posts_columns['categories'] = __( 'Categories' ); + + if ( empty( $post_type ) || is_object_in_taxonomy( $post_type, 'post_tag' ) ) + $posts_columns['tags'] = __( 'Tags' ); + + $post_status = !empty( $_REQUEST['post_status'] ) ? $_REQUEST['post_status'] : 'all'; + if ( post_type_supports( $post_type, 'comments' ) && !in_array( $post_status, array( 'pending', 'draft', 'future' ) ) ) + $posts_columns['comments'] = '' . esc_attr__( 'Comments' ) . ''; + + $posts_columns['date'] = __( 'Date' ); + + if ( 'page' == $post_type ) + $posts_columns = apply_filters( 'manage_pages_columns', $posts_columns ); + else + $posts_columns = apply_filters( 'manage_posts_columns', $posts_columns, $post_type ); + $posts_columns = apply_filters( "manage_{$post_type}_posts_columns", $posts_columns ); + + return $posts_columns; + } + + function get_sortable_columns() { + return array( + 'title' => 'title', + 'author' => 'author', + 'parent' => 'parent', + 'comments' => 'comment_count', + 'date' => array( 'date', true ) + ); + } + + function display_rows( $posts = array() ) { + global $wp_query, $post_type_object, $per_page; + + if ( empty( $posts ) ) + $posts = $wp_query->posts; + + add_filter( 'the_title', 'esc_html' ); + + if ( $this->hierarchical_display ) { + $this->_display_rows_hierarchical( $posts, $this->get_pagenum(), $per_page ); + } else { + $this->_display_rows( $posts ); + } + } + + function _display_rows( $posts ) { + global $post, $mode; + + // Create array of post IDs. + $post_ids = array(); + + foreach ( $posts as $a_post ) + $post_ids[] = $a_post->ID; + + $this->comment_pending_count = get_pending_comments_num( $post_ids ); + + foreach ( $posts as $post ) + $this->single_row( $post ); + } + + function _display_rows_hierarchical( $pages, $pagenum = 1, $per_page = 20 ) { + global $wpdb; + + $level = 0; + + if ( ! $pages ) { + $pages = get_pages( array( 'sort_column' => 'menu_order' ) ); + + if ( ! $pages ) + return false; + } + + /* + * arrange pages into two parts: top level pages and children_pages + * children_pages is two dimensional array, eg. + * children_pages[10][] contains all sub-pages whose parent is 10. + * It only takes O( N ) to arrange this and it takes O( 1 ) for subsequent lookup operations + * If searching, ignore hierarchy and treat everything as top level + */ + if ( empty( $_REQUEST['s'] ) ) { + + $top_level_pages = array(); + $children_pages = array(); + + foreach ( $pages as $page ) { + + // catch and repair bad pages + if ( $page->post_parent == $page->ID ) { + $page->post_parent = 0; + $wpdb->update( $wpdb->posts, array( 'post_parent' => 0 ), array( 'ID' => $page->ID ) ); + clean_page_cache( $page->ID ); + } + + if ( 0 == $page->post_parent ) + $top_level_pages[] = $page; + else + $children_pages[ $page->post_parent ][] = $page; + } + + $pages = &$top_level_pages; + } + + $count = 0; + $start = ( $pagenum - 1 ) * $per_page; + $end = $start + $per_page; + + foreach ( $pages as $page ) { + if ( $count >= $end ) + break; + + if ( $count >= $start ) + echo "\t" . $this->single_row( $page, $level ); + + $count++; + + if ( isset( $children_pages ) ) + $this->_page_rows( $children_pages, $count, $page->ID, $level + 1, $pagenum, $per_page ); + } + + // if it is the last pagenum and there are orphaned pages, display them with paging as well + if ( isset( $children_pages ) && $count < $end ){ + foreach ( $children_pages as $orphans ){ + foreach ( $orphans as $op ) { + if ( $count >= $end ) + break; + if ( $count >= $start ) + echo "\t" . $this->single_row( $op, 0 ); + $count++; + } + } + } + } + + /** + * Given a top level page ID, display the nested hierarchy of sub-pages + * together with paging support + * + * @since 3.1.0 (Standalone function exists since 2.6.0) + * + * @param unknown_type $children_pages + * @param unknown_type $count + * @param unknown_type $parent + * @param unknown_type $level + * @param unknown_type $pagenum + * @param unknown_type $per_page + */ + function _page_rows( &$children_pages, &$count, $parent, $level, $pagenum, $per_page ) { + + if ( ! isset( $children_pages[$parent] ) ) + return; + + $start = ( $pagenum - 1 ) * $per_page; + $end = $start + $per_page; + + foreach ( $children_pages[$parent] as $page ) { + + if ( $count >= $end ) + break; + + // If the page starts in a subtree, print the parents. + if ( $count == $start && $page->post_parent > 0 ) { + $my_parents = array(); + $my_parent = $page->post_parent; + while ( $my_parent ) { + $my_parent = get_post( $my_parent ); + $my_parents[] = $my_parent; + if ( !$my_parent->post_parent ) + break; + $my_parent = $my_parent->post_parent; + } + $num_parents = count( $my_parents ); + while ( $my_parent = array_pop( $my_parents ) ) { + echo "\t" . $this->single_row( $my_parent, $level - $num_parents ); + $num_parents--; + } + } + + if ( $count >= $start ) + echo "\t" . $this->single_row( $page, $level ); + + $count++; + + $this->_page_rows( $children_pages, $count, $page->ID, $level + 1, $pagenum, $per_page ); + } + + unset( $children_pages[$parent] ); //required in order to keep track of orphans + } + + function single_row( $a_post, $level = 0 ) { + global $post, $current_screen, $mode; + static $rowclass; + + $global_post = $post; + $post = $a_post; + setup_postdata( $post ); + + $rowclass = 'alternate' == $rowclass ? '' : 'alternate'; + $post_owner = ( get_current_user_id() == $post->post_author ? 'self' : 'other' ); + $edit_link = get_edit_post_link( $post->ID ); + $title = _draft_or_post_title(); + $post_type_object = get_post_type_object( $post->post_type ); + $can_edit_post = current_user_can( $post_type_object->cap->edit_post, $post->ID ); + $post_format = get_post_format( $post->ID ); + $post_format_class = ( $post_format && !is_wp_error($post_format) ) ? 'format-' . sanitize_html_class( $post_format ) : 'format-default'; + ?> + post_status . ' ' . $post_format_class); ?> iedit' valign="top"> + get_column_info(); + + foreach ( $columns as $column_name => $column_display_name ) { + $class = "class=\"$column_name column-$column_name\""; + + $style = ''; + if ( in_array( $column_name, $hidden ) ) + $style = ' style="display:none;"'; + + $attributes = "$class$style"; + + switch ( $column_name ) { + + case 'cb': + ?> + + hierarchical_display ) { + $attributes = 'class="post-title page-title column-title"' . $style; + + if ( 0 == $level && (int) $post->post_parent > 0 ) { + //sent level 0 by accident, by default, or because we don't know the actual level + $find_main_page = (int) $post->post_parent; + while ( $find_main_page > 0 ) { + $parent = get_page( $find_main_page ); + + if ( is_null( $parent ) ) + break; + + $level++; + $find_main_page = (int) $parent->post_parent; + + if ( !isset( $parent_name ) ) + $parent_name = apply_filters( 'the_title', $parent->post_title, $parent->ID ); + } + } + + $pad = str_repeat( '— ', $level ); +?> + '; + break; + + case 'date': + if ( '0000-00-00 00:00:00' == $post->post_date && 'date' == $column_name ) { + $t_time = $h_time = __( 'Unpublished' ); + $time_diff = 0; + } else { + $t_time = get_the_time( __( 'Y/m/d g:i:s A' ) ); + $m_time = $post->post_date; + $time = get_post_time( 'G', true, $post ); + + $time_diff = time() - $time; + + if ( $time_diff > 0 && $time_diff < 24*60*60 ) + $h_time = sprintf( __( '%s ago' ), human_time_diff( $time ) ); + else + $h_time = mysql2date( __( 'Y/m/d' ), $m_time ); + } + + echo ''; + break; + + case 'categories': + ?> + + + + + + + + + + + + post_type ); + $post_type_object = get_post_type_object( $screen->post_type ); + + $taxonomy_names = get_object_taxonomies( $screen->post_type ); + $hierarchical_taxonomies = array(); + $flat_taxonomies = array(); + foreach ( $taxonomy_names as $taxonomy_name ) { + $taxonomy = get_taxonomy( $taxonomy_name ); + + if ( !$taxonomy->show_ui ) + continue; + + if ( $taxonomy->hierarchical ) + $hierarchical_taxonomies[] = $taxonomy; + else + $flat_taxonomies[] = $taxonomy; + } + + $m = ( isset( $mode ) && 'excerpt' == $mode ) ? 'excerpt' : 'list'; + $can_publish = current_user_can( $post_type_object->cap->publish_posts ); + $core_columns = array( 'cb' => true, 'date' => true, 'title' => true, 'categories' => true, 'tags' => true, 'comments' => true, 'author' => true ); + + ?> + +
'; + $this->no_items(); + echo '
'; + echo $this->column_cb( $item ); + echo '"; + echo call_user_func( array( &$this, 'column_' . $column_name ), $item ); + echo ""; + echo $this->column_default( $item, $column_name ); + echo "
ID ) ) { ?>>ID, array( 80, 60 ), true ) ) { + if ( $this->is_trash ) { + echo $thumb; + } else { +?> + + + + + + >is_trash ) echo $att_title; else { ?> +

+ID ), $matches ) ) + echo esc_html( strtoupper( $matches[1] ) ); + else + echo strtoupper( str_replace( 'image/', '', get_post_mime_type() ) ); +?> +

+row_actions( $this->_get_row_actions( $post, $att_title ) ); +?> +
>>slug'> " . esc_html( sanitize_term_field( 'name', $c->name, $c->term_id, 'post_tag', 'display' ) ) . ""; + echo join( ', ', $out ); + } else { + _e( 'No Tags' ); + } +?> + >post_excerpt : ''; ?>>> + , + + >
+
> +
+ID ); + + $this->comments_bubble( $post->ID, $pending_comments ); +?> +
+
> + +
+ + + +
$checkbox$theme_name"; + echo $this->row_actions( $actions, true ); + echo " +
$description
+
"; + + $theme_meta = array(); + + if ( !empty( $theme['Version'] ) ) + $theme_meta[] = sprintf( __( 'Version %s' ), $theme['Version'] ); + + if ( !empty( $theme['Author'] ) ) + $theme_meta[] = sprintf( __( 'By %s' ), $theme['Author'] ); + + if ( !empty( $theme['Theme URI'] ) ) + $theme_meta[] = '' . __( 'Visit Theme Site' ) . ''; + + $theme_meta = apply_filters( 'theme_row_meta', $theme_meta, $theme_key, $theme, $status ); + echo implode( ' | ', $theme_meta ); + + echo "
"; + do_action( 'manage_themes_custom_column', $column_name, $theme_key, $theme ); + echo "
+ + "; ?> + user_login ); ?>user_login, $super_admins ) ) + echo ' - ' . __( 'Super Admin' ); + ?> +
+ ' . __( 'Edit' ) . ''; + + if ( current_user_can( 'delete_user', $user->ID) && ! in_array( $user->user_login, $super_admins ) ) { + $actions['delete'] = '' . __( 'Delete' ) . ''; + } + + $actions = apply_filters( 'ms_user_row_actions', $actions, $user ); + echo $this->row_actions( $actions ); + ?> +
$user->user_email" . mysql2date( $date, $user->user_registered ) . ""; + if ( is_array( $blogs ) ) { + foreach ( (array) $blogs as $key => $val ) { + if ( !can_edit_network( $val->site_id ) ) + continue; + + $path = ( $val->path == '/' ) ? '' : $val->path; + echo ''; + echo '' . str_replace( '.' . $current_site->domain, '', $val->domain . $path ) . ''; + echo ' '; + $actions = array(); + $actions['edit'] = '' . __( 'Edit' ) . ''; + + $class = ''; + if ( get_blog_status( $val->userblog_id, 'spam' ) == 1 ) + $class .= 'site-spammed '; + if ( get_blog_status( $val->userblog_id, 'mature' ) == 1 ) + $class .= 'site-mature '; + if ( get_blog_status( $val->userblog_id, 'deleted' ) == 1 ) + $class .= 'site-deleted '; + if ( get_blog_status( $val->userblog_id, 'archived' ) == 1 ) + $class .= 'site-archived '; + + $actions['view'] = '' . __( 'View' ) . ''; + + $actions = apply_filters('ms_user_list_site_actions', $actions, $val->userblog_id); + + $i=0; + $action_count = count( $actions ); + foreach ( $actions as $action => $link ) { + ++$i; + ( $i == $action_count ) ? $sep = '' : $sep = ' | '; + echo "$link$sep"; + } + echo '
'; + } + } + ?> +
> + + >> +
+
+ +
<?php _e( '5 stars' ) ?>
+
<?php _e( '4 stars' ) ?>
+
<?php _e( '3 stars' ) ?>
+
<?php _e( '2 stars' ) ?>
+
<?php _e( '1 star' ) ?>
+
+
>
$checkbox$plugin_name"; + echo $this->row_actions( $actions, true ); + echo " +
$description
+
"; + + $plugin_meta = array(); + if ( !empty( $plugin_data['Version'] ) ) + $plugin_meta[] = sprintf( __( 'Version %s' ), $plugin_data['Version'] ); + if ( !empty( $plugin_data['Author'] ) ) { + $author = $plugin_data['Author']; + if ( !empty( $plugin_data['AuthorURI'] ) ) + $author = '' . $plugin_data['Author'] . ''; + $plugin_meta[] = sprintf( __( 'By %s' ), $author ); + } + if ( ! empty( $plugin_data['PluginURI'] ) ) + $plugin_meta[] = '' . __( 'Visit plugin site' ) . ''; + + $plugin_meta = apply_filters( 'plugin_row_meta', $plugin_meta, $plugin_file, $plugin_data, $status ); + echo implode( ' | ', $plugin_meta ); + + echo "
"; + do_action( 'manage_plugins_custom_column', $column_name, $plugin_file, $plugin_data ); + echo "
>post_status != 'trash' ) { ?>labels->parent_item_colon . ' ' . esc_html( $parent_name ) : ''; ?> + + >post_status != 'trash' ) { ?> +post_status ) { + $actions['edit'] = '' . __( 'Edit' ) . ''; + $actions['inline hide-if-no-js'] = '' . __( 'Quick Edit' ) . ''; + } + if ( current_user_can( $post_type_object->cap->delete_post, $post->ID ) ) { + if ( 'trash' == $post->post_status ) + $actions['untrash'] = "ID ) ), 'untrash-' . $post->post_type . '_' . $post->ID ) . "'>" . __( 'Restore' ) . ""; + elseif ( EMPTY_TRASH_DAYS ) + $actions['trash'] = "" . __( 'Trash' ) . ""; + if ( 'trash' == $post->post_status || !EMPTY_TRASH_DAYS ) + $actions['delete'] = "" . __( 'Delete Permanently' ) . ""; + } + if ( $post_type_object->public ) { + if ( in_array( $post->post_status, array( 'pending', 'draft' ) ) ) { + if ( $can_edit_post ) + $actions['view'] = '' . __( 'Preview' ) . ''; + } elseif ( 'trash' != $post->post_status ) { + $actions['view'] = '' . __( 'View' ) . ''; + } + } + + $actions = apply_filters( is_post_type_hierarchical( $post->post_type ) ? 'page_row_actions' : 'post_row_actions', $actions, $post ); + echo $this->row_actions( $actions ); + + get_inline_data( $post ); + echo ''; + if ( 'excerpt' == $mode ) + echo apply_filters( 'post_date_column_time', $t_time, $post, $column_name, $mode ); + else + echo '' . apply_filters( 'post_date_column_time', $h_time, $post, $column_name, $mode ) . ''; + echo '
'; + if ( 'publish' == $post->post_status ) { + _e( 'Published' ); + } elseif ( 'future' == $post->post_status ) { + if ( $time_diff > 0 ) + echo '' . __( 'Missed schedule' ) . ''; + else + _e( 'Scheduled' ); + } else { + _e( 'Last Modified' ); + } + echo '
>%s', + esc_url( add_query_arg( array( 'post_type' => $post->post_type, 'category_name' => $c->slug ), 'edit.php' ) ), + esc_html( sanitize_term_field( 'name', $c->name, $c->term_id, 'category', 'display' ) ) + ); + } + echo join( ', ', $out ); + } else { + _e( 'Uncategorized' ); + } + ?>>ID ); + if ( !empty( $tags ) ) { + $out = array(); + foreach ( $tags as $c ) { + $out[] = sprintf( '%s', + esc_url( add_query_arg( array( 'post_type' => $post->post_type, 'tag' => $c->slug ), 'edit.php' ) ), + esc_html( sanitize_term_field( 'name', $c->name, $c->term_id, 'tag', 'display' ) ) + ); + } + echo join( ', ', $out ); + } else { + _e( 'No Tags' ); + } + ?>>
+ comment_pending_count[$post->ID] ) ? $this->comment_pending_count[$post->ID] : 0; + + $this->comments_bubble( $post->ID, $pending_comments ); + ?> +
>%s', + esc_url( add_query_arg( array( 'post_type' => $post->post_type, 'author' => get_the_author_meta( 'ID' ) ), 'edit.php' )), + get_the_author() + ); + ?>>post_type ) ) + do_action( 'manage_pages_custom_column', $column_name, $post->ID ); + else + do_action( 'manage_posts_custom_column', $column_name, $post->ID ); + do_action( "manage_{$post->post_type}_posts_custom_column", $column_name, $post->ID ); + ?>
+ + + post_type "; + echo $bulk ? "bulk-edit-row bulk-edit-row-$hclass bulk-edit-$screen->post_type" : "quick-edit-row quick-edit-row-$hclass inline-edit-$screen->post_type"; + ?>" style="display: none"> + +
+ +
+

+ post_type, 'title' ) ) : + if ( $bulk ) : ?> +
+
+
+ + + + + + + + + + + +
+ +
+
+ post_type, 'author' ) ) : + $authors_dropdown = ''; + + if ( is_super_admin() || current_user_can( $post_type_object->cap->edit_others_posts ) ) : + $users_opt = array( + 'hide_if_only_one_author' => false, + 'who' => 'authors', + 'name' => 'post_author', + 'class'=> 'authors', + 'multi' => 1, + 'echo' => 0 + ); + if ( $bulk ) + $users_opt['show_option_none'] = __( '— No Change —' ); + + if ( $authors = wp_dropdown_users( $users_opt ) ) : + $authors_dropdown = ''; + endif; + endif; // authors + ?> + + + +
+ + + + + + +
+ + + +
+ + + +
+ + + + labels->name ) ?> + + + + +
    + $taxonomy->name ) ) ?> +
+ + + +
+ + + +
+ + post_type, 'author' ) && $bulk ) + echo $authors_dropdown; + ?> + + hierarchical ) : ?> + + + + post_type, 'page-attributes' ) ) : + if ( !$bulk ) : ?> + + + + + + + + hierarchical ?> + + + + + + + + + + + + post_type, 'comments' ) || post_type_supports( $screen->post_type, 'trackbacks' ) ) : + if ( $bulk ) : ?> + +
+ post_type, 'comments' ) ) : ?> + + post_type, 'trackbacks' ) ) : ?> + + +
+ + + +
+ post_type, 'comments' ) ) : ?> + + post_type, 'trackbacks' ) ) : ?> + + +
+ + + +
+ + + post_type && $can_publish && current_user_can( $post_type_object->cap->edit_others_posts ) ) : ?> + + + + + + + + + + + + + +
+ +
+ + get_column_info(); + + foreach ( $columns as $column_name => $column_display_name ) { + if ( isset( $core_columns[$column_name] ) ) + continue; + do_action( $bulk ? 'bulk_edit_custom_box' : 'quick_edit_custom_box', $column_name, $screen->post_type ); + } + ?> +

+ + + + + 's' ) ); + } ?> + + + +
+

+
+ diff --git a/src/wp-admin/includes/class-wp-terms-list-table.php b/src/wp-admin/includes/class-wp-terms-list-table.php new file mode 100644 index 0000000..7778d88 --- /dev/null +++ b/src/wp-admin/includes/class-wp-terms-list-table.php @@ -0,0 +1,380 @@ + true ) ) ) ) + $post_type = 'post'; + + parent::__construct( array( + 'plural' => 'tags', + 'singular' => 'tag', + ) ); + } + + function ajax_user_can() { + global $tax; + + return current_user_can( $tax->cap->manage_terms ); + } + + function prepare_items() { + global $taxonomy; + + $tags_per_page = $this->get_items_per_page( 'edit_' . $taxonomy . '_per_page' ); + + if ( 'post_tag' == $taxonomy ) { + $tags_per_page = apply_filters( 'edit_tags_per_page', $tags_per_page ); + $tags_per_page = apply_filters( 'tagsperpage', $tags_per_page ); // Old filter + } elseif ( 'category' == $taxonomy ) { + $tags_per_page = apply_filters( 'edit_categories_per_page', $tags_per_page ); // Old filter + } + + $search = !empty( $_REQUEST['s'] ) ? trim( stripslashes( $_REQUEST['s'] ) ) : ''; + + $args = array( + 'search' => $search, + 'page' => $this->get_pagenum(), + 'number' => $tags_per_page, + ); + + if ( !empty( $_REQUEST['orderby'] ) ) + $args['orderby'] = trim( stripslashes( $_REQUEST['orderby'] ) ); + + if ( !empty( $_REQUEST['order'] ) ) + $args['order'] = trim( stripslashes( $_REQUEST['order'] ) ); + + $this->callback_args = $args; + + $this->set_pagination_args( array( + 'total_items' => wp_count_terms( $taxonomy, compact( 'search' ) ), + 'per_page' => $tags_per_page, + ) ); + } + + function has_items() { + // todo: populate $this->items in prepare_items() + return true; + } + + function get_bulk_actions() { + $actions = array(); + $actions['delete'] = __( 'Delete' ); + + return $actions; + } + + function current_action() { + if ( isset( $_REQUEST['action'] ) && isset( $_REQUEST['delete_tags'] ) && ( 'delete' == $_REQUEST['action'] || 'delete' == $_REQUEST['action2'] ) ) + return 'bulk-delete'; + + return parent::current_action(); + } + + function get_columns() { + global $taxonomy, $typenow; + + $columns = array( + 'cb' => '', + 'name' => _x( 'Name', 'term name' ), + 'description' => __( 'Description' ), + 'slug' => __( 'Slug' ), + ); + + if ( 'link_category' == $taxonomy ) { + $columns['links'] = __( 'Links' ); + } else { + $post_type = empty( $typenow ) ? 'post' : $typenow; + $post_type_object = get_post_type_object( $post_type ); + $columns['posts'] = $post_type_object ? $post_type_object->labels->name : __( 'Posts' ); + } + + return $columns; + } + + function get_sortable_columns() { + return array( + 'name' => 'name', + 'description' => 'description', + 'slug' => 'slug', + 'posts' => 'count', + 'links' => 'count' + ); + } + + function display_rows_or_placeholder() { + global $taxonomy; + + $args = wp_parse_args( $this->callback_args, array( + 'page' => 1, + 'number' => 20, + 'search' => '', + 'hide_empty' => 0 + ) ); + + extract( $args, EXTR_SKIP ); + + $args['offset'] = $offset = ( $page - 1 ) * $number; + + // convert it to table rows + $out = ''; + $count = 0; + + $terms = array(); + + if ( is_taxonomy_hierarchical( $taxonomy ) && !isset( $orderby ) ) { + // We'll need the full set of terms then. + $args['number'] = $args['offset'] = 0; + + $terms = get_terms( $taxonomy, $args ); + if ( !empty( $search ) ) // Ignore children on searches. + $children = array(); + else + $children = _get_term_hierarchy( $taxonomy ); + + // Some funky recursion to get the job done( Paging & parents mainly ) is contained within, Skip it for non-hierarchical taxonomies for performance sake + $out .= $this->_rows( $taxonomy, $terms, $children, $offset, $number, $count ); + } else { + $terms = get_terms( $taxonomy, $args ); + foreach ( $terms as $term ) + $out .= $this->single_row( $term, 0, $taxonomy ); + $count = $number; // Only displaying a single page. + } + + if ( empty( $terms ) ) { + list( $columns, $hidden ) = $this->get_column_info(); + echo ''; + $this->no_items(); + echo ''; + } else { + echo $out; + } + } + + function _rows( $taxonomy, $terms, &$children, $start = 0, $per_page = 20, &$count, $parent = 0, $level = 0 ) { + + $end = $start + $per_page; + + $output = ''; + foreach ( $terms as $key => $term ) { + + if ( $count >= $end ) + break; + + if ( $term->parent != $parent && empty( $_REQUEST['s'] ) ) + continue; + + // If the page starts in a subtree, print the parents. + if ( $count == $start && $term->parent > 0 && empty( $_REQUEST['s'] ) ) { + $my_parents = $parent_ids = array(); + $p = $term->parent; + while ( $p ) { + $my_parent = get_term( $p, $taxonomy ); + $my_parents[] = $my_parent; + $p = $my_parent->parent; + if ( in_array( $p, $parent_ids ) ) // Prevent parent loops. + break; + $parent_ids[] = $p; + } + unset( $parent_ids ); + + $num_parents = count( $my_parents ); + while ( $my_parent = array_pop( $my_parents ) ) { + $output .= "\t" . $this->single_row( $my_parent, $level - $num_parents, $taxonomy ); + $num_parents--; + } + } + + if ( $count >= $start ) + $output .= "\t" . $this->single_row( $term, $level, $taxonomy ); + + ++$count; + + unset( $terms[$key] ); + + if ( isset( $children[$term->term_id] ) && empty( $_REQUEST['s'] ) ) + $output .= $this->_rows( $taxonomy, $terms, $children, $start, $per_page, $count, $term->term_id, $level + 1 ); + } + + return $output; + } + + function single_row( $tag, $level = 0 ) { + static $row_class = ''; + $row_class = ( $row_class == '' ? ' class="alternate"' : '' ); + + $this->level = $level; + + echo ''; + echo $this->single_row_columns( $tag ); + echo ''; + } + + function column_cb( $tag ) { + global $taxonomy, $tax; + + $default_term = get_option( 'default_' . $taxonomy ); + + if ( current_user_can( $tax->cap->delete_terms ) && $tag->term_id != $default_term ) + return ''; + else + return ' '; + } + + function column_name( $tag ) { + global $taxonomy, $tax, $post_type; + + $default_term = get_option( 'default_' . $taxonomy ); + + $pad = str_repeat( '— ', max( 0, $this->level ) ); + $name = apply_filters( 'term_name', $pad . ' ' . $tag->name, $tag ); + $qe_data = get_term( $tag->term_id, $taxonomy, OBJECT, 'edit' ); + $edit_link = esc_url( get_edit_term_link( $tag->term_id, $taxonomy, $post_type ) ); + + $out = '' . $name . '
'; + + $actions = array(); + if ( current_user_can( $tax->cap->edit_terms ) ) { + $actions['edit'] = '' . __( 'Edit' ) . ''; + $actions['inline hide-if-no-js'] = '' . __( 'Quick Edit' ) . ''; + } + if ( current_user_can( $tax->cap->delete_terms ) && $tag->term_id != $default_term ) + $actions['delete'] = "term_id ) . "'>" . __( 'Delete' ) . ""; + $actions['view'] = '' . __( 'View' ) . ''; + + $actions = apply_filters( 'tag_row_actions', $actions, $tag ); + $actions = apply_filters( "{$taxonomy}_row_actions", $actions, $tag ); + + $out .= $this->row_actions( $actions ); + $out .= ''; + + return $out; + } + + function column_description( $tag ) { + return $tag->description; + } + + function column_slug( $tag ) { + return apply_filters( 'editable_slug', $tag->slug ); + } + + function column_posts( $tag ) { + global $taxonomy, $post_type; + + $count = number_format_i18n( $tag->count ); + + $tax = get_taxonomy( $taxonomy ); + + if ( ! $tax->public ) + return $count; + + if ( $tax->query_var ) { + $args = array( $tax->query_var => $tag->slug ); + } else { + $args = array( 'taxonomy' => $tax->name, 'term' => $tag->slug ); + } + + $args['post_type'] = $post_type; + + return "$count"; + } + + function column_links( $tag ) { + $count = number_format_i18n( $tag->count ); + if ( $count ) + $count = "$count"; + return $count; + } + + function column_default( $tag, $column_name ) { + $screen = get_current_screen(); + + return apply_filters( "manage_{$screen->taxonomy}_custom_column", '', $column_name, $tag->term_id ); + } + + /** + * Outputs the hidden row displayed when inline editing + * + * @since 3.1.0 + */ + function inline_edit() { + global $tax; + + if ( ! current_user_can( $tax->cap->edit_terms ) ) + return; +?> + +
+ +
+ diff --git a/src/wp-admin/includes/class-wp-theme-install-list-table.php b/src/wp-admin/includes/class-wp-theme-install-list-table.php new file mode 100644 index 0000000..7e44267 --- /dev/null +++ b/src/wp-admin/includes/class-wp-theme-install-list-table.php @@ -0,0 +1,185 @@ +get_pagenum(); + + $per_page = 30; + + // These are the tabs which are shown on the page, + $tabs = array(); + $tabs['dashboard'] = __( 'Search' ); + if ( 'search' == $tab ) + $tabs['search'] = __( 'Search Results' ); + $tabs['upload'] = __( 'Upload' ); + $tabs['featured'] = _x( 'Featured','Theme Installer' ); + //$tabs['popular'] = _x( 'Popular','Theme Installer' ); + $tabs['new'] = _x( 'Newest','Theme Installer' ); + $tabs['updated'] = _x( 'Recently Updated','Theme Installer' ); + + $nonmenu_tabs = array( 'theme-information' ); // Valid actions to perform which do not have a Menu item. + + $tabs = apply_filters( 'install_themes_tabs', $tabs ); + $nonmenu_tabs = apply_filters( 'install_themes_nonmenu_tabs', $nonmenu_tabs ); + + // If a non-valid menu tab has been selected, And its not a non-menu action. + if ( empty( $tab ) || ( ! isset( $tabs[ $tab ] ) && ! in_array( $tab, (array) $nonmenu_tabs ) ) ) + $tab = key( $tabs ); + + $args = array( 'page' => $paged, 'per_page' => $per_page, 'fields' => $theme_field_defaults ); + + switch ( $tab ) { + case 'search': + $type = isset( $_REQUEST['type'] ) ? stripslashes( $_REQUEST['type'] ) : ''; + $term = isset( $_REQUEST['s'] ) ? stripslashes( $_REQUEST['s'] ) : ''; + + switch ( $type ) { + case 'tag': + $terms = explode( ',', $term ); + $terms = array_map( 'trim', $terms ); + $terms = array_map( 'sanitize_title_with_dashes', $terms ); + $args['tag'] = $terms; + break; + case 'term': + $args['search'] = $term; + break; + case 'author': + $args['author'] = $term; + break; + } + + if ( !empty( $_POST['features'] ) ) { + $terms = $_POST['features']; + $terms = array_map( 'trim', $terms ); + $terms = array_map( 'sanitize_title_with_dashes', $terms ); + $args['tag'] = $terms; + $_REQUEST['s'] = implode( ',', $terms ); + $_REQUEST['type'] = 'tag'; + } + + add_action( 'install_themes_table_header', 'install_theme_search_form' ); + break; + + case 'featured': + //case 'popular': + case 'new': + case 'updated': + $args['browse'] = $tab; + break; + + default: + $args = false; + } + + if ( !$args ) + return; + + $api = themes_api( 'query_themes', $args ); + + if ( is_wp_error( $api ) ) + wp_die( $api->get_error_message() . '

' . __( 'Try again' ) . '' ); + + $this->items = $api->themes; + + $this->set_pagination_args( array( + 'total_items' => $api->info['results'], + 'per_page' => $per_page, + ) ); + } + + function no_items() { + _e( 'No themes match your request.' ); + } + + function get_views() { + global $tabs, $tab; + + $display_tabs = array(); + foreach ( (array) $tabs as $action => $text ) { + $class = ( $action == $tab ) ? ' class="current"' : ''; + $href = self_admin_url('theme-install.php?tab=' . $action); + $display_tabs['theme-install-'.$action] = "$text"; + } + + return $display_tabs; + } + + function get_columns() { + return array(); + } + + function display() { + + // wp_nonce_field( "fetch-list-" . get_class( $this ), '_ajax_fetch_list_nonce' ); +?> +

+
+ +
+ pagination( 'top' ); ?> + +
+
+ + + + display_rows_or_placeholder(); ?> + +
+ +
+ pagination( 'bottom' ); ?> + +
+
+items; + + $rows = ceil( count( $themes ) / 3 ); + $table = array(); + $theme_keys = array_keys( $themes ); + for ( $row = 1; $row <= $rows; $row++ ) + for ( $col = 1; $col <= 3; $col++ ) + $table[$row][$col] = array_shift( $theme_keys ); + + foreach ( $table as $row => $cols ) { + echo "\t\n"; + foreach ( $cols as $col => $theme_index ) { + $class = array( 'available-theme' ); + if ( $row == 1 ) $class[] = 'top'; + if ( $col == 1 ) $class[] = 'left'; + if ( $row == $rows ) $class[] = 'bottom'; + if ( $col == 3 ) $class[] = 'right'; + ?> + + \n"; + } // end foreach $table + } +} + +?> diff --git a/src/wp-admin/includes/class-wp-themes-list-table.php b/src/wp-admin/includes/class-wp-themes-list-table.php new file mode 100644 index 0000000..5cb7648 --- /dev/null +++ b/src/wp-admin/includes/class-wp-themes-list-table.php @@ -0,0 +1,240 @@ +search = array_merge( $this->search, array_filter( array_map( 'trim', explode( ',', $search ) ) ) ); + $this->search = array_unique( $this->search ); + } + + if ( !empty( $_REQUEST['features'] ) ) { + $this->features = $_REQUEST['features']; + $this->features = array_map( 'trim', $this->features ); + $this->features = array_map( 'sanitize_title_with_dashes', $this->features ); + $this->features = array_unique( $this->features ); + } + + if ( $this->search || $this->features ) { + foreach ( $themes as $key => $theme ) { + if ( !$this->search_theme( $theme ) ) + unset( $themes[ $key ] ); + } + } + + unset( $themes[$ct->name] ); + uksort( $themes, "strnatcasecmp" ); + + $per_page = 15; + $page = $this->get_pagenum(); + + $start = ( $page - 1 ) * $per_page; + + $this->items = array_slice( $themes, $start, $per_page ); + + $this->set_pagination_args( array( + 'total_items' => count( $themes ), + 'per_page' => $per_page, + ) ); + } + + function no_items() { + if ( $this->search || $this->features ) { + _e( 'No items found.' ); + return; + } + + if ( is_multisite() ) { + if ( current_user_can( 'install_themes' ) && current_user_can( 'manage_network_themes' ) ) { + printf( __( 'You only have one theme enabled for this site right now. Visit the Network Admin to enable or install more themes.' ), network_admin_url( 'site-themes.php?id=' . $GLOBALS['blog_id'] ), network_admin_url( 'theme-install.php' ) ); + + return; + } elseif ( current_user_can( 'manage_network_themes' ) ) { + printf( __( 'You only have one theme enabled for this site right now. Visit the Network Admin to enable more themes.' ), network_admin_url( 'site-themes.php?id=' . $GLOBALS['blog_id'] ) ); + + return; + } + // else, fallthrough. install_themes doesn't help if you can't enable it. + } else { + if ( current_user_can( 'install_themes' ) ) { + printf( __( 'You only have one theme installed right now. Live a little! You can choose from over 1,000 free themes in the WordPress.org Theme Directory at any time: just click on the Install Themes tab above.' ), admin_url( 'theme-install.php' ) ); + + return; + } + } + // Fallthrough. + printf( __( 'Only the current theme is available to you. Contact the %s administrator for information about accessing additional themes.' ), get_site_option( 'site_name' ) ); + } + + function tablenav( $which = 'top' ) { + if ( $this->get_pagination_arg( 'total_pages' ) <= 1 ) + return; + ?> +
+ pagination( $which ); ?> + +
+
+ + tablenav( 'top' ); ?> + + + + display_rows_or_placeholder(); ?> + +
+ + tablenav( 'bottom' ); ?> +items; + $theme_names = array_keys( $themes ); + natcasesort( $theme_names ); + + $table = array(); + $rows = ceil( count( $theme_names ) / 3 ); + for ( $row = 1; $row <= $rows; $row++ ) + for ( $col = 1; $col <= 3; $col++ ) + $table[$row][$col] = array_shift( $theme_names ); + + foreach ( $table as $row => $cols ) { +?> + + $theme_name ) { + $class = array( 'available-theme' ); + if ( $row == 1 ) $class[] = 'top'; + if ( $col == 1 ) $class[] = 'left'; + if ( $row == $rows ) $class[] = 'bottom'; + if ( $col == 3 ) $class[] = 'right'; +?> + + 1, 'template' => $template, 'stylesheet' => $stylesheet, 'preview_iframe' => true, 'TB_iframe' => 'true' ), $preview_link ) ); + $preview_text = esc_attr( sprintf( __( 'Preview of “%s”' ), $title ) ); + $tags = $themes[$theme_name]['Tags']; + $thickbox_class = 'thickbox thickbox-preview'; + $activate_link = wp_nonce_url( "themes.php?action=activate&template=".urlencode( $template )."&stylesheet=".urlencode( $stylesheet ), 'switch-theme_' . $template ); + $activate_text = esc_attr( sprintf( __( 'Activate “%s”' ), $title ) ); + $actions = array(); + $actions[] = '' . __( 'Activate' ) . ''; + $actions[] = '' . __( 'Preview' ) . ''; + if ( ! is_multisite() && current_user_can( 'delete_themes' ) ) + $actions[] = '' . __( 'Delete' ) . ''; + $actions = apply_filters( 'theme_action_links', $actions, $themes[$theme_name] ); + + $actions = implode ( ' | ', $actions ); +?> + + + + + +

+

+ + +

%2$s. The stylesheet files are located in %3$s. %4$s uses templates from %5$s. Changes made to the templates will affect both themes.' ), $title, str_replace( WP_CONTENT_DIR, '', $template_dir ), str_replace( WP_CONTENT_DIR, '', $stylesheet_dir ), $title, $parent_theme ); ?>

+ +

%2$s.' ), $title, str_replace( WP_CONTENT_DIR, '', $template_dir ), str_replace( WP_CONTENT_DIR, '', $stylesheet_dir ) ); ?>

+ + +

+ + + + + + +search ) > 0 ) { + foreach ( $this->search as $word ) { + $matched = 0; + + // In a tag? + if ( in_array( $word, array_map( 'sanitize_title_with_dashes', $theme['Tags'] ) ) ) + $matched = 1; + + // In one of the fields? + foreach ( array( 'Name', 'Title', 'Description', 'Author', 'Template', 'Stylesheet' ) AS $field ) { + if ( stripos( $theme[$field], $word ) !== false ) + $matched++; + } + + if ( $matched == 0 ) + return false; + } + } + + // Now search the features + if ( count( $this->features ) > 0 ) { + foreach ( $this->features as $word ) { + // In a tag? + if ( !in_array( $word, array_map( 'sanitize_title_with_dashes', $theme['Tags'] ) ) ) + return false; + } + } + + // Only get here if each word exists in the tags or one of the fields + return true; + } +} + +?> diff --git a/src/wp-admin/includes/class-wp-upgrader.php b/src/wp-admin/includes/class-wp-upgrader.php new file mode 100644 index 0000000..1cf4c41 --- /dev/null +++ b/src/wp-admin/includes/class-wp-upgrader.php @@ -0,0 +1,1457 @@ +skin = new WP_Upgrader_Skin(); + else + $this->skin = $skin; + } + + function init() { + $this->skin->set_upgrader($this); + $this->generic_strings(); + } + + function generic_strings() { + $this->strings['bad_request'] = __('Invalid Data provided.'); + $this->strings['fs_unavailable'] = __('Could not access filesystem.'); + $this->strings['fs_error'] = __('Filesystem error.'); + $this->strings['fs_no_root_dir'] = __('Unable to locate WordPress Root directory.'); + $this->strings['fs_no_content_dir'] = __('Unable to locate WordPress Content directory (wp-content).'); + $this->strings['fs_no_plugins_dir'] = __('Unable to locate WordPress Plugin directory.'); + $this->strings['fs_no_themes_dir'] = __('Unable to locate WordPress Theme directory.'); + /* translators: %s: directory name */ + $this->strings['fs_no_folder'] = __('Unable to locate needed folder (%s).'); + + $this->strings['download_failed'] = __('Download failed.'); + $this->strings['installing_package'] = __('Installing the latest version…'); + $this->strings['folder_exists'] = __('Destination folder already exists.'); + $this->strings['mkdir_failed'] = __('Could not create directory.'); + $this->strings['bad_package'] = __('Incompatible Archive.'); + + $this->strings['maintenance_start'] = __('Enabling Maintenance mode…'); + $this->strings['maintenance_end'] = __('Disabling Maintenance mode…'); + } + + function fs_connect( $directories = array() ) { + global $wp_filesystem; + + if ( false === ($credentials = $this->skin->request_filesystem_credentials()) ) + return false; + + if ( ! WP_Filesystem($credentials) ) { + $error = true; + if ( is_object($wp_filesystem) && $wp_filesystem->errors->get_error_code() ) + $error = $wp_filesystem->errors; + $this->skin->request_filesystem_credentials($error); //Failed to connect, Error and request again + return false; + } + + if ( ! is_object($wp_filesystem) ) + return new WP_Error('fs_unavailable', $this->strings['fs_unavailable'] ); + + if ( is_wp_error($wp_filesystem->errors) && $wp_filesystem->errors->get_error_code() ) + return new WP_Error('fs_error', $this->strings['fs_error'], $wp_filesystem->errors); + + foreach ( (array)$directories as $dir ) { + switch ( $dir ) { + case ABSPATH: + if ( ! $wp_filesystem->abspath() ) + return new WP_Error('fs_no_root_dir', $this->strings['fs_no_root_dir']); + break; + case WP_CONTENT_DIR: + if ( ! $wp_filesystem->wp_content_dir() ) + return new WP_Error('fs_no_content_dir', $this->strings['fs_no_content_dir']); + break; + case WP_PLUGIN_DIR: + if ( ! $wp_filesystem->wp_plugins_dir() ) + return new WP_Error('fs_no_plugins_dir', $this->strings['fs_no_plugins_dir']); + break; + case WP_CONTENT_DIR . '/themes': + if ( ! $wp_filesystem->find_folder(WP_CONTENT_DIR . '/themes') ) + return new WP_Error('fs_no_themes_dir', $this->strings['fs_no_themes_dir']); + break; + default: + if ( ! $wp_filesystem->find_folder($dir) ) + return new WP_Error('fs_no_folder', sprintf($this->strings['fs_no_folder'], $dir)); + break; + } + } + return true; + } //end fs_connect(); + + function download_package($package) { + + if ( ! preg_match('!^(http|https|ftp)://!i', $package) && file_exists($package) ) //Local file or remote? + return $package; //must be a local file.. + + if ( empty($package) ) + return new WP_Error('no_package', $this->strings['no_package']); + + $this->skin->feedback('downloading_package', $package); + + $download_file = download_url($package); + + if ( is_wp_error($download_file) ) + return new WP_Error('download_failed', $this->strings['download_failed'], $download_file->get_error_message()); + + return $download_file; + } + + function unpack_package($package, $delete_package = true) { + global $wp_filesystem; + + $this->skin->feedback('unpack_package'); + + $upgrade_folder = $wp_filesystem->wp_content_dir() . 'upgrade/'; + + //Clean up contents of upgrade directory beforehand. + $upgrade_files = $wp_filesystem->dirlist($upgrade_folder); + if ( !empty($upgrade_files) ) { + foreach ( $upgrade_files as $file ) + $wp_filesystem->delete($upgrade_folder . $file['name'], true); + } + + //We need a working directory + $working_dir = $upgrade_folder . basename($package, '.zip'); + + // Clean up working directory + if ( $wp_filesystem->is_dir($working_dir) ) + $wp_filesystem->delete($working_dir, true); + + // Unzip package to working directory + $result = unzip_file($package, $working_dir); //TODO optimizations, Copy when Move/Rename would suffice? + + // Once extracted, delete the package if required. + if ( $delete_package ) + unlink($package); + + if ( is_wp_error($result) ) { + $wp_filesystem->delete($working_dir, true); + return $result; + } + + return $working_dir; + } + + function install_package($args = array()) { + global $wp_filesystem; + $defaults = array( 'source' => '', 'destination' => '', //Please always pass these + 'clear_destination' => false, 'clear_working' => false, + 'hook_extra' => array()); + + $args = wp_parse_args($args, $defaults); + extract($args); + + @set_time_limit( 300 ); + + if ( empty($source) || empty($destination) ) + return new WP_Error('bad_request', $this->strings['bad_request']); + + $this->skin->feedback('installing_package'); + + $res = apply_filters('upgrader_pre_install', true, $hook_extra); + if ( is_wp_error($res) ) + return $res; + + //Retain the Original source and destinations + $remote_source = $source; + $local_destination = $destination; + + $source_files = array_keys( $wp_filesystem->dirlist($remote_source) ); + $remote_destination = $wp_filesystem->find_folder($local_destination); + + //Locate which directory to copy to the new folder, This is based on the actual folder holding the files. + if ( 1 == count($source_files) && $wp_filesystem->is_dir( trailingslashit($source) . $source_files[0] . '/') ) //Only one folder? Then we want its contents. + $source = trailingslashit($source) . trailingslashit($source_files[0]); + elseif ( count($source_files) == 0 ) + return new WP_Error('bad_package', $this->strings['bad_package']); //There are no files? + //else //Its only a single file, The upgrader will use the foldername of this file as the destination folder. foldername is based on zip filename. + + //Hook ability to change the source file location.. + $source = apply_filters('upgrader_source_selection', $source, $remote_source, $this); + if ( is_wp_error($source) ) + return $source; + + //Has the source location changed? If so, we need a new source_files list. + if ( $source !== $remote_source ) + $source_files = array_keys( $wp_filesystem->dirlist($source) ); + + //Protection against deleting files in any important base directories. + if ( in_array( $destination, array(ABSPATH, WP_CONTENT_DIR, WP_PLUGIN_DIR, WP_CONTENT_DIR . '/themes') ) ) { + $remote_destination = trailingslashit($remote_destination) . trailingslashit(basename($source)); + $destination = trailingslashit($destination) . trailingslashit(basename($source)); + } + + if ( $clear_destination ) { + //We're going to clear the destination if theres something there + $this->skin->feedback('remove_old'); + $removed = true; + if ( $wp_filesystem->exists($remote_destination) ) + $removed = $wp_filesystem->delete($remote_destination, true); + $removed = apply_filters('upgrader_clear_destination', $removed, $local_destination, $remote_destination, $hook_extra); + + if ( is_wp_error($removed) ) + return $removed; + else if ( ! $removed ) + return new WP_Error('remove_old_failed', $this->strings['remove_old_failed']); + } elseif ( $wp_filesystem->exists($remote_destination) ) { + //If we're not clearing the destination folder and something exists there allready, Bail. + //But first check to see if there are actually any files in the folder. + $_files = $wp_filesystem->dirlist($remote_destination); + if ( ! empty($_files) ) { + $wp_filesystem->delete($remote_source, true); //Clear out the source files. + return new WP_Error('folder_exists', $this->strings['folder_exists'], $remote_destination ); + } + } + + //Create destination if needed + if ( !$wp_filesystem->exists($remote_destination) ) + if ( !$wp_filesystem->mkdir($remote_destination, FS_CHMOD_DIR) ) + return new WP_Error('mkdir_failed', $this->strings['mkdir_failed'], $remote_destination); + + // Copy new version of item into place. + $result = copy_dir($source, $remote_destination); + if ( is_wp_error($result) ) { + if ( $clear_working ) + $wp_filesystem->delete($remote_source, true); + return $result; + } + + //Clear the Working folder? + if ( $clear_working ) + $wp_filesystem->delete($remote_source, true); + + $destination_name = basename( str_replace($local_destination, '', $destination) ); + if ( '.' == $destination_name ) + $destination_name = ''; + + $this->result = compact('local_source', 'source', 'source_name', 'source_files', 'destination', 'destination_name', 'local_destination', 'remote_destination', 'clear_destination', 'delete_source_dir'); + + $res = apply_filters('upgrader_post_install', true, $hook_extra, $this->result); + if ( is_wp_error($res) ) { + $this->result = $res; + return $res; + } + + //Bombard the calling function will all the info which we've just used. + return $this->result; + } + + function run($options) { + + $defaults = array( 'package' => '', //Please always pass this. + 'destination' => '', //And this + 'clear_destination' => false, + 'clear_working' => true, + 'is_multi' => false, + 'hook_extra' => array() //Pass any extra $hook_extra args here, this will be passed to any hooked filters. + ); + + $options = wp_parse_args($options, $defaults); + extract($options); + + //Connect to the Filesystem first. + $res = $this->fs_connect( array(WP_CONTENT_DIR, $destination) ); + if ( ! $res ) //Mainly for non-connected filesystem. + return false; + + if ( is_wp_error($res) ) { + $this->skin->error($res); + return $res; + } + + if ( !$is_multi ) // call $this->header separately if running multiple times + $this->skin->header(); + + $this->skin->before(); + + //Download the package (Note, This just returns the filename of the file if the package is a local file) + $download = $this->download_package( $package ); + if ( is_wp_error($download) ) { + $this->skin->error($download); + $this->skin->after(); + return $download; + } + + $delete_package = ($download != $package); // Do not delete a "local" file + + //Unzip's the file into a temporary directory + $working_dir = $this->unpack_package( $download, $delete_package ); + if ( is_wp_error($working_dir) ) { + $this->skin->error($working_dir); + $this->skin->after(); + return $working_dir; + } + + //With the given options, this installs it to the destination directory. + $result = $this->install_package( array( + 'source' => $working_dir, + 'destination' => $destination, + 'clear_destination' => $clear_destination, + 'clear_working' => $clear_working, + 'hook_extra' => $hook_extra + ) ); + $this->skin->set_result($result); + if ( is_wp_error($result) ) { + $this->skin->error($result); + $this->skin->feedback('process_failed'); + } else { + //Install Suceeded + $this->skin->feedback('process_success'); + } + $this->skin->after(); + + if ( !$is_multi ) + $this->skin->footer(); + + return $result; + } + + function maintenance_mode($enable = false) { + global $wp_filesystem; + $file = $wp_filesystem->abspath() . '.maintenance'; + if ( $enable ) { + $this->skin->feedback('maintenance_start'); + // Create maintenance file to signal that we are upgrading + $maintenance_string = ''; + $wp_filesystem->delete($file); + $wp_filesystem->put_contents($file, $maintenance_string, FS_CHMOD_FILE); + } else if ( !$enable && $wp_filesystem->exists($file) ) { + $this->skin->feedback('maintenance_end'); + $wp_filesystem->delete($file); + } + } + +} + +/** + * Plugin Upgrader class for WordPress Plugins, It is designed to upgrade/install plugins from a local zip, remote zip URL, or uploaded zip file. + * + * @TODO More Detailed docs, for methods as well. + * + * @package WordPress + * @subpackage Upgrader + * @since 2.8.0 + */ +class Plugin_Upgrader extends WP_Upgrader { + + var $result; + var $bulk = false; + var $show_before = ''; + + function upgrade_strings() { + $this->strings['up_to_date'] = __('The plugin is at the latest version.'); + $this->strings['no_package'] = __('Update package not available.'); + $this->strings['downloading_package'] = __('Downloading update from %s…'); + $this->strings['unpack_package'] = __('Unpacking the update…'); + $this->strings['deactivate_plugin'] = __('Deactivating the plugin…'); + $this->strings['remove_old'] = __('Removing the old version of the plugin…'); + $this->strings['remove_old_failed'] = __('Could not remove the old plugin.'); + $this->strings['process_failed'] = __('Plugin update failed.'); + $this->strings['process_success'] = __('Plugin updated successfully.'); + } + + function install_strings() { + $this->strings['no_package'] = __('Install package not available.'); + $this->strings['downloading_package'] = __('Downloading install package from %s…'); + $this->strings['unpack_package'] = __('Unpacking the package…'); + $this->strings['installing_package'] = __('Installing the plugin…'); + $this->strings['process_failed'] = __('Plugin install failed.'); + $this->strings['process_success'] = __('Plugin installed successfully.'); + } + + function install($package) { + + $this->init(); + $this->install_strings(); + + $this->run(array( + 'package' => $package, + 'destination' => WP_PLUGIN_DIR, + 'clear_destination' => false, //Do not overwrite files. + 'clear_working' => true, + 'hook_extra' => array() + )); + + // Force refresh of plugin update information + delete_site_transient('update_plugins'); + + } + + function upgrade($plugin) { + + $this->init(); + $this->upgrade_strings(); + + $current = get_site_transient( 'update_plugins' ); + if ( !isset( $current->response[ $plugin ] ) ) { + $this->skin->before(); + $this->skin->set_result(false); + $this->skin->error('up_to_date'); + $this->skin->after(); + return false; + } + + // Get the URL to the zip file + $r = $current->response[ $plugin ]; + + add_filter('upgrader_pre_install', array(&$this, 'deactivate_plugin_before_upgrade'), 10, 2); + add_filter('upgrader_clear_destination', array(&$this, 'delete_old_plugin'), 10, 4); + //'source_selection' => array(&$this, 'source_selection'), //theres a track ticket to move up the directory for zip's which are made a bit differently, useful for non-.org plugins. + + $this->run(array( + 'package' => $r->package, + 'destination' => WP_PLUGIN_DIR, + 'clear_destination' => true, + 'clear_working' => true, + 'hook_extra' => array( + 'plugin' => $plugin + ) + )); + + // Cleanup our hooks, incase something else does a upgrade on this connection. + remove_filter('upgrader_pre_install', array(&$this, 'deactivate_plugin_before_upgrade')); + remove_filter('upgrader_clear_destination', array(&$this, 'delete_old_plugin')); + + if ( ! $this->result || is_wp_error($this->result) ) + return $this->result; + + // Force refresh of plugin update information + delete_site_transient('update_plugins'); + } + + function bulk_upgrade($plugins) { + + $this->init(); + $this->bulk = true; + $this->upgrade_strings(); + + $current = get_site_transient( 'update_plugins' ); + + add_filter('upgrader_clear_destination', array(&$this, 'delete_old_plugin'), 10, 4); + + $this->skin->header(); + + // Connect to the Filesystem first. + $res = $this->fs_connect( array(WP_CONTENT_DIR, WP_PLUGIN_DIR) ); + if ( ! $res ) { + $this->skin->footer(); + return false; + } + + $this->skin->bulk_header(); + + // Only start maintenance mode if running in Multisite OR the plugin is in use + $maintenance = is_multisite(); // @TODO: This should only kick in for individual sites if at all possible. + foreach ( $plugins as $plugin ) + $maintenance = $maintenance || (is_plugin_active($plugin) && isset($current->response[ $plugin ]) ); // Only activate Maintenance mode if a plugin is active AND has an update available + if ( $maintenance ) + $this->maintenance_mode(true); + + $results = array(); + + $this->update_count = count($plugins); + $this->update_current = 0; + foreach ( $plugins as $plugin ) { + $this->update_current++; + $this->skin->plugin_info = get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin, false, true); + + if ( !isset( $current->response[ $plugin ] ) ) { + $this->skin->set_result(false); + $this->skin->before(); + $this->skin->error('up_to_date'); + $this->skin->after(); + $results[$plugin] = false; + continue; + } + + // Get the URL to the zip file + $r = $current->response[ $plugin ]; + + $this->skin->plugin_active = is_plugin_active($plugin); + + $result = $this->run(array( + 'package' => $r->package, + 'destination' => WP_PLUGIN_DIR, + 'clear_destination' => true, + 'clear_working' => true, + 'is_multi' => true, + 'hook_extra' => array( + 'plugin' => $plugin + ) + )); + + $results[$plugin] = $this->result; + + // Prevent credentials auth screen from displaying multiple times + if ( false === $result ) + break; + } //end foreach $plugins + + $this->maintenance_mode(false); + + $this->skin->bulk_footer(); + + $this->skin->footer(); + + // Cleanup our hooks, incase something else does a upgrade on this connection. + remove_filter('upgrader_clear_destination', array(&$this, 'delete_old_plugin')); + + // Force refresh of plugin update information + delete_site_transient('update_plugins'); + + return $results; + } + + //return plugin info. + function plugin_info() { + if ( ! is_array($this->result) ) + return false; + if ( empty($this->result['destination_name']) ) + return false; + + $plugin = get_plugins('/' . $this->result['destination_name']); //Ensure to pass with leading slash + if ( empty($plugin) ) + return false; + + $pluginfiles = array_keys($plugin); //Assume the requested plugin is the first in the list + + return $this->result['destination_name'] . '/' . $pluginfiles[0]; + } + + //Hooked to pre_install + function deactivate_plugin_before_upgrade($return, $plugin) { + + if ( is_wp_error($return) ) //Bypass. + return $return; + + $plugin = isset($plugin['plugin']) ? $plugin['plugin'] : ''; + if ( empty($plugin) ) + return new WP_Error('bad_request', $this->strings['bad_request']); + + if ( is_plugin_active($plugin) ) { + $this->skin->feedback('deactivate_plugin'); + //Deactivate the plugin silently, Prevent deactivation hooks from running. + deactivate_plugins($plugin, true); + } + } + + //Hooked to upgrade_clear_destination + function delete_old_plugin($removed, $local_destination, $remote_destination, $plugin) { + global $wp_filesystem; + + if ( is_wp_error($removed) ) + return $removed; //Pass errors through. + + $plugin = isset($plugin['plugin']) ? $plugin['plugin'] : ''; + if ( empty($plugin) ) + return new WP_Error('bad_request', $this->strings['bad_request']); + + $plugins_dir = $wp_filesystem->wp_plugins_dir(); + $this_plugin_dir = trailingslashit( dirname($plugins_dir . $plugin) ); + + if ( ! $wp_filesystem->exists($this_plugin_dir) ) //If its already vanished. + return $removed; + + // If plugin is in its own directory, recursively delete the directory. + if ( strpos($plugin, '/') && $this_plugin_dir != $plugins_dir ) //base check on if plugin includes directory separator AND that its not the root plugin folder + $deleted = $wp_filesystem->delete($this_plugin_dir, true); + else + $deleted = $wp_filesystem->delete($plugins_dir . $plugin); + + if ( ! $deleted ) + return new WP_Error('remove_old_failed', $this->strings['remove_old_failed']); + + return true; + } +} + +/** + * Theme Upgrader class for WordPress Themes, It is designed to upgrade/install themes from a local zip, remote zip URL, or uploaded zip file. + * + * @TODO More Detailed docs, for methods as well. + * + * @package WordPress + * @subpackage Upgrader + * @since 2.8.0 + */ +class Theme_Upgrader extends WP_Upgrader { + + var $result; + + function upgrade_strings() { + $this->strings['up_to_date'] = __('The theme is at the latest version.'); + $this->strings['no_package'] = __('Update package not available.'); + $this->strings['downloading_package'] = __('Downloading update from %s…'); + $this->strings['unpack_package'] = __('Unpacking the update…'); + $this->strings['remove_old'] = __('Removing the old version of the theme…'); + $this->strings['remove_old_failed'] = __('Could not remove the old theme.'); + $this->strings['process_failed'] = __('Theme update failed.'); + $this->strings['process_success'] = __('Theme updated successfully.'); + } + + function install_strings() { + $this->strings['no_package'] = __('Install package not available.'); + $this->strings['downloading_package'] = __('Downloading install package from %s…'); + $this->strings['unpack_package'] = __('Unpacking the package…'); + $this->strings['installing_package'] = __('Installing the theme…'); + $this->strings['process_failed'] = __('Theme install failed.'); + $this->strings['process_success'] = __('Theme installed successfully.'); + } + + function install($package) { + + $this->init(); + $this->install_strings(); + + $options = array( + 'package' => $package, + 'destination' => WP_CONTENT_DIR . '/themes', + 'clear_destination' => false, //Do not overwrite files. + 'clear_working' => true + ); + + $this->run($options); + + if ( ! $this->result || is_wp_error($this->result) ) + return $this->result; + + // Force refresh of theme update information + delete_site_transient('update_themes'); + + if ( empty($result['destination_name']) ) + return false; + else + return $result['destination_name']; + } + + function upgrade($theme) { + + $this->init(); + $this->upgrade_strings(); + + // Is an update available? + $current = get_site_transient( 'update_themes' ); + if ( !isset( $current->response[ $theme ] ) ) { + $this->skin->before(); + $this->skin->set_result(false); + $this->skin->error('up_to_date'); + $this->skin->after(); + return false; + } + + $r = $current->response[ $theme ]; + + add_filter('upgrader_pre_install', array(&$this, 'current_before'), 10, 2); + add_filter('upgrader_post_install', array(&$this, 'current_after'), 10, 2); + add_filter('upgrader_clear_destination', array(&$this, 'delete_old_theme'), 10, 4); + + $options = array( + 'package' => $r['package'], + 'destination' => WP_CONTENT_DIR . '/themes', + 'clear_destination' => true, + 'clear_working' => true, + 'hook_extra' => array( + 'theme' => $theme + ) + ); + + $this->run($options); + + if ( ! $this->result || is_wp_error($this->result) ) + return $this->result; + + // Force refresh of theme update information + delete_site_transient('update_themes'); + + return true; + } + + function bulk_upgrade($themes) { + + $this->init(); + $this->bulk = true; + $this->upgrade_strings(); + + $current = get_site_transient( 'update_themes' ); + + add_filter('upgrader_pre_install', array(&$this, 'current_before'), 10, 2); + add_filter('upgrader_post_install', array(&$this, 'current_after'), 10, 2); + add_filter('upgrader_clear_destination', array(&$this, 'delete_old_theme'), 10, 4); + + $this->skin->header(); + + // Connect to the Filesystem first. + $res = $this->fs_connect( array(WP_CONTENT_DIR) ); + if ( ! $res ) { + $this->skin->footer(); + return false; + } + + $this->skin->bulk_header(); + + // Only start maintenance mode if running in Multisite OR the theme is in use + $maintenance = is_multisite(); // @TODO: This should only kick in for individual sites if at all possible. + foreach ( $themes as $theme ) + $maintenance = $maintenance || $theme == get_stylesheet() || $theme == get_template(); + if ( $maintenance ) + $this->maintenance_mode(true); + + $results = array(); + + $this->update_count = count($themes); + $this->update_current = 0; + foreach ( $themes as $theme ) { + $this->update_current++; + + if ( !isset( $current->response[ $theme ] ) ) { + $this->skin->set_result(false); + $this->skin->before(); + $this->skin->error('up_to_date'); + $this->skin->after(); + $results[$theme] = false; + continue; + } + + $this->skin->theme_info = $this->theme_info($theme); + + // Get the URL to the zip file + $r = $current->response[ $theme ]; + + $options = array( + 'package' => $r['package'], + 'destination' => WP_CONTENT_DIR . '/themes', + 'clear_destination' => true, + 'clear_working' => true, + 'hook_extra' => array( + 'theme' => $theme + ) + ); + + $result = $this->run($options); + + $results[$theme] = $this->result; + + // Prevent credentials auth screen from displaying multiple times + if ( false === $result ) + break; + } //end foreach $plugins + + $this->maintenance_mode(false); + + $this->skin->bulk_footer(); + + $this->skin->footer(); + + // Cleanup our hooks, incase something else does a upgrade on this connection. + remove_filter('upgrader_pre_install', array(&$this, 'current_before'), 10, 2); + remove_filter('upgrader_post_install', array(&$this, 'current_after'), 10, 2); + remove_filter('upgrader_clear_destination', array(&$this, 'delete_old_theme'), 10, 4); + + // Force refresh of theme update information + delete_site_transient('update_themes'); + + return $results; + } + + function current_before($return, $theme) { + + if ( is_wp_error($return) ) + return $return; + + $theme = isset($theme['theme']) ? $theme['theme'] : ''; + + if ( $theme != get_stylesheet() ) //If not current + return $return; + //Change to maintenance mode now. + if ( ! $this->bulk ) + $this->maintenance_mode(true); + + return $return; + } + function current_after($return, $theme) { + if ( is_wp_error($return) ) + return $return; + + $theme = isset($theme['theme']) ? $theme['theme'] : ''; + + if ( $theme != get_stylesheet() ) //If not current + return $return; + + //Ensure stylesheet name hasnt changed after the upgrade: + // @TODO: Note, This doesnt handle the Template changing, or the Template name changing. + if ( $theme == get_stylesheet() && $theme != $this->result['destination_name'] ) { + $theme_info = $this->theme_info(); + $stylesheet = $this->result['destination_name']; + $template = !empty($theme_info['Template']) ? $theme_info['Template'] : $stylesheet; + switch_theme($template, $stylesheet, true); + } + + //Time to remove maintenance mode + if ( ! $this->bulk ) + $this->maintenance_mode(false); + return $return; + } + + function delete_old_theme($removed, $local_destination, $remote_destination, $theme) { + global $wp_filesystem; + + $theme = isset($theme['theme']) ? $theme['theme'] : ''; + + if ( is_wp_error($removed) || empty($theme) ) + return $removed; //Pass errors through. + + $themes_dir = $wp_filesystem->wp_themes_dir(); + if ( $wp_filesystem->exists( trailingslashit($themes_dir) . $theme ) ) + if ( ! $wp_filesystem->delete( trailingslashit($themes_dir) . $theme, true ) ) + return false; + return true; + } + + function theme_info($theme = null) { + + if ( empty($theme) ) { + if ( !empty($this->result['destination_name']) ) + $theme = $this->result['destination_name']; + else + return false; + } + return get_theme_data(WP_CONTENT_DIR . '/themes/' . $theme . '/style.css'); + } + +} + +/** + * Core Upgrader class for WordPress. It allows for WordPress to upgrade itself in combiantion with the wp-admin/includes/update-core.php file + * + * @TODO More Detailed docs, for methods as well. + * + * @package WordPress + * @subpackage Upgrader + * @since 2.8.0 + */ +class Core_Upgrader extends WP_Upgrader { + + function upgrade_strings() { + $this->strings['up_to_date'] = __('WordPress is at the latest version.'); + $this->strings['no_package'] = __('Update package not available.'); + $this->strings['downloading_package'] = __('Downloading update from %s…'); + $this->strings['unpack_package'] = __('Unpacking the update…'); + $this->strings['copy_failed'] = __('Could not copy files.'); + } + + function upgrade($current) { + global $wp_filesystem, $wp_version; + + $this->init(); + $this->upgrade_strings(); + + if ( !empty($feedback) ) + add_filter('update_feedback', $feedback); + + // Is an update available? + if ( !isset( $current->response ) || $current->response == 'latest' ) + return new WP_Error('up_to_date', $this->strings['up_to_date']); + + $res = $this->fs_connect( array(ABSPATH, WP_CONTENT_DIR) ); + if ( is_wp_error($res) ) + return $res; + + $wp_dir = trailingslashit($wp_filesystem->abspath()); + + // If partial update is returned from the API, use that, unless we're doing a reinstall. + // If we cross the new_bundled version number, then use the new_bundled zip. + // Don't though if the constant is set to skip bundled items. + // If the API returns a no_content zip, go with it. Finally, default to the full zip. + if ( $current->packages->partial && 'reinstall' != $current->response && $wp_version == $current->partial_version ) + $to_download = 'partial'; + elseif ( $current->packages->new_bundled && version_compare( $wp_version, $current->new_bundled, '<' ) + && ( ! defined( 'CORE_UPGRADE_SKIP_NEW_BUNDLED' ) || ! CORE_UPGRADE_SKIP_NEW_BUNDLED ) ) + $to_download = 'new_bundled'; + elseif ( $current->packages->no_content ) + $to_download = 'no_content'; + else + $to_download = 'full'; + + $download = $this->download_package( $current->packages->$to_download ); + if ( is_wp_error($download) ) + return $download; + + $working_dir = $this->unpack_package( $download ); + if ( is_wp_error($working_dir) ) + return $working_dir; + + // Copy update-core.php from the new version into place. + if ( !$wp_filesystem->copy($working_dir . '/wordpress/wp-admin/includes/update-core.php', $wp_dir . 'wp-admin/includes/update-core.php', true) ) { + $wp_filesystem->delete($working_dir, true); + return new WP_Error('copy_failed', $this->strings['copy_failed']); + } + $wp_filesystem->chmod($wp_dir . 'wp-admin/includes/update-core.php', FS_CHMOD_FILE); + + require(ABSPATH . 'wp-admin/includes/update-core.php'); + + return update_core($working_dir, $wp_dir); + } + +} + +/** + * Generic Skin for the WordPress Upgrader classes. This skin is designed to be extended for specific purposes. + * + * @TODO More Detailed docs, for methods as well. + * + * @package WordPress + * @subpackage Upgrader + * @since 2.8.0 + */ +class WP_Upgrader_Skin { + + var $upgrader; + var $done_header = false; + var $result = false; + + function __construct($args = array()) { + $defaults = array( 'url' => '', 'nonce' => '', 'title' => '', 'context' => false ); + $this->options = wp_parse_args($args, $defaults); + } + + function set_upgrader(&$upgrader) { + if ( is_object($upgrader) ) + $this->upgrader =& $upgrader; + $this->add_strings(); + } + + function add_strings() { + } + + function set_result($result) { + $this->result = $result; + } + + function request_filesystem_credentials($error = false) { + $url = $this->options['url']; + $context = $this->options['context']; + if ( !empty($this->options['nonce']) ) + $url = wp_nonce_url($url, $this->options['nonce']); + return request_filesystem_credentials($url, '', $error, $context); //Possible to bring inline, Leaving as is for now. + } + + function header() { + if ( $this->done_header ) + return; + $this->done_header = true; + echo '
'; + echo screen_icon(); + echo '

' . $this->options['title'] . '

'; + } + function footer() { + echo '
'; + } + + function error($errors) { + if ( ! $this->done_header ) + $this->header(); + if ( is_string($errors) ) { + $this->feedback($errors); + } elseif ( is_wp_error($errors) && $errors->get_error_code() ) { + foreach ( $errors->get_error_messages() as $message ) { + if ( $errors->get_error_data() ) + $this->feedback($message . ' ' . $errors->get_error_data() ); + else + $this->feedback($message); + } + } + } + + function feedback($string) { + if ( isset( $this->upgrader->strings[$string] ) ) + $string = $this->upgrader->strings[$string]; + + if ( strpos($string, '%') !== false ) { + $args = func_get_args(); + $args = array_splice($args, 1); + if ( !empty($args) ) + $string = vsprintf($string, $args); + } + if ( empty($string) ) + return; + show_message($string); + } + function before() {} + function after() {} + +} + +/** + * Plugin Upgrader Skin for WordPress Plugin Upgrades. + * + * @TODO More Detailed docs, for methods as well. + * + * @package WordPress + * @subpackage Upgrader + * @since 2.8.0 + */ +class Plugin_Upgrader_Skin extends WP_Upgrader_Skin { + var $plugin = ''; + var $plugin_active = false; + var $plugin_network_active = false; + + function __construct($args = array()) { + $defaults = array( 'url' => '', 'plugin' => '', 'nonce' => '', 'title' => __('Update Plugin') ); + $args = wp_parse_args($args, $defaults); + + $this->plugin = $args['plugin']; + + $this->plugin_active = is_plugin_active( $this->plugin ); + $this->plugin_network_active = is_plugin_active_for_network( $this->plugin ); + + parent::__construct($args); + } + + function after() { + $this->plugin = $this->upgrader->plugin_info(); + if ( !empty($this->plugin) && !is_wp_error($this->result) && $this->plugin_active ){ + show_message(__('Reactivating the plugin…')); + echo ''; + } + + $update_actions = array( + 'activate_plugin' => '' . __('Activate Plugin') . '', + 'plugins_page' => '' . __('Return to Plugins page') . '' + ); + if ( $this->plugin_active ) + unset( $update_actions['activate_plugin'] ); + if ( ! $this->result || is_wp_error($this->result) ) + unset( $update_actions['activate_plugin'] ); + + $update_actions = apply_filters('update_plugin_complete_actions', $update_actions, $this->plugin); + if ( ! empty($update_actions) ) + $this->feedback(implode(' | ', (array)$update_actions)); + } + + function before() { + if ( $this->upgrader->show_before ) { + echo $this->upgrader->show_before; + $this->upgrader->show_before = ''; + } + } +} + +/** + * Plugin Upgrader Skin for WordPress Plugin Upgrades. + * + * @package WordPress + * @subpackage Upgrader + * @since 3.0.0 + */ +class Bulk_Upgrader_Skin extends WP_Upgrader_Skin { + var $in_loop = false; + var $error = false; + + function __construct($args = array()) { + $defaults = array( 'url' => '', 'nonce' => '' ); + $args = wp_parse_args($args, $defaults); + + parent::__construct($args); + } + + function add_strings() { + $this->upgrader->strings['skin_upgrade_start'] = __('The update process is starting. This process may take a while on some hosts, so please be patient.'); + $this->upgrader->strings['skin_update_failed_error'] = __('An error occurred while updating %1$s: %2$s.'); + $this->upgrader->strings['skin_update_failed'] = __('The update of %1$s failed.'); + $this->upgrader->strings['skin_update_successful'] = __('%1$s updated successfully.').' '.__('Show Details').'.'; + $this->upgrader->strings['skin_upgrade_end'] = __('All updates have been completed.'); + } + + function feedback($string) { + if ( isset( $this->upgrader->strings[$string] ) ) + $string = $this->upgrader->strings[$string]; + + if ( strpos($string, '%') !== false ) { + $args = func_get_args(); + $args = array_splice($args, 1); + if ( !empty($args) ) + $string = vsprintf($string, $args); + } + if ( empty($string) ) + return; + if ( $this->in_loop ) + echo "$string
\n"; + else + echo "

$string

\n"; + } + + function header() { + // Nothing, This will be displayed within a iframe. + } + + function footer() { + // Nothing, This will be displayed within a iframe. + } + function error($error) { + if ( is_string($error) && isset( $this->upgrader->strings[$error] ) ) + $this->error = $this->upgrader->strings[$error]; + + if ( is_wp_error($error) ) { + foreach ( $error->get_error_messages() as $emessage ) { + if ( $error->get_error_data() ) + $messages[] = $emessage . ' ' . $error->get_error_data(); + else + $messages[] = $emessage; + } + $this->error = implode(', ', $messages); + } + echo ''; + } + + function bulk_header() { + $this->feedback('skin_upgrade_start'); + } + + function bulk_footer() { + $this->feedback('skin_upgrade_end'); + } + + function before($title = '') { + $this->in_loop = true; + printf( '

' . $this->upgrader->strings['skin_before_update_header'] . '

', $title, $this->upgrader->update_current, $this->upgrader->update_count); + echo ''; + echo '

'; + $this->flush_output(); + } + + function after($title = '') { + echo '

'; + if ( $this->error || ! $this->result ) { + if ( $this->error ) + echo '

' . sprintf($this->upgrader->strings['skin_update_failed_error'], $title, $this->error) . '

'; + else + echo '

' . sprintf($this->upgrader->strings['skin_update_failed'], $title) . '

'; + + echo ''; + } + if ( !empty($this->result) && !is_wp_error($this->result) ) { + echo '

' . sprintf($this->upgrader->strings['skin_update_successful'], $title, 'jQuery(\'#progress-' . esc_js($this->upgrader->update_current) . '\').toggle();jQuery(\'span\', this).toggle(); return false;') . '

'; + echo ''; + } + + $this->reset(); + $this->flush_output(); + } + + function reset() { + $this->in_loop = false; + $this->error = false; + } + + function flush_output() { + wp_ob_end_flush_all(); + flush(); + } +} + +class Bulk_Plugin_Upgrader_Skin extends Bulk_Upgrader_Skin { + var $plugin_info = array(); // Plugin_Upgrader::bulk() will fill this in. + + function __construct($args = array()) { + parent::__construct($args); + } + + function add_strings() { + parent::add_strings(); + $this->upgrader->strings['skin_before_update_header'] = __('Updating Plugin %1$s (%2$d/%3$d)'); + } + + function before() { + parent::before($this->plugin_info['Title']); + } + + function after() { + parent::after($this->plugin_info['Title']); + } + function bulk_footer() { + parent::bulk_footer(); + $update_actions = array( + 'plugins_page' => '' . __('Return to Plugins page') . '', + 'updates_page' => '' . __('Return to WordPress Updates') . '' + ); + + $update_actions = apply_filters('update_bulk_plugins_complete_actions', $update_actions, $this->plugin_info); + if ( ! empty($update_actions) ) + $this->feedback(implode(' | ', (array)$update_actions)); + } +} + +class Bulk_Theme_Upgrader_Skin extends Bulk_Upgrader_Skin { + var $theme_info = array(); // Theme_Upgrader::bulk() will fill this in. + + function __construct($args = array()) { + parent::__construct($args); + } + + function add_strings() { + parent::add_strings(); + $this->upgrader->strings['skin_before_update_header'] = __('Updating Theme %1$s (%2$d/%3$d)'); + } + + function before() { + parent::before($this->theme_info['Name']); + } + + function after() { + parent::after($this->theme_info['Name']); + } + function bulk_footer() { + parent::bulk_footer(); + $update_actions = array( + 'themes_page' => '' . __('Return to Themes page') . '', + 'updates_page' => '' . __('Return to WordPress Updates') . '' + ); + + $update_actions = apply_filters('update_bulk_theme_complete_actions', $update_actions, $this->theme_info); + if ( ! empty($update_actions) ) + $this->feedback(implode(' | ', (array)$update_actions)); + } +} + +/** + * Plugin Installer Skin for WordPress Plugin Installer. + * + * @TODO More Detailed docs, for methods as well. + * + * @package WordPress + * @subpackage Upgrader + * @since 2.8.0 + */ +class Plugin_Installer_Skin extends WP_Upgrader_Skin { + var $api; + var $type; + + function __construct($args = array()) { + $defaults = array( 'type' => 'web', 'url' => '', 'plugin' => '', 'nonce' => '', 'title' => '' ); + $args = wp_parse_args($args, $defaults); + + $this->type = $args['type']; + $this->api = isset($args['api']) ? $args['api'] : array(); + + parent::__construct($args); + } + + function before() { + if ( !empty($this->api) ) + $this->upgrader->strings['process_success'] = sprintf( __('Successfully installed the plugin %s %s.'), $this->api->name, $this->api->version); + } + + function after() { + + $plugin_file = $this->upgrader->plugin_info(); + + $install_actions = array(); + + $from = isset($_GET['from']) ? stripslashes($_GET['from']) : 'plugins'; + + if ( 'import' == $from ) + $install_actions['activate_plugin'] = '' . __('Activate Plugin & Run Importer') . ''; + else + $install_actions['activate_plugin'] = '' . __('Activate Plugin') . ''; + + if ( is_multisite() && current_user_can( 'manage_network_plugins' ) ) { + $install_actions['network_activate'] = '' . __('Network Activate') . ''; + unset( $install_actions['activate_plugin'] ); + } + + if ( 'import' == $from ) + $install_actions['importers_page'] = '' . __('Return to Importers') . ''; + else if ( $this->type == 'web' ) + $install_actions['plugins_page'] = '' . __('Return to Plugin Installer') . ''; + else + $install_actions['plugins_page'] = '' . __('Return to Plugins page') . ''; + + + if ( ! $this->result || is_wp_error($this->result) ) { + unset( $install_actions['activate_plugin'] ); + unset( $install_actions['network_activate'] ); + } + $install_actions = apply_filters('install_plugin_complete_actions', $install_actions, $this->api, $plugin_file); + if ( ! empty($install_actions) ) + $this->feedback(implode(' | ', (array)$install_actions)); + } +} + +/** + * Theme Installer Skin for the WordPress Theme Installer. + * + * @TODO More Detailed docs, for methods as well. + * + * @package WordPress + * @subpackage Upgrader + * @since 2.8.0 + */ +class Theme_Installer_Skin extends WP_Upgrader_Skin { + var $api; + var $type; + + function __construct($args = array()) { + $defaults = array( 'type' => 'web', 'url' => '', 'theme' => '', 'nonce' => '', 'title' => '' ); + $args = wp_parse_args($args, $defaults); + + $this->type = $args['type']; + $this->api = isset($args['api']) ? $args['api'] : array(); + + parent::__construct($args); + } + + function before() { + if ( !empty($this->api) ) { + /* translators: 1: theme name, 2: version */ + $this->upgrader->strings['process_success'] = sprintf( __('Successfully installed the theme %1$s %2$s.'), $this->api->name, $this->api->version); + } + } + + function after() { + if ( empty($this->upgrader->result['destination_name']) ) + return; + + $theme_info = $this->upgrader->theme_info(); + if ( empty($theme_info) ) + return; + $name = $theme_info['Name']; + $stylesheet = $this->upgrader->result['destination_name']; + $template = !empty($theme_info['Template']) ? $theme_info['Template'] : $stylesheet; + + $preview_link = htmlspecialchars( add_query_arg( array('preview' => 1, 'template' => $template, 'stylesheet' => $stylesheet, 'preview_iframe' => 1, 'TB_iframe' => 'true' ), trailingslashit(esc_url(get_option('home'))) ) ); + $activate_link = wp_nonce_url("themes.php?action=activate&template=" . urlencode($template) . "&stylesheet=" . urlencode($stylesheet), 'switch-theme_' . $template); + + $install_actions = array( + 'preview' => '' . __('Preview') . '', + 'activate' => '' . __('Activate') . '' + ); + + if ( $this->type == 'web' ) + $install_actions['themes_page'] = '' . __('Return to Theme Installer') . ''; + else + $install_actions['themes_page'] = '' . __('Return to Themes page') . ''; + + if ( ! $this->result || is_wp_error($this->result) || is_network_admin() ) + unset( $install_actions['activate'], $install_actions['preview'] ); + + $install_actions = apply_filters('install_theme_complete_actions', $install_actions, $this->api, $stylesheet, $theme_info); + if ( ! empty($install_actions) ) + $this->feedback(implode(' | ', (array)$install_actions)); + } +} + +/** + * Theme Upgrader Skin for WordPress Theme Upgrades. + * + * @TODO More Detailed docs, for methods as well. + * + * @package WordPress + * @subpackage Upgrader + * @since 2.8.0 + */ +class Theme_Upgrader_Skin extends WP_Upgrader_Skin { + var $theme = ''; + + function __construct($args = array()) { + $defaults = array( 'url' => '', 'theme' => '', 'nonce' => '', 'title' => __('Update Theme') ); + $args = wp_parse_args($args, $defaults); + + $this->theme = $args['theme']; + + parent::__construct($args); + } + + function after() { + + $update_actions = array(); + if ( !empty($this->upgrader->result['destination_name']) && + ($theme_info = $this->upgrader->theme_info()) && + !empty($theme_info) ) { + + $name = $theme_info['Name']; + $stylesheet = $this->upgrader->result['destination_name']; + $template = !empty($theme_info['Template']) ? $theme_info['Template'] : $stylesheet; + + $preview_link = htmlspecialchars( add_query_arg( array('preview' => 1, 'template' => $template, 'stylesheet' => $stylesheet, 'TB_iframe' => 'true' ), trailingslashit(esc_url(get_option('home'))) ) ); + $activate_link = wp_nonce_url("themes.php?action=activate&template=" . urlencode($template) . "&stylesheet=" . urlencode($stylesheet), 'switch-theme_' . $template); + + $update_actions['preview'] = '' . __('Preview') . ''; + $update_actions['activate'] = '' . __('Activate') . ''; + + if ( ( ! $this->result || is_wp_error($this->result) ) || $stylesheet == get_stylesheet() ) + unset($update_actions['preview'], $update_actions['activate']); + } + + $update_actions['themes_page'] = '' . __('Return to Themes page') . ''; + + $update_actions = apply_filters('update_theme_complete_actions', $update_actions, $this->theme); + if ( ! empty($update_actions) ) + $this->feedback(implode(' | ', (array)$update_actions)); + } +} + +/** + * Upgrade Skin helper for File uploads. This class handles the upload process and passes it as if its a local file to the Upgrade/Installer functions. + * + * @TODO More Detailed docs, for methods as well. + * + * @package WordPress + * @subpackage Upgrader + * @since 2.8.0 + */ +class File_Upload_Upgrader { + var $package; + var $filename; + + function __construct($form, $urlholder) { + if ( ! ( ( $uploads = wp_upload_dir() ) && false === $uploads['error'] ) ) + wp_die($uploads['error']); + + if ( empty($_FILES[$form]['name']) && empty($_GET[$urlholder]) ) + wp_die(__('Please select a file')); + + if ( !empty($_FILES) ) + $this->filename = $_FILES[$form]['name']; + else if ( isset($_GET[$urlholder]) ) + $this->filename = $_GET[$urlholder]; + + //Handle a newly uploaded file, Else assume its already been uploaded + if ( !empty($_FILES) ) { + $this->filename = wp_unique_filename( $uploads['basedir'], $this->filename ); + $this->package = $uploads['basedir'] . '/' . $this->filename; + + // Move the file to the uploads dir + if ( false === @ move_uploaded_file( $_FILES[$form]['tmp_name'], $this->package) ) + wp_die( sprintf( __('The uploaded file could not be moved to %s.' ), $uploads['path'])); + } else { + $this->package = $uploads['basedir'] . '/' . $this->filename; + } + } +} \ No newline at end of file diff --git a/src/wp-admin/includes/class-wp-users-list-table.php b/src/wp-admin/includes/class-wp-users-list-table.php new file mode 100644 index 0000000..de22748 --- /dev/null +++ b/src/wp-admin/includes/class-wp-users-list-table.php @@ -0,0 +1,320 @@ +is_site_users = 'site-users-network' == $screen->id; + + if ( $this->is_site_users ) + $this->site_id = isset( $_REQUEST['id'] ) ? intval( $_REQUEST['id'] ) : 0; + + parent::__construct( array( + 'singular' => 'user', + 'plural' => 'users' + ) ); + } + + function ajax_user_can() { + if ( $this->is_site_users ) + return current_user_can( 'manage_sites' ); + else + return current_user_can( 'list_users' ); + } + + function prepare_items() { + global $role, $usersearch; + + $usersearch = isset( $_REQUEST['s'] ) ? $_REQUEST['s'] : ''; + + $role = isset( $_REQUEST['role'] ) ? $_REQUEST['role'] : ''; + + $per_page = ( $this->is_site_users ) ? 'site_users_network_per_page' : 'users_per_page'; + $users_per_page = $this->get_items_per_page( $per_page ); + + $paged = $this->get_pagenum(); + + $args = array( + 'number' => $users_per_page, + 'offset' => ( $paged-1 ) * $users_per_page, + 'role' => $role, + 'search' => $usersearch, + 'fields' => 'all_with_meta' + ); + + if ( '' !== $args['search'] ) + $args['search'] = '*' . $args['search'] . '*'; + + if ( $this->is_site_users ) + $args['blog_id'] = $this->site_id; + + if ( isset( $_REQUEST['orderby'] ) ) + $args['orderby'] = $_REQUEST['orderby']; + + if ( isset( $_REQUEST['order'] ) ) + $args['order'] = $_REQUEST['order']; + + // Query the user IDs for this page + $wp_user_search = new WP_User_Query( $args ); + + $this->items = $wp_user_search->get_results(); + + $this->set_pagination_args( array( + 'total_items' => $wp_user_search->get_total(), + 'per_page' => $users_per_page, + ) ); + } + + function no_items() { + _e( 'No matching users were found.' ); + } + + function get_views() { + global $wp_roles, $role; + + if ( $this->is_site_users ) { + $url = 'site-users.php?id=' . $this->site_id; + switch_to_blog( $this->site_id ); + $users_of_blog = count_users(); + restore_current_blog(); + } else { + $url = 'users.php'; + $users_of_blog = count_users(); + } + $total_users = $users_of_blog['total_users']; + $avail_roles =& $users_of_blog['avail_roles']; + unset($users_of_blog); + + $current_role = false; + $class = empty($role) ? ' class="current"' : ''; + $role_links = array(); + $role_links['all'] = "" . sprintf( _nx( 'All (%s)', 'All (%s)', $total_users, 'users' ), number_format_i18n( $total_users ) ) . ''; + foreach ( $wp_roles->get_names() as $this_role => $name ) { + if ( !isset($avail_roles[$this_role]) ) + continue; + + $class = ''; + + if ( $this_role == $role ) { + $current_role = $role; + $class = ' class="current"'; + } + + $name = translate_user_role( $name ); + /* translators: User role name with count */ + $name = sprintf( __('%1$s (%2$s)'), $name, $avail_roles[$this_role] ); + $role_links[$this_role] = "$name"; + } + + return $role_links; + } + + function get_bulk_actions() { + $actions = array(); + + if ( is_multisite() ) { + if ( current_user_can( 'remove_users' ) ) + $actions['remove'] = __( 'Remove' ); + } else { + if ( current_user_can( 'delete_users' ) ) + $actions['delete'] = __( 'Delete' ); + } + + return $actions; + } + + function extra_tablenav( $which ) { + if ( 'top' != $which ) + return; + if ( ! current_user_can( 'promote_users' ) ) + return; +?> +
+ + + +
+ '', + 'username' => __( 'Username' ), + 'name' => __( 'Name' ), + 'email' => __( 'E-mail' ), + 'role' => __( 'Role' ), + 'posts' => __( 'Posts' ) + ); + + if ( $this->is_site_users ) + unset( $c['posts'] ); + + return $c; + } + + function get_sortable_columns() { + $c = array( + 'username' => 'login', + 'name' => 'name', + 'email' => 'email', + ); + + if ( $this->is_site_users ) + unset( $c['posts'] ); + + return $c; + } + + function display_rows() { + // Query the post counts for this page + if ( ! $this->is_site_users ) + $post_counts = count_many_users_posts( array_keys( $this->items ) ); + + $style = ''; + foreach ( $this->items as $userid => $user_object ) { + $role = reset( $user_object->roles ); + + if ( is_multisite() && empty( $role ) ) + continue; + + $style = ( ' class="alternate"' == $style ) ? '' : ' class="alternate"'; + echo "\n\t", $this->single_row( $user_object, $style, $role, isset( $post_counts ) ? $post_counts[ $userid ] : 0 ); + } + } + + /** + * Generate HTML for a single row on the users.php admin panel. + * + * @since 2.1.0 + * + * @param object $user_object + * @param string $style Optional. Attributes added to the TR element. Must be sanitized. + * @param string $role Key for the $wp_roles array. + * @param int $numposts Optional. Post count to display for this user. Defaults to zero, as in, a new user has made zero posts. + * @return string + */ + function single_row( $user_object, $style = '', $role = '', $numposts = 0 ) { + global $wp_roles; + + if ( !( is_object( $user_object ) && is_a( $user_object, 'WP_User' ) ) ) + $user_object = new WP_User( (int) $user_object ); + $user_object = sanitize_user_object( $user_object, 'display' ); + $email = $user_object->user_email; + + if ( $this->is_site_users ) + $url = "site-users.php?id={$this->site_id}&"; + else + $url = 'users.php?'; + + $checkbox = ''; + // Check if the user for this row is editable + if ( current_user_can( 'list_users' ) ) { + // Set up the user editing link + // TODO: make profile/user-edit determination a separate function + if ( get_current_user_id() == $user_object->ID ) { + $edit_link = 'profile.php'; + } else { + $edit_link = esc_url( add_query_arg( 'wp_http_referer', urlencode( stripslashes( $_SERVER['REQUEST_URI'] ) ), "user-edit.php?user_id=$user_object->ID" ) ); + } + + // Set up the hover actions for this user + $actions = array(); + + if ( current_user_can( 'edit_user', $user_object->ID ) ) { + $edit = "$user_object->user_login
"; + $actions['edit'] = '' . __( 'Edit' ) . ''; + } else { + $edit = "$user_object->user_login
"; + } + + if ( !is_multisite() && get_current_user_id() != $user_object->ID && current_user_can( 'delete_user', $user_object->ID ) ) + $actions['delete'] = "" . __( 'Delete' ) . ""; + if ( is_multisite() && get_current_user_id() != $user_object->ID && current_user_can( 'remove_user', $user_object->ID ) ) + $actions['remove'] = "" . __( 'Remove' ) . ""; + $actions = apply_filters( 'user_row_actions', $actions, $user_object ); + $edit .= $this->row_actions( $actions ); + + // Set up the checkbox ( because the user is editable, otherwise its empty ) + $checkbox = ""; + + } else { + $edit = '' . $user_object->user_login . ''; + } + $role_name = isset( $wp_roles->role_names[$role] ) ? translate_user_role( $wp_roles->role_names[$role] ) : __( 'None' ); + $avatar = get_avatar( $user_object->ID, 32 ); + + $r = ""; + + list( $columns, $hidden ) = $this->get_column_info(); + + foreach ( $columns as $column_name => $column_display_name ) { + $class = "class=\"$column_name column-$column_name\""; + + $style = ''; + if ( in_array( $column_name, $hidden ) ) + $style = ' style="display:none;"'; + + $attributes = "$class$style"; + + switch ( $column_name ) { + case 'cb': + $r .= "$checkbox"; + break; + case 'username': + $r .= "$avatar $edit"; + break; + case 'name': + $r .= "$user_object->first_name $user_object->last_name"; + break; + case 'email': + $r .= "$email"; + break; + case 'role': + $r .= "$role_name"; + break; + case 'posts': + $attributes = 'class="posts column-posts num"' . $style; + $r .= ""; + if ( $numposts > 0 ) { + $r .= ""; + $r .= $numposts; + $r .= ''; + } else { + $r .= 0; + } + $r .= ""; + break; + default: + $r .= ""; + $r .= apply_filters( 'manage_users_custom_column', '', $column_name, $user_object->ID ); + $r .= ""; + } + } + $r .= ''; + + return $r; + } +} + +?> diff --git a/src/wp-admin/includes/comment.php b/src/wp-admin/includes/comment.php new file mode 100644 index 0000000..d731130 --- /dev/null +++ b/src/wp-admin/includes/comment.php @@ -0,0 +1,159 @@ +get_var( $wpdb->prepare("SELECT comment_post_ID FROM $wpdb->comments + WHERE comment_author = %s AND comment_date = %s", $comment_author, $comment_date) ); +} + +/** + * Update a comment with values provided in $_POST. + * + * @since 2.0.0 + */ +function edit_comment() { + + if ( ! current_user_can( 'edit_comment', (int) $_POST['comment_ID'] ) ) + wp_die ( __( 'You are not allowed to edit comments on this post.' ) ); + + $_POST['comment_author'] = $_POST['newcomment_author']; + $_POST['comment_author_email'] = $_POST['newcomment_author_email']; + $_POST['comment_author_url'] = $_POST['newcomment_author_url']; + $_POST['comment_approved'] = $_POST['comment_status']; + $_POST['comment_content'] = $_POST['content']; + $_POST['comment_ID'] = (int) $_POST['comment_ID']; + + foreach ( array ('aa', 'mm', 'jj', 'hh', 'mn') as $timeunit ) { + if ( !empty( $_POST['hidden_' . $timeunit] ) && $_POST['hidden_' . $timeunit] != $_POST[$timeunit] ) { + $_POST['edit_date'] = '1'; + break; + } + } + + if ( !empty ( $_POST['edit_date'] ) ) { + $aa = $_POST['aa']; + $mm = $_POST['mm']; + $jj = $_POST['jj']; + $hh = $_POST['hh']; + $mn = $_POST['mn']; + $ss = $_POST['ss']; + $jj = ($jj > 31 ) ? 31 : $jj; + $hh = ($hh > 23 ) ? $hh -24 : $hh; + $mn = ($mn > 59 ) ? $mn -60 : $mn; + $ss = ($ss > 59 ) ? $ss -60 : $ss; + $_POST['comment_date'] = "$aa-$mm-$jj $hh:$mn:$ss"; + } + + wp_update_comment( $_POST ); +} + +/** + * {@internal Missing Short Description}} + * + * @since 2.0.0 + * + * @param int $id ID of comment to retrieve + * @return bool|object Comment if found. False on failure. + */ +function get_comment_to_edit( $id ) { + if ( !$comment = get_comment($id) ) + return false; + + $comment->comment_ID = (int) $comment->comment_ID; + $comment->comment_post_ID = (int) $comment->comment_post_ID; + + $comment->comment_content = format_to_edit( $comment->comment_content ); + $comment->comment_content = apply_filters( 'comment_edit_pre', $comment->comment_content); + + $comment->comment_author = format_to_edit( $comment->comment_author ); + $comment->comment_author_email = format_to_edit( $comment->comment_author_email ); + $comment->comment_author_url = format_to_edit( $comment->comment_author_url ); + $comment->comment_author_url = esc_url($comment->comment_author_url); + + return $comment; +} + +/** + * Get the number of pending comments on a post or posts + * + * @since 2.3.0 + * @uses $wpdb + * + * @param int|array $post_id Either a single Post ID or an array of Post IDs + * @return int|array Either a single Posts pending comments as an int or an array of ints keyed on the Post IDs + */ +function get_pending_comments_num( $post_id ) { + global $wpdb; + + $single = false; + if ( !is_array($post_id) ) { + $post_id_array = (array) $post_id; + $single = true; + } else { + $post_id_array = $post_id; + } + $post_id_array = array_map('intval', $post_id_array); + $post_id_in = "'" . implode("', '", $post_id_array) . "'"; + + $pending = $wpdb->get_results( "SELECT comment_post_ID, COUNT(comment_ID) as num_comments FROM $wpdb->comments WHERE comment_post_ID IN ( $post_id_in ) AND comment_approved = '0' GROUP BY comment_post_ID", ARRAY_A ); + + if ( $single ) { + if ( empty($pending) ) + return 0; + else + return absint($pending[0]['num_comments']); + } + + $pending_keyed = array(); + + // Default to zero pending for all posts in request + foreach ( $post_id_array as $id ) + $pending_keyed[$id] = 0; + + if ( !empty($pending) ) + foreach ( $pending as $pend ) + $pending_keyed[$pend['comment_post_ID']] = absint($pend['num_comments']); + + return $pending_keyed; +} + +/** + * Add avatars to relevant places in admin, or try to. + * + * @since 2.5.0 + * @uses $comment + * + * @param string $name User name. + * @return string Avatar with Admin name. + */ +function floated_admin_avatar( $name ) { + global $comment; + $avatar = get_avatar( $comment, 32 ); + return "$avatar $name"; +} + +function enqueue_comment_hotkeys_js() { + if ( 'true' == get_user_option( 'comment_shortcuts' ) ) + wp_enqueue_script( 'jquery-table-hotkeys' ); +} +?> diff --git a/src/wp-admin/includes/continents-cities.php b/src/wp-admin/includes/continents-cities.php new file mode 100644 index 0000000..0ebc4f3 --- /dev/null +++ b/src/wp-admin/includes/continents-cities.php @@ -0,0 +1,493 @@ + 5, + ); + } + $recent_comments_title = __( 'Recent Comments' ); + wp_add_dashboard_widget( 'dashboard_recent_comments', $recent_comments_title, 'wp_dashboard_recent_comments', 'wp_dashboard_recent_comments_control' ); + } + + // Incoming Links Widget + if ( is_blog_admin() && current_user_can('publish_posts') ) { + if ( !isset( $widget_options['dashboard_incoming_links'] ) || !isset( $widget_options['dashboard_incoming_links']['home'] ) || $widget_options['dashboard_incoming_links']['home'] != get_option('home') ) { + $update = true; + $num_items = isset($widget_options['dashboard_incoming_links']['items']) ? $widget_options['dashboard_incoming_links']['items'] : 10; + $widget_options['dashboard_incoming_links'] = array( + 'home' => get_option('home'), + 'link' => apply_filters( 'dashboard_incoming_links_link', 'http://blogsearch.google.com/blogsearch?scoring=d&partner=wordpress&q=link:' . trailingslashit( get_option('home') ) ), + 'url' => isset($widget_options['dashboard_incoming_links']['url']) ? apply_filters( 'dashboard_incoming_links_feed', $widget_options['dashboard_incoming_links']['url'] ) : apply_filters( 'dashboard_incoming_links_feed', 'http://blogsearch.google.com/blogsearch_feeds?scoring=d&ie=utf-8&num=' . $num_items . '&output=rss&partner=wordpress&q=link:' . trailingslashit( get_option('home') ) ), + 'items' => $num_items, + 'show_date' => isset($widget_options['dashboard_incoming_links']['show_date']) ? $widget_options['dashboard_incoming_links']['show_date'] : false + ); + } + wp_add_dashboard_widget( 'dashboard_incoming_links', __( 'Incoming Links' ), 'wp_dashboard_incoming_links', 'wp_dashboard_incoming_links_control' ); + } + + // WP Plugins Widget + if ( ( ! is_multisite() && is_blog_admin() && current_user_can( 'install_plugins' ) ) || ( is_network_admin() && current_user_can( 'manage_network_plugins' ) && current_user_can( 'install_plugins' ) ) ) + wp_add_dashboard_widget( 'dashboard_plugins', __( 'Plugins' ), 'wp_dashboard_plugins' ); + + // QuickPress Widget + if ( is_blog_admin() && current_user_can('edit_posts') ) + wp_add_dashboard_widget( 'dashboard_quick_press', __( 'QuickPress' ), 'wp_dashboard_quick_press' ); + + // Recent Drafts + if ( is_blog_admin() && current_user_can('edit_posts') ) + wp_add_dashboard_widget( 'dashboard_recent_drafts', __('Recent Drafts'), 'wp_dashboard_recent_drafts' ); + + // Primary feed (Dev Blog) Widget + if ( !isset( $widget_options['dashboard_primary'] ) ) { + $update = true; + $widget_options['dashboard_primary'] = array( + 'link' => apply_filters( 'dashboard_primary_link', __( 'http://wordpress.org/news/' ) ), + 'url' => apply_filters( 'dashboard_primary_feed', __( 'http://wordpress.org/news/feed/' ) ), + 'title' => apply_filters( 'dashboard_primary_title', __( 'WordPress Blog' ) ), + 'items' => 2, + 'show_summary' => 1, + 'show_author' => 0, + 'show_date' => 1, + ); + } + wp_add_dashboard_widget( 'dashboard_primary', $widget_options['dashboard_primary']['title'], 'wp_dashboard_primary', 'wp_dashboard_primary_control' ); + + // Secondary Feed (Planet) Widget + if ( !isset( $widget_options['dashboard_secondary'] ) ) { + $update = true; + $widget_options['dashboard_secondary'] = array( + 'link' => apply_filters( 'dashboard_secondary_link', __( 'http://planet.wordpress.org/' ) ), + 'url' => apply_filters( 'dashboard_secondary_feed', __( 'http://planet.wordpress.org/feed/' ) ), + 'title' => apply_filters( 'dashboard_secondary_title', __( 'Other WordPress News' ) ), + 'items' => 5, + 'show_summary' => 0, + 'show_author' => 0, + 'show_date' => 0, + ); + } + wp_add_dashboard_widget( 'dashboard_secondary', $widget_options['dashboard_secondary']['title'], 'wp_dashboard_secondary', 'wp_dashboard_secondary_control' ); + + // Hook to register new widgets + // Filter widget order + if ( is_network_admin() ) { + do_action( 'wp_network_dashboard_setup' ); + $dashboard_widgets = apply_filters( 'wp_network_dashboard_widgets', array() ); + } elseif ( is_user_admin() ) { + do_action( 'wp_user_dashboard_setup' ); + $dashboard_widgets = apply_filters( 'wp_user_dashboard_widgets', array() ); + } else { + do_action( 'wp_dashboard_setup' ); + $dashboard_widgets = apply_filters( 'wp_dashboard_widgets', array() ); + } + + foreach ( $dashboard_widgets as $widget_id ) { + $name = empty( $wp_registered_widgets[$widget_id]['all_link'] ) ? $wp_registered_widgets[$widget_id]['name'] : $wp_registered_widgets[$widget_id]['name'] . " " . __('View all') . ''; + wp_add_dashboard_widget( $widget_id, $name, $wp_registered_widgets[$widget_id]['callback'], $wp_registered_widget_controls[$widget_id]['callback'] ); + } + + if ( 'POST' == $_SERVER['REQUEST_METHOD'] && isset($_POST['widget_id']) ) { + ob_start(); // hack - but the same hack wp-admin/widgets.php uses + wp_dashboard_trigger_widget_control( $_POST['widget_id'] ); + ob_end_clean(); + wp_redirect( remove_query_arg( 'edit' ) ); + exit; + } + + if ( $update ) + update_option( 'dashboard_widget_options', $widget_options ); + + do_action('do_meta_boxes', $screen->id, 'normal', ''); + do_action('do_meta_boxes', $screen->id, 'side', ''); +} + +function wp_add_dashboard_widget( $widget_id, $widget_name, $callback, $control_callback = null ) { + $screen = get_current_screen(); + global $wp_dashboard_control_callbacks; + + if ( $control_callback && current_user_can( 'edit_dashboard' ) && is_callable( $control_callback ) ) { + $wp_dashboard_control_callbacks[$widget_id] = $control_callback; + if ( isset( $_GET['edit'] ) && $widget_id == $_GET['edit'] ) { + list($url) = explode( '#', add_query_arg( 'edit', false ), 2 ); + $widget_name .= ' ' . __( 'Cancel' ) . ''; + $callback = '_wp_dashboard_control_callback'; + } else { + list($url) = explode( '#', add_query_arg( 'edit', $widget_id ), 2 ); + $widget_name .= ' ' . __( 'Configure' ) . ''; + } + } + + if ( is_blog_admin () ) + $side_widgets = array('dashboard_quick_press', 'dashboard_recent_drafts', 'dashboard_primary', 'dashboard_secondary'); + else if (is_network_admin() ) + $side_widgets = array('dashboard_primary', 'dashboard_secondary'); + else + $side_widgets = array(); + + $location = 'normal'; + if ( in_array($widget_id, $side_widgets) ) + $location = 'side'; + + $priority = 'core'; + if ( 'dashboard_browser_nag' === $widget_id ) + $priority = 'high'; + + add_meta_box( $widget_id, $widget_name, $callback, $screen->id, $location, $priority ); +} + +function _wp_dashboard_control_callback( $dashboard, $meta_box ) { + echo '
'; + wp_dashboard_trigger_widget_control( $meta_box['id'] ); + echo ''; + submit_button( __('Submit') ); + echo '
'; +} + +/** + * Displays the dashboard. + * + * @since 2.5.0 + */ +function wp_dashboard() { + global $screen_layout_columns; + + $screen = get_current_screen(); + + $hide2 = $hide3 = $hide4 = ''; + switch ( $screen_layout_columns ) { + case 4: + $width = 'width:24.5%;'; + break; + case 3: + $width = 'width:32.67%;'; + $hide4 = 'display:none;'; + break; + case 2: + $width = 'width:49%;'; + $hide3 = $hide4 = 'display:none;'; + break; + default: + $width = 'width:98%;'; + $hide2 = $hide3 = $hide4 = 'display:none;'; + } +?> +
+\n"; + do_meta_boxes( $screen->id, 'normal', '' ); + + echo "\t
\n"; + do_meta_boxes( $screen->id, 'side', '' ); + + echo "\t
\n"; + do_meta_boxes( $screen->id, 'column3', '' ); + + echo "\t
\n"; + do_meta_boxes( $screen->id, 'column4', '' ); +?> +
+ +
+

+ +

+
+ +'; + echo "\n\t".'

' . __('Content') . '

'."\n\t".''; + echo "\n\t".''; + + // Posts + $num = number_format_i18n( $num_posts->publish ); + $text = _n( 'Post', 'Posts', intval($num_posts->publish) ); + if ( current_user_can( 'edit_posts' ) ) { + $num = "$num"; + $text = "$text"; + } + echo ''; + echo ''; + + echo ''; + /* TODO: Show status breakdown on hover + if ( $can_edit_pages && !empty($num_pages->publish) ) { // how many pages is not exposed in feeds. Don't show if !current_user_can + $post_type_texts[] = ''.sprintf( _n( '%s page', '%s pages', $num_pages->publish ), number_format_i18n( $num_pages->publish ) ).''; + } + if ( $can_edit_posts && !empty($num_posts->draft) ) { + $post_type_texts[] = ''.sprintf( _n( '%s draft', '%s drafts', $num_posts->draft ), number_format_i18n( $num_posts->draft ) ).''; + } + if ( $can_edit_posts && !empty($num_posts->future) ) { + $post_type_texts[] = ''.sprintf( _n( '%s scheduled post', '%s scheduled posts', $num_posts->future ), number_format_i18n( $num_posts->future ) ).''; + } + if ( current_user_can('publish_posts') && !empty($num_posts->pending) ) { + $pending_text = sprintf( _n( 'There is %2$s post pending your review.', 'There are %2$s posts pending your review.', $num_posts->pending ), 'edit.php?post_status=pending', number_format_i18n( $num_posts->pending ) ); + } else { + $pending_text = ''; + } + */ + + // Pages + $num = number_format_i18n( $num_pages->publish ); + $text = _n( 'Page', 'Pages', $num_pages->publish ); + if ( current_user_can( 'edit_pages' ) ) { + $num = "$num"; + $text = "$text"; + } + echo ''; + echo ''; + + echo ''; + + // Categories + $num = number_format_i18n( $num_cats ); + $text = _n( 'Category', 'Categories', $num_cats ); + if ( current_user_can( 'manage_categories' ) ) { + $num = "$num"; + $text = "$text"; + } + echo ''; + echo ''; + + echo ''; + + // Tags + $num = number_format_i18n( $num_tags ); + $text = _n( 'Tag', 'Tags', $num_tags ); + if ( current_user_can( 'manage_categories' ) ) { + $num = "$num"; + $text = "$text"; + } + echo ''; + echo ''; + + echo ""; + do_action('right_now_content_table_end'); + echo "\n\t
' . $num . '' . $text . '
' . $num . '' . $text . '
' . $num . '' . $text . '
' . $num . '' . $text . '
\n\t
"; + + + echo "\n\t".'
'; + echo "\n\t".'

' . __('Discussion') . '

'."\n\t".''; + echo "\n\t".''; + + // Total Comments + $num = '' . number_format_i18n($num_comm->total_comments) . ''; + $text = _n( 'Comment', 'Comments', $num_comm->total_comments ); + if ( current_user_can( 'moderate_comments' ) ) { + $num = '' . $num . ''; + $text = '' . $text . ''; + } + echo ''; + echo ''; + + echo ''; + + // Approved Comments + $num = '' . number_format_i18n($num_comm->approved) . ''; + $text = _nx( 'Approved', 'Approved', $num_comm->approved, 'Right Now' ); + if ( current_user_can( 'moderate_comments' ) ) { + $num = "$num"; + $text = "$text"; + } + echo ''; + echo ''; + + echo "\n\t"; + + // Pending Comments + $num = '' . number_format_i18n($num_comm->moderated) . ''; + $text = _n( 'Pending', 'Pending', $num_comm->moderated ); + if ( current_user_can( 'moderate_comments' ) ) { + $num = "$num"; + $text = "$text"; + } + echo ''; + echo ''; + + echo "\n\t"; + + // Spam Comments + $num = number_format_i18n($num_comm->spam); + $text = _nx( 'Spam', 'Spam', $num_comm->spam, 'comment' ); + if ( current_user_can( 'moderate_comments' ) ) { + $num = "$num"; + $text = "$text"; + } + echo ''; + echo ''; + + echo ""; + do_action('right_now_table_end'); + do_action('right_now_discussion_table_end'); + echo "\n\t
' . $num . '' . $text . '
' . $num . '' . $text . '
' . $num . '' . $text . '
' . $num . '' . $text . '
\n\t
"; + + echo "\n\t".'
'; + $ct = current_theme_info(); + + echo "\n\t

"; + if ( !empty($wp_registered_sidebars) ) { + $sidebars_widgets = wp_get_sidebars_widgets(); + $num_widgets = 0; + foreach ( (array) $sidebars_widgets as $k => $v ) { + if ( 'wp_inactive_widgets' == $k ) + continue; + if ( is_array($v) ) + $num_widgets = $num_widgets + count($v); + } + $num = number_format_i18n( $num_widgets ); + + $switch_themes = $ct->title; + if ( current_user_can( 'switch_themes') ) + $switch_themes = '' . $switch_themes . ''; + if ( current_user_can( 'edit_theme_options' ) ) { + printf(_n('Theme %1$s with %2$s Widget', 'Theme %1$s with %2$s Widgets', $num_widgets), $switch_themes, $num); + } else { + printf(_n('Theme %1$s with %2$s Widget', 'Theme %1$s with %2$s Widgets', $num_widgets), $switch_themes, $num); + } + } else { + if ( current_user_can( 'switch_themes' ) ) + printf( __('Theme %1$s'), $ct->title ); + else + printf( __('Theme %1$s'), $ct->title ); + } + echo '

'; + + // Check if search engines are blocked. + if ( !is_network_admin() && !is_user_admin() && current_user_can('manage_options') && '1' != get_option('blog_public') ) { + $title = apply_filters('privacy_on_link_title', __('Your site is asking search engines not to index its content') ); + $content = apply_filters('privacy_on_link_text', __('Search Engines Blocked') ); + + echo "

$content

"; + } + + update_right_now_message(); + + echo "\n\t".'
'; + do_action( 'rightnow_end' ); + do_action( 'activity_box_end' ); +} + +function wp_network_dashboard_right_now() { + $actions = array(); + if ( current_user_can('create_sites') ) + $actions['create-site'] = '' . __( 'Create a New Site' ) . ''; + if ( current_user_can('create_users') ) + $actions['create-user'] = '' . __( 'Create a New User' ) . ''; + + $c_users = get_user_count(); + $c_blogs = get_blog_count(); + + $user_text = sprintf( _n( '%s user', '%s users', $c_users ), number_format_i18n( $c_users ) ); + $blog_text = sprintf( _n( '%s site', '%s sites', $c_blogs ), number_format_i18n( $c_blogs ) ); + + $sentence = sprintf( __( 'You have %1$s and %2$s.' ), $blog_text, $user_text ); + + if ( $actions ) { + echo ''; + } +?> +
+ +

+ + +
+

+ + 'submit_users' ) ); ?> +

+
+ +
+

+ + 'submit_sites' ) ); ?> +

+
+

' . __( 'Post published. View post | Edit post' ) . '

', esc_url( $view ), $edit ); + else + printf( '

' . __( 'Post submitted. Preview post | Edit post' ) . '

', esc_url( add_query_arg( 'preview', 1, $view ) ), $edit ); + } else { + printf( '

' . __( 'Draft saved. Preview post | Edit post' ) . '

', esc_url( add_query_arg( 'preview', 1, $view ) ), $edit ); + $drafts_query = new WP_Query( array( + 'post_type' => 'post', + 'post_status' => 'draft', + 'author' => $GLOBALS['current_user']->ID, + 'posts_per_page' => 1, + 'orderby' => 'modified', + 'order' => 'DESC' + ) ); + + if ( $drafts_query->posts ) + $drafts =& $drafts_query->posts; + } + printf('

' . __('You can also try %s, easy blogging from anywhere on the Web.') . '

', '' . __('Press This') . '' ); + $_REQUEST = array(); // hack for get_default_post_to_edit() + } + + /* Check if a new auto-draft (= no new post_ID) is needed or if the old can be used */ + $last_post_id = (int) get_user_option( 'dashboard_quick_press_last_post_id' ); // Get the last post_ID + if ( $last_post_id ) { + $post = get_post( $last_post_id ); + if ( empty( $post ) || $post->post_status != 'auto-draft' ) { // auto-draft doesn't exists anymore + $post = get_default_post_to_edit('post', true); + update_user_option( (int) $GLOBALS['current_user']->ID, 'dashboard_quick_press_last_post_id', (int) $post->ID ); // Save post_ID + } else { + $post->post_title = ''; // Remove the auto draft title + } + } else { + $post = get_default_post_to_edit('post', true); + update_user_option( (int) $GLOBALS['current_user']->ID, 'dashboard_quick_press_last_post_id', (int) $post->ID ); // Save post_ID + } + + $post_ID = (int) $post->ID; +?> + +
+

+
+ +
+ + +
+ +
+ + +

+
+ +
+ + + +

+
+ +
+ +

+ + + + + 'save-post', 'tabindex'=> 4 ) ); ?> + + + + + +
+

+ +
+ + 'post', + 'post_status' => 'draft', + 'author' => $GLOBALS['current_user']->ID, + 'posts_per_page' => 5, + 'orderby' => 'modified', + 'order' => 'DESC' + ) ); + $drafts =& $drafts_query->posts; + } + + if ( $drafts && is_array( $drafts ) ) { + $list = array(); + foreach ( $drafts as $draft ) { + $url = get_edit_post_link( $draft->ID ); + $title = _draft_or_post_title( $draft->ID ); + $item = "

" . esc_html($title) . " " . get_the_time( get_option( 'date_format' ), $draft ) . '

'; + if ( $the_content = preg_split( '#\s#', strip_tags( $draft->post_content ), 11, PREG_SPLIT_NO_EMPTY ) ) + $item .= '

' . join( ' ', array_slice( $the_content, 0, 10 ) ) . ( 10 < count( $the_content ) ? '…' : '' ) . '

'; + $list[] = $item; + } +?> + +

+get_results( "SELECT * FROM $wpdb->comments c LEFT JOIN $wpdb->posts p ON c.comment_post_ID = p.ID WHERE p.post_status != 'trash' ORDER BY c.comment_date_gmt DESC LIMIT $start, 50" ) ) { + + foreach ( $possible as $comment ) { + if ( count( $comments ) >= $total_items ) + break; + if ( in_array( $comment->comment_approved, $allowed_states ) && current_user_can( 'read_post', $comment->comment_post_ID ) ) + $comments[] = $comment; + } + + $start = $start + 50; + } + + if ( $comments ) : +?> + +
+ + +
+ + + views(); ?> + + +

+ +comment_post_ID ); + $comment_post_title = strip_tags(get_the_title( $comment->comment_post_ID )); + $comment_post_link = "$comment_post_title"; + $comment_link = '#'; + + $actions_string = ''; + if ( current_user_can( 'edit_comment', $comment->comment_ID ) ) { + // preorder it: Approve | Reply | Edit | Spam | Trash + $actions = array( + 'approve' => '', 'unapprove' => '', + 'reply' => '', + 'edit' => '', + 'spam' => '', + 'trash' => '', 'delete' => '' + ); + + $del_nonce = esc_html( '_wpnonce=' . wp_create_nonce( "delete-comment_$comment->comment_ID" ) ); + $approve_nonce = esc_html( '_wpnonce=' . wp_create_nonce( "approve-comment_$comment->comment_ID" ) ); + + $approve_url = esc_url( "comment.php?action=approvecomment&p=$comment->comment_post_ID&c=$comment->comment_ID&$approve_nonce" ); + $unapprove_url = esc_url( "comment.php?action=unapprovecomment&p=$comment->comment_post_ID&c=$comment->comment_ID&$approve_nonce" ); + $spam_url = esc_url( "comment.php?action=spamcomment&p=$comment->comment_post_ID&c=$comment->comment_ID&$del_nonce" ); + $trash_url = esc_url( "comment.php?action=trashcomment&p=$comment->comment_post_ID&c=$comment->comment_ID&$del_nonce" ); + $delete_url = esc_url( "comment.php?action=deletecomment&p=$comment->comment_post_ID&c=$comment->comment_ID&$del_nonce" ); + + $actions['approve'] = "" . __( 'Approve' ) . ''; + $actions['unapprove'] = "" . __( 'Unapprove' ) . ''; + $actions['edit'] = "". __('Edit') . ''; + $actions['reply'] = '' . __('Reply') . ''; + $actions['spam'] = "" . /* translators: mark as spam link */ _x( 'Spam', 'verb' ) . ''; + if ( !EMPTY_TRASH_DAYS ) + $actions['delete'] = "" . __('Delete Permanently') . ''; + else + $actions['trash'] = "" . _x('Trash', 'verb') . ''; + + $actions = apply_filters( 'comment_row_actions', array_filter($actions), $comment ); + + $i = 0; + foreach ( $actions as $action => $link ) { + ++$i; + ( ( ('approve' == $action || 'unapprove' == $action) && 2 === $i ) || 1 === $i ) ? $sep = '' : $sep = ' | '; + + // Reply and quickedit need a hide-if-no-js span + if ( 'reply' == $action || 'quickedit' == $action ) + $action .= ' hide-if-no-js'; + + $actions_string .= "$sep$link"; + } + } + +?> + +
comment_ID) ) ); ?>> + comment_type || 'comment' == $comment->comment_type ) : ?> + + + +
+

+ ' . get_comment_author_link() . '', $comment_post_link.' '.$comment_link, ' ' . __( '[Pending]' ) . '' ); ?> +

+ + comment_type ) : + case 'pingback' : + $type = __( 'Pingback' ); + break; + case 'trackback' : + $type = __( 'Trackback' ); + break; + default : + $type = ucwords( $comment->comment_type ); + endswitch; + $type = esc_html( $type ); + ?> +
+ +

$type", $comment_post_link." ".$comment_link ); ?>

+

+ + +

+

+
+
+'; + echo '

'; +} + +function wp_dashboard_incoming_links() { + wp_dashboard_cached_rss_widget( 'dashboard_incoming_links', 'wp_dashboard_incoming_links_output' ); +} + +/** + * Display incoming links dashboard widget content. + * + * @since 2.5.0 + */ +function wp_dashboard_incoming_links_output() { + $widgets = get_option( 'dashboard_widget_options' ); + @extract( @$widgets['dashboard_incoming_links'], EXTR_SKIP ); + $rss = fetch_feed( $url ); + + if ( is_wp_error($rss) ) { + if ( is_admin() || current_user_can('manage_options') ) { + echo '

'; + printf(__('RSS Error: %s'), $rss->get_error_message()); + echo '

'; + } + return; + } + + if ( !$rss->get_item_quantity() ) { + echo '

' . __('This dashboard widget queries Google Blog Search so that when another blog links to your site it will show up here. It has found no incoming links… yet. It’s okay — there is no rush.') . "

\n"; + $rss->__destruct(); + unset($rss); + return; + } + + echo "\n"; + $rss->__destruct(); + unset($rss); +} + +function wp_dashboard_incoming_links_control() { + wp_dashboard_rss_control( 'dashboard_incoming_links', array( 'title' => false, 'show_summary' => false, 'show_author' => false ) ); +} + +function wp_dashboard_primary() { + wp_dashboard_cached_rss_widget( 'dashboard_primary', 'wp_dashboard_rss_output' ); +} + +function wp_dashboard_primary_control() { + wp_dashboard_rss_control( 'dashboard_primary' ); +} + +/** + * {@internal Missing Short Description}} + * + * @since 2.5.0 + * + * @param string $widget_id + */ +function wp_dashboard_rss_output( $widget_id ) { + $widgets = get_option( 'dashboard_widget_options' ); + echo '
'; + wp_widget_rss_output( $widgets[$widget_id] ); + echo "
"; +} + +function wp_dashboard_secondary() { + wp_dashboard_cached_rss_widget( 'dashboard_secondary', 'wp_dashboard_secondary_output' ); +} + +function wp_dashboard_secondary_control() { + wp_dashboard_rss_control( 'dashboard_secondary' ); +} + +/** + * Display secondary dashboard RSS widget feed. + * + * @since 2.5.0 + * + * @return unknown + */ +function wp_dashboard_secondary_output() { + $widgets = get_option( 'dashboard_widget_options' ); + @extract( @$widgets['dashboard_secondary'], EXTR_SKIP ); + $rss = @fetch_feed( $url ); + + if ( is_wp_error($rss) ) { + if ( is_admin() || current_user_can('manage_options') ) { + echo '

'; + printf(__('RSS Error: %s'), $rss->get_error_message()); + echo '

'; + } + } elseif ( !$rss->get_item_quantity() ) { + $rss->__destruct(); + unset($rss); + return false; + } else { + echo '
'; + wp_widget_rss_output( $rss, $widgets['dashboard_secondary'] ); + echo '
'; + $rss->__destruct(); + unset($rss); + } +} + +function wp_dashboard_plugins() { + wp_dashboard_cached_rss_widget( 'dashboard_plugins', 'wp_dashboard_plugins_output', array( + 'http://wordpress.org/extend/plugins/rss/browse/popular/', + 'http://wordpress.org/extend/plugins/rss/browse/new/', + 'http://wordpress.org/extend/plugins/rss/browse/updated/' + ) ); +} + +/** + * Display plugins most popular, newest plugins, and recently updated widget text. + * + * @since 2.5.0 + */ +function wp_dashboard_plugins_output() { + $popular = fetch_feed( 'http://wordpress.org/extend/plugins/rss/browse/popular/' ); + $new = fetch_feed( 'http://wordpress.org/extend/plugins/rss/browse/new/' ); + $updated = fetch_feed( 'http://wordpress.org/extend/plugins/rss/browse/updated/' ); + + if ( false === $plugin_slugs = get_transient( 'plugin_slugs' ) ) { + $plugin_slugs = array_keys( get_plugins() ); + set_transient( 'plugin_slugs', $plugin_slugs, 86400 ); + } + + foreach ( array( 'popular' => __('Most Popular'), 'new' => __('Newest Plugins'), 'updated' => __('Recently Updated') ) as $feed => $label ) { + if ( is_wp_error($$feed) || !$$feed->get_item_quantity() ) + continue; + + $items = $$feed->get_items(0, 5); + + // Pick a random, non-installed plugin + while ( true ) { + // Abort this foreach loop iteration if there's no plugins left of this type + if ( 0 == count($items) ) + continue 2; + + $item_key = array_rand($items); + $item = $items[$item_key]; + + list($link, $frag) = explode( '#', $item->get_link() ); + + $link = esc_url($link); + if ( preg_match( '|/([^/]+?)/?$|', $link, $matches ) ) + $slug = $matches[1]; + else { + unset( $items[$item_key] ); + continue; + } + + // Is this random plugin's slug already installed? If so, try again. + reset( $plugin_slugs ); + foreach ( $plugin_slugs as $plugin_slug ) { + if ( $slug == substr( $plugin_slug, 0, strlen( $slug ) ) ) { + unset( $items[$item_key] ); + continue 2; + } + } + + // If we get to this point, then the random plugin isn't installed and we can stop the while(). + break; + } + + // Eliminate some common badly formed plugin descriptions + while ( ( null !== $item_key = array_rand($items) ) && false !== strpos( $items[$item_key]->get_description(), 'Plugin Name:' ) ) + unset($items[$item_key]); + + if ( !isset($items[$item_key]) ) + continue; + + // current bbPress feed item titles are: user on "topic title" + if ( preg_match( '/"(.*)"/s', $item->get_title(), $matches ) ) + $title = $matches[1]; + else // but let's make it forward compatible if things change + $title = $item->get_title(); + $title = esc_html( $title ); + + $description = esc_html( strip_tags(@html_entity_decode($item->get_description(), ENT_QUOTES, get_option('blog_charset'))) ); + + $ilink = wp_nonce_url('plugin-install.php?tab=plugin-information&plugin=' . $slug, 'install-plugin_' . $slug) . + '&TB_iframe=true&width=600&height=800'; + + echo "

$label

\n"; + echo "
$title
 (" . __( 'Install' ) . ")\n"; + echo "

$description

\n"; + + $$feed->__destruct(); + unset($$feed); + } +} + +/** + * Checks to see if all of the feed url in $check_urls are cached. + * + * If $check_urls is empty, look for the rss feed url found in the dashboard + * widget optios of $widget_id. If cached, call $callback, a function that + * echoes out output for this widget. If not cache, echo a "Loading..." stub + * which is later replaced by AJAX call (see top of /wp-admin/index.php) + * + * @since 2.5.0 + * + * @param string $widget_id + * @param callback $callback + * @param array $check_urls RSS feeds + * @return bool False on failure. True on success. + */ +function wp_dashboard_cached_rss_widget( $widget_id, $callback, $check_urls = array() ) { + $loading = '

' . __( 'Loading…' ) . '

' . __( 'This widget requires JavaScript.' ) . '

'; + $doing_ajax = ( defined('DOING_AJAX') && DOING_AJAX ); + + if ( empty($check_urls) ) { + $widgets = get_option( 'dashboard_widget_options' ); + if ( empty($widgets[$widget_id]['url']) && ! $doing_ajax ) { + echo $loading; + return false; + } + $check_urls = array( $widgets[$widget_id]['url'] ); + } + + $cache_key = 'dash_' . md5( $widget_id ); + if ( false !== ( $output = get_transient( $cache_key ) ) ) { + echo $output; + return true; + } + + if ( ! $doing_ajax ) { + echo $loading; + return false; + } + + if ( $callback && is_callable( $callback ) ) { + $args = array_slice( func_get_args(), 2 ); + array_unshift( $args, $widget_id ); + ob_start(); + call_user_func_array( $callback, $args ); + set_transient( $cache_key, ob_get_flush(), 43200); // Default lifetime in cache of 12 hours (same as the feeds) + } + + return true; +} + +/* Dashboard Widgets Controls */ + +// Calls widget_control callback +/** + * Calls widget control callback. + * + * @since 2.5.0 + * + * @param int $widget_control_id Registered Widget ID. + */ +function wp_dashboard_trigger_widget_control( $widget_control_id = false ) { + global $wp_dashboard_control_callbacks; + + if ( is_scalar($widget_control_id) && $widget_control_id && isset($wp_dashboard_control_callbacks[$widget_control_id]) && is_callable($wp_dashboard_control_callbacks[$widget_control_id]) ) { + call_user_func( $wp_dashboard_control_callbacks[$widget_control_id], '', array( 'id' => $widget_control_id, 'callback' => $wp_dashboard_control_callbacks[$widget_control_id] ) ); + } +} + +/** + * The RSS dashboard widget control. + * + * Sets up $args to be used as input to wp_widget_rss_form(). Handles POST data + * from RSS-type widgets. + * + * @since 2.5.0 + * + * @param string $widget_id + * @param array $form_inputs + */ +function wp_dashboard_rss_control( $widget_id, $form_inputs = array() ) { + if ( !$widget_options = get_option( 'dashboard_widget_options' ) ) + $widget_options = array(); + + if ( !isset($widget_options[$widget_id]) ) + $widget_options[$widget_id] = array(); + + $number = 1; // Hack to use wp_widget_rss_form() + $widget_options[$widget_id]['number'] = $number; + + if ( 'POST' == $_SERVER['REQUEST_METHOD'] && isset($_POST['widget-rss'][$number]) ) { + $_POST['widget-rss'][$number] = stripslashes_deep( $_POST['widget-rss'][$number] ); + $widget_options[$widget_id] = wp_widget_rss_process( $_POST['widget-rss'][$number] ); + // title is optional. If black, fill it if possible + if ( !$widget_options[$widget_id]['title'] && isset($_POST['widget-rss'][$number]['title']) ) { + $rss = fetch_feed($widget_options[$widget_id]['url']); + if ( is_wp_error($rss) ) { + $widget_options[$widget_id]['title'] = htmlentities(__('Unknown Feed')); + } else { + $widget_options[$widget_id]['title'] = htmlentities(strip_tags($rss->get_title())); + $rss->__destruct(); + unset($rss); + } + } + update_option( 'dashboard_widget_options', $widget_options ); + $cache_key = 'dash_' . md5( $widget_id ); + delete_transient( $cache_key ); + } + + wp_widget_rss_form( $widget_options[$widget_id], $form_inputs ); +} + +// Display File upload quota on dashboard +function wp_dashboard_quota() { + if ( !is_multisite() || !current_user_can('upload_files') || get_site_option( 'upload_space_check_disabled' ) ) + return true; + + $quota = get_space_allowed(); + $used = get_dirsize( BLOGUPLOADDIR ) / 1024 / 1024; + + if ( $used > $quota ) + $percentused = '100'; + else + $percentused = ( $used / $quota ) * 100; + $used_color = ( $percentused >= 70 ) ? ' spam' : ''; + $used = round( $used, 2 ); + $percentused = number_format( $percentused ); + + ?> +

+
+ + + + + +
%2$sMB' ), esc_url( admin_url( 'upload.php' ) ), $quota ); ?>
+
+
+ + + + + +
%2$sMB (%3$s%%)' ), esc_url( admin_url( 'upload.php' ) ), $used, $percentused ); ?>
+
+
+ %s. Using an outdated browser makes your computer unsafe. For the best WordPress experience, please update your browser." ), esc_attr( $response['update_url'] ), esc_html( $response['name'] ) ); + } else { + $msg = sprintf( __( "It looks like you're using an old version of %s. For the best WordPress experience, please update your browser." ), esc_attr( $response['update_url'] ), esc_html( $response['name'] ) ); + } + + $browser_nag_class = ''; + if ( !empty( $response['img_src'] ) ) { + $img_src = ( is_ssl() && ! empty( $response['img_src_ssl'] ) )? $response['img_src_ssl'] : $response['img_src']; + + $notice .= '
'; + $browser_nag_class = ' has-browser-icon'; + } + $notice .= "

{$msg}

"; + $notice .= sprintf( __( '

Update %2$s or learn how to browse happy

' ), esc_attr( $response['update_url'] ), esc_html( $response['name'] ), 'http://browsehappy.com/' ); + $notice .= '

' . __( 'Dismiss' ) . '

'; + $notice .= '
'; + } + + echo apply_filters( 'browse-happy-notice', $notice, $response ); +} + +function dashboard_browser_nag_class( $classes ) { + $response = wp_check_browser_version(); + + if ( $response && $response['insecure'] ) + $classes[] = 'browser-insecure'; + + return $classes; +} + +/** + * Check if the user needs a browser update + * + * @since 3.2.0 + * + * @return array|bool False on failure, array of browser data on success. + */ +function wp_check_browser_version() { + if ( empty( $_SERVER['HTTP_USER_AGENT'] ) ) + return false; + + $key = md5( $_SERVER['HTTP_USER_AGENT'] ); + + if ( false === ($response = get_site_transient('browser_' . $key) ) ) { + global $wp_version; + + $options = array( + 'body' => array( 'useragent' => $_SERVER['HTTP_USER_AGENT'] ), + 'user-agent' => 'WordPress/' . $wp_version . '; ' . get_bloginfo( 'url' ) + ); + + $response = wp_remote_post( 'http://api.wordpress.org/core/browse-happy/1.0/', $options ); + + if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) ) + return false; + + /** + * Response should be an array with: + * 'name' - string - A user friendly browser name + * 'version' - string - The most recent version of the browser + * 'current_version' - string - The version of the browser the user is using + * 'upgrade' - boolean - Whether the browser needs an upgrade + * 'insecure' - boolean - Whether the browser is deemed insecure + * 'upgrade_url' - string - The url to visit to upgrade + * 'img_src' - string - An image representing the browser + * 'img_src_ssl' - string - An image (over SSL) representing the browser + */ + $response = unserialize( wp_remote_retrieve_body( $response ) ); + + if ( ! $response ) + return false; + + set_site_transient( 'browser_' . $key, $response, 604800 ); // cache for 1 week + } + + return $response; +} + +/** + * Empty function usable by plugins to output empty dashboard widget (to be populated later by JS). + */ +function wp_dashboard_empty() {} + +?> diff --git a/src/wp-admin/includes/deprecated.php b/src/wp-admin/includes/deprecated.php new file mode 100644 index 0000000..3e02dbc --- /dev/null +++ b/src/wp-admin/includes/deprecated.php @@ -0,0 +1,703 @@ + 0) ); + + if ( $categories ) { + foreach ( $categories as $category ) { + if ( $currentcat != $category->term_id && $parent == $category->parent) { + $pad = str_repeat( '– ', $level ); + $category->name = esc_html( $category->name ); + echo "\n\t"; + wp_dropdown_cats( $currentcat, $currentparent, $category->term_id, $level +1, $categories ); + } + } + } else { + return false; + } +} + +/** + * Register a setting and its sanitization callback + * + * @since 2.7.0 + * @deprecated 3.0.0 + * @deprecated Use register_setting() + * @see register_setting() + * + * @param string $option_group A settings group name. Should correspond to a whitelisted option key name. + * Default whitelisted option key names include "general," "discussion," and "reading," among others. + * @param string $option_name The name of an option to sanitize and save. + * @param unknown_type $sanitize_callback A callback function that sanitizes the option's value. + * @return unknown + */ +function add_option_update_handler( $option_group, $option_name, $sanitize_callback = '' ) { + _deprecated_function( __FUNCTION__, '3.0', 'register_setting()' ); + return register_setting( $option_group, $option_name, $sanitize_callback ); +} + +/** + * Unregister a setting + * + * @since 2.7.0 + * @deprecated 3.0.0 + * @deprecated Use unregister_setting() + * @see unregister_setting() + * + * @param unknown_type $option_group + * @param unknown_type $option_name + * @param unknown_type $sanitize_callback + * @return unknown + */ +function remove_option_update_handler( $option_group, $option_name, $sanitize_callback = '' ) { + _deprecated_function( __FUNCTION__, '3.0', 'unregister_setting()' ); + return unregister_setting( $option_group, $option_name, $sanitize_callback ); +} + +/** + * Determines the language to use for CodePress syntax highlighting. + * + * @since 2.8.0 + * @deprecated 3.0.0 + * + * @param string $filename +**/ +function codepress_get_lang( $filename ) { + _deprecated_function( __FUNCTION__, '3.0' ); + return; +} + +/** + * Adds Javascript required to make CodePress work on the theme/plugin editors. + * + * @since 2.8.0 + * @deprecated 3.0.0 +**/ +function codepress_footer_js() { + _deprecated_function( __FUNCTION__, '3.0' ); + return; +} + +/** + * Determine whether to use CodePress. + * + * @since 2.8 + * @deprecated 3.0.0 +**/ +function use_codepress() { + _deprecated_function( __FUNCTION__, '3.0' ); + return; +} + + +/** + * @deprecated 3.1.0 + * + * @return array List of user IDs. + */ +function get_author_user_ids() { + _deprecated_function( __FUNCTION__, '3.1', 'get_users()' ); + + global $wpdb; + if ( !is_multisite() ) + $level_key = $wpdb->get_blog_prefix() . 'user_level'; + else + $level_key = $wpdb->get_blog_prefix() . 'capabilities'; // wpmu site admins don't have user_levels + + return $wpdb->get_col( $wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = %s AND meta_value != '0'", $level_key) ); +} + +/** + * @deprecated 3.1.0 + * + * @param int $user_id User ID. + * @return array|bool List of editable authors. False if no editable users. + */ +function get_editable_authors( $user_id ) { + _deprecated_function( __FUNCTION__, '3.1', 'get_users()' ); + + global $wpdb; + + $editable = get_editable_user_ids( $user_id ); + + if ( !$editable ) { + return false; + } else { + $editable = join(',', $editable); + $authors = $wpdb->get_results( "SELECT * FROM $wpdb->users WHERE ID IN ($editable) ORDER BY display_name" ); + } + + return apply_filters('get_editable_authors', $authors); +} + +/** + * @deprecated 3.1.0 + * + * @param int $user_id User ID. + * @param bool $exclude_zeros Optional, default is true. Whether to exclude zeros. + * @return unknown + */ +function get_editable_user_ids( $user_id, $exclude_zeros = true, $post_type = 'post' ) { + _deprecated_function( __FUNCTION__, '3.1', 'get_users()' ); + + global $wpdb; + + $user = new WP_User( $user_id ); + $post_type_obj = get_post_type_object($post_type); + + if ( ! $user->has_cap($post_type_obj->cap->edit_others_posts) ) { + if ( $user->has_cap($post_type_obj->cap->edit_posts) || ! $exclude_zeros ) + return array($user->id); + else + return array(); + } + + if ( !is_multisite() ) + $level_key = $wpdb->get_blog_prefix() . 'user_level'; + else + $level_key = $wpdb->get_blog_prefix() . 'capabilities'; // wpmu site admins don't have user_levels + + $query = $wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = %s", $level_key); + if ( $exclude_zeros ) + $query .= " AND meta_value != '0'"; + + return $wpdb->get_col( $query ); +} + +/** + * @deprecated 3.1.0 + */ +function get_nonauthor_user_ids() { + _deprecated_function( __FUNCTION__, '3.1', 'get_users()' ); + + global $wpdb; + + if ( !is_multisite() ) + $level_key = $wpdb->get_blog_prefix() . 'user_level'; + else + $level_key = $wpdb->get_blog_prefix() . 'capabilities'; // wpmu site admins don't have user_levels + + return $wpdb->get_col( $wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = %s AND meta_value = '0'", $level_key) ); +} + +if ( !class_exists('WP_User_Search') ) : +/** + * WordPress User Search class. + * + * @since 2.1.0 + * @deprecated 3.1.0 + */ +class WP_User_Search { + + /** + * {@internal Missing Description}} + * + * @since 2.1.0 + * @access private + * @var unknown_type + */ + var $results; + + /** + * {@internal Missing Description}} + * + * @since 2.1.0 + * @access private + * @var unknown_type + */ + var $search_term; + + /** + * Page number. + * + * @since 2.1.0 + * @access private + * @var int + */ + var $page; + + /** + * Role name that users have. + * + * @since 2.5.0 + * @access private + * @var string + */ + var $role; + + /** + * Raw page number. + * + * @since 2.1.0 + * @access private + * @var int|bool + */ + var $raw_page; + + /** + * Amount of users to display per page. + * + * @since 2.1.0 + * @access public + * @var int + */ + var $users_per_page = 50; + + /** + * {@internal Missing Description}} + * + * @since 2.1.0 + * @access private + * @var unknown_type + */ + var $first_user; + + /** + * {@internal Missing Description}} + * + * @since 2.1.0 + * @access private + * @var int + */ + var $last_user; + + /** + * {@internal Missing Description}} + * + * @since 2.1.0 + * @access private + * @var string + */ + var $query_limit; + + /** + * {@internal Missing Description}} + * + * @since 3.0.0 + * @access private + * @var string + */ + var $query_orderby; + + /** + * {@internal Missing Description}} + * + * @since 3.0.0 + * @access private + * @var string + */ + var $query_from; + + /** + * {@internal Missing Description}} + * + * @since 3.0.0 + * @access private + * @var string + */ + var $query_where; + + /** + * {@internal Missing Description}} + * + * @since 2.1.0 + * @access private + * @var int + */ + var $total_users_for_query = 0; + + /** + * {@internal Missing Description}} + * + * @since 2.1.0 + * @access private + * @var bool + */ + var $too_many_total_users = false; + + /** + * {@internal Missing Description}} + * + * @since 2.1.0 + * @access private + * @var unknown_type + */ + var $search_errors; + + /** + * {@internal Missing Description}} + * + * @since 2.7.0 + * @access private + * @var unknown_type + */ + var $paging_text; + + /** + * PHP4 Constructor - Sets up the object properties. + * + * @since 2.1.0 + * + * @param string $search_term Search terms string. + * @param int $page Optional. Page ID. + * @param string $role Role name. + * @return WP_User_Search + */ + function WP_User_Search ($search_term = '', $page = '', $role = '') { + _deprecated_function( __FUNCTION__, '3.1', 'WP_User_Query' ); + + $this->search_term = stripslashes( $search_term ); + $this->raw_page = ( '' == $page ) ? false : (int) $page; + $this->page = (int) ( '' == $page ) ? 1 : $page; + $this->role = $role; + + $this->prepare_query(); + $this->query(); + $this->prepare_vars_for_template_usage(); + $this->do_paging(); + } + + /** + * {@internal Missing Short Description}} + * + * {@internal Missing Long Description}} + * + * @since 2.1.0 + * @access public + */ + function prepare_query() { + global $wpdb; + $this->first_user = ($this->page - 1) * $this->users_per_page; + + $this->query_limit = $wpdb->prepare(" LIMIT %d, %d", $this->first_user, $this->users_per_page); + $this->query_orderby = ' ORDER BY user_login'; + + $search_sql = ''; + if ( $this->search_term ) { + $searches = array(); + $search_sql = 'AND ('; + foreach ( array('user_login', 'user_nicename', 'user_email', 'user_url', 'display_name') as $col ) + $searches[] = $wpdb->prepare( $col . ' LIKE %s', '%' . like_escape($this->search_term) . '%' ); + $search_sql .= implode(' OR ', $searches); + $search_sql .= ')'; + } + + $this->query_from = " FROM $wpdb->users"; + $this->query_where = " WHERE 1=1 $search_sql"; + + if ( $this->role ) { + $this->query_from .= " INNER JOIN $wpdb->usermeta ON $wpdb->users.ID = $wpdb->usermeta.user_id"; + $this->query_where .= $wpdb->prepare(" AND $wpdb->usermeta.meta_key = '{$wpdb->prefix}capabilities' AND $wpdb->usermeta.meta_value LIKE %s", '%' . $this->role . '%'); + } elseif ( is_multisite() ) { + $level_key = $wpdb->prefix . 'capabilities'; // wpmu site admins don't have user_levels + $this->query_from .= ", $wpdb->usermeta"; + $this->query_where .= " AND $wpdb->users.ID = $wpdb->usermeta.user_id AND meta_key = '{$level_key}'"; + } + + do_action_ref_array( 'pre_user_search', array( &$this ) ); + } + + /** + * {@internal Missing Short Description}} + * + * {@internal Missing Long Description}} + * + * @since 2.1.0 + * @access public + */ + function query() { + global $wpdb; + + $this->results = $wpdb->get_col("SELECT DISTINCT($wpdb->users.ID)" . $this->query_from . $this->query_where . $this->query_orderby . $this->query_limit); + + if ( $this->results ) + $this->total_users_for_query = $wpdb->get_var("SELECT COUNT(DISTINCT($wpdb->users.ID))" . $this->query_from . $this->query_where); // no limit + else + $this->search_errors = new WP_Error('no_matching_users_found', __('No matching users were found!')); + } + + /** + * {@internal Missing Short Description}} + * + * {@internal Missing Long Description}} + * + * @since 2.1.0 + * @access public + */ + function prepare_vars_for_template_usage() { + $this->search_term = stripslashes($this->search_term); // done with DB, from now on we want slashes gone + } + + /** + * {@internal Missing Short Description}} + * + * {@internal Missing Long Description}} + * + * @since 2.1.0 + * @access public + */ + function do_paging() { + if ( $this->total_users_for_query > $this->users_per_page ) { // have to page the results + $args = array(); + if( ! empty($this->search_term) ) + $args['usersearch'] = urlencode($this->search_term); + if( ! empty($this->role) ) + $args['role'] = urlencode($this->role); + + $this->paging_text = paginate_links( array( + 'total' => ceil($this->total_users_for_query / $this->users_per_page), + 'current' => $this->page, + 'base' => 'users.php?%_%', + 'format' => 'userspage=%#%', + 'add_args' => $args + ) ); + if ( $this->paging_text ) { + $this->paging_text = sprintf( '' . __( 'Displaying %s–%s of %s' ) . '%s', + number_format_i18n( ( $this->page - 1 ) * $this->users_per_page + 1 ), + number_format_i18n( min( $this->page * $this->users_per_page, $this->total_users_for_query ) ), + number_format_i18n( $this->total_users_for_query ), + $this->paging_text + ); + } + } + } + + /** + * {@internal Missing Short Description}} + * + * {@internal Missing Long Description}} + * + * @since 2.1.0 + * @access public + * + * @return unknown + */ + function get_results() { + return (array) $this->results; + } + + /** + * Displaying paging text. + * + * @see do_paging() Builds paging text. + * + * @since 2.1.0 + * @access public + */ + function page_links() { + echo $this->paging_text; + } + + /** + * Whether paging is enabled. + * + * @see do_paging() Builds paging text. + * + * @since 2.1.0 + * @access public + * + * @return bool + */ + function results_are_paged() { + if ( $this->paging_text ) + return true; + return false; + } + + /** + * Whether there are search terms. + * + * @since 2.1.0 + * @access public + * + * @return bool + */ + function is_search() { + if ( $this->search_term ) + return true; + return false; + } +} +endif; + +/** + * Retrieve editable posts from other users. + * + * @deprecated 3.1.0 + * + * @param int $user_id User ID to not retrieve posts from. + * @param string $type Optional, defaults to 'any'. Post type to retrieve, can be 'draft' or 'pending'. + * @return array List of posts from others. + */ +function get_others_unpublished_posts($user_id, $type='any') { + _deprecated_function( __FUNCTION__, '3.1' ); + + global $wpdb; + + $editable = get_editable_user_ids( $user_id ); + + if ( in_array($type, array('draft', 'pending')) ) + $type_sql = " post_status = '$type' "; + else + $type_sql = " ( post_status = 'draft' OR post_status = 'pending' ) "; + + $dir = ( 'pending' == $type ) ? 'ASC' : 'DESC'; + + if ( !$editable ) { + $other_unpubs = ''; + } else { + $editable = join(',', $editable); + $other_unpubs = $wpdb->get_results( $wpdb->prepare("SELECT ID, post_title, post_author FROM $wpdb->posts WHERE post_type = 'post' AND $type_sql AND post_author IN ($editable) AND post_author != %d ORDER BY post_modified $dir", $user_id) ); + } + + return apply_filters('get_others_drafts', $other_unpubs); +} + +/** + * Retrieve drafts from other users. + * + * @deprecated 3.1.0 + * + * @param int $user_id User ID. + * @return array List of drafts from other users. + */ +function get_others_drafts($user_id) { + _deprecated_function( __FUNCTION__, '3.1' ); + + return get_others_unpublished_posts($user_id, 'draft'); +} + +/** + * Retrieve pending review posts from other users. + * + * @deprecated 3.1.0 + * + * @param int $user_id User ID. + * @return array List of posts with pending review post type from other users. + */ +function get_others_pending($user_id) { + _deprecated_function( __FUNCTION__, '3.1' ); + + return get_others_unpublished_posts($user_id, 'pending'); +} + +/** + * Output the QuickPress dashboard widget. + * + * @since 3.0.0 + * @deprecated 3.2.0 + * @deprecated Use wp_dashboard_quick_press() + * @see wp_dashboard_quick_press() + */ +function wp_dashboard_quick_press_output() { + _deprecated_function( __FUNCTION__, '3.2', 'wp_dashboard_quick_press()' ); + wp_dashboard_quick_press(); +} diff --git a/src/wp-admin/includes/export.php b/src/wp-admin/includes/export.php new file mode 100644 index 0000000..cfdc3dd --- /dev/null +++ b/src/wp-admin/includes/export.php @@ -0,0 +1,425 @@ + 'all', 'author' => false, 'category' => false, + 'start_date' => false, 'end_date' => false, 'status' => false, + ); + $args = wp_parse_args( $args, $defaults ); + + do_action( 'export_wp' ); + + $sitename = sanitize_key( get_bloginfo( 'name' ) ); + if ( ! empty($sitename) ) $sitename .= '.'; + $filename = $sitename . 'wordpress.' . date( 'Y-m-d' ) . '.xml'; + + header( 'Content-Description: File Transfer' ); + header( 'Content-Disposition: attachment; filename=' . $filename ); + header( 'Content-Type: text/xml; charset=' . get_option( 'blog_charset' ), true ); + + if ( 'all' != $args['content'] && post_type_exists( $args['content'] ) ) { + $ptype = get_post_type_object( $args['content'] ); + if ( ! $ptype->can_export ) + $args['content'] = 'post'; + + $where = $wpdb->prepare( "{$wpdb->posts}.post_type = %s", $args['content'] ); + } else { + $post_types = get_post_types( array( 'can_export' => true ) ); + $esses = array_fill( 0, count($post_types), '%s' ); + $where = $wpdb->prepare( "{$wpdb->posts}.post_type IN (" . implode( ',', $esses ) . ')', $post_types ); + } + + if ( $args['status'] && ( 'post' == $args['content'] || 'page' == $args['content'] ) ) + $where .= $wpdb->prepare( " AND {$wpdb->posts}.post_status = %s", $args['status'] ); + else + $where .= " AND {$wpdb->posts}.post_status != 'auto-draft'"; + + $join = ''; + if ( $args['category'] && 'post' == $args['content'] ) { + if ( $term = term_exists( $args['category'], 'category' ) ) { + $join = "INNER JOIN {$wpdb->term_relationships} ON ({$wpdb->posts}.ID = {$wpdb->term_relationships}.object_id)"; + $where .= $wpdb->prepare( " AND {$wpdb->term_relationships}.term_taxonomy_id = %d", $term['term_taxonomy_id'] ); + } + } + + if ( 'post' == $args['content'] || 'page' == $args['content'] ) { + if ( $args['author'] ) + $where .= $wpdb->prepare( " AND {$wpdb->posts}.post_author = %d", $args['author'] ); + + if ( $args['start_date'] ) + $where .= $wpdb->prepare( " AND {$wpdb->posts}.post_date >= %s", date( 'Y-m-d', strtotime($args['start_date']) ) ); + + if ( $args['end_date'] ) + $where .= $wpdb->prepare( " AND {$wpdb->posts}.post_date < %s", date( 'Y-m-d', strtotime('+1 month', strtotime($args['end_date'])) ) ); + } + + // grab a snapshot of post IDs, just in case it changes during the export + $post_ids = $wpdb->get_col( "SELECT ID FROM {$wpdb->posts} $join WHERE $where" ); + + // get the requested terms ready, empty unless posts filtered by category or all content + $cats = $tags = $terms = array(); + if ( isset( $term ) && $term ) { + $cat = get_term( $term['term_id'], 'category' ); + $cats = array( $cat->term_id => $cat ); + unset( $term, $cat ); + } else if ( 'all' == $args['content'] ) { + $categories = (array) get_categories( array( 'get' => 'all' ) ); + $tags = (array) get_tags( array( 'get' => 'all' ) ); + + $custom_taxonomies = get_taxonomies( array( '_builtin' => false ) ); + $custom_terms = (array) get_terms( $custom_taxonomies, array( 'get' => 'all' ) ); + + // put categories in order with no child going before its parent + while ( $cat = array_shift( $categories ) ) { + if ( $cat->parent == 0 || isset( $cats[$cat->parent] ) ) + $cats[$cat->term_id] = $cat; + else + $categories[] = $cat; + } + + // put terms in order with no child going before its parent + while ( $t = array_shift( $custom_terms ) ) { + if ( $t->parent == 0 || isset( $terms[$t->parent] ) ) + $terms[$t->term_id] = $t; + else + $custom_terms[] = $t; + } + + unset( $categories, $custom_taxonomies, $custom_terms ); + } + + /** + * Wrap given string in XML CDATA tag. + * + * @since 2.1.0 + * + * @param string $str String to wrap in XML CDATA tag. + */ + function wxr_cdata( $str ) { + if ( seems_utf8( $str ) == false ) + $str = utf8_encode( $str ); + + // $str = ent2ncr(esc_html($str)); + $str = "'; + + return $str; + } + + /** + * Return the URL of the site + * + * @since 2.5.0 + * + * @return string Site URL. + */ + function wxr_site_url() { + // ms: the base url + if ( is_multisite() ) + return network_home_url(); + // wp: the blog url + else + return get_bloginfo_rss( 'url' ); + } + + /** + * Output a cat_name XML tag from a given category object + * + * @since 2.1.0 + * + * @param object $category Category Object + */ + function wxr_cat_name( $category ) { + if ( empty( $category->name ) ) + return; + + echo '' . wxr_cdata( $category->name ) . ''; + } + + /** + * Output a category_description XML tag from a given category object + * + * @since 2.1.0 + * + * @param object $category Category Object + */ + function wxr_category_description( $category ) { + if ( empty( $category->description ) ) + return; + + echo '' . wxr_cdata( $category->description ) . ''; + } + + /** + * Output a tag_name XML tag from a given tag object + * + * @since 2.3.0 + * + * @param object $tag Tag Object + */ + function wxr_tag_name( $tag ) { + if ( empty( $tag->name ) ) + return; + + echo '' . wxr_cdata( $tag->name ) . ''; + } + + /** + * Output a tag_description XML tag from a given tag object + * + * @since 2.3.0 + * + * @param object $tag Tag Object + */ + function wxr_tag_description( $tag ) { + if ( empty( $tag->description ) ) + return; + + echo '' . wxr_cdata( $tag->description ) . ''; + } + + /** + * Output a term_name XML tag from a given term object + * + * @since 2.9.0 + * + * @param object $term Term Object + */ + function wxr_term_name( $term ) { + if ( empty( $term->name ) ) + return; + + echo '' . wxr_cdata( $term->name ) . ''; + } + + /** + * Output a term_description XML tag from a given term object + * + * @since 2.9.0 + * + * @param object $term Term Object + */ + function wxr_term_description( $term ) { + if ( empty( $term->description ) ) + return; + + echo '' . wxr_cdata( $term->description ) . ''; + } + + /** + * Output list of authors with posts + * + * @since 3.1.0 + */ + function wxr_authors_list() { + global $wpdb; + + $authors = array(); + $results = $wpdb->get_results( "SELECT DISTINCT post_author FROM $wpdb->posts" ); + foreach ( (array) $results as $result ) + $authors[] = get_userdata( $result->post_author ); + + $authors = array_filter( $authors ); + + foreach( $authors as $author ) { + echo "\t"; + echo '' . $author->ID . ''; + echo '' . $author->user_login . ''; + echo '' . $author->user_email . ''; + echo '' . wxr_cdata( $author->display_name ) . ''; + echo '' . wxr_cdata( $author->user_firstname ) . ''; + echo '' . wxr_cdata( $author->user_lastname ) . ''; + echo "\n"; + } + } + + /** + * Ouput all navigation menu terms + * + * @since 3.1.0 + */ + function wxr_nav_menu_terms() { + $nav_menus = wp_get_nav_menus(); + if ( empty( $nav_menus ) || ! is_array( $nav_menus ) ) + return; + + foreach ( $nav_menus as $menu ) { + echo "\t{$menu->term_id}nav_menu{$menu->slug}"; + wxr_term_name( $menu ); + echo "\n"; + } + } + + /** + * Output list of taxonomy terms, in XML tag format, associated with a post + * + * @since 2.3.0 + */ + function wxr_post_taxonomy() { + global $post; + + $taxonomies = get_object_taxonomies( $post->post_type ); + if ( empty( $taxonomies ) ) + return; + $terms = wp_get_object_terms( $post->ID, $taxonomies ); + + foreach ( (array) $terms as $term ) { + echo "\t\ttaxonomy}\" nicename=\"{$term->slug}\">" . wxr_cdata( $term->name ) . "\n"; + } + } + + echo '\n"; + + ?> + + + + + + + + + + + + + + + + + + + + + + <?php bloginfo_rss( 'name' ); ?> + + + + + + + + + + + + term_id ?>slug; ?>parent ? $cats[$c->parent]->slug : ''; ?> + + + term_id ?>slug; ?> + + + term_id ?>taxonomy; ?>slug; ?>parent ? $terms[$t->parent]->slug : ''; ?> + + + + + +in_the_loop = true; // Fake being in the loop. + + // fetch 20 posts at a time rather than loading the entire table into memory + while ( $next_posts = array_splice( $post_ids, 0, 20 ) ) { + $where = 'WHERE ID IN (' . join( ',', $next_posts ) . ')'; + $posts = $wpdb->get_results( "SELECT * FROM {$wpdb->posts} $where" ); + + // Begin Loop + foreach ( $posts as $post ) { + setup_postdata( $post ); + $is_sticky = is_sticky( $post->ID ) ? 1 : 0; +?> + + <?php echo apply_filters( 'the_title_rss', $post->post_title ); ?> + + + + + + post_content ) ); ?> + post_excerpt ) ); ?> + ID; ?> + post_date; ?> + post_date_gmt; ?> + comment_status; ?> + ping_status; ?> + post_name; ?> + post_status; ?> + post_parent; ?> + menu_order; ?> + post_type; ?> + post_password; ?> + +post_type == 'attachment' ) : ?> + ID ); ?> + + +get_results( $wpdb->prepare( "SELECT * FROM $wpdb->postmeta WHERE post_id = %d", $post->ID ) ); + foreach( $postmeta as $meta ) : if ( $meta->meta_key != '_edit_lock' ) : ?> + + meta_key; ?> + meta_value ); ?> + + +get_results( $wpdb->prepare( "SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_approved <> 'spam'", $post->ID ) ); + foreach ( $comments as $c ) : ?> + + comment_ID; ?> + comment_author ); ?> + comment_author_email; ?> + comment_author_url ); ?> + comment_author_IP; ?> + comment_date; ?> + comment_date_gmt; ?> + comment_content ) ?> + comment_approved; ?> + comment_type; ?> + comment_parent; ?> + user_id; ?> +get_results( $wpdb->prepare( "SELECT * FROM $wpdb->commentmeta WHERE comment_id = %d", $c->comment_ID ) ); + foreach ( $c_meta as $meta ) : ?> + + meta_key; ?> + meta_value ); ?> + + + + + + + + + __( 'Main Index Template' ), + 'style.css' => __( 'Stylesheet' ), + 'editor-style.css' => __( 'Visual Editor Stylesheet' ), + 'editor-style-rtl.css' => __( 'Visual Editor RTL Stylesheet' ), + 'rtl.css' => __( 'RTL Stylesheet' ), + 'comments.php' => __( 'Comments' ), + 'comments-popup.php' => __( 'Popup Comments' ), + 'footer.php' => __( 'Footer' ), + 'header.php' => __( 'Header' ), + 'sidebar.php' => __( 'Sidebar' ), + 'archive.php' => __( 'Archives' ), + 'author.php' => __( 'Author Template' ), + 'tag.php' => __( 'Tag Template' ), + 'category.php' => __( 'Category Template' ), + 'page.php' => __( 'Page Template' ), + 'search.php' => __( 'Search Results' ), + 'searchform.php' => __( 'Search Form' ), + 'single.php' => __( 'Single Post' ), + '404.php' => __( '404 Template' ), + 'link.php' => __( 'Links Template' ), + 'functions.php' => __( 'Theme Functions' ), + 'attachment.php' => __( 'Attachment Template' ), + 'image.php' => __('Image Attachment Template'), + 'video.php' => __('Video Attachment Template'), + 'audio.php' => __('Audio Attachment Template'), + 'application.php' => __('Application Attachment Template'), + 'my-hacks.php' => __( 'my-hacks.php (legacy hacks support)' ), + '.htaccess' => __( '.htaccess (for rewrite rules )' ), + // Deprecated files + 'wp-layout.css' => __( 'Stylesheet' ), + 'wp-comments.php' => __( 'Comments Template' ), + 'wp-comments-popup.php' => __( 'Popup Comments Template' ), +); + +/** + * Get the description for standard WordPress theme files and other various standard + * WordPress files + * + * @since 1.5.0 + * + * @uses _cleanup_header_comment + * @uses $wp_file_descriptions + * @param string $file Filesystem path or filename + * @return string Description of file from $wp_file_descriptions or basename of $file if description doesn't exist + */ +function get_file_description( $file ) { + global $wp_file_descriptions; + + if ( isset( $wp_file_descriptions[basename( $file )] ) ) { + return $wp_file_descriptions[basename( $file )]; + } + elseif ( file_exists( $file ) && is_file( $file ) ) { + $template_data = implode( '', file( $file ) ); + if ( preg_match( '|Template Name:(.*)$|mi', $template_data, $name )) + return sprintf( __( '%s Page Template' ), _cleanup_header_comment($name[1]) ); + } + + return basename( $file ); +} + +/** + * Get the absolute filesystem path to the root of the WordPress installation + * + * @since 1.5.0 + * + * @uses get_option + * @return string Full filesystem path to the root of the WordPress installation + */ +function get_home_path() { + $home = get_option( 'home' ); + $siteurl = get_option( 'siteurl' ); + if ( $home != '' && $home != $siteurl ) { + $wp_path_rel_to_home = str_replace($home, '', $siteurl); /* $siteurl - $home */ + $pos = strpos($_SERVER["SCRIPT_FILENAME"], $wp_path_rel_to_home); + $home_path = substr($_SERVER["SCRIPT_FILENAME"], 0, $pos); + $home_path = trailingslashit( $home_path ); + } else { + $home_path = ABSPATH; + } + + return $home_path; +} + +/** + * Get the real file system path to a file to edit within the admin + * + * If the $file is index.php or .htaccess this function will assume it is relative + * to the install root, otherwise it is assumed the file is relative to the wp-content + * directory + * + * @since 1.5.0 + * + * @uses get_home_path + * @uses WP_CONTENT_DIR full filesystem path to the wp-content directory + * @param string $file filesystem path relative to the WordPress install directory or to the wp-content directory + * @return string full file system path to edit + */ +function get_real_file_to_edit( $file ) { + if ('index.php' == $file || '.htaccess' == $file ) { + $real_file = get_home_path() . $file; + } else { + $real_file = WP_CONTENT_DIR . $file; + } + + return $real_file; +} + +/** + * Returns a listing of all files in the specified folder and all subdirectories up to 100 levels deep. + * The depth of the recursiveness can be controlled by the $levels param. + * + * @since 2.6.0 + * + * @param string $folder Full path to folder + * @param int $levels (optional) Levels of folders to follow, Default: 100 (PHP Loop limit). + * @return bool|array False on failure, Else array of files + */ +function list_files( $folder = '', $levels = 100 ) { + if ( empty($folder) ) + return false; + + if ( ! $levels ) + return false; + + $files = array(); + if ( $dir = @opendir( $folder ) ) { + while (($file = readdir( $dir ) ) !== false ) { + if ( in_array($file, array('.', '..') ) ) + continue; + if ( is_dir( $folder . '/' . $file ) ) { + $files2 = list_files( $folder . '/' . $file, $levels - 1); + if ( $files2 ) + $files = array_merge($files, $files2 ); + else + $files[] = $folder . '/' . $file . '/'; + } else { + $files[] = $folder . '/' . $file; + } + } + } + @closedir( $dir ); + return $files; +} + +/** + * Returns a filename of a Temporary unique file. + * Please note that the calling function must unlink() this itself. + * + * The filename is based off the passed parameter or defaults to the current unix timestamp, + * while the directory can either be passed as well, or by leaving it blank, default to a writable temporary directory. + * + * @since 2.6.0 + * + * @param string $filename (optional) Filename to base the Unique file off + * @param string $dir (optional) Directory to store the file in + * @return string a writable filename + */ +function wp_tempnam($filename = '', $dir = '') { + if ( empty($dir) ) + $dir = get_temp_dir(); + $filename = basename($filename); + if ( empty($filename) ) + $filename = time(); + + $filename = preg_replace('|\..*$|', '.tmp', $filename); + $filename = $dir . wp_unique_filename($dir, $filename); + touch($filename); + return $filename; +} + +/** + * Make sure that the file that was requested to edit, is allowed to be edited + * + * Function will die if if you are not allowed to edit the file + * + * @since 1.5.0 + * + * @uses wp_die + * @uses validate_file + * @param string $file file the users is attempting to edit + * @param array $allowed_files Array of allowed files to edit, $file must match an entry exactly + * @return null + */ +function validate_file_to_edit( $file, $allowed_files = '' ) { + $code = validate_file( $file, $allowed_files ); + + if (!$code ) + return $file; + + switch ( $code ) { + case 1 : + wp_die( __('Sorry, can’t edit files with “..” in the name. If you are trying to edit a file in your WordPress home directory, you can just type the name of the file in.' )); + + //case 2 : + // wp_die( __('Sorry, can’t call files with their real path.' )); + + case 3 : + wp_die( __('Sorry, that file cannot be edited.' )); + } +} + +/** + * Handle PHP uploads in WordPress, sanitizing file names, checking extensions for mime type, + * and moving the file to the appropriate directory within the uploads directory. + * + * @since 2.0 + * + * @uses wp_handle_upload_error + * @uses apply_filters + * @uses is_multisite + * @uses wp_check_filetype_and_ext + * @uses current_user_can + * @uses wp_upload_dir + * @uses wp_unique_filename + * @uses delete_transient + * @param array $file Reference to a single element of $_FILES. Call the function once for each uploaded file. + * @param array $overrides Optional. An associative array of names=>values to override default variables with extract( $overrides, EXTR_OVERWRITE ). + * @return array On success, returns an associative array of file attributes. On failure, returns $overrides['upload_error_handler'](&$file, $message ) or array( 'error'=>$message ). + */ +function wp_handle_upload( &$file, $overrides = false, $time = null ) { + // The default error handler. + if ( ! function_exists( 'wp_handle_upload_error' ) ) { + function wp_handle_upload_error( &$file, $message ) { + return array( 'error'=>$message ); + } + } + + $file = apply_filters( 'wp_handle_upload_prefilter', $file ); + + // You may define your own function and pass the name in $overrides['upload_error_handler'] + $upload_error_handler = 'wp_handle_upload_error'; + + // You may have had one or more 'wp_handle_upload_prefilter' functions error out the file. Handle that gracefully. + if ( isset( $file['error'] ) && !is_numeric( $file['error'] ) && $file['error'] ) + return $upload_error_handler( $file, $file['error'] ); + + // You may define your own function and pass the name in $overrides['unique_filename_callback'] + $unique_filename_callback = null; + + // $_POST['action'] must be set and its value must equal $overrides['action'] or this: + $action = 'wp_handle_upload'; + + // Courtesy of php.net, the strings that describe the error indicated in $_FILES[{form field}]['error']. + $upload_error_strings = array( false, + __( "The uploaded file exceeds the upload_max_filesize directive in php.ini." ), + __( "The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form." ), + __( "The uploaded file was only partially uploaded." ), + __( "No file was uploaded." ), + '', + __( "Missing a temporary folder." ), + __( "Failed to write file to disk." ), + __( "File upload stopped by extension." )); + + // All tests are on by default. Most can be turned off by $override[{test_name}] = false; + $test_form = true; + $test_size = true; + $test_upload = true; + + // If you override this, you must provide $ext and $type!!!! + $test_type = true; + $mimes = false; + + // Install user overrides. Did we mention that this voids your warranty? + if ( is_array( $overrides ) ) + extract( $overrides, EXTR_OVERWRITE ); + + // A correct form post will pass this test. + if ( $test_form && (!isset( $_POST['action'] ) || ($_POST['action'] != $action ) ) ) + return call_user_func($upload_error_handler, $file, __( 'Invalid form submission.' )); + + // A successful upload will pass this test. It makes no sense to override this one. + if ( $file['error'] > 0 ) + return call_user_func($upload_error_handler, $file, $upload_error_strings[$file['error']] ); + + // A non-empty file will pass this test. + if ( $test_size && !($file['size'] > 0 ) ) { + if ( is_multisite() ) + $error_msg = __( 'File is empty. Please upload something more substantial.' ); + else + $error_msg = __( 'File is empty. Please upload something more substantial. This error could also be caused by uploads being disabled in your php.ini or by post_max_size being defined as smaller than upload_max_filesize in php.ini.' ); + return call_user_func($upload_error_handler, $file, $error_msg); + } + + // A properly uploaded file will pass this test. There should be no reason to override this one. + if ( $test_upload && ! @ is_uploaded_file( $file['tmp_name'] ) ) + return call_user_func($upload_error_handler, $file, __( 'Specified file failed upload test.' )); + + // A correct MIME type will pass this test. Override $mimes or use the upload_mimes filter. + if ( $test_type ) { + $wp_filetype = wp_check_filetype_and_ext( $file['tmp_name'], $file['name'], $mimes ); + + extract( $wp_filetype ); + + // Check to see if wp_check_filetype_and_ext() determined the filename was incorrect + if ( $proper_filename ) + $file['name'] = $proper_filename; + + if ( ( !$type || !$ext ) && !current_user_can( 'unfiltered_upload' ) ) + return call_user_func($upload_error_handler, $file, __( 'Sorry, this file type is not permitted for security reasons.' )); + + if ( !$ext ) + $ext = ltrim(strrchr($file['name'], '.'), '.'); + + if ( !$type ) + $type = $file['type']; + } else { + $type = ''; + } + + // A writable uploads dir will pass this test. Again, there's no point overriding this one. + if ( ! ( ( $uploads = wp_upload_dir($time) ) && false === $uploads['error'] ) ) + return call_user_func($upload_error_handler, $file, $uploads['error'] ); + + $filename = wp_unique_filename( $uploads['path'], $file['name'], $unique_filename_callback ); + + // Move the file to the uploads dir + $new_file = $uploads['path'] . "/$filename"; + if ( false === @ move_uploaded_file( $file['tmp_name'], $new_file ) ) + return $upload_error_handler( $file, sprintf( __('The uploaded file could not be moved to %s.' ), $uploads['path'] ) ); + + // Set correct file permissions + $stat = stat( dirname( $new_file )); + $perms = $stat['mode'] & 0000666; + @ chmod( $new_file, $perms ); + + // Compute the URL + $url = $uploads['url'] . "/$filename"; + + if ( is_multisite() ) + delete_transient( 'dirsize_cache' ); + + return apply_filters( 'wp_handle_upload', array( 'file' => $new_file, 'url' => $url, 'type' => $type ), 'upload' ); +} + +/** + * Handle sideloads, which is the process of retriving a media item from another server instead of + * a traditional media upload. This process involves sanitizing the filename, checking extensions + * for mime type, and moving the file to the appropriate directory within the uploads directory. + * + * @since 2.6.0 + * + * @uses wp_handle_upload_error + * @uses apply_filters + * @uses wp_check_filetype_and_ext + * @uses current_user_can + * @uses wp_upload_dir + * @uses wp_unique_filename + * @param array $file an array similar to that of a PHP $_FILES POST array + * @param array $overrides Optional. An associative array of names=>values to override default variables with extract( $overrides, EXTR_OVERWRITE ). + * @return array On success, returns an associative array of file attributes. On failure, returns $overrides['upload_error_handler'](&$file, $message ) or array( 'error'=>$message ). + */ +function wp_handle_sideload( &$file, $overrides = false ) { + // The default error handler. + if (! function_exists( 'wp_handle_upload_error' ) ) { + function wp_handle_upload_error( &$file, $message ) { + return array( 'error'=>$message ); + } + } + + // You may define your own function and pass the name in $overrides['upload_error_handler'] + $upload_error_handler = 'wp_handle_upload_error'; + + // You may define your own function and pass the name in $overrides['unique_filename_callback'] + $unique_filename_callback = null; + + // $_POST['action'] must be set and its value must equal $overrides['action'] or this: + $action = 'wp_handle_sideload'; + + // Courtesy of php.net, the strings that describe the error indicated in $_FILES[{form field}]['error']. + $upload_error_strings = array( false, + __( "The uploaded file exceeds the upload_max_filesize directive in php.ini." ), + __( "The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form." ), + __( "The uploaded file was only partially uploaded." ), + __( "No file was uploaded." ), + '', + __( "Missing a temporary folder." ), + __( "Failed to write file to disk." ), + __( "File upload stopped by extension." )); + + // All tests are on by default. Most can be turned off by $override[{test_name}] = false; + $test_form = true; + $test_size = true; + + // If you override this, you must provide $ext and $type!!!! + $test_type = true; + $mimes = false; + + // Install user overrides. Did we mention that this voids your warranty? + if ( is_array( $overrides ) ) + extract( $overrides, EXTR_OVERWRITE ); + + // A correct form post will pass this test. + if ( $test_form && (!isset( $_POST['action'] ) || ($_POST['action'] != $action ) ) ) + return $upload_error_handler( $file, __( 'Invalid form submission.' )); + + // A successful upload will pass this test. It makes no sense to override this one. + if ( ! empty( $file['error'] ) ) + return $upload_error_handler( $file, $upload_error_strings[$file['error']] ); + + // A non-empty file will pass this test. + if ( $test_size && !(filesize($file['tmp_name']) > 0 ) ) + return $upload_error_handler( $file, __( 'File is empty. Please upload something more substantial. This error could also be caused by uploads being disabled in your php.ini.' )); + + // A properly uploaded file will pass this test. There should be no reason to override this one. + if (! @ is_file( $file['tmp_name'] ) ) + return $upload_error_handler( $file, __( 'Specified file does not exist.' )); + + // A correct MIME type will pass this test. Override $mimes or use the upload_mimes filter. + if ( $test_type ) { + $wp_filetype = wp_check_filetype_and_ext( $file['tmp_name'], $file['name'], $mimes ); + + extract( $wp_filetype ); + + // Check to see if wp_check_filetype_and_ext() determined the filename was incorrect + if ( $proper_filename ) + $file['name'] = $proper_filename; + + if ( ( !$type || !$ext ) && !current_user_can( 'unfiltered_upload' ) ) + return $upload_error_handler( $file, __( 'Sorry, this file type is not permitted for security reasons.' )); + + if ( !$ext ) + $ext = ltrim(strrchr($file['name'], '.'), '.'); + + if ( !$type ) + $type = $file['type']; + } + + // A writable uploads dir will pass this test. Again, there's no point overriding this one. + if ( ! ( ( $uploads = wp_upload_dir() ) && false === $uploads['error'] ) ) + return $upload_error_handler( $file, $uploads['error'] ); + + $filename = wp_unique_filename( $uploads['path'], $file['name'], $unique_filename_callback ); + + // Strip the query strings. + $filename = str_replace('?','-', $filename); + $filename = str_replace('&','-', $filename); + + // Move the file to the uploads dir + $new_file = $uploads['path'] . "/$filename"; + if ( false === @ rename( $file['tmp_name'], $new_file ) ) { + return $upload_error_handler( $file, sprintf( __('The uploaded file could not be moved to %s.' ), $uploads['path'] ) ); + } + + // Set correct file permissions + $stat = stat( dirname( $new_file )); + $perms = $stat['mode'] & 0000666; + @ chmod( $new_file, $perms ); + + // Compute the URL + $url = $uploads['url'] . "/$filename"; + + $return = apply_filters( 'wp_handle_upload', array( 'file' => $new_file, 'url' => $url, 'type' => $type ), 'sideload' ); + + return $return; +} + +/** + * Downloads a url to a local temporary file using the WordPress HTTP Class. + * Please note, That the calling function must unlink() the file. + * + * @since 2.5.0 + * + * @param string $url the URL of the file to download + * @param int $timeout The timeout for the request to download the file default 300 seconds + * @return mixed WP_Error on failure, string Filename on success. + */ +function download_url( $url, $timeout = 300 ) { + //WARNING: The file is not automatically deleted, The script must unlink() the file. + if ( ! $url ) + return new WP_Error('http_no_url', __('Invalid URL Provided.')); + + $tmpfname = wp_tempnam($url); + if ( ! $tmpfname ) + return new WP_Error('http_no_file', __('Could not create Temporary file.')); + + $response = wp_remote_get( $url, array( 'timeout' => $timeout, 'stream' => true, 'filename' => $tmpfname ) ); + + if ( is_wp_error( $response ) ) { + unlink( $tmpfname ); + return $response; + } + + if ( 200 != wp_remote_retrieve_response_code( $response ) ){ + unlink( $tmpfname ); + return new WP_Error( 'http_404', trim( wp_remote_retrieve_response_message( $response ) ) ); + } + + return $tmpfname; +} + +/** + * Unzip's a specified ZIP file to a location on the Filesystem via the WordPress Filesystem Abstraction. + * Assumes that WP_Filesystem() has already been called and set up. Does not extract a root-level __MACOSX directory, if present. + * + * Attempts to increase the PHP Memory limit to 256M before uncompressing, + * However, The most memory required shouldn't be much larger than the Archive itself. + * + * @since 2.5.0 + * + * @param string $file Full path and filename of zip archive + * @param string $to Full path on the filesystem to extract archive to + * @return mixed WP_Error on failure, True on success + */ +function unzip_file($file, $to) { + global $wp_filesystem; + + if ( ! $wp_filesystem || !is_object($wp_filesystem) ) + return new WP_Error('fs_unavailable', __('Could not access filesystem.')); + + // Unzip can use a lot of memory, but not this much hopefully + @ini_set( 'memory_limit', apply_filters( 'admin_memory_limit', WP_MAX_MEMORY_LIMIT ) ); + + $needed_dirs = array(); + $to = trailingslashit($to); + + // Determine any parent dir's needed (of the upgrade directory) + if ( ! $wp_filesystem->is_dir($to) ) { //Only do parents if no children exist + $path = preg_split('![/\\\]!', untrailingslashit($to)); + for ( $i = count($path); $i >= 0; $i-- ) { + if ( empty($path[$i]) ) + continue; + + $dir = implode('/', array_slice($path, 0, $i+1) ); + if ( preg_match('!^[a-z]:$!i', $dir) ) // Skip it if it looks like a Windows Drive letter. + continue; + + if ( ! $wp_filesystem->is_dir($dir) ) + $needed_dirs[] = $dir; + else + break; // A folder exists, therefor, we dont need the check the levels below this + } + } + + if ( class_exists('ZipArchive') && apply_filters('unzip_file_use_ziparchive', true ) ) { + $result = _unzip_file_ziparchive($file, $to, $needed_dirs); + if ( true === $result ) { + return $result; + } elseif ( is_wp_error($result) ) { + if ( 'incompatible_archive' != $result->get_error_code() ) + return $result; + } + } + // Fall through to PclZip if ZipArchive is not available, or encountered an error opening the file. + return _unzip_file_pclzip($file, $to, $needed_dirs); +} + +/** + * This function should not be called directly, use unzip_file instead. Attempts to unzip an archive using the ZipArchive class. + * Assumes that WP_Filesystem() has already been called and set up. + * + * @since 3.0.0 + * @see unzip_file + * @access private + * + * @param string $file Full path and filename of zip archive + * @param string $to Full path on the filesystem to extract archive to + * @param array $needed_dirs A partial list of required folders needed to be created. + * @return mixed WP_Error on failure, True on success + */ +function _unzip_file_ziparchive($file, $to, $needed_dirs = array() ) { + global $wp_filesystem; + + $z = new ZipArchive(); + + // PHP4-compat - php4 classes can't contain constants + $zopen = $z->open($file, /* ZIPARCHIVE::CHECKCONS */ 4); + if ( true !== $zopen ) + return new WP_Error('incompatible_archive', __('Incompatible Archive.')); + + for ( $i = 0; $i < $z->numFiles; $i++ ) { + if ( ! $info = $z->statIndex($i) ) + return new WP_Error('stat_failed', __('Could not retrieve file from archive.')); + + if ( '__MACOSX/' === substr($info['name'], 0, 9) ) // Skip the OS X-created __MACOSX directory + continue; + + if ( '/' == substr($info['name'], -1) ) // directory + $needed_dirs[] = $to . untrailingslashit($info['name']); + else + $needed_dirs[] = $to . untrailingslashit(dirname($info['name'])); + } + + $needed_dirs = array_unique($needed_dirs); + foreach ( $needed_dirs as $dir ) { + // Check the parent folders of the folders all exist within the creation array. + if ( untrailingslashit($to) == $dir ) // Skip over the working directory, We know this exists (or will exist) + continue; + if ( strpos($dir, $to) === false ) // If the directory is not within the working directory, Skip it + continue; + + $parent_folder = dirname($dir); + while ( !empty($parent_folder) && untrailingslashit($to) != $parent_folder && !in_array($parent_folder, $needed_dirs) ) { + $needed_dirs[] = $parent_folder; + $parent_folder = dirname($parent_folder); + } + } + asort($needed_dirs); + + // Create those directories if need be: + foreach ( $needed_dirs as $_dir ) { + if ( ! $wp_filesystem->mkdir($_dir, FS_CHMOD_DIR) && ! $wp_filesystem->is_dir($_dir) ) // Only check to see if the Dir exists upon creation failure. Less I/O this way. + return new WP_Error('mkdir_failed', __('Could not create directory.'), $_dir); + } + unset($needed_dirs); + + for ( $i = 0; $i < $z->numFiles; $i++ ) { + if ( ! $info = $z->statIndex($i) ) + return new WP_Error('stat_failed', __('Could not retrieve file from archive.')); + + if ( '/' == substr($info['name'], -1) ) // directory + continue; + + if ( '__MACOSX/' === substr($info['name'], 0, 9) ) // Don't extract the OS X-created __MACOSX directory files + continue; + + $contents = $z->getFromIndex($i); + if ( false === $contents ) + return new WP_Error('extract_failed', __('Could not extract file from archive.'), $info['name']); + + if ( ! $wp_filesystem->put_contents( $to . $info['name'], $contents, FS_CHMOD_FILE) ) + return new WP_Error('copy_failed', __('Could not copy file.'), $to . $info['filename']); + } + + $z->close(); + + return true; +} + +/** + * This function should not be called directly, use unzip_file instead. Attempts to unzip an archive using the PclZip library. + * Assumes that WP_Filesystem() has already been called and set up. + * + * @since 3.0.0 + * @see unzip_file + * @access private + * + * @param string $file Full path and filename of zip archive + * @param string $to Full path on the filesystem to extract archive to + * @param array $needed_dirs A partial list of required folders needed to be created. + * @return mixed WP_Error on failure, True on success + */ +function _unzip_file_pclzip($file, $to, $needed_dirs = array()) { + global $wp_filesystem; + + // See #15789 - PclZip uses string functions on binary data, If it's overloaded with Multibyte safe functions the results are incorrect. + if ( ini_get('mbstring.func_overload') && function_exists('mb_internal_encoding') ) { + $previous_encoding = mb_internal_encoding(); + mb_internal_encoding('ISO-8859-1'); + } + + require_once(ABSPATH . 'wp-admin/includes/class-pclzip.php'); + + $archive = new PclZip($file); + + $archive_files = $archive->extract(PCLZIP_OPT_EXTRACT_AS_STRING); + + if ( isset($previous_encoding) ) + mb_internal_encoding($previous_encoding); + + // Is the archive valid? + if ( !is_array($archive_files) ) + return new WP_Error('incompatible_archive', __('Incompatible Archive.'), $archive->errorInfo(true)); + + if ( 0 == count($archive_files) ) + return new WP_Error('empty_archive', __('Empty archive.')); + + // Determine any children directories needed (From within the archive) + foreach ( $archive_files as $file ) { + if ( '__MACOSX/' === substr($file['filename'], 0, 9) ) // Skip the OS X-created __MACOSX directory + continue; + + $needed_dirs[] = $to . untrailingslashit( $file['folder'] ? $file['filename'] : dirname($file['filename']) ); + } + + $needed_dirs = array_unique($needed_dirs); + foreach ( $needed_dirs as $dir ) { + // Check the parent folders of the folders all exist within the creation array. + if ( untrailingslashit($to) == $dir ) // Skip over the working directory, We know this exists (or will exist) + continue; + if ( strpos($dir, $to) === false ) // If the directory is not within the working directory, Skip it + continue; + + $parent_folder = dirname($dir); + while ( !empty($parent_folder) && untrailingslashit($to) != $parent_folder && !in_array($parent_folder, $needed_dirs) ) { + $needed_dirs[] = $parent_folder; + $parent_folder = dirname($parent_folder); + } + } + asort($needed_dirs); + + // Create those directories if need be: + foreach ( $needed_dirs as $_dir ) { + if ( ! $wp_filesystem->mkdir($_dir, FS_CHMOD_DIR) && ! $wp_filesystem->is_dir($_dir) ) // Only check to see if the dir exists upon creation failure. Less I/O this way. + return new WP_Error('mkdir_failed', __('Could not create directory.'), $_dir); + } + unset($needed_dirs); + + // Extract the files from the zip + foreach ( $archive_files as $file ) { + if ( $file['folder'] ) + continue; + + if ( '__MACOSX/' === substr($file['filename'], 0, 9) ) // Don't extract the OS X-created __MACOSX directory files + continue; + + if ( ! $wp_filesystem->put_contents( $to . $file['filename'], $file['content'], FS_CHMOD_FILE) ) + return new WP_Error('copy_failed', __('Could not copy file.'), $to . $file['filename']); + } + return true; +} + +/** + * Copies a directory from one location to another via the WordPress Filesystem Abstraction. + * Assumes that WP_Filesystem() has already been called and setup. + * + * @since 2.5.0 + * + * @param string $from source directory + * @param string $to destination directory + * @param array $skip_list a list of files/folders to skip copying + * @return mixed WP_Error on failure, True on success. + */ +function copy_dir($from, $to, $skip_list = array() ) { + global $wp_filesystem; + + $dirlist = $wp_filesystem->dirlist($from); + + $from = trailingslashit($from); + $to = trailingslashit($to); + + $skip_regex = ''; + foreach ( (array)$skip_list as $key => $skip_file ) + $skip_regex .= preg_quote($skip_file, '!') . '|'; + + if ( !empty($skip_regex) ) + $skip_regex = '!(' . rtrim($skip_regex, '|') . ')$!i'; + + foreach ( (array) $dirlist as $filename => $fileinfo ) { + if ( !empty($skip_regex) ) + if ( preg_match($skip_regex, $from . $filename) ) + continue; + + if ( 'f' == $fileinfo['type'] ) { + if ( ! $wp_filesystem->copy($from . $filename, $to . $filename, true, FS_CHMOD_FILE) ) { + // If copy failed, chmod file to 0644 and try again. + $wp_filesystem->chmod($to . $filename, 0644); + if ( ! $wp_filesystem->copy($from . $filename, $to . $filename, true, FS_CHMOD_FILE) ) + return new WP_Error('copy_failed', __('Could not copy file.'), $to . $filename); + } + } elseif ( 'd' == $fileinfo['type'] ) { + if ( !$wp_filesystem->is_dir($to . $filename) ) { + if ( !$wp_filesystem->mkdir($to . $filename, FS_CHMOD_DIR) ) + return new WP_Error('mkdir_failed', __('Could not create directory.'), $to . $filename); + } + $result = copy_dir($from . $filename, $to . $filename, $skip_list); + if ( is_wp_error($result) ) + return $result; + } + } + return true; +} + +/** + * Initialises and connects the WordPress Filesystem Abstraction classes. + * This function will include the chosen transport and attempt connecting. + * + * Plugins may add extra transports, And force WordPress to use them by returning the filename via the 'filesystem_method_file' filter. + * + * @since 2.5.0 + * + * @param array $args (optional) Connection args, These are passed directly to the WP_Filesystem_*() classes. + * @param string $context (optional) Context for get_filesystem_method(), See function declaration for more information. + * @return boolean false on failure, true on success + */ +function WP_Filesystem( $args = false, $context = false ) { + global $wp_filesystem; + + require_once(ABSPATH . 'wp-admin/includes/class-wp-filesystem-base.php'); + + $method = get_filesystem_method($args, $context); + + if ( ! $method ) + return false; + + if ( ! class_exists("WP_Filesystem_$method") ) { + $abstraction_file = apply_filters('filesystem_method_file', ABSPATH . 'wp-admin/includes/class-wp-filesystem-' . $method . '.php', $method); + if ( ! file_exists($abstraction_file) ) + return; + + require_once($abstraction_file); + } + $method = "WP_Filesystem_$method"; + + $wp_filesystem = new $method($args); + + //Define the timeouts for the connections. Only available after the construct is called to allow for per-transport overriding of the default. + if ( ! defined('FS_CONNECT_TIMEOUT') ) + define('FS_CONNECT_TIMEOUT', 30); + if ( ! defined('FS_TIMEOUT') ) + define('FS_TIMEOUT', 30); + + if ( is_wp_error($wp_filesystem->errors) && $wp_filesystem->errors->get_error_code() ) + return false; + + if ( !$wp_filesystem->connect() ) + return false; //There was an erorr connecting to the server. + + // Set the permission constants if not already set. + if ( ! defined('FS_CHMOD_DIR') ) + define('FS_CHMOD_DIR', 0755 ); + if ( ! defined('FS_CHMOD_FILE') ) + define('FS_CHMOD_FILE', 0644 ); + + return true; +} + +/** + * Determines which Filesystem Method to use. + * The priority of the Transports are: Direct, SSH2, FTP PHP Extension, FTP Sockets (Via Sockets class, or fsoxkopen()) + * + * Note that the return value of this function can be overridden in 2 ways + * - By defining FS_METHOD in your wp-config.php file + * - By using the filesystem_method filter + * Valid values for these are: 'direct', 'ssh', 'ftpext' or 'ftpsockets' + * Plugins may also define a custom transport handler, See the WP_Filesystem function for more information. + * + * @since 2.5.0 + * + * @param array $args Connection details. + * @param string $context Full path to the directory that is tested for being writable. + * @return string The transport to use, see description for valid return values. + */ +function get_filesystem_method($args = array(), $context = false) { + $method = defined('FS_METHOD') ? FS_METHOD : false; //Please ensure that this is either 'direct', 'ssh', 'ftpext' or 'ftpsockets' + + if ( ! $method && function_exists('getmyuid') && function_exists('fileowner') ){ + if ( !$context ) + $context = WP_CONTENT_DIR; + $context = trailingslashit($context); + $temp_file_name = $context . 'temp-write-test-' . time(); + $temp_handle = @fopen($temp_file_name, 'w'); + if ( $temp_handle ) { + if ( getmyuid() == @fileowner($temp_file_name) ) + $method = 'direct'; + @fclose($temp_handle); + @unlink($temp_file_name); + } + } + + if ( ! $method && isset($args['connection_type']) && 'ssh' == $args['connection_type'] && extension_loaded('ssh2') && function_exists('stream_get_contents') ) $method = 'ssh2'; + if ( ! $method && extension_loaded('ftp') ) $method = 'ftpext'; + if ( ! $method && ( extension_loaded('sockets') || function_exists('fsockopen') ) ) $method = 'ftpsockets'; //Sockets: Socket extension; PHP Mode: FSockopen / fwrite / fread + return apply_filters('filesystem_method', $method, $args); +} + +/** + * Displays a form to the user to request for their FTP/SSH details in order to connect to the filesystem. + * All chosen/entered details are saved, Excluding the Password. + * + * Hostnames may be in the form of hostname:portnumber (eg: wordpress.org:2467) to specify an alternate FTP/SSH port. + * + * Plugins may override this form by returning true|false via the request_filesystem_credentials filter. + * + * @since 2.5.0 + * + * @param string $form_post the URL to post the form to + * @param string $type the chosen Filesystem method in use + * @param boolean $error if the current request has failed to connect + * @param string $context The directory which is needed access to, The write-test will be performed on this directory by get_filesystem_method() + * @param string $extra_fields Extra POST fields which should be checked for to be included in the post. + * @return boolean False on failure. True on success. + */ +function request_filesystem_credentials($form_post, $type = '', $error = false, $context = false, $extra_fields = null) { + $req_cred = apply_filters( 'request_filesystem_credentials', '', $form_post, $type, $error, $context, $extra_fields ); + if ( '' !== $req_cred ) + return $req_cred; + + if ( empty($type) ) + $type = get_filesystem_method(array(), $context); + + if ( 'direct' == $type ) + return true; + + if ( is_null( $extra_fields ) ) + $extra_fields = array( 'version', 'locale' ); + + $credentials = get_option('ftp_credentials', array( 'hostname' => '', 'username' => '')); + + // If defined, set it to that, Else, If POST'd, set it to that, If not, Set it to whatever it previously was(saved details in option) + $credentials['hostname'] = defined('FTP_HOST') ? FTP_HOST : (!empty($_POST['hostname']) ? stripslashes($_POST['hostname']) : $credentials['hostname']); + $credentials['username'] = defined('FTP_USER') ? FTP_USER : (!empty($_POST['username']) ? stripslashes($_POST['username']) : $credentials['username']); + $credentials['password'] = defined('FTP_PASS') ? FTP_PASS : (!empty($_POST['password']) ? stripslashes($_POST['password']) : ''); + + // Check to see if we are setting the public/private keys for ssh + $credentials['public_key'] = defined('FTP_PUBKEY') ? FTP_PUBKEY : (!empty($_POST['public_key']) ? stripslashes($_POST['public_key']) : ''); + $credentials['private_key'] = defined('FTP_PRIKEY') ? FTP_PRIKEY : (!empty($_POST['private_key']) ? stripslashes($_POST['private_key']) : ''); + + //sanitize the hostname, Some people might pass in odd-data: + $credentials['hostname'] = preg_replace('|\w+://|', '', $credentials['hostname']); //Strip any schemes off + + if ( strpos($credentials['hostname'], ':') ) { + list( $credentials['hostname'], $credentials['port'] ) = explode(':', $credentials['hostname'], 2); + if ( ! is_numeric($credentials['port']) ) + unset($credentials['port']); + } else { + unset($credentials['port']); + } + + if ( (defined('FTP_SSH') && FTP_SSH) || (defined('FS_METHOD') && 'ssh' == FS_METHOD) ) + $credentials['connection_type'] = 'ssh'; + else if ( (defined('FTP_SSL') && FTP_SSL) && 'ftpext' == $type ) //Only the FTP Extension understands SSL + $credentials['connection_type'] = 'ftps'; + else if ( !empty($_POST['connection_type']) ) + $credentials['connection_type'] = stripslashes($_POST['connection_type']); + else if ( !isset($credentials['connection_type']) ) //All else fails (And its not defaulted to something else saved), Default to FTP + $credentials['connection_type'] = 'ftp'; + + if ( ! $error && + ( + ( !empty($credentials['password']) && !empty($credentials['username']) && !empty($credentials['hostname']) ) || + ( 'ssh' == $credentials['connection_type'] && !empty($credentials['public_key']) && !empty($credentials['private_key']) ) + ) ) { + $stored_credentials = $credentials; + if ( !empty($stored_credentials['port']) ) //save port as part of hostname to simplify above code. + $stored_credentials['hostname'] .= ':' . $stored_credentials['port']; + + unset($stored_credentials['password'], $stored_credentials['port'], $stored_credentials['private_key'], $stored_credentials['public_key']); + update_option('ftp_credentials', $stored_credentials); + return $credentials; + } + $hostname = ''; + $username = ''; + $password = ''; + $connection_type = ''; + if ( !empty($credentials) ) + extract($credentials, EXTR_OVERWRITE); + if ( $error ) { + $error_string = __('Error: There was an error connecting to the server, Please verify the settings are correct.'); + if ( is_wp_error($error) ) + $error_string = esc_html( $error->get_error_message() ); + echo '

' . $error_string . '

'; + } + + $types = array(); + if ( extension_loaded('ftp') || extension_loaded('sockets') || function_exists('fsockopen') ) + $types[ 'ftp' ] = __('FTP'); + if ( extension_loaded('ftp') ) //Only this supports FTPS + $types[ 'ftps' ] = __('FTPS (SSL)'); + if ( extension_loaded('ssh2') && function_exists('stream_get_contents') ) + $types[ 'ssh' ] = __('SSH2'); + + $types = apply_filters('fs_ftp_connection_types', $types, $credentials, $type, $error, $context); + +?> + +
+
+ +

+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
" size="40" />
size="40" />
size="40" />
+
+
+ +

size="40" />
size="40" /> +
+
+ $text ) : ?> + + +
+
+ +'; +} +submit_button( __( 'Proceed' ), 'button', 'upgrade' ); +?> +
+
+ diff --git a/src/wp-admin/includes/image-edit.php b/src/wp-admin/includes/image-edit.php new file mode 100644 index 0000000..86cdfe2 --- /dev/null +++ b/src/wp-admin/includes/image-edit.php @@ -0,0 +1,668 @@ + 400 ? 400 / $big : 1; + + $backup_sizes = get_post_meta( $post_id, '_wp_attachment_backup_sizes', true ); + $can_restore = !empty($backup_sizes) && isset($backup_sizes['full-orig']) + && $backup_sizes['full-orig']['file'] != basename($meta['file']); + + if ( $msg ) { + if ( isset($msg->error) ) + $note = "

$msg->error

"; + elseif ( isset($msg->msg) ) + $note = "

$msg->msg

"; + } + + ?> +
+ + + + + +
+
+
, this)" class="imgedit-crop disabled" title="">
+
, this)" title="">
+
, this)" title="">
+ +
+
+ + +
, this)" class="imgedit-flipv" title="">
+
, this)" class="imgedit-fliph" title="">
+ +
, this)" class="imgedit-undo disabled" title="">
+
, this)" class="imgedit-redo disabled" title="">
+
+
+ + + + + + + + + +
+ +
+ +
+ + )" disabled="disabled" class="button-primary imgedit-submit-btn" value="" /> +
+
+
+
+ +
+

+

+
+ × + ! + , 'scale')" class="button-primary" value="" /> +
+
+
+ + + +
+ +
+

+
+ , 'restore')" class="button-primary" value="" /> +
+
+
+ + + +
+ +
+
+ + +
+

+ +
    +
  • +
  • +
  • +
  • +
  • +
+ +


+

+ +


+

+
+
+ +

+ + + + : + + +

+ +

+ + + + : + + +

+
+ + + +
+
+ + +

+
+ +

+
+

+ +

+
+ + + + + + +

+
+ + + +
+
+ + +
+ 400 ? (400 / $max) : 1; +} + +function _rotate_image_resource($img, $angle) { + if ( function_exists('imagerotate') ) { + $rotated = imagerotate($img, $angle, 0); + if ( is_resource($rotated) ) { + imagedestroy($img); + $img = $rotated; + } + } + return $img; +} + + +function _flip_image_resource($img, $horz, $vert) { + $w = imagesx($img); + $h = imagesy($img); + $dst = wp_imagecreatetruecolor($w, $h); + if ( is_resource($dst) ) { + $sx = $vert ? ($w - 1) : 0; + $sy = $horz ? ($h - 1) : 0; + $sw = $vert ? -$w : $w; + $sh = $horz ? -$h : $h; + + if ( imagecopyresampled($dst, $img, 0, 0, $sx, $sy, $w, $h, $sw, $sh) ) { + imagedestroy($img); + $img = $dst; + } + } + return $img; +} + +function _crop_image_resource($img, $x, $y, $w, $h) { + $dst = wp_imagecreatetruecolor($w, $h); + if ( is_resource($dst) ) { + if ( imagecopy($dst, $img, 0, 0, $x, $y, $w, $h) ) { + imagedestroy($img); + $img = $dst; + } + } + return $img; +} + +function image_edit_apply_changes($img, $changes) { + + if ( !is_array($changes) ) + return $img; + + // expand change operations + foreach ( $changes as $key => $obj ) { + if ( isset($obj->r) ) { + $obj->type = 'rotate'; + $obj->angle = $obj->r; + unset($obj->r); + } elseif ( isset($obj->f) ) { + $obj->type = 'flip'; + $obj->axis = $obj->f; + unset($obj->f); + } elseif ( isset($obj->c) ) { + $obj->type = 'crop'; + $obj->sel = $obj->c; + unset($obj->c); + } + $changes[$key] = $obj; + } + + // combine operations + if ( count($changes) > 1 ) { + $filtered = array($changes[0]); + for ( $i = 0, $j = 1; $j < count($changes); $j++ ) { + $combined = false; + if ( $filtered[$i]->type == $changes[$j]->type ) { + switch ( $filtered[$i]->type ) { + case 'rotate': + $filtered[$i]->angle += $changes[$j]->angle; + $combined = true; + break; + case 'flip': + $filtered[$i]->axis ^= $changes[$j]->axis; + $combined = true; + break; + } + } + if ( !$combined ) + $filtered[++$i] = $changes[$j]; + } + $changes = $filtered; + unset($filtered); + } + + // image resource before applying the changes + $img = apply_filters('image_edit_before_change', $img, $changes); + + foreach ( $changes as $operation ) { + switch ( $operation->type ) { + case 'rotate': + if ( $operation->angle != 0 ) + $img = _rotate_image_resource($img, $operation->angle); + break; + case 'flip': + if ( $operation->axis != 0 ) + $img = _flip_image_resource($img, ($operation->axis & 1) != 0, ($operation->axis & 2) != 0); + break; + case 'crop': + $sel = $operation->sel; + $scale = 1 / _image_get_preview_ratio( imagesx($img), imagesy($img) ); // discard preview scaling + $img = _crop_image_resource($img, $sel->x * $scale, $sel->y * $scale, $sel->w * $scale, $sel->h * $scale); + break; + } + } + + return $img; +} + +function stream_preview_image($post_id) { + $post = get_post($post_id); + @ini_set( 'memory_limit', apply_filters( 'admin_memory_limit', WP_MAX_MEMORY_LIMIT ) ); + $img = load_image_to_edit( $post_id, $post->post_mime_type, array(400, 400) ); + + if ( !is_resource($img) ) + return false; + + $changes = !empty($_REQUEST['history']) ? json_decode( stripslashes($_REQUEST['history']) ) : null; + if ( $changes ) + $img = image_edit_apply_changes($img, $changes); + + // scale the image + $w = imagesx($img); + $h = imagesy($img); + $ratio = _image_get_preview_ratio($w, $h); + $w2 = $w * $ratio; + $h2 = $h * $ratio; + + $preview = wp_imagecreatetruecolor($w2, $h2); + imagecopyresampled( $preview, $img, 0, 0, 0, 0, $w2, $h2, $w, $h ); + wp_stream_image($preview, $post->post_mime_type, $post_id); + + imagedestroy($preview); + imagedestroy($img); + return true; +} + +function wp_restore_image($post_id) { + $meta = wp_get_attachment_metadata($post_id); + $file = get_attached_file($post_id); + $backup_sizes = get_post_meta( $post_id, '_wp_attachment_backup_sizes', true ); + $restored = false; + $msg = new stdClass; + + if ( !is_array($backup_sizes) ) { + $msg->error = __('Cannot load image metadata.'); + return $msg; + } + + $parts = pathinfo($file); + $suffix = time() . rand(100, 999); + $default_sizes = apply_filters( 'intermediate_image_sizes', array('large', 'medium', 'thumbnail') ); + + if ( isset($backup_sizes['full-orig']) && is_array($backup_sizes['full-orig']) ) { + $data = $backup_sizes['full-orig']; + + if ( $parts['basename'] != $data['file'] ) { + if ( defined('IMAGE_EDIT_OVERWRITE') && IMAGE_EDIT_OVERWRITE ) { + // delete only if it's edited image + if ( preg_match('/-e[0-9]{13}\./', $parts['basename']) ) { + $delpath = apply_filters('wp_delete_file', $file); + @unlink($delpath); + } + } else { + $backup_sizes["full-$suffix"] = array('width' => $meta['width'], 'height' => $meta['height'], 'file' => $parts['basename']); + } + } + + $restored_file = path_join($parts['dirname'], $data['file']); + $restored = update_attached_file($post_id, $restored_file); + + $meta['file'] = _wp_relative_upload_path( $restored_file ); + $meta['width'] = $data['width']; + $meta['height'] = $data['height']; + list ( $uwidth, $uheight ) = wp_constrain_dimensions($meta['width'], $meta['height'], 128, 96); + $meta['hwstring_small'] = "height='$uheight' width='$uwidth'"; + } + + foreach ( $default_sizes as $default_size ) { + if ( isset($backup_sizes["$default_size-orig"]) ) { + $data = $backup_sizes["$default_size-orig"]; + if ( isset($meta['sizes'][$default_size]) && $meta['sizes'][$default_size]['file'] != $data['file'] ) { + if ( defined('IMAGE_EDIT_OVERWRITE') && IMAGE_EDIT_OVERWRITE ) { + // delete only if it's edited image + if ( preg_match('/-e[0-9]{13}-/', $meta['sizes'][$default_size]['file']) ) { + $delpath = apply_filters( 'wp_delete_file', path_join($parts['dirname'], $meta['sizes'][$default_size]['file']) ); + @unlink($delpath); + } + } else { + $backup_sizes["$default_size-{$suffix}"] = $meta['sizes'][$default_size]; + } + } + + $meta['sizes'][$default_size] = $data; + } else { + unset($meta['sizes'][$default_size]); + } + } + + if ( !wp_update_attachment_metadata($post_id, $meta) || !update_post_meta( $post_id, '_wp_attachment_backup_sizes', $backup_sizes) ) { + $msg->error = __('Cannot save image metadata.'); + return $msg; + } + + if ( !$restored ) + $msg->error = __('Image metadata is inconsistent.'); + else + $msg->msg = __('Image restored successfully.'); + + return $msg; +} + +function wp_save_image($post_id) { + $return = new stdClass; + $success = $delete = $scaled = $nocrop = false; + $post = get_post($post_id); + @ini_set( 'memory_limit', apply_filters( 'admin_memory_limit', WP_MAX_MEMORY_LIMIT ) ); + $img = load_image_to_edit($post_id, $post->post_mime_type); + + if ( !is_resource($img) ) { + $return->error = esc_js( __('Unable to create new image.') ); + return $return; + } + + $fwidth = !empty($_REQUEST['fwidth']) ? intval($_REQUEST['fwidth']) : 0; + $fheight = !empty($_REQUEST['fheight']) ? intval($_REQUEST['fheight']) : 0; + $target = !empty($_REQUEST['target']) ? preg_replace('/[^a-z0-9_-]+/i', '', $_REQUEST['target']) : ''; + $scale = !empty($_REQUEST['do']) && 'scale' == $_REQUEST['do']; + + if ( $scale && $fwidth > 0 && $fheight > 0 ) { + $sX = imagesx($img); + $sY = imagesy($img); + + // check if it has roughly the same w / h ratio + $diff = round($sX / $sY, 2) - round($fwidth / $fheight, 2); + if ( -0.1 < $diff && $diff < 0.1 ) { + // scale the full size image + $dst = wp_imagecreatetruecolor($fwidth, $fheight); + if ( imagecopyresampled( $dst, $img, 0, 0, 0, 0, $fwidth, $fheight, $sX, $sY ) ) { + imagedestroy($img); + $img = $dst; + $scaled = true; + } + } + + if ( !$scaled ) { + $return->error = esc_js( __('Error while saving the scaled image. Please reload the page and try again.') ); + return $return; + } + } elseif ( !empty($_REQUEST['history']) ) { + $changes = json_decode( stripslashes($_REQUEST['history']) ); + if ( $changes ) + $img = image_edit_apply_changes($img, $changes); + } else { + $return->error = esc_js( __('Nothing to save, the image has not changed.') ); + return $return; + } + + $meta = wp_get_attachment_metadata($post_id); + $backup_sizes = get_post_meta( $post->ID, '_wp_attachment_backup_sizes', true ); + + if ( !is_array($meta) ) { + $return->error = esc_js( __('Image data does not exist. Please re-upload the image.') ); + return $return; + } + + if ( !is_array($backup_sizes) ) + $backup_sizes = array(); + + // generate new filename + $path = get_attached_file($post_id); + $path_parts = pathinfo( $path ); + $filename = $path_parts['filename']; + $suffix = time() . rand(100, 999); + + if ( defined('IMAGE_EDIT_OVERWRITE') && IMAGE_EDIT_OVERWRITE && + isset($backup_sizes['full-orig']) && $backup_sizes['full-orig']['file'] != $path_parts['basename'] ) { + + if ( 'thumbnail' == $target ) + $new_path = "{$path_parts['dirname']}/{$filename}-temp.{$path_parts['extension']}"; + else + $new_path = $path; + } else { + while( true ) { + $filename = preg_replace( '/-e([0-9]+)$/', '', $filename ); + $filename .= "-e{$suffix}"; + $new_filename = "{$filename}.{$path_parts['extension']}"; + $new_path = "{$path_parts['dirname']}/$new_filename"; + if ( file_exists($new_path) ) + $suffix++; + else + break; + } + } + + // save the full-size file, also needed to create sub-sizes + if ( !wp_save_image_file($new_path, $img, $post->post_mime_type, $post_id) ) { + $return->error = esc_js( __('Unable to save the image.') ); + return $return; + } + + if ( 'nothumb' == $target || 'all' == $target || 'full' == $target || $scaled ) { + $tag = false; + if ( isset($backup_sizes['full-orig']) ) { + if ( ( !defined('IMAGE_EDIT_OVERWRITE') || !IMAGE_EDIT_OVERWRITE ) && $backup_sizes['full-orig']['file'] != $path_parts['basename'] ) + $tag = "full-$suffix"; + } else { + $tag = 'full-orig'; + } + + if ( $tag ) + $backup_sizes[$tag] = array('width' => $meta['width'], 'height' => $meta['height'], 'file' => $path_parts['basename']); + + $success = update_attached_file($post_id, $new_path); + + $meta['file'] = _wp_relative_upload_path($new_path); + $meta['width'] = imagesx($img); + $meta['height'] = imagesy($img); + + list ( $uwidth, $uheight ) = wp_constrain_dimensions($meta['width'], $meta['height'], 128, 96); + $meta['hwstring_small'] = "height='$uheight' width='$uwidth'"; + + if ( $success && ('nothumb' == $target || 'all' == $target) ) { + $sizes = apply_filters( 'intermediate_image_sizes', array('large', 'medium', 'thumbnail') ); + if ( 'nothumb' == $target ) + $sizes = array_diff( $sizes, array('thumbnail') ); + } + + $return->fw = $meta['width']; + $return->fh = $meta['height']; + } elseif ( 'thumbnail' == $target ) { + $sizes = array( 'thumbnail' ); + $success = $delete = $nocrop = true; + } + + if ( isset($sizes) ) { + foreach ( $sizes as $size ) { + $tag = false; + if ( isset($meta['sizes'][$size]) ) { + if ( isset($backup_sizes["$size-orig"]) ) { + if ( ( !defined('IMAGE_EDIT_OVERWRITE') || !IMAGE_EDIT_OVERWRITE ) && $backup_sizes["$size-orig"]['file'] != $meta['sizes'][$size]['file'] ) + $tag = "$size-$suffix"; + } else { + $tag = "$size-orig"; + } + + if ( $tag ) + $backup_sizes[$tag] = $meta['sizes'][$size]; + } + + $crop = $nocrop ? false : get_option("{$size}_crop"); + $resized = image_make_intermediate_size($new_path, get_option("{$size}_size_w"), get_option("{$size}_size_h"), $crop ); + + if ( $resized ) + $meta['sizes'][$size] = $resized; + else + unset($meta['sizes'][$size]); + } + } + + if ( $success ) { + wp_update_attachment_metadata($post_id, $meta); + update_post_meta( $post_id, '_wp_attachment_backup_sizes', $backup_sizes); + + if ( $target == 'thumbnail' || $target == 'all' || $target == 'full' ) { + $file_url = wp_get_attachment_url($post_id); + if ( $thumb = $meta['sizes']['thumbnail'] ) + $return->thumbnail = path_join( dirname($file_url), $thumb['file'] ); + else + $return->thumbnail = "$file_url?w=128&h=128"; + } + } else { + $delete = true; + } + + if ( $delete ) { + $delpath = apply_filters('wp_delete_file', $new_path); + @unlink($delpath); + } + + imagedestroy($img); + + $return->msg = esc_js( __('Image saved') ); + return $return; +} + diff --git a/src/wp-admin/includes/image.php b/src/wp-admin/includes/image.php new file mode 100644 index 0000000..44329c0 --- /dev/null +++ b/src/wp-admin/includes/image.php @@ -0,0 +1,341 @@ + '', 'height' => '', 'crop' => FALSE ); + if ( isset( $_wp_additional_image_sizes[$s]['width'] ) ) + $sizes[$s]['width'] = intval( $_wp_additional_image_sizes[$s]['width'] ); // For theme-added sizes + else + $sizes[$s]['width'] = get_option( "{$s}_size_w" ); // For default sizes set in options + if ( isset( $_wp_additional_image_sizes[$s]['height'] ) ) + $sizes[$s]['height'] = intval( $_wp_additional_image_sizes[$s]['height'] ); // For theme-added sizes + else + $sizes[$s]['height'] = get_option( "{$s}_size_h" ); // For default sizes set in options + if ( isset( $_wp_additional_image_sizes[$s]['crop'] ) ) + $sizes[$s]['crop'] = intval( $_wp_additional_image_sizes[$s]['crop'] ); // For theme-added sizes + else + $sizes[$s]['crop'] = get_option( "{$s}_crop" ); // For default sizes set in options + } + + $sizes = apply_filters( 'intermediate_image_sizes_advanced', $sizes ); + + foreach ($sizes as $size => $size_data ) { + $resized = image_make_intermediate_size( $file, $size_data['width'], $size_data['height'], $size_data['crop'] ); + if ( $resized ) + $metadata['sizes'][$size] = $resized; + } + + // fetch additional metadata from exif/iptc + $image_meta = wp_read_image_metadata( $file ); + if ( $image_meta ) + $metadata['image_meta'] = $image_meta; + + } + + return apply_filters( 'wp_generate_attachment_metadata', $metadata, $attachment_id ); +} + +/** + * Calculated the new dimentions for a downsampled image. + * + * @since 2.0.0 + * @see wp_constrain_dimensions() + * + * @param int $width Current width of the image + * @param int $height Current height of the image + * @return mixed Array(height,width) of shrunk dimensions. + */ +function get_udims( $width, $height) { + return wp_constrain_dimensions( $width, $height, 128, 96 ); +} + +/** + * Convert a fraction string to a decimal. + * + * @since 2.5.0 + * + * @param string $str + * @return int|float + */ +function wp_exif_frac2dec($str) { + @list( $n, $d ) = explode( '/', $str ); + if ( !empty($d) ) + return $n / $d; + return $str; +} + +/** + * Convert the exif date format to a unix timestamp. + * + * @since 2.5.0 + * + * @param string $str + * @return int + */ +function wp_exif_date2ts($str) { + @list( $date, $time ) = explode( ' ', trim($str) ); + @list( $y, $m, $d ) = explode( ':', $date ); + + return strtotime( "{$y}-{$m}-{$d} {$time}" ); +} + +/** + * Get extended image metadata, exif or iptc as available. + * + * Retrieves the EXIF metadata aperture, credit, camera, caption, copyright, iso + * created_timestamp, focal_length, shutter_speed, and title. + * + * The IPTC metadata that is retrieved is APP13, credit, byline, created date + * and time, caption, copyright, and title. Also includes FNumber, Model, + * DateTimeDigitized, FocalLength, ISOSpeedRatings, and ExposureTime. + * + * @todo Try other exif libraries if available. + * @since 2.5.0 + * + * @param string $file + * @return bool|array False on failure. Image metadata array on success. + */ +function wp_read_image_metadata( $file ) { + if ( ! file_exists( $file ) ) + return false; + + list( , , $sourceImageType ) = getimagesize( $file ); + + // exif contains a bunch of data we'll probably never need formatted in ways + // that are difficult to use. We'll normalize it and just extract the fields + // that are likely to be useful. Fractions and numbers are converted to + // floats, dates to unix timestamps, and everything else to strings. + $meta = array( + 'aperture' => 0, + 'credit' => '', + 'camera' => '', + 'caption' => '', + 'created_timestamp' => 0, + 'copyright' => '', + 'focal_length' => 0, + 'iso' => 0, + 'shutter_speed' => 0, + 'title' => '', + ); + + // read iptc first, since it might contain data not available in exif such + // as caption, description etc + if ( is_callable( 'iptcparse' ) ) { + getimagesize( $file, $info ); + + if ( ! empty( $info['APP13'] ) ) { + $iptc = iptcparse( $info['APP13'] ); + + // headline, "A brief synopsis of the caption." + if ( ! empty( $iptc['2#105'][0] ) ) + $meta['title'] = utf8_encode( trim( $iptc['2#105'][0] ) ); + // title, "Many use the Title field to store the filename of the image, though the field may be used in many ways." + elseif ( ! empty( $iptc['2#005'][0] ) ) + $meta['title'] = utf8_encode( trim( $iptc['2#005'][0] ) ); + + if ( ! empty( $iptc['2#120'][0] ) ) { // description / legacy caption + $caption = utf8_encode( trim( $iptc['2#120'][0] ) ); + if ( empty( $meta['title'] ) ) { + // Assume the title is stored in 2:120 if it's short. + if ( strlen( $caption ) < 80 ) + $meta['title'] = $caption; + else + $meta['caption'] = $caption; + } elseif ( $caption != $meta['title'] ) { + $meta['caption'] = $caption; + } + } + + if ( ! empty( $iptc['2#110'][0] ) ) // credit + $meta['credit'] = utf8_encode(trim($iptc['2#110'][0])); + elseif ( ! empty( $iptc['2#080'][0] ) ) // creator / legacy byline + $meta['credit'] = utf8_encode(trim($iptc['2#080'][0])); + + if ( ! empty( $iptc['2#055'][0] ) and ! empty( $iptc['2#060'][0] ) ) // created date and time + $meta['created_timestamp'] = strtotime( $iptc['2#055'][0] . ' ' . $iptc['2#060'][0] ); + + if ( ! empty( $iptc['2#116'][0] ) ) // copyright + $meta['copyright'] = utf8_encode( trim( $iptc['2#116'][0] ) ); + } + } + + // fetch additional info from exif if available + if ( is_callable( 'exif_read_data' ) && in_array( $sourceImageType, apply_filters( 'wp_read_image_metadata_types', array( IMAGETYPE_JPEG, IMAGETYPE_TIFF_II, IMAGETYPE_TIFF_MM ) ) ) ) { + $exif = @exif_read_data( $file ); + + if ( !empty( $exif['Title'] ) ) + $meta['title'] = utf8_encode( trim( $exif['Title'] ) ); + + if ( ! empty( $exif['ImageDescription'] ) ) { + if ( empty( $meta['title'] ) && strlen( $exif['ImageDescription'] ) < 80 ) { + // Assume the title is stored in ImageDescription + $meta['title'] = utf8_encode( trim( $exif['ImageDescription'] ) ); + if ( ! empty( $exif['COMPUTED']['UserComment'] ) && trim( $exif['COMPUTED']['UserComment'] ) != $meta['title'] ) + $meta['caption'] = utf8_encode( trim( $exif['COMPUTED']['UserComment'] ) ); + } elseif ( trim( $exif['ImageDescription'] ) != $meta['title'] ) { + $meta['caption'] = utf8_encode( trim( $exif['ImageDescription'] ) ); + } + } elseif ( ! empty( $exif['Comments'] ) && trim( $exif['Comments'] ) != $meta['title'] ) { + $meta['caption'] = utf8_encode( trim( $exif['Comments'] ) ); + } + + if ( ! empty( $exif['Artist'] ) ) + $meta['credit'] = utf8_encode( trim( $exif['Artist'] ) ); + elseif ( ! empty($exif['Author'] ) ) + $meta['credit'] = utf8_encode( trim( $exif['Author'] ) ); + + if ( ! empty( $exif['Copyright'] ) ) + $meta['copyright'] = utf8_encode( trim( $exif['Copyright'] ) ); + if ( ! empty($exif['FNumber'] ) ) + $meta['aperture'] = round( wp_exif_frac2dec( $exif['FNumber'] ), 2 ); + if ( ! empty($exif['Model'] ) ) + $meta['camera'] = utf8_encode( trim( $exif['Model'] ) ); + if ( ! empty($exif['DateTimeDigitized'] ) ) + $meta['created_timestamp'] = wp_exif_date2ts($exif['DateTimeDigitized'] ); + if ( ! empty($exif['FocalLength'] ) ) + $meta['focal_length'] = wp_exif_frac2dec( $exif['FocalLength'] ); + if ( ! empty($exif['ISOSpeedRatings'] ) ) + $meta['iso'] = utf8_encode( trim( $exif['ISOSpeedRatings'] ) ); + if ( ! empty($exif['ExposureTime'] ) ) + $meta['shutter_speed'] = wp_exif_frac2dec( $exif['ExposureTime'] ); + } + + return apply_filters( 'wp_read_image_metadata', $meta, $file, $sourceImageType ); + +} + +/** + * Validate that file is an image. + * + * @since 2.5.0 + * + * @param string $path File path to test if valid image. + * @return bool True if valid image, false if not valid image. + */ +function file_is_valid_image($path) { + $size = @getimagesize($path); + return !empty($size); +} + +/** + * Validate that file is suitable for displaying within a web page. + * + * @since 2.5.0 + * @uses apply_filters() Calls 'file_is_displayable_image' on $result and $path. + * + * @param string $path File path to test. + * @return bool True if suitable, false if not suitable. + */ +function file_is_displayable_image($path) { + $info = @getimagesize($path); + if ( empty($info) ) + $result = false; + elseif ( !in_array($info[2], array(IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_PNG)) ) // only gif, jpeg and png images can reliably be displayed + $result = false; + else + $result = true; + + return apply_filters('file_is_displayable_image', $result, $path); +} diff --git a/src/wp-admin/includes/import.php b/src/wp-admin/includes/import.php new file mode 100644 index 0000000..f57be76 --- /dev/null +++ b/src/wp-admin/includes/import.php @@ -0,0 +1,97 @@ + false, 'test_type' => false ); + $_FILES['import']['name'] .= '.txt'; + $file = wp_handle_upload( $_FILES['import'], $overrides ); + + if ( isset( $file['error'] ) ) + return $file; + + $url = $file['url']; + $type = $file['type']; + $file = $file['file']; + $filename = basename( $file ); + + // Construct the object array + $object = array( 'post_title' => $filename, + 'post_content' => $url, + 'post_mime_type' => $type, + 'guid' => $url, + 'context' => 'import', + 'post_status' => 'private' + ); + + // Save the data + $id = wp_insert_attachment( $object, $file ); + + // schedule a cleanup for one day from now in case of failed import or missing wp_import_cleanup() call + wp_schedule_single_event( time() + 86400, 'importer_scheduled_cleanup', array( $id ) ); + + return array( 'file' => $file, 'id' => $id ); +} + +?> diff --git a/src/wp-admin/includes/internal-linking.php b/src/wp-admin/includes/internal-linking.php new file mode 100644 index 0000000..a95c01b --- /dev/null +++ b/src/wp-admin/includes/internal-linking.php @@ -0,0 +1,124 @@ + true ), 'objects' ); + $pt_names = array_keys( $pts ); + + $query = array( + 'post_type' => $pt_names, + 'suppress_filters' => true, + 'update_post_term_cache' => false, + 'update_post_meta_cache' => false, + 'post_status' => 'publish', + 'order' => 'DESC', + 'orderby' => 'post_date', + 'posts_per_page' => 20, + ); + + $args['pagenum'] = isset( $args['pagenum'] ) ? absint( $args['pagenum'] ) : 1; + + if ( isset( $args['s'] ) ) + $query['s'] = $args['s']; + + $query['offset'] = $args['pagenum'] > 1 ? $query['posts_per_page'] * ( $args['pagenum'] - 1 ) : 0; + + // Do main query. + $get_posts = new WP_Query; + $posts = $get_posts->query( $query ); + // Check if any posts were found. + if ( ! $get_posts->post_count ) + return false; + + // Build results. + $results = array(); + foreach ( $posts as $post ) { + if ( 'post' == $post->post_type ) + $info = mysql2date( __( 'Y/m/d' ), $post->post_date ); + else + $info = $pts[ $post->post_type ]->labels->singular_name; + + $results[] = array( + 'ID' => $post->ID, + 'title' => trim( esc_html( strip_tags( get_the_title( $post ) ) ) ), + 'permalink' => get_permalink( $post->ID ), + 'info' => $info, + ); + } + + return $results; +} + +/** + * Dialog for internal linking. + * + * @since 3.1.0 + */ +function wp_link_dialog() { +?> + + diff --git a/src/wp-admin/includes/list-table.php b/src/wp-admin/includes/list-table.php new file mode 100644 index 0000000..716e80a --- /dev/null +++ b/src/wp-admin/includes/list-table.php @@ -0,0 +1,104 @@ + 'posts', + 'WP_Media_List_Table' => 'media', + 'WP_Terms_List_Table' => 'terms', + 'WP_Users_List_Table' => 'users', + 'WP_Comments_List_Table' => 'comments', + 'WP_Post_Comments_List_Table' => 'comments', + 'WP_Links_List_Table' => 'links', + 'WP_Plugin_Install_List_Table' => 'plugin-install', + 'WP_Themes_List_Table' => 'themes', + 'WP_Theme_Install_List_Table' => 'theme-install', + 'WP_Plugins_List_Table' => 'plugins', + // Network Admin + 'WP_MS_Sites_List_Table' => 'ms-sites', + 'WP_MS_Users_List_Table' => 'ms-users', + 'WP_MS_Themes_List_Table' => 'ms-themes', + ); + + if ( isset( $core_classes[ $class ] ) ) { + require_once( ABSPATH . 'wp-admin/includes/class-wp-' . $core_classes[ $class ] . '-list-table.php' ); + return new $class; + } + + return false; +} + +/** + * Register column headers for a particular screen. + * + * @since 2.7.0 + * + * @param string $screen The handle for the screen to add help to. This is usually the hook name returned by the add_*_page() functions. + * @param array $columns An array of columns with column IDs as the keys and translated column names as the values + * @see get_column_headers(), print_column_headers(), get_hidden_columns() + */ +function register_column_headers($screen, $columns) { + $wp_list_table = new _WP_List_Table_Compat($screen, $columns); +} + +/** + * Prints column headers for a particular screen. + * + * @since 2.7.0 + */ +function print_column_headers($screen, $id = true) { + $wp_list_table = new _WP_List_Table_Compat($screen); + + $wp_list_table->print_column_headers($id); +} + +/** + * Helper class to be used only by back compat functions + * + * @since 3.1.0 + */ +class _WP_List_Table_Compat extends WP_List_Table { + var $_screen; + var $_columns; + + function _WP_List_Table_Compat( $screen, $columns = array() ) { + if ( is_string( $screen ) ) + $screen = convert_to_screen( $screen ); + + $this->_screen = $screen; + + if ( !empty( $columns ) ) { + $this->_columns = $columns; + add_filter( 'manage_' . $screen->id . '_columns', array( &$this, 'get_columns' ), 0 ); + } + } + + function get_column_info() { + $columns = get_column_headers( $this->_screen ); + $hidden = get_hidden_columns( $this->_screen ); + $sortable = array(); + + return array( $columns, $hidden, $sortable ); + } + + function get_columns() { + return $this->_columns; + } +} +?> \ No newline at end of file diff --git a/src/wp-admin/includes/manifest.php b/src/wp-admin/includes/manifest.php new file mode 100644 index 0000000..600b5db --- /dev/null +++ b/src/wp-admin/includes/manifest.php @@ -0,0 +1,203 @@ + __('From Computer'), // handler action suffix => tab text + 'type_url' => __('From URL'), + 'gallery' => __('Gallery'), + 'library' => __('Media Library') + ); + + return apply_filters('media_upload_tabs', $_default_tabs); +} + +/** + * {@internal Missing Short Description}} + * + * @since 2.5.0 + * + * @param unknown_type $tabs + * @return unknown + */ +function update_gallery_tab($tabs) { + global $wpdb; + + if ( !isset($_REQUEST['post_id']) ) { + unset($tabs['gallery']); + return $tabs; + } + + $post_id = intval($_REQUEST['post_id']); + + if ( $post_id ) + $attachments = intval( $wpdb->get_var( $wpdb->prepare( "SELECT count(*) FROM $wpdb->posts WHERE post_type = 'attachment' AND post_status != 'trash' AND post_parent = %d", $post_id ) ) ); + + if ( empty($attachments) ) { + unset($tabs['gallery']); + return $tabs; + } + + $tabs['gallery'] = sprintf(__('Gallery (%s)'), "$attachments"); + + return $tabs; +} +add_filter('media_upload_tabs', 'update_gallery_tab'); + +/** + * {@internal Missing Short Description}} + * + * @since 2.5.0 + */ +function the_media_upload_tabs() { + global $redir_tab; + $tabs = media_upload_tabs(); + + if ( !empty($tabs) ) { + echo "\n"; + } +} + +/** + * {@internal Missing Short Description}} + * + * @since 2.5.0 + * + * @param unknown_type $id + * @param unknown_type $alt + * @param unknown_type $title + * @param unknown_type $align + * @param unknown_type $url + * @param unknown_type $rel + * @param unknown_type $size + * @return unknown + */ +function get_image_send_to_editor($id, $caption, $title, $align, $url='', $rel = false, $size='medium', $alt = '') { + + $html = get_image_tag($id, $alt, $title, $align, $size); + + $rel = $rel ? ' rel="attachment wp-att-' . esc_attr($id).'"' : ''; + + if ( $url ) + $html = '$html"; + + $html = apply_filters( 'image_send_to_editor', $html, $id, $caption, $title, $align, $url, $size, $alt ); + + return $html; +} + +/** + * {@internal Missing Short Description}} + * + * @since 2.6.0 + * + * @param unknown_type $html + * @param unknown_type $id + * @param unknown_type $alt + * @param unknown_type $title + * @param unknown_type $align + * @param unknown_type $url + * @param unknown_type $size + * @return unknown + */ +function image_add_caption( $html, $id, $caption, $title, $align, $url, $size, $alt = '' ) { + + if ( empty($caption) || apply_filters( 'disable_captions', '' ) ) + return $html; + + $id = ( 0 < (int) $id ) ? 'attachment_' . $id : ''; + + if ( ! preg_match( '/width="([0-9]+)/', $html, $matches ) ) + return $html; + + $width = $matches[1]; + + $caption = str_replace( array( '>', '<', '"', "'" ), + array( '>', '<', '"', ''' ), + $caption + ); + + $html = preg_replace( '/(class=["\'][^\'"]*)align(none|left|right|center)\s?/', '$1', $html ); + if ( empty($align) ) + $align = 'none'; + + $shcode = '[caption id="' . $id . '" align="align' . $align + . '" width="' . $width . '" caption="' . addslashes($caption) . '"]' . $html . '[/caption]'; + + return apply_filters( 'image_add_caption_shortcode', $shcode, $html ); +} +add_filter( 'image_send_to_editor', 'image_add_caption', 20, 8 ); + +/** + * {@internal Missing Short Description}} + * + * @since 2.5.0 + * + * @param unknown_type $html + */ +function media_send_to_editor($html) { +?> + + false )) { + + $time = current_time('mysql'); + if ( $post = get_post($post_id) ) { + if ( substr( $post->post_date, 0, 4 ) > 0 ) + $time = $post->post_date; + } + + $name = $_FILES[$file_id]['name']; + $file = wp_handle_upload($_FILES[$file_id], $overrides, $time); + + if ( isset($file['error']) ) + return new WP_Error( 'upload_error', $file['error'] ); + + $name_parts = pathinfo($name); + $name = trim( substr( $name, 0, -(1 + strlen($name_parts['extension'])) ) ); + + $url = $file['url']; + $type = $file['type']; + $file = $file['file']; + $title = $name; + $content = ''; + + // use image exif/iptc data for title and caption defaults if possible + if ( $image_meta = @wp_read_image_metadata($file) ) { + if ( trim( $image_meta['title'] ) && ! is_numeric( sanitize_title( $image_meta['title'] ) ) ) + $title = $image_meta['title']; + if ( trim( $image_meta['caption'] ) ) + $content = $image_meta['caption']; + } + + // Construct the attachment array + $attachment = array_merge( array( + 'post_mime_type' => $type, + 'guid' => $url, + 'post_parent' => $post_id, + 'post_title' => $title, + 'post_content' => $content, + ), $post_data ); + + // This should never be set as it would then overwrite an existing attachment. + if ( isset( $attachment['ID'] ) ) + unset( $attachment['ID'] ); + + // Save the data + $id = wp_insert_attachment($attachment, $file, $post_id); + if ( !is_wp_error($id) ) { + wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $file ) ); + } + + return $id; + +} + +/** + * This handles a sideloaded file in the same way as an uploaded file is handled by {@link media_handle_upload()} + * + * @since 2.6.0 + * + * @param array $file_array Array similar to a {@link $_FILES} upload array + * @param int $post_id The post ID the media is associated with + * @param string $desc Description of the sideloaded file + * @param array $post_data allows you to overwrite some of the attachment + * @return int|object The ID of the attachment or a WP_Error on failure + */ +function media_handle_sideload($file_array, $post_id, $desc = null, $post_data = array()) { + $overrides = array('test_form'=>false); + + $file = wp_handle_sideload($file_array, $overrides); + if ( isset($file['error']) ) + return new WP_Error( 'upload_error', $file['error'] ); + + $url = $file['url']; + $type = $file['type']; + $file = $file['file']; + $title = preg_replace('/\.[^.]+$/', '', basename($file)); + $content = ''; + + // use image exif/iptc data for title and caption defaults if possible + if ( $image_meta = @wp_read_image_metadata($file) ) { + if ( trim( $image_meta['title'] ) && ! is_numeric( sanitize_title( $image_meta['title'] ) ) ) + $title = $image_meta['title']; + if ( trim( $image_meta['caption'] ) ) + $content = $image_meta['caption']; + } + + $title = isset($desc) ? $desc : ''; + + // Construct the attachment array + $attachment = array_merge( array( + 'post_mime_type' => $type, + 'guid' => $url, + 'post_parent' => $post_id, + 'post_title' => $title, + 'post_content' => $content, + ), $post_data ); + + // This should never be set as it would then overwrite an existing attachment. + if ( isset( $attachment['ID'] ) ) + unset( $attachment['ID'] ); + + // Save the attachment metadata + $id = wp_insert_attachment($attachment, $file, $post_id); + if ( !is_wp_error($id) ) + wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $file ) ); + + return $id; +} + +/** + * {@internal Missing Short Description}} + * + * Wrap iframe content (produced by $content_func) in a doctype, html head/body + * etc any additional function args will be passed to content_func. + * + * @since 2.5.0 + * + * @param unknown_type $content_func + */ +function wp_iframe($content_func /* ... */) { +?> + + > + + +<?php bloginfo('name') ?> › <?php _e('Uploads'); ?> — <?php _e('WordPress'); ?> + + + + + class="no-js"> + + + + + +$title"; +} + +function get_upload_iframe_src($type) { + global $post_ID, $temp_ID; + $uploading_iframe_ID = (int) (0 == $post_ID ? $temp_ID : $post_ID); + $upload_iframe_src = add_query_arg('post_id', $uploading_iframe_ID, 'media-upload.php'); + + if ( 'media' != $type ) + $upload_iframe_src = add_query_arg('type', $type, $upload_iframe_src); + $upload_iframe_src = apply_filters($type . '_upload_iframe_src', $upload_iframe_src); + + return add_query_arg('TB_iframe', true, $upload_iframe_src); +} + +/** + * {@internal Missing Short Description}} + * + * @since 2.5.0 + * + * @return unknown + */ +function media_upload_form_handler() { + check_admin_referer('media-form'); + + $errors = null; + + if ( isset($_POST['send']) ) { + $keys = array_keys($_POST['send']); + $send_id = (int) array_shift($keys); + } + + if ( !empty($_POST['attachments']) ) foreach ( $_POST['attachments'] as $attachment_id => $attachment ) { + $post = $_post = get_post($attachment_id, ARRAY_A); + $post_type_object = get_post_type_object( $post[ 'post_type' ] ); + + if ( !current_user_can( $post_type_object->cap->edit_post, $attachment_id ) ) + continue; + + if ( isset($attachment['post_content']) ) + $post['post_content'] = $attachment['post_content']; + if ( isset($attachment['post_title']) ) + $post['post_title'] = $attachment['post_title']; + if ( isset($attachment['post_excerpt']) ) + $post['post_excerpt'] = $attachment['post_excerpt']; + if ( isset($attachment['menu_order']) ) + $post['menu_order'] = $attachment['menu_order']; + + if ( isset($send_id) && $attachment_id == $send_id ) { + if ( isset($attachment['post_parent']) ) + $post['post_parent'] = $attachment['post_parent']; + } + + $post = apply_filters('attachment_fields_to_save', $post, $attachment); + + if ( isset($attachment['image_alt']) ) { + $image_alt = get_post_meta($attachment_id, '_wp_attachment_image_alt', true); + if ( $image_alt != stripslashes($attachment['image_alt']) ) { + $image_alt = wp_strip_all_tags( stripslashes($attachment['image_alt']), true ); + // update_meta expects slashed + update_post_meta( $attachment_id, '_wp_attachment_image_alt', addslashes($image_alt) ); + } + } + + if ( isset($post['errors']) ) { + $errors[$attachment_id] = $post['errors']; + unset($post['errors']); + } + + if ( $post != $_post ) + wp_update_post($post); + + foreach ( get_attachment_taxonomies($post) as $t ) { + if ( isset($attachment[$t]) ) + wp_set_object_terms($attachment_id, array_map('trim', preg_split('/,+/', $attachment[$t])), $t, false); + } + } + + if ( isset($_POST['insert-gallery']) || isset($_POST['update-gallery']) ) { ?> + + $html"; + } + + $html = apply_filters('media_send_to_editor', $html, $send_id, $attachment); + return media_send_to_editor($html); + } + + return $errors; +} + +/** + * {@internal Missing Short Description}} + * + * @since 2.5.0 + * + * @return unknown + */ +function media_upload_image() { + $errors = array(); + $id = 0; + + if ( isset($_POST['html-upload']) && !empty($_FILES) ) { + check_admin_referer('media-form'); + // Upload File button was clicked + $id = media_handle_upload('async-upload', $_REQUEST['post_id']); + unset($_FILES); + if ( is_wp_error($id) ) { + $errors['upload_error'] = $id; + $id = false; + } + } + + if ( !empty($_POST['insertonlybutton']) ) { + $alt = $align = ''; + + $src = $_POST['insertonly']['src']; + if ( !empty($src) && !strpos($src, '://') ) + $src = "http://$src"; + $alt = esc_attr($_POST['insertonly']['alt']); + if ( isset($_POST['insertonly']['align']) ) { + $align = esc_attr($_POST['insertonly']['align']); + $class = " class='align$align'"; + } + if ( !empty($src) ) + $html = "$alt"; + + $html = apply_filters('image_send_to_editor_url', $html, esc_url_raw($src), $alt, $align); + return media_send_to_editor($html); + } + + if ( !empty($_POST) ) { + $return = media_upload_form_handler(); + + if ( is_string($return) ) + return $return; + if ( is_array($return) ) + $errors = $return; + } + + if ( isset($_POST['save']) ) { + $errors['upload_notice'] = __('Saved.'); + return media_upload_gallery(); + } + + if ( isset($_GET['tab']) && $_GET['tab'] == 'type_url' ) + return wp_iframe( 'media_upload_type_url_form', 'image', $errors, $id ); + + return wp_iframe( 'media_upload_type_form', 'image', $errors, $id ); +} + +/** + * Download an image from the specified URL and attach it to a post. + * + * @since 2.6.0 + * + * @param string $file The URL of the image to download + * @param int $post_id The post ID the media is to be associated with + * @param string $desc Optional. Description of the image + * @return string|WP_Error Populated HTML img tag on success + */ +function media_sideload_image($file, $post_id, $desc = null) { + if ( ! empty($file) ) { + // Download file to temp location + $tmp = download_url( $file ); + + // Set variables for storage + // fix file filename for query strings + preg_match('/[^\?]+\.(jpg|JPG|jpe|JPE|jpeg|JPEG|gif|GIF|png|PNG)/', $file, $matches); + $file_array['name'] = basename($matches[0]); + $file_array['tmp_name'] = $tmp; + + // If error storing temporarily, unlink + if ( is_wp_error( $tmp ) ) { + @unlink($file_array['tmp_name']); + $file_array['tmp_name'] = ''; + } + + // do the validation and storage stuff + $id = media_handle_sideload( $file_array, $post_id, $desc ); + // If error storing permanently, unlink + if ( is_wp_error($id) ) { + @unlink($file_array['tmp_name']); + return $id; + } + + $src = wp_get_attachment_url( $id ); + } + + // Finally check to make sure the file has been saved, then return the html + if ( ! empty($src) ) { + $alt = isset($desc) ? esc_attr($desc) : ''; + $html = "$alt"; + return $html; + } +} + +/** + * {@internal Missing Short Description}} + * + * @since 2.5.0 + * + * @return unknown + */ +function media_upload_audio() { + $errors = array(); + $id = 0; + + if ( isset($_POST['html-upload']) && !empty($_FILES) ) { + check_admin_referer('media-form'); + // Upload File button was clicked + $id = media_handle_upload('async-upload', $_REQUEST['post_id']); + unset($_FILES); + if ( is_wp_error($id) ) { + $errors['upload_error'] = $id; + $id = false; + } + } + + if ( !empty($_POST['insertonlybutton']) ) { + $href = $_POST['insertonly']['href']; + if ( !empty($href) && !strpos($href, '://') ) + $href = "http://$href"; + + $title = esc_attr($_POST['insertonly']['title']); + if ( empty($title) ) + $title = esc_attr( basename($href) ); + + if ( !empty($title) && !empty($href) ) + $html = "$title"; + + $html = apply_filters('audio_send_to_editor_url', $html, $href, $title); + + return media_send_to_editor($html); + } + + if ( !empty($_POST) ) { + $return = media_upload_form_handler(); + + if ( is_string($return) ) + return $return; + if ( is_array($return) ) + $errors = $return; + } + + if ( isset($_POST['save']) ) { + $errors['upload_notice'] = __('Saved.'); + return media_upload_gallery(); + } + + if ( isset($_GET['tab']) && $_GET['tab'] == 'type_url' ) + return wp_iframe( 'media_upload_type_url_form', 'audio', $errors, $id ); + + return wp_iframe( 'media_upload_type_form', 'audio', $errors, $id ); +} + +/** + * {@internal Missing Short Description}} + * + * @since 2.5.0 + * + * @return unknown + */ +function media_upload_video() { + $errors = array(); + $id = 0; + + if ( isset($_POST['html-upload']) && !empty($_FILES) ) { + check_admin_referer('media-form'); + // Upload File button was clicked + $id = media_handle_upload('async-upload', $_REQUEST['post_id']); + unset($_FILES); + if ( is_wp_error($id) ) { + $errors['upload_error'] = $id; + $id = false; + } + } + + if ( !empty($_POST['insertonlybutton']) ) { + $href = $_POST['insertonly']['href']; + if ( !empty($href) && !strpos($href, '://') ) + $href = "http://$href"; + + $title = esc_attr($_POST['insertonly']['title']); + if ( empty($title) ) + $title = esc_attr( basename($href) ); + + if ( !empty($title) && !empty($href) ) + $html = "$title"; + + $html = apply_filters('video_send_to_editor_url', $html, $href, $title); + + return media_send_to_editor($html); + } + + if ( !empty($_POST) ) { + $return = media_upload_form_handler(); + + if ( is_string($return) ) + return $return; + if ( is_array($return) ) + $errors = $return; + } + + if ( isset($_POST['save']) ) { + $errors['upload_notice'] = __('Saved.'); + return media_upload_gallery(); + } + + if ( isset($_GET['tab']) && $_GET['tab'] == 'type_url' ) + return wp_iframe( 'media_upload_type_url_form', 'video', $errors, $id ); + + return wp_iframe( 'media_upload_type_form', 'video', $errors, $id ); +} + +/** + * {@internal Missing Short Description}} + * + * @since 2.5.0 + * + * @return unknown + */ +function media_upload_file() { + $errors = array(); + $id = 0; + + if ( isset($_POST['html-upload']) && !empty($_FILES) ) { + check_admin_referer('media-form'); + // Upload File button was clicked + $id = media_handle_upload('async-upload', $_REQUEST['post_id']); + unset($_FILES); + if ( is_wp_error($id) ) { + $errors['upload_error'] = $id; + $id = false; + } + } + + if ( !empty($_POST['insertonlybutton']) ) { + $href = $_POST['insertonly']['href']; + if ( !empty($href) && !strpos($href, '://') ) + $href = "http://$href"; + + $title = esc_attr($_POST['insertonly']['title']); + if ( empty($title) ) + $title = basename($href); + if ( !empty($title) && !empty($href) ) + $html = "$title"; + $html = apply_filters('file_send_to_editor_url', $html, esc_url_raw($href), $title); + return media_send_to_editor($html); + } + + if ( !empty($_POST) ) { + $return = media_upload_form_handler(); + + if ( is_string($return) ) + return $return; + if ( is_array($return) ) + $errors = $return; + } + + if ( isset($_POST['save']) ) { + $errors['upload_notice'] = __('Saved.'); + return media_upload_gallery(); + } + + if ( isset($_GET['tab']) && $_GET['tab'] == 'type_url' ) + return wp_iframe( 'media_upload_type_url_form', 'file', $errors, $id ); + + return wp_iframe( 'media_upload_type_form', 'file', $errors, $id ); +} + +/** + * {@internal Missing Short Description}} + * + * @since 2.5.0 + * + * @return unknown + */ +function media_upload_gallery() { + $errors = array(); + + if ( !empty($_POST) ) { + $return = media_upload_form_handler(); + + if ( is_string($return) ) + return $return; + if ( is_array($return) ) + $errors = $return; + } + + wp_enqueue_script('admin-gallery'); + return wp_iframe( 'media_upload_gallery_form', $errors ); +} + +/** + * {@internal Missing Short Description}} + * + * @since 2.5.0 + * + * @return unknown + */ +function media_upload_library() { + $errors = array(); + if ( !empty($_POST) ) { + $return = media_upload_form_handler(); + + if ( is_string($return) ) + return $return; + if ( is_array($return) ) + $errors = $return; + } + + return wp_iframe( 'media_upload_library_form', $errors ); +} + +/** + * Retrieve HTML for the image alignment radio buttons with the specified one checked. + * + * @since 2.7.0 + * + * @param unknown_type $post + * @param unknown_type $checked + * @return unknown + */ +function image_align_input_fields( $post, $checked = '' ) { + + if ( empty($checked) ) + $checked = get_user_setting('align', 'none'); + + $alignments = array('none' => __('None'), 'left' => __('Left'), 'center' => __('Center'), 'right' => __('Right')); + if ( !array_key_exists( (string) $checked, $alignments ) ) + $checked = 'none'; + + $out = array(); + foreach ( $alignments as $name => $label ) { + $name = esc_attr($name); + $out[] = ""; + } + return join("\n", $out); +} + +/** + * Retrieve HTML for the size radio buttons with the specified one checked. + * + * @since 2.7.0 + * + * @param unknown_type $post + * @param unknown_type $check + * @return unknown + */ +function image_size_input_fields( $post, $check = '' ) { + + // get a list of the actual pixel dimensions of each possible intermediate version of this image + $size_names = array('thumbnail' => __('Thumbnail'), 'medium' => __('Medium'), 'large' => __('Large'), 'full' => __('Full Size')); + + if ( empty($check) ) + $check = get_user_setting('imgsize', 'medium'); + + foreach ( $size_names as $size => $label ) { + $downsize = image_downsize($post->ID, $size); + $checked = ''; + + // is this size selectable? + $enabled = ( $downsize[3] || 'full' == $size ); + $css_id = "image-size-{$size}-{$post->ID}"; + // if this size is the default but that's not available, don't select it + if ( $size == $check ) { + if ( $enabled ) + $checked = " checked='checked'"; + else + $check = ''; + } elseif ( !$check && $enabled && 'thumbnail' != $size ) { + // if $check is not enabled, default to the first available size that's bigger than a thumbnail + $check = $size; + $checked = " checked='checked'"; + } + + $html = "
"; + + $html .= ""; + // only show the dimensions if that choice is available + if ( $enabled ) + $html .= " "; + + $html .= '
'; + + $out[] = $html; + } + + return array( + 'label' => __('Size'), + 'input' => 'html', + 'html' => join("\n", $out), + ); +} + +/** + * Retrieve HTML for the Link URL buttons with the default link type as specified. + * + * @since 2.7.0 + * + * @param unknown_type $post + * @param unknown_type $url_type + * @return unknown + */ +function image_link_input_fields($post, $url_type = '') { + + $file = wp_get_attachment_url($post->ID); + $link = get_attachment_link($post->ID); + + if ( empty($url_type) ) + $url_type = get_user_setting('urlbutton', 'post'); + + $url = ''; + if ( $url_type == 'file' ) + $url = $file; + elseif ( $url_type == 'post' ) + $url = $link; + + return " +
+ + + +"; +} + +/** + * {@internal Missing Short Description}} + * + * @since 2.5.0 + * + * @param unknown_type $form_fields + * @param unknown_type $post + * @return unknown + */ +function image_attachment_fields_to_edit($form_fields, $post) { + if ( substr($post->post_mime_type, 0, 5) == 'image' ) { + $alt = get_post_meta($post->ID, '_wp_attachment_image_alt', true); + if ( empty($alt) ) + $alt = ''; + + $form_fields['post_title']['required'] = true; + + $form_fields['image_alt'] = array( + 'value' => $alt, + 'label' => __('Alternate Text'), + 'helps' => __('Alt text for the image, e.g. “The Mona Lisa”') + ); + + $form_fields['align'] = array( + 'label' => __('Alignment'), + 'input' => 'html', + 'html' => image_align_input_fields($post, get_option('image_default_align')), + ); + + $form_fields['image-size'] = image_size_input_fields( $post, get_option('image_default_size', 'medium') ); + + } else { + unset( $form_fields['image_alt'] ); + } + return $form_fields; +} + +add_filter('attachment_fields_to_edit', 'image_attachment_fields_to_edit', 10, 2); + +/** + * {@internal Missing Short Description}} + * + * @since 2.5.0 + * + * @param unknown_type $form_fields + * @param unknown_type $post + * @return unknown + */ +function media_single_attachment_fields_to_edit( $form_fields, $post ) { + unset($form_fields['url'], $form_fields['align'], $form_fields['image-size']); + return $form_fields; +} + +/** + * {@internal Missing Short Description}} + * + * @since 2.8.0 + * + * @param unknown_type $form_fields + * @param unknown_type $post + * @return unknown + */ +function media_post_single_attachment_fields_to_edit( $form_fields, $post ) { + unset($form_fields['image_url']); + return $form_fields; +} + +/** + * {@internal Missing Short Description}} + * + * @since 2.5.0 + * + * @param unknown_type $post + * @param unknown_type $attachment + * @return unknown + */ +function image_attachment_fields_to_save($post, $attachment) { + if ( substr($post['post_mime_type'], 0, 5) == 'image' ) { + if ( strlen(trim($post['post_title'])) == 0 ) { + $post['post_title'] = preg_replace('/\.\w+$/', '', basename($post['guid'])); + $post['errors']['post_title']['errors'][] = __('Empty Title filled from filename.'); + } + } + + return $post; +} + +add_filter('attachment_fields_to_save', 'image_attachment_fields_to_save', 10, 2); + +/** + * {@internal Missing Short Description}} + * + * @since 2.5.0 + * + * @param unknown_type $html + * @param unknown_type $attachment_id + * @param unknown_type $attachment + * @return unknown + */ +function image_media_send_to_editor($html, $attachment_id, $attachment) { + $post =& get_post($attachment_id); + if ( substr($post->post_mime_type, 0, 5) == 'image' ) { + $url = $attachment['url']; + $align = !empty($attachment['align']) ? $attachment['align'] : 'none'; + $size = !empty($attachment['image-size']) ? $attachment['image-size'] : 'medium'; + $alt = !empty($attachment['image_alt']) ? $attachment['image_alt'] : ''; + $rel = ( $url == get_attachment_link($attachment_id) ); + + return get_image_send_to_editor($attachment_id, $attachment['post_excerpt'], $attachment['post_title'], $align, $url, $rel, $size, $alt); + } + + return $html; +} + +add_filter('media_send_to_editor', 'image_media_send_to_editor', 10, 3); + +/** + * {@internal Missing Short Description}} + * + * @since 2.5.0 + * + * @param unknown_type $post + * @param unknown_type $errors + * @return unknown + */ +function get_attachment_fields_to_edit($post, $errors = null) { + if ( is_int($post) ) + $post =& get_post($post); + if ( is_array($post) ) + $post = (object) $post; + + $image_url = wp_get_attachment_url($post->ID); + + $edit_post = sanitize_post($post, 'edit'); + + + + $form_fields = array( + 'post_title' => array( + 'label' => __('Title'), + 'value' => $edit_post->post_title + ), + 'image_alt' => array(), + 'post_excerpt' => array( + 'label' => __('Caption'), + 'value' => $edit_post->post_excerpt + ), + 'post_content' => array( + 'label' => __('Description'), + 'value' => $edit_post->post_content, + 'input' => 'textarea' + ), + 'url' => array( + 'label' => __('Link URL'), + 'input' => 'html', + 'html' => image_link_input_fields($post, get_option('image_default_link_type')), + 'helps' => __('Enter a link URL or click above for presets.') + ), + 'menu_order' => array( + 'label' => __('Order'), + 'value' => $edit_post->menu_order + ), + 'image_url' => array( + 'label' => __('File URL'), + 'input' => 'html', + 'html' => "
", + 'value' => wp_get_attachment_url($post->ID), + 'helps' => __('Location of the uploaded file.') + ) + ); + + foreach ( get_attachment_taxonomies($post) as $taxonomy ) { + $t = (array) get_taxonomy($taxonomy); + if ( ! $t['public'] ) + continue; + if ( empty($t['label']) ) + $t['label'] = $taxonomy; + if ( empty($t['args']) ) + $t['args'] = array(); + + $terms = get_object_term_cache($post->ID, $taxonomy); + if ( empty($terms) ) + $terms = wp_get_object_terms($post->ID, $taxonomy, $t['args']); + + $values = array(); + + foreach ( $terms as $term ) + $values[] = $term->name; + $t['value'] = join(', ', $values); + + $form_fields[$taxonomy] = $t; + } + + // Merge default fields with their errors, so any key passed with the error (e.g. 'error', 'helps', 'value') will replace the default + // The recursive merge is easily traversed with array casting: foreach( (array) $things as $thing ) + $form_fields = array_merge_recursive($form_fields, (array) $errors); + + $form_fields = apply_filters('attachment_fields_to_edit', $form_fields, $post); + + return $form_fields; +} + +/** + * Retrieve HTML for media items of post gallery. + * + * The HTML markup retrieved will be created for the progress of SWF Upload + * component. Will also create link for showing and hiding the form to modify + * the image attachment. + * + * @since 2.5.0 + * + * @param int $post_id Optional. Post ID. + * @param array $errors Errors for attachment, if any. + * @return string + */ +function get_media_items( $post_id, $errors ) { + $attachments = array(); + if ( $post_id ) { + $post = get_post($post_id); + if ( $post && $post->post_type == 'attachment' ) + $attachments = array($post->ID => $post); + else + $attachments = get_children( array( 'post_parent' => $post_id, 'post_type' => 'attachment', 'orderby' => 'menu_order ASC, ID', 'order' => 'DESC') ); + } else { + if ( is_array($GLOBALS['wp_the_query']->posts) ) + foreach ( $GLOBALS['wp_the_query']->posts as $attachment ) + $attachments[$attachment->ID] = $attachment; + } + + $output = ''; + foreach ( (array) $attachments as $id => $attachment ) { + if ( $attachment->post_status == 'trash' ) + continue; + if ( $item = get_media_item( $id, array( 'errors' => isset($errors[$id]) ? $errors[$id] : null) ) ) + $output .= "\n
$item\n
"; + } + + return $output; +} + +/** + * Retrieve HTML form for modifying the image attachment. + * + * @since 2.5.0 + * + * @param int $attachment_id Attachment ID for modification. + * @param string|array $args Optional. Override defaults. + * @return string HTML form for attachment. + */ +function get_media_item( $attachment_id, $args = null ) { + global $redir_tab; + + if ( ( $attachment_id = intval( $attachment_id ) ) && $thumb_url = wp_get_attachment_image_src( $attachment_id, 'thumbnail', true ) ) + $thumb_url = $thumb_url[0]; + else + $thumb_url = false; + + $post = get_post( $attachment_id ); + + $default_args = array( 'errors' => null, 'send' => $post->post_parent ? post_type_supports( get_post_type( $post->post_parent ), 'editor' ) : true, 'delete' => true, 'toggle' => true, 'show_title' => true ); + $args = wp_parse_args( $args, $default_args ); + $args = apply_filters( 'get_media_item_args', $args ); + extract( $args, EXTR_SKIP ); + + $toggle_on = __( 'Show' ); + $toggle_off = __( 'Hide' ); + + $filename = esc_html( basename( $post->guid ) ); + $title = esc_attr( $post->post_title ); + + if ( $_tags = get_the_tags( $attachment_id ) ) { + foreach ( $_tags as $tag ) + $tags[] = $tag->name; + $tags = esc_attr( join( ', ', $tags ) ); + } + + $post_mime_types = get_post_mime_types(); + $keys = array_keys( wp_match_mime_types( array_keys( $post_mime_types ), $post->post_mime_type ) ); + $type = array_shift( $keys ); + $type_html = ""; + + $form_fields = get_attachment_fields_to_edit( $post, $errors ); + + if ( $toggle ) { + $class = empty( $errors ) ? 'startclosed' : 'startopen'; + $toggle_links = " + $toggle_on + $toggle_off"; + } else { + $class = 'form-table'; + $toggle_links = ''; + } + + $display_title = ( !empty( $title ) ) ? $title : $filename; // $title shouldn't ever be empty, but just in case + $display_title = $show_title ? "
" . wp_html_excerpt( $display_title, 60 ) . "
" : ''; + + $gallery = ( ( isset( $_REQUEST['tab'] ) && 'gallery' == $_REQUEST['tab'] ) || ( isset( $redir_tab ) && 'gallery' == $redir_tab ) ); + $order = ''; + + foreach ( $form_fields as $key => $val ) { + if ( 'menu_order' == $key ) { + if ( $gallery ) + $order = ""; + else + $order = ""; + + unset( $form_fields['menu_order'] ); + break; + } + } + + $media_dims = ''; + $meta = wp_get_attachment_metadata( $post->ID ); + if ( is_array( $meta ) && array_key_exists( 'width', $meta ) && array_key_exists( 'height', $meta ) ) + $media_dims .= "{$meta['width']} × {$meta['height']} "; + $media_dims = apply_filters( 'media_meta', $media_dims, $post ); + + $image_edit_button = ''; + if ( gd_edit_image_support( $post->post_mime_type ) ) { + $nonce = wp_create_nonce( "image_editor-$post->ID" ); + $image_edit_button = " "; + } + + $attachment_url = get_permalink( $attachment_id ); + + $item = " + $type_html + $toggle_links + $order + $display_title + + + + + \n"; + + + + $item .= " + + + + \n"; + + $defaults = array( + 'input' => 'text', + 'required' => false, + 'value' => '', + 'extra_rows' => array(), + ); + + if ( $send ) + $send = get_submit_button( __( 'Insert into Post' ), 'button', "send[$attachment_id]", false ); + if ( $delete && current_user_can( 'delete_post', $attachment_id ) ) { + if ( !EMPTY_TRASH_DAYS ) { + $delete = "" . __( 'Delete Permanently' ) . ''; + } elseif ( !MEDIA_TRASH ) { + $delete = "" . __( 'Delete' ) . " + "; + } else { + $delete = "" . __( 'Move to Trash' ) . " + "; + } + } else { + $delete = ''; + } + + $thumbnail = ''; + $calling_post_id = 0; + if ( isset( $_GET['post_id'] ) ) + $calling_post_id = absint( $_GET['post_id'] ); + elseif ( isset( $_POST ) && count( $_POST ) ) // Like for async-upload where $_GET['post_id'] isn't set + $calling_post_id = $post->post_parent; + if ( 'image' == $type && $calling_post_id && current_theme_supports( 'post-thumbnails', get_post_type( $calling_post_id ) ) && get_post_thumbnail_id( $calling_post_id ) != $attachment_id ) { + $ajax_nonce = wp_create_nonce( "set_post_thumbnail-$calling_post_id" ); + $thumbnail = "" . esc_html__( "Use as featured image" ) . ""; + } + + if ( ( $send || $thumbnail || $delete ) && !isset( $form_fields['buttons'] ) ) + $form_fields['buttons'] = array( 'tr' => "\t\t\n" ); + + $hidden_fields = array(); + + foreach ( $form_fields as $id => $field ) { + if ( $id[0] == '_' ) + continue; + + if ( !empty( $field['tr'] ) ) { + $item .= $field['tr']; + continue; + } + + $field = array_merge( $defaults, $field ); + $name = "attachments[$attachment_id][$id]"; + + if ( $field['input'] == 'hidden' ) { + $hidden_fields[$name] = $field['value']; + continue; + } + + $required = $field['required'] ? '*' : ''; + $aria_required = $field['required'] ? " aria-required='true' " : ''; + $class = $id; + $class .= $field['required'] ? ' form-required' : ''; + + $item .= "\t\t\n\t\t\t\n\t\t\t\n\t\t\n"; + + $extra_rows = array(); + + if ( !empty( $field['errors'] ) ) + foreach ( array_unique( (array) $field['errors'] ) as $error ) + $extra_rows['error'][] = $error; + + if ( !empty( $field['extra_rows'] ) ) + foreach ( $field['extra_rows'] as $class => $rows ) + foreach ( (array) $rows as $html ) + $extra_rows[$class][] = $html; + + foreach ( $extra_rows as $class => $rows ) + foreach ( $rows as $html ) + $item .= "\t\t\n"; + } + + if ( !empty( $form_fields['_final'] ) ) + $item .= "\t\t\n"; + $item .= "\t\n"; + $item .= "\t
+

+

$image_edit_button

+
+

" . __('File name:') . " $filename

+

" . __('File type:') . " $post->post_mime_type

+

" . __('Upload date:') . " " . mysql2date( get_option('date_format'), $post->post_date ). '

'; + if ( !empty( $media_dims ) ) + $item .= "

" . __('Dimensions:') . " $media_dims

\n"; + + $item .= "
$send $thumbnail $delete
"; + if ( !empty( $field[ $field['input'] ] ) ) + $item .= $field[ $field['input'] ]; + elseif ( $field['input'] == 'textarea' ) { + if ( user_can_richedit() ) { // textarea_escaped when user_can_richedit() = false + $field['value'] = esc_textarea( $field['value'] ); + } + $item .= "'; + } else { + $item .= ""; + } + if ( !empty( $field['helps'] ) ) + $item .= "

" . join( "

\n

", array_unique( (array) $field['helps'] ) ) . '

'; + $item .= "
$html
{$form_fields['_final']}
\n"; + + foreach ( $hidden_fields as $name => $value ) + $item .= "\t\n"; + + if ( $post->post_parent < 1 && isset( $_REQUEST['post_id'] ) ) { + $parent = (int) $_REQUEST['post_id']; + $parent_name = "attachments[$attachment_id][post_parent]"; + $item .= "\t\n"; + } + + return $item; +} + +/** + * {@internal Missing Short Description}} + * + * @since 2.5.0 + */ +function media_upload_header() { + ?> + +
+ +
+ 1024 && $u < count( $sizes ) - 1; $u++ ) + $upload_size_unit /= 1024; + if ( $u < 0 ) { + $upload_size_unit = 0; + $u = 0; + } else { + $upload_size_unit = (int) $upload_size_unit; + } +?> + +
+ + + +
+
+ + get_error_message(); ?> + +
+' . sprintf( __( 'Sorry, you have filled your storage quota (%s MB).' ), get_space_allowed() ) . '

'; + return; +} + +do_action('pre-upload-ui'); + +if ( $flash ) : + +// Set the post params, which SWFUpload will post back with the file, and pass +// them through a filter. +$post_params = array( + "post_id" => $post_id, + "auth_cookie" => (is_ssl() ? $_COOKIE[SECURE_AUTH_COOKIE] : $_COOKIE[AUTH_COOKIE]), + "logged_in_cookie" => $_COOKIE[LOGGED_IN_COOKIE], + "_wpnonce" => wp_create_nonce('media-form'), + "type" => $type, + "tab" => $tab, + "short" => "1", +); +$post_params = apply_filters( 'swfupload_post_params', $post_params ); +$p = array(); +foreach ( $post_params as $param => $val ) + $p[] = "\t\t'$param' : '$val'"; +$post_params_str = implode( ", \n", $p ); + +// #8545. wmode=transparent cannot be used with SWFUpload +if ( 'media-new.php' == $pagenow ) { + $upload_image_path = get_user_option( 'admin_color' ); + if ( 'classic' != $upload_image_path ) + $upload_image_path = 'fresh'; + $upload_image_path = admin_url( 'images/upload-' . $upload_image_path . '.png?ver=20101205' ); +} else { + $upload_image_path = includes_url( 'images/upload.png?ver=20100531' ); +} + +?> + + +
+ + +
+ +
+ +
+

+ +

+
+ + +
> + +

+ + + + +

+
+

+ +

+ + +
+ + + +
+ + + + +

+ + + + +
+'.esc_html($id->get_error_message()).'
'; + exit; + } +} +?> +
+

+ +

+ + + +
+ + + + + +

+ + + +
+
+ +
+
+
+ + + +
+ + + + + + + | + | + +
+ + + +
+ + + + + + + + + +
+ + add_query_arg( 'paged', '%#%' ), + 'format' => '', + 'prev_text' => __('«'), + 'next_text' => __('»'), + 'total' => ceil($wp_query->found_posts / 10), + 'current' => $_GET['paged'] +)); + +if ( $page_links ) + echo "
$page_links
"; +?> + +
+posts WHERE post_type = 'attachment' ORDER BY post_date DESC"; + +$arc_result = $wpdb->get_results( $arc_query ); + +$month_count = count($arc_result); + +if ( $month_count && !( 1 == $month_count && 0 == $arc_result[0]->mmonth ) ) { ?> + + + + + +
+ +
+
+
+ +
+ + + + + + +
+ + +
+

+ + +

+
+ + + + + + +'; + } else { + $caption = ''; + } + + $default_align = get_option('image_default_align'); + if ( empty($default_align) ) + $default_align = 'none'; + + return ' +

' . __('Insert an image from another web site') . '

+ + + + + + + + + + + + + + + + ' . $caption . ' + + + + + + + + + + ' . _insert_into_post_button('image') . ' +
+ + * +
+ + * +
+ + +

' . __('Alt text for the image, e.g. “The Mona Lisa”') . '

+ + + + + + + + +
+ +
+ + + +

' . __('Enter a link URL or click above for presets.') . '

+'; + +} + +/** + * {@internal Missing Short Description}} + * + * @since 2.7.0 + * + * @return unknown + */ +function type_url_form_audio() { + return ' + + + + + + + + + + + ' . _insert_into_post_button('audio') . ' +
+ + * +
+ + * +
' . __('Link text, e.g. “Still Alive by Jonathan Coulton”') . '
+'; +} + +/** + * {@internal Missing Short Description}} + * + * @since 2.7.0 + * + * @return unknown + */ +function type_url_form_video() { + return ' + + + + + + + + + + + ' . _insert_into_post_button('video') . ' +
+ + * +
+ + * +
' . __('Link text, e.g. “Lucy on YouTube”') . '
+'; +} + +/** + * {@internal Missing Short Description}} + * + * @since 2.7.0 + * + * @return unknown + */ +function type_url_form_file() { + return ' + + + + + + + + + + + ' . _insert_into_post_button('file') . ' +
+ + * +
+ + * +
' . __('Link text, e.g. “Ransom Demands (PDF)”') . '
+'; +} + + +function _insert_into_post_button($type) { + if ( !post_type_supports(get_post_type($_GET['post_id']), 'editor') ) + return ''; + + if ( 'image' == $type ) + return ' + + + + + + + '; + + return ' + + + + ' . get_submit_button( __( 'Insert into Post' ), 'button', 'insertonlybutton', false ) . ' + + + '; +} + +/** + * {@internal Missing Short Description}} + * + * Support a GET parameter for disabling the flash uploader. + * + * @since 2.6.0 + * + * @param unknown_type $flash + * @return unknown + */ +function media_upload_use_flash($flash) { + if ( array_key_exists('flash', $_REQUEST) ) + $flash = !empty($_REQUEST['flash']); + return $flash; +} + +add_filter('flash_uploader', 'media_upload_use_flash'); + +/** + * {@internal Missing Short Description}} + * + * @since 2.6.0 + */ +function media_upload_flash_bypass() { + echo '

'; + printf( __('You are using the Flash uploader. Problems? Try the Browser uploader instead.'), esc_url(add_query_arg('flash', 0)) ); + echo '

'; +} + +/** + * {@internal Missing Short Description}} + * + * @since 2.6.0 + */ +function media_upload_html_bypass($flash = true) { + echo '

'; + _e('You are using the Browser uploader.'); + if ( $flash ) { + // the user manually selected the browser uploader, so let them switch back to Flash + echo ' '; + printf( __('Try the Flash uploader instead.'), esc_url(add_query_arg('flash', 1)) ); + } + echo "

\n"; +} + +add_action('post-flash-upload-ui', 'media_upload_flash_bypass'); +add_action('post-html-upload-ui', 'media_upload_html_bypass'); + +/** + * {@internal Missing Short Description}} + * + * Make sure the GET parameter sticks when we submit a form. + * + * @since 2.6.0 + * + * @param unknown_type $url + * @return unknown + */ +function media_upload_bypass_url($url) { + if ( array_key_exists('flash', $_REQUEST) ) + $url = add_query_arg('flash', intval($_REQUEST['flash'])); + return $url; +} + +add_filter('media_upload_form_url', 'media_upload_bypass_url'); + +add_filter('async_upload_image', 'get_media_item', 10, 2); +add_filter('async_upload_audio', 'get_media_item', 10, 2); +add_filter('async_upload_video', 'get_media_item', 10, 2); +add_filter('async_upload_file', 'get_media_item', 10, 2); + +add_action('media_upload_image', 'media_upload_image'); +add_action('media_upload_audio', 'media_upload_audio'); +add_action('media_upload_video', 'media_upload_video'); +add_action('media_upload_file', 'media_upload_file'); + +add_filter('media_upload_gallery', 'media_upload_gallery'); + +add_filter('media_upload_library', 'media_upload_library'); diff --git a/src/wp-admin/includes/menu.php b/src/wp-admin/includes/menu.php new file mode 100644 index 0000000..fa85e4b --- /dev/null +++ b/src/wp-admin/includes/menu.php @@ -0,0 +1,230 @@ + $sub) { + foreach ($sub as $index => $data) { + if ( ! current_user_can($data[1]) ) { + unset(${$sub_loop}[$parent][$index]); + $_wp_submenu_nopriv[$parent][$data[2]] = true; + } + } + unset($index, $data); + + if ( empty(${$sub_loop}[$parent]) ) + unset(${$sub_loop}[$parent]); + } + unset($sub, $parent); +} +unset($sub_loop); + +// Loop over the top-level menu. +// Menus for which the original parent is not accessible due to lack of privs will have the next +// submenu in line be assigned as the new menu parent. +foreach ( $menu as $id => $data ) { + if ( empty($submenu[$data[2]]) ) + continue; + $subs = $submenu[$data[2]]; + $first_sub = array_shift($subs); + $old_parent = $data[2]; + $new_parent = $first_sub[2]; + // If the first submenu is not the same as the assigned parent, + // make the first submenu the new parent. + if ( $new_parent != $old_parent ) { + $_wp_real_parent_file[$old_parent] = $new_parent; + $menu[$id][2] = $new_parent; + + foreach ($submenu[$old_parent] as $index => $data) { + $submenu[$new_parent][$index] = $submenu[$old_parent][$index]; + unset($submenu[$old_parent][$index]); + } + unset($submenu[$old_parent], $index); + + if ( isset($_wp_submenu_nopriv[$old_parent]) ) + $_wp_submenu_nopriv[$new_parent] = $_wp_submenu_nopriv[$old_parent]; + } +} +unset($id, $data, $subs, $first_sub, $old_parent, $new_parent); + +if ( is_network_admin() ) + do_action('network_admin_menu', ''); +elseif ( is_user_admin() ) + do_action('user_admin_menu', ''); +else + do_action('admin_menu', ''); + +// Remove menus that have no accessible submenus and require privs that the user does not have. +// Run re-parent loop again. +foreach ( $menu as $id => $data ) { + if ( ! current_user_can($data[1]) ) + $_wp_menu_nopriv[$data[2]] = true; + + // If there is only one submenu and it is has same destination as the parent, + // remove the submenu. + if ( ! empty( $submenu[$data[2]] ) && 1 == count ( $submenu[$data[2]] ) ) { + $subs = $submenu[$data[2]]; + $first_sub = array_shift($subs); + if ( $data[2] == $first_sub[2] ) + unset( $submenu[$data[2]] ); + } + + // If submenu is empty... + if ( empty($submenu[$data[2]]) ) { + // And user doesn't have privs, remove menu. + if ( isset( $_wp_menu_nopriv[$data[2]] ) ) { + unset($menu[$id]); + } + } +} +unset($id, $data, $subs, $first_sub); + +// Remove any duplicated separators +$separator_found = false; +foreach ( $menu as $id => $data ) { + if ( 0 == strcmp('wp-menu-separator', $data[4] ) ) { + if (false == $separator_found) { + $separator_found = true; + } else { + unset($menu[$id]); + $separator_found = false; + } + } else { + $separator_found = false; + } +} +unset($id, $data); + +function add_cssclass($add, $class) { + $class = empty($class) ? $add : $class .= ' ' . $add; + return $class; +} + +function add_menu_classes($menu) { + + $first = $lastorder = false; + $i = 0; + $mc = count($menu); + foreach ( $menu as $order => $top ) { + $i++; + + if ( 0 == $order ) { // dashboard is always shown/single + $menu[0][4] = add_cssclass('menu-top-first', $top[4]); + $lastorder = 0; + continue; + } + + if ( 0 === strpos($top[2], 'separator') ) { // if separator + $first = true; + $c = $menu[$lastorder][4]; + $menu[$lastorder][4] = add_cssclass('menu-top-last', $c); + continue; + } + + if ( $first ) { + $c = $menu[$order][4]; + $menu[$order][4] = add_cssclass('menu-top-first', $c); + $first = false; + } + + if ( $mc == $i ) { // last item + $c = $menu[$order][4]; + $menu[$order][4] = add_cssclass('menu-top-last', $c); + } + + $lastorder = $order; + } + + return apply_filters( 'add_menu_classes', $menu ); +} + +uksort($menu, "strnatcasecmp"); // make it all pretty + +if ( apply_filters('custom_menu_order', false) ) { + $menu_order = array(); + foreach ( $menu as $menu_item ) { + $menu_order[] = $menu_item[2]; + } + unset($menu_item); + $default_menu_order = $menu_order; + $menu_order = apply_filters('menu_order', $menu_order); + $menu_order = array_flip($menu_order); + $default_menu_order = array_flip($default_menu_order); + + function sort_menu($a, $b) { + global $menu_order, $default_menu_order; + $a = $a[2]; + $b = $b[2]; + if ( isset($menu_order[$a]) && !isset($menu_order[$b]) ) { + return -1; + } elseif ( !isset($menu_order[$a]) && isset($menu_order[$b]) ) { + return 1; + } elseif ( isset($menu_order[$a]) && isset($menu_order[$b]) ) { + if ( $menu_order[$a] == $menu_order[$b] ) + return 0; + return ($menu_order[$a] < $menu_order[$b]) ? -1 : 1; + } else { + return ($default_menu_order[$a] <= $default_menu_order[$b]) ? -1 : 1; + } + } + + usort($menu, 'sort_menu'); + unset($menu_order, $default_menu_order); +} + +// Remove the last menu item if it is a separator. +$last_menu_key = array_pop( array_keys( $menu ) ); +if ( 'wp-menu-separator' == $menu[ $last_menu_key ][ 4 ] ) + unset( $menu[ $last_menu_key ] ); +unset( $last_menu_key ); + +if ( !user_can_access_admin_page() ) { + do_action('admin_page_access_denied'); + wp_die( __('You do not have sufficient permissions to access this page.') ); +} + +$menu = add_menu_classes($menu); + +?> \ No newline at end of file diff --git a/src/wp-admin/includes/meta-boxes.php b/src/wp-admin/includes/meta-boxes.php new file mode 100644 index 0000000..6d396ad --- /dev/null +++ b/src/wp-admin/includes/meta-boxes.php @@ -0,0 +1,914 @@ +post_type; + $post_type_object = get_post_type_object($post_type); + $can_publish = current_user_can($post_type_object->cap->publish_posts); +?> +
+ +
+ + +
+ +
+ +
+
+post_status && 'future' != $post->post_status && 'pending' != $post->post_status ) { ?> +post_status ) { ?>style="display:none" type="submit" name="save" id="save-post" value="" tabindex="4" class="button button-highlighted" /> +post_status && $can_publish ) { ?> + + + +
+ +
+post_status ) { + $preview_link = esc_url( get_permalink( $post->ID ) ); + $preview_button = __( 'Preview Changes' ); +} else { + $preview_link = get_permalink( $post->ID ); + if ( is_ssl() ) + $preview_link = str_replace( 'http://', 'https://', $preview_link ); + $preview_link = esc_url( apply_filters( 'preview_post_link', add_query_arg( 'preview', 'true', $preview_link ) ) ); + $preview_button = __( 'Preview' ); +} +?> + + +
+ +
+
+ +
+ +
+ +post_status ) { + case 'private': + _e('Privately Published'); + break; + case 'publish': + _e('Published'); + break; + case 'future': + _e('Scheduled'); + break; + case 'pending': + _e('Pending Review'); + break; + case 'draft': + case 'auto-draft': + _e('Draft'); + break; +} +?> + +post_status || 'private' == $post->post_status || $can_publish ) { ?> +post_status ) { ?>style="display:none;" class="edit-post-status hide-if-no-js" tabindex='4'> + +
+ + + + +
+ + +
+ +
+ post_status ) { + $post->post_password = ''; + $visibility = 'private'; + $visibility_trans = __('Private'); +} elseif ( !empty( $post->post_password ) ) { + $visibility = 'password'; + $visibility_trans = __('Password protected'); +} elseif ( $post_type == 'post' && is_sticky( $post->ID ) ) { + $visibility = 'public'; + $visibility_trans = __('Public, Sticky'); +} else { + $visibility = 'public'; + $visibility_trans = __('Public'); +} + +echo esc_html( $visibility_trans ); ?> + + + +
+ + +ID)); ?> /> + + + + + />
+ +ID ) ); ?> tabindex="4" />
+ + />
+
+ />
+ +

+ + +

+
+ + +
+ +ID ) { + if ( 'future' == $post->post_status ) { // scheduled for publishing at a future date + $stamp = __('Scheduled for: %1$s'); + } else if ( 'publish' == $post->post_status || 'private' == $post->post_status ) { // already published + $stamp = __('Published on: %1$s'); + } else if ( '0000-00-00 00:00:00' == $post->post_date_gmt ) { // draft, 1 or more saves, no date specified + $stamp = __('Publish immediately'); + } else if ( time() < strtotime( $post->post_date_gmt . ' +0000' ) ) { // draft, 1 or more saves, future date specified + $stamp = __('Schedule for: %1$s'); + } else { // draft, 1 or more saves, date specified + $stamp = __('Publish on: %1$s'); + } + $date = date_i18n( $datef, strtotime( $post->post_date ) ); +} else { // draft (no saves, and thus no date specified) + $stamp = __('Publish immediately'); + $date = date_i18n( $datef, strtotime( current_time('mysql') ) ); +} + +if ( $can_publish ) : // Contributors don't get to choose the date of publish ?> +
+ + + +
+
+ + + +
+
+
+ +
+ +
+ID ) ) { + if ( !EMPTY_TRASH_DAYS ) + $delete_text = __('Delete Permanently'); + else + $delete_text = __('Move to Trash'); + ?> + +
+ +
+ +post_status, array('publish', 'future', 'private') ) || 0 == $post->ID ) { + if ( $can_publish ) : + if ( !empty($post->post_date_gmt) && time() < strtotime( $post->post_date_gmt . ' +0000' ) ) : ?> + + '5', 'accesskey' => 'p' ) ); ?> + + + '5', 'accesskey' => 'p' ) ); ?> + + + '5', 'accesskey' => 'p' ) ); ?> + + + + +
+
+
+
+ +post_type, 'post-formats' ) ) : + $post_formats = get_theme_support( 'post-formats' ); + + if ( is_array( $post_formats[0] ) ) : + $post_format = get_post_format( $post->ID ); + if ( !$post_format ) + $post_format = '0'; + // Add in the current one if it isn't there yet, in case the current theme doesn't support it + if ( $post_format && !in_array( $post_format, $post_formats[0] ) ) + $post_formats[0][] = $post_format; + ?> +
+ /> + +
/> +
+
+ 'post_tag'); + if ( !isset($box['args']) || !is_array($box['args']) ) + $args = array(); + else + $args = $box['args']; + extract( wp_parse_args($args, $defaults), EXTR_SKIP ); + $tax_name = esc_attr($taxonomy); + $taxonomy = get_taxonomy($taxonomy); + $disabled = !current_user_can($taxonomy->cap->assign_terms) ? 'disabled="disabled"' : ''; +?> +
+
+
+

labels->add_or_remove_items; ?>

+
+ cap->assign_terms) ) : ?> +
+ +
labels->add_new_item; ?>
+

+

+
+

labels->separate_items_with_commas ); ?>

+ +
+
+
+cap->assign_terms) ) : ?> +

labels->choose_from_most_used; ?>

+ + 'category'); + if ( !isset($box['args']) || !is_array($box['args']) ) + $args = array(); + else + $args = $box['args']; + extract( wp_parse_args($args, $defaults), EXTR_SKIP ); + $tax = get_taxonomy($taxonomy); + + ?> +
+ + + + +
+ "; // Allows for an empty term set to be sent. 0 is an invalid Term ID and will be ignored by empty() checks. + ?> + +
+ cap->edit_terms) ) : ?> +
+

+ + labels->add_new_item ); + ?> + +

+

+ + + + $taxonomy, 'hide_empty' => 0, 'name' => 'new'.$taxonomy.'_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => '— ' . $tax->labels->parent_item . ' —', 'tab_index' => 3 ) ); ?> + + + +

+
+ +
+ + +

Learn more about manual excerpts.'); ?>

+to_ping) ) .'" />'; + if ('' != $post->pinged) { + $pings = '

'. __('Already pinged:') . '

'; + } + +?> +


()

+

pingbacks, no other action necessary.'); ?>

+ +
+
+ID); +list_meta($metadata); +meta_form(); ?> +
+

use in your theme.'); ?>

+ + +

+
+ + +

+get_var($wpdb->prepare("SELECT count(1) FROM $wpdb->comments WHERE comment_post_ID = '%d' AND ( comment_approved = '0' OR comment_approved = '1')", $post_ID)); + + if ( 1 > $total ) { + echo '

' . __('No comments yet.') . '

'; + return; + } + + wp_nonce_field( 'get-comments', 'add_comment_nonce', false ); + + $wp_list_table = _get_list_table('WP_Post_Comments_List_Table'); + $wp_list_table->display( true ); +?> +

+ + + + + + + 'authors', + 'name' => 'post_author_override', + 'selected' => empty($post->ID) ? $user_ID : $post->post_author, + 'include_selected' => true + ) ); +} + + +/** + * Display list of revisions. + * + * @since 2.6.0 + * + * @param object $post + */ +function post_revisions_meta_box($post) { + wp_list_post_revisions(); +} + + +// -- Page related Meta Boxes + +/** + * Display page attributes form fields. + * + * @since 2.7.0 + * + * @param object $post + */ +function page_attributes_meta_box($post) { + $post_type_object = get_post_type_object($post->post_type); + if ( $post_type_object->hierarchical ) { + $pages = wp_dropdown_pages(array('post_type' => $post->post_type, 'exclude_tree' => $post->ID, 'selected' => $post->post_parent, 'name' => 'parent_id', 'show_option_none' => __('(no parent)'), 'sort_column'=> 'menu_order, post_title', 'echo' => 0)); + if ( ! empty($pages) ) { +?> +

+ + +post_type && 0 != count( get_page_templates() ) ) { + $template = !empty($post->page_template) ? $post->page_template : false; + ?> +

+ + +

+

+

post_type ) _e( 'Need help? Use the Help tab in the upper right of your screen.' ); ?>

+ + + + + +
+ +
+ + + +
+

+ +
+ +
+

+

+

+
+

+link_rel ) ? $link->link_rel : ''; // In PHP 5.3: $link_rel = $link->link_rel ?: ''; + $rels = preg_split('/\s+/', $link_rel); + + if ('' != $value && in_array($value, $rels) ) { + echo ' checked="checked"'; + } + + if ('' == $value) { + if ('family' == $class && strpos($link_rel, 'child') === false && strpos($link_rel, 'parent') === false && strpos($link_rel, 'sibling') === false && strpos($link_rel, 'spouse') === false && strpos($link_rel, 'kin') === false) echo ' checked="checked"'; + if ('friendship' == $class && strpos($link_rel, 'friend') === false && strpos($link_rel, 'acquaintance') === false && strpos($link_rel, 'contact') === false) echo ' checked="checked"'; + if ('geographical' == $class && strpos($link_rel, 'co-resident') === false && strpos($link_rel, 'neighbor') === false) echo ' checked="checked"'; + if ('identity' == $class && in_array('me', $rels) ) echo ' checked="checked"'; + } +} + + +/** + * Display xfn form fields. + * + * @since 2.6.0 + * + * @param object $link + */ +function link_xfn_meta_box($link) { +?> + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + +
+ +
+ + +
+ + + +
+ + + + + + +
+ + + + +
+
+

XFN.'); ?>

+ + + + + + + + + + + + + + + + + + +
  +
+ID, '_thumbnail_id', true ); + echo _wp_post_thumbnail_html( $thumbnail_id ); +} diff --git a/src/wp-admin/includes/misc.php b/src/wp-admin/includes/misc.php new file mode 100644 index 0000000..a0db0ad --- /dev/null +++ b/src/wp-admin/includes/misc.php @@ -0,0 +1,588 @@ + $markerline ) { + if (strpos($markerline, '# BEGIN ' . $marker) !== false) + $state = false; + if ( $state ) { + if ( $n + 1 < count( $markerdata ) ) + fwrite( $f, "{$markerline}\n" ); + else + fwrite( $f, "{$markerline}" ); + } + if (strpos($markerline, '# END ' . $marker) !== false) { + fwrite( $f, "# BEGIN {$marker}\n" ); + if ( is_array( $insertion )) + foreach ( $insertion as $insertline ) + fwrite( $f, "{$insertline}\n" ); + fwrite( $f, "# END {$marker}\n" ); + $state = true; + $foundit = true; + } + } + } + if (!$foundit) { + fwrite( $f, "\n# BEGIN {$marker}\n" ); + foreach ( $insertion as $insertline ) + fwrite( $f, "{$insertline}\n" ); + fwrite( $f, "# END {$marker}\n" ); + } + fclose( $f ); + return true; + } else { + return false; + } +} + +/** + * Updates the htaccess file with the current rules if it is writable. + * + * Always writes to the file if it exists and is writable to ensure that we + * blank out old rules. + * + * @since 1.5.0 + */ +function save_mod_rewrite_rules() { + if ( is_multisite() ) + return; + + global $wp_rewrite; + + $home_path = get_home_path(); + $htaccess_file = $home_path.'.htaccess'; + + // If the file doesn't already exist check for write access to the directory and whether we have some rules. + // else check for write access to the file. + if ((!file_exists($htaccess_file) && is_writable($home_path) && $wp_rewrite->using_mod_rewrite_permalinks()) || is_writable($htaccess_file)) { + if ( got_mod_rewrite() ) { + $rules = explode( "\n", $wp_rewrite->mod_rewrite_rules() ); + return insert_with_markers( $htaccess_file, 'WordPress', $rules ); + } + } + + return false; +} + +/** + * Updates the IIS web.config file with the current rules if it is writable. + * If the permalinks do not require rewrite rules then the rules are deleted from the web.config file. + * + * @since 2.8.0 + * + * @return bool True if web.config was updated successfully + */ +function iis7_save_url_rewrite_rules(){ + if ( is_multisite() ) + return; + + global $wp_rewrite; + + $home_path = get_home_path(); + $web_config_file = $home_path . 'web.config'; + + // Using win_is_writable() instead of is_writable() because of a bug in Windows PHP + if ( iis7_supports_permalinks() && ( ( ! file_exists($web_config_file) && win_is_writable($home_path) && $wp_rewrite->using_mod_rewrite_permalinks() ) || win_is_writable($web_config_file) ) ) { + $rule = $wp_rewrite->iis7_url_rewrite_rules(false, '', ''); + if ( ! empty($rule) ) { + return iis7_add_rewrite_rule($web_config_file, $rule); + } else { + return iis7_delete_rewrite_rule($web_config_file); + } + } + return false; +} + +/** + * {@internal Missing Short Description}} + * + * @since 1.5.0 + * + * @param unknown_type $file + */ +function update_recently_edited( $file ) { + $oldfiles = (array ) get_option( 'recently_edited' ); + if ( $oldfiles ) { + $oldfiles = array_reverse( $oldfiles ); + $oldfiles[] = $file; + $oldfiles = array_reverse( $oldfiles ); + $oldfiles = array_unique( $oldfiles ); + if ( 5 < count( $oldfiles )) + array_pop( $oldfiles ); + } else { + $oldfiles[] = $file; + } + update_option( 'recently_edited', $oldfiles ); +} + +/** + * If siteurl or home changed, flush rewrite rules. + * + * @since 2.1.0 + * + * @param unknown_type $old_value + * @param unknown_type $value + */ +function update_home_siteurl( $old_value, $value ) { + global $wp_rewrite; + + if ( defined( "WP_INSTALLING" ) ) + return; + + // If home changed, write rewrite rules to new location. + $wp_rewrite->flush_rules(); +} + +add_action( 'update_option_home', 'update_home_siteurl', 10, 2 ); +add_action( 'update_option_siteurl', 'update_home_siteurl', 10, 2 ); + +/** + * Shorten an URL, to be used as link text + * + * @since 1.2.1 + * + * @param string $url + * @return string + */ +function url_shorten( $url ) { + $short_url = str_replace( 'http://', '', stripslashes( $url )); + $short_url = str_replace( 'www.', '', $short_url ); + if ('/' == substr( $short_url, -1 )) + $short_url = substr( $short_url, 0, -1 ); + if ( strlen( $short_url ) > 35 ) + $short_url = substr( $short_url, 0, 32 ).'...'; + return $short_url; +} + +/** + * Resets global variables based on $_GET and $_POST + * + * This function resets global variables based on the names passed + * in the $vars array to the value of $_POST[$var] or $_GET[$var] or '' + * if neither is defined. + * + * @since 2.0.0 + * + * @param array $vars An array of globals to reset. + */ +function wp_reset_vars( $vars ) { + for ( $i=0; $iget_error_data() ) + $message = $message->get_error_message() . ': ' . $message->get_error_data(); + else + $message = $message->get_error_message(); + } + echo "

$message

\n"; + wp_ob_end_flush_all(); + flush(); +} + +function wp_doc_link_parse( $content ) { + if ( !is_string( $content ) || empty( $content ) ) + return array(); + + if ( !function_exists('token_get_all') ) + return array(); + + $tokens = token_get_all( $content ); + $functions = array(); + $ignore_functions = array(); + for ( $t = 0, $count = count( $tokens ); $t < $count; $t++ ) { + if ( !is_array( $tokens[$t] ) ) continue; + if ( T_STRING == $tokens[$t][0] && ( '(' == $tokens[ $t + 1 ] || '(' == $tokens[ $t + 2 ] ) ) { + // If it's a function or class defined locally, there's not going to be any docs available + if ( ( isset( $tokens[ $t - 2 ][1] ) && in_array( $tokens[ $t - 2 ][1], array( 'function', 'class' ) ) ) || ( isset( $tokens[ $t - 2 ][0] ) && T_OBJECT_OPERATOR == $tokens[ $t - 1 ][0] ) ) { + $ignore_functions[] = $tokens[$t][1]; + } + // Add this to our stack of unique references + $functions[] = $tokens[$t][1]; + } + } + + $functions = array_unique( $functions ); + sort( $functions ); + $ignore_functions = apply_filters( 'documentation_ignore_functions', $ignore_functions ); + $ignore_functions = array_unique( $ignore_functions ); + + $out = array(); + foreach ( $functions as $function ) { + if ( in_array( $function, $ignore_functions ) ) + continue; + $out[] = $function; + } + + return $out; +} + +/** + * Saves option for number of rows when listing posts, pages, comments, etc. + * + * @since 2.8 +**/ +function set_screen_options() { + + if ( isset($_POST['wp_screen_options']) && is_array($_POST['wp_screen_options']) ) { + check_admin_referer( 'screen-options-nonce', 'screenoptionnonce' ); + + if ( !$user = wp_get_current_user() ) + return; + $option = $_POST['wp_screen_options']['option']; + $value = $_POST['wp_screen_options']['value']; + + if ( !preg_match( '/^[a-z_-]+$/', $option ) ) + return; + + $option = str_replace('-', '_', $option); + + $map_option = $option; + $type = str_replace('edit_', '', $map_option); + $type = str_replace('_per_page', '', $type); + if ( in_array($type, get_post_types()) ) + $map_option = 'edit_per_page'; + if ( in_array( $type, get_taxonomies()) ) + $map_option = 'edit_tags_per_page'; + + + switch ( $map_option ) { + case 'edit_per_page': + case 'users_per_page': + case 'edit_comments_per_page': + case 'upload_per_page': + case 'edit_tags_per_page': + case 'plugins_per_page': + // Network admin + case 'sites_network_per_page': + case 'users_network_per_page': + case 'site_users_network_per_page': + case 'plugins_network_per_page': + case 'themes_network_per_page': + case 'site_themes_network_per_page': + $value = (int) $value; + if ( $value < 1 || $value > 999 ) + return; + break; + default: + $value = apply_filters('set-screen-option', false, $option, $value); + if ( false === $value ) + return; + break; + } + + update_user_meta($user->ID, $option, $value); + wp_redirect( remove_query_arg( array('pagenum', 'apage', 'paged'), wp_get_referer() ) ); + exit; + } +} + +/** + * Check if rewrite rule for WordPress already exists in the IIS 7 configuration file + * + * @since 2.8.0 + * + * @return bool + * @param string $filename The file path to the configuration file + */ +function iis7_rewrite_rule_exists($filename) { + if ( ! file_exists($filename) ) + return false; + if ( ! class_exists('DOMDocument') ) + return false; + + $doc = new DOMDocument(); + if ( $doc->load($filename) === false ) + return false; + $xpath = new DOMXPath($doc); + $rules = $xpath->query('/configuration/system.webServer/rewrite/rules/rule[starts-with(@name,\'wordpress\')]'); + if ( $rules->length == 0 ) + return false; + else + return true; +} + +/** + * Delete WordPress rewrite rule from web.config file if it exists there + * + * @since 2.8.0 + * + * @param string $filename Name of the configuration file + * @return bool + */ +function iis7_delete_rewrite_rule($filename) { + // If configuration file does not exist then rules also do not exist so there is nothing to delete + if ( ! file_exists($filename) ) + return true; + + if ( ! class_exists('DOMDocument') ) + return false; + + $doc = new DOMDocument(); + $doc->preserveWhiteSpace = false; + + if ( $doc -> load($filename) === false ) + return false; + $xpath = new DOMXPath($doc); + $rules = $xpath->query('/configuration/system.webServer/rewrite/rules/rule[starts-with(@name,\'wordpress\')]'); + if ( $rules->length > 0 ) { + $child = $rules->item(0); + $parent = $child->parentNode; + $parent->removeChild($child); + $doc->formatOutput = true; + saveDomDocument($doc, $filename); + } + return true; +} + +/** + * Add WordPress rewrite rule to the IIS 7 configuration file. + * + * @since 2.8.0 + * + * @param string $filename The file path to the configuration file + * @param string $rewrite_rule The XML fragment with URL Rewrite rule + * @return bool + */ +function iis7_add_rewrite_rule($filename, $rewrite_rule) { + if ( ! class_exists('DOMDocument') ) + return false; + + // If configuration file does not exist then we create one. + if ( ! file_exists($filename) ) { + $fp = fopen( $filename, 'w'); + fwrite($fp, ''); + fclose($fp); + } + + $doc = new DOMDocument(); + $doc->preserveWhiteSpace = false; + + if ( $doc->load($filename) === false ) + return false; + + $xpath = new DOMXPath($doc); + + // First check if the rule already exists as in that case there is no need to re-add it + $wordpress_rules = $xpath->query('/configuration/system.webServer/rewrite/rules/rule[starts-with(@name,\'wordpress\')]'); + if ( $wordpress_rules->length > 0 ) + return true; + + // Check the XPath to the rewrite rule and create XML nodes if they do not exist + $xmlnodes = $xpath->query('/configuration/system.webServer/rewrite/rules'); + if ( $xmlnodes->length > 0 ) { + $rules_node = $xmlnodes->item(0); + } else { + $rules_node = $doc->createElement('rules'); + + $xmlnodes = $xpath->query('/configuration/system.webServer/rewrite'); + if ( $xmlnodes->length > 0 ) { + $rewrite_node = $xmlnodes->item(0); + $rewrite_node->appendChild($rules_node); + } else { + $rewrite_node = $doc->createElement('rewrite'); + $rewrite_node->appendChild($rules_node); + + $xmlnodes = $xpath->query('/configuration/system.webServer'); + if ( $xmlnodes->length > 0 ) { + $system_webServer_node = $xmlnodes->item(0); + $system_webServer_node->appendChild($rewrite_node); + } else { + $system_webServer_node = $doc->createElement('system.webServer'); + $system_webServer_node->appendChild($rewrite_node); + + $xmlnodes = $xpath->query('/configuration'); + if ( $xmlnodes->length > 0 ) { + $config_node = $xmlnodes->item(0); + $config_node->appendChild($system_webServer_node); + } else { + $config_node = $doc->createElement('configuration'); + $doc->appendChild($config_node); + $config_node->appendChild($system_webServer_node); + } + } + } + } + + $rule_fragment = $doc->createDocumentFragment(); + $rule_fragment->appendXML($rewrite_rule); + $rules_node->appendChild($rule_fragment); + + $doc->encoding = "UTF-8"; + $doc->formatOutput = true; + saveDomDocument($doc, $filename); + + return true; +} + +/** + * Saves the XML document into a file + * + * @since 2.8.0 + * + * @param DOMDocument $doc + * @param string $filename + */ +function saveDomDocument($doc, $filename) { + $config = $doc->saveXML(); + $config = preg_replace("/([^\r])\n/", "$1\r\n", $config); + $fp = fopen($filename, 'w'); + fwrite($fp, $config); + fclose($fp); +} + +/** + * Workaround for Windows bug in is_writable() function + * + * @since 2.8.0 + * + * @param string $path + * @return bool + */ +function win_is_writable( $path ) { + /* will work in despite of Windows ACLs bug + * NOTE: use a trailing slash for folders!!! + * see http://bugs.php.net/bug.php?id=27609 + * see http://bugs.php.net/bug.php?id=30931 + */ + + if ( $path[strlen( $path ) - 1] == '/' ) // recursively return a temporary file path + return win_is_writable( $path . uniqid( mt_rand() ) . '.tmp'); + else if ( is_dir( $path ) ) + return win_is_writable( $path . '/' . uniqid( mt_rand() ) . '.tmp' ); + // check tmp file for read/write capabilities + $should_delete_tmp_file = !file_exists( $path ); + $f = @fopen( $path, 'a' ); + if ( $f === false ) + return false; + fclose( $f ); + if ( $should_delete_tmp_file ) + unlink( $path ); + return true; +} + +/** + * Display the default admin color scheme picker (Used in user-edit.php) + * + * @since 3.0.0 + */ +function admin_color_scheme_picker() { + global $_wp_admin_css_colors, $user_id; ?> +
+ $color_info ): ?> +
/> + + + colors as $html_color ): ?> + + + +
 
+ + +
+ +
+ diff --git a/src/wp-admin/includes/ms-deprecated.php b/src/wp-admin/includes/ms-deprecated.php new file mode 100644 index 0000000..e7b017b --- /dev/null +++ b/src/wp-admin/includes/ms-deprecated.php @@ -0,0 +1,68 @@ + \ No newline at end of file diff --git a/src/wp-admin/includes/ms.php b/src/wp-admin/includes/ms.php new file mode 100644 index 0000000..98991ef --- /dev/null +++ b/src/wp-admin/includes/ms.php @@ -0,0 +1,778 @@ + ( 1024 * get_site_option( 'fileupload_maxk', 1500 ) ) ) + $file['error'] = sprintf(__('This file is too big. Files must be less than %1$s KB in size.'), get_site_option( 'fileupload_maxk', 1500 ) ); + if ( upload_is_user_over_quota( false ) ) { + $file['error'] = __( 'You have used your space quota. Please delete files before uploading.' ); + } + if ( $file['error'] != '0' && !isset($_POST['html-upload']) ) + wp_die( $file['error'] . ' ' . __( 'Back' ) . '' ); + + return $file; +} +add_filter( 'wp_handle_upload_prefilter', 'check_upload_size' ); + +/** + * Delete a blog + * + * @since 3.0.0 + * + * @param int $blog_id Blog ID + * @param bool $drop True if blog's table should be dropped. Default is false. + * @return void + */ +function wpmu_delete_blog( $blog_id, $drop = false ) { + global $wpdb; + + $switch = false; + if ( $blog_id != $wpdb->blogid ) { + $switch = true; + switch_to_blog( $blog_id ); + } + + $blog_prefix = $wpdb->get_blog_prefix( $blog_id ); + + do_action( 'delete_blog', $blog_id, $drop ); + + $users = get_users( array( 'blog_id' => $blog_id, 'fields' => 'ids' ) ); + + // Remove users from this blog. + if ( ! empty( $users ) ) { + foreach ( $users as $user_id ) { + remove_user_from_blog( $user_id, $blog_id) ; + } + } + + update_blog_status( $blog_id, 'deleted', 1 ); + + if ( $drop ) { + if ( substr( $blog_prefix, -1 ) == '_' ) + $blog_prefix = substr( $blog_prefix, 0, -1 ) . '\_'; + + $drop_tables = $wpdb->get_results( "SHOW TABLES LIKE '{$blog_prefix}%'", ARRAY_A ); + $drop_tables = apply_filters( 'wpmu_drop_tables', $drop_tables ); + + reset( $drop_tables ); + foreach ( (array) $drop_tables as $drop_table) { + $wpdb->query( "DROP TABLE IF EXISTS ". current( $drop_table ) ."" ); + } + $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->blogs WHERE blog_id = %d", $blog_id ) ); + $dir = apply_filters( 'wpmu_delete_blog_upload_dir', WP_CONTENT_DIR . "/blogs.dir/{$blog_id}/files/", $blog_id ); + $dir = rtrim( $dir, DIRECTORY_SEPARATOR ); + $top_dir = $dir; + $stack = array($dir); + $index = 0; + + while ( $index < count( $stack ) ) { + # Get indexed directory from stack + $dir = $stack[$index]; + + $dh = @opendir( $dir ); + if ( $dh ) { + while ( ( $file = @readdir( $dh ) ) !== false ) { + if ( $file == '.' || $file == '..' ) + continue; + + if ( @is_dir( $dir . DIRECTORY_SEPARATOR . $file ) ) + $stack[] = $dir . DIRECTORY_SEPARATOR . $file; + else if ( @is_file( $dir . DIRECTORY_SEPARATOR . $file ) ) + @unlink( $dir . DIRECTORY_SEPARATOR . $file ); + } + } + $index++; + } + + $stack = array_reverse( $stack ); // Last added dirs are deepest + foreach( (array) $stack as $dir ) { + if ( $dir != $top_dir) + @rmdir( $dir ); + } + } + + $wpdb->query( "DELETE FROM {$wpdb->usermeta} WHERE meta_key = '{$blog_prefix}autosave_draft_ids'" ); + $blogs = get_site_option( 'blog_list' ); + if ( is_array( $blogs ) ) { + foreach ( $blogs as $n => $blog ) { + if ( $blog['blog_id'] == $blog_id ) + unset( $blogs[$n] ); + } + update_site_option( 'blog_list', $blogs ); + } + + if ( $switch === true ) + restore_current_blog(); +} + +// @todo Merge with wp_delete_user() ? +function wpmu_delete_user( $id ) { + global $wpdb; + + $id = (int) $id; + + do_action( 'wpmu_delete_user', $id ); + + $blogs = get_blogs_of_user( $id ); + + if ( ! empty( $blogs ) ) { + foreach ( $blogs as $blog ) { + switch_to_blog( $blog->userblog_id ); + remove_user_from_blog( $id, $blog->userblog_id ); + + $post_ids = $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_author = %d", $id ) ); + foreach ( (array) $post_ids as $post_id ) { + wp_delete_post( $post_id ); + } + + // Clean links + $link_ids = $wpdb->get_col( $wpdb->prepare( "SELECT link_id FROM $wpdb->links WHERE link_owner = %d", $id ) ); + + if ( $link_ids ) { + foreach ( $link_ids as $link_id ) + wp_delete_link( $link_id ); + } + + restore_current_blog(); + } + } + + $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->users WHERE ID = %d", $id ) ); + $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->usermeta WHERE user_id = %d", $id ) ); + + clean_user_cache( $id ); + + // allow for commit transaction + do_action( 'deleted_user', $id ); + + return true; +} + +function wpmu_get_blog_allowedthemes( $blog_id = 0 ) { + $themes = get_themes(); + + if ( $blog_id != 0 ) + switch_to_blog( $blog_id ); + + $blog_allowed_themes = get_option( 'allowedthemes' ); + if ( !is_array( $blog_allowed_themes ) || empty( $blog_allowed_themes ) ) { // convert old allowed_themes to new allowedthemes + $blog_allowed_themes = get_option( 'allowed_themes' ); + + if ( is_array( $blog_allowed_themes ) ) { + foreach( (array) $themes as $key => $theme ) { + $theme_key = esc_html( $theme['Stylesheet'] ); + if ( isset( $blog_allowed_themes[$key] ) == true ) { + $blog_allowedthemes[$theme_key] = 1; + } + } + $blog_allowed_themes = $blog_allowedthemes; + add_option( 'allowedthemes', $blog_allowed_themes ); + delete_option( 'allowed_themes' ); + } + } + + if ( $blog_id != 0 ) + restore_current_blog(); + + return $blog_allowed_themes; +} + +function update_option_new_admin_email( $old_value, $value ) { + $email = get_option( 'admin_email' ); + if ( $value == get_option( 'admin_email' ) || !is_email( $value ) ) + return; + + $hash = md5( $value. time() .mt_rand() ); + $new_admin_email = array( + 'hash' => $hash, + 'newemail' => $value + ); + update_option( 'adminhash', $new_admin_email ); + + $content = apply_filters( 'new_admin_email_content', __( "Dear user, + +You recently requested to have the administration email address on +your site changed. +If this is correct, please click on the following link to change it: +###ADMIN_URL### + +You can safely ignore and delete this email if you do not want to +take this action. + +This email has been sent to ###EMAIL### + +Regards, +All at ###SITENAME### +###SITEURL### "), $new_admin_email ); + + $content = str_replace( '###ADMIN_URL###', esc_url( admin_url( 'options.php?adminhash='.$hash ) ), $content ); + $content = str_replace( '###EMAIL###', $value, $content ); + $content = str_replace( '###SITENAME###', get_site_option( 'site_name' ), $content ); + $content = str_replace( '###SITEURL###', network_home_url(), $content ); + + wp_mail( $value, sprintf( __( '[%s] New Admin Email Address' ), get_option( 'blogname' ) ), $content ); +} +add_action( 'update_option_new_admin_email', 'update_option_new_admin_email', 10, 2 ); +add_action( 'add_option_new_admin_email', 'update_option_new_admin_email', 10, 2 ); + +function send_confirmation_on_profile_email() { + global $errors, $wpdb; + $current_user = wp_get_current_user(); + if ( ! is_object($errors) ) + $errors = new WP_Error(); + + if ( $current_user->id != $_POST['user_id'] ) + return false; + + if ( $current_user->user_email != $_POST['email'] ) { + if ( !is_email( $_POST['email'] ) ) { + $errors->add( 'user_email', __( "ERROR: The e-mail address isn't correct." ), array( 'form-field' => 'email' ) ); + return; + } + + if ( $wpdb->get_var( $wpdb->prepare( "SELECT user_email FROM {$wpdb->users} WHERE user_email=%s", $_POST['email'] ) ) ) { + $errors->add( 'user_email', __( "ERROR: The e-mail address is already used." ), array( 'form-field' => 'email' ) ); + delete_option( $current_user->ID . '_new_email' ); + return; + } + + $hash = md5( $_POST['email'] . time() . mt_rand() ); + $new_user_email = array( + 'hash' => $hash, + 'newemail' => $_POST['email'] + ); + update_option( $current_user->ID . '_new_email', $new_user_email ); + + $content = apply_filters( 'new_user_email_content', __( "Dear user, + +You recently requested to have the email address on your account changed. +If this is correct, please click on the following link to change it: +###ADMIN_URL### + +You can safely ignore and delete this email if you do not want to +take this action. + +This email has been sent to ###EMAIL### + +Regards, +All at ###SITENAME### +###SITEURL###" ), $new_user_email ); + + $content = str_replace( '###ADMIN_URL###', esc_url( admin_url( 'profile.php?newuseremail='.$hash ) ), $content ); + $content = str_replace( '###EMAIL###', $_POST['email'], $content); + $content = str_replace( '###SITENAME###', get_site_option( 'site_name' ), $content ); + $content = str_replace( '###SITEURL###', network_home_url(), $content ); + + wp_mail( $_POST['email'], sprintf( __( '[%s] New Email Address' ), get_option( 'blogname' ) ), $content ); + $_POST['email'] = $current_user->user_email; + } +} +add_action( 'personal_options_update', 'send_confirmation_on_profile_email' ); + +function new_user_email_admin_notice() { + if ( strpos( $_SERVER['PHP_SELF'], 'profile.php' ) && isset( $_GET['updated'] ) && $email = get_option( get_current_user_id() . '_new_email' ) ) + echo "
" . sprintf( __( "Your email address has not been updated yet. Please check your inbox at %s for a confirmation email." ), $email['newemail'] ) . "
"; +} +add_action( 'admin_notices', 'new_user_email_admin_notice' ); + +function get_site_allowed_themes() { + $themes = get_themes(); + $allowed_themes = get_site_option( 'allowedthemes' ); + if ( !is_array( $allowed_themes ) || empty( $allowed_themes ) ) { + $allowed_themes = get_site_option( 'allowed_themes' ); // convert old allowed_themes format + if ( !is_array( $allowed_themes ) ) { + $allowed_themes = array(); + } else { + foreach( (array) $themes as $key => $theme ) { + $theme_key = esc_html( $theme['Stylesheet'] ); + if ( isset( $allowed_themes[ $key ] ) == true ) { + $allowedthemes[ $theme_key ] = 1; + } + } + $allowed_themes = $allowedthemes; + } + } + return $allowed_themes; +} + +/** + * Determines if there is any upload space left in the current blog's quota. + * + * @since 3.0.0 + * @return bool True if space is available, false otherwise. + */ +function is_upload_space_available() { + if ( get_site_option( 'upload_space_check_disabled' ) ) + return true; + + if ( !( $space_allowed = get_upload_space_available() ) ) + return false; + + return true; +} + +/** + * @since 3.0.0 + * + * @return int of upload size limit in bytes + */ +function upload_size_limit_filter( $size ) { + $fileupload_maxk = 1024 * get_site_option( 'fileupload_maxk', 1500 ); + if ( get_site_option( 'upload_space_check_disabled' ) ) + return min( $size, $fileupload_maxk ); + + return min( $size, $fileupload_maxk, get_upload_space_available() ); +} +/** + * Determines if there is any upload space left in the current blog's quota. + * + * @return int of upload space available in bytes + */ +function get_upload_space_available() { + $space_allowed = get_space_allowed() * 1024 * 1024; + if ( get_site_option( 'upload_space_check_disabled' ) ) + return $space_allowed; + + $dir_name = trailingslashit( BLOGUPLOADDIR ); + if ( !( is_dir( $dir_name) && is_readable( $dir_name ) ) ) + return $space_allowed; + + $dir = dir( $dir_name ); + $size = 0; + + while ( $file = $dir->read() ) { + if ( $file != '.' && $file != '..' ) { + if ( is_dir( $dir_name . $file) ) { + $size += get_dirsize( $dir_name . $file ); + } else { + $size += filesize( $dir_name . $file ); + } + } + } + $dir->close(); + + if ( ( $space_allowed - $size ) <= 0 ) + return 0; + + return $space_allowed - $size; +} + +/** + * Returns the upload quota for the current blog. + * + * @return int Quota + */ +function get_space_allowed() { + $space_allowed = get_option( 'blog_upload_space' ); + if ( $space_allowed == false ) + $space_allowed = get_site_option( 'blog_upload_space' ); + if ( empty( $space_allowed ) || !is_numeric( $space_allowed ) ) + $space_allowed = 50; + + return $space_allowed; +} + +function display_space_usage() { + $space = get_space_allowed(); + $used = get_dirsize( BLOGUPLOADDIR ) / 1024 / 1024; + + $percentused = ( $used / $space ) * 100; + + if ( $space > 1000 ) { + $space = number_format( $space / 1024 ); + /* translators: Gigabytes */ + $space .= __( 'GB' ); + } else { + /* translators: Megabytes */ + $space .= __( 'MB' ); + } + ?> + + + + + + + update( $wpdb->users, array( $pref => $value ), array( 'ID' => $id ) ); + + clean_user_cache( $id ); + + if ( $pref == 'spam' ) { + if ( $value == 1 ) + do_action( 'make_spam_user', $id ); + else + do_action( 'make_ham_user', $id ); + } + + return $value; +} + +function refresh_user_details( $id ) { + $id = (int) $id; + + if ( !$user = get_userdata( $id ) ) + return false; + + clean_user_cache( $id ); + + return $id; +} + +function format_code_lang( $code = '' ) { + $code = strtolower( substr( $code, 0, 2 ) ); + $lang_codes = array( + 'aa' => 'Afar', 'ab' => 'Abkhazian', 'af' => 'Afrikaans', 'ak' => 'Akan', 'sq' => 'Albanian', 'am' => 'Amharic', 'ar' => 'Arabic', 'an' => 'Aragonese', 'hy' => 'Armenian', 'as' => 'Assamese', 'av' => 'Avaric', 'ae' => 'Avestan', 'ay' => 'Aymara', 'az' => 'Azerbaijani', 'ba' => 'Bashkir', 'bm' => 'Bambara', 'eu' => 'Basque', 'be' => 'Belarusian', 'bn' => 'Bengali', + 'bh' => 'Bihari', 'bi' => 'Bislama', 'bs' => 'Bosnian', 'br' => 'Breton', 'bg' => 'Bulgarian', 'my' => 'Burmese', 'ca' => 'Catalan; Valencian', 'ch' => 'Chamorro', 'ce' => 'Chechen', 'zh' => 'Chinese', 'cu' => 'Church Slavic; Old Slavonic; Church Slavonic; Old Bulgarian; Old Church Slavonic', 'cv' => 'Chuvash', 'kw' => 'Cornish', 'co' => 'Corsican', 'cr' => 'Cree', + 'cs' => 'Czech', 'da' => 'Danish', 'dv' => 'Divehi; Dhivehi; Maldivian', 'nl' => 'Dutch; Flemish', 'dz' => 'Dzongkha', 'en' => 'English', 'eo' => 'Esperanto', 'et' => 'Estonian', 'ee' => 'Ewe', 'fo' => 'Faroese', 'fj' => 'Fijjian', 'fi' => 'Finnish', 'fr' => 'French', 'fy' => 'Western Frisian', 'ff' => 'Fulah', 'ka' => 'Georgian', 'de' => 'German', 'gd' => 'Gaelic; Scottish Gaelic', + 'ga' => 'Irish', 'gl' => 'Galician', 'gv' => 'Manx', 'el' => 'Greek, Modern', 'gn' => 'Guarani', 'gu' => 'Gujarati', 'ht' => 'Haitian; Haitian Creole', 'ha' => 'Hausa', 'he' => 'Hebrew', 'hz' => 'Herero', 'hi' => 'Hindi', 'ho' => 'Hiri Motu', 'hu' => 'Hungarian', 'ig' => 'Igbo', 'is' => 'Icelandic', 'io' => 'Ido', 'ii' => 'Sichuan Yi', 'iu' => 'Inuktitut', 'ie' => 'Interlingue', + 'ia' => 'Interlingua (International Auxiliary Language Association)', 'id' => 'Indonesian', 'ik' => 'Inupiaq', 'it' => 'Italian', 'jv' => 'Javanese', 'ja' => 'Japanese', 'kl' => 'Kalaallisut; Greenlandic', 'kn' => 'Kannada', 'ks' => 'Kashmiri', 'kr' => 'Kanuri', 'kk' => 'Kazakh', 'km' => 'Central Khmer', 'ki' => 'Kikuyu; Gikuyu', 'rw' => 'Kinyarwanda', 'ky' => 'Kirghiz; Kyrgyz', + 'kv' => 'Komi', 'kg' => 'Kongo', 'ko' => 'Korean', 'kj' => 'Kuanyama; Kwanyama', 'ku' => 'Kurdish', 'lo' => 'Lao', 'la' => 'Latin', 'lv' => 'Latvian', 'li' => 'Limburgan; Limburger; Limburgish', 'ln' => 'Lingala', 'lt' => 'Lithuanian', 'lb' => 'Luxembourgish; Letzeburgesch', 'lu' => 'Luba-Katanga', 'lg' => 'Ganda', 'mk' => 'Macedonian', 'mh' => 'Marshallese', 'ml' => 'Malayalam', + 'mi' => 'Maori', 'mr' => 'Marathi', 'ms' => 'Malay', 'mg' => 'Malagasy', 'mt' => 'Maltese', 'mo' => 'Moldavian', 'mn' => 'Mongolian', 'na' => 'Nauru', 'nv' => 'Navajo; Navaho', 'nr' => 'Ndebele, South; South Ndebele', 'nd' => 'Ndebele, North; North Ndebele', 'ng' => 'Ndonga', 'ne' => 'Nepali', 'nn' => 'Norwegian Nynorsk; Nynorsk, Norwegian', 'nb' => 'Bokmål, Norwegian, Norwegian Bokmål', + 'no' => 'Norwegian', 'ny' => 'Chichewa; Chewa; Nyanja', 'oc' => 'Occitan, Provençal', 'oj' => 'Ojibwa', 'or' => 'Oriya', 'om' => 'Oromo', 'os' => 'Ossetian; Ossetic', 'pa' => 'Panjabi; Punjabi', 'fa' => 'Persian', 'pi' => 'Pali', 'pl' => 'Polish', 'pt' => 'Portuguese', 'ps' => 'Pushto', 'qu' => 'Quechua', 'rm' => 'Romansh', 'ro' => 'Romanian', 'rn' => 'Rundi', 'ru' => 'Russian', + 'sg' => 'Sango', 'sa' => 'Sanskrit', 'sr' => 'Serbian', 'hr' => 'Croatian', 'si' => 'Sinhala; Sinhalese', 'sk' => 'Slovak', 'sl' => 'Slovenian', 'se' => 'Northern Sami', 'sm' => 'Samoan', 'sn' => 'Shona', 'sd' => 'Sindhi', 'so' => 'Somali', 'st' => 'Sotho, Southern', 'es' => 'Spanish; Castilian', 'sc' => 'Sardinian', 'ss' => 'Swati', 'su' => 'Sundanese', 'sw' => 'Swahili', + 'sv' => 'Swedish', 'ty' => 'Tahitian', 'ta' => 'Tamil', 'tt' => 'Tatar', 'te' => 'Telugu', 'tg' => 'Tajik', 'tl' => 'Tagalog', 'th' => 'Thai', 'bo' => 'Tibetan', 'ti' => 'Tigrinya', 'to' => 'Tonga (Tonga Islands)', 'tn' => 'Tswana', 'ts' => 'Tsonga', 'tk' => 'Turkmen', 'tr' => 'Turkish', 'tw' => 'Twi', 'ug' => 'Uighur; Uyghur', 'uk' => 'Ukrainian', 'ur' => 'Urdu', 'uz' => 'Uzbek', + 've' => 'Venda', 'vi' => 'Vietnamese', 'vo' => 'Volapük', 'cy' => 'Welsh','wa' => 'Walloon','wo' => 'Wolof', 'xh' => 'Xhosa', 'yi' => 'Yiddish', 'yo' => 'Yoruba', 'za' => 'Zhuang; Chuang', 'zu' => 'Zulu' ); + $lang_codes = apply_filters( 'lang_codes', $lang_codes, $code ); + return strtr( $code, $lang_codes ); +} + +function sync_category_tag_slugs( $term, $taxonomy ) { + if ( global_terms_enabled() && ( $taxonomy == 'category' || $taxonomy == 'post_tag' ) ) { + if ( is_object( $term ) ) { + $term->slug = sanitize_title( $term->name ); + } else { + $term['slug'] = sanitize_title( $term['name'] ); + } + } + return $term; +} +add_filter( 'get_term', 'sync_category_tag_slugs', 10, 2 ); + +function _access_denied_splash() { + if ( ! is_user_logged_in() || is_network_admin() ) + return; + + $blogs = get_blogs_of_user( get_current_user_id() ); + + if ( wp_list_filter( $blogs, array( 'userblog_id' => get_current_blog_id() ) ) ) + return; + + $blog_name = get_bloginfo( 'name' ); + + if ( empty( $blogs ) ) + wp_die( sprintf( __( 'You attempted to access the "%1$s" dashboard, but you do not currently have privileges on this site. If you believe you should be able to access the "%1$s" dashboard, please contact your network administrator.' ), $blog_name ) ); + + $output = '

' . sprintf( __( 'You attempted to access the "%1$s" dashboard, but you do not currently have privileges on this site. If you believe you should be able to access the "%1$s" dashboard, please contact your network administrator.' ), $blog_name ) . '

'; + $output .= '

' . __( 'If you reached this screen by accident and meant to visit one of your own sites, here are some shortcuts to help you find your way.' ) . '

'; + + $output .= '

' . __('Your Sites') . '

'; + $output .= ''; + + foreach ( $blogs as $blog ) { + $output .= ""; + $output .= ""; + $output .= ""; + $output .= ""; + } + $output .= '
"; + $output .= "{$blog->blogname}"; + $output .= ""; + $output .= "" . __( 'Visit Dashboard' ) . " | " . __( 'View Site' ) . "" ; + $output .= "
'; + + wp_die( $output ); +} +add_action( 'admin_page_access_denied', '_access_denied_splash', 99 ); + +function check_import_new_users( $permission ) { + if ( !is_super_admin() ) + return false; + return true; +} +add_filter( 'import_allow_create_users', 'check_import_new_users' ); +// See "import_allow_fetch_attachments" and "import_attachment_size_limit" filters too. + +function mu_dropdown_languages( $lang_files = array(), $current = '' ) { + $flag = false; + $output = array(); + + foreach ( (array) $lang_files as $val ) { + $code_lang = basename( $val, '.mo' ); + + if ( $code_lang == 'en_US' ) { // American English + $flag = true; + $ae = __( 'American English' ); + $output[$ae] = ''; + } elseif ( $code_lang == 'en_GB' ) { // British English + $flag = true; + $be = __( 'British English' ); + $output[$be] = ''; + } else { + $translated = format_code_lang( $code_lang ); + $output[$translated] = ''; + } + + } + + if ( $flag === false ) // WordPress english + $output[] = '"; + + // Order by name + uksort( $output, 'strnatcasecmp' ); + + $output = apply_filters( 'mu_dropdown_languages', $output, $lang_files, $current ); + echo implode( "\n\t", $output ); +} + +/* Warn the admin if SECRET SALT information is missing from wp-config.php */ +function secret_salt_warning() { + if ( !is_super_admin() ) + return; + $secret_keys = array( 'AUTH_KEY', 'SECURE_AUTH_KEY', 'LOGGED_IN_KEY', 'NONCE_KEY', 'AUTH_SALT', 'SECURE_AUTH_SALT', 'LOGGED_IN_SALT', 'NONCE_SALT' ); + $out = ''; + foreach( $secret_keys as $key ) { + if ( ! defined( $key ) ) + $out .= "define( '$key', '" . esc_html( wp_generate_password( 64, true, true ) ) . "' );
"; + } + if ( $out != '' ) { + $msg = __( 'Warning! WordPress encrypts user cookies, but you must add the following lines to wp-config.php for it to be more secure.' ); + $msg .= '
' . __( "Before the line /* That's all, stop editing! Happy blogging. */ please add this code:" ); + $msg .= "

$out"; + + echo "
$msg
"; + } +} +add_action( 'network_admin_notices', 'secret_salt_warning' ); + +function site_admin_notice() { + global $wp_db_version; + if ( !is_super_admin() ) + return false; + if ( get_site_option( 'wpmu_upgrade_site' ) != $wp_db_version ) + echo "
" . sprintf( __( 'Thank you for Updating! Please visit the Update Network page to update all your sites.' ), esc_url( network_admin_url( 'upgrade.php' ) ) ) . "
"; +} +add_action( 'admin_notices', 'site_admin_notice' ); +add_action( 'network_admin_notices', 'site_admin_notice' ); + +function avoid_blog_page_permalink_collision( $data, $postarr ) { + if ( is_subdomain_install() ) + return $data; + if ( $data['post_type'] != 'page' ) + return $data; + if ( !isset( $data['post_name'] ) || $data['post_name'] == '' ) + return $data; + if ( !is_main_site() ) + return $data; + + $post_name = $data['post_name']; + $c = 0; + while( $c < 10 && get_id_from_blogname( $post_name ) ) { + $post_name .= mt_rand( 1, 10 ); + $c ++; + } + if ( $post_name != $data['post_name'] ) { + $data['post_name'] = $post_name; + } + return $data; +} +add_filter( 'wp_insert_post_data', 'avoid_blog_page_permalink_collision', 10, 2 ); + +function choose_primary_blog() { + ?> + + + + + + + + + + + +
+ 1 ) { + $found = false; + ?> + + userblog_id ); + } + } elseif ( count( $all_blogs ) == 1 ) { + $blog = array_shift( $all_blogs ); + echo $blog->domain; + if ( $primary_blog != $blog->userblog_id ) // Set the primary blog again if it's out of sync with blog list. + update_user_meta( get_current_user_id(), 'primary_blog', $blog->userblog_id ); + } else { + echo "N/A"; + } + ?> +
+ +
+ ' . sprintf( __( 'The %1$s file is deprecated. Please remove it and update your server rewrite rules to use %2$s instead.' ), 'wp-content/blogs.php', 'wp-includes/ms-files.php' ) . ''; +} +add_action( 'network_admin_notices', 'ms_deprecated_blogs_file' ); + +/** + * Grants super admin privileges. + * + * @since 3.0.0 + * @param int $user_id + */ +function grant_super_admin( $user_id ) { + global $super_admins; + + // If global super_admins override is defined, there is nothing to do here. + if ( isset($super_admins) ) + return false; + + do_action( 'grant_super_admin', $user_id ); + + // Directly fetch site_admins instead of using get_super_admins() + $super_admins = get_site_option( 'site_admins', array( 'admin' ) ); + + $user = new WP_User( $user_id ); + if ( ! in_array( $user->user_login, $super_admins ) ) { + $super_admins[] = $user->user_login; + update_site_option( 'site_admins' , $super_admins ); + do_action( 'granted_super_admin', $user_id ); + return true; + } + return false; +} + +/** + * Revokes super admin privileges. + * + * @since 3.0.0 + * @param int $user_id + */ +function revoke_super_admin( $user_id ) { + global $super_admins; + + // If global super_admins override is defined, there is nothing to do here. + if ( isset($super_admins) ) + return false; + + do_action( 'revoke_super_admin', $user_id ); + + // Directly fetch site_admins instead of using get_super_admins() + $super_admins = get_site_option( 'site_admins', array( 'admin' ) ); + + $user = new WP_User( $user_id ); + if ( $user->user_email != get_site_option( 'admin_email' ) ) { + if ( false !== ( $key = array_search( $user->user_login, $super_admins ) ) ) { + unset( $super_admins[$key] ); + update_site_option( 'site_admins', $super_admins ); + do_action( 'revoked_super_admin', $user_id ); + return true; + } + } + return false; +} + +/** + * Whether or not we can edit this network from this page + * + * By default editing of network is restricted to the Network Admin for that site_id this allows for this to be overridden + * + * @since 3.1.0 + * @param integer $site_id The network/site id to check. + */ +function can_edit_network( $site_id ) { + global $wpdb; + + if ($site_id == $wpdb->siteid ) + $result = true; + else + $result = false; + + return apply_filters( 'can_edit_network', $result, $site_id ); +} + +/** + * Thickbox image paths for Network Admin. + * + * @since 3.1.0 + * @access private + */ +function _thickbox_path_admin_subfolder() { +?> + + diff --git a/src/wp-admin/includes/nav-menu.php b/src/wp-admin/includes/nav-menu.php new file mode 100644 index 0000000..8890166 --- /dev/null +++ b/src/wp-admin/includes/nav-menu.php @@ -0,0 +1,1171 @@ + $_wp_nav_menu_max_depth ? $depth : $_wp_nav_menu_max_depth; + + $indent = ( $depth ) ? str_repeat( "\t", $depth ) : ''; + + ob_start(); + $item_id = esc_attr( $item->ID ); + $removed_args = array( + 'action', + 'customlink-tab', + 'edit-menu-item', + 'menu-item', + 'page-tab', + '_wpnonce', + ); + + $original_title = ''; + if ( 'taxonomy' == $item->type ) { + $original_title = get_term_field( 'name', $item->object_id, $item->object, 'raw' ); + if ( is_wp_error( $original_title ) ) + $original_title = false; + } elseif ( 'post_type' == $item->type ) { + $original_object = get_post( $item->object_id ); + $original_title = $original_object->post_title; + } + + $classes = array( + 'menu-item menu-item-depth-' . $depth, + 'menu-item-' . esc_attr( $item->object ), + 'menu-item-edit-' . ( ( isset( $_GET['edit-menu-item'] ) && $item_id == $_GET['edit-menu-item'] ) ? 'active' : 'inactive'), + ); + + $title = $item->title; + + if ( ! empty( $item->_invalid ) ) { + $classes[] = 'menu-item-invalid'; + /* translators: %s: title of menu item which is invalid */ + $title = sprintf( __( '%s (Invalid)' ), $item->title ); + } elseif ( isset( $item->post_status ) && 'draft' == $item->post_status ) { + $classes[] = 'pending'; + /* translators: %s: title of menu item in draft status */ + $title = sprintf( __('%s (Pending)'), $item->title ); + } + + $title = empty( $item->label ) ? $title : $item->label; + + ?> +
  • '; + $output .= ''; + + // Menu item hidden fields + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + } +} + +/** + * Prints the appropriate response to a menu quick search. + * + * @since 3.0.0 + * + * @param array $request The unsanitized request values. + */ +function _wp_ajax_menu_quick_search( $request = array() ) { + $args = array(); + $type = isset( $request['type'] ) ? $request['type'] : ''; + $object_type = isset( $request['object_type'] ) ? $request['object_type'] : ''; + $query = isset( $request['q'] ) ? $request['q'] : ''; + $response_format = isset( $request['response-format'] ) && in_array( $request['response-format'], array( 'json', 'markup' ) ) ? $request['response-format'] : 'json'; + + if ( 'markup' == $response_format ) { + $args['walker'] = new Walker_Nav_Menu_Checklist; + } + + if ( 'get-post-item' == $type ) { + if ( post_type_exists( $object_type ) ) { + if ( isset( $request['ID'] ) ) { + $object_id = (int) $request['ID']; + if ( 'markup' == $response_format ) { + echo walk_nav_menu_tree( array_map('wp_setup_nav_menu_item', array( get_post( $object_id ) ) ), 0, (object) $args ); + } elseif ( 'json' == $response_format ) { + $post_obj = get_post( $object_id ); + echo json_encode( + array( + 'ID' => $object_id, + 'post_title' => get_the_title( $object_id ), + 'post_type' => get_post_type( $object_id ), + ) + ); + echo "\n"; + } + } + } elseif ( taxonomy_exists( $object_type ) ) { + if ( isset( $request['ID'] ) ) { + $object_id = (int) $request['ID']; + if ( 'markup' == $response_format ) { + echo walk_nav_menu_tree( array_map('wp_setup_nav_menu_item', array( get_term( $object_id, $object_type ) ) ), 0, (object) $args ); + } elseif ( 'json' == $response_format ) { + $post_obj = get_term( $object_id, $object_type ); + echo json_encode( + array( + 'ID' => $object_id, + 'post_title' => $post_obj->name, + 'post_type' => $object_type, + ) + ); + echo "\n"; + } + } + + } + + + } elseif ( preg_match('/quick-search-(posttype|taxonomy)-([a-zA-Z_-]*\b)/', $type, $matches) ) { + if ( 'posttype' == $matches[1] && get_post_type_object( $matches[2] ) ) { + query_posts(array( + 'posts_per_page' => 10, + 'post_type' => $matches[2], + 's' => $query, + )); + if ( ! have_posts() ) + return; + while ( have_posts() ) { + the_post(); + if ( 'markup' == $response_format ) { + echo walk_nav_menu_tree( array_map('wp_setup_nav_menu_item', array( get_post( get_the_ID() ) ) ), 0, (object) $args ); + } elseif ( 'json' == $response_format ) { + echo json_encode( + array( + 'ID' => get_the_ID(), + 'post_title' => get_the_title(), + 'post_type' => get_post_type(), + ) + ); + echo "\n"; + } + } + } elseif ( 'taxonomy' == $matches[1] ) { + $terms = get_terms( $matches[2], array( + 'name__like' => $query, + 'number' => 10, + )); + if ( empty( $terms ) || is_wp_error( $terms ) ) + return; + foreach( (array) $terms as $term ) { + if ( 'markup' == $response_format ) { + echo walk_nav_menu_tree( array_map('wp_setup_nav_menu_item', array( $term ) ), 0, (object) $args ); + } elseif ( 'json' == $response_format ) { + echo json_encode( + array( + 'ID' => $term->term_id, + 'post_title' => $term->name, + 'post_type' => $matches[2], + ) + ); + echo "\n"; + } + } + } + } +} + +/** + * Register nav menu metaboxes and advanced menu items + * + * @since 3.0.0 + **/ +function wp_nav_menu_setup() { + // Register meta boxes + if ( wp_get_nav_menus() ) + add_meta_box( 'nav-menu-theme-locations', __( 'Theme Locations' ), 'wp_nav_menu_locations_meta_box' , 'nav-menus', 'side', 'default' ); + add_meta_box( 'add-custom-links', __('Custom Links'), 'wp_nav_menu_item_link_meta_box', 'nav-menus', 'side', 'default' ); + wp_nav_menu_post_type_meta_boxes(); + wp_nav_menu_taxonomy_meta_boxes(); + + // Register advanced menu items (columns) + add_filter( 'manage_nav-menus_columns', 'wp_nav_menu_manage_columns'); + + // If first time editing, disable advanced items by default. + if( false === get_user_option( 'managenav-menuscolumnshidden' ) ) { + $user = wp_get_current_user(); + update_user_option($user->ID, 'managenav-menuscolumnshidden', + array( 0 => 'link-target', 1 => 'css-classes', 2 => 'xfn', 3 => 'description', ), + true); + } +} + +/** + * Limit the amount of meta boxes to just links, pages and cats for first time users. + * + * @since 3.0.0 + **/ +function wp_initial_nav_menu_meta_boxes() { + global $wp_meta_boxes; + + if ( get_user_option( 'metaboxhidden_nav-menus' ) !== false || ! is_array($wp_meta_boxes) ) + return; + + $initial_meta_boxes = array( 'nav-menu-theme-locations', 'add-custom-links', 'add-page', 'add-category' ); + $hidden_meta_boxes = array(); + + foreach ( array_keys($wp_meta_boxes['nav-menus']) as $context ) { + foreach ( array_keys($wp_meta_boxes['nav-menus'][$context]) as $priority ) { + foreach ( $wp_meta_boxes['nav-menus'][$context][$priority] as $box ) { + if ( in_array( $box['id'], $initial_meta_boxes ) ) { + unset( $box['id'] ); + } else { + $hidden_meta_boxes[] = $box['id']; + } + } + } + } + + $user = wp_get_current_user(); + update_user_option( $user->ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes, true ); +} + +/** + * Creates metaboxes for any post type menu item. + * + * @since 3.0.0 + */ +function wp_nav_menu_post_type_meta_boxes() { + $post_types = get_post_types( array( 'show_in_nav_menus' => true ), 'object' ); + + if ( ! $post_types ) + return; + + foreach ( $post_types as $post_type ) { + $post_type = apply_filters( 'nav_menu_meta_box_object', $post_type ); + if ( $post_type ) { + $id = $post_type->name; + add_meta_box( "add-{$id}", $post_type->labels->name, 'wp_nav_menu_item_post_type_meta_box', 'nav-menus', 'side', 'default', $post_type ); + } + } +} + +/** + * Creates metaboxes for any taxonomy menu item. + * + * @since 3.0.0 + */ +function wp_nav_menu_taxonomy_meta_boxes() { + $taxonomies = get_taxonomies( array( 'show_in_nav_menus' => true ), 'object' ); + + if ( !$taxonomies ) + return; + + foreach ( $taxonomies as $tax ) { + $tax = apply_filters( 'nav_menu_meta_box_object', $tax ); + if ( $tax ) { + $id = $tax->name; + add_meta_box( "add-{$id}", $tax->labels->name, 'wp_nav_menu_item_taxonomy_meta_box', 'nav-menus', 'side', 'default', $tax ); + } + } +} + +/** + * Displays a metabox for the nav menu theme locations. + * + * @since 3.0.0 + */ +function wp_nav_menu_locations_meta_box() { + global $nav_menu_selected_id; + + if ( ! current_theme_supports( 'menus' ) ) { + // We must only support widgets. Leave a message and bail. + echo '

    ' . __('The current theme does not natively support menus, but you can use the “Custom Menu” widget to add any menus you create here to the theme’s sidebar.') . '

    '; + return; + } + + $locations = get_registered_nav_menus(); + $menus = wp_get_nav_menus(); + $menu_locations = get_nav_menu_locations(); + $num_locations = count( array_keys($locations) ); + + echo '

    ' . sprintf( _n('Your theme supports %s menu. Select which menu you would like to use.', 'Your theme supports %s menus. Select which menu appears in each location.', $num_locations ), number_format_i18n($num_locations) ) . '

    '; + + foreach ( $locations as $location => $description ) { + ?> +

    + +

    + +

    + + +

    + $_nav_menu_placeholder ? $_nav_menu_placeholder - 1 : -1; + + $current_tab = 'create'; + if ( isset( $_REQUEST['customlink-tab'] ) && in_array( $_REQUEST['customlink-tab'], array('create', 'all') ) ) { + $current_tab = $_REQUEST['customlink-tab']; + } + + $removed_args = array( + 'action', + 'customlink-tab', + 'edit-menu-item', + 'menu-item', + 'page-tab', + '_wpnonce', + ); + + ?> +
    + + + + + + +

    + + + class="button-secondary submit-add-to-menu" value="" name="add-custom-menu-item" id="submit-customlinkdiv" /> + +

    + +
    + name; + + // paginate browsing for large numbers of post objects + $per_page = 50; + $pagenum = isset( $_REQUEST[$post_type_name . '-tab'] ) && isset( $_REQUEST['paged'] ) ? absint( $_REQUEST['paged'] ) : 1; + $offset = 0 < $pagenum ? $per_page * ( $pagenum - 1 ) : 0; + + $args = array( + 'offset' => $offset, + 'order' => 'ASC', + 'orderby' => 'title', + 'posts_per_page' => $per_page, + 'post_type' => $post_type_name, + 'suppress_filters' => true, + 'update_post_term_cache' => false, + 'update_post_meta_cache' => false + ); + + if ( isset( $post_type['args']->_default_query ) ) + $args = array_merge($args, (array) $post_type['args']->_default_query ); + + // @todo transient caching of these results with proper invalidation on updating of a post of this type + $get_posts = new WP_Query; + $posts = $get_posts->query( $args ); + if ( ! $get_posts->post_count ) { + echo '

    ' . __( 'No items.' ) . '

    '; + return; + } + + $post_type_object = get_post_type_object($post_type_name); + + $num_pages = $get_posts->max_num_pages; + + $page_links = paginate_links( array( + 'base' => add_query_arg( + array( + $post_type_name . '-tab' => 'all', + 'paged' => '%#%', + 'item-type' => 'post_type', + 'item-object' => $post_type_name, + ) + ), + 'format' => '', + 'prev_text' => __('«'), + 'next_text' => __('»'), + 'total' => $num_pages, + 'current' => $pagenum + )); + + if ( !$posts ) + $error = '
  • '. $post_type['args']->labels->not_found .'
  • '; + + $db_fields = false; + if ( is_post_type_hierarchical( $post_type_name ) ) { + $db_fields = array( 'parent' => 'post_parent', 'id' => 'ID' ); + } + + $walker = new Walker_Nav_Menu_Checklist( $db_fields ); + + $current_tab = 'most-recent'; + if ( isset( $_REQUEST[$post_type_name . '-tab'] ) && in_array( $_REQUEST[$post_type_name . '-tab'], array('all', 'search') ) ) { + $current_tab = $_REQUEST[$post_type_name . '-tab']; + } + + if ( ! empty( $_REQUEST['quick-search-posttype-' . $post_type_name] ) ) { + $current_tab = 'search'; + } + + $removed_args = array( + 'action', + 'customlink-tab', + 'edit-menu-item', + 'menu-item', + 'page-tab', + '_wpnonce', + ); + + ?> +
    +
      +
    • >
    • +
    • >
    • +
    • >
    • +
    + +
    +
      + 'post_date', 'order' => 'DESC', 'posts_per_page' => 15 ) ); + $most_recent = $get_posts->query( $recent_args ); + $args['walker'] = $walker; + echo walk_nav_menu_tree( array_map('wp_setup_nav_menu_item', $most_recent), 0, (object) $args ); + ?> +
    +
    + + + + +
    + + + +
      + _add_to_top = true; + $front_page_obj->label = sprintf( _x('Home: %s', 'nav menu front page title'), $front_page_obj->post_title ); + array_unshift( $posts, $front_page_obj ); + } else { + $_nav_menu_placeholder = ( 0 > $_nav_menu_placeholder ) ? intval($_nav_menu_placeholder) - 1 : -1; + array_unshift( $posts, (object) array( + '_add_to_top' => true, + 'ID' => 0, + 'object_id' => $_nav_menu_placeholder, + 'post_content' => '', + 'post_excerpt' => '', + 'post_parent' => '', + 'post_title' => _x('Home', 'nav menu home label'), + 'post_type' => 'nav_menu_item', + 'type' => 'custom', + 'url' => home_url('/'), + ) ); + } + } + + $posts = apply_filters( 'nav_menu_items_'.$post_type_name, $posts, $args, $post_type ); + $checkbox_items = walk_nav_menu_tree( array_map('wp_setup_nav_menu_item', $posts), 0, (object) $args ); + + if ( 'all' == $current_tab && ! empty( $_REQUEST['selectall'] ) ) { + $checkbox_items = preg_replace('/(type=(.)checkbox(\2))/', '$1 checked=$2checked$2', $checkbox_items); + + } + + echo $checkbox_items; + ?> +
    + + + +
    + + +

    + + + + + + + class="button-secondary submit-add-to-menu" value="" name="add-post-type-menu-item" id="submit-posttype-" /> + +

    + +
    + name; + + // paginate browsing for large numbers of objects + $per_page = 50; + $pagenum = isset( $_REQUEST[$taxonomy_name . '-tab'] ) && isset( $_REQUEST['paged'] ) ? absint( $_REQUEST['paged'] ) : 1; + $offset = 0 < $pagenum ? $per_page * ( $pagenum - 1 ) : 0; + + $args = array( + 'child_of' => 0, + 'exclude' => '', + 'hide_empty' => false, + 'hierarchical' => 1, + 'include' => '', + 'include_last_update_time' => false, + 'number' => $per_page, + 'offset' => $offset, + 'order' => 'ASC', + 'orderby' => 'name', + 'pad_counts' => false, + ); + + $terms = get_terms( $taxonomy_name, $args ); + + if ( ! $terms || is_wp_error($terms) ) { + echo '

    ' . __( 'No items.' ) . '

    '; + return; + } + + $num_pages = ceil( wp_count_terms( $taxonomy_name , array_merge( $args, array('number' => '', 'offset' => '') ) ) / $per_page ); + + $page_links = paginate_links( array( + 'base' => add_query_arg( + array( + $taxonomy_name . '-tab' => 'all', + 'paged' => '%#%', + 'item-type' => 'taxonomy', + 'item-object' => $taxonomy_name, + ) + ), + 'format' => '', + 'prev_text' => __('«'), + 'next_text' => __('»'), + 'total' => $num_pages, + 'current' => $pagenum + )); + + $db_fields = false; + if ( is_taxonomy_hierarchical( $taxonomy_name ) ) { + $db_fields = array( 'parent' => 'parent', 'id' => 'term_id' ); + } + + $walker = new Walker_Nav_Menu_Checklist( $db_fields ); + + $current_tab = 'most-used'; + if ( isset( $_REQUEST[$taxonomy_name . '-tab'] ) && in_array( $_REQUEST[$taxonomy_name . '-tab'], array('all', 'most-used', 'search') ) ) { + $current_tab = $_REQUEST[$taxonomy_name . '-tab']; + } + + if ( ! empty( $_REQUEST['quick-search-taxonomy-' . $taxonomy_name] ) ) { + $current_tab = 'search'; + } + + $removed_args = array( + 'action', + 'customlink-tab', + 'edit-menu-item', + 'menu-item', + 'page-tab', + '_wpnonce', + ); + + ?> +
    +
      +
    • >
    • +
    • >
    • +
    • >
    • +
    + +
    +
      + 'count', 'order' => 'DESC', 'number' => 10, 'hierarchical' => false ) ); + $args['walker'] = $walker; + echo walk_nav_menu_tree( array_map('wp_setup_nav_menu_item', $popular_terms), 0, (object) $args ); + ?> +
    +
    + +
    + + + +
      + +
    + + + +
    + +
    + $searched, 'fields' => 'all', 'orderby' => 'count', 'order' => 'DESC', 'hierarchical' => false ) ); + } else { + $searched = ''; + $search_results = array(); + } + ?> +

    + + + 'submit-quick-search-taxonomy-' . $taxonomy_name ) ); ?> +

    + +
      + + + +
    • get_error_message(); ?>
    • + +
    • + +
    +
    + +

    + + + + + + + class="button-secondary submit-add-to-menu" value="" name="add-taxonomy-menu-item" id="submit-taxonomy-" /> + +

    + +
    + $_item_object_data ) { + if ( + empty( $_item_object_data['menu-item-object-id'] ) && // checkbox is not checked + ( + ! isset( $_item_object_data['menu-item-type'] ) || // and item type either isn't set + in_array( $_item_object_data['menu-item-url'], array( 'http://', '' ) ) || // or URL is the default + ! ( 'custom' == $_item_object_data['menu-item-type'] && ! isset( $_item_object_data['menu-item-db-id'] ) ) || // or it's not a custom menu item (but not the custom home page) + ! empty( $_item_object_data['menu-item-db-id'] ) // or it *is* a custom menu item that already exists + ) + ) { + continue; // then this potential menu item is not getting added to this menu + } + + // if this possible menu item doesn't actually have a menu database ID yet + if ( + empty( $_item_object_data['menu-item-db-id'] ) || + ( 0 > $_possible_db_id ) || + $_possible_db_id != $_item_object_data['menu-item-db-id'] + ) { + $_actual_db_id = 0; + } else { + $_actual_db_id = (int) $_item_object_data['menu-item-db-id']; + } + + $args = array( + 'menu-item-db-id' => ( isset( $_item_object_data['menu-item-db-id'] ) ? $_item_object_data['menu-item-db-id'] : '' ), + 'menu-item-object-id' => ( isset( $_item_object_data['menu-item-object-id'] ) ? $_item_object_data['menu-item-object-id'] : '' ), + 'menu-item-object' => ( isset( $_item_object_data['menu-item-object'] ) ? $_item_object_data['menu-item-object'] : '' ), + 'menu-item-parent-id' => ( isset( $_item_object_data['menu-item-parent-id'] ) ? $_item_object_data['menu-item-parent-id'] : '' ), + 'menu-item-position' => ( isset( $_item_object_data['menu-item-position'] ) ? $_item_object_data['menu-item-position'] : '' ), + 'menu-item-type' => ( isset( $_item_object_data['menu-item-type'] ) ? $_item_object_data['menu-item-type'] : '' ), + 'menu-item-title' => ( isset( $_item_object_data['menu-item-title'] ) ? $_item_object_data['menu-item-title'] : '' ), + 'menu-item-url' => ( isset( $_item_object_data['menu-item-url'] ) ? $_item_object_data['menu-item-url'] : '' ), + 'menu-item-description' => ( isset( $_item_object_data['menu-item-description'] ) ? $_item_object_data['menu-item-description'] : '' ), + 'menu-item-attr-title' => ( isset( $_item_object_data['menu-item-attr-title'] ) ? $_item_object_data['menu-item-attr-title'] : '' ), + 'menu-item-target' => ( isset( $_item_object_data['menu-item-target'] ) ? $_item_object_data['menu-item-target'] : '' ), + 'menu-item-classes' => ( isset( $_item_object_data['menu-item-classes'] ) ? $_item_object_data['menu-item-classes'] : '' ), + 'menu-item-xfn' => ( isset( $_item_object_data['menu-item-xfn'] ) ? $_item_object_data['menu-item-xfn'] : '' ), + ); + + $items_saved[] = wp_update_nav_menu_item( $menu_id, $_actual_db_id, $args ); + + } + } + return $items_saved; +} + +/** + * Adds custom arguments to some of the meta box object types. + * + * @since 3.0.0 + * + * @access private + * + * @param object $object The post type or taxonomy meta-object. + * @return object The post type of taxonomy object. + */ +function _wp_nav_menu_meta_box_object( $object = null ) { + if ( isset( $object->name ) ) { + + if ( 'page' == $object->name ) { + $object->_default_query = array( + 'orderby' => 'menu_order title', + 'post_status' => 'publish', + ); + + // posts should show only published items + } elseif ( 'post' == $object->name ) { + $object->_default_query = array( + 'post_status' => 'publish', + ); + + // cats should be in reverse chronological order + } elseif ( 'category' == $object->name ) { + $object->_default_query = array( + 'orderby' => 'id', + 'order' => 'DESC', + ); + + // custom post types should show only published items + } else { + $object->_default_query = array( + 'post_status' => 'publish', + ); + } + } + + return $object; +} + +/** + * Returns the menu formatted to edit. + * + * @since 3.0.0 + * + * @param string $menu_id The ID of the menu to format. + * @return string|WP_Error $output The menu formatted to edit or error object on failure. + */ +function wp_get_nav_menu_to_edit( $menu_id = 0 ) { + $menu = wp_get_nav_menu_object( $menu_id ); + + // If the menu exists, get its items. + if ( is_nav_menu( $menu ) ) { + $menu_items = wp_get_nav_menu_items( $menu->term_id, array('post_status' => 'any') ); + $result = '
    ' : '">'; + $result .= '

    ' . __('Select menu items (pages, categories, links) from the boxes at left to begin building your custom menu.') . '

    '; + $result .= '
    '; + + if( empty($menu_items) ) + return $result . ' '; + + $walker_class_name = apply_filters( 'wp_edit_nav_menu_walker', 'Walker_Nav_Menu_Edit', $menu_id ); + + if ( class_exists( $walker_class_name ) ) + $walker = new $walker_class_name; + else + return new WP_Error( 'menu_walker_not_exist', sprintf( __('The Walker class named %s does not exist.'), $walker_class_name ) ); + + $some_pending_menu_items = $some_invalid_menu_items = false; + foreach( (array) $menu_items as $menu_item ) { + if ( isset( $menu_item->post_status ) && 'draft' == $menu_item->post_status ) + $some_pending_menu_items = true; + if ( ! empty( $menu_item->_invalid ) ) + $some_invalid_menu_items = true; + } + + if ( $some_pending_menu_items ) + $result .= '

    ' . __('Click Save Menu to make pending menu items public.') . '

    '; + + if ( $some_invalid_menu_items ) + $result .= '

    ' . __('There are some invalid menu items. Please check or delete them.') . '

    '; + + $result .= ' '; + return $result; + } elseif ( is_wp_error( $menu ) ) { + return $menu; + } + + +} + +/** + * Returns the columns for the nav menus page. + * + * @since 3.0.0 + * + * @return string|WP_Error $output The menu formatted to edit or error object on failure. + */ +function wp_nav_menu_manage_columns() { + return array( + '_title' => __('Show advanced menu properties'), + 'cb' => '', + 'link-target' => __('Link Target'), + 'css-classes' => __('CSS Classes'), + 'xfn' => __('Link Relationship (XFN)'), + 'description' => __('Description'), + ); +} + +/** + * Deletes orphaned draft menu items + * + * @access private + * @since 3.0.0 + * + */ +function _wp_delete_orphaned_draft_menu_items() { + global $wpdb; + $delete_timestamp = time() - (60*60*24*EMPTY_TRASH_DAYS); + + // delete orphaned draft menu items + $menu_items_to_delete = $wpdb->get_col($wpdb->prepare("SELECT ID FROM $wpdb->posts AS p LEFT JOIN $wpdb->postmeta AS m ON p.ID = m.post_id WHERE post_type = 'nav_menu_item' AND post_status = 'draft' AND meta_key = '_menu_item_orphaned' AND meta_value < '%d'", $delete_timestamp ) ); + + foreach( (array) $menu_items_to_delete as $menu_item_id ) + wp_delete_post( $menu_item_id, true ); +} + +add_action('admin_head-nav-menus.php', '_wp_delete_orphaned_draft_menu_items'); + +?> diff --git a/src/wp-admin/includes/plugin-install.php b/src/wp-admin/includes/plugin-install.php new file mode 100644 index 0000000..ca3e1f5 --- /dev/null +++ b/src/wp-admin/includes/plugin-install.php @@ -0,0 +1,369 @@ +per_page) ) + $args->per_page = 24; + + // Allows a plugin to override the WordPress.org API entirely. + // Use the filter 'plugins_api_result' to mearly add results. + // Please ensure that a object is returned from the following filters. + $args = apply_filters('plugins_api_args', $args, $action); + $res = apply_filters('plugins_api', false, $action, $args); + + if ( false === $res ) { + $request = wp_remote_post('http://api.wordpress.org/plugins/info/1.0/', array( 'timeout' => 15, 'body' => array('action' => $action, 'request' => serialize($args))) ); + if ( is_wp_error($request) ) { + $res = new WP_Error('plugins_api_failed', __('An Unexpected HTTP Error occurred during the API request.'), $request->get_error_message() ); + } else { + $res = unserialize( wp_remote_retrieve_body( $request ) ); + if ( false === $res ) + $res = new WP_Error('plugins_api_failed', __('An unknown error occurred.'), wp_remote_retrieve_body( $request ) ); + } + } elseif ( !is_wp_error($res) ) { + $res->external = true; + } + + return apply_filters('plugins_api_result', $res, $action, $args); +} + +/** + * Retrieve popular WordPress plugin tags. + * + * @since 2.7.0 + * + * @param array $args + * @return array + */ +function install_popular_tags( $args = array() ) { + $key = md5(serialize($args)); + if ( false !== ($tags = get_site_transient('poptags_' . $key) ) ) + return $tags; + + $tags = plugins_api('hot_tags', $args); + + if ( is_wp_error($tags) ) + return $tags; + + set_site_transient('poptags_' . $key, $tags, 10800); // 3 * 60 * 60 = 10800 + + return $tags; +} + +function install_dashboard() { + ?> +

    WordPress Plugin Directory or upload a plugin in .zip format via this page.') ?>

    + +

    +

    + + +

    +

    + '; + if ( is_wp_error($api_tags) ) { + echo $api_tags->get_error_message(); + } else { + //Set up the tags in a way which can be interprated by wp_generate_tag_cloud() + $tags = array(); + foreach ( (array)$api_tags as $tag ) + $tags[ $tag['name'] ] = (object) array( + 'link' => esc_url( self_admin_url('plugin-install.php?tab=search&type=tag&s=' . urlencode($tag['name'])) ), + 'name' => $tag['name'], + 'id' => sanitize_title_with_dashes($tag['name']), + 'count' => $tag['count'] ); + echo wp_generate_tag_cloud($tags, array( 'single_text' => __('%d plugin'), 'multiple_text' => __('%d plugins') ) ); + } + echo '


    '; +} +add_action('install_plugins_dashboard', 'install_dashboard'); + +/** + * Display search form for searching plugins. + * + * @since 2.7.0 + */ +function install_search_form(){ + $type = isset($_REQUEST['type']) ? stripslashes( $_REQUEST['type'] ) : ''; + $term = isset($_REQUEST['s']) ? stripslashes( $_REQUEST['s'] ) : ''; + + ?>
    + + + + + +
    +

    +

    +
    + + + + +
    +display(); +} +add_action('install_plugins_search', 'display_plugins_table'); +add_action('install_plugins_featured', 'display_plugins_table'); +add_action('install_plugins_popular', 'display_plugins_table'); +add_action('install_plugins_new', 'display_plugins_table'); +add_action('install_plugins_updated', 'display_plugins_table'); + +/** + * Determine the status we can perform on a plugin. + * + * @since 3.0.0 + */ +function install_plugin_install_status($api, $loop = false) { + // this function is called recursivly, $loop prevents futhur loops. + if ( is_array($api) ) + $api = (object) $api; + + //Default to a "new" plugin + $status = 'install'; + $url = false; + + //Check to see if this plugin is known to be installed, and has an update awaiting it. + $update_plugins = get_site_transient('update_plugins'); + if ( is_object( $update_plugins ) ) { + foreach ( (array)$update_plugins->response as $file => $plugin ) { + if ( $plugin->slug === $api->slug ) { + $status = 'update_available'; + $update_file = $file; + $version = $plugin->new_version; + if ( current_user_can('update_plugins') ) + $url = wp_nonce_url(self_admin_url('update.php?action=upgrade-plugin&plugin=' . $update_file), 'upgrade-plugin_' . $update_file); + break; + } + } + } + + if ( 'install' == $status ) { + if ( is_dir( WP_PLUGIN_DIR . '/' . $api->slug ) ) { + $installed_plugin = get_plugins('/' . $api->slug); + if ( empty($installed_plugin) ) { + if ( current_user_can('install_plugins') ) + $url = wp_nonce_url(self_admin_url('update.php?action=install-plugin&plugin=' . $api->slug), 'install-plugin_' . $api->slug); + } else { + $key = array_shift( $key = array_keys($installed_plugin) ); //Use the first plugin regardless of the name, Could have issues for multiple-plugins in one directory if they share different version numbers + if ( version_compare($api->version, $installed_plugin[ $key ]['Version'], '=') ){ + $status = 'latest_installed'; + } elseif ( version_compare($api->version, $installed_plugin[ $key ]['Version'], '<') ) { + $status = 'newer_installed'; + $version = $installed_plugin[ $key ]['Version']; + } else { + //If the above update check failed, Then that probably means that the update checker has out-of-date information, force a refresh + if ( ! $loop ) { + delete_site_transient('update_plugins'); + wp_update_plugins(); + return install_plugin_install_status($api, true); + } + } + } + } else { + // "install" & no directory with that slug + if ( current_user_can('install_plugins') ) + $url = wp_nonce_url(self_admin_url('update.php?action=install-plugin&plugin=' . $api->slug), 'install-plugin_' . $api->slug); + } + } + if ( isset($_GET['from']) ) + $url .= '&from=' . urlencode(stripslashes($_GET['from'])); + + return compact('status', 'url', 'version'); +} + +/** + * Display plugin information in dialog box form. + * + * @since 2.7.0 + */ +function install_plugin_information() { + global $tab; + + $api = plugins_api('plugin_information', array('slug' => stripslashes( $_REQUEST['plugin'] ) )); + + if ( is_wp_error($api) ) + wp_die($api); + + $plugins_allowedtags = array('a' => array('href' => array(), 'title' => array(), 'target' => array()), + 'abbr' => array('title' => array()), 'acronym' => array('title' => array()), + 'code' => array(), 'pre' => array(), 'em' => array(), 'strong' => array(), + 'div' => array(), 'p' => array(), 'ul' => array(), 'ol' => array(), 'li' => array(), + 'h1' => array(), 'h2' => array(), 'h3' => array(), 'h4' => array(), 'h5' => array(), 'h6' => array(), + 'img' => array('src' => array(), 'class' => array(), 'alt' => array())); + //Sanitize HTML + foreach ( (array)$api->sections as $section_name => $content ) + $api->sections[$section_name] = wp_kses($content, $plugins_allowedtags); + foreach ( array('version', 'author', 'requires', 'tested', 'homepage', 'downloaded', 'slug') as $key ) + $api->$key = wp_kses($api->$key, $plugins_allowedtags); + + $section = isset($_REQUEST['section']) ? stripslashes( $_REQUEST['section'] ) : 'description'; //Default to the Description tab, Do not translate, API returns English. + if ( empty($section) || ! isset($api->sections[ $section ]) ) + $section = array_shift( $section_titles = array_keys((array)$api->sections) ); + + iframe_header( __('Plugin Install') ); + echo "
    \n"; + echo "
      \n"; + foreach ( (array)$api->sections as $section_name => $content ) { + + $title = $section_name; + $title = ucwords(str_replace('_', ' ', $title)); + + $class = ( $section_name == $section ) ? ' class="current"' : ''; + $href = add_query_arg( array('tab' => $tab, 'section' => $section_name) ); + $href = esc_url($href); + $san_title = esc_attr(sanitize_title_with_dashes($title)); + echo "\t
    • $title
    • \n"; + } + echo "
    \n"; + echo "
    \n"; + ?> +
    + download_link) && ( current_user_can('install_plugins') || current_user_can('update_plugins') ) ) : ?> +

    + ' . __('Install Now') . ''; + break; + case 'update_available': + if ( $status['url'] ) + echo '' . __('Install Update Now') .''; + break; + case 'newer_installed': + echo '' . sprintf(__('Newer Version (%s) Installed'), $status['version']) . ''; + break; + case 'latest_installed': + echo '' . __('Latest Version Installed') . ''; + break; + } + ?> +

    + +

    +
      +version) ) : ?> +
    • version ?>
    • +author) ) : ?> +
    • author, '_blank') ?>
    • +last_updated) ) : ?> +
    • last_updated)) ) ?>
    • +requires) ) : ?> +
    • requires) ?>
    • +tested) ) : ?> +
    • tested ?>
    • +downloaded) ) : ?> +
    • downloaded), number_format_i18n($api->downloaded)) ?>
    • +slug) && empty($api->external) ) : ?> +
    • +homepage) ) : ?> +
    • + +
    + rating) ) : ?> +

    +
    +
    +
    <?php _e('5 stars') ?>
    +
    <?php _e('4 stars') ?>
    +
    <?php _e('3 stars') ?>
    +
    <?php _e('2 stars') ?>
    +
    <?php _e('1 star') ?>
    +
    + num_ratings), number_format_i18n($api->num_ratings)); ?> + +
    +
    + tested) && version_compare( substr($GLOBALS['wp_version'], 0, strlen($api->tested)), $api->tested, '>') ) + echo '

    ' . __('Warning: This plugin has not been tested with your current version of WordPress.') . '

    '; + + else if ( !empty($api->requires) && version_compare( substr($GLOBALS['wp_version'], 0, strlen($api->requires)), $api->requires, '<') ) + echo '

    ' . __('Warning: This plugin has not been marked as compatible with your version of WordPress.') . '

    '; + + foreach ( (array)$api->sections as $section_name => $content ) { + $title = $section_name; + $title[0] = strtoupper($title[0]); + $title = str_replace('_', ' ', $title); + + $content = links_add_base_url($content, 'http://wordpress.org/extend/plugins/' . $api->slug . '/'); + $content = links_add_target($content, '_blank'); + + $san_title = esc_attr(sanitize_title_with_dashes($title)); + + $display = ( $section_name == $section ) ? 'block' : 'none'; + + echo "\t
    \n"; + echo "\t\t

    $title

    "; + echo $content; + echo "\t
    \n"; + } + echo "
    \n"; + + iframe_footer(); + exit; +} +add_action('install_plugins_pre_plugin-information', 'install_plugin_information'); diff --git a/src/wp-admin/includes/plugin.php b/src/wp-admin/includes/plugin.php new file mode 100644 index 0000000..be97e8c --- /dev/null +++ b/src/wp-admin/includes/plugin.php @@ -0,0 +1,1726 @@ + + * /* + * Plugin Name: Name of Plugin + * Plugin URI: Link to plugin information + * Description: Plugin Description + * Author: Plugin author's name + * Author URI: Link to the author's web site + * Version: Must be set in the plugin for WordPress 2.3+ + * Text Domain: Optional. Unique identifier, should be same as the one used in + * plugin_text_domain() + * Domain Path: Optional. Only useful if the translations are located in a + * folder above the plugin's base path. For example, if .mo files are + * located in the locale folder then Domain Path will be "/locale/" and + * must have the first slash. Defaults to the base folder the plugin is + * located in. + * Network: Optional. Specify "Network: true" to require that a plugin is activated + * across all sites in an installation. This will prevent a plugin from being + * activated on a single site when Multisite is enabled. + * * / # Remove the space to close comment + * + * + * Plugin data returned array contains the following: + * 'Name' - Name of the plugin, must be unique. + * 'Title' - Title of the plugin and the link to the plugin's web site. + * 'Description' - Description of what the plugin does and/or notes + * from the author. + * 'Author' - The author's name + * 'AuthorURI' - The authors web site address. + * 'Version' - The plugin version number. + * 'PluginURI' - Plugin web site address. + * 'TextDomain' - Plugin's text domain for localization. + * 'DomainPath' - Plugin's relative directory path to .mo files. + * 'Network' - Boolean. Whether the plugin can only be activated network wide. + * + * Some users have issues with opening large files and manipulating the contents + * for want is usually the first 1kiB or 2kiB. This function stops pulling in + * the plugin contents when it has all of the required plugin data. + * + * The first 8kiB of the file will be pulled in and if the plugin data is not + * within that first 8kiB, then the plugin author should correct their plugin + * and move the plugin data headers to the top. + * + * The plugin file is assumed to have permissions to allow for scripts to read + * the file. This is not checked however and the file is only opened for + * reading. + * + * @link http://trac.wordpress.org/ticket/5651 Previous Optimizations. + * @link http://trac.wordpress.org/ticket/7372 Further and better Optimizations. + * @since 1.5.0 + * + * @param string $plugin_file Path to the plugin file + * @param bool $markup If the returned data should have HTML markup applied + * @param bool $translate If the returned data should be translated + * @return array See above for description. + */ +function get_plugin_data( $plugin_file, $markup = true, $translate = true ) { + + $default_headers = array( + 'Name' => 'Plugin Name', + 'PluginURI' => 'Plugin URI', + 'Version' => 'Version', + 'Description' => 'Description', + 'Author' => 'Author', + 'AuthorURI' => 'Author URI', + 'TextDomain' => 'Text Domain', + 'DomainPath' => 'Domain Path', + 'Network' => 'Network', + // Site Wide Only is deprecated in favor of Network. + '_sitewide' => 'Site Wide Only', + ); + + $plugin_data = get_file_data( $plugin_file, $default_headers, 'plugin' ); + + // Site Wide Only is the old header for Network + if ( empty( $plugin_data['Network'] ) && ! empty( $plugin_data['_sitewide'] ) ) { + _deprecated_argument( __FUNCTION__, '3.0', sprintf( __( 'The %1$s plugin header is deprecated. Use %2$s instead.' ), 'Site Wide Only: true', 'Network: true' ) ); + $plugin_data['Network'] = $plugin_data['_sitewide']; + } + $plugin_data['Network'] = ( 'true' == strtolower( $plugin_data['Network'] ) ); + unset( $plugin_data['_sitewide'] ); + + //For backward compatibility by default Title is the same as Name. + $plugin_data['Title'] = $plugin_data['Name']; + + if ( $markup || $translate ) + $plugin_data = _get_plugin_data_markup_translate( $plugin_file, $plugin_data, $markup, $translate ); + else + $plugin_data['AuthorName'] = $plugin_data['Author']; + + return $plugin_data; +} + +function _get_plugin_data_markup_translate($plugin_file, $plugin_data, $markup = true, $translate = true) { + + //Translate fields + if ( $translate && ! empty($plugin_data['TextDomain']) ) { + if ( ! empty( $plugin_data['DomainPath'] ) ) + load_plugin_textdomain($plugin_data['TextDomain'], false, dirname($plugin_file). $plugin_data['DomainPath']); + else + load_plugin_textdomain($plugin_data['TextDomain'], false, dirname($plugin_file)); + + foreach ( array('Name', 'PluginURI', 'Description', 'Author', 'AuthorURI', 'Version') as $field ) + $plugin_data[ $field ] = translate($plugin_data[ $field ], $plugin_data['TextDomain']); + } + + $plugins_allowedtags = array( + 'a' => array( 'href' => array(), 'title' => array() ), + 'abbr' => array( 'title' => array() ), + 'acronym' => array( 'title' => array() ), + 'code' => array(), + 'em' => array(), + 'strong' => array(), + ); + + $plugin_data['AuthorName'] = $plugin_data['Author'] = wp_kses( $plugin_data['Author'], $plugins_allowedtags ); + + //Apply Markup + if ( $markup ) { + if ( ! empty($plugin_data['PluginURI']) && ! empty($plugin_data['Name']) ) + $plugin_data['Title'] = '' . $plugin_data['Name'] . ''; + else + $plugin_data['Title'] = $plugin_data['Name']; + + if ( ! empty($plugin_data['AuthorURI']) && ! empty($plugin_data['Author']) ) + $plugin_data['Author'] = '' . $plugin_data['Author'] . ''; + + $plugin_data['Description'] = wptexturize( $plugin_data['Description'] ); + if ( ! empty($plugin_data['Author']) ) + $plugin_data['Description'] .= ' ' . sprintf( __('By %s'), $plugin_data['Author'] ) . '.'; + } + + // Sanitize all displayed data. Author and AuthorName sanitized above. + $plugin_data['Title'] = wp_kses( $plugin_data['Title'], $plugins_allowedtags ); + $plugin_data['Version'] = wp_kses( $plugin_data['Version'], $plugins_allowedtags ); + $plugin_data['Description'] = wp_kses( $plugin_data['Description'], $plugins_allowedtags ); + $plugin_data['Name'] = wp_kses( $plugin_data['Name'], $plugins_allowedtags ); + + return $plugin_data; +} + +/** + * Get a list of a plugin's files. + * + * @since 2.8.0 + * + * @param string $plugin Plugin ID + * @return array List of files relative to the plugin root. + */ +function get_plugin_files($plugin) { + $plugin_file = WP_PLUGIN_DIR . '/' . $plugin; + $dir = dirname($plugin_file); + $plugin_files = array($plugin); + if ( is_dir($dir) && $dir != WP_PLUGIN_DIR ) { + $plugins_dir = @ opendir( $dir ); + if ( $plugins_dir ) { + while (($file = readdir( $plugins_dir ) ) !== false ) { + if ( substr($file, 0, 1) == '.' ) + continue; + if ( is_dir( $dir . '/' . $file ) ) { + $plugins_subdir = @ opendir( $dir . '/' . $file ); + if ( $plugins_subdir ) { + while (($subfile = readdir( $plugins_subdir ) ) !== false ) { + if ( substr($subfile, 0, 1) == '.' ) + continue; + $plugin_files[] = plugin_basename("$dir/$file/$subfile"); + } + @closedir( $plugins_subdir ); + } + } else { + if ( plugin_basename("$dir/$file") != $plugin ) + $plugin_files[] = plugin_basename("$dir/$file"); + } + } + @closedir( $plugins_dir ); + } + } + + return $plugin_files; +} + +/** + * Check the plugins directory and retrieve all plugin files with plugin data. + * + * WordPress only supports plugin files in the base plugins directory + * (wp-content/plugins) and in one directory above the plugins directory + * (wp-content/plugins/my-plugin). The file it looks for has the plugin data and + * must be found in those two locations. It is recommended that do keep your + * plugin files in directories. + * + * The file with the plugin data is the file that will be included and therefore + * needs to have the main execution for the plugin. This does not mean + * everything must be contained in the file and it is recommended that the file + * be split for maintainability. Keep everything in one file for extreme + * optimization purposes. + * + * @since 1.5.0 + * + * @param string $plugin_folder Optional. Relative path to single plugin folder. + * @return array Key is the plugin file path and the value is an array of the plugin data. + */ +function get_plugins($plugin_folder = '') { + + if ( ! $cache_plugins = wp_cache_get('plugins', 'plugins') ) + $cache_plugins = array(); + + if ( isset($cache_plugins[ $plugin_folder ]) ) + return $cache_plugins[ $plugin_folder ]; + + $wp_plugins = array (); + $plugin_root = WP_PLUGIN_DIR; + if ( !empty($plugin_folder) ) + $plugin_root .= $plugin_folder; + + // Files in wp-content/plugins directory + $plugins_dir = @ opendir( $plugin_root); + $plugin_files = array(); + if ( $plugins_dir ) { + while (($file = readdir( $plugins_dir ) ) !== false ) { + if ( substr($file, 0, 1) == '.' ) + continue; + if ( is_dir( $plugin_root.'/'.$file ) ) { + $plugins_subdir = @ opendir( $plugin_root.'/'.$file ); + if ( $plugins_subdir ) { + while (($subfile = readdir( $plugins_subdir ) ) !== false ) { + if ( substr($subfile, 0, 1) == '.' ) + continue; + if ( substr($subfile, -4) == '.php' ) + $plugin_files[] = "$file/$subfile"; + } + closedir( $plugins_subdir ); + } + } else { + if ( substr($file, -4) == '.php' ) + $plugin_files[] = $file; + } + } + closedir( $plugins_dir ); + } + + if ( empty($plugin_files) ) + return $wp_plugins; + + foreach ( $plugin_files as $plugin_file ) { + if ( !is_readable( "$plugin_root/$plugin_file" ) ) + continue; + + $plugin_data = get_plugin_data( "$plugin_root/$plugin_file", false, false ); //Do not apply markup/translate as it'll be cached. + + if ( empty ( $plugin_data['Name'] ) ) + continue; + + $wp_plugins[plugin_basename( $plugin_file )] = $plugin_data; + } + + uasort( $wp_plugins, '_sort_uname_callback' ); + + $cache_plugins[ $plugin_folder ] = $wp_plugins; + wp_cache_set('plugins', $cache_plugins, 'plugins'); + + return $wp_plugins; +} + +/** + * Check the mu-plugins directory and retrieve all mu-plugin files with any plugin data. + * + * WordPress only includes mu-plugin files in the base mu-plugins directory (wp-content/mu-plugins). + * + * @since 3.0.0 + * @return array Key is the mu-plugin file path and the value is an array of the mu-plugin data. + */ +function get_mu_plugins() { + $wp_plugins = array(); + // Files in wp-content/mu-plugins directory + $plugin_files = array(); + + if ( ! is_dir( WPMU_PLUGIN_DIR ) ) + return $wp_plugins; + if ( $plugins_dir = @ opendir( WPMU_PLUGIN_DIR ) ) { + while ( ( $file = readdir( $plugins_dir ) ) !== false ) { + if ( substr( $file, -4 ) == '.php' ) + $plugin_files[] = $file; + } + } else { + return $wp_plugins; + } + + @closedir( $plugins_dir ); + + if ( empty($plugin_files) ) + return $wp_plugins; + + foreach ( $plugin_files as $plugin_file ) { + if ( !is_readable( WPMU_PLUGIN_DIR . "/$plugin_file" ) ) + continue; + + $plugin_data = get_plugin_data( WPMU_PLUGIN_DIR . "/$plugin_file", false, false ); //Do not apply markup/translate as it'll be cached. + + if ( empty ( $plugin_data['Name'] ) ) + $plugin_data['Name'] = $plugin_file; + + $wp_plugins[ $plugin_file ] = $plugin_data; + } + + if ( isset( $wp_plugins['index.php'] ) && filesize( WPMU_PLUGIN_DIR . '/index.php') <= 30 ) // silence is golden + unset( $wp_plugins['index.php'] ); + + uasort( $wp_plugins, '_sort_uname_callback' ); + + return $wp_plugins; +} + +/** + * Callback to sort array by a 'Name' key. + * + * @since 3.1.0 + * @access private + */ +function _sort_uname_callback( $a, $b ) { + return strnatcasecmp( $a['Name'], $b['Name'] ); +} + +/** + * Check the wp-content directory and retrieve all drop-ins with any plugin data. + * + * @since 3.0.0 + * @return array Key is the file path and the value is an array of the plugin data. + */ +function get_dropins() { + $dropins = array(); + $plugin_files = array(); + + $_dropins = _get_dropins(); + + // These exist in the wp-content directory + if ( $plugins_dir = @ opendir( WP_CONTENT_DIR ) ) { + while ( ( $file = readdir( $plugins_dir ) ) !== false ) { + if ( isset( $_dropins[ $file ] ) ) + $plugin_files[] = $file; + } + } else { + return $dropins; + } + + @closedir( $plugins_dir ); + + if ( empty($plugin_files) ) + return $dropins; + + foreach ( $plugin_files as $plugin_file ) { + if ( !is_readable( WP_CONTENT_DIR . "/$plugin_file" ) ) + continue; + $plugin_data = get_plugin_data( WP_CONTENT_DIR . "/$plugin_file", false, false ); //Do not apply markup/translate as it'll be cached. + if ( empty( $plugin_data['Name'] ) ) + $plugin_data['Name'] = $plugin_file; + $dropins[ $plugin_file ] = $plugin_data; + } + + uksort( $dropins, 'strnatcasecmp' ); + + return $dropins; +} + +/** + * Returns drop-ins that WordPress uses. + * + * Includes Multisite drop-ins only when is_multisite() + * + * @since 3.0.0 + * @return array Key is file name. The value is an array, with the first value the + * purpose of the drop-in and the second value the name of the constant that must be + * true for the drop-in to be used, or true if no constant is required. + */ +function _get_dropins() { + $dropins = array( + 'advanced-cache.php' => array( __( 'Advanced caching plugin.' ), 'WP_CACHE' ), // WP_CACHE + 'db.php' => array( __( 'Custom database class.' ), true ), // auto on load + 'db-error.php' => array( __( 'Custom database error message.' ), true ), // auto on error + 'install.php' => array( __( 'Custom install script.' ), true ), // auto on install + 'maintenance.php' => array( __( 'Custom maintenance message.' ), true ), // auto on maintenance + 'object-cache.php' => array( __( 'External object cache.' ), true ), // auto on load + ); + + if ( is_multisite() ) { + $dropins['sunrise.php' ] = array( __( 'Executed before Multisite is loaded.' ), 'SUNRISE' ); // SUNRISE + $dropins['blog-deleted.php' ] = array( __( 'Custom site deleted message.' ), true ); // auto on deleted blog + $dropins['blog-inactive.php' ] = array( __( 'Custom site inactive message.' ), true ); // auto on inactive blog + $dropins['blog-suspended.php'] = array( __( 'Custom site suspended message.' ), true ); // auto on archived or spammed blog + } + + return $dropins; +} + +/** + * Check whether the plugin is active by checking the active_plugins list. + * + * @since 2.5.0 + * + * @param string $plugin Base plugin path from plugins directory. + * @return bool True, if in the active plugins list. False, not in the list. + */ +function is_plugin_active( $plugin ) { + return in_array( $plugin, (array) get_option( 'active_plugins', array() ) ) || is_plugin_active_for_network( $plugin ); +} + +/** + * Check whether the plugin is inactive. + * + * Reverse of is_plugin_active(). Used as a callback. + * + * @since 3.1.0 + * @see is_plugin_active() + * + * @param string $plugin Base plugin path from plugins directory. + * @return bool True if inactive. False if active. + */ +function is_plugin_inactive( $plugin ) { + return ! is_plugin_active( $plugin ); +} + +/** + * Check whether the plugin is active for the entire network. + * + * @since 3.0.0 + * + * @param string $plugin Base plugin path from plugins directory. + * @return bool True, if active for the network, otherwise false. + */ +function is_plugin_active_for_network( $plugin ) { + if ( !is_multisite() ) + return false; + + $plugins = get_site_option( 'active_sitewide_plugins'); + if ( isset($plugins[$plugin]) ) + return true; + + return false; +} + +/** + * Checks for "Network: true" in the plugin header to see if this should + * be activated only as a network wide plugin. The plugin would also work + * when Multisite is not enabled. + * + * Checks for "Site Wide Only: true" for backwards compatibility. + * + * @since 3.0.0 + * + * @param string $plugin Plugin to check + * @return bool True if plugin is network only, false otherwise. + */ +function is_network_only_plugin( $plugin ) { + $plugin_data = get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin ); + if ( $plugin_data ) + return $plugin_data['Network']; + return false; +} + +/** + * Attempts activation of plugin in a "sandbox" and redirects on success. + * + * A plugin that is already activated will not attempt to be activated again. + * + * The way it works is by setting the redirection to the error before trying to + * include the plugin file. If the plugin fails, then the redirection will not + * be overwritten with the success message. Also, the options will not be + * updated and the activation hook will not be called on plugin error. + * + * It should be noted that in no way the below code will actually prevent errors + * within the file. The code should not be used elsewhere to replicate the + * "sandbox", which uses redirection to work. + * {@source 13 1} + * + * If any errors are found or text is outputted, then it will be captured to + * ensure that the success redirection will update the error redirection. + * + * @since 2.5.0 + * + * @param string $plugin Plugin path to main plugin file with plugin data. + * @param string $redirect Optional. URL to redirect to. + * @param bool $network_wide Whether to enable the plugin for all sites in the + * network or just the current site. Multisite only. Default is false. + * @param bool $silent Prevent calling activation hooks. Optional, default is false. + * @return WP_Error|null WP_Error on invalid file or null on success. + */ +function activate_plugin( $plugin, $redirect = '', $network_wide = false, $silent = false ) { + $plugin = plugin_basename( trim( $plugin ) ); + + if ( is_multisite() && ( $network_wide || is_network_only_plugin($plugin) ) ) { + $network_wide = true; + $current = get_site_option( 'active_sitewide_plugins', array() ); + } else { + $current = get_option( 'active_plugins', array() ); + } + + $valid = validate_plugin($plugin); + if ( is_wp_error($valid) ) + return $valid; + + if ( !in_array($plugin, $current) ) { + if ( !empty($redirect) ) + wp_redirect(add_query_arg('_error_nonce', wp_create_nonce('plugin-activation-error_' . $plugin), $redirect)); // we'll override this later if the plugin can be included without fatal error + ob_start(); + include_once(WP_PLUGIN_DIR . '/' . $plugin); + + if ( ! $silent ) { + do_action( 'activate_plugin', $plugin, $network_wide ); + do_action( 'activate_' . $plugin, $network_wide ); + } + + if ( $network_wide ) { + $current[$plugin] = time(); + update_site_option( 'active_sitewide_plugins', $current ); + } else { + $current[] = $plugin; + sort($current); + update_option('active_plugins', $current); + } + + if ( ! $silent ) { + do_action( 'activated_plugin', $plugin, $network_wide ); + } + + if ( ob_get_length() > 0 ) { + $output = ob_get_clean(); + return new WP_Error('unexpected_output', __('The plugin generated unexpected output.'), $output); + } + ob_end_clean(); + } + + return null; +} + +/** + * Deactivate a single plugin or multiple plugins. + * + * The deactivation hook is disabled by the plugin upgrader by using the $silent + * parameter. + * + * @since 2.5.0 + * + * @param string|array $plugins Single plugin or list of plugins to deactivate. + * @param bool $silent Prevent calling deactivation hooks. Default is false. + */ +function deactivate_plugins( $plugins, $silent = false ) { + if ( is_multisite() ) + $network_current = get_site_option( 'active_sitewide_plugins', array() ); + $current = get_option( 'active_plugins', array() ); + $do_blog = $do_network = false; + + foreach ( (array) $plugins as $plugin ) { + $plugin = plugin_basename( trim( $plugin ) ); + if ( ! is_plugin_active($plugin) ) + continue; + + $network_wide = is_plugin_active_for_network( $plugin ); + + if ( ! $silent ) + do_action( 'deactivate_plugin', $plugin, $network_wide ); + + if ( $network_wide ) { + $do_network = true; + unset( $network_current[ $plugin ] ); + } else { + $key = array_search( $plugin, $current ); + if ( false !== $key ) { + $do_blog = true; + array_splice( $current, $key, 1 ); + } + } + + if ( ! $silent ) { + do_action( 'deactivate_' . $plugin, $network_wide ); + do_action( 'deactivated_plugin', $plugin, $network_wide ); + } + } + + if ( $do_blog ) + update_option('active_plugins', $current); + if ( $do_network ) + update_site_option( 'active_sitewide_plugins', $network_current ); +} + +/** + * Activate multiple plugins. + * + * When WP_Error is returned, it does not mean that one of the plugins had + * errors. It means that one or more of the plugins file path was invalid. + * + * The execution will be halted as soon as one of the plugins has an error. + * + * @since 2.6.0 + * + * @param string|array $plugins + * @param string $redirect Redirect to page after successful activation. + * @param bool $network_wide Whether to enable the plugin for all sites in the network. + * @param bool $silent Prevent calling activation hooks. Default is false. + * @return bool|WP_Error True when finished or WP_Error if there were errors during a plugin activation. + */ +function activate_plugins( $plugins, $redirect = '', $network_wide = false, $silent = false ) { + if ( !is_array($plugins) ) + $plugins = array($plugins); + + $errors = array(); + foreach ( $plugins as $plugin ) { + if ( !empty($redirect) ) + $redirect = add_query_arg('plugin', $plugin, $redirect); + $result = activate_plugin($plugin, $redirect, $network_wide, $silent); + if ( is_wp_error($result) ) + $errors[$plugin] = $result; + } + + if ( !empty($errors) ) + return new WP_Error('plugins_invalid', __('One of the plugins is invalid.'), $errors); + + return true; +} + +/** + * Remove directory and files of a plugin for a single or list of plugin(s). + * + * If the plugins parameter list is empty, false will be returned. True when + * completed. + * + * @since 2.6.0 + * + * @param array $plugins List of plugin + * @param string $redirect Redirect to page when complete. + * @return mixed + */ +function delete_plugins($plugins, $redirect = '' ) { + global $wp_filesystem; + + if ( empty($plugins) ) + return false; + + $checked = array(); + foreach( $plugins as $plugin ) + $checked[] = 'checked[]=' . $plugin; + + ob_start(); + $url = wp_nonce_url('plugins.php?action=delete-selected&verify-delete=1&' . implode('&', $checked), 'bulk-plugins'); + if ( false === ($credentials = request_filesystem_credentials($url)) ) { + $data = ob_get_contents(); + ob_end_clean(); + if ( ! empty($data) ){ + include_once( ABSPATH . 'wp-admin/admin-header.php'); + echo $data; + include( ABSPATH . 'wp-admin/admin-footer.php'); + exit; + } + return; + } + + if ( ! WP_Filesystem($credentials) ) { + request_filesystem_credentials($url, '', true); //Failed to connect, Error and request again + $data = ob_get_contents(); + ob_end_clean(); + if ( ! empty($data) ){ + include_once( ABSPATH . 'wp-admin/admin-header.php'); + echo $data; + include( ABSPATH . 'wp-admin/admin-footer.php'); + exit; + } + return; + } + + if ( ! is_object($wp_filesystem) ) + return new WP_Error('fs_unavailable', __('Could not access filesystem.')); + + if ( is_wp_error($wp_filesystem->errors) && $wp_filesystem->errors->get_error_code() ) + return new WP_Error('fs_error', __('Filesystem error.'), $wp_filesystem->errors); + + //Get the base plugin folder + $plugins_dir = $wp_filesystem->wp_plugins_dir(); + if ( empty($plugins_dir) ) + return new WP_Error('fs_no_plugins_dir', __('Unable to locate WordPress Plugin directory.')); + + $plugins_dir = trailingslashit( $plugins_dir ); + + $errors = array(); + + foreach( $plugins as $plugin_file ) { + // Run Uninstall hook + if ( is_uninstallable_plugin( $plugin_file ) ) + uninstall_plugin($plugin_file); + + $this_plugin_dir = trailingslashit( dirname($plugins_dir . $plugin_file) ); + // If plugin is in its own directory, recursively delete the directory. + if ( strpos($plugin_file, '/') && $this_plugin_dir != $plugins_dir ) //base check on if plugin includes directory separator AND that its not the root plugin folder + $deleted = $wp_filesystem->delete($this_plugin_dir, true); + else + $deleted = $wp_filesystem->delete($plugins_dir . $plugin_file); + + if ( ! $deleted ) + $errors[] = $plugin_file; + } + + if ( ! empty($errors) ) + return new WP_Error('could_not_remove_plugin', sprintf(__('Could not fully remove the plugin(s) %s.'), implode(', ', $errors)) ); + + // Force refresh of plugin update information + if ( $current = get_site_transient('update_plugins') ) { + unset( $current->response[ $plugin_file ] ); + set_site_transient('update_plugins', $current); + } + + return true; +} + +/** + * Validate active plugins + * + * Validate all active plugins, deactivates invalid and + * returns an array of deactivated ones. + * + * @since 2.5.0 + * @return array invalid plugins, plugin as key, error as value + */ +function validate_active_plugins() { + $plugins = get_option( 'active_plugins', array() ); + // validate vartype: array + if ( ! is_array( $plugins ) ) { + update_option( 'active_plugins', array() ); + $plugins = array(); + } + + if ( is_multisite() && is_super_admin() ) { + $network_plugins = (array) get_site_option( 'active_sitewide_plugins', array() ); + $plugins = array_merge( $plugins, array_keys( $network_plugins ) ); + } + + if ( empty( $plugins ) ) + return; + + $invalid = array(); + + // invalid plugins get deactivated + foreach ( $plugins as $plugin ) { + $result = validate_plugin( $plugin ); + if ( is_wp_error( $result ) ) { + $invalid[$plugin] = $result; + deactivate_plugins( $plugin, true ); + } + } + return $invalid; +} + +/** + * Validate the plugin path. + * + * Checks that the file exists and {@link validate_file() is valid file}. + * + * @since 2.5.0 + * + * @param string $plugin Plugin Path + * @return WP_Error|int 0 on success, WP_Error on failure. + */ +function validate_plugin($plugin) { + if ( validate_file($plugin) ) + return new WP_Error('plugin_invalid', __('Invalid plugin path.')); + if ( ! file_exists(WP_PLUGIN_DIR . '/' . $plugin) ) + return new WP_Error('plugin_not_found', __('Plugin file does not exist.')); + + $installed_plugins = get_plugins(); + if ( ! isset($installed_plugins[$plugin]) ) + return new WP_Error('no_plugin_header', __('The plugin does not have a valid header.')); + return 0; +} + +/** + * Whether the plugin can be uninstalled. + * + * @since 2.7.0 + * + * @param string $plugin Plugin path to check. + * @return bool Whether plugin can be uninstalled. + */ +function is_uninstallable_plugin($plugin) { + $file = plugin_basename($plugin); + + $uninstallable_plugins = (array) get_option('uninstall_plugins'); + if ( isset( $uninstallable_plugins[$file] ) || file_exists( WP_PLUGIN_DIR . '/' . dirname($file) . '/uninstall.php' ) ) + return true; + + return false; +} + +/** + * Uninstall a single plugin. + * + * Calls the uninstall hook, if it is available. + * + * @since 2.7.0 + * + * @param string $plugin Relative plugin path from Plugin Directory. + */ +function uninstall_plugin($plugin) { + $file = plugin_basename($plugin); + + $uninstallable_plugins = (array) get_option('uninstall_plugins'); + if ( file_exists( WP_PLUGIN_DIR . '/' . dirname($file) . '/uninstall.php' ) ) { + if ( isset( $uninstallable_plugins[$file] ) ) { + unset($uninstallable_plugins[$file]); + update_option('uninstall_plugins', $uninstallable_plugins); + } + unset($uninstallable_plugins); + + define('WP_UNINSTALL_PLUGIN', $file); + include WP_PLUGIN_DIR . '/' . dirname($file) . '/uninstall.php'; + + return true; + } + + if ( isset( $uninstallable_plugins[$file] ) ) { + $callable = $uninstallable_plugins[$file]; + unset($uninstallable_plugins[$file]); + update_option('uninstall_plugins', $uninstallable_plugins); + unset($uninstallable_plugins); + + include WP_PLUGIN_DIR . '/' . $file; + + add_action( 'uninstall_' . $file, $callable ); + do_action( 'uninstall_' . $file ); + } +} + +// +// Menu +// + +/** + * Add a top level menu page + * + * This function takes a capability which will be used to determine whether + * or not a page is included in the menu. + * + * The function which is hooked in to handle the output of the page must check + * that the user has the required capability as well. + * + * @param string $page_title The text to be displayed in the title tags of the page when the menu is selected + * @param string $menu_title The text to be used for the menu + * @param string $capability The capability required for this menu to be displayed to the user. + * @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu) + * @param callback $function The function to be called to output the content for this page. + * @param string $icon_url The url to the icon to be used for this menu + * @param int $position The position in the menu order this one should appear + * + * @return string The resulting page's hook_suffix + */ +function add_menu_page( $page_title, $menu_title, $capability, $menu_slug, $function = '', $icon_url = '', $position = NULL ) { + global $menu, $admin_page_hooks, $_registered_pages, $_parent_pages; + + $menu_slug = plugin_basename( $menu_slug ); + + $admin_page_hooks[$menu_slug] = sanitize_title( $menu_title ); + + $hookname = get_plugin_page_hookname( $menu_slug, '' ); + + if ( !empty( $function ) && !empty( $hookname ) && current_user_can( $capability ) ) + add_action( $hookname, $function ); + + if ( empty($icon_url) ) + $icon_url = esc_url( admin_url( 'images/generic.png' ) ); + elseif ( is_ssl() && 0 === strpos($icon_url, 'http://') ) + $icon_url = 'https://' . substr($icon_url, 7); + + $new_menu = array( $menu_title, $capability, $menu_slug, $page_title, 'menu-top ' . $hookname, $hookname, $icon_url ); + + if ( null === $position ) + $menu[] = $new_menu; + else + $menu[$position] = $new_menu; + + $_registered_pages[$hookname] = true; + + // No parent as top level + $_parent_pages[$menu_slug] = false; + + return $hookname; +} + +/** + * Add a top level menu page in the 'objects' section + * + * This function takes a capability which will be used to determine whether + * or not a page is included in the menu. + * + * The function which is hooked in to handle the output of the page must check + * that the user has the required capability as well. + * + * @param string $page_title The text to be displayed in the title tags of the page when the menu is selected + * @param string $menu_title The text to be used for the menu + * @param string $capability The capability required for this menu to be displayed to the user. + * @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu) + * @param callback $function The function to be called to output the content for this page. + * @param string $icon_url The url to the icon to be used for this menu + * + * @return string The resulting page's hook_suffix + */ +function add_object_page( $page_title, $menu_title, $capability, $menu_slug, $function = '', $icon_url = '') { + global $_wp_last_object_menu; + + $_wp_last_object_menu++; + + return add_menu_page($page_title, $menu_title, $capability, $menu_slug, $function, $icon_url, $_wp_last_object_menu); +} + +/** + * Add a top level menu page in the 'utility' section + * + * This function takes a capability which will be used to determine whether + * or not a page is included in the menu. + * + * The function which is hooked in to handle the output of the page must check + * that the user has the required capability as well. + * + * @param string $page_title The text to be displayed in the title tags of the page when the menu is selected + * @param string $menu_title The text to be used for the menu + * @param string $capability The capability required for this menu to be displayed to the user. + * @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu) + * @param callback $function The function to be called to output the content for this page. + * @param string $icon_url The url to the icon to be used for this menu + * + * @return string The resulting page's hook_suffix + */ +function add_utility_page( $page_title, $menu_title, $capability, $menu_slug, $function = '', $icon_url = '') { + global $_wp_last_utility_menu; + + $_wp_last_utility_menu++; + + return add_menu_page($page_title, $menu_title, $capability, $menu_slug, $function, $icon_url, $_wp_last_utility_menu); +} + +/** + * Add a sub menu page + * + * This function takes a capability which will be used to determine whether + * or not a page is included in the menu. + * + * The function which is hooked in to handle the output of the page must check + * that the user has the required capability as well. + * + * @param string $parent_slug The slug name for the parent menu (or the file name of a standard WordPress admin page) + * @param string $page_title The text to be displayed in the title tags of the page when the menu is selected + * @param string $menu_title The text to be used for the menu + * @param string $capability The capability required for this menu to be displayed to the user. + * @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu) + * @param callback $function The function to be called to output the content for this page. + * + * @return string|bool The resulting page's hook_suffix, or false if the user does not have the capability required. + */ +function add_submenu_page( $parent_slug, $page_title, $menu_title, $capability, $menu_slug, $function = '' ) { + global $submenu; + global $menu; + global $_wp_real_parent_file; + global $_wp_submenu_nopriv; + global $_registered_pages; + global $_parent_pages; + + $menu_slug = plugin_basename( $menu_slug ); + $parent_slug = plugin_basename( $parent_slug); + + if ( isset( $_wp_real_parent_file[$parent_slug] ) ) + $parent_slug = $_wp_real_parent_file[$parent_slug]; + + if ( !current_user_can( $capability ) ) { + $_wp_submenu_nopriv[$parent_slug][$menu_slug] = true; + return false; + } + + // If the parent doesn't already have a submenu, add a link to the parent + // as the first item in the submenu. If the submenu file is the same as the + // parent file someone is trying to link back to the parent manually. In + // this case, don't automatically add a link back to avoid duplication. + if (!isset( $submenu[$parent_slug] ) && $menu_slug != $parent_slug ) { + foreach ( (array)$menu as $parent_menu ) { + if ( $parent_menu[2] == $parent_slug && current_user_can( $parent_menu[1] ) ) + $submenu[$parent_slug][] = $parent_menu; + } + } + + $submenu[$parent_slug][] = array ( $menu_title, $capability, $menu_slug, $page_title ); + + $hookname = get_plugin_page_hookname( $menu_slug, $parent_slug); + if (!empty ( $function ) && !empty ( $hookname )) + add_action( $hookname, $function ); + + $_registered_pages[$hookname] = true; + // backwards-compatibility for plugins using add_management page. See wp-admin/admin.php for redirect from edit.php to tools.php + if ( 'tools.php' == $parent_slug ) + $_registered_pages[get_plugin_page_hookname( $menu_slug, 'edit.php')] = true; + + // No parent as top level + $_parent_pages[$menu_slug] = $parent_slug; + + return $hookname; +} + +/** + * Add sub menu page to the tools main menu. + * + * This function takes a capability which will be used to determine whether + * or not a page is included in the menu. + * + * The function which is hooked in to handle the output of the page must check + * that the user has the required capability as well. + * + * @param string $page_title The text to be displayed in the title tags of the page when the menu is selected + * @param string $menu_title The text to be used for the menu + * @param string $capability The capability required for this menu to be displayed to the user. + * @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu) + * @param callback $function The function to be called to output the content for this page. + * + * @return string|bool The resulting page's hook_suffix, or false if the user does not have the capability required. + */ +function add_management_page( $page_title, $menu_title, $capability, $menu_slug, $function = '' ) { + return add_submenu_page( 'tools.php', $page_title, $menu_title, $capability, $menu_slug, $function ); +} + +/** + * Add sub menu page to the options main menu. + * + * This function takes a capability which will be used to determine whether + * or not a page is included in the menu. + * + * The function which is hooked in to handle the output of the page must check + * that the user has the required capability as well. + * + * @param string $page_title The text to be displayed in the title tags of the page when the menu is selected + * @param string $menu_title The text to be used for the menu + * @param string $capability The capability required for this menu to be displayed to the user. + * @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu) + * @param callback $function The function to be called to output the content for this page. + * + * @return string|bool The resulting page's hook_suffix, or false if the user does not have the capability required. + */ +function add_options_page( $page_title, $menu_title, $capability, $menu_slug, $function = '' ) { + return add_submenu_page( 'options-general.php', $page_title, $menu_title, $capability, $menu_slug, $function ); +} + +/** + * Add sub menu page to the themes main menu. + * + * This function takes a capability which will be used to determine whether + * or not a page is included in the menu. + * + * The function which is hooked in to handle the output of the page must check + * that the user has the required capability as well. + * + * @param string $page_title The text to be displayed in the title tags of the page when the menu is selected + * @param string $menu_title The text to be used for the menu + * @param string $capability The capability required for this menu to be displayed to the user. + * @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu) + * @param callback $function The function to be called to output the content for this page. + * + * @return string|bool The resulting page's hook_suffix, or false if the user does not have the capability required. + */ +function add_theme_page( $page_title, $menu_title, $capability, $menu_slug, $function = '' ) { + return add_submenu_page( 'themes.php', $page_title, $menu_title, $capability, $menu_slug, $function ); +} + +/** + * Add sub menu page to the plugins main menu. + * + * This function takes a capability which will be used to determine whether + * or not a page is included in the menu. + * + * The function which is hooked in to handle the output of the page must check + * that the user has the required capability as well. + * + * @param string $page_title The text to be displayed in the title tags of the page when the menu is selected + * @param string $menu_title The text to be used for the menu + * @param string $capability The capability required for this menu to be displayed to the user. + * @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu) + * @param callback $function The function to be called to output the content for this page. + * + * @return string|bool The resulting page's hook_suffix, or false if the user does not have the capability required. + */ +function add_plugins_page( $page_title, $menu_title, $capability, $menu_slug, $function = '' ) { + return add_submenu_page( 'plugins.php', $page_title, $menu_title, $capability, $menu_slug, $function ); +} + +/** + * Add sub menu page to the Users/Profile main menu. + * + * This function takes a capability which will be used to determine whether + * or not a page is included in the menu. + * + * The function which is hooked in to handle the output of the page must check + * that the user has the required capability as well. + * + * @param string $page_title The text to be displayed in the title tags of the page when the menu is selected + * @param string $menu_title The text to be used for the menu + * @param string $capability The capability required for this menu to be displayed to the user. + * @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu) + * @param callback $function The function to be called to output the content for this page. + * + * @return string|bool The resulting page's hook_suffix, or false if the user does not have the capability required. + */ +function add_users_page( $page_title, $menu_title, $capability, $menu_slug, $function = '' ) { + if ( current_user_can('edit_users') ) + $parent = 'users.php'; + else + $parent = 'profile.php'; + return add_submenu_page( $parent, $page_title, $menu_title, $capability, $menu_slug, $function ); +} +/** + * Add sub menu page to the Dashboard main menu. + * + * This function takes a capability which will be used to determine whether + * or not a page is included in the menu. + * + * The function which is hooked in to handle the output of the page must check + * that the user has the required capability as well. + * + * @param string $page_title The text to be displayed in the title tags of the page when the menu is selected + * @param string $menu_title The text to be used for the menu + * @param string $capability The capability required for this menu to be displayed to the user. + * @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu) + * @param callback $function The function to be called to output the content for this page. + * + * @return string|bool The resulting page's hook_suffix, or false if the user does not have the capability required. + */ +function add_dashboard_page( $page_title, $menu_title, $capability, $menu_slug, $function = '' ) { + return add_submenu_page( 'index.php', $page_title, $menu_title, $capability, $menu_slug, $function ); +} + +/** + * Add sub menu page to the posts main menu. + * + * This function takes a capability which will be used to determine whether + * or not a page is included in the menu. + * + * The function which is hooked in to handle the output of the page must check + * that the user has the required capability as well. + * + * @param string $page_title The text to be displayed in the title tags of the page when the menu is selected + * @param string $menu_title The text to be used for the menu + * @param string $capability The capability required for this menu to be displayed to the user. + * @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu) + * @param callback $function The function to be called to output the content for this page. + * + * @return string|bool The resulting page's hook_suffix, or false if the user does not have the capability required. + */ +function add_posts_page( $page_title, $menu_title, $capability, $menu_slug, $function = '' ) { + return add_submenu_page( 'edit.php', $page_title, $menu_title, $capability, $menu_slug, $function ); +} + +/** + * Add sub menu page to the media main menu. + * + * This function takes a capability which will be used to determine whether + * or not a page is included in the menu. + * + * The function which is hooked in to handle the output of the page must check + * that the user has the required capability as well. + * + * @param string $page_title The text to be displayed in the title tags of the page when the menu is selected + * @param string $menu_title The text to be used for the menu + * @param string $capability The capability required for this menu to be displayed to the user. + * @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu) + * @param callback $function The function to be called to output the content for this page. + * + * @return string|bool The resulting page's hook_suffix, or false if the user does not have the capability required. + */ +function add_media_page( $page_title, $menu_title, $capability, $menu_slug, $function = '' ) { + return add_submenu_page( 'upload.php', $page_title, $menu_title, $capability, $menu_slug, $function ); +} + +/** + * Add sub menu page to the links main menu. + * + * This function takes a capability which will be used to determine whether + * or not a page is included in the menu. + * + * The function which is hooked in to handle the output of the page must check + * that the user has the required capability as well. + * + * @param string $page_title The text to be displayed in the title tags of the page when the menu is selected + * @param string $menu_title The text to be used for the menu + * @param string $capability The capability required for this menu to be displayed to the user. + * @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu) + * @param callback $function The function to be called to output the content for this page. + * + * @return string|bool The resulting page's hook_suffix, or false if the user does not have the capability required. + */ +function add_links_page( $page_title, $menu_title, $capability, $menu_slug, $function = '' ) { + return add_submenu_page( 'link-manager.php', $page_title, $menu_title, $capability, $menu_slug, $function ); +} + +/** + * Add sub menu page to the pages main menu. + * + * This function takes a capability which will be used to determine whether + * or not a page is included in the menu. + * + * The function which is hooked in to handle the output of the page must check + * that the user has the required capability as well. + * + * @param string $page_title The text to be displayed in the title tags of the page when the menu is selected + * @param string $menu_title The text to be used for the menu + * @param string $capability The capability required for this menu to be displayed to the user. + * @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu) + * @param callback $function The function to be called to output the content for this page. + * + * @return string|bool The resulting page's hook_suffix, or false if the user does not have the capability required. +*/ +function add_pages_page( $page_title, $menu_title, $capability, $menu_slug, $function = '' ) { + return add_submenu_page( 'edit.php?post_type=page', $page_title, $menu_title, $capability, $menu_slug, $function ); +} + +/** + * Add sub menu page to the comments main menu. + * + * This function takes a capability which will be used to determine whether + * or not a page is included in the menu. + * + * The function which is hooked in to handle the output of the page must check + * that the user has the required capability as well. + * + * @param string $page_title The text to be displayed in the title tags of the page when the menu is selected + * @param string $menu_title The text to be used for the menu + * @param string $capability The capability required for this menu to be displayed to the user. + * @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu) + * @param callback $function The function to be called to output the content for this page. + * + * @return string|bool The resulting page's hook_suffix, or false if the user does not have the capability required. +*/ +function add_comments_page( $page_title, $menu_title, $capability, $menu_slug, $function = '' ) { + return add_submenu_page( 'edit-comments.php', $page_title, $menu_title, $capability, $menu_slug, $function ); +} + + +/** + * Remove a top level admin menu + * + * @since 3.1.0 + * + * @param string $menu_slug The slug of the menu + * @return array|bool The removed menu on success, False if not found + */ +function remove_menu_page( $menu_slug ) { + global $menu; + + foreach ( $menu as $i => $item ) { + if ( $menu_slug == $item[2] ) { + unset( $menu[$i] ); + return $item; + } + } + + return false; +} + +/** + * Remove an admin submenu + * + * @since 3.1.0 + * + * @param string $menu_slug The slug for the parent menu + * @param string $submenu_slug The slug of the submenu + * @return array|bool The removed submenu on success, False if not found + */ +function remove_submenu_page( $menu_slug, $submenu_slug ) { + global $submenu; + + if ( !isset( $submenu[$menu_slug] ) ) + return false; + + foreach ( $submenu[$menu_slug] as $i => $item ) { + if ( $submenu_slug == $item[2] ) { + unset( $submenu[$menu_slug][$i] ); + return $item; + } + } + + return false; +} + +/** + * Get the url to access a particular menu page based on the slug it was registered with. + * + * If the slug hasn't been registered properly no url will be returned + * + * @since 3.0 + * + * @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu) + * @param bool $echo Whether or not to echo the url - default is true + * @return string the url + */ +function menu_page_url($menu_slug, $echo = true) { + global $_parent_pages; + + if ( isset( $_parent_pages[$menu_slug] ) ) { + $parent_slug = $_parent_pages[$menu_slug]; + if ( $parent_slug && ! isset( $_parent_pages[$parent_slug] ) ) { + $url = admin_url( add_query_arg( 'page', $menu_slug, $parent_slug ) ); + } else { + $url = admin_url( 'admin.php?page=' . $menu_slug ); + } + } else { + $url = ''; + } + + $url = esc_url($url); + + if ( $echo ) + echo $url; + + return $url; +} + +// +// Pluggable Menu Support -- Private +// + +function get_admin_page_parent( $parent = '' ) { + global $parent_file; + global $menu; + global $submenu; + global $pagenow; + global $typenow; + global $plugin_page; + global $_wp_real_parent_file; + global $_wp_menu_nopriv; + global $_wp_submenu_nopriv; + + if ( !empty ( $parent ) && 'admin.php' != $parent ) { + if ( isset( $_wp_real_parent_file[$parent] ) ) + $parent = $_wp_real_parent_file[$parent]; + return $parent; + } + + /* + if ( !empty ( $parent_file ) ) { + if ( isset( $_wp_real_parent_file[$parent_file] ) ) + $parent_file = $_wp_real_parent_file[$parent_file]; + + return $parent_file; + } + */ + + if ( $pagenow == 'admin.php' && isset( $plugin_page ) ) { + foreach ( (array)$menu as $parent_menu ) { + if ( $parent_menu[2] == $plugin_page ) { + $parent_file = $plugin_page; + if ( isset( $_wp_real_parent_file[$parent_file] ) ) + $parent_file = $_wp_real_parent_file[$parent_file]; + return $parent_file; + } + } + if ( isset( $_wp_menu_nopriv[$plugin_page] ) ) { + $parent_file = $plugin_page; + if ( isset( $_wp_real_parent_file[$parent_file] ) ) + $parent_file = $_wp_real_parent_file[$parent_file]; + return $parent_file; + } + } + + if ( isset( $plugin_page ) && isset( $_wp_submenu_nopriv[$pagenow][$plugin_page] ) ) { + $parent_file = $pagenow; + if ( isset( $_wp_real_parent_file[$parent_file] ) ) + $parent_file = $_wp_real_parent_file[$parent_file]; + return $parent_file; + } + + foreach (array_keys( (array)$submenu ) as $parent) { + foreach ( $submenu[$parent] as $submenu_array ) { + if ( isset( $_wp_real_parent_file[$parent] ) ) + $parent = $_wp_real_parent_file[$parent]; + if ( !empty($typenow) && ($submenu_array[2] == "$pagenow?post_type=$typenow") ) { + $parent_file = $parent; + return $parent; + } elseif ( $submenu_array[2] == $pagenow && empty($typenow) && ( empty($parent_file) || false === strpos($parent_file, '?') ) ) { + $parent_file = $parent; + return $parent; + } else + if ( isset( $plugin_page ) && ($plugin_page == $submenu_array[2] ) ) { + $parent_file = $parent; + return $parent; + } + } + } + + if ( empty($parent_file) ) + $parent_file = ''; + return ''; +} + +function get_admin_page_title() { + global $title; + global $menu; + global $submenu; + global $pagenow; + global $plugin_page; + global $typenow; + + if ( ! empty ( $title ) ) + return $title; + + $hook = get_plugin_page_hook( $plugin_page, $pagenow ); + + $parent = $parent1 = get_admin_page_parent(); + + if ( empty ( $parent) ) { + foreach ( (array)$menu as $menu_array ) { + if ( isset( $menu_array[3] ) ) { + if ( $menu_array[2] == $pagenow ) { + $title = $menu_array[3]; + return $menu_array[3]; + } else + if ( isset( $plugin_page ) && ($plugin_page == $menu_array[2] ) && ($hook == $menu_array[3] ) ) { + $title = $menu_array[3]; + return $menu_array[3]; + } + } else { + $title = $menu_array[0]; + return $title; + } + } + } else { + foreach ( array_keys( $submenu ) as $parent ) { + foreach ( $submenu[$parent] as $submenu_array ) { + if ( isset( $plugin_page ) && + ( $plugin_page == $submenu_array[2] ) && + ( + ( $parent == $pagenow ) || + ( $parent == $plugin_page ) || + ( $plugin_page == $hook ) || + ( $pagenow == 'admin.php' && $parent1 != $submenu_array[2] ) || + ( !empty($typenow) && $parent == $pagenow . '?post_type=' . $typenow) + ) + ) { + $title = $submenu_array[3]; + return $submenu_array[3]; + } + + if ( $submenu_array[2] != $pagenow || isset( $_GET['page'] ) ) // not the current page + continue; + + if ( isset( $submenu_array[3] ) ) { + $title = $submenu_array[3]; + return $submenu_array[3]; + } else { + $title = $submenu_array[0]; + return $title; + } + } + } + if ( empty ( $title ) ) { + foreach ( $menu as $menu_array ) { + if ( isset( $plugin_page ) && + ( $plugin_page == $menu_array[2] ) && + ( $pagenow == 'admin.php' ) && + ( $parent1 == $menu_array[2] ) ) + { + $title = $menu_array[3]; + return $menu_array[3]; + } + } + } + } + + return $title; +} + +function get_plugin_page_hook( $plugin_page, $parent_page ) { + $hook = get_plugin_page_hookname( $plugin_page, $parent_page ); + if ( has_action($hook) ) + return $hook; + else + return null; +} + +function get_plugin_page_hookname( $plugin_page, $parent_page ) { + global $admin_page_hooks; + + $parent = get_admin_page_parent( $parent_page ); + + $page_type = 'admin'; + if ( empty ( $parent_page ) || 'admin.php' == $parent_page || isset( $admin_page_hooks[$plugin_page] ) ) { + if ( isset( $admin_page_hooks[$plugin_page] ) ) + $page_type = 'toplevel'; + else + if ( isset( $admin_page_hooks[$parent] )) + $page_type = $admin_page_hooks[$parent]; + } else if ( isset( $admin_page_hooks[$parent] ) ) { + $page_type = $admin_page_hooks[$parent]; + } + + $plugin_name = preg_replace( '!\.php!', '', $plugin_page ); + + return $page_type . '_page_' . $plugin_name; +} + +function user_can_access_admin_page() { + global $pagenow; + global $menu; + global $submenu; + global $_wp_menu_nopriv; + global $_wp_submenu_nopriv; + global $plugin_page; + global $_registered_pages; + + $parent = get_admin_page_parent(); + + if ( !isset( $plugin_page ) && isset( $_wp_submenu_nopriv[$parent][$pagenow] ) ) + return false; + + if ( isset( $plugin_page ) ) { + if ( isset( $_wp_submenu_nopriv[$parent][$plugin_page] ) ) + return false; + + $hookname = get_plugin_page_hookname($plugin_page, $parent); + + if ( !isset($_registered_pages[$hookname]) ) + return false; + } + + if ( empty( $parent) ) { + if ( isset( $_wp_menu_nopriv[$pagenow] ) ) + return false; + if ( isset( $_wp_submenu_nopriv[$pagenow][$pagenow] ) ) + return false; + if ( isset( $plugin_page ) && isset( $_wp_submenu_nopriv[$pagenow][$plugin_page] ) ) + return false; + if ( isset( $plugin_page ) && isset( $_wp_menu_nopriv[$plugin_page] ) ) + return false; + foreach (array_keys( $_wp_submenu_nopriv ) as $key ) { + if ( isset( $_wp_submenu_nopriv[$key][$pagenow] ) ) + return false; + if ( isset( $plugin_page ) && isset( $_wp_submenu_nopriv[$key][$plugin_page] ) ) + return false; + } + return true; + } + + if ( isset( $plugin_page ) && ( $plugin_page == $parent ) && isset( $_wp_menu_nopriv[$plugin_page] ) ) + return false; + + if ( isset( $submenu[$parent] ) ) { + foreach ( $submenu[$parent] as $submenu_array ) { + if ( isset( $plugin_page ) && ( $submenu_array[2] == $plugin_page ) ) { + if ( current_user_can( $submenu_array[1] )) + return true; + else + return false; + } else if ( $submenu_array[2] == $pagenow ) { + if ( current_user_can( $submenu_array[1] )) + return true; + else + return false; + } + } + } + + foreach ( $menu as $menu_array ) { + if ( $menu_array[2] == $parent) { + if ( current_user_can( $menu_array[1] )) + return true; + else + return false; + } + } + + return true; +} + +/* Whitelist functions */ + +/** + * Register a setting and its sanitization callback + * + * @since 2.7.0 + * + * @param string $option_group A settings group name. Should correspond to a whitelisted option key name. + * Default whitelisted option key names include "general," "discussion," and "reading," among others. + * @param string $option_name The name of an option to sanitize and save. + * @param unknown_type $sanitize_callback A callback function that sanitizes the option's value. + * @return unknown + */ +function register_setting( $option_group, $option_name, $sanitize_callback = '' ) { + global $new_whitelist_options; + + if ( 'misc' == $option_group ) { + _deprecated_argument( __FUNCTION__, '3.0', __( 'The miscellaneous options group has been removed. Use another settings group.' ) ); + $option_group = 'general'; + } + + $new_whitelist_options[ $option_group ][] = $option_name; + if ( $sanitize_callback != '' ) + add_filter( "sanitize_option_{$option_name}", $sanitize_callback ); +} + +/** + * Unregister a setting + * + * @since 2.7.0 + * + * @param unknown_type $option_group + * @param unknown_type $option_name + * @param unknown_type $sanitize_callback + * @return unknown + */ +function unregister_setting( $option_group, $option_name, $sanitize_callback = '' ) { + global $new_whitelist_options; + + if ( 'misc' == $option_group ) { + _deprecated_argument( __FUNCTION__, '3.0', __( 'The miscellaneous options group has been removed. Use another settings group.' ) ); + $option_group = 'general'; + } + + $pos = array_search( $option_name, (array) $new_whitelist_options ); + if ( $pos !== false ) + unset( $new_whitelist_options[ $option_group ][ $pos ] ); + if ( $sanitize_callback != '' ) + remove_filter( "sanitize_option_{$option_name}", $sanitize_callback ); +} + +/** + * {@internal Missing Short Description}} + * + * @since 2.7.0 + * + * @param unknown_type $options + * @return unknown + */ +function option_update_filter( $options ) { + global $new_whitelist_options; + + if ( is_array( $new_whitelist_options ) ) + $options = add_option_whitelist( $new_whitelist_options, $options ); + + return $options; +} +add_filter( 'whitelist_options', 'option_update_filter' ); + +/** + * {@internal Missing Short Description}} + * + * @since 2.7.0 + * + * @param unknown_type $new_options + * @param unknown_type $options + * @return unknown + */ +function add_option_whitelist( $new_options, $options = '' ) { + if ( $options == '' ) + global $whitelist_options; + else + $whitelist_options = $options; + + foreach ( $new_options as $page => $keys ) { + foreach ( $keys as $key ) { + if ( !isset($whitelist_options[ $page ]) || !is_array($whitelist_options[ $page ]) ) { + $whitelist_options[ $page ] = array(); + $whitelist_options[ $page ][] = $key; + } else { + $pos = array_search( $key, $whitelist_options[ $page ] ); + if ( $pos === false ) + $whitelist_options[ $page ][] = $key; + } + } + } + + return $whitelist_options; +} + +/** + * {@internal Missing Short Description}} + * + * @since 2.7.0 + * + * @param unknown_type $del_options + * @param unknown_type $options + * @return unknown + */ +function remove_option_whitelist( $del_options, $options = '' ) { + if ( $options == '' ) + global $whitelist_options; + else + $whitelist_options = $options; + + foreach ( $del_options as $page => $keys ) { + foreach ( $keys as $key ) { + if ( isset($whitelist_options[ $page ]) && is_array($whitelist_options[ $page ]) ) { + $pos = array_search( $key, $whitelist_options[ $page ] ); + if ( $pos !== false ) + unset( $whitelist_options[ $page ][ $pos ] ); + } + } + } + + return $whitelist_options; +} + +/** + * Output nonce, action, and option_page fields for a settings page. + * + * @since 2.7.0 + * + * @param string $option_group A settings group name. This should match the group name used in register_setting(). + */ +function settings_fields($option_group) { + echo ""; + echo ''; + wp_nonce_field("$option_group-options"); +} + +?> diff --git a/src/wp-admin/includes/post.php b/src/wp-admin/includes/post.php new file mode 100644 index 0000000..d65e0e2 --- /dev/null +++ b/src/wp-admin/includes/post.php @@ -0,0 +1,1864 @@ +cap->edit_others_posts ) ) { + if ( 'page' == $post_data['post_type'] ) { + return new WP_Error( 'edit_others_pages', $update ? + __( 'You are not allowed to edit pages as this user.' ) : + __( 'You are not allowed to create pages as this user.' ) + ); + } else { + return new WP_Error( 'edit_others_posts', $update ? + __( 'You are not allowed to edit posts as this user.' ) : + __( 'You are not allowed to post as this user.' ) + ); + } + } + } + + // What to do based on which button they pressed + if ( isset($post_data['saveasdraft']) && '' != $post_data['saveasdraft'] ) + $post_data['post_status'] = 'draft'; + if ( isset($post_data['saveasprivate']) && '' != $post_data['saveasprivate'] ) + $post_data['post_status'] = 'private'; + if ( isset($post_data['publish']) && ( '' != $post_data['publish'] ) && ( !isset($post_data['post_status']) || $post_data['post_status'] != 'private' ) ) + $post_data['post_status'] = 'publish'; + if ( isset($post_data['advanced']) && '' != $post_data['advanced'] ) + $post_data['post_status'] = 'draft'; + if ( isset($post_data['pending']) && '' != $post_data['pending'] ) + $post_data['post_status'] = 'pending'; + + if ( isset( $post_data['ID'] ) ) + $post_id = $post_data['ID']; + else + $post_id = false; + $previous_status = $post_id ? get_post_field( 'post_status', $post_id ) : false; + + // Posts 'submitted for approval' present are submitted to $_POST the same as if they were being published. + // Change status from 'publish' to 'pending' if user lacks permissions to publish or to resave published posts. + if ( isset($post_data['post_status']) && ('publish' == $post_data['post_status'] && !current_user_can( $ptype->cap->publish_posts )) ) + if ( $previous_status != 'publish' || !current_user_can( 'edit_post', $post_id ) ) + $post_data['post_status'] = 'pending'; + + if ( ! isset($post_data['post_status']) ) + $post_data['post_status'] = $previous_status; + + if (!isset( $post_data['comment_status'] )) + $post_data['comment_status'] = 'closed'; + + if (!isset( $post_data['ping_status'] )) + $post_data['ping_status'] = 'closed'; + + foreach ( array('aa', 'mm', 'jj', 'hh', 'mn') as $timeunit ) { + if ( !empty( $post_data['hidden_' . $timeunit] ) && $post_data['hidden_' . $timeunit] != $post_data[$timeunit] ) { + $post_data['edit_date'] = '1'; + break; + } + } + + if ( !empty( $post_data['edit_date'] ) ) { + $aa = $post_data['aa']; + $mm = $post_data['mm']; + $jj = $post_data['jj']; + $hh = $post_data['hh']; + $mn = $post_data['mn']; + $ss = $post_data['ss']; + $aa = ($aa <= 0 ) ? date('Y') : $aa; + $mm = ($mm <= 0 ) ? date('n') : $mm; + $jj = ($jj > 31 ) ? 31 : $jj; + $jj = ($jj <= 0 ) ? date('j') : $jj; + $hh = ($hh > 23 ) ? $hh -24 : $hh; + $mn = ($mn > 59 ) ? $mn -60 : $mn; + $ss = ($ss > 59 ) ? $ss -60 : $ss; + $post_data['post_date'] = sprintf( "%04d-%02d-%02d %02d:%02d:%02d", $aa, $mm, $jj, $hh, $mn, $ss ); + $post_data['post_date_gmt'] = get_gmt_from_date( $post_data['post_date'] ); + } + + return $post_data; +} + +/** + * Update an existing post with values provided in $_POST. + * + * @since 1.5.0 + * + * @param array $post_data Optional. + * @return int Post ID. + */ +function edit_post( $post_data = null ) { + + if ( empty($post_data) ) + $post_data = &$_POST; + + // Clear out any data in internal vars. + unset( $post_data['filter'] ); + + $post_ID = (int) $post_data['post_ID']; + $post = get_post( $post_ID ); + $post_data['post_type'] = $post->post_type; + $post_data['post_mime_type'] = $post->post_mime_type; + + $ptype = get_post_type_object($post_data['post_type']); + if ( !current_user_can( $ptype->cap->edit_post, $post_ID ) ) { + if ( 'page' == $post_data['post_type'] ) + wp_die( __('You are not allowed to edit this page.' )); + else + wp_die( __('You are not allowed to edit this post.' )); + } + + // Autosave shouldn't save too soon after a real save + if ( 'autosave' == $post_data['action'] ) { + $post =& get_post( $post_ID ); + $now = time(); + $then = strtotime($post->post_date_gmt . ' +0000'); + $delta = AUTOSAVE_INTERVAL / 2; + if ( ($now - $then) < $delta ) + return $post_ID; + } + + $post_data = _wp_translate_postdata( true, $post_data ); + if ( is_wp_error($post_data) ) + wp_die( $post_data->get_error_message() ); + if ( 'autosave' != $post_data['action'] && 'auto-draft' == $post_data['post_status'] ) + $post_data['post_status'] = 'draft'; + + if ( isset($post_data['visibility']) ) { + switch ( $post_data['visibility'] ) { + case 'public' : + $post_data['post_password'] = ''; + break; + case 'password' : + unset( $post_data['sticky'] ); + break; + case 'private' : + $post_data['post_status'] = 'private'; + $post_data['post_password'] = ''; + unset( $post_data['sticky'] ); + break; + } + } + + // Post Formats + if ( current_theme_supports( 'post-formats' ) && isset( $post_data['post_format'] ) ) { + $formats = get_theme_support( 'post-formats' ); + if ( is_array( $formats ) ) { + $formats = $formats[0]; + if ( in_array( $post_data['post_format'], $formats ) ) { + set_post_format( $post_ID, $post_data['post_format'] ); + } elseif ( '0' == $post_data['post_format'] ) { + set_post_format( $post_ID, false ); + } + } + } + + // Meta Stuff + if ( isset($post_data['meta']) && $post_data['meta'] ) { + foreach ( $post_data['meta'] as $key => $value ) { + if ( !$meta = get_post_meta_by_id( $key ) ) + continue; + if ( $meta->post_id != $post_ID ) + continue; + if ( is_protected_meta( $value['key'] ) ) + continue; + update_meta( $key, $value['key'], $value['value'] ); + } + } + + if ( isset($post_data['deletemeta']) && $post_data['deletemeta'] ) { + foreach ( $post_data['deletemeta'] as $key => $value ) { + if ( !$meta = get_post_meta_by_id( $key ) ) + continue; + if ( $meta->post_id != $post_ID ) + continue; + if ( is_protected_meta( $meta->meta_key ) ) + continue; + delete_meta( $key ); + } + } + + add_meta( $post_ID ); + + update_post_meta( $post_ID, '_edit_last', $GLOBALS['current_user']->ID ); + + wp_update_post( $post_data ); + + // Reunite any orphaned attachments with their parent + if ( !$draft_ids = get_user_option( 'autosave_draft_ids' ) ) + $draft_ids = array(); + if ( $draft_temp_id = (int) array_search( $post_ID, $draft_ids ) ) + _relocate_children( $draft_temp_id, $post_ID ); + + // Now that we have an ID we can fix any attachment anchor hrefs + _fix_attachment_links( $post_ID ); + + wp_set_post_lock( $post_ID, $GLOBALS['current_user']->ID ); + + if ( current_user_can( $ptype->cap->edit_others_posts ) ) { + if ( ! empty( $post_data['sticky'] ) ) + stick_post( $post_ID ); + else + unstick_post( $post_ID ); + } + + return $post_ID; +} + +/** + * Process the post data for the bulk editing of posts. + * + * Updates all bulk edited posts/pages, adding (but not removing) tags and + * categories. Skips pages when they would be their own parent or child. + * + * @since 2.7.0 + * + * @param array $post_data Optional, the array of post data to process if not provided will use $_POST superglobal. + * @return array + */ +function bulk_edit_posts( $post_data = null ) { + global $wpdb; + + if ( empty($post_data) ) + $post_data = &$_POST; + + if ( isset($post_data['post_type']) ) + $ptype = get_post_type_object($post_data['post_type']); + else + $ptype = get_post_type_object('post'); + + if ( !current_user_can( $ptype->cap->edit_posts ) ) { + if ( 'page' == $ptype->name ) + wp_die( __('You are not allowed to edit pages.')); + else + wp_die( __('You are not allowed to edit posts.')); + } + + if ( -1 == $post_data['_status'] ) { + $post_data['post_status'] = null; + unset($post_data['post_status']); + } else { + $post_data['post_status'] = $post_data['_status']; + } + unset($post_data['_status']); + + $post_IDs = array_map( 'intval', (array) $post_data['post'] ); + + $reset = array( 'post_author', 'post_status', 'post_password', 'post_parent', 'page_template', 'comment_status', 'ping_status', 'keep_private', 'tax_input', 'post_category', 'sticky' ); + foreach ( $reset as $field ) { + if ( isset($post_data[$field]) && ( '' == $post_data[$field] || -1 == $post_data[$field] ) ) + unset($post_data[$field]); + } + + if ( isset($post_data['post_category']) ) { + if ( is_array($post_data['post_category']) && ! empty($post_data['post_category']) ) + $new_cats = array_map( 'absint', $post_data['post_category'] ); + else + unset($post_data['post_category']); + } + + $tax_input = array(); + if ( isset($post_data['tax_input'])) { + foreach ( $post_data['tax_input'] as $tax_name => $terms ) { + if ( empty($terms) ) + continue; + if ( is_taxonomy_hierarchical( $tax_name ) ) + $tax_input[$tax_name] = array_map( 'absint', $terms ); + else { + $tax_input[$tax_name] = preg_replace( '/\s*,\s*/', ',', rtrim( trim($terms), ' ,' ) ); + $tax_input[$tax_name] = explode(',', $tax_input[$tax_name]); + } + } + } + + if ( isset($post_data['post_parent']) && ($parent = (int) $post_data['post_parent']) ) { + $pages = $wpdb->get_results("SELECT ID, post_parent FROM $wpdb->posts WHERE post_type = 'page'"); + $children = array(); + + for ( $i = 0; $i < 50 && $parent > 0; $i++ ) { + $children[] = $parent; + + foreach ( $pages as $page ) { + if ( $page->ID == $parent ) { + $parent = $page->post_parent; + break; + } + } + } + } + + $updated = $skipped = $locked = array(); + foreach ( $post_IDs as $post_ID ) { + $post_type_object = get_post_type_object( get_post_type( $post_ID ) ); + + if ( !isset( $post_type_object ) || ( isset($children) && in_array($post_ID, $children) ) || !current_user_can( $post_type_object->cap->edit_post, $post_ID ) ) { + $skipped[] = $post_ID; + continue; + } + + if ( wp_check_post_lock( $post_ID ) ) { + $locked[] = $post_ID; + continue; + } + + $post = get_post( $post_ID ); + $tax_names = get_object_taxonomies( $post ); + foreach ( $tax_names as $tax_name ) { + $taxonomy_obj = get_taxonomy($tax_name); + if ( isset( $tax_input[$tax_name]) && current_user_can( $taxonomy_obj->cap->assign_terms ) ) + $new_terms = $tax_input[$tax_name]; + else + $new_terms = array(); + + if ( $taxonomy_obj->hierarchical ) + $current_terms = (array) wp_get_object_terms( $post_ID, $tax_name, array('fields' => 'ids') ); + else + $current_terms = (array) wp_get_object_terms( $post_ID, $tax_name, array('fields' => 'names') ); + + $post_data['tax_input'][$tax_name] = array_merge( $current_terms, $new_terms ); + } + + if ( isset($new_cats) && in_array( 'category', $tax_names ) ) { + $cats = (array) wp_get_post_categories($post_ID); + $post_data['post_category'] = array_unique( array_merge($cats, $new_cats) ); + unset( $post_data['tax_input']['category'] ); + } + + $post_data['post_mime_type'] = $post->post_mime_type; + $post_data['guid'] = $post->guid; + + $post_data['ID'] = $post_ID; + $updated[] = wp_update_post( $post_data ); + + if ( isset( $post_data['sticky'] ) && current_user_can( $ptype->cap->edit_others_posts ) ) { + if ( 'sticky' == $post_data['sticky'] ) + stick_post( $post_ID ); + else + unstick_post( $post_ID ); + } + + } + + return array( 'updated' => $updated, 'skipped' => $skipped, 'locked' => $locked ); +} + +/** + * Default post information to use when populating the "Write Post" form. + * + * @since 2.0.0 + * + * @param string $post_type A post type string, defaults to 'post'. + * @return object stdClass object containing all the default post data as attributes + */ +function get_default_post_to_edit( $post_type = 'post', $create_in_db = false ) { + global $wpdb; + + $post_title = ''; + if ( !empty( $_REQUEST['post_title'] ) ) + $post_title = esc_html( stripslashes( $_REQUEST['post_title'] )); + + $post_content = ''; + if ( !empty( $_REQUEST['content'] ) ) + $post_content = esc_html( stripslashes( $_REQUEST['content'] )); + + $post_excerpt = ''; + if ( !empty( $_REQUEST['excerpt'] ) ) + $post_excerpt = esc_html( stripslashes( $_REQUEST['excerpt'] )); + + if ( $create_in_db ) { + // Cleanup old auto-drafts more than 7 days old + $old_posts = $wpdb->get_col( "SELECT ID FROM $wpdb->posts WHERE post_status = 'auto-draft' AND DATE_SUB( NOW(), INTERVAL 7 DAY ) > post_date" ); + foreach ( (array) $old_posts as $delete ) + wp_delete_post( $delete, true ); // Force delete + $post_id = wp_insert_post( array( 'post_title' => __( 'Auto Draft' ), 'post_type' => $post_type, 'post_status' => 'auto-draft' ) ); + $post = get_post( $post_id ); + if ( current_theme_supports( 'post-formats' ) && post_type_supports( $post->post_type, 'post-formats' ) && get_option( 'default_post_format' ) ) + set_post_format( $post, get_option( 'default_post_format' ) ); + } else { + $post->ID = 0; + $post->post_author = ''; + $post->post_date = ''; + $post->post_date_gmt = ''; + $post->post_password = ''; + $post->post_type = $post_type; + $post->post_status = 'draft'; + $post->to_ping = ''; + $post->pinged = ''; + $post->comment_status = get_option( 'default_comment_status' ); + $post->ping_status = get_option( 'default_ping_status' ); + $post->post_pingback = get_option( 'default_pingback_flag' ); + $post->post_category = get_option( 'default_category' ); + $post->page_template = 'default'; + $post->post_parent = 0; + $post->menu_order = 0; + } + + $post->post_content = apply_filters( 'default_content', $post_content, $post ); + $post->post_title = apply_filters( 'default_title', $post_title, $post ); + $post->post_excerpt = apply_filters( 'default_excerpt', $post_excerpt, $post ); + $post->post_name = ''; + + return $post; +} + +/** + * Get the default page information to use. + * + * @since 2.5.0 + * + * @return object stdClass object containing all the default post data as attributes + */ +function get_default_page_to_edit() { + $page = get_default_post_to_edit(); + $page->post_type = 'page'; + return $page; +} + +/** + * Get an existing post and format it for editing. + * + * @since 2.0.0 + * + * @param unknown_type $id + * @return unknown + */ +function get_post_to_edit( $id ) { + + $post = get_post( $id, OBJECT, 'edit' ); + + if ( $post->post_type == 'page' ) + $post->page_template = get_post_meta( $id, '_wp_page_template', true ); + + return $post; +} + +/** + * Determine if a post exists based on title, content, and date + * + * @since 2.0.0 + * + * @param string $title Post title + * @param string $content Optional post content + * @param string $date Optional post date + * @return int Post ID if post exists, 0 otherwise. + */ +function post_exists($title, $content = '', $date = '') { + global $wpdb; + + $post_title = stripslashes( sanitize_post_field( 'post_title', $title, 0, 'db' ) ); + $post_content = stripslashes( sanitize_post_field( 'post_content', $content, 0, 'db' ) ); + $post_date = stripslashes( sanitize_post_field( 'post_date', $date, 0, 'db' ) ); + + $query = "SELECT ID FROM $wpdb->posts WHERE 1=1"; + $args = array(); + + if ( !empty ( $date ) ) { + $query .= ' AND post_date = %s'; + $args[] = $post_date; + } + + if ( !empty ( $title ) ) { + $query .= ' AND post_title = %s'; + $args[] = $post_title; + } + + if ( !empty ( $content ) ) { + $query .= 'AND post_content = %s'; + $args[] = $post_content; + } + + if ( !empty ( $args ) ) + return $wpdb->get_var( $wpdb->prepare($query, $args) ); + + return 0; +} + +/** + * Creates a new post from the "Write Post" form using $_POST information. + * + * @since 2.1.0 + * + * @return unknown + */ +function wp_write_post() { + global $user_ID; + + + if ( isset($_POST['post_type']) ) + $ptype = get_post_type_object($_POST['post_type']); + else + $ptype = get_post_type_object('post'); + + if ( !current_user_can( $ptype->cap->edit_posts ) ) { + if ( 'page' == $ptype->name ) + return new WP_Error( 'edit_pages', __( 'You are not allowed to create pages on this site.' ) ); + else + return new WP_Error( 'edit_posts', __( 'You are not allowed to create posts or drafts on this site.' ) ); + } + + $_POST['post_mime_type'] = ''; + + // Clear out any data in internal vars. + unset( $_POST['filter'] ); + + // Check for autosave collisions + // Does this need to be updated? ~ Mark + $temp_id = false; + if ( isset($_POST['temp_ID']) ) { + $temp_id = (int) $_POST['temp_ID']; + if ( !$draft_ids = get_user_option( 'autosave_draft_ids' ) ) + $draft_ids = array(); + foreach ( $draft_ids as $temp => $real ) + if ( time() + $temp > 86400 ) // 1 day: $temp is equal to -1 * time( then ) + unset($draft_ids[$temp]); + + if ( isset($draft_ids[$temp_id]) ) { // Edit, don't write + $_POST['post_ID'] = $draft_ids[$temp_id]; + unset($_POST['temp_ID']); + update_user_option( $user_ID, 'autosave_draft_ids', $draft_ids ); + return edit_post(); + } + } + + // Edit don't write if we have a post id. + if ( isset( $_POST['ID'] ) ) { + $_POST['post_ID'] = $_POST['ID']; + unset ( $_POST['ID'] ); + } + if ( isset( $_POST['post_ID'] ) ) { + return edit_post(); + } + + $translated = _wp_translate_postdata( false ); + if ( is_wp_error($translated) ) + return $translated; + + if ( isset($_POST['visibility']) ) { + switch ( $_POST['visibility'] ) { + case 'public' : + $_POST['post_password'] = ''; + break; + case 'password' : + unset( $_POST['sticky'] ); + break; + case 'private' : + $_POST['post_status'] = 'private'; + $_POST['post_password'] = ''; + unset( $_POST['sticky'] ); + break; + } + } + + // Create the post. + $post_ID = wp_insert_post( $_POST ); + if ( is_wp_error( $post_ID ) ) + return $post_ID; + + if ( empty($post_ID) ) + return 0; + + add_meta( $post_ID ); + + add_post_meta( $post_ID, '_edit_last', $GLOBALS['current_user']->ID ); + + // Reunite any orphaned attachments with their parent + // Does this need to be udpated? ~ Mark + if ( !$draft_ids = get_user_option( 'autosave_draft_ids' ) ) + $draft_ids = array(); + if ( $draft_temp_id = (int) array_search( $post_ID, $draft_ids ) ) + _relocate_children( $draft_temp_id, $post_ID ); + if ( $temp_id && $temp_id != $draft_temp_id ) + _relocate_children( $temp_id, $post_ID ); + + // Update autosave collision detection + if ( $temp_id ) { + $draft_ids[$temp_id] = $post_ID; + update_user_option( $user_ID, 'autosave_draft_ids', $draft_ids ); + } + + // Now that we have an ID we can fix any attachment anchor hrefs + _fix_attachment_links( $post_ID ); + + wp_set_post_lock( $post_ID, $GLOBALS['current_user']->ID ); + + return $post_ID; +} + +/** + * Calls wp_write_post() and handles the errors. + * + * @since 2.0.0 + * + * @return unknown + */ +function write_post() { + $result = wp_write_post(); + if ( is_wp_error( $result ) ) + wp_die( $result->get_error_message() ); + else + return $result; +} + +// +// Post Meta +// + +/** + * {@internal Missing Short Description}} + * + * @since 1.2.0 + * + * @param unknown_type $post_ID + * @return unknown + */ +function add_meta( $post_ID ) { + global $wpdb; + $post_ID = (int) $post_ID; + + $metakeyselect = isset($_POST['metakeyselect']) ? stripslashes( trim( $_POST['metakeyselect'] ) ) : ''; + $metakeyinput = isset($_POST['metakeyinput']) ? stripslashes( trim( $_POST['metakeyinput'] ) ) : ''; + $metavalue = isset($_POST['metavalue']) ? maybe_serialize( stripslashes_deep( $_POST['metavalue'] ) ) : ''; + if ( is_string($metavalue) ) + $metavalue = trim( $metavalue ); + + if ( ('0' === $metavalue || !empty ( $metavalue ) ) && ((('#NONE#' != $metakeyselect) && !empty ( $metakeyselect) ) || !empty ( $metakeyinput) ) ) { + // We have a key/value pair. If both the select and the + // input for the key have data, the input takes precedence: + + if ('#NONE#' != $metakeyselect) + $metakey = $metakeyselect; + + if ( $metakeyinput) + $metakey = $metakeyinput; // default + + if ( is_protected_meta( $metakey ) ) + return false; + + wp_cache_delete($post_ID, 'post_meta'); + $wpdb->insert( $wpdb->postmeta, array( 'post_id' => $post_ID, 'meta_key' => $metakey, 'meta_value' => $metavalue ) ); + $meta_id = $wpdb->insert_id; + do_action( 'added_postmeta', $meta_id, $post_ID, $metakey, $metavalue ); + + return $meta_id; + } + return false; +} // add_meta + +/** + * {@internal Missing Short Description}} + * + * @since 1.2.0 + * + * @param unknown_type $mid + * @return unknown + */ +function delete_meta( $mid ) { + global $wpdb; + $mid = (int) $mid; + + $post_id = $wpdb->get_var( $wpdb->prepare("SELECT post_id FROM $wpdb->postmeta WHERE meta_id = %d", $mid) ); + + do_action( 'delete_postmeta', $mid ); + wp_cache_delete($post_id, 'post_meta'); + $rval = $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->postmeta WHERE meta_id = %d", $mid) ); + do_action( 'deleted_postmeta', $mid ); + + return $rval; +} + +/** + * Get a list of previously defined keys. + * + * @since 1.2.0 + * + * @return unknown + */ +function get_meta_keys() { + global $wpdb; + + $keys = $wpdb->get_col( " + SELECT meta_key + FROM $wpdb->postmeta + GROUP BY meta_key + ORDER BY meta_key" ); + + return $keys; +} + +/** + * {@internal Missing Short Description}} + * + * @since 2.1.0 + * + * @param unknown_type $mid + * @return unknown + */ +function get_post_meta_by_id( $mid ) { + global $wpdb; + $mid = (int) $mid; + + $meta = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->postmeta WHERE meta_id = %d", $mid) ); + if ( empty($meta) ) + return false; + if ( is_serialized_string( $meta->meta_value ) ) + $meta->meta_value = maybe_unserialize( $meta->meta_value ); + return $meta; +} + +/** + * {@internal Missing Short Description}} + * + * Some postmeta stuff. + * + * @since 1.2.0 + * + * @param unknown_type $postid + * @return unknown + */ +function has_meta( $postid ) { + global $wpdb; + + return $wpdb->get_results( $wpdb->prepare("SELECT meta_key, meta_value, meta_id, post_id + FROM $wpdb->postmeta WHERE post_id = %d + ORDER BY meta_key,meta_id", $postid), ARRAY_A ); + +} + +/** + * {@internal Missing Short Description}} + * + * @since 1.2.0 + * + * @param unknown_type $meta_id + * @param unknown_type $meta_key Expect Slashed + * @param unknown_type $meta_value Expect Slashed + * @return unknown + */ +function update_meta( $meta_id, $meta_key, $meta_value ) { + global $wpdb; + + $meta_key = stripslashes($meta_key); + + if ( is_protected_meta( $meta_key ) ) + return false; + + if ( '' === trim( $meta_value ) ) + return false; + + $post_id = $wpdb->get_var( $wpdb->prepare("SELECT post_id FROM $wpdb->postmeta WHERE meta_id = %d", $meta_id) ); + + $meta_value = maybe_serialize( stripslashes_deep( $meta_value ) ); + $meta_id = (int) $meta_id; + + $data = compact( 'meta_key', 'meta_value' ); + $where = compact( 'meta_id' ); + + do_action( 'update_postmeta', $meta_id, $post_id, $meta_key, $meta_value ); + $rval = $wpdb->update( $wpdb->postmeta, $data, $where ); + wp_cache_delete($post_id, 'post_meta'); + do_action( 'updated_postmeta', $meta_id, $post_id, $meta_key, $meta_value ); + + return $rval; +} + +// +// Private +// + +/** + * Replace hrefs of attachment anchors with up-to-date permalinks. + * + * @since 2.3.0 + * @access private + * + * @param unknown_type $post_ID + * @return unknown + */ +function _fix_attachment_links( $post_ID ) { + global $_fix_attachment_link_id; + + $post = & get_post( $post_ID, ARRAY_A ); + + $search = "#]+rel=('|\")[^'\"]*attachment[^>]*>#ie"; + + // See if we have any rel="attachment" links + if ( 0 == preg_match_all( $search, $post['post_content'], $anchor_matches, PREG_PATTERN_ORDER ) ) + return; + + $i = 0; + $search = "#[\s]+rel=(\"|')(.*?)wp-att-(\d+)\\1#i"; + foreach ( $anchor_matches[0] as $anchor ) { + if ( 0 == preg_match( $search, $anchor, $id_matches ) ) + continue; + + $id = (int) $id_matches[3]; + + // While we have the attachment ID, let's adopt any orphans. + $attachment = & get_post( $id, ARRAY_A ); + if ( ! empty( $attachment) && ! is_object( get_post( $attachment['post_parent'] ) ) ) { + $attachment['post_parent'] = $post_ID; + // Escape data pulled from DB. + $attachment = add_magic_quotes( $attachment ); + wp_update_post( $attachment ); + } + + $post_search[$i] = $anchor; + $_fix_attachment_link_id = $id; + $post_replace[$i] = preg_replace_callback( "#href=(\"|')[^'\"]*\\1#", '_fix_attachment_links_replace_cb', $anchor ); + ++$i; + } + + $post['post_content'] = str_replace( $post_search, $post_replace, $post['post_content'] ); + + // Escape data pulled from DB. + $post = add_magic_quotes( $post); + + return wp_update_post( $post); +} + +function _fix_attachment_links_replace_cb($match) { + global $_fix_attachment_link_id; + return stripslashes( 'href='.$match[1] ).get_attachment_link( $_fix_attachment_link_id ).stripslashes( $match[1] ); +} + +/** + * Move child posts to a new parent. + * + * @since 2.3.0 + * @access private + * + * @param unknown_type $old_ID + * @param unknown_type $new_ID + * @return unknown + */ +function _relocate_children( $old_ID, $new_ID ) { + global $wpdb; + $old_ID = (int) $old_ID; + $new_ID = (int) $new_ID; + + $children = $wpdb->get_col( $wpdb->prepare(" + SELECT post_id + FROM $wpdb->postmeta + WHERE meta_key = '_wp_attachment_temp_parent' + AND meta_value = %d", $old_ID) ); + + foreach ( $children as $child_id ) { + $wpdb->update($wpdb->posts, array('post_parent' => $new_ID), array('ID' => $child_id) ); + delete_post_meta($child_id, '_wp_attachment_temp_parent'); + } +} + +/** + * Get all the possible statuses for a post_type + * + * @since 2.5.0 + * + * @param string $type The post_type you want the statuses for + * @return array As array of all the statuses for the supplied post type + */ +function get_available_post_statuses($type = 'post') { + $stati = wp_count_posts($type); + + return array_keys(get_object_vars($stati)); +} + +/** + * Run the wp query to fetch the posts for listing on the edit posts page + * + * @since 2.5.0 + * + * @param array|bool $q Array of query variables to use to build the query or false to use $_GET superglobal. + * @return array + */ +function wp_edit_posts_query( $q = false ) { + if ( false === $q ) + $q = $_GET; + $q['m'] = isset($q['m']) ? (int) $q['m'] : 0; + $q['cat'] = isset($q['cat']) ? (int) $q['cat'] : 0; + $post_stati = get_post_stati(); + + if ( isset($q['post_type']) && in_array( $q['post_type'], get_post_types() ) ) + $post_type = $q['post_type']; + else + $post_type = 'post'; + + $avail_post_stati = get_available_post_statuses($post_type); + + if ( isset($q['post_status']) && in_array( $q['post_status'], $post_stati ) ) { + $post_status = $q['post_status']; + $perm = 'readable'; + } + + if ( isset($q['orderby']) ) + $orderby = $q['orderby']; + elseif ( isset($q['post_status']) && in_array($q['post_status'], array('pending', 'draft')) ) + $orderby = 'modified'; + + if ( isset($q['order']) ) + $order = $q['order']; + elseif ( isset($q['post_status']) && 'pending' == $q['post_status'] ) + $order = 'ASC'; + + $per_page = 'edit_' . $post_type . '_per_page'; + $posts_per_page = (int) get_user_option( $per_page ); + if ( empty( $posts_per_page ) || $posts_per_page < 1 ) + $posts_per_page = 20; + + $posts_per_page = apply_filters( $per_page, $posts_per_page ); + $posts_per_page = apply_filters( 'edit_posts_per_page', $posts_per_page, $post_type ); + + $query = compact('post_type', 'post_status', 'perm', 'order', 'orderby', 'posts_per_page'); + + // Hierarchical types require special args. + if ( is_post_type_hierarchical( $post_type ) && !isset($orderby) ) { + $query['orderby'] = 'menu_order title'; + $query['order'] = 'asc'; + $query['posts_per_page'] = -1; + $query['posts_per_archive_page'] = -1; + } + + if ( ! empty( $q['show_sticky'] ) ) + $query['post__in'] = (array) get_option( 'sticky_posts' ); + + wp( $query ); + + return $avail_post_stati; +} + +/** + * Get default post mime types + * + * @since 2.9.0 + * + * @return array + */ +function get_post_mime_types() { + $post_mime_types = array( // array( adj, noun ) + 'image' => array(__('Images'), __('Manage Images'), _n_noop('Image (%s)', 'Images (%s)')), + 'audio' => array(__('Audio'), __('Manage Audio'), _n_noop('Audio (%s)', 'Audio (%s)')), + 'video' => array(__('Video'), __('Manage Video'), _n_noop('Video (%s)', 'Video (%s)')), + ); + + return apply_filters('post_mime_types', $post_mime_types); +} + +/** + * {@internal Missing Short Description}} + * + * @since 2.5.0 + * + * @param unknown_type $type + * @return unknown + */ +function get_available_post_mime_types($type = 'attachment') { + global $wpdb; + + $types = $wpdb->get_col($wpdb->prepare("SELECT DISTINCT post_mime_type FROM $wpdb->posts WHERE post_type = %s", $type)); + return $types; +} + +/** + * {@internal Missing Short Description}} + * + * @since 2.5.0 + * + * @param unknown_type $q + * @return unknown + */ +function wp_edit_attachments_query( $q = false ) { + if ( false === $q ) + $q = $_GET; + + $q['m'] = isset( $q['m'] ) ? (int) $q['m'] : 0; + $q['cat'] = isset( $q['cat'] ) ? (int) $q['cat'] : 0; + $q['post_type'] = 'attachment'; + $post_type = get_post_type_object( 'attachment' ); + $states = 'inherit'; + if ( current_user_can( $post_type->cap->read_private_posts ) ) + $states .= ',private'; + + $q['post_status'] = isset( $q['status'] ) && 'trash' == $q['status'] ? 'trash' : $states; + $media_per_page = (int) get_user_option( 'upload_per_page' ); + if ( empty( $media_per_page ) || $media_per_page < 1 ) + $media_per_page = 20; + $q['posts_per_page'] = apply_filters( 'upload_per_page', $media_per_page ); + + $post_mime_types = get_post_mime_types(); + $avail_post_mime_types = get_available_post_mime_types('attachment'); + + if ( isset($q['post_mime_type']) && !array_intersect( (array) $q['post_mime_type'], array_keys($post_mime_types) ) ) + unset($q['post_mime_type']); + + if ( isset($q['detached']) ) + add_filter('posts_where', '_edit_attachments_query_helper'); + + wp( $q ); + + if ( isset($q['detached']) ) + remove_filter('posts_where', '_edit_attachments_query_helper'); + + return array($post_mime_types, $avail_post_mime_types); +} + +function _edit_attachments_query_helper($where) { + return $where .= ' AND post_parent < 1'; +} + +/** + * Returns the list of classes to be used by a metabox + * + * @uses get_user_option() + * @since 2.5.0 + * + * @param unknown_type $id + * @param unknown_type $page + * @return unknown + */ +function postbox_classes( $id, $page ) { + if ( isset( $_GET['edit'] ) && $_GET['edit'] == $id ) { + $classes = array( '' ); + } elseif ( $closed = get_user_option('closedpostboxes_'.$page ) ) { + if ( !is_array( $closed ) ) { + $classes = array( '' ); + } else { + $classes = in_array( $id, $closed ) ? array( 'closed' ) : array( '' ); + } + } else { + $classes = array( '' ); + } + + $classes = apply_filters( "postbox_classes_{$page}_{$id}", $classes ); + return implode( ' ', $classes ); +} + +/** + * {@internal Missing Short Description}} + * + * @since 2.5.0 + * + * @param int|object $id Post ID or post object. + * @param string $title (optional) Title + * @param string $name (optional) Name + * @return array With two entries of type string + */ +function get_sample_permalink($id, $title = null, $name = null) { + $post = &get_post($id); + if ( !$post->ID ) + return array('', ''); + + $ptype = get_post_type_object($post->post_type); + + $original_status = $post->post_status; + $original_date = $post->post_date; + $original_name = $post->post_name; + + // Hack: get_permalink would return ugly permalink for + // drafts, so we will fake, that our post is published + if ( in_array($post->post_status, array('draft', 'pending')) ) { + $post->post_status = 'publish'; + $post->post_name = sanitize_title($post->post_name ? $post->post_name : $post->post_title, $post->ID); + } + + // If the user wants to set a new name -- override the current one + // Note: if empty name is supplied -- use the title instead, see #6072 + if ( !is_null($name) ) + $post->post_name = sanitize_title($name ? $name : $title, $post->ID); + + $post->post_name = wp_unique_post_slug($post->post_name, $post->ID, $post->post_status, $post->post_type, $post->post_parent); + + $post->filter = 'sample'; + + $permalink = get_permalink($post, true); + + // Replace custom post_type Token with generic pagename token for ease of use. + $permalink = str_replace("%$post->post_type%", '%pagename%', $permalink); + + // Handle page hierarchy + if ( $ptype->hierarchical ) { + $uri = get_page_uri($post); + $uri = untrailingslashit($uri); + $uri = strrev( stristr( strrev( $uri ), '/' ) ); + $uri = untrailingslashit($uri); + $uri = apply_filters( 'editable_slug', $uri ); + if ( !empty($uri) ) + $uri .= '/'; + $permalink = str_replace('%pagename%', "{$uri}%pagename%", $permalink); + } + + $permalink = array($permalink, apply_filters('editable_slug', $post->post_name)); + $post->post_status = $original_status; + $post->post_date = $original_date; + $post->post_name = $original_name; + unset($post->filter); + + return $permalink; +} + +/** + * sample permalink html + * + * intended to be used for the inplace editor of the permalink post slug on in the post (and page?) editor. + * + * @since 2.5.0 + * + * @param int|object $id Post ID or post object. + * @param string $new_title (optional) New title + * @param string $new_slug (optional) New slug + * @return string intended to be used for the inplace editor of the permalink post slug on in the post (and page?) editor. + */ +function get_sample_permalink_html( $id, $new_title = null, $new_slug = null ) { + global $wpdb; + $post = &get_post($id); + + list($permalink, $post_name) = get_sample_permalink($post->ID, $new_title, $new_slug); + + if ( 'publish' == $post->post_status ) { + $ptype = get_post_type_object($post->post_type); + $view_post = $ptype->labels->view_item; + $title = __('Click to edit this part of the permalink'); + } else { + $title = __('Temporary permalink. Click to edit this part.'); + } + + if ( false === strpos($permalink, '%postname%') && false === strpos($permalink, '%pagename%') ) { + $return = '' . __('Permalink:') . "\n" . '' . $permalink . "\n"; + if ( '' == get_option( 'permalink_structure' ) && current_user_can( 'manage_options' ) && !( 'page' == get_option('show_on_front') && $id == get_option('page_on_front') ) ) + $return .= '' . __('Change Permalinks') . "\n"; + if ( isset($view_post) ) + $return .= "$view_post\n"; + + $return = apply_filters('get_sample_permalink_html', $return, $id, $new_title, $new_slug); + + return $return; + } + + if ( function_exists('mb_strlen') ) { + if ( mb_strlen($post_name) > 30 ) { + $post_name_abridged = mb_substr($post_name, 0, 14). '…' . mb_substr($post_name, -14); + } else { + $post_name_abridged = $post_name; + } + } else { + if ( strlen($post_name) > 30 ) { + $post_name_abridged = substr($post_name, 0, 14). '…' . substr($post_name, -14); + } else { + $post_name_abridged = $post_name; + } + } + + $post_name_html = '' . $post_name_abridged . ''; + $display_link = str_replace(array('%pagename%','%postname%'), $post_name_html, $permalink); + $view_link = str_replace(array('%pagename%','%postname%'), $post_name, $permalink); + $return = '' . __('Permalink:') . "\n"; + $return .= '' . $display_link . "\n"; + $return .= '‎'; // Fix bi-directional text display defect in RTL languages. + $return .= '' . __('Edit') . "\n"; + $return .= '' . $post_name . "\n"; + if ( isset($view_post) ) + $return .= "$view_post\n"; + + $return = apply_filters('get_sample_permalink_html', $return, $id, $new_title, $new_slug); + + return $return; +} + +/** + * Output HTML for the post thumbnail meta-box. + * + * @since 2.9.0 + * + * @param int $thumbnail_id ID of the attachment used for thumbnail + * @return string html + */ +function _wp_post_thumbnail_html( $thumbnail_id = NULL ) { + global $content_width, $_wp_additional_image_sizes, $post_ID; + $set_thumbnail_link = '

    %s

    '; + $content = sprintf($set_thumbnail_link, esc_html__( 'Set featured image' )); + + if ( $thumbnail_id && get_post( $thumbnail_id ) ) { + $old_content_width = $content_width; + $content_width = 266; + if ( !isset( $_wp_additional_image_sizes['post-thumbnail'] ) ) + $thumbnail_html = wp_get_attachment_image( $thumbnail_id, array( $content_width, $content_width ) ); + else + $thumbnail_html = wp_get_attachment_image( $thumbnail_id, 'post-thumbnail' ); + if ( !empty( $thumbnail_html ) ) { + $ajax_nonce = wp_create_nonce( "set_post_thumbnail-$post_ID" ); + $content = sprintf($set_thumbnail_link, $thumbnail_html); + $content .= '

    ' . esc_html__( 'Remove featured image' ) . '

    '; + } + $content_width = $old_content_width; + } + + return apply_filters( 'admin_post_thumbnail_html', $content ); +} + +/** + * Check to see if the post is currently being edited by another user. + * + * @since 2.5.0 + * + * @param int $post_id ID of the post to check for editing + * @return bool|int False: not locked or locked by current user. Int: user ID of user with lock. + */ +function wp_check_post_lock( $post_id ) { + if ( !$post = get_post( $post_id ) ) + return false; + + if ( !$lock = get_post_meta( $post->ID, '_edit_lock', true ) ) + return false; + + $lock = explode( ':', $lock ); + $time = $lock[0]; + $user = isset( $lock[1] ) ? $lock[1] : get_post_meta( $post->ID, '_edit_last', true ); + + $time_window = apply_filters( 'wp_check_post_lock_window', AUTOSAVE_INTERVAL * 2 ); + + if ( $time && $time > time() - $time_window && $user != get_current_user_id() ) + return $user; + return false; +} + +/** + * Mark the post as currently being edited by the current user + * + * @since 2.5.0 + * + * @param int $post_id ID of the post to being edited + * @return bool Returns false if the post doesn't exist of there is no current user + */ +function wp_set_post_lock( $post_id ) { + if ( !$post = get_post( $post_id ) ) + return false; + if ( 0 == ($user_id = get_current_user_id()) ) + return false; + + $now = time(); + $lock = "$now:$user_id"; + + update_post_meta( $post->ID, '_edit_lock', $lock ); +} + +/** + * Outputs the notice message to say that someone else is editing this post at the moment. + * + * @since 2.8.5 + * @return none + */ +function _admin_notice_post_locked() { + global $post; + + $lock = explode( ':', get_post_meta( $post->ID, '_edit_lock', true ) ); + $user = isset( $lock[1] ) ? $lock[1] : get_post_meta( $post->ID, '_edit_last', true ); + $last_user = get_userdata( $user ); + $last_user_name = $last_user ? $last_user->display_name : __('Somebody'); + + switch ($post->post_type) { + case 'post': + $message = __( 'Warning: %s is currently editing this post' ); + break; + case 'page': + $message = __( 'Warning: %s is currently editing this page' ); + break; + default: + $message = __( 'Warning: %s is currently editing this.' ); + } + + $message = sprintf( $message, esc_html( $last_user_name ) ); + echo "

    $message

    "; +} + +/** + * Creates autosave data for the specified post from $_POST data. + * + * @package WordPress + * @subpackage Post_Revisions + * @since 2.6.0 + * + * @uses _wp_translate_postdata() + * @uses _wp_post_revision_fields() + * + * @return unknown + */ +function wp_create_post_autosave( $post_id ) { + $translated = _wp_translate_postdata( true ); + if ( is_wp_error( $translated ) ) + return $translated; + + // Only store one autosave. If there is already an autosave, overwrite it. + if ( $old_autosave = wp_get_post_autosave( $post_id ) ) { + $new_autosave = _wp_post_revision_fields( $_POST, true ); + $new_autosave['ID'] = $old_autosave->ID; + $new_autosave['post_author'] = get_current_user_id(); + return wp_update_post( $new_autosave ); + } + + // _wp_put_post_revision() expects unescaped. + $_POST = stripslashes_deep($_POST); + + // Otherwise create the new autosave as a special post revision + return _wp_put_post_revision( $_POST, true ); +} + +/** + * Save draft or manually autosave for showing preview. + * + * @package WordPress + * @since 2.7.0 + * + * @uses wp_write_post() + * @uses edit_post() + * @uses get_post() + * @uses current_user_can() + * @uses wp_create_post_autosave() + * + * @return str URL to redirect to show the preview + */ +function post_preview() { + + $post_ID = (int) $_POST['post_ID']; + $status = get_post_status( $post_ID ); + if ( 'auto-draft' == $status ) + wp_die( __('Preview not available. Please save as a draft first.') ); + + if ( isset($_POST['catslist']) ) + $_POST['post_category'] = explode(",", $_POST['catslist']); + + if ( isset($_POST['tags_input']) ) + $_POST['tags_input'] = explode(",", $_POST['tags_input']); + + if ( $_POST['post_type'] == 'page' || empty($_POST['post_category']) ) + unset($_POST['post_category']); + + $_POST['ID'] = $post_ID; + $post = get_post($post_ID); + + if ( 'page' == $post->post_type ) { + if ( !current_user_can('edit_page', $post_ID) ) + wp_die(__('You are not allowed to edit this page.')); + } else { + if ( !current_user_can('edit_post', $post_ID) ) + wp_die(__('You are not allowed to edit this post.')); + } + + if ( 'draft' == $post->post_status ) { + $id = edit_post(); + } else { // Non drafts are not overwritten. The autosave is stored in a special post revision. + $id = wp_create_post_autosave( $post->ID ); + if ( ! is_wp_error($id) ) + $id = $post->ID; + } + + if ( is_wp_error($id) ) + wp_die( $id->get_error_message() ); + + if ( $_POST['post_status'] == 'draft' ) { + $url = add_query_arg( 'preview', 'true', get_permalink($id) ); + } else { + $nonce = wp_create_nonce('post_preview_' . $id); + $url = add_query_arg( array( 'preview' => 'true', 'preview_id' => $id, 'preview_nonce' => $nonce ), get_permalink($id) ); + } + + return $url; +} + +/** + * Adds the TinyMCE editor used on the Write and Edit screens. + * + * @package WordPress + * @since 2.7.0 + * + * TinyMCE is loaded separately from other Javascript by using wp-tinymce.php. It outputs concatenated + * and optionaly pre-compressed version of the core and all default plugins. Additional plugins are loaded + * directly by TinyMCE using non-blocking method. Custom plugins can be refreshed by adding a query string + * to the URL when queueing them with the mce_external_plugins filter. + * + * @param bool $teeny optional Output a trimmed down version used in Press This. + * @param mixed $settings optional An array that can add to or overwrite the default TinyMCE settings. + */ +function wp_tiny_mce( $teeny = false, $settings = false ) { + global $concatenate_scripts, $compress_scripts, $tinymce_version, $editor_styles; + + if ( ! user_can_richedit() ) + return; + + $baseurl = includes_url('js/tinymce'); + + $mce_locale = ( '' == get_locale() ) ? 'en' : strtolower( substr(get_locale(), 0, 2) ); // only ISO 639-1 + + /* + The following filter allows localization scripts to change the languages displayed in the spellchecker's drop-down menu. + By default it uses Google's spellchecker API, but can be configured to use PSpell/ASpell if installed on the server. + The + sign marks the default language. More information: + http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/spellchecker + */ + $mce_spellchecker_languages = apply_filters('mce_spellchecker_languages', '+English=en,Danish=da,Dutch=nl,Finnish=fi,French=fr,German=de,Italian=it,Polish=pl,Portuguese=pt,Spanish=es,Swedish=sv'); + + if ( $teeny ) { + $plugins = apply_filters( 'teeny_mce_plugins', array('inlinepopups', 'fullscreen', 'wordpress', 'wplink', 'wpdialogs') ); + $ext_plugins = ''; + } else { + $plugins = array( 'inlinepopups', 'spellchecker', 'tabfocus', 'paste', 'media', 'wordpress', 'wpfullscreen', 'wpeditimage', 'wpgallery', 'wplink', 'wpdialogs' ); + + /* + The following filter takes an associative array of external plugins for TinyMCE in the form 'plugin_name' => 'url'. + It adds the plugin's name to TinyMCE's plugins init and the call to PluginManager to load the plugin. + The url should be absolute and should include the js file name to be loaded. Example: + array( 'myplugin' => 'http://my-site.com/wp-content/plugins/myfolder/mce_plugin.js' ) + If the plugin uses a button, it should be added with one of the "$mce_buttons" filters. + */ + $mce_external_plugins = apply_filters('mce_external_plugins', array()); + + $ext_plugins = ''; + if ( ! empty($mce_external_plugins) ) { + + /* + The following filter loads external language files for TinyMCE plugins. + It takes an associative array 'plugin_name' => 'path', where path is the + include path to the file. The language file should follow the same format as + /tinymce/langs/wp-langs.php and should define a variable $strings that + holds all translated strings. + When this filter is not used, the function will try to load {mce_locale}.js. + If that is not found, en.js will be tried next. + */ + $mce_external_languages = apply_filters('mce_external_languages', array()); + + $loaded_langs = array(); + $strings = ''; + + if ( ! empty($mce_external_languages) ) { + foreach ( $mce_external_languages as $name => $path ) { + if ( @is_file($path) && @is_readable($path) ) { + include_once($path); + $ext_plugins .= $strings . "\n"; + $loaded_langs[] = $name; + } + } + } + + foreach ( $mce_external_plugins as $name => $url ) { + + if ( is_ssl() ) $url = str_replace('http://', 'https://', $url); + + $plugins[] = '-' . $name; + + $plugurl = dirname($url); + $strings = $str1 = $str2 = ''; + if ( ! in_array($name, $loaded_langs) ) { + $path = str_replace( WP_PLUGIN_URL, '', $plugurl ); + $path = WP_PLUGIN_DIR . $path . '/langs/'; + + if ( function_exists('realpath') ) + $path = trailingslashit( realpath($path) ); + + if ( @is_file($path . $mce_locale . '.js') ) + $strings .= @file_get_contents($path . $mce_locale . '.js') . "\n"; + + if ( @is_file($path . $mce_locale . '_dlg.js') ) + $strings .= @file_get_contents($path . $mce_locale . '_dlg.js') . "\n"; + + if ( 'en' != $mce_locale && empty($strings) ) { + if ( @is_file($path . 'en.js') ) { + $str1 = @file_get_contents($path . 'en.js'); + $strings .= preg_replace( '/([\'"])en\./', '$1' . $mce_locale . '.', $str1, 1 ) . "\n"; + } + + if ( @is_file($path . 'en_dlg.js') ) { + $str2 = @file_get_contents($path . 'en_dlg.js'); + $strings .= preg_replace( '/([\'"])en\./', '$1' . $mce_locale . '.', $str2, 1 ) . "\n"; + } + } + + if ( ! empty($strings) ) + $ext_plugins .= "\n" . $strings . "\n"; + } + + $ext_plugins .= 'tinyMCEPreInit.load_ext("' . $plugurl . '", "' . $mce_locale . '");' . "\n"; + $ext_plugins .= 'tinymce.PluginManager.load("' . $name . '", "' . $url . '");' . "\n"; + } + } + } + + if ( $teeny ) { + $mce_buttons = apply_filters( 'teeny_mce_buttons', array('bold, italic, underline, blockquote, separator, strikethrough, bullist, numlist,justifyleft, justifycenter, justifyright, undo, redo, link, unlink, fullscreen') ); + $mce_buttons = implode($mce_buttons, ','); + $mce_buttons_2 = $mce_buttons_3 = $mce_buttons_4 = ''; + } else { + $mce_buttons = apply_filters('mce_buttons', array('bold', 'italic', 'strikethrough', '|', 'bullist', 'numlist', 'blockquote', '|', 'justifyleft', 'justifycenter', 'justifyright', '|', 'link', 'unlink', 'wp_more', '|', 'spellchecker', 'fullscreen', 'wp_adv' )); + $mce_buttons = implode($mce_buttons, ','); + + $mce_buttons_2 = array( 'formatselect', 'underline', 'justifyfull', 'forecolor', '|', 'pastetext', 'pasteword', 'removeformat', '|', 'charmap', '|', 'outdent', 'indent', '|', 'undo', 'redo', 'wp_help' ); + $mce_buttons_2 = apply_filters('mce_buttons_2', $mce_buttons_2); + $mce_buttons_2 = implode($mce_buttons_2, ','); + + $mce_buttons_3 = apply_filters('mce_buttons_3', array()); + $mce_buttons_3 = implode($mce_buttons_3, ','); + + $mce_buttons_4 = apply_filters('mce_buttons_4', array()); + $mce_buttons_4 = implode($mce_buttons_4, ','); + } + $no_captions = (bool) apply_filters( 'disable_captions', '' ); + + // TinyMCE init settings + $initArray = array ( + 'mode' => 'specific_textareas', + 'editor_selector' => 'theEditor', + 'width' => '100%', + 'theme' => 'advanced', + 'skin' => 'wp_theme', + 'theme_advanced_buttons1' => $mce_buttons, + 'theme_advanced_buttons2' => $mce_buttons_2, + 'theme_advanced_buttons3' => $mce_buttons_3, + 'theme_advanced_buttons4' => $mce_buttons_4, + 'language' => $mce_locale, + 'spellchecker_languages' => $mce_spellchecker_languages, + 'theme_advanced_toolbar_location' => 'top', + 'theme_advanced_toolbar_align' => 'left', + 'theme_advanced_statusbar_location' => 'bottom', + 'theme_advanced_resizing' => true, + 'theme_advanced_resize_horizontal' => false, + 'dialog_type' => 'modal', + 'formats' => "{ + alignleft : [ + {selector : 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li', styles : {textAlign : 'left'}}, + {selector : 'img,table', classes : 'alignleft'} + ], + aligncenter : [ + {selector : 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li', styles : {textAlign : 'center'}}, + {selector : 'img,table', classes : 'aligncenter'} + ], + alignright : [ + {selector : 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li', styles : {textAlign : 'right'}}, + {selector : 'img,table', classes : 'alignright'} + ], + strikethrough : {inline : 'del'} + }", + 'relative_urls' => false, + 'remove_script_host' => false, + 'convert_urls' => false, + 'apply_source_formatting' => false, + 'remove_linebreaks' => true, + 'gecko_spellcheck' => true, + 'keep_styles' => false, + 'entities' => '38,amp,60,lt,62,gt', + 'accessibility_focus' => true, + 'tabfocus_elements' => 'major-publishing-actions', + 'media_strict' => false, + 'paste_remove_styles' => true, + 'paste_remove_spans' => true, + 'paste_strip_class_attributes' => 'all', + 'paste_text_use_dialog' => true, + 'extended_valid_elements' => 'article[*],aside[*],audio[*],canvas[*],command[*],datalist[*],details[*],embed[*],figcaption[*],figure[*],footer[*],header[*],hgroup[*],keygen[*],mark[*],meter[*],nav[*],output[*],progress[*],section[*],source[*],summary,time[*],video[*],wbr', + 'wpeditimage_disable_captions' => $no_captions, + 'wp_fullscreen_content_css' => "$baseurl/plugins/wpfullscreen/css/wp-fullscreen.css", + 'plugins' => implode( ',', $plugins ), + ); + + if ( ! empty( $editor_styles ) && is_array( $editor_styles ) ) { + $mce_css = array(); + $style_uri = get_stylesheet_directory_uri(); + if ( ! is_child_theme() ) { + foreach ( $editor_styles as $file ) + $mce_css[] = "$style_uri/$file"; + } else { + $style_dir = get_stylesheet_directory(); + $template_uri = get_template_directory_uri(); + $template_dir = get_template_directory(); + foreach ( $editor_styles as $file ) { + if ( file_exists( "$template_dir/$file" ) ) + $mce_css[] = "$template_uri/$file"; + if ( file_exists( "$style_dir/$file" ) ) + $mce_css[] = "$style_uri/$file"; + } + } + $mce_css = implode( ',', $mce_css ); + } else { + $mce_css = ''; + } + + $mce_css = trim( apply_filters( 'mce_css', $mce_css ), ' ,' ); + + if ( ! empty($mce_css) ) + $initArray['content_css'] = $mce_css; + + if ( is_array($settings) ) + $initArray = array_merge($initArray, $settings); + + // For people who really REALLY know what they're doing with TinyMCE + // You can modify initArray to add, remove, change elements of the config before tinyMCE.init + // Setting "valid_elements", "invalid_elements" and "extended_valid_elements" can be done through "tiny_mce_before_init". + // Best is to use the default cleanup by not specifying valid_elements, as TinyMCE contains full set of XHTML 1.0. + if ( $teeny ) { + $initArray = apply_filters('teeny_mce_before_init', $initArray); + } else { + $initArray = apply_filters('tiny_mce_before_init', $initArray); + } + + if ( empty($initArray['theme_advanced_buttons3']) && !empty($initArray['theme_advanced_buttons4']) ) { + $initArray['theme_advanced_buttons3'] = $initArray['theme_advanced_buttons4']; + $initArray['theme_advanced_buttons4'] = ''; + } + + if ( ! isset($concatenate_scripts) ) + script_concat_settings(); + + $language = $initArray['language']; + + $compressed = $compress_scripts && $concatenate_scripts && isset($_SERVER['HTTP_ACCEPT_ENCODING']) + && false !== stripos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip'); + + /** + * Deprecated + * + * The tiny_mce_version filter is not needed since external plugins are loaded directly by TinyMCE. + * These plugins can be refreshed by appending query string to the URL passed to mce_external_plugins filter. + * If the plugin has a popup dialog, a query string can be added to the button action that opens it (in the plugin's code). + */ + $version = apply_filters('tiny_mce_version', ''); + $version = 'ver=' . $tinymce_version . $version; + + if ( 'en' != $language ) + include_once(ABSPATH . WPINC . '/js/tinymce/langs/wp-langs.php'); + + $mce_options = ''; + foreach ( $initArray as $k => $v ) { + if ( is_bool($v) ) { + $val = $v ? 'true' : 'false'; + $mce_options .= $k . ':' . $val . ', '; + continue; + } elseif ( !empty($v) && is_string($v) && ( ('{' == $v{0} && '}' == $v{strlen($v) - 1}) || ('[' == $v{0} && ']' == $v{strlen($v) - 1}) || preg_match('/^\(?function ?\(/', $v) ) ) { + $mce_options .= $k . ':' . $v . ', '; + continue; + } + + $mce_options .= $k . ':"' . $v . '", '; + } + + $mce_options = rtrim( trim($mce_options), '\n\r,' ); + + do_action('before_wp_tiny_mce', $initArray); ?> + + + +\n"; + else + echo "\n"; + + if ( 'en' != $language && isset($lang) ) + echo "\n"; + else + echo "\n"; +?> + + +
    'wpdialogs,wplink,wpfullscreen' ) ); + + if ( !user_can_richedit() ) { + wp_enqueue_style( 'tinymce-buttons', includes_url('js/tinymce/themes/advanced/skins/wp_theme/ui.css'), array(), $tinymce_version ); + wp_print_styles('tinymce-buttons'); + } +} + +function wp_print_editor_js() { + wp_print_scripts('editor'); +} + +function wp_fullscreen_html() { + global $content_width, $post; + + $width = isset($content_width) && 800 > $content_width ? $content_width : 800; + $width = $width + 10; // compensate for the padding + $dfw_width = get_user_setting( 'dfw_width', $width ); + $save = isset($post->post_status) && $post->post_status == 'publish' ? __('Update') : __('Save'); +?> +
    +
    +
    +
    +
    + +
    + + +
    + +
    + array( 'title' => __('Bold (Ctrl + B)'), 'onclick' => 'fullscreen.b();', 'both' => false ), + 'italic' => array( 'title' => __('Italic (Ctrl + I)'), 'onclick' => 'fullscreen.i();', 'both' => false ), + '0' => 'separator', + 'bullist' => array( 'title' => __('Unordered list (Alt + Shift + U)'), 'onclick' => 'fullscreen.ul();', 'both' => false ), + 'numlist' => array( 'title' => __('Ordered list (Alt + Shift + O)'), 'onclick' => 'fullscreen.ol();', 'both' => false ), + '1' => 'separator', + 'blockquote' => array( 'title' => __('Blockquote (Alt+Shift+Q)'), 'onclick' => 'fullscreen.blockquote();', 'both' => false ), + 'image' => array( 'title' => __('Insert/edit image (Alt + Shift + M)'), 'onclick' => "jQuery('#add_{$media_link_type}').click();", 'both' => true ), + '2' => 'separator', + 'link' => array( 'title' => __('Insert/edit link (Alt + Shift + A)'), 'onclick' => 'fullscreen.link();', 'both' => true ), + 'unlink' => array( 'title' => __('Unlink (Alt + Shift + S)'), 'onclick' => 'fullscreen.unlink();', 'both' => false ), + '3' => 'separator', + 'help' => array( 'title' => __('Help (Alt + Shift + H)'), 'onclick' => 'fullscreen.help();', 'both' => false ) + ); + + $buttons = apply_filters( 'wp_fullscreen_buttons', $buttons ); + + foreach ( $buttons as $button => $args ) { + if ( 'separator' == $args ) { ?> +
    + + + class="wp-fullscreen-both"> + + + +
    + + +
    + +
    + post_status == 'publish' ) _e('Updated.'); else _e('Saved.'); ?> + + +
    + +
    +
    +
    + +
    + + + +
    + +
    + +
    +
    0' ); ?>
    +
    +
    +
    + + +
    +
    +charset) ) + $charset_collate = "DEFAULT CHARACTER SET $wpdb->charset"; +if ( ! empty($wpdb->collate) ) + $charset_collate .= " COLLATE $wpdb->collate"; + +/** Create WordPress database tables SQL */ +$wp_queries = "CREATE TABLE $wpdb->terms ( + term_id bigint(20) unsigned NOT NULL auto_increment, + name varchar(200) NOT NULL default '', + slug varchar(200) NOT NULL default '', + term_group bigint(10) NOT NULL default 0, + PRIMARY KEY (term_id), + UNIQUE KEY slug (slug), + KEY name (name) +) $charset_collate; +CREATE TABLE $wpdb->term_taxonomy ( + term_taxonomy_id bigint(20) unsigned NOT NULL auto_increment, + term_id bigint(20) unsigned NOT NULL default 0, + taxonomy varchar(32) NOT NULL default '', + description longtext NOT NULL, + parent bigint(20) unsigned NOT NULL default 0, + count bigint(20) NOT NULL default 0, + PRIMARY KEY (term_taxonomy_id), + UNIQUE KEY term_id_taxonomy (term_id,taxonomy), + KEY taxonomy (taxonomy) +) $charset_collate; +CREATE TABLE $wpdb->term_relationships ( + object_id bigint(20) unsigned NOT NULL default 0, + term_taxonomy_id bigint(20) unsigned NOT NULL default 0, + term_order int(11) NOT NULL default 0, + PRIMARY KEY (object_id,term_taxonomy_id), + KEY term_taxonomy_id (term_taxonomy_id) +) $charset_collate; +CREATE TABLE $wpdb->commentmeta ( + meta_id bigint(20) unsigned NOT NULL auto_increment, + comment_id bigint(20) unsigned NOT NULL default '0', + meta_key varchar(255) default NULL, + meta_value longtext, + PRIMARY KEY (meta_id), + KEY comment_id (comment_id), + KEY meta_key (meta_key) +) $charset_collate; +CREATE TABLE $wpdb->comments ( + comment_ID bigint(20) unsigned NOT NULL auto_increment, + comment_post_ID bigint(20) unsigned NOT NULL default '0', + comment_author tinytext NOT NULL, + comment_author_email varchar(100) NOT NULL default '', + comment_author_url varchar(200) NOT NULL default '', + comment_author_IP varchar(100) NOT NULL default '', + comment_date datetime NOT NULL default '0000-00-00 00:00:00', + comment_date_gmt datetime NOT NULL default '0000-00-00 00:00:00', + comment_content text NOT NULL, + comment_karma int(11) NOT NULL default '0', + comment_approved varchar(20) NOT NULL default '1', + comment_agent varchar(255) NOT NULL default '', + comment_type varchar(20) NOT NULL default '', + comment_parent bigint(20) unsigned NOT NULL default '0', + user_id bigint(20) unsigned NOT NULL default '0', + PRIMARY KEY (comment_ID), + KEY comment_approved (comment_approved), + KEY comment_post_ID (comment_post_ID), + KEY comment_approved_date_gmt (comment_approved,comment_date_gmt), + KEY comment_date_gmt (comment_date_gmt), + KEY comment_parent (comment_parent) +) $charset_collate; +CREATE TABLE $wpdb->links ( + link_id bigint(20) unsigned NOT NULL auto_increment, + link_url varchar(255) NOT NULL default '', + link_name varchar(255) NOT NULL default '', + link_image varchar(255) NOT NULL default '', + link_target varchar(25) NOT NULL default '', + link_description varchar(255) NOT NULL default '', + link_visible varchar(20) NOT NULL default 'Y', + link_owner bigint(20) unsigned NOT NULL default '1', + link_rating int(11) NOT NULL default '0', + link_updated datetime NOT NULL default '0000-00-00 00:00:00', + link_rel varchar(255) NOT NULL default '', + link_notes mediumtext NOT NULL, + link_rss varchar(255) NOT NULL default '', + PRIMARY KEY (link_id), + KEY link_visible (link_visible) +) $charset_collate; +CREATE TABLE $wpdb->options ( + option_id bigint(20) unsigned NOT NULL auto_increment, + blog_id int(11) NOT NULL default '0', + option_name varchar(64) NOT NULL default '', + option_value longtext NOT NULL, + autoload varchar(20) NOT NULL default 'yes', + PRIMARY KEY (option_id), + UNIQUE KEY option_name (option_name) +) $charset_collate; +CREATE TABLE $wpdb->postmeta ( + meta_id bigint(20) unsigned NOT NULL auto_increment, + post_id bigint(20) unsigned NOT NULL default '0', + meta_key varchar(255) default NULL, + meta_value longtext, + PRIMARY KEY (meta_id), + KEY post_id (post_id), + KEY meta_key (meta_key) +) $charset_collate; +CREATE TABLE $wpdb->posts ( + ID bigint(20) unsigned NOT NULL auto_increment, + post_author bigint(20) unsigned NOT NULL default '0', + post_date datetime NOT NULL default '0000-00-00 00:00:00', + post_date_gmt datetime NOT NULL default '0000-00-00 00:00:00', + post_content longtext NOT NULL, + post_title text NOT NULL, + post_excerpt text NOT NULL, + post_status varchar(20) NOT NULL default 'publish', + comment_status varchar(20) NOT NULL default 'open', + ping_status varchar(20) NOT NULL default 'open', + post_password varchar(20) NOT NULL default '', + post_name varchar(200) NOT NULL default '', + to_ping text NOT NULL, + pinged text NOT NULL, + post_modified datetime NOT NULL default '0000-00-00 00:00:00', + post_modified_gmt datetime NOT NULL default '0000-00-00 00:00:00', + post_content_filtered text NOT NULL, + post_parent bigint(20) unsigned NOT NULL default '0', + guid varchar(255) NOT NULL default '', + menu_order int(11) NOT NULL default '0', + post_type varchar(20) NOT NULL default 'post', + post_mime_type varchar(100) NOT NULL default '', + comment_count bigint(20) NOT NULL default '0', + PRIMARY KEY (ID), + KEY post_name (post_name), + KEY type_status_date (post_type,post_status,post_date,ID), + KEY post_parent (post_parent), + KEY post_author (post_author) +) $charset_collate; +CREATE TABLE $wpdb->users ( + ID bigint(20) unsigned NOT NULL auto_increment, + user_login varchar(60) NOT NULL default '', + user_pass varchar(64) NOT NULL default '', + user_nicename varchar(50) NOT NULL default '', + user_email varchar(100) NOT NULL default '', + user_url varchar(100) NOT NULL default '', + user_registered datetime NOT NULL default '0000-00-00 00:00:00', + user_activation_key varchar(60) NOT NULL default '', + user_status int(11) NOT NULL default '0', + display_name varchar(250) NOT NULL default '', + PRIMARY KEY (ID), + KEY user_login_key (user_login), + KEY user_nicename (user_nicename) +) $charset_collate; +CREATE TABLE $wpdb->usermeta ( + umeta_id bigint(20) unsigned NOT NULL auto_increment, + user_id bigint(20) unsigned NOT NULL default '0', + meta_key varchar(255) default NULL, + meta_value longtext, + PRIMARY KEY (umeta_id), + KEY user_id (user_id), + KEY meta_key (meta_key) +) $charset_collate;"; + +/** + * Create WordPress options and set the default values. + * + * @since 1.5.0 + * @uses $wpdb + * @uses $wp_db_version + */ +function populate_options() { + global $wpdb, $wp_db_version, $current_site; + + $guessurl = wp_guess_url(); + + do_action('populate_options'); + + if ( ini_get('safe_mode') ) { + // Safe mode can break mkdir() so use a flat structure by default. + $uploads_use_yearmonth_folders = 0; + } else { + $uploads_use_yearmonth_folders = 1; + } + + $options = array( + 'siteurl' => $guessurl, + 'blogname' => __('My Site'), + /* translators: blog tagline */ + 'blogdescription' => __('Just another WordPress site'), + 'users_can_register' => 0, + 'admin_email' => 'you@example.com', + 'start_of_week' => 1, + 'use_balanceTags' => 0, + 'use_smilies' => 1, + 'require_name_email' => 1, + 'comments_notify' => 1, + 'posts_per_rss' => 10, + 'rss_use_excerpt' => 0, + 'mailserver_url' => 'mail.example.com', + 'mailserver_login' => 'login@example.com', + 'mailserver_pass' => 'password', + 'mailserver_port' => 110, + 'default_category' => 1, + 'default_comment_status' => 'open', + 'default_ping_status' => 'open', + 'default_pingback_flag' => 1, + 'default_post_edit_rows' => 20, + 'posts_per_page' => 10, + /* translators: default date format, see http://php.net/date */ + 'date_format' => __('F j, Y'), + /* translators: default time format, see http://php.net/date */ + 'time_format' => __('g:i a'), + /* translators: links last updated date format, see http://php.net/date */ + 'links_updated_date_format' => __('F j, Y g:i a'), + 'links_recently_updated_prepend' => '', + 'links_recently_updated_append' => '', + 'links_recently_updated_time' => 120, + 'comment_moderation' => 0, + 'moderation_notify' => 1, + 'permalink_structure' => '', + 'gzipcompression' => 0, + 'hack_file' => 0, + 'blog_charset' => 'UTF-8', + 'moderation_keys' => '', + 'active_plugins' => array(), + 'home' => $guessurl, + 'category_base' => '', + 'ping_sites' => 'http://rpc.pingomatic.com/', + 'advanced_edit' => 0, + 'comment_max_links' => 2, + 'gmt_offset' => date('Z') / 3600, + + // 1.5 + 'default_email_category' => 1, + 'recently_edited' => '', + 'template' => WP_DEFAULT_THEME, + 'stylesheet' => WP_DEFAULT_THEME, + 'comment_whitelist' => 1, + 'blacklist_keys' => '', + 'comment_registration' => 0, + 'rss_language' => 'en', + 'html_type' => 'text/html', + + // 1.5.1 + 'use_trackback' => 0, + + // 2.0 + 'default_role' => 'subscriber', + 'db_version' => $wp_db_version, + + // 2.0.1 + 'uploads_use_yearmonth_folders' => $uploads_use_yearmonth_folders, + 'upload_path' => '', + + // 2.1 + 'blog_public' => '1', + 'default_link_category' => 2, + 'show_on_front' => 'posts', + + // 2.2 + 'tag_base' => '', + + // 2.5 + 'show_avatars' => '1', + 'avatar_rating' => 'G', + 'upload_url_path' => '', + 'thumbnail_size_w' => 150, + 'thumbnail_size_h' => 150, + 'thumbnail_crop' => 1, + 'medium_size_w' => 300, + 'medium_size_h' => 300, + + // 2.6 + 'avatar_default' => 'mystery', + 'enable_app' => 0, + 'enable_xmlrpc' => 0, + + // 2.7 + 'large_size_w' => 1024, + 'large_size_h' => 1024, + 'image_default_link_type' => 'file', + 'image_default_size' => '', + 'image_default_align' => '', + 'close_comments_for_old_posts' => 0, + 'close_comments_days_old' => 14, + 'thread_comments' => 1, + 'thread_comments_depth' => 5, + 'page_comments' => 0, + 'comments_per_page' => 50, + 'default_comments_page' => 'newest', + 'comment_order' => 'asc', + 'sticky_posts' => array(), + 'widget_categories' => array(), + 'widget_text' => array(), + 'widget_rss' => array(), + + // 2.8 + 'timezone_string' => '', + + // 2.9 + 'embed_autourls' => 1, + 'embed_size_w' => '', + 'embed_size_h' => 600, + + // 3.0 + 'page_for_posts' => 0, + 'page_on_front' => 0, + + // 3.1 + 'default_post_format' => 0, + ); + + // 3.0 multisite + if ( is_multisite() ) { + /* translators: blog tagline */ + $options[ 'blogdescription' ] = sprintf(__('Just another %s site'), $current_site->site_name ); + $options[ 'permalink_structure' ] = '/%year%/%monthnum%/%day%/%postname%/'; + } + + // Set autoload to no for these options + $fat_options = array( 'moderation_keys', 'recently_edited', 'blacklist_keys' ); + + $existing_options = $wpdb->get_col("SELECT option_name FROM $wpdb->options"); + + $insert = ''; + foreach ( $options as $option => $value ) { + if ( in_array($option, $existing_options) ) + continue; + if ( in_array($option, $fat_options) ) + $autoload = 'no'; + else + $autoload = 'yes'; + + $option = $wpdb->escape($option); + if ( is_array($value) ) + $value = serialize($value); + $value = $wpdb->escape($value); + if ( !empty($insert) ) + $insert .= ', '; + $insert .= "('$option', '$value', '$autoload')"; + } + + if ( !empty($insert) ) + $wpdb->query("INSERT INTO $wpdb->options (option_name, option_value, autoload) VALUES " . $insert); + + // in case it is set, but blank, update "home" + if ( !__get_option('home') ) update_option('home', $guessurl); + + // Delete unused options + $unusedoptions = array ('blodotgsping_url', 'bodyterminator', 'emailtestonly', 'phoneemail_separator', 'smilies_directory', 'subjectprefix', 'use_bbcode', 'use_blodotgsping', 'use_phoneemail', 'use_quicktags', 'use_weblogsping', 'weblogs_cache_file', 'use_preview', 'use_htmltrans', 'smilies_directory', 'fileupload_allowedusers', 'use_phoneemail', 'default_post_status', 'default_post_category', 'archive_mode', 'time_difference', 'links_minadminlevel', 'links_use_adminlevels', 'links_rating_type', 'links_rating_char', 'links_rating_ignore_zero', 'links_rating_single_image', 'links_rating_image0', 'links_rating_image1', 'links_rating_image2', 'links_rating_image3', 'links_rating_image4', 'links_rating_image5', 'links_rating_image6', 'links_rating_image7', 'links_rating_image8', 'links_rating_image9', 'weblogs_cacheminutes', 'comment_allowed_tags', 'search_engine_friendly_urls', 'default_geourl_lat', 'default_geourl_lon', 'use_default_geourl', 'weblogs_xml_url', 'new_users_can_blog', '_wpnonce', '_wp_http_referer', 'Update', 'action', 'rich_editing', 'autosave_interval', 'deactivated_plugins', 'can_compress_scripts', 'page_uris', 'update_core', 'update_plugins', 'update_themes', 'doing_cron', 'random_seed', 'rss_excerpt_length', 'secret', 'use_linksupdate', 'default_comment_status_page', 'wporg_popular_tags', 'what_to_show'); + foreach ( $unusedoptions as $option ) + delete_option($option); + + // delete obsolete magpie stuff + $wpdb->query("DELETE FROM $wpdb->options WHERE option_name REGEXP '^rss_[0-9a-f]{32}(_ts)?$'"); +} + +/** + * Execute WordPress role creation for the various WordPress versions. + * + * @since 2.0.0 + */ +function populate_roles() { + populate_roles_160(); + populate_roles_210(); + populate_roles_230(); + populate_roles_250(); + populate_roles_260(); + populate_roles_270(); + populate_roles_280(); + populate_roles_300(); +} + +/** + * Create the roles for WordPress 2.0 + * + * @since 2.0.0 + */ +function populate_roles_160() { + // Add roles + + // Dummy gettext calls to get strings in the catalog. + /* translators: user role */ + _x('Administrator', 'User role'); + /* translators: user role */ + _x('Editor', 'User role'); + /* translators: user role */ + _x('Author', 'User role'); + /* translators: user role */ + _x('Contributor', 'User role'); + /* translators: user role */ + _x('Subscriber', 'User role'); + + add_role('administrator', 'Administrator'); + add_role('editor', 'Editor'); + add_role('author', 'Author'); + add_role('contributor', 'Contributor'); + add_role('subscriber', 'Subscriber'); + + // Add caps for Administrator role + $role =& get_role('administrator'); + $role->add_cap('switch_themes'); + $role->add_cap('edit_themes'); + $role->add_cap('activate_plugins'); + $role->add_cap('edit_plugins'); + $role->add_cap('edit_users'); + $role->add_cap('edit_files'); + $role->add_cap('manage_options'); + $role->add_cap('moderate_comments'); + $role->add_cap('manage_categories'); + $role->add_cap('manage_links'); + $role->add_cap('upload_files'); + $role->add_cap('import'); + $role->add_cap('unfiltered_html'); + $role->add_cap('edit_posts'); + $role->add_cap('edit_others_posts'); + $role->add_cap('edit_published_posts'); + $role->add_cap('publish_posts'); + $role->add_cap('edit_pages'); + $role->add_cap('read'); + $role->add_cap('level_10'); + $role->add_cap('level_9'); + $role->add_cap('level_8'); + $role->add_cap('level_7'); + $role->add_cap('level_6'); + $role->add_cap('level_5'); + $role->add_cap('level_4'); + $role->add_cap('level_3'); + $role->add_cap('level_2'); + $role->add_cap('level_1'); + $role->add_cap('level_0'); + + // Add caps for Editor role + $role =& get_role('editor'); + $role->add_cap('moderate_comments'); + $role->add_cap('manage_categories'); + $role->add_cap('manage_links'); + $role->add_cap('upload_files'); + $role->add_cap('unfiltered_html'); + $role->add_cap('edit_posts'); + $role->add_cap('edit_others_posts'); + $role->add_cap('edit_published_posts'); + $role->add_cap('publish_posts'); + $role->add_cap('edit_pages'); + $role->add_cap('read'); + $role->add_cap('level_7'); + $role->add_cap('level_6'); + $role->add_cap('level_5'); + $role->add_cap('level_4'); + $role->add_cap('level_3'); + $role->add_cap('level_2'); + $role->add_cap('level_1'); + $role->add_cap('level_0'); + + // Add caps for Author role + $role =& get_role('author'); + $role->add_cap('upload_files'); + $role->add_cap('edit_posts'); + $role->add_cap('edit_published_posts'); + $role->add_cap('publish_posts'); + $role->add_cap('read'); + $role->add_cap('level_2'); + $role->add_cap('level_1'); + $role->add_cap('level_0'); + + // Add caps for Contributor role + $role =& get_role('contributor'); + $role->add_cap('edit_posts'); + $role->add_cap('read'); + $role->add_cap('level_1'); + $role->add_cap('level_0'); + + // Add caps for Subscriber role + $role =& get_role('subscriber'); + $role->add_cap('read'); + $role->add_cap('level_0'); +} + +/** + * Create and modify WordPress roles for WordPress 2.1. + * + * @since 2.1.0 + */ +function populate_roles_210() { + $roles = array('administrator', 'editor'); + foreach ($roles as $role) { + $role =& get_role($role); + if ( empty($role) ) + continue; + + $role->add_cap('edit_others_pages'); + $role->add_cap('edit_published_pages'); + $role->add_cap('publish_pages'); + $role->add_cap('delete_pages'); + $role->add_cap('delete_others_pages'); + $role->add_cap('delete_published_pages'); + $role->add_cap('delete_posts'); + $role->add_cap('delete_others_posts'); + $role->add_cap('delete_published_posts'); + $role->add_cap('delete_private_posts'); + $role->add_cap('edit_private_posts'); + $role->add_cap('read_private_posts'); + $role->add_cap('delete_private_pages'); + $role->add_cap('edit_private_pages'); + $role->add_cap('read_private_pages'); + } + + $role =& get_role('administrator'); + if ( ! empty($role) ) { + $role->add_cap('delete_users'); + $role->add_cap('create_users'); + } + + $role =& get_role('author'); + if ( ! empty($role) ) { + $role->add_cap('delete_posts'); + $role->add_cap('delete_published_posts'); + } + + $role =& get_role('contributor'); + if ( ! empty($role) ) { + $role->add_cap('delete_posts'); + } +} + +/** + * Create and modify WordPress roles for WordPress 2.3. + * + * @since 2.3.0 + */ +function populate_roles_230() { + $role =& get_role( 'administrator' ); + + if ( !empty( $role ) ) { + $role->add_cap( 'unfiltered_upload' ); + } +} + +/** + * Create and modify WordPress roles for WordPress 2.5. + * + * @since 2.5.0 + */ +function populate_roles_250() { + $role =& get_role( 'administrator' ); + + if ( !empty( $role ) ) { + $role->add_cap( 'edit_dashboard' ); + } +} + +/** + * Create and modify WordPress roles for WordPress 2.6. + * + * @since 2.6.0 + */ +function populate_roles_260() { + $role =& get_role( 'administrator' ); + + if ( !empty( $role ) ) { + $role->add_cap( 'update_plugins' ); + $role->add_cap( 'delete_plugins' ); + } +} + +/** + * Create and modify WordPress roles for WordPress 2.7. + * + * @since 2.7.0 + */ +function populate_roles_270() { + $role =& get_role( 'administrator' ); + + if ( !empty( $role ) ) { + $role->add_cap( 'install_plugins' ); + $role->add_cap( 'update_themes' ); + } +} + +/** + * Create and modify WordPress roles for WordPress 2.8. + * + * @since 2.8.0 + */ +function populate_roles_280() { + $role =& get_role( 'administrator' ); + + if ( !empty( $role ) ) { + $role->add_cap( 'install_themes' ); + } +} + +/** + * Create and modify WordPress roles for WordPress 3.0. + * + * @since 3.0.0 + */ +function populate_roles_300() { + $role =& get_role( 'administrator' ); + + if ( !empty( $role ) ) { + $role->add_cap( 'update_core' ); + $role->add_cap( 'list_users' ); + $role->add_cap( 'remove_users' ); + $role->add_cap( 'add_users' ); + $role->add_cap( 'promote_users' ); + $role->add_cap( 'edit_theme_options' ); + $role->add_cap( 'delete_themes' ); + $role->add_cap( 'export' ); + } +} + +/** + * populate network settings + * + * @since 3.0.0 + * + * @param int $network_id id of network to populate + * @return bool|WP_Error True on success, or WP_Error on warning (with the install otherwise successful, + * so the error code must be checked) or failure. + */ +function populate_network( $network_id = 1, $domain = '', $email = '', $site_name = '', $path = '/', $subdomain_install = false ) { + global $wpdb, $current_site, $wp_db_version, $wp_rewrite; + + $errors = new WP_Error(); + if ( '' == $domain ) + $errors->add( 'empty_domain', __( 'You must provide a domain name.' ) ); + if ( '' == $site_name ) + $errors->add( 'empty_sitename', __( 'You must provide a name for your network of sites.' ) ); + + // check for network collision + if ( $network_id == $wpdb->get_var( $wpdb->prepare( "SELECT id FROM $wpdb->site WHERE id = %d", $network_id ) ) ) + $errors->add( 'siteid_exists', __( 'The network already exists.' ) ); + + $site_user = get_user_by_email( $email ); + if ( ! is_email( $email ) ) + $errors->add( 'invalid_email', __( 'You must provide a valid e-mail address.' ) ); + + if ( $errors->get_error_code() ) + return $errors; + + // set up site tables + $template = get_option( 'template' ); + $stylesheet = get_option( 'stylesheet' ); + $allowed_themes = array( $stylesheet => true ); + if ( $template != $stylesheet ) + $allowed_themes[ $template ] = true; + if ( WP_DEFAULT_THEME != $stylesheet && WP_DEFAULT_THEME != $template ) + $allowed_themes[ WP_DEFAULT_THEME ] = true; + + if ( 1 == $network_id ) { + $wpdb->insert( $wpdb->site, array( 'domain' => $domain, 'path' => $path ) ); + $network_id = $wpdb->insert_id; + } else { + $wpdb->insert( $wpdb->site, array( 'domain' => $domain, 'path' => $path, 'id' => $network_id ) ); + } + + if ( !is_multisite() ) { + $site_admins = array( $site_user->user_login ); + $users = get_users( array( 'fields' => array( 'ID', 'user_login' ) ) ); + if ( $users ) { + foreach ( $users as $user ) { + if ( is_super_admin( $user->ID ) && !in_array( $user->user_login, $site_admins ) ) + $site_admins[] = $user->user_login; + } + } + } else { + $site_admins = get_site_option( 'site_admins' ); + } + + $welcome_email = __( 'Dear User, + +Your new SITE_NAME site has been successfully set up at: +BLOG_URL + +You can log in to the administrator account with the following information: +Username: USERNAME +Password: PASSWORD +Log in Here: BLOG_URLwp-login.php + +We hope you enjoy your new site. +Thanks! + +--The Team @ SITE_NAME' ); + + $sitemeta = array( + 'site_name' => $site_name, + 'admin_email' => $site_user->user_email, + 'admin_user_id' => $site_user->ID, + 'registration' => 'none', + 'upload_filetypes' => 'jpg jpeg png gif mp3 mov avi wmv midi mid pdf', + 'blog_upload_space' => 10, + 'fileupload_maxk' => 1500, + 'site_admins' => $site_admins, + 'allowedthemes' => $allowed_themes, + 'illegal_names' => array( 'www', 'web', 'root', 'admin', 'main', 'invite', 'administrator', 'files' ), + 'wpmu_upgrade_site' => $wp_db_version, + 'welcome_email' => $welcome_email, + 'first_post' => __( 'Welcome to SITE_NAME. This is your first post. Edit or delete it, then start blogging!' ), + // @todo - network admins should have a method of editing the network siteurl (used for cookie hash) + 'siteurl' => get_option( 'siteurl' ) . '/', + 'add_new_users' => '0', + 'upload_space_check_disabled' => '0', + 'subdomain_install' => intval( $subdomain_install ), + 'global_terms_enabled' => global_terms_enabled() ? '1' : '0' + ); + if ( ! $subdomain_install ) + $sitemeta['illegal_names'][] = 'blog'; + + $insert = ''; + foreach ( $sitemeta as $meta_key => $meta_value ) { + $meta_key = $wpdb->escape( $meta_key ); + if ( is_array( $meta_value ) ) + $meta_value = serialize( $meta_value ); + $meta_value = $wpdb->escape( $meta_value ); + if ( !empty( $insert ) ) + $insert .= ', '; + $insert .= "( $network_id, '$meta_key', '$meta_value')"; + } + $wpdb->query( "INSERT INTO $wpdb->sitemeta ( site_id, meta_key, meta_value ) VALUES " . $insert ); + + $current_site->domain = $domain; + $current_site->path = $path; + $current_site->site_name = ucfirst( $domain ); + + if ( !is_multisite() ) { + $wpdb->insert( $wpdb->blogs, array( 'site_id' => $network_id, 'domain' => $domain, 'path' => $path, 'registered' => current_time( 'mysql' ) ) ); + $blog_id = $wpdb->insert_id; + update_user_meta( $site_user->ID, 'source_domain', $domain ); + update_user_meta( $site_user->ID, 'primary_blog', $blog_id ); + if ( !$upload_path = get_option( 'upload_path' ) ) { + $upload_path = substr( WP_CONTENT_DIR, strlen( ABSPATH ) ) . '/uploads'; + update_option( 'upload_path', $upload_path ); + } + update_option( 'fileupload_url', get_option( 'siteurl' ) . '/' . $upload_path ); + } + + if ( $subdomain_install ) + update_option( 'permalink_structure', '/%year%/%monthnum%/%day%/%postname%/'); + else + update_option( 'permalink_structure', '/blog/%year%/%monthnum%/%day%/%postname%/'); + + $wp_rewrite->flush_rules(); + + if ( $subdomain_install ) { + $vhost_ok = false; + $errstr = ''; + $hostname = substr( md5( time() ), 0, 6 ) . '.' . $domain; // Very random hostname! + $page = wp_remote_get( 'http://' . $hostname, array( 'timeout' => 5, 'httpversion' => '1.1' ) ); + if ( is_wp_error( $page ) ) + $errstr = $page->get_error_message(); + elseif ( 200 == wp_remote_retrieve_response_code( $page ) ) + $vhost_ok = true; + + if ( ! $vhost_ok ) { + $msg = '

    ' . __( 'Warning! Wildcard DNS may not be configured correctly!' ) . '

    '; + $msg .= '

    ' . sprintf( __( 'The installer attempted to contact a random hostname (%1$s) on your domain.' ), $hostname ); + if ( ! empty ( $errstr ) ) + $msg .= ' ' . sprintf( __( 'This resulted in an error message: %s' ), '' . $errstr . '' ); + $msg .= '

    '; + $msg .= '

    ' . __( 'To use a subdomain configuration, you must have a wildcard entry in your DNS. This usually means adding a * hostname record pointing at your web server in your DNS configuration tool.' ) . '

    '; + $msg .= '

    ' . __( 'You can still use your site but any subdomain you create may not be accessible. If you know your DNS is correct, ignore this message.' ) . '

    '; + return new WP_Error( 'no_wildcard_dns', $msg ); + } + } + + return true; +} + +?> diff --git a/src/wp-admin/includes/taxonomy.php b/src/wp-admin/includes/taxonomy.php new file mode 100644 index 0000000..12e231a --- /dev/null +++ b/src/wp-admin/includes/taxonomy.php @@ -0,0 +1,252 @@ + $cat_name, 'category_parent' => $parent) ); +} + +/** + * {@internal Missing Short Description}} + * + * @since 2.0.0 + * + * @param unknown_type $categories + * @param unknown_type $post_id + * @return unknown + */ +function wp_create_categories($categories, $post_id = '') { + $cat_ids = array (); + foreach ($categories as $category) { + if ($id = category_exists($category)) + $cat_ids[] = $id; + else + if ($id = wp_create_category($category)) + $cat_ids[] = $id; + } + + if ( $post_id ) + wp_set_post_categories($post_id, $cat_ids); + + return $cat_ids; +} + +/** + * Updates an existing Category or creates a new Category. + * + * @since 2.0.0 + * + * @param mixed $catarr See defaults below. Set 'cat_ID' to a non-zero value to update an existing category. The 'taxonomy' key was added in 3.0.0. + * @param bool $wp_error Optional, since 2.5.0. Set this to true if the caller handles WP_Error return values. + * @return int|object The ID number of the new or updated Category on success. Zero or a WP_Error on failure, depending on param $wp_error. + */ +function wp_insert_category($catarr, $wp_error = false) { + $cat_defaults = array('cat_ID' => 0, 'taxonomy' => 'category', 'cat_name' => '', 'category_description' => '', 'category_nicename' => '', 'category_parent' => ''); + $catarr = wp_parse_args($catarr, $cat_defaults); + extract($catarr, EXTR_SKIP); + + if ( trim( $cat_name ) == '' ) { + if ( ! $wp_error ) + return 0; + else + return new WP_Error( 'cat_name', __('You did not enter a category name.') ); + } + + $cat_ID = (int) $cat_ID; + + // Are we updating or creating? + if ( !empty ($cat_ID) ) + $update = true; + else + $update = false; + + $name = $cat_name; + $description = $category_description; + $slug = $category_nicename; + $parent = $category_parent; + + $parent = (int) $parent; + if ( $parent < 0 ) + $parent = 0; + + if ( empty($parent) || !category_exists( $parent ) || ($cat_ID && cat_is_ancestor_of($cat_ID, $parent) ) ) + $parent = 0; + + $args = compact('name', 'slug', 'parent', 'description'); + + if ( $update ) + $cat_ID = wp_update_term($cat_ID, $taxonomy, $args); + else + $cat_ID = wp_insert_term($cat_name, $taxonomy, $args); + + if ( is_wp_error($cat_ID) ) { + if ( $wp_error ) + return $cat_ID; + else + return 0; + } + + return $cat_ID['term_id']; +} + +/** + * Aliases wp_insert_category() with minimal args. + * + * If you want to update only some fields of an existing category, call this + * function with only the new values set inside $catarr. + * + * @since 2.0.0 + * + * @param array $catarr The 'cat_ID' value is required. All other keys are optional. + * @return int|bool The ID number of the new or updated Category on success. Zero or FALSE on failure. + */ +function wp_update_category($catarr) { + $cat_ID = (int) $catarr['cat_ID']; + + if ( isset($catarr['category_parent']) && ($cat_ID == $catarr['category_parent']) ) + return false; + + // First, get all of the original fields + $category = get_category($cat_ID, ARRAY_A); + + // Escape data pulled from DB. + $category = add_magic_quotes($category); + + // Merge old and new fields with new fields overwriting old ones. + $catarr = array_merge($category, $catarr); + + return wp_insert_category($catarr); +} + +// +// Tags +// + +/** + * {@internal Missing Short Description}} + * + * @since 2.3.0 + * + * @param unknown_type $tag_name + * @return unknown + */ +function tag_exists($tag_name) { + return term_exists($tag_name, 'post_tag'); +} + +/** + * {@internal Missing Short Description}} + * + * @since 2.3.0 + * + * @param unknown_type $tag_name + * @return unknown + */ +function wp_create_tag($tag_name) { + return wp_create_term( $tag_name, 'post_tag'); +} + +/** + * {@internal Missing Short Description}} + * + * @since 2.3.0 + * + * @param unknown_type $post_id + * @return unknown + */ +function get_tags_to_edit( $post_id, $taxonomy = 'post_tag' ) { + return get_terms_to_edit( $post_id, $taxonomy); +} + +/** + * {@internal Missing Short Description}} + * + * @since 2.8.0 + * + * @param unknown_type $post_id + * @return unknown + */ +function get_terms_to_edit( $post_id, $taxonomy = 'post_tag' ) { + $post_id = (int) $post_id; + if ( !$post_id ) + return false; + + $tags = wp_get_post_terms($post_id, $taxonomy, array()); + + if ( !$tags ) + return false; + + if ( is_wp_error($tags) ) + return $tags; + + foreach ( $tags as $tag ) + $tag_names[] = $tag->name; + $tags_to_edit = join( ',', $tag_names ); + $tags_to_edit = esc_attr( $tags_to_edit ); + $tags_to_edit = apply_filters( 'terms_to_edit', $tags_to_edit, $taxonomy ); + + return $tags_to_edit; +} + +/** + * {@internal Missing Short Description}} + * + * @since 2.8.0 + * + * @param unknown_type $tag_name + * @return unknown + */ +function wp_create_term($tag_name, $taxonomy = 'post_tag') { + if ( $id = term_exists($tag_name, $taxonomy) ) + return $id; + + return wp_insert_term($tag_name, $taxonomy); +} diff --git a/src/wp-admin/includes/template.php b/src/wp-admin/includes/template.php new file mode 100644 index 0000000..a488baf --- /dev/null +++ b/src/wp-admin/includes/template.php @@ -0,0 +1,2228 @@ + 'parent', 'id' => 'term_id'); //TODO: decouple this + + function start_lvl(&$output, $depth, $args) { + $indent = str_repeat("\t", $depth); + $output .= "$indent
      \n"; + } + + function end_lvl(&$output, $depth, $args) { + $indent = str_repeat("\t", $depth); + $output .= "$indent
    \n"; + } + + function start_el(&$output, $category, $depth, $args) { + extract($args); + if ( empty($taxonomy) ) + $taxonomy = 'category'; + + if ( $taxonomy == 'category' ) + $name = 'post_category'; + else + $name = 'tax_input['.$taxonomy.']'; + + $class = in_array( $category->term_id, $popular_cats ) ? ' class="popular-category"' : ''; + $output .= "\n
  • " . ''; + } + + function end_el(&$output, $category, $depth, $args) { + $output .= "
  • \n"; + } +} + +/** + * {@internal Missing Short Description}} + * + * @since 2.5.1 + * + * @param unknown_type $post_id + * @param unknown_type $descendants_and_self + * @param unknown_type $selected_cats + * @param unknown_type $popular_cats + */ +function wp_category_checklist( $post_id = 0, $descendants_and_self = 0, $selected_cats = false, $popular_cats = false, $walker = null, $checked_ontop = true ) { + wp_terms_checklist($post_id, + array( + 'taxonomy' => 'category', + 'descendants_and_self' => $descendants_and_self, + 'selected_cats' => $selected_cats, + 'popular_cats' => $popular_cats, + 'walker' => $walker, + 'checked_ontop' => $checked_ontop + )); +} + +/** + * Taxonomy independent version of wp_category_checklist + * + * @since 3.0.0 + * + * @param int $post_id + * @param array $args + */ +function wp_terms_checklist($post_id = 0, $args = array()) { + $defaults = array( + 'descendants_and_self' => 0, + 'selected_cats' => false, + 'popular_cats' => false, + 'walker' => null, + 'taxonomy' => 'category', + 'checked_ontop' => true + ); + extract( wp_parse_args($args, $defaults), EXTR_SKIP ); + + if ( empty($walker) || !is_a($walker, 'Walker') ) + $walker = new Walker_Category_Checklist; + + $descendants_and_self = (int) $descendants_and_self; + + $args = array('taxonomy' => $taxonomy); + + $tax = get_taxonomy($taxonomy); + $args['disabled'] = !current_user_can($tax->cap->assign_terms); + + if ( is_array( $selected_cats ) ) + $args['selected_cats'] = $selected_cats; + elseif ( $post_id ) + $args['selected_cats'] = wp_get_object_terms($post_id, $taxonomy, array_merge($args, array('fields' => 'ids'))); + else + $args['selected_cats'] = array(); + + if ( is_array( $popular_cats ) ) + $args['popular_cats'] = $popular_cats; + else + $args['popular_cats'] = get_terms( $taxonomy, array( 'fields' => 'ids', 'orderby' => 'count', 'order' => 'DESC', 'number' => 10, 'hierarchical' => false ) ); + + if ( $descendants_and_self ) { + $categories = (array) get_terms($taxonomy, array( 'child_of' => $descendants_and_self, 'hierarchical' => 0, 'hide_empty' => 0 ) ); + $self = get_term( $descendants_and_self, $taxonomy ); + array_unshift( $categories, $self ); + } else { + $categories = (array) get_terms($taxonomy, array('get' => 'all')); + } + + if ( $checked_ontop ) { + // Post process $categories rather than adding an exclude to the get_terms() query to keep the query the same across all posts (for any query cache) + $checked_categories = array(); + $keys = array_keys( $categories ); + + foreach( $keys as $k ) { + if ( in_array( $categories[$k]->term_id, $args['selected_cats'] ) ) { + $checked_categories[] = $categories[$k]; + unset( $categories[$k] ); + } + } + + // Put checked cats on top + echo call_user_func_array(array(&$walker, 'walk'), array($checked_categories, 0, $args)); + } + // Then the rest of them + echo call_user_func_array(array(&$walker, 'walk'), array($categories, 0, $args)); +} + +/** + * {@internal Missing Short Description}} + * + * @since 2.5.0 + * + * @param unknown_type $taxonomy + * @param unknown_type $default + * @param unknown_type $number + * @param unknown_type $echo + * @return unknown + */ +function wp_popular_terms_checklist( $taxonomy, $default = 0, $number = 10, $echo = true ) { + global $post_ID; + + if ( $post_ID ) + $checked_terms = wp_get_object_terms($post_ID, $taxonomy, array('fields'=>'ids')); + else + $checked_terms = array(); + + $terms = get_terms( $taxonomy, array( 'orderby' => 'count', 'order' => 'DESC', 'number' => $number, 'hierarchical' => false ) ); + + $tax = get_taxonomy($taxonomy); + if ( ! current_user_can($tax->cap->assign_terms) ) + $disabled = 'disabled="disabled"'; + else + $disabled = ''; + + $popular_ids = array(); + foreach ( (array) $terms as $term ) { + $popular_ids[] = $term->term_id; + if ( !$echo ) // hack for AJAX use + continue; + $id = "popular-$taxonomy-$term->term_id"; + $checked = in_array( $term->term_id, $checked_terms ) ? 'checked="checked"' : ''; + ?> + + + + 'name', 'hide_empty' => 0 ) ); + + if ( empty( $categories ) ) + return; + + foreach ( $categories as $category ) { + $cat_id = $category->term_id; + $name = esc_html( apply_filters( 'the_category', $category->name ) ); + $checked = in_array( $cat_id, $checked_categories ) ? ' checked="checked"' : ''; + echo '"; + } +} + +/** + * Get the column headers for a screen + * + * @since 2.7.0 + * + * @param string|object $screen The screen you want the headers for + * @return array Containing the headers in the format id => UI String + */ +function get_column_headers( $screen ) { + if ( is_string( $screen ) ) + $screen = convert_to_screen( $screen ); + + global $_wp_column_headers; + + if ( !isset( $_wp_column_headers[ $screen->id ] ) ) { + $_wp_column_headers[ $screen->id ] = apply_filters( 'manage_' . $screen->id . '_columns', array() ); + } + + return $_wp_column_headers[ $screen->id ]; +} + +/** + * Get a list of hidden columns. + * + * @since 2.7.0 + * + * @param string|object $screen The screen you want the hidden columns for + * @return array + */ +function get_hidden_columns( $screen ) { + if ( is_string( $screen ) ) + $screen = convert_to_screen( $screen ); + + return (array) get_user_option( 'manage' . $screen->id . 'columnshidden' ); +} + +// adds hidden fields with the data for use in the inline editor for posts and pages +/** + * {@internal Missing Short Description}} + * + * @since 2.7.0 + * + * @param unknown_type $post + */ +function get_inline_data($post) { + $post_type_object = get_post_type_object($post->post_type); + if ( ! current_user_can($post_type_object->cap->edit_post, $post->ID) ) + return; + + $title = esc_textarea( trim( $post->post_title ) ); + + echo ' +'; +} + +/** + * {@internal Missing Short Description}} + * + * @since 2.7.0 + * + * @param unknown_type $position + * @param unknown_type $checkbox + * @param unknown_type $mode + */ +function wp_comment_reply($position = '1', $checkbox = false, $mode = 'single', $table_row = true) { + // allow plugin to replace the popup content + $content = apply_filters( 'wp_comment_reply', '', array('position' => $position, 'checkbox' => $checkbox, 'mode' => $mode) ); + + if ( ! empty($content) ) { + echo $content; + return; + } + + if ( $mode == 'single' ) { + $wp_list_table = _get_list_table('WP_Post_Comments_List_Table'); + } else { + $wp_list_table = _get_list_table('WP_Comments_List_Table'); + } + +?> +
    + +
    + + + +
    + + + + + + + ' . _x( 'Name', 'meta name' ) . ' + ' . __( 'Value' ) . ' + + + + + +'; //TBODY needed for list-manipulation JS + return; + } + $count = 0; +?> + + + + + + + + + + +
    + + $entry['meta_id'] = (int) $entry['meta_id']; + + $delete_nonce = wp_create_nonce( 'delete-meta_' . $entry['meta_id'] ); + + $r .= "\n\t"; + $r .= "\n\t\t"; + + $r .= "\n\t\t
    "; + $r .= get_submit_button( __( 'Delete' ), "delete:the-list:meta-{$entry['meta_id']}::_ajax_nonce=$delete_nonce deletemeta", "deletemeta[{$entry['meta_id']}]", false, array( 'tabindex' => '6' ) ); + $r .= "\n\t\t"; + $r .= get_submit_button( __( 'Update' ), "add:the-list:meta-{$entry['meta_id']}::_ajax_nonce-add-meta=$update_nonce updatemeta" , 'updatemeta', false, array( 'tabindex' => '6' ) ); + $r .= "
    "; + $r .= wp_nonce_field( 'change-meta', '_ajax_nonce', false, false ); + $r .= ""; + + $r .= "\n\t\t\n\t"; + return $r; +} + +/** + * {@internal Missing Short Description}} + * + * @since 1.2.0 + */ +function meta_form() { + global $wpdb; + $limit = (int) apply_filters( 'postmeta_form_limit', 30 ); + $keys = $wpdb->get_col( " + SELECT meta_key + FROM $wpdb->postmeta + GROUP BY meta_key + HAVING meta_key NOT LIKE '\_%' + ORDER BY meta_key + LIMIT $limit" ); + if ( $keys ) + natcasesort($keys); +?> +

    + + + + + + + + + + + + + + + + +
    + + + + + + + + + +
    + 'addmetasub', 'tabindex' => '9' ) ); ?> + +
    +post_status, array('draft', 'pending') ) && (!$post->post_date_gmt || '0000-00-00 00:00:00' == $post->post_date_gmt ) ); + + $tab_index_attribute = ''; + if ( (int) $tab_index > 0 ) + $tab_index_attribute = " tabindex=\"$tab_index\""; + + // echo '
    '; + + $time_adj = current_time('timestamp'); + $post_date = ($for_post) ? $post->post_date : $comment->comment_date; + $jj = ($edit) ? mysql2date( 'd', $post_date, false ) : gmdate( 'd', $time_adj ); + $mm = ($edit) ? mysql2date( 'm', $post_date, false ) : gmdate( 'm', $time_adj ); + $aa = ($edit) ? mysql2date( 'Y', $post_date, false ) : gmdate( 'Y', $time_adj ); + $hh = ($edit) ? mysql2date( 'H', $post_date, false ) : gmdate( 'H', $time_adj ); + $mn = ($edit) ? mysql2date( 'i', $post_date, false ) : gmdate( 'i', $time_adj ); + $ss = ($edit) ? mysql2date( 's', $post_date, false ) : gmdate( 's', $time_adj ); + + $cur_jj = gmdate( 'd', $time_adj ); + $cur_mm = gmdate( 'm', $time_adj ); + $cur_aa = gmdate( 'Y', $time_adj ); + $cur_hh = gmdate( 'H', $time_adj ); + $cur_mn = gmdate( 'i', $time_adj ); + + $month = "'; + + $day = ''; + $year = ''; + $hour = ''; + $minute = ''; + + echo '
    '; + /* translators: 1: month input, 2: day input, 3: year input, 4: hour input, 5: minute input */ + printf(__('%1$s%2$s, %3$s @ %4$s : %5$s'), $month, $day, $year, $hour, $minute); + + echo '
    '; + + if ( $multi ) return; + + echo "\n\n"; + foreach ( array('mm', 'jj', 'aa', 'hh', 'mn') as $timeunit ) { + echo '' . "\n"; + $cur_timeunit = 'cur_' . $timeunit; + echo '' . "\n"; + } +?> + +

    + + +

    +$template"; + endforeach; +} + +/** + * {@internal Missing Short Description}} + * + * @since 1.5.0 + * + * @param unknown_type $default + * @param unknown_type $parent + * @param unknown_type $level + * @return unknown + */ +function parent_dropdown( $default = 0, $parent = 0, $level = 0 ) { + global $wpdb, $post_ID; + $items = $wpdb->get_results( $wpdb->prepare("SELECT ID, post_parent, post_title FROM $wpdb->posts WHERE post_parent = %d AND post_type = 'page' ORDER BY menu_order", $parent) ); + + if ( $items ) { + foreach ( $items as $item ) { + // A page cannot be its own parent. + if (!empty ( $post_ID ) ) { + if ( $item->ID == $post_ID ) { + continue; + } + } + $pad = str_repeat( ' ', $level * 3 ); + if ( $item->ID == $default) + $current = ' selected="selected"'; + else + $current = ''; + + echo "\n\t"; + parent_dropdown( $default, $item->ID, $level +1 ); + } + } else { + return false; + } +} + +/** + * {@internal Missing Short Description}} + * + * @since 2.0.0 + * + * @param unknown_type $id + * @return unknown + */ +function the_attachment_links( $id = false ) { + $id = (int) $id; + $post = & get_post( $id ); + + if ( $post->post_type != 'attachment' ) + return false; + + $icon = wp_get_attachment_image( $post->ID, 'thumbnail', true ); + $attachment_data = wp_get_attachment_metadata( $id ); + $thumb = isset( $attachment_data['thumb'] ); +?> + + html elements for role selectors + * + * @since 2.1.0 + * + * @param string $selected slug for the role that should be already selected + */ +function wp_dropdown_roles( $selected = false ) { + $p = ''; + $r = ''; + + $editable_roles = get_editable_roles(); + + foreach ( $editable_roles as $role => $details ) { + $name = translate_user_role($details['name'] ); + if ( $selected == $role ) // preselect specified role + $p = "\n\t"; + else + $r .= "\n\t"; + } + echo $p . $r; +} + +/** + * {@internal Missing Short Description}} + * + * @since 2.3.0 + * + * @param unknown_type $size + * @return unknown + */ +function wp_convert_hr_to_bytes( $size ) { + $size = strtolower($size); + $bytes = (int) $size; + if ( strpos($size, 'k') !== false ) + $bytes = intval($size) * 1024; + elseif ( strpos($size, 'm') !== false ) + $bytes = intval($size) * 1024 * 1024; + elseif ( strpos($size, 'g') !== false ) + $bytes = intval($size) * 1024 * 1024 * 1024; + return $bytes; +} + +/** + * {@internal Missing Short Description}} + * + * @since 2.3.0 + * + * @param unknown_type $bytes + * @return unknown + */ +function wp_convert_bytes_to_hr( $bytes ) { + $units = array( 0 => 'B', 1 => 'kB', 2 => 'MB', 3 => 'GB' ); + $log = log( $bytes, 1024 ); + $power = (int) $log; + $size = pow(1024, $log - $power); + return $size . $units[$power]; +} + +/** + * {@internal Missing Short Description}} + * + * @since 2.5.0 + * + * @return unknown + */ +function wp_max_upload_size() { + $u_bytes = wp_convert_hr_to_bytes( ini_get( 'upload_max_filesize' ) ); + $p_bytes = wp_convert_hr_to_bytes( ini_get( 'post_max_size' ) ); + $bytes = apply_filters( 'upload_size_limit', min($u_bytes, $p_bytes), $u_bytes, $p_bytes ); + return $bytes; +} + +/** + * Outputs the form used by the importers to accept the data to be imported + * + * @since 2.0.0 + * + * @param string $action The action attribute for the form. + */ +function wp_import_upload_form( $action ) { + $bytes = apply_filters( 'import_upload_size_limit', wp_max_upload_size() ); + $size = wp_convert_bytes_to_hr( $bytes ); + $upload_dir = wp_upload_dir(); + if ( ! empty( $upload_dir['error'] ) ) : + ?>

    +

    +
    +

    + () + + + +

    + +
    + $id, 'title' => $title, 'callback' => $callback, 'args' => $callback_args); +} + +/** + * Meta-Box template function + * + * @since 2.5.0 + * + * @param string $page page identifier, also known as screen identifier + * @param string $context box context + * @param mixed $object gets passed to the box callback function as first parameter + * @return int number of meta_boxes + */ +function do_meta_boxes($page, $context, $object) { + global $wp_meta_boxes; + static $already_sorted = false; + + $hidden = get_hidden_meta_boxes($page); + + printf('
    ', htmlspecialchars($context)); + + $i = 0; + do { + // Grab the ones the user has manually sorted. Pull them out of their previous context/priority and into the one the user chose + if ( !$already_sorted && $sorted = get_user_option( "meta-box-order_$page" ) ) { + foreach ( $sorted as $box_context => $ids ) { + foreach ( explode(',', $ids ) as $id ) { + if ( $id && 'dashboard_browser_nag' !== $id ) + add_meta_box( $id, null, null, $page, $box_context, 'sorted' ); + } + } + } + $already_sorted = true; + + if ( !isset($wp_meta_boxes) || !isset($wp_meta_boxes[$page]) || !isset($wp_meta_boxes[$page][$context]) ) + break; + + foreach ( array('high', 'sorted', 'core', 'default', 'low') as $priority ) { + if ( isset($wp_meta_boxes[$page][$context][$priority]) ) { + foreach ( (array) $wp_meta_boxes[$page][$context][$priority] as $box ) { + if ( false == $box || ! $box['title'] ) + continue; + $i++; + $style = ''; + $hidden_class = in_array($box['id'], $hidden) ? ' hide-if-js' : ''; + echo '
    ' . "\n"; + if ( 'dashboard_browser_nag' != $box['id'] ) + echo '

    '; + echo "

    {$box['title']}

    \n"; + echo '
    ' . "\n"; + call_user_func($box['callback'], $object, $box); + echo "
    \n"; + echo "
    \n"; + } + } + } + } while(0); + + echo "
    "; + + return $i; + +} + +/** + * Remove a meta box from an edit form. + * + * @since 2.6.0 + * + * @param string $id String for use in the 'id' attribute of tags. + * @param string $page The type of edit page on which to show the box (post, page, link). + * @param string $context The context within the page where the boxes should show ('normal', 'advanced'). + */ +function remove_meta_box($id, $page, $context) { + global $wp_meta_boxes; + + if ( !isset($wp_meta_boxes) ) + $wp_meta_boxes = array(); + if ( !isset($wp_meta_boxes[$page]) ) + $wp_meta_boxes[$page] = array(); + if ( !isset($wp_meta_boxes[$page][$context]) ) + $wp_meta_boxes[$page][$context] = array(); + + foreach ( array('high', 'core', 'default', 'low') as $priority ) + $wp_meta_boxes[$page][$context][$priority][$id] = false; +} + +/** + * {@internal Missing Short Description}} + * + * @since 2.7.0 + * + * @param unknown_type $screen + */ +function meta_box_prefs($screen) { + global $wp_meta_boxes; + + if ( is_string($screen) ) + $screen = convert_to_screen($screen); + + if ( empty($wp_meta_boxes[$screen->id]) ) + return; + + $hidden = get_hidden_meta_boxes($screen); + + foreach ( array_keys($wp_meta_boxes[$screen->id]) as $context ) { + foreach ( array_keys($wp_meta_boxes[$screen->id][$context]) as $priority ) { + foreach ( $wp_meta_boxes[$screen->id][$context][$priority] as $box ) { + if ( false == $box || ! $box['title'] ) + continue; + // Submit box cannot be hidden + if ( 'submitdiv' == $box['id'] || 'linksubmitdiv' == $box['id'] ) + continue; + $box_id = $box['id']; + echo '\n"; + } + } + } +} + +/** + * Get Hidden Meta Boxes + * + * @since 2.7.0 + * + * @param string|object $screen Screen identifier + * @return array Hidden Meta Boxes + */ +function get_hidden_meta_boxes( $screen ) { + if ( is_string( $screen ) ) + $screen = convert_to_screen( $screen ); + + $hidden = get_user_option( "metaboxhidden_{$screen->id}" ); + + // Hide slug boxes by default + if ( !is_array( $hidden ) ) { + if ( 'post' == $screen->base || 'page' == $screen->base ) + $hidden = array('slugdiv', 'trackbacksdiv', 'postcustom', 'postexcerpt', 'commentstatusdiv', 'commentsdiv', 'authordiv', 'revisionsdiv'); + else + $hidden = array( 'slugdiv' ); + $hidden = apply_filters('default_hidden_meta_boxes', $hidden, $screen); + } + + return $hidden; +} + +/** + * Add a new section to a settings page. + * + * Part of the Settings API. Use this to define new settings sections for an admin page. + * Show settings sections in your admin page callback function with do_settings_sections(). + * Add settings fields to your section with add_settings_field() + * + * The $callback argument should be the name of a function that echoes out any + * content you want to show at the top of the settings section before the actual + * fields. It can output nothing if you want. + * + * @since 2.7.0 + * + * @global $wp_settings_sections Storage array of all settings sections added to admin pages + * + * @param string $id Slug-name to identify the section. Used in the 'id' attribute of tags. + * @param string $title Formatted title of the section. Shown as the heading for the section. + * @param string $callback Function that echos out any content at the top of the section (between heading and fields). + * @param string $page The slug-name of the settings page on which to show the section. Built-in pages include 'general', 'reading', 'writing', 'discussion', 'media', etc. Create your own using add_options_page(); + */ +function add_settings_section($id, $title, $callback, $page) { + global $wp_settings_sections; + + if ( 'misc' == $page ) { + _deprecated_argument( __FUNCTION__, '3.0', __( 'The miscellaneous options group has been removed. Use another settings group.' ) ); + $page = 'general'; + } + + if ( !isset($wp_settings_sections) ) + $wp_settings_sections = array(); + if ( !isset($wp_settings_sections[$page]) ) + $wp_settings_sections[$page] = array(); + if ( !isset($wp_settings_sections[$page][$id]) ) + $wp_settings_sections[$page][$id] = array(); + + $wp_settings_sections[$page][$id] = array('id' => $id, 'title' => $title, 'callback' => $callback); +} + +/** + * Add a new field to a section of a settings page + * + * Part of the Settings API. Use this to define a settings field that will show + * as part of a settings section inside a settings page. The fields are shown using + * do_settings_fields() in do_settings-sections() + * + * The $callback argument should be the name of a function that echoes out the + * html input tags for this setting field. Use get_option() to retrive existing + * values to show. + * + * @since 2.7.0 + * + * @global $wp_settings_fields Storage array of settings fields and info about their pages/sections + * + * @param string $id Slug-name to identify the field. Used in the 'id' attribute of tags. + * @param string $title Formatted title of the field. Shown as the label for the field during output. + * @param string $callback Function that fills the field with the desired form inputs. The function should echo its output. + * @param string $page The slug-name of the settings page on which to show the section (general, reading, writing, ...). + * @param string $section The slug-name of the section of the settingss page in which to show the box (default, ...). + * @param array $args Additional arguments + */ +function add_settings_field($id, $title, $callback, $page, $section = 'default', $args = array()) { + global $wp_settings_fields; + + if ( 'misc' == $page ) { + _deprecated_argument( __FUNCTION__, '3.0', __( 'The miscellaneous options group has been removed. Use another settings group.' ) ); + $page = 'general'; + } + + if ( !isset($wp_settings_fields) ) + $wp_settings_fields = array(); + if ( !isset($wp_settings_fields[$page]) ) + $wp_settings_fields[$page] = array(); + if ( !isset($wp_settings_fields[$page][$section]) ) + $wp_settings_fields[$page][$section] = array(); + + $wp_settings_fields[$page][$section][$id] = array('id' => $id, 'title' => $title, 'callback' => $callback, 'args' => $args); +} + +/** + * Prints out all settings sections added to a particular settings page + * + * Part of the Settings API. Use this in a settings page callback function + * to output all the sections and fields that were added to that $page with + * add_settings_section() and add_settings_field() + * + * @global $wp_settings_sections Storage array of all settings sections added to admin pages + * @global $wp_settings_fields Storage array of settings fields and info about their pages/sections + * @since 2.7.0 + * + * @param string $page The slug name of the page whos settings sections you want to output + */ +function do_settings_sections($page) { + global $wp_settings_sections, $wp_settings_fields; + + if ( !isset($wp_settings_sections) || !isset($wp_settings_sections[$page]) ) + return; + + foreach ( (array) $wp_settings_sections[$page] as $section ) { + echo "

    {$section['title']}

    \n"; + call_user_func($section['callback'], $section); + if ( !isset($wp_settings_fields) || !isset($wp_settings_fields[$page]) || !isset($wp_settings_fields[$page][$section['id']]) ) + continue; + echo ''; + do_settings_fields($page, $section['id']); + echo '
    '; + } +} + +/** + * Print out the settings fields for a particular settings section + * + * Part of the Settings API. Use this in a settings page to output + * a specific section. Should normally be called by do_settings_sections() + * rather than directly. + * + * @global $wp_settings_fields Storage array of settings fields and their pages/sections + * + * @since 2.7.0 + * + * @param string $page Slug title of the admin page who's settings fields you want to show. + * @param section $section Slug title of the settings section who's fields you want to show. + */ +function do_settings_fields($page, $section) { + global $wp_settings_fields; + + if ( !isset($wp_settings_fields) || !isset($wp_settings_fields[$page]) || !isset($wp_settings_fields[$page][$section]) ) + return; + + foreach ( (array) $wp_settings_fields[$page][$section] as $field ) { + echo ''; + if ( !empty($field['args']['label_for']) ) + echo ''; + else + echo '' . $field['title'] . ''; + echo ''; + call_user_func($field['callback'], $field['args']); + echo ''; + echo ''; + } +} + +/** + * Register a settings error to be displayed to the user + * + * Part of the Settings API. Use this to show messages to users about settings validation + * problems, missing settings or anything else. + * + * Settings errors should be added inside the $sanitize_callback function defined in + * register_setting() for a given setting to give feedback about the submission. + * + * By default messages will show immediately after the submission that generated the error. + * Additional calls to settings_errors() can be used to show errors even when the settings + * page is first accessed. + * + * @since 3.0.0 + * + * @global array $wp_settings_errors Storage array of errors registered during this pageload + * + * @param string $setting Slug title of the setting to which this error applies + * @param string $code Slug-name to identify the error. Used as part of 'id' attribute in HTML output. + * @param string $message The formatted message text to display to the user (will be shown inside styled
    and

    ) + * @param string $type The type of message it is, controls HTML class. Use 'error' or 'updated'. + */ +function add_settings_error( $setting, $code, $message, $type = 'error' ) { + global $wp_settings_errors; + + if ( !isset($wp_settings_errors) ) + $wp_settings_errors = array(); + + $new_error = array( + 'setting' => $setting, + 'code' => $code, + 'message' => $message, + 'type' => $type + ); + $wp_settings_errors[] = $new_error; +} + +/** + * Fetch settings errors registered by add_settings_error() + * + * Checks the $wp_settings_errors array for any errors declared during the current + * pageload and returns them. + * + * If changes were just submitted ($_GET['settings-updated']) and settings errors were saved + * to the 'settings_errors' transient then those errors will be returned instead. This + * is used to pass errors back across pageloads. + * + * Use the $sanitize argument to manually re-sanitize the option before returning errors. + * This is useful if you have errors or notices you want to show even when the user + * hasn't submitted data (i.e. when they first load an options page, or in admin_notices action hook) + * + * @since 3.0.0 + * + * @global array $wp_settings_errors Storage array of errors registered during this pageload + * + * @param string $setting Optional slug title of a specific setting who's errors you want. + * @param boolean $sanitize Whether to re-sanitize the setting value before returning errors. + * @return array Array of settings errors + */ +function get_settings_errors( $setting = '', $sanitize = FALSE ) { + global $wp_settings_errors; + + // If $sanitize is true, manually re-run the sanitizisation for this option + // This allows the $sanitize_callback from register_setting() to run, adding + // any settings errors you want to show by default. + if ( $sanitize ) + sanitize_option( $setting, get_option($setting)); + + // If settings were passed back from options.php then use them + // Ignore transients if $sanitize is true, we dont' want the old values anyway + if ( isset($_GET['settings-updated']) && $_GET['settings-updated'] && get_transient('settings_errors') ) { + $settings_errors = get_transient('settings_errors'); + delete_transient('settings_errors'); + // Otherwise check global in case validation has been run on this pageload + } elseif ( count( $wp_settings_errors ) ) { + $settings_errors = $wp_settings_errors; + } else { + return; + } + + // Filter the results to those of a specific setting if one was set + if ( $setting ) { + foreach ( (array) $settings_errors as $key => $details ) + if ( $setting != $details['setting'] ) + unset( $settings_errors[$key] ); + } + return $settings_errors; +} + +/** + * Display settings errors registered by add_settings_error() + * + * Part of the Settings API. Outputs a

    for each error retrieved by get_settings_errors(). + * + * This is called automatically after a settings page based on the Settings API is submitted. + * Errors should be added during the validation callback function for a setting defined in register_setting() + * + * The $sanitize option is passed into get_settings_errors() and will re-run the setting sanitization + * on its current value. + * + * The $hide_on_update option will cause errors to only show when the settings page is first loaded. + * if the user has already saved new values it will be hidden to avoid repeating messages already + * shown in the default error reporting after submission. This is useful to show general errors like missing + * settings when the user arrives at the settings page. + * + * @since 3.0.0 + * + * @param string $setting Optional slug title of a specific setting who's errors you want. + * @param boolean $sanitize Whether to re-sanitize the setting value before returning errors. + * @param boolean $hide_on_update If set to true errors will not be shown if the settings page has already been submitted. + */ +function settings_errors( $setting = '', $sanitize = FALSE, $hide_on_update = FALSE ) { + + if ($hide_on_update AND $_GET['settings-updated']) return; + + $settings_errors = get_settings_errors( $setting, $sanitize ); + + if ( !is_array($settings_errors) ) return; + + $output = ''; + foreach ( $settings_errors as $key => $details ) { + $css_id = 'setting-error-' . $details['code']; + $css_class = $details['type'] . ' settings-error'; + $output .= "
    \n"; + $output .= "

    {$details['message']}

    "; + $output .= "
    \n"; + } + echo $output; +} + +/** + * {@internal Missing Short Description}} + * + * @since 2.7.0 + * + * @param unknown_type $found_action + */ +function find_posts_div($found_action = '') { +?> + +post_password ) ) echo esc_attr( $post->post_password ); +} + +/** + * {@internal Missing Short Description}} + * + * @since 2.7.0 + */ +function favorite_actions( $screen = null ) { + $default_action = false; + + if ( is_string($screen) ) + $screen = convert_to_screen($screen); + + if ( $screen->is_user ) + return; + + if ( isset($screen->post_type) ) { + $post_type_object = get_post_type_object($screen->post_type); + if ( 'add' != $screen->action ) + $default_action = array('post-new.php?post_type=' . $post_type_object->name => array($post_type_object->labels->new_item, $post_type_object->cap->edit_posts)); + else + $default_action = array('edit.php?post_type=' . $post_type_object->name => array($post_type_object->labels->name, $post_type_object->cap->edit_posts)); + } + + if ( !$default_action ) { + if ( $screen->is_network ) { + $default_action = array('sites.php' => array( __('Sites'), 'manage_sites')); + } else { + switch ( $screen->id ) { + case 'upload': + $default_action = array('media-new.php' => array(__('New Media'), 'upload_files')); + break; + case 'media': + $default_action = array('upload.php' => array(__('Edit Media'), 'upload_files')); + break; + case 'link-manager': + case 'link': + if ( 'add' != $screen->action ) + $default_action = array('link-add.php' => array(__('New Link'), 'manage_links')); + else + $default_action = array('link-manager.php' => array(__('Edit Links'), 'manage_links')); + break; + case 'users': + $default_action = array('user-new.php' => array(__('New User'), 'create_users')); + break; + case 'user': + $default_action = array('users.php' => array(__('Edit Users'), 'edit_users')); + break; + case 'plugins': + $default_action = array('plugin-install.php' => array(__('Install Plugins'), 'install_plugins')); + break; + case 'plugin-install': + $default_action = array('plugins.php' => array(__('Manage Plugins'), 'activate_plugins')); + break; + case 'themes': + $default_action = array('theme-install.php' => array(__('Install Themes'), 'install_themes')); + break; + case 'theme-install': + $default_action = array('themes.php' => array(__('Manage Themes'), 'switch_themes')); + break; + default: + $default_action = array('post-new.php' => array(__('New Post'), 'edit_posts')); + break; + } + } + } + + if ( !$screen->is_network ) { + $actions = array( + 'post-new.php' => array(__('New Post'), 'edit_posts'), + 'edit.php?post_status=draft' => array(__('Drafts'), 'edit_posts'), + 'post-new.php?post_type=page' => array(__('New Page'), 'edit_pages'), + 'media-new.php' => array(__('Upload'), 'upload_files'), + 'edit-comments.php' => array(__('Comments'), 'moderate_comments') + ); + } else { + $actions = array( + 'sites.php' => array( __('Sites'), 'manage_sites'), + 'users.php' => array( __('Users'), 'manage_network_users') + ); + } + + $default_key = array_keys($default_action); + $default_key = $default_key[0]; + if ( isset($actions[$default_key]) ) + unset($actions[$default_key]); + $actions = array_merge($default_action, $actions); + $actions = apply_filters( 'favorite_actions', $actions, $screen ); + + $allowed_actions = array(); + foreach ( $actions as $action => $data ) { + if ( current_user_can($data[1]) ) + $allowed_actions[$action] = $data[0]; + } + + if ( empty($allowed_actions) ) + return; + + $first = array_keys($allowed_actions); + $first = $first[0]; + echo '
    '; + echo '

    '; + echo '
    '; + + array_shift($allowed_actions); + + foreach ( $allowed_actions as $action => $label) { + echo "\n"; + } + echo "
    \n"; +} + +/** + * Get the post title. + * + * The post title is fetched and if it is blank then a default string is + * returned. + * + * @since 2.7.0 + * @param int $post_id The post id. If not supplied the global $post is used. + * @return string The post title if set + */ +function _draft_or_post_title( $post_id = 0 ) { + $title = get_the_title($post_id); + if ( empty($title) ) + $title = __('(no title)'); + return $title; +} + +/** + * Display the search query. + * + * A simple wrapper to display the "s" parameter in a GET URI. This function + * should only be used when {@link the_search_query()} cannot. + * + * @uses attr + * @since 2.7.0 + * + */ +function _admin_search_query() { + echo isset($_REQUEST['s']) ? esc_attr( stripslashes( $_REQUEST['s'] ) ) : ''; +} + +/** + * Generic Iframe header for use with Thickbox + * + * @since 2.7.0 + * @param string $title Title of the Iframe page. + * @param bool $limit_styles Limit styles to colour-related styles only (unless others are enqueued). + * + */ +function iframe_header( $title = '', $limit_styles = false ) { + show_admin_bar( false ); + global $hook_suffix, $current_screen, $current_user, $admin_body_class, $wp_locale; + $admin_body_class = preg_replace('/[^a-z0-9_-]+/i', '-', $hook_suffix); + $admin_body_class .= ' iframe'; + +?> + > + + +<?php bloginfo('name') ?> › <?php echo $title ?> — <?php _e('WordPress'); ?> + + + + + class="no-js "> + + + + + + +post_password) ) + $post_states['protected'] = __('Password protected'); + if ( 'private' == $post->post_status && 'private' != $post_status ) + $post_states['private'] = __('Private'); + if ( 'draft' == $post->post_status && 'draft' != $post_status ) + $post_states['draft'] = __('Draft'); + if ( 'pending' == $post->post_status && 'pending' != $post_status ) + /* translators: post state */ + $post_states['pending'] = _x('Pending', 'post state'); + if ( is_sticky($post->ID) ) + $post_states['sticky'] = __('Sticky'); + + $post_states = apply_filters( 'display_post_states', $post_states ); + + if ( ! empty($post_states) ) { + $state_count = count($post_states); + $i = 0; + echo ' - '; + foreach ( $post_states as $state ) { + ++$i; + ( $i == $state_count ) ? $sep = '' : $sep = ', '; + echo "$state$sep"; + } + } + + if ( get_post_format( $post->ID ) ) + echo ' - ' . get_post_format_string( get_post_format( $post->ID ) ) . ''; +} + +function _media_states( $post ) { + $media_states = array(); + $stylesheet = get_option('stylesheet'); + + if ( current_theme_supports( 'custom-header') ) { + $meta_header = get_post_meta($post->ID, '_wp_attachment_is_custom_header', true ); + if ( ! empty( $meta_header ) && $meta_header == $stylesheet ) + $media_states[] = __( 'Header Image' ); + } + + if ( current_theme_supports( 'custom-background') ) { + $meta_background = get_post_meta($post->ID, '_wp_attachment_is_custom_background', true ); + if ( ! empty( $meta_background ) && $meta_background == $stylesheet ) + $media_states[] = __( 'Background Image' ); + } + + $media_states = apply_filters( 'display_media_states', $media_states ); + + if ( ! empty( $media_states ) ) { + $state_count = count( $media_states ); + $i = 0; + echo ' - '; + foreach ( $media_states as $state ) { + ++$i; + ( $i == $state_count ) ? $sep = '' : $sep = ', '; + echo "$state$sep"; + } + } +} + +/** + * Convert a screen string to a screen object + * + * @since 3.0.0 + * + * @param string $screen The name of the screen + * @return object An object containing the safe screen name and id + */ +function convert_to_screen( $screen ) { + $screen = str_replace( array('.php', '-new', '-add', '-network', '-user' ), '', $screen); + + if ( is_network_admin() ) + $screen .= '-network'; + elseif ( is_user_admin() ) + $screen .= '-user'; + + $screen = (string) apply_filters( 'screen_meta_screen', $screen ); + $screen = (object) array('id' => $screen, 'base' => $screen); + return $screen; +} + +function screen_meta($screen) { + global $wp_meta_boxes, $_wp_contextual_help, $wp_list_table, $wp_current_screen_options; + + if ( is_string($screen) ) + $screen = convert_to_screen($screen); + + $columns = get_column_headers( $screen ); + $hidden = get_hidden_columns( $screen ); + + $meta_screens = array('index' => 'dashboard'); + + if ( isset($meta_screens[$screen->id]) ) { + $screen->id = $meta_screens[$screen->id]; + $screen->base = $screen->id; + } + + $show_screen = false; + if ( !empty($wp_meta_boxes[$screen->id]) || !empty($columns) ) + $show_screen = true; + + $screen_options = screen_options($screen); + if ( $screen_options ) + $show_screen = true; + + if ( !isset($_wp_contextual_help) ) + $_wp_contextual_help = array(); + + $settings = apply_filters('screen_settings', '', $screen); + + switch ( $screen->id ) { + case 'widgets': + $settings = '

    ' . __('Enable accessibility mode') . '' . __('Disable accessibility mode') . "

    \n"; + $show_screen = true; + break; + } + if ( ! empty( $settings ) ) + $show_screen = true; + + if ( !empty($wp_current_screen_options) ) + $show_screen = true; + + $show_screen = apply_filters('screen_options_show_screen', $show_screen, $screen); + +?> +
    + + + + + + + +
    +id] = $help; +} + +function screen_layout($screen) { + global $screen_layout_columns, $wp_current_screen_options; + + if ( is_string($screen) ) + $screen = convert_to_screen($screen); + + // Back compat for plugins using the filter instead of add_screen_option() + $columns = apply_filters('screen_layout_columns', array(), $screen->id, $screen); + if ( !empty($columns) && isset($columns[$screen->id]) ) + add_screen_option('layout_columns', array('max' => $columns[$screen->id]) ); + + if ( !isset($wp_current_screen_options['layout_columns']) ) { + $screen_layout_columns = 0; + return ''; + } + + $screen_layout_columns = get_user_option("screen_layout_$screen->id"); + $num = $wp_current_screen_options['layout_columns']['max']; + + if ( ! $screen_layout_columns ) { + if ( isset($wp_current_screen_options['layout_columns']['default']) ) + $screen_layout_columns = $wp_current_screen_options['layout_columns']['default']; + else + $screen_layout_columns = 2; + } + + $i = 1; + $return = '
    ' . __('Screen Layout') . "
    \n
    " . __('Number of Columns:') . "\n"; + while ( $i <= $num ) { + $return .= "\n"; + ++$i; + } + $return .= "
    \n"; + return $return; +} + +/** + * Register and configure an admin screen option + * + * @since 3.1.0 + * + * @param string $option An option name. + * @param mixed $args Option dependent arguments + * @return void + */ +function add_screen_option( $option, $args = array() ) { + global $wp_current_screen_options; + + if ( !isset($wp_current_screen_options) ) + $wp_current_screen_options = array(); + + $wp_current_screen_options[$option] = $args; +} + +function screen_options($screen) { + global $wp_current_screen_options; + + if ( is_string($screen) ) + $screen = convert_to_screen($screen); + + if ( !isset($wp_current_screen_options['per_page']) ) + return ''; + + $per_page_label = $wp_current_screen_options['per_page']['label']; + + if ( empty($wp_current_screen_options['per_page']['option']) ) { + $option = str_replace( '-', '_', "{$screen->id}_per_page" ); + } else { + $option = $wp_current_screen_options['per_page']['option']; + } + + $per_page = (int) get_user_option( $option ); + if ( empty( $per_page ) || $per_page < 1 ) { + if ( isset($wp_current_screen_options['per_page']['default']) ) + $per_page = $wp_current_screen_options['per_page']['default']; + else + $per_page = 20; + } + + if ( 'edit_comments_per_page' == $option ) + $per_page = apply_filters( 'comments_per_page', $per_page, isset($_REQUEST['comment_status']) ? $_REQUEST['comment_status'] : 'all' ); + elseif ( 'categories_per_page' == $option ) + $per_page = apply_filters( 'edit_categories_per_page', $per_page ); + else + $per_page = apply_filters( $option, $per_page ); + + // Back compat + if ( isset( $screen->post_type ) ) + $per_page = apply_filters( 'edit_posts_per_page', $per_page, $screen->post_type ); + + $return = "
    \n"; + if ( !empty($per_page_label) ) + $return .= " \n"; + $return .= get_submit_button( __( 'Apply' ), 'button', 'screen-options-apply', false ); + $return .= ""; + $return .= "
    \n"; + return $return; +} + +function screen_icon( $screen = '' ) { + echo get_screen_icon( $screen ); +} + +function get_screen_icon( $screen = '' ) { + global $current_screen, $typenow; + + if ( empty($screen) ) + $screen = $current_screen; + elseif ( is_string($screen) ) + $name = $screen; + + $class = 'icon32'; + + if ( empty($name) ) { + if ( !empty($screen->parent_base) ) + $name = $screen->parent_base; + else + $name = $screen->base; + + if ( 'edit' == $name && isset($screen->post_type) && 'page' == $screen->post_type ) + $name = 'edit-pages'; + + $post_type = ''; + if ( isset( $screen->post_type ) ) + $post_type = $screen->post_type; + elseif ( $current_screen == $screen ) + $post_type = $typenow; + if ( $post_type ) + $class .= ' ' . sanitize_html_class( 'icon32-posts-' . $post_type ); + } + + return '

    '; +} + +/** + * Test support for compressing JavaScript from PHP + * + * Outputs JavaScript that tests if compression from PHP works as expected + * and sets an option with the result. Has no effect when the current user + * is not an administrator. To run the test again the option 'can_compress_scripts' + * has to be deleted. + * + * @since 2.8.0 + */ +function compression_test() { +?> + + $current_screen, 'base' => $current_screen); + } else { + $id = sanitize_key($id); + if ( false !== strpos($id, '-') ) { + list( $id, $typenow ) = explode('-', $id, 2); + if ( taxonomy_exists( $typenow ) ) { + $id = 'edit-tags'; + $taxnow = $typenow; + $typenow = ''; + } + } + $current_screen = array('id' => $id, 'base' => $id); + } + + $current_screen = (object) $current_screen; + + $current_screen->action = $action; + + // Map index to dashboard + if ( 'index' == $current_screen->base ) + $current_screen->base = 'dashboard'; + if ( 'index' == $current_screen->id ) + $current_screen->id = 'dashboard'; + + if ( 'edit' == $current_screen->id ) { + if ( empty($typenow) ) + $typenow = 'post'; + $current_screen->id .= '-' . $typenow; + $current_screen->post_type = $typenow; + } elseif ( 'post' == $current_screen->id ) { + if ( empty($typenow) ) + $typenow = 'post'; + $current_screen->id = $typenow; + $current_screen->post_type = $typenow; + } elseif ( 'edit-tags' == $current_screen->id ) { + if ( empty($taxnow) ) + $taxnow = 'post_tag'; + $current_screen->id = 'edit-' . $taxnow; + $current_screen->taxonomy = $taxnow; + } + + $current_screen->is_network = is_network_admin(); + $current_screen->is_user = is_user_admin(); + + if ( $current_screen->is_network ) { + $current_screen->base .= '-network'; + $current_screen->id .= '-network'; + } elseif ( $current_screen->is_user ) { + $current_screen->base .= '-user'; + $current_screen->id .= '-user'; + } + + $current_screen = apply_filters('current_screen', $current_screen); +} + +/** + * Echos a submit button, with provided text and appropriate class + * + * @since 3.1.0 + * + * @param string $text The text of the button (defaults to 'Save Changes') + * @param string $type The type of button. One of: primary, secondary, delete + * @param string $name The HTML name of the submit button. Defaults to "submit". If no id attribute + * is given in $other_attributes below, $name will be used as the button's id. + * @param bool $wrap True if the output button should be wrapped in a paragraph tag, + * false otherwise. Defaults to true + * @param array|string $other_attributes Other attributes that should be output with the button, + * mapping attributes to their values, such as array( 'tabindex' => '1' ). + * These attributes will be ouput as attribute="value", such as tabindex="1". + * Defaults to no other attributes. Other attributes can also be provided as a + * string such as 'tabindex="1"', though the array format is typically cleaner. + */ +function submit_button( $text = NULL, $type = 'primary', $name = 'submit', $wrap = true, $other_attributes = NULL ) { + echo get_submit_button( $text, $type, $name, $wrap, $other_attributes ); +} + +/** + * Returns a submit button, with provided text and appropriate class + * + * @since 3.1.0 + * + * @param string $text The text of the button (defaults to 'Save Changes') + * @param string $type The type of button. One of: primary, secondary, delete + * @param string $name The HTML name of the submit button. Defaults to "submit". If no id attribute + * is given in $other_attributes below, $name will be used as the button's id. + * @param bool $wrap True if the output button should be wrapped in a paragraph tag, + * false otherwise. Defaults to true + * @param array|string $other_attributes Other attributes that should be output with the button, + * mapping attributes to their values, such as array( 'tabindex' => '1' ). + * These attributes will be ouput as attribute="value", such as tabindex="1". + * Defaults to no other attributes. Other attributes can also be provided as a + * string such as 'tabindex="1"', though the array format is typically cleaner. + */ +function get_submit_button( $text = NULL, $type = 'primary', $name = 'submit', $wrap = true, $other_attributes = NULL ) { + switch ( $type ) : + case 'primary' : + case 'secondary' : + $class = 'button-' . $type; + break; + case 'delete' : + $class = 'button-secondary delete'; + break; + default : + $class = $type; // Custom cases can just pass in the classes they want to be used + endswitch; + $text = ( NULL == $text ) ? __( 'Save Changes' ) : $text; + + // Default the id attribute to $name unless an id was specifically provided in $other_attributes + $id = $name; + if ( is_array( $other_attributes ) && isset( $other_attributes['id'] ) ) { + $id = $other_attributes['id']; + unset( $other_attributes['id'] ); + } + + $attributes = ''; + if ( is_array( $other_attributes ) ) { + foreach ( $other_attributes as $attribute => $value ) { + $attributes .= $attribute . '="' . esc_attr( $value ) . '" '; // Trailing space is important + } + } else if ( !empty( $other_attributes ) ) { // Attributes provided as a string + $attributes = $other_attributes; + } + + $button = ''; + + if ( $wrap ) { + $button = '

    ' . $button . '

    '; + } + + return $button; +} diff --git a/src/wp-admin/includes/theme-install.php b/src/wp-admin/includes/theme-install.php new file mode 100644 index 0000000..1f24e40 --- /dev/null +++ b/src/wp-admin/includes/theme-install.php @@ -0,0 +1,323 @@ + array('href' => array(), 'title' => array(), 'target' => array()), + 'abbr' => array('title' => array()), 'acronym' => array('title' => array()), + 'code' => array(), 'pre' => array(), 'em' => array(), 'strong' => array(), + 'div' => array(), 'p' => array(), 'ul' => array(), 'ol' => array(), 'li' => array(), + 'h1' => array(), 'h2' => array(), 'h3' => array(), 'h4' => array(), 'h5' => array(), 'h6' => array(), + 'img' => array('src' => array(), 'class' => array(), 'alt' => array()) +); + +$theme_field_defaults = array( 'description' => true, 'sections' => false, 'tested' => true, 'requires' => true, + 'rating' => true, 'downloaded' => true, 'downloadlink' => true, 'last_updated' => true, 'homepage' => true, + 'tags' => true, 'num_ratings' => true +); + +/** + * Retrieve list of WordPress theme features (aka theme tags) + * + * @since 2.8.0 + * + * @deprecated since 3.1.0 Use get_theme_feature_list() instead. + * + * @return array + */ +function install_themes_feature_list( ) { + if ( !$cache = get_transient( 'wporg_theme_feature_list' ) ) + set_transient( 'wporg_theme_feature_list', array( ), 10800); + + if ( $cache ) + return $cache; + + $feature_list = themes_api( 'feature_list', array( ) ); + if ( is_wp_error( $feature_list ) ) + return $features; + + set_transient( 'wporg_theme_feature_list', $feature_list, 10800 ); + + return $feature_list; +} + +/** + * Display search form for searching themes. + * + * @since 2.8.0 + */ +function install_theme_search_form() { + $type = isset( $_REQUEST['type'] ) ? stripslashes( $_REQUEST['type'] ) : ''; + $term = isset( $_REQUEST['s'] ) ? stripslashes( $_REQUEST['s'] ) : ''; + ?> +

    + +
    + + + + +
    + +

    +
    +

    + '; + + foreach ( (array) $feature_list as $feature_name => $features ) { + $feature_name = esc_html( $feature_name ); + echo '
    ' . $feature_name . '
    '; + + echo '
      '; + foreach ( $features as $feature => $feature_name ) { + $feature_name = esc_html( $feature_name ); + $feature = esc_attr($feature); +?> + +
    1. + + +
    2. + + +
    +
    + + +
    +
    + + + +

    +

    +
    + + + +
    + name, $themes_allowedtags); + $desc = wp_kses($theme->description, $themes_allowedtags); + //if ( strlen($desc) > 30 ) + // $desc = substr($desc, 0, 15) . '...' . substr($desc, -15) . ''; + + $preview_link = $theme->preview_url . '?TB_iframe=true&width=600&height=400'; + if ( !is_array($actions) ) { + $actions = array(); + $actions[] = '' . __('Install') . ''; + if ( !is_network_admin() ) + $actions[] = '' . __('Preview') . ''; + $actions = apply_filters('theme_install_action_links', $actions, $theme); + } + + $actions = implode ( ' | ', $actions ); + ?> +'> + + +

    + +

    + + +
    +

    version, $themes_allowedtags) ?>

    +

    author, $themes_allowedtags) ?>

    +last_updated) ) : ?> +

    last_updated)) ) ?>

    +requires) ) : ?> +

    requires) ?>

    +tested) ) : ?> +

    tested ?>

    +downloaded) ) : ?> +

    downloaded), number_format_i18n($theme->downloaded)) ?>

    + +
    +
    +
    <?php _e('5 stars') ?>
    +
    <?php _e('4 stars') ?>
    +
    <?php _e('3 stars') ?>
    +
    <?php _e('2 stars') ?>
    +
    <?php _e('1 star') ?>
    +
    +
    + string 'Magazine Basic' (length=14) + public 'slug' => string 'magazine-basic' (length=14) + public 'version' => string '1.1' (length=3) + public 'author' => string 'tinkerpriest' (length=12) + public 'preview_url' => string 'http://wp-themes.com/?magazine-basic' (length=36) + public 'screenshot_url' => string 'http://wp-themes.com/wp-content/themes/magazine-basic/screenshot.png' (length=68) + public 'rating' => float 80 + public 'num_ratings' => int 1 + public 'homepage' => string 'http://wordpress.org/extend/themes/magazine-basic' (length=49) + public 'description' => string 'A basic magazine style layout with a fully customizable layout through a backend interface. Designed by c.bavota of Tinker Priest Media.' (length=214) + public 'download_link' => string 'http://wordpress.org/extend/themes/download/magazine-basic.1.1.zip' (length=66) + */ +} + +/** + * Display theme content based on theme list. + * + * @since 2.8.0 + */ +function display_themes() { + global $wp_list_table; + + $wp_list_table->display(); +} +add_action('install_themes_search', 'display_themes'); +add_action('install_themes_featured', 'display_themes'); +add_action('install_themes_new', 'display_themes'); +add_action('install_themes_updated', 'display_themes'); + +/** + * Display theme information in dialog box form. + * + * @since 2.8.0 + */ +function install_theme_information() { + //TODO: This function needs a LOT of UI work :) + global $tab, $themes_allowedtags; + + $api = themes_api('theme_information', array('slug' => stripslashes( $_REQUEST['theme'] ) )); + + if ( is_wp_error($api) ) + wp_die($api); + + // Sanitize HTML + foreach ( (array)$api->sections as $section_name => $content ) + $api->sections[$section_name] = wp_kses($content, $themes_allowedtags); + + foreach ( array('version', 'author', 'requires', 'tested', 'homepage', 'downloaded', 'slug') as $key ) { + if ( isset($api->$key) ) + $api->$key = wp_kses($api->$key, $themes_allowedtags); + } + + iframe_header( __('Theme Install') ); + + if ( empty($api->download_link) ) { + echo '

    ' . __('Error: This theme is currently not available. Please try again later.') . '

    '; + iframe_footer(); + exit; + } + + if ( !empty($api->tested) && version_compare($GLOBALS['wp_version'], $api->tested, '>') ) + echo '

    ' . __('Warning: This theme has not been tested with your current version of WordPress.') . '

    '; + else if ( !empty($api->requires) && version_compare($GLOBALS['wp_version'], $api->requires, '<') ) + echo '

    ' . __('Warning: This theme has not been marked as compatible with your version of WordPress.') . '

    '; + + // Default to a "new" theme + $type = 'install'; + // Check to see if this theme is known to be installed, and has an update awaiting it. + $update_themes = get_site_transient('update_themes'); + if ( is_object($update_themes) && isset($update_themes->response) ) { + foreach ( (array)$update_themes->response as $theme_slug => $theme_info ) { + if ( $theme_slug === $api->slug ) { + $type = 'update_available'; + $update_file = $theme_slug; + break; + } + } + } + + $themes = get_themes(); + foreach ( $themes as $this_theme ) { + if ( is_array($this_theme) && $this_theme['Stylesheet'] == $api->slug ) { + if ( $this_theme['Version'] == $api->version ) { + $type = 'latest_installed'; + } elseif ( $this_theme['Version'] > $api->version ) { + $type = 'newer_installed'; + $newer_version = $this_theme['Version']; + } + break; + } + } +?> + +
    + +

    name; ?>

    +

    author); ?>

    +

    version); ?>

    + +' . __('Cancel') . ' '; + +switch ( $type ) { +default: +case 'install': + if ( current_user_can('install_themes') ) : + $buttons .= '' . __('Install Now') . ''; + endif; + break; +case 'update_available': + if ( current_user_can('update_themes') ) : + $buttons .= '' . __('Install Update Now') . ''; + endif; + break; +case 'newer_installed': + if ( current_user_can('install_themes') || current_user_can('update_themes') ) : + ?>

    +
    +
    + +

    + +
    +

    + +name = $current_theme; + $ct->title = $themes[$current_theme]['Title']; + $ct->version = $themes[$current_theme]['Version']; + $ct->parent_theme = $themes[$current_theme]['Parent Theme']; + $ct->template_dir = $themes[$current_theme]['Template Dir']; + $ct->stylesheet_dir = $themes[$current_theme]['Stylesheet Dir']; + $ct->template = $themes[$current_theme]['Template']; + $ct->stylesheet = $themes[$current_theme]['Stylesheet']; + $ct->screenshot = $themes[$current_theme]['Screenshot']; + $ct->description = $themes[$current_theme]['Description']; + $ct->author = $themes[$current_theme]['Author']; + $ct->tags = $themes[$current_theme]['Tags']; + $ct->theme_root = $themes[$current_theme]['Theme Root']; + $ct->theme_root_uri = $themes[$current_theme]['Theme Root URI']; + return $ct; +} + +/** + * Remove a theme + * + * @since 2.8.0 + * + * @param string $template Template directory of the theme to delete + * @param string $redirect Redirect to page when complete. + * @return mixed + */ +function delete_theme($template, $redirect = '') { + global $wp_filesystem; + + if ( empty($template) ) + return false; + + ob_start(); + if ( empty( $redirect ) ) + $redirect = wp_nonce_url('themes.php?action=delete&template=' . $template, 'delete-theme_' . $template); + if ( false === ($credentials = request_filesystem_credentials($redirect)) ) { + $data = ob_get_contents(); + ob_end_clean(); + if ( ! empty($data) ){ + include_once( ABSPATH . 'wp-admin/admin-header.php'); + echo $data; + include( ABSPATH . 'wp-admin/admin-footer.php'); + exit; + } + return; + } + + if ( ! WP_Filesystem($credentials) ) { + request_filesystem_credentials($url, '', true); // Failed to connect, Error and request again + $data = ob_get_contents(); + ob_end_clean(); + if ( ! empty($data) ) { + include_once( ABSPATH . 'wp-admin/admin-header.php'); + echo $data; + include( ABSPATH . 'wp-admin/admin-footer.php'); + exit; + } + return; + } + + + if ( ! is_object($wp_filesystem) ) + return new WP_Error('fs_unavailable', __('Could not access filesystem.')); + + if ( is_wp_error($wp_filesystem->errors) && $wp_filesystem->errors->get_error_code() ) + return new WP_Error('fs_error', __('Filesystem error.'), $wp_filesystem->errors); + + //Get the base plugin folder + $themes_dir = $wp_filesystem->wp_themes_dir(); + if ( empty($themes_dir) ) + return new WP_Error('fs_no_themes_dir', __('Unable to locate WordPress theme directory.')); + + $themes_dir = trailingslashit( $themes_dir ); + $theme_dir = trailingslashit($themes_dir . $template); + $deleted = $wp_filesystem->delete($theme_dir, true); + + if ( ! $deleted ) + return new WP_Error('could_not_remove_theme', sprintf(__('Could not fully remove the theme %s.'), $template) ); + + // Force refresh of theme update information + delete_site_transient('update_themes'); + + return true; +} + +/** + * {@internal Missing Short Description}} + * + * @since 1.5.0 + * + * @return unknown + */ +function get_broken_themes() { + global $wp_broken_themes; + + get_themes(); + return $wp_broken_themes; +} + +/** + * Get the allowed themes for the current blog. + * + * @since 3.0.0 + * + * @uses get_themes() + * @uses current_theme_info() + * @uses get_site_allowed_themes() + * @uses wpmu_get_blog_allowedthemes + * + * @return array $themes Array of allowed themes. + */ +function get_allowed_themes() { + if ( !is_multisite() ) + return get_themes(); + + $themes = get_themes(); + $ct = current_theme_info(); + $allowed_themes = apply_filters("allowed_themes", get_site_allowed_themes() ); + if ( $allowed_themes == false ) + $allowed_themes = array(); + + $blog_allowed_themes = wpmu_get_blog_allowedthemes(); + if ( is_array( $blog_allowed_themes ) ) + $allowed_themes = array_merge( $allowed_themes, $blog_allowed_themes ); + + if ( isset( $allowed_themes[ esc_html( $ct->stylesheet ) ] ) == false ) + $allowed_themes[ esc_html( $ct->stylesheet ) ] = true; + + reset( $themes ); + foreach ( $themes as $key => $theme ) { + if ( isset( $allowed_themes[ esc_html( $theme[ 'Stylesheet' ] ) ] ) == false ) + unset( $themes[ $key ] ); + } + reset( $themes ); + + return $themes; +} + +/** + * Get the Page Templates available in this theme + * + * @since 1.5.0 + * + * @return array Key is the template name, value is the filename of the template + */ +function get_page_templates() { + $themes = get_themes(); + $theme = get_current_theme(); + $templates = $themes[$theme]['Template Files']; + $page_templates = array(); + + if ( is_array( $templates ) ) { + $base = array( trailingslashit(get_template_directory()), trailingslashit(get_stylesheet_directory()) ); + + foreach ( $templates as $template ) { + $basename = str_replace($base, '', $template); + + // don't allow template files in subdirectories + if ( false !== strpos($basename, '/') ) + continue; + + if ( 'functions.php' == $basename ) + continue; + + $template_data = implode( '', file( $template )); + + $name = ''; + if ( preg_match( '|Template Name:(.*)$|mi', $template_data, $name ) ) + $name = _cleanup_header_comment($name[1]); + + if ( !empty( $name ) ) { + $page_templates[trim( $name )] = $basename; + } + } + } + + return $page_templates; +} + +/** + * Tidies a filename for url display by the theme editor. + * + * @since 2.9.0 + * @access private + * + * @param string $fullpath Full path to the theme file + * @param string $containingfolder Path of the theme parent folder + * @return string + */ +function _get_template_edit_filename($fullpath, $containingfolder) { + return str_replace(dirname(dirname( $containingfolder )) , '', $fullpath); +} + +/** + * Check if there is an update for a theme available. + * + * Will display link, if there is an update available. + * + * @since 2.7.0 + * + * @param object $theme Theme data object. + * @return bool False if no valid info was passed. + */ +function theme_update_available( $theme ) { + static $themes_update; + + if ( !current_user_can('update_themes' ) ) + return; + + if ( !isset($themes_update) ) + $themes_update = get_site_transient('update_themes'); + + if ( is_object($theme) && isset($theme->stylesheet) ) + $stylesheet = $theme->stylesheet; + elseif ( is_array($theme) && isset($theme['Stylesheet']) ) + $stylesheet = $theme['Stylesheet']; + else + return false; //No valid info passed. + + if ( isset($themes_update->response[ $stylesheet ]) ) { + $update = $themes_update->response[ $stylesheet ]; + $theme_name = is_object($theme) ? $theme->name : (is_array($theme) ? $theme['Name'] : ''); + $details_url = add_query_arg(array('TB_iframe' => 'true', 'width' => 1024, 'height' => 800), $update['url']); //Theme browser inside WP? replace this, Also, theme preview JS will override this on the available list. + $update_url = wp_nonce_url('update.php?action=upgrade-theme&theme=' . urlencode($stylesheet), 'upgrade-theme_' . $stylesheet); + $update_onclick = 'onclick="if ( confirm(\'' . esc_js( __("Updating this theme will lose any customizations you have made. 'Cancel' to stop, 'OK' to update.") ) . '\') ) {return true;}return false;"'; + + if ( !is_multisite() ) { + if ( ! current_user_can('update_themes') ) + printf( '

    ' . __('There is a new version of %1$s available. View version %3$s details.') . '

    ', $theme_name, $details_url, $update['new_version']); + else if ( empty($update['package']) ) + printf( '

    ' . __('There is a new version of %1$s available. View version %3$s details. Automatic update is unavailable for this theme.') . '

    ', $theme_name, $details_url, $update['new_version']); + else + printf( '

    ' . __('There is a new version of %1$s available. View version %3$s details or update automatically.') . '

    ', $theme_name, $details_url, $update['new_version'], $update_url, $update_onclick ); + } + } +} + +/** + * Retrieve list of WordPress theme features (aka theme tags) + * + * @since 3.1.0 + * + * @return array Array of features keyed by category with translations keyed by slug. + */ +function get_theme_feature_list() { + // Hard-coded list is used if api not accessible. + $features = array( + __('Colors') => array( + 'black' => __( 'Black' ), + 'blue' => __( 'Blue' ), + 'brown' => __( 'Brown' ), + 'gray' => __( 'Gray' ), + 'green' => __( 'Green' ), + 'orange' => __( 'Orange' ), + 'pink' => __( 'Pink' ), + 'purple' => __( 'Purple' ), + 'red' => __( 'Red' ), + 'silver' => __( 'Silver' ), + 'tan' => __( 'Tan' ), + 'white' => __( 'White' ), + 'yellow' => __( 'Yellow' ), + 'dark' => __( 'Dark' ), + 'light' => __( 'Light ') + ), + + __('Columns') => array( + 'one-column' => __( 'One Column' ), + 'two-columns' => __( 'Two Columns' ), + 'three-columns' => __( 'Three Columns' ), + 'four-columns' => __( 'Four Columns' ), + 'left-sidebar' => __( 'Left Sidebar' ), + 'right-sidebar' => __( 'Right Sidebar' ) + ), + + __('Width') => array( + 'fixed-width' => __( 'Fixed Width' ), + 'flexible-width' => __( 'Flexible Width' ) + ), + + __( 'Features' ) => array( + 'blavatar' => __( 'Blavatar' ), + 'buddypress' => __( 'BuddyPress' ), + 'custom-background' => __( 'Custom Background' ), + 'custom-colors' => __( 'Custom Colors' ), + 'custom-header' => __( 'Custom Header' ), + 'custom-menu' => __( 'Custom Menu' ), + 'editor-style' => __( 'Editor Style' ), + 'featured-image-header' => __( 'Featured Image Header' ), + 'featured-images' => __( 'Featured Images' ), + 'front-page-post-form' => __( 'Front Page Posting' ), + 'full-width-template' => __( 'Full Width Template' ), + 'microformats' => __( 'Microformats' ), + 'post-formats' => __( 'Post Formats' ), + 'rtl-language-support' => __( 'RTL Language Support' ), + 'sticky-post' => __( 'Sticky Post' ), + 'theme-options' => __( 'Theme Options' ), + 'threaded-comments' => __( 'Threaded Comments' ), + 'translation-ready' => __( 'Translation Ready' ) + ), + + __( 'Subject' ) => array( + 'holiday' => __( 'Holiday' ), + 'photoblogging' => __( 'Photoblogging' ), + 'seasonal' => __( 'Seasonal' ) + ) + ); + + if ( !current_user_can('install_themes') ) + return $features; + + if ( !$feature_list = get_site_transient( 'wporg_theme_feature_list' ) ) + set_site_transient( 'wporg_theme_feature_list', array( ), 10800); + + if ( !$feature_list ) { + $feature_list = themes_api( 'feature_list', array( ) ); + if ( is_wp_error( $feature_list ) ) + return $features; + } + + if ( !$feature_list ) + return $features; + + set_site_transient( 'wporg_theme_feature_list', $feature_list, 10800 ); + + $category_translations = array( 'Colors' => __('Colors'), 'Columns' => __('Columns'), 'Width' => __('Width'), + 'Features' => __('Features'), 'Subject' => __('Subject') ); + + // Loop over the wporg canonical list and apply translations + $wporg_features = array(); + foreach ( (array) $feature_list as $feature_category => $feature_items ) { + if ( isset($category_translations[$feature_category]) ) + $feature_category = $category_translations[$feature_category]; + $wporg_features[$feature_category] = array(); + + foreach ( $feature_items as $feature ) { + if ( isset($features[$feature_category][$feature]) ) + $wporg_features[$feature_category][$feature] = $features[$feature_category][$feature]; + else + $wporg_features[$feature_category][$feature] = $feature; + } + } + + return $wporg_features; +} + +/** + * Retrieve theme installer pages from WordPress Themes API. + * + * It is possible for a theme to override the Themes API result with three + * filters. Assume this is for themes, which can extend on the Theme Info to + * offer more choices. This is very powerful and must be used with care, when + * overridding the filters. + * + * The first filter, 'themes_api_args', is for the args and gives the action as + * the second parameter. The hook for 'themes_api_args' must ensure that an + * object is returned. + * + * The second filter, 'themes_api', is the result that would be returned. + * + * @since 2.8.0 + * + * @param string $action + * @param array|object $args Optional. Arguments to serialize for the Theme Info API. + * @return mixed + */ +function themes_api($action, $args = null) { + + if ( is_array($args) ) + $args = (object)$args; + + if ( !isset($args->per_page) ) + $args->per_page = 24; + + $args = apply_filters('themes_api_args', $args, $action); //NOTE: Ensure that an object is returned via this filter. + $res = apply_filters('themes_api', false, $action, $args); //NOTE: Allows a theme to completely override the builtin WordPress.org API. + + if ( ! $res ) { + $request = wp_remote_post('http://api.wordpress.org/themes/info/1.0/', array( 'body' => array('action' => $action, 'request' => serialize($args))) ); + if ( is_wp_error($request) ) { + $res = new WP_Error('themes_api_failed', __('An Unexpected HTTP Error occurred during the API request.'), $request->get_error_message() ); + } else { + $res = unserialize( wp_remote_retrieve_body( $request ) ); + if ( ! $res ) + $res = new WP_Error('themes_api_failed', __('An unknown error occurred.'), wp_remote_retrieve_body( $request ) ); + } + } + //var_dump(array($args, $res)); + return apply_filters('themes_api_result', $res, $action, $args); +} + +?> diff --git a/src/wp-admin/includes/update-core.php b/src/wp-admin/includes/update-core.php new file mode 100644 index 0000000..d44ffb2 --- /dev/null +++ b/src/wp-admin/includes/update-core.php @@ -0,0 +1,522 @@ + Introduced version + * Directories should be noted by suffixing it with a trailing slash (/) + * + * @since 3.2.0 + * @global array $_new_bundled_files + * @var array + * @name $_new_bundled_files + */ +global $_new_bundled_files; + +$_new_bundled_files = array( +'plugins/akismet/' => '2.0', +'themes/twentyten/' => '3.0', +'themes/twentyeleven/' => '3.2' +); + +/** + * Upgrade the core of WordPress. + * + * This will create a .maintenance file at the base of the WordPress directory + * to ensure that people can not access the web site, when the files are being + * copied to their locations. + * + * The files in the {@link $_old_files} list will be removed and the new files + * copied from the zip file after the database is upgraded. + * + * The files in the {@link $_new_bundled_files} list will be added to the installation + * if the version is greater than or equal to the old version being upgraded. + * + * The steps for the upgrader for after the new release is downloaded and + * unzipped is: + * 1. Test unzipped location for select files to ensure that unzipped worked. + * 2. Create the .maintenance file in current WordPress base. + * 3. Copy new WordPress directory over old WordPress files. + * 4. Upgrade WordPress to new version. + * 4.1. Copy all files/folders other than wp-content + * 4.2. Copy any language files to WP_LANG_DIR (which may differ from WP_CONTENT_DIR + * 4.3. Copy any new bundled themes/plugins to their respective locations + * 5. Delete new WordPress directory path. + * 6. Delete .maintenance file. + * 7. Remove old files. + * 8. Delete 'update_core' option. + * + * There are several areas of failure. For instance if PHP times out before step + * 6, then you will not be able to access any portion of your site. Also, since + * the upgrade will not continue where it left off, you will not be able to + * automatically remove old files and remove the 'update_core' option. This + * isn't that bad. + * + * If the copy of the new WordPress over the old fails, then the worse is that + * the new WordPress directory will remain. + * + * If it is assumed that every file will be copied over, including plugins and + * themes, then if you edit the default theme, you should rename it, so that + * your changes remain. + * + * @since 2.7.0 + * + * @param string $from New release unzipped path. + * @param string $to Path to old WordPress installation. + * @return WP_Error|null WP_Error on failure, null on success. + */ +function update_core($from, $to) { + global $wp_filesystem, $_old_files, $_new_bundled_files, $wpdb; + + @set_time_limit( 300 ); + + $php_version = phpversion(); + $mysql_version = $wpdb->db_version(); + $required_php_version = '5.2.4'; + $required_mysql_version = '5.0'; + $wp_version = '3.2.1'; + $php_compat = version_compare( $php_version, $required_php_version, '>=' ); + $mysql_compat = version_compare( $mysql_version, $required_mysql_version, '>=' ) || file_exists( WP_CONTENT_DIR . '/db.php' ); + + if ( !$mysql_compat || !$php_compat ) + $wp_filesystem->delete($from, true); + + if ( !$mysql_compat && !$php_compat ) + return new WP_Error( 'php_mysql_not_compatible', sprintf( __('The update cannot be installed because WordPress %1$s requires PHP version %2$s or higher and MySQL version %3$s or higher. You are running PHP version %4$s and MySQL version %5$s.'), $wp_version, $required_php_version, $required_mysql_version, $php_version, $mysql_version ) ); + elseif ( !$php_compat ) + return new WP_Error( 'php_not_compatible', sprintf( __('The update cannot be installed because WordPress %1$s requires PHP version %2$s or higher. You are running version %3$s.'), $wp_version, $required_php_version, $php_version ) ); + elseif ( !$mysql_compat ) + return new WP_Error( 'mysql_not_compatible', sprintf( __('The update cannot be installed because WordPress %1$s requires MySQL version %2$s or higher. You are running version %3$s.'), $wp_version, $required_mysql_version, $mysql_version ) ); + + // Sanity check the unzipped distribution + apply_filters('update_feedback', __('Verifying the unpacked files…')); + $distro = ''; + $roots = array( '/wordpress/', '/wordpress-mu/' ); + foreach( $roots as $root ) { + if ( $wp_filesystem->exists($from . $root . 'readme.html') && $wp_filesystem->exists($from . $root . 'wp-includes/version.php') ) { + $distro = $root; + break; + } + } + if ( !$distro ) { + $wp_filesystem->delete($from, true); + return new WP_Error('insane_distro', __('The update could not be unpacked') ); + } + + apply_filters('update_feedback', __('Installing the latest version…')); + + // Create maintenance file to signal that we are upgrading + $maintenance_string = ''; + $maintenance_file = $to . '.maintenance'; + $wp_filesystem->delete($maintenance_file); + $wp_filesystem->put_contents($maintenance_file, $maintenance_string, FS_CHMOD_FILE); + + // Copy new versions of WP files into place. + $result = _copy_dir($from . $distro, $to, array('wp-content') ); + + // Custom Content Directory needs updating now. + // Copy Languages + if ( !is_wp_error($result) && $wp_filesystem->is_dir($from . $distro . 'wp-content/languages') ) { + if ( WP_LANG_DIR != ABSPATH . WPINC . '/languages' || @is_dir(WP_LANG_DIR) ) + $lang_dir = WP_LANG_DIR; + else + $lang_dir = WP_CONTENT_DIR . '/languages'; + + if ( !@is_dir($lang_dir) && 0 === strpos($lang_dir, ABSPATH) ) { // Check the language directory exists first + $wp_filesystem->mkdir($to . str_replace($lang_dir, ABSPATH, ''), FS_CHMOD_DIR); // If it's within the ABSPATH we can handle it here, otherwise they're out of luck. + clearstatcache(); // for FTP, Need to clear the stat cache + } + + if ( @is_dir($lang_dir) ) { + $wp_lang_dir = $wp_filesystem->find_folder($lang_dir); + if ( $wp_lang_dir ) + $result = copy_dir($from . $distro . 'wp-content/languages/', $wp_lang_dir); + } + } + + // Copy New bundled plugins & themes + // This gives us the ability to install new plugins & themes bundled with future versions of WordPress whilst avoiding the re-install upon upgrade issue. + if ( !is_wp_error($result) && ( ! defined('CORE_UPGRADE_SKIP_NEW_BUNDLED') || ! CORE_UPGRADE_SKIP_NEW_BUNDLED ) ) { + $old_version = $GLOBALS['wp_version']; // $wp_version in local scope == new version + foreach ( (array) $_new_bundled_files as $file => $introduced_version ) { + // If $introduced version is greater than what the site was previously running + if ( version_compare($introduced_version, $old_version, '>') ) { + $directory = ('/' == $file[ strlen($file)-1 ]); + list($type, $filename) = explode('/', $file, 2); + + if ( 'plugins' == $type ) + $dest = $wp_filesystem->wp_plugins_dir(); + elseif ( 'themes' == $type ) + $dest = trailingslashit($wp_filesystem->wp_themes_dir()); // Back-compat, ::wp_themes_dir() did not return trailingslash'd pre-3.2 + else + continue; + + if ( ! $directory ) { + if ( $wp_filesystem->exists($dest . $filename) ) + continue; + + if ( ! $wp_filesystem->copy($from . $distro . 'wp-content/' . $file, $dest . $filename, FS_CHMOD_FILE) ) + $result = new WP_Error('copy_failed', __('Could not copy file.'), $dest . $filename); + } else { + if ( $wp_filesystem->is_dir($dest . $filename) ) + continue; + + $wp_filesystem->mkdir($dest . $filename, FS_CHMOD_DIR); + $_result = copy_dir( $from . $distro . 'wp-content/' . $file, $dest . $filename); + if ( is_wp_error($_result) ) //If a error occurs partway through this final step, keep the error flowing through, but keep process going. + $result = $_result; + } + } + } //end foreach + } + + // Handle $result error from the above blocks + if ( is_wp_error($result) ) { + $wp_filesystem->delete($maintenance_file); + $wp_filesystem->delete($from, true); + return $result; + } + + // Remove old files + foreach ( $_old_files as $old_file ) { + $old_file = $to . $old_file; + if ( !$wp_filesystem->exists($old_file) ) + continue; + $wp_filesystem->delete($old_file, true); + } + + // Upgrade DB with separate request + apply_filters('update_feedback', __('Upgrading database…')); + $db_upgrade_url = admin_url('upgrade.php?step=upgrade_db'); + wp_remote_post($db_upgrade_url, array('timeout' => 60)); + + // Remove working directory + $wp_filesystem->delete($from, true); + + // Force refresh of update information + if ( function_exists('delete_site_transient') ) + delete_site_transient('update_core'); + else + delete_option('update_core'); + + // Remove maintenance file, we're done. + $wp_filesystem->delete($maintenance_file); +} + +/** + * Copies a directory from one location to another via the WordPress Filesystem Abstraction. + * Assumes that WP_Filesystem() has already been called and setup. + * + * This is a temporary function for the 3.1 -> 3.2 upgrade only and will be removed in 3.3 + * + * @ignore + * @since 3.2.0 + * @see copy_dir() + * + * @param string $from source directory + * @param string $to destination directory + * @param array $skip_list a list of files/folders to skip copying + * @return mixed WP_Error on failure, True on success. + */ +function _copy_dir($from, $to, $skip_list = array() ) { + global $wp_filesystem; + + $dirlist = $wp_filesystem->dirlist($from); + + $from = trailingslashit($from); + $to = trailingslashit($to); + + $skip_regex = ''; + foreach ( (array)$skip_list as $key => $skip_file ) + $skip_regex .= preg_quote($skip_file, '!') . '|'; + + if ( !empty($skip_regex) ) + $skip_regex = '!(' . rtrim($skip_regex, '|') . ')$!i'; + + foreach ( (array) $dirlist as $filename => $fileinfo ) { + if ( !empty($skip_regex) ) + if ( preg_match($skip_regex, $from . $filename) ) + continue; + + if ( 'f' == $fileinfo['type'] ) { + if ( ! $wp_filesystem->copy($from . $filename, $to . $filename, true, FS_CHMOD_FILE) ) { + // If copy failed, chmod file to 0644 and try again. + $wp_filesystem->chmod($to . $filename, 0644); + if ( ! $wp_filesystem->copy($from . $filename, $to . $filename, true, FS_CHMOD_FILE) ) + return new WP_Error('copy_failed', __('Could not copy file.'), $to . $filename); + } + } elseif ( 'd' == $fileinfo['type'] ) { + if ( !$wp_filesystem->is_dir($to . $filename) ) { + if ( !$wp_filesystem->mkdir($to . $filename, FS_CHMOD_DIR) ) + return new WP_Error('mkdir_failed', __('Could not create directory.'), $to . $filename); + } + $result = _copy_dir($from . $filename, $to . $filename, $skip_list); + if ( is_wp_error($result) ) + return $result; + } + } + return true; +} + +?> diff --git a/src/wp-admin/includes/update.php b/src/wp-admin/includes/update.php new file mode 100644 index 0000000..202f7c4 --- /dev/null +++ b/src/wp-admin/includes/update.php @@ -0,0 +1,313 @@ + 'latest'); + return $updates[0]; +} + +/** + * Get available core updates + * + * @param array $options Set $options['dismissed'] to true to show dismissed upgrades too, + * set $options['available'] to false to skip not-dimissed updates. + * @return array Array of the update objects + */ +function get_core_updates( $options = array() ) { + $options = array_merge( array('available' => true, 'dismissed' => false ), $options ); + $dismissed = get_site_option( 'dismissed_update_core' ); + if ( !is_array( $dismissed ) ) $dismissed = array(); + $from_api = get_site_transient( 'update_core' ); + if ( empty($from_api) ) + return false; + if ( !isset( $from_api->updates ) || !is_array( $from_api->updates ) ) return false; + $updates = $from_api->updates; + if ( !is_array( $updates ) ) return false; + $result = array(); + foreach($updates as $update) { + if ( array_key_exists( $update->current.'|'.$update->locale, $dismissed ) ) { + if ( $options['dismissed'] ) { + $update->dismissed = true; + $result[]= $update; + } + } else { + if ( $options['available'] ) { + $update->dismissed = false; + $result[]= $update; + } + } + } + return $result; +} + +function dismiss_core_update( $update ) { + $dismissed = get_site_option( 'dismissed_update_core' ); + $dismissed[ $update->current.'|'.$update->locale ] = true; + return update_site_option( 'dismissed_update_core', $dismissed ); +} + +function undismiss_core_update( $version, $locale ) { + $dismissed = get_site_option( 'dismissed_update_core' ); + $key = $version.'|'.$locale; + if ( !isset( $dismissed[$key] ) ) return false; + unset( $dismissed[$key] ); + return update_site_option( 'dismissed_update_core', $dismissed ); +} + +function find_core_update( $version, $locale ) { + $from_api = get_site_transient( 'update_core' ); + if ( !is_array( $from_api->updates ) ) return false; + $updates = $from_api->updates; + foreach($updates as $update) { + if ( $update->current == $version && $update->locale == $locale ) + return $update; + } + return false; +} + +function core_update_footer( $msg = '' ) { + if ( is_multisite() && !current_user_can('update_core') ) + return false; + + if ( !current_user_can('update_core') ) + return sprintf( __( 'Version %s' ), $GLOBALS['wp_version'] ); + + $cur = get_preferred_from_update_core(); + if ( ! isset( $cur->current ) ) + $cur->current = ''; + + if ( ! isset( $cur->url ) ) + $cur->url = ''; + + if ( ! isset( $cur->response ) ) + $cur->response = ''; + + switch ( $cur->response ) { + case 'development' : + return sprintf( __( 'You are using a development version (%1$s). Cool! Please stay updated.' ), $GLOBALS['wp_version'], network_admin_url( 'update-core.php' ) ); + break; + + case 'upgrade' : + return sprintf( ''.__( 'Get Version %2$s' ).'', network_admin_url( 'update-core.php' ), $cur->current); + break; + + case 'latest' : + default : + return sprintf( __( 'Version %s' ), $GLOBALS['wp_version'] ); + break; + } +} +add_filter( 'update_footer', 'core_update_footer' ); + +function update_nag() { + if ( is_multisite() && !current_user_can('update_core') ) + return false; + + global $pagenow; + + if ( 'update-core.php' == $pagenow ) + return; + + $cur = get_preferred_from_update_core(); + + if ( ! isset( $cur->response ) || $cur->response != 'upgrade' ) + return false; + + if ( current_user_can('update_core') ) { + $msg = sprintf( __('WordPress %1$s is available! Please update now.'), $cur->current, network_admin_url( 'update-core.php' ) ); + } else { + $msg = sprintf( __('WordPress %1$s is available! Please notify the site administrator.'), $cur->current ); + } + echo "
    $msg
    "; +} +add_action( 'admin_notices', 'update_nag', 3 ); + +// Called directly from dashboard +function update_right_now_message() { + if ( is_multisite() && !current_user_can('update_core') ) + return false; + + $cur = get_preferred_from_update_core(); + + $msg = sprintf( __('You are using WordPress %s.'), $GLOBALS['wp_version'] ); + + if ( isset( $cur->response ) && $cur->response == 'upgrade' && current_user_can('update_core') ) { + $msg .= " " . sprintf( __('Update to %s'), $cur->current ? $cur->current : __( 'Latest' ) ) . ''; + } + + echo "$msg"; +} + +function get_plugin_updates() { + $all_plugins = get_plugins(); + $upgrade_plugins = array(); + $current = get_site_transient( 'update_plugins' ); + foreach ( (array)$all_plugins as $plugin_file => $plugin_data) { + if ( isset( $current->response[ $plugin_file ] ) ) { + $upgrade_plugins[ $plugin_file ] = (object) $plugin_data; + $upgrade_plugins[ $plugin_file ]->update = $current->response[ $plugin_file ]; + } + } + + return $upgrade_plugins; +} + +function wp_plugin_update_rows() { + if ( !current_user_can('update_plugins' ) ) + return; + + $plugins = get_site_transient( 'update_plugins' ); + if ( isset($plugins->response) && is_array($plugins->response) ) { + $plugins = array_keys( $plugins->response ); + foreach( $plugins as $plugin_file ) { + add_action( "after_plugin_row_$plugin_file", 'wp_plugin_update_row', 10, 2 ); + } + } +} +add_action( 'admin_init', 'wp_plugin_update_rows' ); + +function wp_plugin_update_row( $file, $plugin_data ) { + $current = get_site_transient( 'update_plugins' ); + if ( !isset( $current->response[ $file ] ) ) + return false; + + $r = $current->response[ $file ]; + + $plugins_allowedtags = array('a' => array('href' => array(),'title' => array()),'abbr' => array('title' => array()),'acronym' => array('title' => array()),'code' => array(),'em' => array(),'strong' => array()); + $plugin_name = wp_kses( $plugin_data['Name'], $plugins_allowedtags ); + + $details_url = self_admin_url('plugin-install.php?tab=plugin-information&plugin=' . $r->slug . '&TB_iframe=true&width=600&height=800'); + + $wp_list_table = _get_list_table('WP_Plugins_List_Table'); + + if ( is_network_admin() || !is_multisite() ) { + echo '
    '; + + if ( ! current_user_can('update_plugins') ) + printf( __('There is a new version of %1$s available. View version %4$s details.'), $plugin_name, esc_url($details_url), esc_attr($plugin_name), $r->new_version ); + else if ( empty($r->package) ) + printf( __('There is a new version of %1$s available. View version %4$s details. Automatic update is unavailable for this plugin.'), $plugin_name, esc_url($details_url), esc_attr($plugin_name), $r->new_version ); + else + printf( __('There is a new version of %1$s available. View version %4$s details or update automatically.'), $plugin_name, esc_url($details_url), esc_attr($plugin_name), $r->new_version, wp_nonce_url( self_admin_url('update.php?action=upgrade-plugin&plugin=') . $file, 'upgrade-plugin_' . $file) ); + + do_action( "in_plugin_update_message-$file", $plugin_data, $r ); + + echo '
    '; + } +} + +function wp_update_plugin($plugin, $feedback = '') { + if ( !empty($feedback) ) + add_filter('update_feedback', $feedback); + + include ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; + $upgrader = new Plugin_Upgrader(); + return $upgrader->upgrade($plugin); +} + +function get_theme_updates() { + $themes = get_themes(); + $current = get_site_transient('update_themes'); + $update_themes = array(); + + foreach ( $themes as $theme ) { + $theme = (object) $theme; + if ( isset($current->response[ $theme->Stylesheet ]) ) { + $update_themes[$theme->Stylesheet] = $theme; + $update_themes[$theme->Stylesheet]->update = $current->response[ $theme->Stylesheet ]; + } + } + + return $update_themes; +} + +function wp_update_theme($theme, $feedback = '') { + if ( !empty($feedback) ) + add_filter('update_feedback', $feedback); + + include ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; + $upgrader = new Theme_Upgrader(); + return $upgrader->upgrade($theme); +} + +function wp_theme_update_rows() { + if ( !current_user_can('update_themes' ) ) + return; + + $themes = get_site_transient( 'update_themes' ); + if ( isset($themes->response) && is_array($themes->response) ) { + $themes = array_keys( $themes->response ); + + foreach( $themes as $theme ) { + add_action( "after_theme_row_$theme", 'wp_theme_update_row', 10, 2 ); + } + } +} +add_action( 'admin_init', 'wp_theme_update_rows' ); + +function wp_theme_update_row( $theme_key, $theme ) { + $current = get_site_transient( 'update_themes' ); + if ( !isset( $current->response[ $theme_key ] ) ) + return false; + $r = $current->response[ $theme_key ]; + $themes_allowedtags = array('a' => array('href' => array(),'title' => array()),'abbr' => array('title' => array()),'acronym' => array('title' => array()),'code' => array(),'em' => array(),'strong' => array()); + $theme_name = wp_kses( $theme['Name'], $themes_allowedtags ); + + $details_url = self_admin_url("theme-install.php?tab=theme-information&theme=$theme_key&TB_iframe=true&width=600&height=400"); + + $wp_list_table = _get_list_table('WP_MS_Themes_List_Table'); + + echo '
    '; + if ( ! current_user_can('update_themes') ) + printf( __('There is a new version of %1$s available. View version %4$s details.'), $theme['Name'], esc_url($details_url), esc_attr($theme['Name']), $r->new_version ); + else if ( empty( $r['package'] ) ) + printf( __('There is a new version of %1$s available. View version %4$s details. Automatic update is unavailable for this plugin.'), $theme['Name'], esc_url($details_url), esc_attr($theme['Name']), $r['new_version'] ); + else + printf( __('There is a new version of %1$s available. View version %4$s details or update automatically.'), $theme['Name'], esc_url($details_url), esc_attr($theme['Name']), $r['new_version'], wp_nonce_url( self_admin_url('update.php?action=upgrade-theme&theme=') . $theme_key, 'upgrade-theme_' . $theme_key) ); + + do_action( "in_theme_update_message-$theme_key", $theme, $r ); + + echo '
    '; +} + +function wp_update_core($current, $feedback = '') { + if ( !empty($feedback) ) + add_filter('update_feedback', $feedback); + + include ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; + $upgrader = new Core_Upgrader(); + return $upgrader->upgrade($current); + +} + +function maintenance_nag() { + global $upgrading; + if ( ! isset( $upgrading ) ) + return false; + + if ( current_user_can('update_core') ) + $msg = sprintf( __('An automated WordPress update has failed to complete - please attempt the update again now.'), 'update-core.php' ); + else + $msg = __('An automated WordPress update has failed to complete! Please notify the site administrator.'); + + echo "
    $msg
    "; +} +add_action( 'admin_notices', 'maintenance_nag' ); + +?> diff --git a/src/wp-admin/includes/upgrade.php b/src/wp-admin/includes/upgrade.php new file mode 100644 index 0000000..f29f594 --- /dev/null +++ b/src/wp-admin/includes/upgrade.php @@ -0,0 +1,2001 @@ +Note that password carefully! It is a random password that was generated just for you.'); + $user_id = wp_create_user($user_name, $user_password, $user_email); + update_user_option($user_id, 'default_password_nag', true, true); + $email_password = true; + } else if ( !$user_id ) { + // Password has been provided + $message = ''.__('Your chosen password.').''; + $user_id = wp_create_user($user_name, $user_password, $user_email); + } else { + $message = __('User already exists. Password inherited.'); + } + + $user = new WP_User($user_id); + $user->set_role('administrator'); + + wp_install_defaults($user_id); + + $wp_rewrite->flush_rules(); + + wp_new_blog_notification($blog_title, $guessurl, $user_id, ($email_password ? $user_password : __('The password you chose during the install.') ) ); + + wp_cache_flush(); + + return array('url' => $guessurl, 'user_id' => $user_id, 'password' => $user_password, 'password_message' => $message); +} +endif; + +if ( !function_exists('wp_install_defaults') ) : +/** + * {@internal Missing Short Description}} + * + * {@internal Missing Long Description}} + * + * @since 2.1.0 + * + * @param int $user_id User ID. + */ +function wp_install_defaults($user_id) { + global $wpdb, $wp_rewrite, $current_site, $table_prefix; + + // Default category + $cat_name = __('Uncategorized'); + /* translators: Default category slug */ + $cat_slug = sanitize_title(_x('Uncategorized', 'Default category slug')); + + if ( global_terms_enabled() ) { + $cat_id = $wpdb->get_var( $wpdb->prepare( "SELECT cat_ID FROM {$wpdb->sitecategories} WHERE category_nicename = %s", $cat_slug ) ); + if ( $cat_id == null ) { + $wpdb->insert( $wpdb->sitecategories, array('cat_ID' => 0, 'cat_name' => $cat_name, 'category_nicename' => $cat_slug, 'last_updated' => current_time('mysql', true)) ); + $cat_id = $wpdb->insert_id; + } + update_option('default_category', $cat_id); + } else { + $cat_id = 1; + } + + $wpdb->insert( $wpdb->terms, array('term_id' => $cat_id, 'name' => $cat_name, 'slug' => $cat_slug, 'term_group' => 0) ); + $wpdb->insert( $wpdb->term_taxonomy, array('term_id' => $cat_id, 'taxonomy' => 'category', 'description' => '', 'parent' => 0, 'count' => 1)); + $cat_tt_id = $wpdb->insert_id; + + // Default link category + $cat_name = __('Blogroll'); + /* translators: Default link category slug */ + $cat_slug = sanitize_title(_x('Blogroll', 'Default link category slug')); + + if ( global_terms_enabled() ) { + $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', true)) ); + $blogroll_id = $wpdb->insert_id; + } + update_option('default_link_category', $blogroll_id); + } else { + $blogroll_id = 2; + } + + $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' => 7)); + $blogroll_tt_id = $wpdb->insert_id; + + // Now drop in some default links + $default_links = array(); + $default_links[] = array( 'link_url' => 'http://codex.wordpress.org/', + 'link_name' => 'Documentation', + 'link_rss' => '', + 'link_notes' => ''); + + $default_links[] = array( 'link_url' => 'http://wordpress.org/news/', + 'link_name' => 'WordPress Blog', + 'link_rss' => 'http://wordpress.org/news/feed/', + 'link_notes' => ''); + + $default_links[] = array( 'link_url' => 'http://wordpress.org/extend/ideas/', + 'link_name' => 'Suggest Ideas', + 'link_rss' => '', + 'link_notes' =>''); + + $default_links[] = array( 'link_url' => 'http://wordpress.org/support/', + 'link_name' => 'Support Forum', + 'link_rss' => '', + 'link_notes' =>''); + + $default_links[] = array( 'link_url' => 'http://wordpress.org/extend/plugins/', + 'link_name' => 'Plugins', + 'link_rss' => '', + 'link_notes' =>''); + + $default_links[] = array( 'link_url' => 'http://wordpress.org/extend/themes/', + 'link_name' => 'Themes', + 'link_rss' => '', + 'link_notes' =>''); + + $default_links[] = array( 'link_url' => 'http://planet.wordpress.org/', + 'link_name' => 'WordPress Planet', + 'link_rss' => '', + 'link_notes' =>''); + + foreach ( $default_links as $link ) { + $wpdb->insert( $wpdb->links, $link); + $wpdb->insert( $wpdb->term_relationships, array('term_taxonomy_id' => $blogroll_tt_id, 'object_id' => $wpdb->insert_id) ); + } + + // First post + $now = date('Y-m-d H:i:s'); + $now_gmt = gmdate('Y-m-d H:i:s'); + $first_post_guid = get_option('home') . '/?p=1'; + + if ( is_multisite() ) { + $first_post = get_site_option( 'first_post' ); + + if ( empty($first_post) ) + $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", esc_url( network_home_url() ), $first_post ); + $first_post = str_replace( "SITE_NAME", $current_site->site_name, $first_post ); + } else { + $first_post = __('Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!'); + } + + $wpdb->insert( $wpdb->posts, array( + 'post_author' => $user_id, + 'post_date' => $now, + 'post_date_gmt' => $now_gmt, + 'post_content' => $first_post, + 'post_excerpt' => '', + 'post_title' => __('Hello world!'), + /* translators: Default post slug */ + 'post_name' => sanitize_title( _x('hello-world', 'Default post slug') ), + 'post_modified' => $now, + 'post_modified_gmt' => $now_gmt, + 'guid' => $first_post_guid, + 'comment_count' => 1, + 'to_ping' => '', + 'pinged' => '', + 'post_content_filtered' => '' + )); + $wpdb->insert( $wpdb->term_relationships, array('term_taxonomy_id' => $cat_tt_id, 'object_id' => 1) ); + + // Default comment + $first_comment_author = __('Mr WordPress'); + $first_comment_url = 'http://wordpress.org/'; + $first_comment = __('Hi, this is a comment.
    To delete a comment, just log in and view the post's comments. There you will have the option to edit or delete them.'); + if ( is_multisite() ) { + $first_comment_author = get_site_option( 'first_comment_author', $first_comment_author ); + $first_comment_url = get_site_option( 'first_comment_url', network_home_url() ); + $first_comment = get_site_option( 'first_comment', $first_comment ); + } + $wpdb->insert( $wpdb->comments, array( + 'comment_post_ID' => 1, + 'comment_author' => $first_comment_author, + 'comment_author_email' => '', + 'comment_author_url' => $first_comment_url, + 'comment_date' => $now, + 'comment_date_gmt' => $now_gmt, + 'comment_content' => $first_comment + )); + + // First Page + $first_page = sprintf( __( "This is an example page. It's different from a blog post because it will stay in one place and will show up in your site navigation (in most themes). Most people start with an About page that introduces them to potential site visitors. It might say something like this: + +
    Hi there! I'm a bike messenger by day, aspiring actor by night, and this is my blog. I live in Los Angeles, have a great dog named Jack, and I like piña coladas. (And gettin' caught in the rain.)
    + +...or something like this: + +
    The XYZ Doohickey Company was founded in 1971, and has been providing quality doohickies to the public ever since. Located in Gotham City, XYZ employs over 2,000 people and does all kinds of awesome things for the Gotham community.
    + +As a new WordPress user, you should go to your dashboard to delete this page and create new pages for your content. Have fun!" ), admin_url() ); + if ( is_multisite() ) + $first_page = get_site_option( 'first_page', $first_page ); + $first_post_guid = get_option('home') . '/?page_id=2'; + $wpdb->insert( $wpdb->posts, array( + 'post_author' => $user_id, + 'post_date' => $now, + 'post_date_gmt' => $now_gmt, + 'post_content' => $first_page, + 'post_excerpt' => '', + 'post_title' => __( 'Sample Page' ), + /* translators: Default page slug */ + 'post_name' => __( 'sample-page' ), + 'post_modified' => $now, + 'post_modified_gmt' => $now_gmt, + 'guid' => $first_post_guid, + 'post_type' => 'page', + 'to_ping' => '', + 'pinged' => '', + 'post_content_filtered' => '' + )); + $wpdb->insert( $wpdb->postmeta, array( 'post_id' => 2, 'meta_key' => '_wp_page_template', 'meta_value' => 'default' ) ); + + // Set up default widgets for default theme. + update_option( 'widget_search', array ( 2 => array ( 'title' => '' ), '_multiwidget' => 1 ) ); + update_option( 'widget_recent-posts', array ( 2 => array ( 'title' => '', 'number' => 5 ), '_multiwidget' => 1 ) ); + update_option( 'widget_recent-comments', array ( 2 => array ( 'title' => '', 'number' => 5 ), '_multiwidget' => 1 ) ); + update_option( 'widget_archives', array ( 2 => array ( 'title' => '', 'count' => 0, 'dropdown' => 0 ), '_multiwidget' => 1 ) ); + update_option( 'widget_categories', array ( 2 => array ( 'title' => '', 'count' => 0, 'hierarchical' => 0, 'dropdown' => 0 ), '_multiwidget' => 1 ) ); + update_option( 'widget_meta', array ( 2 => array ( 'title' => '' ), '_multiwidget' => 1 ) ); + update_option( 'sidebars_widgets', array ( 'wp_inactive_widgets' => array ( ), 'primary-widget-area' => array ( 0 => 'search-2', 1 => 'recent-posts-2', 2 => 'recent-comments-2', 3 => 'archives-2', 4 => 'categories-2', 5 => 'meta-2', ), 'secondary-widget-area' => array ( ), 'first-footer-widget-area' => array ( ), 'second-footer-widget-area' => array ( ), 'third-footer-widget-area' => array ( ), 'fourth-footer-widget-area' => array ( ), 'array_version' => 3 ) ); + + if ( is_multisite() ) { + // Flush rules to pick up the new page. + $wp_rewrite->init(); + $wp_rewrite->flush_rules(); + + $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_super_admin( $user_id ) && $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') ); + } +} +endif; + +if ( !function_exists('wp_new_blog_notification') ) : +/** + * {@internal Missing Short Description}} + * + * {@internal Missing Long Description}} + * + * @since 2.1.0 + * + * @param string $blog_title Blog title. + * @param string $blog_url Blog url. + * @param int $user_id User ID. + * @param string $password User's Password. + */ +function wp_new_blog_notification($blog_title, $blog_url, $user_id, $password) { + $user = new WP_User($user_id); + $email = $user->user_email; + $name = $user->user_login; + $message = sprintf(__("Your new WordPress site has been successfully set up at: + +%1\$s + +You can log in to the administrator account with the following information: + +Username: %2\$s +Password: %3\$s + +We hope you enjoy your new site. Thanks! + +--The WordPress Team +http://wordpress.org/ +"), $blog_url, $name, $password); + + @wp_mail($email, __('New WordPress Site'), $message); +} +endif; + +if ( !function_exists('wp_upgrade') ) : +/** + * Run WordPress Upgrade functions. + * + * {@internal Missing Long Description}} + * + * @since 2.1.0 + * + * @return null + */ +function wp_upgrade() { + global $wp_current_db_version, $wp_db_version, $wpdb; + + $wp_current_db_version = __get_option('db_version'); + + // We are up-to-date. Nothing to do. + if ( $wp_db_version == $wp_current_db_version ) + return; + + if ( ! is_blog_installed() ) + return; + + wp_check_mysql_version(); + wp_cache_flush(); + pre_schema_upgrade(); + make_db_current_silent(); + upgrade_all(); + if ( is_multisite() && is_main_site() ) + upgrade_network(); + wp_cache_flush(); + + if ( is_multisite() ) { + if ( $wpdb->get_row( "SELECT blog_id FROM {$wpdb->blog_versions} WHERE blog_id = '{$wpdb->blogid}'" ) ) + $wpdb->query( "UPDATE {$wpdb->blog_versions} SET db_version = '{$wp_db_version}' WHERE blog_id = '{$wpdb->blogid}'" ); + else + $wpdb->query( "INSERT INTO {$wpdb->blog_versions} ( `blog_id` , `db_version` , `last_updated` ) VALUES ( '{$wpdb->blogid}', '{$wp_db_version}', NOW());" ); + } +} +endif; + +/** + * Functions to be called in install and upgrade scripts. + * + * {@internal Missing Long Description}} + * + * @since 1.0.1 + */ +function upgrade_all() { + global $wp_current_db_version, $wp_db_version, $wp_rewrite; + $wp_current_db_version = __get_option('db_version'); + + // We are up-to-date. Nothing to do. + if ( $wp_db_version == $wp_current_db_version ) + return; + + // If the version is not set in the DB, try to guess the version. + if ( empty($wp_current_db_version) ) { + $wp_current_db_version = 0; + + // If the template option exists, we have 1.5. + $template = __get_option('template'); + if ( !empty($template) ) + $wp_current_db_version = 2541; + } + + if ( $wp_current_db_version < 6039 ) + upgrade_230_options_table(); + + populate_options(); + + if ( $wp_current_db_version < 2541 ) { + upgrade_100(); + upgrade_101(); + upgrade_110(); + upgrade_130(); + } + + if ( $wp_current_db_version < 3308 ) + upgrade_160(); + + if ( $wp_current_db_version < 4772 ) + upgrade_210(); + + if ( $wp_current_db_version < 4351 ) + upgrade_old_slugs(); + + if ( $wp_current_db_version < 5539 ) + upgrade_230(); + + if ( $wp_current_db_version < 6124 ) + upgrade_230_old_tables(); + + if ( $wp_current_db_version < 7499 ) + upgrade_250(); + + if ( $wp_current_db_version < 7935 ) + upgrade_252(); + + if ( $wp_current_db_version < 8201 ) + upgrade_260(); + + if ( $wp_current_db_version < 8989 ) + upgrade_270(); + + if ( $wp_current_db_version < 10360 ) + upgrade_280(); + + if ( $wp_current_db_version < 11958 ) + upgrade_290(); + + if ( $wp_current_db_version < 15260 ) + upgrade_300(); + + maybe_disable_automattic_widgets(); + + update_option( 'db_version', $wp_db_version ); + update_option( 'db_upgraded', true ); +} + +/** + * Execute changes made in WordPress 1.0. + * + * @since 1.0.0 + */ +function upgrade_100() { + global $wpdb; + + // Get the title and ID of every post, post_name to check if it already has a value + $posts = $wpdb->get_results("SELECT ID, post_title, post_name FROM $wpdb->posts WHERE post_name = ''"); + if ($posts) { + foreach($posts as $post) { + if ('' == $post->post_name) { + $newtitle = sanitize_title($post->post_title); + $wpdb->query( $wpdb->prepare("UPDATE $wpdb->posts SET post_name = %s WHERE ID = %d", $newtitle, $post->ID) ); + } + } + } + + $categories = $wpdb->get_results("SELECT cat_ID, cat_name, category_nicename FROM $wpdb->categories"); + foreach ($categories as $category) { + if ('' == $category->category_nicename) { + $newtitle = sanitize_title($category->cat_name); + $wpdb>update( $wpdb->categories, array('category_nicename' => $newtitle), array('cat_ID' => $category->cat_ID) ); + } + } + + $wpdb->query("UPDATE $wpdb->options SET option_value = REPLACE(option_value, 'wp-links/links-images/', 'wp-images/links/') + WHERE option_name LIKE 'links_rating_image%' + AND option_value LIKE 'wp-links/links-images/%'"); + + $done_ids = $wpdb->get_results("SELECT DISTINCT post_id FROM $wpdb->post2cat"); + if ($done_ids) : + foreach ($done_ids as $done_id) : + $done_posts[] = $done_id->post_id; + endforeach; + $catwhere = ' AND ID NOT IN (' . implode(',', $done_posts) . ')'; + else: + $catwhere = ''; + endif; + + $allposts = $wpdb->get_results("SELECT ID, post_category FROM $wpdb->posts WHERE post_category != '0' $catwhere"); + if ($allposts) : + foreach ($allposts as $post) { + // Check to see if it's already been imported + $cat = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->post2cat WHERE post_id = %d AND category_id = %d", $post->ID, $post->post_category) ); + if (!$cat && 0 != $post->post_category) { // If there's no result + $wpdb->insert( $wpdb->post2cat, array('post_id' => $post->ID, 'category_id' => $post->post_category) ); + } + } + endif; +} + +/** + * Execute changes made in WordPress 1.0.1. + * + * @since 1.0.1 + */ +function upgrade_101() { + global $wpdb; + + // Clean up indices, add a few + add_clean_index($wpdb->posts, 'post_name'); + add_clean_index($wpdb->posts, 'post_status'); + add_clean_index($wpdb->categories, 'category_nicename'); + add_clean_index($wpdb->comments, 'comment_approved'); + add_clean_index($wpdb->comments, 'comment_post_ID'); + add_clean_index($wpdb->links , 'link_category'); + add_clean_index($wpdb->links , 'link_visible'); +} + +/** + * Execute changes made in WordPress 1.2. + * + * @since 1.2.0 + */ +function upgrade_110() { + global $wpdb; + + // Set user_nicename. + $users = $wpdb->get_results("SELECT ID, user_nickname, user_nicename FROM $wpdb->users"); + foreach ($users as $user) { + if ('' == $user->user_nicename) { + $newname = sanitize_title($user->user_nickname); + $wpdb->update( $wpdb->users, array('user_nicename' => $newname), array('ID' => $user->ID) ); + } + } + + $users = $wpdb->get_results("SELECT ID, user_pass from $wpdb->users"); + foreach ($users as $row) { + if (!preg_match('/^[A-Fa-f0-9]{32}$/', $row->user_pass)) { + $wpdb->update( $wpdb->users, array('user_pass' => md5($row->user_pass)), array('ID' => $row->ID) ); + } + } + + // Get the GMT offset, we'll use that later on + $all_options = get_alloptions_110(); + + $time_difference = $all_options->time_difference; + + $server_time = time()+date('Z'); + $weblogger_time = $server_time + $time_difference*3600; + $gmt_time = time(); + + $diff_gmt_server = ($gmt_time - $server_time) / 3600; + $diff_weblogger_server = ($weblogger_time - $server_time) / 3600; + $diff_gmt_weblogger = $diff_gmt_server - $diff_weblogger_server; + $gmt_offset = -$diff_gmt_weblogger; + + // Add a gmt_offset option, with value $gmt_offset + add_option('gmt_offset', $gmt_offset); + + // Check if we already set the GMT fields (if we did, then + // MAX(post_date_gmt) can't be '0000-00-00 00:00:00' + // I just slapped myself silly for not thinking about it earlier + $got_gmt_fields = ! ($wpdb->get_var("SELECT MAX(post_date_gmt) FROM $wpdb->posts") == '0000-00-00 00:00:00'); + + if (!$got_gmt_fields) { + + // Add or substract time to all dates, to get GMT dates + $add_hours = intval($diff_gmt_weblogger); + $add_minutes = intval(60 * ($diff_gmt_weblogger - $add_hours)); + $wpdb->query("UPDATE $wpdb->posts SET post_date_gmt = DATE_ADD(post_date, INTERVAL '$add_hours:$add_minutes' HOUR_MINUTE)"); + $wpdb->query("UPDATE $wpdb->posts SET post_modified = post_date"); + $wpdb->query("UPDATE $wpdb->posts SET post_modified_gmt = DATE_ADD(post_modified, INTERVAL '$add_hours:$add_minutes' HOUR_MINUTE) WHERE post_modified != '0000-00-00 00:00:00'"); + $wpdb->query("UPDATE $wpdb->comments SET comment_date_gmt = DATE_ADD(comment_date, INTERVAL '$add_hours:$add_minutes' HOUR_MINUTE)"); + $wpdb->query("UPDATE $wpdb->users SET user_registered = DATE_ADD(user_registered, INTERVAL '$add_hours:$add_minutes' HOUR_MINUTE)"); + } + +} + +/** + * Execute changes made in WordPress 1.5. + * + * @since 1.5.0 + */ +function upgrade_130() { + global $wpdb; + + // Remove extraneous backslashes. + $posts = $wpdb->get_results("SELECT ID, post_title, post_content, post_excerpt, guid, post_date, post_name, post_status, post_author FROM $wpdb->posts"); + if ($posts) { + foreach($posts as $post) { + $post_content = addslashes(deslash($post->post_content)); + $post_title = addslashes(deslash($post->post_title)); + $post_excerpt = addslashes(deslash($post->post_excerpt)); + if ( empty($post->guid) ) + $guid = get_permalink($post->ID); + else + $guid = $post->guid; + + $wpdb->update( $wpdb->posts, compact('post_title', 'post_content', 'post_excerpt', 'guid'), array('ID' => $post->ID) ); + + } + } + + // Remove extraneous backslashes. + $comments = $wpdb->get_results("SELECT comment_ID, comment_author, comment_content FROM $wpdb->comments"); + if ($comments) { + foreach($comments as $comment) { + $comment_content = deslash($comment->comment_content); + $comment_author = deslash($comment->comment_author); + + $wpdb->update($wpdb->comments, compact('comment_content', 'comment_author'), array('comment_ID' => $comment->comment_ID) ); + } + } + + // Remove extraneous backslashes. + $links = $wpdb->get_results("SELECT link_id, link_name, link_description FROM $wpdb->links"); + if ($links) { + foreach($links as $link) { + $link_name = deslash($link->link_name); + $link_description = deslash($link->link_description); + + $wpdb->update( $wpdb->links, compact('link_name', 'link_description'), array('link_id' => $link->link_id) ); + } + } + + $active_plugins = __get_option('active_plugins'); + + // If plugins are not stored in an array, they're stored in the old + // newline separated format. Convert to new format. + if ( !is_array( $active_plugins ) ) { + $active_plugins = explode("\n", trim($active_plugins)); + update_option('active_plugins', $active_plugins); + } + + // Obsolete tables + $wpdb->query('DROP TABLE IF EXISTS ' . $wpdb->prefix . 'optionvalues'); + $wpdb->query('DROP TABLE IF EXISTS ' . $wpdb->prefix . 'optiontypes'); + $wpdb->query('DROP TABLE IF EXISTS ' . $wpdb->prefix . 'optiongroups'); + $wpdb->query('DROP TABLE IF EXISTS ' . $wpdb->prefix . 'optiongroup_options'); + + // Update comments table to use comment_type + $wpdb->query("UPDATE $wpdb->comments SET comment_type='trackback', comment_content = REPLACE(comment_content, '', '') WHERE comment_content LIKE '%'"); + $wpdb->query("UPDATE $wpdb->comments SET comment_type='pingback', comment_content = REPLACE(comment_content, '', '') WHERE comment_content LIKE '%'"); + + // Some versions have multiple duplicate option_name rows with the same values + $options = $wpdb->get_results("SELECT option_name, COUNT(option_name) AS dupes FROM `$wpdb->options` GROUP BY option_name"); + foreach ( $options as $option ) { + if ( 1 != $option->dupes ) { // Could this be done in the query? + $limit = $option->dupes - 1; + $dupe_ids = $wpdb->get_col( $wpdb->prepare("SELECT option_id FROM $wpdb->options WHERE option_name = %s LIMIT %d", $option->option_name, $limit) ); + if ( $dupe_ids ) { + $dupe_ids = join($dupe_ids, ','); + $wpdb->query("DELETE FROM $wpdb->options WHERE option_id IN ($dupe_ids)"); + } + } + } + + make_site_theme(); +} + +/** + * Execute changes made in WordPress 2.0. + * + * @since 2.0.0 + */ +function upgrade_160() { + global $wpdb, $wp_current_db_version; + + populate_roles_160(); + + $users = $wpdb->get_results("SELECT * FROM $wpdb->users"); + foreach ( $users as $user ) : + if ( !empty( $user->user_firstname ) ) + update_user_meta( $user->ID, 'first_name', $wpdb->escape($user->user_firstname) ); + if ( !empty( $user->user_lastname ) ) + update_user_meta( $user->ID, 'last_name', $wpdb->escape($user->user_lastname) ); + if ( !empty( $user->user_nickname ) ) + update_user_meta( $user->ID, 'nickname', $wpdb->escape($user->user_nickname) ); + if ( !empty( $user->user_level ) ) + update_user_meta( $user->ID, $wpdb->prefix . 'user_level', $user->user_level ); + if ( !empty( $user->user_icq ) ) + update_user_meta( $user->ID, 'icq', $wpdb->escape($user->user_icq) ); + if ( !empty( $user->user_aim ) ) + update_user_meta( $user->ID, 'aim', $wpdb->escape($user->user_aim) ); + if ( !empty( $user->user_msn ) ) + update_user_meta( $user->ID, 'msn', $wpdb->escape($user->user_msn) ); + if ( !empty( $user->user_yim ) ) + update_user_meta( $user->ID, 'yim', $wpdb->escape($user->user_icq) ); + if ( !empty( $user->user_description ) ) + update_user_meta( $user->ID, 'description', $wpdb->escape($user->user_description) ); + + if ( isset( $user->user_idmode ) ): + $idmode = $user->user_idmode; + if ($idmode == 'nickname') $id = $user->user_nickname; + if ($idmode == 'login') $id = $user->user_login; + if ($idmode == 'firstname') $id = $user->user_firstname; + if ($idmode == 'lastname') $id = $user->user_lastname; + if ($idmode == 'namefl') $id = $user->user_firstname.' '.$user->user_lastname; + if ($idmode == 'namelf') $id = $user->user_lastname.' '.$user->user_firstname; + if (!$idmode) $id = $user->user_nickname; + $wpdb->update( $wpdb->users, array('display_name' => $id), array('ID' => $user->ID) ); + endif; + + // FIXME: RESET_CAPS is temporary code to reset roles and caps if flag is set. + $caps = get_user_meta( $user->ID, $wpdb->prefix . 'capabilities'); + if ( empty($caps) || defined('RESET_CAPS') ) { + $level = get_user_meta($user->ID, $wpdb->prefix . 'user_level', true); + $role = translate_level_to_role($level); + update_user_meta( $user->ID, $wpdb->prefix . 'capabilities', array($role => true) ); + } + + endforeach; + $old_user_fields = array( 'user_firstname', 'user_lastname', 'user_icq', 'user_aim', 'user_msn', 'user_yim', 'user_idmode', 'user_ip', 'user_domain', 'user_browser', 'user_description', 'user_nickname', 'user_level' ); + $wpdb->hide_errors(); + foreach ( $old_user_fields as $old ) + $wpdb->query("ALTER TABLE $wpdb->users DROP $old"); + $wpdb->show_errors(); + + // populate comment_count field of posts table + $comments = $wpdb->get_results( "SELECT comment_post_ID, COUNT(*) as c FROM $wpdb->comments WHERE comment_approved = '1' GROUP BY comment_post_ID" ); + if ( is_array( $comments ) ) + foreach ($comments as $comment) + $wpdb->update( $wpdb->posts, array('comment_count' => $comment->c), array('ID' => $comment->comment_post_ID) ); + + // Some alpha versions used a post status of object instead of attachment and put + // the mime type in post_type instead of post_mime_type. + if ( $wp_current_db_version > 2541 && $wp_current_db_version <= 3091 ) { + $objects = $wpdb->get_results("SELECT ID, post_type FROM $wpdb->posts WHERE post_status = 'object'"); + foreach ($objects as $object) { + $wpdb->update( $wpdb->posts, array( 'post_status' => 'attachment', + 'post_mime_type' => $object->post_type, + 'post_type' => ''), + array( 'ID' => $object->ID ) ); + + $meta = get_post_meta($object->ID, 'imagedata', true); + if ( ! empty($meta['file']) ) + update_attached_file( $object->ID, $meta['file'] ); + } + } +} + +/** + * Execute changes made in WordPress 2.1. + * + * @since 2.1.0 + */ +function upgrade_210() { + global $wpdb, $wp_current_db_version; + + if ( $wp_current_db_version < 3506 ) { + // Update status and type. + $posts = $wpdb->get_results("SELECT ID, post_status FROM $wpdb->posts"); + + if ( ! empty($posts) ) foreach ($posts as $post) { + $status = $post->post_status; + $type = 'post'; + + if ( 'static' == $status ) { + $status = 'publish'; + $type = 'page'; + } else if ( 'attachment' == $status ) { + $status = 'inherit'; + $type = 'attachment'; + } + + $wpdb->query( $wpdb->prepare("UPDATE $wpdb->posts SET post_status = %s, post_type = %s WHERE ID = %d", $status, $type, $post->ID) ); + } + } + + if ( $wp_current_db_version < 3845 ) { + populate_roles_210(); + } + + if ( $wp_current_db_version < 3531 ) { + // Give future posts a post_status of future. + $now = gmdate('Y-m-d H:i:59'); + $wpdb->query ("UPDATE $wpdb->posts SET post_status = 'future' WHERE post_status = 'publish' AND post_date_gmt > '$now'"); + + $posts = $wpdb->get_results("SELECT ID, post_date FROM $wpdb->posts WHERE post_status ='future'"); + if ( !empty($posts) ) + foreach ( $posts as $post ) + wp_schedule_single_event(mysql2date('U', $post->post_date, false), 'publish_future_post', array($post->ID)); + } +} + +/** + * Execute changes made in WordPress 2.3. + * + * @since 2.3.0 + */ +function upgrade_230() { + global $wp_current_db_version, $wpdb; + + if ( $wp_current_db_version < 5200 ) { + populate_roles_230(); + } + + // Convert categories to terms. + $tt_ids = array(); + $have_tags = false; + $categories = $wpdb->get_results("SELECT * FROM $wpdb->categories ORDER BY cat_ID"); + foreach ($categories as $category) { + $term_id = (int) $category->cat_ID; + $name = $category->cat_name; + $description = $category->category_description; + $slug = $category->category_nicename; + $parent = $category->category_parent; + $term_group = 0; + + // Associate terms with the same slug in a term group and make slugs unique. + if ( $exists = $wpdb->get_results( $wpdb->prepare("SELECT term_id, term_group FROM $wpdb->terms WHERE slug = %s", $slug) ) ) { + $term_group = $exists[0]->term_group; + $id = $exists[0]->term_id; + $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; + + if ( empty( $term_group ) ) { + $term_group = $wpdb->get_var("SELECT MAX(term_group) FROM $wpdb->terms GROUP BY term_group") + 1; + $wpdb->query( $wpdb->prepare("UPDATE $wpdb->terms SET term_group = %d WHERE term_id = %d", $term_group, $id) ); + } + } + + $wpdb->query( $wpdb->prepare("INSERT INTO $wpdb->terms (term_id, name, slug, term_group) VALUES + (%d, %s, %s, %d)", $term_id, $name, $slug, $term_group) ); + + $count = 0; + if ( !empty($category->category_count) ) { + $count = (int) $category->category_count; + $taxonomy = 'category'; + $wpdb->query( $wpdb->prepare("INSERT INTO $wpdb->term_taxonomy (term_id, taxonomy, description, parent, count) VALUES ( %d, %s, %s, %d, %d)", $term_id, $taxonomy, $description, $parent, $count) ); + $tt_ids[$term_id][$taxonomy] = (int) $wpdb->insert_id; + } + + if ( !empty($category->link_count) ) { + $count = (int) $category->link_count; + $taxonomy = 'link_category'; + $wpdb->query( $wpdb->prepare("INSERT INTO $wpdb->term_taxonomy (term_id, taxonomy, description, parent, count) VALUES ( %d, %s, %s, %d, %d)", $term_id, $taxonomy, $description, $parent, $count) ); + $tt_ids[$term_id][$taxonomy] = (int) $wpdb->insert_id; + } + + if ( !empty($category->tag_count) ) { + $have_tags = true; + $count = (int) $category->tag_count; + $taxonomy = 'post_tag'; + $wpdb->insert( $wpdb->term_taxonomy, compact('term_id', 'taxonomy', 'description', 'parent', 'count') ); + $tt_ids[$term_id][$taxonomy] = (int) $wpdb->insert_id; + } + + if ( empty($count) ) { + $count = 0; + $taxonomy = 'category'; + $wpdb->insert( $wpdb->term_taxonomy, compact('term_id', 'taxonomy', 'description', 'parent', 'count') ); + $tt_ids[$term_id][$taxonomy] = (int) $wpdb->insert_id; + } + } + + $select = 'post_id, category_id'; + if ( $have_tags ) + $select .= ', rel_type'; + + $posts = $wpdb->get_results("SELECT $select FROM $wpdb->post2cat GROUP BY post_id, category_id"); + foreach ( $posts as $post ) { + $post_id = (int) $post->post_id; + $term_id = (int) $post->category_id; + $taxonomy = 'category'; + if ( !empty($post->rel_type) && 'tag' == $post->rel_type) + $taxonomy = 'tag'; + $tt_id = $tt_ids[$term_id][$taxonomy]; + if ( empty($tt_id) ) + continue; + + $wpdb->insert( $wpdb->term_relationships, array('object_id' => $post_id, 'term_taxonomy_id' => $tt_id) ); + } + + // < 3570 we used linkcategories. >= 3570 we used categories and link2cat. + if ( $wp_current_db_version < 3570 ) { + // Create link_category terms for link categories. Create a map of link cat IDs + // to link_category terms. + $link_cat_id_map = array(); + $default_link_cat = 0; + $tt_ids = array(); + $link_cats = $wpdb->get_results("SELECT cat_id, cat_name FROM " . $wpdb->prefix . 'linkcategories'); + foreach ( $link_cats as $category) { + $cat_id = (int) $category->cat_id; + $term_id = 0; + $name = $wpdb->escape($category->cat_name); + $slug = sanitize_title($name); + $term_group = 0; + + // Associate terms with the same slug in a term group and make slugs unique. + if ( $exists = $wpdb->get_results( $wpdb->prepare("SELECT term_id, term_group FROM $wpdb->terms WHERE slug = %s", $slug) ) ) { + $term_group = $exists[0]->term_group; + $term_id = $exists[0]->term_id; + } + + if ( empty($term_id) ) { + $wpdb->insert( $wpdb->terms, compact('name', 'slug', 'term_group') ); + $term_id = (int) $wpdb->insert_id; + } + + $link_cat_id_map[$cat_id] = $term_id; + $default_link_cat = $term_id; + + $wpdb->insert( $wpdb->term_taxonomy, array('term_id' => $term_id, 'taxonomy' => 'link_category', 'description' => '', 'parent' => 0, 'count' => 0) ); + $tt_ids[$term_id] = (int) $wpdb->insert_id; + } + + // Associate links to cats. + $links = $wpdb->get_results("SELECT link_id, link_category FROM $wpdb->links"); + if ( !empty($links) ) foreach ( $links as $link ) { + if ( 0 == $link->link_category ) + continue; + if ( ! isset($link_cat_id_map[$link->link_category]) ) + continue; + $term_id = $link_cat_id_map[$link->link_category]; + $tt_id = $tt_ids[$term_id]; + if ( empty($tt_id) ) + continue; + + $wpdb->insert( $wpdb->term_relationships, array('object_id' => $link->link_id, 'term_taxonomy_id' => $tt_id) ); + } + + // Set default to the last category we grabbed during the upgrade loop. + update_option('default_link_category', $default_link_cat); + } else { + $links = $wpdb->get_results("SELECT link_id, category_id FROM $wpdb->link2cat GROUP BY link_id, category_id"); + foreach ( $links as $link ) { + $link_id = (int) $link->link_id; + $term_id = (int) $link->category_id; + $taxonomy = 'link_category'; + $tt_id = $tt_ids[$term_id][$taxonomy]; + if ( empty($tt_id) ) + continue; + $wpdb->insert( $wpdb->term_relationships, array('object_id' => $link_id, 'term_taxonomy_id' => $tt_id) ); + } + } + + if ( $wp_current_db_version < 4772 ) { + // Obsolete linkcategories table + $wpdb->query('DROP TABLE IF EXISTS ' . $wpdb->prefix . 'linkcategories'); + } + + // Recalculate all counts + $terms = $wpdb->get_results("SELECT term_taxonomy_id, taxonomy FROM $wpdb->term_taxonomy"); + foreach ( (array) $terms as $term ) { + if ( ('post_tag' == $term->taxonomy) || ('category' == $term->taxonomy) ) + $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->term_taxonomy_id) ); + else + $count = $wpdb->get_var( $wpdb->prepare("SELECT COUNT(*) FROM $wpdb->term_relationships WHERE term_taxonomy_id = %d", $term->term_taxonomy_id) ); + $wpdb->update( $wpdb->term_taxonomy, array('count' => $count), array('term_taxonomy_id' => $term->term_taxonomy_id) ); + } +} + +/** + * Remove old options from the database. + * + * @since 2.3.0 + */ +function upgrade_230_options_table() { + global $wpdb; + $old_options_fields = array( 'option_can_override', 'option_type', 'option_width', 'option_height', 'option_description', 'option_admin_level' ); + $wpdb->hide_errors(); + foreach ( $old_options_fields as $old ) + $wpdb->query("ALTER TABLE $wpdb->options DROP $old"); + $wpdb->show_errors(); +} + +/** + * Remove old categories, link2cat, and post2cat database tables. + * + * @since 2.3.0 + */ +function upgrade_230_old_tables() { + global $wpdb; + $wpdb->query('DROP TABLE IF EXISTS ' . $wpdb->prefix . 'categories'); + $wpdb->query('DROP TABLE IF EXISTS ' . $wpdb->prefix . 'link2cat'); + $wpdb->query('DROP TABLE IF EXISTS ' . $wpdb->prefix . 'post2cat'); +} + +/** + * Upgrade old slugs made in version 2.2. + * + * @since 2.2.0 + */ +function upgrade_old_slugs() { + // upgrade people who were using the Redirect Old Slugs plugin + global $wpdb; + $wpdb->query("UPDATE $wpdb->postmeta SET meta_key = '_wp_old_slug' WHERE meta_key = 'old_slug'"); +} + +/** + * Execute changes made in WordPress 2.5.0. + * + * @since 2.5.0 + */ +function upgrade_250() { + global $wp_current_db_version; + + if ( $wp_current_db_version < 6689 ) { + populate_roles_250(); + } + +} + +/** + * Execute changes made in WordPress 2.5.2. + * + * @since 2.5.2 + */ +function upgrade_252() { + global $wpdb; + + $wpdb->query("UPDATE $wpdb->users SET user_activation_key = ''"); +} + +/** + * Execute changes made in WordPress 2.6. + * + * @since 2.6.0 + */ +function upgrade_260() { + global $wp_current_db_version; + + if ( $wp_current_db_version < 8000 ) + populate_roles_260(); + + if ( $wp_current_db_version < 8201 ) { + update_option('enable_app', 1); + update_option('enable_xmlrpc', 1); + } +} + +/** + * Execute changes made in WordPress 2.7. + * + * @since 2.7.0 + */ +function upgrade_270() { + global $wpdb, $wp_current_db_version; + + if ( $wp_current_db_version < 8980 ) + populate_roles_270(); + + // Update post_date for unpublished posts with empty timestamp + if ( $wp_current_db_version < 8921 ) + $wpdb->query( "UPDATE $wpdb->posts SET post_date = post_modified WHERE post_date = '0000-00-00 00:00:00'" ); +} + +/** + * Execute changes made in WordPress 2.8. + * + * @since 2.8.0 + */ +function upgrade_280() { + global $wp_current_db_version, $wpdb; + + if ( $wp_current_db_version < 10360 ) + populate_roles_280(); + if ( is_multisite() ) { + $start = 0; + while( $rows = $wpdb->get_results( "SELECT option_name, option_value FROM $wpdb->options ORDER BY option_id LIMIT $start, 20" ) ) { + foreach( $rows as $row ) { + $value = $row->option_value; + if ( !@unserialize( $value ) ) + $value = stripslashes( $value ); + if ( $value !== $row->option_value ) { + update_option( $row->option_name, $value ); + } + } + $start += 20; + } + refresh_blog_details( $wpdb->blogid ); + } +} + +/** + * Execute changes made in WordPress 2.9. + * + * @since 2.9.0 + */ +function upgrade_290() { + global $wp_current_db_version; + + if ( $wp_current_db_version < 11958 ) { + // Previously, setting depth to 1 would redundantly disable threading, but now 2 is the minimum depth to avoid confusion + if ( get_option( 'thread_comments_depth' ) == '1' ) { + update_option( 'thread_comments_depth', 2 ); + update_option( 'thread_comments', 0 ); + } + } +} + +/** + * Execute changes made in WordPress 3.0. + * + * @since 3.0.0 + */ +function upgrade_300() { + global $wp_current_db_version, $wpdb; + + if ( $wp_current_db_version < 15093 ) + populate_roles_300(); + + if ( $wp_current_db_version < 14139 && is_multisite() && is_main_site() && ! defined( 'MULTISITE' ) && get_site_option( 'siteurl' ) === false ) + add_site_option( 'siteurl', '' ); + + // 3.0-alpha nav menu postmeta changes. can be removed before release. // r13802 + if ( $wp_current_db_version >= 13226 && $wp_current_db_version < 13974 ) + $wpdb->query( "DELETE FROM $wpdb->postmeta WHERE meta_key IN( 'menu_type', 'object_id', 'menu_new_window', 'menu_link', '_menu_item_append', 'menu_item_append', 'menu_item_type', 'menu_item_object_id', 'menu_item_target', 'menu_item_classes', 'menu_item_xfn', 'menu_item_url' )" ); + + // 3.0-beta1 remove_user primitive->meta cap. can be removed before release. r13956 + if ( $wp_current_db_version >= 12751 && $wp_current_db_version < 13974 ) { + $role =& get_role( 'administrator' ); + if ( ! empty( $role ) ) + $role->remove_cap( 'remove_user' ); + } + + // 3.0-beta1 nav menu postmeta changes. can be removed before release. r13974 + if ( $wp_current_db_version >= 13802 && $wp_current_db_version < 13974 ) + $wpdb->update( $wpdb->postmeta, array( 'meta_value' => '' ), array( 'meta_key' => '_menu_item_target', 'meta_value' => '_self' ) ); + + // 3.0 screen options key name changes. + if ( is_main_site() && !defined('DO_NOT_UPGRADE_GLOBAL_TABLES') ) { + $prefix = like_escape($wpdb->base_prefix); + $wpdb->query( "DELETE FROM $wpdb->usermeta WHERE meta_key LIKE '{$prefix}%meta-box-hidden%' OR meta_key LIKE '{$prefix}%closedpostboxes%' OR meta_key LIKE '{$prefix}%manage-%-columns-hidden%' OR meta_key LIKE '{$prefix}%meta-box-order%' OR meta_key LIKE '{$prefix}%metaboxorder%' OR meta_key LIKE '{$prefix}%screen_layout%' + OR meta_key = 'manageedittagscolumnshidden' OR meta_key='managecategoriescolumnshidden' OR meta_key = 'manageedit-tagscolumnshidden' OR meta_key = 'manageeditcolumnshidden' OR meta_key = 'categories_per_page' OR meta_key = 'edit_tags_per_page'" ); + } + +} + +/** + * Execute network level changes + * + * @since 3.0.0 + */ +function upgrade_network() { + global $wp_current_db_version, $wpdb; + // 2.8 + if ( $wp_current_db_version < 11549 ) { + $wpmu_sitewide_plugins = get_site_option( 'wpmu_sitewide_plugins' ); + $active_sitewide_plugins = get_site_option( 'active_sitewide_plugins' ); + if ( $wpmu_sitewide_plugins ) { + if ( !$active_sitewide_plugins ) + $sitewide_plugins = (array) $wpmu_sitewide_plugins; + else + $sitewide_plugins = array_merge( (array) $active_sitewide_plugins, (array) $wpmu_sitewide_plugins ); + + update_site_option( 'active_sitewide_plugins', $sitewide_plugins ); + } + delete_site_option( 'wpmu_sitewide_plugins' ); + delete_site_option( 'deactivated_sitewide_plugins' ); + + $start = 0; + while( $rows = $wpdb->get_results( "SELECT meta_key, meta_value FROM {$wpdb->sitemeta} ORDER BY meta_id LIMIT $start, 20" ) ) { + foreach( $rows as $row ) { + $value = $row->meta_value; + if ( !@unserialize( $value ) ) + $value = stripslashes( $value ); + if ( $value !== $row->meta_value ) { + update_site_option( $row->meta_key, $value ); + } + } + $start += 20; + } + } + // 3.0 + if ( $wp_current_db_version < 13576 ) + update_site_option( 'global_terms_enabled', '1' ); +} + +// The functions we use to actually do stuff + +// General + +/** + * {@internal Missing Short Description}} + * + * {@internal Missing Long Description}} + * + * @since 1.0.0 + * + * @param string $table_name Database table name to create. + * @param string $create_ddl SQL statement to create table. + * @return bool If table already exists or was created by function. + */ +function maybe_create_table($table_name, $create_ddl) { + global $wpdb; + if ( $wpdb->get_var("SHOW TABLES LIKE '$table_name'") == $table_name ) + return true; + //didn't find it try to create it. + $q = $wpdb->query($create_ddl); + // we cannot directly tell that whether this succeeded! + if ( $wpdb->get_var("SHOW TABLES LIKE '$table_name'") == $table_name ) + return true; + return false; +} + +/** + * {@internal Missing Short Description}} + * + * {@internal Missing Long Description}} + * + * @since 1.0.1 + * + * @param string $table Database table name. + * @param string $index Index name to drop. + * @return bool True, when finished. + */ +function drop_index($table, $index) { + global $wpdb; + $wpdb->hide_errors(); + $wpdb->query("ALTER TABLE `$table` DROP INDEX `$index`"); + // Now we need to take out all the extra ones we may have created + for ($i = 0; $i < 25; $i++) { + $wpdb->query("ALTER TABLE `$table` DROP INDEX `{$index}_$i`"); + } + $wpdb->show_errors(); + return true; +} + +/** + * {@internal Missing Short Description}} + * + * {@internal Missing Long Description}} + * + * @since 1.0.1 + * + * @param string $table Database table name. + * @param string $index Database table index column. + * @return bool True, when done with execution. + */ +function add_clean_index($table, $index) { + global $wpdb; + drop_index($table, $index); + $wpdb->query("ALTER TABLE `$table` ADD INDEX ( `$index` )"); + return true; +} + +/** + ** maybe_add_column() + ** Add column to db table if it doesn't exist. + ** Returns: true if already exists or on successful completion + ** false on error + */ +function maybe_add_column($table_name, $column_name, $create_ddl) { + global $wpdb, $debug; + foreach ($wpdb->get_col("DESC $table_name", 0) as $column ) { + if ($debug) echo("checking $column == $column_name
    "); + if ($column == $column_name) { + return true; + } + } + //didn't find it try to create it. + $q = $wpdb->query($create_ddl); + // we cannot directly tell that whether this succeeded! + foreach ($wpdb->get_col("DESC $table_name", 0) as $column ) { + if ($column == $column_name) { + return true; + } + } + return false; +} + +/** + * Retrieve all options as it was for 1.2. + * + * @since 1.2.0 + * + * @return array List of options. + */ +function get_alloptions_110() { + global $wpdb; + if ($options = $wpdb->get_results("SELECT option_name, option_value FROM $wpdb->options")) { + foreach ($options as $option) { + // "When trying to design a foolproof system, + // never underestimate the ingenuity of the fools :)" -- Dougal + if ('siteurl' == $option->option_name) $option->option_value = preg_replace('|/+$|', '', $option->option_value); + if ('home' == $option->option_name) $option->option_value = preg_replace('|/+$|', '', $option->option_value); + if ('category_base' == $option->option_name) $option->option_value = preg_replace('|/+$|', '', $option->option_value); + $all_options->{$option->option_name} = stripslashes($option->option_value); + } + } + return $all_options; +} + +/** + * Version of get_option that is private to install/upgrade. + * + * @since 1.5.1 + * @access private + * + * @param string $setting Option name. + * @return mixed + */ +function __get_option($setting) { + global $wpdb; + + if ( $setting == 'home' && defined( 'WP_HOME' ) ) { + return preg_replace( '|/+$|', '', WP_HOME ); + } + + if ( $setting == 'siteurl' && defined( 'WP_SITEURL' ) ) { + return preg_replace( '|/+$|', '', WP_SITEURL ); + } + + $option = $wpdb->get_var( $wpdb->prepare("SELECT option_value FROM $wpdb->options WHERE option_name = %s", $setting) ); + + if ( 'home' == $setting && '' == $option ) + return __get_option('siteurl'); + + if ( 'siteurl' == $setting || 'home' == $setting || 'category_base' == $setting ) + $option = preg_replace('|/+$|', '', $option); + + @ $kellogs = unserialize($option); + if ($kellogs !== FALSE) + return $kellogs; + else + return $option; +} + +/** + * {@internal Missing Short Description}} + * + * {@internal Missing Long Description}} + * + * @since 1.5.0 + * + * @param string $content + * @return string + */ +function deslash($content) { + // Note: \\\ inside a regex denotes a single backslash. + + // Replace one or more backslashes followed by a single quote with + // a single quote. + $content = preg_replace("/\\\+'/", "'", $content); + + // Replace one or more backslashes followed by a double quote with + // a double quote. + $content = preg_replace('/\\\+"/', '"', $content); + + // Replace one or more backslashes with one backslash. + $content = preg_replace("/\\\+/", "\\", $content); + + return $content; +} + +/** + * {@internal Missing Short Description}} + * + * {@internal Missing Long Description}} + * + * @since 1.5.0 + * + * @param unknown_type $queries + * @param unknown_type $execute + * @return unknown + */ +function dbDelta($queries, $execute = true) { + global $wpdb; + + // Separate individual queries into an array + if ( !is_array($queries) ) { + $queries = explode( ';', $queries ); + if ('' == $queries[count($queries) - 1]) array_pop($queries); + } + + $cqueries = array(); // Creation Queries + $iqueries = array(); // Insertion Queries + $for_update = array(); + + // Create a tablename index for an array ($cqueries) of queries + foreach($queries as $qry) { + if (preg_match("|CREATE TABLE ([^ ]*)|", $qry, $matches)) { + $cqueries[trim( strtolower($matches[1]), '`' )] = $qry; + $for_update[$matches[1]] = 'Created table '.$matches[1]; + } else if (preg_match("|CREATE DATABASE ([^ ]*)|", $qry, $matches)) { + array_unshift($cqueries, $qry); + } else if (preg_match("|INSERT INTO ([^ ]*)|", $qry, $matches)) { + $iqueries[] = $qry; + } else if (preg_match("|UPDATE ([^ ]*)|", $qry, $matches)) { + $iqueries[] = $qry; + } else { + // Unrecognized query type + } + } + + // Check to see which tables and fields exist + if ($tables = $wpdb->get_col('SHOW TABLES;')) { + // For every table in the database + foreach ($tables as $table) { + // Upgrade global tables only for the main site. Don't upgrade at all if DO_NOT_UPGRADE_GLOBAL_TABLES is defined. + if ( in_array($table, $wpdb->tables('global')) && ( !is_main_site() || defined('DO_NOT_UPGRADE_GLOBAL_TABLES') ) ) + continue; + + // If a table query exists for the database table... + if ( array_key_exists(strtolower($table), $cqueries) ) { + // Clear the field and index arrays + $cfields = $indices = array(); + // Get all of the field names in the query from between the parens + preg_match("|\((.*)\)|ms", $cqueries[strtolower($table)], $match2); + $qryline = trim($match2[1]); + + // Separate field lines into an array + $flds = explode("\n", $qryline); + + //echo "
    \n".print_r(strtolower($table), true).":\n".print_r($cqueries, true)."

    "; + + // For every field line specified in the query + foreach ($flds as $fld) { + // Extract the field name + preg_match("|^([^ ]*)|", trim($fld), $fvals); + $fieldname = trim( $fvals[1], '`' ); + + // Verify the found field name + $validfield = true; + switch (strtolower($fieldname)) { + case '': + case 'primary': + case 'index': + case 'fulltext': + case 'unique': + case 'key': + $validfield = false; + $indices[] = trim(trim($fld), ", \n"); + break; + } + $fld = trim($fld); + + // If it's a valid field, add it to the field array + if ($validfield) { + $cfields[strtolower($fieldname)] = trim($fld, ", \n"); + } + } + + // Fetch the table column structure from the database + $tablefields = $wpdb->get_results("DESCRIBE {$table};"); + + // For every field in the table + foreach ($tablefields as $tablefield) { + // If the table field exists in the field array... + if (array_key_exists(strtolower($tablefield->Field), $cfields)) { + // Get the field type from the query + preg_match("|".$tablefield->Field." ([^ ]*( unsigned)?)|i", $cfields[strtolower($tablefield->Field)], $matches); + $fieldtype = $matches[1]; + + // Is actual field type different from the field type in query? + if ($tablefield->Type != $fieldtype) { + // Add a query to change the column type + $cqueries[] = "ALTER TABLE {$table} CHANGE COLUMN {$tablefield->Field} " . $cfields[strtolower($tablefield->Field)]; + $for_update[$table.'.'.$tablefield->Field] = "Changed type of {$table}.{$tablefield->Field} from {$tablefield->Type} to {$fieldtype}"; + } + + // Get the default value from the array + //echo "{$cfields[strtolower($tablefield->Field)]}
    "; + if (preg_match("| DEFAULT '(.*)'|i", $cfields[strtolower($tablefield->Field)], $matches)) { + $default_value = $matches[1]; + if ($tablefield->Default != $default_value) { + // Add a query to change the column's default value + $cqueries[] = "ALTER TABLE {$table} ALTER COLUMN {$tablefield->Field} SET DEFAULT '{$default_value}'"; + $for_update[$table.'.'.$tablefield->Field] = "Changed default value of {$table}.{$tablefield->Field} from {$tablefield->Default} to {$default_value}"; + } + } + + // Remove the field from the array (so it's not added) + unset($cfields[strtolower($tablefield->Field)]); + } else { + // This field exists in the table, but not in the creation queries? + } + } + + // For every remaining field specified for the table + foreach ($cfields as $fieldname => $fielddef) { + // Push a query line into $cqueries that adds the field to that table + $cqueries[] = "ALTER TABLE {$table} ADD COLUMN $fielddef"; + $for_update[$table.'.'.$fieldname] = 'Added column '.$table.'.'.$fieldname; + } + + // Index stuff goes here + // Fetch the table index structure from the database + $tableindices = $wpdb->get_results("SHOW INDEX FROM {$table};"); + + if ($tableindices) { + // Clear the index array + unset($index_ary); + + // For every index in the table + foreach ($tableindices as $tableindex) { + // Add the index to the index data array + $keyname = $tableindex->Key_name; + $index_ary[$keyname]['columns'][] = array('fieldname' => $tableindex->Column_name, 'subpart' => $tableindex->Sub_part); + $index_ary[$keyname]['unique'] = ($tableindex->Non_unique == 0)?true:false; + } + + // For each actual index in the index array + foreach ($index_ary as $index_name => $index_data) { + // Build a create string to compare to the query + $index_string = ''; + if ($index_name == 'PRIMARY') { + $index_string .= 'PRIMARY '; + } else if($index_data['unique']) { + $index_string .= 'UNIQUE '; + } + $index_string .= 'KEY '; + if ($index_name != 'PRIMARY') { + $index_string .= $index_name; + } + $index_columns = ''; + // For each column in the index + foreach ($index_data['columns'] as $column_data) { + if ($index_columns != '') $index_columns .= ','; + // Add the field to the column list string + $index_columns .= $column_data['fieldname']; + if ($column_data['subpart'] != '') { + $index_columns .= '('.$column_data['subpart'].')'; + } + } + // Add the column list to the index create string + $index_string .= ' ('.$index_columns.')'; + if (!(($aindex = array_search($index_string, $indices)) === false)) { + unset($indices[$aindex]); + //echo "
    {$table}:
    Found index:".$index_string."
    \n"; + } + //else echo "
    {$table}:
    Did not find index:".$index_string."
    ".print_r($indices, true)."
    \n"; + } + } + + // For every remaining index specified for the table + foreach ( (array) $indices as $index ) { + // Push a query line into $cqueries that adds the index to that table + $cqueries[] = "ALTER TABLE {$table} ADD $index"; + $for_update[$table.'.'.$fieldname] = 'Added index '.$table.' '.$index; + } + + // Remove the original table creation query from processing + unset($cqueries[strtolower($table)]); + unset($for_update[strtolower($table)]); + } else { + // This table exists in the database, but not in the creation queries? + } + } + } + + $allqueries = array_merge($cqueries, $iqueries); + if ($execute) { + foreach ($allqueries as $query) { + //echo "
    ".print_r($query, true)."
    \n"; + $wpdb->query($query); + } + } + + return $for_update; +} + +/** + * {@internal Missing Short Description}} + * + * {@internal Missing Long Description}} + * + * @since 1.5.0 + */ +function make_db_current() { + global $wp_queries; + + $alterations = dbDelta($wp_queries); + echo "
      \n"; + foreach($alterations as $alteration) echo "
    1. $alteration
    2. \n"; + echo "
    \n"; +} + +/** + * {@internal Missing Short Description}} + * + * {@internal Missing Long Description}} + * + * @since 1.5.0 + */ +function make_db_current_silent() { + global $wp_queries; + + $alterations = dbDelta($wp_queries); +} + +/** + * {@internal Missing Short Description}} + * + * {@internal Missing Long Description}} + * + * @since 1.5.0 + * + * @param unknown_type $theme_name + * @param unknown_type $template + * @return unknown + */ +function make_site_theme_from_oldschool($theme_name, $template) { + $home_path = get_home_path(); + $site_dir = WP_CONTENT_DIR . "/themes/$template"; + + if (! file_exists("$home_path/index.php")) + return false; + + // Copy files from the old locations to the site theme. + // TODO: This does not copy arbitarary include dependencies. Only the + // standard WP files are copied. + $files = array('index.php' => 'index.php', 'wp-layout.css' => 'style.css', 'wp-comments.php' => 'comments.php', 'wp-comments-popup.php' => 'comments-popup.php'); + + foreach ($files as $oldfile => $newfile) { + if ($oldfile == 'index.php') + $oldpath = $home_path; + else + $oldpath = ABSPATH; + + if ($oldfile == 'index.php') { // Check to make sure it's not a new index + $index = implode('', file("$oldpath/$oldfile")); + if (strpos($index, 'WP_USE_THEMES') !== false) { + if (! @copy(WP_CONTENT_DIR . '/themes/' . WP_DEFAULT_THEME . '/index.php', "$site_dir/$newfile")) + return false; + continue; // Don't copy anything + } + } + + if (! @copy("$oldpath/$oldfile", "$site_dir/$newfile")) + return false; + + chmod("$site_dir/$newfile", 0777); + + // Update the blog header include in each file. + $lines = explode("\n", implode('', file("$site_dir/$newfile"))); + if ($lines) { + $f = fopen("$site_dir/$newfile", 'w'); + + foreach ($lines as $line) { + if (preg_match('/require.*wp-blog-header/', $line)) + $line = '//' . $line; + + // Update stylesheet references. + $line = str_replace("/wp-layout.css", "", $line); + + // Update comments template inclusion. + $line = str_replace("", "", $line); + + fwrite($f, "{$line}\n"); + } + fclose($f); + } + } + + // Add a theme header. + $header = "/*\nTheme Name: $theme_name\nTheme URI: " . __get_option('siteurl') . "\nDescription: A theme automatically created by the update.\nVersion: 1.0\nAuthor: Moi\n*/\n"; + + $stylelines = file_get_contents("$site_dir/style.css"); + if ($stylelines) { + $f = fopen("$site_dir/style.css", 'w'); + + fwrite($f, $header); + fwrite($f, $stylelines); + fclose($f); + } + + return true; +} + +/** + * {@internal Missing Short Description}} + * + * {@internal Missing Long Description}} + * + * @since 1.5.0 + * + * @param unknown_type $theme_name + * @param unknown_type $template + * @return unknown + */ +function make_site_theme_from_default($theme_name, $template) { + $site_dir = WP_CONTENT_DIR . "/themes/$template"; + $default_dir = WP_CONTENT_DIR . '/themes/' . WP_DEFAULT_THEME; + + // Copy files from the default theme to the site theme. + //$files = array('index.php', 'comments.php', 'comments-popup.php', 'footer.php', 'header.php', 'sidebar.php', 'style.css'); + + $theme_dir = @ opendir($default_dir); + if ($theme_dir) { + while(($theme_file = readdir( $theme_dir )) !== false) { + if (is_dir("$default_dir/$theme_file")) + continue; + if (! @copy("$default_dir/$theme_file", "$site_dir/$theme_file")) + return; + chmod("$site_dir/$theme_file", 0777); + } + } + @closedir($theme_dir); + + // Rewrite the theme header. + $stylelines = explode("\n", implode('', file("$site_dir/style.css"))); + if ($stylelines) { + $f = fopen("$site_dir/style.css", 'w'); + + foreach ($stylelines as $line) { + if (strpos($line, 'Theme Name:') !== false) $line = 'Theme Name: ' . $theme_name; + elseif (strpos($line, 'Theme URI:') !== false) $line = 'Theme URI: ' . __get_option('url'); + elseif (strpos($line, 'Description:') !== false) $line = 'Description: Your theme.'; + elseif (strpos($line, 'Version:') !== false) $line = 'Version: 1'; + elseif (strpos($line, 'Author:') !== false) $line = 'Author: You'; + fwrite($f, $line . "\n"); + } + fclose($f); + } + + // Copy the images. + umask(0); + if (! mkdir("$site_dir/images", 0777)) { + return false; + } + + $images_dir = @ opendir("$default_dir/images"); + if ($images_dir) { + while(($image = readdir($images_dir)) !== false) { + if (is_dir("$default_dir/images/$image")) + continue; + if (! @copy("$default_dir/images/$image", "$site_dir/images/$image")) + return; + chmod("$site_dir/images/$image", 0777); + } + } + @closedir($images_dir); +} + +// Create a site theme from the default theme. +/** + * {@internal Missing Short Description}} + * + * {@internal Missing Long Description}} + * + * @since 1.5.0 + * + * @return unknown + */ +function make_site_theme() { + // Name the theme after the blog. + $theme_name = __get_option('blogname'); + $template = sanitize_title($theme_name); + $site_dir = WP_CONTENT_DIR . "/themes/$template"; + + // If the theme already exists, nothing to do. + if ( is_dir($site_dir)) { + return false; + } + + // We must be able to write to the themes dir. + if (! is_writable(WP_CONTENT_DIR . "/themes")) { + return false; + } + + umask(0); + if (! mkdir($site_dir, 0777)) { + return false; + } + + if (file_exists(ABSPATH . 'wp-layout.css')) { + if (! make_site_theme_from_oldschool($theme_name, $template)) { + // TODO: rm -rf the site theme directory. + return false; + } + } else { + if (! make_site_theme_from_default($theme_name, $template)) + // TODO: rm -rf the site theme directory. + return false; + } + + // Make the new site theme active. + $current_template = __get_option('template'); + if ($current_template == WP_DEFAULT_THEME) { + update_option('template', $template); + update_option('stylesheet', $template); + } + return $template; +} + +/** + * Translate user level to user role name. + * + * @since 2.0.0 + * + * @param int $level User level. + * @return string User role name. + */ +function translate_level_to_role($level) { + switch ($level) { + case 10: + case 9: + case 8: + return 'administrator'; + case 7: + case 6: + case 5: + return 'editor'; + case 4: + case 3: + case 2: + return 'author'; + case 1: + return 'contributor'; + case 0: + return 'subscriber'; + } +} + +/** + * {@internal Missing Short Description}} + * + * {@internal Missing Long Description}} + * + * @since 2.1.0 + */ +function wp_check_mysql_version() { + global $wpdb; + $result = $wpdb->check_database_version(); + if ( is_wp_error( $result ) ) + die( $result->get_error_message() ); +} + +/** + * {@internal Missing Short Description}} + * + * {@internal Missing Long Description}} + * + * @since 2.2.0 + */ +function maybe_disable_automattic_widgets() { + $plugins = __get_option( 'active_plugins' ); + + foreach ( (array) $plugins as $plugin ) { + if ( basename( $plugin ) == 'widgets.php' ) { + array_splice( $plugins, array_search( $plugin, $plugins ), 1 ); + update_option( 'active_plugins', $plugins ); + break; + } + } +} + +/** + * Runs before the schema is upgraded. + * + * @since 2.9.0 + */ +function pre_schema_upgrade() { + global $wp_current_db_version, $wp_db_version, $wpdb; + + // Upgrade versions prior to 2.9 + if ( $wp_current_db_version < 11557 ) { + // Delete duplicate options. Keep the option with the highest option_id. + $wpdb->query("DELETE o1 FROM $wpdb->options AS o1 JOIN $wpdb->options AS o2 USING (`option_name`) WHERE o2.option_id > o1.option_id"); + + // Drop the old primary key and add the new. + $wpdb->query("ALTER TABLE $wpdb->options DROP PRIMARY KEY, ADD PRIMARY KEY(option_id)"); + + // Drop the old option_name index. dbDelta() doesn't do the drop. + $wpdb->query("ALTER TABLE $wpdb->options DROP INDEX option_name"); + } + +} + +/** + * Install Network. + * + * @since 3.0.0 + * + */ +if ( !function_exists( 'install_network' ) ) : +function install_network() { + global $wpdb, $charset_collate; + $ms_queries = " +CREATE TABLE $wpdb->users ( + ID bigint(20) unsigned NOT NULL auto_increment, + user_login varchar(60) NOT NULL default '', + user_pass varchar(64) NOT NULL default '', + user_nicename varchar(50) NOT NULL default '', + user_email varchar(100) NOT NULL default '', + user_url varchar(100) NOT NULL default '', + user_registered datetime NOT NULL default '0000-00-00 00:00:00', + user_activation_key varchar(60) NOT NULL default '', + user_status int(11) NOT NULL default '0', + display_name varchar(250) NOT NULL default '', + spam tinyint(2) NOT NULL default '0', + deleted tinyint(2) NOT NULL default '0', + PRIMARY KEY (ID), + KEY user_login_key (user_login), + KEY user_nicename (user_nicename) +) $charset_collate; +CREATE TABLE $wpdb->blogs ( + blog_id bigint(20) NOT NULL auto_increment, + site_id bigint(20) NOT NULL default '0', + domain varchar(200) NOT NULL default '', + path varchar(100) NOT NULL default '', + registered datetime NOT NULL default '0000-00-00 00:00:00', + last_updated datetime NOT NULL default '0000-00-00 00:00:00', + public tinyint(2) NOT NULL default '1', + archived enum('0','1') NOT NULL default '0', + mature tinyint(2) NOT NULL default '0', + spam tinyint(2) NOT NULL default '0', + deleted tinyint(2) NOT NULL default '0', + lang_id int(11) NOT NULL default '0', + PRIMARY KEY (blog_id), + KEY domain (domain(50),path(5)), + KEY lang_id (lang_id) +) $charset_collate; +CREATE TABLE $wpdb->blog_versions ( + blog_id bigint(20) NOT NULL default '0', + db_version varchar(20) NOT NULL default '', + last_updated datetime NOT NULL default '0000-00-00 00:00:00', + PRIMARY KEY (blog_id), + KEY db_version (db_version) +) $charset_collate; +CREATE TABLE $wpdb->registration_log ( + ID bigint(20) NOT NULL auto_increment, + email varchar(255) NOT NULL default '', + IP varchar(30) NOT NULL default '', + blog_id bigint(20) NOT NULL default '0', + date_registered datetime NOT NULL default '0000-00-00 00:00:00', + PRIMARY KEY (ID), + KEY IP (IP) +) $charset_collate; +CREATE TABLE $wpdb->site ( + id bigint(20) NOT NULL auto_increment, + domain varchar(200) NOT NULL default '', + path varchar(100) NOT NULL default '', + PRIMARY KEY (id), + KEY domain (domain,path) +) $charset_collate; +CREATE TABLE $wpdb->sitemeta ( + meta_id bigint(20) NOT NULL auto_increment, + site_id bigint(20) NOT NULL default '0', + meta_key varchar(255) default NULL, + meta_value longtext, + PRIMARY KEY (meta_id), + KEY meta_key (meta_key), + KEY site_id (site_id) +) $charset_collate; +CREATE TABLE $wpdb->signups ( + domain varchar(200) NOT NULL default '', + path varchar(100) NOT NULL default '', + title longtext NOT NULL, + user_login varchar(60) NOT NULL default '', + user_email varchar(100) NOT NULL default '', + registered datetime NOT NULL default '0000-00-00 00:00:00', + activated datetime NOT NULL default '0000-00-00 00:00:00', + active tinyint(1) NOT NULL default '0', + activation_key varchar(50) NOT NULL default '', + meta longtext, + KEY activation_key (activation_key), + KEY domain (domain) +) $charset_collate; +"; +// now create tables + dbDelta( $ms_queries ); +} +endif; + +/** + * Install global terms. + * + * @since 3.0.0 + * + */ +if ( !function_exists( 'install_global_terms' ) ) : +function install_global_terms() { + global $wpdb, $charset_collate; + $ms_queries = " +CREATE TABLE $wpdb->sitecategories ( + cat_ID bigint(20) NOT NULL auto_increment, + cat_name varchar(55) NOT NULL default '', + category_nicename varchar(200) NOT NULL default '', + last_updated timestamp NOT NULL, + PRIMARY KEY (cat_ID), + KEY category_nicename (category_nicename), + KEY last_updated (last_updated) +) $charset_collate; +"; +// now create tables + dbDelta( $ms_queries ); +} +endif; +?> diff --git a/src/wp-admin/includes/user.php b/src/wp-admin/includes/user.php new file mode 100644 index 0000000..758c065 --- /dev/null +++ b/src/wp-admin/includes/user.php @@ -0,0 +1,383 @@ +role_objects[$new_role]->has_cap( 'edit_users' ) ) { + // If the new role isn't editable by the logged-in user die with error + $editable_roles = get_editable_roles(); + if ( empty( $editable_roles[$new_role] ) ) + wp_die(__('You can’t give users that role.')); + + $user = new WP_User( $user_id ); + $user->set_role( $new_role ); + } + } + } else { + add_action( 'user_register', 'add_user' ); // See above + return edit_user(); + } +} + +/** + * Edit user settings based on contents of $_POST + * + * Used on user-edit.php and profile.php to manage and process user options, passwords etc. + * + * @since 2.0 + * + * @param int $user_id Optional. User ID. + * @return int user id of the updated user + */ +function edit_user( $user_id = 0 ) { + global $wp_roles, $wpdb; + $user = new stdClass; + if ( $user_id ) { + $update = true; + $user->ID = (int) $user_id; + $userdata = get_userdata( $user_id ); + $user->user_login = $wpdb->escape( $userdata->user_login ); + } else { + $update = false; + } + + if ( !$update && isset( $_POST['user_login'] ) ) + $user->user_login = sanitize_user($_POST['user_login'], true); + + $pass1 = $pass2 = ''; + if ( isset( $_POST['pass1'] )) + $pass1 = $_POST['pass1']; + if ( isset( $_POST['pass2'] )) + $pass2 = $_POST['pass2']; + + if ( isset( $_POST['role'] ) && current_user_can( 'edit_users' ) ) { + $new_role = sanitize_text_field( $_POST['role'] ); + $potential_role = isset($wp_roles->role_objects[$new_role]) ? $wp_roles->role_objects[$new_role] : false; + // Don't let anyone with 'edit_users' (admins) edit their own role to something without it. + // Multisite super admins can freely edit their blog roles -- they possess all caps. + if ( ( is_multisite() && current_user_can( 'manage_sites' ) ) || $user_id != get_current_user_id() || ($potential_role && $potential_role->has_cap( 'edit_users' ) ) ) + $user->role = $new_role; + + // If the new role isn't editable by the logged-in user die with error + $editable_roles = get_editable_roles(); + if ( ! empty( $new_role ) && empty( $editable_roles[$new_role] ) ) + wp_die(__('You can’t give users that role.')); + } + + if ( isset( $_POST['email'] )) + $user->user_email = sanitize_text_field( $_POST['email'] ); + if ( isset( $_POST['url'] ) ) { + if ( empty ( $_POST['url'] ) || $_POST['url'] == 'http://' ) { + $user->user_url = ''; + } else { + $user->user_url = esc_url_raw( $_POST['url'] ); + $user->user_url = preg_match('/^(https?|ftps?|mailto|news|irc|gopher|nntp|feed|telnet):/is', $user->user_url) ? $user->user_url : 'http://'.$user->user_url; + } + } + if ( isset( $_POST['first_name'] ) ) + $user->first_name = sanitize_text_field( $_POST['first_name'] ); + if ( isset( $_POST['last_name'] ) ) + $user->last_name = sanitize_text_field( $_POST['last_name'] ); + if ( isset( $_POST['nickname'] ) ) + $user->nickname = sanitize_text_field( $_POST['nickname'] ); + if ( isset( $_POST['display_name'] ) ) + $user->display_name = sanitize_text_field( $_POST['display_name'] ); + + if ( isset( $_POST['description'] ) ) + $user->description = trim( $_POST['description'] ); + + foreach ( _wp_get_user_contactmethods( $user ) as $method => $name ) { + if ( isset( $_POST[$method] )) + $user->$method = sanitize_text_field( $_POST[$method] ); + } + + if ( $update ) { + $user->rich_editing = isset( $_POST['rich_editing'] ) && 'false' == $_POST['rich_editing'] ? 'false' : 'true'; + $user->admin_color = isset( $_POST['admin_color'] ) ? sanitize_text_field( $_POST['admin_color'] ) : 'fresh'; + $user->show_admin_bar_front = isset( $_POST['admin_bar_front'] ) ? 'true' : 'false'; + $user->show_admin_bar_admin = isset( $_POST['admin_bar_admin'] ) ? 'true' : 'false'; + } + + $user->comment_shortcuts = isset( $_POST['comment_shortcuts'] ) && 'true' == $_POST['comment_shortcuts'] ? 'true' : ''; + + $user->use_ssl = 0; + if ( !empty($_POST['use_ssl']) ) + $user->use_ssl = 1; + + $errors = new WP_Error(); + + /* checking that username has been typed */ + if ( $user->user_login == '' ) + $errors->add( 'user_login', __( 'ERROR: Please enter a username.' )); + + /* checking the password has been typed twice */ + do_action_ref_array( 'check_passwords', array ( $user->user_login, & $pass1, & $pass2 )); + + if ( $update ) { + if ( empty($pass1) && !empty($pass2) ) + $errors->add( 'pass', __( 'ERROR: You entered your new password only once.' ), array( 'form-field' => 'pass1' ) ); + elseif ( !empty($pass1) && empty($pass2) ) + $errors->add( 'pass', __( 'ERROR: You entered your new password only once.' ), array( 'form-field' => 'pass2' ) ); + } else { + if ( empty($pass1) ) + $errors->add( 'pass', __( 'ERROR: Please enter your password.' ), array( 'form-field' => 'pass1' ) ); + elseif ( empty($pass2) ) + $errors->add( 'pass', __( 'ERROR: Please enter your password twice.' ), array( 'form-field' => 'pass2' ) ); + } + + /* Check for "\" in password */ + if ( false !== strpos( stripslashes($pass1), "\\" ) ) + $errors->add( 'pass', __( 'ERROR: Passwords may not contain the character "\\".' ), array( 'form-field' => 'pass1' ) ); + + /* checking the password has been typed twice the same */ + if ( $pass1 != $pass2 ) + $errors->add( 'pass', __( 'ERROR: Please enter the same password in the two password fields.' ), array( 'form-field' => 'pass1' ) ); + + if ( !empty( $pass1 ) ) + $user->user_pass = $pass1; + + if ( !$update && isset( $_POST['user_login'] ) && !validate_username( $_POST['user_login'] ) ) + $errors->add( 'user_login', __( 'ERROR: This username is invalid because it uses illegal characters. Please enter a valid username.' )); + + if ( !$update && username_exists( $user->user_login ) ) + $errors->add( 'user_login', __( 'ERROR: This username is already registered. Please choose another one.' )); + + /* checking e-mail address */ + if ( empty( $user->user_email ) ) { + $errors->add( 'empty_email', __( 'ERROR: Please enter an e-mail address.' ), array( 'form-field' => 'email' ) ); + } elseif ( !is_email( $user->user_email ) ) { + $errors->add( 'invalid_email', __( 'ERROR: The e-mail address isn’t correct.' ), array( 'form-field' => 'email' ) ); + } elseif ( ( $owner_id = email_exists($user->user_email) ) && ( !$update || ( $owner_id != $user->ID ) ) ) { + $errors->add( 'email_exists', __('ERROR: This email is already registered, please choose another one.'), array( 'form-field' => 'email' ) ); + } + + // Allow plugins to return their own errors. + do_action_ref_array('user_profile_update_errors', array ( &$errors, $update, &$user ) ); + + if ( $errors->get_error_codes() ) + return $errors; + + if ( $update ) { + $user_id = wp_update_user( get_object_vars( $user ) ); + } else { + $user_id = wp_insert_user( get_object_vars( $user ) ); + wp_new_user_notification( $user_id, isset($_POST['send_password']) ? $pass1 : '' ); + } + return $user_id; +} + +/** + * Fetch a filtered list of user roles that the current user is + * allowed to edit. + * + * Simple function who's main purpose is to allow filtering of the + * list of roles in the $wp_roles object so that plugins can remove + * innappropriate ones depending on the situation or user making edits. + * Specifically because without filtering anyone with the edit_users + * capability can edit others to be administrators, even if they are + * only editors or authors. This filter allows admins to delegate + * user management. + * + * @since 2.8 + * + * @return unknown + */ +function get_editable_roles() { + global $wp_roles; + + $all_roles = $wp_roles->roles; + $editable_roles = apply_filters('editable_roles', $all_roles); + + return $editable_roles; +} + +/** + * Retrieve user data and filter it. + * + * @since 2.0.5 + * + * @param int $user_id User ID. + * @return object WP_User object with user data. + */ +function get_user_to_edit( $user_id ) { + $user = new WP_User( $user_id ); + + $user_contactmethods = _wp_get_user_contactmethods( $user ); + foreach ($user_contactmethods as $method => $name) { + if ( empty( $user->{$method} ) ) + $user->{$method} = ''; + } + + if ( empty($user->description) ) + $user->description = ''; + + $user = sanitize_user_object($user, 'edit'); + + return $user; +} + +/** + * Retrieve the user's drafts. + * + * @since 2.0.0 + * + * @param int $user_id User ID. + * @return array + */ +function get_users_drafts( $user_id ) { + global $wpdb; + $query = $wpdb->prepare("SELECT ID, post_title FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'draft' AND post_author = %d ORDER BY post_modified DESC", $user_id); + $query = apply_filters('get_users_drafts', $query); + return $wpdb->get_results( $query ); +} + +/** + * Remove user and optionally reassign posts and links to another user. + * + * If the $reassign parameter is not assigned to an User ID, then all posts will + * be deleted of that user. The action 'delete_user' that is passed the User ID + * being deleted will be run after the posts are either reassigned or deleted. + * The user meta will also be deleted that are for that User ID. + * + * @since 2.0.0 + * + * @param int $id User ID. + * @param int $reassign Optional. Reassign posts and links to new User ID. + * @return bool True when finished. + */ +function wp_delete_user( $id, $reassign = 'novalue' ) { + global $wpdb; + + $id = (int) $id; + + // allow for transaction statement + do_action('delete_user', $id); + + if ( 'novalue' === $reassign || null === $reassign ) { + $post_ids = $wpdb->get_col( $wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_author = %d", $id) ); + + if ( $post_ids ) { + foreach ( $post_ids as $post_id ) + wp_delete_post($post_id); + } + + // Clean links + $link_ids = $wpdb->get_col( $wpdb->prepare("SELECT link_id FROM $wpdb->links WHERE link_owner = %d", $id) ); + + if ( $link_ids ) { + foreach ( $link_ids as $link_id ) + wp_delete_link($link_id); + } + } else { + $reassign = (int) $reassign; + $wpdb->update( $wpdb->posts, array('post_author' => $reassign), array('post_author' => $id) ); + $wpdb->update( $wpdb->links, array('link_owner' => $reassign), array('link_owner' => $id) ); + } + + clean_user_cache($id); + + // FINALLY, delete user + if ( !is_multisite() ) { + $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->usermeta WHERE user_id = %d", $id) ); + $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->users WHERE ID = %d", $id) ); + } else { + $level_key = $wpdb->get_blog_prefix() . 'capabilities'; // wpmu site admins don't have user_levels + $wpdb->query("DELETE FROM $wpdb->usermeta WHERE user_id = $id AND meta_key = '{$level_key}'"); + } + + // allow for commit transaction + do_action('deleted_user', $id); + + return true; +} + +/** + * Remove all capabilities from user. + * + * @since 2.1.0 + * + * @param int $id User ID. + */ +function wp_revoke_user($id) { + $id = (int) $id; + + $user = new WP_User($id); + $user->remove_all_caps(); +} + +add_action('admin_init', 'default_password_nag_handler'); +/** + * @since 2.8.0 + */ +function default_password_nag_handler($errors = false) { + global $user_ID; + if ( ! get_user_option('default_password_nag') ) //Short circuit it. + return; + + //get_user_setting = JS saved UI setting. else no-js-falback code. + if ( 'hide' == get_user_setting('default_password_nag') || isset($_GET['default_password_nag']) && '0' == $_GET['default_password_nag'] ) { + delete_user_setting('default_password_nag'); + update_user_option($user_ID, 'default_password_nag', false, true); + } +} + +add_action('profile_update', 'default_password_nag_edit_user', 10, 2); +/** + * @since 2.8.0 + */ +function default_password_nag_edit_user($user_ID, $old_data) { + if ( ! get_user_option('default_password_nag', $user_ID) ) //Short circuit it. + return; + + $new_data = get_userdata($user_ID); + + if ( $new_data->user_pass != $old_data->user_pass ) { //Remove the nag if the password has been changed. + delete_user_setting('default_password_nag', $user_ID); + update_user_option($user_ID, 'default_password_nag', false, true); + } +} + +add_action('admin_notices', 'default_password_nag'); +/** + * @since 2.8.0 + */ +function default_password_nag() { + global $pagenow; + if ( 'profile.php' == $pagenow || ! get_user_option('default_password_nag') ) //Short circuit it. + return; + + echo '
    '; + echo '

    '; + echo '' . __('Notice:') . ' '; + _e('You’re using the auto-generated password for your account. Would you like to change it to something easier to remember?'); + echo '

    '; + printf( '' . __('Yes, take me to my profile page') . ' | ', admin_url('profile.php') . '#password' ); + printf( '' . __('No thanks, do not remind me again') . '', '?default_password_nag=0' ); + echo '

    '; +} + +?> diff --git a/src/wp-admin/includes/widgets.php b/src/wp-admin/includes/widgets.php new file mode 100644 index 0000000..6b7d635 --- /dev/null +++ b/src/wp-admin/includes/widgets.php @@ -0,0 +1,225 @@ + $widget['id'], 'widget_name' => $widget['name'], '_display' => 'template' ); + + if ( isset($wp_registered_widget_controls[$widget['id']]['id_base']) && isset($widget['params'][0]['number']) ) { + $id_base = $wp_registered_widget_controls[$widget['id']]['id_base']; + $args['_temp_id'] = "$id_base-__i__"; + $args['_multi_num'] = next_widget_id_number($id_base); + $args['_add'] = 'multi'; + } else { + $args['_add'] = 'single'; + if ( $sidebar ) + $args['_hide'] = '1'; + } + + $args = wp_list_widget_controls_dynamic_sidebar( array( 0 => $args, 1 => $widget['params'][0] ) ); + call_user_func_array( 'wp_widget_control', $args ); + } +} + +/** + * Callback to sort array by a 'name' key. + * + * @since 3.1.0 + * @access private + */ +function _sort_name_callback( $a, $b ) { + return strnatcasecmp( $a['name'], $b['name'] ); +} + +/** + * Show the widgets and their settings for a sidebar. + * Used in the the admin widget config screen. + * + * @since 2.5.0 + * + * @param string $sidebar id slug of the sidebar + */ +function wp_list_widget_controls( $sidebar ) { + add_filter( 'dynamic_sidebar_params', 'wp_list_widget_controls_dynamic_sidebar' ); + + echo "
    \n"; + + $description = wp_sidebar_description( $sidebar ); + + if ( !empty( $description ) ) { + echo "\n"; + } + + dynamic_sidebar( $sidebar ); + echo "
    \n"; +} + +/** + * {@internal Missing Short Description}} + * + * @since 2.5.0 + * + * @param array $params + * @return array + */ +function wp_list_widget_controls_dynamic_sidebar( $params ) { + global $wp_registered_widgets; + static $i = 0; + $i++; + + $widget_id = $params[0]['widget_id']; + $id = isset($params[0]['_temp_id']) ? $params[0]['_temp_id'] : $widget_id; + $hidden = isset($params[0]['_hide']) ? ' style="display:none;"' : ''; + + $params[0]['before_widget'] = "
    "; + $params[0]['after_widget'] = "
    "; + $params[0]['before_title'] = "%BEG_OF_TITLE%"; // deprecated + $params[0]['after_title'] = "%END_OF_TITLE%"; // deprecated + if ( is_callable( $wp_registered_widgets[$widget_id]['callback'] ) ) { + $wp_registered_widgets[$widget_id]['_callback'] = $wp_registered_widgets[$widget_id]['callback']; + $wp_registered_widgets[$widget_id]['callback'] = 'wp_widget_control'; + } + + return $params; +} + +function next_widget_id_number($id_base) { + global $wp_registered_widgets; + $number = 1; + + foreach ( $wp_registered_widgets as $widget_id => $widget ) { + if ( preg_match( '/' . $id_base . '-([0-9]+)$/', $widget_id, $matches ) ) + $number = max($number, $matches[1]); + } + $number++; + + return $number; +} + +/** + * Meta widget used to display the control form for a widget. + * + * Called from dynamic_sidebar(). + * + * @since 2.5.0 + * + * @param array $sidebar_args + * @return array + */ +function wp_widget_control( $sidebar_args ) { + global $wp_registered_widgets, $wp_registered_widget_controls, $sidebars_widgets; + + $widget_id = $sidebar_args['widget_id']; + $sidebar_id = isset($sidebar_args['id']) ? $sidebar_args['id'] : false; + $key = $sidebar_id ? array_search( $widget_id, $sidebars_widgets[$sidebar_id] ) : '-1'; // position of widget in sidebar + $control = isset($wp_registered_widget_controls[$widget_id]) ? $wp_registered_widget_controls[$widget_id] : array(); + $widget = $wp_registered_widgets[$widget_id]; + + $id_format = $widget['id']; + $widget_number = isset($control['params'][0]['number']) ? $control['params'][0]['number'] : ''; + $id_base = isset($control['id_base']) ? $control['id_base'] : $widget_id; + $multi_number = isset($sidebar_args['_multi_num']) ? $sidebar_args['_multi_num'] : ''; + $add_new = isset($sidebar_args['_add']) ? $sidebar_args['_add'] : ''; + + $query_arg = array( 'editwidget' => $widget['id'] ); + if ( $add_new ) { + $query_arg['addnew'] = 1; + if ( $multi_number ) { + $query_arg['num'] = $multi_number; + $query_arg['base'] = $id_base; + } + } else { + $query_arg['sidebar'] = $sidebar_id; + $query_arg['key'] = $key; + } + + // We aren't showing a widget control, we're outputing a template for a mult-widget control + if ( isset($sidebar_args['_display']) && 'template' == $sidebar_args['_display'] && $widget_number ) { + // number == -1 implies a template where id numbers are replaced by a generic '__i__' + $control['params'][0]['number'] = -1; + // with id_base widget id's are constructed like {$id_base}-{$id_number} + if ( isset($control['id_base']) ) + $id_format = $control['id_base'] . '-__i__'; + } + + $wp_registered_widgets[$widget_id]['callback'] = $wp_registered_widgets[$widget_id]['_callback']; + unset($wp_registered_widgets[$widget_id]['_callback']); + + $widget_title = esc_html( strip_tags( $sidebar_args['widget_name'] ) ); + $has_form = 'noform'; + + echo $sidebar_args['before_widget']; ?> +
    +
    + + +
    +

    +
    + +
    +
    +
    +" . __('There are no options for this widget.') . "

    \n"; ?> +
    + + + + + + + + +
    +
    + | + +
    +
    + + 'widget-' . esc_attr( $id_format ) . '-savewidget' ) ); ?> +
    +
    +
    +
    +
    + +
    + +
    + \ No newline at end of file diff --git a/src/wp-admin/index.php b/src/wp-admin/index.php new file mode 100644 index 0000000..35b041d --- /dev/null +++ b/src/wp-admin/index.php @@ -0,0 +1,70 @@ + 4, 'default' => 1) ); +else + add_screen_option('layout_columns', array('max' => 4, 'default' => 2) ); + +add_contextual_help($current_screen, + + '

    ' . __( 'Welcome to your WordPress Dashboard! You will find helpful tips in the Help tab of each screen to assist you as you get to know the application.' ) . '

    ' . + '

    ' . __( 'The Admin Bar at the top provides quick access to common tasks when you are viewing your site. If you miss the Favorite Actions dropdown, removed as of 3.2, you can find many of the same actions in the Admin Bar, such as Add New > Post.' ) . '

    ' . + '

    ' . __( 'The left-hand navigation menu provides links to the administration screens in your WordPress application. You can expand or collapse navigation sections by clicking on the arrow that appears on the right side of each navigation item when you hover over it. You can also minimize the navigation menu to a narrow icon strip by clicking on the Collapse Menu arrow at the bottom of the nav menu, below Settings; when minimized, the submenu items will be displayed on hover.' ) . '

    ' . + '

    ' . __( 'You can arrange your dashboard by choosing which boxes, or modules, to display in the work area, how many columns to display them in, and where each box should be placed. You can hide/show boxes and select the number of columns in the Screen Options tab. To rearrange the boxes, drag and drop by clicking on the title bar of the selected box and releasing when you see a gray dotted-line rectangle appear in the location you want to place the box. You can also expand or collapse each box; click the title area or downward arrow of the box. In addition, some boxes are configurable, and will show a “Configure” link in the title bar if you hover over it.' ) . '

    ' . + '

    ' . __( 'The boxes on your Dashboard screen are:' ) . '

    ' . + '

    ' . __( 'Right Now - Displays a summary of the content on your site and identifies which theme and version of WordPress you are using.' ) . '

    ' . + '

    ' . __( 'Recent Comments - Shows the most recent comments on your posts (configurable, up to 30) and allows you to moderate them.' ) . '

    ' . + '

    ' . __( 'Incoming Links - Shows links to your site found by Google Blog Search.' ) . '

    ' . + '

    ' . __( 'QuickPress - Allows you to create a new post and either publish it or save it as a draft.' ) . '

    ' . + '

    ' . __( 'Recent Drafts - Displays links to the 5 most recent draft posts you’ve started.' ) . '

    ' . + '

    ' . __( 'WordPress Blog - Come here for the latest scoop.' ) . '

    ' . + '

    ' . __( 'Other WordPress News - Shows the feed from WordPress Planet. You can configure it to show a different feed of your choosing.' ) . '

    ' . + '

    ' . __( 'Plugins - Features the most popular, newest, and recently updated plugins from the WordPress.org Plugin Directory.' ) . '

    ' . + '

    ' . __( 'For more information:' ) . '

    ' . + '

    ' . __( 'Documentation on Dashboard' ) . '

    ' . + '

    ' . __( 'Support Forums' ) . '

    ' +); + +include (ABSPATH . 'wp-admin/admin-header.php'); + +$today = current_time('mysql', 1); +?> + +
    + +

    + +
    + + + +
    +
    + +
    + + diff --git a/src/wp-admin/install-helper.php b/src/wp-admin/install-helper.php new file mode 100644 index 0000000..2970b7c --- /dev/null +++ b/src/wp-admin/install-helper.php @@ -0,0 +1,217 @@ + + * check_column('wp_links', 'link_description', 'mediumtext'); + * if (check_column($wpdb->comments, 'comment_author', 'tinytext')) + * echo "ok\n"; + * + * $error_count = 0; + * $tablename = $wpdb->links; + * // check the column + * if (!check_column($wpdb->links, 'link_description', 'varchar(255)')) { + * $ddl = "ALTER TABLE $wpdb->links MODIFY COLUMN link_description varchar(255) NOT NULL DEFAULT '' "; + * $q = $wpdb->query($ddl); + * } + * + * if (check_column($wpdb->links, 'link_description', 'varchar(255)')) { + * $res .= $tablename . ' - ok
    '; + * } else { + * $res .= 'There was a problem with ' . $tablename . '
    '; + * ++$error_count; + * } + * + * + * @package WordPress + * @subpackage Plugin + */ + +/** Load WordPress Bootstrap */ +require_once(dirname(dirname(__FILE__)).'/wp-load.php'); + +/** + * Turn debugging on or off. + * @global bool|int $debug + * @name $debug + * @var bool|int + * @since 1.0.0 + */ +$debug = 0; + +if ( ! function_exists('maybe_create_table') ) : +/** + * Create database table, if it doesn't already exist. + * + * @since 1.0.0 + * @package WordPress + * @subpackage Plugin + * @uses $wpdb + * + * @param string $table_name Database table name. + * @param string $create_ddl Create database table SQL. + * @return bool False on error, true if already exists or success. + */ +function maybe_create_table($table_name, $create_ddl) { + global $wpdb; + foreach ($wpdb->get_col("SHOW TABLES",0) as $table ) { + if ($table == $table_name) { + return true; + } + } + //didn't find it try to create it. + $wpdb->query($create_ddl); + // we cannot directly tell that whether this succeeded! + foreach ($wpdb->get_col("SHOW TABLES",0) as $table ) { + if ($table == $table_name) { + return true; + } + } + return false; +} +endif; + +if ( ! function_exists('maybe_add_column') ) : +/** + * Add column to database table, if column doesn't already exist in table. + * + * @since 1.0.0 + * @package WordPress + * @subpackage Plugin + * @uses $wpdb + * @uses $debug + * + * @param string $table_name Database table name + * @param string $column_name Table column name + * @param string $create_ddl SQL to add column to table. + * @return bool False on failure. True, if already exists or was successful. + */ +function maybe_add_column($table_name, $column_name, $create_ddl) { + global $wpdb, $debug; + foreach ($wpdb->get_col("DESC $table_name",0) as $column ) { + if ($debug) echo("checking $column == $column_name
    "); + + if ($column == $column_name) { + return true; + } + } + //didn't find it try to create it. + $wpdb->query($create_ddl); + // we cannot directly tell that whether this succeeded! + foreach ($wpdb->get_col("DESC $table_name",0) as $column ) { + if ($column == $column_name) { + return true; + } + } + return false; +} +endif; + +/** + * Drop column from database table, if it exists. + * + * @since 1.0.0 + * @package WordPress + * @subpackage Plugin + * @uses $wpdb + * + * @param string $table_name Table name + * @param string $column_name Column name + * @param string $drop_ddl SQL statement to drop column. + * @return bool False on failure, true on success or doesn't exist. + */ +function maybe_drop_column($table_name, $column_name, $drop_ddl) { + global $wpdb; + foreach ($wpdb->get_col("DESC $table_name",0) as $column ) { + if ($column == $column_name) { + //found it try to drop it. + $wpdb->query($drop_ddl); + // we cannot directly tell that whether this succeeded! + foreach ($wpdb->get_col("DESC $table_name",0) as $column ) { + if ($column == $column_name) { + return false; + } + } + } + } + // else didn't find it + return true; +} + +/** + * Check column matches criteria. + * + * Uses the SQL DESC for retrieving the table info for the column. It will help + * understand the parameters, if you do more research on what column information + * is returned by the SQL statement. Pass in null to skip checking that + * criteria. + * + * Column names returned from DESC table are case sensitive and are listed: + * Field + * Type + * Null + * Key + * Default + * Extra + * + * @since 1.0.0 + * @package WordPress + * @subpackage Plugin + * + * @param string $table_name Table name + * @param string $col_name Column name + * @param string $col_type Column type + * @param bool $is_null Optional. Check is null. + * @param mixed $key Optional. Key info. + * @param mixed $default Optional. Default value. + * @param mixed $extra Optional. Extra value. + * @return bool True, if matches. False, if not matching. + */ +function check_column($table_name, $col_name, $col_type, $is_null = null, $key = null, $default = null, $extra = null) { + global $wpdb, $debug; + $diffs = 0; + $results = $wpdb->get_results("DESC $table_name"); + + foreach ($results as $row ) { + if ($debug > 1) print_r($row); + + if ($row->Field == $col_name) { + // got our column, check the params + if ($debug) echo ("checking $row->Type against $col_type\n"); + if (($col_type != null) && ($row->Type != $col_type)) { + ++$diffs; + } + if (($is_null != null) && ($row->Null != $is_null)) { + ++$diffs; + } + if (($key != null) && ($row->Key != $key)) { + ++$diffs; + } + if (($default != null) && ($row->Default != $default)) { + ++$diffs; + } + if (($extra != null) && ($row->Extra != $extra)) { + ++$diffs; + } + if ($diffs > 0) { + if ($debug) echo ("diffs = $diffs returning false\n"); + return false; + } + return true; + } // end if found our column + } + return false; +} + +?> \ No newline at end of file diff --git a/src/wp-admin/install.php b/src/wp-admin/install.php new file mode 100644 index 0000000..0b65f52 --- /dev/null +++ b/src/wp-admin/install.php @@ -0,0 +1,264 @@ + + + + + + Error: PHP is not running + + +

    WordPress

    +

    Error: PHP is not running

    +

    WordPress requires that your web server is running PHP. Your server does not have PHP installed, or PHP is turned off.

    + + + + +> + + + <?php _e( 'WordPress › Installation' ); ?> + + + +

    WordPress

    + +get_var("SHOW TABLES LIKE '$wpdb->users'") != null ); + + // Ensure that Blogs appear in search engines by default + $blog_public = 1; + if ( ! empty( $_POST ) ) + $blog_public = isset( $_POST['blog_public'] ); + + $weblog_title = isset( $_POST['weblog_title'] ) ? trim( stripslashes( $_POST['weblog_title'] ) ) : ''; + $user_name = isset($_POST['user_name']) ? trim( stripslashes( $_POST['user_name'] ) ) : 'admin'; + $admin_password = isset($_POST['admin_password']) ? trim( stripslashes( $_POST['admin_password'] ) ) : ''; + $admin_email = isset( $_POST['admin_email'] ) ? trim( stripslashes( $_POST['admin_email'] ) ) : ''; + + if ( ! is_null( $error ) ) { +?> +

    ERROR: %s' ), $error ); ?>

    + +
    + + + + + + + + + + + + + + + + + + + + + + +
    + +

    + +
    + +

    +
    + +

    +
    +

    +
    +

    +

    +
    +' . __( 'Already Installed' ) . '

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

    ' . __('Log In') . '

    ' ); +} + +$php_version = phpversion(); +$mysql_version = $wpdb->db_version(); +$php_compat = version_compare( $php_version, $required_php_version, '>=' ); +$mysql_compat = version_compare( $mysql_version, $required_mysql_version, '>=' ) || file_exists( WP_CONTENT_DIR . '/db.php' ); + +if ( !$mysql_compat && !$php_compat ) + $compat = sprintf( __('You cannot install because WordPress %1$s requires PHP version %2$s or higher and MySQL version %3$s or higher. You are running PHP version %4$s and MySQL version %5$s.'), $wp_version, $required_php_version, $required_mysql_version, $php_version, $mysql_version ); +elseif ( !$php_compat ) + $compat = sprintf( __('You cannot install because WordPress %1$s requires PHP version %2$s or higher. You are running version %3$s.'), $wp_version, $required_php_version, $php_version ); +elseif ( !$mysql_compat ) + $compat = sprintf( __('You cannot install because WordPress %1$s requires MySQL version %2$s or higher. You are running version %3$s.'), $wp_version, $required_mysql_version, $mysql_version ); + +if ( !$mysql_compat || !$php_compat ) { + display_header(); + die('

    ' . __('Insufficient Requirements') . '

    ' . $compat . '

    '); +} + +switch($step) { + case 0: // Step 1 + case 1: // Step 1, direct link. + display_header(); +?> +

    +

    ReadMe documentation at your leisure. Otherwise, just fill in the information below and you’ll be on your way to using the most extendable and powerful personal publishing platform in the world.' ), '../readme.html' ); ?>

    + +

    +

    + +error ) ) + wp_die( $wpdb->error->get_error_message() ); + + display_header(); + // Fill in the data we gathered + $weblog_title = isset( $_POST['weblog_title'] ) ? trim( stripslashes( $_POST['weblog_title'] ) ) : ''; + $user_name = isset($_POST['user_name']) ? trim( stripslashes( $_POST['user_name'] ) ) : 'admin'; + $admin_password = isset($_POST['admin_password']) ? $_POST['admin_password'] : ''; + $admin_password_check = isset($_POST['admin_password2']) ? $_POST['admin_password2'] : ''; + $admin_email = isset( $_POST['admin_email'] ) ?trim( stripslashes( $_POST['admin_email'] ) ) : ''; + $public = isset( $_POST['blog_public'] ) ? (int) $_POST['blog_public'] : 0; + // check e-mail address + $error = false; + if ( empty( $user_name ) ) { + // TODO: poka-yoke + display_setup_form( __('you must provide a valid username.') ); + $error = true; + } elseif ( $user_name != sanitize_user( $user_name, true ) ) { + display_setup_form( __('the username you provided has invalid characters.') ); + $error = true; + } elseif ( $admin_password != $admin_password_check ) { + // TODO: poka-yoke + display_setup_form( __( 'your passwords do not match. Please try again' ) ); + $error = true; + } else if ( empty( $admin_email ) ) { + // TODO: poka-yoke + display_setup_form( __( 'you must provide an e-mail address.' ) ); + $error = true; + } elseif ( ! is_email( $admin_email ) ) { + // TODO: poka-yoke + display_setup_form( __( 'that isn’t a valid e-mail address. E-mail addresses look like: username@example.com' ) ); + $error = true; + } + + if ( $error === false ) { + $wpdb->show_errors(); + $result = wp_install($weblog_title, $user_name, $admin_email, $public, '', $admin_password); + extract( $result, EXTR_SKIP ); +?> + +

    + +

    + + + + + + + + + + +
    '. esc_html($password) .'
    '; + echo "

    $password_message

    "; ?> +
    + +

    + + + + + + + + + + diff --git a/src/wp-admin/js/cat.dev.js b/src/wp-admin/js/cat.dev.js new file mode 100644 index 0000000..cbc2900 --- /dev/null +++ b/src/wp-admin/js/cat.dev.js @@ -0,0 +1,5 @@ +jQuery(document).ready( function($) { + var myConfirm = function() { return '' !== $('#newcat').val(); }; + $('#jaxcat').prepend('' + catL10n.how + ''); + $('#categorychecklist').wpList( { alt: '', response: 'cat-ajax-response', confirm: myConfirm } ); +} ); diff --git a/src/wp-admin/js/cat.js b/src/wp-admin/js/cat.js new file mode 100644 index 0000000..deee8c4 --- /dev/null +++ b/src/wp-admin/js/cat.js @@ -0,0 +1 @@ +jQuery(document).ready(function(b){var a=function(){return""!==b("#newcat").val()};b("#jaxcat").prepend(''+catL10n.how+'');b("#categorychecklist").wpList({alt:"",response:"cat-ajax-response",confirm:a})}); \ No newline at end of file diff --git a/src/wp-admin/js/categories.dev.js b/src/wp-admin/js/categories.dev.js new file mode 100644 index 0000000..cc58eb4 --- /dev/null +++ b/src/wp-admin/js/categories.dev.js @@ -0,0 +1,34 @@ +jQuery(document).ready(function($) { + var options = false, addAfter, delBefore, delAfter; + if ( document.forms['addcat'].category_parent ) + options = document.forms['addcat'].category_parent.options; + + addAfter = function( r, settings ) { + var name, id; + + name = $("" + $('name', r).text() + "").text(); + id = $('cat', r).attr('id'); + options[options.length] = new Option(name, id); + } + + delAfter = function( r, settings ) { + var id = $('cat', r).attr('id'), o; + for ( o = 0; o < options.length; o++ ) + if ( id == options[o].value ) + options[o] = null; + } + + delBefore = function(s) { + if ( 'undefined' != showNotice ) + return showNotice.warn() ? s : false; + + return s; + } + + if ( options ) + $('#the-list').wpList( { addAfter: addAfter, delBefore: delBefore, delAfter: delAfter } ); + else + $('#the-list').wpList({ delBefore: delBefore }); + + $('.delete a[class^="delete"]').live('click', function(){return false;}); +}); diff --git a/src/wp-admin/js/categories.js b/src/wp-admin/js/categories.js new file mode 100644 index 0000000..45c2358 --- /dev/null +++ b/src/wp-admin/js/categories.js @@ -0,0 +1 @@ +jQuery(document).ready(function(d){var b=false,e,c,a;if(document.forms.addcat.category_parent){b=document.forms.addcat.category_parent.options}e=function(h,g){var f,i;f=d(""+d("name",h).text()+"").text();i=d("cat",h).attr("id");b[b.length]=new Option(f,i)};a=function(g,f){var i=d("cat",g).attr("id"),h;for(h=0;h' + + $( '#mm option[value="' + mm + '"]' ).text() + ' ' + + jj + ', ' + + aa + ' @ ' + + hh + ':' + + mn + ' ' + ); + return false; + }); +}); diff --git a/src/wp-admin/js/comment.js b/src/wp-admin/js/comment.js new file mode 100644 index 0000000..5816ebb --- /dev/null +++ b/src/wp-admin/js/comment.js @@ -0,0 +1 @@ +jQuery(document).ready(function(b){var a=b("#timestamp").html();b(".edit-timestamp").click(function(){if(b("#timestampdiv").is(":hidden")){b("#timestampdiv").slideDown("normal");b(".edit-timestamp").hide()}return false});b(".cancel-timestamp").click(function(){b("#timestampdiv").slideUp("normal");b("#mm").val(b("#hidden_mm").val());b("#jj").val(b("#hidden_jj").val());b("#aa").val(b("#hidden_aa").val());b("#hh").val(b("#hidden_hh").val());b("#mn").val(b("#hidden_mn").val());b("#timestamp").html(a);b(".edit-timestamp").show();return false});b(".save-timestamp").click(function(){var g=b("#aa").val(),h=b("#mm").val(),d=b("#jj").val(),c=b("#hh").val(),f=b("#mn").val(),e=new Date(g,h-1,d,c,f);if(e.getFullYear()!=g||(1+e.getMonth())!=h||e.getDate()!=d||e.getMinutes()!=f){b(".timestamp-wrap","#timestampdiv").addClass("form-invalid");return false}else{b(".timestamp-wrap","#timestampdiv").removeClass("form-invalid")}b("#timestampdiv").slideUp("normal");b(".edit-timestamp").show();b("#timestamp").html(commentL10n.submittedOn+" "+b('#mm option[value="'+h+'"]').text()+" "+d+", "+g+" @ "+c+":"+f+" ");return false})}); \ No newline at end of file diff --git a/src/wp-admin/js/common.dev.js b/src/wp-admin/js/common.dev.js new file mode 100644 index 0000000..5ab98ed --- /dev/null +++ b/src/wp-admin/js/common.dev.js @@ -0,0 +1,370 @@ +var showNotice, adminMenu, columns, validateForm, screenMeta; +(function($){ +// sidebar admin menu +adminMenu = { + init : function() { + var menu = $('#adminmenu'); + + $('.wp-menu-toggle', menu).each( function() { + var t = $(this), sub = t.siblings('.wp-submenu'); + if ( sub.length ) + t.click(function(){ adminMenu.toggle( sub ); }); + else + t.hide(); + }); + + this.favorites(); + + $('#collapse-menu', menu).click(function(){ + if ( $('body').hasClass('folded') ) { + adminMenu.fold(1); + deleteUserSetting( 'mfold' ); + } else { + adminMenu.fold(); + setUserSetting( 'mfold', 'f' ); + } + return false; + }); + + if ( $('body').hasClass('folded') ) + this.fold(); + }, + + restoreMenuState : function() { + // (perhaps) needed for back-compat + }, + + toggle : function(el) { + el.slideToggle(150, function() { + var id = el.css('display','').parent().toggleClass( 'wp-menu-open' ).attr('id'); + if ( id ) { + $('li.wp-has-submenu', '#adminmenu').each(function(i, e) { + if ( id == e.id ) { + var v = $(e).hasClass('wp-menu-open') ? 'o' : 'c'; + setUserSetting( 'm'+i, v ); + } + }); + } + }); + + return false; + }, + + fold : function(off) { + if (off) { + $('body').removeClass('folded'); + $('#adminmenu li.wp-has-submenu').unbind(); + } else { + $('body').addClass('folded'); + $('#adminmenu li.wp-has-submenu').hoverIntent({ + over: function(e){ + var m, b, h, o, f; + m = $(this).find('.wp-submenu'); + b = $(this).offset().top + m.height() + 1; // Bottom offset of the menu + h = $('#wpwrap').height(); // Height of the entire page + o = 60 + b - h; + f = $(window).height() + $(window).scrollTop() - 15; // The fold + if ( f < (b - o) ) { + o = b - f; + } + if ( o > 1 ) { + m.css({'marginTop':'-'+o+'px'}); + } else if ( m.css('marginTop') ) { + m.css({'marginTop':''}); + } + m.addClass('sub-open'); + }, + out: function(){ + $(this).find('.wp-submenu').removeClass('sub-open'); + }, + timeout: 220, + sensitivity: 8, + interval: 100 + }); + + } + }, + + favorites : function() { + $('#favorite-inside').width( $('#favorite-actions').width() - 4 ); + $('#favorite-toggle, #favorite-inside').bind('mouseenter', function() { + $('#favorite-inside').removeClass('slideUp').addClass('slideDown'); + setTimeout(function() { + if ( $('#favorite-inside').hasClass('slideDown') ) { + $('#favorite-inside').slideDown(100); + $('#favorite-first').addClass('slide-down'); + } + }, 200); + }).bind('mouseleave', function() { + $('#favorite-inside').removeClass('slideDown').addClass('slideUp'); + setTimeout(function() { + if ( $('#favorite-inside').hasClass('slideUp') ) { + $('#favorite-inside').slideUp(100, function() { + $('#favorite-first').removeClass('slide-down'); + }); + } + }, 300); + }); + } +}; + +$(document).ready(function(){ adminMenu.init(); }); + +// show/hide/save table columns +columns = { + init : function() { + var that = this; + $('.hide-column-tog', '#adv-settings').click( function() { + var $t = $(this), column = $t.val(); + if ( $t.prop('checked') ) + that.checked(column); + else + that.unchecked(column); + + columns.saveManageColumnsState(); + }); + }, + + saveManageColumnsState : function() { + var hidden = this.hidden(); + $.post(ajaxurl, { + action: 'hidden-columns', + hidden: hidden, + screenoptionnonce: $('#screenoptionnonce').val(), + page: pagenow + }); + }, + + checked : function(column) { + $('.column-' + column).show(); + this.colSpanChange(+1); + }, + + unchecked : function(column) { + $('.column-' + column).hide(); + this.colSpanChange(-1); + }, + + hidden : function() { + return $('.manage-column').filter(':hidden').map(function() { return this.id; }).get().join(','); + }, + + useCheckboxesForHidden : function() { + this.hidden = function(){ + return $('.hide-column-tog').not(':checked').map(function() { + var id = this.id; + return id.substring( id, id.length - 5 ); + }).get().join(','); + }; + }, + + colSpanChange : function(diff) { + var $t = $('table').find('.colspanchange'), n; + if ( !$t.length ) + return; + n = parseInt( $t.attr('colspan'), 10 ) + diff; + $t.attr('colspan', n.toString()); + } +} + +$(document).ready(function(){columns.init();}); + +validateForm = function( form ) { + return !$( form ).find('.form-required').filter( function() { return $('input:visible', this).val() == ''; } ).addClass( 'form-invalid' ).find('input:visible').change( function() { $(this).closest('.form-invalid').removeClass( 'form-invalid' ); } ).size(); +} + +// stub for doing better warnings +showNotice = { + warn : function() { + var msg = commonL10n.warnDelete || ''; + if ( confirm(msg) ) { + return true; + } + + return false; + }, + + note : function(text) { + alert(text); + } +}; + +screenMeta = { + links: { + 'screen-options-link-wrap': 'screen-options-wrap', + 'contextual-help-link-wrap': 'contextual-help-wrap' + }, + init: function() { + $('.screen-meta-toggle').click( screenMeta.toggleEvent ); + }, + toggleEvent: function( e ) { + var panel; + e.preventDefault(); + + // Check to see if we found a panel. + if ( ! screenMeta.links[ this.id ] ) + return; + + panel = $('#' + screenMeta.links[ this.id ]); + + if ( panel.is(':visible') ) + screenMeta.close( panel, $(this) ); + else + screenMeta.open( panel, $(this) ); + }, + open: function( panel, link ) { + $('.screen-meta-toggle').not( link ).css('visibility', 'hidden'); + + panel.slideDown( 'fast', function() { + link.addClass('screen-meta-active'); + }); + }, + close: function( panel, link ) { + panel.slideUp( 'fast', function() { + link.removeClass('screen-meta-active'); + $('.screen-meta-toggle').css('visibility', ''); + }); + } +}; + +$(document).ready( function() { + var lastClicked = false, checks, first, last, checked, dropdown, + pageInput = $('input[name="paged"]'), currentPage; + + // Move .updated and .error alert boxes. Don't move boxes designed to be inline. + $('div.wrap h2:first').nextAll('div.updated, div.error').addClass('below-h2'); + $('div.updated, div.error').not('.below-h2, .inline').insertAfter( $('div.wrap h2:first') ); + + // Init screen meta + screenMeta.init(); + + // User info dropdown. + dropdown = { + doc: $(document), + element: $('#user_info'), + open: function() { + if ( ! dropdown.element.hasClass('active') ) { + dropdown.element.addClass('active'); + dropdown.doc.one( 'click', dropdown.close ); + return false; + } + }, + close: function() { + dropdown.element.removeClass('active'); + } + }; + + dropdown.element.click( dropdown.open ); + + // check all checkboxes + $('tbody').children().children('.check-column').find(':checkbox').click( function(e) { + if ( 'undefined' == e.shiftKey ) { return true; } + if ( e.shiftKey ) { + if ( !lastClicked ) { return true; } + checks = $( lastClicked ).closest( 'form' ).find( ':checkbox' ); + first = checks.index( lastClicked ); + last = checks.index( this ); + checked = $(this).prop('checked'); + if ( 0 < first && 0 < last && first != last ) { + checks.slice( first, last ).prop( 'checked', function(){ + if ( $(this).closest('tr').is(':visible') ) + return checked; + + return false; + }); + } + } + lastClicked = this; + return true; + }); + + $('thead, tfoot').find('.check-column :checkbox').click( function(e) { + var c = $(this).prop('checked'), + kbtoggle = 'undefined' == typeof toggleWithKeyboard ? false : toggleWithKeyboard, + toggle = e.shiftKey || kbtoggle; + + $(this).closest( 'table' ).children( 'tbody' ).filter(':visible') + .children().children('.check-column').find(':checkbox') + .prop('checked', function() { + if ( $(this).closest('tr').is(':hidden') ) + return false; + if ( toggle ) + return $(this).prop( 'checked' ); + else if (c) + return true; + return false; + }); + + $(this).closest('table').children('thead, tfoot').filter(':visible') + .children().children('.check-column').find(':checkbox') + .prop('checked', function() { + if ( toggle ) + return false; + else if (c) + return true; + return false; + }); + }); + + $('#default-password-nag-no').click( function() { + setUserSetting('default_password_nag', 'hide'); + $('div.default-password-nag').hide(); + return false; + }); + + // tab in textareas + $('#newcontent').bind('keydown.wpevent_InsertTab', function(e) { + if ( e.keyCode != 9 ) + return true; + + var el = e.target, selStart = el.selectionStart, selEnd = el.selectionEnd, val = el.value, scroll, sel; + + try { + this.lastKey = 9; // not a standard DOM property, lastKey is to help stop Opera tab event. See blur handler below. + } catch(err) {} + + if ( document.selection ) { + el.focus(); + sel = document.selection.createRange(); + sel.text = '\t'; + } else if ( selStart >= 0 ) { + scroll = this.scrollTop; + el.value = val.substring(0, selStart).concat('\t', val.substring(selEnd) ); + el.selectionStart = el.selectionEnd = selStart + 1; + this.scrollTop = scroll; + } + + if ( e.stopPropagation ) + e.stopPropagation(); + if ( e.preventDefault ) + e.preventDefault(); + }); + + $('#newcontent').bind('blur.wpevent_InsertTab', function(e) { + if ( this.lastKey && 9 == this.lastKey ) + this.focus(); + }); + + if ( pageInput.length ) { + currentPage = pageInput.val(); + pageInput.closest('form').submit( function(){ + // Reset paging var for new filters/searches. See #17685. + if ( pageInput.val() == currentPage ) + pageInput.val('1'); + }); + } + +}); + +// internal use +$(document).bind( 'wp_CloseOnEscape', function( e, data ) { + if ( typeof(data.cb) != 'function' ) + return; + + if ( typeof(data.condition) != 'function' || data.condition() ) + data.cb(); + + return true; +}); + +})(jQuery); diff --git a/src/wp-admin/js/common.js b/src/wp-admin/js/common.js new file mode 100644 index 0000000..944dbdb --- /dev/null +++ b/src/wp-admin/js/common.js @@ -0,0 +1 @@ +var showNotice,adminMenu,columns,validateForm,screenMeta;(function(a){adminMenu={init:function(){var b=a("#adminmenu");a(".wp-menu-toggle",b).each(function(){var c=a(this),d=c.siblings(".wp-submenu");if(d.length){c.click(function(){adminMenu.toggle(d)})}else{c.hide()}});this.favorites();a("#collapse-menu",b).click(function(){if(a("body").hasClass("folded")){adminMenu.fold(1);deleteUserSetting("mfold")}else{adminMenu.fold();setUserSetting("mfold","f")}return false});if(a("body").hasClass("folded")){this.fold()}},restoreMenuState:function(){},toggle:function(b){b.slideToggle(150,function(){var c=b.css("display","").parent().toggleClass("wp-menu-open").attr("id");if(c){a("li.wp-has-submenu","#adminmenu").each(function(f,g){if(c==g.id){var d=a(g).hasClass("wp-menu-open")?"o":"c";setUserSetting("m"+f,d)}})}});return false},fold:function(b){if(b){a("body").removeClass("folded");a("#adminmenu li.wp-has-submenu").unbind()}else{a("body").addClass("folded");a("#adminmenu li.wp-has-submenu").hoverIntent({over:function(j){var d,c,g,k,i;d=a(this).find(".wp-submenu");c=a(this).offset().top+d.height()+1;g=a("#wpwrap").height();k=60+c-g;i=a(window).height()+a(window).scrollTop()-15;if(i<(c-k)){k=c-i}if(k>1){d.css({marginTop:"-"+k+"px"})}else{if(d.css("marginTop")){d.css({marginTop:""})}}d.addClass("sub-open")},out:function(){a(this).find(".wp-submenu").removeClass("sub-open")},timeout:220,sensitivity:8,interval:100})}},favorites:function(){a("#favorite-inside").width(a("#favorite-actions").width()-4);a("#favorite-toggle, #favorite-inside").bind("mouseenter",function(){a("#favorite-inside").removeClass("slideUp").addClass("slideDown");setTimeout(function(){if(a("#favorite-inside").hasClass("slideDown")){a("#favorite-inside").slideDown(100);a("#favorite-first").addClass("slide-down")}},200)}).bind("mouseleave",function(){a("#favorite-inside").removeClass("slideDown").addClass("slideUp");setTimeout(function(){if(a("#favorite-inside").hasClass("slideUp")){a("#favorite-inside").slideUp(100,function(){a("#favorite-first").removeClass("slide-down")})}},300)})}};a(document).ready(function(){adminMenu.init()});columns={init:function(){var b=this;a(".hide-column-tog","#adv-settings").click(function(){var d=a(this),c=d.val();if(d.prop("checked")){b.checked(c)}else{b.unchecked(c)}columns.saveManageColumnsState()})},saveManageColumnsState:function(){var b=this.hidden();a.post(ajaxurl,{action:"hidden-columns",hidden:b,screenoptionnonce:a("#screenoptionnonce").val(),page:pagenow})},checked:function(b){a(".column-"+b).show();this.colSpanChange(+1)},unchecked:function(b){a(".column-"+b).hide();this.colSpanChange(-1)},hidden:function(){return a(".manage-column").filter(":hidden").map(function(){return this.id}).get().join(",")},useCheckboxesForHidden:function(){this.hidden=function(){return a(".hide-column-tog").not(":checked").map(function(){var b=this.id;return b.substring(b,b.length-5)}).get().join(",")}},colSpanChange:function(b){var d=a("table").find(".colspanchange"),c;if(!d.length){return}c=parseInt(d.attr("colspan"),10)+b;d.attr("colspan",c.toString())}};a(document).ready(function(){columns.init()});validateForm=function(b){return !a(b).find(".form-required").filter(function(){return a("input:visible",this).val()==""}).addClass("form-invalid").find("input:visible").change(function(){a(this).closest(".form-invalid").removeClass("form-invalid")}).size()};showNotice={warn:function(){var b=commonL10n.warnDelete||"";if(confirm(b)){return true}return false},note:function(b){alert(b)}};screenMeta={links:{"screen-options-link-wrap":"screen-options-wrap","contextual-help-link-wrap":"contextual-help-wrap"},init:function(){a(".screen-meta-toggle").click(screenMeta.toggleEvent)},toggleEvent:function(c){var b;c.preventDefault();if(!screenMeta.links[this.id]){return}b=a("#"+screenMeta.links[this.id]);if(b.is(":visible")){screenMeta.close(b,a(this))}else{screenMeta.open(b,a(this))}},open:function(b,c){a(".screen-meta-toggle").not(c).css("visibility","hidden");b.slideDown("fast",function(){c.addClass("screen-meta-active")})},close:function(b,c){b.slideUp("fast",function(){c.removeClass("screen-meta-active");a(".screen-meta-toggle").css("visibility","")})}};a(document).ready(function(){var i=false,b,f,e,d,h,g=a('input[name="paged"]'),c;a("div.wrap h2:first").nextAll("div.updated, div.error").addClass("below-h2");a("div.updated, div.error").not(".below-h2, .inline").insertAfter(a("div.wrap h2:first"));screenMeta.init();h={doc:a(document),element:a("#user_info"),open:function(){if(!h.element.hasClass("active")){h.element.addClass("active");h.doc.one("click",h.close);return false}},close:function(){h.element.removeClass("active")}};h.element.click(h.open);a("tbody").children().children(".check-column").find(":checkbox").click(function(j){if("undefined"==j.shiftKey){return true}if(j.shiftKey){if(!i){return true}b=a(i).closest("form").find(":checkbox");f=b.index(i);e=b.index(this);d=a(this).prop("checked");if(0=0){j=this.scrollTop;l.value=p.substring(0,q).concat("\t",p.substring(k));l.selectionStart=l.selectionEnd=q+1;this.scrollTop=j}}if(o.stopPropagation){o.stopPropagation()}if(o.preventDefault){o.preventDefault()}});a("#newcontent").bind("blur.wpevent_InsertTab",function(j){if(this.lastKey&&9==this.lastKey){this.focus()}});if(g.length){c=g.val();g.closest("form").submit(function(){if(g.val()==c){g.val("1")}})}});a(document).bind("wp_CloseOnEscape",function(c,b){if(typeof(b.cb)!="function"){return}if(typeof(b.condition)!="function"||b.condition()){b.cb()}return true})})(jQuery); \ No newline at end of file diff --git a/src/wp-admin/js/custom-background.dev.js b/src/wp-admin/js/custom-background.dev.js new file mode 100644 index 0000000..b4dbc66 --- /dev/null +++ b/src/wp-admin/js/custom-background.dev.js @@ -0,0 +1,55 @@ +var farbtastic; + +function pickColor(color) { + farbtastic.setColor(color); + jQuery('#background-color').val(color); + jQuery('#custom-background-image').css('background-color', color); + if ( color && color !== '#' ) + jQuery('#clearcolor').show(); + else + jQuery('#clearcolor').hide(); +} + +jQuery(document).ready(function() { + jQuery('#pickcolor').click(function() { + jQuery('#colorPickerDiv').show(); + return false; + }); + + jQuery('#clearcolor a').click( function(e) { + pickColor(''); + e.preventDefault(); + }); + + jQuery('#background-color').keyup(function() { + var _hex = jQuery('#background-color').val(), hex = _hex; + if ( hex.charAt(0) != '#' ) + hex = '#' + hex; + hex = hex.replace(/[^#a-fA-F0-9]+/, ''); + if ( hex != _hex ) + jQuery('#background-color').val(hex); + if ( hex.length == 4 || hex.length == 7 ) + pickColor( hex ); + }); + + jQuery('input[name="background-position-x"]').change(function() { + jQuery('#custom-background-image').css('background-position', jQuery(this).val() + ' top'); + }); + + jQuery('input[name="background-repeat"]').change(function() { + jQuery('#custom-background-image').css('background-repeat', jQuery(this).val()); + }); + + farbtastic = jQuery.farbtastic('#colorPickerDiv', function(color) { + pickColor(color); + }); + pickColor(jQuery('#background-color').val()); + + jQuery(document).mousedown(function(){ + jQuery('#colorPickerDiv').each(function(){ + var display = jQuery(this).css('display'); + if ( display == 'block' ) + jQuery(this).fadeOut(2); + }); + }); +}); diff --git a/src/wp-admin/js/custom-background.js b/src/wp-admin/js/custom-background.js new file mode 100644 index 0000000..6cf8851 --- /dev/null +++ b/src/wp-admin/js/custom-background.js @@ -0,0 +1 @@ +var farbtastic;function pickColor(a){farbtastic.setColor(a);jQuery("#background-color").val(a);jQuery("#custom-background-image").css("background-color",a);if(a&&a!=="#"){jQuery("#clearcolor").show()}else{jQuery("#clearcolor").hide()}}jQuery(document).ready(function(){jQuery("#pickcolor").click(function(){jQuery("#colorPickerDiv").show();return false});jQuery("#clearcolor a").click(function(a){pickColor("");a.preventDefault()});jQuery("#background-color").keyup(function(){var b=jQuery("#background-color").val(),a=b;if(a.charAt(0)!="#"){a="#"+a}a=a.replace(/[^#a-fA-F0-9]+/,"");if(a!=b){jQuery("#background-color").val(a)}if(a.length==4||a.length==7){pickColor(a)}});jQuery('input[name="background-position-x"]').change(function(){jQuery("#custom-background-image").css("background-position",jQuery(this).val()+" top")});jQuery('input[name="background-repeat"]').change(function(){jQuery("#custom-background-image").css("background-repeat",jQuery(this).val())});farbtastic=jQuery.farbtastic("#colorPickerDiv",function(a){pickColor(a)});pickColor(jQuery("#background-color").val());jQuery(document).mousedown(function(){jQuery("#colorPickerDiv").each(function(){var a=jQuery(this).css("display");if(a=="block"){jQuery(this).fadeOut(2)}})})}); \ No newline at end of file diff --git a/src/wp-admin/js/custom-fields.dev.js b/src/wp-admin/js/custom-fields.dev.js new file mode 100644 index 0000000..9eab214 --- /dev/null +++ b/src/wp-admin/js/custom-fields.dev.js @@ -0,0 +1,34 @@ +jQuery(document).ready( function($) { + var before, addBefore, addAfter, delBefore; + + before = function() { + var nonce = $('#newmeta [name="_ajax_nonce"]').val(), postId = $('#post_ID').val(); + if ( !nonce || !postId ) { return false; } + return [nonce,postId]; + } + + addBefore = function( s ) { + var b = before(); + if ( !b ) { return false; } + s.data = s.data.replace(/_ajax_nonce=[a-f0-9]+/, '_ajax_nonce=' + b[0]) + '&post_id=' + b[1]; + return s; + }; + + addAfter = function( r, s ) { + var postId = $('postid', r).text(), h; + if ( !postId ) { return; } + $('#post_ID').attr( 'name', 'post_ID' ).val( postId ); + h = $('#hiddenaction'); + if ( 'post' == h.val() ) { h.val( 'postajaxpost' ); } + }; + + delBefore = function( s ) { + var b = before(); if ( !b ) return false; + s.data._ajax_nonce = b[0]; s.data.post_id = b[1]; + return s; + } + + $('#the-list') + .wpList( { addBefore: addBefore, addAfter: addAfter, delBefore: delBefore } ) + .find('.updatemeta, .deletemeta').attr( 'type', 'button' ); +} ); diff --git a/src/wp-admin/js/custom-fields.js b/src/wp-admin/js/custom-fields.js new file mode 100644 index 0000000..dbe2f48 --- /dev/null +++ b/src/wp-admin/js/custom-fields.js @@ -0,0 +1 @@ +jQuery(document).ready(function(d){var c,b,e,a;c=function(){var g=d('#newmeta [name="_ajax_nonce"]').val(),f=d("#post_ID").val();if(!g||!f){return false}return[g,f]};b=function(g){var f=c();if(!f){return false}g.data=g.data.replace(/_ajax_nonce=[a-f0-9]+/,"_ajax_nonce="+f[0])+"&post_id="+f[1];return g};e=function(j,i){var f=d("postid",j).text(),g;if(!f){return}d("#post_ID").attr("name","post_ID").val(f);g=d("#hiddenaction");if("post"==g.val()){g.val("postajaxpost")}};a=function(g){var f=c();if(!f){return false}g.data._ajax_nonce=f[0];g.data.post_id=f[1];return g};d("#the-list").wpList({addBefore:b,addAfter:e,delBefore:a}).find(".updatemeta, .deletemeta").attr("type","button")}); \ No newline at end of file diff --git a/src/wp-admin/js/dashboard.dev.js b/src/wp-admin/js/dashboard.dev.js new file mode 100644 index 0000000..127a7bd --- /dev/null +++ b/src/wp-admin/js/dashboard.dev.js @@ -0,0 +1,67 @@ +var ajaxWidgets, ajaxPopulateWidgets, quickPressLoad; + +jQuery(document).ready( function($) { + // These widgets are sometimes populated via ajax + ajaxWidgets = [ + 'dashboard_incoming_links', + 'dashboard_primary', + 'dashboard_secondary', + 'dashboard_plugins' + ]; + + ajaxPopulateWidgets = function(el) { + function show(i, id) { + var p, e = $('#' + id + ' div.inside:visible').find('.widget-loading'); + if ( e.length ) { + p = e.parent(); + setTimeout( function(){ + p.load( ajaxurl.replace( '/admin-ajax.php', '' ) + '/index-extra.php?jax=' + id, '', function() { + p.hide().slideDown('normal', function(){ + $(this).css('display', ''); + }); + }); + }, i * 500 ); + } + } + + if ( el ) { + el = el.toString(); + if ( $.inArray(el, ajaxWidgets) != -1 ) + show(0, el); + } else { + $.each( ajaxWidgets, show ); + } + }; + ajaxPopulateWidgets(); + + postboxes.add_postbox_toggles(pagenow, { pbshow: ajaxPopulateWidgets } ); + + /* QuickPress */ + quickPressLoad = function() { + var act = $('#quickpost-action'), t; + t = $('#quick-press').submit( function() { + $('#dashboard_quick_press #publishing-action img.waiting').css('visibility', 'visible'); + $('#quick-press .submit input[type="submit"], #quick-press .submit input[type="reset"]').prop('disabled', true); + + if ( 'post' == act.val() ) { + act.val( 'post-quickpress-publish' ); + } + + $('#dashboard_quick_press div.inside').load( t.attr( 'action' ), t.serializeArray(), function() { + $('#dashboard_quick_press #publishing-action img.waiting').css('visibility', 'hidden'); + $('#quick-press .submit input[type="submit"], #quick-press .submit input[type="reset"]').prop('disabled', false); + $('#dashboard_quick_press ul').next('p').remove(); + $('#dashboard_quick_press ul').find('li').each( function() { + $('#dashboard_recent_drafts ul').prepend( this ); + } ).end().remove(); + quickPressLoad(); + } ); + return false; + } ); + + $('#publish').click( function() { act.val( 'post-quickpress-publish' ); } ); + + }; + quickPressLoad(); + +} ); diff --git a/src/wp-admin/js/dashboard.js b/src/wp-admin/js/dashboard.js new file mode 100644 index 0000000..bd836d1 --- /dev/null +++ b/src/wp-admin/js/dashboard.js @@ -0,0 +1 @@ +var ajaxWidgets,ajaxPopulateWidgets,quickPressLoad;jQuery(document).ready(function(a){ajaxWidgets=["dashboard_incoming_links","dashboard_primary","dashboard_secondary","dashboard_plugins"];ajaxPopulateWidgets=function(c){function b(d,h){var g,f=a("#"+h+" div.inside:visible").find(".widget-loading");if(f.length){g=f.parent();setTimeout(function(){g.load(ajaxurl.replace("/admin-ajax.php","")+"/index-extra.php?jax="+h,"",function(){g.hide().slideDown("normal",function(){a(this).css("display","")})})},d*500)}}if(c){c=c.toString();if(a.inArray(c,ajaxWidgets)!=-1){b(0,c)}}else{a.each(ajaxWidgets,b)}};ajaxPopulateWidgets();postboxes.add_postbox_toggles(pagenow,{pbshow:ajaxPopulateWidgets});quickPressLoad=function(){var b=a("#quickpost-action"),c;c=a("#quick-press").submit(function(){a("#dashboard_quick_press #publishing-action img.waiting").css("visibility","visible");a('#quick-press .submit input[type="submit"], #quick-press .submit input[type="reset"]').prop("disabled",true);if("post"==b.val()){b.val("post-quickpress-publish")}a("#dashboard_quick_press div.inside").load(c.attr("action"),c.serializeArray(),function(){a("#dashboard_quick_press #publishing-action img.waiting").css("visibility","hidden");a('#quick-press .submit input[type="submit"], #quick-press .submit input[type="reset"]').prop("disabled",false);a("#dashboard_quick_press ul").next("p").remove();a("#dashboard_quick_press ul").find("li").each(function(){a("#dashboard_recent_drafts ul").prepend(this)}).end().remove();quickPressLoad()});return false});a("#publish").click(function(){b.val("post-quickpress-publish")})};quickPressLoad()}); \ No newline at end of file diff --git a/src/wp-admin/js/edit-comments.dev.js b/src/wp-admin/js/edit-comments.dev.js new file mode 100644 index 0000000..7cffd56 --- /dev/null +++ b/src/wp-admin/js/edit-comments.dev.js @@ -0,0 +1,596 @@ +var theList, theExtraList, toggleWithKeyboard = false, getCount, updateCount, updatePending, dashboardTotals; +(function($) { + +setCommentsList = function() { + var totalInput, perPageInput, pageInput, lastConfidentTime = 0, dimAfter, delBefore, updateTotalCount, delAfter, refillTheExtraList; + + totalInput = $('input[name="_total"]', '#comments-form'); + perPageInput = $('input[name="_per_page"]', '#comments-form'); + pageInput = $('input[name="_page"]', '#comments-form'); + + dimAfter = function( r, settings ) { + var c = $('#' + settings.element), editRow, replyID, replyButton; + + editRow = $('#replyrow'); + replyID = $('#comment_ID', editRow).val(); + replyButton = $('#replybtn', editRow); + + if ( c.is('.unapproved') ) { + if ( settings.data.id == replyID ) + replyButton.text(adminCommentsL10n.replyApprove); + + c.find('div.comment_status').html('0'); + } else { + if ( settings.data.id == replyID ) + replyButton.text(adminCommentsL10n.reply); + + c.find('div.comment_status').html('1'); + } + + $('span.pending-count').each( function() { + var a = $(this), n, dif; + n = a.html().replace(/[^0-9]+/g, ''); + n = parseInt(n,10); + if ( isNaN(n) ) return; + dif = $('#' + settings.element).is('.' + settings.dimClass) ? 1 : -1; + n = n + dif; + if ( n < 0 ) { n = 0; } + a.closest('.awaiting-mod')[ 0 == n ? 'addClass' : 'removeClass' ]('count-0'); + updateCount(a, n); + dashboardTotals(); + }); + }; + + // Send current total, page, per_page and url + delBefore = function( settings, list ) { + var cl = $(settings.target).attr('class'), id, el, n, h, a, author, action = false; + + settings.data._total = totalInput.val() || 0; + settings.data._per_page = perPageInput.val() || 0; + settings.data._page = pageInput.val() || 0; + settings.data._url = document.location.href; + settings.data.comment_status = $('input[name="comment_status"]', '#comments-form').val(); + + if ( cl.indexOf(':trash=1') != -1 ) + action = 'trash'; + else if ( cl.indexOf(':spam=1') != -1 ) + action = 'spam'; + + if ( action ) { + id = cl.replace(/.*?comment-([0-9]+).*/, '$1'); + el = $('#comment-' + id); + note = $('#' + action + '-undo-holder').html(); + + el.find('.check-column :checkbox').prop('checked', false); // Uncheck the row so as not to be affected by Bulk Edits. + + if ( el.siblings('#replyrow').length && commentReply.cid == id ) + commentReply.close(); + + if ( el.is('tr') ) { + n = el.children(':visible').length; + author = $('.author strong', el).text(); + h = $('' + note + ''); + } else { + author = $('.comment-author', el).text(); + h = $(''); + } + + el.before(h); + + $('strong', '#undo-' + id).text(author + ' '); + a = $('.undo a', '#undo-' + id); + a.attr('href', 'comment.php?action=un' + action + 'comment&c=' + id + '&_wpnonce=' + settings.data._ajax_nonce); + a.attr('class', 'delete:the-comment-list:comment-' + id + '::un' + action + '=1 vim-z vim-destructive'); + $('.avatar', el).clone().prependTo('#undo-' + id + ' .' + action + '-undo-inside'); + + a.click(function(){ + list.wpList.del(this); + $('#undo-' + id).css( {backgroundColor:'#ceb'} ).fadeOut(350, function(){ + $(this).remove(); + $('#comment-' + id).css('backgroundColor', '').fadeIn(300, function(){ $(this).show() }); + }); + return false; + }); + } + + return settings; + }; + + // Updates the current total (as displayed visibly) + updateTotalCount = function( total, time, setConfidentTime ) { + if ( time < lastConfidentTime ) + return; + + if ( setConfidentTime ) + lastConfidentTime = time; + + totalInput.val( total.toString() ); + $('span.total-type-count').each( function() { + updateCount( $(this), total ); + }); + }; + + dashboardTotals = function(n) { + var dash = $('#dashboard_right_now'), total, appr, totalN, apprN; + + n = n || 0; + if ( isNaN(n) || !dash.length ) + return; + + total = $('span.total-count', dash); + appr = $('span.approved-count', dash); + totalN = getCount(total); + + totalN = totalN + n; + apprN = totalN - getCount( $('span.pending-count', dash) ) - getCount( $('span.spam-count', dash) ); + updateCount(total, totalN); + updateCount(appr, apprN); + + }; + + getCount = function(el) { + var n = parseInt( el.html().replace(/[^0-9]+/g, ''), 10 ); + if ( isNaN(n) ) + return 0; + return n; + }; + + updateCount = function(el, n) { + var n1 = ''; + if ( isNaN(n) ) + return; + n = n < 1 ? '0' : n.toString(); + if ( n.length > 3 ) { + while ( n.length > 3 ) { + n1 = thousandsSeparator + n.substr(n.length - 3) + n1; + n = n.substr(0, n.length - 3); + } + n = n + n1; + } + el.html(n); + }; + + updatePending = function(n) { + $('span.pending-count').each( function() { + var a = $(this); + + if ( n < 0 ) + n = 0; + + a.closest('.awaiting-mod')[ 0 == n ? 'addClass' : 'removeClass' ]('count-0'); + updateCount(a, n); + dashboardTotals(); + }); + }; + + // In admin-ajax.php, we send back the unix time stamp instead of 1 on success + delAfter = function( r, settings ) { + var total, N, untrash = $(settings.target).parent().is('span.untrash'), + unspam = $(settings.target).parent().is('span.unspam'), spam, trash, pending, + unapproved = $('#' + settings.element).is('.unapproved'); + + function getUpdate(s) { + if ( $(settings.target).parent().is('span.' + s) ) + return 1; + else if ( $('#' + settings.element).is('.' + s) ) + return -1; + + return 0; + } + + spam = getUpdate('spam'); + trash = getUpdate('trash'); + + if ( untrash ) + trash = -1; + if ( unspam ) + spam = -1; + + pending = getCount( $('span.pending-count').eq(0) ); + + if ( $(settings.target).parent().is('span.unapprove') || ( ( untrash || unspam ) && unapproved ) ) { // we "deleted" an approved comment from the approved list by clicking "Unapprove" + pending = pending + 1; + } else if ( unapproved ) { // we deleted a formerly unapproved comment + pending = pending - 1; + } + + updatePending(pending); + + $('span.spam-count').each( function() { + var a = $(this), n = getCount(a) + spam; + updateCount(a, n); + }); + + $('span.trash-count').each( function() { + var a = $(this), n = getCount(a) + trash; + updateCount(a, n); + }); + + if ( $('#dashboard_right_now').length ) { + N = trash ? -1 * trash : 0; + dashboardTotals(N); + } else { + total = totalInput.val() ? parseInt( totalInput.val(), 10 ) : 0; + total = total - spam - trash; + if ( total < 0 ) + total = 0; + + if ( ( 'object' == typeof r ) && lastConfidentTime < settings.parsed.responses[0].supplemental.time ) { + total_items_i18n = settings.parsed.responses[0].supplemental.total_items_i18n || ''; + if ( total_items_i18n ) { + $('.displaying-num').text( total_items_i18n ); + $('.total-pages').text( settings.parsed.responses[0].supplemental.total_pages_i18n ); + $('.tablenav-pages').find('.next-page, .last-page').toggleClass('disabled', settings.parsed.responses[0].supplemental.total_pages == $('.current-page').val()); + } + updateTotalCount( total, settings.parsed.responses[0].supplemental.time, true ); + } else { + updateTotalCount( total, r, false ); + } + } + + + if ( ! theExtraList || theExtraList.size() == 0 || theExtraList.children().size() == 0 || untrash || unspam ) { + return; + } + + theList.get(0).wpList.add( theExtraList.children(':eq(0)').remove().clone() ); + + refillTheExtraList(); + }; + + refillTheExtraList = function(ev) { + var args = $.query.get(), total_pages = $('.total-pages').text(), per_page = $('input[name="_per_page"]', '#comments-form').val(); + + if (! args.paged) + args.paged = 1; + + if (args.paged > total_pages) { + return; + } + + if (ev) { + theExtraList.empty(); + args.number = Math.min(8, per_page); // see WP_Comments_List_Table::prepare_items() @ class-wp-comments-list-table.php + } else { + args.number = 1; + args.offset = Math.min(8, per_page) - 1; // fetch only the next item on the extra list + } + + args.no_placeholder = true; + + args.paged ++; + + // $.query.get() needs some correction to be sent into an ajax request + if ( true === args.comment_type ) + args.comment_type = ''; + + args = $.extend(args, { + 'action': 'fetch-list', + 'list_args': list_args, + '_ajax_fetch_list_nonce': $('#_ajax_fetch_list_nonce').val() + }); + + $.ajax({ + url: ajaxurl, + global: false, + dataType: 'json', + data: args, + success: function(response) { + theExtraList.get(0).wpList.add( response.rows ); + } + }); + }; + + theExtraList = $('#the-extra-comment-list').wpList( { alt: '', delColor: 'none', addColor: 'none' } ); + theList = $('#the-comment-list').wpList( { alt: '', delBefore: delBefore, dimAfter: dimAfter, delAfter: delAfter, addColor: 'none' } ) + .bind('wpListDelEnd', function(e, s){ + var id = s.element.replace(/[^0-9]+/g, ''); + + if ( s.target.className.indexOf(':trash=1') != -1 || s.target.className.indexOf(':spam=1') != -1 ) + $('#undo-' + id).fadeIn(300, function(){ $(this).show() }); + }); +}; + +commentReply = { + cid : '', + act : '', + + init : function() { + var row = $('#replyrow'); + + $('a.cancel', row).click(function() { return commentReply.revert(); }); + $('a.save', row).click(function() { return commentReply.send(); }); + $('input#author, input#author-email, input#author-url', row).keypress(function(e){ + if ( e.which == 13 ) { + commentReply.send(); + e.preventDefault(); + return false; + } + }); + + // add events + $('#the-comment-list .column-comment > p').dblclick(function(){ + commentReply.toggle($(this).parent()); + }); + + $('#doaction, #doaction2, #post-query-submit').click(function(e){ + if ( $('#the-comment-list #replyrow').length > 0 ) + commentReply.close(); + }); + + this.comments_listing = $('#comments-form > input[name="comment_status"]').val() || ''; + + /* $(listTable).bind('beforeChangePage', function(){ + commentReply.close(); + }); */ + }, + + addEvents : function(r) { + r.each(function() { + $(this).find('.column-comment > p').dblclick(function(){ + commentReply.toggle($(this).parent()); + }); + }); + }, + + toggle : function(el) { + if ( $(el).css('display') != 'none' ) + $(el).find('a.vim-q').click(); + }, + + revert : function() { + + if ( $('#the-comment-list #replyrow').length < 1 ) + return false; + + $('#replyrow').fadeOut('fast', function(){ + commentReply.close(); + }); + + return false; + }, + + close : function() { + var c; + + if ( this.cid ) { + c = $('#comment-' + this.cid); + + if ( this.act == 'edit-comment' ) + c.fadeIn(300, function(){ c.show() }).css('backgroundColor', ''); + + $('#replyrow').hide(); + $('#com-reply').append( $('#replyrow') ); + $('#replycontent').val(''); + $('input', '#edithead').val(''); + $('.error', '#replysubmit').html('').hide(); + $('.waiting', '#replysubmit').hide(); + + if ( $.browser.msie ) + $('#replycontainer, #replycontent').css('height', '120px'); + else + $('#replycontainer').resizable('destroy').css('height', '120px'); + + this.cid = ''; + } + }, + + open : function(id, p, a) { + var t = this, editRow, rowData, act, h, c = $('#comment-' + id), replyButton; + + t.close(); + t.cid = id; + + editRow = $('#replyrow'); + rowData = $('#inline-'+id); + act = t.act = (a == 'edit') ? 'edit-comment' : 'replyto-comment'; + + $('#action', editRow).val(act); + $('#comment_post_ID', editRow).val(p); + $('#comment_ID', editRow).val(id); + + if ( a == 'edit' ) { + $('#author', editRow).val( $('div.author', rowData).text() ); + $('#author-email', editRow).val( $('div.author-email', rowData).text() ); + $('#author-url', editRow).val( $('div.author-url', rowData).text() ); + $('#status', editRow).val( $('div.comment_status', rowData).text() ); + $('#replycontent', editRow).val( $('textarea.comment', rowData).val() ); + $('#edithead, #savebtn', editRow).show(); + $('#replyhead, #replybtn', editRow).hide(); + + h = c.height(); + if ( h > 220 ) + if ( $.browser.msie ) + $('#replycontainer, #replycontent', editRow).height(h-105); + else + $('#replycontainer', editRow).height(h-105); + + c.after( editRow ).fadeOut('fast', function(){ + $('#replyrow').fadeIn(300, function(){ $(this).show() }); + }); + } else { + replyButton = $('#replybtn', editRow); + $('#edithead, #savebtn', editRow).hide(); + $('#replyhead, #replybtn', editRow).show(); + c.after(editRow); + + if ( c.hasClass('unapproved') ) { + replyButton.text(adminCommentsL10n.replyApprove); + } else { + replyButton.text(adminCommentsL10n.reply); + } + + $('#replyrow').fadeIn(300, function(){ $(this).show() }); + } + + setTimeout(function() { + var rtop, rbottom, scrollTop, vp, scrollBottom; + + rtop = $('#replyrow').offset().top; + rbottom = rtop + $('#replyrow').height(); + scrollTop = window.pageYOffset || document.documentElement.scrollTop; + vp = document.documentElement.clientHeight || self.innerHeight || 0; + scrollBottom = scrollTop + vp; + + if ( scrollBottom - 20 < rbottom ) + window.scroll(0, rbottom - vp + 35); + else if ( rtop - 20 < scrollTop ) + window.scroll(0, rtop - 35); + + $('#replycontent').focus().keyup(function(e){ + if ( e.which == 27 ) + commentReply.revert(); // close on Escape + }); + }, 600); + + return false; + }, + + send : function() { + var post = {}; + + $('#replysubmit .error').hide(); + $('#replysubmit .waiting').show(); + + $('#replyrow input').not(':button').each(function() { + post[ $(this).attr('name') ] = $(this).val(); + }); + + post.content = $('#replycontent').val(); + post.id = post.comment_post_ID; + post.comments_listing = this.comments_listing; + post.p = $('[name="p"]').val(); + + if ( $('#comment-' + $('#comment_ID').val()).hasClass('unapproved') ) + post.approve_parent = 1; + + $.ajax({ + type : 'POST', + url : ajaxurl, + data : post, + success : function(x) { commentReply.show(x); }, + error : function(r) { commentReply.error(r); } + }); + + return false; + }, + + show : function(xml) { + var t = this, r, c, id, bg, pid; + + t.revert(); + + if ( typeof(xml) == 'string' ) { + t.error({'responseText': xml}); + return false; + } + + r = wpAjax.parseAjaxResponse(xml); + if ( r.errors ) { + t.error({'responseText': wpAjax.broken}); + return false; + } + + r = r.responses[0]; + c = r.data; + id = '#comment-' + r.id; + if ( 'edit-comment' == t.act ) + $(id).remove(); + + if ( r.supplemental.parent_approved ) { + pid = $('#comment-' + r.supplemental.parent_approved); + updatePending( getCount( $('span.pending-count').eq(0) ) - 1 ); + + if ( this.comments_listing == 'moderated' ) { + pid.animate( { 'backgroundColor':'#CCEEBB' }, 400, function(){ + pid.fadeOut(); + }); + return; + } + } + + $(c).hide() + $('#replyrow').after(c); + id = $(id); + t.addEvents(id); + bg = id.hasClass('unapproved') ? '#FFFFE0' : id.closest('.widefat').css('backgroundColor'); + + id.animate( { 'backgroundColor':'#CCEEBB' }, 300 ) + .animate( { 'backgroundColor': bg }, 300, function() { + if ( pid && pid.length ) { + pid.animate( { 'backgroundColor':'#CCEEBB' }, 300 ) + .animate( { 'backgroundColor': bg }, 300 ) + .removeClass('unapproved').addClass('approved') + .find('div.comment_status').html('1'); + } + }); + + }, + + error : function(r) { + var er = r.statusText; + + $('#replysubmit .waiting').hide(); + + if ( r.responseText ) + er = r.responseText.replace( /<.[^<>]*?>/g, '' ); + + if ( er ) + $('#replysubmit .error').html(er).show(); + + } +}; + +$(document).ready(function(){ + var make_hotkeys_redirect, edit_comment, toggle_all, make_bulk; + + setCommentsList(); + commentReply.init(); + $(document).delegate('span.delete a.delete', 'click', function(){return false;}); + + if ( typeof QTags != 'undefined' ) + ed_reply = new QTags('ed_reply', 'replycontent', 'replycontainer', 'more,fullscreen'); + + if ( typeof $.table_hotkeys != 'undefined' ) { + make_hotkeys_redirect = function(which) { + return function() { + var first_last, l; + + first_last = 'next' == which? 'first' : 'last'; + l = $('.tablenav-pages .'+which+'-page:not(.disabled)'); + if (l.length) + window.location = l[0].href.replace(/\&hotkeys_highlight_(first|last)=1/g, '')+'&hotkeys_highlight_'+first_last+'=1'; + } + }; + + edit_comment = function(event, current_row) { + window.location = $('span.edit a', current_row).attr('href'); + }; + + toggle_all = function() { + toggleWithKeyboard = true; + $('input:checkbox', '#cb').click().prop('checked', false); + toggleWithKeyboard = false; + }; + + make_bulk = function(value) { + return function() { + var scope = $('select[name="action"]'); + $('option[value="' + value + '"]', scope).prop('selected', true); + $('#doaction').click(); + } + }; + + $.table_hotkeys( + $('table.widefat'), + ['a', 'u', 's', 'd', 'r', 'q', 'z', ['e', edit_comment], ['shift+x', toggle_all], + ['shift+a', make_bulk('approve')], ['shift+s', make_bulk('spam')], + ['shift+d', make_bulk('delete')], ['shift+t', make_bulk('trash')], + ['shift+z', make_bulk('untrash')], ['shift+u', make_bulk('unapprove')]], + { highlight_first: adminCommentsL10n.hotkeys_highlight_first, highlight_last: adminCommentsL10n.hotkeys_highlight_last, + prev_page_link_cb: make_hotkeys_redirect('prev'), next_page_link_cb: make_hotkeys_redirect('next') } + ); + } +}); + +})(jQuery); diff --git a/src/wp-admin/js/edit-comments.js b/src/wp-admin/js/edit-comments.js new file mode 100644 index 0000000..c7c417c --- /dev/null +++ b/src/wp-admin/js/edit-comments.js @@ -0,0 +1 @@ +var theList,theExtraList,toggleWithKeyboard=false,getCount,updateCount,updatePending,dashboardTotals;(function(a){setCommentsList=function(){var c,e,g,j=0,f,h,d,i,b;c=a('input[name="_total"]',"#comments-form");e=a('input[name="_per_page"]',"#comments-form");g=a('input[name="_page"]',"#comments-form");f=function(n,l){var p=a("#"+l.element),k,o,m;k=a("#replyrow");o=a("#comment_ID",k).val();m=a("#replybtn",k);if(p.is(".unapproved")){if(l.data.id==o){m.text(adminCommentsL10n.replyApprove)}p.find("div.comment_status").html("0")}else{if(l.data.id==o){m.text(adminCommentsL10n.reply)}p.find("div.comment_status").html("1")}a("span.pending-count").each(function(){var q=a(this),s,r;s=q.html().replace(/[^0-9]+/g,"");s=parseInt(s,10);if(isNaN(s)){return}r=a("#"+l.element).is("."+l.dimClass)?1:-1;s=s+r;if(s<0){s=0}q.closest(".awaiting-mod")[0==s?"addClass":"removeClass"]("count-0");updateCount(q,s);dashboardTotals()})};h=function(o,s){var u=a(o.target).attr("class"),k,l,m,r,t,q,p=false;o.data._total=c.val()||0;o.data._per_page=e.val()||0;o.data._page=g.val()||0;o.data._url=document.location.href;o.data.comment_status=a('input[name="comment_status"]',"#comments-form").val();if(u.indexOf(":trash=1")!=-1){p="trash"}else{if(u.indexOf(":spam=1")!=-1){p="spam"}}if(p){k=u.replace(/.*?comment-([0-9]+).*/,"$1");l=a("#comment-"+k);note=a("#"+p+"-undo-holder").html();l.find(".check-column :checkbox").prop("checked",false);if(l.siblings("#replyrow").length&&commentReply.cid==k){commentReply.close()}if(l.is("tr")){m=l.children(":visible").length;q=a(".author strong",l).text();r=a(''+note+"")}else{q=a(".comment-author",l).text();r=a('")}l.before(r);a("strong","#undo-"+k).text(q+" ");t=a(".undo a","#undo-"+k);t.attr("href","comment.php?action=un"+p+"comment&c="+k+"&_wpnonce="+o.data._ajax_nonce);t.attr("class","delete:the-comment-list:comment-"+k+"::un"+p+"=1 vim-z vim-destructive");a(".avatar",l).clone().prependTo("#undo-"+k+" ."+p+"-undo-inside");t.click(function(){s.wpList.del(this);a("#undo-"+k).css({backgroundColor:"#ceb"}).fadeOut(350,function(){a(this).remove();a("#comment-"+k).css("backgroundColor","").fadeIn(300,function(){a(this).show()})});return false})}return o};d=function(k,l,m){if(l3){while(m.length>3){k=thousandsSeparator+m.substr(m.length-3)+k;m=m.substr(0,m.length-3)}m=m+k}l.html(m)};updatePending=function(k){a("span.pending-count").each(function(){var l=a(this);if(k<0){k=0}l.closest(".awaiting-mod")[0==k?"addClass":"removeClass"]("count-0");updateCount(l,k);dashboardTotals()})};i=function(k,n){var q,o,u=a(n.target).parent().is("span.untrash"),m=a(n.target).parent().is("span.unspam"),t,s,l,p=a("#"+n.element).is(".unapproved");function v(r){if(a(n.target).parent().is("span."+r)){return 1}else{if(a("#"+n.element).is("."+r)){return -1}}return 0}t=v("spam");s=v("trash");if(u){s=-1}if(m){t=-1}l=getCount(a("span.pending-count").eq(0));if(a(n.target).parent().is("span.unapprove")||((u||m)&&p)){l=l+1}else{if(p){l=l-1}}updatePending(l);a("span.spam-count").each(function(){var r=a(this),w=getCount(r)+t;updateCount(r,w)});a("span.trash-count").each(function(){var r=a(this),w=getCount(r)+s;updateCount(r,w)});if(a("#dashboard_right_now").length){o=s?-1*s:0;dashboardTotals(o)}else{q=c.val()?parseInt(c.val(),10):0;q=q-t-s;if(q<0){q=0}if(("object"==typeof k)&&jk){return}if(n){theExtraList.empty();l.number=Math.min(8,m)}else{l.number=1;l.offset=Math.min(8,m)-1}l.no_placeholder=true;l.paged++;if(true===l.comment_type){l.comment_type=""}l=a.extend(l,{action:"fetch-list",list_args:list_args,_ajax_fetch_list_nonce:a("#_ajax_fetch_list_nonce").val()});a.ajax({url:ajaxurl,global:false,dataType:"json",data:l,success:function(o){theExtraList.get(0).wpList.add(o.rows)}})};theExtraList=a("#the-extra-comment-list").wpList({alt:"",delColor:"none",addColor:"none"});theList=a("#the-comment-list").wpList({alt:"",delBefore:h,dimAfter:f,delAfter:i,addColor:"none"}).bind("wpListDelEnd",function(l,k){var m=k.element.replace(/[^0-9]+/g,"");if(k.target.className.indexOf(":trash=1")!=-1||k.target.className.indexOf(":spam=1")!=-1){a("#undo-"+m).fadeIn(300,function(){a(this).show()})}})};commentReply={cid:"",act:"",init:function(){var b=a("#replyrow");a("a.cancel",b).click(function(){return commentReply.revert()});a("a.save",b).click(function(){return commentReply.send()});a("input#author, input#author-email, input#author-url",b).keypress(function(c){if(c.which==13){commentReply.send();c.preventDefault();return false}});a("#the-comment-list .column-comment > p").dblclick(function(){commentReply.toggle(a(this).parent())});a("#doaction, #doaction2, #post-query-submit").click(function(c){if(a("#the-comment-list #replyrow").length>0){commentReply.close()}});this.comments_listing=a('#comments-form > input[name="comment_status"]').val()||""},addEvents:function(b){b.each(function(){a(this).find(".column-comment > p").dblclick(function(){commentReply.toggle(a(this).parent())})})},toggle:function(b){if(a(b).css("display")!="none"){a(b).find("a.vim-q").click()}},revert:function(){if(a("#the-comment-list #replyrow").length<1){return false}a("#replyrow").fadeOut("fast",function(){commentReply.close()});return false},close:function(){var b;if(this.cid){b=a("#comment-"+this.cid);if(this.act=="edit-comment"){b.fadeIn(300,function(){b.show()}).css("backgroundColor","")}a("#replyrow").hide();a("#com-reply").append(a("#replyrow"));a("#replycontent").val("");a("input","#edithead").val("");a(".error","#replysubmit").html("").hide();a(".waiting","#replysubmit").hide();if(a.browser.msie){a("#replycontainer, #replycontent").css("height","120px")}else{a("#replycontainer").resizable("destroy").css("height","120px")}this.cid=""}},open:function(b,d,k){var m=this,e,f,i,g,j=a("#comment-"+b),l;m.close();m.cid=b;e=a("#replyrow");f=a("#inline-"+b);i=m.act=(k=="edit")?"edit-comment":"replyto-comment";a("#action",e).val(i);a("#comment_post_ID",e).val(d);a("#comment_ID",e).val(b);if(k=="edit"){a("#author",e).val(a("div.author",f).text());a("#author-email",e).val(a("div.author-email",f).text());a("#author-url",e).val(a("div.author-url",f).text());a("#status",e).val(a("div.comment_status",f).text());a("#replycontent",e).val(a("textarea.comment",f).val());a("#edithead, #savebtn",e).show();a("#replyhead, #replybtn",e).hide();g=j.height();if(g>220){if(a.browser.msie){a("#replycontainer, #replycontent",e).height(g-105)}else{a("#replycontainer",e).height(g-105)}}j.after(e).fadeOut("fast",function(){a("#replyrow").fadeIn(300,function(){a(this).show()})})}else{l=a("#replybtn",e);a("#edithead, #savebtn",e).hide();a("#replyhead, #replybtn",e).show();j.after(e);if(j.hasClass("unapproved")){l.text(adminCommentsL10n.replyApprove)}else{l.text(adminCommentsL10n.reply)}a("#replyrow").fadeIn(300,function(){a(this).show()})}setTimeout(function(){var o,h,p,c,n;o=a("#replyrow").offset().top;h=o+a("#replyrow").height();p=window.pageYOffset||document.documentElement.scrollTop;c=document.documentElement.clientHeight||self.innerHeight||0;n=p+c;if(n-20]*?>/g,"")}if(c){a("#replysubmit .error").html(c).show()}}};a(document).ready(function(){var e,b,c,d;setCommentsList();commentReply.init();a(document).delegate("span.delete a.delete","click",function(){return false});if(typeof QTags!="undefined"){ed_reply=new QTags("ed_reply","replycontent","replycontainer","more,fullscreen")}if(typeof a.table_hotkeys!="undefined"){e=function(f){return function(){var h,g;h="next"==f?"first":"last";g=a(".tablenav-pages ."+f+"-page:not(.disabled)");if(g.length){window.location=g[0].href.replace(/\&hotkeys_highlight_(first|last)=1/g,"")+"&hotkeys_highlight_"+h+"=1"}}};b=function(g,f){window.location=a("span.edit a",f).attr("href")};c=function(){toggleWithKeyboard=true;a("input:checkbox","#cb").click().prop("checked",false);toggleWithKeyboard=false};d=function(f){return function(){var g=a('select[name="action"]');a('option[value="'+f+'"]',g).prop("selected",true);a("#doaction").click()}};a.table_hotkeys(a("table.widefat"),["a","u","s","d","r","q","z",["e",b],["shift+x",c],["shift+a",d("approve")],["shift+s",d("spam")],["shift+d",d("delete")],["shift+t",d("trash")],["shift+z",d("untrash")],["shift+u",d("unapprove")]],{highlight_first:adminCommentsL10n.hotkeys_highlight_first,highlight_last:adminCommentsL10n.hotkeys_highlight_last,prev_page_link_cb:e("prev"),next_page_link_cb:e("next")})}})})(jQuery); \ No newline at end of file diff --git a/src/wp-admin/js/editor.dev.js b/src/wp-admin/js/editor.dev.js new file mode 100644 index 0000000..2271bdb --- /dev/null +++ b/src/wp-admin/js/editor.dev.js @@ -0,0 +1,207 @@ + +jQuery(document).ready(function($){ + var h = wpCookies.getHash('TinyMCE_content_size'); + + if ( getUserSetting( 'editor' ) == 'html' ) { + if ( h ) + $('#content').css('height', h.ch - 15 + 'px'); + } else { + if ( typeof tinyMCE != 'object' ) { + $('#content').css('color', '#000'); + } else { + $('#quicktags').hide(); + } + } +}); + +var switchEditors = { + + mode : '', + + I : function(e) { + return document.getElementById(e); + }, + + _wp_Nop : function(content) { + var blocklist1, blocklist2; + + // Protect pre|script tags + if ( content.indexOf(']*>[\s\S]+?<\/\1>/g, function(a) { + a = a.replace(/
    (\r\n|\n)?/g, ''); + return a.replace(/<\/?p( [^>]*)?>(\r\n|\n)?/g, ''); + }); + } + + // Pretty it up for the source editor + blocklist1 = 'blockquote|ul|ol|li|table|thead|tbody|tfoot|tr|th|td|div|h[1-6]|p|fieldset'; + content = content.replace(new RegExp('\\s*\\s*', 'g'), '\n'); + content = content.replace(new RegExp('\\s*<((?:'+blocklist1+')(?: [^>]*)?)>', 'g'), '\n<$1>'); + + // Mark

    if it has any attributes. + content = content.replace(/(

    ]+>.*?)<\/p>/g, '$1'); + + // Sepatate

    containing

    + content = content.replace(/]*)?>\s*

    /gi, '\n\n'); + + // Remove

    and
    + content = content.replace(/\s*

    /gi, ''); + content = content.replace(/\s*<\/p>\s*/gi, '\n\n'); + content = content.replace(/\n[\s\u00a0]+\n/g, '\n\n'); + content = content.replace(/\s*
    \s*/gi, '\n'); + + // Fix some block element newline issues + content = content.replace(/\s*

    \s*/g, '
    \n'); + content = content.replace(/\s*\[caption([^\[]+)\[\/caption\]\s*/gi, '\n\n[caption$1[/caption]\n\n'); + content = content.replace(/caption\]\n\n+\[caption/g, 'caption]\n\n[caption'); + + blocklist2 = 'blockquote|ul|ol|li|table|thead|tbody|tfoot|tr|th|td|h[1-6]|pre|fieldset'; + content = content.replace(new RegExp('\\s*<((?:'+blocklist2+')(?: [^>]*)?)\\s*>', 'g'), '\n<$1>'); + content = content.replace(new RegExp('\\s*\\s*', 'g'), '\n'); + content = content.replace(/]*)>/g, '\t'); + + if ( content.indexOf(']*)?>\s*/g, '\n\n\n\n'); + } + + if ( content.indexOf('/g, function(a){ + return a.replace(/[\r\n]+/g, ''); + }); + } + + // Unmark special paragraph closing tags + content = content.replace(/<\/p#>/g, '

    \n'); + content = content.replace(/\s*(

    ]+>[\s\S]*?<\/p>)/g, '\n$1'); + + // Trim whitespace + content = content.replace(/^\s+/, ''); + content = content.replace(/[\s\u00a0]+$/, ''); + + // put back the line breaks in pre|script + content = content.replace(//g, '\n'); + + return content; + }, + + go : function(id, mode) { + id = id || 'content'; + mode = mode || this.mode || ''; + + var ed, qt = this.I('quicktags'), H = this.I('edButtonHTML'), P = this.I('edButtonPreview'), ta = this.I(id); + + try { ed = tinyMCE.get(id); } + catch(e) { ed = false; } + + if ( 'tinymce' == mode ) { + if ( ed && ! ed.isHidden() ) + return false; + + setUserSetting( 'editor', 'tinymce' ); + this.mode = 'html'; + + P.className = 'active'; + H.className = ''; + edCloseAllTags(); // :-( + qt.style.display = 'none'; + + ta.style.color = '#FFF'; + ta.value = this.wpautop(ta.value); + + try { + if ( ed ) + ed.show(); + else + tinyMCE.execCommand("mceAddControl", false, id); + } catch(e) {} + + ta.style.color = '#000'; + } else { + setUserSetting( 'editor', 'html' ); + ta.style.color = '#000'; + this.mode = 'tinymce'; + H.className = 'active'; + P.className = ''; + + if ( ed && !ed.isHidden() ) { + ta.style.height = ed.getContentAreaContainer().offsetHeight + 24 + 'px'; + ed.hide(); + } + + qt.style.display = 'block'; + } + return false; + }, + + _wp_Autop : function(pee) { + var blocklist = 'table|thead|tfoot|tbody|tr|td|th|caption|col|colgroup|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|p|h[1-6]|fieldset|legend|hr|noscript|menu|samp|header|footer|article|section|hgroup|nav|aside|details|summary'; + + if ( pee.indexOf('/g, function(a){ + return a.replace(/[\r\n]+/g, ''); + }); + } + + pee = pee.replace(/<[^<>]+>/g, function(a){ + return a.replace(/[\r\n]+/g, ' '); + }); + + // Protect pre|script tags + if ( pee.indexOf(']*>[\s\S]+?<\/\1>/g, function(a) { + return a.replace(/(\r\n|\n)/g, ''); + }); + } + + pee = pee + '\n\n'; + pee = pee.replace(/
    \s*
    /gi, '\n\n'); + pee = pee.replace(new RegExp('(<(?:'+blocklist+')(?: [^>]*)?>)', 'gi'), '\n$1'); + pee = pee.replace(new RegExp('()', 'gi'), '$1\n\n'); + pee = pee.replace(/]*)?>/gi, '\n\n'); // hr is self closing block element + pee = pee.replace(/\r\n|\r/g, '\n'); + pee = pee.replace(/\n\s*\n+/g, '\n\n'); + pee = pee.replace(/([\s\S]+?)\n\n/g, '

    $1

    \n'); + pee = pee.replace(/

    \s*?<\/p>/gi, ''); + pee = pee.replace(new RegExp('

    \\s*(]*)?>)\\s*

    ', 'gi'), "$1"); + pee = pee.replace(/

    (/gi, '$1'); + pee = pee.replace(/

    \s*]*)>/gi, '

    '); + pee = pee.replace(/<\/blockquote>\s*<\/p>/gi, '

    '); + pee = pee.replace(new RegExp('

    \\s*(]*)?>)', 'gi'), "$1"); + pee = pee.replace(new RegExp('(]*)?>)\\s*

    ', 'gi'), "$1"); + pee = pee.replace(/\s*\n/gi, '
    \n'); + pee = pee.replace(new RegExp('(]*>)\\s*
    ', 'gi'), "$1"); + pee = pee.replace(/
    (\s*<\/?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)>)/gi, '$1'); + pee = pee.replace(/(?:

    |
    )*\s*\[caption([^\[]+)\[\/caption\]\s*(?:<\/p>|
    )*/gi, '[caption$1[/caption]'); + + pee = pee.replace(/(<(?:div|th|td|form|fieldset|dd)[^>]*>)(.*?)<\/p>/g, function(a, b, c) { + if ( c.match(/]*)?>/) ) + return a; + + return b + '

    ' + c + '

    '; + }); + + // put back the line breaks in pre|script + pee = pee.replace(//g, '\n'); + + return pee; + }, + + pre_wpautop : function(content) { + var t = this, o = { o: t, data: content, unfiltered: content }; + + jQuery('body').trigger('beforePreWpautop', [o]); + o.data = t._wp_Nop(o.data); + jQuery('body').trigger('afterPreWpautop', [o]); + return o.data; + }, + + wpautop : function(pee) { + var t = this, o = { o: t, data: pee, unfiltered: pee }; + + jQuery('body').trigger('beforeWpautop', [o]); + o.data = t._wp_Autop(o.data); + jQuery('body').trigger('afterWpautop', [o]); + return o.data; + } +}; diff --git a/src/wp-admin/js/editor.js b/src/wp-admin/js/editor.js new file mode 100644 index 0000000..c3e342a --- /dev/null +++ b/src/wp-admin/js/editor.js @@ -0,0 +1 @@ +jQuery(document).ready(function(b){var a=wpCookies.getHash("TinyMCE_content_size");if(getUserSetting("editor")=="html"){if(a){b("#content").css("height",a.ch-15+"px")}}else{if(typeof tinyMCE!="object"){b("#content").css("color","#000")}else{b("#quicktags").hide()}}});var switchEditors={mode:"",I:function(a){return document.getElementById(a)},_wp_Nop:function(b){var c,a;if(b.indexOf("]*>[\s\S]+?<\/\1>/g,function(d){d=d.replace(/
    (\r\n|\n)?/g,"");return d.replace(/<\/?p( [^>]*)?>(\r\n|\n)?/g,"")})}c="blockquote|ul|ol|li|table|thead|tbody|tfoot|tr|th|td|div|h[1-6]|p|fieldset";b=b.replace(new RegExp("\\s*\\s*","g"),"\n");b=b.replace(new RegExp("\\s*<((?:"+c+")(?: [^>]*)?)>","g"),"\n<$1>");b=b.replace(/(

    ]+>.*?)<\/p>/g,"$1");b=b.replace(/]*)?>\s*

    /gi,"\n\n");b=b.replace(/\s*

    /gi,"");b=b.replace(/\s*<\/p>\s*/gi,"\n\n");b=b.replace(/\n[\s\u00a0]+\n/g,"\n\n");b=b.replace(/\s*
    \s*/gi,"\n");b=b.replace(/\s*

    \s*/g,"
    \n");b=b.replace(/\s*\[caption([^\[]+)\[\/caption\]\s*/gi,"\n\n[caption$1[/caption]\n\n");b=b.replace(/caption\]\n\n+\[caption/g,"caption]\n\n[caption");a="blockquote|ul|ol|li|table|thead|tbody|tfoot|tr|th|td|h[1-6]|pre|fieldset";b=b.replace(new RegExp("\\s*<((?:"+a+")(?: [^>]*)?)\\s*>","g"),"\n<$1>");b=b.replace(new RegExp("\\s*\\s*","g"),"\n");b=b.replace(/]*)>/g,"\t");if(b.indexOf("]*)?>\s*/g,"\n\n\n\n")}if(b.indexOf("/g,function(d){return d.replace(/[\r\n]+/g,"")})}b=b.replace(/<\/p#>/g,"

    \n");b=b.replace(/\s*(

    ]+>[\s\S]*?<\/p>)/g,"\n$1");b=b.replace(/^\s+/,"");b=b.replace(/[\s\u00a0]+$/,"");b=b.replace(//g,"\n");return b},go:function(i,g){i=i||"content";g=g||this.mode||"";var b,h=this.I("quicktags"),c=this.I("edButtonHTML"),d=this.I("edButtonPreview"),a=this.I(i);try{b=tinyMCE.get(i)}catch(f){b=false}if("tinymce"==g){if(b&&!b.isHidden()){return false}setUserSetting("editor","tinymce");this.mode="html";d.className="active";c.className="";edCloseAllTags();h.style.display="none";a.style.color="#FFF";a.value=this.wpautop(a.value);try{if(b){b.show()}else{tinyMCE.execCommand("mceAddControl",false,i)}}catch(f){}a.style.color="#000"}else{setUserSetting("editor","html");a.style.color="#000";this.mode="tinymce";c.className="active";d.className="";if(b&&!b.isHidden()){a.style.height=b.getContentAreaContainer().offsetHeight+24+"px";b.hide()}h.style.display="block"}return false},_wp_Autop:function(a){var b="table|thead|tfoot|tbody|tr|td|th|caption|col|colgroup|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|p|h[1-6]|fieldset|legend|hr|noscript|menu|samp|header|footer|article|section|hgroup|nav|aside|details|summary";if(a.indexOf("/g,function(c){return c.replace(/[\r\n]+/g,"")})}a=a.replace(/<[^<>]+>/g,function(c){return c.replace(/[\r\n]+/g," ")});if(a.indexOf("]*>[\s\S]+?<\/\1>/g,function(c){return c.replace(/(\r\n|\n)/g,"")})}a=a+"\n\n";a=a.replace(/
    \s*
    /gi,"\n\n");a=a.replace(new RegExp("(<(?:"+b+")(?: [^>]*)?>)","gi"),"\n$1");a=a.replace(new RegExp("()","gi"),"$1\n\n");a=a.replace(/]*)?>/gi,"\n\n");a=a.replace(/\r\n|\r/g,"\n");a=a.replace(/\n\s*\n+/g,"\n\n");a=a.replace(/([\s\S]+?)\n\n/g,"

    $1

    \n");a=a.replace(/

    \s*?<\/p>/gi,"");a=a.replace(new RegExp("

    \\s*(]*)?>)\\s*

    ","gi"),"$1");a=a.replace(/

    (/gi,"$1");a=a.replace(/

    \s*]*)>/gi,"

    ");a=a.replace(/<\/blockquote>\s*<\/p>/gi,"

    ");a=a.replace(new RegExp("

    \\s*(]*)?>)","gi"),"$1");a=a.replace(new RegExp("(]*)?>)\\s*

    ","gi"),"$1");a=a.replace(/\s*\n/gi,"
    \n");a=a.replace(new RegExp("(]*>)\\s*
    ","gi"),"$1");a=a.replace(/
    (\s*<\/?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)>)/gi,"$1");a=a.replace(/(?:

    |
    )*\s*\[caption([^\[]+)\[\/caption\]\s*(?:<\/p>|
    )*/gi,"[caption$1[/caption]");a=a.replace(/(<(?:div|th|td|form|fieldset|dd)[^>]*>)(.*?)<\/p>/g,function(e,d,f){if(f.match(/]*)?>/)){return e}return d+"

    "+f+"

    "});a=a.replace(//g,"\n");return a},pre_wpautop:function(b){var a=this,c={o:a,data:b,unfiltered:b};jQuery("body").trigger("beforePreWpautop",[c]);c.data=a._wp_Nop(c.data);jQuery("body").trigger("afterPreWpautop",[c]);return c.data},wpautop:function(b){var a=this,c={o:a,data:b,unfiltered:b};jQuery("body").trigger("beforeWpautop",[c]);c.data=a._wp_Autop(c.data);jQuery("body").trigger("afterWpautop",[c]);return c.data}}; \ No newline at end of file diff --git a/src/wp-admin/js/farbtastic.js b/src/wp-admin/js/farbtastic.js new file mode 100644 index 0000000..5404fb6 --- /dev/null +++ b/src/wp-admin/js/farbtastic.js @@ -0,0 +1,276 @@ +/*! + * Farbtastic: jQuery color picker plug-in v1.3u + * + * Licensed under the GPL license: + * http://www.gnu.org/licenses/gpl.html + */ +(function($) { + +$.fn.farbtastic = function (options) { + $.farbtastic(this, options); + return this; +}; + +$.farbtastic = function (container, callback) { + var container = $(container).get(0); + return container.farbtastic || (container.farbtastic = new $._farbtastic(container, callback)); +}; + +$._farbtastic = function (container, callback) { + // Store farbtastic object + var fb = this; + + // Insert markup + $(container).html('
    '); + var e = $('.farbtastic', container); + fb.wheel = $('.wheel', container).get(0); + // Dimensions + fb.radius = 84; + fb.square = 100; + fb.width = 194; + + // Fix background PNGs in IE6 + if (navigator.appVersion.match(/MSIE [0-6]\./)) { + $('*', e).each(function () { + if (this.currentStyle.backgroundImage != 'none') { + var image = this.currentStyle.backgroundImage; + image = this.currentStyle.backgroundImage.substring(5, image.length - 2); + $(this).css({ + 'backgroundImage': 'none', + 'filter': "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=crop, src='" + image + "')" + }); + } + }); + } + + /** + * Link to the given element(s) or callback. + */ + fb.linkTo = function (callback) { + // Unbind previous nodes + if (typeof fb.callback == 'object') { + $(fb.callback).unbind('keyup', fb.updateValue); + } + + // Reset color + fb.color = null; + + // Bind callback or elements + if (typeof callback == 'function') { + fb.callback = callback; + } + else if (typeof callback == 'object' || typeof callback == 'string') { + fb.callback = $(callback); + fb.callback.bind('keyup', fb.updateValue); + if (fb.callback.get(0).value) { + fb.setColor(fb.callback.get(0).value); + } + } + return this; + }; + fb.updateValue = function (event) { + if (this.value && this.value != fb.color) { + fb.setColor(this.value); + } + }; + + /** + * Change color with HTML syntax #123456 + */ + fb.setColor = function (color) { + var unpack = fb.unpack(color); + if (fb.color != color && unpack) { + fb.color = color; + fb.rgb = unpack; + fb.hsl = fb.RGBToHSL(fb.rgb); + fb.updateDisplay(); + } + return this; + }; + + /** + * Change color with HSL triplet [0..1, 0..1, 0..1] + */ + fb.setHSL = function (hsl) { + fb.hsl = hsl; + fb.rgb = fb.HSLToRGB(hsl); + fb.color = fb.pack(fb.rgb); + fb.updateDisplay(); + return this; + }; + + ///////////////////////////////////////////////////// + + /** + * Retrieve the coordinates of the given event relative to the center + * of the widget. + */ + fb.widgetCoords = function (event) { + var offset = $(fb.wheel).offset(); + return { x: (event.pageX - offset.left) - fb.width / 2, y: (event.pageY - offset.top) - fb.width / 2 }; + }; + + /** + * Mousedown handler + */ + fb.mousedown = function (event) { + // Capture mouse + if (!document.dragging) { + $(document).bind('mousemove', fb.mousemove).bind('mouseup', fb.mouseup); + document.dragging = true; + } + + // Check which area is being dragged + var pos = fb.widgetCoords(event); + fb.circleDrag = Math.max(Math.abs(pos.x), Math.abs(pos.y)) * 2 > fb.square; + + // Process + fb.mousemove(event); + return false; + }; + + /** + * Mousemove handler + */ + fb.mousemove = function (event) { + // Get coordinates relative to color picker center + var pos = fb.widgetCoords(event); + + // Set new HSL parameters + if (fb.circleDrag) { + var hue = Math.atan2(pos.x, -pos.y) / 6.28; + if (hue < 0) hue += 1; + fb.setHSL([hue, fb.hsl[1], fb.hsl[2]]); + } + else { + var sat = Math.max(0, Math.min(1, -(pos.x / fb.square) + .5)); + var lum = Math.max(0, Math.min(1, -(pos.y / fb.square) + .5)); + fb.setHSL([fb.hsl[0], sat, lum]); + } + return false; + }; + + /** + * Mouseup handler + */ + fb.mouseup = function () { + // Uncapture mouse + $(document).unbind('mousemove', fb.mousemove); + $(document).unbind('mouseup', fb.mouseup); + document.dragging = false; + }; + + /** + * Update the markers and styles + */ + fb.updateDisplay = function () { + // Markers + var angle = fb.hsl[0] * 6.28; + $('.h-marker', e).css({ + left: Math.round(Math.sin(angle) * fb.radius + fb.width / 2) + 'px', + top: Math.round(-Math.cos(angle) * fb.radius + fb.width / 2) + 'px' + }); + + $('.sl-marker', e).css({ + left: Math.round(fb.square * (.5 - fb.hsl[1]) + fb.width / 2) + 'px', + top: Math.round(fb.square * (.5 - fb.hsl[2]) + fb.width / 2) + 'px' + }); + + // Saturation/Luminance gradient + $('.color', e).css('backgroundColor', fb.pack(fb.HSLToRGB([fb.hsl[0], 1, 0.5]))); + + // Linked elements or callback + if (typeof fb.callback == 'object') { + // Set background/foreground color + $(fb.callback).css({ + backgroundColor: fb.color, + color: fb.hsl[2] > 0.5 ? '#000' : '#fff' + }); + + // Change linked value + $(fb.callback).each(function() { + if (this.value && this.value != fb.color) { + this.value = fb.color; + } + }); + } + else if (typeof fb.callback == 'function') { + fb.callback.call(fb, fb.color); + } + }; + + /* Various color utility functions */ + fb.pack = function (rgb) { + var r = Math.round(rgb[0] * 255); + var g = Math.round(rgb[1] * 255); + var b = Math.round(rgb[2] * 255); + return '#' + (r < 16 ? '0' : '') + r.toString(16) + + (g < 16 ? '0' : '') + g.toString(16) + + (b < 16 ? '0' : '') + b.toString(16); + }; + + fb.unpack = function (color) { + if (color.length == 7) { + return [parseInt('0x' + color.substring(1, 3)) / 255, + parseInt('0x' + color.substring(3, 5)) / 255, + parseInt('0x' + color.substring(5, 7)) / 255]; + } + else if (color.length == 4) { + return [parseInt('0x' + color.substring(1, 2)) / 15, + parseInt('0x' + color.substring(2, 3)) / 15, + parseInt('0x' + color.substring(3, 4)) / 15]; + } + }; + + fb.HSLToRGB = function (hsl) { + var m1, m2, r, g, b; + var h = hsl[0], s = hsl[1], l = hsl[2]; + m2 = (l <= 0.5) ? l * (s + 1) : l + s - l*s; + m1 = l * 2 - m2; + return [this.hueToRGB(m1, m2, h+0.33333), + this.hueToRGB(m1, m2, h), + this.hueToRGB(m1, m2, h-0.33333)]; + }; + + fb.hueToRGB = function (m1, m2, h) { + h = (h < 0) ? h + 1 : ((h > 1) ? h - 1 : h); + if (h * 6 < 1) return m1 + (m2 - m1) * h * 6; + if (h * 2 < 1) return m2; + if (h * 3 < 2) return m1 + (m2 - m1) * (0.66666 - h) * 6; + return m1; + }; + + fb.RGBToHSL = function (rgb) { + var min, max, delta, h, s, l; + var r = rgb[0], g = rgb[1], b = rgb[2]; + min = Math.min(r, Math.min(g, b)); + max = Math.max(r, Math.max(g, b)); + delta = max - min; + l = (min + max) / 2; + s = 0; + if (l > 0 && l < 1) { + s = delta / (l < 0.5 ? (2 * l) : (2 - 2 * l)); + } + h = 0; + if (delta > 0) { + if (max == r && max != g) h += (g - b) / delta; + if (max == g && max != b) h += (2 + (b - r) / delta); + if (max == b && max != r) h += (4 + (r - g) / delta); + h /= 6; + } + return [h, s, l]; + }; + + // Install mousedown handler (the others are set on the document on-demand) + $('*', e).mousedown(fb.mousedown); + + // Init color + fb.setColor('#000000'); + + // Set linked elements/callback + if (callback) { + fb.linkTo(callback); + } +}; + +})(jQuery); \ No newline at end of file diff --git a/src/wp-admin/js/gallery.dev.js b/src/wp-admin/js/gallery.dev.js new file mode 100644 index 0000000..1e80fd9 --- /dev/null +++ b/src/wp-admin/js/gallery.dev.js @@ -0,0 +1,197 @@ +jQuery(document).ready(function($) { + var gallerySortable, gallerySortableInit, w, desc = false; + + gallerySortableInit = function() { + gallerySortable = $('#media-items').sortable( { + items: 'div.media-item', + placeholder: 'sorthelper', + axis: 'y', + distance: 2, + handle: 'div.filename', + stop: function(e, ui) { + // When an update has occurred, adjust the order for each item + var all = $('#media-items').sortable('toArray'), len = all.length; + $.each(all, function(i, id) { + var order = desc ? (len - i) : (1 + i); + $('#' + id + ' .menu_order input').val(order); + }); + } + } ); + } + + sortIt = function() { + var all = $('.menu_order_input'), len = all.length; + all.each(function(i){ + var order = desc ? (len - i) : (1 + i); + $(this).val(order); + }); + } + + clearAll = function(c) { + c = c || 0; + $('.menu_order_input').each(function(){ + if ( this.value == '0' || c ) this.value = ''; + }); + } + + $('#asc').click(function(){desc = false; sortIt(); return false;}); + $('#desc').click(function(){desc = true; sortIt(); return false;}); + $('#clear').click(function(){clearAll(1); return false;}); + $('#showall').click(function(){ + $('#sort-buttons span a').toggle(); + $('a.describe-toggle-on').hide(); + $('a.describe-toggle-off, table.slidetoggle').show(); + return false; + }); + $('#hideall').click(function(){ + $('#sort-buttons span a').toggle(); + $('a.describe-toggle-on').show(); + $('a.describe-toggle-off, table.slidetoggle').hide(); + return false; + }); + + // initialize sortable + gallerySortableInit(); + clearAll(); + + if ( $('#media-items>*').length > 1 ) { + w = wpgallery.getWin(); + + $('#save-all, #gallery-settings').show(); + if ( typeof w.tinyMCE != 'undefined' && w.tinyMCE.activeEditor && ! w.tinyMCE.activeEditor.isHidden() ) { + wpgallery.mcemode = true; + wpgallery.init(); + } else { + $('#insert-gallery').show(); + } + } +}); + +jQuery(window).unload( function () { tinymce = tinyMCE = wpgallery = null; } ); // Cleanup + +/* gallery settings */ +var tinymce = null, tinyMCE, wpgallery; + +wpgallery = { + mcemode : false, + editor : {}, + dom : {}, + is_update : false, + el : {}, + + I : function(e) { + return document.getElementById(e); + }, + + init: function() { + var t = this, li, q, i, it, w = t.getWin(); + + if ( ! t.mcemode ) return; + + li = ('' + document.location.search).replace(/^\?/, '').split('&'); + q = {}; + for (i=0; i*").length>1){a=wpgallery.getWin();c("#save-all, #gallery-settings").show();if(typeof a.tinyMCE!="undefined"&&a.tinyMCE.activeEditor&&!a.tinyMCE.activeEditor.isHidden()){wpgallery.mcemode=true;wpgallery.init()}else{c("#insert-gallery").show()}}});jQuery(window).unload(function(){tinymce=tinyMCE=wpgallery=null});var tinymce=null,tinyMCE,wpgallery;wpgallery={mcemode:false,editor:{},dom:{},is_update:false,el:{},I:function(a){return document.getElementById(a)},init:function(){var d=this,a,f,c,e,b=d.getWin();if(!d.mcemode){return}a=(""+document.location.search).replace(/^\?/,"").split("&");f={};for(c=0;c this.hold['oh'] ) || ( w1 && w1 > this.hold['ow'] ) ) + warn.css('visibility', 'visible'); + else + warn.css('visibility', 'hidden'); + }, + + getSelRatio : function(postid) { + var x = this.hold['w'], y = this.hold['h'], + X = this.intval( $('#imgedit-crop-width-' + postid).val() ), + Y = this.intval( $('#imgedit-crop-height-' + postid).val() ); + + if ( X && Y ) + return X + ':' + Y; + + if ( x && y ) + return x + ':' + y; + + return '1:1'; + }, + + filterHistory : function(postid, setSize) { + // apply undo state to history + var history = $('#imgedit-history-' + postid).val(), pop, n, o, i, op = []; + + if ( history != '' ) { + history = JSON.parse(history); + pop = this.intval( $('#imgedit-undone-' + postid).val() ); + if ( pop > 0 ) { + while ( pop > 0 ) { + history.pop(); + pop--; + } + } + + if ( setSize ) { + if ( !history.length ) { + this.hold['w'] = this.hold['ow']; + this.hold['h'] = this.hold['oh']; + return ''; + } + + // restore + o = history[history.length - 1]; + o = o.c || o.r || o.f || false; + + if ( o ) { + this.hold['w'] = o.fw; + this.hold['h'] = o.fh; + } + } + + // filter the values + for ( n in history ) { + i = history[n]; + if ( i.hasOwnProperty('c') ) { + op[n] = { 'c': { 'x': i.c.x, 'y': i.c.y, 'w': i.c.w, 'h': i.c.h } }; + } else if ( i.hasOwnProperty('r') ) { + op[n] = { 'r': i.r.r }; + } else if ( i.hasOwnProperty('f') ) { + op[n] = { 'f': i.f.f }; + } + } + return JSON.stringify(op); + } + return ''; + }, + + refreshEditor : function(postid, nonce, callback) { + var t = this, data, img; + + t.toggleEditor(postid, 1); + data = { + 'action': 'imgedit-preview', + '_ajax_nonce': nonce, + 'postid': postid, + 'history': t.filterHistory(postid, 1), + 'rand': t.intval(Math.random() * 1000000) + }; + + img = $(''); + img.load( function() { + var max1, max2, parent = $('#imgedit-crop-' + postid), t = imageEdit; + + parent.empty().append(img); + + // w, h are the new full size dims + max1 = Math.max( t.hold.w, t.hold.h ); + max2 = Math.max( $(img).width(), $(img).height() ); + t.hold['sizer'] = max1 > max2 ? max2 / max1 : 1; + + t.initCrop(postid, img, parent); + t.setCropSelection(postid, 0); + + if ( (typeof callback != "unknown") && callback != null ) + callback(); + + if ( $('#imgedit-history-' + postid).val() && $('#imgedit-undone-' + postid).val() == 0 ) + $('input.imgedit-submit-btn', '#imgedit-panel-' + postid).removeAttr('disabled'); + else + $('input.imgedit-submit-btn', '#imgedit-panel-' + postid).prop('disabled', true); + + t.toggleEditor(postid, 0); + }).attr('src', ajaxurl + '?' + $.param(data)); + }, + + action : function(postid, nonce, action) { + var t = this, data, w, h, fw, fh; + + if ( t.notsaved(postid) ) + return false; + + data = { + 'action': 'image-editor', + '_ajax_nonce': nonce, + 'postid': postid + }; + + if ( 'scale' == action ) { + w = $('#imgedit-scale-width-' + postid), + h = $('#imgedit-scale-height-' + postid), + fw = t.intval(w.val()), + fh = t.intval(h.val()); + + if ( fw < 1 ) { + w.focus(); + return false; + } else if ( fh < 1 ) { + h.focus(); + return false; + } + + if ( fw == t.hold.ow || fh == t.hold.oh ) + return false; + + data['do'] = 'scale'; + data['fwidth'] = fw; + data['fheight'] = fh; + } else if ( 'restore' == action ) { + data['do'] = 'restore'; + } else { + return false; + } + + t.toggleEditor(postid, 1); + $.post(ajaxurl, data, function(r) { + $('#image-editor-' + postid).empty().append(r); + t.toggleEditor(postid, 0); + }); + }, + + save : function(postid, nonce) { + var data, target = this.getTarget(postid), history = this.filterHistory(postid, 0); + + if ( '' == history ) + return false; + + this.toggleEditor(postid, 1); + data = { + 'action': 'image-editor', + '_ajax_nonce': nonce, + 'postid': postid, + 'history': history, + 'target': target, + 'do': 'save' + }; + + $.post(ajaxurl, data, function(r) { + var ret = JSON.parse(r); + + if ( ret.error ) { + $('#imgedit-response-' + postid).html('

    ' + ret.error + '

    '); + imageEdit.close(postid); + return; + } + + if ( ret.fw && ret.fh ) + $('#media-dims-' + postid).html( ret.fw + ' × ' + ret.fh ); + + if ( ret.thumbnail ) + $('.thumbnail', '#thumbnail-head-' + postid).attr('src', ''+ret.thumbnail); + + if ( ret.msg ) + $('#imgedit-response-' + postid).html('

    ' + ret.msg + '

    '); + + imageEdit.close(postid); + }); + }, + + open : function(postid, nonce) { + var data, elem = $('#image-editor-' + postid), head = $('#media-head-' + postid), + btn = $('#imgedit-open-btn-' + postid), spin = btn.siblings('img'); + + btn.prop('disabled', true); + spin.css('visibility', 'visible'); + + data = { + 'action': 'image-editor', + '_ajax_nonce': nonce, + 'postid': postid, + 'do': 'open' + }; + + elem.load(ajaxurl, data, function() { + elem.fadeIn('fast'); + head.fadeOut('fast', function(){ + btn.removeAttr('disabled'); + spin.css('visibility', 'hidden'); + }); + }); + }, + + imgLoaded : function(postid) { + var img = $('#image-preview-' + postid), parent = $('#imgedit-crop-' + postid); + + this.initCrop(postid, img, parent); + this.setCropSelection(postid, 0); + this.toggleEditor(postid, 0); + }, + + initCrop : function(postid, image, parent) { + var t = this, selW = $('#imgedit-sel-width-' + postid), + selH = $('#imgedit-sel-height-' + postid); + + t.iasapi = $(image).imgAreaSelect({ + parent: parent, + instance: true, + handles: true, + keys: true, + minWidth: 3, + minHeight: 3, + + onInit: function(img, c) { + parent.children().mousedown(function(e){ + var ratio = false, sel, defRatio; + + if ( e.shiftKey ) { + sel = t.iasapi.getSelection(); + defRatio = t.getSelRatio(postid); + ratio = ( sel && sel.width && sel.height ) ? sel.width + ':' + sel.height : defRatio; + } + + t.iasapi.setOptions({ + aspectRatio: ratio + }); + }); + }, + + onSelectStart: function(img, c) { + imageEdit.setDisabled($('#imgedit-crop-sel-' + postid), 1); + }, + + onSelectEnd: function(img, c) { + imageEdit.setCropSelection(postid, c); + }, + + onSelectChange: function(img, c) { + var sizer = imageEdit.hold.sizer; + selW.val( imageEdit.round(c.width / sizer) ); + selH.val( imageEdit.round(c.height / sizer) ); + } + }); + }, + + setCropSelection : function(postid, c) { + var sel, min = $('#imgedit-minthumb-' + postid).val() || '128:128', + sizer = this.hold['sizer']; + min = min.split(':'); + c = c || 0; + + if ( !c || ( c.width < 3 && c.height < 3 ) ) { + this.setDisabled($('.imgedit-crop', '#imgedit-panel-' + postid), 0); + this.setDisabled($('#imgedit-crop-sel-' + postid), 0); + $('#imgedit-sel-width-' + postid).val(''); + $('#imgedit-sel-height-' + postid).val(''); + $('#imgedit-selection-' + postid).val(''); + return false; + } + + if ( c.width < (min[0] * sizer) && c.height < (min[1] * sizer) ) { + this.setDisabled($('.imgedit-crop', '#imgedit-panel-' + postid), 0); + $('#imgedit-selection-' + postid).val(''); + return false; + } + + sel = { 'x': c.x1, 'y': c.y1, 'w': c.width, 'h': c.height }; + this.setDisabled($('.imgedit-crop', '#imgedit-panel-' + postid), 1); + $('#imgedit-selection-' + postid).val( JSON.stringify(sel) ); + }, + + close : function(postid, warn) { + warn = warn || false; + + if ( warn && this.notsaved(postid) ) + return false; + + this.iasapi = {}; + this.hold = {}; + $('#image-editor-' + postid).fadeOut('fast', function() { + $('#media-head-' + postid).fadeIn('fast'); + $(this).empty(); + }); + }, + + notsaved : function(postid) { + var h = $('#imgedit-history-' + postid).val(), + history = (h != '') ? JSON.parse(h) : new Array(), + pop = this.intval( $('#imgedit-undone-' + postid).val() ); + + if ( pop < history.length ) { + if ( confirm( $('#imgedit-leaving-' + postid).html() ) ) + return false; + return true; + } + return false; + }, + + addStep : function(op, postid, nonce) { + var t = this, elem = $('#imgedit-history-' + postid), + history = (elem.val() != '') ? JSON.parse(elem.val()) : new Array(), + undone = $('#imgedit-undone-' + postid), + pop = t.intval(undone.val()); + + while ( pop > 0 ) { + history.pop(); + pop--; + } + undone.val(0); // reset + + history.push(op); + elem.val( JSON.stringify(history) ); + + t.refreshEditor(postid, nonce, function() { + t.setDisabled($('#image-undo-' + postid), true); + t.setDisabled($('#image-redo-' + postid), false); + }); + }, + + rotate : function(angle, postid, nonce, t) { + if ( $(t).hasClass('disabled') ) + return false; + + this.addStep({ 'r': { 'r': angle, 'fw': this.hold['h'], 'fh': this.hold['w'] }}, postid, nonce); + }, + + flip : function (axis, postid, nonce, t) { + if ( $(t).hasClass('disabled') ) + return false; + + this.addStep({ 'f': { 'f': axis, 'fw': this.hold['w'], 'fh': this.hold['h'] }}, postid, nonce); + }, + + crop : function (postid, nonce, t) { + var sel = $('#imgedit-selection-' + postid).val(), + w = this.intval( $('#imgedit-sel-width-' + postid).val() ), + h = this.intval( $('#imgedit-sel-height-' + postid).val() ); + + if ( $(t).hasClass('disabled') || sel == '' ) + return false; + + sel = JSON.parse(sel); + if ( sel.w > 0 && sel.h > 0 && w > 0 && h > 0 ) { + sel['fw'] = w; + sel['fh'] = h; + this.addStep({ 'c': sel }, postid, nonce); + } + }, + + undo : function (postid, nonce) { + var t = this, button = $('#image-undo-' + postid), elem = $('#imgedit-undone-' + postid), + pop = t.intval( elem.val() ) + 1; + + if ( button.hasClass('disabled') ) + return; + + elem.val(pop); + t.refreshEditor(postid, nonce, function() { + var elem = $('#imgedit-history-' + postid), + history = (elem.val() != '') ? JSON.parse(elem.val()) : new Array(); + + t.setDisabled($('#image-redo-' + postid), true); + t.setDisabled(button, pop < history.length); + }); + }, + + redo : function(postid, nonce) { + var t = this, button = $('#image-redo-' + postid), elem = $('#imgedit-undone-' + postid), + pop = t.intval( elem.val() ) - 1; + + if ( button.hasClass('disabled') ) + return; + + elem.val(pop); + t.refreshEditor(postid, nonce, function() { + t.setDisabled($('#image-undo-' + postid), true); + t.setDisabled(button, pop > 0); + }); + }, + + setNumSelection : function(postid) { + var sel, elX = $('#imgedit-sel-width-' + postid), elY = $('#imgedit-sel-height-' + postid), + x = this.intval( elX.val() ), y = this.intval( elY.val() ), + img = $('#image-preview-' + postid), imgh = img.height(), imgw = img.width(), + sizer = this.hold['sizer'], x1, y1, x2, y2, ias = this.iasapi; + + if ( x < 1 ) { + elX.val(''); + return false; + } + + if ( y < 1 ) { + elY.val(''); + return false; + } + + if ( x && y && ( sel = ias.getSelection() ) ) { + x2 = sel.x1 + Math.round( x * sizer ); + y2 = sel.y1 + Math.round( y * sizer ); + x1 = sel.x1; + y1 = sel.y1; + + if ( x2 > imgw ) { + x1 = 0; + x2 = imgw; + elX.val( Math.round( x2 / sizer ) ); + } + + if ( y2 > imgh ) { + y1 = 0; + y2 = imgh; + elY.val( Math.round( y2 / sizer ) ); + } + + ias.setSelection( x1, y1, x2, y2 ); + ias.update(); + this.setCropSelection(postid, ias.getSelection()); + } + }, + + round : function(num) { + var s; + num = Math.round(num); + + if ( this.hold.sizer > 0.6 ) + return num; + + s = num.toString().slice(-1); + + if ( '1' == s ) + return num - 1; + else if ( '9' == s ) + return num + 1; + + return num; + }, + + setRatioSelection : function(postid, n, el) { + var sel, r, x = this.intval( $('#imgedit-crop-width-' + postid).val() ), + y = this.intval( $('#imgedit-crop-height-' + postid).val() ), + h = $('#image-preview-' + postid).height(); + + if ( !this.intval( $(el).val() ) ) { + $(el).val(''); + return; + } + + if ( x && y ) { + this.iasapi.setOptions({ + aspectRatio: x + ':' + y + }); + + if ( sel = this.iasapi.getSelection(true) ) { + r = Math.ceil( sel.y1 + ((sel.x2 - sel.x1) / (x / y)) ); + + if ( r > h ) { + r = h; + if ( n ) + $('#imgedit-crop-height-' + postid).val(''); + else + $('#imgedit-crop-width-' + postid).val(''); + } + + this.iasapi.setSelection( sel.x1, sel.y1, sel.x2, r ); + this.iasapi.update(); + } + } + } +} +})(jQuery); diff --git a/src/wp-admin/js/image-edit.js b/src/wp-admin/js/image-edit.js new file mode 100644 index 0000000..27a2d04 --- /dev/null +++ b/src/wp-admin/js/image-edit.js @@ -0,0 +1 @@ +var imageEdit;(function(a){imageEdit={iasapi:{},hold:{},postid:"",intval:function(b){return b|0},setDisabled:function(c,b){if(b){c.removeClass("disabled");a("input",c).removeAttr("disabled")}else{c.addClass("disabled");a("input",c).prop("disabled",true)}},init:function(g,e){var d=this,c=a("#image-editor-"+d.postid),b=d.intval(a("#imgedit-x-"+g).val()),f=d.intval(a("#imgedit-y-"+g).val());if(d.postid!=g&&c.length){d.close(d.postid)}d.hold.w=d.hold.ow=b;d.hold.h=d.hold.oh=f;d.hold.xy_ratio=b/f;d.hold.sizer=parseFloat(a("#imgedit-sizer-"+g).val());d.postid=g;a("#imgedit-response-"+g).empty();a('input[type="text"]',"#imgedit-panel-"+g).keypress(function(i){var h=i.keyCode;if(36this.hold.oh)||(c&&c>this.hold.ow)){g.css("visibility","visible")}else{g.css("visibility","hidden")}},getSelRatio:function(f){var b=this.hold.w,e=this.hold.h,d=this.intval(a("#imgedit-crop-width-"+f).val()),c=this.intval(a("#imgedit-crop-height-"+f).val());if(d&&c){return d+":"+c}if(b&&e){return b+":"+e}return"1:1"},filterHistory:function(j,f){var d=a("#imgedit-history-"+j).val(),b,h,e,c,g=[];if(d!=""){d=JSON.parse(d);b=this.intval(a("#imgedit-undone-"+j).val());if(b>0){while(b>0){d.pop();b--}}if(f){if(!d.length){this.hold.w=this.hold.ow;this.hold.h=this.hold.oh;return""}e=d[d.length-1];e=e.c||e.r||e.f||false;if(e){this.hold.w=e.fw;this.hold.h=e.fh}}for(h in d){c=d[h];if(c.hasOwnProperty("c")){g[h]={c:{x:c.c.x,y:c.c.y,w:c.c.w,h:c.c.h}}}else{if(c.hasOwnProperty("r")){g[h]={r:c.r.r}}else{if(c.hasOwnProperty("f")){g[h]={f:c.f.f}}}}}return JSON.stringify(g)}return""},refreshEditor:function(g,d,f){var c=this,e,b;c.toggleEditor(g,1);e={action:"imgedit-preview",_ajax_nonce:d,postid:g,history:c.filterHistory(g,1),rand:c.intval(Math.random()*1000000)};b=a('');b.load(function(){var i,h,k=a("#imgedit-crop-"+g),j=imageEdit;k.empty().append(b);i=Math.max(j.hold.w,j.hold.h);h=Math.max(a(b).width(),a(b).height());j.hold.sizer=i>h?h/i:1;j.initCrop(g,b,k);j.setCropSelection(g,0);if((typeof f!="unknown")&&f!=null){f()}if(a("#imgedit-history-"+g).val()&&a("#imgedit-undone-"+g).val()==0){a("input.imgedit-submit-btn","#imgedit-panel-"+g).removeAttr("disabled")}else{a("input.imgedit-submit-btn","#imgedit-panel-"+g).prop("disabled",true)}j.toggleEditor(g,0)}).attr("src",ajaxurl+"?"+a.param(e))},action:function(b,g,c){var j=this,e,i,f,d,k;if(j.notsaved(b)){return false}e={action:"image-editor",_ajax_nonce:g,postid:b};if("scale"==c){i=a("#imgedit-scale-width-"+b),f=a("#imgedit-scale-height-"+b),d=j.intval(i.val()),k=j.intval(f.val());if(d<1){i.focus();return false}else{if(k<1){f.focus();return false}}if(d==j.hold.ow||k==j.hold.oh){return false}e["do"]="scale";e.fwidth=d;e.fheight=k}else{if("restore"==c){e["do"]="restore"}else{return false}}j.toggleEditor(b,1);a.post(ajaxurl,e,function(h){a("#image-editor-"+b).empty().append(h);j.toggleEditor(b,0)})},save:function(f,b){var c,e=this.getTarget(f),d=this.filterHistory(f,0);if(""==d){return false}this.toggleEditor(f,1);c={action:"image-editor",_ajax_nonce:b,postid:f,history:d,target:e,"do":"save"};a.post(ajaxurl,c,function(h){var g=JSON.parse(h);if(g.error){a("#imgedit-response-"+f).html('

    '+g.error+"

    ");imageEdit.close(f);return}if(g.fw&&g.fh){a("#media-dims-"+f).html(g.fw+" × "+g.fh)}if(g.thumbnail){a(".thumbnail","#thumbnail-head-"+f).attr("src",""+g.thumbnail)}if(g.msg){a("#imgedit-response-"+f).html('

    '+g.msg+"

    ")}imageEdit.close(f)})},open:function(h,d){var f,e=a("#image-editor-"+h),c=a("#media-head-"+h),b=a("#imgedit-open-btn-"+h),g=b.siblings("img");b.prop("disabled",true);g.css("visibility","visible");f={action:"image-editor",_ajax_nonce:d,postid:h,"do":"open"};e.load(ajaxurl,f,function(){e.fadeIn("fast");c.fadeOut("fast",function(){b.removeAttr("disabled");g.css("visibility","hidden")})})},imgLoaded:function(d){var b=a("#image-preview-"+d),c=a("#imgedit-crop-"+d);this.initCrop(d,b,c);this.setCropSelection(d,0);this.toggleEditor(d,0)},initCrop:function(g,e,c){var b=this,d=a("#imgedit-sel-width-"+g),f=a("#imgedit-sel-height-"+g);b.iasapi=a(e).imgAreaSelect({parent:c,instance:true,handles:true,keys:true,minWidth:3,minHeight:3,onInit:function(h,i){c.children().mousedown(function(m){var k=false,l,j;if(m.shiftKey){l=b.iasapi.getSelection();j=b.getSelRatio(g);k=(l&&l.width&&l.height)?l.width+":"+l.height:j}b.iasapi.setOptions({aspectRatio:k})})},onSelectStart:function(h,i){imageEdit.setDisabled(a("#imgedit-crop-sel-"+g),1)},onSelectEnd:function(h,i){imageEdit.setCropSelection(g,i)},onSelectChange:function(h,j){var i=imageEdit.hold.sizer;d.val(imageEdit.round(j.width/i));f.val(imageEdit.round(j.height/i))}})},setCropSelection:function(g,f){var e,b=a("#imgedit-minthumb-"+g).val()||"128:128",d=this.hold.sizer;b=b.split(":");f=f||0;if(!f||(f.width<3&&f.height<3)){this.setDisabled(a(".imgedit-crop","#imgedit-panel-"+g),0);this.setDisabled(a("#imgedit-crop-sel-"+g),0);a("#imgedit-sel-width-"+g).val("");a("#imgedit-sel-height-"+g).val("");a("#imgedit-selection-"+g).val("");return false}if(f.width<(b[0]*d)&&f.height<(b[1]*d)){this.setDisabled(a(".imgedit-crop","#imgedit-panel-"+g),0);a("#imgedit-selection-"+g).val("");return false}e={x:f.x1,y:f.y1,w:f.width,h:f.height};this.setDisabled(a(".imgedit-crop","#imgedit-panel-"+g),1);a("#imgedit-selection-"+g).val(JSON.stringify(e))},close:function(c,b){b=b||false;if(b&&this.notsaved(c)){return false}this.iasapi={};this.hold={};a("#image-editor-"+c).fadeOut("fast",function(){a("#media-head-"+c).fadeIn("fast");a(this).empty()})},notsaved:function(e){var c=a("#imgedit-history-"+e).val(),d=(c!="")?JSON.parse(c):new Array(),b=this.intval(a("#imgedit-undone-"+e).val());if(b0){g.pop();b--}f.val(0);g.push(i);e.val(JSON.stringify(g));c.refreshEditor(h,d,function(){c.setDisabled(a("#image-undo-"+h),true);c.setDisabled(a("#image-redo-"+h),false)})},rotate:function(d,e,c,b){if(a(b).hasClass("disabled")){return false}this.addStep({r:{r:d,fw:this.hold.h,fh:this.hold.w}},e,c)},flip:function(d,e,c,b){if(a(b).hasClass("disabled")){return false}this.addStep({f:{f:d,fw:this.hold.w,fh:this.hold.h}},e,c)},crop:function(g,e,c){var f=a("#imgedit-selection-"+g).val(),b=this.intval(a("#imgedit-sel-width-"+g).val()),d=this.intval(a("#imgedit-sel-height-"+g).val());if(a(c).hasClass("disabled")||f==""){return false}f=JSON.parse(f);if(f.w>0&&f.h>0&&b>0&&d>0){f.fw=b;f.fh=d;this.addStep({c:f},g,e)}},undo:function(g,e){var d=this,c=a("#image-undo-"+g),f=a("#imgedit-undone-"+g),b=d.intval(f.val())+1;if(c.hasClass("disabled")){return}f.val(b);d.refreshEditor(g,e,function(){var h=a("#imgedit-history-"+g),i=(h.val()!="")?JSON.parse(h.val()):new Array();d.setDisabled(a("#image-redo-"+g),true);d.setDisabled(c,b0)})},setNumSelection:function(c){var g,k=a("#imgedit-sel-width-"+c),j=a("#imgedit-sel-height-"+c),o=this.intval(k.val()),m=this.intval(j.val()),i=a("#image-preview-"+c),p=i.height(),h=i.width(),b=this.hold.sizer,f,n,e,l,d=this.iasapi;if(o<1){k.val("");return false}if(m<1){j.val("");return false}if(o&&m&&(g=d.getSelection())){e=g.x1+Math.round(o*b);l=g.y1+Math.round(m*b);f=g.x1;n=g.y1;if(e>h){f=0;e=h;k.val(Math.round(e/b))}if(l>p){n=0;l=p;j.val(Math.round(l/b))}d.setSelection(f,n,e,l);d.update();this.setCropSelection(c,d.getSelection())}},round:function(b){var c;b=Math.round(b);if(this.hold.sizer>0.6){return b}c=b.toString().slice(-1);if("1"==c){return b-1}else{if("9"==c){return b+1}}return b},setRatioSelection:function(j,i,d){var f,e,b=this.intval(a("#imgedit-crop-width-"+j).val()),g=this.intval(a("#imgedit-crop-height-"+j).val()),c=a("#image-preview-"+j).height();if(!this.intval(a(d).val())){a(d).val("");return}if(b&&g){this.iasapi.setOptions({aspectRatio:b+":"+g});if(f=this.iasapi.getSelection(true)){e=Math.ceil(f.y1+((f.x2-f.x1)/(b/g)));if(e>c){e=c;if(i){a("#imgedit-crop-height-"+j).val("")}else{a("#imgedit-crop-width-"+j).val("")}}this.iasapi.setSelection(f.x1,f.y1,f.x2,e);this.iasapi.update()}}}}})(jQuery); \ No newline at end of file diff --git a/src/wp-admin/js/inline-edit-post.dev.js b/src/wp-admin/js/inline-edit-post.dev.js new file mode 100644 index 0000000..b470c33 --- /dev/null +++ b/src/wp-admin/js/inline-edit-post.dev.js @@ -0,0 +1,290 @@ +(function($) { +inlineEditPost = { + + init : function(){ + var t = this, qeRow = $('#inline-edit'), bulkRow = $('#bulk-edit'); + + t.type = $('table.widefat').hasClass('pages') ? 'page' : 'post'; + t.what = '#post-'; + + // prepare the edit rows + qeRow.keyup(function(e){ + if (e.which == 27) + return inlineEditPost.revert(); + }); + bulkRow.keyup(function(e){ + if (e.which == 27) + return inlineEditPost.revert(); + }); + + $('a.cancel', qeRow).click(function(){ + return inlineEditPost.revert(); + }); + $('a.save', qeRow).click(function(){ + return inlineEditPost.save(this); + }); + $('td', qeRow).keydown(function(e){ + if ( e.which == 13 ) + return inlineEditPost.save(this); + }); + + $('a.cancel', bulkRow).click(function(){ + return inlineEditPost.revert(); + }); + + $('#inline-edit .inline-edit-private input[value="private"]').click( function(){ + var pw = $('input.inline-edit-password-input'); + if ( $(this).prop('checked') ) { + pw.val('').prop('disabled', true); + } else { + pw.prop('disabled', false); + } + }); + + // add events + $('a.editinline').live('click', function(){ + inlineEditPost.edit(this); + return false; + }); + + $('#bulk-title-div').parents('fieldset').after( + $('#inline-edit fieldset.inline-edit-categories').clone() + ).siblings( 'fieldset:last' ).prepend( + $('#inline-edit label.inline-edit-tags').clone() + ); + + // hiearchical taxonomies expandable? + $('span.catshow').click(function(){ + $(this).hide().next().show().parent().next().addClass("cat-hover"); + }); + + $('span.cathide').click(function(){ + $(this).hide().prev().show().parent().next().removeClass("cat-hover"); + }); + + $('select[name="_status"] option[value="future"]', bulkRow).remove(); + + $('#doaction, #doaction2').click(function(e){ + var n = $(this).attr('id').substr(2); + if ( $('select[name="'+n+'"]').val() == 'edit' ) { + e.preventDefault(); + t.setBulk(); + } else if ( $('form#posts-filter tr.inline-editor').length > 0 ) { + t.revert(); + } + }); + + $('#post-query-submit').mousedown(function(e){ + t.revert(); + $('select[name^="action"]').val('-1'); + }); + }, + + toggle : function(el){ + var t = this; + $(t.what+t.getId(el)).css('display') == 'none' ? t.revert() : t.edit(el); + }, + + setBulk : function(){ + var te = '', type = this.type, tax, c = true; + this.revert(); + + $('#bulk-edit td').attr('colspan', $('.widefat:first thead th:visible').length); + $('table.widefat tbody').prepend( $('#bulk-edit') ); + $('#bulk-edit').addClass('inline-editor').show(); + + $('tbody th.check-column input[type="checkbox"]').each(function(i){ + if ( $(this).prop('checked') ) { + c = false; + var id = $(this).val(), theTitle; + theTitle = $('#inline_'+id+' .post_title').text() || inlineEditL10n.notitle; + te += '
    X'+theTitle+'
    '; + } + }); + + if ( c ) + return this.revert(); + + $('#bulk-titles').html(te); + $('#bulk-titles a').click(function(){ + var id = $(this).attr('id').substr(1); + + $('table.widefat input[value="' + id + '"]').prop('checked', false); + $('#ttle'+id).remove(); + }); + + // enable autocomplete for tags + if ( 'post' == type ) { + // support multi taxonomies? + tax = 'post_tag'; + $('tr.inline-editor textarea[name="tags_input"]').suggest( 'admin-ajax.php?action=ajax-tag-search&tax='+tax, { delay: 500, minchars: 2, multiple: true, multipleSep: ", " } ); + } + $('html, body').animate( { scrollTop: 0 }, 'fast' ); + }, + + edit : function(id) { + var t = this, fields, editRow, rowData, cats, status, pageOpt, pageLevel, nextPage, pageLoop = true, nextLevel, tax; + t.revert(); + + if ( typeof(id) == 'object' ) + id = t.getId(id); + + fields = ['post_title', 'post_name', 'post_author', '_status', 'jj', 'mm', 'aa', 'hh', 'mn', 'ss', 'post_password']; + if ( t.type == 'page' ) + fields.push('post_parent', 'menu_order', 'page_template'); + + // add the new blank row + editRow = $('#inline-edit').clone(true); + $('td', editRow).attr('colspan', $('.widefat:first thead th:visible').length); + + if ( $(t.what+id).hasClass('alternate') ) + $(editRow).addClass('alternate'); + $(t.what+id).hide().after(editRow); + + // populate the data + rowData = $('#inline_'+id); + if ( !$(':input[name="post_author"] option[value="' + $('.post_author', rowData).text() + '"]', editRow).val() ) { + // author no longer has edit caps, so we need to add them to the list of authors + $(':input[name="post_author"]', editRow).prepend(''); + } + if ( $(':input[name="post_author"] option', editRow).length == 1 ) { + $('label.inline-edit-author', editRow).hide(); + } + + for ( var f = 0; f < fields.length; f++ ) { + $(':input[name="' + fields[f] + '"]', editRow).val( $('.'+fields[f], rowData).text() ); + } + + if ( $('.comment_status', rowData).text() == 'open' ) + $('input[name="comment_status"]', editRow).prop("checked", true); + if ( $('.ping_status', rowData).text() == 'open' ) + $('input[name="ping_status"]', editRow).prop("checked", true); + if ( $('.sticky', rowData).text() == 'sticky' ) + $('input[name="sticky"]', editRow).prop("checked", true); + + // hierarchical taxonomies + $('.post_category', rowData).each(function(){ + var term_ids = $(this).text(); + + if ( term_ids ) { + taxname = $(this).attr('id').replace('_'+id, ''); + $('ul.'+taxname+'-checklist :checkbox', editRow).val(term_ids.split(',')); + } + }); + //flat taxonomies + $('.tags_input', rowData).each(function(){ + var terms = $(this).text(); + + if ( terms ) { + taxname = $(this).attr('id').replace('_'+id, ''); + $('textarea.tax_input_'+taxname, editRow).val(terms); + $('textarea.tax_input_'+taxname, editRow).suggest( 'admin-ajax.php?action=ajax-tag-search&tax='+taxname, { delay: 500, minchars: 2, multiple: true, multipleSep: ", " } ); + } + }); + + + // handle the post status + status = $('._status', rowData).text(); + if ( 'future' != status ) + $('select[name="_status"] option[value="future"]', editRow).remove(); + + if ( 'private' == status ) { + $('input[name="keep_private"]', editRow).prop("checked", true); + $('input.inline-edit-password-input').val('').prop('disabled', true); + } + + // remove the current page and children from the parent dropdown + pageOpt = $('select[name="post_parent"] option[value="' + id + '"]', editRow); + if ( pageOpt.length > 0 ) { + pageLevel = pageOpt[0].className.split('-')[1]; + nextPage = pageOpt; + while ( pageLoop ) { + nextPage = nextPage.next('option'); + if (nextPage.length == 0) break; + nextLevel = nextPage[0].className.split('-')[1]; + if ( nextLevel <= pageLevel ) { + pageLoop = false; + } else { + nextPage.remove(); + nextPage = pageOpt; + } + } + pageOpt.remove(); + } + + $(editRow).attr('id', 'edit-'+id).addClass('inline-editor').show(); + $('.ptitle', editRow).focus(); + + return false; + }, + + save : function(id) { + var params, fields, page = $('.post_status_page').val() || ''; + + if ( typeof(id) == 'object' ) + id = this.getId(id); + + $('table.widefat .inline-edit-save .waiting').show(); + + params = { + action: 'inline-save', + post_type: typenow, + post_ID: id, + edit_date: 'true', + post_status: page + }; + + fields = $('#edit-'+id+' :input').serialize(); + params = fields + '&' + $.param(params); + + // make ajax request + $.post('admin-ajax.php', params, + function(r) { + $('table.widefat .inline-edit-save .waiting').hide(); + + if (r) { + if ( -1 != r.indexOf(']*?>/g, '' ); + $('#edit-'+id+' .inline-edit-save .error').html(r).show(); + } + } else { + $('#edit-'+id+' .inline-edit-save .error').html(inlineEditL10n.error).show(); + } + } + , 'html'); + return false; + }, + + revert : function(){ + var id = $('table.widefat tr.inline-editor').attr('id'); + + if ( id ) { + $('table.widefat .inline-edit-save .waiting').hide(); + + if ( 'bulk-edit' == id ) { + $('table.widefat #bulk-edit').removeClass('inline-editor').hide(); + $('#bulk-titles').html(''); + $('#inlineedit').append( $('#bulk-edit') ); + } else { + $('#'+id).remove(); + id = id.substr( id.lastIndexOf('-') + 1 ); + $(this.what+id).show(); + } + } + + return false; + }, + + getId : function(o) { + var id = $(o).closest('tr').attr('id'), + parts = id.split('-'); + return parts[parts.length - 1]; + } +}; + +$(document).ready(function(){inlineEditPost.init();}); +})(jQuery); diff --git a/src/wp-admin/js/inline-edit-post.js b/src/wp-admin/js/inline-edit-post.js new file mode 100644 index 0000000..b72bd87 --- /dev/null +++ b/src/wp-admin/js/inline-edit-post.js @@ -0,0 +1 @@ +(function(a){inlineEditPost={init:function(){var c=this,d=a("#inline-edit"),b=a("#bulk-edit");c.type=a("table.widefat").hasClass("pages")?"page":"post";c.what="#post-";d.keyup(function(f){if(f.which==27){return inlineEditPost.revert()}});b.keyup(function(f){if(f.which==27){return inlineEditPost.revert()}});a("a.cancel",d).click(function(){return inlineEditPost.revert()});a("a.save",d).click(function(){return inlineEditPost.save(this)});a("td",d).keydown(function(f){if(f.which==13){return inlineEditPost.save(this)}});a("a.cancel",b).click(function(){return inlineEditPost.revert()});a('#inline-edit .inline-edit-private input[value="private"]').click(function(){var e=a("input.inline-edit-password-input");if(a(this).prop("checked")){e.val("").prop("disabled",true)}else{e.prop("disabled",false)}});a("a.editinline").live("click",function(){inlineEditPost.edit(this);return false});a("#bulk-title-div").parents("fieldset").after(a("#inline-edit fieldset.inline-edit-categories").clone()).siblings("fieldset:last").prepend(a("#inline-edit label.inline-edit-tags").clone());a("span.catshow").click(function(){a(this).hide().next().show().parent().next().addClass("cat-hover")});a("span.cathide").click(function(){a(this).hide().prev().show().parent().next().removeClass("cat-hover")});a('select[name="_status"] option[value="future"]',b).remove();a("#doaction, #doaction2").click(function(f){var g=a(this).attr("id").substr(2);if(a('select[name="'+g+'"]').val()=="edit"){f.preventDefault();c.setBulk()}else{if(a("form#posts-filter tr.inline-editor").length>0){c.revert()}}});a("#post-query-submit").mousedown(function(f){c.revert();a('select[name^="action"]').val("-1")})},toggle:function(c){var b=this;a(b.what+b.getId(c)).css("display")=="none"?b.revert():b.edit(c)},setBulk:function(){var e="",d=this.type,b,f=true;this.revert();a("#bulk-edit td").attr("colspan",a(".widefat:first thead th:visible").length);a("table.widefat tbody").prepend(a("#bulk-edit"));a("#bulk-edit").addClass("inline-editor").show();a('tbody th.check-column input[type="checkbox"]').each(function(g){if(a(this).prop("checked")){f=false;var h=a(this).val(),c;c=a("#inline_"+h+" .post_title").text()||inlineEditL10n.notitle;e+='
    X'+c+"
    "}});if(f){return this.revert()}a("#bulk-titles").html(e);a("#bulk-titles a").click(function(){var c=a(this).attr("id").substr(1);a('table.widefat input[value="'+c+'"]').prop("checked",false);a("#ttle"+c).remove()});if("post"==d){b="post_tag";a('tr.inline-editor textarea[name="tags_input"]').suggest("admin-ajax.php?action=ajax-tag-search&tax="+b,{delay:500,minchars:2,multiple:true,multipleSep:", "})}a("html, body").animate({scrollTop:0},"fast")},edit:function(b){var o=this,j,d,g,n,i,h,m,l,c=true,p,e;o.revert();if(typeof(b)=="object"){b=o.getId(b)}j=["post_title","post_name","post_author","_status","jj","mm","aa","hh","mn","ss","post_password"];if(o.type=="page"){j.push("post_parent","menu_order","page_template")}d=a("#inline-edit").clone(true);a("td",d).attr("colspan",a(".widefat:first thead th:visible").length);if(a(o.what+b).hasClass("alternate")){a(d).addClass("alternate")}a(o.what+b).hide().after(d);g=a("#inline_"+b);if(!a(':input[name="post_author"] option[value="'+a(".post_author",g).text()+'"]',d).val()){a(':input[name="post_author"]',d).prepend('")}if(a(':input[name="post_author"] option',d).length==1){a("label.inline-edit-author",d).hide()}for(var k=0;k0){m=h[0].className.split("-")[1];l=h;while(c){l=l.next("option");if(l.length==0){break}p=l[0].className.split("-")[1];if(p<=m){c=false}else{l.remove();l=h}}h.remove()}a(d).attr("id","edit-"+b).addClass("inline-editor").show();a(".ptitle",d).focus();return false},save:function(e){var d,b,c=a(".post_status_page").val()||"";if(typeof(e)=="object"){e=this.getId(e)}a("table.widefat .inline-edit-save .waiting").show();d={action:"inline-save",post_type:typenow,post_ID:e,edit_date:"true",post_status:c};b=a("#edit-"+e+" :input").serialize();d=b+"&"+a.param(d);a.post("admin-ajax.php",d,function(f){a("table.widefat .inline-edit-save .waiting").hide();if(f){if(-1!=f.indexOf("]*?>/g,"");a("#edit-"+e+" .inline-edit-save .error").html(f).show()}}else{a("#edit-"+e+" .inline-edit-save .error").html(inlineEditL10n.error).show()}},"html");return false},revert:function(){var b=a("table.widefat tr.inline-editor").attr("id");if(b){a("table.widefat .inline-edit-save .waiting").hide();if("bulk-edit"==b){a("table.widefat #bulk-edit").removeClass("inline-editor").hide();a("#bulk-titles").html("");a("#inlineedit").append(a("#bulk-edit"))}else{a("#"+b).remove();b=b.substr(b.lastIndexOf("-")+1);a(this.what+b).show()}}return false},getId:function(c){var d=a(c).closest("tr").attr("id"),b=d.split("-");return b[b.length-1]}};a(document).ready(function(){inlineEditPost.init()})})(jQuery); \ No newline at end of file diff --git a/src/wp-admin/js/inline-edit-tax.dev.js b/src/wp-admin/js/inline-edit-tax.dev.js new file mode 100644 index 0000000..333bf6b --- /dev/null +++ b/src/wp-admin/js/inline-edit-tax.dev.js @@ -0,0 +1,118 @@ + +(function($) { +inlineEditTax = { + + init : function() { + var t = this, row = $('#inline-edit'); + + t.type = $('#the-list').attr('class').substr(5); + t.what = '#'+t.type+'-'; + + $('.editinline').live('click', function(){ + inlineEditTax.edit(this); + return false; + }); + + // prepare the edit row + row.keyup(function(e) { if(e.which == 27) return inlineEditTax.revert(); }); + + $('a.cancel', row).click(function() { return inlineEditTax.revert(); }); + $('a.save', row).click(function() { return inlineEditTax.save(this); }); + $('input, select', row).keydown(function(e) { if(e.which == 13) return inlineEditTax.save(this); }); + + $('#posts-filter input[type="submit"]').mousedown(function(e){ + t.revert(); + }); + }, + + toggle : function(el) { + var t = this; + $(t.what+t.getId(el)).css('display') == 'none' ? t.revert() : t.edit(el); + }, + + edit : function(id) { + var t = this, editRow; + t.revert(); + + if ( typeof(id) == 'object' ) + id = t.getId(id); + + editRow = $('#inline-edit').clone(true), rowData = $('#inline_'+id); + $('td', editRow).attr('colspan', $('.widefat:first thead th:visible').length); + + if ( $(t.what+id).hasClass('alternate') ) + $(editRow).addClass('alternate'); + + $(t.what+id).hide().after(editRow); + + $(':input[name="name"]', editRow).val( $('.name', rowData).text() ); + $(':input[name="slug"]', editRow).val( $('.slug', rowData).text() ); + + $(editRow).attr('id', 'edit-'+id).addClass('inline-editor').show(); + $('.ptitle', editRow).eq(0).focus(); + + return false; + }, + + save : function(id) { + var params, fields, tax = $('input[name="taxonomy"]').val() || ''; + + if( typeof(id) == 'object' ) + id = this.getId(id); + + $('table.widefat .inline-edit-save .waiting').show(); + + params = { + action: 'inline-save-tax', + tax_type: this.type, + tax_ID: id, + taxonomy: tax + }; + + fields = $('#edit-'+id+' :input').serialize(); + params = fields + '&' + $.param(params); + + // make ajax request + $.post('admin-ajax.php', params, + function(r) { + var row, new_id; + $('table.widefat .inline-edit-save .waiting').hide(); + + if (r) { + if ( -1 != r.indexOf('' ).text( name ); + } ); + } ); + }; + + $('#categorychecklist').wpList( { + alt: '', + what: 'link-category', + response: 'category-ajax-response', + addAfter: catAddAfter + } ); + + $('a[href="#categories-all"]').click(function(){deleteUserSetting('cats');}); + $('a[href="#categories-pop"]').click(function(){setUserSetting('cats','pop');}); + if ( 'pop' == getUserSetting('cats') ) + $('a[href="#categories-pop"]').click(); + + $('#category-add-toggle').click( function() { + $(this).parents('div:first').toggleClass( 'wp-hidden-children' ); + $('#category-tabs a[href="#categories-all"]').click(); + $('#newcategory').focus(); + return false; + } ); + + $('.categorychecklist :checkbox').change( syncChecks ).filter( ':checked' ).change(); +}); diff --git a/src/wp-admin/js/link.js b/src/wp-admin/js/link.js new file mode 100644 index 0000000..3feeaeb --- /dev/null +++ b/src/wp-admin/js/link.js @@ -0,0 +1 @@ +jQuery(document).ready(function(c){var b,a=false,d,e;c("#link_name").focus();postboxes.add_postbox_toggles("link");c("#category-tabs a").click(function(){var f=c(this).attr("href");c(this).parent().addClass("tabs").siblings("li").removeClass("tabs");c(".tabs-panel").hide();c(f).show();if("#categories-all"==f){deleteUserSetting("cats")}else{setUserSetting("cats","pop")}return false});if(getUserSetting("cats")){c('#category-tabs a[href="#categories-pop"]').click()}b=c("#newcat").one("focus",function(){c(this).val("").removeClass("form-input-tip")});c("#category-add-submit").click(function(){b.focus()});d=function(){if(a){return}a=true;var f=c(this),h=f.is(":checked"),g=f.val().toString();c("#in-link-category-"+g+", #in-popular-category-"+g).prop("checked",h);a=false};e=function(g,f){c(f.what+" response_data",g).each(function(){var h=c(c(this).text());h.find("label").each(function(){var j=c(this),l=j.find("input").val(),m=j.find("input")[0].id,i=c.trim(j.text()),k;c("#"+m).change(d);k=c('').text(i)})})};c("#categorychecklist").wpList({alt:"",what:"link-category",response:"category-ajax-response",addAfter:e});c('a[href="#categories-all"]').click(function(){deleteUserSetting("cats")});c('a[href="#categories-pop"]').click(function(){setUserSetting("cats","pop")});if("pop"==getUserSetting("cats")){c('a[href="#categories-pop"]').click()}c("#category-add-toggle").click(function(){c(this).parents("div:first").toggleClass("wp-hidden-children");c('#category-tabs a[href="#categories-all"]').click();c("#newcategory").focus();return false});c(".categorychecklist :checkbox").change(d).filter(":checked").change()}); \ No newline at end of file diff --git a/src/wp-admin/js/media-upload.dev.js b/src/wp-admin/js/media-upload.dev.js new file mode 100644 index 0000000..b19f292 --- /dev/null +++ b/src/wp-admin/js/media-upload.dev.js @@ -0,0 +1,72 @@ +// send html to the post editor +function send_to_editor(h) { + var ed; + + if ( typeof tinyMCE != 'undefined' && ( ed = tinyMCE.activeEditor ) && !ed.isHidden() ) { + // restore caret position on IE + if ( tinymce.isIE && ed.windowManager.insertimagebookmark ) + ed.selection.moveToBookmark(ed.windowManager.insertimagebookmark); + + if ( h.indexOf('[caption') === 0 ) { + if ( ed.plugins.wpeditimage ) + h = ed.plugins.wpeditimage._do_shcode(h); + } else if ( h.indexOf('[gallery') === 0 ) { + if ( ed.plugins.wpgallery ) + h = ed.plugins.wpgallery._do_gallery(h); + } else if ( h.indexOf('[embed') === 0 ) { + if ( ed.plugins.wordpress ) + h = ed.plugins.wordpress._setEmbed(h); + } + + ed.execCommand('mceInsertContent', false, h); + + } else if ( typeof edInsertContent == 'function' ) { + edInsertContent(edCanvas, h); + } else { + jQuery( edCanvas ).val( jQuery( edCanvas ).val() + h ); + } + + tb_remove(); +} + +// thickbox settings +var tb_position; +(function($) { + tb_position = function() { + var tbWindow = $('#TB_window'), width = $(window).width(), H = $(window).height(), W = ( 720 < width ) ? 720 : width, adminbar_height = 0; + + if ( $('body.admin-bar').length ) + adminbar_height = 28; + + if ( tbWindow.size() ) { + tbWindow.width( W - 50 ).height( H - 45 - adminbar_height ); + $('#TB_iframeContent').width( W - 50 ).height( H - 75 - adminbar_height ); + tbWindow.css({'margin-left': '-' + parseInt((( W - 50 ) / 2),10) + 'px'}); + if ( typeof document.body.style.maxWidth != 'undefined' ) + tbWindow.css({'top': 20 + adminbar_height + 'px','margin-top':'0'}); + }; + + return $('a.thickbox').each( function() { + var href = $(this).attr('href'); + if ( ! href ) return; + href = href.replace(/&width=[0-9]+/g, ''); + href = href.replace(/&height=[0-9]+/g, ''); + $(this).attr( 'href', href + '&width=' + ( W - 80 ) + '&height=' + ( H - 85 - adminbar_height ) ); + }); + }; + + $(window).resize(function(){ tb_position(); }); + + // store caret position in IE + $(document).ready(function($){ + $('a.thickbox').click(function(){ + var ed; + + if ( typeof tinyMCE != 'undefined' && tinymce.isIE && ( ed = tinyMCE.activeEditor ) && !ed.isHidden() ) { + ed.focus(); + ed.windowManager.insertimagebookmark = ed.selection.getBookmark(); + } + }); + }); + +})(jQuery); diff --git a/src/wp-admin/js/media-upload.js b/src/wp-admin/js/media-upload.js new file mode 100644 index 0000000..201f6ab --- /dev/null +++ b/src/wp-admin/js/media-upload.js @@ -0,0 +1 @@ +function send_to_editor(b){var a;if(typeof tinyMCE!="undefined"&&(a=tinyMCE.activeEditor)&&!a.isHidden()){if(tinymce.isIE&&a.windowManager.insertimagebookmark){a.selection.moveToBookmark(a.windowManager.insertimagebookmark)}if(b.indexOf("[caption")===0){if(a.plugins.wpeditimage){b=a.plugins.wpeditimage._do_shcode(b)}}else{if(b.indexOf("[gallery")===0){if(a.plugins.wpgallery){b=a.plugins.wpgallery._do_gallery(b)}}else{if(b.indexOf("[embed")===0){if(a.plugins.wordpress){b=a.plugins.wordpress._setEmbed(b)}}}}a.execCommand("mceInsertContent",false,b)}else{if(typeof edInsertContent=="function"){edInsertContent(edCanvas,b)}else{jQuery(edCanvas).val(jQuery(edCanvas).val()+b)}}tb_remove()}var tb_position;(function(a){tb_position=function(){var f=a("#TB_window"),e=a(window).width(),d=a(window).height(),c=(720]*?>/g, '' ); + } + if ( er ) { + $('#find-posts-response').html(er); + } + } + }; + + $(document).ready(function() { + $('#find-posts-submit').click(function(e) { + if ( '' == $('#find-posts-response').html() ) + e.preventDefault(); + }); + $( '#find-posts .find-box-search :input' ).keypress( function( event ) { + if ( 13 == event.which ) { + findPosts.send(); + return false; + } + } ); + $( '#find-posts-search' ).click( findPosts.send ); + $( '#find-posts-close' ).click( findPosts.close ); + $('#doaction, #doaction2').click(function(e){ + $('select[name^="action"]').each(function(){ + if ( $(this).val() == 'attach' ) { + e.preventDefault(); + findPosts.open(); + } + }); + }); + }); +})(jQuery); diff --git a/src/wp-admin/js/media.js b/src/wp-admin/js/media.js new file mode 100644 index 0000000..d5bd85b --- /dev/null +++ b/src/wp-admin/js/media.js @@ -0,0 +1 @@ +var findPosts;(function(a){findPosts={open:function(d,c){var b=document.documentElement.scrollTop||a(document).scrollTop();if(d&&c){a("#affected").attr("name",d).val(c)}a("#find-posts").show().draggable({handle:"#find-posts-head"}).css({top:b+50+"px",left:"50%",marginLeft:"-250px"});a("#find-posts-input").focus().keyup(function(f){if(f.which==27){findPosts.close()}});return false},close:function(){a("#find-posts-response").html("");a("#find-posts").draggable("destroy").hide()},send:function(){var b={ps:a("#find-posts-input").val(),action:"find_posts",_ajax_nonce:a("#_ajax_nonce").val()};var c;a("input[@name='itemSelect[]']:checked").each(function(){c=a(this).val()});b.post_type=c;a.ajax({type:"POST",url:ajaxurl,data:b,success:function(d){findPosts.show(d)},error:function(d){findPosts.error(d)}})},show:function(b){if(typeof(b)=="string"){this.error({responseText:b});return}var c=wpAjax.parseAjaxResponse(b);if(c.errors){this.error({responseText:wpAjax.broken})}c=c.responses[0];a("#find-posts-response").html(c.data)},error:function(b){var c=b.statusText;if(b.responseText){c=b.responseText.replace(/<.[^<>]*?>/g,"")}if(c){a("#find-posts-response").html(c)}}};a(document).ready(function(){a("#find-posts-submit").click(function(b){if(""==a("#find-posts-response").html()){b.preventDefault()}});a("#find-posts .find-box-search :input").keypress(function(b){if(13==b.which){findPosts.send();return false}});a("#find-posts-search").click(findPosts.send);a("#find-posts-close").click(findPosts.close);a("#doaction, #doaction2").click(function(b){a('select[name^="action"]').each(function(){if(a(this).val()=="attach"){b.preventDefault();findPosts.open()}})})})})(jQuery); \ No newline at end of file diff --git a/src/wp-admin/js/nav-menu.dev.js b/src/wp-admin/js/nav-menu.dev.js new file mode 100644 index 0000000..33cc6cf --- /dev/null +++ b/src/wp-admin/js/nav-menu.dev.js @@ -0,0 +1,959 @@ +/** + * WordPress Administration Navigation Menu + * Interface JS functions + * + * @version 2.0.0 + * + * @package WordPress + * @subpackage Administration + */ + +var wpNavMenu; + +(function($) { + + var api = wpNavMenu = { + + options : { + menuItemDepthPerLevel : 30, // Do not use directly. Use depthToPx and pxToDepth instead. + globalMaxDepth : 11 + }, + + menuList : undefined, // Set in init. + targetList : undefined, // Set in init. + menusChanged : false, + isRTL: !! ( 'undefined' != typeof isRtl && isRtl ), + negateIfRTL: ( 'undefined' != typeof isRtl && isRtl ) ? -1 : 1, + + // Functions that run on init. + init : function() { + api.menuList = $('#menu-to-edit'); + api.targetList = api.menuList; + + this.jQueryExtensions(); + + this.attachMenuEditListeners(); + + this.setupInputWithDefaultTitle(); + this.attachQuickSearchListeners(); + this.attachThemeLocationsListeners(); + + this.attachTabsPanelListeners(); + + this.attachUnsavedChangesListener(); + + if( api.menuList.length ) // If no menu, we're in the + tab. + this.initSortables(); + + this.initToggles(); + + this.initTabManager(); + }, + + jQueryExtensions : function() { + // jQuery extensions + $.fn.extend({ + menuItemDepth : function() { + var margin = api.isRTL ? this.eq(0).css('margin-right') : this.eq(0).css('margin-left'); + return api.pxToDepth( margin && -1 != margin.indexOf('px') ? margin.slice(0, -2) : 0 ); + }, + updateDepthClass : function(current, prev) { + return this.each(function(){ + var t = $(this); + prev = prev || t.menuItemDepth(); + $(this).removeClass('menu-item-depth-'+ prev ) + .addClass('menu-item-depth-'+ current ); + }); + }, + shiftDepthClass : function(change) { + return this.each(function(){ + var t = $(this), + depth = t.menuItemDepth(); + $(this).removeClass('menu-item-depth-'+ depth ) + .addClass('menu-item-depth-'+ (depth + change) ); + }); + }, + childMenuItems : function() { + var result = $(); + this.each(function(){ + var t = $(this), depth = t.menuItemDepth(), next = t.next(); + while( next.length && next.menuItemDepth() > depth ) { + result = result.add( next ); + next = next.next(); + } + }); + return result; + }, + updateParentMenuItemDBId : function() { + return this.each(function(){ + var item = $(this), + input = item.find('.menu-item-data-parent-id'), + depth = item.menuItemDepth(), + parent = item.prev(); + + if( depth == 0 ) { // Item is on the top level, has no parent + input.val(0); + } else { // Find the parent item, and retrieve its object id. + while( ! parent[0] || ! parent[0].className || -1 == parent[0].className.indexOf('menu-item') || ( parent.menuItemDepth() != depth - 1 ) ) + parent = parent.prev(); + input.val( parent.find('.menu-item-data-db-id').val() ); + } + }); + }, + hideAdvancedMenuItemFields : function() { + return this.each(function(){ + var that = $(this); + $('.hide-column-tog').not(':checked').each(function(){ + that.find('.field-' + $(this).val() ).addClass('hidden-field'); + }); + }); + }, + /** + * Adds selected menu items to the menu. + * + * @param jQuery metabox The metabox jQuery object. + */ + addSelectedToMenu : function(processMethod) { + if ( 0 == $('#menu-to-edit').length ) { + return false; + } + + return this.each(function() { + var t = $(this), menuItems = {}, + checkboxes = t.find('.tabs-panel-active .categorychecklist li input:checked'), + re = new RegExp('menu-item\\[(\[^\\]\]*)'); + + processMethod = processMethod || api.addMenuItemToBottom; + + // If no items are checked, bail. + if ( !checkboxes.length ) + return false; + + // Show the ajax spinner + t.find('img.waiting').show(); + + // Retrieve menu item data + $(checkboxes).each(function(){ + var t = $(this), + listItemDBIDMatch = re.exec( t.attr('name') ), + listItemDBID = 'undefined' == typeof listItemDBIDMatch[1] ? 0 : parseInt(listItemDBIDMatch[1], 10); + if ( this.className && -1 != this.className.indexOf('add-to-top') ) + processMethod = api.addMenuItemToTop; + menuItems[listItemDBID] = t.closest('li').getItemData( 'add-menu-item', listItemDBID ); + }); + + // Add the items + api.addItemToMenu(menuItems, processMethod, function(){ + // Deselect the items and hide the ajax spinner + checkboxes.removeAttr('checked'); + t.find('img.waiting').hide(); + }); + }); + }, + getItemData : function( itemType, id ) { + itemType = itemType || 'menu-item'; + + var itemData = {}, i, + fields = [ + 'menu-item-db-id', + 'menu-item-object-id', + 'menu-item-object', + 'menu-item-parent-id', + 'menu-item-position', + 'menu-item-type', + 'menu-item-title', + 'menu-item-url', + 'menu-item-description', + 'menu-item-attr-title', + 'menu-item-target', + 'menu-item-classes', + 'menu-item-xfn' + ]; + + if( !id && itemType == 'menu-item' ) { + id = this.find('.menu-item-data-db-id').val(); + } + + if( !id ) return itemData; + + this.find('input').each(function() { + var field; + i = fields.length; + while ( i-- ) { + if( itemType == 'menu-item' ) + field = fields[i] + '[' + id + ']'; + else if( itemType == 'add-menu-item' ) + field = 'menu-item[' + id + '][' + fields[i] + ']'; + + if ( + this.name && + field == this.name + ) { + itemData[fields[i]] = this.value; + } + } + }); + + return itemData; + }, + setItemData : function( itemData, itemType, id ) { // Can take a type, such as 'menu-item', or an id. + itemType = itemType || 'menu-item'; + + if( !id && itemType == 'menu-item' ) { + id = $('.menu-item-data-db-id', this).val(); + } + + if( !id ) return this; + + this.find('input').each(function() { + var t = $(this), field; + $.each( itemData, function( attr, val ) { + if( itemType == 'menu-item' ) + field = attr + '[' + id + ']'; + else if( itemType == 'add-menu-item' ) + field = 'menu-item[' + id + '][' + attr + ']'; + + if ( field == t.attr('name') ) { + t.val( val ); + } + }); + }); + return this; + } + }); + }, + + initToggles : function() { + // init postboxes + postboxes.add_postbox_toggles('nav-menus'); + + // adjust columns functions for menus UI + columns.useCheckboxesForHidden(); + columns.checked = function(field) { + $('.field-' + field).removeClass('hidden-field'); + } + columns.unchecked = function(field) { + $('.field-' + field).addClass('hidden-field'); + } + // hide fields + api.menuList.hideAdvancedMenuItemFields(); + }, + + initSortables : function() { + var currentDepth = 0, originalDepth, minDepth, maxDepth, + prev, next, prevBottom, nextThreshold, helperHeight, transport, + menuEdge = api.menuList.offset().left, + body = $('body'), maxChildDepth, + menuMaxDepth = initialMenuMaxDepth(); + + // Use the right edge if RTL. + menuEdge += api.isRTL ? api.menuList.width() : 0; + + api.menuList.sortable({ + handle: '.menu-item-handle', + placeholder: 'sortable-placeholder', + start: function(e, ui) { + var height, width, parent, children, tempHolder; + + // handle placement for rtl orientation + if ( api.isRTL ) + ui.item[0].style.right = 'auto'; + + transport = ui.item.children('.menu-item-transport'); + + // Set depths. currentDepth must be set before children are located. + originalDepth = ui.item.menuItemDepth(); + updateCurrentDepth(ui, originalDepth); + + // Attach child elements to parent + // Skip the placeholder + parent = ( ui.item.next()[0] == ui.placeholder[0] ) ? ui.item.next() : ui.item; + children = parent.childMenuItems(); + transport.append( children ); + + // Update the height of the placeholder to match the moving item. + height = transport.outerHeight(); + // If there are children, account for distance between top of children and parent + height += ( height > 0 ) ? (ui.placeholder.css('margin-top').slice(0, -2) * 1) : 0; + height += ui.helper.outerHeight(); + helperHeight = height; + height -= 2; // Subtract 2 for borders + ui.placeholder.height(height); + + // Update the width of the placeholder to match the moving item. + maxChildDepth = originalDepth; + children.each(function(){ + var depth = $(this).menuItemDepth(); + maxChildDepth = (depth > maxChildDepth) ? depth : maxChildDepth; + }); + width = ui.helper.find('.menu-item-handle').outerWidth(); // Get original width + width += api.depthToPx(maxChildDepth - originalDepth); // Account for children + width -= 2; // Subtract 2 for borders + ui.placeholder.width(width); + + // Update the list of menu items. + tempHolder = ui.placeholder.next(); + tempHolder.css( 'margin-top', helperHeight + 'px' ); // Set the margin to absorb the placeholder + ui.placeholder.detach(); // detach or jQuery UI will think the placeholder is a menu item + $(this).sortable( "refresh" ); // The children aren't sortable. We should let jQ UI know. + ui.item.after( ui.placeholder ); // reattach the placeholder. + tempHolder.css('margin-top', 0); // reset the margin + + // Now that the element is complete, we can update... + updateSharedVars(ui); + }, + stop: function(e, ui) { + var children, depthChange = currentDepth - originalDepth; + + // Return child elements to the list + children = transport.children().insertAfter(ui.item); + + // Update depth classes + if( depthChange != 0 ) { + ui.item.updateDepthClass( currentDepth ); + children.shiftDepthClass( depthChange ); + updateMenuMaxDepth( depthChange ); + } + // Register a change + api.registerChange(); + // Update the item data. + ui.item.updateParentMenuItemDBId(); + + // address sortable's incorrectly-calculated top in opera + ui.item[0].style.top = 0; + + // handle drop placement for rtl orientation + if ( api.isRTL ) { + ui.item[0].style.left = 'auto'; + ui.item[0].style.right = 0; + } + + // The width of the tab bar might have changed. Just in case. + api.refreshMenuTabs( true ); + }, + change: function(e, ui) { + // Make sure the placeholder is inside the menu. + // Otherwise fix it, or we're in trouble. + if( ! ui.placeholder.parent().hasClass('menu') ) + (prev.length) ? prev.after( ui.placeholder ) : api.menuList.prepend( ui.placeholder ); + + updateSharedVars(ui); + }, + sort: function(e, ui) { + var offset = ui.helper.offset(), + edge = api.isRTL ? offset.left + ui.helper.width() : offset.left, + depth = api.negateIfRTL * api.pxToDepth( edge - menuEdge ); + // Check and correct if depth is not within range. + // Also, if the dragged element is dragged upwards over + // an item, shift the placeholder to a child position. + if ( depth > maxDepth || offset.top < prevBottom ) depth = maxDepth; + else if ( depth < minDepth ) depth = minDepth; + + if( depth != currentDepth ) + updateCurrentDepth(ui, depth); + + // If we overlap the next element, manually shift downwards + if( nextThreshold && offset.top + helperHeight > nextThreshold ) { + next.after( ui.placeholder ); + updateSharedVars( ui ); + $(this).sortable( "refreshPositions" ); + } + } + }); + + function updateSharedVars(ui) { + var depth; + + prev = ui.placeholder.prev(); + next = ui.placeholder.next(); + + // Make sure we don't select the moving item. + if( prev[0] == ui.item[0] ) prev = prev.prev(); + if( next[0] == ui.item[0] ) next = next.next(); + + prevBottom = (prev.length) ? prev.offset().top + prev.height() : 0; + nextThreshold = (next.length) ? next.offset().top + next.height() / 3 : 0; + minDepth = (next.length) ? next.menuItemDepth() : 0; + + if( prev.length ) + maxDepth = ( (depth = prev.menuItemDepth() + 1) > api.options.globalMaxDepth ) ? api.options.globalMaxDepth : depth; + else + maxDepth = 0; + } + + function updateCurrentDepth(ui, depth) { + ui.placeholder.updateDepthClass( depth, currentDepth ); + currentDepth = depth; + } + + function initialMenuMaxDepth() { + if( ! body[0].className ) return 0; + var match = body[0].className.match(/menu-max-depth-(\d+)/); + return match && match[1] ? parseInt(match[1]) : 0; + } + + function updateMenuMaxDepth( depthChange ) { + var depth, newDepth = menuMaxDepth; + if ( depthChange === 0 ) { + return; + } else if ( depthChange > 0 ) { + depth = maxChildDepth + depthChange; + if( depth > menuMaxDepth ) + newDepth = depth; + } else if ( depthChange < 0 && maxChildDepth == menuMaxDepth ) { + while( ! $('.menu-item-depth-' + newDepth, api.menuList).length && newDepth > 0 ) + newDepth--; + } + // Update the depth class. + body.removeClass( 'menu-max-depth-' + menuMaxDepth ).addClass( 'menu-max-depth-' + newDepth ); + menuMaxDepth = newDepth; + } + }, + + attachMenuEditListeners : function() { + var that = this; + $('#update-nav-menu').bind('click', function(e) { + if ( e.target && e.target.className ) { + if ( -1 != e.target.className.indexOf('item-edit') ) { + return that.eventOnClickEditLink(e.target); + } else if ( -1 != e.target.className.indexOf('menu-save') ) { + return that.eventOnClickMenuSave(e.target); + } else if ( -1 != e.target.className.indexOf('menu-delete') ) { + return that.eventOnClickMenuDelete(e.target); + } else if ( -1 != e.target.className.indexOf('item-delete') ) { + return that.eventOnClickMenuItemDelete(e.target); + } else if ( -1 != e.target.className.indexOf('item-cancel') ) { + return that.eventOnClickCancelLink(e.target); + } + } + }); + }, + + /** + * An interface for managing default values for input elements + * that is both JS and accessibility-friendly. + * + * Input elements that add the class 'input-with-default-title' + * will have their values set to the provided HTML title when empty. + */ + setupInputWithDefaultTitle : function() { + var name = 'input-with-default-title'; + + $('.' + name).each( function(){ + var $t = $(this), title = $t.attr('title'), val = $t.val(); + $t.data( name, title ); + + if( '' == val ) $t.val( title ); + else if ( title == val ) return; + else $t.removeClass( name ); + }).focus( function(){ + var $t = $(this); + if( $t.val() == $t.data(name) ) + $t.val('').removeClass( name ); + }).blur( function(){ + var $t = $(this); + if( '' == $t.val() ) + $t.addClass( name ).val( $t.data(name) ); + }); + }, + + attachThemeLocationsListeners : function() { + var loc = $('#nav-menu-theme-locations'), params = {}; + params['action'] = 'menu-locations-save'; + params['menu-settings-column-nonce'] = $('#menu-settings-column-nonce').val(); + loc.find('input[type="submit"]').click(function() { + loc.find('select').each(function() { + params[this.name] = $(this).val(); + }); + loc.find('.waiting').show(); + $.post( ajaxurl, params, function(r) { + loc.find('.waiting').hide(); + }); + return false; + }); + }, + + attachQuickSearchListeners : function() { + var searchTimer; + + $('.quick-search').keypress(function(e){ + var t = $(this); + + if( 13 == e.which ) { + api.updateQuickSearchResults( t ); + return false; + } + + if( searchTimer ) clearTimeout(searchTimer); + + searchTimer = setTimeout(function(){ + api.updateQuickSearchResults( t ); + }, 400); + }).attr('autocomplete','off'); + }, + + updateQuickSearchResults : function(input) { + var panel, params, + minSearchLength = 2, + q = input.val(); + + if( q.length < minSearchLength ) return; + + panel = input.parents('.tabs-panel'); + params = { + 'action': 'menu-quick-search', + 'response-format': 'markup', + 'menu': $('#menu').val(), + 'menu-settings-column-nonce': $('#menu-settings-column-nonce').val(), + 'q': q, + 'type': input.attr('name') + }; + + $('img.waiting', panel).show(); + + $.post( ajaxurl, params, function(menuMarkup) { + api.processQuickSearchQueryResponse(menuMarkup, params, panel); + }); + }, + + addCustomLink : function( processMethod ) { + var url = $('#custom-menu-item-url').val(), + label = $('#custom-menu-item-name').val(); + + processMethod = processMethod || api.addMenuItemToBottom; + + if ( '' == url || 'http://' == url ) + return false; + + // Show the ajax spinner + $('.customlinkdiv img.waiting').show(); + this.addLinkToMenu( url, label, processMethod, function() { + // Remove the ajax spinner + $('.customlinkdiv img.waiting').hide(); + // Set custom link form back to defaults + $('#custom-menu-item-name').val('').blur(); + $('#custom-menu-item-url').val('http://'); + }); + }, + + addLinkToMenu : function(url, label, processMethod, callback) { + processMethod = processMethod || api.addMenuItemToBottom; + callback = callback || function(){}; + + api.addItemToMenu({ + '-1': { + 'menu-item-type': 'custom', + 'menu-item-url': url, + 'menu-item-title': label + } + }, processMethod, callback); + }, + + addItemToMenu : function(menuItem, processMethod, callback) { + var menu = $('#menu').val(), + nonce = $('#menu-settings-column-nonce').val(); + + processMethod = processMethod || function(){}; + callback = callback || function(){}; + + params = { + 'action': 'add-menu-item', + 'menu': menu, + 'menu-settings-column-nonce': nonce, + 'menu-item': menuItem + }; + + $.post( ajaxurl, params, function(menuMarkup) { + var ins = $('#menu-instructions'); + processMethod(menuMarkup, params); + if( ! ins.hasClass('menu-instructions-inactive') && ins.siblings().length ) + ins.addClass('menu-instructions-inactive'); + callback(); + }); + }, + + /** + * Process the add menu item request response into menu list item. + * + * @param string menuMarkup The text server response of menu item markup. + * @param object req The request arguments. + */ + addMenuItemToBottom : function( menuMarkup, req ) { + $(menuMarkup).hideAdvancedMenuItemFields().appendTo( api.targetList ); + }, + + addMenuItemToTop : function( menuMarkup, req ) { + $(menuMarkup).hideAdvancedMenuItemFields().prependTo( api.targetList ); + }, + + attachUnsavedChangesListener : function() { + $('#menu-management input, #menu-management select, #menu-management, #menu-management textarea').change(function(){ + api.registerChange(); + }); + + if ( 0 != $('#menu-to-edit').length ) { + window.onbeforeunload = function(){ + if ( api.menusChanged ) + return navMenuL10n.saveAlert; + }; + } else { + // Make the post boxes read-only, as they can't be used yet + $('#menu-settings-column').find('input,select').prop('disabled', true).end().find('a').attr('href', '#').unbind('click'); + } + }, + + registerChange : function() { + api.menusChanged = true; + }, + + attachTabsPanelListeners : function() { + $('#menu-settings-column').bind('click', function(e) { + var selectAreaMatch, panelId, wrapper, items, + target = $(e.target); + + if ( target.hasClass('nav-tab-link') ) { + panelId = /#(.*)$/.exec(e.target.href); + if ( panelId && panelId[1] ) + panelId = panelId[1] + else + return false; + + wrapper = target.parents('.inside').first(); + + // upon changing tabs, we want to uncheck all checkboxes + $('input', wrapper).removeAttr('checked'); + + $('.tabs-panel-active', wrapper).removeClass('tabs-panel-active').addClass('tabs-panel-inactive'); + $('#' + panelId, wrapper).removeClass('tabs-panel-inactive').addClass('tabs-panel-active'); + + $('.tabs', wrapper).removeClass('tabs'); + target.parent().addClass('tabs'); + + // select the search bar + $('.quick-search', wrapper).focus(); + + return false; + } else if ( target.hasClass('select-all') ) { + selectAreaMatch = /#(.*)$/.exec(e.target.href); + if ( selectAreaMatch && selectAreaMatch[1] ) { + items = $('#' + selectAreaMatch[1] + ' .tabs-panel-active .menu-item-title input'); + if( items.length === items.filter(':checked').length ) + items.removeAttr('checked'); + else + items.prop('checked', true); + return false; + } + } else if ( target.hasClass('submit-add-to-menu') ) { + api.registerChange(); + + if ( e.target.id && 'submit-customlinkdiv' == e.target.id ) + api.addCustomLink( api.addMenuItemToBottom ); + else if ( e.target.id && -1 != e.target.id.indexOf('submit-') ) + $('#' + e.target.id.replace(/submit-/, '')).addSelectedToMenu( api.addMenuItemToBottom ); + return false; + } else if ( target.hasClass('page-numbers') ) { + $.post( ajaxurl, e.target.href.replace(/.*\?/, '').replace(/action=([^&]*)/, '') + '&action=menu-get-metabox', + function( resp ) { + if ( -1 == resp.indexOf('replace-id') ) + return; + + var metaBoxData = $.parseJSON(resp), + toReplace = document.getElementById(metaBoxData['replace-id']), + placeholder = document.createElement('div'), + wrap = document.createElement('div'); + + if ( ! metaBoxData['markup'] || ! toReplace ) + return; + + wrap.innerHTML = metaBoxData['markup'] ? metaBoxData['markup'] : ''; + + toReplace.parentNode.insertBefore( placeholder, toReplace ); + placeholder.parentNode.removeChild( toReplace ); + + placeholder.parentNode.insertBefore( wrap, placeholder ); + + placeholder.parentNode.removeChild( placeholder ); + + } + ); + + return false; + } + }); + }, + + initTabManager : function() { + var fixed = $('.nav-tabs-wrapper'), + fluid = fixed.children('.nav-tabs'), + active = fluid.children('.nav-tab-active'), + tabs = fluid.children('.nav-tab'), + tabsWidth = 0, + fixedRight, fixedLeft, + arrowLeft, arrowRight, resizeTimer, css = {}, + marginFluid = api.isRTL ? 'margin-right' : 'margin-left', + marginFixed = api.isRTL ? 'margin-left' : 'margin-right', + msPerPx = 2; + + /** + * Refreshes the menu tabs. + * Will show and hide arrows where necessary. + * Scrolls to the active tab by default. + * + * @param savePosition {boolean} Optional. Prevents scrolling so + * that the current position is maintained. Default false. + **/ + api.refreshMenuTabs = function( savePosition ) { + var fixedWidth = fixed.width(), + margin = 0, css = {}; + fixedLeft = fixed.offset().left; + fixedRight = fixedLeft + fixedWidth; + + if( !savePosition ) + active.makeTabVisible(); + + // Prevent space from building up next to the last tab if there's more to show + if( tabs.last().isTabVisible() ) { + margin = fixed.width() - tabsWidth; + margin = margin > 0 ? 0 : margin; + css[marginFluid] = margin + 'px'; + fluid.animate( css, 100, "linear" ); + } + + // Show the arrows only when necessary + if( fixedWidth > tabsWidth ) + arrowLeft.add( arrowRight ).hide(); + else + arrowLeft.add( arrowRight ).show(); + } + + $.fn.extend({ + makeTabVisible : function() { + var t = this.eq(0), left, right, css = {}, shift = 0; + + if( ! t.length ) return this; + + left = t.offset().left; + right = left + t.outerWidth(); + + if( right > fixedRight ) + shift = fixedRight - right; + else if ( left < fixedLeft ) + shift = fixedLeft - left; + + if( ! shift ) return this; + + css[marginFluid] = "+=" + api.negateIfRTL * shift + 'px'; + fluid.animate( css, Math.abs( shift ) * msPerPx, "linear" ); + return this; + }, + isTabVisible : function() { + var t = this.eq(0), + left = t.offset().left, + right = left + t.outerWidth(); + return ( right <= fixedRight && left >= fixedLeft ) ? true : false; + } + }); + + // Find the width of all tabs + tabs.each(function(){ + tabsWidth += $(this).outerWidth(true); + }); + + // Set up fixed margin for overflow, unset padding + css['padding'] = 0; + css[marginFixed] = (-1 * tabsWidth) + 'px'; + fluid.css( css ); + + // Build tab navigation + arrowLeft = $(''); + arrowRight = $(''); + // Attach to the document + fixed.wrap(''; + include( ABSPATH . 'wp-admin/admin-footer.php' ); + die(); + } + + echo '
    '; + + wp_nonce_field( 'install-network-1' ); + + $error_codes = array(); + if ( is_wp_error( $errors ) ) { + echo '

    ' . __( 'ERROR: The network could not be created.' ) . '

    '; + foreach ( $errors->get_error_messages() as $error ) + echo "

    $error

    "; + echo '
    '; + $error_codes = $errors->get_error_codes(); + } + + if ( WP_CONTENT_DIR != ABSPATH . 'wp-content' ) + echo '

    ' . __('Warning!') . ' ' . __( 'Networks may not be fully compatible with custom wp-content directories.' ) . '

    '; + + $site_name = ( ! empty( $_POST['sitename'] ) && ! in_array( 'empty_sitename', $error_codes ) ) ? $_POST['sitename'] : sprintf( _x('%s Sites', 'Default network name' ), get_option( 'blogname' ) ); + $admin_email = ( ! empty( $_POST['email'] ) && ! in_array( 'invalid_email', $error_codes ) ) ? $_POST['email'] : get_option( 'admin_email' ); + ?> +

    +

    +

    ' . __( 'Note:' ) . ' ' . __( 'Please make sure the Apache mod_rewrite module is installed as it will be used at the end of this installation.' ) . '

    '; + elseif ( $is_apache ) + echo '

    ' . __( 'Warning!' ) . ' ' . __( 'It looks like the Apache mod_rewrite module is not installed.' ) . '

    '; + if ( $got_mod_rewrite || $is_apache ) // Protect against mod_rewrite mimicry (but ! Apache) + echo '

    ' . __( 'If mod_rewrite is disabled, ask your administrator to enable that module, or look at the Apache documentation or elsewhere for help setting it up.' ) . '

    '; + } + + if ( allow_subdomain_install() && allow_subdirectory_install() ) : ?> +

    +

    You cannot change this later.' ); ?>

    +

    + + + + + + + + + + +
    site1.%1$s and site2.%1$s', 'subdomain examples' ), $hostname ); ?>
    %1$s/site1 and %1$s/site2', 'subdirectory examples' ), $hostname ); ?>
    + + +

    +

    %1$s before enabling the network feature. It will still be possible to visit your site using the www prefix with an address like %2$s but any links will not have the www prefix.' ), substr( $hostname, 4 ), $hostname ); ?> + + + + + +
    + %s.' ), $hostname ); ?> +
    + + +

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    localhost, the sites in your WordPress network must use sub-directories. Consider using localhost.localdomain if you wish to use sub-domains.' ); + // Uh oh: + if ( !allow_subdirectory_install() ) + echo ' ' . __( 'Warning!' ) . ' ' . __( 'The main site in a sub-directory install will need to use a modified permalink structure, potentially breaking existing links.' ) . ''; + ?>
    ' . __( 'Warning!' ) . ' ' . __( 'The main site in a sub-directory install will need to use a modified permalink structure, potentially breaking existing links.' ) . ''; + ?>
    ' . __( 'The main site in a sub-directory install will need to use a modified permalink structure, potentially breaking existing links.' ) . ''; + ?>
    + %s.' ), $hostname ); ?> +
    + +
    +
    + +
    +
    + +
    + ' . $errors->get_error_message() . '
    '; + + if ( $_POST ) { + if ( allow_subdomain_install() ) + $subdomain_install = allow_subdirectory_install() ? ! empty( $_POST['subdomain_install'] ) : true; + else + $subdomain_install = false; + } else { + if ( is_multisite() ) { + $subdomain_install = is_subdomain_install(); +?> +

    +get_var( "SELECT meta_value FROM $wpdb->sitemeta WHERE site_id = 1 AND meta_key = 'subdomain_install'" ); +?> +

    +

    + +

    +

    +

    Caution: We recommend you back up your existing wp-config.php and %s files.' ), '.htaccess' ); + elseif ( file_exists( ABSPATH . 'web.config' ) ) + printf( __( 'Caution: We recommend you back up your existing wp-config.php and %s files.' ), 'web.config' ); + else + _e( 'Caution: We recommend you back up your existing wp-config.php file.' ); + ?>

    + +
      +
    1. blogs.dir directory at %s/blogs.dir. This directory is used to store uploaded media for your additional sites and must be writeable by the web server.' ), WP_CONTENT_DIR ); + if ( WP_CONTENT_DIR != ABSPATH . 'wp-content' ) + echo ' ' . __('Warning:') . ' ' . __( 'Networks may not be fully compatible with custom wp-content directories.' ) . '

    2. +
    3. wp-config.php file in %s above the line reading /* That’s all, stop editing! Happy blogging. */:' ), ABSPATH ); ?>

      + + '', 'SECURE_AUTH_KEY' => '', 'LOGGED_IN_KEY' => '', 'NONCE_KEY' => '', 'AUTH_SALT' => '', 'SECURE_AUTH_SALT' => '', 'LOGGED_IN_SALT' => '', 'NONCE_SALT' => '' ); + foreach ( $keys_salts as $c => $v ) { + if ( defined( $c ) ) + unset( $keys_salts[ $c ] ); + } + if ( ! empty( $keys_salts ) ) { + $keys_salts_str = ''; + $from_api = wp_remote_get( 'https://api.wordpress.org/secret-key/1.1/salt/' ); + if ( is_wp_error( $from_api ) ) { + foreach ( $keys_salts as $c => $v ) { + $keys_salts_str .= "\ndefine( '$c', '" . wp_generate_password( 64, true, true ) . "' );"; + } + } else { + $from_api = explode( "\n", wp_remote_retrieve_body( $from_api ) ); + foreach ( $keys_salts as $c => $v ) { + $keys_salts_str .= "\ndefine( '$c', '" . substr( array_shift( $from_api ), 28, 64 ) . "' );"; + } + } + $num_keys_salts = count( $keys_salts ); +?> +

      wp-config.php file.', 'These unique authentication keys are also missing from your wp-config.php file.', $num_keys_salts ); ?>

      + + +
    4. + + + + + + + + + + + + + + + + + + + + + + + + + + + + +'; + } else { + $web_config_file = +' + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +'; + } + ?> +
    5. web.config file in %s, replacing other WordPress rules:' ), ABSPATH ); ?>

      +
    6. +
    + + +
  • .htaccess file in %s, replacing other WordPress rules:' ), ABSPATH ); ?>

    +
  • + + + +

    +get_error_codes() ) && 'no_wildcard_dns' == $result->get_error_code() ) + network_step2( $result ); + else + network_step1( $result ); + } else { + network_step2(); + } + } else { + network_step2(); + } +} elseif ( is_multisite() || network_domain_check() ) { + network_step2(); +} else { + network_step1(); +} +?> +
    + + diff --git a/src/wp-admin/network/admin.php b/src/wp-admin/network/admin.php new file mode 100644 index 0000000..d6de38d --- /dev/null +++ b/src/wp-admin/network/admin.php @@ -0,0 +1,25 @@ +domain != $current_site->domain ) || ( $current_blog->path != $current_site->path ) ); +$redirect_network_admin_request = apply_filters( 'redirect_network_admin_request', $redirect_network_admin_request ); +if ( $redirect_network_admin_request ) { + wp_redirect( network_admin_url() ); + exit; +} +unset( $redirect_network_admin_request ); +?> diff --git a/src/wp-admin/network/edit.php b/src/wp-admin/network/edit.php new file mode 100644 index 0000000..2d3f952 --- /dev/null +++ b/src/wp-admin/network/edit.php @@ -0,0 +1,482 @@ + +

    +

    +
    + + ID'>$current_user->user_login"; + + foreach ( ( $allusers = (array) $_POST['allusers'] ) as $key => $val ) { + if ( $val != '' && $val != '0' ) { + $delete_user = new WP_User( $val ); + + if ( ! current_user_can( 'delete_user', $delete_user->ID ) ) + wp_die( sprintf( __( 'Warning! User %s cannot be deleted.' ), $delete_user->user_login ) ); + + if ( in_array( $delete_user->user_login, $site_admins ) ) + wp_die( sprintf( __( 'Warning! User cannot be deleted. The user %s is a network admnistrator.' ), $delete_user->user_login ) ); + + echo "\n"; + $blogs = get_blogs_of_user( $val, true ); + + if ( !empty( $blogs ) ) { + ?> +

    %s?" ), $delete_user->user_login ); ?>

    + $details ) { + $blog_users = get_users( array( 'blog_id' => $details->userblog_id ) ); + if ( is_array( $blog_users ) && !empty( $blog_users ) ) { + $user_site = "{$details->blogname}"; + $user_dropdown = "\n"; + ?> +
      +
    • +
    • +
    • +
    + "; + } + } + } + + submit_button( __('Confirm Deletion'), 'delete' ); + ?> + + options page.' ), esc_url( admin_url( 'settings.php' ) ) ) ); + + if ( isset($_POST['WPLANG']) && ( '' === $_POST['WPLANG'] || in_array( $_POST['WPLANG'], get_available_languages() ) ) ) + update_site_option( 'WPLANG', $_POST['WPLANG'] ); + + if ( is_email( $_POST['admin_email'] ) ) + update_site_option( 'admin_email', $_POST['admin_email'] ); + + $illegal_names = split( ' ', $_POST['illegal_names'] ); + foreach ( (array) $illegal_names as $name ) { + $name = trim( $name ); + if ( $name != '' ) + $names[] = trim( $name ); + } + update_site_option( 'illegal_names', $names ); + + if ( $_POST['limited_email_domains'] != '' ) { + $limited_email_domains = str_replace( ' ', "\n", $_POST['limited_email_domains'] ); + $limited_email_domains = split( "\n", stripslashes( $limited_email_domains ) ); + $limited_email = array(); + foreach ( (array) $limited_email_domains as $domain ) { + $domain = trim( $domain ); + if ( ! preg_match( '/(--|\.\.)/', $domain ) && preg_match( '|^([a-zA-Z0-9-\.])+$|', $domain ) ) + $limited_email[] = trim( $domain ); + } + update_site_option( 'limited_email_domains', $limited_email ); + } else { + update_site_option( 'limited_email_domains', '' ); + } + + if ( $_POST['banned_email_domains'] != '' ) { + $banned_email_domains = split( "\n", stripslashes( $_POST['banned_email_domains'] ) ); + $banned = array(); + foreach ( (array) $banned_email_domains as $domain ) { + $domain = trim( $domain ); + if ( ! preg_match( '/(--|\.\.)/', $domain ) && preg_match( '|^([a-zA-Z0-9-\.])+$|', $domain ) ) + $banned[] = trim( $domain ); + } + update_site_option( 'banned_email_domains', $banned ); + } else { + update_site_option( 'banned_email_domains', '' ); + } + + $options = array( 'registrationnotification', 'registration', 'add_new_users', 'menu_items', 'mu_media_buttons', 'upload_space_check_disabled', 'blog_upload_space', 'upload_filetypes', 'site_name', 'first_post', 'first_page', 'first_comment', 'first_comment_url', 'first_comment_author', 'welcome_email', 'welcome_user_email', 'fileupload_maxk', 'global_terms_enabled' ); + $checked_options = array( 'mu_media_buttons' => array(), 'menu_items' => array(), 'registrationnotification' => 'no', 'upload_space_check_disabled' => 1, 'add_new_users' => 0 ); + foreach ( $checked_options as $option_name => $option_unchecked_value ) { + if ( ! isset( $_POST[$option_name] ) ) + $_POST[$option_name] = $option_unchecked_value; + } + foreach ( $options as $option_name ) { + if ( ! isset($_POST[$option_name]) ) + continue; + $value = stripslashes_deep( $_POST[$option_name] ); + update_site_option( $option_name, $value ); + } + + // Update more options here + do_action( 'update_wpmu_options' ); + + wp_redirect( add_query_arg( 'updated', 'true', network_admin_url( 'settings.php' ) ) ); + exit(); + break; + + case 'updateblog': + // No longer used. + break; + + case 'deleteblog': + check_admin_referer('deleteblog'); + if ( ! ( current_user_can( 'manage_sites' ) && current_user_can( 'delete_sites' ) ) ) + wp_die( __( 'You do not have permission to access this page.' ) ); + + if ( $id != '0' && $id != $current_site->blog_id && current_user_can( 'delete_site', $id ) ) { + wpmu_delete_blog( $id, true ); + wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'delete' ), wp_get_referer() ) ); + } else { + wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'not_deleted' ), wp_get_referer() ) ); + } + + exit(); + break; + + case 'allblogs': + if ( ( isset( $_POST['action'] ) || isset( $_POST['action2'] ) ) && isset( $_POST['allblogs'] ) ) { + check_admin_referer( 'bulk-sites' ); + + if ( ! current_user_can( 'manage_sites' ) ) + wp_die( __( 'You do not have permission to access this page.' ) ); + + if ( $_GET['action'] != -1 || $_POST['action2'] != -1 ) + $doaction = $_POST['action'] != -1 ? $_POST['action'] : $_POST['action2']; + + $blogfunction = ''; + + foreach ( (array) $_POST['allblogs'] as $key => $val ) { + if ( $val != '0' && $val != $current_site->blog_id ) { + switch ( $doaction ) { + case 'delete': + if ( ! current_user_can( 'delete_site', $val ) ) + wp_die( __( 'You are not allowed to delete the site.' ) ); + $blogfunction = 'all_delete'; + wpmu_delete_blog( $val, true ); + break; + + case 'spam': + $blogfunction = 'all_spam'; + update_blog_status( $val, 'spam', '1' ); + set_time_limit( 60 ); + break; + + case 'notspam': + $blogfunction = 'all_notspam'; + update_blog_status( $val, 'spam', '0' ); + set_time_limit( 60 ); + break; + } + } else { + wp_die( __( 'You are not allowed to change the current site.' ) ); + } + } + + wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => $blogfunction ), wp_get_referer() ) ); + } else { + wp_redirect( network_admin_url( 'sites.php' ) ); + } + exit(); + break; + + case 'archiveblog': + check_admin_referer( 'archiveblog' ); + if ( ! current_user_can( 'manage_sites' ) ) + wp_die( __( 'You do not have permission to access this page.' ) ); + + update_blog_status( $id, 'archived', '1' ); + wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'archive' ), wp_get_referer() ) ); + exit(); + break; + + case 'unarchiveblog': + check_admin_referer( 'unarchiveblog' ); + if ( ! current_user_can( 'manage_sites' ) ) + wp_die( __( 'You do not have permission to access this page.' ) ); + + update_blog_status( $id, 'archived', '0' ); + wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'unarchive' ), wp_get_referer() ) ); + exit(); + break; + + case 'activateblog': + check_admin_referer( 'activateblog' ); + if ( ! current_user_can( 'manage_sites' ) ) + wp_die( __( 'You do not have permission to access this page.' ) ); + + update_blog_status( $id, 'deleted', '0' ); + do_action( 'activate_blog', $id ); + wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'activate' ), wp_get_referer() ) ); + exit(); + break; + + case 'deactivateblog': + check_admin_referer( 'deactivateblog' ); + if ( ! current_user_can( 'manage_sites' ) ) + wp_die( __( 'You do not have permission to access this page.' ) ); + + do_action( 'deactivate_blog', $id ); + update_blog_status( $id, 'deleted', '1' ); + wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'deactivate' ), wp_get_referer() ) ); + exit(); + break; + + case 'unspamblog': + check_admin_referer( 'unspamblog' ); + if ( ! current_user_can( 'manage_sites' ) ) + wp_die( __( 'You do not have permission to access this page.' ) ); + + update_blog_status( $id, 'spam', '0' ); + wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'unspam' ), wp_get_referer() ) ); + exit(); + break; + + case 'spamblog': + check_admin_referer( 'spamblog' ); + if ( ! current_user_can( 'manage_sites' ) ) + wp_die( __( 'You do not have permission to access this page.' ) ); + + update_blog_status( $id, 'spam', '1' ); + wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'spam' ), wp_get_referer() ) ); + exit(); + break; + + case 'unmatureblog': + check_admin_referer( 'unmatureblog' ); + if ( ! current_user_can( 'manage_sites' ) ) + wp_die( __( 'You do not have permission to access this page.' ) ); + + update_blog_status( $id, 'mature', '0' ); + wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'unmature' ), wp_get_referer() ) ); + exit(); + break; + + case 'matureblog': + check_admin_referer( 'matureblog' ); + if ( ! current_user_can( 'manage_sites' ) ) + wp_die( __( 'You do not have permission to access this page.' ) ); + + update_blog_status( $id, 'mature', '1' ); + wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'mature' ), wp_get_referer() ) ); + exit(); + break; + + // Common + case 'confirm': + check_admin_referer( 'confirm' ); + if ( !headers_sent() ) { + nocache_headers(); + header( 'Content-Type: text/html; charset=utf-8' ); + } + if ( $current_site->blog_id == $id ) + wp_die( __( 'You are not allowed to change the current site.' ) ); + ?> + + > + + <?php _e( 'WordPress › Confirm your action' ); ?> + + + + + +

    WordPress

    +
    + + + + +

    + +
    + + + '; + confirm_delete_users( $_POST['allusers'] ); + echo '
    '; + require_once( '../admin-footer.php' ); + } else { + wp_redirect( network_admin_url( 'users.php' ) ); + } + exit(); + break; + + case 'allusers': + if ( !current_user_can( 'manage_network_users' ) ) + wp_die( __( 'You do not have permission to access this page.' ) ); + + if ( ( isset( $_POST['action']) || isset($_POST['action2'] ) ) && isset( $_POST['allusers'] ) ) { + check_admin_referer( 'bulk-users-network' ); + + if ( $_GET['action'] != -1 || $_POST['action2'] != -1 ) + $doaction = $_POST['action'] != -1 ? $_POST['action'] : $_POST['action2']; + + $userfunction = ''; + + foreach ( (array) $_POST['allusers'] as $key => $val ) { + if ( !empty( $val ) ) { + switch ( $doaction ) { + case 'delete': + if ( ! current_user_can( 'delete_users' ) ) + wp_die( __( 'You do not have permission to access this page.' ) ); + $title = __( 'Users' ); + $parent_file = 'users.php'; + require_once( '../admin-header.php' ); + echo '
    '; + confirm_delete_users( $_POST['allusers'] ); + echo '
    '; + require_once( '../admin-footer.php' ); + exit(); + break; + + case 'spam': + $user = new WP_User( $val ); + if ( in_array( $user->user_login, get_super_admins() ) ) + wp_die( sprintf( __( 'Warning! User cannot be modified. The user %s is a network administrator.' ), esc_html( $user->user_login ) ) ); + + $userfunction = 'all_spam'; + $blogs = get_blogs_of_user( $val, true ); + foreach ( (array) $blogs as $key => $details ) { + if ( $details->userblog_id != $current_site->blog_id ) // main blog not a spam ! + update_blog_status( $details->userblog_id, 'spam', '1' ); + } + update_user_status( $val, 'spam', '1' ); + break; + + case 'notspam': + $userfunction = 'all_notspam'; + $blogs = get_blogs_of_user( $val, true ); + foreach ( (array) $blogs as $key => $details ) + update_blog_status( $details->userblog_id, 'spam', '0' ); + + update_user_status( $val, 'spam', '0' ); + break; + } + } + } + + wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => $userfunction ), wp_get_referer() ) ); + } else { + $location = network_admin_url( 'users.php' ); + + if ( ! empty( $_REQUEST['paged'] ) ) + $location = add_query_arg( 'paged', (int) $_REQUEST['paged'], $location ); + wp_redirect( $location ); + } + exit(); + break; + + case 'dodelete': + check_admin_referer( 'ms-users-delete' ); + if ( ! ( current_user_can( 'manage_network_users' ) && current_user_can( 'delete_users' ) ) ) + wp_die( __( 'You do not have permission to access this page.' ) ); + + if ( ! empty( $_POST['blog'] ) && is_array( $_POST['blog'] ) ) { + foreach ( $_POST['blog'] as $id => $users ) { + foreach ( $users as $blogid => $user_id ) { + if ( ! current_user_can( 'delete_user', $id ) ) + continue; + + if ( ! empty( $_POST['delete'] ) && 'reassign' == $_POST['delete'][$blogid][$id] ) + remove_user_from_blog( $id, $blogid, $user_id ); + else + remove_user_from_blog( $id, $blogid ); + } + } + } + $i = 0; + if ( is_array( $_POST['user'] ) && ! empty( $_POST['user'] ) ) + foreach( $_POST['user'] as $id ) { + if ( ! current_user_can( 'delete_user', $id ) ) + continue; + wpmu_delete_user( $id ); + $i++; + } + + if ( $i == 1 ) + $deletefunction = 'delete'; + else + $deletefunction = 'all_delete'; + + wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => $deletefunction ), network_admin_url( 'users.php' ) ) ); + exit(); + break; + + default: + // Let plugins use us as a post handler easily + do_action( 'network_admin_edit_' . $_GET['action'] ); + wp_redirect( network_admin_url( 'index.php' ) ); + exit(); + break; +} +?> diff --git a/src/wp-admin/network/index-extra.php b/src/wp-admin/network/index-extra.php new file mode 100644 index 0000000..17ead78 --- /dev/null +++ b/src/wp-admin/network/index-extra.php @@ -0,0 +1,13 @@ +' . __('Until WordPress 3.0, running multiple sites required using WordPress MU instead of regular WordPress. In version 3.0, these applications have merged. If you are a former MU user, you should be aware of the following changes:') . '

    ' . + '
    • ' . __('Site Admin is now Super Admin (we highly encourage you to get yourself a cape!).') . '
    • ' . + '
    • ' . __('Blogs are now called Sites; Site is now called Network.') . '
    ' . + '

    ' . __('The Right Now box provides the network administrator with links to the screens to either create a new site or user, or to search existing users and sites. Screen for Sites and Users are also accessible through the left-hand navigation in the Network Admin section.') . '

    ' . + '

    ' . __('For more information:') . '

    ' . + '

    ' . __('Documentation on the Network Admin') . '

    ' . + '

    ' . __('Support Forums') . '

    ' +); + +wp_dashboard_setup(); + +wp_enqueue_script( 'dashboard' ); +wp_enqueue_script( 'plugin-install' ); +wp_admin_css( 'dashboard' ); +wp_admin_css( 'plugin-install' ); +add_thickbox(); + +add_screen_option('layout_columns', array('max' => 4, 'default' => 2) ); + +require_once( '../admin-header.php' ); + +?> + +
    + +

    + +
    + + + +
    +
    + +
    + + diff --git a/src/wp-admin/network/menu.php b/src/wp-admin/network/menu.php new file mode 100644 index 0000000..c33d47a --- /dev/null +++ b/src/wp-admin/network/menu.php @@ -0,0 +1,86 @@ +response) ) + $theme_update_count = count( $update_themes->response ); + $menu[15] = array(sprintf( __( 'Themes %s' ), "" . number_format_i18n( $theme_update_count ) . "" ), 'manage_network_themes', 'themes.php', '', 'menu-top menu-icon-appearance', 'menu-appearance', 'div' ); +} else { + $menu[15] = array( __( 'Themes' ), 'manage_network_themes', 'themes.php', '', 'menu-top menu-icon-appearance', 'menu-appearance', 'div' ); +} +$submenu['themes.php'][5] = array( __('Installed Themes'), 'manage_network_themes', 'themes.php' ); +$submenu['themes.php'][10] = array( _x('Add New', 'theme'), 'install_themes', 'theme-install.php' ); +$submenu['themes.php'][15] = array( _x('Editor', 'theme editor'), 'edit_themes', 'theme-editor.php' ); + +if ( current_user_can( 'update_plugins' ) ) { + $update_plugins = get_site_transient( 'update_plugins' ); + if ( !empty($update_plugins->response) ) + $plugin_update_count = count( $update_plugins->response ); + $menu[20] = array( sprintf( __( 'Plugins %s' ), "" . number_format_i18n( $plugin_update_count ) . "" ), 'manage_network_plugins', 'plugins.php', '', 'menu-top menu-icon-plugins', 'menu-plugins', 'div'); +} else { + $menu[20] = array( __('Plugins'), 'manage_network_plugins', 'plugins.php', '', 'menu-top menu-icon-plugins', 'menu-plugins', 'div' ); +} +$submenu['plugins.php'][5] = array( __('Installed Plugins'), 'manage_network_plugins', 'plugins.php' ); +$submenu['plugins.php'][10] = array( _x('Add New', 'plugin editor'), 'install_plugins', 'plugin-install.php' ); +$submenu['plugins.php'][15] = array( _x('Editor', 'plugin editor'), 'edit_plugins', 'plugin-editor.php' ); + + +$menu[25] = array(__('Settings'), 'manage_network_options', 'settings.php', '', 'menu-top menu-icon-settings', 'menu-settings', 'div'); +if ( defined( 'MULTISITE' ) && defined( 'WP_ALLOW_MULTISITE' ) && WP_ALLOW_MULTISITE ) { + $submenu['settings.php'][5] = array( __('Network Settings'), 'manage_network_options', 'settings.php' ); + $submenu['settings.php'][10] = array( __('Network Setup'), 'manage_network_options', 'setup.php' ); +} + +if ( current_user_can( 'update_core' ) ) { + $update_wordpress = get_core_updates( array('dismissed' => false) ); + if ( !empty($update_wordpress) && !in_array( $update_wordpress[0]->response, array('development', 'latest') ) ) + $wordpress_update_count = 1; + + $update_count = $plugin_update_count + $theme_update_count + $wordpress_update_count; + $update_title = array(); + if ( $wordpress_update_count ) + $update_title[] = sprintf(__('%d WordPress Update'), $wordpress_update_count); + if ( $plugin_update_count ) + $update_title[] = sprintf(_n('%d Plugin Update', '%d Plugin Updates', $plugin_update_count), $plugin_update_count); + if ( $theme_update_count ) + $update_title[] = sprintf(_n('%d Theme Update', '%d Theme Updates', $theme_update_count), $theme_update_count); + + $update_title = !empty($update_title) ? esc_attr(implode(', ', $update_title)) : ''; + + $menu[30] = array( sprintf( __( 'Updates %s' ), "" . number_format_i18n($update_count) . "" ), 'manage_network', 'upgrade.php', '', 'menu-top menu-icon-tools', 'menu-update', 'div' ); +} else { + $menu[30] = array( __( 'Updates' ), 'manage_network', 'upgrade.php', '', 'menu-top menu-icon-tools', 'menu-update', 'div' ); +} + +$submenu[ 'upgrade.php' ][10] = array( __( 'Available Updates' ), 'update_core', 'update-core.php' ); +$submenu[ 'upgrade.php' ][15] = array( __( 'Update Network' ), 'manage_network', 'upgrade.php' ); +unset($plugin_update_count, $theme_update_count, $wordpress_update_count, $update_count, $update_title, $update_themes, $update_plugins, $update_wordpress); + + +$menu[99] = array( '', 'read', 'separator-last', '', 'wp-menu-separator-last' ); + +require_once(ABSPATH . 'wp-admin/includes/menu.php'); + +?> \ No newline at end of file diff --git a/src/wp-admin/network/plugin-editor.php b/src/wp-admin/network/plugin-editor.php new file mode 100644 index 0000000..8850aa8 --- /dev/null +++ b/src/wp-admin/network/plugin-editor.php @@ -0,0 +1,16 @@ +' . __('This screen sets and changes options for the network as a whole. The first site is the main site in the network and network options are pulled from that original site’s options.') . '

    ' . + '

    ' . __('Operational settings has fields for the network’s name and admin email.') . '

    ' . + '

    ' . __('Dashboard Site is an option to give a site to users who do not have a site on the system. Their default role is Subscriber, but that default can be changed. The Admin Notice Feed can provide a notice on all dashboards of the latest post via RSS or Atom, or provide no such notice if left blank.') . '

    ' . + '

    ' . __('Registration settings can disable/enable public signups. If you let others sign up for a site, install spam plugins. Spaces, not commas, should separate names banned as sites for this network.') . '

    ' . + '

    ' . __('New site settings are defaults applied when a new site is created in the network. These include welcome email for when a new site or user account is registered, and what᾿s put in the first post, page, comment, comment author, and comment URL.') . '

    ' . + '

    ' . __('Upload settings control the size of the uploaded files and the amount of available upload space for each site. You can change the default value for specific sites when you edit a particular site. Allowed file types are also listed (space separated only).') . '

    ' . + '

    ' . __('Checkboxes for media upload buttons set which are shown in the visual editor. If unchecked, a generic upload button is still visible; other media types can still be uploaded if on the allowed file types list.') . '

    ' . + '

    ' . __('Menu setting enables/disables the plugin menus from appearing for non super admins, so that only super admins, not site admins, have access to activate plugins.') . '

    ' . + '

    ' . __('Super admins can no longer be added on the Options screen. You must now go to the list of existing users on Network Admin > Users and click on Username or the Edit action link below that name. This goes to an Edit User page where you can check a box to grant super admin privileges.') . '

    ' . + '

    ' . __('For more information:') . '

    ' . + '

    ' . __('Documentation on Network Settings') . '

    ' . + '

    ' . __('Support Forums') . '

    ' +); + +include( '../admin-header.php' ); + +if (isset($_GET['updated'])) { + ?> +

    + + +
    + +

    +
    + +

    + + + + + + + + + + +
    + +
    + +
    + +
    + support@%s is recommended.' ), $current_site->domain ); ?> +
    +

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    +
    +
    +
    + NOBLOGREDIRECT in wp-config.php to a URL you will redirect visitors to if they visit a non-existent site.' ); + ?> +
    + +
    + +
    + " size="45" /> +
    + +
    + + +
    + +
    + +
    + +
    +

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + +
    + +
    + +
    + +
    + +
    + +
    + +
    + +
    + +
    + +
    + +
    + +
    + +
    + +
    +

    + + + + + + + + + + + + + + + + + + + + + +

    +
    +
    +
    +
    ' ); ?>
    + + +

    + + + + + +
    + +
    + + +

    + + + + + + + + + + +
    +
    + + diff --git a/src/wp-admin/network/setup.php b/src/wp-admin/network/setup.php new file mode 100644 index 0000000..e5d5880 --- /dev/null +++ b/src/wp-admin/network/setup.php @@ -0,0 +1,16 @@ +' . __('The menu is for editing information specific to individual sites, particularly if the admin area of a site is unavailable.') . '

    ' . + '

    ' . __('Info - The domain and path are rarely edited as this can cause the site to not work properly. The Registered date and Last Updated date are displayed. Network admins can mark a site as archived, spam, deleted and mature, to remove from public listings or disable.') . '

    ' . + '

    ' . __('Users - This displays the users associated with this site. You can also change their role, reset their password, or remove them from the site. Removing the user from the site does not remove the user from the network.') . '

    ' . + '

    ' . sprintf( __('Themes - This area shows themes that are not already enabled across the network. Enabling a theme in this menu makes it accessible to this site. It does not activate the theme, but allows it to show in the site’s Appearance menu. To enable a theme for the entire network, see the Network Themes screen.' ), network_admin_url( 'themes.php' ) ) . '

    ' . + '

    ' . __('Settings - This page shows a list of all settings associated with this site. Some are created by WordPress and others are created by plugins you activate. Note that some fields are grayed out and say Serialized Data. You cannot modify these values due to the way the setting is stored in the database.') . '

    ' . + '

    ' . __('For more information:') . '

    ' . + '

    ' . __('Documentation on Site Management') . '

    ' . + '

    ' . __('Support Forums') . '

    ' +); + +$id = isset( $_REQUEST['id'] ) ? intval( $_REQUEST['id'] ) : 0; + +if ( ! $id ) + wp_die( __('Invalid site ID.') ); + +$details = get_blog_details( $id ); +if ( !can_edit_network( $details->site_id ) ) + wp_die( __( 'You do not have permission to access this page.' ) ); + +$is_main_site = is_main_site( $id ); + +if ( isset($_REQUEST['action']) && 'update-site' == $_REQUEST['action'] ) { + check_admin_referer( 'edit-site' ); + + switch_to_blog( $id ); + + if ( isset( $_POST['update_home_url'] ) && $_POST['update_home_url'] == 'update' ) { + $blog_address = get_blogaddress_by_domain( $_POST['blog']['domain'], $_POST['blog']['path'] ); + if ( get_option( 'siteurl' ) != $blog_address ) + update_option( 'siteurl', $blog_address ); + + if ( get_option( 'home' ) != $blog_address ) + update_option( 'home', $blog_address ); + } + + // rewrite rules can't be flushed during switch to blog + delete_option( 'rewrite_rules' ); + + // update blogs table + $blog_data = stripslashes_deep( $_POST['blog'] ); + $existing_details = get_blog_details( $id, false ); + $blog_data_checkboxes = array( 'public', 'archived', 'spam', 'mature', 'deleted' ); + foreach ( $blog_data_checkboxes as $c ) { + if ( ! in_array( $existing_details->$c, array( 0, 1 ) ) ) + $blog_data[ $c ] = $existing_details->$c; + else + $blog_data[ $c ] = isset( $_POST['blog'][ $c ] ) ? 1 : 0; + } + update_blog_details( $id, $blog_data ); + + restore_current_blog(); + wp_redirect( add_query_arg( array( 'update' => 'updated', 'id' => $id ), 'site-info.php') ); + exit; +} + +if ( isset($_GET['update']) ) { + $messages = array(); + if ( 'updated' == $_GET['update'] ) + $messages[] = __('Site info updated.'); +} + +$site_url_no_http = preg_replace( '#^http(s)?://#', '', get_blogaddress_by_id( $id ) ); +$title_site_url_linked = sprintf( __('Edit Site: %2$s'), get_blogaddress_by_id( $id ), $site_url_no_http ); +$title = sprintf( __('Edit Site: %s'), $site_url_no_http ); + +$parent_file = 'sites.php'; +$submenu_file = 'sites.php'; + +require('../admin-header.php'); + +?> + +
    + +

    + +

    ' . $msg . '

    '; +} ?> +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + __( 'Public' ) ); + if ( ! $is_main_site ) { + $attribute_fields['archived'] = __( 'Archived' ); + $attribute_fields['spam'] = _x( 'Spam', 'site' ); + $attribute_fields['deleted'] = __( 'Deleted' ); + } + $attribute_fields['mature'] = __( 'Mature' ); + ?> + + + + +
    domain ) ?>
    path ) ?> +
    /> siteurl and home as well.' ); ?>
    + $field_label ) : ?> +
    + +
    + +
    + +
    +' . __('This screen is for Super Admins to add new sites to the network. This is not affected by the registration settings.') . '

    ' . + '

    ' . __('If the admin email for the new site does not exist in the database, a new user will also be created.') . '

    ' . + '

    ' . __('For more information:') . '

    ' . + '

    ' . __('Documentation on Site Management') . '

    ' . + '

    ' . __('Support Forums') . '

    ' +); + +if ( isset($_REQUEST['action']) && 'add-site' == $_REQUEST['action'] ) { + check_admin_referer( 'add-blog', '_wpnonce_add-blog' ); + + if ( ! current_user_can( 'manage_sites' ) ) + wp_die( __( 'You do not have permission to access this page.' ) ); + + if ( ! is_array( $_POST['blog'] ) ) + wp_die( __( 'Can’t create an empty site.' ) ); + $blog = $_POST['blog']; + $domain = ''; + if ( ! preg_match( '/(--)/', $blog['domain'] ) && preg_match( '|^([a-zA-Z0-9-])+$|', $blog['domain'] ) ) + $domain = strtolower( $blog['domain'] ); + + // If not a subdomain install, make sure the domain isn't a reserved word + if ( ! is_subdomain_install() ) { + $subdirectory_reserved_names = apply_filters( 'subdirectory_reserved_names', array( 'page', 'comments', 'blog', 'files', 'feed' ) ); + if ( in_array( $domain, $subdirectory_reserved_names ) ) + wp_die( sprintf( __('The following words are reserved for use by WordPress functions and cannot be used as blog names: %s' ), implode( ', ', $subdirectory_reserved_names ) ) ); + } + + $email = sanitize_email( $blog['email'] ); + $title = $blog['title']; + + if ( empty( $domain ) ) + wp_die( __( 'Missing or invalid site address.' ) ); + if ( empty( $email ) ) + wp_die( __( 'Missing email address.' ) ); + if ( !is_email( $email ) ) + wp_die( __( 'Invalid email address.' ) ); + + if ( is_subdomain_install() ) { + $newdomain = $domain . '.' . preg_replace( '|^www\.|', '', $current_site->domain ); + $path = $base; + } else { + $newdomain = $current_site->domain; + $path = $base . $domain . '/'; + } + + $password = 'N/A'; + $user_id = email_exists($email); + if ( !$user_id ) { // Create a new user with a random password + $password = wp_generate_password( 12, false ); + $user_id = wpmu_create_user( $domain, $password, $email ); + if ( false == $user_id ) + wp_die( __( 'There was an error creating the user.' ) ); + else + wp_new_user_notification( $user_id, $password ); + } + + $wpdb->hide_errors(); + $id = wpmu_create_blog( $newdomain, $path, $title, $user_id , array( 'public' => 1 ), $current_site->id ); + $wpdb->show_errors(); + if ( !is_wp_error( $id ) ) { + if ( !is_super_admin( $user_id ) && !get_user_option( 'primary_blog', $user_id ) ) + update_user_option( $user_id, 'primary_blog', $id, true ); + $content_mail = sprintf( __( "New site created by %1s\n\nAddress: http://%2s\nName: %3s"), $current_user->user_login , $newdomain . $path, stripslashes( $title ) ); + wp_mail( get_site_option('admin_email'), sprintf( __( '[%s] New Site Created' ), $current_site->site_name ), $content_mail, 'From: "Site Admin" <' . get_site_option( 'admin_email' ) . '>' ); + wpmu_welcome_notification( $id, $user_id, $password, $title, array( 'public' => 1 ) ); + wp_redirect( add_query_arg( array('update' => 'added'), 'site-new.php' ) ); + exit; + } else { + wp_die( $id->get_error_message() ); + } +} + +if ( isset($_GET['update']) ) { + $messages = array(); + if ( 'added' == $_GET['update'] ) + $messages[] = __('Site added.'); +} + +$title = __('Add New Site'); +$parent_file = 'sites.php'; + +require('../admin-header.php'); + +?> + +
    + +

    +

    ' . $msg . '

    '; +} ?> +
    + + + + + + + + + + + + + + + + + +
    + + .domain );?> + domain . $current_site->path ?> + ' . __( 'Only the characters a-z and 0-9 recommended.' ) . '

    '; + ?> +

    + +
    +
    + diff --git a/src/wp-admin/network/site-settings.php b/src/wp-admin/network/site-settings.php new file mode 100644 index 0000000..35bcb43 --- /dev/null +++ b/src/wp-admin/network/site-settings.php @@ -0,0 +1,153 @@ +' . __('The menu is for editing information specific to individual sites, particularly if the admin area of a site is unavailable.') . '

    ' . + '

    ' . __('Info - The domain and path are rarely edited as this can cause the site to not work properly. The Registered date and Last Updated date are displayed. Network admins can mark a site as archived, spam, deleted and mature, to remove from public listings or disable.') . '

    ' . + '

    ' . __('Users - This displays the users associated with this site. You can also change their role, reset their password, or remove them from the site. Removing the user from the site does not remove the user from the network.') . '

    ' . + '

    ' . sprintf( __('Themes - This area shows themes that are not already enabled across the network. Enabling a theme in this menu makes it accessible to this site. It does not activate the theme, but allows it to show in the site’s Appearance menu. To enable a theme for the entire network, see the Network Themes screen.' ), network_admin_url( 'themes.php' ) ) . '

    ' . + '

    ' . __('Settings - This page shows a list of all settings associated with this site. Some are created by WordPress and others are created by plugins you activate. Note that some fields are grayed out and say Serialized Data. You cannot modify these values due to the way the setting is stored in the database.') . '

    ' . + '

    ' . __('For more information:') . '

    ' . + '

    ' . __('Documentation on Site Management') . '

    ' . + '

    ' . __('Support Forums') . '

    ' +); + +$id = isset( $_REQUEST['id'] ) ? intval( $_REQUEST['id'] ) : 0; + +if ( ! $id ) + wp_die( __('Invalid site ID.') ); + +$details = get_blog_details( $id ); +if ( !can_edit_network( $details->site_id ) ) + wp_die( __( 'You do not have permission to access this page.' ) ); + +$is_main_site = is_main_site( $id ); + +if ( isset($_REQUEST['action']) && 'update-site' == $_REQUEST['action'] && is_array( $_POST['option'] ) ) { + check_admin_referer( 'edit-site' ); + + switch_to_blog( $id ); + + $c = 1; + $count = count( $_POST['option'] ); + $skip_options = array( 'allowedthemes' ); // Don't update these options since they are handled elsewhere in the form. + foreach ( (array) $_POST['option'] as $key => $val ) { + if ( $key === 0 || is_array( $val ) || in_array($key, $skip_options) ) + continue; // Avoids "0 is a protected WP option and may not be modified" error when edit blog options + if ( $c == $count ) + update_option( $key, stripslashes( $val ) ); + else + update_option( $key, stripslashes( $val ), false ); // no need to refresh blog details yet + $c++; + } + + do_action( 'wpmu_update_blog_options' ); + restore_current_blog(); + wp_redirect( add_query_arg( array( 'update' => 'updated', 'id' => $id ), 'site-settings.php') ); + exit; +} + +if ( isset($_GET['update']) ) { + $messages = array(); + if ( 'updated' == $_GET['update'] ) + $messages[] = __('Site options updated.'); +} + +$site_url_no_http = preg_replace( '#^http(s)?://#', '', get_blogaddress_by_id( $id ) ); +$title_site_url_linked = sprintf( __('Edit Site: %2$s'), get_blogaddress_by_id( $id ), $site_url_no_http ); +$title = sprintf( __('Edit Site: %s'), $site_url_no_http ); + +$parent_file = 'sites.php'; +$submenu_file = 'sites.php'; + +require('../admin-header.php'); + +?> + +
    + +

    + +

    ' . $msg . '

    '; +} ?> +
    + + + + get_blog_prefix( $id ); + $options = $wpdb->get_results( "SELECT * FROM {$blog_prefix}options WHERE option_name NOT LIKE '\_%' AND option_name NOT LIKE '%user_roles'" ); + foreach ( $options as $option ) { + if ( $option->option_name == 'default_role' ) + $editblog_default_role = $option->option_value; + $disabled = false; + $class = 'all-options'; + if ( is_serialized( $option->option_value ) ) { + if ( is_serialized_string( $option->option_value ) ) { + $option->option_value = esc_html( maybe_unserialize( $option->option_value ), 'single' ); + } else { + $option->option_value = 'SERIALIZED DATA'; + $disabled = true; + $class = 'all-options disabled'; + } + } + if ( strpos( $option->option_value, "\n" ) !== false ) { + ?> + + + + + + + + option_name, array( 'siteurl', 'home' ) ) ) { ?> + + + + + + +
    option_name ) ) ?>
    option_name ) ) ); ?>option_value ) ?> />
    + +
    + +
    +' . __('The menu is for editing information specific to individual sites, particularly if the admin area of a site is unavailable.') . '

    ' . + '

    ' . __('Info - The domain and path are rarely edited as this can cause the site to not work properly. The Registered date and Last Updated date are displayed. Network admins can mark a site as archived, spam, deleted and mature, to remove from public listings or disable.') . '

    ' . + '

    ' . __('Users - This displays the users associated with this site. You can also change their role, reset their password, or remove them from the site. Removing the user from the site does not remove the user from the network.') . '

    ' . + '

    ' . sprintf( __('Themes - This area shows themes that are not already enabled across the network. Enabling a theme in this menu makes it accessible to this site. It does not activate the theme, but allows it to show in the site’s Appearance menu. To enable a theme for the entire network, see the Network Themes screen.' ), network_admin_url( 'themes.php' ) ) . '

    ' . + '

    ' . __('Settings - This page shows a list of all settings associated with this site. Some are created by WordPress and others are created by plugins you activate. Note that some fields are grayed out and say Serialized Data. You cannot modify these values due to the way the setting is stored in the database.') . '

    ' . + '

    ' . __('For more information:') . '

    ' . + '

    ' . __('Documentation on Site Management') . '

    ' . + '

    ' . __('Support Forums') . '

    ' +); + +$wp_list_table = _get_list_table('WP_MS_Themes_List_Table'); + +$action = $wp_list_table->current_action(); + +$s = isset($_REQUEST['s']) ? $_REQUEST['s'] : ''; + +// Clean up request URI from temporary args for screen options/paging uri's to work as expected. +$temp_args = array( 'enabled', 'disabled', 'error' ); +$_SERVER['REQUEST_URI'] = remove_query_arg( $temp_args, $_SERVER['REQUEST_URI'] ); +$referer = remove_query_arg( $temp_args, wp_get_referer() ); + +$id = isset( $_REQUEST['id'] ) ? intval( $_REQUEST['id'] ) : 0; + +if ( ! $id ) + wp_die( __('Invalid site ID.') ); + +$wp_list_table->prepare_items(); + +$details = get_blog_details( $id ); +if ( !can_edit_network( $details->site_id ) ) + wp_die( __( 'You do not have permission to access this page.' ) ); + +$is_main_site = is_main_site( $id ); + +if ( $action ) { + switch_to_blog( $id ); + $allowed_themes = get_option( 'allowedthemes' ); + + switch ( $action ) { + case 'enable': + check_admin_referer( 'enable-theme_' . $_GET['theme'] ); + $theme = $_GET['theme']; + $action = 'enabled'; + $n = 1; + if ( !$allowed_themes ) + $allowed_themes = array( $theme => true ); + else + $allowed_themes[$theme] = true; + break; + case 'disable': + check_admin_referer( 'disable-theme_' . $_GET['theme'] ); + $theme = $_GET['theme']; + $action = 'disabled'; + $n = 1; + if ( !$allowed_themes ) + $allowed_themes = array(); + else + unset( $allowed_themes[$theme] ); + break; + case 'enable-selected': + check_admin_referer( 'bulk-themes' ); + if ( isset( $_POST['checked'] ) ) { + $themes = (array) $_POST['checked']; + $action = 'enabled'; + $n = count( $themes ); + foreach( (array) $themes as $theme ) + $allowed_themes[ $theme ] = true; + } else { + $action = 'error'; + $n = 'none'; + } + break; + case 'disable-selected': + check_admin_referer( 'bulk-themes' ); + if ( isset( $_POST['checked'] ) ) { + $themes = (array) $_POST['checked']; + $action = 'disabled'; + $n = count( $themes ); + foreach( (array) $themes as $theme ) + unset( $allowed_themes[ $theme ] ); + } else { + $action = 'error'; + $n = 'none'; + } + break; + } + + update_option( 'allowedthemes', $allowed_themes ); + restore_current_blog(); + + wp_redirect( add_query_arg( $action, $n, $referer ) ); + exit; +} + +if ( isset( $_GET['action'] ) && 'update-site' == $_GET['action'] ) { + wp_redirect( $referer ); + exit(); +} + +add_thickbox(); +add_screen_option( 'per_page', array( 'label' => _x( 'Themes', 'themes per page (screen options)' ) ) ); + +$site_url_no_http = preg_replace( '#^http(s)?://#', '', get_blogaddress_by_id( $id ) ); +$title_site_url_linked = sprintf( __('Edit Site: %2$s'), get_blogaddress_by_id( $id ), $site_url_no_http ); +$title = sprintf( __('Edit Site: %s'), $site_url_no_http ); + +$parent_file = 'sites.php'; +$submenu_file = 'sites.php'; + +require('../admin-header.php'); ?> + +
    + +

    +

    ' . sprintf( _n( 'Theme enabled.', '%s themes enabled.', $_GET['enabled'] ), number_format_i18n( $_GET['enabled'] ) ) . '

    '; +} elseif ( isset( $_GET['disabled'] ) ) { + $_GET['disabled'] = absint( $_GET['disabled'] ); + echo '

    ' . sprintf( _n( 'Theme disabled.', '%s themes disabled.', $_GET['disabled'] ), number_format_i18n( $_GET['disabled'] ) ) . '

    '; +} elseif ( isset( $_GET['error'] ) && 'none' == $_GET['error'] ) { + echo '

    ' . __( 'No theme selected.' ) . '

    '; +} ?> + +

    + +
    +search_box( __( 'Search Installed Themes' ), 'theme' ); ?> + +
    + +views(); ?> + +
    + + + +display(); ?> + +
    + + + diff --git a/src/wp-admin/network/site-users.php b/src/wp-admin/network/site-users.php new file mode 100644 index 0000000..82788af --- /dev/null +++ b/src/wp-admin/network/site-users.php @@ -0,0 +1,311 @@ +prepare_items(); + +$action = $wp_list_table->current_action(); + +add_contextual_help($current_screen, + '

    ' . __('The menu is for editing information specific to individual sites, particularly if the admin area of a site is unavailable.') . '

    ' . + '

    ' . __('Info - The domain and path are rarely edited as this can cause the site to not work properly. The Registered date and Last Updated date are displayed. Network admins can mark a site as archived, spam, deleted and mature, to remove from public listings or disable.') . '

    ' . + '

    ' . __('Users - This displays the users associated with this site. You can also change their role, reset their password, or remove them from the site. Removing the user from the site does not remove the user from the network.') . '

    ' . + '

    ' . sprintf( __('Themes - This area shows themes that are not already enabled across the network. Enabling a theme in this menu makes it accessible to this site. It does not activate the theme, but allows it to show in the site’s Appearance menu. To enable a theme for the entire network, see the Network Themes screen.' ), network_admin_url( 'themes.php' ) ) . '

    ' . + '

    ' . __('Settings - This page shows a list of all settings associated with this site. Some are created by WordPress and others are created by plugins you activate. Note that some fields are grayed out and say Serialized Data. You cannot modify these values due to the way the setting is stored in the database.') . '

    ' . + '

    ' . __('For more information:') . '

    ' . + '

    ' . __('Documentation on Site Management') . '

    ' . + '

    ' . __('Support Forums') . '

    ' +); + +$id = isset( $_REQUEST['id'] ) ? intval( $_REQUEST['id'] ) : 0; + +if ( ! $id ) + wp_die( __('Invalid site ID.') ); + +$details = get_blog_details( $id ); +if ( !can_edit_network( $details->site_id ) ) + wp_die( __( 'You do not have permission to access this page.' ) ); + +$is_main_site = is_main_site( $id ); + +// get blog prefix +$blog_prefix = $wpdb->get_blog_prefix( $id ); + +// @todo This is a hack. Eventually, add API to WP_Roles allowing retrieval of roles for a particular blog. +if ( ! empty($wp_roles->use_db) ) { + $editblog_roles = get_blog_option( $id, "{$blog_prefix}user_roles" ); +} else { + // Roles are stored in memory, not the DB. + $editblog_roles = $wp_roles->roles; +} +$default_role = get_blog_option( $id, 'default_role' ); + +$action = $wp_list_table->current_action(); + +if ( $action ) { + switch_to_blog( $id ); + + switch ( $action ) { + case 'newuser': + check_admin_referer( 'add-user', '_wpnonce_add-new-user' ); + $user = $_POST['user']; + if ( !is_array( $_POST['user'] ) || empty( $user['username'] ) || empty( $user['email'] ) ) { + $update = 'err_new'; + } else { + $password = wp_generate_password( 12, false); + $user_id = wpmu_create_user( esc_html( strtolower( $user['username'] ) ), $password, esc_html( $user['email'] ) ); + + if ( false == $user_id ) { + $update = 'err_new_dup'; + } else { + wp_new_user_notification( $user_id, $password ); + add_user_to_blog( $id, $user_id, $_POST['new_role'] ); + $update = 'newuser'; + } + } + break; + + case 'adduser': + check_admin_referer( 'add-user', '_wpnonce_add-user' ); + if ( !empty( $_POST['newuser'] ) ) { + $update = 'adduser'; + $newuser = $_POST['newuser']; + $userid = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM " . $wpdb->users . " WHERE user_login = %s", $newuser ) ); + if ( $userid ) { + $user = $wpdb->get_var( "SELECT user_id FROM " . $wpdb->usermeta . " WHERE user_id='$userid' AND meta_key='{$blog_prefix}capabilities'" ); + if ( $user == false ) + add_user_to_blog( $id, $userid, $_POST['new_role'] ); + else + $update = 'err_add_member'; + } else { + $update = 'err_add_notfound'; + } + } else { + $update = 'err_add_notfound'; + } + break; + + case 'remove': + if ( !current_user_can('remove_users') ) + die(__('You can’t remove users.')); + check_admin_referer( 'bulk-users' ); + + $update = 'remove'; + if ( isset( $_REQUEST['users'] ) ) { + $userids = $_REQUEST['users']; + + foreach ( $userids as $user_id ) { + $user_id = (int) $user_id; + remove_user_from_blog( $user_id, $id ); + } + } elseif ( isset( $_GET['user'] ) ) { + remove_user_from_blog( $_GET['user'] ); + } else { + $update = 'err_remove'; + } + break; + + case 'promote': + check_admin_referer( 'bulk-users' ); + $editable_roles = get_editable_roles(); + if ( empty( $editable_roles[$_REQUEST['new_role']] ) ) + wp_die(__('You can’t give users that role.')); + + if ( isset( $_REQUEST['users'] ) ) { + $userids = $_REQUEST['users']; + $update = 'promote'; + foreach ( $userids as $user_id ) { + $user_id = (int) $user_id; + + // If the user doesn't already belong to the blog, bail. + if ( !is_user_member_of_blog( $user_id ) ) + wp_die(__('Cheatin’ uh?')); + + $user = new WP_User( $user_id ); + $user->set_role( $_REQUEST['new_role'] ); + } + } else { + $update = 'err_promote'; + } + break; + } + + restore_current_blog(); + wp_redirect( add_query_arg( 'update', $update, wp_get_referer() ) ); + exit(); +} + +if ( isset( $_GET['action'] ) && 'update-site' == $_GET['action'] ) { + wp_redirect( wp_get_referer() ); + exit(); +} + +add_screen_option( 'per_page', array( 'label' => _x( 'Users', 'users per page (screen options)' ) ) ); + +$site_url_no_http = preg_replace( '#^http(s)?://#', '', get_blogaddress_by_id( $id ) ); +$title_site_url_linked = sprintf( __('Edit Site: %2$s'), get_blogaddress_by_id( $id ), $site_url_no_http ); +$title = sprintf( __('Edit Site: %s'), $site_url_no_http ); + +$parent_file = 'sites.php'; +$submenu_file = 'sites.php'; + +require('../admin-header.php'); ?> + +
    + +

    +

    ' . __( 'User added.' ) . '

    '; + break; + case 'err_add_member': + echo '

    ' . __( 'User is already a member of this site.' ) . '

    '; + break; + case 'err_add_notfound': + echo '

    ' . __( 'Enter the username of an existing user.' ) . '

    '; + break; + case 'promote': + echo '

    ' . __( 'Changed roles.' ) . '

    '; + break; + case 'err_promote': + echo '

    ' . __( 'Select a user to change role.' ) . '

    '; + break; + case 'remove': + echo '

    ' . __( 'User removed from this site.' ) . '

    '; + break; + case 'err_remove': + echo '

    ' . __( 'Select a user to remove.' ) . '

    '; + break; + case 'newuser': + echo '

    ' . __( 'User created.' ) . '

    '; + break; + case 'err_new': + echo '

    ' . __( 'Enter the username and email.' ) . '

    '; + break; + case 'err_new_dup': + echo '

    ' . __( 'Duplicated username or email address.' ) . '

    '; + break; + } +endif; ?> + +
    +search_box( __( 'Search Users' ), 'user' ); ?> + +
    + +views(); ?> + +
    + + + +display(); ?> + +
    + + + + +

    + +

    + +

    + +
    +
    + + + + + + + + + + + +
    + + 'submit-add-existing-user' ) ); ?> +
    + + + +
    +
    + + + + + + + + + + + + + + + + + + +
    + + 'submit-add-user' ) ); ?> +
    + + +get_pagenum(); + +$title = __( 'Sites' ); +$parent_file = 'sites.php'; + +add_screen_option( 'per_page', array('label' => _x( 'Sites', 'sites per page (screen options)' )) ); + +add_contextual_help($current_screen, + '

    ' . __('Add New takes you to the Add New Site screen. You can search for a site by Name, ID number, or IP address. Screen Options allows you to choose how many sites to display on one page.') . '

    ' . + '

    ' . __('This is the main table of all sites on this network. Switch between list and excerpt views by using the icons above the right side of the table.') . '

    ' . + '

    ' . __('Hovering over each site reveals seven options (three for the primary site):') . '

    ' . + '
    • ' . __('An Edit link to a separate Edit Site screen.') . '
    • ' . + '
    • ' . __('Dashboard leads to the Dashboard for that site.') . '
    • ' . + '
    • ' . __('Deactivate, Archive, and Spam which lead to confirmation screens. These actions can be reversed later.') . '
    • ' . + '
    • ' . __('Delete which is a permanent action after the confirmation screens.') . '
    • ' . + '
    • ' . __('Visit to go to the frontend site live.') . '
    ' . + '

    ' . __('The site ID is used internally, and is not shown on the front end of the site or to users/viewers.') . '

    ' . + '

    ' . __('Clicking on bold headings can re-sort this table.') . '

    ' . + '

    ' . __('For more information:') . '

    ' . + '

    ' . __('Documentation on Site Management') . '

    ' . + '

    ' . __('Support Forums') . '

    ' +); + +$id = isset( $_REQUEST['id'] ) ? intval( $_REQUEST['id'] ) : 0; + +$msg = ''; +if ( isset( $_REQUEST['updated'] ) && $_REQUEST['updated'] == 'true' && ! empty( $_REQUEST['action'] ) ) { + switch ( $_REQUEST['action'] ) { + case 'all_notspam': + $msg = __( 'Sites removed from spam.' ); + break; + case 'all_spam': + $msg = __( 'Sites marked as spam.' ); + break; + case 'all_delete': + $msg = __( 'Sites deleted.' ); + break; + case 'delete': + $msg = __( 'Site deleted.' ); + break; + case 'not_deleted': + $msg = __( 'You do not have permission to delete that site.' ); + break; + case 'archive': + $msg = __( 'Site archived.' ); + break; + case 'unarchive': + $msg = __( 'Site unarchived.' ); + break; + case 'activate': + $msg = __( 'Site activated.' ); + break; + case 'deactivate': + $msg = __( 'Site deactivated.' ); + break; + case 'unspam': + $msg = __( 'Site removed from spam.' ); + break; + case 'spam': + $msg = __( 'Site marked as spam.' ); + break; + default: + $msg = apply_filters( 'network_sites_updated_message_' . $_REQUEST['action'] , __( 'Settings saved.' ) ); + break; + } + if ( $msg ) + $msg = '

    ' . $msg . '

    '; +} + +$wp_list_table->prepare_items(); + +require_once( '../admin-header.php' ); +?> + +
    + +

    + + + + + +' . __( 'Search results for “%s”' ) . '', esc_html( $s ) ); +} ?> +

    + + + +
    + display(); ?> +
    +
    + diff --git a/src/wp-admin/network/theme-editor.php b/src/wp-admin/network/theme-editor.php new file mode 100644 index 0000000..f6ac9c2 --- /dev/null +++ b/src/wp-admin/network/theme-editor.php @@ -0,0 +1,16 @@ +get_pagenum(); + +$action = $wp_list_table->current_action(); + +$s = isset($_REQUEST['s']) ? $_REQUEST['s'] : ''; + +// Clean up request URI from temporary args for screen options/paging uri's to work as expected. +$temp_args = array( 'enabled', 'disabled', 'deleted', 'error' ); +$_SERVER['REQUEST_URI'] = remove_query_arg( $temp_args, $_SERVER['REQUEST_URI'] ); +$referer = remove_query_arg( $temp_args, wp_get_referer() ); + +if ( $action ) { + $allowed_themes = get_site_option( 'allowedthemes' ); + switch ( $action ) { + case 'enable': + check_admin_referer('enable-theme_' . $_GET['theme']); + $allowed_themes[ $_GET['theme'] ] = true; + update_site_option( 'allowedthemes', $allowed_themes ); + wp_redirect( add_query_arg( 'enabled', '1', $referer ) ); + exit; + break; + case 'disable': + check_admin_referer('disable-theme_' . $_GET['theme']); + unset( $allowed_themes[ $_GET['theme'] ] ); + update_site_option( 'allowedthemes', $allowed_themes ); + wp_redirect( add_query_arg( 'disabled', '1', $referer ) ); + exit; + break; + case 'enable-selected': + check_admin_referer('bulk-themes'); + $themes = isset( $_POST['checked'] ) ? (array) $_POST['checked'] : array(); + if ( empty($themes) ) { + wp_redirect( add_query_arg( 'error', 'none', $referer ) ); + exit; + } + foreach( (array) $themes as $theme ) + $allowed_themes[ $theme ] = true; + update_site_option( 'allowedthemes', $allowed_themes ); + wp_redirect( add_query_arg( 'enabled', count( $themes ), $referer ) ); + exit; + break; + case 'disable-selected': + check_admin_referer('bulk-themes'); + $themes = isset( $_POST['checked'] ) ? (array) $_POST['checked'] : array(); + if ( empty($themes) ) { + wp_redirect( add_query_arg( 'error', 'none', $referer ) ); + exit; + } + foreach( (array) $themes as $theme ) + unset( $allowed_themes[ $theme ] ); + update_site_option( 'allowedthemes', $allowed_themes ); + wp_redirect( add_query_arg( 'disabled', count( $themes ), $referer ) ); + exit; + break; + case 'delete-selected': + if ( ! current_user_can( 'delete_themes' ) ) + wp_die( __('You do not have sufficient permissions to delete themes for this site.') ); + check_admin_referer( 'bulk-themes' ); + + $themes = isset( $_REQUEST['checked'] ) ? (array) $_REQUEST['checked'] : array(); + + if ( isset( $themes[ get_option( 'template' ) ] ) ) + unset( $themes[ get_option( 'template' ) ] ); + if ( isset( $themes[ get_option( 'stylesheet' ) ] ) ) + unset( $themes[ get_option( 'stylesheet' ) ] ); + + if ( empty( $themes ) ) { + wp_redirect( add_query_arg( 'error', 'none', $referer ) ); + exit; + } + + $main_theme = get_current_theme(); + $files_to_delete = $theme_info = array(); + foreach ( $themes as $key => $theme ) { + $data = get_theme_data( WP_CONTENT_DIR . '/themes/' . $theme . '/style.css' ); + if ( $data['Name'] == $main_theme ) { + unset( $themes[$key] ); + } else { + $files_to_delete = array_merge( $files_to_delete, list_files( WP_CONTENT_DIR . "/themes/$theme" ) ); + $theme_info[ $theme ] = $data; + } + } + + if ( empty( $themes ) ) { + wp_redirect( add_query_arg( 'error', 'main', $referer ) ); + exit; + } + + include(ABSPATH . 'wp-admin/update.php'); + + $parent_file = 'themes.php'; + + if ( ! isset( $_REQUEST['verify-delete'] ) ) { + wp_enqueue_script( 'jquery' ); + require_once( ABSPATH . 'wp-admin/admin-header.php' ); + ?> +
    + ' . _n( 'Delete Theme', 'Delete Themes', $themes_to_delete ) . ''; + ?> +

    +

    +
      + ', sprintf( __('%1$s by %2$s' ), esc_html( $theme['Name'] ), esc_html( $theme['AuthorName'] ) ), ''; /* translators: 1: theme name, 2: theme author */ ?> +
    +

    +
    + + + '; + ?> + + +
    +
    + +
    + +

    + +
    + 1), $_SERVER['REQUEST_URI'] ) ) ); + $paged = ( $_REQUEST['paged'] ) ? $_REQUEST['paged'] : 1; + wp_redirect( network_admin_url( "themes.php?deleted=".count( $themes )."&paged=$paged&s=$s" ) ); + exit; + break; + } +} + +$wp_list_table->prepare_items(); + +add_thickbox(); + +add_screen_option( 'per_page', array('label' => _x( 'Themes', 'themes per page (screen options)' )) ); + +add_contextual_help($current_screen, + '

    ' . __('This screen enables and disables the inclusion of themes available to choose in the Appearance menu for each site. It does not activate or deactivate which theme a site is currently using.') . '

    ' . + '

    ' . __('If the network admin disables a theme that is in use, it can still remain selected on that site. If another theme is chosen, the disabled theme will not appear in the site’s Appearance > Themes screen.') . '

    ' . + '

    ' . __('Themes can be enabled on a site by site basis by the network admin on the Edit Site screen (which has a Themes tab); get there via the Edit action link on the All Sites screen. Only network admins are able to install or edit themes.') . '

    ' . + '

    ' . __('For more information:') . '

    ' . + '

    ' . __('Documentation on Network Themes') . '

    ' . + '

    ' . __('Support Forums') . '

    ' +); + +$title = __('Themes'); +$parent_file = 'themes.php'; + +require_once(ABSPATH . 'wp-admin/admin-header.php'); + +?> + +
    + +

    ' . __('Search results for “%s”') . '', esc_html( $s ) ); ?> +

    + +

    ' . sprintf( _n( 'Theme enabled.', '%s themes enabled.', $_GET['enabled'] ), number_format_i18n( $_GET['enabled'] ) ) . '

    '; +} elseif ( isset( $_GET['disabled'] ) ) { + $_GET['disabled'] = absint( $_GET['disabled'] ); + echo '

    ' . sprintf( _n( 'Theme disabled.', '%s themes disabled.', $_GET['disabled'] ), number_format_i18n( $_GET['disabled'] ) ) . '

    '; +} elseif ( isset( $_GET['deleted'] ) ) { + $_GET['deleted'] = absint( $_GET['deleted'] ); + echo '

    ' . sprintf( _nx( 'Theme deleted.', '%s themes deleted.', $_GET['deleted'], 'network' ), number_format_i18n( $_GET['deleted'] ) ) . '

    '; +} elseif ( isset( $_GET['error'] ) && 'none' == $_GET['error'] ) { + echo '

    ' . __( 'No theme selected.' ) . '

    '; +} elseif ( isset( $_GET['error'] ) && 'main' == $_GET['error'] ) { + echo '

    ' . __( 'You cannot delete a theme while it is active on the main site.' ) . '

    '; +} + +?> + +
    +search_box( __( 'Search Installed Themes' ), 'theme' ); ?> +
    + +views(); ?> + +
    + + + +display(); ?> +
    + + + +' . __('Only use this screen once you have updated to a new version of WordPress through Updates/Available Updates (via the Network Administration navigation menu or the Admin Bar). Clicking the Update Network button will step through each site in the network, five at a time, and make sure any database updates are applied.') . '

    ' . + '

    ' . __('If a version update to core has not happened, clicking this button won’t affect anything.') . '

    ' . + '

    ' . __('If this process fails for any reason, users logging in to their sites will force the same update.') . '

    ' . + '

    ' . __('For more information:') . '

    ' . + '

    ' . __('Documentation on Update Network') . '

    ' . + '

    ' . __('Support Forums') . '

    ' +); + +require_once('../admin-header.php'); + +if ( ! current_user_can( 'manage_network' ) ) + wp_die( __( 'You do not have permission to access this page.' ) ); + +echo '
    '; +screen_icon('tools'); +echo '

    ' . __( 'Update Network' ) . '

    '; + +$action = isset($_GET['action']) ? $_GET['action'] : 'show'; + +switch ( $action ) { + case "upgrade": + $n = ( isset($_GET['n']) ) ? intval($_GET['n']) : 0; + + if ( $n < 5 ) { + global $wp_db_version; + update_site_option( 'wpmu_upgrade_site', $wp_db_version ); + } + + $blogs = $wpdb->get_results( "SELECT * FROM {$wpdb->blogs} WHERE site_id = '{$wpdb->siteid}' AND spam = '0' AND deleted = '0' AND archived = '0' ORDER BY registered DESC LIMIT {$n}, 5", ARRAY_A ); + if ( empty( $blogs ) ) { + echo '

    ' . __( 'All done!' ) . '

    '; + break; + } + echo "
      "; + foreach ( (array) $blogs as $details ) { + $siteurl = get_blog_option( $details['blog_id'], 'siteurl' ); + echo "
    • $siteurl
    • "; + $response = wp_remote_get( trailingslashit( $siteurl ) . "wp-admin/upgrade.php?step=upgrade_db", array( 'timeout' => 120, 'httpversion' => '1.1' ) ); + if ( is_wp_error( $response ) ) + wp_die( sprintf( __( 'Warning! Problem updating %1$s. Your server may not be able to connect to sites running on it. Error message: %2$s' ), $siteurl, $response->get_error_message() ) ); + do_action( 'after_mu_upgrade', $response ); + do_action( 'wpmu_upgrade_site', $details[ 'blog_id' ] ); + } + echo "
    "; + ?>

    +

    +

    +
    + + diff --git a/src/wp-admin/network/user-edit.php b/src/wp-admin/network/user-edit.php new file mode 100644 index 0000000..0b2cfd2 --- /dev/null +++ b/src/wp-admin/network/user-edit.php @@ -0,0 +1,16 @@ +' . __('Add User will set up a new user account on the network and send that person an email with username and password.') . '

    ' . + '

    ' . __('Users who are signed up to the network without a site are added as subscribers to the main or primary dashboard site, giving them profile pages to manage their accounts. These users will only see Dashboard and My Sites in the main navigation until a site is created for them.') . '

    ' . + '

    ' . __('For more information:') . '

    ' . + '

    ' . __('Documentation on Network Users') . '

    ' . + '

    ' . __('Support Forums') . '

    ' +); + +if ( isset($_REQUEST['action']) && 'add-user' == $_REQUEST['action'] ) { + check_admin_referer( 'add-user', '_wpnonce_add-user' ); + if ( ! current_user_can( 'manage_network_users' ) ) + wp_die( __( 'You do not have permission to access this page.' ) ); + + if ( ! is_array( $_POST['user'] ) ) + wp_die( __( 'Cannot create an empty user.' ) ); + + $user = $_POST['user']; + + $user_details = wpmu_validate_user_signup( $user['username'], $user['email'] ); + if ( is_wp_error( $user_details[ 'errors' ] ) && ! empty( $user_details[ 'errors' ]->errors ) ) { + $add_user_errors = $user_details[ 'errors' ]; + } else { + $password = wp_generate_password( 12, false); + $user_id = wpmu_create_user( esc_html( strtolower( $user['username'] ) ), $password, esc_html( $user['email'] ) ); + + if ( ! $user_id ) { + $add_user_errors = new WP_Error( 'add_user_fail', __( 'Cannot add user.' ) ); + } else { + wp_new_user_notification( $user_id, $password ); + wp_redirect( add_query_arg( array('update' => 'added'), 'user-new.php' ) ); + exit; + } + } +} + +if ( isset($_GET['update']) ) { + $messages = array(); + if ( 'added' == $_GET['update'] ) + $messages[] = __('User added.'); +} + +$title = __('Add New User'); +$parent_file = 'users.php'; + +require('../admin-header.php'); ?> + +
    + +

    +

    ' . $msg . '

    '; +} + +if ( isset( $add_user_errors ) && is_wp_error( $add_user_errors ) ) { ?> +
    + get_error_messages() as $message ) + echo "

    $message

    "; + ?> +
    + +
    + + + + + + + + + + + + +
    + + +
    + + diff --git a/src/wp-admin/network/users.php b/src/wp-admin/network/users.php new file mode 100644 index 0000000..44a6c9c --- /dev/null +++ b/src/wp-admin/network/users.php @@ -0,0 +1,96 @@ +get_pagenum(); +$wp_list_table->prepare_items(); +$total_pages = $wp_list_table->get_pagination_arg( 'total_pages' ); + +if ( $pagenum > $total_pages && $total_pages > 0 ) { + wp_redirect( add_query_arg( 'paged', $total_pages ) ); + exit; +} +$title = __( 'Users' ); +$parent_file = 'users.php'; + +add_screen_option( 'per_page', array('label' => _x( 'Users', 'users per page (screen options)' )) ); + +add_contextual_help($current_screen, + '

    ' . __('This table shows all users across the network and the sites to which they are assigned.') . '

    ' . + '

    ' . __('Hover over any user on the list to make the edit links appear. The Edit link on the left will take you to his or her Edit User profile page; the Edit link on the right by any site name goes to an Edit Site screen for that site.') . '

    ' . + '

    ' . __('You can also go to the user’s profile page by clicking on the individual username.') . '

    ' . + '

    ' . __('You can sort the table by clicking on any of the bold headings and switch between list and excerpt views by using the icons in the upper right.') . '

    ' . + '

    ' . __('The bulk action will permanently delete selected users, or mark/unmark those selected as spam. Spam users will have posts removed and will be unable to sign up again with the same email addresses.') . '

    ' . + '

    ' . __('You can make an existing user an additional super admin by going to the Edit User profile page and checking the box to grant that privilege.') . '

    ' . + '

    ' . __('For more information:') . '

    ' . + '

    ' . __('Documentation on Network Users') . '

    ' . + '

    ' . __('Support Forums') . '

    ' +); + +require_once( '../admin-header.php' ); + +if ( isset( $_REQUEST['updated'] ) && $_REQUEST['updated'] == 'true' && ! empty( $_REQUEST['action'] ) ) { + ?> +

    + +

    + +
    + +

    + ' . __( 'Search results for “%s”' ) . '', esc_html( $usersearch ) ); + ?> +

    + + views(); ?> + +
    + search_box( __( 'Search Users' ), 'user' ); ?> +
    + +
    + display(); ?> +
    +
    + + diff --git a/src/wp-admin/options-discussion.php b/src/wp-admin/options-discussion.php new file mode 100644 index 0000000..862b002 --- /dev/null +++ b/src/wp-admin/options-discussion.php @@ -0,0 +1,248 @@ +' . __('This screen provides many options for controlling the management and display of comments and links to your posts/pages. So many, in fact, they won’t all fit here! :) Use the documentation link below to get information on what each discussion setting does.') . '

    ' . + '

    ' . __('You must click the Save Changes button at the bottom of the screen for new settings to take effect.') . '

    ' . + '

    ' . __('For more information:') . '

    ' . + '

    ' . __('Documentation on Discussion Settings') . '

    ' . + '

    ' . __('Support Forums') . '

    ' +); + +include('./admin-header.php'); +?> + +
    + +

    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + +
    + +
    + +
    + +
    + +
    + +
    + +
    + +
    + +
    + +
    + +
    +

    + +

    +

    + +

    +
    +

    +

    + +

    +
    + +

    + +

    + + + + + + + + + + + + + + + + + +
    + __( 'Don’t show Avatars' ), 1 => __( 'Show Avatars' ) ); + foreach ( $yesorno as $key => $value) { + $selected = (get_option('show_avatars') == $key) ? 'checked="checked"' : ''; + echo "\n\t
    "; + } +?> +
    + + __('G — Suitable for all audiences'), + /* translators: Content suitability rating: http://bit.ly/89QxZA */ + 'PG' => __('PG — Possibly offensive, usually for audiences 13 and above'), + /* translators: Content suitability rating: http://bit.ly/89QxZA */ + 'R' => __('R — Intended for adult audiences above 17'), + /* translators: Content suitability rating: http://bit.ly/89QxZA */ + 'X' => __('X — Even more mature than above') +); +foreach ($ratings as $key => $rating) : + $selected = (get_option('avatar_rating') == $key) ? 'checked="checked"' : ''; + echo "\n\t
    "; +endforeach; +?> + +
    + +
    + + __('Mystery Man'), + 'blank' => __('Blank'), + 'gravatar_default' => __('Gravatar Logo'), + 'identicon' => __('Identicon (Generated)'), + 'wavatar' => __('Wavatar (Generated)'), + 'monsterid' => __('MonsterID (Generated)'), + 'retro' => __('Retro (Generated)') +); +$avatar_defaults = apply_filters('avatar_defaults', $avatar_defaults); +$default = get_option('avatar_default'); +if ( empty($default) ) + $default = 'mystery'; +$size = 32; +$avatar_list = ''; +foreach ( $avatar_defaults as $default_key => $default_name ) { + $selected = ($default == $default_key) ? 'checked="checked" ' : ''; + $avatar_list .= "\n\t'; + $avatar_list .= '
    '; +} +echo apply_filters('default_avatar_select', $avatar_list); +?> + +
    + + + + +
    +
    + + diff --git a/src/wp-admin/options-general.php b/src/wp-admin/options-general.php new file mode 100644 index 0000000..3f8a7b7 --- /dev/null +++ b/src/wp-admin/options-general.php @@ -0,0 +1,318 @@ + + +' . __('The fields on this screen determine some of the basics of your site setup.') . '

    ' . + '

    ' . __('Most themes display the site title at the top of every page, in the title bar of the browser, and as the identifying name for syndicated feeds. The tagline is also displayed by many themes.') . '

    ' . + '

    ' . __('The WordPress URL and the Site URL can be the same (example.com) or different; for example, having the WordPress core files (example.com/wordpress) in a subdirectory instead of the root directory.') . '

    ' . + '

    ' . __('If you want site visitors to be able to register themselves, as opposed to being registered by the site administrator, check the membership box. A default user role can be set for all new users, whether self-registered or registered by the site administrator.') . '

    ' . + '

    ' . __('UTC means Coordinated Universal Time.') . '

    ' . + '

    ' . __('Remember to click the Save Changes button at the bottom of the screen for new settings to take effect.') . '

    ' . + '

    ' . __('For more information:') . '

    ' . + '

    ' . __('Documentation on General Settings') . '

    ' . + '

    ' . __('Support Forums') . '

    ' +); + +include('./admin-header.php'); +?> + +
    + +

    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    class="regular-text code" />
    class="regular-text code" /> +to be different from the directory you installed WordPress.'); ?>
    +
    +
    + +
    +The new address will not become active until confirmed.') ?> + +
    +

    %1$s. Cancel'), esc_html( $new_admin_email ), esc_url( admin_url( 'options.php?dismiss=new_admin_email' ) ) ); ?>

    +
    + +
    + + + + UTC time is %s'), date_i18n($timezone_format, false, 'gmt')); ?> + + %1$s'), date_i18n($timezone_format)); ?> + +
    + + +
    + + +
    + $right_now ) { + $found = true; + break; + } + } + + if ( $found ) { + echo ' '; + $message = $tr['isdst'] ? + __('Daylight saving time begins on: %s.') : + __('Standard time begins on: %s.'); + // Add the difference between the current offset and the new offset to ts to get the correct transition time from date_i18n(). + printf( $message, date_i18n(get_option('date_format') . ' ' . get_option('time_format'), $tr['ts'] + ($tz_offset - $tr['offset']) ) ); + } else { + _e('This timezone does not observe daylight saving time.'); + } + } + // Set back to UTC. + date_default_timezone_set('UTC'); + ?> +
    + +
    +
    + ' . date_i18n( $format ) . "
    \n"; + } + + echo ' ' . date_i18n( get_option('date_format') ) . " \n"; + + echo "\t

    " . __('Documentation on date and time formatting.') . "

    \n"; +?> +
    +
    +
    + ' . date_i18n( $format ) . "
    \n"; + } + + echo ' ' . date_i18n( get_option('time_format') ) . " \n"; + ; +?> +
    +
    + +
    + + + + +
    + +
    + + diff --git a/src/wp-admin/options-head.php b/src/wp-admin/options-head.php new file mode 100644 index 0000000..7f2cc74 --- /dev/null +++ b/src/wp-admin/options-head.php @@ -0,0 +1,21 @@ + \ No newline at end of file diff --git a/src/wp-admin/options-media.php b/src/wp-admin/options-media.php new file mode 100644 index 0000000..6e3a29c --- /dev/null +++ b/src/wp-admin/options-media.php @@ -0,0 +1,141 @@ +' . __('You can set maximum sizes for images inserted into your written content; you can also insert an image as Full Size.') . '

    ' . + '

    ' . __('The Embed option allows you embed a video, image, or other media content into your content automatically by typing the URL (of the web page where the file lives) on its own line when you create your content.') . '

    ' . + ( is_multisite() ? '' : '

    ' . __('Uploading Options gives you folder and path choices for storing your files in your installation’s directory.') . '

    ' ) . + '

    ' . __('You must click the Save Changes button at the bottom of the screen for new settings to take effect.') . '

    ' . + '

    ' . __('For more information:') . '

    ' . + '

    ' . __('Documentation on Media Settings') . '

    ' . + '

    ' . __('Support Forums') . '

    ' +); + +include('./admin-header.php'); + +?> + +
    + +

    + +
    + + +

    +

    + + + + + + + + + + + + + + + + + + +
    + + + +
    +/> + +
    + + + + +
    + + + + +
    + +

    + + + + + + + + + + + + + + +
    + +
    + + + + +' . __("If the width value is left blank, embeds will default to the max width of your theme."); ?> +
    + + +

    + + + + + + + + + + + + + + + + +
    +wp-content/uploads'); ?> +
    + +
    + +
    + + + + + + +
    + +
    + + diff --git a/src/wp-admin/options-permalink.php b/src/wp-admin/options-permalink.php new file mode 100644 index 0000000..50aa32e --- /dev/null +++ b/src/wp-admin/options-permalink.php @@ -0,0 +1,260 @@ +' . __('This screen provides some common options for your default permalinks URL structure.') . '

    ' . + '

    ' . __('If you pick an option other than Default, your general URL path with structure tags, terms surrounded by %, will also appear in the custom structure field and your path can be further modified there.') . '

    ' . + '

    ' . __('When you assign multiple categories or tags to a post, only one can show up in the permalink: the lowest numbered category. This applies if your custom structure includes %category% or %tag%.') . '

    ' . + '

    ' . __('Note that permalinks beginning with the category, tag, author or postname structure tags require more advanced server resources. Double-check your hosting details to make sure those are in place or start your permalinks with other structure tags.') . '

    ' . + '

    ' . __('The Optional fields let you customize the “category” and “tag” base names that will appear in archive URLs. For example, the page listing all posts in the “Uncategorized” category could be /topics/uncategorized instead of /category/uncategorized.') . '

    ' . + '

    ' . __('You must click the Save Changes button at the bottom of the screen for new settings to take effect.') . '

    ' . + '

    ' . __('For more information:') . '

    ' . + '

    ' . __('Documentation on Permalinks Settings') . '

    ' . + '

    ' . __('Documentation on Using Permalinks') . '

    ' . + '

    ' . __('Support Forums') . '

    ' +); + +/** + * Display JavaScript on the page. + * + * @package WordPress + * @subpackage Permalink_Settings_Screen + */ +function add_js() { + ?> + +set_permalink_structure( $permalink_structure ); + } + + if ( isset( $_POST['category_base'] ) ) { + $category_base = $_POST['category_base']; + if ( ! empty( $category_base ) ) + $category_base = $blog_prefix . preg_replace('#/+#', '/', '/' . str_replace( '#', '', $category_base ) ); + $wp_rewrite->set_category_base( $category_base ); + } + + if ( isset( $_POST['tag_base'] ) ) { + $tag_base = $_POST['tag_base']; + if ( ! empty( $tag_base ) ) + $tag_base = $blog_prefix . preg_replace('#/+#', '/', '/' . str_replace( '#', '', $tag_base ) ); + $wp_rewrite->set_tag_base( $tag_base ); + } + + create_initial_taxonomies(); +} + +$permalink_structure = get_option('permalink_structure'); +$category_base = get_option('category_base'); +$tag_base = get_option( 'tag_base' ); + +if ( $iis7_permalinks ) { + if ( ( ! file_exists($home_path . 'web.config') && win_is_writable($home_path) ) || win_is_writable($home_path . 'web.config') ) + $writable = true; + else + $writable = false; +} else { + if ( ( ! file_exists($home_path . '.htaccess') && is_writable($home_path) ) || is_writable($home_path . '.htaccess') ) + $writable = true; + else + $writable = false; +} + +if ( $wp_rewrite->using_index_permalinks() ) + $usingpi = true; +else + $usingpi = false; + +$wp_rewrite->flush_rules(); + + +if (isset($_POST['submit'])) : ?> +

    +

    + + +
    + +

    + +
    + + +

    URLs which have question marks and lots of numbers in them, however WordPress offers you the ability to create a custom URL structure for your permalinks and archives. This can improve the aesthetics, usability, and forward-compatibility of your links. A number of tags are available, and here are some examples to get you started.'); ?>

    + + +

    + + + + + + + + + + + + + + + + + + + + + +
    /?p=123
    /archives/123
    + + + + +
    + +

    + +

    URLs here. For example, using topics as your category base would make your category links like http://example.org/topics/uncategorized/. If you leave these blank the defaults will be used.') ?>

    + +

    URLs here. For example, using topics as your category base would make your category links like http://example.org/index.php/topics/uncategorized/. If you leave these blank the defaults will be used.') ?>

    + + + + + + + + + + + + +
    + + + + +
    + + +

    web.config file were writable, we could do this automatically, but it isn’t so this is the url rewrite rule you should have in your web.config file. Click in the field and press CTRL + a to select all. Then insert this rule inside of the /<configuration>/<system.webServer>/<rewrite>/<rules> element in web.config file.') ?>

    +
    + +

    +
    +

    web.config file writable for us to generate rewrite rules automatically, do not forget to revert the permissions after rule has been saved.') ?>

    + +

    writable, we could do this automatically, but it isn’t so this is the url rewrite rule you should have in your web.config file. Create a new file, called web.config in the root directory of your site. Click in the field and press CTRL + a to select all. Then insert this code into the web.config file.') ?>

    +
    + +

    +
    +

    web.config file automatically, do not forget to revert the permissions after the file has been created.') ?>

    + + + +

    .htaccess file were writable, we could do this automatically, but it isn’t so these are the mod_rewrite rules you should have in your .htaccess file. Click in the field and press CTRL + a to select all.') ?>

    +
    + +

    +
    + + + + +
    + + diff --git a/src/wp-admin/options-privacy.php b/src/wp-admin/options-privacy.php new file mode 100644 index 0000000..9fd25bc --- /dev/null +++ b/src/wp-admin/options-privacy.php @@ -0,0 +1,58 @@ +' . __('You can choose whether or not your site will be crawled by robots, ping services, and spiders. If you want those services to ignore your site, click the second option here. Note that your privacy is not complete; your site is still visible on the web.') . '

    ' . + '

    ' . __('When this setting is in effect a reminder is shown in the Right Now box of the Dashboard that says, “Search Engines Blocked,” to remind you that your site is not being crawled.') . '

    ' . + '

    ' . __('You must click the Save Changes button at the bottom of the screen for new settings to take effect.') . '

    ' . + '

    ' . __('For more information:') . '

    ' . + '

    ' . __('Documentation on Privacy Settings') . '

    ' . + '

    ' . __('Support Forums') . '

    ' +); + +include('./admin-header.php'); +?> + +
    + +

    + +
    + + + + + + + + +
    + /> +
    + /> + + +
    + + + + +
    + +
    + + diff --git a/src/wp-admin/options-reading.php b/src/wp-admin/options-reading.php new file mode 100644 index 0000000..08c408e --- /dev/null +++ b/src/wp-admin/options-reading.php @@ -0,0 +1,131 @@ + + +' . __('This screen contains the settings that affect the display of your content.') . '

    ' . + '

    ' . sprintf(__('You can choose what’s displayed on the front page of your site. It can be posts in reverse chronological order (classic blog), or a fixed/static page. To set a static home page, you first need to create two Pages. One will become the front page, and the other will be where your posts are displayed.'), 'post-new.php?post_type=page') . '

    ' . + '

    ' . __('You can also control the display of your content in RSS feeds, including the maximum numbers of posts to display, whether to show full text or a summary, and the character set encoding.') . '

    ' . + '

    ' . __('You must click the Save Changes button at the bottom of the screen for new settings to take effect.') . '

    ' . + '

    ' . __('For more information:') . '

    ' . + '

    ' . __('Documentation on Reading Settings') . '

    ' . + '

    ' . __('Support Forums') . '

    ' +); + +include( './admin-header.php' ); +?> + +
    + +

    + +
    + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + +
    +

    +

    +

    +

    +
      +
    • +
    • +
    + +

    Warning: these pages should not be the same!' ); ?>

    + +
    + +
    +


    +

    +
    +character encoding of your site (UTF-8 is recommended, if you are adventurous there are some other encodings)' ); ?>
    + + + + +
    +
    + diff --git a/src/wp-admin/options-writing.php b/src/wp-admin/options-writing.php new file mode 100644 index 0000000..115e143 --- /dev/null +++ b/src/wp-admin/options-writing.php @@ -0,0 +1,176 @@ +' . __('You can submit content in several different ways; this screen holds the settings for all of them. The top section controls the editor within these administration screens, while the rest control external publishing methods. For more information on any of these methods, use the documentation links below.') . '

    ' . + '

    ' . __('You must click the Save Changes button at the bottom of the screen for new settings to take effect.') . '

    ' . + '

    ' . __('For more information:') . '

    ' . + '

    ' . __('Documentation on Writing Settings') . '

    ' . + '

    ' . __('Support Forums') . '

    ' +); + +include('./admin-header.php'); +?> + +
    + +

    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    +
    + +
    + 0, 'name' => 'default_category', 'orderby' => 'name', 'selected' => get_option('default_category'), 'hierarchical' => true)); +?> +
    + +
    + 0, 'name' => 'default_link_category', 'orderby' => 'name', 'selected' => get_option('default_link_category'), 'hierarchical' => true, 'taxonomy' => 'link_category')); +?> +
    + + +

    +

    +

    +

    +

    + + + +

    +

    %s, %s, %s.'), wp_generate_password(8, false), wp_generate_password(8, false), wp_generate_password(8, false)) ?>

    + + + + + + + + + + + + + + + + + + + +
    + + +
    + +
    + 0, 'name' => 'default_email_category', 'orderby' => 'name', 'selected' => get_option('default_email_category'), 'hierarchical' => true)); +?> +
    + + +

    +

    + + + + + + + + + + +
    +
    +
    +
    +
    + + +

    + + + +

    + + + + + +

    Update Services because of your site’s privacy settings.'), 'options-privacy.php'); ?>

    + + + + + + + +
    +
    + + diff --git a/src/wp-admin/options.php b/src/wp-admin/options.php new file mode 100644 index 0000000..069dcb9 --- /dev/null +++ b/src/wp-admin/options.php @@ -0,0 +1,227 @@ + array( 'blogname', 'blogdescription', 'gmt_offset', 'date_format', 'time_format', 'start_of_week', 'timezone_string' ), + 'discussion' => array( 'default_pingback_flag', 'default_ping_status', 'default_comment_status', 'comments_notify', 'moderation_notify', 'comment_moderation', 'require_name_email', 'comment_whitelist', 'comment_max_links', 'moderation_keys', 'blacklist_keys', 'show_avatars', 'avatar_rating', 'avatar_default', 'close_comments_for_old_posts', 'close_comments_days_old', 'thread_comments', 'thread_comments_depth', 'page_comments', 'comments_per_page', 'default_comments_page', 'comment_order', 'comment_registration' ), + 'media' => array( 'thumbnail_size_w', 'thumbnail_size_h', 'thumbnail_crop', 'medium_size_w', 'medium_size_h', 'large_size_w', 'large_size_h', 'image_default_size', 'image_default_align', 'image_default_link_type', 'embed_autourls', 'embed_size_w', 'embed_size_h' ), + 'privacy' => array( 'blog_public' ), + 'reading' => array( 'posts_per_page', 'posts_per_rss', 'rss_use_excerpt', 'blog_charset', 'show_on_front', 'page_on_front', 'page_for_posts' ), + 'writing' => array( 'default_post_edit_rows', 'use_smilies', 'default_category', 'default_email_category', 'use_balanceTags', 'default_link_category', 'default_post_format', 'enable_app', 'enable_xmlrpc' ), + 'options' => array( '' ) ); + +$mail_options = array('mailserver_url', 'mailserver_port', 'mailserver_login', 'mailserver_pass'); +$uploads_options = array('uploads_use_yearmonth_folders', 'upload_path', 'upload_url_path'); + +if ( !is_multisite() ) { + if ( !defined( 'WP_SITEURL' ) ) + $whitelist_options['general'][] = 'siteurl'; + if ( !defined( 'WP_HOME' ) ) + $whitelist_options['general'][] = 'home'; + + $whitelist_options['general'][] = 'admin_email'; + $whitelist_options['general'][] = 'users_can_register'; + $whitelist_options['general'][] = 'default_role'; + + $whitelist_options['writing'] = array_merge($whitelist_options['writing'], $mail_options); + $whitelist_options['writing'][] = 'ping_sites'; + + $whitelist_options['media'] = array_merge($whitelist_options['media'], $uploads_options); +} else { + $whitelist_options['general'][] = 'new_admin_email'; + $whitelist_options['general'][] = 'WPLANG'; + $whitelist_options['general'][] = 'language'; + + if ( apply_filters( 'enable_post_by_email_configuration', true ) ) + $whitelist_options['writing'] = array_merge($whitelist_options['writing'], $mail_options); + + $whitelist_options[ 'misc' ] = array(); +} + +$whitelist_options = apply_filters( 'whitelist_options', $whitelist_options ); + +/* + * If $_GET['action'] == 'update' we are saving settings sent from a settings page + */ +if ( 'update' == $action ) { + if ( 'options' == $option_page && !isset( $_POST['option_page'] ) ) { // This is for back compat and will eventually be removed. + $unregistered = true; + check_admin_referer( 'update-options' ); + } else { + $unregistered = false; + check_admin_referer( $option_page . '-options' ); + } + + if ( !isset( $whitelist_options[ $option_page ] ) ) + wp_die( __( 'Error: options page not found.' ) ); + + if ( 'options' == $option_page ) { + if ( is_multisite() && ! is_super_admin() ) + wp_die( __( 'You do not have sufficient permissions to modify unregistered settings for this site.' ) ); + $options = explode( ',', stripslashes( $_POST[ 'page_options' ] ) ); + } else { + $options = $whitelist_options[ $option_page ]; + } + + // Handle custom date/time formats + if ( 'general' == $option_page ) { + if ( !empty($_POST['date_format']) && isset($_POST['date_format_custom']) && '\c\u\s\t\o\m' == stripslashes( $_POST['date_format'] ) ) + $_POST['date_format'] = $_POST['date_format_custom']; + if ( !empty($_POST['time_format']) && isset($_POST['time_format_custom']) && '\c\u\s\t\o\m' == stripslashes( $_POST['time_format'] ) ) + $_POST['time_format'] = $_POST['time_format_custom']; + // Map UTC+- timezones to gmt_offsets and set timezone_string to empty. + if ( !empty($_POST['timezone_string']) && preg_match('/^UTC[+-]/', $_POST['timezone_string']) ) { + $_POST['gmt_offset'] = $_POST['timezone_string']; + $_POST['gmt_offset'] = preg_replace('/UTC\+?/', '', $_POST['gmt_offset']); + $_POST['timezone_string'] = ''; + } + } + + if ( $options ) { + foreach ( $options as $option ) { + if ( $unregistered ) + _deprecated_argument( 'options.php', '2.7', sprintf( __( 'The %1$s setting is unregistered. Unregistered settings are deprecated. See http://codex.wordpress.org/Settings_API' ), $option, $option_page ) ); + + $option = trim($option); + $value = null; + if ( isset($_POST[$option]) ) + $value = $_POST[$option]; + if ( !is_array($value) ) + $value = trim($value); + $value = stripslashes_deep($value); + update_option($option, $value); + } + } + + /** + * Handle settings errors and return to options page + */ + // If no settings errors were registered add a general 'updated' message. + if ( !count( get_settings_errors() ) ) + add_settings_error('general', 'settings_updated', __('Settings saved.'), 'updated'); + set_transient('settings_errors', get_settings_errors(), 30); + + /** + * Redirect back to the settings page that was submitted + */ + $goback = add_query_arg( 'settings-updated', 'true', wp_get_referer() ); + wp_redirect( $goback ); + exit; +} + +include('./admin-header.php'); ?> + +
    + +

    +
    + + + + +get_results( "SELECT * FROM $wpdb->options ORDER BY option_name" ); + +foreach ( (array) $options as $option ) : + $disabled = false; + if ( $option->option_name == '' ) + continue; + if ( is_serialized( $option->option_value ) ) { + if ( is_serialized_string( $option->option_value ) ) { + // this is a serialized string, so we should display it + $value = maybe_unserialize( $option->option_value ); + $options_to_update[] = $option->option_name; + $class = 'all-options'; + } else { + $value = 'SERIALIZED DATA'; + $disabled = true; + $class = 'all-options disabled'; + } + } else { + $value = $option->option_value; + $options_to_update[] = $option->option_name; + $class = 'all-options'; + } + $name = esc_attr( $option->option_name ); + echo " + + + +"; +endforeach; +?> +
    "; + if ( strpos( $value, "\n" ) !== false ) + echo ""; + else + echo ""; + echo "
    + + + + + +
    +
    + + + diff --git a/src/wp-admin/plugin-editor.php b/src/wp-admin/plugin-editor.php new file mode 100644 index 0000000..2c710df --- /dev/null +++ b/src/wp-admin/plugin-editor.php @@ -0,0 +1,264 @@ + time()) + (array)get_option('recently_activated')); + + wp_redirect(add_query_arg('_wpnonce', wp_create_nonce('edit-plugin-test_' . $file), "plugin-editor.php?file=$file&liveupdate=1&scrollto=$scrollto&networkwide=" . $network_wide)); + exit; + } + wp_redirect( self_admin_url("plugin-editor.php?file=$file&a=te&scrollto=$scrollto") ); + } else { + wp_redirect( self_admin_url("plugin-editor.php?file=$file&scrollto=$scrollto") ); + } + exit; + +break; + +default: + + if ( isset($_GET['liveupdate']) ) { + check_admin_referer('edit-plugin-test_' . $file); + + $error = validate_plugin($file); + if ( is_wp_error($error) ) + wp_die( $error ); + + if ( ( ! empty( $_GET['networkwide'] ) && ! is_plugin_active_for_network($file) ) || ! is_plugin_active($file) ) + activate_plugin($file, "plugin-editor.php?file=$file&phperror=1", ! empty( $_GET['networkwide'] ) ); // we'll override this later if the plugin can be included without fatal error + + wp_redirect( self_admin_url("plugin-editor.php?file=$file&a=te&scrollto=$scrollto") ); + exit; + } + + // List of allowable extensions + $editable_extensions = array('php', 'txt', 'text', 'js', 'css', 'html', 'htm', 'xml', 'inc', 'include'); + $editable_extensions = (array) apply_filters('editable_extensions', $editable_extensions); + + if ( ! is_file($real_file) ) { + wp_die(sprintf('

    %s

    ', __('No such file exists! Double check the name and try again.'))); + } else { + // Get the extension of the file + if ( preg_match('/\.([^.]+)$/', $real_file, $matches) ) { + $ext = strtolower($matches[1]); + // If extension is not in the acceptable list, skip it + if ( !in_array( $ext, $editable_extensions) ) + wp_die(sprintf('

    %s

    ', __('Files of this type are not editable.'))); + } + } + + add_contextual_help($current_screen, + '

    ' . __('You can use the editor to make changes to any of your plugins’ individual PHP files. Be aware that if you make changes, plugins updates will overwrite your customizations.') . '

    ' . + '

    ' . __('Choose a plugin to edit from the menu in the upper right and click the Select button. Click once on any file name to load it in the editor, and make your changes. Don’t forget to save your changes (Update File) when you’re finished.') . '

    ' . + '

    ' . __('The Documentation menu below the editor lists the PHP functions recognized in the plugin file. Clicking Lookup takes you to a web page about that particular function.') . '

    ' . + '

    ' . __('If you want to make changes but don’t want them to be overwritten when the plugin is updated, you may be ready to think about writing your own plugin. For information on how to edit plugins, write your own from scratch, or just better understand their anatomy, check out the links below.') . '

    ' . + ( is_network_admin() ? '

    ' . __('Any edits to files from this screen will be reflected on all sites in the network.') . '

    ' : '' ) . + '

    ' . __('For more information:') . '

    ' . + '

    ' . __('Documentation on Editing Plugins') . '

    ' . + '

    ' . __('Documentation on Writing Plugins') . '

    ' . + '

    ' . __('Support Forums') . '

    ' + ); + + require_once(ABSPATH . 'wp-admin/admin-header.php'); + + update_recently_edited(WP_PLUGIN_DIR . '/' . $file); + + $content = file_get_contents( $real_file ); + + if ( '.php' == substr( $real_file, strrpos( $real_file, '.' ) ) ) { + $functions = wp_doc_link_parse( $content ); + + if ( !empty($functions) ) { + $docs_select = ''; + } + } + + $content = esc_textarea( $content ); + ?> + +

    + +

    fatal error.') ?>

    + + + +
    + +
    + +

    + +
    +
    +%s (active)'), $file); + else + echo sprintf(__('Browsing %s (active)'), $file); + } else { + if ( is_writeable($real_file) ) + echo sprintf(__('Editing %s (inactive)'), $file); + else + echo sprintf(__('Browsing %s (inactive)'), $file); + } + ?> +
    +
    +
    + + + +
    +
    +
    +
    + +
    +

    + +
      + + > + +
    +
    +
    + +
    + + + + +
    + +
    + + + +

    Warning: Making changes to active plugins is not recommended. If your changes cause a fatal error, the plugin will be automatically deactivated.'); ?>

    + +

    + "; + submit_button( __( 'Update File and Attempt to Reactivate' ), 'primary', 'submit', false, array( 'tabindex' => '2' ) ); + } else { + submit_button( __( 'Update File' ), 'primary', 'submit', false, array( 'tabindex' => '2' ) ); + } + ?> +

    + +

    the Codex for more information.'); ?>

    + +
    +
    +
    + +get_pagenum(); +$wp_list_table->prepare_items(); + +$title = __('Install Plugins'); +$parent_file = 'plugins.php'; + +wp_enqueue_style( 'plugin-install' ); +wp_enqueue_script( 'plugin-install' ); +if ( 'plugin-information' != $tab ) + add_thickbox(); + +$body_id = $tab; + +do_action('install_plugins_pre_' . $tab); //Used to override the general interface, Eg, install or plugin information. + +add_contextual_help($current_screen, + '

    ' . sprintf(__('Plugins hook into WordPress to extend its functionality with custom features. Plugins are developed independently from WordPress core by thousands of developers all over the world. All plugins in the official WordPress.org Plugin Directory are compatible with the license WordPress uses. You can find new plugins to install by searching or browsing the Directory right here in your own Plugins section.'), 'http://wordpress.org/extend/plugins/') . '

    ' . + '

    ' . __('If you know what you’re looking for, Search is your best bet. The Search screen has options to search the WordPress.org Plugin Directory for a particular Term, Author, or Tag. You can also search the directory by selecting a popular tags. Tags in larger type mean more plugins have been labeled with that tag.') . '

    ' . + '

    ' . __('If you just want to get an idea of what’s available, you can browse Featured, Popular, Newest, and Recently Updated plugins by using the links in the upper left of the screen. These sections rotate regularly.') . '

    ' . + '

    ' . __('If you want to install a plugin that you’ve downloaded elsewhere, click Upload in the upper left. You will be prompted to upload the .zip package, and once uploaded, you can activate the new plugin.') . '

    ' . + '

    ' . __('For more information:') . '

    ' . + '

    ' . __('Documentation on Installing Plugins') . '

    ' . + '

    ' . __('Support Forums') . '

    ' +); + +include(ABSPATH . 'wp-admin/admin-header.php'); +?> +
    + +

    + +views(); ?> + +
    + +
    +get_pagenum(); + +$action = $wp_list_table->current_action(); + +$plugin = isset($_REQUEST['plugin']) ? $_REQUEST['plugin'] : ''; +$s = isset($_REQUEST['s']) ? $_REQUEST['s'] : ''; + +// Clean up request URI from temporary args for screen options/paging uri's to work as expected. +$_SERVER['REQUEST_URI'] = remove_query_arg(array('error', 'deleted', 'activate', 'activate-multi', 'deactivate', 'deactivate-multi', '_error_nonce'), $_SERVER['REQUEST_URI']); + +if ( $action ) { + $network_wide = false; + if ( ( isset( $_GET['networkwide'] ) || 'network-activate-selected' == $action ) && is_multisite() && current_user_can( 'manage_network_plugins' ) ) + $network_wide = true; + + switch ( $action ) { + case 'activate': + if ( ! current_user_can('activate_plugins') ) + wp_die(__('You do not have sufficient permissions to activate plugins for this site.')); + + check_admin_referer('activate-plugin_' . $plugin); + + $result = activate_plugin($plugin, self_admin_url('plugins.php?error=true&plugin=' . $plugin), $network_wide); + if ( is_wp_error( $result ) ) { + if ( 'unexpected_output' == $result->get_error_code() ) { + $redirect = self_admin_url('plugins.php?error=true&charsout=' . strlen($result->get_error_data()) . '&plugin=' . $plugin . "&plugin_status=$status&paged=$page&s=$s"); + wp_redirect(add_query_arg('_error_nonce', wp_create_nonce('plugin-activation-error_' . $plugin), $redirect)); + exit; + } else { + wp_die($result); + } + } + + $recent = (array)get_option('recently_activated'); + if ( isset($recent[ $plugin ]) ) { + unset($recent[ $plugin ]); + update_option('recently_activated', $recent); + } + if ( isset($_GET['from']) && 'import' == $_GET['from'] ) { + wp_redirect( self_admin_url("import.php?import=" . str_replace('-importer', '', dirname($plugin))) ); // overrides the ?error=true one above and redirects to the Imports page, stripping the -importer suffix + } else { + wp_redirect( self_admin_url("plugins.php?activate=true&plugin_status=$status&paged=$page&s=$s") ); // overrides the ?error=true one above + } + exit; + break; + case 'activate-selected': + case 'network-activate-selected': + if ( ! current_user_can('activate_plugins') ) + wp_die(__('You do not have sufficient permissions to activate plugins for this site.')); + + check_admin_referer('bulk-plugins'); + + $plugins = isset( $_POST['checked'] ) ? (array) $_POST['checked'] : array(); + + // Only activate plugins which are not already active. + $check = $network_wide ? 'is_plugin_active_for_network' : 'is_plugin_active'; + foreach ( $plugins as $i => $plugin ) + if ( $check( $plugin ) ) + unset( $plugins[ $i ] ); + + if ( empty($plugins) ) { + wp_redirect( self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s") ); + exit; + } + + activate_plugins($plugins, self_admin_url('plugins.php?error=true'), $network_wide); + + $recent = (array)get_option('recently_activated'); + foreach ( $plugins as $plugin => $time) + if ( isset($recent[ $plugin ]) ) + unset($recent[ $plugin ]); + + update_option('recently_activated', $recent); + + wp_redirect( self_admin_url("plugins.php?activate-multi=true&plugin_status=$status&paged=$page&s=$s") ); + exit; + break; + case 'update-selected' : + + check_admin_referer( 'bulk-plugins' ); + + if ( isset( $_GET['plugins'] ) ) + $plugins = explode( ',', $_GET['plugins'] ); + elseif ( isset( $_POST['checked'] ) ) + $plugins = (array) $_POST['checked']; + else + $plugins = array(); + + $title = __( 'Update Plugins' ); + $parent_file = 'plugins.php'; + + require_once(ABSPATH . 'wp-admin/admin-header.php'); + + echo '
    '; + screen_icon(); + echo '

    ' . esc_html( $title ) . '

    '; + + + $url = self_admin_url('update.php?action=update-selected&plugins=' . urlencode( join(',', $plugins) )); + $url = wp_nonce_url($url, 'bulk-update-plugins'); + + echo ""; + echo '
    '; + require_once(ABSPATH . 'wp-admin/admin-footer.php'); + exit; + break; + case 'error_scrape': + if ( ! current_user_can('activate_plugins') ) + wp_die(__('You do not have sufficient permissions to activate plugins for this site.')); + + check_admin_referer('plugin-activation-error_' . $plugin); + + $valid = validate_plugin($plugin); + if ( is_wp_error($valid) ) + wp_die($valid); + + if ( ! WP_DEBUG ) { + error_reporting( E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING | E_RECOVERABLE_ERROR ); + } + + @ini_set('display_errors', true); //Ensure that Fatal errors are displayed. + // Go back to "sandbox" scope so we get the same errors as before + function plugin_sandbox_scrape( $plugin ) { + include( WP_PLUGIN_DIR . '/' . $plugin ); + } + plugin_sandbox_scrape( $plugin ); + do_action('activate_' . $plugin); + exit; + break; + case 'deactivate': + if ( ! current_user_can('activate_plugins') ) + wp_die(__('You do not have sufficient permissions to deactivate plugins for this site.')); + + check_admin_referer('deactivate-plugin_' . $plugin); + deactivate_plugins($plugin); + update_option('recently_activated', array($plugin => time()) + (array)get_option('recently_activated')); + if ( headers_sent() ) + echo ""; + else + wp_redirect( self_admin_url("plugins.php?deactivate=true&plugin_status=$status&paged=$page&s=$s") ); + exit; + break; + case 'deactivate-selected': + if ( ! current_user_can('activate_plugins') ) + wp_die(__('You do not have sufficient permissions to deactivate plugins for this site.')); + + check_admin_referer('bulk-plugins'); + + $plugins = isset( $_POST['checked'] ) ? (array) $_POST['checked'] : array(); + $plugins = array_filter($plugins, 'is_plugin_active'); //Do not deactivate plugins which are already deactivated. + if ( empty($plugins) ) { + wp_redirect( self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s") ); + exit; + } + + deactivate_plugins($plugins); + + $deactivated = array(); + foreach ( $plugins as $plugin ) + $deactivated[ $plugin ] = time(); + + update_option('recently_activated', $deactivated + (array)get_option('recently_activated')); + wp_redirect( self_admin_url("plugins.php?deactivate-multi=true&plugin_status=$status&paged=$page&s=$s") ); + exit; + break; + case 'delete-selected': + if ( ! current_user_can('delete_plugins') ) + wp_die(__('You do not have sufficient permissions to delete plugins for this site.')); + + check_admin_referer('bulk-plugins'); + + //$_POST = from the plugin form; $_GET = from the FTP details screen. + $plugins = isset( $_REQUEST['checked'] ) ? (array) $_REQUEST['checked'] : array(); + if ( empty( $plugins ) ) { + wp_redirect( self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s") ); + exit; + } + + $plugins = array_filter($plugins, 'is_plugin_inactive'); // Do not allow to delete Activated plugins. + if ( empty( $plugins ) ) { + wp_redirect( self_admin_url( "plugins.php?error=true&main=true&plugin_status=$status&paged=$page&s=$s" ) ); + exit; + } + + include(ABSPATH . 'wp-admin/update.php'); + + $parent_file = 'plugins.php'; + + if ( ! isset($_REQUEST['verify-delete']) ) { + wp_enqueue_script('jquery'); + require_once(ABSPATH . 'wp-admin/admin-header.php'); + ?> +
    + $data ) { + $plugin_info[ $plugin_file ] = _get_plugin_data_markup_translate( $plugin_file, $data ); + $plugin_info[ $plugin_file ]['is_uninstallable'] = is_uninstallable_plugin( $plugin ); + if ( ! $plugin_info[ $plugin_file ]['Network'] ) + $have_non_network_plugins = true; + } + } + } + } + screen_icon(); + $plugins_to_delete = count( $plugin_info ); + echo '

    ' . _n( 'Delete Plugin', 'Delete Plugins', $plugins_to_delete ) . '

    '; + ?> + +

    + +

    +
      + ', sprintf( __( '%1$s by %2$s (will also delete its data)' ), esc_html($plugin['Name']), esc_html($plugin['AuthorName']) ), ''; + $data_to_delete = true; + } else { + /* translators: 1: plugin name, 2: plugin author */ + echo '
    • ', sprintf( __('%1$s by %2$s' ), esc_html($plugin['Name']), esc_html($plugin['AuthorName']) ), '
    • '; + } + } + ?> +
    +

    +
    + + + '; + ?> + + +
    +
    + +
    + +

    + +
    + prepare_items(); + +wp_enqueue_script('plugin-install'); +add_thickbox(); + +add_screen_option( 'per_page', array('label' => _x( 'Plugins', 'plugins per page (screen options)' )) ); + +add_contextual_help($current_screen, + '

    ' . __('Plugins extend and expand the functionality of WordPress. Once a plugin is installed, you may activate it or deactivate it here.') . '

    ' . + '

    ' . sprintf(__('You can find additional plugins for your site by using the Plugin Browser/Installer functionality or by browsing the WordPress Plugin Directory directly and installing new plugins manually. To manually install a plugin you generally just need to upload the plugin file into your /wp-content/plugins directory. Once a plugin has been installed, you can activate it here.'), 'plugin-install.php', 'http://wordpress.org/extend/plugins/') . '

    ' . + '

    ' . __('Most of the time, plugins play nicely with the core of WordPress and with other plugins. Sometimes, though, a plugin’s code will get in the way of another plugin, causing compatibility issues. If your site starts doing strange things, this may be the problem. Try deactivating all your plugins and re-activating them in various combinations until you isolate which one(s) caused the issue.') . '

    ' . + '

    ' . sprintf( __('If something goes wrong with a plugin and you can’t use WordPress, delete or rename that file in the %s directory and it will be automatically deactivated.'), WP_PLUGIN_DIR) . '

    ' . + '

    ' . __('For more information:') . '

    ' . + '

    ' . __('Documentation on Managing Plugins') . '

    ' . + '

    ' . __('Support Forums') . '

    ' +); + +$title = __('Plugins'); +$parent_file = 'plugins.php'; + +require_once(ABSPATH . 'wp-admin/admin-header.php'); + +$invalid = validate_active_plugins(); +if ( !empty($invalid) ) + foreach ( $invalid as $plugin_file => $error ) + echo '

    ' . sprintf(__('The plugin %s has been deactivated due to an error: %s'), esc_html($plugin_file), $error->get_error_message()) . '

    '; +?> + +unexpected output during activation. If you notice “headers already sent” messages, problems with syndication feeds or other issues, try deactivating or removing this plugin.'), $_GET['charsout']); + else + $errmsg = __('Plugin could not be activated because it triggered a fatal error.'); + ?> +

    + + + +
    + +

    get_error_message() ); ?>

    + +

    deleted.'); ?>

    + + +

    activated.') ?>

    + +

    activated.'); ?>

    + +

    deactivated.') ?>

    + +

    deactivated.'); ?>

    + +

    + + +
    + +

    + +' . __('Search results for “%s”') . '', esc_html( $s ) ); ?> +

    + + + +views(); ?> + +
    + +search_box( __( 'Search Installed Plugins' ), 'plugin' ); ?> + + + + +display(); ?> +
    + +
    + + true ) ) ) ) + $post_type = $_GET['post_type']; +else + wp_die( __('Invalid post type') ); + +if ( 'post' != $post_type ) { + $parent_file = "edit.php?post_type=$post_type"; + $submenu_file = "post-new.php?post_type=$post_type"; +} else { + $parent_file = 'edit.php'; + $submenu_file = 'post-new.php'; +} + +$post_type_object = get_post_type_object($post_type); + +$title = $post_type_object->labels->add_new_item; + +$editing = true; + +if ( ! current_user_can( $post_type_object->cap->edit_posts ) ) + wp_die( __( 'Cheatin’ uh?' ) ); + +wp_enqueue_script('autosave'); + +// Show post form. +$post = get_default_post_to_edit( $post_type, true ); +$post_ID = $post->ID; +include('edit-form-advanced.php'); +include('./admin-footer.php'); +?> diff --git a/src/wp-admin/post.php b/src/wp-admin/post.php new file mode 100644 index 0000000..df9e5a5 --- /dev/null +++ b/src/wp-admin/post.php @@ -0,0 +1,279 @@ +post_type); + if ( $post_type_object ) { + $post_type = $post->post_type; + $current_screen->post_type = $post->post_type; + $current_screen->id = $current_screen->post_type; + } + } +} elseif ( isset($_POST['post_type']) ) { + $post_type_object = get_post_type_object($_POST['post_type']); + if ( $post_type_object ) { + $post_type = $post_type_object->name; + $current_screen->post_type = $post_type; + $current_screen->id = $current_screen->post_type; + } +} + +/** + * Redirect to previous page. + * + * @param int $post_id Optional. Post ID. + */ +function redirect_post($post_id = '') { + if ( isset($_POST['save']) || isset($_POST['publish']) ) { + $status = get_post_status( $post_id ); + + if ( isset( $_POST['publish'] ) ) { + switch ( $status ) { + case 'pending': + $message = 8; + break; + case 'future': + $message = 9; + break; + default: + $message = 6; + } + } else { + $message = 'draft' == $status ? 10 : 1; + } + + $location = add_query_arg( 'message', $message, get_edit_post_link( $post_id, 'url' ) ); + } elseif ( isset($_POST['addmeta']) && $_POST['addmeta'] ) { + $location = add_query_arg( 'message', 2, wp_get_referer() ); + $location = explode('#', $location); + $location = $location[0] . '#postcustom'; + } elseif ( isset($_POST['deletemeta']) && $_POST['deletemeta'] ) { + $location = add_query_arg( 'message', 3, wp_get_referer() ); + $location = explode('#', $location); + $location = $location[0] . '#postcustom'; + } elseif ( 'post-quickpress-save-cont' == $_POST['action'] ) { + $location = "post.php?action=edit&post=$post_id&message=7"; + } else { + $location = add_query_arg( 'message', 4, get_edit_post_link( $post_id, 'url' ) ); + } + + wp_redirect( apply_filters( 'redirect_post_location', $location, $post_id ) ); + exit; +} + +if ( isset( $_POST['deletepost'] ) ) + $action = 'delete'; +elseif ( isset($_POST['wp-preview']) && 'dopreview' == $_POST['wp-preview'] ) + $action = 'preview'; + +$sendback = wp_get_referer(); +if ( strpos($sendback, 'post.php') !== false || strpos($sendback, 'post-new.php') !== false ) { + $sendback = admin_url('edit.php'); + $sendback .= ( !empty( $post_type ) ) ? '?post_type=' . $post_type : ''; +} else { + $sendback = remove_query_arg( array('trashed', 'untrashed', 'deleted', 'ids'), $sendback ); +} + +switch($action) { +case 'postajaxpost': +case 'post': +case 'post-quickpress-publish': +case 'post-quickpress-save': + check_admin_referer('add-' . $post_type); + + if ( 'post-quickpress-publish' == $action ) + $_POST['publish'] = 'publish'; // tell write_post() to publish + + if ( 'post-quickpress-publish' == $action || 'post-quickpress-save' == $action ) { + $_POST['comment_status'] = get_option('default_comment_status'); + $_POST['ping_status'] = get_option('default_ping_status'); + } + + if ( !empty( $_POST['quickpress_post_ID'] ) ) { + $_POST['post_ID'] = (int) $_POST['quickpress_post_ID']; + $post_id = edit_post(); + } else { + $post_id = 'postajaxpost' == $action ? edit_post() : write_post(); + } + + if ( 0 === strpos( $action, 'post-quickpress' ) ) { + $_POST['post_ID'] = $post_id; + // output the quickpress dashboard widget + require_once(ABSPATH . 'wp-admin/includes/dashboard.php'); + wp_dashboard_quick_press(); + exit; + } + + redirect_post($post_id); + exit(); + break; + +case 'edit': + $editing = true; + + if ( empty( $post_id ) ) { + wp_redirect( admin_url('post.php') ); + exit(); + } + + $p = $post_id; + + if ( empty($post->ID) ) + wp_die( __('You attempted to edit an item that doesn’t exist. Perhaps it was deleted?') ); + + if ( !current_user_can($post_type_object->cap->edit_post, $post_id) ) + wp_die( __('You are not allowed to edit this item.') ); + + if ( 'trash' == $post->post_status ) + wp_die( __('You can’t edit this item because it is in the Trash. Please restore it and try again.') ); + + if ( null == $post_type_object ) + wp_die( __('Unknown post type.') ); + + $post_type = $post->post_type; + if ( 'post' == $post_type ) { + $parent_file = "edit.php"; + $submenu_file = "edit.php"; + $post_new_file = "post-new.php"; + } else { + if ( isset( $post_type_object ) && $post_type_object->show_in_menu && $post_type_object->show_in_menu !== true ) + $parent_file = $post_type_object->show_in_menu; + else + $parent_file = "edit.php?post_type=$post_type"; + $submenu_file = "edit.php?post_type=$post_type"; + $post_new_file = "post-new.php?post_type=$post_type"; + } + + if ( $last = wp_check_post_lock( $post->ID ) ) { + add_action('admin_notices', '_admin_notice_post_locked' ); + } else { + wp_set_post_lock( $post->ID ); + wp_enqueue_script('autosave'); + } + + $title = $post_type_object->labels->edit_item; + $post = get_post_to_edit($post_id); + + if ( post_type_supports($post_type, 'comments') ) { + wp_enqueue_script('admin-comments'); + enqueue_comment_hotkeys_js(); + } + + include('./edit-form-advanced.php'); + + break; + +case 'editattachment': + check_admin_referer('update-attachment_' . $post_id); + + // Don't let these be changed + unset($_POST['guid']); + $_POST['post_type'] = 'attachment'; + + // Update the thumbnail filename + $newmeta = wp_get_attachment_metadata( $post_id, true ); + $newmeta['thumb'] = $_POST['thumb']; + + wp_update_attachment_metadata( $post_id, $newmeta ); + +case 'editpost': + check_admin_referer('update-' . $post_type . '_' . $post_id); + + $post_id = edit_post(); + + redirect_post($post_id); // Send user on their way while we keep working + + exit(); + break; + +case 'trash': + check_admin_referer('trash-' . $post_type . '_' . $post_id); + + $post = & get_post($post_id); + + if ( !current_user_can($post_type_object->cap->delete_post, $post_id) ) + wp_die( __('You are not allowed to move this item to the Trash.') ); + + if ( ! wp_trash_post($post_id) ) + wp_die( __('Error in moving to Trash.') ); + + wp_redirect( add_query_arg( array('trashed' => 1, 'ids' => $post_id), $sendback ) ); + exit(); + break; + +case 'untrash': + check_admin_referer('untrash-' . $post_type . '_' . $post_id); + + if ( !current_user_can($post_type_object->cap->delete_post, $post_id) ) + wp_die( __('You are not allowed to move this item out of the Trash.') ); + + if ( ! wp_untrash_post($post_id) ) + wp_die( __('Error in restoring from Trash.') ); + + wp_redirect( add_query_arg('untrashed', 1, $sendback) ); + exit(); + break; + +case 'delete': + check_admin_referer('delete-' . $post_type . '_' . $post_id); + + if ( !current_user_can($post_type_object->cap->delete_post, $post_id) ) + wp_die( __('You are not allowed to delete this item.') ); + + $force = !EMPTY_TRASH_DAYS; + if ( $post->post_type == 'attachment' ) { + $force = ( $force || !MEDIA_TRASH ); + if ( ! wp_delete_attachment($post_id, $force) ) + wp_die( __('Error in deleting.') ); + } else { + if ( !wp_delete_post($post_id, $force) ) + wp_die( __('Error in deleting.') ); + } + + wp_redirect( add_query_arg('deleted', 1, $sendback) ); + exit(); + break; + +case 'preview': + check_admin_referer( 'autosave', 'autosavenonce' ); + + $url = post_preview(); + + wp_redirect($url); + exit(); + break; + +default: + wp_redirect( admin_url('edit.php') ); + exit(); + break; +} // end switch +include('./admin-footer.php'); +?> diff --git a/src/wp-admin/press-this.php b/src/wp-admin/press-this.php new file mode 100644 index 0000000..70f1808 --- /dev/null +++ b/src/wp-admin/press-this.php @@ -0,0 +1,652 @@ + $image) { + // see if files exist in content - we don't want to upload non-used selected files. + if ( strpos($_POST['content'], htmlspecialchars($image)) !== false ) { + $desc = isset($_POST['photo_description'][$key]) ? $_POST['photo_description'][$key] : ''; + $upload = media_sideload_image($image, $post_ID, $desc); + + // Replace the POSTED content with correct uploaded ones. Regex contains fix for Magic Quotes + if ( !is_wp_error($upload) ) + $content = preg_replace('/]*)src=\\\?(\"|\')'.preg_quote(htmlspecialchars($image), '/').'\\\?(\2)([^>\/]*)\/*>/is', $upload, $content); + } + } + } + // set the post_content and status + if ( isset( $_POST['publish'] ) && current_user_can( 'publish_posts' ) ) + $quick['post_status'] = 'publish'; + elseif ( isset( $_POST['review'] ) ) + $quick['post_status'] = 'pending'; + else + $quick['post_status'] = 'draft'; + $quick['post_content'] = $content; + // error handling for media_sideload + if ( is_wp_error($upload) ) { + wp_delete_post($post_ID); + wp_die($upload); + } else { + // Post formats + if ( current_theme_supports( 'post-formats' ) && isset( $_POST['post_format'] ) ) { + $post_formats = get_theme_support( 'post-formats' ); + if ( is_array( $post_formats ) ) { + $post_formats = $post_formats[0]; + if ( in_array( $_POST['post_format'], $post_formats ) ) + set_post_format( $post_ID, $_POST['post_format'] ); + elseif ( '0' == $_POST['post_format'] ) + set_post_format( $post_ID, false ); + } + } + + $quick['ID'] = $post_ID; + wp_update_post($quick); + } + return $post_ID; +} + +// For submitted posts. +if ( isset($_REQUEST['action']) && 'post' == $_REQUEST['action'] ) { + check_admin_referer('press-this'); + $post_ID = press_it(); + $posted = $post_ID; +} else { + $post_ID = 0; +} + +// Set Variables +$title = isset( $_GET['t'] ) ? trim( strip_tags( html_entity_decode( stripslashes( $_GET['t'] ) , ENT_QUOTES) ) ) : ''; + +$selection = ''; +if ( !empty($_GET['s']) ) { + $selection = str_replace(''', "'", stripslashes($_GET['s'])); + $selection = trim( htmlspecialchars( html_entity_decode($selection, ENT_QUOTES) ) ); +} + +if ( ! empty($selection) ) { + $selection = preg_replace('/(\r?\n|\r)/', '

    ', $selection); + $selection = '

    ' . str_replace('

    ', '', $selection) . '

    '; +} + +$url = isset($_GET['u']) ? esc_url($_GET['u']) : ''; +$image = isset($_GET['i']) ? $_GET['i'] : ''; + +if ( !empty($_REQUEST['ajax']) ) { + switch ($_REQUEST['ajax']) { + case 'video': ?> + +
    +

    +
    + +

    +
    +
    + + +

    +
    +
    + +
    +
    + +

    + + + <?php echo esc_attr(__('Click to insert.')); ?> + +

    + +

    + + +

    +
    +
    + +
    +
    +

    +
    +
    + +
    +
    + +

    |

    + ]*)src=(\"|\')([^<>\'\"]+)(\2)([^>]*)\/*>/i'; + $content = str_replace(array("\n","\t","\r"), '', $content); + preg_match_all($pattern, $content, $matches); + if ( empty($matches[0]) ) + return ''; + $sources = array(); + foreach ($matches[3] as $src) { + // if no http in url + if (strpos($src, 'http') === false) + // if it doesn't have a relative uri + if ( strpos($src, '../') === false && strpos($src, './') === false && strpos($src, '/') === 0) + $src = 'http://'.str_replace('//','/', $host['host'].'/'.$src); + else + $src = 'http://'.str_replace('//','/', $host['host'].'/'.dirname($host['path']).'/'.$src); + $sources[] = esc_url($src); + } + return "'" . implode("','", $sources) . "'"; + } + $url = wp_kses(urldecode($url), null); + echo 'new Array('.get_images_from_uri($url).')'; + break; + + case 'photo_js': ?> + // gather images and load some default JS + var last = null + var img, img_tag, aspect, w, h, skip, i, strtoappend = ""; + if(photostorage == false) { + var my_src = eval( + jQuery.ajax({ + type: "GET", + url: "", + cache : false, + async : false, + data: "ajax=photo_images&u=", + dataType : "script" + }).responseText + ); + if(my_src.length == 0) { + var my_src = eval( + jQuery.ajax({ + type: "GET", + url: "", + cache : false, + async : false, + data: "ajax=photo_images&u=", + dataType : "script" + }).responseText + ); + if(my_src.length == 0) { + strtoappend = ''; + } + } + } + for (i = 0; i < my_src.length; i++) { + img = new Image(); + img.src = my_src[i]; + img_attr = 'id="img' + i + '"'; + skip = false; + + maybeappend = ''; + + if (img.width && img.height) { + if (img.width >= 30 && img.height >= 30) { + aspect = img.width / img.height; + scale = (aspect > 1) ? (71 / img.width) : (71 / img.height); + + w = img.width; + h = img.height; + + if (scale < 1) { + w = parseInt(img.width * scale); + h = parseInt(img.height * scale); + } + img_attr += ' style="width: ' + w + 'px; height: ' + h + 'px;"'; + strtoappend += maybeappend; + } + } else { + strtoappend += maybeappend; + } + } + + function pick(img, desc) { + if (img) { + if('object' == typeof jQuery('.photolist input') && jQuery('.photolist input').length != 0) length = jQuery('.photolist input').length; + if(length == 0) length = 1; + jQuery('.photolist').append(''); + jQuery('.photolist').append(''); + insert_editor( "\n\n" + encodeURI('

    ' + desc + '

    ')); + } + return false; + } + + function image_selector() { + tb_remove(); + desc = jQuery('#this_photo_description').val(); + src = jQuery('#this_photo').val(); + pick(src, desc); + jQuery('#extra-fields').hide(); + jQuery('#extra-fields').html(''); + return false; + } + jQuery('#extra-fields').html('

    ()

    '); + jQuery('#img_container').html(strtoappend); + + + > + + + <?php _e('Press This') ?> + + + + + + + + + '370' ) ); +} +?> +
    +
    +
    +
    + + + + + + + +
    + +
    +

    +

    +
    +

    + 'save' ) ); + if ( current_user_can('publish_posts') ) { + submit_button( __( 'Publish' ), 'primary', 'publish', false ); + } else { + echo '

    '; + submit_button( __( 'Submit for Review' ), 'primary', 'review', false ); + } ?> + +

    + +

    + +

    + +
    +
    + + +
    +

    +

    +
    +
    + + + + + +
    +
      + 'category', 'popular_cats' => $popular_ids ) ) ?> +
    +
    + + cap->assign_terms) ) : ?> +

    + + cap->edit_terms) ) : ?> +
    +

    + + labels->add_new_item ); ?> + +

    +

    + + + + 'category', 'hide_empty' => 0, 'name' => 'newcategory_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => '— ' . $tax->labels->parent_item . ' —', 'tab_index' => 3 ) ); ?> + + + +

    +
    + +
    +
    +
    + +
    +
    +
    +
    +

    +
    +
    +

    + + +

    + + +
    +

    +
    +
    + +
    +
    +
    +
    +
    + + + + +

    | |

    + + +
    +
    + +
    +
    + + + +
    +
    + + + +
    + + +
    + + +<?php _e('Insert an Image'); ?><?php _e('Embed a Video'); ?> +
    +
    +
    +
    + +
    +
    +
    +
    +
    + + + + diff --git a/src/wp-admin/profile.php b/src/wp-admin/profile.php new file mode 100644 index 0000000..71a1b04 --- /dev/null +++ b/src/wp-admin/profile.php @@ -0,0 +1,19 @@ + diff --git a/src/wp-admin/revision.php b/src/wp-admin/revision.php new file mode 100644 index 0000000..dd20c12 --- /dev/null +++ b/src/wp-admin/revision.php @@ -0,0 +1,223 @@ +post_parent ) ) + break; + if ( !$post = get_post( $revision->post_parent ) ) + break; + + // Revisions disabled and we're not looking at an autosave + if ( ( ! WP_POST_REVISIONS || !post_type_supports($post->post_type, 'revisions') ) && !wp_is_post_autosave( $revision ) ) { + $redirect = 'edit.php?post_type=' . $post->post_type; + break; + } + + check_admin_referer( "restore-post_$post->ID|$revision->ID" ); + + wp_restore_post_revision( $revision->ID ); + $redirect = add_query_arg( array( 'message' => 5, 'revision' => $revision->ID ), get_edit_post_link( $post->ID, 'url' ) ); + break; +case 'diff' : + if ( !$left_revision = get_post( $left ) ) + break; + if ( !$right_revision = get_post( $right ) ) + break; + + if ( !current_user_can( 'read_post', $left_revision->ID ) || !current_user_can( 'read_post', $right_revision->ID ) ) + break; + + // If we're comparing a revision to itself, redirect to the 'view' page for that revision or the edit page for that post + if ( $left_revision->ID == $right_revision->ID ) { + $redirect = get_edit_post_link( $left_revision->ID ); + include( './js/revisions-js.php' ); + break; + } + + // Don't allow reverse diffs? + if ( strtotime($right_revision->post_modified_gmt) < strtotime($left_revision->post_modified_gmt) ) { + $redirect = add_query_arg( array( 'left' => $right, 'right' => $left ) ); + break; + } + + if ( $left_revision->ID == $right_revision->post_parent ) // right is a revision of left + $post =& $left_revision; + elseif ( $left_revision->post_parent == $right_revision->ID ) // left is a revision of right + $post =& $right_revision; + elseif ( $left_revision->post_parent == $right_revision->post_parent ) // both are revisions of common parent + $post = get_post( $left_revision->post_parent ); + else + break; // Don't diff two unrelated revisions + + if ( ! WP_POST_REVISIONS || !post_type_supports($post->post_type, 'revisions') ) { // Revisions disabled + if ( + // we're not looking at an autosave + ( !wp_is_post_autosave( $left_revision ) && !wp_is_post_autosave( $right_revision ) ) + || + // we're not comparing an autosave to the current post + ( $post->ID !== $left_revision->ID && $post->ID !== $right_revision->ID ) + ) { + $redirect = 'edit.php?post_type=' . $post->post_type; + break; + } + } + + if ( + // They're the same + $left_revision->ID == $right_revision->ID + || + // Neither is a revision + ( !wp_get_post_revision( $left_revision->ID ) && !wp_get_post_revision( $right_revision->ID ) ) + ) + break; + + $post_title = '' . get_the_title() . ''; + $h2 = sprintf( __( 'Compare Revisions of “%1$s”' ), $post_title ); + $title = __( 'Revisions' ); + + $left = $left_revision->ID; + $right = $right_revision->ID; + + $redirect = false; + break; +case 'view' : +default : + if ( !$revision = wp_get_post_revision( $revision_id ) ) + break; + if ( !$post = get_post( $revision->post_parent ) ) + break; + + if ( !current_user_can( 'read_post', $revision->ID ) || !current_user_can( 'read_post', $post->ID ) ) + break; + + // Revisions disabled and we're not looking at an autosave + if ( ( ! WP_POST_REVISIONS || !post_type_supports($post->post_type, 'revisions') ) && !wp_is_post_autosave( $revision ) ) { + $redirect = 'edit.php?post_type=' . $post->post_type; + break; + } + + $post_title = '' . get_the_title() . ''; + $revision_title = wp_post_revision_title( $revision, false ); + $h2 = sprintf( __( 'Revision for “%1$s” created on %2$s' ), $post_title, $revision_title ); + $title = __( 'Revisions' ); + + // Sets up the diff radio buttons + $left = $revision->ID; + $right = $post->ID; + + $redirect = false; + break; +endswitch; + +// Empty post_type means either malformed object found, or no valid parent was found. +if ( !$redirect && empty($post->post_type) ) + $redirect = 'edit.php'; + +if ( !empty($redirect) ) { + wp_redirect( $redirect ); + exit; +} + +// This is so that the correct "Edit" menu item is selected. +if ( !empty($post->post_type) && 'post' != $post->post_type ) + $parent_file = $submenu_file = 'edit.php?post_type=' . $post->post_type; +else + $parent_file = $submenu_file = 'edit.php'; + +require_once( './admin-header.php' ); + +?> + +
    + +

    + + + + + + + + + $field_title ) : + if ( 'diff' == $action ) { + $left_content = apply_filters( "_wp_post_revision_field_$field", $left_revision->$field, $field ); + $right_content = apply_filters( "_wp_post_revision_field_$field", $right_revision->$field, $field ); + if ( !$content = wp_text_diff( $left_content, $right_content ) ) + continue; // There is no difference between left and right + $identical = false; + } else { + add_filter( "_wp_post_revision_field_$field", 'htmlspecialchars' ); + $content = apply_filters( "_wp_post_revision_field_$field", $revision->$field, $field ); + } + ?> + + + + + + + + + + + + +
    + + +

    + +
    + +

    + + 'form-table', 'parent' => true, 'right' => $right, 'left' => $left ); +if ( ! WP_POST_REVISIONS || !post_type_supports($post->post_type, 'revisions') ) + $args['type'] = 'autosave'; + +wp_list_post_revisions( $post, $args ); + +?> + +
    + +El archivo 'wp-config.php' ya existe. Si necesitas reiniciar alguno de los elementos de la configuración de este archivo bórralo primero. Puedes tratar de instalar ahora.

    "); + +// Comprobamos si existe un wp-config.php por encima del directorio raiz pero que no sea parte de otra instalación +if (file_exists(ABSPATH . '../wp-config.php') && ! file_exists(ABSPATH . '../wp-settings.php')) + wp_die("

    El archivo 'wp-config.php' ya existe un nivel por encima de tu instalación de WordPress. Si necesitas reiniciar alguno de los elementos de la configuración de este archivo bórralo primero. Puedes tratar de instalar ahora.

    "); + +if ( version_compare( $required_php_version, phpversion(), '>' ) ) + wp_die( sprintf( /*WP_I18N_OLD_PHP*/'Tu servidor está usando la versión de PHP %1$s pero WordPress requiere al menos la %2$s.'/*/WP_I18N_OLD_PHP*/, phpversion(), $required_php_version ) ); + +if ( !extension_loaded('mysql') && !file_exists(ABSPATH . 'wp-content/db.php') ) + wp_die( /*WP_I18N_OLD_MYSQL*/'Tu instalación de PHP parece que no dispone de la extensión MySQL requerida por WordPress.'/*/WP_I18N_OLD_MYSQL*/ ); + +if (isset($_GET['step'])) + $step = $_GET['step']; +else + $step = 0; + +/** + * Muestra la cabecera de configuración del fichero wp-config.php. + * + * @ignore + * @since 2.3.0 + * @package WordPress + * @subpackage Installer_WP_Config + */ +function display_header() { + header( 'Content-Type: text/html; charset=utf-8' ); +?> + + + + +Archivo de configuración de WordPress + + + + +

    WordPress

    + + +

    Bienvenid@ a WordPress. Antes de empezar necesitamos algo de información de la base de datos. Necesitas conocer la siguiente información antes de seguir.

    +
      +
    1. Nombre de la base de datos
    2. +
    3. Nombre de usuario de la base de datos
    4. +
    5. Contraseña de la base de datos
    6. +
    7. Host de la base de datos
    8. +
    9. Prefijo de tabla (si quieres ejecutar más de un WordPress en una sola base de datos
    10. +
    +

    Si por alguna razón no funciona la creación automática de este archivo no te preocupes. Todo lo que hace es rellenar un fichero de configuración con la información de la base de datos. También puedes simplemente abrir el fichero wp-config-sample.php en un editor de texto, rellenar la información y guardarlo como wp-config.php.

    +

    En la mayoría de las ocasiones esta información te la facilita tu proveedor de alojamiento. Si no tienes esta información tendrás que contactar con ellos antes de poder continuar. Si ya estás listo …

    + +

    ¡Vamos a ello!

    + +
    +

    A continuación deberás introducir los detalles de conexión con tu base de datos. Si no estás seguro de cuales son contacta con tu proveedor de alojamiento.

    + + + + + + + + + + + + + + + + + + + + + + + + + + +
    El nombre de la base de datos en la que quieres que se ejecute WP.
    Tu nombre de usuario de MySQL
    …y la contraseña de MySQL.
    Si no funciona localhost tendrás que contactar con tu proveedor de alojamiento para que te diga cual es.
    Si quieres ejecutar varias instalaciones de WordPress en una sola base de datos cambia esto.
    + +

    +
    +ERROR: "Prefijo de tabla" solo puede contener números, letras y guión bajo.'/*/WP_I18N_BAD_PREFIX*/ ); + + // Probamos la conexión con la base de datos. + /**#@+ + * @ignore + */ + define('DB_NAME', $dbname); + define('DB_USER', $uname); + define('DB_PASSWORD', $passwrd); + define('DB_HOST', $dbhost); + /**#@-*/ + + // Fallará si los valores son incorrectos. + require_wp_db(); + if ( !empty($wpdb->error) ) + wp_die($wpdb->error->get_error_message()); + + // Carga o generación de las claves y salts. + $no_api = isset( $_POST['noapi'] ); + require_once( ABSPATH . WPINC . '/plugin.php' ); + require_once( ABSPATH . WPINC . '/l10n.php' ); + require_once( ABSPATH . WPINC . '/pomo/translations.php' ); + if ( ! $no_api ) { + require_once( ABSPATH . WPINC . '/class-http.php' ); + require_once( ABSPATH . WPINC . '/http.php' ); + wp_fix_server_vars(); + /**#@+ + * @ignore + */ + function get_bloginfo() { + return ( ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . str_replace( $_SERVER['PHP_SELF'], '/wp-admin/setup-config.php', '' ) ); + } + /**#@-*/ + $secret_keys = wp_remote_get( 'https://api.wordpress.org/secret-key/1.1/salt/' ); + } + + if ( $no_api || is_wp_error( $secret_keys ) ) { + $secret_keys = array(); + require_once( ABSPATH . WPINC . '/pluggable.php' ); + for ( $i = 0; $i < 8; $i++ ) { + $secret_keys[] = wp_generate_password( 64, true, true ); + } + } else { + $secret_keys = explode( "\n", wp_remote_retrieve_body( $secret_keys ) ); + foreach ( $secret_keys as $k => $v ) { + $secret_keys[$k] = substr( $v, 28, 64 ); + } + } + $key = 0; + + foreach ($configFile as $line_num => $line) { + switch (substr($line,0,16)) { + case "define('DB_NAME'": + $configFile[$line_num] = str_replace("nombredetubasededatos", $dbname, $line); + break; + case "define('DB_USER'": + $configFile[$line_num] = str_replace("'nombredeusuario'", "'$uname'", $line); + break; + case "define('DB_PASSW": + $configFile[$line_num] = str_replace("'contraseña'", "'$passwrd'", $line); + break; + case "define('DB_HOST'": + $configFile[$line_num] = str_replace("localhost", $dbhost, $line); + break; + case '$table_prefix =': + $configFile[$line_num] = str_replace('wp_', $prefix, $line); + break; + case "define('AUTH_KEY": + case "define('SECURE_A": + case "define('LOGGED_I": + case "define('NONCE_KE": + case "define('AUTH_SAL": + case "define('SECURE_A": + case "define('LOGGED_I": + case "define('NONCE_SA": + $configFile[$line_num] = str_replace('pon aquí tu frase aleatoria', $secret_keys[$key++], $line ); + break; + } + } + if ( ! is_writable(ABSPATH) ) : + display_header(); +?> +

    Lo siento pero no se ha podido escribir en el fichero wp-config.php.

    +

    Puedes crear mahualmente el archivo wp-config.php y pegar dentro el siguiente texto.

    + +

    Una vez hayas hecho esto haz clic en "Iniciar la instalación."

    +

    Iniciar la instalación

    + +

    ¡Todo correcto! Ya has terminado esta parte de la instalación. Ahora WordPress puede comunicarse con tu base de datos. Si estás preparado es momento de …

    + +

    Iniciar la instalación

    + + + diff --git a/src/wp-admin/theme-editor.php b/src/wp-admin/theme-editor.php new file mode 100644 index 0000000..c41f0c8 --- /dev/null +++ b/src/wp-admin/theme-editor.php @@ -0,0 +1,271 @@ +'.__('You do not have sufficient permissions to edit templates for this site.').'

    '); + +$title = __("Edit Themes"); +$parent_file = 'themes.php'; + +$help = '

    ' . __('You can use the Theme Editor to edit the individual CSS and PHP files which make up your theme.') . '

    '; +$help .= '

    ' . __('Begin by choosing a theme to edit from the dropdown menu and clicking Select. A list then appears of all the template files. Clicking once on any file name causes the file to appear in the large Editor box.') . '

    '; +$help .= '

    ' . __('For PHP files, you can use the Documentation dropdown to select from functions recognized in that file. Lookup takes you to a web page with reference material about that particular function.') . '

    '; +$help .= '

    ' . __('After typing in your edits, click Update File.') . '

    '; +$help .= '

    ' . __('Advice: think very carefully about your site crashing if you are live-editing the theme currently in use.') . '

    '; +$help .= '

    ' . __('Upgrading to a newer version of the same theme will override changes made here. To avoid this, consider creating a child theme instead.') . '

    '; +if ( is_network_admin() ) + $help .= '

    ' . __('Any edits to files from this screen will be reflected on all sites in the network.') . '

    '; +$help .= '

    ' . __('For more information:') . '

    '; +$help .= '

    ' . __('Documentation on Theme Development') . '

    '; +$help .= '

    ' . __('Documentation on Using Themes') . '

    '; +$help .= '

    ' . __('Documentation on Editing Files') . '

    '; +$help .= '

    ' . __('Documentation on Template Tags') . '

    '; +$help .= '

    ' . __('Support Forums') . '

    '; +add_contextual_help($current_screen, $help); + +wp_reset_vars(array('action', 'redirect', 'profile', 'error', 'warning', 'a', 'file', 'theme', 'dir')); + +wp_admin_css( 'theme-editor' ); + +$themes = get_themes(); + +if (empty($theme)) { + $theme = get_current_theme(); +} else { + $theme = stripslashes($theme); +} + +if ( ! isset($themes[$theme]) ) + wp_die(__('The requested theme does not exist.')); + +$allowed_files = array_merge( $themes[$theme]['Stylesheet Files'], $themes[$theme]['Template Files'] ); + +if ( empty( $file ) ) { + if ( false !== array_search( $themes[$theme]['Stylesheet Dir'] . '/style.css', $allowed_files ) ) + $file = $themes[$theme]['Stylesheet Dir'] . '/style.css'; + else + $file = $allowed_files[0]; +} else { + $file = stripslashes($file); + if ( 'theme' == $dir ) { + $file = dirname(dirname($themes[$theme]['Template Dir'])) . $file ; + } else if ( 'style' == $dir) { + $file = dirname(dirname($themes[$theme]['Stylesheet Dir'])) . $file ; + } +} + +validate_file_to_edit($file, $allowed_files); +$scrollto = isset($_REQUEST['scrollto']) ? (int) $_REQUEST['scrollto'] : 0; +$file_show = basename( $file ); + +switch($action) { + +case 'update': + + check_admin_referer('edit-theme_' . $file . $theme); + + $newcontent = stripslashes($_POST['newcontent']); + $theme = urlencode($theme); + if (is_writeable($file)) { + //is_writable() not always reliable, check return value. see comments @ http://uk.php.net/is_writable + $f = fopen($file, 'w+'); + if ($f !== FALSE) { + fwrite($f, $newcontent); + fclose($f); + $location = "theme-editor.php?file=$file&theme=$theme&a=te&scrollto=$scrollto"; + } else { + $location = "theme-editor.php?file=$file&theme=$theme&scrollto=$scrollto"; + } + } else { + $location = "theme-editor.php?file=$file&theme=$theme&scrollto=$scrollto"; + } + + $location = wp_kses_no_null($location); + $strip = array('%0d', '%0a', '%0D', '%0A'); + $location = _deep_replace($strip, $location); + header("Location: $location"); + exit(); + +break; + +default: + + require_once(ABSPATH . 'wp-admin/admin-header.php'); + + update_recently_edited($file); + + if ( !is_file($file) ) + $error = 1; + + $content = ''; + if ( !$error && filesize($file) > 0 ) { + $f = fopen($file, 'r'); + $content = fread($f, filesize($file)); + + if ( '.php' == substr( $file, strrpos( $file, '.' ) ) ) { + $functions = wp_doc_link_parse( $content ); + + $docs_select = ''; + } + + $content = esc_textarea( $content ); + } + + ?> + +

    +($file_show)" : $file_show; + +$is_child_theme = $themes[$theme]['Template'] != $themes[$theme]['Stylesheet']; +?> +
    + +

    + +
    +
    +

    +
    +
    +
    + + + +
    +
    +
    +
    +
    + +

    + +

    + +
      +($template_show)" : "$description"; + $filedesc = ( $template_file == $file ) ? "$description
      ($template_show)
      " : $filedesc; + $template_mapping[ $description ] = array( _get_template_edit_filename($template_file, $template_dir), $filedesc ); + } + ksort( $template_mapping ); + while ( list( $template_sorted_key, list( $template_file, $filedesc ) ) = each( $template_mapping ) ) : + ?> +
    • + +
    +

    +
      +($style_show)" : "$description"; + $filedesc = ( $style_file == $file ) ? "$description
      ($style_show)
      " : $filedesc; + $template_mapping[ $description ] = array( _get_template_edit_filename($style_file, $stylesheet_dir), $filedesc ); + } + ksort( $template_mapping ); + while ( list( $template_sorted_key, list( $style_file, $filedesc ) ) = each( $template_mapping ) ) : + ?> +
    • + +
    + +
    + +
    + +
    + + + + +
    + +
    + + + +
    + + +
    + +

    +

    + + '2' ) ); + else : ?> +

    the Codex for more information.'); ?>

    + +
    +
    +

    ' . __('Oops, no such file exists! Double check the name and try again, merci.') . '

    '; + } +?> +
    +
    + +get_pagenum(); +$wp_list_table->prepare_items(); + +$title = __('Install Themes'); +$parent_file = 'themes.php'; +if ( !is_network_admin() ) + $submenu_file = 'themes.php'; + +wp_enqueue_style( 'theme-install' ); +wp_enqueue_script( 'theme-install' ); + +add_thickbox(); +wp_enqueue_script( 'theme-preview' ); + +$body_id = $tab; + +do_action('install_themes_pre_' . $tab); //Used to override the general interface, Eg, install or theme information. + +$help = '

    ' . sprintf(__('You can find additional themes for your site by using the Theme Browser/Installer on this screen, which will display themes from the WordPress.org Theme Directory. These themes are designed and developed by third parties, are available free of charge, and are compatible with the license WordPress uses.'), 'http://wordpress.org/extend/themes/') . '

    '; +$help .= '

    ' . __('You can Search for themes by keyword, author, or tag, or can get more specific and search by criteria listed in the feature filter. Alternately, you can browse the themes that are Featured, Newest, or Recently Updated. When you find a theme you like, you can preview it or install it.') . '

    '; +$help .= '

    ' . __('You can Upload a theme manually if you have already downloaded its ZIP archive onto your computer (make sure it is from a trusted and original source). You can also do it the old-fashioned way and copy a downloaded theme’s folder via FTP into your /wp-content/themes directory.') . '

    '; +$help .= '

    ' . __('For more information:') . '

    '; +$help .= '

    ' . __('Documentation on Adding New Themes') . '

    '; +$help .= '

    ' . __('Support Forums') . '

    '; +add_contextual_help($current_screen, $help); + +include(ABSPATH . 'wp-admin/admin-header.php'); +?> +
    + +

    + + + +views(); ?> + +
    + +
    +prepare_items(); + +$title = __('Manage Themes'); +$parent_file = 'themes.php'; + +if ( current_user_can( 'switch_themes' ) ) : + +$help = '

    ' . __('Aside from the default theme included with your WordPress installation, themes are designed and developed by third parties.') . '

    '; +$help .= '

    ' . __('You can see your active theme at the top of the screen. Below are the other themes you have installed that are not currently in use. You can see what your site would look like with one of these themes by clicking the Preview link. To change themes, click the Activate link.') . '

    '; +if ( current_user_can('install_themes') ) + $help .= '

    ' . sprintf(__('If you would like to see more themes to choose from, click on the “Install Themes” tab and you will be able to browse or search for additional themes from the WordPress.org Theme Directory. Themes in the WordPress.org Theme Directory are designed and developed by third parties, and are compatible with the license WordPress uses. Oh, and they’re free!'), 'http://wordpress.org/extend/themes/') . '

    '; + +$help .= '

    ' . __('For more information:') . '

    '; +$help .= '

    ' . __('Documentation on Using Themes') . '

    '; +$help .= '

    ' . __('Support Forums') . '

    '; +add_contextual_help($current_screen, $help); + +add_thickbox(); +wp_enqueue_script( 'theme-preview' ); +wp_enqueue_script( 'theme' ); +wp_enqueue_style( 'theme-install' ); + +endif; + +require_once('./admin-header.php'); +?> + + +

    + +

    widgets settings screen to configure them.'), admin_url( 'widgets.php' ) ); ?>

    +

    Visit site' ), home_url( '/' ) ); ?>

    +

    + + +
    +

    + +

    + +

    +
    +screenshot ) : ?> +<?php _e('Current theme preview'); ?> + +

    title, $ct->version, $ct->author) ; ?>

    +

    description; ?>

    +
    + + {$item[0]}"; + else + $options[] = "{$item[0]}"; + } else if ( current_user_can($item[1]) ) { + if ( file_exists(ABSPATH . 'wp-admin/' . $item[2]) ) { + $options[] = "{$item[0]}"; + } else { + $options[] = "{$item[0]}"; + } + } + } + } + echo implode ( ' | ', $options ); + + if ( $ct->tags ) : ?> +

    tags); ?>

    + +
    + + +
    + +
    +'; + require( './admin-footer.php' ); + exit; +} +?> + +

    + +has_items() ) : ?> + +
    + + + +
    + +
    + +
    +

    + + + + $features ) : + $feature_name = esc_html( $feature_name ); ?> + +
    +
    + +
      + $feature ) : + $feature_name = $feature; + $feature_name = esc_html( $feature_name ); + $feature = esc_attr( $feature ); + ?> +
    1. + features ) ); ?>/> + +
    2. + +
    +
    + + +
    + 'margin-left: 120px', 'id' => 'filter-submit' ) ); ?> +   + +
    +
    +
    +
    +
    + +
    + + + +display(); ?> + +
    +
    + + + +

    +

    + + + + + + + + + + "; + } +?> +
    $title$description
    + +
    + + diff --git a/src/wp-admin/tools.php b/src/wp-admin/tools.php new file mode 100644 index 0000000..48528ae --- /dev/null +++ b/src/wp-admin/tools.php @@ -0,0 +1,63 @@ +' . __('Press This is a bookmarklet that makes it easy to blog about something you come across on the web. You can use it to just grab a link, or to post an excerpt. Press This will even allow you to choose from images included on the page and use them in your post. Just drag the Press This link on this screen to your bookmarks bar in your browser, and you’ll be on your way to easier content creation. Clicking on it while on another website opens a popup window with all these options.') . '

    ' . + '

    ' . __('The Use This link for the Categories and Tags Converter will take you to the Import page, where that Converter is one of the plugins you can download. Once that plugin is installed, the link on this page takes you to a screen where you can choose conversion either way.') . '

    ' . + '

    ' . __('Note: Turbo/Gears is no longer promoted on this screen as it was in previous versions due to the fact that Google has discontinued support for it.') . '

    ' . + '

    ' . __('For more information:') . '

    ' . + '

    ' . __('Documentation on Tools') . '

    ' . + '

    ' . __('Support Forums') . '

    ' +); + +require_once('./admin-header.php'); + +?> +
    + +

    + + +
    +

    +

    + +

    +

    +

    + +
    +cap->manage_terms) || current_user_can($tags->cap->manage_terms) ) : ?> +
    +

    +

    Use this to convert categories to tags or tags to categories.'), 'import.php' ); ?>

    +
    + +
    + diff --git a/src/wp-admin/update-core.php b/src/wp-admin/update-core.php new file mode 100644 index 0000000..85c70a4 --- /dev/null +++ b/src/wp-admin/update-core.php @@ -0,0 +1,505 @@ +locale && 'en_US' == get_locale() ) ? + $update->current : sprintf("%s–%s", $update->current, $update->locale); + $current = false; + if ( !isset($update->response) || 'latest' == $update->response ) + $current = true; + $submit = __('Update Now'); + $form_action = 'update-core.php?action=do-core-upgrade'; + $php_version = phpversion(); + $mysql_version = $wpdb->db_version(); + $show_buttons = true; + if ( 'development' == $update->response ) { + $message = __('You are using a development version of WordPress. You can update to the latest nightly build automatically or download the nightly build and install it manually:'); + $download = __('Download nightly build'); + } else { + if ( $current ) { + $message = sprintf(__('You have the latest version of WordPress. You do not need to update. However, if you want to re-install version %s, you can do so automatically or download the package and re-install manually:'), $version_string); + $submit = __('Re-install Now'); + $form_action = 'update-core.php?action=do-core-reinstall'; + } else { + $php_compat = version_compare( $php_version, $update->php_version, '>=' ); + $mysql_compat = version_compare( $mysql_version, $update->mysql_version, '>=' ) || file_exists( WP_CONTENT_DIR . '/db.php' ); + if ( !$mysql_compat && !$php_compat ) + $message = sprintf( __('You cannot update because WordPress %1$s requires PHP version %2$s or higher and MySQL version %3$s or higher. You are running PHP version %4$s and MySQL version %5$s.'), $update->current, $update->php_version, $update->mysql_version, $php_version, $mysql_version ); + elseif ( !$php_compat ) + $message = sprintf( __('You cannot update because WordPress %1$s requires PHP version %2$s or higher. You are running version %3$s.'), $update->current, $update->php_version, $php_version ); + elseif ( !$mysql_compat ) + $message = sprintf( __('You cannot update because WordPress %1$s requires MySQL version %2$s or higher. You are running version %3$s.'), $update->current, $update->mysql_version, $mysql_version ); + else + $message = sprintf(__('You can update to WordPress %2$s automatically or download the package and install it manually:'), $update->current, $version_string); + if ( !$mysql_compat || !$php_compat ) + $show_buttons = false; + } + $download = sprintf(__('Download %s'), $version_string); + } + + echo '

    '; + echo $message; + echo '

    '; + echo '
    '; + wp_nonce_field('upgrade-core'); + echo '

    '; + echo ''; + echo ''; + if ( $show_buttons ) { + if ( $first_pass ) { + submit_button( $submit, 'button button-primary', 'upgrade', false ); + $first_pass = false; + } else { + submit_button( $submit, 'button', 'upgrade', false ); + } + echo ' ' . $download . ' '; + } + if ( 'en_US' != $update->locale ) + if ( !isset( $update->dismissed ) || !$update->dismissed ) + submit_button( __('Hide this update'), 'button', 'dismiss', false ); + else + submit_button( __('Bring back this update'), 'button', 'undismiss', false ); + echo '

    '; + if ( 'en_US' != $update->locale && ( !isset($wp_local_package) || $wp_local_package != $update->locale ) ) + echo '

    '.__('This localized version contains both the translation and various other localization fixes. You can skip upgrading if you want to keep your current translation.').'

    '; + else if ( 'en_US' == $update->locale && get_locale() != 'en_US' ) { + echo '

    '.sprintf( __('You are about to install WordPress %s in English (US). There is a chance this update will break your translation. You may prefer to wait for the localized version to be released.'), $update->response != 'development' ? $update->current : '' ).'

    '; + } + echo '
    '; + +} + +function dismissed_updates() { + $dismissed = get_core_updates( array( 'dismissed' => true, 'available' => false ) ); + if ( $dismissed ) { + + $show_text = esc_js(__('Show hidden updates')); + $hide_text = esc_js(__('Hide hidden updates')); + ?> + + '.__('Show hidden updates').'

    '; + echo '
      '; + foreach( (array) $dismissed as $update) { + echo '
    • '; + list_core_update( $update ); + echo '
    • '; + } + echo '
    '; + } +} + +/** + * Display upgrade WordPress for downloading latest or upgrading automatically form. + * + * @since 2.7 + * + * @return null + */ +function core_upgrade_preamble() { + global $upgrade_error; + + $updates = get_core_updates(); +?> +
    + +

    +

    '; + if ( $upgrade_error == 'themes' ) + _e('Please select one or more themes to update.'); + else + _e('Please select one or more plugins to update.'); + echo '

    '; + } + + echo '

    '; + /* translators: %1 date, %2 time. */ + printf( __('Last checked on %1$s at %2$s.'), date_i18n( get_option( 'date_format' ) ), date_i18n( get_option( 'time_format' ) ) ); + echo '   ' . __( 'Check Again' ) . ''; + echo '

    '; + + if ( !isset($updates[0]->response) || 'latest' == $updates[0]->response ) { + echo '

    '; + _e('You have the latest version of WordPress.'); + echo '

    '; + } else { + echo '

    '; + _e('Important: before updating, please back up your database and files. For help with updates, visit the Updating WordPress Codex page.'); + echo '

    '; + + echo '

    '; + _e( 'An updated version of WordPress is available.' ); + echo '

    '; + } + + echo '
      '; + $alternate = true; + foreach( (array) $updates as $update ) { + echo '
    • '; + list_core_update( $update ); + echo '
    • '; + } + echo '
    '; + echo '

    ' . __( 'While your site is being updated, it will be in maintenance mode. As soon as your updates are complete, your site will return to normal.' ) . '

    '; + dismissed_updates(); + + if ( current_user_can( 'update_plugins' ) ) + list_plugin_updates(); + if ( current_user_can( 'update_themes' ) ) + list_theme_updates(); + do_action('core_upgrade_preamble'); + echo ''; +} + +function list_plugin_updates() { + global $wp_version; + + $cur_wp_version = preg_replace('/-.*$/', '', $wp_version); + + require_once(ABSPATH . 'wp-admin/includes/plugin-install.php'); + $plugins = get_plugin_updates(); + if ( empty( $plugins ) ) { + echo '

    ' . __( 'Plugins' ) . '

    '; + echo '

    ' . __( 'Your plugins are all up to date.' ) . '

    '; + return; + } + $form_action = 'update-core.php?action=do-plugin-upgrade'; + + $core_updates = get_core_updates(); + if ( !isset($core_updates[0]->response) || 'latest' == $core_updates[0]->response || 'development' == $core_updates[0]->response || version_compare( $core_updates[0]->current, $cur_wp_version, '=') ) + $core_update_version = false; + else + $core_update_version = $core_updates[0]->current; + ?> +

    +

    +
    + +

    + + + + + + + + + + + + + + + + $plugin_data) { + $info = plugins_api('plugin_information', array('slug' => $plugin_data->update->slug )); + // Get plugin compat for running version of WordPress. + if ( isset($info->tested) && version_compare($info->tested, $cur_wp_version, '>=') ) { + $compat = '
    ' . sprintf(__('Compatibility with WordPress %1$s: 100%% (according to its author)'), $cur_wp_version); + } elseif ( isset($info->compatibility[$cur_wp_version][$plugin_data->update->new_version]) ) { + $compat = $info->compatibility[$cur_wp_version][$plugin_data->update->new_version]; + $compat = '
    ' . sprintf(__('Compatibility with WordPress %1$s: %2$d%% (%3$d "works" votes out of %4$d total)'), $cur_wp_version, $compat[0], $compat[2], $compat[1]); + } else { + $compat = '
    ' . sprintf(__('Compatibility with WordPress %1$s: Unknown'), $cur_wp_version); + } + // Get plugin compat for updated version of WordPress. + if ( $core_update_version ) { + if ( isset($info->compatibility[$core_update_version][$plugin_data->update->new_version]) ) { + $update_compat = $info->compatibility[$core_update_version][$plugin_data->update->new_version]; + $compat .= '
    ' . sprintf(__('Compatibility with WordPress %1$s: %2$d%% (%3$d "works" votes out of %4$d total)'), $core_update_version, $update_compat[0], $update_compat[2], $update_compat[1]); + } else { + $compat .= '
    ' . sprintf(__('Compatibility with WordPress %1$s: Unknown'), $core_update_version); + } + } + // Get the upgrade notice for the new plugin version. + if ( isset($plugin_data->update->upgrade_notice) ) { + $upgrade_notice = '
    ' . strip_tags($plugin_data->update->upgrade_notice); + } else { + $upgrade_notice = ''; + } + echo " + + + + "; + } +?> + +
    {$plugin_data->Name}
    " . sprintf(__('You have version %1$s installed. Update to %2$s.'), $plugin_data->Version, $plugin_data->update->new_version) . $compat . $upgrade_notice . "
    +

    +
    +' . __( 'Themes' ) . ''; + echo '

    ' . __( 'Your themes are all up to date.' ) . '

    '; + return; + } + + $form_action = 'update-core.php?action=do-theme-upgrade'; + +?> +

    +

    +

    Please Note: Any customizations you have made to theme files will be lost. Please consider using child themes for modifications.'), _x('http://codex.wordpress.org/Child_Themes', 'Link used in suggestion to use child themes in GUU') ); ?>

    +
    + +

    + + + + + + + + + + + + + + + + $theme_data) { + $screenshot = $theme_data->{'Theme Root URI'} . '/' . $stylesheet . '/' . $theme_data->Screenshot; + + echo " + + + + "; + } +?> + +
    {$theme_data->Name}" . sprintf(__('You have version %1$s installed. Update to %2$s.'), $theme_data->Version, $theme_data->update['new_version']) . "
    +

    +
    + +
    + +

    +errors->get_error_code() ) { + foreach ( $wp_filesystem->errors->get_error_messages() as $message ) + show_message($message); + echo '
    '; + return; + } + + if ( $reinstall ) + $update->response = 'reinstall'; + + $result = wp_update_core($update, 'show_message'); + + if ( is_wp_error($result) ) { + show_message($result); + if ('up_to_date' != $result->get_error_code() ) + show_message( __('Installation Failed') ); + } else { + show_message( __('WordPress updated successfully') ); + show_message( '' . __('Go to Dashboard') . '' ); + } + echo ''; +} + +function do_dismiss_core_update() { + $version = isset( $_POST['version'] )? $_POST['version'] : false; + $locale = isset( $_POST['locale'] )? $_POST['locale'] : 'en_US'; + $update = find_core_update( $version, $locale ); + if ( !$update ) + return; + dismiss_core_update( $update ); + wp_redirect( wp_nonce_url('update-core.php?action=upgrade-core', 'upgrade-core') ); + exit; +} + +function do_undismiss_core_update() { + $version = isset( $_POST['version'] )? $_POST['version'] : false; + $locale = isset( $_POST['locale'] )? $_POST['locale'] : 'en_US'; + $update = find_core_update( $version, $locale ); + if ( !$update ) + return; + undismiss_core_update( $version, $locale ); + wp_redirect( wp_nonce_url('update-core.php?action=upgrade-core', 'upgrade-core') ); + exit; +} + +function no_update_actions($actions) { + return ''; +} + +$action = isset($_GET['action']) ? $_GET['action'] : 'upgrade-core'; + +$upgrade_error = false; +if ( ( 'do-theme-upgrade' == $action || ( 'do-plugin-upgrade' == $action && ! isset( $_GET['plugins'] ) ) ) + && ! isset( $_POST['checked'] ) ) { + $upgrade_error = $action == 'do-theme-upgrade' ? 'themes' : 'plugins'; + $action = 'upgrade-core'; +} + +$title = __('WordPress Updates'); +$parent_file = 'tools.php'; + +add_contextual_help($current_screen, + '

    ' . __('This screen lets you update to the latest version of WordPress as well as update your themes and plugins from the WordPress.org repository. When updates are available, the number of available updates will appear in a bubble on the left hand menu as a notification. It is very important to keep your WordPress installation up to date for security reasons, so when you see a number appear, make sure you take the time to update, which is an easy process.') . '

    ' . + '

    ' . __('Updating your WordPress installation is a simple one-click procedure; just click on the Update button when it says a new version is available.') . '

    ' . + '

    ' . __('To update themes or plugins from this screen, use the checkboxes to make your selection and click on the appropriate Update button. Check the box at the top of the Themes or Plugins section to select all and update them all at once.') . '

    ' . + '

    ' . __('For more information:') . '

    ' . + '

    ' . __('Documentation on Updating WordPress') . '

    ' . + '

    ' . __('Support Forums') . '

    ' +); + +if ( 'upgrade-core' == $action ) { + + wp_version_check(); + require_once(ABSPATH . 'wp-admin/admin-header.php'); + core_upgrade_preamble(); + include(ABSPATH . 'wp-admin/admin-footer.php'); + +} elseif ( 'do-core-upgrade' == $action || 'do-core-reinstall' == $action ) { + check_admin_referer('upgrade-core'); + + // do the (un)dismiss actions before headers, + // so that they can redirect + if ( isset( $_POST['dismiss'] ) ) + do_dismiss_core_update(); + elseif ( isset( $_POST['undismiss'] ) ) + do_undismiss_core_update(); + + require_once(ABSPATH . 'wp-admin/admin-header.php'); + if ( 'do-core-reinstall' == $action ) + $reinstall = true; + else + $reinstall = false; + + if ( isset( $_POST['upgrade'] ) ) + do_core_upgrade($reinstall); + + include(ABSPATH . 'wp-admin/admin-footer.php'); + +} elseif ( 'do-plugin-upgrade' == $action ) { + + if ( ! current_user_can( 'update_plugins' ) ) + wp_die( __( 'You do not have sufficient permissions to update this site.' ) ); + + check_admin_referer('upgrade-core'); + + if ( isset( $_GET['plugins'] ) ) { + $plugins = explode( ',', $_GET['plugins'] ); + } elseif ( isset( $_POST['checked'] ) ) { + $plugins = (array) $_POST['checked']; + } else { + wp_redirect( admin_url('update-core.php') ); + exit; + } + + $url = 'update.php?action=update-selected&plugins=' . urlencode(implode(',', $plugins)); + $url = wp_nonce_url($url, 'bulk-update-plugins'); + + $title = __('Update Plugins'); + + require_once(ABSPATH . 'wp-admin/admin-header.php'); + echo '
    '; + screen_icon('plugins'); + echo '

    ' . esc_html__('Update Plugins') . '

    '; + echo ""; + echo '
    '; + include(ABSPATH . 'wp-admin/admin-footer.php'); + +} elseif ( 'do-theme-upgrade' == $action ) { + + if ( ! current_user_can( 'update_themes' ) ) + wp_die( __( 'You do not have sufficient permissions to update this site.' ) ); + + check_admin_referer('upgrade-core'); + + if ( isset( $_GET['themes'] ) ) { + $themes = explode( ',', $_GET['themes'] ); + } elseif ( isset( $_POST['checked'] ) ) { + $themes = (array) $_POST['checked']; + } else { + wp_redirect( admin_url('update-core.php') ); + exit; + } + + $url = 'update.php?action=update-selected-themes&themes=' . urlencode(implode(',', $themes)); + $url = wp_nonce_url($url, 'bulk-update-themes'); + + $title = __('Update Themes'); + + require_once(ABSPATH . 'wp-admin/admin-header.php'); + echo '
    '; + screen_icon('themes'); + echo '

    ' . esc_html__('Update Themes') . '

    '; + echo ""; + echo '
    '; + include(ABSPATH . 'wp-admin/admin-footer.php'); + +} else { + do_action('update-core-custom_' . $action); +} \ No newline at end of file diff --git a/src/wp-admin/update.php b/src/wp-admin/update.php new file mode 100644 index 0000000..e529064 --- /dev/null +++ b/src/wp-admin/update.php @@ -0,0 +1,250 @@ +bulk_upgrade( $plugins ); + + iframe_footer(); + + } elseif ( 'upgrade-plugin' == $action ) { + if ( ! current_user_can('update_plugins') ) + wp_die(__('You do not have sufficient permissions to update plugins for this site.')); + + check_admin_referer('upgrade-plugin_' . $plugin); + + $title = __('Update Plugin'); + $parent_file = 'plugins.php'; + $submenu_file = 'plugins.php'; + require_once(ABSPATH . 'wp-admin/admin-header.php'); + + $nonce = 'upgrade-plugin_' . $plugin; + $url = 'update.php?action=upgrade-plugin&plugin=' . $plugin; + + $upgrader = new Plugin_Upgrader( new Plugin_Upgrader_Skin( compact('title', 'nonce', 'url', 'plugin') ) ); + $upgrader->upgrade($plugin); + + include(ABSPATH . 'wp-admin/admin-footer.php'); + + } elseif ('activate-plugin' == $action ) { + if ( ! current_user_can('update_plugins') ) + wp_die(__('You do not have sufficient permissions to update plugins for this site.')); + + check_admin_referer('activate-plugin_' . $plugin); + if ( ! isset($_GET['failure']) && ! isset($_GET['success']) ) { + wp_redirect( admin_url('update.php?action=activate-plugin&failure=true&plugin=' . $plugin . '&_wpnonce=' . $_GET['_wpnonce']) ); + activate_plugin( $plugin, '', ! empty( $_GET['networkwide'] ), true ); + wp_redirect( admin_url('update.php?action=activate-plugin&success=true&plugin=' . $plugin . '&_wpnonce=' . $_GET['_wpnonce']) ); + die(); + } + iframe_header( __('Plugin Reactivation'), true ); + if ( isset($_GET['success']) ) + echo '

    ' . __('Plugin reactivated successfully.') . '

    '; + + if ( isset($_GET['failure']) ){ + echo '

    ' . __('Plugin failed to reactivate due to a fatal error.') . '

    '; + + error_reporting( E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING | E_RECOVERABLE_ERROR ); + @ini_set('display_errors', true); //Ensure that Fatal errors are displayed. + include(WP_PLUGIN_DIR . '/' . $plugin); + } + iframe_footer(); + } elseif ( 'install-plugin' == $action ) { + + if ( ! current_user_can('install_plugins') ) + wp_die(__('You do not have sufficient permissions to install plugins for this site.')); + + include_once ABSPATH . 'wp-admin/includes/plugin-install.php'; //for plugins_api.. + + check_admin_referer('install-plugin_' . $plugin); + $api = plugins_api('plugin_information', array('slug' => $plugin, 'fields' => array('sections' => false) ) ); //Save on a bit of bandwidth. + + if ( is_wp_error($api) ) + wp_die($api); + + $title = __('Plugin Install'); + $parent_file = 'plugins.php'; + $submenu_file = 'plugin-install.php'; + require_once(ABSPATH . 'wp-admin/admin-header.php'); + + $title = sprintf( __('Installing Plugin: %s'), $api->name . ' ' . $api->version ); + $nonce = 'install-plugin_' . $plugin; + $url = 'update.php?action=install-plugin&plugin=' . $plugin; + if ( isset($_GET['from']) ) + $url .= '&from=' . urlencode(stripslashes($_GET['from'])); + + $type = 'web'; //Install plugin type, From Web or an Upload. + + $upgrader = new Plugin_Upgrader( new Plugin_Installer_Skin( compact('title', 'url', 'nonce', 'plugin', 'api') ) ); + $upgrader->install($api->download_link); + + include(ABSPATH . 'wp-admin/admin-footer.php'); + + } elseif ( 'upload-plugin' == $action ) { + + if ( ! current_user_can('install_plugins') ) + wp_die(__('You do not have sufficient permissions to install plugins for this site.')); + + check_admin_referer('plugin-upload'); + + $file_upload = new File_Upload_Upgrader('pluginzip', 'package'); + + $title = __('Upload Plugin'); + $parent_file = 'plugins.php'; + $submenu_file = 'plugin-install.php'; + require_once(ABSPATH . 'wp-admin/admin-header.php'); + + $title = sprintf( __('Installing Plugin from uploaded file: %s'), basename( $file_upload->filename ) ); + $nonce = 'plugin-upload'; + $url = add_query_arg(array('package' => $file_upload->filename ), 'update.php?action=upload-plugin'); + $type = 'upload'; //Install plugin type, From Web or an Upload. + + $upgrader = new Plugin_Upgrader( new Plugin_Installer_Skin( compact('type', 'title', 'nonce', 'url') ) ); + $upgrader->install( $file_upload->package ); + + include(ABSPATH . 'wp-admin/admin-footer.php'); + + } elseif ( 'upgrade-theme' == $action ) { + + if ( ! current_user_can('update_themes') ) + wp_die(__('You do not have sufficient permissions to update themes for this site.')); + + check_admin_referer('upgrade-theme_' . $theme); + + add_thickbox(); + wp_enqueue_script('theme-preview'); + $title = __('Update Theme'); + $parent_file = 'themes.php'; + $submenu_file = 'themes.php'; + require_once(ABSPATH . 'wp-admin/admin-header.php'); + + $nonce = 'upgrade-theme_' . $theme; + $url = 'update.php?action=upgrade-theme&theme=' . $theme; + + $upgrader = new Theme_Upgrader( new Theme_Upgrader_Skin( compact('title', 'nonce', 'url', 'theme') ) ); + $upgrader->upgrade($theme); + + include(ABSPATH . 'wp-admin/admin-footer.php'); + } elseif ( 'update-selected-themes' == $action ) { + if ( ! current_user_can( 'update_themes' ) ) + wp_die( __( 'You do not have sufficient permissions to update themes for this site.' ) ); + + check_admin_referer( 'bulk-update-themes' ); + + if ( isset( $_GET['themes'] ) ) + $themes = explode( ',', stripslashes($_GET['themes']) ); + elseif ( isset( $_POST['checked'] ) ) + $themes = (array) $_POST['checked']; + else + $themes = array(); + + $themes = array_map('urldecode', $themes); + + $url = 'update.php?action=update-selected-themes&themes=' . urlencode(implode(',', $themes)); + $nonce = 'bulk-update-themes'; + + wp_enqueue_script('jquery'); + iframe_header(); + + $upgrader = new Theme_Upgrader( new Bulk_Theme_Upgrader_Skin( compact( 'nonce', 'url' ) ) ); + $upgrader->bulk_upgrade( $themes ); + + iframe_footer(); + } elseif ( 'install-theme' == $action ) { + + if ( ! current_user_can('install_themes') ) + wp_die(__('You do not have sufficient permissions to install themes for this site.')); + + include_once ABSPATH . 'wp-admin/includes/theme-install.php'; //for themes_api.. + + check_admin_referer('install-theme_' . $theme); + $api = themes_api('theme_information', array('slug' => $theme, 'fields' => array('sections' => false) ) ); //Save on a bit of bandwidth. + + if ( is_wp_error($api) ) + wp_die($api); + + add_thickbox(); + wp_enqueue_script('theme-preview'); + $title = __('Install Themes'); + $parent_file = 'themes.php'; + $submenu_file = 'themes.php'; + require_once(ABSPATH . 'wp-admin/admin-header.php'); + + $title = sprintf( __('Installing Theme: %s'), $api->name . ' ' . $api->version ); + $nonce = 'install-theme_' . $theme; + $url = 'update.php?action=install-theme&theme=' . $theme; + $type = 'web'; //Install theme type, From Web or an Upload. + + $upgrader = new Theme_Upgrader( new Theme_Installer_Skin( compact('title', 'url', 'nonce', 'plugin', 'api') ) ); + $upgrader->install($api->download_link); + + include(ABSPATH . 'wp-admin/admin-footer.php'); + + } elseif ( 'upload-theme' == $action ) { + + if ( ! current_user_can('install_themes') ) + wp_die(__('You do not have sufficient permissions to install themes for this site.')); + + check_admin_referer('theme-upload'); + + $file_upload = new File_Upload_Upgrader('themezip', 'package'); + + $title = __('Upload Theme'); + $parent_file = 'themes.php'; + $submenu_file = 'theme-install.php'; + add_thickbox(); + wp_enqueue_script('theme-preview'); + require_once(ABSPATH . 'wp-admin/admin-header.php'); + + $title = sprintf( __('Installing Theme from uploaded file: %s'), basename( $file_upload->filename ) ); + $nonce = 'theme-upload'; + $url = add_query_arg(array('package' => $file_upload->filename), 'update.php?action=upload-theme'); + $type = 'upload'; //Install plugin type, From Web or an Upload. + + $upgrader = new Theme_Upgrader( new Theme_Installer_Skin( compact('type', 'title', 'nonce', 'url') ) ); + $upgrader->install( $file_upload->package ); + + include(ABSPATH . 'wp-admin/admin-footer.php'); + + } else { + do_action('update-custom_' . $action); + } +} diff --git a/src/wp-admin/upgrade-functions.php b/src/wp-admin/upgrade-functions.php new file mode 100644 index 0000000..ca14a59 --- /dev/null +++ b/src/wp-admin/upgrade-functions.php @@ -0,0 +1,13 @@ + diff --git a/src/wp-admin/upgrade.php b/src/wp-admin/upgrade.php new file mode 100644 index 0000000..794b55b --- /dev/null +++ b/src/wp-admin/upgrade.php @@ -0,0 +1,110 @@ +db_version(); +$php_compat = version_compare( $php_version, $required_php_version, '>=' ); +$mysql_compat = version_compare( $mysql_version, $required_mysql_version, '>=' ) || file_exists( WP_CONTENT_DIR . '/db.php' ); + +@header( 'Content-Type: ' . get_option( 'html_type' ) . '; charset=' . get_option( 'blog_charset' ) ); +?> + +> + + + <?php _e( 'WordPress › Update' ); ?> + + + +

    WordPress

    + + + +

    +

    +

    + +WordPress %1$s requires PHP version %2$s or higher and MySQL version %3$s or higher. You are running PHP version %4$s and MySQL version %5$s.'), $wp_version, $required_php_version, $required_mysql_version, $php_version, $mysql_version ); + elseif ( !$php_compat ) + printf( __('You cannot update because WordPress %1$s requires PHP version %2$s or higher. You are running version %3$s.'), $wp_version, $required_php_version, $php_version ); + elseif ( !$mysql_compat ) + printf( __('You cannot update because WordPress %1$s requires MySQL version %2$s or higher. You are running version %3$s.'), $wp_version, $required_mysql_version, $mysql_version ); +?> + +

    +

    +

    +

    + +

    +

    +

    + + + + + + diff --git a/src/wp-admin/upload.php b/src/wp-admin/upload.php new file mode 100644 index 0000000..e121207 --- /dev/null +++ b/src/wp-admin/upload.php @@ -0,0 +1,222 @@ +get_pagenum(); + +// Handle bulk actions +$doaction = $wp_list_table->current_action(); + +if ( $doaction ) { + check_admin_referer('bulk-media'); + + if ( 'delete_all' == $doaction ) { + $post_ids = $wpdb->get_col( "SELECT ID FROM $wpdb->posts WHERE post_type='attachment' AND post_status = 'trash'" ); + $doaction = 'delete'; + } elseif ( isset( $_REQUEST['media'] ) ) { + $post_ids = $_REQUEST['media']; + } elseif ( isset( $_REQUEST['ids'] ) ) { + $post_ids = explode( ',', $_REQUEST['ids'] ); + } + + $location = 'upload.php'; + if ( $referer = wp_get_referer() ) { + if ( false !== strpos( $referer, 'upload.php' ) ) + $location = remove_query_arg( array( 'trashed', 'untrashed', 'deleted', 'message', 'ids', 'posted' ), $referer ); + } + + switch ( $doaction ) { + case 'find_detached': + if ( !current_user_can('edit_posts') ) + wp_die( __('You are not allowed to scan for lost attachments.') ); + + $lost = $wpdb->get_col( " + SELECT ID FROM $wpdb->posts + WHERE post_type = 'attachment' AND post_parent > '0' + AND post_parent NOT IN ( + SELECT ID FROM $wpdb->posts + WHERE post_type NOT IN ( 'attachment', '" . join( "', '", get_post_types( array( 'public' => false ) ) ) . "' ) + ) + " ); + + $_REQUEST['detached'] = 1; + break; + case 'attach': + $parent_id = (int) $_REQUEST['found_post_id']; + if ( !$parent_id ) + return; + + $parent = &get_post( $parent_id ); + if ( !current_user_can( 'edit_post', $parent_id ) ) + wp_die( __( 'You are not allowed to edit this post.' ) ); + + $attach = array(); + foreach ( (array) $_REQUEST['media'] as $att_id ) { + $att_id = (int) $att_id; + + if ( !current_user_can( 'edit_post', $att_id ) ) + continue; + + $attach[] = $att_id; + clean_attachment_cache( $att_id ); + } + + if ( ! empty( $attach ) ) { + $attach = implode( ',', $attach ); + $attached = $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->posts SET post_parent = %d WHERE post_type = 'attachment' AND ID IN ( $attach )", $parent_id ) ); + } + + if ( isset( $attached ) ) { + $location = 'upload.php'; + if ( $referer = wp_get_referer() ) { + if ( false !== strpos( $referer, 'upload.php' ) ) + $location = $referer; + } + + $location = add_query_arg( array( 'attached' => $attached ) , $location ); + wp_redirect( $location ); + exit; + } + break; + case 'trash': + foreach ( (array) $post_ids as $post_id ) { + if ( !current_user_can( 'delete_post', $post_id ) ) + wp_die( __( 'You are not allowed to move this post to the trash.' ) ); + + if ( !wp_trash_post( $post_id ) ) + wp_die( __( 'Error in moving to trash...' ) ); + } + $location = add_query_arg( array( 'trashed' => count( $post_ids ), 'ids' => join( ',', $post_ids ) ), $location ); + break; + case 'untrash': + foreach ( (array) $post_ids as $post_id ) { + if ( !current_user_can( 'delete_post', $post_id ) ) + wp_die( __( 'You are not allowed to move this post out of the trash.' ) ); + + if ( !wp_untrash_post( $post_id ) ) + wp_die( __( 'Error in restoring from trash...' ) ); + } + $location = add_query_arg( 'untrashed', count( $post_ids ), $location ); + break; + case 'delete': + foreach ( (array) $post_ids as $post_id_del ) { + if ( !current_user_can( 'delete_post', $post_id_del ) ) + wp_die( __( 'You are not allowed to delete this post.' ) ); + + if ( !wp_delete_attachment( $post_id_del ) ) + wp_die( __( 'Error in deleting...' ) ); + } + $location = add_query_arg( 'deleted', count( $post_ids ), $location ); + break; + } + + wp_redirect( $location ); + exit; +} elseif ( ! empty( $_GET['_wp_http_referer'] ) ) { + wp_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce' ), stripslashes( $_SERVER['REQUEST_URI'] ) ) ); + exit; +} + +$wp_list_table->prepare_items(); + +$title = __('Media Library'); +$parent_file = 'upload.php'; + +wp_enqueue_script( 'wp-ajax-response' ); +wp_enqueue_script( 'jquery-ui-draggable' ); +wp_enqueue_script( 'media' ); + +add_screen_option( 'per_page', array('label' => _x( 'Media items', 'items per page (screen options)' )) ); + +add_contextual_help( $current_screen, + '

    ' . __( 'All the files you’ve uploaded are listed in the Media Library, with the most recent uploads listed first. You can use the Screen Options tab to customize the display of this screen.' ) . '

    ' . + '

    ' . __( 'You can narrow the list by file type/status using the text link filters at the top of the screen. You also can refine the list by date using the dropdown menu above the media table.' ) . '

    ' . + '

    ' . __( 'Hovering over a row reveals action links: Edit, Delete Permanently, and View. Clicking Edit or on the media file’s name displays a simple screen to edit that individual file’s metadata. Clicking Delete Permanently will delete the file from the media library (as well as from any posts to which it is currently attached). View will take you to the display page for that file.' ) . '

    ' . + '

    ' . __( 'If a media file has not been attached to any post, you will see that in the Attached To column, and can click on Attach File to launch a small popup that will allow you to search for a post and attach the file.' ) . '

    ' . + '

    ' . __( 'For more information:' ) . '

    ' . + '

    ' . __( 'Documentation on Media Library' ) . '

    ' . + '

    ' . __( 'Support Forums' ) . '

    ' +); + +require_once('./admin-header.php'); +?> + +
    + +

    ' . __('Search results for “%s”') . '', get_search_query() ); ?> +

    + +' . __('Undo') . ''; + $_SERVER['REQUEST_URI'] = remove_query_arg(array('trashed'), $_SERVER['REQUEST_URI']); +} + +if ( isset($_GET['untrashed']) && (int) $_GET['untrashed'] ) { + $message = sprintf( _n( 'Media attachment restored from the trash.', '%d media attachments restored from the trash.', $_GET['untrashed'] ), number_format_i18n( $_GET['untrashed'] ) ); + $_SERVER['REQUEST_URI'] = remove_query_arg(array('untrashed'), $_SERVER['REQUEST_URI']); +} + +$messages[1] = __('Media attachment updated.'); +$messages[2] = __('Media permanently deleted.'); +$messages[3] = __('Error saving media attachment.'); +$messages[4] = __('Media moved to the trash.') . ' ' . __('Undo') . ''; +$messages[5] = __('Media restored from the trash.'); + +if ( isset($_GET['message']) && (int) $_GET['message'] ) { + $message = $messages[$_GET['message']]; + $_SERVER['REQUEST_URI'] = remove_query_arg(array('message'), $_SERVER['REQUEST_URI']); +} + +if ( !empty($message) ) { ?> +

    + + +views(); ?> + +
    + +search_box( __( 'Search Media' ), 'media' ); ?> + +display(); ?> + +
    + +
    + +
    +
    + +ID ) ); + +if ( ! $user_id && IS_PROFILE_PAGE ) + $user_id = $current_user->ID; +elseif ( ! $user_id && ! IS_PROFILE_PAGE ) + wp_die(__( 'Invalid user ID.' ) ); +elseif ( ! get_userdata( $user_id ) ) + wp_die( __('Invalid user ID.') ); + +wp_enqueue_script('user-profile'); + +$title = IS_PROFILE_PAGE ? __('Profile') : __('Edit User'); +if ( current_user_can('edit_users') && !IS_PROFILE_PAGE ) + $submenu_file = 'users.php'; +else + $submenu_file = 'profile.php'; + +if ( current_user_can('edit_users') && !is_user_admin() ) + $parent_file = 'users.php'; +else + $parent_file = 'profile.php'; + +// contextual help - choose Help on the top right of admin panel to preview this. +add_contextual_help($current_screen, + '

    ' . __('Your profile contains information about you (your “account”) as well as some personal options related to using WordPress.') . '

    ' . + '

    ' . __('You can change your password, turn on keyboard shortcuts, change the color scheme of your WordPress administration screens, and turn off the WYSIWYG (Visual) editor, among other things.') . '

    ' . + '

    ' . __('Your username cannot be changed, but you can use other fields to enter your real name or a nickname, and change which name to display on your posts.') . '

    ' . + '

    ' . __('Required fields are indicated; the rest are optional. Profile information will only be displayed if your theme is set up to do so.') . '

    ' . + '

    ' . __('Remember to click the Update Profile button when you are finished.') . '

    ' . + '

    ' . __('For more information:') . '

    ' . + '

    ' . __('Documentation on User Profiles') . '

    ' . + '

    ' . __('Support Forums') . '

    ' +); + + +$wp_http_referer = remove_query_arg(array('update', 'delete_count'), stripslashes($wp_http_referer)); + +$user_can_edit = current_user_can( 'edit_posts' ) || current_user_can( 'edit_pages' ); + +/** + * Optional SSL preference that can be turned on by hooking to the 'personal_options' action. + * + * @since 2.7.0 + * + * @param object $user User data object + */ +function use_ssl_preference($user) { +?> + + + + +ID && ! apply_filters( 'enable_edit_any_user_configuration', true ) ) + wp_die( __( 'You do not have permission to edit this user.' ) ); + +// Execute confirmed email change. See send_confirmation_on_profile_email(). +if ( is_multisite() && IS_PROFILE_PAGE && isset( $_GET[ 'newuseremail' ] ) && $current_user->ID ) { + $new_email = get_option( $current_user->ID . '_new_email' ); + if ( $new_email[ 'hash' ] == $_GET[ 'newuseremail' ] ) { + $user->ID = $current_user->ID; + $user->user_email = esc_html( trim( $new_email[ 'newemail' ] ) ); + if ( $wpdb->get_var( $wpdb->prepare( "SELECT user_login FROM {$wpdb->signups} WHERE user_login = %s", $current_user->user_login ) ) ) + $wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->signups} SET user_email = %s WHERE user_login = %s", $user->user_email, $current_user->user_login ) ); + wp_update_user( get_object_vars( $user ) ); + delete_option( $current_user->ID . '_new_email' ); + wp_redirect( add_query_arg( array('updated' => 'true'), self_admin_url( 'profile.php' ) ) ); + die(); + } +} elseif ( is_multisite() && IS_PROFILE_PAGE && !empty( $_GET['dismiss'] ) && $current_user->ID . '_new_email' == $_GET['dismiss'] ) { + delete_option( $current_user->ID . '_new_email' ); + wp_redirect( add_query_arg( array('updated' => 'true'), self_admin_url( 'profile.php' ) ) ); + die(); +} + +switch ($action) { +case 'update': + +check_admin_referer('update-user_' . $user_id); + +if ( !current_user_can('edit_user', $user_id) ) + wp_die(__('You do not have permission to edit this user.')); + +if ( IS_PROFILE_PAGE ) + do_action('personal_options_update', $user_id); +else + do_action('edit_user_profile_update', $user_id); + +if ( !is_multisite() ) { + $errors = edit_user($user_id); +} else { + $user = get_userdata( $user_id ); + + // Update the email address in signups, if present. + if ( $user->user_login && isset( $_POST[ 'email' ] ) && is_email( $_POST[ 'email' ] ) && $wpdb->get_var( $wpdb->prepare( "SELECT user_login FROM {$wpdb->signups} WHERE user_login = %s", $user->user_login ) ) ) + $wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->signups} SET user_email = %s WHERE user_login = %s", $_POST[ 'email' ], $user_login ) ); + + // WPMU must delete the user from the current blog if WP added him after editing. + $delete_role = false; + $blog_prefix = $wpdb->get_blog_prefix(); + if ( $user_id != $current_user->ID ) { + $cap = $wpdb->get_var( "SELECT meta_value FROM {$wpdb->usermeta} WHERE user_id = '{$user_id}' AND meta_key = '{$blog_prefix}capabilities' AND meta_value = 'a:0:{}'" ); + if ( !is_network_admin() && null == $cap && $_POST[ 'role' ] == '' ) { + $_POST[ 'role' ] = 'contributor'; + $delete_role = true; + } + } + if ( !isset( $errors ) || ( isset( $errors ) && is_object( $errors ) && false == $errors->get_error_codes() ) ) + $errors = edit_user($user_id); + if ( $delete_role ) // stops users being added to current blog when they are edited + delete_user_meta( $user_id, $blog_prefix . 'capabilities' ); + + if ( is_multisite() && is_network_admin() && !IS_PROFILE_PAGE && current_user_can( 'manage_network_options' ) && !isset($super_admins) && empty( $_POST['super_admin'] ) == is_super_admin( $user_id ) ) + empty( $_POST['super_admin'] ) ? revoke_super_admin( $user_id ) : grant_super_admin( $user_id ); +} + +if ( !is_wp_error( $errors ) ) { + $redirect = (IS_PROFILE_PAGE ? "profile.php?" : "user-edit.php?user_id=$user_id&"). "updated=true"; + if ( $wp_http_referer ) + $redirect = add_query_arg('wp_http_referer', urlencode($wp_http_referer), $redirect); + wp_redirect($redirect); + exit; +} + +default: +$profileuser = get_user_to_edit($user_id); + +if ( !current_user_can('edit_user', $user_id) ) + wp_die(__('You do not have permission to edit this user.')); + +include (ABSPATH . 'wp-admin/admin-header.php'); +?> + +ID ) && current_user_can( 'manage_network_options' ) ) { ?> +

    + + +
    +

    + +

    + +
    + + +

    \n

    ", $errors->get_error_messages() ); ?>

    + + +
    + +

    + + + + + +

    + +
    > + + + + +

    + + +

    + +

    + + + + + + + + + 1 && has_action('admin_color_scheme_picker') ) : ?> + + + + + + + + + + + + + + + +
    More information'); ?>
    +
    +
    +
    + + +

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + +
    +user_email != get_site_option( 'admin_email' ) ) : ?> +

    + +

    + +
    + +
    + +

    + + + + + + + + + + + + + $desc) { +?> + + + + + +
    + ID . '_new_email' ); + if ( $new_email && $new_email != $current_user->user_email ) : ?> +
    +

    %1$s. Cancel'), $new_email['newemail'], esc_url( self_admin_url( 'profile.php?dismiss=' . $current_user->ID . '_new_email' ) ) ); ?>

    +
    + +
    + +

    + + + + + + + + + + + + + +

    +

    +
    +
    +

    +
    + + + +caps) > count($profileuser->roles) && apply_filters('additional_capabilities_display', true, $profileuser) ) { ?> +
    + + + + + +
    caps as $cap => $value ) { + if ( !$wp_roles->is_role($cap) ) { + if ( $output != '' ) + $output .= ', '; + $output .= $value ? $cap : "Denied: {$cap}"; + } + } + echo $output; + ?>
    + + + + + + + +
    +
    + + + diff --git a/src/wp-admin/user-new.php b/src/wp-admin/user-new.php new file mode 100644 index 0000000..cef46a3 --- /dev/null +++ b/src/wp-admin/user-new.php @@ -0,0 +1,350 @@ + 'enter_email'), 'user-new.php' ) ); + die(); + } + } + + if ( !$user_details ) { + wp_redirect( add_query_arg( array('update' => 'does_not_exist'), 'user-new.php' ) ); + die(); + } + + if ( ! current_user_can('promote_user', $user_details->ID) ) + wp_die(__('Cheatin’ uh?')); + + // Adding an existing user to this blog + $new_user_email = esc_html(trim($_REQUEST['email'])); + $redirect = 'user-new.php'; + $username = $user_details->user_login; + $user_id = $user_details->ID; + if ( ( $username != null && !is_super_admin( $user_id ) ) && ( array_key_exists($blog_id, get_blogs_of_user($user_id)) ) ) { + $redirect = add_query_arg( array('update' => 'addexisting'), 'user-new.php' ); + } else { + if ( isset( $_POST[ 'noconfirmation' ] ) && is_super_admin() ) { + add_existing_user_to_blog( array( 'user_id' => $user_id, 'role' => $_REQUEST[ 'role' ] ) ); + $redirect = add_query_arg( array('update' => 'addnoconfirmation'), 'user-new.php' ); + } else { + $newuser_key = substr( md5( $user_id ), 0, 5 ); + add_option( 'new_user_' . $newuser_key, array( 'user_id' => $user_id, 'email' => $user_details->user_email, 'role' => $_REQUEST[ 'role' ] ) ); + $message = __("Hi,\n\nYou have been invited to join '%s' at\n%s as a %s.\nPlease click the following link to confirm the invite:\n%s\n"); + wp_mail( $new_user_email, sprintf( __( '[%s] Joining confirmation' ), get_option( 'blogname' ) ), sprintf($message, get_option('blogname'), site_url(), $_REQUEST[ 'role' ], site_url("/newbloguser/$newuser_key/"))); + $redirect = add_query_arg( array('update' => 'add'), 'user-new.php' ); + } + } + wp_redirect( $redirect ); + die(); +} elseif ( isset($_REQUEST['action']) && 'createuser' == $_REQUEST['action'] ) { + check_admin_referer( 'create-user', '_wpnonce_create-user' ); + + if ( ! current_user_can('create_users') ) + wp_die(__('Cheatin’ uh?')); + + if ( !is_multisite() ) { + $user_id = add_user(); + + if ( is_wp_error( $user_id ) ) { + $add_user_errors = $user_id; + } else { + if ( current_user_can('edit_users') ) { + $new_user_login = apply_filters('pre_user_login', sanitize_user(stripslashes($_REQUEST['user_login']), true)); + $redirect = 'users.php?usersearch='. urlencode($new_user_login) . '&update=add' . '#user-' . $user_id; + } else { + $redirect = add_query_arg( 'update', 'add', 'user-new.php' ); + } + wp_redirect( $redirect ); + die(); + } + } else { + // Adding a new user to this blog + $user_details = wpmu_validate_user_signup( $_REQUEST[ 'user_login' ], $_REQUEST[ 'email' ] ); + unset( $user_details[ 'errors' ]->errors[ 'user_email_used' ] ); + if ( is_wp_error( $user_details[ 'errors' ] ) && !empty( $user_details[ 'errors' ]->errors ) ) { + $add_user_errors = $user_details[ 'errors' ]; + } else { + $new_user_login = apply_filters('pre_user_login', sanitize_user(stripslashes($_REQUEST['user_login']), true)); + if ( isset( $_POST[ 'noconfirmation' ] ) && is_super_admin() ) { + add_filter( 'wpmu_signup_user_notification', '__return_false' ); // Disable confirmation email + } + wpmu_signup_user( $new_user_login, $_REQUEST[ 'email' ], array( 'add_to_blog' => $wpdb->blogid, 'new_role' => $_REQUEST[ 'role' ] ) ); + if ( isset( $_POST[ 'noconfirmation' ] ) && is_super_admin() ) { + $key = $wpdb->get_var( $wpdb->prepare( "SELECT activation_key FROM {$wpdb->signups} WHERE user_login = %s AND user_email = %s", $new_user_login, $_REQUEST[ 'email' ] ) ); + wpmu_activate_signup( $key ); + $redirect = add_query_arg( array('update' => 'addnoconfirmation'), 'user-new.php' ); + } else { + $redirect = add_query_arg( array('update' => 'newuserconfimation'), 'user-new.php' ); + } + wp_redirect( $redirect ); + die(); + } + } +} + + +$title = __('Add New User'); +$parent_file = 'users.php'; + +$do_both = false; +if ( is_multisite() && current_user_can('promote_users') && current_user_can('create_users') ) + $do_both = true; + +add_contextual_help($current_screen, + '

    ' . __('To add a new user to your site, fill in the form on this screen. If you’re not sure which role to assign, you can use the link below to review the different roles and their capabilities. Here is a basic overview of roles:') . '

    ' . + '
      ' . + '
    • ' . __('Administrators have access to all the administration features.') . '
    • ' . + '
    • ' . __('Editors can publish posts, manage posts as well as manage other people’s posts, etc.') . '
    • ' . + '
    • ' . __('Authors can publish and manage their own posts.') . '
    • ' . + '
    • ' . __('Contributors can write and manage their posts but not publish posts or upload media files.') . '
    • ' . + '
    • ' . __('Subscribers can read comments/comment/receive newsletters, etc.') . '
    • ' . + '
    ' . + '

    ' . __('You must assign a password to the new user, but don’t worry; when they log in for the first time they will be prompted to change it. The username, however, cannot be changed.') . '

    ' . + '

    ' . __('New users will receive an email letting them know they’ve been added as a user for your site. By default, this email will also contain their password. Uncheck the box if you don’t want the password to be included in the welcome email.') . '

    ' . + '

    ' . __('Remember to click the Add User button at the bottom of this screen when you are finished.') . '

    ' . + '

    ' . __('For more information:') . '

    ' . + '

    ' . __('Documentation on Adding New Users') . '

    ' . + '

    ' . __('Support Forums') . '

    ' +); + +wp_enqueue_script('wp-ajax-response'); +wp_enqueue_script('user-profile'); + +require_once ('admin-header.php'); + +if ( isset($_GET['update']) ) { + $messages = array(); + if ( is_multisite() ) { + switch ( $_GET['update'] ) { + case "newuserconfimation": + $messages[] = __('Invitation email sent to new user. A confirmation link must be clicked before their account is created.'); + break; + case "add": + $messages[] = __('Invitation email sent to user. A confirmation link must be clicked for them to be added to your site.'); + break; + case "addnoconfirmation": + $messages[] = __('User has been added to your site.'); + break; + case "addexisting": + $messages[] = __('That user is already a member of this site.'); + break; + case "does_not_exist": + $messages[] = __('The requested user does not exist.'); + break; + case "does_not_exist": + $messages[] = __('Please enter a valid email address.'); + break; + } + } else { + if ( 'add' == $_GET['update'] ) + $messages[] = __('User added.'); + } +} +?> +
    + +

    +

    + + +
    +
      + get_error_messages() as $err ) + echo "
    • $err
    • \n"; + ?> +
    +
    +

    ' . $msg . '

    '; +} ?> + + +
    + get_error_messages() as $message ) + echo "

    $message

    "; + ?> +
    + +
    + +' . __('Add Existing User') . ''; + if ( !is_super_admin() ) { + _e( 'Enter the email address of an existing user on this network to invite them to this site. That person will be sent an email asking them to confirm the invite.' ); + $label = __('E-mail'); + } else { + _e( 'Enter the email address or username of an existing user on this network to invite them to this site. That person will be sent an email asking them to confirm the invite.' ); + $label = __('E-mail or Username'); + } +?> +
    > + + + + + + + + + + + + + + + + + + +
    +
    + 'addusersub' ) ); ?> +
    +' . __( 'Add New User' ) . ''; +?> +

    +
    > + + + 'login', 'first_name' => 'firstname', 'last_name' => 'lastname', + 'email' => 'email', 'url' => 'uri', 'role' => 'role', 'send_password' => 'send_password', 'noconfirmation' => 'ignore_pass' ) as $post_field => $var ) { + $var = "new_user_$var"; + if( isset( $_POST['createuser'] ) ) { + if ( ! isset($$var) ) + $$var = isset( $_POST[$post_field] ) ? stripslashes( $_POST[$post_field] ) : ''; + } else { + $$var = false; + } +} + +?> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + +
    +
    +

    +
    +
    + + 'createusersub' ) ); ?> + +
    + + + diff --git a/src/wp-admin/user/admin.php b/src/wp-admin/user/admin.php new file mode 100644 index 0000000..6aebd88 --- /dev/null +++ b/src/wp-admin/user/admin.php @@ -0,0 +1,27 @@ +domain != $current_site->domain ) || ( $current_blog->path != $current_site->path ) ); +$redirect_user_admin_request = apply_filters( 'redirect_user_admin_request', $redirect_user_admin_request ); +if ( $redirect_user_admin_request ) { + wp_redirect( user_admin_url() ); + exit; +} +unset( $redirect_user_admin_request ); + +?> diff --git a/src/wp-admin/user/index-extra.php b/src/wp-admin/user/index-extra.php new file mode 100644 index 0000000..4881263 --- /dev/null +++ b/src/wp-admin/user/index-extra.php @@ -0,0 +1,12 @@ + \ No newline at end of file diff --git a/src/wp-admin/user/profile.php b/src/wp-admin/user/profile.php new file mode 100644 index 0000000..b55ba1c --- /dev/null +++ b/src/wp-admin/user/profile.php @@ -0,0 +1,12 @@ +get_pagenum(); +$title = __('Users'); +$parent_file = 'users.php'; + +add_screen_option( 'per_page', array('label' => _x( 'Users', 'users per page (screen options)' )) ); + +// contextual help - choose Help on the top right of admin panel to preview this. +add_contextual_help($current_screen, + '

    ' . __('This screen lists all the existing users for your site. Each user has one of five defined roles as set by the site admin: Site Administrator, Editor, Author, Contributor, or Subscriber. Users with roles other than Administrator will see fewer options in the dashboard navigation when they are logged in, based on their role.') . '

    ' . + '

    ' . __('You can customize the display of information on this screen as you can on other screens, by using the Screen Options tab and the on-screen filters.') . '

    ' . + '

    ' . __('To add a new user for your site, click the Add New button at the top of the screen or Add New in the Users menu section.') . '

    ' . + '

    ' . __('For more information:') . '

    ' . + '

    ' . __('Documentation on Managing Users') . '

    ' . + '

    ' . __('Descriptions of Roles and Capabilities') . '

    ' . + '

    ' . __('Support Forums') . '

    ' +); + +if ( empty($_REQUEST) ) { + $referer = ''; +} elseif ( isset($_REQUEST['wp_http_referer']) ) { + $redirect = remove_query_arg(array('wp_http_referer', 'updated', 'delete_count'), stripslashes($_REQUEST['wp_http_referer'])); + $referer = ''; +} else { + $redirect = 'users.php'; + $referer = ''; +} + +$update = ''; + +switch ( $wp_list_table->current_action() ) { + +/* Bulk Dropdown menu Role changes */ +case 'promote': + check_admin_referer('bulk-users'); + + if ( ! current_user_can( 'promote_users' ) ) + wp_die( __( 'You can’t edit that user.' ) ); + + if ( empty($_REQUEST['users']) ) { + wp_redirect($redirect); + exit(); + } + + $editable_roles = get_editable_roles(); + if ( empty( $editable_roles[$_REQUEST['new_role']] ) ) + wp_die(__('You can’t give users that role.')); + + $userids = $_REQUEST['users']; + $update = 'promote'; + foreach ( $userids as $id ) { + $id = (int) $id; + + if ( ! current_user_can('promote_user', $id) ) + wp_die(__('You can’t edit that user.')); + // The new role of the current user must also have promote_users caps + if ( $id == $current_user->ID && !$wp_roles->role_objects[$_REQUEST['new_role']]->has_cap('promote_users') ) { + $update = 'err_admin_role'; + continue; + } + + // If the user doesn't already belong to the blog, bail. + if ( is_multisite() && !is_user_member_of_blog( $id ) ) + wp_die(__('Cheatin’ uh?')); + + $user = new WP_User($id); + $user->set_role($_REQUEST['new_role']); + } + + wp_redirect(add_query_arg('update', $update, $redirect)); + exit(); + +break; + +case 'dodelete': + if ( is_multisite() ) + wp_die( __('User deletion is not allowed from this screen.') ); + + check_admin_referer('delete-users'); + + if ( empty($_REQUEST['users']) ) { + wp_redirect($redirect); + exit(); + } + + if ( ! current_user_can( 'delete_users' ) ) + wp_die(__('You can’t delete users.')); + + $userids = $_REQUEST['users']; + $update = 'del'; + $delete_count = 0; + + foreach ( (array) $userids as $id) { + $id = (int) $id; + + if ( ! current_user_can( 'delete_user', $id ) ) + wp_die(__( 'You can’t delete that user.' ) ); + + if ( $id == $current_user->ID ) { + $update = 'err_admin_del'; + continue; + } + switch ( $_REQUEST['delete_option'] ) { + case 'delete': + if ( current_user_can('delete_user', $id) ) + wp_delete_user($id); + break; + case 'reassign': + if ( current_user_can('delete_user', $id) ) + wp_delete_user($id, $_REQUEST['reassign_user']); + break; + } + ++$delete_count; + } + + $redirect = add_query_arg( array('delete_count' => $delete_count, 'update' => $update), $redirect); + wp_redirect($redirect); + exit(); + +break; + +case 'delete': + if ( is_multisite() ) + wp_die( __('User deletion is not allowed from this screen.') ); + + check_admin_referer('bulk-users'); + + if ( empty($_REQUEST['users']) && empty($_REQUEST['user']) ) { + wp_redirect($redirect); + exit(); + } + + if ( ! current_user_can( 'delete_users' ) ) + $errors = new WP_Error( 'edit_users', __( 'You can’t delete users.' ) ); + + if ( empty($_REQUEST['users']) ) + $userids = array(intval($_REQUEST['user'])); + else + $userids = (array) $_REQUEST['users']; + + include ('admin-header.php'); +?> +
    + + + +
    + +

    +

    +
      +ID ) { + echo "
    • " . sprintf(__('ID #%1s: %2s The current user will not be deleted.'), $id, $user->user_login) . "
    • \n"; + } else { + echo "
    • " . sprintf(__('ID #%1s: %2s'), $id, $user->user_login) . "
    • \n"; + $go_delete++; + } + } + ?> +
    + +

    +
      +
    • +
    • + '.__('Attribute all posts and links to:').''; + wp_dropdown_users( array( 'name' => 'reassign_user', 'exclude' => array_diff( $userids, array($current_user->ID) ) ) ); ?>
    • +
    + + + +

    + +
    +
    +id && !is_super_admin() ) { + $update = 'err_admin_remove'; + continue; + } + if ( !current_user_can('remove_user', $id) ) { + $update = 'err_admin_remove'; + continue; + } + remove_user_from_blog($id, $blog_id); + } + + $redirect = add_query_arg( array('update' => $update), $redirect); + wp_redirect($redirect); + exit; + +break; + +case 'remove': + + check_admin_referer('bulk-users'); + + if ( ! is_multisite() ) + wp_die( __( 'You can’t remove users.' ) ); + + if ( empty($_REQUEST['users']) && empty($_REQUEST['user']) ) { + wp_redirect($redirect); + exit(); + } + + if ( !current_user_can('remove_users') ) + $error = new WP_Error('edit_users', __('You can’t remove users.')); + + if ( empty($_REQUEST['users']) ) + $userids = array(intval($_REQUEST['user'])); + else + $userids = $_REQUEST['users']; + + include ('admin-header.php'); +?> +
    + + + +
    + +

    +

    +
      +id && !is_super_admin() ) { + echo "
    • " . sprintf(__('ID #%1s: %2s The current user will not be removed.'), $id, $user->user_login) . "
    • \n"; + } elseif ( !current_user_can('remove_user', $id) ) { + echo "
    • " . sprintf(__('ID #%1s: %2s You don\'t have permission to remove this user.'), $id, $user->user_login) . "
    • \n"; + } else { + echo "
    • " . sprintf(__('ID #%1s: %2s'), $id, $user->user_login) . "
    • \n"; + $go_remove = true; + } + } + ?> + + + + +

      + +
    +
    +prepare_items(); + $total_pages = $wp_list_table->get_pagination_arg( 'total_pages' ); + if ( $pagenum > $total_pages && $total_pages > 0 ) { + wp_redirect( add_query_arg( 'paged', $total_pages ) ); + exit; + } + include('./admin-header.php'); + + $messages = array(); + if ( isset($_GET['update']) ) : + switch($_GET['update']) { + case 'del': + case 'del_many': + $delete_count = isset($_GET['delete_count']) ? (int) $_GET['delete_count'] : 0; + $messages[] = '

    ' . sprintf(_n('%s user deleted', '%s users deleted', $delete_count), $delete_count) . '

    '; + break; + case 'add': + $messages[] = '

    ' . __('New user created.') . '

    '; + break; + case 'promote': + $messages[] = '

    ' . __('Changed roles.') . '

    '; + break; + case 'err_admin_role': + $messages[] = '

    ' . __('The current user’s role must have user editing capabilities.') . '

    '; + $messages[] = '

    ' . __('Other user roles have been changed.') . '

    '; + break; + case 'err_admin_del': + $messages[] = '

    ' . __('You can’t delete the current user.') . '

    '; + $messages[] = '

    ' . __('Other users have been deleted.') . '

    '; + break; + case 'remove': + $messages[] = '

    ' . __('User removed from this site.') . '

    '; + break; + case 'err_admin_remove': + $messages[] = '

    ' . __("You can't remove the current user.") . '

    '; + $messages[] = '

    ' . __('Other users have been removed.') . '

    '; + break; + } + endif; ?> + + +
    +
      + get_error_messages() as $err ) + echo "
    • $err
    • \n"; + ?> +
    +
    + + +
    + +

    + + + + +' . __('Search results for “%s”') . '', esc_html( $usersearch ) ); ?> +

    + +views(); ?> + +
    + +search_box( __( 'Search Users' ), 'user' ); ?> + +display(); ?> +
    + +
    +
    +' . __('Widgets are independent sections of content that can be placed into any widgetized area provided by your theme (commonly called sidebars). To populate your sidebars/widget areas with individual widgets, drag and drop the title bars into the desired area. By default, only the first widget area is expanded. To populate additional widget areas, click on their title bars to expand them.') . '

    +

    ' . __('The Available Widgets section contains all the widgets you can choose from. Once you drag a widget into a sidebar, it will open to allow you to configure its settings. When you are happy with the widget settings, click the Save button and the widget will go live on your site. If you click Delete, it will remove the widget.') . '

    +

    ' . __('If you want to remove the widget but save its setting for possible future use, just drag it into the Inactive Widgets area. You can add them back anytime from there. This is especially helpful when you switch to a theme with fewer or different widget areas.') . '

    +

    ' . __('Widgets may be used multiple times. You can give each widget a title, to display on your site, but it’s not required.') . '

    +

    ' . __('Enabling Accessibility Mode, via Screen Options, allows you to use Add and Edit buttons instead of using drag and drop.') . '

    +

    ' . __('Many themes show some sidebar widgets by default until you edit your sidebars, but they are not automatically displayed in your sidebar management tool. After you make your first widget change, you can re-add the default widgets by adding them from the Available Widgets area.') . '

    +'; +$help .= '

    ' . __('For more information:') . '

    '; +$help .= '

    ' . __('Documentation on Widgets') . '

    '; +$help .= '

    ' . __('Support Forums') . '

    '; +add_contextual_help($current_screen, $help); + +// register the inactive_widgets area as sidebar +register_sidebar(array( + 'name' => __('Inactive Widgets'), + 'id' => 'wp_inactive_widgets', + 'description' => '', + 'before_widget' => '', + 'after_widget' => '', + 'before_title' => '', + 'after_title' => '', +)); + +// These are the widgets grouped by sidebar +$sidebars_widgets = wp_get_sidebars_widgets(); +if ( empty( $sidebars_widgets ) ) + $sidebars_widgets = wp_get_widget_defaults(); + +// look for "lost" widgets, this has to run at least on each theme change +function retrieve_widgets() { + global $wp_registered_widget_updates, $wp_registered_sidebars, $sidebars_widgets, $wp_registered_widgets; + + $_sidebars_widgets = array(); + $sidebars = array_keys($wp_registered_sidebars); + + unset( $sidebars_widgets['array_version'] ); + + $old = array_keys($sidebars_widgets); + sort($old); + sort($sidebars); + + if ( $old == $sidebars ) + return; + + // 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]); + } + } + + // if new theme has less sidebars than the old theme + if ( !empty($sidebars_widgets) ) { + foreach ( $sidebars_widgets as $lost => $val ) { + if ( is_array($val) ) + $_sidebars_widgets['wp_inactive_widgets'] = array_merge( (array) $_sidebars_widgets['wp_inactive_widgets'], $val ); + } + } + + // discard invalid, theme-specific widgets from sidebars + $shown_widgets = array(); + foreach ( $_sidebars_widgets as $sidebar => $widgets ) { + if ( !is_array($widgets) ) + continue; + + $_widgets = array(); + foreach ( $widgets as $widget ) { + if ( isset($wp_registered_widgets[$widget]) ) + $_widgets[] = $widget; + } + $_sidebars_widgets[$sidebar] = $_widgets; + $shown_widgets = array_merge($shown_widgets, $_widgets); + } + + $sidebars_widgets = $_sidebars_widgets; + unset($_sidebars_widgets, $_widgets); + + // find hidden/lost multi-widget instances + $lost_widgets = array(); + foreach ( $wp_registered_widgets as $key => $val ) { + if ( in_array($key, $shown_widgets, true) ) + continue; + + $number = preg_replace('/.+?-([0-9]+)$/', '$1', $key); + + if ( 2 > (int) $number ) + continue; + + $lost_widgets[] = $key; + } + + $sidebars_widgets['wp_inactive_widgets'] = array_merge($lost_widgets, (array) $sidebars_widgets['wp_inactive_widgets']); + wp_set_sidebars_widgets($sidebars_widgets); +} +retrieve_widgets(); + +if ( count($wp_registered_sidebars) == 1 ) { + // If only "wp_inactive_widgets" is defined the theme has no sidebars, die. + require_once( './admin-header.php' ); +?> + +
    + +

    +
    +

    +
    +

    follow these instructions.' ); ?>

    +
    + + $val ) { + if ( is_array($val) && preg_match('/__i__|%i%/', key($val)) ) { + $_POST[$key] = array( $number => array_shift($val) ); + break; + } + } + } + + $sidebar_id = $_POST['sidebar']; + $position = isset($_POST[$sidebar_id . '_position']) ? (int) $_POST[$sidebar_id . '_position'] - 1 : 0; + + $id_base = $_POST['id_base']; + $sidebar = isset($sidebars_widgets[$sidebar_id]) ? $sidebars_widgets[$sidebar_id] : array(); + + // delete + if ( isset($_POST['removewidget']) && $_POST['removewidget'] ) { + + if ( !in_array($widget_id, $sidebar, true) ) { + wp_redirect( admin_url('widgets.php?error=0') ); + exit; + } + + $sidebar = array_diff( $sidebar, array($widget_id) ); + $_POST = array('sidebar' => $sidebar_id, 'widget-' . $id_base => array(), 'the-widget-id' => $widget_id, 'delete_widget' => '1'); + } + + $_POST['widget-id'] = $sidebar; + + foreach ( (array) $wp_registered_widget_updates as $name => $control ) { + if ( $name != $id_base || !is_callable($control['callback']) ) + continue; + + ob_start(); + call_user_func_array( $control['callback'], $control['params'] ); + ob_end_clean(); + + break; + } + + $sidebars_widgets[$sidebar_id] = $sidebar; + + // remove old position + if ( !isset($_POST['delete_widget']) ) { + foreach ( $sidebars_widgets as $key => $sb ) { + if ( is_array($sb) ) + $sidebars_widgets[$key] = array_diff( $sb, array($widget_id) ); + } + array_splice( $sidebars_widgets[$sidebar_id], $position, 0, $widget_id ); + } + + wp_set_sidebars_widgets($sidebars_widgets); + wp_redirect( admin_url('widgets.php?message=0') ); + exit; +} + +// Output the widget form without js +if ( isset($_GET['editwidget']) && $_GET['editwidget'] ) { + $widget_id = $_GET['editwidget']; + + if ( isset($_GET['addnew']) ) { + // Default to the first sidebar + $sidebar = array_shift( $keys = array_keys($wp_registered_sidebars) ); + + if ( isset($_GET['base']) && isset($_GET['num']) ) { // multi-widget + // Copy minimal info from an existing instance of this widget to a new instance + foreach ( $wp_registered_widget_controls as $control ) { + if ( $_GET['base'] === $control['id_base'] ) { + $control_callback = $control['callback']; + $multi_number = (int) $_GET['num']; + $control['params'][0]['number'] = -1; + $widget_id = $control['id'] = $control['id_base'] . '-' . $multi_number; + $wp_registered_widget_controls[$control['id']] = $control; + break; + } + } + } + } + + if ( isset($wp_registered_widget_controls[$widget_id]) && !isset($control) ) { + $control = $wp_registered_widget_controls[$widget_id]; + $control_callback = $control['callback']; + } elseif ( !isset($wp_registered_widget_controls[$widget_id]) && isset($wp_registered_widgets[$widget_id]) ) { + $name = esc_html( strip_tags($wp_registered_widgets[$widget_id]['name']) ); + } + + if ( !isset($name) ) + $name = esc_html( strip_tags($control['name']) ); + + if ( !isset($sidebar) ) + $sidebar = isset($_GET['sidebar']) ? $_GET['sidebar'] : 'wp_inactive_widgets'; + + if ( !isset($multi_number) ) + $multi_number = isset($control['params'][0]['number']) ? $control['params'][0]['number'] : ''; + + $id_base = isset($control['id_base']) ? $control['id_base'] : $control['id']; + + // show the widget form + $width = ' style="width:' . max($control['width'], 350) . 'px"'; + $key = isset($_GET['key']) ? (int) $_GET['key'] : 0; + + require_once( './admin-header.php' ); ?> +
    + +

    +
    > +

    + +
    +
    +' . __('There are no options for this widget.') . "

    \n"; ?> +
    + +

    +
    + + $sbvalue ) { + echo "\t\t\n"; + } ?> +
    "; + if ( 'wp_inactive_widgets' == $sbname ) { + echo ' '; + } else { + if ( !isset($sidebars_widgets[$sbname]) || !is_array($sidebars_widgets[$sbname]) ) { + $j = 1; + $sidebars_widgets[$sbname] = array(); + } else { + $j = count($sidebars_widgets[$sbname]); + if ( isset($_GET['addnew']) || !in_array($widget_id, $sidebars_widgets[$sbname], true) ) + $j++; + } + $selected = ''; + echo "\t\t\n"; + } + echo "
    +
    + +
    + + + + + + + +
    +
    +
    +
    +
    + + +
    + +

    + + +

    + + +

    + + + + +
    +
    +
    + +
    +

    +
    + +
    +
    +
    +
    +
    + +
    + +
    +

    + +
    +
    +
    +
    +
    + +
    +
    + $registered_sidebar ) { + if ( 'wp_inactive_widgets' == $sidebar ) + continue; + $closed = $i ? ' closed' : ''; ?> +
    + + +
    + +
    +
    +
    + +
    +
    +
    + +script_name = array_pop( explode( '/', $_SERVER['SCRIPT_NAME'] ) ); + $this->app_base = site_url( $this->script_name . '/' ); + + $this->selectors = array( + '@/service$@' => + array('GET' => 'get_service'), + '@/categories$@' => + array('GET' => 'get_categories_xml'), + '@/post/(\d+)$@' => + array('GET' => 'get_post', + 'PUT' => 'put_post', + 'DELETE' => 'delete_post'), + '@/posts/?(\d+)?$@' => + array('GET' => 'get_posts', + 'POST' => 'create_post'), + '@/attachments/?(\d+)?$@' => + array('GET' => 'get_attachment', + 'POST' => 'create_attachment'), + '@/attachment/file/(\d+)$@' => + array('GET' => 'get_file', + 'PUT' => 'put_file', + 'DELETE' => 'delete_file'), + '@/attachment/(\d+)$@' => + array('GET' => 'get_attachment', + 'PUT' => 'put_attachment', + 'DELETE' => 'delete_attachment'), + ); + } + + /** + * Handle ATOMPUB request. + * + * @since 2.2.0 + */ + function handle_request() { + global $always_authenticate; + + if ( !empty( $_SERVER['ORIG_PATH_INFO'] ) ) + $path = $_SERVER['ORIG_PATH_INFO']; + else + $path = $_SERVER['PATH_INFO']; + + $method = $_SERVER['REQUEST_METHOD']; + + log_app('REQUEST',"$method $path\n================"); + + $this->process_conditionals(); + //$this->process_conditionals(); + + // exception case for HEAD (treat exactly as GET, but don't output) + if ($method == 'HEAD') { + $this->do_output = false; + $method = 'GET'; + } + + // redirect to /service in case no path is found. + if (strlen($path) == 0 || $path == '/') + $this->redirect($this->get_service_url()); + + // check to see if AtomPub is enabled + if ( !get_option( 'enable_app' ) ) + $this->forbidden( sprintf( __( 'AtomPub services are disabled on this site. An admin user can enable them at %s' ), admin_url('options-writing.php') ) ); + + // dispatch + foreach ( $this->selectors as $regex => $funcs ) { + if ( preg_match($regex, $path, $matches) ) { + if ( isset($funcs[$method]) ) { + + // authenticate regardless of the operation and set the current + // user. each handler will decide if auth is required or not. + if ( !$this->authenticate() ) { + if ( $always_authenticate ) + $this->auth_required('Credentials required.'); + } + + array_shift($matches); + call_user_func_array(array(&$this,$funcs[$method]), $matches); + exit(); + } else { + // only allow what we have handlers for... + $this->not_allowed(array_keys($funcs)); + } + } + } + + // oops, nothing found + $this->not_found(); + } + + /** + * Retrieve XML for ATOMPUB service. + * + * @since 2.2.0 + */ + function get_service() { + log_app('function','get_service()'); + + if ( !current_user_can( 'edit_posts' ) ) + $this->auth_required( __( 'Sorry, you do not have the right to access this site.' ) ); + + $entries_url = esc_attr($this->get_entries_url()); + $categories_url = esc_attr($this->get_categories_url()); + $media_url = esc_attr($this->get_attachments_url()); + $accepted_media_types = ''; + foreach ($this->media_content_types as $med) { + $accepted_media_types = $accepted_media_types . "" . $med . ""; + } + $atom_prefix="atom"; + $atom_blogname = get_bloginfo('name'); + $service_doc = << + + <$atom_prefix:title>$atom_blogname Workspace + + <$atom_prefix:title>$atom_blogname Posts + $this->ATOM_CONTENT_TYPE;type=entry + + + + <$atom_prefix:title>$atom_blogname Media + $accepted_media_types + + + + +EOD; + + $this->output($service_doc, $this->SERVICE_CONTENT_TYPE); + } + + /** + * Retrieve categories list in XML format. + * + * @since 2.2.0 + */ + function get_categories_xml() { + log_app('function','get_categories_xml()'); + + if ( !current_user_can( 'edit_posts' ) ) + $this->auth_required( __( 'Sorry, you do not have the right to access this site.' ) ); + + $home = esc_attr(get_bloginfo_rss('url')); + + $categories = ""; + $cats = get_categories(array('hierarchical' => 0, 'hide_empty' => 0)); + foreach ( (array) $cats as $cat ) { + $categories .= " name) . "\" />\n"; + } + $output = << + $categories + +EOD; + $this->output($output, $this->CATEGORIES_CONTENT_TYPE); + } + + /** + * Create new post. + * + * @since 2.2.0 + */ + function create_post() { + global $user_ID; + $this->get_accepted_content_type($this->atom_content_types); + + $parser = new AtomParser(); + if ( !$parser->parse() ) + $this->client_error(); + + $entry = array_pop($parser->feed->entries); + + log_app('Received entry:', print_r($entry,true)); + + $catnames = array(); + foreach ( $entry->categories as $cat ) { + array_push($catnames, $cat["term"]); + } + + $wp_cats = get_categories(array('hide_empty' => false)); + + $post_category = array(); + + foreach ( $wp_cats as $cat ) { + if ( in_array($cat->name, $catnames) ) + array_push($post_category, $cat->term_id); + } + + $publish = ! ( isset( $entry->draft ) && 'yes' == trim( $entry->draft ) ); + + $cap = ($publish) ? 'publish_posts' : 'edit_posts'; + + if ( !current_user_can($cap) ) + $this->auth_required(__('Sorry, you do not have the right to edit/publish new posts.')); + + $blog_ID = get_current_blog_id(); + $post_status = ($publish) ? 'publish' : 'draft'; + $post_author = (int) $user_ID; + $post_title = $entry->title[1]; + $post_content = $entry->content[1]; + $post_excerpt = $entry->summary[1]; + $pubtimes = $this->get_publish_time($entry->published); + $post_date = $pubtimes[0]; + $post_date_gmt = $pubtimes[1]; + + if ( isset( $_SERVER['HTTP_SLUG'] ) ) + $post_name = $_SERVER['HTTP_SLUG']; + + $post_data = compact('blog_ID', 'post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_title', 'post_category', 'post_status', 'post_excerpt', 'post_name'); + + $this->escape($post_data); + log_app('Inserting Post. Data:', print_r($post_data,true)); + + $postID = wp_insert_post($post_data); + if ( is_wp_error( $postID ) ) + $this->internal_error($postID->get_error_message()); + + if ( !$postID ) + $this->internal_error(__('Sorry, your entry could not be posted. Something wrong happened.')); + + // getting warning here about unable to set headers + // because something in the cache is printing to the buffer + // could we clean up wp_set_post_categories or cache to not print + // this could affect our ability to send back the right headers + @wp_set_post_categories($postID, $post_category); + + do_action( 'atompub_create_post', $postID, $entry ); + + $output = $this->get_entry($postID); + + log_app('function',"create_post($postID)"); + $this->created($postID, $output); + } + + /** + * Retrieve post. + * + * @since 2.2.0 + * + * @param int $postID Post ID. + */ + function get_post($postID) { + global $entry; + + if ( !current_user_can( 'edit_post', $postID ) ) + $this->auth_required( __( 'Sorry, you do not have the right to access this post.' ) ); + + $this->set_current_entry($postID); + $output = $this->get_entry($postID); + log_app('function',"get_post($postID)"); + $this->output($output); + + } + + /** + * Update post. + * + * @since 2.2.0 + * + * @param int $postID Post ID. + */ + function put_post($postID) { + // checked for valid content-types (atom+xml) + // quick check and exit + $this->get_accepted_content_type($this->atom_content_types); + + $parser = new AtomParser(); + if ( !$parser->parse() ) + $this->bad_request(); + + $parsed = array_pop($parser->feed->entries); + + log_app('Received UPDATED entry:', print_r($parsed,true)); + + // check for not found + global $entry; + $this->set_current_entry($postID); + + if ( !current_user_can('edit_post', $entry['ID']) ) + $this->auth_required(__('Sorry, you do not have the right to edit this post.')); + + $publish = ! ( isset($parsed->draft) && 'yes' == trim($parsed->draft) ); + $post_status = ($publish) ? 'publish' : 'draft'; + + extract($entry); + + $post_title = $parsed->title[1]; + $post_content = $parsed->content[1]; + $post_excerpt = $parsed->summary[1]; + $pubtimes = $this->get_publish_time($entry->published); + $post_date = $pubtimes[0]; + $post_date_gmt = $pubtimes[1]; + $pubtimes = $this->get_publish_time($parsed->updated); + $post_modified = $pubtimes[0]; + $post_modified_gmt = $pubtimes[1]; + + $postdata = compact('ID', 'post_content', 'post_title', 'post_category', 'post_status', 'post_excerpt', 'post_date', 'post_date_gmt', 'post_modified', 'post_modified_gmt'); + $this->escape($postdata); + + $result = wp_update_post($postdata); + + if ( !$result ) + $this->internal_error(__('For some strange yet very annoying reason, this post could not be edited.')); + + do_action( 'atompub_put_post', $ID, $parsed ); + + log_app('function',"put_post($postID)"); + $this->ok(); + } + + /** + * Remove post. + * + * @since 2.2.0 + * + * @param int $postID Post ID. + */ + function delete_post($postID) { + + // check for not found + global $entry; + $this->set_current_entry($postID); + + if ( !current_user_can('edit_post', $postID) ) + $this->auth_required(__('Sorry, you do not have the right to delete this post.')); + + if ( $entry['post_type'] == 'attachment' ) { + $this->delete_attachment($postID); + } else { + $result = wp_delete_post($postID); + + if ( !$result ) { + $this->internal_error(__('For some strange yet very annoying reason, this post could not be deleted.')); + } + + log_app('function',"delete_post($postID)"); + $this->ok(); + } + + } + + /** + * Retrieve attachment. + * + * @since 2.2.0 + * + * @param int $postID Optional. Post ID. + */ + function get_attachment($postID = null) { + if ( !current_user_can( 'upload_files' ) ) + $this->auth_required( __( 'Sorry, you do not have permission to upload files.' ) ); + + if ( !isset($postID) ) { + $this->get_attachments(); + } else { + $this->set_current_entry($postID); + $output = $this->get_entry($postID, 'attachment'); + log_app('function',"get_attachment($postID)"); + $this->output($output); + } + } + + /** + * Create new attachment. + * + * @since 2.2.0 + */ + function create_attachment() { + + $type = $this->get_accepted_content_type(); + + if ( !current_user_can('upload_files') ) + $this->auth_required(__('You do not have permission to upload files.')); + + $fp = fopen("php://input", "rb"); + $bits = null; + while ( !feof($fp) ) { + $bits .= fread($fp, 4096); + } + fclose($fp); + + $slug = ''; + if ( isset( $_SERVER['HTTP_SLUG'] ) ) + $slug = $_SERVER['HTTP_SLUG']; + elseif ( isset( $_SERVER['HTTP_TITLE'] ) ) + $slug = $_SERVER['HTTP_TITLE']; + elseif ( empty( $slug ) ) // just make a random name + $slug = substr( md5( uniqid( microtime() ) ), 0, 7); + $ext = preg_replace( '|.*/([a-z0-9]+)|', '$1', $_SERVER['CONTENT_TYPE'] ); + $slug = sanitize_file_name( "$slug.$ext" ); + $file = wp_upload_bits( $slug, NULL, $bits); + + log_app('wp_upload_bits returns:',print_r($file,true)); + + $url = $file['url']; + $file = $file['file']; + + do_action('wp_create_file_in_uploads', $file); // replicate + + // Construct the attachment array + $attachment = array( + 'post_title' => $slug, + 'post_content' => $slug, + 'post_status' => 'attachment', + 'post_parent' => 0, + 'post_mime_type' => $type, + 'guid' => $url + ); + + // Save the data + $postID = wp_insert_attachment($attachment, $file); + + if (!$postID) + $this->internal_error(__('Sorry, your entry could not be posted. Something wrong happened.')); + + $output = $this->get_entry($postID, 'attachment'); + + $this->created($postID, $output, 'attachment'); + log_app('function',"create_attachment($postID)"); + } + + /** + * Update attachment. + * + * @since 2.2.0 + * + * @param int $postID Post ID. + */ + function put_attachment($postID) { + // checked for valid content-types (atom+xml) + // quick check and exit + $this->get_accepted_content_type($this->atom_content_types); + + $parser = new AtomParser(); + if (!$parser->parse()) { + $this->bad_request(); + } + + $parsed = array_pop($parser->feed->entries); + + // check for not found + global $entry; + $this->set_current_entry($postID); + + if ( !current_user_can('edit_post', $entry['ID']) ) + $this->auth_required(__('Sorry, you do not have the right to edit this post.')); + + extract($entry); + + $post_title = $parsed->title[1]; + $post_content = $parsed->summary[1]; + $pubtimes = $this->get_publish_time($parsed->updated); + $post_modified = $pubtimes[0]; + $post_modified_gmt = $pubtimes[1]; + + $postdata = compact('ID', 'post_content', 'post_title', 'post_category', 'post_status', 'post_excerpt', 'post_modified', 'post_modified_gmt'); + $this->escape($postdata); + + $result = wp_update_post($postdata); + + if ( !$result ) + $this->internal_error(__('For some strange yet very annoying reason, this post could not be edited.')); + + log_app('function',"put_attachment($postID)"); + $this->ok(); + } + + /** + * Remove attachment. + * + * @since 2.2.0 + * + * @param int $postID Post ID. + */ + function delete_attachment($postID) { + log_app('function',"delete_attachment($postID). File '$location' deleted."); + + // check for not found + global $entry; + $this->set_current_entry($postID); + + if ( !current_user_can('edit_post', $postID) ) + $this->auth_required(__('Sorry, you do not have the right to delete this post.')); + + $location = get_post_meta($entry['ID'], '_wp_attached_file', true); + $filetype = wp_check_filetype($location); + + if ( !isset($location) || 'attachment' != $entry['post_type'] || empty($filetype['ext']) ) + $this->internal_error(__('Error occurred while accessing post metadata for file location.')); + + // delete file + @unlink($location); + + // delete attachment + $result = wp_delete_post($postID); + + if ( !$result ) + $this->internal_error(__('For some strange yet very annoying reason, this post could not be deleted.')); + + log_app('function',"delete_attachment($postID). File '$location' deleted."); + $this->ok(); + } + + /** + * Retrieve attachment from post. + * + * @since 2.2.0 + * + * @param int $postID Post ID. + */ + function get_file($postID) { + + // check for not found + global $entry; + $this->set_current_entry($postID); + + // then whether user can edit the specific post + if ( !current_user_can('edit_post', $postID) ) + $this->auth_required(__('Sorry, you do not have the right to edit this post.')); + + $location = get_post_meta($entry['ID'], '_wp_attached_file', true); + $location = get_option ('upload_path') . '/' . $location; + $filetype = wp_check_filetype($location); + + if ( !isset($location) || 'attachment' != $entry['post_type'] || empty($filetype['ext']) ) + $this->internal_error(__('Error occurred while accessing post metadata for file location.')); + + status_header('200'); + header('Content-Type: ' . $entry['post_mime_type']); + header('Connection: close'); + + if ( $fp = fopen($location, "rb") ) { + status_header('200'); + header('Content-Type: ' . $entry['post_mime_type']); + header('Connection: close'); + + while ( !feof($fp) ) { + echo fread($fp, 4096); + } + + fclose($fp); + } else { + status_header ('404'); + } + + log_app('function',"get_file($postID)"); + exit; + } + + /** + * Upload file to blog and add attachment to post. + * + * @since 2.2.0 + * + * @param int $postID Post ID. + */ + function put_file($postID) { + + // first check if user can upload + if ( !current_user_can('upload_files') ) + $this->auth_required(__('You do not have permission to upload files.')); + + // check for not found + global $entry; + $this->set_current_entry($postID); + + // then whether user can edit the specific post + if ( !current_user_can('edit_post', $postID) ) + $this->auth_required(__('Sorry, you do not have the right to edit this post.')); + + $upload_dir = wp_upload_dir( ); + $location = get_post_meta($entry['ID'], '_wp_attached_file', true); + $filetype = wp_check_filetype($location); + + $location = "{$upload_dir['basedir']}/{$location}"; + + if (!isset($location) || 'attachment' != $entry['post_type'] || empty($filetype['ext'])) + $this->internal_error(__('Error occurred while accessing post metadata for file location.')); + + $fp = fopen("php://input", "rb"); + $localfp = fopen($location, "w+"); + while ( !feof($fp) ) { + fwrite($localfp,fread($fp, 4096)); + } + fclose($fp); + fclose($localfp); + + $ID = $entry['ID']; + $pubtimes = $this->get_publish_time($entry->published); + $post_date = $pubtimes[0]; + $post_date_gmt = $pubtimes[1]; + $pubtimes = $this->get_publish_time($parsed->updated); + $post_modified = $pubtimes[0]; + $post_modified_gmt = $pubtimes[1]; + + $post_data = compact('ID', 'post_date', 'post_date_gmt', 'post_modified', 'post_modified_gmt'); + $result = wp_update_post($post_data); + + if ( !$result ) + $this->internal_error(__('Sorry, your entry could not be posted. Something wrong happened.')); + + wp_update_attachment_metadata( $postID, wp_generate_attachment_metadata( $postID, $location ) ); + + log_app('function',"put_file($postID)"); + $this->ok(); + } + + /** + * Retrieve entries URL. + * + * @since 2.2.0 + * + * @param int $page Page ID. + * @return string + */ + function get_entries_url($page = null) { + if ( isset($GLOBALS['post_type']) && ( $GLOBALS['post_type'] == 'attachment' ) ) + $path = $this->MEDIA_PATH; + else + $path = $this->ENTRIES_PATH; + $url = $this->app_base . $path; + if ( isset($page) && is_int($page) ) + $url .= "/$page"; + return $url; + } + + /** + * Display entries URL. + * + * @since 2.2.0 + * + * @param int $page Page ID. + */ + function the_entries_url($page = null) { + echo $this->get_entries_url($page); + } + + /** + * Retrieve categories URL. + * + * @since 2.2.0 + * + * @param mixed $deprecated Not used. + * @return string + */ + function get_categories_url($deprecated = '') { + if ( !empty( $deprecated ) ) + _deprecated_argument( __FUNCTION__, '2.5' ); + return $this->app_base . $this->CATEGORIES_PATH; + } + + /** + * Display category URL. + * + * @since 2.2.0 + */ + function the_categories_url() { + echo $this->get_categories_url(); + } + + /** + * Retrieve attachment URL. + * + * @since 2.2.0 + * + * @param int $page Page ID. + * @return string + */ + function get_attachments_url($page = null) { + $url = $this->app_base . $this->MEDIA_PATH; + if (isset($page) && is_int($page)) { + $url .= "/$page"; + } + return $url; + } + + /** + * Display attachment URL. + * + * @since 2.2.0 + * + * @param int $page Page ID. + */ + function the_attachments_url($page = null) { + echo $this->get_attachments_url($page); + } + + /** + * Retrieve service URL. + * + * @since 2.3.0 + * + * @return string + */ + function get_service_url() { + return $this->app_base . $this->SERVICE_PATH; + } + + /** + * Retrieve entry URL. + * + * @since 2.7.0 + * + * @param int $postID Post ID. + * @return string + */ + function get_entry_url($postID = null) { + if (!isset($postID)) { + global $post; + $postID = (int) $post->ID; + } + + $url = $this->app_base . $this->ENTRY_PATH . "/$postID"; + + log_app('function',"get_entry_url() = $url"); + return $url; + } + + /** + * Display entry URL. + * + * @since 2.7.0 + * + * @param int $postID Post ID. + */ + function the_entry_url($postID = null) { + echo $this->get_entry_url($postID); + } + + /** + * Retrieve media URL. + * + * @since 2.2.0 + * + * @param int $postID Post ID. + * @return string + */ + function get_media_url($postID = null) { + if (!isset($postID)) { + global $post; + $postID = (int) $post->ID; + } + + $url = $this->app_base . $this->MEDIA_SINGLE_PATH ."/file/$postID"; + + log_app('function',"get_media_url() = $url"); + return $url; + } + + /** + * Display the media URL. + * + * @since 2.2.0 + * + * @param int $postID Post ID. + */ + function the_media_url($postID = null) { + echo $this->get_media_url($postID); + } + + /** + * Set the current entry to post ID. + * + * @since 2.2.0 + * + * @param int $postID Post ID. + */ + function set_current_entry($postID) { + global $entry; + log_app('function',"set_current_entry($postID)"); + + if (!isset($postID)) { + // $this->bad_request(); + $this->not_found(); + } + + $entry = wp_get_single_post($postID,ARRAY_A); + + if (!isset($entry) || !isset($entry['ID'])) + $this->not_found(); + + return; + } + + /** + * Display posts XML. + * + * @since 2.2.0 + * + * @param int $page Optional. Page ID. + * @param string $post_type Optional, default is 'post'. Post Type. + */ + function get_posts($page = 1, $post_type = 'post') { + log_app('function',"get_posts($page, '$post_type')"); + $feed = $this->get_feed($page, $post_type); + $this->output($feed); + } + + /** + * Display attachment XML. + * + * @since 2.2.0 + * + * @param int $page Page ID. + * @param string $post_type Optional, default is 'attachment'. Post type. + */ + function get_attachments($page = 1, $post_type = 'attachment') { + log_app('function',"get_attachments($page, '$post_type')"); + $GLOBALS['post_type'] = $post_type; + $feed = $this->get_feed($page, $post_type); + $this->output($feed); + } + + /** + * Retrieve feed XML. + * + * @since 2.2.0 + * + * @param int $page Page ID. + * @param string $post_type Optional, default is post. Post type. + * @return string + */ + function get_feed($page = 1, $post_type = 'post') { + global $post, $wp, $wp_query, $posts, $wpdb, $blog_id; + log_app('function',"get_feed($page, '$post_type')"); + ob_start(); + + $this->ENTRY_PATH = $post_type; + + if (!isset($page)) { + $page = 1; + } + $page = (int) $page; + + $count = get_option('posts_per_rss'); + + wp('posts_per_page=' . $count . '&offset=' . ($count * ($page-1) . '&orderby=modified')); + + $post = $GLOBALS['post']; + $posts = $GLOBALS['posts']; + $wp = $GLOBALS['wp']; + $wp_query = $GLOBALS['wp_query']; + $wpdb = $GLOBALS['wpdb']; + $blog_id = (int) $GLOBALS['blog_id']; + log_app('function',"query_posts(# " . print_r($wp_query, true) . "#)"); + + log_app('function',"total_count(# $wp_query->max_num_pages #)"); + $last_page = $wp_query->max_num_pages; + $next_page = (($page + 1) > $last_page) ? NULL : $page + 1; + $prev_page = ($page - 1) < 1 ? NULL : $page - 1; + $last_page = ((int)$last_page == 1 || (int)$last_page == 0) ? NULL : (int) $last_page; + $self_page = $page > 1 ? $page : NULL; +?> > +the_entries_url() ?> + +<?php bloginfo_rss('name') ?> + + + + + + + + + + +Copyright + +echo_entry(); + } + } +?> +ENTRY_PATH = 'attachment'; + $varname = 'attachment_id'; + break; + } + query_posts($varname . '=' . $postID); + if ( have_posts() ) { + while ( have_posts() ) { + the_post(); + $this->echo_entry(); + log_app('$post',print_r($GLOBALS['post'],true)); + $entry = ob_get_contents(); + break; + } + } + ob_end_clean(); + + log_app('get_entry returning:',$entry); + return $entry; + } + + /** + * Display post content XML. + * + * @since 2.3.0 + */ + function echo_entry() { ?> + + ID ); ?> + + <?php echo $content ?> + + + + + post_status == 'draft' ? 'yes' : 'no') ?> + + + + + + + +post_type == 'attachment') { ?> + + + + +post_content ) ) : +list($content_type, $content) = prep_atom_text_construct(get_the_content()); ?> + + + + + + + + + + + + + 302 Found + + +

    Found

    +

    The document has moved here.

    + + + +EOD; + header('HTTP/1.1 302 Moved'); + header('Content-Type: text/html'); + header('Location: ' . $url); + echo $content; + exit; + + } + + /** + * Set 'Client Error' (400) status header. + * + * @since 2.2.0 + */ + function client_error($msg = 'Client Error') { + log_app('Status','400: Client Error'); + header('Content-Type: text/plain'); + status_header('400'); + exit; + } + + /** + * Set created status headers (201). + * + * Sets the 'content-type', 'content-location', and 'location'. + * + * @since 2.2.0 + */ + function created($post_ID, $content, $post_type = 'post') { + log_app('created()::$post_ID',"$post_ID, $post_type"); + $edit = $this->get_entry_url($post_ID); + switch($post_type) { + case 'post': + $ctloc = $this->get_entry_url($post_ID); + break; + case 'attachment': + $edit = $this->app_base . "attachments/$post_ID"; + break; + } + header("Content-Type: $this->ATOM_CONTENT_TYPE"); + if (isset($ctloc)) + header('Content-Location: ' . $ctloc); + header('Location: ' . $edit); + status_header('201'); + echo $content; + exit; + } + + /** + * Set 'Auth Required' (401) headers. + * + * @since 2.2.0 + * + * @param string $msg Status header content and HTML content. + */ + function auth_required($msg) { + log_app('Status','401: Auth Required'); + nocache_headers(); + header('WWW-Authenticate: Basic realm="WordPress Atom Protocol"'); + header("HTTP/1.1 401 $msg"); + header('Status: 401 ' . $msg); + header('Content-Type: text/html'); + $content = << + + + 401 Unauthorized + + +

    401 Unauthorized

    +

    $msg

    + + + +EOD; + echo $content; + exit; + } + + /** + * Display XML and set headers with content type. + * + * @since 2.2.0 + * + * @param string $xml Display feed content. + * @param string $ctype Optional, default is 'atom+xml'. Feed content type. + */ + function output($xml, $ctype = 'application/atom+xml') { + status_header('200'); + $xml = ''."\n".$xml; + header('Connection: close'); + header('Content-Length: '. strlen($xml)); + header('Content-Type: ' . $ctype); + header('Content-Disposition: attachment; filename=atom.xml'); + header('Date: '. date('r')); + if ($this->do_output) + echo $xml; + log_app('function', "output:\n$xml"); + exit; + } + + /** + * Sanitize content for database usage. + * + * @since 2.2.0 + * + * @param array $array Sanitize array and multi-dimension array. + */ + function escape(&$array) { + global $wpdb; + + foreach ($array as $k => $v) { + if (is_array($v)) { + $this->escape($array[$k]); + } else if (is_object($v)) { + //skip + } else { + $array[$k] = $wpdb->escape($v); + } + } + } + + /** + * Access credential through various methods and perform login. + * + * @since 2.2.0 + * + * @return bool + */ + function authenticate() { + log_app("authenticate()",print_r($_ENV, true)); + + // if using mod_rewrite/ENV hack + // http://www.besthostratings.com/articles/http-auth-php-cgi.html + if (isset($_SERVER['HTTP_AUTHORIZATION'])) { + list($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']) = + explode(':', base64_decode(substr($_SERVER['HTTP_AUTHORIZATION'], 6))); + } else if (isset($_SERVER['REDIRECT_REMOTE_USER'])) { + // Workaround for setups that do not forward HTTP_AUTHORIZATION + // See http://trac.wordpress.org/ticket/7361 + list($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']) = + explode(':', base64_decode(substr($_SERVER['REDIRECT_REMOTE_USER'], 6))); + } + + // If Basic Auth is working... + if (isset($_SERVER['PHP_AUTH_USER']) && isset($_SERVER['PHP_AUTH_PW'])) { + log_app("Basic Auth",$_SERVER['PHP_AUTH_USER']); + + $user = wp_authenticate($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']); + if ( $user && !is_wp_error($user) ) { + wp_set_current_user($user->ID); + log_app("authenticate()", $user->user_login); + return true; + } + } + + return false; + } + + /** + * Retrieve accepted content types. + * + * @since 2.2.0 + * + * @param array $types Optional. Content Types. + * @return string + */ + function get_accepted_content_type($types = null) { + + if (!isset($types)) { + $types = $this->media_content_types; + } + + if (!isset($_SERVER['CONTENT_LENGTH']) || !isset($_SERVER['CONTENT_TYPE'])) { + $this->length_required(); + } + + $type = $_SERVER['CONTENT_TYPE']; + list($type,$subtype) = explode('/',$type); + list($subtype) = explode(";",$subtype); // strip MIME parameters + log_app("get_accepted_content_type", "type=$type, subtype=$subtype"); + + foreach($types as $t) { + list($acceptedType,$acceptedSubtype) = explode('/',$t); + if ($acceptedType == '*' || $acceptedType == $type) { + if ($acceptedSubtype == '*' || $acceptedSubtype == $subtype) + return $type . "/" . $subtype; + } + } + + $this->invalid_media(); + } + + /** + * Process conditionals for posts. + * + * @since 2.2.0 + */ + function process_conditionals() { + + if (empty($this->params)) return; + if ($_SERVER['REQUEST_METHOD'] == 'DELETE') return; + + switch($this->params[0]) { + case $this->ENTRY_PATH: + global $post; + $post = wp_get_single_post($this->params[1]); + $wp_last_modified = get_post_modified_time('D, d M Y H:i:s', true); + $post = NULL; + break; + case $this->ENTRIES_PATH: + $wp_last_modified = mysql2date('D, d M Y H:i:s', get_lastpostmodified('GMT'), 0).' GMT'; + break; + default: + return; + } + $wp_etag = md5($wp_last_modified); + @header("Last-Modified: $wp_last_modified"); + @header("ETag: $wp_etag"); + + // Support for Conditional GET + if (isset($_SERVER['HTTP_IF_NONE_MATCH'])) + $client_etag = stripslashes($_SERVER['HTTP_IF_NONE_MATCH']); + else + $client_etag = false; + + $client_last_modified = trim( $_SERVER['HTTP_IF_MODIFIED_SINCE']); + // If string is empty, return 0. If not, attempt to parse into a timestamp + $client_modified_timestamp = $client_last_modified ? strtotime($client_last_modified) : 0; + + // Make a timestamp for our most recent modification... + $wp_modified_timestamp = strtotime($wp_last_modified); + + if ( ($client_last_modified && $client_etag) ? + (($client_modified_timestamp >= $wp_modified_timestamp) && ($client_etag == $wp_etag)) : + (($client_modified_timestamp >= $wp_modified_timestamp) || ($client_etag == $wp_etag)) ) { + status_header( 304 ); + exit; + } + } + + /** + * Convert RFC3339 time string to timestamp. + * + * @since 2.3.0 + * + * @param string $str String to time. + * @return bool|int false if format is incorrect. + */ + function rfc3339_str2time($str) { + + $match = false; + if (!preg_match("/(\d{4}-\d{2}-\d{2})T(\d{2}\:\d{2}\:\d{2})\.?\d{0,3}(Z|[+-]+\d{2}\:\d{2})/", $str, $match)) + return false; + + if ($match[3] == 'Z') + $match[3] = '+0000'; + + return strtotime($match[1] . " " . $match[2] . " " . $match[3]); + } + + /** + * Retrieve published time to display in XML. + * + * @since 2.3.0 + * + * @param string $published Time string. + * @return string + */ + function get_publish_time($published) { + + $pubtime = $this->rfc3339_str2time($published); + + if (!$pubtime) { + return array(current_time('mysql'),current_time('mysql',1)); + } else { + return array(date("Y-m-d H:i:s", $pubtime), gmdate("Y-m-d H:i:s", $pubtime)); + } + } + +} + +/** + * AtomServer + * @var AtomServer + * @global object $server + */ +$server = new AtomServer(); +$server->handle_request(); + +?> diff --git a/src/wp-atom.php b/src/wp-atom.php new file mode 100644 index 0000000..a83ac7d --- /dev/null +++ b/src/wp-atom.php @@ -0,0 +1,12 @@ + diff --git a/src/wp-blog-header.php b/src/wp-blog-header.php new file mode 100644 index 0000000..0f7118f --- /dev/null +++ b/src/wp-blog-header.php @@ -0,0 +1,20 @@ + \ No newline at end of file diff --git a/src/wp-comments-post.php b/src/wp-comments-post.php new file mode 100644 index 0000000..9c17a35 --- /dev/null +++ b/src/wp-comments-post.php @@ -0,0 +1,105 @@ +comment_status) ) { + do_action('comment_id_not_found', $comment_post_ID); + exit; +} + +// get_post_status() will get the parent status for attachments. +$status = get_post_status($post); + +$status_obj = get_post_status_object($status); + +if ( !comments_open($comment_post_ID) ) { + do_action('comment_closed', $comment_post_ID); + wp_die( __('Sorry, comments are closed for this item.') ); +} elseif ( 'trash' == $status ) { + do_action('comment_on_trash', $comment_post_ID); + exit; +} elseif ( !$status_obj->public && !$status_obj->private ) { + do_action('comment_on_draft', $comment_post_ID); + exit; +} elseif ( post_password_required($comment_post_ID) ) { + do_action('comment_on_password_protected', $comment_post_ID); + exit; +} else { + do_action('pre_comment_on_post', $comment_post_ID); +} + +$comment_author = ( isset($_POST['author']) ) ? trim(strip_tags($_POST['author'])) : null; +$comment_author_email = ( isset($_POST['email']) ) ? trim($_POST['email']) : null; +$comment_author_url = ( isset($_POST['url']) ) ? trim($_POST['url']) : null; +$comment_content = ( isset($_POST['comment']) ) ? trim($_POST['comment']) : null; + +// If the user is logged in +$user = wp_get_current_user(); +if ( $user->ID ) { + if ( empty( $user->display_name ) ) + $user->display_name=$user->user_login; + $comment_author = $wpdb->escape($user->display_name); + $comment_author_email = $wpdb->escape($user->user_email); + $comment_author_url = $wpdb->escape($user->user_url); + if ( current_user_can('unfiltered_html') ) { + if ( wp_create_nonce('unfiltered-html-comment_' . $comment_post_ID) != $_POST['_wp_unfiltered_html_comment'] ) { + kses_remove_filters(); // start with a clean slate + kses_init_filters(); // set up the filters + } + } +} else { + if ( get_option('comment_registration') || 'private' == $status ) + wp_die( __('Sorry, you must be logged in to post a comment.') ); +} + +$comment_type = ''; + +if ( get_option('require_name_email') && !$user->ID ) { + if ( 6 > strlen($comment_author_email) || '' == $comment_author ) + wp_die( __('Error: please fill the required fields (name, email).') ); + elseif ( !is_email($comment_author_email)) + wp_die( __('Error: please enter a valid email address.') ); +} + +if ( '' == $comment_content ) + wp_die( __('Error: please type a comment.') ); + +$comment_parent = isset($_POST['comment_parent']) ? absint($_POST['comment_parent']) : 0; + +$commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_content', 'comment_type', 'comment_parent', 'user_ID'); + +$comment_id = wp_new_comment( $commentdata ); + +$comment = get_comment($comment_id); +if ( !$user->ID ) { + $comment_cookie_lifetime = apply_filters('comment_cookie_lifetime', 30000000); + setcookie('comment_author_' . COOKIEHASH, $comment->comment_author, time() + $comment_cookie_lifetime, COOKIEPATH, COOKIE_DOMAIN); + setcookie('comment_author_email_' . COOKIEHASH, $comment->comment_author_email, time() + $comment_cookie_lifetime, COOKIEPATH, COOKIE_DOMAIN); + setcookie('comment_author_url_' . COOKIEHASH, esc_url($comment->comment_author_url), time() + $comment_cookie_lifetime, COOKIEPATH, COOKIE_DOMAIN); +} + +$location = empty($_POST['redirect_to']) ? get_comment_link($comment_id) : $_POST['redirect_to'] . '#comment-' . $comment_id; +$location = apply_filters('comment_post_redirect', $location, $comment); + +wp_redirect($location); +exit; +?> diff --git a/src/wp-commentsrss2.php b/src/wp-commentsrss2.php new file mode 100644 index 0000000..280766e --- /dev/null +++ b/src/wp-commentsrss2.php @@ -0,0 +1,12 @@ + diff --git a/src/wp-config-sample.php b/src/wp-config-sample.php new file mode 100644 index 0000000..d1cea2c --- /dev/null +++ b/src/wp-config-sample.php @@ -0,0 +1,89 @@ + diff --git a/src/wp-config.php b/src/wp-config.php new file mode 100644 index 0000000..117541d --- /dev/null +++ b/src/wp-config.php @@ -0,0 +1,89 @@ +DIYSO:./Vc9]=6slE09lmnc'); // Cambia esto por tu frase aleatoria. +define('LOGGED_IN_KEY', 'p[oo(DWyBGqu:OQ[t%td=d~ v)NxEukr~@cs[D%A|XJ4i%f;r#4m)KgVP;jX&, 8'); // Cambia esto por tu frase aleatoria. +define('NONCE_KEY', '`+f_GgA?|5=uy[=6jPw[-CJ,ERa|CSV`_gx&^Nx~1q|wAp`tZ'); // Cambia esto por tu frase aleatoria. +define('NONCE_SALT', 'L57JJ4Jd0v9P;B4f&v T?/2?N%ha;fyO`jqXM%?DR< CoZO>MmxgM~2&.kZkjR2~'); // Cambia esto por tu frase aleatoria. +/**#@-*/ + +/** + * Prefijo de la base de datos de WordPress. + * + * Cambia el prefijo si deseas instalar multiples blogs en una sola base de datos. + * Emplea solo números, letras y guión bajo. + */ +$table_prefix = 'wp_'; + +/** + * Idioma de WordPress. + * + * Cambia lo siguiente para tener WordPress en tu idioma. El correspondiente archivo MO + * del lenguaje elegido debe encontrarse en wp-content/languages. + * Por ejemplo, instala ca_ES.mo copiándolo a wp-content/languages y define WPLANG como 'ca_ES' + * para traducir WordPress al catalán. + */ +define ('WPLANG', 'es_ES'); + +/** + * Para desarrolladores: modo debug de WordPress. + * + * Cambia esto a true para activar la muestra de avisos durante el desarrollo. + * Se recomienda encarecidamente a los desarrolladores de temas y plugins que usen WP_DEBUG + * en sus entornos de desarrollo. + */ +define('WP_DEBUG', false); + +/* ¡Eso es todo, deja de editar! Feliz blogging */ + +/** WordPress absolute path to the Wordpress directory. */ +if ( !defined('ABSPATH') ) + define('ABSPATH', dirname(__FILE__) . '/'); + +/** Sets up WordPress vars and included files. */ +require_once(ABSPATH . 'wp-settings.php'); +?> diff --git a/src/wp-content/index.php b/src/wp-content/index.php new file mode 100644 index 0000000..4e6c07c --- /dev/null +++ b/src/wp-content/index.php @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/src/wp-content/languages/es_ES.mo b/src/wp-content/languages/es_ES.mo new file mode 100644 index 0000000..bdb789f Binary files /dev/null and b/src/wp-content/languages/es_ES.mo differ diff --git a/src/wp-content/languages/es_ES.po b/src/wp-content/languages/es_ES.po new file mode 100644 index 0000000..179f55f --- /dev/null +++ b/src/wp-content/languages/es_ES.po @@ -0,0 +1,14470 @@ +# Translation of Development (future 3.2) in Spanish (Spain) +# This file is distributed under the same license as the Development (future 3.2) package. +msgid "" +msgstr "" +"PO-Revision-Date: 2011-07-05 05:59:15+0000\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: GlotPress/0.1\n" +"Project-Id-Version: Development (future 3.2)\n" + +#: wp-admin/includes/theme.php:313 +msgid "Full Width Template" +msgstr "Plantilla a pantalla completa" + +#: wp-admin/includes/theme.php:315 +msgid "Post Formats" +msgstr "Formatos de entradas" + +#: wp-admin/includes/theme.php:311 +msgid "Featured Images" +msgstr "Imágenes destacadas" + +#: wp-admin/includes/theme.php:310 +msgid "Featured Image Header" +msgstr "Imagen de cabecera" + +#: wp-includes/formatting.php:2541 +msgid "The timezone you have entered is not valid. Please select a valid timezone." +msgstr "La zona horaria que has introducido no es válida. Por favor, selecciona una zona horaria válida." + +#: wp-admin/includes/dashboard.php:1181 +msgid "It looks like you're using an old version of %s. For the best WordPress experience, please update your browser." +msgstr "Parece que estás usando una versión antigua de %s. Para una mejor experiencia de WordPress, por favor, actualiza tu navegador." + +#: wp-admin/includes/dashboard.php:1179 +msgid "It looks like you're using an insecure version of %s. Using an outdated browser makes your computer unsafe. For the best WordPress experience, please update your browser." +msgstr "Parece que estás usando una versión insegura de %s. El uso de un navegador obsoleto hace que tu ordenador sea inseguro. Para una mejor experiencia con WordPress, por favor, actualiza tu navegador." + +#: wp-admin/includes/nav-menu.php:1118 +msgid "There are some invalid menu items. Please check or delete them." +msgstr "Hay algunos elementos de menú no válidos. Por favor, compruébalos o elimínalos." + +#: wp-includes/post.php:22 +msgctxt "add new on admin bar" +msgid "Post" +msgstr "Entrada" + +#: wp-includes/post.php:37 +msgctxt "add new on admin bar" +msgid "Page" +msgstr "Página" + +#: wp-admin/includes/nav-menu.php:73 +msgid "%s (Invalid)" +msgstr "%s (no válido)" + +#: wp-admin/includes/class-wp-plugin-install-list-table.php:141 +msgctxt "plugin name" +msgid "Name" +msgstr "Nombre" + +#: wp-admin/includes/class-wp-terms-list-table.php:100 +#: wp-admin/includes/class-wp-terms-list-table.php:339 +msgctxt "term name" +msgid "Name" +msgstr "Nombre" + +#: wp-admin/includes/template.php:428 wp-admin/includes/template.php:443 +#: wp-admin/includes/template.php:538 +msgctxt "meta name" +msgid "Name" +msgstr "Nombre" + +#: wp-admin/index.php:44 +msgid "WordPress Blog - Come here for the latest scoop." +msgstr "Blog oficial de WordPress - Ven aquí para ver las últimas noticias." + +#: wp-admin/user-new.php:34 +msgid "[%s] Your site invite" +msgstr "[%s] Tu sitio invita a" + +#: wp-admin/themes.php:212 +msgctxt "theme name" +msgid "Name" +msgstr "Nombre" + +#: wp-admin/edit-link-form.php:86 +#: wp-admin/includes/class-wp-links-list-table.php:80 +msgctxt "link name" +msgid "Name" +msgstr "Nombre" + +#: wp-includes/js/tinymce/langs/wp-langs.php:366 +msgctxt "html attribute" +msgid "Name" +msgstr "Nombre" + +#: wp-includes/js/tinymce/langs/wp-langs.php:323 +msgctxt "html attribute" +msgid "Name:" +msgstr "Nombre:" + +#: wp-admin/credits.php:174 +msgid "Blue Color Scheme" +msgstr "Paleta azul" + +#: wp-admin/credits.php:173 +msgid "Icon Design" +msgstr "Diseño del icono" + +#: wp-admin/theme-install.php:42 +msgid "You can find additional themes for your site by using the Theme Browser/Installer on this screen, which will display themes from the WordPress.org Theme Directory. These themes are designed and developed by third parties, are available free of charge, and are compatible with the license WordPress uses." +msgstr "Puedes encontrar más temas en el buscador/instalador de temas que hay en esta misma página, donde se mostrarán los temas del Directorio de temas. Estos temas son diseñados y desarrollados por terceros y estás disponibles sin cargo (gratis) y compatible con la licencia que utiliza WordPress." + +#: wp-admin/themes.php:43 +msgid "If you would like to see more themes to choose from, click on the “Install Themes” tab and you will be able to browse or search for additional themes from the WordPress.org Theme Directory. Themes in the WordPress.org Theme Directory are designed and developed by third parties, and are compatible with the license WordPress uses. Oh, and they’re free!" +msgstr "Si quieres ver más temas entre los que elegir haz clic en la pestaña “Instalar Temas” y podrás navegar o buscar más temas del Directorio de Temas de WordPress.org. Los temas del Directorio de WordPress.org están diseñados por terceros y son compabiltes con la licencia que utiliza Wordpress. Ah, y además ¡son gratis!" + +#: wp-admin/plugin-install.php:40 +msgid "Plugins hook into WordPress to extend its functionality with custom features. Plugins are developed independently from WordPress core by thousands of developers all over the world. All plugins in the official WordPress.org Plugin Directory are compatible with the license WordPress uses. You can find new plugins to install by searching or browsing the Directory right here in your own Plugins section." +msgstr "Los plugins se conectan con WordPress para extender su funcionalidad con características personalizadas. Los plugins los desarrollan de manera independiente del núcleo de WordPress miles de desarrolladores de tdoo el mundo. Todos los plugins en el directorio oficial de plugins de WordPress.org son compatibles con la licencia que utiliza WordPress. Puedes descubrir nuevos plugins para instalar buscando o navegando por el directorio desde aquí mismo, en tu propia sección de plugins." + +#: wp-includes/admin-bar.php:249 +msgctxt "add new from admin bar" +msgid "Media" +msgstr "Medio" + +#: wp-includes/admin-bar.php:261 +msgctxt "add new from admin bar" +msgid "Plugin" +msgstr "Plugin" + +#: wp-includes/admin-bar.php:252 +msgctxt "add new from admin bar" +msgid "Link" +msgstr "Enlace" + +#: wp-includes/admin-bar.php:258 +msgctxt "add new from admin bar" +msgid "Theme" +msgstr "Tema" + +#: wp-includes/admin-bar.php:255 +msgctxt "add new from admin bar" +msgid "User" +msgstr "Usuario" + +#: wp-admin/update-core.php:40 +msgid "Re-install Now" +msgstr "Reinstalar ahora" + +#: wp-admin/includes/file.php:255 +msgid "The uploaded file exceeds the upload_max_filesize directive in php.ini." +msgstr "El archivo subido excede la directiva upload_max_filesize en php.ini." + +#: wp-admin/includes/file.php:256 +msgid "The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form." +msgstr "El archivo subido excede la directiva MAX_FILE_SIZE que se especificó en el formulario HTML." + +#: wp-includes/pluggable.php:870 +msgid "You should specify a nonce action to be verified by using the first parameter." +msgstr "Debes especificar una acción \"nonce\" a verificar mediante el primer parámetro." + +#: wp-includes/taxonomy.php:407 +msgid "View Tag" +msgstr "Ver etiqueta" + +#: wp-includes/taxonomy.php:407 +msgid "View Category" +msgstr "Ver categoría" + +#: wp-admin/tools.php:39 wp-admin/options-writing.php:94 +msgid "If your bookmarks toolbar is hidden: copy the code below, open your Bookmarks manager, create new bookmark, type Press This into the name field and paste the code into the URL field." +msgstr "Si tu barra de marcadores está oculta: copia el siguiente código, abre el gestor de marcadores, crea un nuevo marcador, teclea Publica esto en el campo de nombre y pega el código en el campo de la URL." + +#: wp-admin/credits.php:166 +msgid "Core Committer" +msgstr "Confirmador del núcleo" + +#: wp-admin/credits.php:167 +msgid "Guest Committer" +msgstr "Confirmador invitado" + +#: wp-admin/credits.php:172 +msgid "External Libraries" +msgstr "Librerías externas" + +#: wp-admin/press-this.php:623 +msgid "Add:" +msgstr "Añadir:" + +#: wp-admin/press-this.php:315 +msgid "Add Photos" +msgstr "Añadir fotos" + +#: wp-includes/js/tinymce/wp-mce-help.php:260 +msgid "Editor width in Distraction-free writing mode:" +msgstr "Ancho del editor en modo de escritura sin distracciones:" + +#: wp-includes/js/tinymce/wp-mce-help.php:261 +msgid "Wider" +msgstr "Más ancho" + +#: wp-includes/js/tinymce/wp-mce-help.php:262 +msgid "Narrower" +msgstr "Más estrecho" + +#: wp-includes/js/tinymce/wp-mce-help.php:263 +msgid "Default width" +msgstr "Ancho por defecto" + +#: wp-admin/credits.php:20 +msgid "Documentation on Contributing to WordPress" +msgstr "Documentación acerca de como colaborar con WordPress" + +#: wp-admin/credits.php:18 +msgid "WordPress always needs more people to report bugs, patch bugs, test betas, work on UI design, translate strings, write documentation, and add questions/answers/suggestions to the Support Forums. Join in!" +msgstr "WordPress siempre necesita más personas para informar de los errores, errores de parches, las versiones beta de prueba, el trabajo en el diseño de la interfaz de usuario, traducir cadenas, escribir documentación y agregar preguntas, respuestas y sugerencias a los foros de soporte técnico. ¡Participa!" + +#: wp-admin/credits.php:16 +msgid "Each name or handle is a link to that person’s profile in the WordPress.org community directory." +msgstr "Cada nombre o manejador es un enlace al perfil de esa persona en el directorio de la comunidad WordPress.org." + +#: wp-admin/nav-menus.php:452 +msgid "This feature allows you to use a custom menu in place of your theme’s default menus. If your theme does not support the custom menus feature yet (the new and old default themes, Twenty Eleven and Twenty Ten, do), you can learn about adding this support by following the Documentation link in this tab. You can still use the “Custom Menu” widget to add menus to a sidebar." +msgstr "Esta característica te permite usar un menú personalizado en lugar de menús predeterminados en tu tema. Si tu tema no es compatible con la función de los menús personalizados (los temas predeterminados nuevos y viejos, Twenty Eleven y Twenty Ten lo son), puedes aprender acerca de cómo agregar esta función siguiendo el enlace de documentación en esta pestaña. Puedes seguir utilizando el widget \"menú personalizado\" para añadir menús a una barra lateral." + +#: wp-admin/credits.php:17 +msgid "You can register your own profile at this link to start contributing." +msgstr "Puedes registrar tu propio perfil en este enlace para empezar a colaborar." + +#: wp-admin/index.php:36 +msgid "The left-hand navigation menu provides links to the administration screens in your WordPress application. You can expand or collapse navigation sections by clicking on the arrow that appears on the right side of each navigation item when you hover over it. You can also minimize the navigation menu to a narrow icon strip by clicking on the Collapse Menu arrow at the bottom of the nav menu, below Settings; when minimized, the submenu items will be displayed on hover." +msgstr "El menú de navegación de la izquierda ofrece enlaces a las pantallas de administración de WordPress. Puedes expandir o contraer secciones de navegación haciendo clic en la flecha que aparece a la derecha de cada elemento de navegación cuando pasas sobre él. También puedes minimizar el menú de navegación a una franja estrecha haciendo clic en la flecha de Cerrar menú en la parte inferior del menú de navegación, debajo de Ajustes. Cuando se minimiza, los elementos de submenú se mostrarán al pasar por encima." + +#: wp-admin/index.php:37 +msgid "You can arrange your dashboard by choosing which boxes, or modules, to display in the work area, how many columns to display them in, and where each box should be placed. You can hide/show boxes and select the number of columns in the Screen Options tab. To rearrange the boxes, drag and drop by clicking on the title bar of the selected box and releasing when you see a gray dotted-line rectangle appear in the location you want to place the box. You can also expand or collapse each box; click the title area or downward arrow of the box. In addition, some boxes are configurable, and will show a “Configure” link in the title bar if you hover over it." +msgstr "Puedes ordenar tu escritorio eligiendo que cajas, o módulos, mostrar en el área de trabajo, en cuantas columnas mostrarlas y donde debe estar cada caja. Puedes ocultar o mostrar cajas y elegir el número de columnas en la pestaña de Opciones de pantalla. Para reordenar las cajas arrastra y suéltalas haciendo clic en la barra de título de la caja elegida y suéltala cuando veas un rectángulo con una línea de puntos gris en el sitio donde quieras poner la caja. También peudes expandir o cerrar cada caja; haz clic en el área del título o en la flecha abajo de la caja. Además, algunas cajas son configurables, y mostrarán un enlace de “Configurar” en la barra de título al pasar sobre ella." + +#: wp-admin/edit-form-advanced.php:171 +msgid "Post Format - This designates how your theme will display a specific post. For example, you could have a standard blog post with a title and paragraphs, or a short aside that omits the title and contains a short text blurb. Please refer to the Codex for descriptions of each post format. Your theme could enable all or some of 10 possible formats." +msgstr "Formato de entrada - Esto se refiere a como tu tema mostrará una entrada específica. Por ejemplo, puedes tener una entrada de blog standard con título y párrafos, o una cita corta que omita el título y contenga un texto corto emergente. Por favor, remítete al Codex para las descripciones de cada formato de entrada. Tu tema puede permitir todos o solo alguno de los 10 posibles formatos." + +#: wp-admin/edit-form-advanced.php:182 +msgid "Creating a Page is very similar to creating a Post, and the screens can be customized in the same way using drag and drop, the Screen Options tab, and expanding/collapsing boxes as you choose. This screen also has the new in 3.2 distraction-free writing space, available in both the Visual and HTML modes via the Fullscreen buttons. The Page editor mostly works the same as the Post editor, but there are some Page-specific features in the Page Attributes box:" +msgstr "Crear una página es muy parecido a crear una entrada, y las pantallas pueden personalizarse del mismo modo, arrastrando y soltando, tienes la pestaña de Ajustes de pantalla, y puedes expandir o cerrar cajas a voluntad. Esta pantalla también dispone del espacio sin distracciones incorporado en 3.2, disponible tanto en los modos de editor visual como HTML desde los botones de pantalla completa. El editor de páginas trabaja prácticamente igual que el editor de entradas, solo que hay algunas características específicas para páginas en la caja Atributos de página:" + +#: wp-admin/index.php:35 +msgid "The Admin Bar at the top provides quick access to common tasks when you are viewing your site. If you miss the Favorite Actions dropdown, removed as of 3.2, you can find many of the same actions in the Admin Bar, such as Add New > Post." +msgstr "La barra de administración de la parte superior ofrece acceso rápido a tareas habituales cuando estás viendo tu sitio. Si echas de menos el desplegable de acciones preferidas, eliminado desde la versión 3.2, puedes encontrar muchas de esas acciones en la barra de administración, como por ejemplo Añadir nueva > Entrada." + +#: wp-admin/edit-comments.php:117 +msgid "In the Comment column, above each comment it says “Submitted on,” followed by the date and time the comment was left on your site. Clicking on the date/time link will take you to that comment on your live site. Hovering over any comment gives you options to approve, reply (and approve), quick edit, edit, spam mark, or trash that comment." +msgstr "En la columna de comentario, sobre cada comentario dice: \"Enviado el\", seguido de la fecha y hora se hizo un comentario en tu sitio. Al hacer clic en la fecha y hora, el enlace te llevará a ese comentario en tu sitio. Pasar por encima de cualquier comentario da opciones para aprobarlo, responderlo (con aprobación), edición rápida, edición normal, marcar como spam o mandar a la papelera ese comentario." + +#: wp-admin/options-privacy.php:20 +msgid "When this setting is in effect a reminder is shown in the Right Now box of the Dashboard that says, “Search Engines Blocked,” to remind you that your site is not being crawled." +msgstr "Cuando este ajuste está activado se muestra un aviso en la caja Ahora mismo del Escritorio que dice: \"Motores de búsqueda bloqueados\", para recordarte que tu sitio no está siendo rastreado." + +#: wp-admin/edit-form-advanced.php:169 +msgid "Post editor - Enter the text for your post. There are two modes of editing: Visual and HTML. Choose the mode by clicking on the appropriate tab. Visual mode gives you a WYSIWYG editor. Click the last icon in the row to get a second row of controls. The HTML mode allows you to enter raw HTML along with your post text. You can insert media files by clicking the icons above the post editor and following the directions. You can go the distraction-free writing screen, new in 3.2, via the Fullscreen icon in Visual mode (second to last in the top row) or the Fullscreen button in HTML mode (last in the row). Once there, you can make buttons visible by hovering over the top area. Exit Fullscreen back to the regular post editor." +msgstr "Editor de entradas - Introduce el texto de tu entrada. Hay dos modos de editar: Visual y HTML. Elige el modo haciendo clic en la pestaña adecuada. El modo visual te ofrece un editor WYSIWYG (lo que ves es lo que obtendrás). Haz clic en el último icono de la fila para mostrar una segunda fila de controles. El modo HTML permite introducir HTML en el texto de tu entrada. Puedes insertar archivos multimedia haciendo clic en los iconos por encima del editor y seguir las instrucciones. Puedes ir a la pantalla de escritura sin distracción, nueva en 3.2, a través del icono de Pantalla completa en el modo visual (segundo desde la derecha en la fila superior) o del botón de Pantalla completa del modo HTML (el último de la fila). Una vez ahí puedes hacer visibles los botones pasando sobre el área superior. Salir de pantalla completa te devuelve al editor de entradas normal." + +#: wp-admin/tools.php:16 +msgid "The Use This link for the Categories and Tags Converter will take you to the Import page, where that Converter is one of the plugins you can download. Once that plugin is installed, the link on this page takes you to a screen where you can choose conversion either way." +msgstr "Al usar este vínculo para el convertidor de las categorías y etiquetas te llevará a la página de importación, donde dicho convertidor es uno de los plugins que puedes descargar. Una vez que el plugin está instalado, el enlace en esta página te lleva a una pantalla donde se puede elegir la conversión adecuada." + +#: wp-admin/edit-form-advanced.php:167 +msgid "The title field and the big Post Editing Area are fixed in place, but you can reposition all the other boxes using drag and drop, and can minimize or expand them by clicking the title bar of each box. Use the Screen Options tab to unhide more boxes (Excerpt, Send Trackbacks, Custom Fields, Discussion, Slug, Author) or to choose a 1- or 2-column layout for this screen." +msgstr "El campo de título del área grande de edición de entradas es fijo, pero puedes cambiar la posición del resto de cajas solo con arrastrar y soltar, y puedes miniminzarlas o expandirlas haciendo clic en la barra de título de cada caja. Usa la pestaña de Ajustes de pantalla para mostrar más cajas (Extracto, Enviar trackbacks, Campos personalizados, Discusión, Slug, Autor) o para elegir un diseño de 1 o 2 columnas para esta pantalla." + +#: wp-admin/menu.php:219 +msgid "Available Tools" +msgstr "Herramientas disponibles" + +#: wp-admin/menu.php:225 +msgid "Network Setup" +msgstr "Configuración de la red" + +#: wp-admin/credits.php:165 +msgid "User Experience Lead" +msgstr "Líder de experiencia de usuario" + +#: wp-admin/credits.php:105 +msgctxt "Translate this to be the equivalent of English Translators in your language for the credits page Translators section" +msgid "Translators" +msgstr "Traductores" + +#: wp-admin/credits.php:92 wp-admin/credits.php:149 +msgid "http://codex.wordpress.org/Contributing_to_WordPress" +msgstr "http://codex.wordpress.org/Contributing_to_WordPress" + +#: wp-admin/credits.php:97 +msgid "WordPress is created by a worldwide team of passionate individuals. We couldn’t possibly list them all, but here some of the most influential people currently involved with the project:" +msgstr "WordPress está creado por un equipo de personas apasionadas de todas partes del mundo. No se pueden enumerar todas, pero estas son algunas de las personas más influyentes que en la actualidad participan en el proyecto:" + +#: wp-admin/freedoms.php:30 +msgid "WordPress grows when people like you tell their friends about it, and the thousands of businesses and services that are built on and around WordPress share that fact with their users. We’re flattered every time someone spreads the good word, just make sure to check out our trademark guidelines first." +msgstr "WordPress crece cuando la gente habla a sus amigos sobre él y los miles de negocios y servicios que se construyen en y alrededor de WordPress lo comparten con sus usuarios. Nos enorgullece cada vez que alguien difunde la buena nueva, simplemente asegúrate de echar un vistazo a nuestras guías de marca." + +#: wp-admin/freedoms.php:37 +msgid "Every plugin and theme in WordPress.org’s directory is 100%% GPL or a similarly free and compatible license, so you can feel safe finding plugins and themes there. If you get a plugin or theme from another source, make sure to ask them if it’s GPL first. If they don’t respect the WordPress license, we don’t recommend them." +msgstr "Cada plugin y tema del directorio de WordPress.org es 100%% GPL o con una licencia libre similar y compatible, así que puedes sentirte seguro buscando plugins y temas aquí. Si obtienes un plugin o tema desde otra fuente asegúrate de preguntar primero si es GPL. Si no respeta la licencia de WordPress no lo recomedamos." + +#: wp-admin/freedoms.php:21 +msgid "WordPress is Free and open source software, built by a distributed community of mostly volunteer developers from around the world. WordPress comes with some awesome, worldview-changing rights courtesy of its license, the GPL." +msgstr "WordPress es un software de código libre y abierto, construido por una comunidad de desarrolladores, en su mayoría voluntarios, distribuidos por todo el mundo. WordPress viene con la genial licencia que cambiará el mundo, la licencia GPL." + +#: wp-admin/edit-form-advanced.php:272 wp-admin/includes/post.php:1853 +msgid "Word count: %s" +msgstr "Número de palabras: %s" + +#: wp-admin/includes/post.php:1807 +msgid "Blockquote (Alt+Shift+Q)" +msgstr "Cita (Alt+Shift+Q)" + +#: wp-admin/credits.php:164 +msgid "Lead Developer" +msgstr "Jefe de Desarrollo" + +#: wp-admin/credits.php:168 +msgid "Developer" +msgstr "Desarrollador" + +#: wp-admin/includes/post.php:1813 +msgid "Help (Alt + Shift + H)" +msgstr "Ayuda (Alt + Mayús + H)" + +#: wp-admin/includes/schema.php:684 +msgid "" +"Dear User,\n" +"\n" +"Your new SITE_NAME site has been successfully set up at:\n" +"BLOG_URL\n" +"\n" +"You can log in to the administrator account with the following information:\n" +"Username: USERNAME\n" +"Password: PASSWORD\n" +"Log in Here: BLOG_URLwp-login.php\n" +"\n" +"We hope you enjoy your new site.\n" +"Thanks!\n" +"\n" +"--The Team @ SITE_NAME" +msgstr "" +"Estimado usuario:\n" +"\n" +"Tu nuevo sitio SITE_NAME se ha creado en:\n" +"BLOG_URL\n" +"\n" +"Puedes acceder a la administración de la cuenta con la siguiente información:\n" +"Nombre de usuario: USERNAME\n" +"Contraseña: PASSWORD\n" +"Acceda aquí: BLOG_URLwp-login.php\n" +"\n" +"Esperamos que disfrutes de tu nuevo sitio\n" +"Gracias\n" +"\n" +"-- El equipo @ SITE_NAME" + +#: wp-admin/credits.php:160 +msgid "Extended Core Team" +msgstr "Equipo Extendido del Core" + +#: wp-admin/credits.php:147 +msgid "Want to see your name in lights on this page? Get involved in WordPress." +msgstr "¿Quieres ver tu nombre destacado en esta página? Involúcrate en WordPress." + +#: wp-admin/credits.php:12 +msgid "Credits" +msgstr "Créditos" + +#: wp-admin/widgets.php:360 +msgctxt "removing-widget" +msgid "Deactivate" +msgstr "Desactivar" + +#: wp-admin/credits.php:82 +msgid "WordPress Credits" +msgstr "Créditos de WordPress" + +#: wp-admin/credits.php:163 +msgid "Cofounder, Project Lead" +msgstr "Co-fundador, jefe de proyecto" + +#: wp-admin/credits.php:171 +msgid "Internationalization" +msgstr "Internacionalización" + +#: wp-admin/admin-header.php:154 +msgid "Howdy, %1$s" +msgstr "Hola, %1$s" + +#: wp-admin/admin-header.php:156 +msgid "Edit your profile" +msgstr "Edita tu perfil" + +#: wp-admin/credits.php:162 +msgid "Core Contributors to WordPress %s" +msgstr "Colaboradores del núcleo de Wordpress %s" + +#: wp-admin/credits.php:161 +msgid "Recent Rockstars" +msgstr "Estrellas del rock recientes" + +#: wp-admin/includes/post.php:1784 +msgid "Exit fullscreen" +msgstr "Salir de pantalla completa" + +#: wp-admin/includes/post.php:1854 +msgid "Just write." +msgstr "Simplemente escribe." + +#: wp-admin/menu.php:117 +msgid "All Comments" +msgstr "Todos los comentarios" + +#: wp-admin/menu.php:185 +msgid "Installed Plugins" +msgstr "Plugins instalados" + +#: wp-admin/menu.php:202 +msgid "All Users" +msgstr "Todos los usuarios" + +#: wp-admin/credits.php:89 +msgid "WordPress is created by a worldwide team of passionate individuals. Get involved in WordPress." +msgstr "WordPress está creado por un equipo de personas apasionadas que están alrededor del todo el planeta.Involucrarse en WordPress." + +#: wp-admin/credits.php:159 +msgid "Project Leaders" +msgstr "Líderes de proyecto" + +#: wp-admin/credits.php:169 +msgid "Designer" +msgstr "Diseñador" + +#: wp-admin/freedoms.php:24 +msgid "You have the freedom to run the program, for any purpose." +msgstr "Tienes la libertad de usar el programa con cualquier propósito." + +#: wp-admin/includes/dashboard.php:1192 +msgid "

    Update %2$s or learn how to browse happy

    " +msgstr "

    Actualiza %2$s o aprende como navegar feliz

    " + +#: wp-admin/freedoms.php:25 +msgid "You have access to the source code, the freedom to study how the program works, and the freedom to change it to make it do what you wish." +msgstr "Tienes acceso al código fuente, la libertad de estudiar cómo funciona el programa, y ​​la libertad de cambiarlo para que haga lo que quieras." + +#: wp-admin/freedoms.php:26 +msgid "You have the freedom to redistribute copies of the original program so you can help your neighbor." +msgstr "Tienes la libertad de redistribuir copias del programa original y así ayudar a otros." + +#: wp-admin/admin-footer.php:27 +msgid "Credits" +msgstr "Créditos" + +#: wp-admin/freedoms.php:27 +msgid "You have the freedom to distribute copies of your modified versions to others. By doing this you can give the whole community a chance to benefit from your changes." +msgstr "Eres libre de distribuir copias de tu versión modificada a quien quieras. Si lo haces, das la oportunidad de beneficiarse de tus cambios a toda la comunidad." + +#: wp-admin/includes/dashboard.php:33 +msgid "You are using an insecure browser!" +msgstr "¡Estás usando un navegador inseguro!" + +#: wp-admin/includes/dashboard.php:35 +msgid "Your browser is out of date!" +msgstr "¡Tu navegador está obsoleto!" + +#: wp-admin/freedoms.php:39 +msgid "Don’t you wish all software came with these freedoms? So do we! For more information, check out the Free Software Foundation." +msgstr "¿No te gustaría que todo el software tuviera esa libertad? Nosotros también. Para más información ve a la Free Software Foundation." + +#: wp-admin/admin-ajax.php:944 +msgid "Your login has expired. Please open a new browser window and log in again. " +msgstr "Tu acceso ha caducado. Por favor, abre una nueva ventana del navegador y accede de nuevo." + +#: wp-admin/admin-footer.php:25 +msgid "Freedoms" +msgstr "Derechos" + +#: wp-admin/freedoms.php:12 wp-admin/freedoms.php:19 +msgid "Freedoms" +msgstr "Derechos" + +#: wp-admin/custom-background.php:298 +msgid "Clear" +msgstr "Borrar" + +#: wp-admin/themes.php:146 wp-admin/themes.php:148 +msgid "Search Installed Themes" +msgstr "Buscar temas instalados" + +#: wp-admin/custom-header.php:542 +msgid "You can use one of these cool headers or show a random one on each page." +msgstr "Puedes usar una de estas cabeceras tan chulas o mostrarlas aleatoriamente en cada página." + +#: wp-admin/custom-header.php:540 +msgid "If you don‘t want to upload your own image, you can use one of these cool headers, or show a random one." +msgstr "Si no quieres subir tu propia imagen puedes usar una de estas cabeceras tan chulas o ir mostrándolas aleatoriamente." + +#: wp-admin/custom-header.php:528 +msgid "You can choose one of your previously uploaded headers, or show a random one." +msgstr "Puedes elegir una las cabeceras que ya has subido o que se muestren aleatoriamente." + +#: wp-includes/script-loader.php:320 +msgid "Approve and Reply" +msgstr "Aprobar y responder" + +#: wp-includes/post.php:1188 wp-admin/menu.php:75 +msgid "All Posts" +msgstr "Todas las entradas" + +#: wp-includes/post.php:1188 wp-admin/menu.php:100 +msgid "All Pages" +msgstr "Todas las páginas" + +#: wp-admin/menu-header.php:173 +msgid "Collapse menu" +msgstr "Cerrar menú" + +#: wp-admin/includes/class-wp-plugins-list-table.php:296 +msgid "Drop-ins are advanced plugins in the %s directory that replace WordPress functionality when present." +msgstr "Los infiltrados son plugins avanzados del directorio %s que reemplazan funcionalidades de WordPress cuando están disponibles." + +#: wp-admin/includes/class-wp-plugins-list-table.php:294 +msgid "Files in the %s directory are executed automatically." +msgstr "Los archivos del directorio %s se ejecutan automáticamente." + +#: wp-admin/includes/post.php:1835 +msgid "Updated." +msgstr "Actualizada." + +#: wp-includes/script-loader.php:89 +msgid "fullscreen" +msgstr "pantalla completa" + +#: wp-admin/custom-header.php:270 +msgid "Random: Show a different image on each page." +msgstr "Aleatoria: Muestra una imagen diferente en cada página." + +#: wp-admin/custom-header.php:526 +msgid "Uploaded Images" +msgstr "Imágenes subidas" + +#: wp-admin/edit-tags.php:216 +msgid "Documentation on Post Tags" +msgstr "Documentación sobre etiquetas de las entradas" + +#: wp-admin/media-upload.php:69 +msgid "Documentation on Uploading Media Files" +msgstr "Documentación sobre la carga de archivos multimedia" + +#: wp-admin/user-edit.php:47 +msgid "Documentation on User Profiles" +msgstr " Documentación sobre los perfiles de usuario" + +#: wp-admin/options-permalink.php:26 +msgid "Documentation on Permalinks Settings" +msgstr " Documentación sobre ajustes de enlaces permanentes" + +#: wp-admin/edit-tags.php:212 +msgid "Documentation on Categories" +msgstr "Documentación sobre las categorías" + +#: wp-admin/edit-tags.php:214 +msgid "Documentation on Link Categories" +msgstr " Documentación sobre categorías de enlaces" + +#: wp-admin/widgets.php:45 +msgid "Documentation on Widgets" +msgstr " Documentación sobre widgets" + +#: wp-admin/nav-menus.php:456 +msgid "Documentation on Menus" +msgstr " Documentación sobre menús " + +#: wp-admin/media.php:76 +msgid "Documentation on Edit Media" +msgstr "Documentación de editar objetos multimedia" + +#: wp-admin/edit-form-advanced.php:188 +msgid "Documentation on Editing Pages" +msgstr " Documentación de la edición de páginas" + +#: wp-admin/upload.php:148 +msgid "Documentation on Media Library" +msgstr "Documentación sobre la librería multimedia " + +#: wp-admin/tools.php:19 +msgid "Documentation on Tools" +msgstr "Documentación sobre herramientas " + +#: wp-admin/custom-header.php:106 +msgid "Documentation on Custom Header" +msgstr "Documentación sobre cabeceras personalizadas" + +#: wp-admin/export.php:45 +msgid "Documentation on Export" +msgstr "Documentación sobre exportación " + +#: wp-admin/options-general.php:69 +msgid "Documentation on General Settings" +msgstr "Documentación sobre ajustes generales" + +#: wp-admin/options-media.php:24 +msgid "Documentation on Media Settings" +msgstr "Documentación sobre Ajustes multimedia" + +#: wp-admin/update-core.php:413 +msgid "Documentation on Updating WordPress" +msgstr " Documentación sobre actualizar WordPress" + +#: wp-admin/edit-form-advanced.php:177 +msgid "Documentation on Writing and Editing Posts" +msgstr "Documentación sobre escritura y edición de entradas " + +#: wp-admin/comment.php:51 wp-admin/edit-comments.php:121 +msgid "Documentation on Comments" +msgstr "Documentación sobre comentarios" + +#: wp-admin/users.php:28 +msgid "Documentation on Managing Users" +msgstr "Documentación sobre la gestión de usuarios" + +#: wp-admin/options-discussion.php:22 +msgid "Documentation on Discussion Settings" +msgstr "Documentación sobre ajustes de comentarios" + +#: wp-admin/edit-link-form.php:47 +msgid "Documentation on Creating Links" +msgstr " Documentación sobre la creación de enlaces " + +#: wp-admin/options-reading.php:50 +msgid "Documentation on Reading Settings" +msgstr "Documentación sobre ajustes de lectura" + +#: wp-admin/plugin-install.php:45 +msgid "Documentation on Installing Plugins" +msgstr "Documentación sobre la instalación de plugins " + +#: wp-admin/edit.php:169 +msgid "Documentation on Managing Posts" +msgstr "Documentación sobre la gestión de entradas " + +#: wp-admin/options-privacy.php:23 +msgid "Documentation on Privacy Settings" +msgstr "Documentación sobre ajustes de privacidad" + +#: wp-admin/index.php:48 +msgid "Documentation on Dashboard" +msgstr "Documentación sobre el escritorio" + +#: wp-admin/plugin-editor.php:122 +msgid "Documentation on Editing Plugins" +msgstr "Documentación de la edición de plugins" + +#: wp-admin/custom-background.php:88 +msgid "Documentation on Custom Background" +msgstr " Documentación sobre fondo personalizado" + +#: wp-admin/import.php:23 +msgid "Documentation on Import" +msgstr "Documentación sobre importar" + +#: wp-admin/edit.php:178 +msgid "Documentation on Managing Pages" +msgstr "Documentación sobre la gestión de páginas" + +#: wp-admin/edit-form-advanced.php:187 +msgid "Documentation on Adding New Pages" +msgstr "Documentación sobre añadir nuevas páginas" + +#: wp-admin/options-writing.php:22 +msgid "Documentation on Writing Settings" +msgstr "Documentación sobre ajustes de escritura" + +#: wp-admin/link-manager.php:49 +msgid "Documentation on Managing Links" +msgstr "Documentación sobre la gestión de enlaces " + +#: wp-admin/user-new.php:149 +msgid "Documentation on Adding New Users" +msgstr "Documentación sobre agregar nuevos usuarios" + +#: wp-admin/includes/post.php:1801 +msgid "Bold (Ctrl + B)" +msgstr "Negrita (Ctrl + B)" + +#: wp-admin/includes/post.php:1802 +msgid "Italic (Ctrl + I)" +msgstr "Cursiva (Ctrl + I)" + +#: wp-admin/includes/post.php:1805 +msgid "Ordered list (Alt + Shift + O)" +msgstr "Lista ordenada (Alt + Mayúsculas + O)" + +#: wp-admin/includes/post.php:1804 +msgid "Unordered list (Alt + Shift + U)" +msgstr "Lista sin ordenar (Alt + Shift + U)" + +#: wp-admin/includes/post.php:1808 +msgid "Insert/edit image (Alt + Shift + M)" +msgstr "Insertar/editar imagen (Alt + Mayúsculas + M)" + +#: wp-admin/includes/post.php:1810 +msgid "Insert/edit link (Alt + Shift + A)" +msgstr "Insertar / editar enlace (Alt + Mayúsculas + A)" + +#: wp-admin/includes/post.php:1811 +msgid "Unlink (Alt + Shift + S)" +msgstr "Desvincular (Alt + Shift + S)" + +#: wp-admin/admin-ajax.php:1524 +msgid "Save failed" +msgstr "Error al guardar" + +#: wp-admin/users.php:164 +msgid "You have specified this user for deletion:" +msgid_plural "You have specified these users for deletion:" +msgstr[0] "Ha marcado a este usuario para su eliminación:" +msgstr[1] "Ha marcado a estos usuarios para su eliminación:" + +#: wp-admin/user-edit.php:161 +msgid "← Back to Users" +msgstr "← Volver a usuarios" + +#: wp-admin/admin-ajax.php:959 +msgid "Autosave disabled." +msgstr "Autoguardado desactivado." + +#: wp-admin/admin-ajax.php:962 +msgid "%s is currently editing this article. If you update it, you will overwrite the changes." +msgstr "%s está actualmente editando este artículo. Si lo actualizas, sobrescribirás los cambios." + +#: wp-includes/js/tinymce/wp-mce-help.php:271 +msgid "TinyMCE is a platform independent web based Javascript HTML WYSIWYG editor released as Open Source under %sLGPL\tby Moxiecode Systems AB. It has the ability to convert HTML TEXTAREA fields or other HTML elements to editor instances." +msgstr "TinyMCE es un editor Javascript HTML WYSIWYG basado en web e independiente de la plataforma, liberado como Código abierto bajo la licencia %sLGPL→ por Moxiecode Systems AB. Puede convertir campos u o tros elementos HTML en instancias del editor." + +#: wp-includes/js/tinymce/langs/wp-langs.php:40 +msgid "Indigo" +msgstr "Índigo" + +#: wp-includes/js/tinymce/langs/wp-langs.php:39 +msgid "Navy Blue" +msgstr "Azul marino" + +#: wp-includes/js/tinymce/langs/wp-langs.php:37 +msgid "Dark green" +msgstr "Verde oscuro" + +#: wp-includes/js/tinymce/langs/wp-langs.php:51 +msgid "Amber" +msgstr "Ámbar" + +#: wp-includes/js/tinymce/langs/wp-langs.php:44 +msgid "Olive" +msgstr "Verde oliva" + +#: wp-includes/js/tinymce/langs/wp-langs.php:231 +msgid "Words:" +msgstr "Palabras:" + +#: wp-includes/js/tinymce/langs/wp-langs.php:42 +msgid "Maroon" +msgstr "Granate" + +#: wp-includes/js/tinymce/langs/wp-langs.php:461 +msgid "Poster" +msgstr "Cartel" + +#: wp-includes/js/tinymce/langs/wp-langs.php:460 +msgid "Preload" +msgstr "Precarga" + +#: wp-includes/js/tinymce/langs/wp-langs.php:459 +msgid "Alternative source 2" +msgstr "Fuente alternativa 2" + +#: wp-includes/js/tinymce/langs/wp-langs.php:458 +msgid "Alternative source 1" +msgstr "Fuente alternativa 1" + +#: wp-includes/js/tinymce/langs/wp-langs.php:224 +msgid "Disc" +msgstr "Disco" + +#: wp-includes/js/tinymce/langs/wp-langs.php:222 +msgid "Upper roman" +msgstr "Romana superior" + +#: wp-includes/js/tinymce/langs/wp-langs.php:62 +msgid "Aqua" +msgstr "Agua" + +#: wp-includes/js/tinymce/langs/wp-langs.php:61 +msgid "Lime" +msgstr "Lima" + +#: wp-includes/js/tinymce/langs/wp-langs.php:58 +msgid "Magenta" +msgstr "Magenta" + +#: wp-includes/js/tinymce/langs/wp-langs.php:55 +msgid "Royal blue" +msgstr "Azul real" + +#: wp-includes/js/tinymce/langs/wp-langs.php:54 +msgid "Turquoise" +msgstr "Turquesa" + +#: wp-includes/js/tinymce/langs/wp-langs.php:52 +msgid "Yellow green" +msgstr "Verde amarillento" + +#: wp-includes/js/tinymce/langs/wp-langs.php:221 +msgid "Upper alpha" +msgstr "Alfa superior" + +#: wp-includes/js/tinymce/langs/wp-langs.php:220 +msgid "Lower roman" +msgstr "Romana inferior" + +#: wp-includes/js/tinymce/langs/wp-langs.php:35 +msgid "Burnt orange" +msgstr "Naranja quemado" + +#: wp-includes/js/tinymce/langs/wp-langs.php:152 +msgid "Paste is now in plain text mode. Click again to toggle back to regular paste mode." +msgstr "Pegar está ahora en modo de texto sin formato. Haz clic de nuevo para volver al modo de pegado normal." + +#: wp-includes/js/tinymce/langs/wp-langs.php:72 +msgid "Plum" +msgstr "Ciruela" + +#: wp-includes/js/tinymce/langs/wp-langs.php:28 +msgid "{#field} must be a number" +msgstr "{#field} debe ser un número" + +#: wp-includes/js/tinymce/langs/wp-langs.php:57 +msgid "Medium gray" +msgstr "Gris medio" + +#: wp-includes/js/tinymce/langs/wp-langs.php:53 +msgid "Sea green" +msgstr "Verde mar" + +#: wp-includes/js/tinymce/langs/wp-langs.php:151 +msgid "Paste is now in plain text mode. Click again to toggle back to regular paste mode. After you paste something you will be returned to regular paste mode." +msgstr "Pegar está ahora en modo de texto sin formato. Haz clic de nuevo para volver al modo de pegado regular. Después de pegar algo se te devolverá al modo de pegado normal." + +#: wp-includes/js/tinymce/langs/wp-langs.php:457 +msgid "HTML5 Video Options" +msgstr "Opciones de vídeo HTML5" + +#: wp-includes/js/tinymce/langs/wp-langs.php:41 +msgid "Very dark gray" +msgstr "Gris muy oscuro" + +#: wp-includes/js/tinymce/langs/wp-langs.php:296 +msgid "Press ALT F10 for toolbar. Press ALT 0 for help." +msgstr "Pulsa ALT F10 para la barra de herramientas. Pulsa ALT 0 para ayuda." + +#: wp-includes/js/tinymce/langs/wp-langs.php:295 +#: wp-includes/js/tinymce/langs/wp-langs.php:351 +msgid "Accessibility Help" +msgstr "Ayuda sobre accesibilidad" + +#: wp-includes/js/tinymce/langs/wp-langs.php:352 +msgid "General Usage" +msgstr "Uso general" + +#: wp-includes/js/tinymce/langs/wp-langs.php:29 +msgid "{#field} must be a number greater than {#min}" +msgstr "{#field} debe ser un número mayor que {#min}" + +#: wp-includes/js/tinymce/langs/wp-langs.php:38 +msgid "Dark azure" +msgstr "Azur oscuro" + +#: wp-includes/js/tinymce/langs/wp-langs.php:36 +msgid "Dark olive" +msgstr "Verde oliva oscuro" + +#: wp-includes/js/tinymce/langs/wp-langs.php:219 +msgid "Lower greek" +msgstr "Griega inferior" + +#: wp-includes/js/tinymce/langs/wp-langs.php:218 +msgid "Lower alpha" +msgstr "Alfa inferior" + +#: wp-includes/js/tinymce/langs/wp-langs.php:210 +msgid "Learn word" +msgstr "Aprender palabra" + +#: wp-includes/js/tinymce/langs/wp-langs.php:216 +msgid "Types" +msgstr "Tipos" + +#: wp-includes/js/tinymce/langs/wp-langs.php:298 +msgid "Toolbar" +msgstr "Barra de herramientas" + +#: wp-includes/js/tinymce/langs/wp-langs.php:30 +msgid "{#field} must be a number or percentage" +msgstr "{#field} debe ser un número o porcentaje" + +#: wp-includes/js/tinymce/langs/wp-langs.php:225 +msgid "Square" +msgstr "Cuadrado" + +#: wp-includes/js/tinymce/langs/wp-langs.php:59 +msgid "Gold" +msgstr "Dorado" + +#: wp-includes/js/tinymce/langs/wp-langs.php:71 +msgid "Light sky blue" +msgstr "Azul cielo claro" + +#: wp-includes/js/tinymce/langs/wp-langs.php:223 +msgid "Circle" +msgstr "Círculo" + +#: wp-includes/js/tinymce/langs/wp-langs.php:67 +msgid "Peach" +msgstr "Melocotón" + +#: wp-includes/js/tinymce/wp-mce-help.php:272 +msgid "Copyright © 2003-2011, Moxiecode Systems AB, All rights reserved." +msgstr "Derechos de copia © 2003-2011, Moxiecode Systems AB, Todos los derechos reservados." + +#: wp-includes/js/tinymce/langs/wp-langs.php:63 +msgid "Sky blue" +msgstr "Azul cielo" + +#: wp-includes/js/tinymce/langs/wp-langs.php:228 +#: wp-includes/js/tinymce/langs/wp-langs.php:297 +msgid "Rich Text Area" +msgstr "Área de texto enriquecido" + +#: wp-includes/js/tinymce/langs/wp-langs.php:69 +msgid "Pale green" +msgstr "Verde pálido" + +#: wp-includes/js/tinymce/langs/wp-langs.php:68 +msgid "Light yellow" +msgstr "Amarillo claro" + +#: wp-includes/js/tinymce/langs/wp-langs.php:46 +msgid "Teal" +msgstr "Turquesa" + +#: wp-includes/js/tinymce/langs/wp-langs.php:70 +msgid "Pale cyan" +msgstr "Cian pálido" + +#: wp-includes/js/tinymce/langs/wp-langs.php:48 +msgid "Grayish blue" +msgstr "Azul grisáceo" + +#: wp-includes/class-http.php:146 +msgid "Destination directory for file streaming does not exist or is not writable." +msgstr "La carpeta de destino para cargar el archivo no existe o no tiene permisos de escritura." + +#: wp-includes/class-http.php:248 +msgid "There are no HTTP transports available which can complete the requested request." +msgstr "No hay medios de transporte HTTP disponibles que puedan completar la solicitud requerida." + +#: wp-includes/taxonomy.php:92 wp-includes/taxonomy.php:93 +#: wp-admin/edit-form-advanced.php:106 +msgctxt "post format" +msgid "Format" +msgstr "Formato" + +#: wp-content/plugins/akismet/admin.php:444 +msgid "Akismet has protected your site from %2$s spam comment already. " +msgid_plural "Akismet has protected your site from %2$s spam comments already. " +msgstr[0] "Akismet ha protegido su sitio de %2$s comentario de spam hasta ahora." +msgstr[1] "Akismet ha protegido su sitio de %2$s comentarios de spam hasta ahora." + +#: wp-content/plugins/akismet/admin.php:454 +msgid "There's %1$s comment in your spam queue right now." +msgid_plural "There are %1$s comments in your spam queue right now." +msgstr[0] "Hay %1$s comentario en la cola de spam en este momento." +msgstr[1] "Hay %1$s comentarios en la cola de spam en este momento." + +#: wp-admin/includes/class-wp-list-table.php:526 +msgctxt "paging" +msgid "%1$s of %2$s" +msgstr "%1$s de %2$s" + +#: wp-content/plugins/akismet/admin.php:450 +msgid "Akismet blocks spam from getting to your blog. " +msgstr "Akismet bloquea el spam que llegue a tu sitio." + +#: wp-admin/user-edit.php:216 wp-admin/user-edit.php:217 +msgid "Show Admin Bar" +msgstr "Mostrar la barra de administración" + +#: wp-admin/user-edit.php:220 +msgid "when viewing site" +msgstr "cuando se esté viendo el sitio" + +#: wp-content/plugins/akismet/admin.php:139 +msgid "Sign up success! Please check your email for your Akismet API Key and enter it below." +msgstr "¡Regístro completado! Por favor, consulta en tu correo electrónico tu clave de API de Akismet y añádela debajo." + +#: wp-admin/user-edit.php:223 +msgid "in dashboard" +msgstr "en el escritorio" + +#: wp-content/plugins/akismet/admin.php:325 +msgid "Flagged as spam by Akismet" +msgstr "Marcado como spam por Akismet" + +#: wp-content/plugins/akismet/widget.php:89 +msgid "" +msgid_plural "" +msgstr[0] "" +msgstr[1] "" + +#: wp-content/plugins/akismet/widget.php:15 +msgid "%1$s%2$s%3$s %4$sspam comment%5$s %6$sblocked by%7$s
    %8$sAkismet%9$s" +msgid_plural "%1$s%2$s%3$s %4$sspam comments%5$s %6$sblocked by%7$s
    %8$sAkismet%9$s" +msgstr[0] "%1$s%2$s%3$s %4$scomentario de spam%5$s %6$sbloqueado por%7$s
    %8$sAkismet%9$s" +msgstr[1] "%1$s%2$s%3$s %4$scomentarios de spam%5$s %6$sbloqueados por%7$s
    %8$sAkismet%9$s" + +#: wp-content/plugins/akismet/admin.php:342 +msgid "History" +msgstr "Historial" + +#: wp-content/plugins/akismet/admin.php:275 +msgctxt "comments" +msgid "Spam" +msgstr "Spam" + +#: wp-content/plugins/akismet/admin.php:460 +msgid "There's nothing in your spam queue at the moment." +msgstr "En este momento no tienes nada en la cola de spam. " + +#: wp-content/plugins/akismet/admin.php:327 +msgid "Cleared by Akismet" +msgstr "Borrado por Akismet" + +#: wp-admin/includes/internal-linking.php:77 +msgid "Enter the destination URL" +msgstr "Introduce la URL de destino" + +#: wp-admin/includes/file.php:65 +msgid "%s Page Template" +msgstr "%s Plantilla de Página" + +#: wp-admin/includes/internal-linking.php:89 +msgid "Or link to existing content" +msgstr "O enlaza a contenido ya existente" + +#: wp-admin/press-this.php:503 +msgid "Post Format:" +msgstr "Formato de entrada:" + +#: wp-admin/plugins.php:250 +msgid "This plugin may be active on other sites in the network." +msgid_plural "These plugins may be active on other sites in the network." +msgstr[0] "Este plugin puede estar activado para otros sitios de la red." +msgstr[1] "Estos plugins pueden estar activos para otros sitios de la red." + +#: wp-admin/plugins.php:345 +msgid "You cannot delete a plugin while it is active on the main site." +msgstr "No puedes borrar un plugin si está activado para el sitio principal." + +#: wp-admin/options-writing.php:65 +msgid "Default Post Format" +msgstr "Formato de entrada por defecto" + +#: wp-admin/update-core.php:18 wp-admin/update-core.php:448 +#: wp-admin/update-core.php:477 +msgid "You do not have sufficient permissions to update this site." +msgstr "No tienes los permisos adecuados para actualizar este sitio." + +#: wp-admin/users.php:365 wp-admin/user-edit.php:178 +msgctxt "user" +msgid "Add Existing" +msgstr "Añadir usuario existente" + +#: wp-admin/user-new.php:191 +msgctxt "user" +msgid "Add New User" +msgstr "Añadir nuevo usuario " + +#: wp-admin/user-new.php:343 +msgid "Add New User " +msgstr "Añadir nuevo usuario" + +#: wp-admin/user-new.php:258 +msgid "Add Existing User " +msgstr "Añadir usuario existente" + +#: wp-admin/plugin-editor.php:120 wp-admin/theme-editor.php:30 +msgid "Any edits to files from this screen will be reflected on all sites in the network." +msgstr "Cualquier modificación de los archivos se verá reflejada en todos los sitios de la red." + +#: wp-admin/user-new.php:193 +msgctxt "user" +msgid "Add Existing User" +msgstr "Añadir usuario existente" + +#: wp-includes/query.php:146 wp-includes/query.php:167 +#: wp-includes/query.php:187 wp-includes/query.php:211 +#: wp-includes/query.php:235 wp-includes/query.php:259 +#: wp-includes/query.php:288 wp-includes/query.php:308 +#: wp-includes/query.php:328 wp-includes/query.php:348 +#: wp-includes/query.php:369 wp-includes/query.php:389 +#: wp-includes/query.php:419 wp-includes/query.php:448 +#: wp-includes/query.php:468 wp-includes/query.php:495 +#: wp-includes/query.php:515 wp-includes/query.php:535 +#: wp-includes/query.php:555 wp-includes/query.php:575 +#: wp-includes/query.php:604 wp-includes/query.php:631 +#: wp-includes/query.php:651 wp-includes/query.php:671 +#: wp-includes/query.php:691 wp-includes/query.php:711 +msgid "Conditional query tags do not work before the query is run. Before then, they always return false." +msgstr "Las etiquetas de las consultas condicionales no funcionan antes de ejecutar la consulta. Haciéndolo antes, siempre devuelven falso." + +#: wp-admin/nav-menus.php:454 +msgid "To create a new custom menu, click on the + tab, give the menu a name, and click Create Menu. Next, add menu items from the appropriate boxes. You’ll be able to edit the information for each menu item, and can drag and drop to put them in order. You can also drag a menu item a little to the right to make it a submenu, to create menus with hierarchy. Drop the item into its new nested placement when the dotted rectangle target shifts over, also a little to the right. Don’t forget to click Save when you’re finished." +msgstr "Si quieres crear un nuevo menú personalizado, pulsa la pestaña +, ponle un nombre y haz clic en Crear menú. A continuación, añade al menú los elementos en las cajas correspondientes. Podrás editar la información de cada elemento del menú, y arrastrar y soltar para ponerlas en el orden que quieras. También puedes arrastrar el menú un poco a la derecha para hacerlo submenú, es decir, para crear menús jerárquicos. Suelta en la parte derecha el elemento en éste nuevo lugar anidado cuando aparezca el rectángulo con línea de puntos. No te olvides hacer clic en Guardar cuando hayas terminado." + +#: wp-admin/tools.php:15 +msgid "Press This is a bookmarklet that makes it easy to blog about something you come across on the web. You can use it to just grab a link, or to post an excerpt. Press This will even allow you to choose from images included on the page and use them in your post. Just drag the Press This link on this screen to your bookmarks bar in your browser, and you’ll be on your way to easier content creation. Clicking on it while on another website opens a popup window with all these options." +msgstr "" +"Publicar esto es un marcador de enlaces que hace fácil bloguear sobre algo con lo que te hayas topado en la web. Puedes usarlo para guardar un enlace, para publicar un resumen del mismo. Publicar esto te permite elegir de entre las imágenes de esa página cuál se utilizará para tu entrada. \n" +"Sólo tienes que arrastrar el enlace de Publicar esto de esta pantalla a la barra de enlaces favoritos de tu navegador y tendrás la forma más fácil de crear contenido. Haciendo clic en él mientras estés visitando cualquier sitio web se abre una ventana emergente con las opciones mencionadas. " + +#: wp-admin/plugin-editor.php:123 +msgid "Documentation on Writing Plugins" +msgstr "Documentación sobre cómo escribir plugins" + +#: wp-admin/index.php:38 +msgid "The boxes on your Dashboard screen are:" +msgstr "Las cajas en tu Escritorio son:" + +#: wp-admin/users.php:24 +msgid "This screen lists all the existing users for your site. Each user has one of five defined roles as set by the site admin: Site Administrator, Editor, Author, Contributor, or Subscriber. Users with roles other than Administrator will see fewer options in the dashboard navigation when they are logged in, based on their role." +msgstr "Esta pantalla muestra todos los usuarios existentes para tu sitio. Cada usuario dispone de uno de los cinco perfiles definidos según lo establecido por el administrador del sitio: Administrador del sitio, editor, autor, colaborador o suscriptor. Los usuarios con perfiles que no sean de administrador verán menos opciones en el panel de navegación cuando se hayan identificado, en base a su perfil." + +#: wp-admin/options-permalink.php:27 +msgid "Documentation on Using Permalinks" +msgstr "Documentación sobre el uso de enlaces permanentes" + +#: wp-admin/plugin-editor.php:119 +msgid "If you want to make changes but don’t want them to be overwritten when the plugin is updated, you may be ready to think about writing your own plugin. For information on how to edit plugins, write your own from scratch, or just better understand their anatomy, check out the links below." +msgstr "Si quieres hacer cambios pero no quieres que se sobreescriban cuando se actualice el plugin, deberías pensar en escribir tu propio plugin. Para obtener información acerca de cómo editar plugins, escribir desde cero el tuyo, o simplemente entender mejor su anatomía, echa un vistazo a los enlaces de aquí abajo." + +#: wp-admin/users.php:29 +msgid "Descriptions of Roles and Capabilities" +msgstr "Descripción de los perfiles y capacidades" + +#: wp-admin/export.php:42 +msgid "You can export a file of your site’s content in order to import it into another installation or platform. The export file will be an XML file format called WXR. Posts, pages, comments, custom fields, categories, and tags can be included. You can choose for the WXR file to include only certain posts or pages by setting the dropdown filters to limit the export by category, author, date range by month, or publishing status." +msgstr "Puedes exportar el contenido de tu sitio’s a un archivo para ser importado en otra instalación o plataforma. El archivo de importación es un archivo XML llamado WXR. Entradas, páginas, comentarios, campos personalizados, categorías y etiquetas se incluirán en él. Puedes elegir sólo algunas entradas o páginas, basta con limitar la exportación a determinadas categorías, autor, rango de fechas por meses o estatus de publicación en los filtros de descarte." + +#: wp-admin/edit-tags.php:184 +msgid "You can delete link categories in the Bulk Action pulldown, but that action does not delete the links within the category. Instead, it moves them to the default link category." +msgstr "Puedes borrar categorías de enlaces con la opción del desplegable Acciones en lote, pero eso no borrará los enlaces de la categoría. En su lugar, lo que hace en enviarlas a la categoría de enlaces por defecto." + +#: wp-admin/includes/upgrade.php:266 +msgid "sample-page" +msgstr "pagina-ejemplo" + +#: wp-admin/includes/upgrade.php:264 +msgid "Sample Page" +msgstr "Página de ejemplo" + +#: wp-includes/functions.php:3501 +msgid "%1$s was called incorrectly. %2$s %3$s" +msgstr "%1$s se llamó incorrectamente. %2$s %3$s" + +#: wp-includes/functions.php:3500 +msgid "(This message was added in version %s.)" +msgstr "(Este mensaje se añadió en la versión %s.)" + +#: wp-admin/options-discussion.php:216 +msgid "Retro (Generated)" +msgstr "Retro (generado)" + +#: wp-admin/includes/class-wp-themes-list-table.php:71 +msgid "You only have one theme enabled for this site right now. Visit the Network Admin to enable or install more themes." +msgstr "Sólo tienes un tema activado para este sitio. Ve a la administración de la red para activar or instalar más temas." + +#: wp-admin/includes/class-wp-themes-list-table.php:75 +msgid "You only have one theme enabled for this site right now. Visit the Network Admin to enable more themes." +msgstr "Sólo tienes un tema activado para este sitio. Ve a la administración de la red para activar más temas." + +#: wp-admin/includes/upgrade.php:246 +msgid "" +"This is an example page. It's different from a blog post because it will stay in one place and will show up in your site navigation (in most themes). Most people start with an About page that introduces them to potential site visitors. It might say something like this:\n" +"\n" +"
    Hi there! I'm a bike messenger by day, aspiring actor by night, and this is my blog. I live in Los Angeles, have a great dog named Jack, and I like piña coladas. (And gettin' caught in the rain.)
    \n" +"\n" +"...or something like this:\n" +"\n" +"
    The XYZ Doohickey Company was founded in 1971, and has been providing quality doohickies to the public ever since. Located in Gotham City, XYZ employs over 2,000 people and does all kinds of awesome things for the Gotham community.
    \n" +"\n" +"As a new WordPress user, you should go to your dashboard to delete this page and create new pages for your content. Have fun!" +msgstr "" +"Esta es una página de ejemplo, Es diferente a una entrada de un blog porque se mantiene estática y, en la mayoría de temas, se mostrará en la barra de navegación. Casi todo el mundo comienza con una página Sobre mí para presentarse a los potenciales visitantes. Puede decir algo así:\n" +"\n" +"
    ¡Hola!: Soy físico durante el día, lector de manga por las noches y este es mi blog. Vivo en Albacete y tengo un gato llamado Alex. Me encantan los mojitos (y mirar a la gente corriendo en los parques)
    \n" +"\n" +"O algo así:\n" +"\n" +"
    La empresa Calcetines XYC se fundó en 1973, y ha estado produciendo calcetines de calidad para sus clientes desde entonces. Se encuentra en Vetusta, tiene unos 2.000 empleados e intenta ayudar en lo que puede para mejorar la vida en Vestusta
    \n" +"\n" +"Deberías ir a tu escritorio, borrar esta página y crear algunas nuevas con tu contenido. ¡A divertirse!" + +#: wp-includes/user.php:111 +msgid "ERROR: The password you entered for the username %1$s is incorrect. Lost your password?" +msgstr "ERROR: La contraseña que introdujo para el usuario %1$s no es correcta. Has perdido tu contraseña?" + +#: wp-includes/class-wp-xmlrpc-server.php:3380 +msgid "Sorry, you cannot publish this post." +msgstr "Perdona, pero no puedes publicar esta entrada." + +#: wp-content/plugins/akismet/admin.php:27 +msgid "Comment History" +msgstr "Historial de comentarios" + +#: wp-content/plugins/akismet/admin.php:221 +msgid "Click here to confirm that Akismet.com is up." +msgstr "Haz click aquí para confirmar que Akismet.com está funcionando." + +#: wp-content/plugins/akismet/admin.php:14 +msgid "Akismet %s requires WordPress 3.0 or higher." +msgstr "Akismet %s necesita WordPress 3.0 o superior para funcionar." + +#: wp-content/plugins/akismet/admin.php:354 +msgid "%s approved" +msgid_plural "%s approved" +msgstr[0] "%s aprobado" +msgstr[1] "%s aprobados" + +#: wp-content/plugins/akismet/admin.php:521 +msgid "%s reported this comment as not spam" +msgstr "%s no considera este comentario como spam" + +#: wp-content/plugins/akismet/akismet.php:266 +msgid "Akismet caught this comment as spam" +msgstr "Akismet considera que este comentario es spam" + +#: wp-content/plugins/akismet/admin.php:570 +msgid "%s reported this comment as spam" +msgstr "%s considera que este comentario es spam" + +#: wp-content/plugins/akismet/akismet.php:459 +msgid "Akismet caught this comment as spam during an automatic retry." +msgstr "Akismet ha realizado una revisión auntomática y considera que este comentario es spam" + +#: wp-content/plugins/akismet/admin.php:211 +msgid "Re-trying" +msgstr "Intentándolo de nuevo" + +#: wp-content/plugins/akismet/admin.php:157 +msgid "Auto-delete spam submitted on posts more than a month old." +msgstr "Autoborrado de spam realizado para entradas con más de un mes de antiguedad." + +#: wp-content/plugins/akismet/admin.php:130 +msgid "Your WordPress home URL %s is invalid. Please fix the home option." +msgstr "La URL de la página de inicio de tu WordPress %s no es válida. Por favor, arregla la opción de página de inicio." + +#: wp-content/plugins/akismet/admin.php:158 +msgid "Show the number of comments you've approved beside each comment author." +msgstr "Mostrar el número de comentarios que has aprobado junto al autor de cada comentario." + +#: wp-content/plugins/akismet/admin.php:615 +msgid "%s changed the comment status to %s" +msgstr "%s cambió el estado del comentario a %s" + +#: wp-content/plugins/akismet/akismet.php:268 +#: wp-content/plugins/akismet/akismet.php:276 +msgid "Comment status was changed to %s" +msgstr "El estado del comentario se cambió a %s" + +#: wp-content/plugins/akismet/akismet.php:461 +msgid "Akismet cleared this comment during an automatic retry." +msgstr "Akismet borró este comentario durante una revisión automática." + +#: wp-content/plugins/akismet/akismet.php:271 +msgid "Akismet cleared this comment" +msgstr "Akismet borró este comentario" + +#: wp-content/plugins/akismet/akismet.php:274 +msgid "Comment was caught by wp_blacklist_check" +msgstr "Comentario pillado por wp_blacklist_check" + +#: wp-content/plugins/akismet/admin.php:302 +msgid "A server or network problem prevented Akismet from checking %d comment. It has been temporarily held for moderation and will be automatically re-checked in %s." +msgid_plural "A server or network problem prevented Akismet from checking %d comments. They have been temporarily held for moderation and will be automatically re-checked in %s." +msgstr[0] "Un problema del servidor o de la red impidió a Akismet revisar el comentario %d. Ha sido temporalmente puesto en moderación y se volverá a revisar en %s." +msgstr[1] "Un problema del servidor o de la red impidió a Akismet revisar los comentarios %d. Han sido temporalmente puestos en moderación y se volverán a revisar en %s." + +#: wp-content/plugins/akismet/admin.php:211 +msgid "Accessible" +msgstr "Accesible" + +#: wp-content/plugins/akismet/akismet.php:281 +msgid "Akismet was unable to check this comment (response: %s), will automatically retry again later." +msgstr "Akismet fue incapaz de revisar este comentario (respuesta: %s), se volverá a intentar más tarde." + +#: wp-admin/user-edit.php:268 +msgid "Super admin privileges cannot be removed because this user has the network admin email." +msgstr "Los privilegios del Super admin no se pueden eliminar porque este usuario tiene el correo electrónico de administrador de la red." + +#: wp-includes/pluggable.php:1102 +msgid "Permalink: %s" +msgstr "Enlace permanente: %s" + +#: wp-admin/includes/class-wp-themes-list-table.php:82 +msgid "You only have one theme installed right now. Live a little! You can choose from over 1,000 free themes in the WordPress.org Theme Directory at any time: just click on the Install Themes tab above." +msgstr "Tienes sólo un tema instalado. ¡Disfruta de la vida! Puedes elegir entre más de 1.000 temas gratuitos en el directorio de temas de WordPress.org cuando quieras: sólo tienes que hacer clic en la pestaña Instalar tema de arriba." + +#: wp-admin/maint/repair.php:81 +msgid "One or more database tables are unavailable. To allow WordPress to attempt to repair these tables, press the “Repair Database” button. Repairing can take a while, so please be patient." +msgstr "Una o más tablas no están disponibles. Para permitir a WordPress que intente repararlas, pulse el botón “Reparar bases de datos”. La reparación puede llevar un rato, ten paciencia, por favor." + +#: wp-admin/includes/file.php:14 +msgid "Visual Editor RTL Stylesheet" +msgstr "Editor visual de estilos RTL" + +#: wp-admin/theme-editor.php:175 +msgid "This child theme inherits templates from a parent theme, %s." +msgstr "Este tema hijo hereda plantillas de un tema padre, %s." + +#: wp-admin/theme-editor.php:242 +msgid "This is a file in your current parent theme." +msgstr "Este es un archivo del tema padre actual." + +#: wp-admin/includes/media.php:1587 +msgid "If you want to use all capabilities of the uploader, like uploading multiple files at once, please update to lighttpd 1.5." +msgstr "Si quieres usar todas las funciones del cargador, como subir varios archivos al mismo tiempo, por favor, actualiza a Lighttpd 1.5" + +#: wp-admin/includes/theme.php:247 +msgid "Updating this theme will lose any customizations you have made. 'Cancel' to stop, 'OK' to update." +msgstr "Al actualizar este tema se perderán todas las personalizaciones que hayas hecho. 'Cancelar' para parar, 'OK' para actualizar." + +#: wp-app.php:715 wp-app.php:752 wp-app.php:804 +msgid "Error occurred while accessing post metadata for file location." +msgstr "Ha ocurrido un error mientras se accedía a los metadatos de la entrada para la localización del archivo." + +#: wp-admin/includes/class-wp-upgrader.php:1086 +msgid "An error occurred while updating %1$s: %2$s." +msgstr "Ha ocurrido un error cuando se actualizaba %1$s: %2$s." + +#: wp-admin/admin-ajax.php:524 wp-admin/admin-ajax.php:1388 +msgid "An error has occurred. Please reload the page and try again." +msgstr "Ha ocurrido un error. Por favor, recarga la página e inténtalo de nuevo." + +#: wp-admin/upgrade.php:93 +msgid "Your WordPress database has been successfully updated!" +msgstr "¡La base de datos de WordPress se ha actualizado con éxito!" + +#: wp-admin/upgrade.php:82 +msgid "Update WordPress Database" +msgstr "Actualizar la base de datos de WordPress" + +#: wp-admin/update-core.php:85 +msgid "You are about to install WordPress %s in English (US). There is a chance this update will break your translation. You may prefer to wait for the localized version to be released." +msgstr "Se va a instalar WordPress %s en inglés (US). Existe la posibilidad de que esta actualización rompa tu traducción. Puede que prefieras esperar a que salga la versión local." + +#: wp-admin/upgrade.php:81 +msgid "The update process may take a little while, so please be patient." +msgstr "La actualización puede tardar un poco, así que sé paciente, por favor." + +#: wp-admin/upgrade.php:49 +msgid "WordPress › Update" +msgstr "Actualización de WordPress" + +#: wp-admin/upgrade.php:92 +msgid "Update Complete" +msgstr "Actualización completada" + +#: wp-admin/update-core.php:411 +msgid "To update themes or plugins from this screen, use the checkboxes to make your selection and click on the appropriate Update button. Check the box at the top of the Themes or Plugins section to select all and update them all at once." +msgstr "Para actualizar temas o plugins en esta pantalla usa las casillas de verificación para hacer tu selección y haz clic en el botón de actualizar correspondiente. Marca la casilla superior en la sección de temas o plugins para seleccionarlas todas y actualizarlas de una vez." + +#: wp-admin/upgrade.php:79 +msgid "Database Update Required" +msgstr "Es necesaria una actualización de la base de datos" + +#: wp-admin/upgrade.php:80 +msgid "WordPress has been updated! Before we send you on your way, we have to update your database to the newest version." +msgstr "¡WordPress se ha actualizado! Antes de continuar, tenemos que actualizar tu base de datos a la última versión." + +#: wp-admin/upgrade.php:60 +msgid "No Update Required" +msgstr "No es necesaria la actualización" + +#: wp-includes/functions.php:2672 +msgid "Your attempt to update this plugin: “%s” has failed." +msgstr "Su intento de actualizar este plugin: \"%s\" ha fallado." + +#: wp-admin/includes/class-wp-upgrader.php:377 +msgid "Plugin updated successfully." +msgstr "El plugin se ha actualizado con éxito." + +#: wp-admin/includes/class-wp-upgrader.php:1383 wp-admin/update.php:154 +msgid "Update Theme" +msgstr "Actualizar tema" + +#: wp-admin/includes/update.php:207 wp-admin/includes/update.php:282 +msgid "There is a new version of %1$s available. View version %4$s details or update automatically." +msgstr "Hay una versión nueva de %1$s disponible. Ver los detalles de la versión %4$s o actualizar automáticamente." + +#: wp-admin/includes/theme.php:253 +msgid "There is a new version of %1$s available. View version %3$s details. Automatic update is unavailable for this theme." +msgstr "Hay una nueva versión de %1$s disponible. Ver detalles de la versión %3$s. La actualización automática no está disponible para este tema." + +#: wp-admin/includes/class-wp-plugins-list-table.php:233 +msgid "Update Available (%s)" +msgid_plural "Update Available (%s)" +msgstr[0] "(%s) actualización disponible" +msgstr[1] "(%s) actualizaciones disponibles" + +#: wp-admin/includes/class-wp-upgrader.php:376 +msgid "Plugin update failed." +msgstr "Actualización de plugin fallida." + +#: wp-admin/includes/class-wp-upgrader.php:615 +msgid "Theme update failed." +msgstr "Actualización del tema fallida." + +#: wp-admin/includes/class-wp-upgrader.php:616 +msgid "Theme updated successfully." +msgstr "Tema actualizado correctamente." + +#: wp-admin/includes/theme.php:255 +msgid "There is a new version of %1$s available. View version %3$s details or update automatically." +msgstr "Hay una nueva versión de %1$s disponible. Ver detalles de la versión %3$s o actualizar automáticamente." + +#: wp-admin/includes/class-wp-upgrader.php:1026 wp-admin/update.php:54 +msgid "Update Plugin" +msgstr "Actualizar plugin" + +#: wp-admin/includes/update.php:205 wp-admin/includes/update.php:280 +msgid "There is a new version of %1$s available. View version %4$s details. Automatic update is unavailable for this plugin." +msgstr "Hay una nueva versión de %1$s disponible. Ver detalles de la versión %4$s. La actualización automática no está disponible para este plugin." + +#: wp-admin/includes/class-wp-upgrader.php:370 +#: wp-admin/includes/class-wp-upgrader.php:610 +#: wp-admin/includes/class-wp-upgrader.php:863 +msgid "Update package not available." +msgstr "Paquete de actualización no disponible." + +#: wp-includes/post.php:5128 +msgctxt "Post format" +msgid "Standard" +msgstr "Estándar" + +#: wp-admin/options-writing.php:68 wp-admin/includes/meta-boxes.php:256 +#: wp-admin/press-this.php:505 +msgid "Standard" +msgstr "Estándar" + +#: wp-includes/post.php:934 +msgid "Post types cannot exceed 20 characters in length" +msgstr "Los tipos de entradas no pueden exceder de 20 caracteres de longitud" + +#: wp-admin/export.php:145 wp-admin/export.php:177 +msgid "Date range:" +msgstr "Rango de fechas:" + +#: wp-admin/export.php:129 +msgid "This will contain all of your posts, pages, comments, custom fields, terms, navigation menus and custom posts." +msgstr "Esto contendrá todas tus entradas, páginas, comentarios, campos personalizados, menús de navegación y entradas personalizadas." + +#: wp-admin/export.php:125 +msgid "Choose what to export" +msgstr "Elige qué exportar" + +#: wp-admin/export.php:123 +msgid "Once you’ve saved the download file, you can use the Import function in another WordPress installation to import this site." +msgstr "Una vez que hayas guardado el archivo de descarga, puedes utilizar la función importar en otra instalación de WordPress para importar este sitio." + +#: wp-admin/export.php:138 wp-admin/export.php:170 +msgid "Authors:" +msgstr "Autores:" + +#: wp-admin/export.php:128 +msgid "All content" +msgstr "Todo el contenido" + +#: wp-includes/script-loader.php:335 +msgid "Add new Tag" +msgstr "Añadir nueva etiqueta" + +#: wp-includes/admin-bar.php:266 +msgctxt "admin bar menu group label" +msgid "Add New" +msgstr "Añadir nueva" + +#: wp-admin/includes/file.php:309 wp-admin/includes/file.php:429 +msgid "Sorry, this file type is not permitted for security reasons." +msgstr "Perdona, por razones de seguridad, este tipo de archivos no está permitido." + +#: wp-admin/options-media.php:84 wp-admin/options-media.php:85 +msgid "When possible, embed the media content from a URL directly onto the page. For example: links to Flickr and YouTube." +msgstr "Siempre que sea posible, incrusta el contenido multimedia pegando la URL directamente en la página. Por ejemplo: pegando los enlaces de Flickr y YouTube. " + +#: wp-includes/post.php:5137 +msgctxt "Post format" +msgid "Audio" +msgstr "Audio" + +#: wp-admin/user-new.php:22 +msgid "" +"Hi,\n" +"You've been invited to join '%1$s' at\n" +"%2$s as a %3$s.\n" +"If you do not want to join this site please ignore\n" +"this email. This invitation will expire in a few days.\n" +"\n" +"Please click the following link to activate your user account:\n" +"%%s" +msgstr "" +"Hola,\n" +"Has sido invitado a unirte a '%1$s' en\n" +"%2$s como %3$s.\n" +"Si no quieres unirte a este sitio, por favor ignora este correo electrónico\n" +"Esta invitación caducará en unos días.\n" +"\n" +"Por favor, haga click en el siguiente enlace para activar su cuenta de usuario:\n" +"%%s" + +#: wp-includes/class-wp-xmlrpc-server.php:2234 +#: wp-includes/class-wp-xmlrpc-server.php:2539 +msgid "Invalid post format" +msgstr "Formato de entrada no válido" + +#: wp-admin/admin-header.php:24 +msgid "%1$s — WordPress" +msgstr "%1$s — WordPress" + +#: wp-admin/admin-header.php:118 +msgid "%s Global Dashboard" +msgstr "%s Escritorio global" + +#: wp-admin/admin-header.php:116 +msgid "%s Network Admin" +msgstr "%s Administrador de la red" + +#: wp-admin/user-edit.php:212 +msgid "More information" +msgstr "Más información" + +#: wp-includes/pluggable.php:1077 wp-includes/pluggable.php:1190 +msgid "Whois : http://whois.arin.net/rest/ip/%s" +msgstr "Whois : http://whois.arin.net/rest/ip/%s" + +#: wp-admin/includes/internal-linking.php:85 +msgid "Open link in a new window/tab" +msgstr "Abrir enlace en una nueva ventana/pestaña" + +#: wp-admin/includes/internal-linking.php:105 +msgid "No search term specified. Showing recent items." +msgstr "" +"No se ha indicado ningún término de búsqueda. Se mostrarán\n" +" los objetos más recientes." + +#: wp-admin/includes/class-wp-comments-list-table.php:258 +msgctxt "column name" +msgid "In Response To" +msgstr "En respuesta a" + +#: wp-admin/includes/class-wp-comments-list-table.php:354 +msgid "Submitted on %2$s at %3$s" +msgstr "Enviado el %2$s a las %3$s" + +#: wp-includes/plugin.php:676 +msgid "Only a static class method or function can be used in an uninstall hook." +msgstr "Sólo una función o método de la clase estática pueden ser usados en un gancho de desinstalación." + +#: wp-admin/edit-comments.php:122 +msgid "Documentation on Comment Spam" +msgstr "Documentación sobre los comentarios de spam" + +#: wp-admin/edit-comments.php:123 +msgid "Documentation on Keyboard Shortcuts" +msgstr "Documentación sobre atajos de teclado" + +#: wp-admin/widgets.php:38 +msgid "The Available Widgets section contains all the widgets you can choose from. Once you drag a widget into a sidebar, it will open to allow you to configure its settings. When you are happy with the widget settings, click the Save button and the widget will go live on your site. If you click Delete, it will remove the widget." +msgstr "La sección de widgets disponibles contiene todos los widgets que puedes elegir. Cuando arrastres el widget al lateral, se abrirá para que puedas configurar sus opciones. Cuando las tengas a tu gusto, haz clic en botón de guardar y el widget se pondrá a funcionar en tu sitio. Si pulsas borrar, se quitará el widget." + +#: wp-admin/media.php:74 +msgid "Remember to click Update Media to save metadata entered or changed." +msgstr "Recuerda hacer clic en Actualizar archivos multimedia para guardar los metadatos que hayas introducido o cambiado." + +#: wp-admin/media.php:73 +msgid "Note that you crop the image by clicking on it (the Crop icon is already selected) and dragging the cropping frame to select the desired part. Then click Save to retain the cropping." +msgstr "Se recorta la imagen haciendo clic en la misma (el icono de recorte ya estará seleccionado) y arrastrando el marcho de recorte hasta donde se desee. Para fijarla, haz clic en guardar." + +#: wp-admin/media.php:72 +msgid "For images only, you can click on Edit Image under the thumbnail to expand out an inline image editor with icons for cropping, rotating, or flipping the image as well as for undoing and redoing. The boxes on the right give you more options for scaling the image, for cropping it, and for cropping the thumbnail in a different way than you crop the original image. You can click on Help in those boxes to get more information." +msgstr "(Sólo para imágenes) Puedes hacer clic en editar imágenes, debajo de la miniatura, para obtener el menú de edición de imágenes y recortar, rotar o invertir la imagen, así como deshacer y rehacer. Las cajas de la derecha te dan más opciones para escalar y recortar la imagen; y para recortar la miniatura de forma diferente de la imagen original. Puedes hacer clic en la ayuda en esas cajas para obtener más información." + +#: wp-admin/media.php:71 +msgid "This screen allows you to edit five fields for metadata in a file within the media library." +msgstr "Esta pantalla te permite editar cinco campos para metadatos de un archivo en la biblioteca multimedia." + +#: wp-admin/user-new.php:175 +msgid "The requested user does not exist." +msgstr "El usuario solicitado no existe" + +#: wp-admin/user-new.php:228 +msgid "Enter the email address of an existing user on this network to invite them to this site. That person will be sent an email asking them to confirm the invite." +msgstr "Escribe el correo electrónico de un usuario de esta red para invitarlo a este sitio. A esa persona se le enviará uno correo electrónico para que confirme la invitación." + +#: wp-admin/user-new.php:232 +msgid "E-mail or Username" +msgstr "Correo electrónico o nombre usuario" + +#: wp-admin/user-new.php:226 +msgid "Add Existing User" +msgstr "Añadir usuario ya existente" + +#: wp-admin/user-new.php:178 +msgid "Please enter a valid email address." +msgstr "Por favor, escribe un correo electrónico válido." + +#: wp-admin/user-new.php:267 +msgid "Create a brand new user and add it to this site." +msgstr "Crear un nuevo usuario y añadirlo a este sitio." + +#: wp-admin/user-new.php:231 +msgid "Enter the email address or username of an existing user on this network to invite them to this site. That person will be sent an email asking them to confirm the invite." +msgstr "Escribe el correo electrónico o el nombre de usuario de un miembro de esta red para invitarlo a este sitio. A esa persona se le enviará uno correo electrónico para que confirme la invitación." + +#: wp-includes/post.php:2312 +msgid "Passing an integer number of posts is deprecated. Pass an array of arguments instead." +msgstr "Pasar un número entero de entradas es obsoleto. Pasa una matriz de argumentos en su lugar." + +#: wp-admin/admin-header.php:26 +msgid "%1$s ‹ %2$s — WordPress" +msgstr "%1$s ‹ %2$s — WordPress" + +#: wp-includes/post.php:5129 +msgctxt "Post format" +msgid "Aside" +msgstr "Minientrada" + +#: wp-includes/post.php:5130 +msgctxt "Post format" +msgid "Chat" +msgstr "Chat" + +#: wp-includes/post.php:5131 +msgctxt "Post format" +msgid "Gallery" +msgstr "Galería" + +#: wp-includes/post.php:5132 +msgctxt "Post format" +msgid "Link" +msgstr "Enlace" + +#: wp-includes/post.php:5133 +msgctxt "Post format" +msgid "Image" +msgstr "Imagen" + +#: wp-includes/post.php:5134 +msgctxt "Post format" +msgid "Quote" +msgstr "Cita" + +#: wp-includes/post.php:5135 +msgctxt "Post format" +msgid "Status" +msgstr "Estado" + +#: wp-includes/post.php:5136 +msgctxt "Post format" +msgid "Video" +msgstr "Vídeo" + +#: wp-admin/user-new.php:254 wp-admin/user-new.php:338 +msgid "Add the user without sending them a confirmation email." +msgstr "Añadir el usuario sin enviarle un email de confirmación." + +#: wp-includes/post.php:1186 +msgid "No pages found in Trash." +msgstr "Ninguna página encontrada en la papelera." + +#: wp-includes/post.php:1185 +msgid "No pages found." +msgstr "No se encontraron páginas." + +#: wp-includes/post.php:1186 +msgid "No posts found in Trash." +msgstr "Ningún post encontrado en la papelera." + +#: wp-includes/admin-bar.php:165 +msgid "Shortlink" +msgstr "Enlace corto" + +#: wp-admin/maint/repair.php:83 +msgid "WordPress can automatically look for some common database problems and repair them. Repairing can take a while, so please be patient." +msgstr "WordPress puede revisar automáticamente algunos problemas habituales de bases de datos. Repararlos puede llevar un rato, ten paciencia, por favor." + +#: wp-includes/class-wp-xmlrpc-server.php:1581 +msgid "Invalid attachment ID." +msgstr "ID de adjunto no válido." + +#: wp-includes/class-wp-xmlrpc-server.php:1640 +msgid "Sorry, you cannot upload files." +msgstr "Perdona, pero no puedes subir archivos." + +#: wp-includes/registration-functions.php:7 wp-includes/registration.php:7 +msgid "This file no longer needs to be included." +msgstr "Ya no es necesario incluir este archivo." + +#: wp-admin/update-core.php:276 +msgid "Please Note: Any customizations you have made to theme files will be lost. Please consider using child themes for modifications." +msgstr "Atención: Se perderá cualquier personalización que hayas hecho a los archivos del tema. Por favor, considere el uso de temas hijos para mantener cambios." + +#: wp-admin/includes/class-wp-posts-list-table.php:178 +msgctxt "posts" +msgid "Sticky (%s)" +msgid_plural "Sticky (%s)" +msgstr[0] "(%s) fija" +msgstr[1] "(%s) fijas" + +#: wp-login.php:402 +msgid "Please enter your username or email address. You will receive a link to create a new password via email." +msgstr "Por favor, escribe tu nombre de usuario o tu correo electrónico. Recibirás un enlace para crear la contraseña nueva por correo electrónico." + +#: wp-admin/update-core.php:139 +msgid "Please select one or more plugins to update." +msgstr "Por favor, elige uno o más plugins a actualizar." + +#: wp-admin/update-core.php:137 +msgid "Please select one or more themes to update." +msgstr "Por favor, elige uno o más temas para actualizarlos." + +#: wp-admin/update-core.php:145 +msgid "Last checked on %1$s at %2$s." +msgstr "Última revisión el %1$s a las %2$s." + +#: wp-admin/update-core.php:146 +msgid "Check Again" +msgstr "Comprobar de nuevo" + +#: wp-includes/default-widgets.php:264 wp-includes/default-widgets.php:493 +msgid "Display as dropdown" +msgstr "Mostrar como desplegable" + +#: wp-includes/class-wp-xmlrpc-server.php:371 +msgid "Large size image height" +msgstr "Altura de la imagen de tamaño grande" + +#: wp-includes/class-wp-xmlrpc-server.php:356 +msgid "Medium size image width" +msgstr "Achura de la imagen de tamaño medio" + +#: wp-includes/class-wp-xmlrpc-server.php:361 +msgid "Medium size image height" +msgstr "Altura de la imagen de tamaño medio" + +#: wp-includes/class-wp-xmlrpc-server.php:366 +msgid "Large size image width" +msgstr "Tamaño grande de la imagen" + +#: wp-includes/class-wp-xmlrpc-server.php:351 +msgid "Crop thumbnail to exact dimensions" +msgstr "Recortar la miniatura a sus dimensiones exactas" + +#: wp-includes/class-wp-xmlrpc-server.php:346 +msgid "Thumbnail Height" +msgstr "Altura de la miniatura" + +#: wp-includes/class-wp-xmlrpc-server.php:341 +msgid "Thumbnail Width" +msgstr "Anchura de la miniatura" + +#: wp-admin/includes/class-wp-upgrader.php:1085 +msgid "The update process is starting. This process may take a while on some hosts, so please be patient." +msgstr "El proceso de actualización ha empezado. Puede llevar un rato en algunos servidores, ten paciencia, por favor." + +#: wp-includes/script-loader.php:282 +msgid "No matches found." +msgstr "No se han encontrado coincidencias." + +#: wp-login.php:459 +msgid "New password" +msgstr "Nueva contraseña" + +#: wp-login.php:463 +msgid "Confirm new password" +msgstr "Confirma la nueva contraseña" + +#: wp-login.php:218 +msgid "To reset your password, visit the following address:" +msgstr "Para restaurar la contraseña, visita la siguiente dirección:" + +#: wp-login.php:452 wp-login.php:471 +msgid "Reset Password" +msgstr "Restaurar contraseña" + +#: wp-login.php:441 +msgid "The passwords do not match." +msgstr "Las contraseñas no coinciden." + +#: wp-login.php:444 +msgid "Password Reset" +msgstr "Contraseña restaurada" + +#: wp-login.php:444 +msgid "Your password has been reset." +msgstr "Tu contraseña ha sido restaurada." + +#: wp-login.php:214 +msgid "Someone requested that the password be reset for the following account:" +msgstr "Alguien ha solicitado que sea restaurada la contraseña de la siguiente cuenta:" + +#: wp-login.php:217 +msgid "If this was a mistake, just ignore this email and nothing will happen." +msgstr "Si ha sido un error, ignora este correo y no pasará nada." + +#: wp-login.php:452 +msgid "Enter your new password below." +msgstr "Introduce tu nueva contraseña abajo." + +#: wp-includes/post.php:538 +msgid "Invalid post" +msgstr "Entrada no válida" + +#: wp-admin/admin-header.php:19 +msgid "Global Dashboard" +msgstr "Escritorio global" + +#: wp-includes/admin-bar.php:91 +msgid "Edit My Profile" +msgstr "Editar mi perfil" + +#: wp-includes/admin-bar.php:142 +msgid "Manage Comments" +msgstr "Gestionar comentarios" + +#: wp-admin/options-general.php:246 +msgid "Documentation on date and time formatting." +msgstr "Documentación sobre formatos de fecha y hora." + +#: wp-admin/includes/user.php:376 +msgid "You’re using the auto-generated password for your account. Would you like to change it to something easier to remember?" +msgstr "Estás utilizando la contraseña generada automáticamente para tu cuenta. ¿Quieres cambiarla por otra más fácil de recordar?" + +#: wp-admin/themes.php:157 +msgid "Theme filters" +msgstr "Filtros de temas" + +#: wp-admin/themes.php:183 +msgid "Apply Filters" +msgstr "Aplicar filtros" + +#: wp-admin/themes.php:185 +msgid "Close filters" +msgstr "Cerrar filtros" + +#: wp-admin/includes/theme.php:316 +msgid "RTL Language Support" +msgstr "Soporte del lenguaje RTL" + +#: wp-includes/admin-bar.php:133 wp-admin/includes/theme.php:303 +msgid "Blavatar" +msgstr "Blavatar" + +#: wp-admin/includes/theme.php:285 +msgid "Light " +msgstr "Brillante" + +#: wp-admin/includes/theme.php:304 +msgid "BuddyPress" +msgstr "BuddyPress" + +#: wp-admin/includes/theme.php:309 +msgid "Editor Style" +msgstr "Estilo del editor" + +#: wp-admin/includes/theme.php:312 +msgid "Front Page Posting" +msgstr "Escritura en la página principal" + +#: wp-admin/includes/theme.php:320 +msgid "Translation Ready" +msgstr "Traducción lista" + +#: wp-content/plugins/akismet/admin.php:342 +#: wp-content/plugins/akismet/admin.php:349 +msgid "View comment history" +msgstr "Ver histórico de comentarios" + +#: wp-content/plugins/akismet/admin.php:381 +msgid "Akismet" +msgstr "Akismet" + +#: wp-content/plugins/akismet/admin.php:688 +msgid "Akismet was unable to re-check this comment (response: %s)" +msgstr "Akismet ha sido incapaz de revisar de nuevo el comentario (respuesta: %s)" + +#: wp-content/plugins/akismet/admin.php:331 +msgid "Flagged as spam by %s" +msgstr "Marcado como spam por %s" + +#: wp-content/plugins/akismet/admin.php:680 +msgid "Akismet re-checked and caught this comment as spam" +msgstr "Akismet ha revisado de nuevo el comentario y lo considera spam" + +#: wp-content/plugins/akismet/admin.php:14 +msgid "Please upgrade WordPress to a current version, or downgrade to version 2.4 of the Akismet plugin." +msgstr "Por favor, actualiza WordPress a la versión actual, o vuelve a la version 2.4 el plugin de Akismet" + +#: wp-content/plugins/akismet/admin.php:333 +msgid "Un-spammed by %s" +msgstr "Desmarcado como spam por %s" + +#: wp-content/plugins/akismet/admin.php:684 +msgid "Akismet re-checked and cleared this comment" +msgstr "Akismet revisó de nuevo este comentario y lo ha marcado como bueno" + +#: wp-admin/themes.php:92 +msgid "Options:" +msgstr "Opciones:" + +#: wp-admin/comment.php:64 +msgid "You are not allowed to edit this comment." +msgstr "No tienes permiso para editar este comentario." + +#: wp-admin/includes/file.php:985 +msgid "To perform the requested action, WordPress needs to access your web server." +msgstr "Para realizar la operación que has solicitado WordPress necesita tener acceso a tu servidor web." + +#: wp-includes/query.php:1945 +msgid "\"caller_get_posts\" is deprecated. Use \"ignore_sticky_posts\" instead." +msgstr "\"caller_get_posts\" está obsoleto. Utilice \"ignore_sticky_posts\" en su lugar." + +#: wp-includes/taxonomy.php:70 +msgid "New Link Category Name" +msgstr "Nuevo nombre de categoría de enlaces" + +#: wp-includes/taxonomy.php:69 +msgid "Add New Link Category" +msgstr "Añadir nueva categoría de enlaces" + +#: wp-includes/taxonomy.php:68 +msgid "Update Link Category" +msgstr "Actualizar categoría de enlaces" + +#: wp-includes/taxonomy.php:66 +msgid "All Link Categories" +msgstr "Todas las categorías de enlaces" + +#: wp-includes/taxonomy.php:64 +msgid "Search Link Categories" +msgstr "Buscar categorías de enlaces" + +#: wp-includes/taxonomy.php:63 +msgid "Link Category" +msgstr "Categoría de enlaces" + +#: wp-admin/includes/class-wp-list-table.php:519 +msgid "Current page" +msgstr "Página actual" + +#: wp-admin/includes/class-wp-list-table.php:510 +msgid "Go to the previous page" +msgstr "Ir a la página anterior" + +#: wp-admin/includes/class-wp-themes-list-table.php:65 +#: wp-admin/includes/class-wp-list-table.php:187 +msgid "No items found." +msgstr "No se ha encontrado nada." + +#: wp-admin/includes/class-wp-list-table.php:530 +msgid "Go to the next page" +msgstr "Ir a la página siguiente" + +#: wp-admin/includes/class-wp-list-table.php:537 +msgid "Go to the last page" +msgstr "Ir a la última página" + +#: wp-admin/admin-ajax.php:231 wp-admin/includes/class-wp-list-table.php:485 +#: wp-admin/includes/class-wp-list-table.php:884 +msgid "1 item" +msgid_plural "%s items" +msgstr[0] "1 elemento" +msgstr[1] "%s elementos" + +#: wp-admin/includes/class-wp-users-list-table.php:79 +msgid "No matching users were found." +msgstr "No se han encontrado usuarios que se ajusten a lo que buscas." + +#: wp-admin/includes/class-wp-theme-install-list-table.php:109 +msgid "No themes match your request." +msgstr "Ningún tema se ajusta a lo que buscas." + +#: wp-admin/includes/class-wp-list-table.php:503 +msgid "Go to the first page" +msgstr "Ir a la primera página" + +#: wp-admin/includes/dashboard.php:471 +msgid "Search Sites" +msgstr "Buscar sitios" + +#: wp-admin/includes/dashboard.php:437 +msgid "Create a New User" +msgstr "Crear un nuevo usuario" + +#: wp-admin/includes/dashboard.php:445 +msgid "You have %1$s and %2$s." +msgstr "Tienes %1$s y %2$s." + +#: wp-admin/includes/dashboard.php:443 +msgid "%s site" +msgid_plural "%s sites" +msgstr[0] "%s sitio" +msgstr[1] "%s sitios" + +#: wp-admin/includes/dashboard.php:442 +msgid "%s user" +msgid_plural "%s users" +msgstr[0] "%s usuario" +msgstr[1] "%s usuarios" + +#: wp-admin/admin-header.php:17 wp-admin/admin-header.php:160 +msgid "Network Admin" +msgstr "Administrador de la red" + +#: wp-admin/update-core.php:155 +msgid "Important: before updating, please back up your database and files. For help with updates, visit the Updating WordPress Codex page." +msgstr "Importante: antes de la actualización, por favor, realiza un respaldo de la base de datos y ficheros. Si necesitas ayuda para la actualización, visita la página del Codex: Actualización de WordPress." + +#: wp-admin/includes/dashboard.php:89 +msgid "http://wordpress.org/news/" +msgstr "http://wordpress.org/news/" + +#: wp-admin/includes/dashboard.php:90 +msgid "http://wordpress.org/news/feed/" +msgstr "http://wordpress.org/news/feed/" + +#: wp-includes/wp-db.php:742 +msgid "" +"

    Can’t select database

    \n" +"

    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.

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

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

    " +msgstr "" +"

    No se pudo elegir base de datos

    \n" +"

    Hemos podido conectar con el servidor de la bases de datos (lo que significa que tu nombre de usuario y la contraseña están correctos) pero no se pudo elegir la base de datos %1$s.

    \n" +"
      \n" +"
    • ¿Estás seguro que existe?
    • \n" +"
    • ¿El usuario %2$s tiene permiso para utilizar la base de datos %1$?
    • \n" +"
    • En algunos sistemas el nombre de la base de datos es el prefijo con el nombre de usuario, que sería como username_%1$s. ¿Podría ser ésto el problema?
    • \n" +"
    \n" +"

    Si no sabes cómo configurar una base de datos debes ponerte en contacto con el administrador de su hosting. Si todo lo demás falla puedes encontrar ayuda en los Foros de Soporte de WordPress.

    " + +#: wp-admin/options-discussion.php:63 +msgid "(Signup has been disabled. Only members of this site can comment.)" +msgstr "(El registro ha sido deshabilitado. Sólo los miembros de este sitio pueden comentar.)" + +#: wp-admin/update-core.php:52 +msgid "You can update to WordPress %2$s automatically or download the package and install it manually:" +msgstr "Puedes actualizar a WordPress %2$s automáticamente o descargar el paquete e instalarlo manualmente:" + +#: wp-admin/user-new.php:146 +msgid "New users will receive an email letting them know they’ve been added as a user for your site. By default, this email will also contain their password. Uncheck the box if you don’t want the password to be included in the welcome email." +msgstr "Los usuarios nuevos recibirán un correo electrónico haciéndoles saber que han sido añadidos como usuarios de tu sitio. De forma predeterminada, este correo electrónico también contendrá su contraseña. Desmarca la casilla si no quieres que la contraseña se incluya en el correo electrónico de bienvenida." + +#: wp-admin/includes/media.php:2211 +msgid "Link text, e.g. “Lucy on YouTube”" +msgstr "Texto del enlace, p.e. “Lucy en YouTube”" + +#: wp-admin/includes/theme.php:251 +msgid "There is a new version of %1$s available. View version %3$s details." +msgstr "Hay una nueva versión de %1$s disponible. Ver detalles de la versión %3$s." + +#: wp-admin/includes/update.php:203 wp-admin/includes/update.php:278 +msgid "There is a new version of %1$s available. View version %4$s details." +msgstr "Hay una nueva versión de %1$s disponible. Ver detalles de la versión %4$s. " + +#: wp-admin/includes/class-wp-upgrader.php:1233 +msgid "Go to themes page" +msgstr "Ir a la página de temas" + +#: wp-admin/edit.php:221 +msgid "Item moved to the Trash." +msgid_plural "%s items moved to the Trash." +msgstr[0] "Movido a la papelera" +msgstr[1] "%s movidos a la papelera." + +#: wp-admin/includes/class-wp-upgrader.php:1046 +#: wp-admin/includes/class-wp-upgrader.php:1201 +msgid "Go to plugins page" +msgstr "Ir a la página de plugins" + +#: wp-admin/includes/class-wp-upgrader.php:1202 +#: wp-admin/includes/class-wp-upgrader.php:1234 +msgid "Go to WordPress Updates page" +msgstr "Ir a la página de actualizaciones de WordPress" + +#: wp-admin/import.php:139 +msgid "If the importer you need is not listed, search the plugins directory to see if an importer is available." +msgstr "Si el importador que necesitas no está en la lista, busca en el directorio de plugins para ver si está disponible." + +#: wp-content/plugins/akismet/widget.php:43 +msgid "Spam Blocked" +msgstr "Spam bloqueado" + +#: wp-admin/includes/nav-menu.php:77 +msgid "%s (Pending)" +msgstr "%s (Pendiente)" + +#: wp-admin/includes/nav-menu.php:1115 +msgid "Click Save Menu to make pending menu items public." +msgstr "Haz click en Guardar menú para hacer públicos los elementos de menú pendientes." + +#: wp-content/plugins/akismet/admin.php:290 +msgid "You must enter your Akismet API key for it to work." +msgstr "Debes introducir tu clave de API de Akismet para que funcione." + +#: wp-content/plugins/akismet/admin.php:144 +msgid "For many people, Akismet will greatly reduce or even completely eliminate the comment and trackback spam you get on your site. If one does happen to get through, simply mark it as \"spam\" on the moderation screen and Akismet will learn from the mistakes. If you don't have an API key yet, you can get one at Akismet.com." +msgstr "En la mayoría de los casos, Akismet reduce enormemente (o incluso elimina) el spam en los comentarios y trackbacks de tu sitio. Si se cuela alguno simplemente debes marcar como spam en la pantalla de moderación y Akismet aprenderá de sus errores. SI todavía no tienes una clave de API puedes obtener una en Akismet.com." + +#: wp-content/plugins/akismet/admin.php:146 +msgid "Akismet API Key" +msgstr "Clave de API de Akismet" + +#: wp-content/plugins/akismet/admin.php:150 +msgid "What is this?" +msgstr "¿Qué es esto?" + +#: wp-includes/load.php:112 +msgid "Your server is running PHP version %1$s but WordPress %2$s requires at least %3$s." +msgstr "Tu servidor está ejecutando la versión %1$s de PHP, pero WordPess %2$s necesita, al menos, la versión %3$s." + +#: wp-admin/includes/dashboard.php:435 +msgid "Create a New Site" +msgstr "Crear nuevo sitio" + +#: wp-admin/plugins.php:319 +msgctxt "plugins per page (screen options)" +msgid "Plugins" +msgstr "Plugins" + +#: wp-admin/upload.php:140 +msgctxt "items per page (screen options)" +msgid "Media items" +msgstr "Elementos multimedia" + +#: wp-admin/edit-comments.php:112 +msgctxt "comments per page (screen options)" +msgid "Comments" +msgstr "Comentarios" + +#: wp-admin/users.php:20 +msgctxt "users per page (screen options)" +msgid "Users" +msgstr "Usuarios" + +#: wp-admin/custom-header.php:505 +msgid "Images of exactly %1$d × %2$d pixels will be used as-is." +msgstr "Las imágenes de exactamente %1$d x %2$d pixels se utilizarán tal cual." + +#: wp-admin/theme-install.php:46 +msgid "Documentation on Adding New Themes" +msgstr "Documentación sobre Añadir nuevos temas" + +#: wp-admin/custom-header.php:701 +msgid "Crop and Publish" +msgstr "Recortar y publicar" + +#: wp-admin/custom-header.php:104 +msgid "Some themes come with additional header images bundled. If you see multiple images displayed, select the one you’d like and click the Save Changes button." +msgstr "Algunos temas llevan incluidas imágenes de cabecera adicionales. Si ves que se muestran varias imágenes elige la que te guste y haz clic en el botón Guardar cambios." + +#: wp-includes/pluggable.php:1171 +msgid "A new trackback on the post \"%s\" is waiting for your approval" +msgstr "Un nuevo trackback a la entrada \"%s\" está esperando tu aprobación" + +#: wp-admin/theme-editor.php:28 +msgid "Upgrading to a newer version of the same theme will override changes made here. To avoid this, consider creating a child theme instead." +msgstr "Si actualizas a una versión más reciente del mismo tema sobreescribirá los cambios realizados aquí. Para evitar esto plantéate crear un tema hijo (child theme) en su lugar." + +#: wp-admin/plugins.php:323 +msgid "You can find additional plugins for your site by using the Plugin Browser/Installer functionality or by browsing the WordPress Plugin Directory directly and installing new plugins manually. To manually install a plugin you generally just need to upload the plugin file into your /wp-content/plugins directory. Once a plugin has been installed, you can activate it here." +msgstr "Puedes encontrar plugins adicionales para tu sitio usando la funcionalidad Instalador/navegador de plugins o navegando por el directorio de plugins de WordPress directamente e instalando manualmente nuevos plugins. Para instalar manualmente un plugin normalmente necesitarás subir el fichero del plugin a tu directorio /wp-content/plugins. Una vez se haya instalado el plugin puedes activarlo aquí." + +#: wp-admin/edit-link-form.php:45 +msgid "XFN stands for XHTML Friends Network, which is optional. WordPress allows the generation of XFN attributes to show how you are related to the authors/owners of the site to which you are linking." +msgstr "XFN se refiere a red de amigos XHTML (XHTML Friends Network), y es opcional. WordPress permite generar atributos XFN que muestran tu relación con los autores/propietarios del sitio al que estés enlazando." + +#: wp-admin/plugins.php:327 +msgid "Documentation on Managing Plugins" +msgstr "Documentación sobre cómo gestionar plugins" + +#: wp-admin/theme-editor.php:35 +msgid "Documentation on Template Tags" +msgstr "Documentación sobre etiquetas de plantilla" + +#: wp-admin/theme-editor.php:34 +msgid "Documentation on Editing Files" +msgstr "Documentación sobre cómo editar archivos" + +#: wp-admin/themes.php:46 wp-admin/theme-editor.php:33 +msgid "Documentation on Using Themes" +msgstr "Documentación sobre el uso de temas" + +#: wp-admin/theme-editor.php:32 +msgid "Documentation on Theme Development" +msgstr "Documentación sobre el desarrollo de temas" + +#: wp-admin/includes/file.php:995 +msgid "FTP Password" +msgstr "Contraseña FTP" + +#: wp-admin/includes/file.php:994 +msgid "FTP Username" +msgstr "Usuario FTP" + +#: wp-admin/includes/file.php:991 +msgid "FTP/SSH Password" +msgstr "Contraseña FTP/SSH" + +#: wp-admin/includes/file.php:990 +msgid "FTP/SSH Username" +msgstr "Usuario FTP/SSH" + +#: wp-admin/index.php:45 +msgid "Other WordPress News - Shows the feed from WordPress Planet. You can configure it to show a different feed of your choosing." +msgstr "Otras noticias sobre WordPress - Muestra el feed de WordPress Planet. Puedes configurarlo para que muestre un feed diferente, a tu elección." + +#: wp-admin/options-reading.php:46 +msgid "You can choose what’s displayed on the front page of your site. It can be posts in reverse chronological order (classic blog), or a fixed/static page. To set a static home page, you first need to create two Pages. One will become the front page, and the other will be where your posts are displayed." +msgstr "Puedes elegir lo que se muestra en la página principal de tu sitio. Pueden ser entradas en orden cronológico inverso (blog clásico) o una página fija/estática. Para definir una página de inicio estática primero tienes que crear dos páginas. Una será la página principal y la otra donde se mostrarán tus entradas." + +#: wp-admin/options-permalink.php:23 +msgid "The Optional fields let you customize the “category” and “tag” base names that will appear in archive URLs. For example, the page listing all posts in the “Uncategorized” category could be /topics/uncategorized instead of /category/uncategorized." +msgstr "Los campos opcionales te permiten personalizar los nombres base de “categoría” y “etiqueta” que aparecerán en las URLs del archivo. Por ejemplo, la página con el listado de todas las entradas de la categoría “Sin categoría” podrían ser como /temas/sin-categoria en vez de /category/sin-categoria." + +#: wp-admin/themes.php:208 +msgid "The following themes are installed but incomplete. Themes must have a stylesheet and a template." +msgstr "Los siguientes temas están instalados pero incompletos. Los temas deben tener una hoja de estilos y una plantilla." + +#: wp-admin/index.php:46 +msgid "Plugins - Features the most popular, newest, and recently updated plugins from the WordPress.org Plugin Directory." +msgstr "Plugins - Muestra los plugins más populares, más nuevos y los recientemente actualizados del directorio de plugins de WordPress.org." + +#: wp-admin/options-permalink.php:21 +msgid "When you assign multiple categories or tags to a post, only one can show up in the permalink: the lowest numbered category. This applies if your custom structure includes %category% or %tag%." +msgstr "Cuando asignas varias categorías o etiquetas a una entrada sólo se puede mostrar una en el enlace permanente: la categoría con el número más bajo. Esto es así si tu estructura personalizada contiene %category% o %tag%." + +#: wp-admin/options-permalink.php:20 +msgid "If you pick an option other than Default, your general URL path with structure tags, terms surrounded by %, will also appear in the custom structure field and your path can be further modified there." +msgstr "Si eliges una opción distinta de la que está por defecto tu ruta general de URL con etiquetas de estructura, los términos rodeados por %, también aparecerán en el campo de estructura personalizada y podrás cambiar aquí tu ruta en otro momento." + +#: wp-admin/widgets.php:42 +msgid "Many themes show some sidebar widgets by default until you edit your sidebars, but they are not automatically displayed in your sidebar management tool. After you make your first widget change, you can re-add the default widgets by adding them from the Available Widgets area." +msgstr "Muchos temas muestran varios widgets de barra lateral por defecto hasta que editas tus barras laterales, pero no se muestran automáticamente en tu herramienta de gestión de barras laterales. Una vez hagas tu primer cambio en un widget puedes volver a añadirlo desde el área de widgets disponibles." + +#: wp-admin/includes/class-wp-themes-list-table.php:188 +msgid "The template files are located in %2$s. The stylesheet files are located in %3$s. %4$s uses templates from %5$s. Changes made to the templates will affect both themes." +msgstr "Los archivos de la plantilla están situados en %2$s. Los archivos de la hoja de estilos están situados en %3$s. %4$s utiliza plantillas de %5$s. Los cambios que se hagan a las plantillas afectarán a ambos temas." + +#: wp-admin/widgets.php:39 +msgid "If you want to remove the widget but save its setting for possible future use, just drag it into the Inactive Widgets area. You can add them back anytime from there. This is especially helpful when you switch to a theme with fewer or different widget areas." +msgstr "Si quieres quitar el widget, pero también guardar los ajustes por si los necesitaras en el futuro, simplemente arrástralo al área de widgets inactivos. Puedes añadirlos de nuevo en cualquier otro momento desde ahí. Esto es especialmente útil cuando cambias a un tema con pocas o distintas áreas de widgets." + +#: wp-admin/users.php:26 +msgid "To add a new user for your site, click the Add New button at the top of the screen or Add New in the Users menu section." +msgstr "Para añadir un usuario nuevo a tu sitio haz clic en el botón Añadir nuevo en la parte superior de la pantalla o en la sección Añadir nuevo del menú Usuarios." + +#: wp-admin/options-media.php:19 +msgid "You can set maximum sizes for images inserted into your written content; you can also insert an image as Full Size." +msgstr "Puedes establecer los tamaños máximos para las imágenes insertadas en tu contenido; también puedes insertar una imagen a tamaño completo." + +#: wp-admin/plugin-install.php:41 +msgid "If you know what you’re looking for, Search is your best bet. The Search screen has options to search the WordPress.org Plugin Directory for a particular Term, Author, or Tag. You can also search the directory by selecting a popular tags. Tags in larger type mean more plugins have been labeled with that tag." +msgstr "Si ya sabes lo que estás buscando la Búsqueda es tu mejor apuesta. La pantalla Buscar tiene opciones para buscar en el directorio de de plugins de WordPress.org un término concreto, por autor o por etiquetas. También puedes buscar en el directorio eligiendo entre las etiquetas populares. Las etiquetas de mayor tamaño significan que hay más plugins etiquetados con esa etiqueta." + +#: wp-admin/media-upload.php:67 +msgid "There are two options for uploading files: Select Files will open the Flash-based uploader (multiple file upload allowed), or you can use the Browser Uploader. Clicking Select Files opens a navigation window showing you files in your operating system. Selecting Open after clicking on the file you want activates a progress bar on the uploader screen. Basic image editing is available after upload is complete. Make sure you click Save before leaving this screen." +msgstr "Hay dos opciones para subir archivos: Elegir archivos abrirá el cargador basado en Flash (permite subir varios archivos), o puedes usar el Cargador del navegador. Haciendo clic en Elegir archivos, se abre una ventana de navegación que muestra los archivos de tu sistema operativo. Eligiendo Abrir, después de hacer clic en el archivo que quieres, activa una barra de progreso en la pantalla del cargador. Hay disponible una edición básica de imágenes después de que la subida esté completa. Asegúrate de hacer clic en Guardar antes de salir de esta pantalla." + +#: wp-admin/options-media.php:20 +msgid "The Embed option allows you embed a video, image, or other media content into your content automatically by typing the URL (of the web page where the file lives) on its own line when you create your content." +msgstr "La opción de Incrustar te permite incrustar un vídeo, imagen u otro contenido multimedia automáticamente en tu contenido tecleando la URL (de la página web donde está el archivo) en su propia línea cuando creas tu contenido." + +#: wp-admin/options-general.php:63 +msgid "Most themes display the site title at the top of every page, in the title bar of the browser, and as the identifying name for syndicated feeds. The tagline is also displayed by many themes." +msgstr "La mayoría de los temas muestran el título del sitio en la parte superior de cada página, en la barra de título del navegador, y como nombre identificativo para los feeds. La descripción corta también se muestra en muchos temas." + +#: wp-admin/edit-form-advanced.php:185 +msgid "Order - Pages are usually ordered alphabetically, but you can choose your own order by entering a number (1 for first, etc.) in this field." +msgstr "Orden - Normalmente las páginas se ordenan alfabéticamente, pero puedes elegir tu propio orden introduciendo un número (1 para la primera, etc) en este campo." + +#: wp-admin/includes/file.php:989 +msgid "Please enter your FTP or SSH credentials to proceed." +msgstr "Por favor, introduce tus datos de acceso FTP o SSH para proceder." + +#: wp-admin/includes/file.php:993 +msgid "Please enter your FTP credentials to proceed." +msgstr "Por favor, introduce tus datos de acceso FTP para proceder." + +#: wp-admin/includes/file.php:999 +msgid "If you do not remember your credentials, you should contact your web host." +msgstr "Si no recuerdas tus datos de acceso deberías contactar con tu proveedor de alojamiento." + +#: wp-admin/upload.php:143 +msgid "All the files you’ve uploaded are listed in the Media Library, with the most recent uploads listed first. You can use the Screen Options tab to customize the display of this screen." +msgstr "Todos los archivos que has subido están listados en la Librería multimedia, con las subidas más recientes listadas al principio. Puedes usar la pestaña Opciones de pantalla para personalizar cómo se muestra esta pantalla. " + +#: wp-admin/theme-install.php:44 +msgid "You can Upload a theme manually if you have already downloaded its ZIP archive onto your computer (make sure it is from a trusted and original source). You can also do it the old-fashioned way and copy a downloaded theme’s folder via FTP into your /wp-content/themes directory." +msgstr "Pudes subir manualmente un tema si ya has descargado su archivo ZIP en tu ordenador (asegúrate de que sea de una fuente fiable y original). También puedes hacerlo al viejo estilo y copiar un tema descargado a través de FTP en tu directorio /wp-content/themes." + +#: wp-admin/user-edit.php:41 +msgid "Your profile contains information about you (your “account”) as well as some personal options related to using WordPress." +msgstr "Tu perfil contiene infomación sobre ti (tu “cuenta”) así como algunas opciones personales relacionadas con el uso de WordPress." + +#: wp-admin/edit-form-advanced.php:181 wp-admin/edit.php:174 +msgid "Pages are similar to Posts in that they have a title, body text, and associated metadata, but they are different in that they are not part of the chronological blog stream, kind of like permanent posts. Pages are not categorized or tagged, but can have a hierarchy. You can nest Pages under other Pages by making one the “Parent” of the other, creating a group of Pages." +msgstr "Las páginas son similares a las entradas y tienen título, cuerpo de texto y metadatos asociados, pero son diferentes en que no forman parte de la secuencia cronológica tipo blog, son una especie de entradas permanentes. Las páginas no tienen categorías ni etiquetas, pero pueden tener una jerarquía. Puedes anidar páginas bajo otras páginas haciendo a una “Superior” de otra, creando así un grupo de páginas." + +#: wp-admin/edit-comments.php:118 +msgid "In the In Response To column, there are three elements. The text is the name of the post that inspired the comment, and links to the post editor for that entry. The “#” permalink symbol below leads to that post on your live site. The small bubble with the number in it shows how many comments that post has received. If the bubble is gray, you have moderated all comments for that post. If it is blue, there are pending comments. Clicking the bubble will filter the comments screen to show only comments on that post." +msgstr "En la columna En respuesta a hay tres elementos. El texto es el nombre de la entrada que inspiró el comentario, y está enlazado al editor de entradas de esa entrada. El enlace permanente del símbolo “#” lleva a esa entrada en tu sitio. La pequeña burbuja con número muestra cuántos comentarios ha recibido esa entrada. Si la burbuja es gris es que ya has moderado todos los comentarios de esa entrada. Si es azul es que hay comentarios pendientes. Haciendo clic en la burbuja se filtra la pantalla de comentarios para que muestre sólo los comentarios de esa entrada." + +#: wp-admin/edit-form-advanced.php:173 +msgid "Send Trackbacks - Trackbacks are a way to notify legacy blog systems that you’ve linked to them. Enter the URL(s) you want to send trackbacks. If you link to other WordPress sites they’ll be notified automatically using pingbacks, and this field is unnecessary." +msgstr "Enviar trackbacks - Los trackbacks son un modo de avisar a los sistemas antiguos de blogs que les has enlazado. Introduce la(s) URL(s) a la(s) que quieres enviar trackbacks. Si enlazas a otro sitio creado con WordPress recibirán aviso automáticamente por medio de los pingbacks, y este campo no sería necesario." + +#: wp-admin/options-permalink.php:22 +msgid "Note that permalinks beginning with the category, tag, author or postname structure tags require more advanced server resources. Double-check your hosting details to make sure those are in place or start your permalinks with other structure tags." +msgstr "Date cuenta de que los enlaces permanentes con etiquetas estructurales que llaman a categoría, etiqueta, autor o nombre de la entrada requieren recursos de servidor más avanzados. Revisa de nuevo los detalles del alojamiento para asegurarte de que que están en su lugar o empieza tus enlaces permanentes con otras etiquetas estructurales." + +#: wp-admin/index.php:34 +msgid "Welcome to your WordPress Dashboard! You will find helpful tips in the Help tab of each screen to assist you as you get to know the application." +msgstr "Bienvenido a tu escritorio de WordPress. Encontrarás consejos en la pestaña Ayuda de cada pantalla que te ayudarán a conocer la aplicación." + +#: wp-admin/upload.php:145 +msgid "Hovering over a row reveals action links: Edit, Delete Permanently, and View. Clicking Edit or on the media file’s name displays a simple screen to edit that individual file’s metadata. Clicking Delete Permanently will delete the file from the media library (as well as from any posts to which it is currently attached). View will take you to the display page for that file." +msgstr "Pasando por encima de la fila revela los enlaces de acción: Editar, Eliminar permanentemente, y Ver. Haciendo clic sobre Editar o sobre el nombre del archivo multimedia mostrará una pantalla simple para poder editar metadatos. Haciendo click en Eliminar permanentemente eliminará el archivo de la librería multimedia (como de las entradas que la estén usando). Ver te llevará a la pantalla de visualizado para el archivo." + +#: wp-admin/user-new.php:142 +msgid "Contributors can write and manage their posts but not publish posts or upload media files." +msgstr "Los Colaboradores pueden escribir y gestionar sus entradas, pero no pueden publicar entradas o subir archivos multimedia." + +#: wp-admin/user-new.php:141 +msgid "Authors can publish and manage their own posts." +msgstr "Los Autores pueden publicar y gestionar sus entradas." + +#: wp-admin/user-new.php:139 +msgid "Administrators have access to all the administration features." +msgstr "Los Administradores tienen acceso a todas las funciones de administración." + +#: wp-admin/plugin-editor.php:118 +msgid "The Documentation menu below the editor lists the PHP functions recognized in the plugin file. Clicking Lookup takes you to a web page about that particular function." +msgstr "El menú Documentación bajo el editor enumera las funciones PHP reconocidas en los archivos del plugin. Haciendo clic en Buscar te lleva a una página que habla de esa función en particular." + +#: wp-admin/plugin-editor.php:116 +msgid "You can use the editor to make changes to any of your plugins’ individual PHP files. Be aware that if you make changes, plugins updates will overwrite your customizations." +msgstr "Puedes usar el editor para realizar cambios a cualquier archivo php de tus plugins. Cuidado si realizas cambios, la actualización de los plugins producirá que tus modificaciones sean sobrescritas y se pierdan." + +#: wp-admin/link-manager.php:44 +msgid "You can add links here to be displayed on your site, usually using Widgets. By default, links to several sites in the WordPress community are included as examples." +msgstr "Aquí puedes añadir enlaces a mostrar en tu sitio, generalmente usando Widgets. Por defecto, los enlaces son a varios sitios de la comunidad de WordPress. Son incluidos como ejemplo." + +#: wp-admin/link-manager.php:47 +msgid "If you delete a link, it will be removed permanently, as Links do not have a Trash function yet." +msgstr "Si eliminas un enlace, será eliminado de forma permanente. Aún no existe una Papelera para los enlaces." + +#: wp-admin/update-core.php:410 +msgid "Updating your WordPress installation is a simple one-click procedure; just click on the Update button when it says a new version is available." +msgstr "Actualizar tu instalación de Wordpress es un proceso tan simple como realizar un solo clic; simplemente haz clic en el botón Actualizar cuando te muestre el mensaje de que hay una nueva actualización." + +#: wp-admin/custom-background.php:86 +msgid "Don’t forget to click on the Save Changes button when you are finished." +msgstr "No olvides hacer clic en el botón Guardar cambios cuando acabes." + +#: wp-admin/custom-header.php:103 +msgid "If you want to discard your custom header and go back to the default included in your theme, click on the buttons to remove the custom image and restore the original header image." +msgstr "Si quieres descartar tu cabecera personalizada y volver a las por defecto de tu tema, haz clic en la parte inferior para eliminar la imagen personalizada y restaurar la imagen original." + +#: wp-admin/custom-background.php:84 +msgid "To use a background image, simply upload it, then choose your display options below. You can display a single instance of your image, or tile it to fill the screen. You can have your background fixed in place, so your site content moves on top of it, or you can have it scroll with your site." +msgstr "Para usar una imagen de fondo, simplemente súbela y después selecciona las opciones de visualización. Puedes mostrar la imagen una sola vez o ponerla en mosaico para que rellene la pantalla. Puedes fijar tu fondo, tu sitio pasará por encima de ella o puedes hacer que se mueva con tu sitio (cuando subas o bajes la barra del navegador)." + +#: wp-admin/custom-background.php:83 +msgid "You can customize the look of your site without touching any of your theme’s code by using a custom background. Your background can be an image or a color." +msgstr "Puedes personalizar la imagen de tu sitio sin tocar nada del código del tema usando un fondo personalizado. Tu fondo puede ser una imagen o un color." + +#: wp-admin/custom-background.php:85 +msgid "You can also choose a background color. If you know the hexadecimal code for the color you want, enter it in the Color field. If not, click on the Select a Color link, and a color picker will allow you to choose the exact shade you want." +msgstr "También puedes elegir un color de fondo. Si sabes el código hexadecimal que quieres introdúcelo en el campo Color. Si no lo sabes, haz click en el enlace de elegir un color y un selector de colores te permitirá escoger el color exacto que quieras." + +#: wp-admin/custom-header.php:102 +msgid "You can set a custom image header for your site. Simply upload the image and crop it, and the new header will go live immediately." +msgstr "Puedes poner una imagen de cabecera personalizada en tu sitio. Simplemente sube una imagen, recórtala/ajústala y la nueva cabecera aparecerá inmediatamente en tu sitio." + +#: wp-admin/edit-tags.php:200 +msgid "Slug - The “slug” is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens." +msgstr "Slug - La “slug ” es la versión amigable de la URL. Normalmente, son todo minúsculas y contiene sólo letras, números y guiones." + +#: wp-admin/edit.php:175 +msgid "Managing Pages is very similar to managing Posts, and the screens can be customized in the same way." +msgstr "Gestionar páginas es muy similar a gestionar entradas y la pantalla se puede personalizar de la misma forma." + +#: wp-admin/edit-form-advanced.php:175 +msgid "You can also create posts with the Press This bookmarklet." +msgstr "También puedes crear entradas con el marcador Publicar esto." + +#: wp-admin/plugins.php:347 +msgid "The plugin generated %d characters of unexpected output during activation. If you notice “headers already sent” messages, problems with syndication feeds or other issues, try deactivating or removing this plugin." +msgstr "El plugin ha generado %d caracteres de salida inesperada durante la activación. Si te sale el mensaje de advertencia “headers already sent” (cabeceras ya enviadas), problemas con las feeds u otros problemas, prueba a desactivar o eliminar este plugin." + +#: wp-admin/users.php:25 +msgid "You can customize the display of information on this screen as you can on other screens, by using the Screen Options tab and the on-screen filters." +msgstr "Puedes personalizar la información de esta pantalla al igual que en las otras, usando la pestaña Opciones de Pantalla y los filtros en pantalla." + +#: wp-admin/user-new.php:147 +msgid "Remember to click the Add User button at the bottom of this screen when you are finished." +msgstr "Acuérdate de hacer clic en el botón Añadir usuario en la parte inferior de la pantalla cuando finalices." + +#: wp-admin/user-edit.php:42 +msgid "You can change your password, turn on keyboard shortcuts, change the color scheme of your WordPress administration screens, and turn off the WYSIWYG (Visual) editor, among other things." +msgstr "Puedes cambiar tu contraseña, activar los atajos de teclado, cambiar el esquema de colores de la pantalla de administración de WordPress y desactivar el editor (visual) WYSIWYG entre de otras cosas." + +#: wp-admin/user-edit.php:43 +msgid "Your username cannot be changed, but you can use other fields to enter your real name or a nickname, and change which name to display on your posts." +msgstr "Tu nombre de usuario no puede cambiarse, pero puedes usar los otros campos para introducir tu nombre real o tu alias y utilizarlo para que se muestre en tus entradas." + +#: wp-admin/user-edit.php:44 +msgid "Required fields are indicated; the rest are optional. Profile information will only be displayed if your theme is set up to do so." +msgstr "Los campos necesarios están marcados. El resto son opcionales. El perfil sólo será mostrado si tu tema está configurado para ello." + +#: wp-admin/user-edit.php:45 +msgid "Remember to click the Update Profile button when you are finished." +msgstr "Recuerda hacer click en el botón actualizar Perfil cuando acabes." + +#: wp-admin/user-new.php:140 +msgid "Editors can publish posts, manage posts as well as manage other people’s posts, etc." +msgstr "Los Editores pueden publicar entradas, gestionar sus entradas y entradas de otras personas, etc." + +#: wp-admin/user-new.php:143 +msgid "Subscribers can read comments/comment/receive newsletters, etc." +msgstr "Los Suscriptores pueden leer comentarios/comentar/recibir noticias, etc." + +#: wp-admin/user-new.php:137 +msgid "To add a new user to your site, fill in the form on this screen. If you’re not sure which role to assign, you can use the link below to review the different roles and their capabilities. Here is a basic overview of roles:" +msgstr "Para añadir un nuevo usuario a tu sitio, rellena el cuestionario siguiente. Si no estás seguro de qué perfil debes asignarle, puedes utilizar el enlace siguiente para ver las diferentes capacidades de los diferentes perfiles. Aquí tienes una breve explicación de los perfiles:" + +#: wp-admin/user-new.php:145 +msgid "You must assign a password to the new user, but don’t worry; when they log in for the first time they will be prompted to change it. The username, however, cannot be changed." +msgstr "Debes asignar una contraseña al nuevo usuario, pero no te preocupes, cuando se identifique por primera vez se le preguntará si quiere cambiarla. El nombre de usuario no se puede cambiar." + +#: wp-admin/custom-background.php:271 +msgid "Background Repeat" +msgstr "Repetir fondo" + +#: wp-admin/comment.php:49 +msgid "You can also moderate the comment from this screen using the Status box, where you can also change the timestamp of the comment." +msgstr "También puedes moderar los comentarios desde esta pantalla usando la caja de estado, donde puedes cambiar el día/hora del comentario." + +#: wp-admin/comment.php:48 +msgid "You can edit the information left in a comment if needed. This is often useful when you notice that a commenter has made a typographical error." +msgstr "Si te es necesario puedes editar la información que falta en un comentario. Esto es muy útil si te advierten que un usuario ha cometido un error tipográfico al realizar un comentario." + +#: wp-admin/custom-background.php:281 +msgid "Background Attachment" +msgstr "Adjunto del fondo" + +#: wp-admin/nav-menus.php:554 +msgid "Automatically add new top-level pages" +msgstr "Añadir automáticamente las páginas de nivel superior" + +#: wp-admin/nav-menus.php:540 +msgid "Enter menu name here" +msgstr "Introduce el nombre del menú aquí." + +#: wp-admin/options-privacy.php:19 +msgid "You can choose whether or not your site will be crawled by robots, ping services, and spiders. If you want those services to ignore your site, click the second option here. Note that your privacy is not complete; your site is still visible on the web." +msgstr "Puedes decidir si tu sitio debe o no ser rastreado por robots, servicios de ping y arañas. Si deseas que todos esos servicios ignoren tu sitio, haz clic en la segunda opción. Atención, tu privacidad no es completa, tu sitio seguirá siendo visible en la web." + +#: wp-admin/options-media.php:21 +msgid "Uploading Options gives you folder and path choices for storing your files in your installation’s directory." +msgstr "Las opciones de subida te dan a escoger en qué directorio y ruta almacenar tus archivos." + +#: wp-admin/options-reading.php:47 +msgid "You can also control the display of your content in RSS feeds, including the maximum numbers of posts to display, whether to show full text or a summary, and the character set encoding." +msgstr "También puedes controlar la forma de mostrar tus contenidos en el canal RSS, incluyendo el número máximo de entradas a mostrar, si mostrar el texto íntegro o una fracción de éste y la codificación de caracteres." + +#: wp-admin/options-permalink.php:19 +msgid "This screen provides some common options for your default permalinks URL structure." +msgstr "Esta pantalla facilita unas opciones comunes para la estructura por defecto de la URL estructural de los enlaces permanentes." + +#: wp-admin/options-general.php:67 +msgid "Remember to click the Save Changes button at the bottom of the screen for new settings to take effect." +msgstr "Recuerda hacer clic en la parte inferior de la pantalla sobre el botón Guardar cambios para que los nuevos ajustes surtan efecto." + +#: wp-admin/options-writing.php:19 +msgid "You can submit content in several different ways; this screen holds the settings for all of them. The top section controls the editor within these administration screens, while the rest control external publishing methods. For more information on any of these methods, use the documentation links below." +msgstr "Puedes enviar contenido de varias formas; en esta pantalla encontrarás los ajustes para todas ellas. La sección superior controla el editor que hay en esta pantalla de administración, mientras que el resto controla métodos externos de publicación. Para más información de cualquiera de estos métodos, usa la documentación que encontrarás en los siguientes enlaces." + +#: wp-admin/options-general.php:66 +msgid "UTC means Coordinated Universal Time." +msgstr "UTC quiere decir Hora universal coordinada (Coordinated Universal Time)" + +#: wp-admin/options-general.php:62 +msgid "The fields on this screen determine some of the basics of your site setup." +msgstr "Los campos en esta pantalla determinan algunas configuraciones básicas de tu sitio." + +#: wp-admin/options-reading.php:45 +msgid "This screen contains the settings that affect the display of your content." +msgstr "Esta pantalla contiene los ajustes que afectarán a cómo se muestran tus contenidos." + +#: wp-admin/options-general.php:65 +msgid "If you want site visitors to be able to register themselves, as opposed to being registered by the site administrator, check the membership box. A default user role can be set for all new users, whether self-registered or registered by the site administrator." +msgstr "Si deseas que los visitantes se puedan registrar en tu sitio, en vez de que el administrador del sitio deba registrarlos, marca la casilla de miembros. Se otorgará un perfil predeterminado a cada nuevo usuario. Da igual que se registren ellos mismos o que les registre el administrador del sitio." + +#: wp-admin/options-discussion.php:20 wp-admin/options-privacy.php:21 +#: wp-admin/options-media.php:22 wp-admin/options-writing.php:20 +#: wp-admin/options-reading.php:48 wp-admin/options-permalink.php:24 +msgid "You must click the Save Changes button at the bottom of the screen for new settings to take effect." +msgstr "Debes hacer clic en el botón Guardar cambios en la parte inferior de la pantalla para que los nuevos ajustes tengan efecto." + +#: wp-admin/options-discussion.php:19 +msgid "This screen provides many options for controlling the management and display of comments and links to your posts/pages. So many, in fact, they won’t all fit here! :) Use the documentation link below to get information on what each discussion setting does." +msgstr "Esta pantalla proporciona muchas opciones para mostrar y gestionar los comentarios y enlaces en tus entradas/páginas. Son muchas, pero no caben todas aquí :) Usa el enlace a la documentación para conseguir más información y saber qué hace cada ajuste." + +#: wp-admin/options-general.php:64 +msgid "The WordPress URL and the Site URL can be the same (example.com) or different; for example, having the WordPress core files (example.com/wordpress) in a subdirectory instead of the root directory." +msgstr "La URL de WordPress y la URL del sitio pueden ser las mismas (ejemplo.com) o diferentes; por ejemplo, puedes tener los archivos del core de WordPress en un subdirectorio (ejemplo.com/wordpress) en vez de en el directorio raíz." + +#: wp-admin/edit-link-form.php:44 +msgid "The boxes for link name, web address, and description have fixed positions, while the others may be repositioned using drag and drop. You can also hide boxes you don’t use in the Screen Options tab, or minimize boxes by clicking on the title bar of the box." +msgstr "Las cajas para el nombre del enlace, dirección web y descripción tienen una posición fija. Las otras las puedes mover y colocar mediante arrastrar y soltar. Puedes esconder cajas que no quieras usar en la pestaña Opciones de pantalla o minimizar las cajas haciendo clic en la barra del título de la caja." + +#: wp-admin/update-core.php:171 +msgid "While your site is being updated, it will be in maintenance mode. As soon as your updates are complete, your site will return to normal." +msgstr "Mientras se actualiza tu sitio, éste permanecerá en modo mantenimiento. Tan pronto como finalice la actualización, tu sitio volverá a estar activo." + +#: wp-admin/update-core.php:191 +msgid "Your plugins are all up to date." +msgstr "Tus plugins están todos actualizados." + +#: wp-admin/update-core.php:151 +msgid "You have the latest version of WordPress." +msgstr "Tienes la última versión de WordPress. No es necesario actualizarla." + +#: wp-admin/update-core.php:267 +msgid "Your themes are all up to date." +msgstr "Tus temas están actualizados." + +#: wp-admin/update-core.php:159 +msgid "An updated version of WordPress is available." +msgstr "Hay disponible una nueva versión actualizada de WordPress." + +#: wp-admin/includes/nav-menu.php:176 +msgid "Original: %s" +msgstr "Original: %s" + +#: wp-admin/plugin-editor.php:138 +msgid "Function Name…" +msgstr "Nombre de la función…" + +#: wp-admin/import.php:113 +msgid "Activate importer" +msgstr "Activar importador" + +#: wp-admin/edit-link-form.php:43 +msgid "You can add or edit links on this screen by entering information in each of the boxes. Only the link’s web address and name (the text you want to display on your site as the link) are required fields." +msgstr "Puede añadir o editar enlaces desde esta pantalla introduciendo la información en cada caja. Sólo son necesarios el enlace a la web y el nombre (el texto que quieres mostrar en el enlace en tu sitio)." + +#: wp-admin/includes/class-wp-upgrader.php:1290 +msgid "Return to Importers" +msgstr "Volver a los importadores" + +#: wp-admin/includes/class-wp-upgrader.php:1280 +msgid "Activate Plugin & Run Importer" +msgstr "Activar plugin y Comenzar Importación" + +#: wp-includes/theme-compat/comments.php:26 +msgid "One Response to %2$s" +msgid_plural "%1$s Responses to %2$s" +msgstr[0] "Una Respuesta a %2$s" +msgstr[1] "%1$s Respuestas a %2$s" + +#: wp-admin/tools.php:52 +msgid "Use this to convert categories to tags or tags to categories." +msgstr "Usa esto para convertir categorías en etiquetas o etiquetas en categorías." + +#: wp-admin/edit-tags.php:277 +msgid "Categories can be selectively converted to tags using the category to tag converter." +msgstr "Las categorías se pueden convertir a voluntad en etiquetas usando el conversor de categorías a etiquetas." + +#: wp-admin/edit-tags.php:282 +msgid "Tags can be selectively converted to categories using the tag to category converter" +msgstr "Las etiquetas se pueden convertir a voluntad a categorías usando el conversor de etiquetas a categorías" + +#: wp-admin/includes/nav-menu.php:733 +msgctxt "nav menu front page title" +msgid "Home: %s" +msgstr "Inicio: %s" + +#: wp-admin/import.php:56 +msgid "ERROR:" +msgstr "ERROR:" + +#: wp-admin/import.php:56 +msgid "The %s importer is invalid or is not installed." +msgstr "El importador %s no es válido o no está instalado." + +#: wp-admin/edit-form-advanced.php:123 +msgid "Page Attributes" +msgstr "Atributos de página" + +#: wp-admin/includes/meta-boxes.php:580 +msgid "Need help? Use the Help tab in the upper right of your screen." +msgstr "¿Necesitas ayuda? Usa la pestaña Ayuda en la parte superior derecha de la pantalla." + +#: wp-admin/tools.php:17 +msgid "Note: Turbo/Gears is no longer promoted on this screen as it was in previous versions due to the fact that Google has discontinued support for it." +msgstr "Nota: Turbo/Gears ya no está disponible en esta pantalla como en versiones anteriores ya que Google ha dejado de darle soporte." + +#: wp-admin/import.php:20 +msgid "This screen lists links to plugins to import data from blogging/content management platforms. Choose the platform you want to import from, and click Install Now when you are prompted in the popup window. If your platform is not listed, click the link to search the plugin directory for other importer plugins to see if there is one for your platform." +msgstr "Esta pantalla lista los enlaces a los plugins de importación de datos de blogs/contenido de diferentes plataformas. Elige la plataforma desde la que quieres importar datos y haz clic en Instalar ahora cuando seas preguntado en la ventana emergente. Si tu plataforma no está en la lista, haz clic en el enlace de buscar en el directorio de plugins para ver si hay uno para tu plataforma." + +#: wp-admin/export.php:43 +msgid "Once generated, your WXR file can be imported by another WordPress site or by another blogging platform able to access this format." +msgstr "Una vez generado, tu archivo WXR puede ser importado por otro sitio WordPress o por otra plataforma de blogs que pueda acceder a este formato." + +#: wp-admin/import.php:21 +msgid "In previous versions of WordPress, all the importers were built-in, but they have been turned into plugins as of version 3.0 since most people only use them once or infrequently." +msgstr "En versiones anteriores de WordPress, todos los importadores estaban incluidos. Ahora han sido convertidos en plugins para la versión 3.0. Mucha gente sólo lo utilizaba una vez o ni eso." + +#: wp-admin/link-manager.php:46 +msgid "You can customize the display of this screen using the Screen Options tab and/or the dropdown filters above the links table." +msgstr "Puedes personalizar cómo se muestra esta pantalla usando la pestaña Opciones de pantalla y/o el menú desplegable de filtros encima de la tabla de enlaces." + +#: wp-admin/plugin-editor.php:117 +msgid "Choose a plugin to edit from the menu in the upper right and click the Select button. Click once on any file name to load it in the editor, and make your changes. Don’t forget to save your changes (Update File) when you’re finished." +msgstr "Elige un plugin a editar en el menú superior derecha y haz clic en el botón Seleccionar. Haz clic una vez sobre cualquier nombre de archivo para cargarlo en el editor. No olvides guardar tus cambios (Actualizar archivo) cuando acabes." + +#: wp-admin/plugins.php:324 +msgid "Most of the time, plugins play nicely with the core of WordPress and with other plugins. Sometimes, though, a plugin’s code will get in the way of another plugin, causing compatibility issues. If your site starts doing strange things, this may be the problem. Try deactivating all your plugins and re-activating them in various combinations until you isolate which one(s) caused the issue." +msgstr "La mayoría de las veces los plugins funcionan perfectamente con el núcleo de WordPress y con los otros plugins. Algunas veces, puede haber incompatibilidades entre algunos plugins produciendo problemas. Tu sitio podría comenzar a hacer cosas raras, esto podría ser un problema. Prueba a desactivar tus plugin e ir activándolos uno a uno y comprobando que el problema no reaparezca. Es la forma de detectar el plugin problemático o la combinación de plugins problemáticos." + +#: wp-admin/plugin-install.php:43 +msgid "If you want to install a plugin that you’ve downloaded elsewhere, click Upload in the upper left. You will be prompted to upload the .zip package, and once uploaded, you can activate the new plugin." +msgstr "Si deseas instalar un plugin que has descargado de cualquier sitio, haz click en la parte superior izquierda. Se te preguntará por un archivo comprimido en .zip y, una vez subido, podrás activarlo." + +#: wp-admin/plugin-install.php:42 +msgid "If you just want to get an idea of what’s available, you can browse Featured, Popular, Newest, and Recently Updated plugins by using the links in the upper left of the screen. These sections rotate regularly." +msgstr "Si quieres hacerte una idea de lo que está disponible, puedes navegar por Destacados, Populares, Nuevos y Actualizados recientemente, usando los enlaces en la parte superior izquierda de la pantalla. Esta sección rota regularmente." + +#: wp-admin/themes.php:41 +msgid "You can see your active theme at the top of the screen. Below are the other themes you have installed that are not currently in use. You can see what your site would look like with one of these themes by clicking the Preview link. To change themes, click the Activate link." +msgstr "Puedes ver tu tema activo en la parte superior de la pantalla. Debajo están los otros temas que tienes instalados pero que no están actualmente en uso. Puedes ver cómo quedaría tu sitio con uno de estos temas haciendo clic en el enlace Previsualizar. Para cambiar de tema, haz clic en Activar." + +#: wp-admin/themes.php:40 +msgid "Aside from the default theme included with your WordPress installation, themes are designed and developed by third parties." +msgstr "Aparte del tema por defecto incluido en su instalación de WordPress, los temas han sido diseñados y desarrollados por terceros." + +#: wp-admin/theme-editor.php:25 +msgid "For PHP files, you can use the Documentation dropdown to select from functions recognized in that file. Lookup takes you to a web page with reference material about that particular function." +msgstr "Para los archivos PHP, puedes usar el menú desplegable de Documentación para elegir las funciones reconocidas que son usadas en ese archivo. Buscar te lleva a una página con material de referencia de esa función en particular." + +#: wp-admin/widgets.php:40 +msgid "Widgets may be used multiple times. You can give each widget a title, to display on your site, but it’s not required." +msgstr "Los widgets pueden usarse varias veces. Puedes proporcionar a cada widget un título para ser mostrado en tu sitio, pero no es necesario." + +#: wp-admin/widgets.php:41 +msgid "Enabling Accessibility Mode, via Screen Options, allows you to use Add and Edit buttons instead of using drag and drop." +msgstr "Activar el modo de accesibilidad, vía Opciones de Pantalla, te permite usar botones de Añadir y Editar en vez de arrastrar y soltar." + +#: wp-admin/theme-editor.php:23 +msgid "You can use the Theme Editor to edit the individual CSS and PHP files which make up your theme." +msgstr "Puedes usar el Editor de temas para editar de forma individual los archivos css y php que crean la apariencia de tu sitio." + +#: wp-admin/theme-editor.php:24 +msgid "Begin by choosing a theme to edit from the dropdown menu and clicking Select. A list then appears of all the template files. Clicking once on any file name causes the file to appear in the large Editor box." +msgstr "Comienza seleccionando qué tema quieres editar en el menú desplegable y haz clic en Elegir. Una lista de todas las plantillas aparecerá. Apretando una vez sobre el nombre de un archivo, éste aparecerá en la gran caja de edición." + +#: wp-admin/widgets.php:37 +msgid "Widgets are independent sections of content that can be placed into any widgetized area provided by your theme (commonly called sidebars). To populate your sidebars/widget areas with individual widgets, drag and drop the title bars into the desired area. By default, only the first widget area is expanded. To populate additional widget areas, click on their title bars to expand them." +msgstr "Los Widgets son secciones independientes de contenido que pueden ser colocados en cualquier parte de tu tema que esté preparado para ello (comúnmente llamados sidebars). Para colocar en tus áreas sidebar/widget con widgets de forma individual, arrastra y suelta la barra del título del widget al área deseada. Por defecto, sólo la primera área está desplegada. Para poner widgets en otras aéreas haz clic en el barra del título para desplegarlas." + +#: wp-admin/theme-install.php:43 +msgid "You can Search for themes by keyword, author, or tag, or can get more specific and search by criteria listed in the feature filter. Alternately, you can browse the themes that are Featured, Newest, or Recently Updated. When you find a theme you like, you can preview it or install it." +msgstr "Puedes buscar temas por palabras clave, autor o etiquetas o puedes ser más específico y buscar por criterios utilizando los filtros. De forma alternativa, puedes ver los temas Destacados, Nuevos o Actualizados Recientemente. Cuando encuentres el tema que te guste, puedes realizar una previsualización o instalarlo." + +#: wp-admin/theme-editor.php:27 +msgid "Advice: think very carefully about your site crashing if you are live-editing the theme currently in use." +msgstr "Advertencia: piensa detenidamente en la posibilidad de que tu sitio produzca errores y sea inaccesible si estás editando el tema en uso y cometes algún error." + +#: wp-admin/theme-editor.php:26 +msgid "After typing in your edits, click Update File." +msgstr "Después de introducir tus modificaciones, haz click en Actualizar archivo." + +#: wp-admin/nav-menus.php:453 +msgid "You can create custom menus for your site. These menus may contain links to pages, categories, custom links or other content types (use the Screen Options tab to decide which ones to show on the screen). You can specify a different navigation label for a menu item as well as other attributes. You can create multiple menus. If your theme includes more than one menu, you can choose which custom menu to associate with each. You can also use custom menus in conjunction with the Custom Menus widget." +msgstr "Puedes crear menús personalizados para tu sitio. Estos menús pueden contener enlaces a páginas, categorías y enlaces personalizados o otro tipo de contenido (usa la pestaña Opciones de pantalla para decidir cuales se muestran en esta pantalla). Puedes especificar diferentes niveles de navegación para un elemento del menú como para otros atributos. Puedes crear múltiples menús. Si tu tema incluye más de un menú, puedes elegir qué menú personalizado asociarás a cada espacio. También puedes usar los menús personalizados conjuntamente con el widget Menús personalizados." + +#: wp-admin/includes/meta-boxes.php:559 +msgid "(no parent)" +msgstr "(sin superior)" + +#: wp-admin/edit.php:176 +msgid "You can also perform the same types of actions, including narrowing the list by using the filters, acting on a Page using the action links that appear when you hover over a row, or using the Bulk Actions menu to edit the metadata for multiple Pages at once." +msgstr "También puedes realizar el mismo tipo que acciones, incluyendo reducir el listado usando filtros, acciones en una página usando las acciones que aparecen cuando te pones sobre ellas o usar el menú Acciones en lote para editar los metadatos de múltiples páginas de una sola vez." + +#: wp-admin/edit-form-advanced.php:184 +msgid "Template - Some themes have custom templates you can use for certain pages that might have additional features or custom layouts. If so, you’ll see them in this dropdown menu." +msgstr "Plantilla - Algunos temas tienen plantillas personalizadas que pueden usarse para añadir algunas características adicionales o diseños personalizados. Si las hay, las encontrarás en el menú desplegable." + +#: wp-admin/edit-form-advanced.php:183 +msgid "Parent - You can arrange your pages in hierarchies. For example, you could have an “About” page that has “Life Story” and “My Dog” pages under it. There are no limits to how many levels you can nest pages." +msgstr "Superiores - Puedes ordenar tus páginas en jerarquías. Por ejemplo, podrías tener una página “Sobre” que bajo ella las páginas “Historia de mi vida” y “Mi perro”. No hay límites en cuántos niveles puedes anidar páginas." + +#: wp-admin/includes/class-wp-upgrader.php:1089 +msgid "All updates have been completed." +msgstr "Todas las actualizaciones han sido completadas." + +#: wp-admin/includes/nav-menu.php:1093 +msgid "Select menu items (pages, categories, links) from the boxes at left to begin building your custom menu." +msgstr "Selecciona elementos de menú (páginas, categorías, enlaces) de la caja de la izquierda para comenzar a construir tu propio menú." + +#: wp-admin/edit-tags.php:191 +msgid "When adding a new tag on this screen, you’ll fill in the following fields:" +msgstr "Cuando añadas una nueva etiqueta en esta pantalla, rellenarás los siguientes campos:" + +#: wp-admin/edit-tags.php:177 +msgid "You can use categories to define sections of your site and group related posts. The default category is “Uncategorized” until you change it in your writing settings." +msgstr "Puedes usar categorías para definir secciones para las entradas de tu sitio y grupo. La categoría por defecto es “Sin categoría” hasta que la cambies en tus ajustes de escritura." + +#: wp-admin/edit-tags.php:181 +msgid "You can assign keywords to your posts using Post Tags. Unlike categories, tags have no hierarchy, meaning there’s no relationship from one tag to another." +msgstr "Puedes asignar palabras clave a tus entradas usando las etiquetas de entradas. A diferencia de las categorías, las etiquetas no tienen jerarquías, lo que quiere decir que no están relacionadas entre sí." + +#: wp-admin/edit-tags.php:186 +msgid "What’s the difference between categories and tags? Normally, tags are ad-hoc keywords that identify important information in your post (names, subjects, etc) that may or may not recur in other posts, while categories are pre-determined sections. If you think of your site like a book, the categories are like the Table of Contents and the tags are like the terms in the index." +msgstr "¿Cuál es la diferencia entre categorías y etiquetas? Normalmente, las etiquetas son palabras clave que identifican información importante en tus entradas (nombres, asuntos, etc...) que pueden ser recurrentes o no en otras entradas, mientras que las categorías son secciones predeterminadas. Si piensas en tu sitio como en un libro, las categorías sería la tabla de contenidos mientras que las etiquetas serían como los términos en el índice." + +#: wp-admin/edit-tags.php:208 +msgid "You can change the display of this screen using the Screen Options tab to set how many items are displayed per screen and to display/hide columns in the table." +msgstr "Puedes cambiar la forma de visualización de esta pantalla usando la pestaña Opciones de pantalla para marcar cuántos elementos se muestran por pantalla y mostrar/esconder columnas." + +#: wp-admin/edit-tags.php:206 +msgid "Description - The description is not prominent by default; however, some themes may display it." +msgstr "Descripción - La descripción no se muestra por defecto, pero algunos temas la podrían mostrar." + +#: wp-admin/edit-tags.php:203 +msgid "Parent - Categories, unlike tags, can have a hierarchy. You might have a Jazz category, and under that have children categories for Bebop and Big Band. Totally optional. To create a subcategory, just choose another category from the Parent dropdown." +msgstr "Categorías - Superiores, a diferencia de las etiquetas, pueden tener jerarquías. Puedes tener la categoría Jazz y bajo esta, tener unas categorías hijas para Bebop y Big Band. Totalmente Opcional. Para crear una subcategoría, tan solo selecciona otra categoría del menú desplegable de Superiores." + +#: wp-admin/edit-tags.php:196 +msgid "Name - The name is how it appears on your site." +msgstr "Nombre - El nombre es como aparece en tu sitio" + +#: wp-admin/edit-tags.php:189 +msgid "When adding a new category on this screen, you’ll fill in the following fields:" +msgstr "Cuando añades una nueva categoría en esta pantalla, rellenas los siguientes campos." + +#: wp-admin/upload.php:146 +msgid "If a media file has not been attached to any post, you will see that in the Attached To column, and can click on Attach File to launch a small popup that will allow you to search for a post and attach the file." +msgstr "Si un archivo multimedia no se ha adjuntado a ninguna entrada, lo verás que en la columna Adjunto a y haciendo click en Adjuntar archivo te desplegará una pequeña ventana emergente que te permitirá buscar una entrada y adjuntarle el archivo." + +#: wp-admin/upload.php:144 +msgid "You can narrow the list by file type/status using the text link filters at the top of the screen. You also can refine the list by date using the dropdown menu above the media table." +msgstr "Puedes reducir el listado por tipo/estado usando los filtros en la parte superior de la pantalla. También puedes refinar la búsqueda por fecha usando el menú desplegable junto a la tabla de multimedia." + +#: wp-admin/media-upload.php:66 +msgid "You can upload media files here without creating a post first. This allows you to upload files to use with posts and pages later and/or to get a web link for a particular file that you can share." +msgstr "Desde aquí puedes subir archivos multimedia sin tener que crear primero una entrada. Esto te permite subir archivos para usarlos en tus entradas y páginas y/o conseguir un enlace al archivo en particular que puedes compartir" + +#: wp-admin/link-manager.php:45 +msgid "Links may be separated into categories; these are different than the categories used on your posts." +msgstr "Los enlaces deben ser separados en categorías. Estas son diferentes de las que utilizas en tus entradas." + +#: wp-admin/includes/template.php:1668 +msgid "Header Image" +msgstr "Imagen de cabecera" + +#: wp-admin/custom-header.php:537 +msgid "Default Images" +msgstr "Imágenes por defecto" + +#: wp-admin/custom-header.php:683 +msgid "Crop Header Image" +msgstr "Recortar imagen de cabecera" + +#: wp-admin/link-manager.php:48 wp-admin/user-new.php:148 wp-admin/index.php:47 +#: wp-admin/edit-link-form.php:46 wp-admin/options-general.php:68 +#: wp-admin/themes.php:45 wp-admin/media.php:75 wp-admin/custom-header.php:105 +#: wp-admin/options-discussion.php:21 wp-admin/plugin-editor.php:121 +#: wp-admin/plugin-install.php:44 wp-admin/options-privacy.php:22 +#: wp-admin/theme-editor.php:31 wp-admin/tools.php:18 +#: wp-admin/edit-form-advanced.php:176 wp-admin/edit-form-advanced.php:186 +#: wp-admin/comment.php:50 wp-admin/edit-comments.php:120 +#: wp-admin/import.php:22 wp-admin/custom-background.php:87 +#: wp-admin/options-media.php:23 wp-admin/edit.php:168 wp-admin/edit.php:177 +#: wp-admin/upload.php:147 wp-admin/export.php:44 wp-admin/theme-install.php:45 +#: wp-admin/users.php:27 wp-admin/options-writing.php:21 +#: wp-admin/update-core.php:412 wp-admin/options-reading.php:49 +#: wp-admin/options-permalink.php:25 wp-admin/user-edit.php:46 +#: wp-admin/widgets.php:44 wp-admin/credits.php:19 wp-admin/plugins.php:326 +#: wp-admin/edit-tags.php:209 wp-admin/media-upload.php:68 +#: wp-admin/nav-menus.php:455 +msgid "For more information:" +msgstr "Para más información:" + +#: wp-admin/custom-header.php:554 +msgid "This will remove the header image. You will not be able to restore any customizations." +msgstr "Esto eliminará la imagen de cabecera. No podrás restaurar ninguna personalización." + +#: wp-admin/edit-tags.php:179 +msgid "You can create groups of links by using link categories. Link category names must be unique and link categories are separate from the categories you use for posts." +msgstr "Puedes crear grupos de enlaces usando las categorías de enlaces. Los nombres de las categorías de enlaces deben ser únicos y diferentes a las categorías que usas para las entradas." + +#: wp-admin/custom-header.php:504 +msgid "You can upload a custom header image to be shown at the top of your site instead of the default one. On the next screen you will be able to crop the image." +msgstr "Puedes subir una imagen de cabecera personalizada para que se vea en tu sitio web en vez de la que viene por defecto. En la siguiente pantalla podrás recortar la imagen." + +#: wp-admin/custom-header.php:555 +msgid "Remove Header Image" +msgstr "Eliminar imagen de cabecera" + +#: wp-admin/custom-header.php:562 +msgid "Reset Image" +msgstr "Restaurar imagen" + +#: wp-admin/custom-header.php:564 +msgid "This will restore the original header image. You will not be able to restore any customizations." +msgstr "Esto restaurará la imagen de cabecera original. No te será posible restaurar ninguna personalización." + +#: wp-admin/custom-header.php:565 +msgid "Restore Original Header Image" +msgstr "Restaurar imagen de cabecera original" + +#: wp-admin/custom-header.php:576 +msgid "Display Text" +msgstr "Visualización de texto" + +#: wp-admin/custom-header.php:587 +msgid "Text Color" +msgstr "Color de texto" + +#: wp-admin/custom-header.php:591 +msgid "If you want to hide header text, add #blank as text color." +msgstr "Si quieres ocultar el texto de la cabecera, añade #blank como color de texto." + +#: wp-admin/custom-header.php:600 +msgid "Reset Text Color" +msgstr "Restaurar color de texto" + +#: wp-admin/custom-header.php:602 +msgid "This will restore the original header text. You will not be able to restore any customizations." +msgstr "Esto restaurará el texto original de la cabecera. No te será posible restaurar ninguna personalización." + +#: wp-admin/custom-header.php:603 +msgid "Restore Original Header Text" +msgstr "Restaurar texto original de la cabecera" + +#: wp-admin/custom-header.php:636 +msgid "Image Upload Error" +msgstr "Error al subir la imagen" + +#: wp-admin/custom-header.php:687 +msgid "You need Javascript to choose a part of the image." +msgstr "Necesitas Javascript para elegir una parte de la imagen." + +#: wp-admin/edit-comments.php:115 +msgid "A yellow row means the comment is waiting for you to moderate it." +msgstr "Una fila amarilla significa que el comentario está esperando a que lo moderes." + +#: wp-admin/edit-comments.php:116 +msgid "In the Author column, in addition to the author’s name, email address, and blog URL, the commenter’s IP address is shown. Clicking on this link will show you all the comments made from this IP address." +msgstr "En la columna Autor, además del nombre del autor, la dirección de correo electrónico y la url del sitio se muestra la dirección IP del que ha realizado el comentario. Haciendo clic en este enlace te mostrará todos los comentarios realizados desde esa dirección IP." + +#: wp-admin/edit-comments.php:114 +msgid "You can manage comments made on your site similar to the way you manage Posts and other content. This screen is customizable in the same ways as other management screens, and you can act on comments using the on-hover action links or the Bulk Actions." +msgstr "Puedes gestionar los comentarios realizados en tu sitio de forma similar a la que gestionas las Entradas y otros contenidos. Esta pantalla es personalizable, de la misma forma que las otras pantallas de gestión. Puedes actuar sobre cada comentario usando los enlaces de acción que aparecerán al ponerte sobre ellos o utilizando la Acción en lote." + +#: wp-admin/edit-comments.php:119 +msgid "Many people take advantage of keyboard shortcuts to moderate their comments more quickly. Use the link below to learn more." +msgstr "Mucha gente saca partido a los atajos de teclado para moderar comentarios de forma rápida. Utiliza el siguiente enlace para aprender más." + +#: wp-admin/includes/class-wp-posts-list-table.php:542 +msgid "Edit this item" +msgstr "Editar este elemento" + +#: wp-admin/includes/class-wp-posts-list-table.php:543 +msgid "Edit this item inline" +msgstr "Editar este elemento en línea" + +#: wp-admin/includes/class-wp-posts-list-table.php:547 +msgid "Restore this item from the Trash" +msgstr "Restaurar este elemento desde la papelera" + +#: wp-admin/includes/class-wp-posts-list-table.php:549 +msgid "Move this item to the Trash" +msgstr "Mover este elemento a la papelera" + +#: wp-admin/includes/class-wp-posts-list-table.php:551 +msgid "Delete this item permanently" +msgstr "Borrar este elemento permanentemente" + +#: wp-admin/includes/meta-boxes.php:447 +msgid "Allow comments." +msgstr "Permitir comentarios." + +#: wp-admin/import.php:32 +msgid "Install the LiveJournal importer to import posts from LiveJournal using their API." +msgstr "Instala el importador de LiveJournal para importar entradas usando su API" + +#: wp-admin/includes/media.php:1484 +msgid "Sorry, you have filled your storage quota (%s MB)." +msgstr "Lo sentimos, usted ha ocupado su cuota de almacenamiento (%s MB)." + +#: wp-admin/includes/nav-menu.php:483 wp-admin/nav-menus.php:450 +msgid "The current theme does not natively support menus, but you can use the “Custom Menu” widget to add any menus you create here to the theme’s sidebar." +msgstr "El tema actual no soporta menús de forma nativa, pero puedes usar el widget “Menús personalizados” para añadir los menús que has creado a la barra lateral de tu tema." + +#: wp-admin/includes/class-wp-upgrader.php:1202 +#: wp-admin/includes/class-wp-upgrader.php:1234 +msgid "Return to WordPress Updates" +msgstr "Volver a las actualizaciones de WordPress" + +#: wp-admin/edit-form-advanced.php:170 +msgid "Publish - You can set the terms of publishing your post in the Publish box. For Status, Visibility, and Publish (immediately), click on the Edit link to reveal more options. Visibility includes options for password-protecting a post or making it stay at the top of your blog indefinitely (sticky). Publish (immediately) allows you to set a future or past date and time, so you can schedule a post to be published in the future or backdate a post." +msgstr "Publicar - Puedes fijar las características de publicación en la caja de publicación. Para el estado, visibilidad y publicar (inmediatamente), haz clic en el enlace \"editar\" para ver más opciones. La visibilidad incluye opciones para proteger una entrada con contraseña o para hacer que se quede en la parte superior de tu sitio indefinidamente (entrada fija). Publicar (inmediatamente) te permite fijar una fecha de publicación pasada o futura, con lo que puedes programar una entrada para publicarse después o atrasar la fecha de una entrada." + +#: wp-admin/edit-form-advanced.php:172 +msgid "Featured Image - This allows you to associate an image with your post without inserting it. This is usually useful only if your theme makes use of the featured image as a post thumbnail on the home page, a custom header, etc." +msgstr "Imagen destacada - Esto te permite asociar una imagen con su entrada sin tener que insertarla, Es útil sólo si tu tema usa la imagen destacada para mostrar una miniatura en la página de inicio, en una cabecera personalizada, etc." + +#: wp-admin/edit-form-advanced.php:168 +msgid "Title - Enter a title for your post. After you enter a title, you’ll see the permalink below, which you can edit." +msgstr "Título - Introduce el título de tu entrada. Después de introducir el título, podrás ver el enlace permanente el cual podrás editar." + +#: wp-admin/edit-form-advanced.php:174 +msgid "Discussion - You can turn comments and pings on or off, and if there are comments on the post, you can see them here and moderate them." +msgstr "Comentarios - Puedes activar o desactivar los comentarios y pings, y si hay comentario en las entradas, puedes verlos aquí y moderarlos." + +#: wp-admin/edit.php:158 +msgid "You can refine the list to show only posts in a specific category or from a specific month by using the dropdown menus above the posts list. Click the Filter button after making your selection. You also can refine the list by clicking on the post author, category or tag in the posts list." +msgstr "Puedes refinar lo que muestra el listado de entradas haciendo que sólo se muestren las de una categoría específica o de un mes determinado usando el menú desplegable que encontrarás sobre el listado de entradas. Realiza un clic sobre el botón Filtro después de realizar tu selección. También puedes refinar el listado haciendo clic sobre el autor de una entrada, categoría o etiqueta del listado de entradas." + +#: wp-admin/edit.php:157 +msgid "You can view posts in a simple title list or with an excerpt. Choose the view you prefer by clicking on the icons at the top of the list on the right." +msgstr "Puedes ver las entradas en un listado que muestre sólo los títulos o un fragmento del contenido. Selecciona la vista que prefieras realizando un clic en los iconos que encontrarás en la parte superior derecha del listado." + +#: wp-admin/edit.php:155 +msgid "You can hide/display columns based on your needs and decide how many posts to list per screen using the Screen Options tab." +msgstr "Puedes esconder/mostrar columnas basándote en tus necesidades y decidir cuántas entradas se mostrarán por pantalla utilizando la pestaña Opciones de pantalla." + +#: wp-admin/edit.php:156 +msgid "You can filter the list of posts by post status using the text links in the upper left to show All, Published, Draft, or Trashed posts. The default view is to show all posts." +msgstr "Puedes filtrar la lista de entradas por estados usando los enlaces que aparecen en la parte superior izquierda para mostrar Todas, Publicado, Borrador o entradas en Papelera. La vista por defecto es mostrar todas las entradas." + +#: wp-admin/edit.php:153 +msgid "You can customize the display of this screen in a number of ways:" +msgstr "Puedes personalizar cómo se muestra esta pantalla de diferentes formas:" + +#: wp-admin/edit.php:160 +msgid "Hovering over a row in the posts list will display action links that allow you to manage your post. You can perform the following actions:" +msgstr "Pasando sobre la línea de la entrada, mostrará los enlaces de las acciones, permitiéndote gestionar la entrada. Puedes realizar las siguientes acciones:" + +#: wp-admin/edit.php:167 +msgid "You can also edit multiple posts at once. Select the posts you want to edit using the checkboxes, select Edit from the Bulk Actions menu and click Apply. You will be able to change the metadata (categories, author, etc.) for all selected posts at once. To remove a post from the grouping, just click the x next to its name in the Bulk Edit area that appears." +msgstr "También puedes editar múltiples entradas de una sola vez. Elige las entradas marcando en sus casillas de verificación, elige Editar en el menú Acciones en lote y haz clic en Aplicar. Esto te permitirá cambiar los metadatos (categorías, autor, etc) de todas las entradas elegidas a la vez. Para eliminar una entrada del grupo, simplemente haz click en la x que está junto a su nombre en el área de Edición en lote." + +#: wp-admin/edit.php:165 +msgid "Preview will show you what your draft post will look like if you publish it. View will take you to your live site to view the post. Which link is available depends on your post’s status." +msgstr "Previsualizar te mostrará cómo se verá la entrada antes de publicarla. Ver te llevará a tu sitio público para ver tu entrada publicada. Cada uno de los enlaces está disponible dependiendo del estado de tu entrada." + +#: wp-admin/edit.php:164 +msgid "Trash removes your post from this list and places it in the trash, from which you can permanently delete it." +msgstr "Papelera elimina la entrada de esta lista y la coloca en la papelera. Desde ahí la podrás eliminar de forma permanente." + +#: wp-admin/edit.php:163 +msgid "Quick Edit provides inline access to the metadata of your post, allowing you to update post details without leaving this screen." +msgstr "Edición rápida te da acceso en línea a los metadatos de tu entrada, permitiéndote actualizar los detalles de tu entrada sin abandonar la pantalla." + +#: wp-admin/edit.php:162 +msgid "Edit takes you to the editing screen for that post. You can also reach that screen by clicking on the post title." +msgstr "Editar te lleva a la pantalla de edición de entradas. También puedes acceder a esta pantalla haciendo clic sobre el título de cada entrada." + +#: wp-includes/default-widgets.php:1057 wp-admin/includes/theme.php:308 +msgid "Custom Menu" +msgstr "Menú personalizado" + +#: wp-includes/default-widgets.php:1056 +msgid "Use this widget to add one of your custom menus as a widget." +msgstr "Usa este widget para añadir uno de tus menús de navegación como widget." + +#: wp-admin/plugins.php:396 +msgid "Search Installed Plugins" +msgstr "Buscar Plugins Instalados" + +#: wp-admin/includes/nav-menu.php:492 +msgid "Your theme supports %s menu. Select which menu you would like to use." +msgid_plural "Your theme supports %s menus. Select which menu appears in each location." +msgstr[0] "Tu tema soporta %s menú. Selecciona qué menú quieres utilizar." +msgstr[1] "Tu tema soporta %s menús. Selecciona qué menú quieres utilizar en cada posición." + +#: wp-admin/update-core.php:409 +msgid "This screen lets you update to the latest version of WordPress as well as update your themes and plugins from the WordPress.org repository. When updates are available, the number of available updates will appear in a bubble on the left hand menu as a notification. It is very important to keep your WordPress installation up to date for security reasons, so when you see a number appear, make sure you take the time to update, which is an easy process." +msgstr "Esta pantalla te permite actualizar a la última versión de WordPress, así como actualizar tu temas y plugins desde el repositorio de WordPress.org. Cuando hay actualizaciones disponibles, el número de actualizaciones disponibles aparecerá en una burbuja en el menú de la izquierda como una notificación. Es muy importante mantener tu instalación de WordPress al día por razones de seguridad, así que cuando veas que aparece un número, asegúrate de que realizas las actualizaciones, que es un proceso muy fácil." + +#: wp-admin/index.php:41 +msgid "Incoming Links - Shows links to your site found by Google Blog Search." +msgstr "Enlaces entrantes - Muestra enlaces que apuntan a tu sitio encontrados por la búsqueda de blogs de Google." + +#: wp-admin/index.php:42 +msgid "QuickPress - Allows you to create a new post and either publish it or save it as a draft." +msgstr "Publicación rápida - Te permite crear entradas nuevas y publicarlas o guardarlas como borradores." + +#: wp-admin/index.php:43 +msgid "Recent Drafts - Displays links to the 5 most recent draft posts you’ve started." +msgstr "Borradores recientes - Muestra un enlace a los últimos 5 borradores de entradas que hayas comenzado." + +#: wp-admin/index.php:39 +msgid "Right Now - Displays a summary of the content on your site and identifies which theme and version of WordPress you are using." +msgstr "Ahora mismo - Muestra un resumen de tu sitio e identifica qué tema y versión estás usando." + +#: wp-admin/index.php:40 +msgid "Recent Comments - Shows the most recent comments on your posts (configurable, up to 30) and allows you to moderate them." +msgstr "Comentario recientes - Muestra los comentarios más recientes en tus entradas (es configurable, hasta 30 comentarios) y te permite moderarlos." + +#: wp-admin/nav-menus.php:19 +msgid "Your theme does not support navigation menus or widgets." +msgstr "El tema actual no soporta menús de navegación o widgets." + +#: wp-includes/script-loader.php:245 wp-admin/async-upload.php:56 +msgid "“%s” has failed to upload due to an error" +msgstr "Ha habido un error al subir “%s”" + +#: wp-admin/includes/dashboard.php:488 +msgid "Post published. View post | Edit post" +msgstr "Entrada publicada. Ver entrada | Editar entrada" + +#: wp-admin/includes/dashboard.php:492 +msgid "Draft saved. Preview post | Edit post" +msgstr "Borrador guardado. Previsualizar entrada | Editar entrada" + +#: wp-admin/tools.php:51 wp-admin/import.php:31 +msgid "Categories and Tags Converter" +msgstr "Conversor de etiquetas y categorías" + +#: wp-admin/import.php:31 +msgid "Install the category/tag converter to convert existing categories to tags or tags to categories, selectively." +msgstr "Instala el conversor de categorías existentes en etiquetas o las etiquetas en categorías, de forma selectiva." + +#: wp-includes/pluggable.php:1092 +msgid "New pingback on your post \"%s\"" +msgstr "Nuevo pingback en tu entrada \"%s\"" + +#: wp-includes/pluggable.php:1178 +msgid "A new pingback on the post \"%s\" is waiting for your approval" +msgstr "Un nuevo pingback a la entada \"%s\" está esperando tu aprobación" + +#: wp-includes/pluggable.php:1185 +msgid "A new comment on the post \"%s\" is waiting for your approval" +msgstr "Un nuevo comentario a la entrada \"%s\" está esperando tu aprobación" + +#: wp-includes/pluggable.php:1083 +msgid "New trackback on your post \"%s\"" +msgstr "Nuevo trackback a tu entrada \"%s\"" + +#: wp-includes/pluggable.php:1072 +msgid "New comment on your post \"%s\"" +msgstr "Nuevo comentario a tu entrada \"%s\"" + +#: wp-admin/user-edit.php:335 +msgid "There is a pending change of your e-mail to %1$s. Cancel" +msgstr "Hay un cambio pendiente en tu correo electrónico a %1$s. Cancelar" + +#: wp-admin/includes/nav-menu.php:664 +msgid "Most Recent" +msgstr "Más reciente" + +#: wp-admin/export.php:151 wp-admin/export.php:183 +msgid "End Date" +msgstr "Fecha de finalización" + +#: wp-admin/export.php:147 wp-admin/export.php:179 +msgid "Start Date" +msgstr "Fecha de inicio" + +#: wp-includes/taxonomy.php:2035 +msgid "A term with the name provided already exists." +msgstr "Ya existe un término igual al facilitado." + +#: wp-admin/custom-background.php:272 +msgid "No Repeat" +msgstr "No repetir" + +#: wp-includes/theme-compat/sidebar.php:74 +msgid "XFN" +msgstr "XFN" + +#: wp-includes/theme-compat/sidebar.php:74 +msgid "XHTML Friends Network" +msgstr "Red de amigos de XHTML" + +#: wp-includes/theme-compat/sidebar.php:73 +msgid "Valid XHTML" +msgstr "Valida XHTML" + +#: wp-includes/theme-compat/footer.php:19 +msgid "%1$s and %2$s." +msgstr "%1$s y %2$s." + +#: wp-includes/theme-compat/sidebar.php:38 +msgid "F, Y" +msgstr "j F Y" + +#: wp-includes/theme-compat/sidebar.php:47 +msgid "You are currently browsing the %2$s blog archives." +msgstr "Estás navegando por el archivo de %2$s." + +#: wp-includes/theme-compat/sidebar.php:38 +msgid "You are currently browsing the %2$s blog archives for %3$s." +msgstr "Actualmente estás viendo el archivo del sitio %2$s de %3$s." + +#: wp-includes/theme-compat/comments.php:49 +msgid "Comments are closed." +msgstr "Los comentarios están cerrados." + +#: wp-includes/theme-compat/sidebar.php:41 +msgid "You are currently browsing the %2$s blog archives for the year %3$s." +msgstr "Actualmente estás viendo el archivo del sitio %2$s del año %3$s." + +#: wp-includes/theme-compat/comments.php:73 +msgid "Logged in as %2$s." +msgstr "Identificado como %2$s." + +#: wp-includes/theme-compat/comments-popup.php:71 +msgid "Logged in as %2$s. Log out »" +msgstr "Identificado como %2$s. Salir »" + +#: wp-includes/theme-compat/comments.php:92 +msgid "Submit Comment" +msgstr "Enviar comentario" + +#: wp-includes/theme-compat/footer.php:17 +msgid "%1$s is proudly powered by %2$s" +msgstr "%1$s funciona gracias a %2$s" + +#: wp-includes/theme-compat/comments-popup.php:85 +msgid "URL" +msgstr "URL" + +#: wp-includes/theme-compat/comments-popup.php:90 +msgid "Your Comment" +msgstr "Tu comentario" + +#: wp-includes/theme-compat/comments-popup.php:98 +msgid "Say It!" +msgstr "Enviar" + +#: wp-includes/theme-compat/comments-popup.php:108 +msgid "Close this window." +msgstr "Cerrar esta ventana." + +#: wp-includes/theme-compat/comments-popup.php:114 +msgid "Sorry, no posts matched your criteria." +msgstr "Lo siento, no hay nada que se ajuste a lo que buscas." + +#: wp-includes/theme-compat/comments-popup.php:118 +msgid "Powered by WordPress" +msgstr "Gestionado con WordPress" + +#: wp-includes/theme-compat/comments.php:73 +msgid "Log out of this account" +msgstr "Salir de esta cuenta" + +#: wp-includes/theme-compat/comments.php:73 +msgid "Log out »" +msgstr "Salir »" + +#: wp-includes/theme-compat/comments.php:81 +msgid "Mail (will not be published)" +msgstr "Correo electrónico (no será publicado)" + +#: wp-includes/theme-compat/comments.php:88 +msgid "XHTML: You can use these tags: %s" +msgstr "XHTML: Puedes usar estas etiquetas: %s" + +#: wp-includes/theme-compat/sidebar.php:44 +msgid "You have searched the %2$s blog archives for ‘%3$s’. If you are unable to find anything in these search results, you can try one of these links." +msgstr "Has buscado en el archivo del sitio %2$s el término ‘%3$s’. Si no te es posible encontrar nada en los resultados, puedes probar uno de estos enlaces." + +#: wp-includes/theme-compat/sidebar.php:35 +msgid "l, F jS, Y" +msgstr "j F Y" + +#: wp-includes/theme-compat/sidebar.php:35 +msgid "You are currently browsing the %2$s blog archives for the day %3$s." +msgstr "Actualmente estás navegando por el archivo del sitio %2$s del día %3$s." + +#: wp-includes/theme-compat/sidebar.php:32 +msgid "You are currently browsing the archives for the %s category." +msgstr "Actualmente estás navegando por el archivo de la categoría %s" + +#: wp-includes/theme-compat/footer.php:20 +msgid "%d queries. %s seconds." +msgstr "%d consultas. %s segundos." + +#: wp-includes/theme-compat/footer.php:19 +msgid "Comments (RSS)" +msgstr "Comentarios (RSS)" + +#: wp-includes/theme-compat/footer.php:19 +msgid "Entries (RSS)" +msgstr "Artículos (RSS)" + +#: wp-includes/theme-compat/comments-popup.php:67 +msgid "Line and paragraph breaks automatic, e-mail address never displayed, HTML allowed: %s" +msgstr "Las líneas y párrafos saltan automáticamente, nunca se mostrarán los correos electrónicos. HTMLpermitido: %s" + +#: wp-includes/theme-compat/comments.php:17 +msgid "This post is password protected. Enter the password to view comments." +msgstr "Esta entrada está protegida. Para verla, escribe la contraseña:" + +#: wp-includes/theme-compat/sidebar.php:73 +msgid "This page validates as XHTML 1.0 Transitional" +msgstr "Esta página valida como XHTML 1.0 transicional" + +#: wp-includes/theme-compat/comments-popup.php:103 +msgid "Sorry, the comment form is closed at this time." +msgstr "Lo siento, el formulario de comentarios está cerrado en este momento." + +#: wp-includes/theme-compat/comments-popup.php:14 +msgid "%1$s - Comments on %2$s" +msgstr "%1$s - Comentarios en %2$s" + +#: wp-includes/theme-compat/comments-popup.php:35 +msgid "RSS feed for comments on this post." +msgstr "RSS feed para los comentarios de esta entrada." + +#: wp-includes/theme-compat/comments-popup.php:38 +msgid "The URL to TrackBack this entry is: %s" +msgstr "La URL para realizar un TrackBack a esta entrada es: %s" + +#: wp-includes/theme-compat/comments-popup.php:56 +msgid "by %1$s — %2$s @ %4$s" +msgstr "por %1$s — %2$s @ %4$s" + +#: wp-includes/theme-compat/comments-popup.php:66 +msgid "Leave a comment" +msgstr "Deja un comentario" + +#: wp-admin/includes/template.php:1795 +msgctxt "Screen Options" +msgid "Show on screen" +msgstr "Mostrar en pantalla" + +#: wp-admin/import.php:36 +msgid "Install the WordPress importer to import posts, pages, comments, custom fields, categories, and tags from a WordPress export file." +msgstr "Instala el importador de WordPress para importar entradas, páginas, comentarios, campos personalizados, categorías y etiquetas de un archivo de exportación de WordPress." + +#: wp-admin/import.php:35 +msgid "Install the RSS importer to import posts from an RSS feed." +msgstr "Instala el importador RSS para Importar entradas de una fuente RSS." + +#: wp-admin/import.php:34 +msgid "Install the blogroll importer to import links in OPML format." +msgstr "Instala el importador de sitios de interés para importar enlaces en formato OPML." + +#: wp-admin/import.php:33 +msgid "Install the Movable Type importer to import posts and comments from a Movable Type or TypePad blog." +msgstr "Instala el importador de Movable Type para importar entradas y comentarios de un blog de Movable Type o TypePad." + +#: wp-admin/import.php:30 +msgid "Install the Blogger importer to import posts, comments, and users from a Blogger blog." +msgstr "Instala el importador de Blogger para importar entradas, comentarios y usuarios de un blog de Blogger." + +#: wp-admin/import.php:119 +msgid "Install importer" +msgstr "Instalar importador" + +#: wp-includes/post-template.php:1416 +msgctxt "revisions column name" +msgid "New" +msgstr "Nuevo" + +#: wp-includes/post-template.php:1415 +msgctxt "revisions column name" +msgid "Old" +msgstr "Antiguo" + +#: wp-includes/post-template.php:1417 +msgctxt "revisions column name" +msgid "Date Created" +msgstr "Fecha de creación" + +#: wp-includes/taxonomy.php:413 wp-admin/press-this.php:583 +msgid "Choose from the most used tags" +msgstr "Elige entre las etiquetas más utilizadas" + +#: wp-admin/theme-editor.php:198 +msgctxt "Theme stylesheets in theme editor" +msgid "Styles" +msgstr "Estilos" + +#: wp-admin/includes/plugin-install.php:128 +msgctxt "Plugin Installer" +msgid "Tag" +msgstr "Etiqueta" + +#: wp-admin/includes/theme-install.php:63 +msgctxt "Theme Installer" +msgid "Tag" +msgstr "Etiqueta" + +#: wp-admin/includes/media.php:1809 +msgctxt "verb" +msgid "Clear" +msgstr "Limpiar" + +#: wp-admin/edit-tags.php:355 wp-admin/edit-tag-form.php:63 +msgctxt "Taxonomy Description" +msgid "Description" +msgstr "Descripción" + +#: wp-admin/edit-tags.php:340 wp-admin/edit-tag-form.php:46 +msgctxt "Taxonomy Slug" +msgid "Slug" +msgstr "Slug" + +#: wp-admin/edit-tags.php:334 wp-admin/edit-tag-form.php:40 +msgctxt "Taxonomy Name" +msgid "Name" +msgstr "Nombre" + +#: wp-admin/edit-tags.php:347 wp-admin/edit-tag-form.php:53 +msgctxt "Taxonomy Parent" +msgid "Parent" +msgstr "Superior" + +#: wp-admin/edit-form-comment.php:51 +msgctxt "adjective" +msgid "Pending" +msgstr "Pendiente" + +#: wp-admin/includes/class-wp-comments-list-table.php:192 +msgctxt "comment" +msgid "Mark as Spam" +msgstr "Marcar como spam" + +#: wp-includes/comment-template.php:1538 +msgid "You may use these HTML tags and attributes: %s" +msgstr "Puedes usar las siguientes etiquetas y atributos HTML: %s" + +#: wp-admin/custom-background.php:294 +msgid "Color" +msgstr "Color" + +#: wp-admin/custom-background.php:180 wp-admin/includes/template.php:1674 +msgid "Background Image" +msgstr "Imagen de fondo" + +#: wp-admin/custom-background.php:213 +msgid "Remove Background Image" +msgstr "Quitar imagen de fondo" + +#: wp-includes/script-loader.php:230 +msgid "This file exceeds the maximum upload size for this site." +msgstr "El tamaño del archivo excede el tamaño permitido en este sitio." + +#: wp-admin/includes/media.php:1570 wp-admin/includes/media.php:1585 +msgid "Maximum upload file size: %d%s" +msgstr "Tamaño máximo de subida de archivos: %d%s" + +#: wp-admin/edit-comments.php:108 wp-admin/edit-comments.php:133 +msgid "Comments on “%s”" +msgstr "Comentarios en “%s”" + +#: wp-admin/includes/nav-menu.php:1104 +msgid "The Walker class named %s does not exist." +msgstr "La clase Walker para el nombre %s no existe." + +#: wp-admin/includes/nav-menu.php:1140 +msgid "Show advanced menu properties" +msgstr "Mostrar propiedades avanzadas de menú" + +#: wp-admin/includes/template.php:1768 +msgctxt "Columns" +msgid "Show on screen" +msgstr "Mostrar en pantalla" + +#: wp-admin/includes/template.php:1761 +msgctxt "Metaboxes" +msgid "Show on screen" +msgstr "Mostrar en pantalla " + +#: wp-admin/includes/nav-menu.php:386 +msgid "Theme Locations" +msgstr "Ubicación del tema" + +#: wp-includes/taxonomy.php:400 +msgctxt "taxonomy singular name" +msgid "Category" +msgstr "Categoría" + +#: wp-includes/taxonomy.php:401 +msgid "Search Tags" +msgstr "Buscar etiquetas" + +#: wp-includes/taxonomy.php:402 +msgid "Popular Tags" +msgstr "Etiquetas populares" + +#: wp-includes/taxonomy.php:410 +msgid "New Category Name" +msgstr "Nombre de la nueva categoría" + +#: wp-includes/taxonomy.php:410 +msgid "New Tag Name" +msgstr "Nombre de la nueva etiqueta" + +#: wp-includes/taxonomy.php:409 +msgid "Add New Category" +msgstr "Añadir nueva categoría" + +#: wp-includes/taxonomy.php:409 +msgid "Add New Tag" +msgstr "Añadir nueva etiqueta" + +#: wp-includes/taxonomy.php:408 +msgid "Update Tag" +msgstr "Etiqueta actualizada" + +#: wp-includes/taxonomy.php:405 +msgid "Parent Category:" +msgstr "Categoría superior:" + +#: wp-includes/taxonomy.php:404 +msgid "Parent Category" +msgstr "Categoría superior" + +#: wp-includes/taxonomy.php:403 +msgid "All Tags" +msgstr "Todas las etiquetas" + +#: wp-includes/taxonomy.php:399 +msgctxt "taxonomy general name" +msgid "Categories" +msgstr "Categorías" + +#: wp-includes/taxonomy.php:400 +msgctxt "taxonomy singular name" +msgid "Post Tag" +msgstr "Etiqueta de la entrada" + +#: wp-includes/taxonomy.php:399 +msgctxt "taxonomy general name" +msgid "Post Tags" +msgstr "Etiquetas de las entradas" + +#: wp-admin/includes/meta-boxes.php:351 wp-admin/press-this.php:546 +msgid "+ %s" +msgstr "+ %s" + +#: wp-admin/includes/dashboard.php:405 +msgid "Theme %1$s with %2$s Widget" +msgid_plural "Theme %1$s with %2$s Widgets" +msgstr[0] "Tema %1$s con %2$s widget" +msgstr[1] "Tema %1$s con %2$s widgets" + +#: wp-includes/post.php:1184 +msgid "Search Pages" +msgstr "Buscar páginas" + +#: wp-includes/post.php:1180 +msgid "Add New Post" +msgstr "Añadir nueva entrada" + +#: wp-includes/post.php:1187 +msgid "Parent Page:" +msgstr "Página superior:" + +#: wp-includes/post.php:1177 +msgctxt "post type general name" +msgid "Posts" +msgstr "Entradas" + +#: wp-includes/post.php:1181 +msgid "Edit Page" +msgstr "Editar página" + +#: wp-includes/post.php:1184 +msgid "Search Posts" +msgstr "Buscar entradas" + +#: wp-includes/post.php:1180 +msgid "Add New Page" +msgstr "Añadir nueva página" + +#: wp-includes/post.php:1177 +msgctxt "post type general name" +msgid "Pages" +msgstr "Páginas" + +#: wp-includes/post.php:1178 +msgctxt "post type singular name" +msgid "Page" +msgstr "Página" + +#: wp-includes/post.php:1178 +msgctxt "post type singular name" +msgid "Post" +msgstr "Entrada" + +#: wp-admin/update-core.php:252 wp-admin/update-core.php:302 +msgid "You have version %1$s installed. Update to %2$s." +msgstr "Estás usando la versión %1$s. Actualiza a %2$s." + +#: wp-admin/includes/nav-menu.php:744 +msgctxt "nav menu home label" +msgid "Home" +msgstr "Inicio" + +#: wp-admin/themes.php:64 +msgid "New theme activated. This theme supports widgets, please visit the widgets settings screen to configure them." +msgstr "Nuevo tema activado. Este tema soporta widgets, por favor, visita la pantalla configuración de widgets para configurarlos." + +#: wp-login.php:300 wp-admin/includes/user.php:164 +msgid "ERROR: This username is invalid because it uses illegal characters. Please enter a valid username." +msgstr "ERROR: Este nombre de usuario no es válido, ya que usa caracteres no permitidos. Por favor, introduce un nombre de usuario válido." + +#: wp-admin/includes/dashboard.php:373 +msgctxt "comment" +msgid "Spam" +msgid_plural "Spam" +msgstr[0] "Spam" +msgstr[1] "Spam" + +#: wp-admin/includes/class-wp-comments-list-table.php:197 +#: wp-admin/includes/class-wp-comments-list-table.php:402 +msgctxt "comment" +msgid "Not Spam" +msgstr "No es spam" + +#: wp-includes/comment-template.php:1531 +msgid "Required fields are marked %s" +msgstr "Los campos necesarios están marcados %s" + +#: wp-admin/custom-background.php:227 +msgid "This will restore the original background image. You will not be able to restore any customizations." +msgstr "Esto restaurará la imagen de fondo original. No te será posible restaurar ninguna personalización." + +#: wp-includes/theme-compat/footer.php:10 +#: wp-includes/theme-compat/sidebar.php:10 +#: wp-includes/theme-compat/comments.php:10 +#: wp-includes/theme-compat/header.php:10 +#: wp-includes/theme-compat/comments-popup.php:10 +msgid "Please include a %1$s template in your theme." +msgstr "Por favor, incluye la plantilla %1$s en tu tema" + +#: wp-includes/theme-compat/footer.php:10 +#: wp-includes/theme-compat/sidebar.php:10 +#: wp-includes/theme-compat/comments.php:10 +#: wp-includes/theme-compat/header.php:10 +#: wp-includes/theme-compat/comments-popup.php:10 +msgid "Theme without %1$s" +msgstr "Tema sin %1$s" + +#: wp-includes/general-template.php:405 +msgid "The %s option is deprecated for the family of bloginfo() functions." +msgstr "La opción %s es obsoleta, ya no se utiliza en la familia de funciones bloginfo()." + +#: wp-includes/general-template.php:405 +msgid "Use the %s option instead." +msgstr "Usa la opción %s en su lugar." + +#: wp-admin/includes/nav-menu.php:557 +msgid "Label" +msgstr "Etiqueta" + +#: wp-admin/nav-menus.php:494 +msgid "Add New Menu" +msgstr "Añadir nuevo menú" + +#: wp-admin/nav-menus.php:587 +msgid "When you have finished building your custom menu, make sure you click the Save Menu button." +msgstr "Cuando hayas terminado de crear tu menú personalizado, asegúrate de hacer clic en el botón Guardar menú." + +#: wp-admin/nav-menus.php:586 +msgid "After you have added your items, drag and drop to put them in the order you want. You can also click each item to reveal additional configuration options." +msgstr "Después de añadir tus objetos, arrastra y suéltalos en el orden que desees. También puedes hacer clic en cada objeto para ver opciones de configuración avanzadas." + +#: wp-admin/nav-menus.php:559 +msgid "Create Menu" +msgstr "Crear menú" + +#: wp-admin/nav-menus.php:585 +msgid "To create a custom menu, give it a name above and click Create Menu. Then choose items like pages, categories or custom links from the left column to add to this menu." +msgstr "Para crear un menú personalizado dale un nombre y haz clic en Crear menú. Después elige objetos como páginas, categorías o enlaces personalizados de la columna izquierda para añadirlos a este menú." + +#: wp-includes/default-widgets.php:17 +msgid "Your site’s WordPress Pages" +msgstr "Las Páginas de tu sitio de WordPress" + +#: wp-admin/includes/upgrade.php:322 +msgid "" +"Your new WordPress site has been successfully set up at:\n" +"\n" +"%1$s\n" +"\n" +"You can log in to the administrator account with the following information:\n" +"\n" +"Username: %2$s\n" +"Password: %3$s\n" +"\n" +"We hope you enjoy your new site. Thanks!\n" +"\n" +"--The WordPress Team\n" +"http://wordpress.org/\n" +msgstr "" +"Se ha configurado correctamente tu nuevo sitio de WordPress en:\n" +"\n" +"%1$s\n" +"\n" +"Puedes identificarte como administrador con la siguiente información:\n" +"\n" +"Nombre de usuario: %2$s\n" +"Contraseña: %3$s\n" +"\n" +"Esperamos que disfrutes de tu nuevo sitio. ¡Gracias!\n" +"\n" +"--El equipo de WordPress\n" +"http://es.wordpress.org/\n" + +#: wp-admin/includes/dashboard.php:91 +msgid "WordPress Blog" +msgstr "Blog oficial WordPress" + +#: wp-content/plugins/akismet/admin.php:169 +msgid "Your web host or server administrator has disabled PHP's fsockopen or gethostbynamel functions. Akismet cannot work correctly until this is fixed. Please contact your web host or firewall administrator and give them this information about Akismet's system requirements." +msgstr "Tu servidor tiene desactivada la función fsockopen o la función gethostbynamel de PHP. Akismet no puede funcionar correctamente si esto está desactivado. Por favor, ponte en contacto con tu proveedor e infórmales sobre los requisitos de Akismet." + +#: wp-includes/class-wp-xmlrpc-server.php:1796 +msgid "Sorry, you do not have access to user data on this site." +msgstr "Disculpa, no tienes acceso a los datos de los usuarios de este sitio." + +#: wp-includes/class-wp-xmlrpc-server.php:2018 +msgid "Sorry, you are not allowed to post on this site." +msgstr "Disculpa, no tienes autorización para publicar en este sitio." + +#: wp-includes/class-wp-xmlrpc-server.php:2210 +#: wp-includes/class-wp-xmlrpc-server.php:2223 +#: wp-includes/class-wp-xmlrpc-server.php:2499 +#: wp-includes/class-wp-xmlrpc-server.php:2517 +#: wp-includes/class-wp-xmlrpc-server.php:2528 +msgid "Sorry, you are not allowed to publish posts on this site." +msgstr "Disculpa, no tienes autorización para publicar entradas en este sitio." + +#: wp-includes/class-wp-xmlrpc-server.php:3000 +#: wp-includes/class-wp-xmlrpc-server.php:3192 +msgid "Sorry, you must be able to edit posts on this site in order to view categories." +msgstr "Disculpa, para ver las categorías tienes que estar autorizado para editar entradas en este sitio." + +#: wp-includes/class-wp-xmlrpc-server.php:2199 +#: wp-includes/class-wp-xmlrpc-server.php:2508 +msgid "Sorry, you are not allowed to publish pages on this site." +msgstr "Disculpa, no tienes autorización para publicar páginas en este sitio." + +#: wp-admin/user-edit.php:255 wp-admin/user-edit.php:257 +msgid "— No role for this site —" +msgstr "— No hay perfil para este sitio —" + +#: wp-app.php:287 +msgid "AtomPub services are disabled on this site. An admin user can enable them at %s" +msgstr "En este sitio están desactivados los servicios AtomPub. Un administrador puede activarlos visitando %s." + +#: wp-includes/class-wp-xmlrpc-server.php:793 +msgid "Sorry, you cannot edit posts on this site." +msgstr "Disculpa, no puedes editar entradas en este sitio." + +#: wp-includes/class-wp-xmlrpc-server.php:957 +msgid "Sorry, you must be able to edit posts to this site in order to view categories." +msgstr "Disculpa, para ver las categorías tienes que estar autorizado para editar entradas en este sitio." + +#: wp-includes/class-wp-xmlrpc-server.php:1338 +#: wp-includes/class-wp-xmlrpc-server.php:1397 +#: wp-includes/class-wp-xmlrpc-server.php:1423 +#: wp-includes/class-wp-xmlrpc-server.php:1449 +msgid "You are not allowed access to details about this site." +msgstr "No tienes autorización para ver los detalles de este sitio." + +#: wp-admin/tools.php:35 wp-admin/options-writing.php:90 +msgid "Use Press This to clip text, images and videos from any web page. Then edit and add more straight from Press This before you save or publish it in a post on your site." +msgstr "Utiliza Publicar esto para copiar texto, imágenes y vídeos de cualquier página Web. Después corrige y añade más directamente desde Publicar esto antes de guardarlo o publicarlo en una entrada del sitio." + +#: wp-includes/default-widgets.php:513 +msgid "The most recent posts on your site" +msgstr "Las entradas más recientes de tu sitio" + +#: wp-includes/default-widgets.php:330 +msgid "A calendar of your site’s posts" +msgstr "Un calendario de las entradas de tu sitio" + +#: wp-includes/default-widgets.php:217 +msgid "A monthly archive of your site’s posts" +msgstr "Un archivo mensual de las entradas de tu sitio" + +#: wp-includes/default-widgets.php:174 +msgid "A search form for your site" +msgstr "Un formulario de búsqueda para tu sitio" + +#: wp-app.php:324 wp-app.php:365 +msgid "Sorry, you do not have the right to access this site." +msgstr "Lo sentimos, no tienes autorización para acceder a este sitio." + +#: wp-admin/users.php:332 +msgid "User removed from this site." +msgstr "Usuario eliminado de este sitio." + +#: wp-includes/pluggable.php:1260 +msgid "New user registration on your site %s:" +msgstr "Registrado un nuevo usuario en tu sitio %s:" + +#: wp-includes/user.php:102 +msgid "Site Suspended." +msgstr "Sitio suspendido." + +#: wp-includes/class-wp-xmlrpc-server.php:993 +#: wp-includes/class-wp-xmlrpc-server.php:1135 +#: wp-includes/class-wp-xmlrpc-server.php:1138 +#: wp-includes/class-wp-xmlrpc-server.php:1185 +#: wp-includes/class-wp-xmlrpc-server.php:1188 +msgid "You are not allowed to moderate comments on this site." +msgstr "No tienes autorización para moderar comentarios en este sitio." + +#: wp-includes/class-wp-xmlrpc-server.php:828 +msgid "Sorry, you must be able to edit posts on this site in order to view tags." +msgstr "Disculpa, para ver las etiquetas tienes que estar autorizado para editar entradas en este sitio." + +#: wp-includes/class-wp-xmlrpc-server.php:321 +msgid "Site Tagline" +msgstr "Descripción corta" + +#: wp-includes/class-wp-xmlrpc-server.php:304 +msgid "Site URL" +msgstr "URL del sitio" + +#: wp-admin/users.php:264 +msgid "Remove Users from Site" +msgstr "Eliminar usuarios del sitio" + +#: wp-includes/class-wp-xmlrpc-server.php:159 +#: wp-includes/class-wp-xmlrpc-server.php:181 +msgid "XML-RPC services are disabled on this site. An admin user can enable them at %s" +msgstr "El servicio XML-RPC está desactivado en este sitio. Un administrador puede activarlo en %s" + +#: wp-admin/includes/post.php:546 +msgid "You are not allowed to create posts or drafts on this site." +msgstr "No tienes autorización para crear entradas o borradores en este sitio." + +#: wp-admin/includes/plugin.php:401 +msgid "Custom site deleted message." +msgstr "Mensaje personalizado para sitios eliminados." + +#: wp-admin/includes/plugin.php:403 +msgid "Custom site suspended message." +msgstr "Mensaje personalizado para sitios suspendidos." + +#: wp-admin/includes/plugin.php:402 +msgid "Custom site inactive message." +msgstr "Mensaje personalizado para sitios inactivos." + +#: wp-admin/includes/meta-boxes.php:408 +msgid "Trackbacks are a way to notify legacy blog systems that you’ve linked to them. If you link other WordPress sites they’ll be notified automatically using pingbacks, no other action necessary." +msgstr "Los trackbacks son un modo de avisar a sistemas antiguos de que les has enlazado. Si enlazas a otros sitios creados con WordPress recibirán un aviso automático gracias a los pingbacks, sin tener que hacer nada." + +#: wp-admin/includes/post.php:544 +msgid "You are not allowed to create pages on this site." +msgstr "No tienes autorización para crear páginas en este sitio." + +#: wp-admin/includes/schema.php:200 +msgid "My Site" +msgstr "Mi sitio" + +#: wp-admin/install.php:133 +msgid "Allow my site to appear in search engines like Google and Technorati." +msgstr "Permitir que mi sitio aparezca en motores de búsqueda como Google y Technorati." + +#: wp-admin/includes/upgrade.php:337 +msgid "New WordPress Site" +msgstr "Nuevo sitio de WordPress" + +#: wp-admin/update.php:194 wp-admin/update.php:224 +msgid "You do not have sufficient permissions to install themes for this site." +msgstr "No tienes suficientes permisos para instalar temas en este sitio." + +#: wp-admin/update.php:93 wp-admin/update.php:124 +msgid "You do not have sufficient permissions to install plugins for this site." +msgstr "No tienes suficientes permisos para instalar plugins en este sitio." + +#: wp-admin/update.php:148 wp-admin/update.php:168 +msgid "You do not have sufficient permissions to update themes for this site." +msgstr "No tienes suficientes permisos para actualizar temas en este sitio." + +#: wp-admin/update.php:24 wp-admin/update.php:50 wp-admin/update.php:69 +msgid "You do not have sufficient permissions to update plugins for this site." +msgstr "No tienes suficientes permisos para actualizar plugins en este sitio." + +#: wp-includes/load.php:426 +msgid "The site you have requested is not installed properly. Please contact the system administrator." +msgstr "El sitio que has solicitado no está instalado correctamente. Por favor, ponte en contacto con el administrador del sistema." + +#: wp-admin/theme-install.php:16 +msgid "You do not have sufficient permissions to install themes on this site." +msgstr "No tienes suficientes permisos para instalar temas en este sitio." + +#: wp-admin/theme-editor.php:18 +msgid "You do not have sufficient permissions to edit templates for this site." +msgstr "No tienes suficientes permisos para editar las plantillas de este sitio." + +#: wp-admin/plugins.php:41 wp-admin/plugins.php:71 wp-admin/plugins.php:131 +msgid "You do not have sufficient permissions to activate plugins for this site." +msgstr "No tienes suficientes permisos para activar plugins en este sitio." + +#: wp-admin/plugin-install.php:16 +msgid "You do not have sufficient permissions to install plugins on this site." +msgstr "No tienes suficientes permisos para instalar plugins en este sitio." + +#: wp-admin/plugins.php:154 wp-admin/plugins.php:167 +msgid "You do not have sufficient permissions to deactivate plugins for this site." +msgstr "No tienes suficientes permisos para desactivar plugins en este sitio." + +#: wp-admin/plugins.php:190 +msgid "You do not have sufficient permissions to delete plugins for this site." +msgstr "No tienes suficientes permisos para eliminar plugins en este sitio." + +#: wp-admin/link-add.php:13 +msgid "You do not have sufficient permissions to add links to this site." +msgstr "No tienes suficientes permisos para añadir enlaces a este sitio." + +#: wp-admin/link-manager.php:12 wp-admin/link-manager.php:56 +#: wp-admin/link.php:18 +msgid "You do not have sufficient permissions to edit the links for this site." +msgstr "No tienes suficientes permisos para editar los enlaces en este sitio." + +#: wp-admin/export.php:13 +msgid "You do not have sufficient permissions to export the content of this site." +msgstr "No tienes suficientes permisos para exportar el contenido de este sitio." + +#: wp-admin/import.php:15 +msgid "You do not have sufficient permissions to import content in this site." +msgstr "No tienes suficientes permisos para importar contenidos en este sitio." + +#: wp-admin/import.php:58 +msgid "If you have posts or comments in another system, WordPress can import those into this site. To get started, choose a system to import from below:" +msgstr "Si tienes entradas o comentarios en otro sistema, WordPress los puede importar a este sitio. Para comenzar, elige el sistema desde el que los importarás:" + +#: wp-admin/plugin-editor.php:30 +msgid "There are no plugins installed on this site." +msgstr "No hay plugins instalados en este sitio." + +#: wp-admin/plugin-editor.php:18 +msgid "You do not have sufficient permissions to edit plugins for this site." +msgstr "No tienes suficientes permisos para editar los plugins de este sitio." + +#: wp-admin/includes/nav-menu.php:609 wp-admin/includes/nav-menu.php:828 +msgid "No items." +msgstr "Sin elementos." + +#: wp-admin/nav-menus.php:539 +msgid "Menu Name" +msgstr "Nombre del menú" + +#: wp-admin/includes/nav-menu.php:1143 +msgid "CSS Classes" +msgstr "Clases CSS" + +#: wp-admin/includes/nav-menu.php:134 +msgid "Navigation Label" +msgstr "Etiqueta de navegación" + +#: wp-includes/script-loader.php:441 +msgctxt "search results" +msgid "No results found." +msgstr "No se han encontrado resultados." + +#: wp-includes/nav-menu.php:226 wp-includes/nav-menu.php:233 +msgid "The menu name %s conflicts with another menu name. Please try another." +msgstr "El nombre de menú %s está creando un conflicto con otro nombre de menú. Por favor, selecciona otro nombre." + +#: wp-admin/includes/schema.php:774 +msgid "To use a subdomain configuration, you must have a wildcard entry in your DNS. This usually means adding a * hostname record pointing at your web server in your DNS configuration tool." +msgstr "Para hacer uso de la configuración en subdominios debes tener una entrada de registro wildcard en tu DNS. Normalmente esto se consigue añadiendo el registro * en tu nombre de servidor, apuntando a tu servidor o dominio en las herramientas de configuración de tu servidor o dominio." + +#: wp-admin/includes/schema.php:770 +msgid "The installer attempted to contact a random hostname (%1$s) on your domain." +msgstr "El instalador ha tratado de contactar con un servidor aleatorio (%1$s) en tu dominio." + +#: wp-admin/includes/nav-menu.php:387 +msgid "Custom Links" +msgstr "Enlaces personalizados" + +#: wp-includes/nav-menu.php:275 +msgid "The given object ID is not that of a menu item." +msgstr "El ID de objeto dado no es de un objeto de menú." + +#: wp-admin/install.php:108 +msgid "Usernames can have only alphanumeric characters, spaces, underscores, hyphens, periods and the @ symbol." +msgstr "Los nombres de usuario sólo pueden tener caracteres alfanuméricos, espacios, guiones bajos, guiones, puntos y el símbolo @." + +#: wp-admin/install.php:197 +msgid "the username you provided has invalid characters." +msgstr "el nombre de usuario proporcionado tiene caracteres inválidos." + +#: wp-admin/includes/nav-menu.php:114 +msgid "Move down" +msgstr "Mover abajo" + +#: wp-admin/nav-menus.php:237 +msgid "The menu item has been successfully deleted." +msgstr "La opción del menú se ha eliminado correctamente." + +#: wp-admin/includes/nav-menu.php:101 +msgid "Move up" +msgstr "Mover arriba" + +#: wp-admin/nav-menus.php:519 wp-admin/nav-menus.php:529 +msgid "Add menu" +msgstr "Añadir menú" + +#: wp-includes/formatting.php:2426 wp-includes/formatting.php:2434 +msgid "The email address entered did not appear to be a valid email address. Please enter a valid email address." +msgstr "La dirección de correo electrónico parece que no es válida. Por favor, introduce una válida." + +#: wp-includes/formatting.php:2517 +msgid "The WordPress address you entered did not appear to be a valid URL. Please enter a valid URL." +msgstr "La dirección de WordPress parece no ser una URL válida. Por favor, introduce una válida." + +#: wp-includes/formatting.php:2527 +msgid "The Site address you entered did not appear to be a valid URL. Please enter a valid URL." +msgstr "La dirección del sitio no parece ser una URL válida. Por favor, introduce una válida." + +#: wp-includes/taxonomy.php:2020 +msgid "A term with the name provided already exists with this parent." +msgstr "Un término con el nombre dado ya existe en este nivel." + +#: wp-admin/includes/class-wp-theme-install-list-table.php:98 +#: wp-admin/includes/class-wp-plugin-install-list-table.php:86 +msgid "Try again" +msgstr "Inténtalo de nuevo" + +#: wp-admin/includes/plugin-install.php:50 wp-admin/includes/theme.php:406 +msgid "An unknown error occurred." +msgstr "Ha ocurrido un error desconocido." + +#: wp-admin/includes/plugin-install.php:46 wp-admin/includes/theme.php:402 +msgid "An Unexpected HTTP Error occurred during the API request." +msgstr "Hubo un error HTTP inesperado durante la petición API." + +#: wp-admin/admin-ajax.php:866 +msgid "Please provide a custom field name." +msgstr "Por favor, proporciona un nombre al campo personalizado." + +#: wp-includes/locale.php:186 +msgid "number_format_decimal_point" +msgstr "," + +#: wp-includes/comment-template.php:1537 +msgid "Your email address will not be published." +msgstr "Tu dirección de correo electrónico no será publicada." + +#: wp-admin/custom-background.php:246 +msgid "Display Options" +msgstr "Opciones de visualización" + +#: wp-admin/custom-header.php:552 wp-admin/custom-background.php:209 +msgid "Remove Image" +msgstr "Eliminar Imagen" + +#: wp-admin/custom-header.php:502 wp-admin/custom-background.php:234 +msgid "Upload Image" +msgstr "Subir imagen" + +#: wp-admin/custom-background.php:295 +msgid "Background Color" +msgstr "Color de fondo" + +#: wp-admin/custom-background.php:253 +msgid "Background Position" +msgstr "Posición del fondo" + +#: wp-admin/users.php:265 +msgid "You have specified these users for removal:" +msgstr "Has especificado estos usuarios para ser eliminados:" + +#: wp-admin/users.php:91 wp-admin/users.php:138 +msgid "User deletion is not allowed from this screen." +msgstr "No está permitido eliminar usuarios desde esta pantalla." + +#: wp-admin/users.php:111 +msgid "You can’t delete that user." +msgstr "No puedes eliminar este usuario." + +#: wp-admin/users.php:273 +msgid "ID #%1s: %2s The current user will not be removed." +msgstr "ID #%1s: %2s El usuario actual no será eliminado." + +#: wp-admin/users.php:275 +msgid "ID #%1s: %2s You don't have permission to remove this user." +msgstr "ID #%1s: %2s No tienes permisos para eliminar este usuario." + +#: wp-admin/users.php:284 +msgid "Confirm Removal" +msgstr "Confirmar Eliminación" + +#: wp-admin/users.php:286 +msgid "There are no valid users selected for removal." +msgstr "No hay usuarios válidos seleccionados para su eliminación." + +#: wp-admin/users.php:335 +msgid "You can't remove the current user." +msgstr "No puedes eliminar el usuario actual." + +#: wp-admin/users.php:336 +msgid "Other users have been removed." +msgstr "Otros usuarios han sido eliminados." + +#: wp-admin/includes/class-wp-upgrader.php:1088 +msgid "%1$s updated successfully." +msgstr "%1$s actualizado correctamente." + +#: wp-admin/includes/class-wp-upgrader.php:1088 +msgid "Show Details" +msgstr "Mostrar detalles" + +#: wp-admin/includes/class-wp-upgrader.php:1088 +msgid "Hide Details" +msgstr "Ocultar detalles" + +#: wp-admin/install.php:194 +msgid "you must provide a valid username." +msgstr "debes proporcionar un nombre de usuario válido." + +#: wp-admin/includes/user.php:378 +msgid "Yes, take me to my profile page" +msgstr "Sí, llévame a mi página de perfil" + +#: wp-admin/includes/upgrade.php:74 +msgid "Your chosen password." +msgstr "Tu contraseña elegida." + +#: wp-admin/includes/user.php:379 +msgid "No thanks, do not remind me again" +msgstr "No gracias, no me lo recuerdes de nuevo" + +#: wp-admin/post.php:235 +msgid "You are not allowed to move this item out of the Trash." +msgstr "No te está permitido mover este elemento fuera de la Papelera." + +#: wp-admin/post.php:254 wp-admin/post.php:257 +msgid "Error in deleting." +msgstr "Error al eliminar." + +#: wp-admin/edit.php:97 wp-admin/post.php:238 +msgid "Error in restoring from Trash." +msgstr "Error al restaurar de la papelera." + +#: wp-admin/edit.php:94 +msgid "You are not allowed to restore this item from the Trash." +msgstr "No estás autorizado para restaurar este elemento de la papelera." + +#: wp-admin/edit.php:84 wp-admin/post.php:225 +msgid "Error in moving to Trash." +msgstr "Error moviendo a la papelera." + +#: wp-admin/edit-comments.php:189 +msgid "%s comment restored from the Trash" +msgid_plural "%s comments restored from the Trash" +msgstr[0] "%s comentario restaurado de la papelera" +msgstr[1] "%s comentarios restaurados de la papelera" + +#: wp-admin/edit-comments.php:185 +msgid "%s comment moved to the Trash." +msgid_plural "%s comments moved to the Trash." +msgstr[0] "%s comentario movido a la papelera." +msgstr[1] "%s comentarios movidos a la papelera." + +#: wp-admin/edit.php:81 wp-admin/post.php:222 +msgid "You are not allowed to move this item to the Trash." +msgstr "No te está permitido mover este elemento a la papelera." + +#: wp-admin/edit.php:228 +msgid "Item restored from the Trash." +msgid_plural "%s items restored from the Trash." +msgstr[0] "Elemento restaurado de la papelera." +msgstr[1] "%s elementos restaurados de la papelera." + +#: wp-admin/update-core.php:275 +msgid "The following themes have new versions available. Check the ones you want to update and then click “Update Themes”." +msgstr "Los siguientes temas tienen versiones nuevas disponibles. Marca aquellas que quieras actualizar y haz clic en “Actualizar Temas”." + +#: wp-includes/class-http.php:123 +msgid "A valid URL was not provided." +msgstr "No se ha facilitado una URL válida." + +#: wp-includes/comment-template.php:1536 +msgid "Logged in as %2$s. Log out?" +msgstr "Conectado como %2$s. ¿Quieres salir?" + +#: wp-admin/user-new.php:169 +msgid "User has been added to your site." +msgstr "El usuario ha sido añadido a tu sitio." + +#: wp-admin/user-new.php:172 +msgid "That user is already a member of this site." +msgstr "Este usuario ya es miembro de este sitio." + +#: wp-admin/user-new.php:166 +msgid "Invitation email sent to user. A confirmation link must be clicked for them to be added to your site." +msgstr "Invitación enviada por correo electrónico al usuario. Debe hacer clic en un enlace de confirmación para que se añada a tu sitio." + +#: wp-includes/media.php:419 +msgid "Could not calculate resized image dimensions" +msgstr "No se han podido recalcular las dimensiones de la imagen redimensionada" + +#: wp-includes/comment-template.php:726 +msgid "Use get_trackback_url() instead if you do not want the value echoed." +msgstr "Utiliza get_trackback_url() en su lugar si no quieres un valor vacío." + +#: wp-admin/update-core.php:203 +msgid "The following plugins have new versions available. Check the ones you want to update and then click “Update Plugins”." +msgstr "Hay nuevas versiones de los siguientes plugins. Marca aquellos que quieras actualizar y haz clic en “Actualizar plugins”." + +#: wp-mail.php:14 +msgid "This action has been disabled by the administrator." +msgstr "Esta acción ha sido deshabilitada por el administrador." + +#: wp-includes/author-template.php:55 +msgid "Use get_the_author() instead if you do not want the value echoed." +msgstr "Utiliza get_the_author() en su lugar si no quieres un valor vacío." + +#: wp-admin/options.php:140 +msgid "The %1$s setting is unregistered. Unregistered settings are deprecated. See http://codex.wordpress.org/Settings_API" +msgstr "La configuración %1$s no está registrada. Las configuraciones sin registrar son obsoletas. Visita http://codex.wordpress.org/Settings_API" + +#: wp-admin/custom-background.php:214 +msgid "This will remove the background image. You will not be able to restore any customizations." +msgstr "Esto eliminará la imagen de fondo. No podrás restaurar ninguna personalización." + +#: wp-admin/edit-tag-form.php:14 +msgid "You did not select an item for editing." +msgstr "No has elegido un elemento para editar." + +#: wp-admin/includes/class-wp-themes-list-table.php:88 +msgid "Only the current theme is available to you. Contact the %s administrator for information about accessing additional themes." +msgstr "Para ti sólo está disponible el tema actual. Contacta con el administrador de %s para obtener información sobre cómo acceder a temas adicionales." + +#: wp-admin/includes/dashboard.php:1154 +msgid "%2$sMB" +msgstr "%2$sMB" + +#: wp-admin/includes/dashboard.php:1162 +msgid "%2$sMB (%3$s%%)" +msgstr "%2$sMB (%3$s%%)" + +#: wp-admin/includes/file.php:22 +msgid "Author Template" +msgstr "Plantilla de autor" + +#: wp-admin/includes/file.php:13 +msgid "Visual Editor Stylesheet" +msgstr "Hoja de estilos del editor visual" + +#: wp-admin/includes/file.php:23 +msgid "Tag Template" +msgstr "Plantilla de etiqueta" + +#: wp-admin/update-core.php:276 +msgctxt "Link used in suggestion to use child themes in GUU" +msgid "http://codex.wordpress.org/Child_Themes" +msgstr "http://codex.wordpress.org/Child_Themes" + +#: wp-admin/edit-form-advanced.php:55 +msgid "Page saved." +msgstr "Página guardada." + +#: wp-admin/edit-form-advanced.php:239 wp-admin/includes/post.php:1845 +msgid "Enter title here" +msgstr "Introduce el título aquí" + +#: wp-admin/users.php:204 wp-admin/users.php:212 wp-admin/users.php:241 +#: wp-admin/users.php:249 +msgid "You can’t remove users." +msgstr "No puedes eliminar usuarios." + +#: wp-includes/script-loader.php:408 +msgid "Are you sure you want to install this plugin?" +msgstr "¿Estás seguro de querer instalar este plugin?" + +#: wp-admin/includes/class-wp-plugin-install-list-table.php:208 +msgid "This plugin is already installed and is up to date" +msgstr "Este plugin ya está instalado y actualizado" + +#: wp-admin/includes/class-wp-plugin-install-list-table.php:192 +msgid "More information about %s" +msgstr "Más información sobre %s" + +#: wp-admin/update-core.php:29 +#: wp-admin/includes/class-wp-plugin-install-list-table.php:204 +msgid "Update Now" +msgstr "Actualizar ahora" + +#: wp-admin/user-edit.php:266 +msgid "Grant this user super admin privileges for the Network." +msgstr "Dar permisos de super admin en la red a este usuario." + +#: wp-admin/user-edit.php:155 +msgid "Important:" +msgstr "Importante:" + +#: wp-admin/user-edit.php:155 +msgid "This user has super admin privileges." +msgstr "Este usuario tiene privilegios de super admin." + +#: wp-admin/includes/post.php:1238 +msgid "Remove featured image" +msgstr "Quitar la imagen destacada" + +#: wp-admin/includes/post.php:1225 wp-admin/includes/post.php:1226 +msgid "Set featured image" +msgstr "Establecer la imagen destacada" + +#: wp-includes/script-loader.php:431 wp-admin/includes/media.php:1338 +msgid "Use as featured image" +msgstr "Usar como imagen destacada" + +#: wp-admin/edit-form-advanced.php:127 +msgid "Featured Image" +msgstr "Imagen destacada" + +#: wp-admin/includes/class-wp-plugin-install-list-table.php:204 +msgid "Update to version %s" +msgstr "Actualizar a la versión %s" + +#: wp-admin/user-new.php:183 +msgid "User added." +msgstr "Usuario añadido." + +#: wp-includes/script-loader.php:265 wp-admin/install.php:258 +msgid "Mismatch" +msgstr "No coinciden" + +#: wp-admin/setup-config.php:163 +msgid "ERROR: \"Table Prefix\" can only contain numbers, letters, and underscores." +msgstr "ERROR: El \"Prefijo Tabla\" sólo puede contener números, letras y guiones bajos." + +#: wp-admin/press-this.php:540 +msgid "You cannot modify this Taxonomy." +msgstr "No puedes modificar esta taxonomía." + +#: wp-admin/custom-background.php:275 +msgid "Tile Vertically" +msgstr "Mosaico Vertical" + +#: wp-admin/custom-background.php:274 +msgid "Tile Horizontally" +msgstr "Mosaico Horizontal" + +#: wp-includes/load.php:173 +msgid "Maintenance" +msgstr "Mantenimiento" + +#: wp-includes/load.php:177 +msgid "Briefly unavailable for scheduled maintenance. Check back in a minute." +msgstr "No disponible por mantenimiento programado. Vuelve a comprobar el sitio en unos minutos." + +#: wp-admin/options-reading.php:108 +msgid "items" +msgstr "elementos" + +#: wp-admin/user-edit.php:238 +msgid "Usernames cannot be changed." +msgstr "El nombre de usuario no puede cambiarse." + +#: wp-includes/post.php:86 +msgid "Navigation Menu Items" +msgstr "Elementos del menú de navegación" + +#: wp-includes/post.php:87 +msgid "Navigation Menu Item" +msgstr "Elemento del menú de navegación" + +#: wp-includes/taxonomy.php:49 +msgid "Navigation Menus" +msgstr "Menús de navegación" + +#: wp-admin/nav-menus.php:385 +msgid "The %s menu has been updated." +msgstr "El menú %s se ha actualizado." + +#: wp-admin/nav-menus.php:256 +msgid "The menu has been successfully deleted." +msgstr "El menú se ha borrado con éxito." + +#: wp-includes/functions.php:1919 +msgid "One or more database tables are unavailable. The database may need to be repaired." +msgstr "Una tabla o más de la base de dato no están disponibles. La base de datos debe ser reparada." + +#: wp-admin/includes/dashboard.php:420 +msgid "Search Engines Blocked" +msgstr "Buscadores bloqueados" + +#: wp-admin/includes/dashboard.php:419 +msgid "Your site is asking search engines not to index its content" +msgstr "Tu sitio le está diciendo a los buscadores que no indexen su contenido." + +#: wp-admin/plugins.php:20 +msgid "You do not have sufficient permissions to manage plugins for this site." +msgstr "No tienes suficientes permisos para administrar los plugins de este sitio." + +#: wp-admin/options-general.php:101 +msgid "Enter the address here if you want your site homepage to be different from the directory you installed WordPress." +msgstr "Introduce la dirección de tu página de inicio si es diferente al directorio donde está instalado WordPress." + +#: wp-admin/options-discussion.php:162 +msgid "An avatar is an image that follows you from weblog to weblog appearing beside your name when you comment on avatar enabled sites. Here you can enable the display of avatars for people who comment on your site." +msgstr "Un avatar es una imagen que te sigue de sitio en sitio, apareciendo junto a tu nombre cuando comentas en una entrada si están activados los avatares en el sitio. Aquí puedes activar que se muestren los avatares de la gente que comente en tu sitio." + +#: wp-admin/options-general.php:99 +msgid "Site address (URL)" +msgstr "Dirección del sitio (URL)" + +#: wp-admin/options-general.php:91 +msgid "In a few words, explain what this site is about." +msgstr "En pocas palabras, explica de qué va este sitio." + +#: wp-admin/options-general.php:299 +msgid "Site language:" +msgstr "Idioma del sitio:" + +#: wp-admin/options-privacy.php:42 +msgid "I would like my site to be visible to everyone, including search engines (like Google, Bing, Technorati) and archivers" +msgstr "Quiero que mi sitio sea visible para todo el mundo, incluyendo buscadores (como Google, Bing, Technorati) y archivadores" + +#: wp-admin/options-privacy.php:39 wp-admin/options-privacy.php:40 +msgid "Site Visibility" +msgstr "Visibilidad del sitio" + +#: wp-admin/options-writing.php:165 +msgid "WordPress is not notifying any Update Services because of your site’s privacy settings." +msgstr "WordPress no está notificando a ningún Servicio de Actualizaciones por la configuración de privacidad." + +#: wp-admin/options-reading.php:121 +msgid "The character encoding of your site (UTF-8 is recommended, if you are adventurous there are some other encodings)" +msgstr "La codificación de caracteres de tu sitio (recomendamos UTF-8, pero si eres un aventurero, tienes otras codificaciones)" + +#: wp-admin/includes/template.php:1092 wp-admin/includes/template.php:1132 +#: wp-admin/includes/plugin.php:1602 wp-admin/includes/plugin.php:1625 +msgid "The miscellaneous options group has been removed. Use another settings group." +msgstr "Las opciones misceláneas de grupo se han eliminado. Usa otros ajustes de grupo." + +#: wp-links-opml.php:29 +msgid "Links for %s" +msgstr "Enlaces para %s" + +#: wp-includes/nav-menu.php:611 +msgid "Custom" +msgstr "Personalizado" + +#: wp-admin/includes/nav-menu.php:149 +msgid "New window or tab" +msgstr "Nueva ventana o pestaña" + +#: wp-admin/includes/nav-menu.php:169 +msgid "The description will be displayed in the menu if the current theme supports it." +msgstr "La descripción se mostrará en los menús si el tema actual lo soporta." + +#: wp-admin/includes/nav-menu.php:148 +msgid "Same window or tab" +msgstr "Misma ventana o pestaña" + +#: wp-includes/default-widgets.php:1094 +msgid "No menus have been created yet. Create some." +msgstr "Aún no se han creado menús. Crea alguno." + +#: wp-admin/options.php:117 +msgid "You do not have sufficient permissions to modify unregistered settings for this site." +msgstr "No tienes suficientes permisos para modificar ajustes no registrados para este sitio." + +#: wp-admin/options-general.php:130 +msgid "There is a pending change of the admin e-mail to %1$s. Cancel" +msgstr "Hay un cambio pendiente del correo electrónico del administrador a %1$s. Cancelar" + +#: wp-includes/script-loader.php:442 +msgid "" +"You are about to permanently delete this menu. \n" +" 'Cancel' to stop, 'OK' to delete." +msgstr "" +"Estás a punto de eliminar permanentemente este menú. \n" +"'Cancelar' para parar, 'OK' para eliminar." + +#: wp-admin/includes/nav-menu.php:140 +msgid "Title Attribute" +msgstr "Atributos del título" + +#: wp-admin/nav-menus.php:296 +msgid "The %s menu has been successfully created." +msgstr "El menú %s se ha creado correctamente." + +#: wp-admin/includes/nav-menu.php:146 wp-admin/includes/nav-menu.php:1142 +msgid "Link Target" +msgstr "Destino del enlace" + +#: wp-admin/includes/nav-menu.php:155 +msgid "CSS Classes (optional)" +msgstr "Clases CSS (opcional)" + +#: wp-admin/nav-menus.php:559 wp-admin/nav-menus.php:598 +msgid "Save Menu" +msgstr "Guardar menú" + +#: wp-admin/install.php:117 +msgid "A password will be automatically generated for you if you leave this blank." +msgstr "Se generará un password automático si lo dejas en blanco. " + +#: wp-admin/install.php:116 +msgid "Password, twice" +msgstr "Password, dos veces" + +#: wp-admin/includes/class-wp-upgrader.php:1220 +msgid "Updating Theme %1$s (%2$d/%3$d)" +msgstr "Actualizando tema %1$s (%2$d/%3$d)" + +#: wp-includes/link-template.php:2464 +msgid "This is the short link." +msgstr "Este es el enlace corto." + +#: wp-admin/options-discussion.php:42 +msgid "Attempt to notify any blogs linked to from the article." +msgstr "Tratar de avisar a los sitios enlazados desde el artículo." + +#: wp-admin/includes/schema.php:640 +msgid "You must provide a domain name." +msgstr "Debes facilitarnos un nombre de dominio." + +#: wp-admin/includes/schema.php:642 +msgid "You must provide a name for your network of sites." +msgstr "Debes facilitarnos un nombre para tu red de sitios." + +#: wp-admin/includes/schema.php:646 +msgid "The network already exists." +msgstr "La red ya existe." + +#: wp-admin/includes/schema.php:650 +msgid "You must provide a valid e-mail address." +msgstr "Debes facilitarnos una dirección de correo electrónico válida." + +#: wp-admin/includes/schema.php:772 +msgid "This resulted in an error message: %s" +msgstr "Esto ha dado como resultado un mensaje de error: %s" + +#: wp-admin/includes/schema.php:775 +msgid "You can still use your site but any subdomain you create may not be accessible. If you know your DNS is correct, ignore this message." +msgstr "Puedes continuar usando tu sitio, pero ningún subdominio que crees será accesible. Si sabes que tu configuración de DNS es correcta, ignora este mensaje." + +#: wp-admin/menu.php:223 +msgid "Delete Site" +msgstr "Eliminar sitio" + +#: wp-admin/includes/user.php:375 +msgid "Notice:" +msgstr "Aviso:" + +#: wp-admin/edit-form-advanced.php:247 +msgid "Get Shortlink" +msgstr "Obtener enlace corto" + +#: wp-includes/admin-bar.php:349 wp-admin/menu.php:57 +msgid "%d WordPress Update" +msgstr "%d Actualización WordPress" + +#: wp-includes/admin-bar.php:353 wp-admin/menu.php:61 +msgid "%d Theme Update" +msgid_plural "%d Theme Updates" +msgstr[0] "%d Actualización tema" +msgstr[1] "%d Actualizaciones temas" + +#: wp-includes/admin-bar.php:351 wp-admin/menu.php:59 +msgid "%d Plugin Update" +msgid_plural "%d Plugin Updates" +msgstr[0] "%d Actualización plugin" +msgstr[1] "%d Actualizaciones plugins" + +#: wp-admin/includes/class-wp-upgrader.php:1188 +msgid "Updating Plugin %1$s (%2$d/%3$d)" +msgstr "Actualizando plugin %1$s (%2$d/%3$d)" + +#: wp-admin/includes/class-wp-upgrader.php:1087 +msgid "The update of %1$s failed." +msgstr "La actualización de %1$s ha fallado." + +#: wp-admin/includes/upgrade.php:87 +msgid "The password you chose during the install." +msgstr "La contraseña que has elegido durante la instalación." + +#: wp-admin/includes/upgrade.php:77 +msgid "User already exists. Password inherited." +msgstr "El usuario ya existe. No se ha modificado la contraseña." + +#: wp-admin/install.php:201 +msgid "your passwords do not match. Please try again" +msgstr "Las contraseñas introducidas no coinciden. Por favor, prueba de nuevo" + +#: wp-includes/admin-bar.php:358 wp-admin/menu.php:67 +msgid "Updates %s" +msgstr "Actualizar %s" + +#: wp-admin/upgrade.php:70 wp-admin/update-core.php:50 +msgid "You cannot update because WordPress %1$s requires MySQL version %2$s or higher. You are running version %3$s." +msgstr "La actualización no puede instalarse porque WordPress %1$s requiere la versión %2$s o superior de MySQL. Estás usando la versión %3$s." + +#: wp-admin/update-core.php:364 +msgid "WordPress updated successfully" +msgstr "WordPress ha sido actualizado correctamente" + +#: wp-admin/update-core.php:345 +msgid "Update WordPress" +msgstr "Actualizar WordPress" + +#: wp-admin/update-core.php:206 wp-admin/update-core.php:258 +#: wp-admin/update-core.php:464 wp-admin/update-core.php:469 +#: wp-admin/plugins.php:111 +msgid "Update Plugins" +msgstr "Actualizar plugins" + +#: wp-admin/upgrade.php:68 wp-admin/update-core.php:48 +msgid "You cannot update because WordPress %1$s requires PHP version %2$s or higher. You are running version %3$s." +msgstr "La actualización no puede instalarse ya que WordPress %1$s requiere la versión %2$s o superior de PHP. Estás usando la versión %3$s." + +#: wp-admin/upgrade.php:66 wp-admin/update-core.php:46 +msgid "You cannot update because WordPress %1$s requires PHP version %2$s or higher and MySQL version %3$s or higher. You are running PHP version %4$s and MySQL version %5$s." +msgstr "No puedes instalar a causa de que WordPress %1$s requiere la versión %2$s o superior de PHP y la versión %3$s o superior de MySQL. Estás usando la versión %4$s de PHP y la versión %5$s de MySQL." + +#: wp-admin/update-core.php:35 +msgid "You are using a development version of WordPress. You can update to the latest nightly build automatically or download the nightly build and install it manually:" +msgstr "Estás utilizando una versión en desarrollo de WordPress. Puedes actualizar a la última versión de desarrollo automáticamente o descargarla para instalarla manualmente:" + +#: wp-admin/update-core.php:39 +msgid "You have the latest version of WordPress. You do not need to update. However, if you want to re-install version %s, you can do so automatically or download the package and re-install manually:" +msgstr "Tienes la última versión de WordPress. No necesitas actualizar. No obstante, si quieres reinstalar la versión %s, puedes hacerlo automáticamente o descargarla para reinstalarla manualmente:" + +#: wp-admin/update-core.php:132 wp-admin/update-core.php:405 +msgid "WordPress Updates" +msgstr "Actualizaciones de WordPress" + +#: wp-admin/user-edit.php:263 +msgid "Super Admin" +msgstr "Súper Admin" + +#: wp-admin/custom-header.php:592 wp-admin/custom-background.php:298 +msgid "Select a Color" +msgstr "Elige un color" + +#: wp-admin/options-general.php:13 wp-admin/options-discussion.php:13 +#: wp-admin/options-privacy.php:13 wp-admin/options-media.php:13 +#: wp-admin/options-writing.php:13 wp-admin/options-reading.php:13 +#: wp-admin/options-permalink.php:13 +msgid "You do not have sufficient permissions to manage options for this site." +msgstr "No tienes suficientes permisos para administrar las opciones de este sitio." + +#: wp-admin/edit.php:17 wp-admin/post-new.php:17 +#: wp-admin/includes/class-wp-posts-list-table.php:56 +msgid "Invalid post type" +msgstr "Tipo de entrada no válido." + +#: wp-admin/includes/nav-menu.php:116 wp-admin/includes/nav-menu.php:118 +msgid "Edit Menu Item" +msgstr "Editar elemento del menú" + +#: wp-includes/script-loader.php:240 +msgid "File canceled." +msgstr "Archivo cancelado." + +#: wp-includes/load.php:22 +msgid "GLOBALS overwrite attempt detected" +msgstr "Detectado intento GLOBAL de sobrescritura." + +#: wp-admin/options-general.php:125 +msgid "This address is used for admin purposes. If you change this we will send you an e-mail at your new address to confirm it. The new address will not become active until confirmed." +msgstr "Esta dirección de correo electrónico se usa para propósitos administrativos. Si la cambias, te enviaremos un correo electrónico a tu nueva dirección para confirmarla. La nueva dirección no se activará hasta ser confirmada." + +#: wp-admin/options-general.php:202 +msgid "Daylight saving time begins on: %s." +msgstr "El horario de verano comienza el: %s." + +#: wp-admin/plugins.php:259 +msgid "%1$s by %2$s (will also delete its data)" +msgstr "%1$s por %2$s (también elimina sus propios datos)" + +#: wp-admin/plugins.php:252 +msgid "You are about to remove the following plugin:" +msgid_plural "You are about to remove the following plugins:" +msgstr[0] "Estás a punto de eliminar el siguiente plugin:" +msgstr[1] "Estás a punto de eliminar los siguientes plugins:" + +#: wp-admin/plugins.php:247 +msgid "Delete Plugin" +msgid_plural "Delete Plugins" +msgstr[0] "Eliminar Plugin" +msgstr[1] "Eliminar Plugins" + +#: wp-admin/plugins.php:270 +msgid "Are you sure you wish to delete these files and data?" +msgstr "¿Estás seguro de que deseas eliminar estos archivos y datos?" + +#: wp-admin/plugins.php:282 +msgid "Yes, Delete these files and data" +msgstr "Sí, quiero borrar estos archivos y datos" + +#: wp-admin/includes/class-wp-plugins-list-table.php:351 +msgid "Requires %s in wp-config.php." +msgstr "Requiere %s en wp-config.php." + +#: wp-admin/includes/class-wp-plugins-list-table.php:351 +msgid "Inactive:" +msgstr "Inactivo:" + +#: wp-admin/includes/class-wp-plugins-list-table.php:227 +msgid "Must-Use (%s)" +msgid_plural "Must-Use (%s)" +msgstr[0] "Debes Usar (%s)" +msgstr[1] "Debes Usar (%s)" + +#: wp-admin/theme-install.php:59 +msgctxt "theme" +msgid "Manage Themes" +msgstr "Administrar temas" + +#: wp-admin/themes.php:76 +msgctxt "theme" +msgid "Install Themes" +msgstr "Instalar temas" + +#: wp-admin/update-core.php:365 +msgid "Go to Dashboard" +msgstr "Ir al Escritorio" + +#: wp-includes/default-widgets.php:1103 wp-admin/nav-menus.php:487 +msgid "Select Menu:" +msgstr "Elegir menú:" + +#: wp-includes/taxonomy.php:50 +msgid "Navigation Menu" +msgstr "Menú de Navegación" + +#: wp-includes/default-widgets.php:1028 +msgid "Taxonomy:" +msgstr "Taxonomía:" + +#: wp-admin/nav-menus.php:299 wp-admin/nav-menus.php:309 +msgid "Please enter a valid menu name." +msgstr "Por favor, introduce un nombre de menú válido." + +#: wp-admin/nav-menus.php:564 +msgid "Delete Menu" +msgstr "Eliminar menú" + +#: wp-admin/includes/nav-menu.php:558 +msgid "Menu Item" +msgstr "Elemento del menú" + +#: wp-admin/includes/nav-menu.php:665 wp-admin/includes/nav-menu.php:879 +msgid "View All" +msgstr "Ver todo" + +#: wp-admin/includes/nav-menu.php:565 wp-admin/includes/nav-menu.php:786 +#: wp-admin/includes/nav-menu.php:963 +msgid "Add to Menu" +msgstr "Añadir al menú" + +#: wp-admin/options-general.php:179 +msgid "This timezone is currently in daylight saving time." +msgstr "Esta zona horaria se encuentra actualmente en el horario de verano." + +#: wp-admin/options-general.php:207 +msgid "This timezone does not observe daylight saving time." +msgstr "Esta zona horaria no tiene en cuenta el horario de verano." + +#: wp-admin/includes/class-wp-plugins-list-table.php:230 +msgid "Drop-ins (%s)" +msgid_plural "Drop-ins (%s)" +msgstr[0] "Infiltrado (%s)" +msgstr[1] "Infiltrados (%s)" + +#: wp-admin/includes/plugin.php:400 +msgid "Executed before Multisite is loaded." +msgstr "Ejecutado antes de cargar el Multisitio." + +#: wp-admin/includes/plugin.php:396 +msgid "External object cache." +msgstr "Caché de objetos externos." + +#: wp-admin/includes/plugin.php:395 +msgid "Custom maintenance message." +msgstr "Mensaje personalizado de mantenimiento." + +#: wp-admin/includes/plugin.php:394 +msgid "Custom install script." +msgstr "Script personalizado de instalación." + +#: wp-admin/includes/plugin.php:393 +msgid "Custom database error message." +msgstr "Mensaje de error de base de datos personalizado." + +#: wp-admin/includes/file.php:288 +msgid "File is empty. Please upload something more substantial." +msgstr "El archivo está vacío. Por favor, sube algo con más sustancia." + +#: wp-admin/includes/class-wp-plugin-install-list-table.php:200 +msgid "Install %s" +msgstr "Instalar %s" + +#: wp-admin/includes/plugin.php:392 +msgid "Custom database class." +msgstr "Clase de base datos personalizada." + +#: wp-admin/includes/plugin.php:391 +msgid "Advanced caching plugin." +msgstr "Plugin avanzado de caché." + +#: wp-admin/install.php:157 +msgid "You cannot install because WordPress %1$s requires MySQL version %2$s or higher. You are running version %3$s." +msgstr "No puedes instalar porque WordPress %1$s requiere la versión %2$s o superior de MySQL. Estás usando la versión %3$s." + +#: wp-admin/install.php:155 +msgid "You cannot install because WordPress %1$s requires PHP version %2$s or higher. You are running version %3$s." +msgstr "No puedes instalar porque WordPress %1$s requiere la versión %2$s o superior de PHP. Estás usando la versión %3$s." + +#: wp-admin/includes/update.php:135 +msgid "WordPress %1$s is available! Please notify the site administrator." +msgstr "¡WordPress %1$s está disponible! Por favor, avisa al administrador del sitio." + +#: wp-admin/includes/update.php:133 +msgid "WordPress %1$s is available! Please update now." +msgstr "¡WordPress %1$s está disponible! Por favor, actualiza ahora." + +#: wp-admin/install.php:153 +msgid "You cannot install because WordPress %1$s requires PHP version %2$s or higher and MySQL version %3$s or higher. You are running PHP version %4$s and MySQL version %5$s." +msgstr "No puedes instalar ya que WordPress %1$s requiere la versión %2$s o superior de PHP y la versión %3$s o superior de MySQL. Estás usando la versión %4$s de PHP y la versión %5$s de MySQL." + +#: wp-includes/admin-bar.php:311 wp-admin/menu.php:161 wp-admin/menu.php:166 +#: wp-admin/nav-menus.php:466 +msgid "Menus" +msgstr "Menús" + +#: wp-admin/comment.php:141 +msgid "This comment is currently marked as spam." +msgstr "Este comentario está marcado como spam." + +#: wp-admin/comment.php:80 +msgid "Moderate Comment" +msgstr "Comentario moderado" + +#: wp-admin/comment.php:138 +msgid "This comment is currently approved." +msgstr "Este comentario está aprobado." + +#: wp-admin/edit-comments.php:197 +msgid "This comment is already approved." +msgstr "Este comentario ya está aprobado." + +#: wp-admin/comment.php:144 +msgid "This comment is currently in the Trash." +msgstr "Este comentario está actualmente en la papelera." + +#: wp-admin/custom-background.php:270 +msgid "Repeat" +msgstr "Repetir" + +#: wp-admin/custom-background.php:280 +msgid "Attachment" +msgstr "Adjunto" + +#: wp-admin/custom-background.php:273 +msgid "Tile" +msgstr "Mosaico" + +#: wp-admin/custom-background.php:284 +msgid "Scroll" +msgstr "Desplazar" + +#: wp-admin/custom-background.php:288 +msgid "Fixed" +msgstr "Fijo" + +#: wp-admin/edit-comments.php:200 +msgid "This comment is already in the Trash." +msgstr "Este comentario ya está en la papelera." + +#: wp-admin/edit-comments.php:200 +msgid "View Trash" +msgstr "Ver papelera" + +#: wp-admin/edit-comments.php:203 +msgid "This comment is already marked as spam." +msgstr "Este comentario ya ha sido marcado como spam." + +#: wp-includes/class-wp-xmlrpc-server.php:164 +#: wp-includes/class-wp-xmlrpc-server.php:188 +msgid "Bad login/pass combination." +msgstr "Combinación de usuario/contraseña errónea." + +#: wp-includes/class-wp-xmlrpc-server.php:294 +msgid "Software Name" +msgstr "Nombre de la aplicación" + +#: wp-includes/class-wp-xmlrpc-server.php:299 +msgid "Software Version" +msgstr "Versión de la aplicación" + +#: wp-includes/class-wp-xmlrpc-server.php:311 +msgid "Time Zone" +msgstr "Zona horaria" + +#: wp-includes/class-wp-xmlrpc-server.php:336 +msgid "Allow new users to sign up" +msgstr "Permitir el registro de nuevos usuarios" + +#: wp-includes/class-wp-xmlrpc-server.php:465 +msgid "Sorry, you cannot edit this page." +msgstr "Disculpa, no puedes editar esta página." + +#: wp-includes/class-wp-xmlrpc-server.php:541 +#: wp-includes/class-wp-xmlrpc-server.php:651 +#: wp-includes/class-wp-xmlrpc-server.php:690 +msgid "Sorry, no such page." +msgstr "Disculpa, no existe esa página." + +#: wp-includes/class-wp-xmlrpc-server.php:569 +#: wp-includes/class-wp-xmlrpc-server.php:733 +msgid "Sorry, you cannot edit pages." +msgstr "Disculpa, no puedes editar páginas." + +#: wp-includes/class-wp-xmlrpc-server.php:617 +msgid "Sorry, you cannot add new pages." +msgstr "Disculpa, no puedes añadir nuevas páginas." + +#: wp-includes/class-wp-xmlrpc-server.php:655 +msgid "Sorry, you do not have the right to delete this page." +msgstr "Disculpa, no tienes autorización para borrar esta página." + +#: wp-includes/class-wp-xmlrpc-server.php:660 +msgid "Failed to delete the page." +msgstr "No se logró borrar la página." + +#: wp-includes/class-wp-xmlrpc-server.php:694 +msgid "Sorry, you do not have the right to edit this page." +msgstr "Disculpa, no tienes autorización para editar esta página." + +#: wp-includes/class-wp-xmlrpc-server.php:873 +msgid "Sorry, you do not have the right to add a category." +msgstr "Disculpa, no tienes autorización para añadir categorías." + +#: wp-includes/class-wp-xmlrpc-server.php:901 +#: wp-includes/class-wp-xmlrpc-server.php:903 +msgid "Sorry, the new category failed." +msgstr "Disculpa, la creación de la nueva categoría falló." + +#: wp-includes/class-wp-xmlrpc-server.php:931 +msgid "Sorry, you do not have the right to delete a category." +msgstr "Disculpa, no tienes autorización para borrar categorías." + +#: wp-includes/class-wp-xmlrpc-server.php:998 +#: wp-includes/class-wp-xmlrpc-server.php:1143 +#: wp-includes/class-wp-xmlrpc-server.php:1193 +msgid "Invalid comment ID." +msgstr "El ID del comentario no es válido." + +#: wp-includes/class-wp-xmlrpc-server.php:1067 +msgid "Sorry, you cannot edit comments." +msgstr "Disculpa, no puedes editar comentarios." + +#: wp-includes/class-wp-xmlrpc-server.php:1200 +msgid "Invalid comment status." +msgstr "El estado del comentario no es válido." + +#: wp-includes/class-wp-xmlrpc-server.php:1231 +msgid "Sorry, the comment could not be edited. Something wrong happened." +msgstr "Disculpa, no se ha podido editar el comentario. Se ha producido un error." + +#: wp-includes/class-wp-xmlrpc-server.php:1262 +msgid "You must be registered to comment" +msgstr "Los usuarios deben registrarse e identificarse para comentar" + +#: wp-includes/class-wp-xmlrpc-server.php:1275 +#: wp-includes/class-wp-xmlrpc-server.php:1278 +#: wp-includes/class-wp-xmlrpc-server.php:2549 +msgid "Invalid post ID." +msgstr "El ID de la entrada no es válido." + +#: wp-includes/class-wp-xmlrpc-server.php:1304 +msgid "Comment author name and email are required" +msgstr "El nombre y correo electrónico del autor del comentario son campos necesarios" + +#: wp-includes/class-wp-xmlrpc-server.php:1306 +msgid "A valid email address is required" +msgstr "Se necesita un correo electrónico válido" + +#: wp-includes/class-wp-xmlrpc-server.php:1365 +msgid "You are not allowed access to details about comments." +msgstr "No tienes autorización para ver los detalles de los comentarios." + +#: wp-includes/class-wp-xmlrpc-server.php:1527 +msgid "You are not allowed to update options." +msgstr "No tienes autorización para actualizar las opciones." + +#: wp-includes/class-wp-xmlrpc-server.php:1831 +#: wp-includes/class-wp-xmlrpc-server.php:2770 +#: wp-includes/class-wp-xmlrpc-server.php:3273 +msgid "Sorry, you cannot edit this post." +msgstr "Disculpa, no puedes editar esta entrada." + +#: wp-includes/class-wp-xmlrpc-server.php:1882 +#: wp-includes/class-wp-xmlrpc-server.php:3138 +msgid "Either there are no posts, or something went wrong." +msgstr "Una de dos, o no hay entradas o algo fue mal." + +#: wp-includes/class-wp-xmlrpc-server.php:1937 +msgid "Sorry, this user can not edit the template." +msgstr "Disculpa, este usuario no puede editar la plantilla." + +#: wp-includes/class-wp-xmlrpc-server.php:1977 +msgid "Sorry, this user cannot edit the template." +msgstr "Disculpa, este usuario no puede editar la plantilla." + +#: wp-includes/class-wp-xmlrpc-server.php:1987 +msgid "Either the file is not writable, or something wrong happened. The file has not been updated." +msgstr "Una de dos, o el archivo no tiene permisos de escritura, o ha ocurrido algún error. El archivo no ha sido actualizado." + +#: wp-includes/class-wp-xmlrpc-server.php:2073 +#: wp-includes/class-wp-xmlrpc-server.php:2125 +#: wp-includes/class-wp-xmlrpc-server.php:2865 +#: wp-includes/class-wp-xmlrpc-server.php:3335 +msgid "Sorry, no such post." +msgstr "Disculpa, no existe la entrada." + +#: wp-includes/class-wp-xmlrpc-server.php:2083 +#: wp-includes/class-wp-xmlrpc-server.php:2686 +msgid "Sorry, you do not have the right to publish this post." +msgstr "Disculpa, no tienes autorización para publicar esta entrada." + +#: wp-includes/class-wp-xmlrpc-server.php:2214 +#: wp-includes/class-wp-xmlrpc-server.php:2270 +#: wp-includes/class-wp-xmlrpc-server.php:2521 +#: wp-includes/class-wp-xmlrpc-server.php:2586 +msgid "Invalid post type." +msgstr "Tipo de entrada no válido." + +#: wp-includes/class-wp-xmlrpc-server.php:2263 +msgid "You are not allowed to post as this user" +msgstr "No tienes autorización para publicar entradas con este nombre de usuario." + +#: wp-includes/class-wp-xmlrpc-server.php:2267 +msgid "You are not allowed to create pages as this user" +msgstr "No tienes autorización para crear páginas con este nombre de usuario." + +#: wp-includes/class-wp-xmlrpc-server.php:2579 +msgid "You are not allowed to change the post author as this user." +msgstr "No tienes autorización para cambiar el autor de la entrada identificado con este nombre de usuario." + +#: wp-includes/class-wp-xmlrpc-server.php:2583 +msgid "You are not allowed to change the page author as this user." +msgstr "No tienes autorización para cambiar el autor de la página identificado con este nombre de usuario." + +#: wp-includes/class-wp-xmlrpc-server.php:2684 +msgid "Sorry, you do not have the right to publish this page." +msgstr "Disculpa, no tienes autorización para publicar esta página." + +#: wp-includes/class-wp-xmlrpc-server.php:2721 +msgid "Sorry, your entry could not be edited. Something wrong happened." +msgstr "Disculpa, no se pudo editar tu entrada. Ocurrió algún error." + +#: wp-includes/class-wp-xmlrpc-server.php:1576 +#: wp-includes/class-wp-xmlrpc-server.php:3056 +msgid "You are not allowed to upload files to this site." +msgstr "No tienes autorización para subir archivos al sitio." + +#: wp-includes/class-wp-xmlrpc-server.php:3083 +msgid "Could not write file %1$s (%2$s)" +msgstr "No se pudo escribir el archivo %1$s (%2$s)" + +#: wp-includes/class-wp-xmlrpc-server.php:3230 +msgid "Sorry, you can not edit this post." +msgstr "Disculpa, no puedes editar esta entrada." + +#: wp-includes/class-wp-xmlrpc-server.php:3427 +msgid "Is there no link to us?" +msgstr "¿No hay enlace hacia nosotros?" + +#: wp-includes/class-wp-xmlrpc-server.php:3467 +#: wp-includes/class-wp-xmlrpc-server.php:3477 +#: wp-includes/class-wp-xmlrpc-server.php:3484 +#: wp-includes/class-wp-xmlrpc-server.php:3591 +msgid "The specified target URL cannot be used as a target. It either doesn’t exist, or it is not a pingback-enabled resource." +msgstr "La URL especificada no puede utilizarse como destino. O bien no existe o no está habilitado para pingbacks." + +#: wp-includes/class-wp-xmlrpc-server.php:3480 +msgid "The source URL and the target URL cannot both point to the same resource." +msgstr "La URL de origen y la URL de destino no pueden apuntar ambas al mismo recurso." + +#: wp-includes/class-wp-xmlrpc-server.php:3488 +msgid "The pingback has already been registered." +msgstr "El pingback ya ha sido registrado." + +#: wp-includes/class-wp-xmlrpc-server.php:3496 +msgid "The source URL does not exist." +msgstr "La URL de origen no existe." + +#: wp-includes/class-wp-xmlrpc-server.php:3508 +msgid "We cannot find a title on that page." +msgstr "No podemos encontrar un título en esa página." + +#: wp-includes/class-wp-xmlrpc-server.php:3544 +msgid "The source URL does not contain a link to the target URL, and so cannot be used as a source." +msgstr "La URL de origen no contiene un enlace a la URL de destino, así que no puede ser usada como origen." + +#: wp-includes/class-wp-xmlrpc-server.php:3565 +msgid "Pingback from %1$s to %2$s registered. Keep the web talking! :-)" +msgstr "Pingback desde %1$s a %2$s registrado. ¡Haz que la web hable! :-)" + +#: wp-includes/class-wp-xmlrpc-server.php:3598 +msgid "The specified target URL does not exist." +msgstr "La URL de destino especificada no existe." + +#: wp-includes/load.php:115 +msgid "Your PHP installation appears to be missing the MySQL extension which is required by WordPress." +msgstr "Parece que tu instalación de PHP no cuenta con la extensión de MySQL, necesaria para hacer funcionar WordPress." + +#: wp-includes/load.php:369 +msgid "ERROR: $table_prefix in wp-config.php can only contain numbers, letters, and underscores." +msgstr "ERROR: $table_prefix en wp-config.php sólo puede contener números, letras y guiones bajos." + +#: wp-includes/wp-db.php:1032 +msgid "" +"\n" +"

    Error establishing a database connection

    \n" +"

    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.

    \n" +"
      \n" +"\t
    • Are you sure you have the correct username and password?
    • \n" +"\t
    • Are you sure that you have typed the correct hostname?
    • \n" +"\t
    • Are you sure that the database server is running?
    • \n" +"
    \n" +"

    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.

    \n" +msgstr "" +"\n" +"

    Error de conexión con la base de datos

    \n" +"

    Esto puede deberse a que los datos de usuario y contraseña de tu wp-config.php son incorrectos o a que no es posible contactar con el servidor de base de datos en %s, lo que podría significar que el servidor de bases de datos de tu host está inactivo.

    \n" +"
      \n" +"\t
    • ¿Estás seguro de que el nombre de usuario y la contraseña son correctos?
    • \n" +"\t
    • ¿Estás seguro de que el nombre del host es correcto?
    • \n" +"\t
    • ¿Estás seguro de que el servidor de bases de datos está activo?
    • \n" +"
    \n" +"

    Si no tienes muy claro lo que significan los términos anteriores, ponte en contacto con tu proveedor de alojamiento. Si necesitas más ayuda, puedes visitar los Foros de ayuda de WordPress.

    \n" + +#: wp-includes/wp-db.php:563 +msgid "Invalid database prefix" +msgstr "Prefijo de la base de datos no válido" + +#: wp-includes/wp-db.php:913 +msgid "WordPress database error %1$s for query %2$s made by %3$s" +msgstr "Error %1$s de la base de datos de WordPress para la consulta %2$s realizada por %3$s" + +#: wp-includes/wp-db.php:915 +msgid "WordPress database error %1$s for query %2$s" +msgstr "Error %1$s de la base de datos de WordPress para la consulta %2$s" + +#: wp-includes/wp-db.php:1311 +msgid " $db->get_row(string query, output type, int offset) -- Output type must be one of: OBJECT, ARRAY_A, ARRAY_N" +msgstr " $db->get_row(string query, output type, int offset) -- El tipo de salida (output) debe ser uno de estos: OBJECT, ARRAY_A, ARRAY_N" + +#: wp-load.php:55 +msgid "ltr" +msgstr "ltr" + +#: wp-load.php:56 +msgid "There doesn't seem to be a wp-config.php file. I need this before we can get started. Need more help? We got it. You can create a wp-config.php file through a web interface, but this doesn't work for all server setups. The safest way is to manually create the file.

    Create a Configuration File" +msgstr "Aparentemente falta el archivo wp-config.php. Este archivo es necesario para empezar. ¿Necesitas ayuda? La encontrarás aquí (en inglés). Puedes crear un archivo wp-config.php a través de la web, pero esto no funciona en algunos servidores. Lo más seguro es crear el archivo manualmente.

    Crear un archivo de configuración" + +#: wp-includes/comment-template.php:1543 +msgid "Cancel reply" +msgstr "Cancelar respuesta" + +#: wp-includes/comment-template.php:1544 +msgid "Post Comment" +msgstr "Publicar comentario" + +#: wp-includes/comment.php:387 +msgid "Unapproved" +msgstr "Rechazado" + +#: wp-includes/comment.php:628 wp-includes/comment.php:630 +msgid "Duplicate comment detected; it looks as though you’ve already said that!" +msgstr "Comentario duplicado: ¡parece que ya había sido enviado antes!" + +#: wp-includes/comment.php:688 wp-includes/comment.php:690 +msgid "You are posting comments too quickly. Slow down." +msgstr "Estás enviando comentarios a demasiada velocidad. Un poco de calma." + +#: wp-includes/comment.php:1412 +msgid "Could not update comment status" +msgstr "No ha sido posible actualizar el estado del comentario" + +#: wp-includes/cron.php:159 +msgid "This argument has changed to an array to match the behavior of the other cron functions." +msgstr "Este argumento ha cambiado a un array para que coincida con el comportamiento de otras funciones de cron." + +#: wp-includes/cron.php:314 +msgid "Once Hourly" +msgstr "Cada hora" + +#: wp-includes/cron.php:315 +msgid "Twice Daily" +msgstr "Dos veces al día" + +#: wp-includes/cron.php:316 +msgid "Once Daily" +msgstr "Cada día" + +#: wp-includes/default-widgets.php:68 +msgid "Sort by:" +msgstr "Ordenar por:" + +#: wp-includes/default-widgets.php:70 +msgid "Page title" +msgstr "Título de la página" + +#: wp-includes/default-widgets.php:71 +msgid "Page order" +msgstr "Orden de la página" + +#: wp-includes/default-widgets.php:72 +msgid "Page ID" +msgstr "ID de la página" + +#: wp-includes/default-widgets.php:76 +msgid "Exclude:" +msgstr "Excluir:" + +#: wp-includes/default-widgets.php:78 +msgid "Page IDs, separated by commas." +msgstr "IDs de página, separados por comas." + +#: wp-includes/default-widgets.php:93 +msgid "Your blogroll" +msgstr "Tus sitios de interés" + +#: wp-includes/default-widgets.php:108 wp-includes/default-widgets.php:143 +#: wp-admin/menu.php:94 +msgid "All Links" +msgstr "Todos los enlaces" + +#: wp-includes/default-widgets.php:141 +msgid "Select Link Category" +msgstr "Elige la categoría del enlace" + +#: wp-includes/default-widgets.php:154 +msgid "Show Link Image" +msgstr "Mostrar la imagen del enlace" + +#: wp-includes/default-widgets.php:156 +msgid "Show Link Name" +msgstr "Mostrar el nombre del enlace" + +#: wp-includes/default-widgets.php:158 +msgid "Show Link Description" +msgstr "Mostrar la descripción del enlace" + +#: wp-includes/default-widgets.php:160 +msgid "Show Link Rating" +msgstr "Mostrar la clasificación del enlace" + +#: wp-includes/default-widgets.php:233 +msgid "Select Month" +msgstr "Elegir mes" + +#: wp-includes/default-widgets.php:266 wp-includes/default-widgets.php:496 +msgid "Show post counts" +msgstr "Mostrar la cantidad de entradas" + +#: wp-includes/default-widgets.php:282 +msgid "Log in/out, admin, feed and WordPress links" +msgstr "Inicio/Cierre de sesión, administración, RSS y enlaces de WordPress" + +#: wp-includes/default-widgets.php:297 +msgid "Syndicate this site using RSS 2.0" +msgstr "Suscribirse a este sitio usando RSS 2.0" + +#: wp-includes/default-widgets.php:297 +msgid "Entries RSS" +msgstr "RSS de las entradas" + +#: wp-includes/default-widgets.php:331 +msgid "Calendar" +msgstr "Calendario" + +#: wp-includes/default-widgets.php:371 +msgid "Arbitrary text or HTML" +msgstr "Texto o HTML arbitrario" + +#: wp-includes/default-widgets.php:373 +msgid "Text" +msgstr "Texto" + +#: wp-includes/default-widgets.php:408 +msgid "Automatically add paragraphs" +msgstr "Añadir automáticamente parágrafos" + +#: wp-includes/default-widgets.php:421 +msgid "A list or dropdown of categories" +msgstr "Una lista o desplegable de categorías" + +#: wp-includes/default-widgets.php:440 +msgid "Select Category" +msgstr "Elegir categoría" + +#: wp-includes/default-widgets.php:499 +msgid "Show hierarchy" +msgstr "Mostrar jerarquía" + +#: wp-includes/default-widgets.php:514 wp-includes/default-widgets.php:536 +msgid "Recent Posts" +msgstr "Entradas recientes" + +#: wp-includes/default-widgets.php:585 +msgid "Number of posts to show:" +msgstr "Número de entradas a mostrar:" + +#: wp-includes/default-widgets.php:599 +msgid "The most recent comments" +msgstr "Los comentarios más recientes" + +#: wp-includes/default-widgets.php:651 +msgctxt "widgets" +msgid "%1$s on %2$s" +msgstr "%1$s en %2$s" + +#: wp-includes/default-widgets.php:696 +msgid "Entries from any RSS or Atom feed" +msgstr "Entradas desde cualquier feed RSS o Atom" + +#: wp-includes/default-widgets.php:740 +msgid "Syndicate this content" +msgstr "Sindicar este contenido" + +#: wp-includes/default-widgets.php:804 +msgid "An error has occurred; the feed is probably down. Try again later." +msgstr "Ha ocurrido un error; probablemente el feed está caído. Inténtalo de nuevo más tarde." + +#: wp-includes/default-widgets.php:818 +msgid "Untitled" +msgstr "Sin título" + +#: wp-includes/default-widgets.php:898 +msgid "RSS Error: %s" +msgstr "RSS Error: %s" + +#: wp-includes/default-widgets.php:902 +msgid "Enter the RSS feed URL here:" +msgstr "Introduce la URL del feed RSS aquí:" + +#: wp-includes/default-widgets.php:905 +msgid "Give the feed a title (optional):" +msgstr "Dale un título al feed (opcional):" + +#: wp-includes/default-widgets.php:908 +msgid "How many items would you like to display?" +msgstr "¿Cuantos elementos te gustaría mostrar?" + +#: wp-includes/default-widgets.php:917 +msgid "Display item content?" +msgstr "¿Mostrar el contenido?" + +#: wp-includes/default-widgets.php:920 +msgid "Display item author if available?" +msgstr "¿Mostrar el autor si está disponible?" + +#: wp-includes/default-widgets.php:923 +msgid "Display item date?" +msgstr "¿Mostrar la fecha?" + +#: wp-includes/default-widgets.php:989 +msgid "Your most used tags in cloud format" +msgstr "Las etiquetas más utilizadas en formato de nube" + +#: wp-includes/default-widgets.php:990 +msgid "Tag Cloud" +msgstr "Nube de etiquetas" + +#: wp-includes/deprecated.php:62 +msgid "new WordPress Loop" +msgstr "nuevo Loop de WordPress" + +#: wp-includes/deprecated.php:987 +msgid "Last updated" +msgstr "Última actualización" + +#: wp-includes/deprecated.php:1898 wp-includes/post-template.php:1154 +msgid "Missing Attachment" +msgstr "Falta el archivo" + +#: wp-includes/feed-atom-comments.php:21 +msgid "Comments for %1$s searching on %2$s" +msgstr "Comentarios para %1$s buscando en %2$s" + +#: wp-includes/feed-rss2-comments.php:26 wp-includes/feed-atom-comments.php:23 +msgid "Comments for %s" +msgstr "Comentarios para %s" + +#: wp-includes/feed-rss2-comments.php:45 wp-includes/feed-atom-comments.php:53 +msgid "Comment on %1$s by %2$s" +msgstr "Comentario en %1$s por %2$s" + +#: wp-includes/feed-rss2-comments.php:47 wp-includes/feed-atom-comments.php:55 +msgid "By: %s" +msgstr "Por: %s" + +#: wp-includes/feed-rss2-comments.php:22 +msgid "Comments on: %s" +msgstr "Comentarios en: %s" + +#: wp-includes/feed-rss2-comments.php:24 +msgid "Comments for %s searching on %s" +msgstr "Comentarios para %s buscando en %s" + +#: wp-includes/feed-rss2-comments.php:55 +msgid "Protected Comments: Please enter your password to view comments." +msgstr "Comentarios protegidos: Por favor, escribe tu contraseña para ver los comentarios." + +#: wp-includes/formatting.php:36 wp-includes/formatting.php:2905 +msgctxt "opening curly quote" +msgid "“" +msgstr "“" + +#: wp-includes/formatting.php:38 +msgctxt "closing curly quote" +msgid "”" +msgstr "”" + +#: wp-includes/formatting.php:1813 +msgid "%s min" +msgid_plural "%s mins" +msgstr[0] "%s min" +msgstr[1] "%s mins" + +#: wp-includes/formatting.php:1819 +msgid "%s hour" +msgid_plural "%s hours" +msgstr[0] "%s hora" +msgstr[1] "%s horas" + +#: wp-includes/formatting.php:1825 +msgid "%s day" +msgid_plural "%s days" +msgstr[0] "%s día" +msgstr[1] "%s días" + +#: wp-includes/formatting.php:2689 +msgid ", " +msgstr ", " + +#: wp-includes/formatting.php:2691 +msgid ", and " +msgstr ", y " + +#: wp-includes/formatting.php:2693 +msgid " and " +msgstr "y " + +#: wp-includes/functions.php:406 +msgid "%s is a protected WP option and may not be modified" +msgstr "%s es una opción protegida de WP y no puede modificarse" + +#: wp-includes/functions.php:1780 +msgid "ERROR: %s is not a valid feed template." +msgstr "ERROR: %s no es una plantilla de feed válida." + +#: wp-includes/functions.php:2274 wp-includes/functions.php:2392 +msgid "Unable to create directory %s. Is its parent directory writable by the server?" +msgstr "No se pudo crear el directorio %s. Asegúrate de que el servidor tiene permisos de escritura para el directorio superior." + +#: wp-includes/functions.php:2371 +msgid "Empty filename" +msgstr "El nombre de archivo está vacío." + +#: wp-includes/functions.php:2398 +msgid "Could not write file %s" +msgstr "No se pudo escribir el archivo %s." + +#: wp-includes/functions.php:2647 +msgid "Your attempt to edit this attachment: “%s” has failed." +msgstr "Tu intento de editar este archivo: “%s” ha fallado." + +#: wp-includes/functions.php:2649 +msgid "Your attempt to add this category has failed." +msgstr "Tu intento de añadir esta categoría ha fallado." + +#: wp-includes/functions.php:2650 +msgid "Your attempt to delete this category: “%s” has failed." +msgstr "Tu intento de eliminar esta categoría: “%s” ha fallado." + +#: wp-includes/functions.php:2651 +msgid "Your attempt to edit this category: “%s” has failed." +msgstr "Tu intento de editar esta categoría: “%s” ha fallado." + +#: wp-includes/functions.php:2653 +msgid "Your attempt to delete this comment: “%s” has failed." +msgstr "Tu intento de borrar este comentario: “%s” ha fallado." + +#: wp-includes/functions.php:2654 +msgid "Your attempt to unapprove this comment: “%s” has failed." +msgstr "Tu intento de rechazar este comentario: “%s” ha fallado." + +#: wp-includes/functions.php:2655 +msgid "Your attempt to approve this comment: “%s” has failed." +msgstr "Tu intento de aprobar este comentario: “%s” ha fallado." + +#: wp-includes/functions.php:2656 +msgid "Your attempt to edit this comment: “%s” has failed." +msgstr "Tu intento de editar este comentario: “%s” ha fallado." + +#: wp-includes/functions.php:2657 +msgid "Your attempt to bulk modify comments has failed." +msgstr "Tu intento de modificar en bloque los comentarios ha fallado." + +#: wp-includes/functions.php:2658 +msgid "Your attempt to moderate comments has failed." +msgstr "Tu intento de moderar comentarios ha fallado." + +#: wp-includes/functions.php:2660 +msgid "Your attempt to add this link has failed." +msgstr "Tu intento de añadir este enlace ha fallado." + +#: wp-includes/functions.php:2661 +msgid "Your attempt to delete this link: “%s” has failed." +msgstr "Tu intento de borrar este enlace: “%s” ha fallado." + +#: wp-includes/functions.php:2662 +msgid "Your attempt to edit this link: “%s” has failed." +msgstr "Tu intento de editar este enlace: “%s” ha fallado." + +#: wp-includes/functions.php:2663 +msgid "Your attempt to bulk modify links has failed." +msgstr "Tu intento de modificar en bloque los enlaces ha fallado." + +#: wp-includes/functions.php:2665 +msgid "Your attempt to add this page has failed." +msgstr "Tu intento de añadir esta página ha fallado." + +#: wp-includes/functions.php:2666 +msgid "Your attempt to delete this page: “%s” has failed." +msgstr "Tu intento de borrar esta página: “%s” ha fallado." + +#: wp-includes/functions.php:2667 +msgid "Your attempt to edit this page: “%s” has failed." +msgstr "Tu intento de editar esta página: “%s” ha fallado." + +#: wp-includes/functions.php:2669 +msgid "Your attempt to edit this plugin file: “%s” has failed." +msgstr "Tu intento de editar este archivo de un plugin: “%s” ha fallado." + +#: wp-includes/functions.php:2670 +msgid "Your attempt to activate this plugin: “%s” has failed." +msgstr "Tu intento de activar este plugin: “%s” ha fallado." + +#: wp-includes/functions.php:2671 +msgid "Your attempt to deactivate this plugin: “%s” has failed." +msgstr "Tu intento de desactivar este plugin: “%s” ha fallado." + +#: wp-includes/functions.php:2674 +msgid "Your attempt to add this post has failed." +msgstr "Tu intento de añadir esta entrada ha fallado." + +#: wp-includes/functions.php:2675 +msgid "Your attempt to delete this post: “%s” has failed." +msgstr "Tu intento de borrar esta entrada: “%s” ha fallado" + +#: wp-includes/functions.php:2676 +msgid "Your attempt to edit this post: “%s” has failed." +msgstr "Tu intento de editar esta entrada: “%s” ha fallado." + +#: wp-includes/functions.php:2678 +msgid "Your attempt to add this user has failed." +msgstr "Tu intento de añadir este usuario ha fallado." + +#: wp-includes/functions.php:2679 +msgid "Your attempt to delete users has failed." +msgstr "Tu intento de borrar estos usuarios ha fallado." + +#: wp-includes/functions.php:2680 +msgid "Your attempt to bulk modify users has failed." +msgstr "Tu intento de modificar en bloque usuarios ha fallado." + +#: wp-includes/functions.php:2681 +msgid "Your attempt to edit this user: “%s” has failed." +msgstr "Tu intento por editar este usuario: “%s” ha fallado." + +#: wp-includes/functions.php:2682 +msgid "Your attempt to modify the profile for: “%s” has failed." +msgstr "Tu intento de modificar el perfil de: “%s” ha fallado." + +#: wp-includes/functions.php:2684 +msgid "Your attempt to edit your settings has failed." +msgstr "Tu intento de editar tu configuración ha fallado." + +#: wp-includes/functions.php:2685 +msgid "Your attempt to change your permalink structure to: %s has failed." +msgstr "Tu intento de cambiar la estructura de enlaces permanentes a %s no ha tenido éxito." + +#: wp-includes/functions.php:2686 +msgid "Your attempt to edit this file: “%s” has failed." +msgstr "Tu intento de editar este fichero: “%s” ha fallado." + +#: wp-includes/functions.php:2687 +msgid "Your attempt to edit this theme file: “%s” has failed." +msgstr "Tu intento de editar este archivo del tema: “%s” ha fallado." + +#: wp-includes/functions.php:2688 +msgid "Your attempt to switch to this theme: “%s” has failed." +msgstr "Tu intento de cambiar este tema: “%s” ha fallado." + +#: wp-includes/functions.php:2690 +msgid "You are attempting to log out of %s" +msgstr "Estás intentando cerrar tu sesión en %s." + +#: wp-includes/functions.php:2729 +msgid "WordPress Failure Notice" +msgstr "Aviso de fallo de WordPress" + +#: wp-includes/functions.php:2732 +msgid "Do you really want to log out?" +msgstr "¿Estás seguro de que quieres desconectarte?" + +#: wp-includes/functions.php:2734 +msgid "Please try again." +msgstr "Por favor, inténtalo de nuevo." + +#: wp-includes/functions.php:2810 +msgid "« Back" +msgstr "« Volver" + +#: wp-includes/functions.php:2831 +msgid "WordPress › Error" +msgstr "WordPress › Error" + +#: wp-includes/functions.php:3382 wp-includes/functions.php:3422 +msgid "%1$s is deprecated since version %2$s! Use %3$s instead." +msgstr "%1$s está obsoleto desde la versión %2$s. Utiliza %3$s en su lugar." + +#: wp-includes/functions.php:3384 wp-includes/functions.php:3424 +msgid "%1$s is deprecated since version %2$s with no alternative available." +msgstr "%1$s está obsoleto desde la versión %2$s y no hay alternativas disponibles." + +#: wp-includes/functions.php:3466 +msgid "%1$s was called with an argument that is deprecated since version %2$s! %3$s" +msgstr "%1$s fue llamado con un argumento que está obsoleto desde la versión %2$s! %3$s" + +#: wp-includes/functions.php:3468 +msgid "%1$s was called with an argument that is deprecated since version %2$s with no alternative available." +msgstr "%1$s fue llamado con un argumento que está obsoleto desde la versión %2$s y no hay alternativas disponibles." + +#: wp-includes/functions.php:4185 +msgid "Select a city" +msgstr "Selecciona una ciudad" + +#: wp-includes/functions.php:4230 wp-includes/functions.php:4234 +msgid "UTC" +msgstr "UTC" + +#: wp-includes/functions.php:4238 +msgid "Manual Offsets" +msgstr "Desplazamientos manuales" + +#: wp-includes/general-template.php:161 +msgid "Search for:" +msgstr "Buscar por:" + +#: wp-includes/general-template.php:187 wp-login.php:419 wp-login.php:444 +#: wp-login.php:475 wp-login.php:531 +msgid "Log in" +msgstr "Acceder" + +#: wp-includes/general-template.php:189 +msgid "Log out" +msgstr "Desconectar" + +#: wp-includes/general-template.php:260 wp-login.php:644 +msgid "Remember Me" +msgstr "Recuérdame" + +#: wp-includes/general-template.php:336 wp-login.php:421 wp-login.php:477 +#: wp-login.php:527 wp-login.php:660 +msgid "Register" +msgstr "Registrarse" + +#: wp-includes/general-template.php:340 wp-admin/admin-header.php:162 +msgid "Site Admin" +msgstr "Administrador del sitio" + +#: wp-includes/general-template.php:587 +msgid "Search Results %1$s %2$s" +msgstr "Resultados de la búsqueda %1$s %2$s" + +#: wp-includes/general-template.php:592 +msgid "Page not found" +msgstr "No se encontró la página" + +#: wp-includes/general-template.php:939 +msgid "%1$s %2$d" +msgstr "%1$s %2$d" + +#: wp-includes/general-template.php:1148 +msgctxt "calendar caption" +msgid "%1$s %2$s" +msgstr "%1$s %2$s" + +#: wp-includes/general-template.php:1174 wp-includes/general-template.php:1182 +msgid "View posts for %1$s %2$s" +msgstr "Ver todas las entradas para %1$s %2$s" + +#: wp-includes/general-template.php:1604 wp-includes/general-template.php:1627 +msgctxt "feed link" +msgid "»" +msgstr "»" + +#: wp-includes/general-template.php:1606 +msgid "%1$s %2$s Feed" +msgstr "%1$s %2$s Feed" + +#: wp-includes/general-template.php:1608 +msgid "%1$s %2$s Comments Feed" +msgstr "%1$s %2$s RSS de los comentarios" + +#: wp-includes/general-template.php:1629 +msgid "%1$s %2$s %3$s Comments Feed" +msgstr "%1$s %2$s %3$s RSS de los comentarios" + +#: wp-includes/general-template.php:1631 +msgid "%1$s %2$s %3$s Category Feed" +msgstr "%1$s %2$s %3$s RSS de la categoría" + +#: wp-includes/general-template.php:1633 +msgid "%1$s %2$s %3$s Tag Feed" +msgstr "%1$s %2$s %3$s RSS de la etiqueta" + +#: wp-includes/general-template.php:1635 +msgid "%1$s %2$s Posts by %3$s Feed" +msgstr "%1$s %2$s RSS de las entradas de %3$s" + +#: wp-includes/general-template.php:1637 +msgid "%1$s %2$s Search Results for “%3$s” Feed" +msgstr "%1$s %2$s Resultados de búsqueda para “%3$s” RSS" + +#: wp-includes/general-template.php:1969 +msgid "« Previous" +msgstr "« Anterior" + +#: wp-includes/general-template.php:1970 +msgid "Next »" +msgstr "Siguiente »" + +#: wp-includes/general-template.php:2079 +#: wp-includes/js/tinymce/langs/wp-langs.php:49 wp-admin/includes/theme.php:274 +msgid "Gray" +msgstr "Gris" + +#: wp-includes/class-http.php:126 +msgid "User has blocked requests through HTTP." +msgstr "El usuario ha bloqueado las peticiones a través de HTTP." + +#: wp-includes/class-http.php:737 wp-includes/class-http.php:921 +#: wp-includes/class-http.php:1117 wp-includes/class-http.php:1136 +msgid "Too many redirects." +msgstr "Demasiadas redirecciones." + +#: wp-includes/class-http.php:821 +msgid "Malformed URL: %s" +msgstr "La URL %s está mal formada" + +#: wp-includes/class-http.php:697 wp-includes/class-http.php:879 +#: wp-includes/class-http.php:898 wp-includes/class-http.php:1072 +msgid "Could not open handle for fopen() to %s" +msgstr "No se pudo utilizar la función fopen() para %s." + +#: wp-includes/js/tinymce/langs/wp-langs.php:15 +msgid "Do you want to use the WYSIWYG mode for this textarea?" +msgstr "¿Quieres usar el editor visual en este área de texto?" + +#: wp-includes/js/tinymce/langs/wp-langs.php:17 +msgid "Insert" +msgstr "Insertar" + +#: wp-includes/js/tinymce/langs/wp-langs.php:21 +msgid "Browse" +msgstr "Examinar" + +#: wp-includes/js/tinymce/langs/wp-langs.php:22 +#: wp-includes/js/tinymce/langs/wp-langs.php:367 +msgid "Class" +msgstr "Clase" + +#: wp-includes/js/tinymce/langs/wp-langs.php:23 +msgid "-- Not set --" +msgstr "-- Sin configurar --" + +#: wp-includes/js/tinymce/langs/wp-langs.php:24 +#: wp-includes/js/tinymce/langs/wp-langs.php:290 +msgid "Copy/Cut/Paste is not available in Mozilla and Firefox." +msgstr "Copiar/Cortar/Pegar no está disponible en Mozilla y Firefox" + +#: wp-includes/js/tinymce/langs/wp-langs.php:25 +msgid "Currently not supported by your browser, use keyboard shortcuts instead." +msgstr "Actualmente no es compatible con tu navegador, en su lugar puedes utilizar los atajos de teclado." + +#: wp-includes/js/tinymce/langs/wp-langs.php:26 +msgid "Sorry, but we have noticed that your popup-blocker has disabled a window that provides application functionality. You will need to disable popup blocking on this site in order to fully utilize this tool." +msgstr "Disculpa, parece que tu bloqueador de ventanas emergentes ha bloqueado una ventana que proporciona funciones de la aplicación. Tendrás que desactivar el bloqueador si quieres usar esta herramienta." + +#: wp-includes/js/tinymce/langs/wp-langs.php:27 +msgid "Error: Invalid values entered, these are marked in red." +msgstr "Error: Se han introducido valores incorrectos que han sido marcados en rojo." + +#: wp-includes/js/tinymce/langs/wp-langs.php:31 +#: wp-includes/js/tinymce/langs/wp-langs.php:294 +msgid "More colors" +msgstr "Más colores" + +#: wp-includes/js/tinymce/langs/wp-langs.php:80 +msgid "Full" +msgstr "Completo" + +#: wp-includes/js/tinymce/langs/wp-langs.php:83 +msgid "%Y-%m-%d" +msgstr "%d-%m-%Y" + +#: wp-includes/js/tinymce/langs/wp-langs.php:84 +msgid "%H:%M:%S" +msgstr "%H:%M:%S" + +#: wp-includes/js/tinymce/langs/wp-langs.php:85 +msgid "Insert date" +msgstr "Insertar fecha" + +#: wp-includes/js/tinymce/langs/wp-langs.php:86 +msgid "Insert time" +msgstr "Insertar hora" + +#: wp-includes/locale.php:140 wp-includes/locale.php:155 +#: wp-includes/js/tinymce/langs/wp-langs.php:87 +msgid "January" +msgstr "enero" + +#: wp-includes/locale.php:141 wp-includes/locale.php:156 +#: wp-includes/js/tinymce/langs/wp-langs.php:87 +msgid "February" +msgstr "febrero" + +#: wp-includes/locale.php:142 wp-includes/locale.php:157 +#: wp-includes/js/tinymce/langs/wp-langs.php:87 +msgid "March" +msgstr "marzo" + +#: wp-includes/locale.php:143 wp-includes/locale.php:158 +#: wp-includes/js/tinymce/langs/wp-langs.php:87 +msgid "April" +msgstr "abril" + +#: wp-includes/locale.php:144 wp-includes/locale.php:159 +#: wp-includes/js/tinymce/langs/wp-langs.php:87 +msgid "May" +msgstr "mayo" + +#: wp-includes/locale.php:145 wp-includes/locale.php:160 +#: wp-includes/js/tinymce/langs/wp-langs.php:87 +msgid "June" +msgstr "junio" + +#: wp-includes/locale.php:146 wp-includes/locale.php:161 +#: wp-includes/js/tinymce/langs/wp-langs.php:87 +msgid "July" +msgstr "julio" + +#: wp-includes/locale.php:147 wp-includes/locale.php:162 +#: wp-includes/js/tinymce/langs/wp-langs.php:87 +msgid "August" +msgstr "agosto" + +#: wp-includes/locale.php:148 wp-includes/locale.php:163 +#: wp-includes/js/tinymce/langs/wp-langs.php:87 +msgid "September" +msgstr "septiembre" + +#: wp-includes/locale.php:149 wp-includes/locale.php:164 +#: wp-includes/js/tinymce/langs/wp-langs.php:87 +msgid "October" +msgstr "octubre" + +#: wp-includes/locale.php:150 wp-includes/locale.php:165 +#: wp-includes/js/tinymce/langs/wp-langs.php:87 +msgid "November" +msgstr "noviembre" + +#: wp-includes/locale.php:151 wp-includes/locale.php:166 +#: wp-includes/js/tinymce/langs/wp-langs.php:87 +msgid "December" +msgstr "diciembre" + +#: wp-includes/locale.php:155 wp-includes/js/tinymce/langs/wp-langs.php:88 +msgid "Jan_January_abbreviation" +msgstr "ene" + +#: wp-includes/locale.php:156 wp-includes/js/tinymce/langs/wp-langs.php:88 +msgid "Feb_February_abbreviation" +msgstr "feb" + +#: wp-includes/locale.php:157 wp-includes/js/tinymce/langs/wp-langs.php:88 +msgid "Mar_March_abbreviation" +msgstr "mar" + +#: wp-includes/locale.php:158 wp-includes/js/tinymce/langs/wp-langs.php:88 +msgid "Apr_April_abbreviation" +msgstr "abr" + +#: wp-includes/locale.php:159 wp-includes/js/tinymce/langs/wp-langs.php:88 +msgid "May_May_abbreviation" +msgstr "may" + +#: wp-includes/locale.php:160 wp-includes/js/tinymce/langs/wp-langs.php:88 +msgid "Jun_June_abbreviation" +msgstr "jun" + +#: wp-includes/locale.php:161 wp-includes/js/tinymce/langs/wp-langs.php:88 +msgid "Jul_July_abbreviation" +msgstr "jul" + +#: wp-includes/locale.php:162 wp-includes/js/tinymce/langs/wp-langs.php:88 +msgid "Aug_August_abbreviation" +msgstr "ago" + +#: wp-includes/locale.php:163 wp-includes/js/tinymce/langs/wp-langs.php:88 +msgid "Sep_September_abbreviation" +msgstr "sep" + +#: wp-includes/locale.php:164 wp-includes/js/tinymce/langs/wp-langs.php:88 +msgid "Oct_October_abbreviation" +msgstr "oct" + +#: wp-includes/locale.php:165 wp-includes/js/tinymce/langs/wp-langs.php:88 +msgid "Nov_November_abbreviation" +msgstr "nov" + +#: wp-includes/locale.php:166 wp-includes/js/tinymce/langs/wp-langs.php:88 +msgid "Dec_December_abbreviation" +msgstr "dic" + +#: wp-includes/locale.php:108 wp-includes/locale.php:118 +#: wp-includes/locale.php:131 wp-includes/js/tinymce/langs/wp-langs.php:89 +msgid "Sunday" +msgstr "Domingo" + +#: wp-includes/locale.php:109 wp-includes/locale.php:119 +#: wp-includes/locale.php:132 wp-includes/js/tinymce/langs/wp-langs.php:89 +msgid "Monday" +msgstr "Lunes" + +#: wp-includes/locale.php:110 wp-includes/locale.php:120 +#: wp-includes/locale.php:133 wp-includes/js/tinymce/langs/wp-langs.php:89 +msgid "Tuesday" +msgstr "Martes" + +#: wp-includes/locale.php:111 wp-includes/locale.php:121 +#: wp-includes/locale.php:134 wp-includes/js/tinymce/langs/wp-langs.php:89 +msgid "Wednesday" +msgstr "Miércoles" + +#: wp-includes/locale.php:112 wp-includes/locale.php:122 +#: wp-includes/locale.php:135 wp-includes/js/tinymce/langs/wp-langs.php:89 +msgid "Thursday" +msgstr "Jueves" + +#: wp-includes/locale.php:113 wp-includes/locale.php:123 +#: wp-includes/locale.php:136 wp-includes/js/tinymce/langs/wp-langs.php:89 +msgid "Friday" +msgstr "Viernes" + +#: wp-includes/locale.php:114 wp-includes/locale.php:124 +#: wp-includes/locale.php:137 wp-includes/js/tinymce/langs/wp-langs.php:89 +msgid "Saturday" +msgstr "Sábado" + +#: wp-includes/locale.php:131 wp-includes/js/tinymce/langs/wp-langs.php:90 +msgid "Sun" +msgstr "Dom" + +#: wp-includes/locale.php:132 wp-includes/js/tinymce/langs/wp-langs.php:90 +msgid "Mon" +msgstr "Lun" + +#: wp-includes/locale.php:133 wp-includes/js/tinymce/langs/wp-langs.php:90 +msgid "Tue" +msgstr "Mar" + +#: wp-includes/locale.php:134 wp-includes/js/tinymce/langs/wp-langs.php:90 +msgid "Wed" +msgstr "Mie" + +#: wp-includes/locale.php:135 wp-includes/js/tinymce/langs/wp-langs.php:90 +msgid "Thu" +msgstr "Jue" + +#: wp-includes/locale.php:136 wp-includes/js/tinymce/langs/wp-langs.php:90 +msgid "Fri" +msgstr "Vie" + +#: wp-includes/locale.php:137 wp-includes/js/tinymce/langs/wp-langs.php:90 +msgid "Sat" +msgstr "Sab" + +#: wp-includes/js/tinymce/langs/wp-langs.php:93 +msgid "Print" +msgstr "Imprimir" + +#: wp-includes/js/tinymce/langs/wp-langs.php:99 +msgid "Direction left to right" +msgstr "Dirección de izquierda a derecha" + +#: wp-includes/js/tinymce/langs/wp-langs.php:100 +msgid "Direction right to left" +msgstr "Dirección de derecha a izquierda" + +#: wp-includes/js/tinymce/langs/wp-langs.php:103 +msgid "Insert new layer" +msgstr "Insertar nueva capa" + +#: wp-includes/js/tinymce/langs/wp-langs.php:104 +msgid "Move forward" +msgstr "Avanzar" + +#: wp-includes/js/tinymce/langs/wp-langs.php:105 +msgid "Move backward" +msgstr "Retroceder" + +#: wp-includes/js/tinymce/langs/wp-langs.php:106 +msgid "Toggle absolute positioning" +msgstr "Cambiar la posición absoluta" + +#: wp-includes/js/tinymce/langs/wp-langs.php:107 +msgid "New layer..." +msgstr "Nueva capa..." + +#: wp-includes/js/tinymce/langs/wp-langs.php:111 +msgid "Cancel all changes" +msgstr "Cancelar todos los cambios" + +#: wp-includes/js/tinymce/langs/wp-langs.php:114 +msgid "Insert non-breaking space character" +msgstr "Insertar un caracter de espacio" + +#: wp-includes/js/tinymce/langs/wp-langs.php:117 +msgid "Run spell checking" +msgstr "Iniciar el corrector ortográfico" + +#: wp-includes/js/tinymce/langs/wp-langs.php:118 +msgid "ieSpell not detected. Do you want to install it now?" +msgstr "No se ha detectado ieSpell. ¿Quieres instalarlo ahora?" + +#: wp-includes/js/tinymce/langs/wp-langs.php:121 +msgid "Horizontale rule" +msgstr "Regla horizontal" + +#: wp-includes/js/tinymce/langs/wp-langs.php:124 +msgid "Emotions" +msgstr "Emoticonos" + +#: wp-includes/js/tinymce/langs/wp-langs.php:127 +msgid "Find" +msgstr "Buscar" + +#: wp-includes/js/tinymce/langs/wp-langs.php:128 +msgid "Find/Replace" +msgstr "Buscar/Remplazar" + +#: wp-includes/js/tinymce/langs/wp-langs.php:131 +#: wp-includes/js/tinymce/langs/wp-langs.php:271 +#: wp-includes/js/tinymce/langs/wp-langs.php:325 +msgid "Insert/edit image" +msgstr "Insertar/Editar imagen" + +#: wp-includes/script-loader.php:278 +#: wp-includes/js/tinymce/langs/wp-langs.php:134 +#: wp-includes/js/tinymce/langs/wp-langs.php:269 +#: wp-includes/js/tinymce/langs/wp-langs.php:342 +msgid "Insert/edit link" +msgstr "Insertar/Editar enlace" + +#: wp-includes/js/tinymce/langs/wp-langs.php:137 +msgid "Citation" +msgstr "Cita" + +#: wp-includes/js/tinymce/langs/wp-langs.php:138 +msgid "Abbreviation" +msgstr "Abreviatura" + +#: wp-includes/js/tinymce/langs/wp-langs.php:139 +msgid "Acronym" +msgstr "Acrónimo" + +#: wp-includes/js/tinymce/langs/wp-langs.php:140 +msgid "Deletion" +msgstr "Borrado" + +#: wp-includes/js/tinymce/langs/wp-langs.php:141 +msgid "Insertion" +msgstr "Insertar" + +#: wp-includes/js/tinymce/langs/wp-langs.php:142 +msgid "Insert/Edit Attributes" +msgstr "Insertar/Editar atributos" + +#: wp-includes/js/tinymce/langs/wp-langs.php:145 +msgid "Edit CSS Style" +msgstr "Editar la hoja de estilos CSS" + +#: wp-includes/js/tinymce/langs/wp-langs.php:148 +msgid "Paste as Plain Text" +msgstr "Pegar como texto plano" + +#: wp-includes/js/tinymce/langs/wp-langs.php:149 +msgid "Paste from Word" +msgstr "Pegar desde Word" + +#: wp-includes/js/tinymce/langs/wp-langs.php:155 +#: wp-includes/js/tinymce/langs/wp-langs.php:157 +msgid "Use CTRL+V on your keyboard to paste the text into the window." +msgstr "Usa CTRL+V en tu teclado para pegar el texto en la ventana." + +#: wp-includes/js/tinymce/langs/wp-langs.php:156 +msgid "Keep linebreaks" +msgstr "Conservar los saltos de línea" + +#: wp-includes/js/tinymce/langs/wp-langs.php:160 +msgid "Inserts a new table" +msgstr "Insertar una nueva tabla" + +#: wp-includes/js/tinymce/langs/wp-langs.php:161 +msgid "Insert row before" +msgstr "Insertar fila encima" + +#: wp-includes/js/tinymce/langs/wp-langs.php:162 +msgid "Insert row after" +msgstr "Insertar fila debajo" + +#: wp-includes/js/tinymce/langs/wp-langs.php:163 +msgid "Delete row" +msgstr "Borrar fila" + +#: wp-includes/js/tinymce/langs/wp-langs.php:164 +msgid "Insert column before" +msgstr "Insertar columna a la izquierda" + +#: wp-includes/js/tinymce/langs/wp-langs.php:165 +msgid "Insert column after" +msgstr "Insertar columna a la derecha" + +#: wp-includes/js/tinymce/langs/wp-langs.php:166 +msgid "Remove column" +msgstr "Borrar columna" + +#: wp-includes/js/tinymce/langs/wp-langs.php:167 +msgid "Split merged table cells" +msgstr "Dividir celdas combinadas" + +#: wp-includes/js/tinymce/langs/wp-langs.php:168 +msgid "Merge table cells" +msgstr "Combinar celdas" + +#: wp-includes/js/tinymce/langs/wp-langs.php:169 +msgid "Table row properties" +msgstr "Propiedades de fila" + +#: wp-includes/js/tinymce/langs/wp-langs.php:170 +msgid "Table cell properties" +msgstr "Propiedades de celda" + +#: wp-includes/js/tinymce/langs/wp-langs.php:171 +msgid "Table properties" +msgstr "Propiedades de tabla" + +#: wp-includes/js/tinymce/langs/wp-langs.php:172 +msgid "Paste table row before" +msgstr "Pegar fila encima" + +#: wp-includes/js/tinymce/langs/wp-langs.php:173 +msgid "Paste table row after" +msgstr "Pegar fila debajo" + +#: wp-includes/js/tinymce/langs/wp-langs.php:174 +msgid "Cut table row" +msgstr "Cortar fila" + +#: wp-includes/js/tinymce/langs/wp-langs.php:175 +msgid "Copy table row" +msgstr "Copiar fila" + +#: wp-includes/js/tinymce/langs/wp-langs.php:176 +msgid "Delete table" +msgstr "Borrar tabla" + +#: wp-includes/js/tinymce/langs/wp-langs.php:177 +msgid "Row" +msgstr "Fila" + +#: wp-includes/js/tinymce/langs/wp-langs.php:178 +msgid "Column" +msgstr "Columna" + +#: wp-includes/js/tinymce/langs/wp-langs.php:179 +msgid "Cell" +msgstr "Celda" + +#: wp-includes/script-loader.php:443 wp-includes/script-loader.php:564 +#: wp-includes/js/tinymce/langs/wp-langs.php:182 +msgid "The changes you made will be lost if you navigate away from this page." +msgstr "Los cambios realizados se perderán si abres otra página." + +#: wp-includes/script-loader.php:90 +#: wp-includes/js/tinymce/langs/wp-langs.php:185 +msgid "Toggle fullscreen mode" +msgstr "Cambiar a modo pantalla completa" + +#: wp-includes/js/tinymce/langs/wp-langs.php:188 +#: wp-includes/js/tinymce/langs/wp-langs.php:356 +msgid "Insert / edit embedded media" +msgstr "Insertar / editar inserción de archivos" + +#: wp-includes/js/tinymce/langs/wp-langs.php:189 +msgid "Edit embedded media" +msgstr "Editar medios incrustados" + +#: wp-includes/js/tinymce/langs/wp-langs.php:192 +msgid "Document properties" +msgstr "Propiedades del documento" + +#: wp-includes/js/tinymce/langs/wp-langs.php:195 +msgid "Insert predefined template content" +msgstr "Insertar la plantilla predefinida de contenido" + +#: wp-includes/js/tinymce/langs/wp-langs.php:198 +msgid "Visual control characters on/off." +msgstr "Control visual de los caracteres on/off." + +#: wp-includes/js/tinymce/langs/wp-langs.php:201 +msgid "Toggle spellchecker" +msgstr "Activar/desactivar el corrector ortográfico" + +#: wp-includes/js/tinymce/langs/wp-langs.php:202 +msgid "Spellchecker settings" +msgstr "Opciones del corrector ortográfico" + +#: wp-includes/js/tinymce/langs/wp-langs.php:203 +msgid "Ignore word" +msgstr "Ignorar palabra" + +#: wp-includes/js/tinymce/langs/wp-langs.php:204 +msgid "Ignore all" +msgstr "Ignorar todo" + +#: wp-includes/js/tinymce/langs/wp-langs.php:205 +msgid "Languages" +msgstr "Idiomas" + +#: wp-includes/js/tinymce/langs/wp-langs.php:206 +msgid "Please wait..." +msgstr "Un momento..." + +#: wp-includes/js/tinymce/langs/wp-langs.php:207 +msgid "Suggestions" +msgstr "Sugerencias" + +#: wp-includes/js/tinymce/langs/wp-langs.php:208 +msgid "No suggestions" +msgstr "No hay sugerencias" + +#: wp-includes/js/tinymce/langs/wp-langs.php:209 +msgid "No misspellings found." +msgstr "No hay errores ortográficos." + +#: wp-includes/js/tinymce/langs/wp-langs.php:213 +msgid "Insert Page Break" +msgstr "Insertar salto de página" + +#: wp-includes/js/tinymce/langs/wp-langs.php:236 +msgctxt "TinyMCE font styles" +msgid "Styles" +msgstr "Estilos" + +#: wp-includes/js/tinymce/langs/wp-langs.php:237 +msgid "Font size" +msgstr "Tamaño de la fuente" + +#: wp-includes/js/tinymce/langs/wp-langs.php:238 +msgid "Font family" +msgstr "Familia de la fuente" + +#: wp-includes/js/tinymce/langs/wp-langs.php:239 +msgid "Format" +msgstr "Formato" + +#: wp-includes/js/tinymce/langs/wp-langs.php:240 +msgid "Paragraph" +msgstr "Párrafo" + +#: wp-includes/js/tinymce/langs/wp-langs.php:241 +msgid "Div" +msgstr "Div" + +#: wp-includes/js/tinymce/langs/wp-langs.php:242 +#: wp-includes/js/tinymce/wp-mce-help.php:242 +msgid "Address" +msgstr "Dirección" + +#: wp-includes/js/tinymce/langs/wp-langs.php:243 +msgid "Preformatted" +msgstr "Preformateado" + +#: wp-includes/js/tinymce/langs/wp-langs.php:244 +#: wp-includes/js/tinymce/wp-mce-help.php:239 +msgid "Heading 1" +msgstr "Título 1" + +#: wp-includes/js/tinymce/langs/wp-langs.php:245 +#: wp-includes/js/tinymce/wp-mce-help.php:240 +msgid "Heading 2" +msgstr "Título 2" + +#: wp-includes/js/tinymce/langs/wp-langs.php:246 +#: wp-includes/js/tinymce/wp-mce-help.php:240 +msgid "Heading 3" +msgstr "Título 3" + +#: wp-includes/js/tinymce/langs/wp-langs.php:247 +#: wp-includes/js/tinymce/wp-mce-help.php:241 +msgid "Heading 4" +msgstr "Título 4" + +#: wp-includes/js/tinymce/langs/wp-langs.php:248 +#: wp-includes/js/tinymce/wp-mce-help.php:241 +msgid "Heading 5" +msgstr "Título 5" + +#: wp-includes/js/tinymce/langs/wp-langs.php:249 +#: wp-includes/js/tinymce/wp-mce-help.php:242 +msgid "Heading 6" +msgstr "Título 6" + +#: wp-includes/js/tinymce/langs/wp-langs.php:250 +#: wp-includes/js/tinymce/langs/wp-langs.php:289 +msgid "Blockquote" +msgstr "Cita" + +#: wp-includes/js/tinymce/langs/wp-langs.php:251 +msgid "Code" +msgstr "Código" + +#: wp-includes/js/tinymce/langs/wp-langs.php:252 +msgid "Code sample" +msgstr "Código de ejemplo" + +#: wp-includes/js/tinymce/langs/wp-langs.php:253 +msgid "Definition term " +msgstr "Definición del término" + +#: wp-includes/js/tinymce/langs/wp-langs.php:254 +msgid "Definition description" +msgstr "Definición de descripción" + +#: wp-includes/js/tinymce/langs/wp-langs.php:255 +#: wp-includes/js/tinymce/wp-mce-help.php:238 +#: wp-includes/js/tinymce/wp-mce-help.php:248 +msgid "Bold" +msgstr "Negrita" + +#: wp-includes/js/tinymce/langs/wp-langs.php:256 +#: wp-includes/js/tinymce/wp-mce-help.php:238 +#: wp-includes/js/tinymce/wp-mce-help.php:248 +msgid "Italic" +msgstr "Cursiva" + +#: wp-includes/js/tinymce/langs/wp-langs.php:257 +#: wp-includes/js/tinymce/wp-mce-help.php:239 +msgid "Underline" +msgstr "Subrayado" + +#: wp-includes/js/tinymce/langs/wp-langs.php:258 +#: wp-includes/js/tinymce/wp-mce-help.php:252 +msgid "Strikethrough" +msgstr "Tachado" + +#: wp-includes/js/tinymce/langs/wp-langs.php:259 +#: wp-includes/js/tinymce/wp-mce-help.php:250 +msgid "Align Left" +msgstr "Alinear a la izquierda" + +#: wp-includes/js/tinymce/langs/wp-langs.php:260 +#: wp-includes/js/tinymce/wp-mce-help.php:251 +msgid "Align Center" +msgstr "Alinear al centro" + +#: wp-includes/js/tinymce/langs/wp-langs.php:261 +#: wp-includes/js/tinymce/wp-mce-help.php:252 +msgid "Align Right" +msgstr "Alinear a la derecha" + +#: wp-includes/js/tinymce/langs/wp-langs.php:262 +msgid "Align Full" +msgstr "Alineación completa" + +#: wp-includes/js/tinymce/langs/wp-langs.php:263 +msgid "Unordered list" +msgstr "Lista desordenada" + +#: wp-includes/js/tinymce/langs/wp-langs.php:264 +msgid "Ordered list" +msgstr "Lista ordenada" + +#: wp-includes/js/tinymce/langs/wp-langs.php:265 +msgid "Outdent" +msgstr "Disminuir margen" + +#: wp-includes/js/tinymce/langs/wp-langs.php:266 +msgid "Indent" +msgstr "Aumentar margen" + +#: wp-includes/js/tinymce/langs/wp-langs.php:270 +msgid "Unlink" +msgstr "Quitar enlace" + +#: wp-includes/js/tinymce/langs/wp-langs.php:272 +msgid "Cleanup messy code" +msgstr "Limpiar el código desordenado" + +#: wp-includes/js/tinymce/langs/wp-langs.php:273 +msgid "Edit HTML Source" +msgstr "Editar HTML" + +#: wp-includes/js/tinymce/langs/wp-langs.php:274 +msgid "Subscript" +msgstr "Subíndice" + +#: wp-includes/js/tinymce/langs/wp-langs.php:275 +msgid "Superscript" +msgstr "Superíndice" + +#: wp-includes/js/tinymce/langs/wp-langs.php:276 +msgid "Insert horizontal ruler" +msgstr "Insertar línea horizontal" + +#: wp-includes/js/tinymce/langs/wp-langs.php:277 +msgid "Remove formatting" +msgstr "Eliminar formato" + +#: wp-includes/js/tinymce/langs/wp-langs.php:278 +msgid "Select text color" +msgstr "Elegir color de texto" + +#: wp-includes/js/tinymce/langs/wp-langs.php:279 +msgid "Select background color" +msgstr "Elegir color de fondo" + +#: wp-includes/js/tinymce/langs/wp-langs.php:280 +msgid "Insert custom character" +msgstr "Insertar carácter especial" + +#: wp-includes/js/tinymce/langs/wp-langs.php:281 +msgid "Toggle guidelines/invisible elements" +msgstr "Mostrar/Ocultar guías y otros elementos" + +#: wp-includes/js/tinymce/langs/wp-langs.php:282 +#: wp-includes/js/tinymce/langs/wp-langs.php:311 +msgid "Insert/edit anchor" +msgstr "Insertar/Editar anclaje" + +#: wp-includes/js/tinymce/langs/wp-langs.php:283 +#: wp-includes/js/tinymce/wp-mce-help.php:235 +msgid "Cut" +msgstr "Cortar" + +#: wp-includes/js/tinymce/langs/wp-langs.php:284 +#: wp-includes/js/tinymce/wp-mce-help.php:234 +msgid "Copy" +msgstr "Copiar" + +#: wp-includes/js/tinymce/langs/wp-langs.php:285 +#: wp-includes/js/tinymce/wp-mce-help.php:234 +msgid "Paste" +msgstr "Pegar" + +#: wp-includes/js/tinymce/langs/wp-langs.php:286 +msgid "Image properties" +msgstr "Propiedades de la imagen" + +#: wp-includes/js/tinymce/langs/wp-langs.php:287 +msgid "New document" +msgstr "Nuevo documento" + +#: wp-includes/js/tinymce/langs/wp-langs.php:292 +msgid "Are you sure you want to clear all contents?" +msgstr "¿Seguro que quieres borrar todo el contenido?" + +#: wp-includes/js/tinymce/langs/wp-langs.php:293 +msgid "Jump to tool buttons - Alt+Q, Jump to editor - Alt-Z, Jump to element path - Alt-X" +msgstr "Ir a la herramienta de los botones - Alt + Q, Ir al editor - Alt-Z, Ir al elemento de la ruta - Alt-X" + +#: wp-includes/js/tinymce/langs/wp-langs.php:302 +#: wp-includes/js/tinymce/wp-mce-help.php:268 +msgid "About TinyMCE" +msgstr "Acerca de TinyMCE" + +#: wp-includes/js/tinymce/langs/wp-langs.php:305 +msgid "License" +msgstr "Licencia" + +#: wp-includes/js/tinymce/langs/wp-langs.php:310 +msgid "Loaded plugins" +msgstr "Plugins cargados" + +#: wp-includes/js/tinymce/langs/wp-langs.php:312 +msgid "Anchor name" +msgstr "Nombre del ancla" + +#: wp-includes/js/tinymce/langs/wp-langs.php:313 +msgid "HTML Source Editor" +msgstr "Editor HTML" + +#: wp-includes/js/tinymce/langs/wp-langs.php:314 +msgid "Word wrap" +msgstr "Ajuste de palabras" + +#: wp-includes/js/tinymce/langs/wp-langs.php:315 +msgid "Select a color" +msgstr "Elige un color" + +#: wp-includes/js/tinymce/langs/wp-langs.php:316 +msgid "Picker" +msgstr "Selector" + +#: wp-includes/js/tinymce/langs/wp-langs.php:317 +msgid "Color picker" +msgstr "Selector de color" + +#: wp-includes/js/tinymce/langs/wp-langs.php:318 +msgid "Palette" +msgstr "Paleta" + +#: wp-includes/js/tinymce/langs/wp-langs.php:319 +msgid "Palette colors" +msgstr "Paleta de colores" + +#: wp-includes/js/tinymce/langs/wp-langs.php:320 +msgid "Named" +msgstr "Nombrado" + +#: wp-includes/js/tinymce/langs/wp-langs.php:321 +msgid "Named colors" +msgstr "Nombre de los colores" + +#: wp-includes/js/tinymce/langs/wp-langs.php:322 +msgid "Color:" +msgstr "Color:" + +#: wp-includes/js/tinymce/langs/wp-langs.php:324 +msgid "Select custom character" +msgstr "Elegir un carácter especial" + +#: wp-includes/js/tinymce/langs/wp-langs.php:327 +msgid "Image description" +msgstr "Descripción de la imagen" + +#: wp-includes/js/tinymce/langs/wp-langs.php:328 +msgid "Image list" +msgstr "Lista de imágenes" + +#: wp-includes/js/tinymce/langs/wp-langs.php:329 +msgid "Border" +msgstr "Borde" + +#: wp-includes/js/tinymce/langs/wp-langs.php:330 +#: wp-includes/js/tinymce/langs/wp-langs.php:361 +msgid "Dimensions" +msgstr "Dimensiones" + +#: wp-includes/js/tinymce/langs/wp-langs.php:331 +msgid "Vertical space" +msgstr "Espacio vertical" + +#: wp-includes/js/tinymce/langs/wp-langs.php:332 +msgid "Horizontal space" +msgstr "Espacio horizontal" + +#: wp-includes/js/tinymce/langs/wp-langs.php:334 +msgid "Baseline" +msgstr "Linea base" + +#: wp-includes/js/tinymce/langs/wp-langs.php:335 +#: wp-includes/js/tinymce/langs/wp-langs.php:436 +msgid "Top" +msgstr "Arriba" + +#: wp-includes/js/tinymce/langs/wp-langs.php:336 +msgid "Middle" +msgstr "Intermedio" + +#: wp-includes/js/tinymce/langs/wp-langs.php:337 +#: wp-includes/js/tinymce/langs/wp-langs.php:438 +msgid "Bottom" +msgstr "Abajo" + +#: wp-includes/js/tinymce/langs/wp-langs.php:338 +msgid "Text top" +msgstr "Texto superior" + +#: wp-includes/js/tinymce/langs/wp-langs.php:339 +msgid "Text bottom" +msgstr "Texto inferior" + +#: wp-includes/js/tinymce/langs/wp-langs.php:345 +msgid "Open link in the same window" +msgstr "Abrir el enlace en la misma ventana" + +#: wp-includes/js/tinymce/langs/wp-langs.php:346 +msgid "Open link in a new window" +msgstr "Abrir el enlace en una nueva ventana" + +#: wp-includes/js/tinymce/langs/wp-langs.php:348 +msgid "The URL you entered seems to be an email address, do you want to add the required mailto: prefix?" +msgstr "La URL que has introducido parece ser un correo electrónico, ¿quieres añadir el prefijo mailto:?" + +#: wp-includes/js/tinymce/langs/wp-langs.php:349 +msgid "The URL you entered seems to external link, do you want to add the required http:// prefix?" +msgstr "La URL especificada parece ser un enlace externo, ¿quieres añadir el prefijo http://?" + +#: wp-includes/js/tinymce/langs/wp-langs.php:350 +msgid "Link list" +msgstr "Lista de enlaces" + +#: wp-includes/js/tinymce/langs/wp-langs.php:357 +msgid "General" +msgstr "Generales" + +#: wp-includes/js/tinymce/langs/wp-langs.php:359 +msgid "File/URL" +msgstr "Archivo/URL" + +#: wp-includes/js/tinymce/langs/wp-langs.php:360 +#: wp-includes/js/tinymce/wp-mce-help.php:253 +#: wp-includes/js/tinymce/wp-mce-help.php:254 +msgid "List" +msgstr "Lista" + +#: wp-includes/js/tinymce/langs/wp-langs.php:363 +msgid "Constrain proportions" +msgstr "Mantener proporciones" + +#: wp-includes/js/tinymce/langs/wp-langs.php:364 +msgid "Type" +msgstr "Tipo" + +#: wp-includes/js/tinymce/langs/wp-langs.php:365 +msgid "Id" +msgstr "Id" + +#: wp-includes/js/tinymce/langs/wp-langs.php:368 +msgid "V-Space" +msgstr "Espacio vertical" + +#: wp-includes/js/tinymce/langs/wp-langs.php:369 +msgid "H-Space" +msgstr "Espacio horizontal" + +#: wp-includes/js/tinymce/langs/wp-langs.php:370 +msgid "Auto play" +msgstr "Reproducción automática" + +#: wp-includes/js/tinymce/langs/wp-langs.php:371 +#: wp-includes/js/tinymce/langs/wp-langs.php:453 +msgid "Loop" +msgstr "Repetir" + +#: wp-includes/js/tinymce/langs/wp-langs.php:372 +msgid "Show menu" +msgstr "Mostrar menú" + +#: wp-includes/js/tinymce/langs/wp-langs.php:373 +msgid "Quality" +msgstr "Calidad" + +#: wp-includes/js/tinymce/langs/wp-langs.php:375 +msgid "Align" +msgstr "Alineación" + +#: wp-includes/js/tinymce/langs/wp-langs.php:376 +msgid "SAlign" +msgstr "SAlign" + +#: wp-includes/js/tinymce/langs/wp-langs.php:377 +msgid "WMode" +msgstr "Modo de ventana" + +#: wp-includes/admin-bar.php:314 wp-includes/js/tinymce/langs/wp-langs.php:378 +#: wp-admin/custom-background.php:67 +msgid "Background" +msgstr "Fondo" + +#: wp-includes/js/tinymce/langs/wp-langs.php:379 +msgid "Base" +msgstr "Base" + +#: wp-includes/js/tinymce/langs/wp-langs.php:380 +msgid "Flashvars" +msgstr "Flashvars" + +#: wp-includes/js/tinymce/langs/wp-langs.php:381 +msgid "SWLiveConnect" +msgstr "SWLiveConnect" + +#: wp-includes/js/tinymce/langs/wp-langs.php:382 +msgid "AutoHREF" +msgstr "AutoHREF" + +#: wp-includes/js/tinymce/langs/wp-langs.php:383 +msgid "Cache" +msgstr "Caché" + +#: wp-includes/js/tinymce/langs/wp-langs.php:384 +msgid "Hidden" +msgstr "Oculto" + +#: wp-includes/js/tinymce/langs/wp-langs.php:385 +msgid "Controller" +msgstr "Controlador" + +#: wp-includes/js/tinymce/langs/wp-langs.php:386 +msgid "Kiosk mode" +msgstr "Modo quiosco" + +#: wp-includes/js/tinymce/langs/wp-langs.php:387 +msgid "Play every frame" +msgstr "Reproducir todos los cuadros" + +#: wp-includes/js/tinymce/langs/wp-langs.php:388 +msgid "Target cache" +msgstr "Caché destino" + +#: wp-includes/js/tinymce/langs/wp-langs.php:389 +msgid "No correction" +msgstr "Sin corrección" + +#: wp-includes/js/tinymce/langs/wp-langs.php:390 +msgid "Enable JavaScript" +msgstr "Activar JavaScript" + +#: wp-includes/js/tinymce/langs/wp-langs.php:391 +#: wp-includes/js/tinymce/langs/wp-langs.php:449 +msgid "Start time" +msgstr "Hora de inicio" + +#: wp-includes/js/tinymce/langs/wp-langs.php:392 +msgid "End time" +msgstr "Hora de finalización" + +#: wp-includes/js/tinymce/langs/wp-langs.php:393 +msgid "href" +msgstr "href" + +#: wp-includes/js/tinymce/langs/wp-langs.php:394 +msgid "Choke speed" +msgstr "Velocidad de obstrucción" + +#: wp-includes/js/tinymce/langs/wp-langs.php:396 +msgid "Volume" +msgstr "Volumen" + +#: wp-includes/js/tinymce/langs/wp-langs.php:397 +#: wp-includes/js/tinymce/langs/wp-langs.php:452 +msgid "Auto start" +msgstr "Inicio automático" + +#: wp-includes/js/tinymce/langs/wp-langs.php:399 +msgid "Fullscreen" +msgstr "Pantalla completa" + +#: wp-includes/js/tinymce/langs/wp-langs.php:400 +msgid "Invoke URLs" +msgstr "Invocar URLs" + +#: wp-includes/js/tinymce/langs/wp-langs.php:401 +msgid "Mute" +msgstr "Silenciar" + +#: wp-includes/js/tinymce/langs/wp-langs.php:402 +msgid "Stretch to fit" +msgstr "Estrechar para ajustar" + +#: wp-includes/js/tinymce/langs/wp-langs.php:403 +msgid "Windowless video" +msgstr "Vídeo sin ventana" + +#: wp-includes/js/tinymce/langs/wp-langs.php:404 +msgid "Balance" +msgstr "Balance" + +#: wp-includes/js/tinymce/langs/wp-langs.php:405 +msgid "Base URL" +msgstr "URL base" + +#: wp-includes/js/tinymce/langs/wp-langs.php:406 +msgid "Captioning id" +msgstr "ID de captura" + +#: wp-includes/js/tinymce/langs/wp-langs.php:407 +msgid "Current marker" +msgstr "Marcador actual" + +#: wp-includes/js/tinymce/langs/wp-langs.php:408 +msgid "Current position" +msgstr "Posición actual" + +#: wp-includes/js/tinymce/langs/wp-langs.php:409 +msgid "Default frame" +msgstr "Marco por defecto" + +#: wp-includes/js/tinymce/langs/wp-langs.php:410 +msgid "Play count" +msgstr "Contador de reproducción" + +#: wp-includes/js/tinymce/langs/wp-langs.php:411 +msgid "Rate" +msgstr "Puntuar" + +#: wp-includes/js/tinymce/langs/wp-langs.php:412 +msgid "UI Mode" +msgstr "Modo UI" + +#: wp-includes/js/tinymce/langs/wp-langs.php:413 +msgid "Flash options" +msgstr "Opciones del Flash" + +#: wp-includes/js/tinymce/langs/wp-langs.php:414 +msgid "Quicktime options" +msgstr "Opciones de Quicktime" + +#: wp-includes/js/tinymce/langs/wp-langs.php:415 +msgid "Windows media player options" +msgstr "Opciones de Windows Media Player" + +#: wp-includes/js/tinymce/langs/wp-langs.php:416 +msgid "Real media player options" +msgstr "Opciones de Real Media Player" + +#: wp-includes/js/tinymce/langs/wp-langs.php:417 +msgid "Shockwave options" +msgstr "Opciones de Shockwave" + +#: wp-includes/js/tinymce/langs/wp-langs.php:418 +msgid "Auto goto URL" +msgstr "Ir automáticamente a la URL" + +#: wp-includes/js/tinymce/langs/wp-langs.php:420 +msgid "Image status" +msgstr "Estado de la Imagen" + +#: wp-includes/js/tinymce/langs/wp-langs.php:421 +msgid "Maintain aspect" +msgstr "Mantener aspecto" + +#: wp-includes/js/tinymce/langs/wp-langs.php:422 +msgid "No java" +msgstr "Sin java" + +#: wp-includes/js/tinymce/langs/wp-langs.php:423 +msgid "Prefetch" +msgstr "Prelectura" + +#: wp-includes/js/tinymce/langs/wp-langs.php:424 +msgid "Shuffle" +msgstr "Aleatorio" + +#: wp-includes/js/tinymce/langs/wp-langs.php:425 +msgid "Console" +msgstr "Consola" + +#: wp-includes/js/tinymce/langs/wp-langs.php:426 +msgid "Num loops" +msgstr "Bucles numéricos" + +#: wp-includes/js/tinymce/langs/wp-langs.php:427 +msgid "Controls" +msgstr "Controles" + +#: wp-includes/js/tinymce/langs/wp-langs.php:428 +msgid "Script callbacks" +msgstr "Llamadas de Script" + +#: wp-includes/js/tinymce/langs/wp-langs.php:429 +msgid "Stretch style" +msgstr "Estilo estirado" + +#: wp-includes/js/tinymce/langs/wp-langs.php:430 +msgid "Stretch H-Align" +msgstr "Estirar alineación horizontal" + +#: wp-includes/js/tinymce/langs/wp-langs.php:431 +msgid "Stretch V-Align" +msgstr "Estirar alineación vertical" + +#: wp-includes/js/tinymce/langs/wp-langs.php:432 +msgid "Sound" +msgstr "Sonido" + +#: wp-includes/js/tinymce/langs/wp-langs.php:433 +msgid "Progress" +msgstr "Progreso" + +#: wp-includes/js/tinymce/langs/wp-langs.php:434 +msgid "QT Src" +msgstr "Origen de QT" + +#: wp-includes/js/tinymce/langs/wp-langs.php:435 +msgid "Streamed rtsp resources should be added to the QT Src field under the advanced tab." +msgstr "Los recursos Rtsp deben añadirse en el campo Origen de QT en la pestaña de Ajustes avanzados." + +#: wp-includes/js/tinymce/langs/wp-langs.php:441 +msgid "Top left" +msgstr "Arriba izq." + +#: wp-includes/js/tinymce/langs/wp-langs.php:442 +msgid "Top right" +msgstr "Arriba dcha." + +#: wp-includes/js/tinymce/langs/wp-langs.php:443 +msgid "Bottom left" +msgstr "Abajo izq." + +#: wp-includes/js/tinymce/langs/wp-langs.php:444 +msgid "Bottom right" +msgstr "Abajo dcha." + +#: wp-includes/js/tinymce/langs/wp-langs.php:445 +msgid "Flash video options" +msgstr "Opciones del video Flash" + +#: wp-includes/js/tinymce/langs/wp-langs.php:446 +msgid "Scale mode" +msgstr "Modo de escala" + +#: wp-includes/js/tinymce/langs/wp-langs.php:447 +msgid "Buffer" +msgstr "Buffer" + +#: wp-includes/js/tinymce/langs/wp-langs.php:448 +msgid "Start image" +msgstr "Imagen de inicio" + +#: wp-includes/js/tinymce/langs/wp-langs.php:450 +msgid "Default volume" +msgstr "Volumen predeterminado" + +#: wp-includes/js/tinymce/langs/wp-langs.php:451 +msgid "Hidden GUI" +msgstr "Ocultar GUI" + +#: wp-includes/js/tinymce/langs/wp-langs.php:454 +msgid "Show scale modes" +msgstr "Mostrar modos de escala" + +#: wp-includes/js/tinymce/langs/wp-langs.php:455 +msgid "Smooth video" +msgstr "Suavizar vídeo" + +#: wp-includes/js/tinymce/langs/wp-langs.php:456 +msgid "JS Callback" +msgstr "Llamada JS" + +#: wp-includes/js/tinymce/langs/wp-langs.php:466 +msgid "Show/Hide Kitchen Sink" +msgstr "Ver/Ocultar botones adicionales" + +#: wp-includes/js/tinymce/langs/wp-langs.php:467 +#: wp-includes/js/tinymce/wp-mce-help.php:256 +msgid "Insert More Tag" +msgstr "Insertar etiqueta Más" + +#: wp-includes/js/tinymce/langs/wp-langs.php:468 +msgid "Insert Page break" +msgstr "Insertar salto de página" + +#: wp-includes/js/tinymce/langs/wp-langs.php:470 +msgid "More..." +msgstr "Más..." + +#: wp-includes/js/tinymce/langs/wp-langs.php:471 +msgid "Next page..." +msgstr "Siguiente página..." + +#: wp-includes/js/tinymce/langs/wp-langs.php:476 +msgid "Edit Gallery" +msgstr "Editar galería" + +#: wp-includes/js/tinymce/langs/wp-langs.php:477 +msgid "Delete Gallery" +msgstr "Eliminar galería" + +#: wp-includes/js/tinymce/langs/wp-langs.php:482 +msgid "Delete Image" +msgstr "Eliminar imagen" + +#: wp-includes/js/tinymce/langs/wp-langs.php:483 +msgid "Advanced Settings" +msgstr "Ajustes avanzados" + +#: wp-includes/js/tinymce/langs/wp-langs.php:489 +msgid "Current Link" +msgstr "Enlace actual" + +#: wp-includes/js/tinymce/langs/wp-langs.php:490 +msgid "Link to Image" +msgstr "Enlazar a imagen" + +#: wp-includes/js/tinymce/langs/wp-langs.php:492 +msgid "Advanced Image Settings" +msgstr "Ajustes avanzados de imágenes" + +#: wp-includes/js/tinymce/langs/wp-langs.php:462 +#: wp-includes/js/tinymce/langs/wp-langs.php:493 +msgid "Source" +msgstr "Fuente" + +#: wp-includes/js/tinymce/langs/wp-langs.php:496 +#: wp-includes/js/tinymce/langs/wp-langs.php:501 +msgid "Original Size" +msgstr "Tamaño original" + +#: wp-includes/js/tinymce/langs/wp-langs.php:497 +#: wp-includes/js/tinymce/langs/wp-langs.php:502 +msgid "CSS Class" +msgstr "Clase CSS" + +#: wp-includes/js/tinymce/langs/wp-langs.php:498 +msgid "Advanced Link Settings" +msgstr "Ajustes avanzados de enlaces" + +#: wp-includes/js/tinymce/langs/wp-langs.php:499 +msgid "Link Rel" +msgstr "Relación del enlace" + +#: wp-includes/js/tinymce/langs/wp-langs.php:503 +msgid "60%" +msgstr "60%" + +#: wp-includes/js/tinymce/langs/wp-langs.php:504 +msgid "70%" +msgstr "70%" + +#: wp-includes/js/tinymce/langs/wp-langs.php:505 +msgid "80%" +msgstr "80%" + +#: wp-includes/js/tinymce/langs/wp-langs.php:506 +msgid "90%" +msgstr "90%" + +#: wp-includes/js/tinymce/langs/wp-langs.php:507 +msgid "100%" +msgstr "100%" + +#: wp-includes/js/tinymce/langs/wp-langs.php:508 +msgid "110%" +msgstr "110%" + +#: wp-includes/js/tinymce/langs/wp-langs.php:509 +msgid "120%" +msgstr "120%" + +#: wp-includes/js/tinymce/langs/wp-langs.php:510 +msgid "130%" +msgstr "130%" + +#: wp-includes/js/tinymce/wp-mce-help.php:16 +msgid "Rich Editor Help" +msgstr "Ayuda del editor visual" + +#: wp-includes/js/tinymce/wp-mce-help.php:200 +msgid "Basics of Rich Editing" +msgstr "Uso básico del editor visual" + +#: wp-includes/js/tinymce/wp-mce-help.php:200 +msgid "Basics" +msgstr "Básico" + +#: wp-includes/js/tinymce/wp-mce-help.php:201 +msgid "Advanced use of the Rich Editor" +msgstr "Uso avanzado del Editor visual" + +#: wp-includes/js/tinymce/wp-mce-help.php:202 +msgid "Hotkeys" +msgstr "Atajos de teclado" + +#: wp-includes/js/tinymce/wp-mce-help.php:203 +msgid "About the software" +msgstr "Acerca del programa" + +#: wp-includes/js/tinymce/wp-mce-help.php:209 +msgid "Rich Editing Basics" +msgstr "Edición visual básica" + +#: wp-includes/js/tinymce/wp-mce-help.php:210 +msgid "Rich editing, also called WYSIWYG for What You See Is What You Get, means your text is formatted as you type. The rich editor creates HTML code behind the scenes while you concentrate on writing. Font styles, links and images all appear approximately as they will on the internet." +msgstr "La edición visual, también llamada WYSIWYG por What You See Is What You Get (en inglés, Lo Que Ves Es Lo Que Obtendrás), consiste en dar formato al texto a medida que lo escribes. El editor visual va creando el código HTML tras las bambalinas mientras tú te centras en escribir. Tipos de letra, enlaces e imágenes se ven tal y como aparecerán en Internet." + +#: wp-includes/js/tinymce/wp-mce-help.php:211 +msgid "WordPress includes a rich HTML editor that works well in all major web browsers used today. However editing HTML is not the same as typing text. Each web page has two major components: the structure, which is the actual HTML code and is produced by the editor as you type, and the display, that is applied to it by the currently selected WordPress theme and is defined in style.css. WordPress is producing valid XHTML 1.0 which means that inserting multiple line breaks (BR tags) after a paragraph would not produce white space on the web page. The BR tags will be removed as invalid by the internal HTML correcting functions." +msgstr "WordPress incluye un editor HTML que suele funcionar bien en los principales navegadores utilizados en la actualidad. Sin embargo, la edición de HTML no es tan fiable como escribir texto. Cada página Web tiene dos componentes principales: la estructura, que es el actual código HTML y es producido por el editor a partir de los que estás escribiendo, y el diseño, que se aplica a ella por el tema seleccionado WordPress y se define en el style.css. Además WordPress válida XHTML 1.0, lo que significa que no se puede mostrar el control de los elementos estructurales. Por lo tanto, la inserción de varios saltos de línea (BR etiquetas) después de un párrafo no da lugar a espacios en blanco en la página web final. La etiquetas BR serán eliminadas como incorrectas por las funciones de corrección." + +#: wp-includes/js/tinymce/wp-mce-help.php:212 +msgid "While using the editor, most basic keyboard shortcuts work like in any other text editor. For example: Shift+Enter inserts line break, Ctrl+C = copy, Ctrl+X = cut, Ctrl+Z = undo, Ctrl+Y = redo, Ctrl+A = select all, etc. (on Mac use the Command key instead of Ctrl). See the Hotkeys tab for all available keyboard shortcuts." +msgstr "Si sueles usar el editor, la mayoría de las combinaciones de teclas básicas funcionan como en cualquier otro editor de texto. Por ejemplo: Shift + Enter inserta un salto de línea, Ctrl + C = copiar, Ctrl + X = cortar, Ctrl + Z = deshacer, Ctrl + Y = rehacer, Ctrl + A = seleccionar todo, etc (en Mac usar la tecla Comando en lugar de Ctrl). Puedes ver la lista de teclas rápidas para todos los atajos de teclado." + +#: wp-includes/js/tinymce/wp-mce-help.php:213 +msgid "If you do not like the way the rich editor works, you may turn it off from Your Profile submenu, under Users in the admin menu." +msgstr "Si no te gusta la forma en que trabaja el editor visual, podrás desactivarlo desde el submenu de tu perfil, en el menú usuario en la administración." + +#: wp-includes/js/tinymce/wp-mce-help.php:217 +msgid "Advanced Rich Editing" +msgstr "Edición visual avanzada" + +#: wp-includes/js/tinymce/wp-mce-help.php:218 +msgid "Images and Attachments" +msgstr "Imágenes y archivos" + +#: wp-includes/js/tinymce/wp-mce-help.php:219 +msgid "There is a button in the editor toolbar for inserting images that are already hosted somewhere on the internet. If you have a URL for an image, click this button and enter the URL in the box which appears." +msgstr "En la barra de herramientas del editor hay un botón para insertar imágenes hospedadas en cualquier sitio de Internet. Si tienes el URL de una imagen, haz clic en ese botón y escríbelo en la ventana que aparecerá." + +#: wp-includes/js/tinymce/wp-mce-help.php:220 +msgid "If you need to upload an image or another media file from your computer, you can use the Media Library buttons above the editor. The media library will attempt to create a thumbnail-sized copy from each uploaded image. To insert your image into the post, first click on the thumbnail to reveal a menu of options. When you have selected the options you like, click \"Send to Editor\" and your image or file will appear in the post you are editing. If you are inserting a movie, there are additional options in the \"Media\" dialog that can be opened from the second toolbar row." +msgstr "Si necesitas subir una imagen o cualquier archivo multimedia de tu ordenador, puedes utilizar los botones de la Librería Multimedia sobre el editor. Esta herramienta tratará de crear una miniatura de la imagen cuando la subas. Para insertar la imagen en la entrada, primero haz clic en la miniatura y aparecerá un menú de opciones. Para insertar la imagen en el editor, primero haz clic en la miniatura y se mostrará un menú de opciones. Selecciona \"Enviar al editor\" y tu imagen o archivo aparecerá en la entrada que estás editando. Si estás insertando un video, aparecen opciones adicionales en el menú a las que se puede acceder desde la segunda fila de botones de la barra de tareas." + +#: wp-includes/js/tinymce/wp-mce-help.php:221 +msgid "HTML in the Rich Editor" +msgstr "HTML en el editor visual" + +#: wp-includes/js/tinymce/wp-mce-help.php:222 +msgid "Any HTML entered directly into the rich editor will show up as text when the post is viewed. What you see is what you get. When you want to include HTML elements that cannot be generated with the toolbar buttons, you must enter it by hand in the HTML editor. Examples are tables and <code>. To do this, click the HTML tab and edit the code, then switch back to Visual mode. If the code is valid and understood by the editor, you should see it rendered immediately." +msgstr "Cualquier etiqueta HTML que escribas en el editor se mostrará como texto al visualizar la entrada. Lo que ves es lo que obtendrás. Si quieres incluir elementos HTML distintos de los generados por los botones de la barra de herramientas, como tablas o <code>, deberás hacerlo a mano en el editor HTML. Para ello, haz clic en el botón HTML, edita el código y haz clic en Actualizar. Si el código es válido y el editor lo entiende, lo verás procesado inmediatamente." + +#: wp-includes/js/tinymce/wp-mce-help.php:223 +msgid "Pasting in the Rich Editor" +msgstr "Pegando en el editor visual" + +#: wp-includes/js/tinymce/wp-mce-help.php:224 +msgid "When pasting content from another web page the results can be inconsistent and depend on your browser and on the web page you are pasting from. The editor tries to correct any invalid HTML code that was pasted, but for best results try using the HTML tab or one of the paste buttons that are on the second row. Alternatively try pasting paragraph by paragraph. In most browsers to select one paragraph at a time, triple-click on it." +msgstr "Cuando se pegan los contenidos de otra página web los resultados pueden ser incompatibles entre sí y dependen de tu navegador y de la página web desde donde estás pegando. El editor intenta corregir cualquier código HTML no válido que se pega, pero para obtener los mejores resultados, prueba a utilizar la pestaña HTML o pegar con uno de los botones que se encuentran en la segunda fila. Alternativamente intenta pegar párrafo por párrafo. En la mayoría de los navegadores, para seleccionar un párrafo a la vez, haz triple clic sobre él." + +#: wp-includes/js/tinymce/wp-mce-help.php:225 +msgid "Pasting content from another application, like Word or Excel, is best done with the Paste from Word button on the second row, or in HTML mode." +msgstr "Al pegar contenido desde otra aplicación, como Word o Excel, se hace mejor con el botón de la segunda fila Pegar desde Word, o en modo HTML." + +#: wp-includes/js/tinymce/wp-mce-help.php:229 +msgid "Writing at Full Speed" +msgstr "Escribir a toda velocidad" + +#: wp-includes/js/tinymce/wp-mce-help.php:230 +msgid "Rather than reaching for your mouse to click on the toolbar, use these access keys. Windows and Linux use Ctrl + letter. Macintosh uses Command + letter." +msgstr "En lugar de mover el ratón para hacer clic en la barra de herramientas, usa estas teclas de acceso rápido. En Windows y Linux usa Ctrl+letra. En Macintosh usa Comando+letra." + +#: wp-includes/js/tinymce/wp-mce-help.php:233 +#: wp-includes/js/tinymce/wp-mce-help.php:247 +msgid "Letter" +msgstr "Letra" + +#: wp-includes/js/tinymce/wp-mce-help.php:233 +#: wp-includes/js/tinymce/wp-mce-help.php:247 +msgid "Action" +msgstr "Acción" + +#: wp-includes/js/tinymce/wp-mce-help.php:235 +msgid "Select all" +msgstr "Seleccionar todos" + +#: wp-includes/js/tinymce/wp-mce-help.php:245 +msgid "The following shortcuts use different access keys: Alt + Shift + letter." +msgstr "Los siguientes atajos utilizan claves de acceso diferentes: Alt + Shift + letra." + +#: wp-includes/js/tinymce/wp-mce-help.php:250 +msgid "Check Spelling" +msgstr "Comprobar ortografía" + +#: wp-includes/js/tinymce/wp-mce-help.php:251 +msgid "Justify Text" +msgstr "Justificar texto" + +#: wp-includes/js/tinymce/wp-mce-help.php:253 +msgid "Insert link" +msgstr "Insertar enlace" + +#: wp-includes/js/tinymce/wp-mce-help.php:254 +msgid "Remove link" +msgstr "Borrar enlace" + +#: wp-includes/js/tinymce/wp-mce-help.php:255 +msgid "Quote" +msgstr "Cita" + +#: wp-includes/js/tinymce/wp-mce-help.php:256 +msgid "Full Screen" +msgstr "Pantalla completa" + +#: wp-includes/js/tinymce/wp-mce-help.php:257 +msgid "Insert Page Break tag" +msgstr "Insertar etiqueta de salto de página" + +#: wp-includes/js/tinymce/wp-mce-help.php:258 +msgid "Switch to HTML mode" +msgstr "Cambiar a modo HTML" + +#: wp-includes/js/tinymce/wp-mce-help.php:271 +msgid "GNU Library General Public Licence" +msgstr "Licencia Pública General de Librería GNU (GPL)" + +#: wp-includes/js/tinymce/wp-mce-help.php:273 +msgid "For more information about this software visit the TinyMCE website." +msgstr "Para más información sobre este software, visita el sitio de TinyMCE." + +#: wp-includes/js/tinymce/wp-mce-help.php:276 +msgid "Got Moxie?" +msgstr "¿Tienes Moxie?" + +#: wp-includes/link-template.php:517 +msgid "Comments Feed" +msgstr "Feed de comentarios" + +#: wp-includes/link-template.php:1177 wp-includes/link-template.php:1455 +msgid "Previous Post" +msgstr "Entrada anterior" + +#: wp-includes/link-template.php:1177 wp-includes/link-template.php:1455 +msgid "Next Post" +msgstr "Entrada siguiente" + +#: wp-includes/link-template.php:1315 +msgid "Last Post" +msgstr "Última entrada" + +#: wp-includes/link-template.php:1803 +msgid "Newer Comments »" +msgstr "Últimos comentarios »" + +#: wp-includes/link-template.php:1840 +msgid "« Older Comments" +msgstr "« Comentarios más viejos" + +#: wp-includes/locale.php:118 +msgid "S_Sunday_initial" +msgstr "D" + +#: wp-includes/locale.php:119 +msgid "M_Monday_initial" +msgstr "L" + +#: wp-includes/locale.php:120 +msgid "T_Tuesday_initial" +msgstr "M" + +#: wp-includes/locale.php:121 +msgid "W_Wednesday_initial" +msgstr "X" + +#: wp-includes/locale.php:122 +msgid "T_Thursday_initial" +msgstr "J" + +#: wp-includes/locale.php:123 +msgid "F_Friday_initial" +msgstr "V" + +#: wp-includes/locale.php:124 +msgid "S_Saturday_initial" +msgstr "S" + +#: wp-includes/locale.php:173 +msgid "am" +msgstr "am" + +#: wp-includes/locale.php:174 +msgid "pm" +msgstr "pm" + +#: wp-includes/locale.php:175 +msgid "AM" +msgstr "AM" + +#: wp-includes/locale.php:176 +msgid "PM" +msgstr "PM" + +#: wp-includes/locale.php:182 +msgid "number_format_thousands_sep" +msgstr "." + +#: wp-includes/media.php:414 +msgid "Could not read image size" +msgstr "No se pudo leer el tamaño de imagen" + +#: wp-includes/media.php:448 wp-includes/media.php:451 +#: wp-includes/media.php:456 +msgid "Resize path invalid" +msgstr "Ruta de redimensionado no válida" + +#: wp-includes/pluggable.php:536 +msgid "ERROR: Invalid username or incorrect password." +msgstr "ERROR: El nombre de usuario y/o la contraseña no son correctos." + +#: wp-includes/pluggable.php:1074 wp-includes/pluggable.php:1187 +msgid "Author : %1$s (IP: %2$s , %3$s)" +msgstr "Autor : %1$s (IP: %2$s , %3$s)" + +#: wp-includes/pluggable.php:1075 wp-includes/pluggable.php:1188 +msgid "E-mail : %s" +msgstr "Correo electrónico : %s" + +#: wp-includes/pluggable.php:1076 wp-includes/pluggable.php:1086 +#: wp-includes/pluggable.php:1095 wp-includes/pluggable.php:1174 +#: wp-includes/pluggable.php:1181 wp-includes/pluggable.php:1189 +msgid "URL : %s" +msgstr "URL : %s" + +#: wp-includes/pluggable.php:1078 wp-includes/pluggable.php:1191 +msgid "Comment: " +msgstr "Comentario:" + +#: wp-includes/pluggable.php:1079 +msgid "You can see all comments on this post here: " +msgstr "Puedes ver todos los comentarios de esta entrada aquí:" + +#: wp-includes/pluggable.php:1081 +msgid "[%1$s] Comment: \"%2$s\"" +msgstr "[%1$s] Comentario: \"%2$s\"" + +#: wp-includes/pluggable.php:1085 wp-includes/pluggable.php:1094 +msgid "Website: %1$s (IP: %2$s , %3$s)" +msgstr "Sitio web: %1$s (IP: %2$s , %3$s)" + +#: wp-includes/pluggable.php:1087 wp-includes/pluggable.php:1096 +msgid "Excerpt: " +msgstr "Extracto:" + +#: wp-includes/pluggable.php:1088 +msgid "You can see all trackbacks on this post here: " +msgstr "Puedes ver todos los trackbacks de esta entrada aquí:" + +#: wp-includes/pluggable.php:1090 +msgid "[%1$s] Trackback: \"%2$s\"" +msgstr "[%1$s] Trackback: \"%2$s\"" + +#: wp-includes/pluggable.php:1097 +msgid "You can see all pingbacks on this post here: " +msgstr "Puede ver todos los pingback de esta entrada aquí:" + +#: wp-includes/pluggable.php:1099 +msgid "[%1$s] Pingback: \"%2$s\"" +msgstr "[%1$s] Pingback: \"%2$s\"" + +#: wp-includes/pluggable.php:1104 wp-includes/pluggable.php:1197 +msgid "Trash it: %s" +msgstr "Enviar a la papelera: %s" + +#: wp-includes/pluggable.php:1106 wp-includes/pluggable.php:1199 +msgid "Delete it: %s" +msgstr "Borrarlo: %s" + +#: wp-includes/pluggable.php:1107 wp-includes/pluggable.php:1200 +msgid "Spam it: %s" +msgstr "Marcarlo como spam: %s" + +#: wp-includes/pluggable.php:1173 wp-includes/pluggable.php:1180 +msgid "Website : %1$s (IP: %2$s , %3$s)" +msgstr "Sitio web : %1$s (IP: %2$s , %3$s)" + +#: wp-includes/pluggable.php:1175 +msgid "Trackback excerpt: " +msgstr "Extracto del trackback:" + +#: wp-includes/pluggable.php:1182 +msgid "Pingback excerpt: " +msgstr "Extracto del pingback:" + +#: wp-includes/pluggable.php:1195 +msgid "Approve it: %s" +msgstr "Aprobarlo: %s" + +#: wp-includes/pluggable.php:1202 +msgid "Currently %s comment is waiting for approval. Please visit the moderation panel:" +msgid_plural "Currently %s comments are waiting for approval. Please visit the moderation panel:" +msgstr[0] "Actualmente hay %s comentario en espera de aprobación. Por favor visita el panel de moderación:" +msgstr[1] "Actualmente hay %s comentarios en espera de aprobación. Por favor visita el panel de moderación:" + +#: wp-includes/pluggable.php:1206 +msgid "[%1$s] Please moderate: \"%2$s\"" +msgstr "[%1$s] Pendientes de moderación: \"%2$s\"" + +#: wp-includes/pluggable.php:1232 +msgid "Password Lost and Changed for user: %s" +msgstr "Contraseña perdida y cambiada para el usuario: %s" + +#: wp-includes/pluggable.php:1236 +msgid "[%s] Password Lost/Changed" +msgstr "[%s] Contraseña Perdida/Cambiada" + +#: wp-includes/pluggable.php:1261 wp-includes/pluggable.php:1269 +#: wp-login.php:216 +msgid "Username: %s" +msgstr "Nombre de usuario: %s" + +#: wp-includes/pluggable.php:1264 +msgid "[%s] New User Registration" +msgstr "[%s] Registro de nuevo usuario" + +#: wp-includes/pluggable.php:1270 +msgid "Password: %s" +msgstr "Contraseña: %s" + +#: wp-includes/pluggable.php:1273 +msgid "[%s] Your username and password" +msgstr "[%s] Tu nombre de usuario y contraseña" + +#: wp-includes/post-template.php:112 +msgid "Protected: %s" +msgstr "Protegido: %s" + +#: wp-includes/post-template.php:115 +msgid "Private: %s" +msgstr "Privado: %s" + +#: wp-includes/post-template.php:268 +msgid "There is no excerpt because this is a protected post." +msgstr "No hay extracto porque es una entrada protegida." + +#: wp-includes/post-template.php:627 +msgid "Next page" +msgstr "Página siguiente" + +#: wp-includes/post-template.php:628 +msgid "Previous page" +msgstr "Página anterior" + +#: wp-includes/post-template.php:890 wp-admin/menu.php:27 +msgid "Home" +msgstr "Inicio" + +#: wp-includes/post-template.php:1215 +msgid "This post is password protected. To view it please enter your password below:" +msgstr "Esta entrada está protegida. Para verla escribe la contraseña:" + +#: wp-includes/post-template.php:1279 +msgctxt "revision date format" +msgid "j F, Y @ G:i" +msgstr "j F, Y @ G:i" + +#: wp-includes/post-template.php:1281 +msgid "%1$s [Autosave]" +msgstr "%s [Autoguardado]" + +#: wp-includes/post-template.php:1283 +msgid "%1$s [Current Revision]" +msgstr "%s [Revisión Actual]" + +#: wp-includes/post-template.php:1349 +msgctxt "post revision" +msgid "%1$s by %2$s" +msgstr "%1$s por %2$s" + +#: wp-includes/post-template.php:1399 +msgid "Compare Revisions" +msgstr "Comparar revisiones" + +#: wp-includes/post.php:71 +msgid "Revision" +msgstr "Revisión" + +#: wp-includes/post.php:97 +msgctxt "post" +msgid "Published" +msgstr "Publicada" + +#: wp-includes/post.php:100 +msgid "Published (%s)" +msgid_plural "Published (%s)" +msgstr[0] "Publicada (%s)" +msgstr[1] "Publicadas (%s)" + +#: wp-includes/post.php:104 +msgctxt "post" +msgid "Scheduled" +msgstr "Programada" + +#: wp-includes/post.php:107 +msgid "Scheduled (%s)" +msgid_plural "Scheduled (%s)" +msgstr[0] "Programada (%s)" +msgstr[1] "Programadas (%s)" + +#: wp-includes/post.php:111 +msgctxt "post" +msgid "Draft" +msgstr "Borrador" + +#: wp-includes/post.php:114 +msgid "Draft (%s)" +msgid_plural "Drafts (%s)" +msgstr[0] "Borrador (%s)" +msgstr[1] "Borradores (%s)" + +#: wp-includes/post.php:118 +msgctxt "post" +msgid "Pending" +msgstr "Pendiente" + +#: wp-includes/post.php:121 +msgid "Pending (%s)" +msgid_plural "Pending (%s)" +msgstr[0] "Pendiente (%s)" +msgstr[1] "Pendientes (%s)" + +#: wp-includes/post.php:125 +msgctxt "post" +msgid "Private" +msgstr "Privada" + +#: wp-includes/post.php:128 +msgid "Private (%s)" +msgid_plural "Private (%s)" +msgstr[0] "Privada (%s)" +msgstr[1] "Privadas (%s)" + +#: wp-includes/post.php:132 +msgctxt "post" +msgid "Trash" +msgstr "Papelera" + +#: wp-includes/post.php:135 +msgid "Trash (%s)" +msgid_plural "Trash (%s)" +msgstr[0] "Papelera (%s)" +msgstr[1] "Papelera (%s)" + +#: wp-includes/post.php:2452 +msgid "Content, title, and excerpt are empty." +msgstr "Contenido, título y extracto están vacios." + +#: wp-includes/post.php:2576 +msgid "Could not update post in the database" +msgstr "No ha sido posible actualizar la entrada en la base de datos" + +#: wp-includes/post.php:2592 +msgid "Could not insert post into the database" +msgstr "No ha sido posible insertar la entrada en la base de datos" + +#: wp-includes/post.php:2642 +msgid "The page template is invalid." +msgstr "La plantilla de la página no es válida." + +#: wp-includes/post.php:4879 +msgid "Cannot create a revision of a revision" +msgstr "No se puede crear una revisión de una revisión" + +#: wp-includes/post.php:5054 +msgid "You do not have permission to preview drafts." +msgstr "No tienes autorización para previsualizar borradores." + +#: wp-includes/user.php:1406 +msgid "Cannot create a user with an empty login name." +msgstr "No se puede crear un usuario con el nombre de identificación vacio." + +#: wp-includes/user.php:1409 +msgid "This username is already registered." +msgstr "Este usuario ya está registrado." + +#: wp-includes/user.php:1424 +msgid "This email address is already registered." +msgstr "Esta dirección de correo electrónico ya está registrada." + +#: wp-includes/user.php:1614 +msgid "AIM" +msgstr "AIM" + +#: wp-includes/user.php:1615 +msgid "Yahoo IM" +msgstr "Yahoo IM" + +#: wp-includes/user.php:1616 +msgid "Jabber / Google Talk" +msgstr "Jabber / Google Talk" + +#: wp-includes/rss.php:900 +msgid "An error has occurred, which probably means the feed is down. Try again later." +msgstr "Ha ocurrido un error, probablemente el feed esté caído. Inténtalo de nuevo más tarde." + +#: wp-includes/script-loader.php:70 +msgid "" +"You are about to permanently delete the selected items.\n" +" 'Cancel' to stop, 'OK' to delete." +msgstr "" +"Estás a punto de borrar permanentemente los elementos seleccionados. \n" +" 'Aceptar' para borrar, 'Cancelar' para salir." + +#: wp-includes/script-loader.php:80 +msgid "(Quick Links)" +msgstr "(Enlaces rápidos)" + +#: wp-includes/script-loader.php:81 +msgid "Enter a word to look up:" +msgstr "Introduce una palabra a buscar:" + +#: wp-includes/script-loader.php:82 +msgid "Dictionary lookup" +msgstr "Buscar en el diccionario" + +#: wp-includes/script-loader.php:83 +msgid "lookup" +msgstr "buscar" + +#: wp-includes/script-loader.php:84 +msgid "Close all open tags" +msgstr "Cerrar todas las etiquetas abiertas" + +#: wp-includes/script-loader.php:85 +msgid "close tags" +msgstr "cerrar etiquetas" + +#: wp-includes/script-loader.php:86 +msgid "Enter the URL" +msgstr "Introduce la URL" + +#: wp-includes/script-loader.php:87 +msgid "Enter the URL of the image" +msgstr "Introduce la URL de la imagen" + +#: wp-includes/script-loader.php:88 +msgid "Enter a description of the image" +msgstr "Introduce una descripción de la imagen" + +#: wp-includes/script-loader.php:107 wp-includes/script-loader.php:307 +msgid "You do not have permission to do that." +msgstr "No tienes autorización para hacer eso." + +#: wp-includes/script-loader.php:108 wp-includes/script-loader.php:308 +msgid "An unidentified error has occurred." +msgstr "Ha ocurrido un error no identificado." + +#: wp-includes/script-loader.php:196 +msgid "Next >" +msgstr "Siguiente >" + +#: wp-includes/script-loader.php:197 +msgid "< Prev" +msgstr "< Anterior" + +#: wp-includes/script-loader.php:198 +msgid "Image" +msgstr "Imagen" + +#: wp-includes/script-loader.php:199 +msgid "of" +msgstr "de" + +#: wp-includes/script-loader.php:201 +msgid "This feature requires inline frames. You have iframes disabled or your browser does not support them." +msgstr "Esta función requiere de frames insertados. Tienes los iframes desactivados o tu navegador no los soporta." + +#: wp-includes/script-loader.php:226 +msgid "not configured" +msgstr "sin configurar" + +#: wp-includes/script-loader.php:229 +msgid "You have attempted to queue too many files." +msgstr "Has intentado poner en cola demasiados archivos." + +#: wp-includes/script-loader.php:231 +msgid "This file is empty. Please try another." +msgstr "Este archivo está vacio. Por favor, prueba con otro." + +#: wp-includes/script-loader.php:232 +msgid "This file type is not allowed. Please try another." +msgstr "Este tipo de archivo no está permitido. Por favor, prueba con otro." + +#: wp-includes/script-loader.php:233 +msgid "An error occurred in the upload. Please try again later." +msgstr "Ha habido un error en la subida. Por favor inténtalo más tarde." + +#: wp-includes/script-loader.php:234 +msgid "There was a configuration error. Please contact the server administrator." +msgstr "Ha habido un problema con la configuración. Por favor, contacta con el administrador del servidor." + +#: wp-includes/script-loader.php:235 +msgid "You may only upload 1 file." +msgstr "Sólo puedes subir 1 archivo." + +#: wp-includes/script-loader.php:236 +msgid "HTTP error." +msgstr "Error HTTP." + +#: wp-includes/script-loader.php:237 +msgid "Upload failed." +msgstr "Falló la subida." + +#: wp-includes/script-loader.php:238 +msgid "IO error." +msgstr "Error de entrada/salida." + +#: wp-includes/script-loader.php:239 +msgid "Security error." +msgstr "Error de seguridad." + +#: wp-includes/script-loader.php:241 +msgid "Upload stopped." +msgstr "Subida detenida." + +#: wp-includes/script-loader.php:243 +msgid "Crunching…" +msgstr "Calculando…" + +#: wp-includes/script-loader.php:244 +msgid "moved to the trash." +msgstr "movidos a la papelera." + +#: wp-includes/script-loader.php:297 +msgid "Separate multiple categories with commas." +msgstr "Separa múltiples categorías con comas." + +#: wp-includes/script-loader.php:263 wp-admin/install.php:256 +msgctxt "password strength" +msgid "Medium" +msgstr "Medio" + +#: wp-includes/script-loader.php:333 +msgid "Tags used on this post:" +msgstr "Etiquetas utilizadas en esta entrada:" + +#: wp-includes/script-loader.php:340 +msgid "Publish on:" +msgstr "Publicar el:" + +#: wp-includes/script-loader.php:341 +msgid "Schedule for:" +msgstr "Programar para el:" + +#: wp-includes/script-loader.php:342 +msgid "Published on:" +msgstr "Publicada el:" + +#: wp-includes/script-loader.php:343 +msgid "Show more comments" +msgstr "Mostrar más comentarios" + +#: wp-includes/script-loader.php:344 +msgid "No more comments found." +msgstr "No hay más comentarios." + +#: wp-includes/script-loader.php:353 +msgid "Password Protected" +msgstr "Protegida con contraseña" + +#: wp-includes/script-loader.php:367 +msgid "Submitted on:" +msgstr "Enviado el:" + +#: wp-includes/script-loader.php:391 wp-includes/script-loader.php:400 +msgid "Error while saving the changes." +msgstr "Error al guardar los cambios." + +#: wp-includes/script-loader.php:392 +msgid "Remove From Bulk Edit" +msgstr "Borrar desde la edición en bloque" + +#: wp-includes/script-loader.php:407 +msgid "Plugin Information:" +msgstr "Información del plugin:" + +#: wp-includes/script-loader.php:432 +msgid "Saving..." +msgstr "Guardando..." + +#: wp-includes/script-loader.php:433 +msgid "Could not set that as the thumbnail image. Try a different attachment." +msgstr "No se pudo establecer como imagen de miniatura. Prueba con otro adjunto." + +#: wp-includes/script-loader.php:563 +msgid "Saving Draft…" +msgstr "Guardando borrador…" + +#: wp-includes/taxonomy.php:490 wp-includes/taxonomy.php:843 +#: wp-includes/taxonomy.php:971 wp-includes/taxonomy.php:1161 +#: wp-includes/taxonomy.php:1834 wp-includes/taxonomy.php:2103 +msgid "Invalid Taxonomy" +msgstr "Taxonomía no válida" + +#: wp-includes/taxonomy.php:838 wp-includes/taxonomy.php:2880 +msgid "Empty Term" +msgstr "Término vacío" + +#: wp-includes/taxonomy.php:1979 +msgid "Invalid term ID" +msgstr "ID del término no válido" + +#: wp-includes/taxonomy.php:1982 wp-includes/taxonomy.php:2300 +msgid "A name is required for this term" +msgstr "Este término necesita un nombre." + +#: wp-includes/taxonomy.php:2024 wp-includes/taxonomy.php:2031 +#: wp-includes/taxonomy.php:2041 +msgid "Could not insert term into the database" +msgstr "No ha sido posible insertar el término en la base de datos." + +#: wp-includes/taxonomy.php:2333 +msgid "The slug “%s” is already in use by another term" +msgstr "El slug “%s” lo está utilizando ya otro término." + +#: wp-includes/taxonomy.php:3044 +msgid "Invalid object ID" +msgstr "El ID del objeto no es válido" + +#: wp-includes/theme.php:282 +msgid "File not readable." +msgstr "Archivo no legible." + +#: wp-includes/theme.php:334 +msgid "Template is missing." +msgstr "Falta la plantilla." + +#: wp-includes/theme.php:336 +msgid "The parent theme is missing. Please install the \"%s\" parent theme." +msgstr "No encontramos el tema principal. Por favor, instala el tema principal \"%s\"." + +#: wp-includes/theme.php:641 +msgid "Stylesheet is missing." +msgstr "Falta la hoja de estilo." + +#: wp-includes/user.php:80 +msgid "ERROR: The username field is empty." +msgstr "ERROR: El campo Nombre de usuario está vacío." + +#: wp-includes/user.php:83 +msgid "ERROR: The password field is empty." +msgstr "ERROR: El campo contraseña está vacío." + +#: wp-includes/user.php:91 +msgid "ERROR: Invalid username. Lost your password?" +msgstr "ERROR: El usuario es incorrecto. ¿La has olvidado?" + +#: wp-includes/user.php:96 +msgid "ERROR: Your account has been marked as a spammer." +msgstr "ERROR: Tu cuenta ha sido marcada como spammer." + +#: wp-includes/user.php:137 +msgid "Please log in again." +msgstr "Por favor, accede de nuevo." + +#: wp-includes/widgets.php:488 wp-includes/widgets.php:547 +msgid "Sidebar %d" +msgstr "Barra lateral %d" + +#: wp-includes/wp-db.php:1479 +msgid "ERROR: WordPress %1$s requires MySQL %2$s or higher" +msgstr "ERROR: WordPress %1$s necesita MySQL %2$s o superior." + +#: wp-login.php:87 +msgid "Powered by WordPress" +msgstr "Funciona gracias a WordPress" + +#: wp-login.php:171 +msgid "ERROR: Enter a username or e-mail address." +msgstr "ERROR: escribe un nombre de usuario o correo electrónico." + +#: wp-login.php:176 +msgid "ERROR: There is no user registered with that email address." +msgstr "ERROR: no hay ningún usuario registrado con esa dirección de correo electrónico." + +#: wp-login.php:188 +msgid "ERROR: Invalid username or e-mail." +msgstr "ERROR: el nombre de usuario o el correo electrónico no son correctos." + +#: wp-login.php:202 +msgid "Password reset is not allowed for this user" +msgstr "El restablecimiento de contraseña no está permitido para este usuario" + +#: wp-login.php:228 +msgid "[%s] Password Reset" +msgstr "[%s] Restablecer contraseña" + +#: wp-login.php:234 +msgid "The e-mail could not be sent." +msgstr "No se pudo enviar el correo electrónico" + +#: wp-login.php:234 +msgid "Possible reason: your host may have disabled the mail() function..." +msgstr "Posible razón: el servidor puede tener deshabilitada la función mail()..." + +#: wp-login.php:255 wp-login.php:258 wp-login.php:263 +msgid "Invalid key" +msgstr "Clave no válida." + +#: wp-login.php:303 +msgid "ERROR: This username is already registered, please choose another one." +msgstr "ERROR: Ese usuario ya existe. Por favor, elige otro." + +#: wp-login.php:308 +msgid "ERROR: Please type your e-mail address." +msgstr "ERROR: Por favor, escribe tu correo electrónico." + +#: wp-login.php:310 +msgid "ERROR: The email address isn’t correct." +msgstr "ERROR: La dirección de correo electrónico no es correcta." + +#: wp-login.php:326 +msgid "ERROR: Couldn’t register you... please contact the webmaster !" +msgstr "ERROR: No es posible registrarte... por favor, ponte en contacto con el administrador" + +#: wp-login.php:398 +msgid "Sorry, that key does not appear to be valid." +msgstr "Disculpa, la contraseña no es válida." + +#: wp-login.php:402 +msgid "Lost Password" +msgstr "Contraseña perdida" + +#: wp-login.php:410 +msgid "Username or E-mail:" +msgstr "Nombre de usuario o correo electrónico:" + +#: wp-login.php:415 +msgid "Get New Password" +msgstr "Obtener una contraseña nueva" + +#: wp-login.php:127 +msgid "Are you lost?" +msgstr "¿Te has perdido?" + +#: wp-login.php:127 +msgid "← Back to %s" +msgstr "« Volver a %s" + +#: wp-login.php:511 +msgid "Registration Form" +msgstr "Formulario de registro" + +#: wp-login.php:511 +msgid "Register For This Site" +msgstr "Registrarte en este sitio" + +#: wp-login.php:524 +msgid "A password will be e-mailed to you." +msgstr "Recibirás una contraseña en este correo electrónico." + +#: wp-login.php:532 wp-login.php:661 wp-login.php:663 +msgid "Password Lost and Found" +msgstr "Recupera tu contraseña perdida" + +#: wp-login.php:532 wp-login.php:661 wp-login.php:663 +msgid "Lost your password?" +msgstr "¿Has perdido tu contraseña?" + +#: wp-login.php:578 +msgid "You have logged in successfully." +msgstr "Te has conectado con éxito." + +#: wp-login.php:607 +msgid "ERROR: Cookies are blocked or not supported by your browser. You must enable cookies to use WordPress." +msgstr "ERROR: Las Cookies están bloqueadas o no las soporta tu navegador. Debes habilitar las cookies para usar WordPress." + +#: wp-login.php:611 +msgid "You are now logged out." +msgstr "Ahora estás desconectado." + +#: wp-login.php:613 +msgid "User registration is currently not allowed." +msgstr "No se permite el registro de nuevos usuarios." + +#: wp-login.php:615 +msgid "Check your e-mail for the confirmation link." +msgstr "Revisa tu correo electrónico para obtener el enlace de confirmación." + +#: wp-login.php:617 +msgid "Check your e-mail for your new password." +msgstr "Revisa tu correo electrónico para obtener la contraseña nueva." + +#: wp-login.php:619 +msgid "Registration complete. Please check your e-mail." +msgstr "Registro completo. Por favor, revisa tu correo electrónico." + +#: wp-login.php:621 +msgid "Your session has expired. Please log-in again." +msgstr "Tu sesión ha expirado. Vuelve a acceder." + +#: wp-mail.php:29 +msgid "Slow down cowboy, no need to check for new mails so often!" +msgstr "¡Tranquilo, campeón! ¡No hace falta comprobar el correo tan a menudo!" + +#: wp-mail.php:49 +msgid "There doesn’t seem to be any new mail." +msgstr "Parece que no hay ningún correo electrónico nuevo." + +#: wp-mail.php:115 +msgid "Author is %s" +msgstr "El autor es %s" + +#: wp-mail.php:221 +msgid "Author: %s" +msgstr "Autor: %s" + +#: wp-mail.php:222 +msgid "Posted title: %s" +msgstr "Título publicado: %s" + +#: wp-mail.php:225 +msgid "Oops: %s" +msgstr "Oops: %s" + +#: wp-mail.php:229 +msgid "Mission complete. Message %s deleted." +msgstr "Misión cumplida. Mensaje %s borrado." + +#: wp-includes/js/tinymce/langs/wp-langs.php:288 +#: wp-includes/js/tinymce/langs/wp-langs.php:304 +#: wp-includes/js/tinymce/langs/wp-langs.php:469 +#: wp-includes/js/tinymce/wp-mce-help.php:257 +#: wp-admin/includes/template.php:1829 +msgid "Help" +msgstr "Ayuda" + +#: wp-admin/includes/template.php:1816 +msgid "Documentation" +msgstr "Documentación" + +#: wp-admin/link-manager.php:50 wp-admin/user-new.php:150 wp-admin/index.php:49 +#: wp-admin/edit-link-form.php:48 wp-admin/options-general.php:70 +#: wp-admin/themes.php:47 wp-admin/media.php:77 wp-admin/custom-header.php:107 +#: wp-admin/options-discussion.php:23 wp-admin/plugin-editor.php:124 +#: wp-admin/plugin-install.php:46 wp-admin/options-privacy.php:24 +#: wp-admin/theme-editor.php:36 wp-admin/tools.php:20 +#: wp-admin/edit-form-advanced.php:178 wp-admin/edit-form-advanced.php:189 +#: wp-admin/comment.php:52 wp-admin/edit-comments.php:124 +#: wp-admin/import.php:24 wp-admin/custom-background.php:89 +#: wp-admin/options-media.php:25 wp-admin/edit.php:170 wp-admin/edit.php:179 +#: wp-admin/upload.php:149 wp-admin/export.php:46 wp-admin/theme-install.php:47 +#: wp-admin/users.php:30 wp-admin/options-writing.php:23 +#: wp-admin/update-core.php:414 wp-admin/options-reading.php:51 +#: wp-admin/includes/template.php:1818 wp-admin/options-permalink.php:28 +#: wp-admin/user-edit.php:48 wp-admin/widgets.php:46 wp-admin/credits.php:21 +#: wp-admin/plugins.php:328 wp-admin/edit-tags.php:218 +#: wp-admin/media-upload.php:70 wp-admin/nav-menus.php:457 +msgid "Support Forums" +msgstr "Foros de soporte (en inglés)" + +#: wp-admin/includes/template.php:1833 +msgid "Screen Options" +msgstr "Opciones de pantalla" + +#: wp-admin/includes/template.php:1888 +msgid "Screen Layout" +msgstr "Diseño de pantalla" + +#: wp-admin/includes/template.php:1888 +msgid "Number of Columns:" +msgstr "Número de columnas:" + +#: wp-admin/includes/theme-install.php:56 +msgid "Search for themes by keyword, author, or tag." +msgstr "Buscar temas por palabra clave, autor o etiqueta." + +#: wp-admin/themes.php:149 wp-admin/includes/theme-install.php:79 +msgid "Feature Filter" +msgstr "Filtrar por características" + +#: wp-admin/includes/theme-install.php:81 +msgid "Find a theme based on specific features" +msgstr "Buscar un tema basándote en determinadas características" + +#: wp-admin/includes/theme.php:270 wp-admin/includes/theme.php:347 +msgid "Colors" +msgstr "Colores" + +#: wp-includes/js/tinymce/langs/wp-langs.php:34 wp-admin/includes/theme.php:271 +msgid "Black" +msgstr "Negro" + +#: wp-includes/general-template.php:2077 +#: wp-includes/js/tinymce/langs/wp-langs.php:47 wp-admin/includes/theme.php:272 +msgid "Blue" +msgstr "Azul" + +#: wp-includes/js/tinymce/langs/wp-langs.php:64 wp-admin/includes/theme.php:273 +msgid "Brown" +msgstr "Marrón" + +#: wp-includes/js/tinymce/langs/wp-langs.php:45 wp-admin/includes/theme.php:275 +msgid "Green" +msgstr "Verde" + +#: wp-includes/js/tinymce/langs/wp-langs.php:43 wp-admin/includes/theme.php:276 +msgid "Orange" +msgstr "Naranja" + +#: wp-includes/js/tinymce/langs/wp-langs.php:66 wp-admin/includes/theme.php:277 +msgid "Pink" +msgstr "Rosa" + +#: wp-includes/js/tinymce/langs/wp-langs.php:56 wp-admin/includes/theme.php:278 +msgid "Purple" +msgstr "Púrpura" + +#: wp-includes/js/tinymce/langs/wp-langs.php:50 wp-admin/includes/theme.php:279 +msgid "Red" +msgstr "Rojo" + +#: wp-includes/js/tinymce/langs/wp-langs.php:65 wp-admin/includes/theme.php:280 +msgid "Silver" +msgstr "Gris" + +#: wp-admin/includes/theme.php:281 +msgid "Tan" +msgstr "Café" + +#: wp-includes/js/tinymce/langs/wp-langs.php:73 wp-admin/includes/theme.php:282 +msgid "White" +msgstr "Blanco" + +#: wp-includes/js/tinymce/langs/wp-langs.php:60 wp-admin/includes/theme.php:283 +msgid "Yellow" +msgstr "Amarillo" + +#: wp-admin/includes/theme.php:284 +msgid "Dark" +msgstr "Negro" + +#: wp-admin/includes/theme.php:288 wp-admin/includes/theme.php:347 +msgid "Columns" +msgstr "Columnas" + +#: wp-admin/includes/theme.php:289 +msgid "One Column" +msgstr "Una columna" + +#: wp-admin/includes/theme.php:290 +msgid "Two Columns" +msgstr "Dos columnas" + +#: wp-admin/includes/theme.php:291 +msgid "Three Columns" +msgstr "Tres columnas" + +#: wp-admin/includes/theme.php:292 +msgid "Four Columns" +msgstr "Cuatro columnas" + +#: wp-admin/includes/theme.php:293 +msgid "Left Sidebar" +msgstr "Barra lateral izquierda" + +#: wp-admin/includes/theme.php:294 +msgid "Right Sidebar" +msgstr "Barra lateral derecha" + +#: wp-includes/js/tinymce/langs/wp-langs.php:494 wp-admin/options-media.php:46 +#: wp-admin/options-media.php:92 wp-admin/includes/theme.php:297 +#: wp-admin/includes/theme.php:347 +msgid "Width" +msgstr "Ancho" + +#: wp-admin/includes/theme.php:298 +msgid "Fixed Width" +msgstr "Ancho fijo" + +#: wp-admin/includes/theme.php:299 +msgid "Flexible Width" +msgstr "Ancho flexible" + +#: wp-admin/includes/theme.php:302 wp-admin/includes/theme.php:348 +msgid "Features" +msgstr "Características" + +#: wp-admin/includes/theme.php:306 +msgid "Custom Colors" +msgstr "Colores personalizados" + +#: wp-admin/includes/theme.php:318 +msgid "Theme Options" +msgstr "Opciones del tema" + +#: wp-admin/includes/theme.php:319 +msgid "Threaded Comments" +msgstr "Comentarios anidados" + +#: wp-admin/includes/theme.php:317 +msgid "Sticky Post" +msgstr "Entrada fija" + +#: wp-admin/includes/theme.php:314 +msgid "Microformats" +msgstr "Microformatos" + +#: wp-admin/includes/theme.php:323 wp-admin/includes/theme.php:348 +msgid "Subject" +msgstr "Asunto" + +#: wp-admin/includes/theme.php:324 +msgid "Holiday" +msgstr "Vacaciones" + +#: wp-admin/includes/theme.php:325 +msgid "Photoblogging" +msgstr "Fotoblogging" + +#: wp-admin/includes/theme.php:326 +msgid "Seasonal" +msgstr "Estacional" + +#: wp-admin/includes/theme-install.php:109 +msgid "Find Themes" +msgstr "Buscar temas" + +#: wp-admin/includes/theme-install.php:117 +msgid "Install a theme in .zip format" +msgstr "Instalar un tema desde un archivo .zip" + +#: wp-admin/includes/theme-install.php:118 +msgid "If you have a theme in a .zip format, you may install it by uploading it here." +msgstr "Si tienes un tema en un archivo .zip, puedes instalarlo subiendo el archivo desde aquí." + +#: wp-admin/includes/theme-install.php:143 +msgid "Install “%s”" +msgstr "Instalar “%s”" + +#: wp-admin/includes/theme-install.php:160 +#: wp-admin/includes/class-wp-plugin-install-list-table.php:192 +msgid "Details" +msgstr "Detalles" + +#: wp-admin/includes/theme-install.php:237 +msgid "Theme Install" +msgstr "Instalar" + +#: wp-admin/includes/theme-install.php:240 +msgid "Error: This theme is currently not available. Please try again later." +msgstr "ERROR: Este tema no está disponible actualmente. Por favor vuelve a intentarlo más tarde." + +#: wp-admin/includes/theme-install.php:246 +msgid "Warning: This theme has not been tested with your current version of WordPress." +msgstr "Atención: Este tema no ha sido probado en esta versión de WordPress." + +#: wp-admin/includes/theme-install.php:248 +msgid "Warning: This theme has not been marked as compatible with your version of WordPress." +msgstr "Atención: Este tema no es compatible con esta versión de WordPress." + +#: wp-admin/includes/theme-install.php:281 +msgid "by %s" +msgstr "por %s" + +#: wp-admin/includes/theme-install.php:282 +msgid "Version: %s" +msgstr "Versión: %s" + +#: wp-admin/includes/theme-install.php:301 +msgid "Newer version (%s) is installed." +msgstr "La última versión (%s) ya está instalada." + +#: wp-admin/includes/theme-install.php:306 +msgid "This version is already installed." +msgstr "Esta versión ya está instalada." + +#: wp-admin/includes/theme.php:93 +msgid "Unable to locate WordPress theme directory." +msgstr "Ha sido imposible localizar el directorio de temas de WordPress." + +#: wp-admin/includes/theme.php:100 +msgid "Could not fully remove the theme %s." +msgstr "No se pudo eliminar completamente el tema %s." + +#: wp-admin/includes/update-core.php:347 +msgid "The update cannot be installed because WordPress %1$s requires PHP version %2$s or higher and MySQL version %3$s or higher. You are running PHP version %4$s and MySQL version %5$s." +msgstr "La actualización no se pudo instalar a causa de que WordPress %1$s requiere la versión %2$s o superior de PHP y la versión %3$s o superior de MySQL. Estás usando la versión %4$s de PHP y la versión %5$s de MySQL." + +#: wp-admin/includes/update-core.php:349 +msgid "The update cannot be installed because WordPress %1$s requires PHP version %2$s or higher. You are running version %3$s." +msgstr "La actualización no puede instalarse ya que WordPress %1$s requiere la versión %2$s o superior de PHP. Estás usando la versión %3$s." + +#: wp-admin/includes/update-core.php:351 +msgid "The update cannot be installed because WordPress %1$s requires MySQL version %2$s or higher. You are running version %3$s." +msgstr "La actualización no puede instalarse porque WordPress %1$s requiere la versión %2$s o superior de MySQL. Estás usando la versión %3$s." + +#: wp-admin/includes/update-core.php:354 +msgid "Verifying the unpacked files…" +msgstr "Verificando los archivos descomprimidos…" + +#: wp-admin/includes/update-core.php:365 +msgid "The update could not be unpacked" +msgstr "No se ha podido descomprimir la actualización." + +#: wp-admin/includes/update-core.php:451 +msgid "Upgrading database…" +msgstr "Actualizado la base de datos…" + +#: wp-admin/includes/class-wp-plugins-list-table.php:429 +#: wp-admin/includes/update.php:89 wp-admin/includes/update.php:112 +msgid "Version %s" +msgstr "Versión %s" + +#: wp-admin/includes/update.php:103 +msgid "You are using a development version (%1$s). Cool! Please stay updated." +msgstr "Estás usando una versión en desarrollo (%1$s). ¡Mola! Por favor, mantente actualizado." + +#: wp-admin/includes/update.php:107 +msgid "Get Version %2$s" +msgstr "Descargar versión %2$s" + +#: wp-admin/includes/update.php:148 +msgid "You are using WordPress %s." +msgstr "Estás usando WordPress %s." + +#: wp-admin/includes/update.php:151 +msgid "Update to %s" +msgstr "Actualizar a %s" + +#: wp-admin/includes/update.php:151 +msgid "Latest" +msgstr "Última" + +#: wp-admin/includes/update.php:305 +msgid "An automated WordPress update has failed to complete - please attempt the update again now." +msgstr "No se ha podido completar la actualización automática de WordPress. Por favor, vuelve a intentarlo." + +#: wp-admin/includes/update.php:307 +msgid "An automated WordPress update has failed to complete! Please notify the site administrator." +msgstr "¡No se ha podido completar la actualización automática de WordPress! Por favor, avisa al administrador." + +#: wp-admin/includes/upgrade.php:68 +msgid "Note that password carefully! It is a random password that was generated just for you." +msgstr "¡Anota la contraseña cuidadosamente! Es una contraseña aleatoria que ha sido generada sólo para ti." + +#: wp-admin/includes/upgrade.php:111 +msgctxt "Default category slug" +msgid "Uncategorized" +msgstr "Sin categoría" + +#: wp-admin/includes/upgrade.php:131 +msgctxt "Default link category slug" +msgid "Blogroll" +msgstr "Sitios de interés" + +#: wp-admin/includes/upgrade.php:204 +msgid "Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!" +msgstr "Bienvenido a WordPress. Esta es tu primera entrada. Edítala o bórrala, ¡y comienza a publicar!." + +#: wp-admin/includes/upgrade.php:213 +msgid "Hello world!" +msgstr "¡Hola mundo!" + +#: wp-admin/includes/upgrade.php:215 +msgctxt "Default post slug" +msgid "hello-world" +msgstr "hola-mundo" + +#: wp-admin/includes/upgrade.php:227 +msgid "Mr WordPress" +msgstr "Sr WordPress" + +#: wp-admin/includes/upgrade.php:229 +msgid "Hi, this is a comment.
    To delete a comment, just log in and view the post's comments. There you will have the option to edit or delete them." +msgstr "Hola, esto es un comentario.
    Para borrar un comentario sólo tienes que entrar y ver los comentarios de la entrada. Entonces tendrás la opción de editar o borrar." + +#: wp-includes/js/tinymce/langs/wp-langs.php:303 +#: wp-includes/js/tinymce/wp-mce-help.php:203 +msgid "About" +msgstr "Acerca de" + +#: wp-admin/users.php:61 wp-admin/includes/user.php:34 +#: wp-admin/includes/user.php:88 +msgid "You can’t give users that role." +msgstr "No puedes dar este perfil a los usuarios." + +#: wp-login.php:298 wp-admin/includes/user.php:135 +msgid "ERROR: Please enter a username." +msgstr "ERROR: Por favor, introduce un nombre de usuario." + +#: wp-admin/includes/user.php:142 wp-admin/includes/user.php:144 +msgid "ERROR: You entered your new password only once." +msgstr "ERROR: Has escrito tu nueva contraseña sólo una vez." + +#: wp-admin/includes/user.php:147 +msgid "ERROR: Please enter your password." +msgstr "ERROR: Por favor, escribe tu contraseña." + +#: wp-admin/includes/user.php:149 +msgid "ERROR: Please enter your password twice." +msgstr "ERROR: Por favor, escribe tu contraseña dos veces." + +#: wp-admin/includes/user.php:154 +msgid "ERROR: Passwords may not contain the character \"\\\"." +msgstr "ERROR: La contraseña no puede contener el carácter \"\\\"." + +#: wp-admin/includes/user.php:158 +msgid "ERROR: Please enter the same password in the two password fields." +msgstr "ERROR: Por favor, introduce la misma contraseña en los dos campos." + +#: wp-admin/includes/user.php:167 +msgid "ERROR: This username is already registered. Please choose another one." +msgstr "ERROR: Ese usuario ya existe. Por favor, elige otro." + +#: wp-admin/includes/user.php:171 +msgid "ERROR: Please enter an e-mail address." +msgstr "ERROR: Por favor, introduce un correo electrónico" + +#: wp-admin/includes/user.php:173 +msgid "ERROR: The e-mail address isn’t correct." +msgstr "ERROR: La dirección de correo electrónico no es correcta." + +#: wp-login.php:313 wp-admin/includes/user.php:175 +msgid "ERROR: This email is already registered, please choose another one." +msgstr "ERROR: Esa dirección de correo electrónico ya está registrada. Por favor, elige otra." + +#: wp-admin/includes/deprecated.php:524 +msgid "No matching users were found!" +msgstr "¡No se encontraron usuarios!" + +#: wp-includes/widgets.php:67 wp-admin/includes/widgets.php:194 +#: wp-admin/widgets.php:273 +msgid "There are no options for this widget." +msgstr "No hay opciones para este widget." + +#: wp-includes/admin-bar.php:108 wp-includes/admin-bar.php:110 +#: wp-includes/admin-bar.php:138 wp-admin/index.php:24 +#: wp-admin/user/menu.php:10 wp-admin/menu.php:25 +msgid "Dashboard" +msgstr "Escritorio" + +#: wp-admin/install.php:60 +msgid "WordPress › Installation" +msgstr "Instalación de WordPress" + +#: wp-admin/install.php:92 +msgid "ERROR: %s" +msgstr "ERROR: %s" + +#: wp-admin/install.php:105 +msgid "User(s) already exists." +msgstr "El (los) usuario(s) ya existe(n)." + +#: wp-includes/script-loader.php:259 wp-login.php:467 wp-admin/user-new.php:314 +#: wp-admin/install.php:122 wp-admin/install.php:253 wp-admin/user-edit.php:375 +msgid "Strength indicator" +msgstr "Seguridad de la contraseña" + +#: wp-login.php:468 wp-admin/user-new.php:315 wp-admin/install.php:123 +#: wp-admin/user-edit.php:376 +msgid "Hint: The password should be at least seven characters long. To make it stronger, use upper and lower case letters, numbers and symbols like ! \" ? $ % ^ & )." +msgstr "Tu contraseña debe tener al menos siete caracteres. Para que tu contraseña sea segura, usa mayúsculas, minúsculas, números y símbolos como ! \" ? $ % ^ & )." + +#: wp-admin/install.php:128 +msgid "Your E-mail" +msgstr "Tu correo electrónico" + +#: wp-admin/install.php:130 +msgid "Double-check your email address before continuing." +msgstr "Comprueba bien tu dirección de correo electrónico antes de continuar." + +#: wp-admin/install.php:136 +msgid "Install WordPress" +msgstr "Instalar WordPress" + +#: wp-admin/install.php:144 +msgid "Already Installed" +msgstr "Ya está instalado" + +#: wp-admin/install.php:144 +msgid "You appear to have already installed WordPress. To reinstall please clear your old database tables first." +msgstr "WordPress parece estar ya instalado. Si deseas reinstalar, por favor, borra las tablas de la base de datos." + +#: wp-admin/install.php:161 +msgid "Insufficient Requirements" +msgstr "Requisitos Insuficientes" + +#: wp-admin/install.php:169 +msgid "Welcome" +msgstr "Bienvenido" + +#: wp-admin/install.php:170 +msgid "Welcome to the famous five minute WordPress installation process! You may want to browse the ReadMe documentation at your leisure. Otherwise, just fill in the information below and you’ll be on your way to using the most extendable and powerful personal publishing platform in the world." +msgstr "¡Bienvenido al famoso proceso de instalación de WordPress de cinco minutos! Tal vez quieras leer tranquilamente la Documentación del archivo Léeme. En caso contrario, rellena los datos más abajo y en seguida estarás utilizando la plataforma de publicación personal más potente y extensible del mundo." + +#: wp-admin/install.php:172 +msgid "Information needed" +msgstr "Información necesaria" + +#: wp-admin/install.php:173 +msgid "Please provide the following information. Don’t worry, you can always change these settings later." +msgstr "Por favor, debes facilitarnos los siguientes datos. No te preocupes, siempre podrás cambiar estos ajustes más tarde." + +#: wp-admin/install.php:205 +msgid "you must provide an e-mail address." +msgstr "debes proporcionar un correo electrónico." + +#: wp-admin/install.php:209 +msgid "that isn’t a valid e-mail address. E-mail addresses look like: username@example.com" +msgstr "esa no es una dirección de correo electrónico válido. Una dirección bien formada tiene este aspecto: usuario@ejemplo.com" + +#: wp-admin/install.php:219 +msgid "Success!" +msgstr "¡Lo lograste!" + +#: wp-admin/install.php:221 +msgid "WordPress has been installed. Were you expecting more steps? Sorry to disappoint." +msgstr "Wordpress se ha instalado correctamente. ¿Esperabas más pasos? Sentimos decepcionarte. :)" + +#: wp-includes/general-template.php:261 wp-login.php:627 wp-login.php:646 +#: wp-admin/install.php:144 wp-admin/install.php:238 +msgid "Log In" +msgstr "Acceder" + +#: wp-includes/script-loader.php:260 wp-admin/install.php:254 +msgid "Very weak" +msgstr "Muy débil" + +#: wp-includes/script-loader.php:261 wp-admin/install.php:255 +msgid "Weak" +msgstr "Débil" + +#: wp-includes/script-loader.php:264 wp-admin/install.php:257 +msgid "Strong" +msgstr "Fuerte" + +#: wp-admin/link-add.php:15 +msgid "Add New Link" +msgstr "Añadir enlace" + +#: wp-includes/taxonomy.php:406 +msgid "Edit Category" +msgstr "Editar Categoría" + +#: wp-admin/link-manager.php:62 wp-admin/edit-link-form.php:56 +#: wp-admin/menu.php:96 +msgctxt "link" +msgid "Add New" +msgstr "Añadir nuevo" + +#: wp-admin/link-manager.php:71 +msgid "%s link deleted." +msgid_plural "%s links deleted" +msgstr[0] "%s enlace eliminado." +msgstr[1] "%s enlaces eliminados." + +#: wp-admin/link-manager.php:79 +msgid "Search Links" +msgstr "Buscar enlaces" + +#: wp-admin/custom-header.php:581 +#: wp-admin/includes/class-wp-links-list-table.php:110 +msgid "Yes" +msgstr "Sí" + +#: wp-admin/includes/class-wp-links-list-table.php:146 +msgid "Visit %s" +msgstr "Visitar %s" + +#: wp-admin/includes/class-wp-links-list-table.php:42 +msgid "No links found." +msgstr "No se encontraron enlaces." + +#: wp-admin/link-parse-opml.php:90 +msgid "XML error: %1$s at line %2$s" +msgstr "Error de XML: %1$s en la línea %2$s" + +#: wp-includes/link-template.php:1056 wp-admin/link.php:104 +msgid "Edit Link" +msgstr "Editar enlace" + +#: wp-admin/link.php:109 +msgid "Link not found." +msgstr "No se encontró el enlace." + +#: wp-admin/maint/repair.php:13 +msgid "WordPress › Database Repair" +msgstr "WordPress › Reparación de la base de datos" + +#: wp-admin/maint/repair.php:22 +msgid "To allow use of this page to automatically repair database problems, please add the following line to your wp-config.php file. Once this line is added to your config, reload this page." +msgstr "Para permitir el uso de esta página y así reparar automáticamente problemas en la base de datos, añade la línea siguiente a tu fichero wp-config.php. Una vez hayas añadido esta línea a tu configuración vuelve a cargar esta página." + +#: wp-admin/maint/repair.php:71 +msgid "Some database problems could not be repaired. Please copy-and-paste the following list of errors to the WordPress support forums to get additional assistance." +msgstr "Algunos problemas de la base de datos no se han podido reparar. Por favor, copia y pega la siguiente lista de errores en los foros de soporte de WordPress para conseguir ayuda." + +#: wp-admin/maint/repair.php:77 +msgid "Repairs complete. Please remove the following line from wp-config.php to prevent this page from being used by unauthorized users." +msgstr "Reparación completa. Quita la siguiente línea del archivo wp-config.php para evitar que esta página la utilicen usuarios sin autorización." + +#: wp-admin/maint/repair.php:85 +msgid "Repair Database" +msgstr "Reparar base de datos" + +#: wp-admin/maint/repair.php:86 +msgid "WordPress can also attempt to optimize the database. This improves performance in some situations. Repairing and optimizing the database can take a long time and the database will be locked while optimizing." +msgstr "WordPress puede también tratar de optimizar la base de datos. Esto mejora el rendimiento en algunas situaciones. Reparar y optimizar la base de datos puede llevar bastante tiempo y la base de datos se bloqueará durante la optimización." + +#: wp-admin/maint/repair.php:87 +msgid "Repair and Optimize Database" +msgstr "Reparar y optimizar la base de datos" + +#: wp-admin/media-upload.php:35 +msgid "You are not allowed to be here" +msgstr "No tienes autorización para estar aquí." + +#: wp-admin/media-upload.php:62 +msgid "Upload New Media" +msgstr "Subir nuevo medio" + +#: wp-admin/media.php:23 wp-admin/media.php:57 +msgid "You are not allowed to edit this attachment." +msgstr "No tienes autorización para editar este archivo adjunto." + +#: wp-admin/media.php:61 +msgid "You attempted to edit an attachment that doesn’t exist. Perhaps it was deleted?" +msgstr "Estás intentando editar un adjunto que no existe. ¿Lo has borrado?" + +#: wp-admin/media.php:62 +msgid "You can’t edit this attachment because it is in the Trash. Please move it out of the Trash and try again." +msgstr "No puedes editar este adjunto ya que está en la Papelera. Sácalo de la Papelera e inténtalo de nuevo." + +#: wp-admin/media.php:88 wp-admin/upload.php:165 wp-admin/upload.php:191 +msgid "Media attachment updated." +msgstr "El archivo ha sido actualizado." + +#: wp-admin/media.php:110 wp-admin/media.php:119 +msgid "Update Media" +msgstr "Actualizar medio" + +#: wp-admin/includes/template.php:1421 wp-admin/includes/template.php:1472 +msgid "Sites" +msgstr "Sitios" + +#: wp-includes/admin-bar.php:305 wp-admin/update-core.php:266 +#: wp-admin/update-core.php:274 wp-admin/menu.php:159 wp-admin/menu.php:164 +msgid "Themes" +msgstr "Temas" + +#: wp-includes/admin-bar.php:126 wp-admin/menu.php:30 +msgid "My Sites" +msgstr "Mis sitios" + +#: wp-admin/menu.php:89 +msgid "Library" +msgstr "Librería multimedia" + +#: wp-admin/media.php:104 wp-admin/upload.php:157 wp-admin/menu.php:91 +msgctxt "file" +msgid "Add New" +msgstr "Añadir nuevo" + +#: wp-includes/post.php:1179 wp-admin/menu.php:102 +msgctxt "page" +msgid "Add New" +msgstr "Añadir nueva" + +#: wp-includes/admin-bar.php:286 wp-admin/menu.php:114 +msgid "Comments %s" +msgstr "Comentarios %s" + +#: wp-includes/admin-bar.php:299 wp-admin/menu.php:158 wp-admin/menu.php:163 +msgid "Appearance" +msgstr "Apariencia" + +#: wp-admin/menu.php:174 +msgctxt "theme editor" +msgid "Editor" +msgstr "Editor" + +#: wp-admin/menu.php:183 +msgid "Plugins %s" +msgstr "Plugins %s" + +#: wp-admin/includes/class-wp-plugin-install-list-table.php:208 +msgid "Installed" +msgstr "Instalados" + +#: wp-admin/plugins.php:384 wp-admin/menu.php:189 +msgctxt "plugin" +msgid "Add New" +msgstr "Añadir nuevo" + +#: wp-admin/menu.php:190 +msgctxt "plugin editor" +msgid "Editor" +msgstr "Editor" + +#: wp-admin/user/menu.php:14 wp-admin/user-edit.php:28 wp-admin/menu.php:198 +msgid "Profile" +msgstr "Perfil" + +#: wp-admin/users.php:363 wp-admin/user-edit.php:176 wp-admin/menu.php:204 +#: wp-admin/menu.php:206 +msgctxt "user" +msgid "Add New" +msgstr "Añadir nuevo" + +#: wp-admin/admin-header.php:156 wp-admin/menu.php:208 wp-admin/menu.php:211 +msgid "Your Profile" +msgstr "Tu perfil" + +#: wp-admin/tools.php:12 wp-admin/menu.php:218 +msgid "Tools" +msgstr "Herramientas" + +#: wp-admin/menu.php:227 wp-admin/options.php:21 +#: wp-content/plugins/akismet/admin.php:45 +msgid "Settings" +msgstr "Ajustes" + +#: wp-admin/menu.php:228 +msgctxt "settings screen" +msgid "General" +msgstr "Generales" + +#: wp-admin/menu.php:229 +msgid "Writing" +msgstr "Escritura" + +#: wp-admin/menu.php:230 +msgid "Reading" +msgstr "Lectura" + +#: wp-admin/menu.php:233 +msgid "Privacy" +msgstr "Privacidad" + +#: wp-admin/menu.php:234 +msgid "Permalinks" +msgstr "Enlaces permanentes" + +#: wp-admin/users.php:376 wp-admin/includes/dashboard.php:464 +msgid "Search Users" +msgstr "Buscar usuarios" + +#: wp-content/plugins/akismet/admin.php:134 +msgid "Options saved." +msgstr "Opciones guardadas." + +#: wp-includes/link-template.php:1315 +msgid "First Post" +msgstr "Primera entrada" + +#: wp-includes/js/tinymce/langs/wp-langs.php:398 +msgid "Enabled" +msgstr "Activado" + +#: wp-includes/js/tinymce/langs/wp-langs.php:291 +msgid "Path" +msgstr "Ruta" + +#: wp-admin/includes/class-wp-users-list-table.php:127 +#: wp-admin/includes/class-wp-users-list-table.php:254 +#: wp-admin/includes/nav-menu.php:189 +msgid "Remove" +msgstr "Eliminar" + +#: wp-admin/user-edit.php:242 +msgid "Role:" +msgstr "Perfil:" + +#: wp-admin/includes/class-wp-plugins-list-table.php:262 +#: wp-admin/includes/class-wp-plugins-list-table.php:377 +msgid "Deactivate" +msgstr "Desactivar" + +#: wp-includes/class-wp-xmlrpc-server.php:316 wp-admin/options-general.php:85 +#: wp-admin/install.php:97 +msgid "Site Title" +msgstr "Título del sitio" + +#: wp-includes/comment-template.php:1525 +msgid "Email" +msgstr "Correo electrónico" + +#: wp-admin/update-core.php:279 wp-admin/update-core.php:308 +#: wp-admin/update-core.php:493 wp-admin/update-core.php:498 +msgid "Update Themes" +msgstr "Actualizar temas" + +#: wp-admin/options-discussion.php:15 +msgid "Discussion Settings" +msgstr "Ajustes de comentarios" + +#: wp-admin/options-discussion.php:38 wp-admin/options-discussion.php:39 +msgid "Default article settings" +msgstr "Ajustes por defecto de las entradas" + +#: wp-admin/options-discussion.php:46 +msgid "Allow link notifications from other blogs (pingbacks and trackbacks.)" +msgstr "Permitir notificaciones de enlace desde otros sitios (pingbacks y trackbacks)" + +#: wp-admin/options-discussion.php:50 +msgid "Allow people to post comments on new articles" +msgstr "Permitir comentarios en las nuevas entradas" + +#: wp-admin/options-discussion.php:52 +msgid "These settings may be overridden for individual articles." +msgstr "Estos ajustes pueden modificarse para cada entrada en particular." + +#: wp-admin/options-discussion.php:56 wp-admin/options-discussion.php:57 +msgid "Other comment settings" +msgstr "Otros ajustes de comentarios" + +#: wp-admin/options-discussion.php:58 +msgid "Comment author must fill out name and e-mail" +msgstr "El autor del comentario debe rellenar el nombre y el correo electrónico" + +#: wp-admin/options-discussion.php:62 +msgid "Users must be registered and logged in to comment" +msgstr "Los usuarios deben registrarse e identificarse para comentar" + +#: wp-admin/options-discussion.php:69 +msgid "Automatically close comments on articles older than %s days" +msgstr "Cerrar automáticamente los comentarios en las entradas con más de %s días" + +#: wp-admin/options-discussion.php:85 +msgid "Enable threaded (nested) comments %s levels deep" +msgstr "Activar los comentarios anidados hasta %s niveles" + +#: wp-admin/options-discussion.php:94 +msgid "last" +msgstr "última" + +#: wp-admin/options-discussion.php:96 +msgid "first" +msgstr "primera" + +#: wp-admin/options-discussion.php:98 +msgid "Break comments into pages with %1$s top level comments per page and the %2$s page displayed by default" +msgstr "Separa los comentarios en páginas de %1$s comentarios por página y se muestra la %2$s página por defecto" + +#: wp-admin/options-discussion.php:106 +msgid "older" +msgstr "más antiguos" + +#: wp-admin/options-discussion.php:108 +msgid "newer" +msgstr "más recientes" + +#: wp-admin/options-discussion.php:110 +msgid "Comments should be displayed with the %s comments at the top of each page" +msgstr "Los comentarios se ordenarán con los %s al principio" + +#: wp-admin/options-discussion.php:116 wp-admin/options-discussion.php:117 +msgid "E-mail me whenever" +msgstr "Enviarme un correo electrónico cuando" + +#: wp-admin/options-discussion.php:120 +msgid "Anyone posts a comment" +msgstr "Alguien envía un comentario" + +#: wp-admin/options-discussion.php:124 +msgid "A comment is held for moderation" +msgstr "Se ha recibido un comentario para moderar" + +#: wp-admin/options-discussion.php:128 wp-admin/options-discussion.php:129 +msgid "Before a comment appears" +msgstr "Para que un comentario aparezca" + +#: wp-admin/options-discussion.php:132 +msgid "An administrator must always approve the comment" +msgstr "Un administrador debe aprobar el comentario" + +#: wp-admin/options-discussion.php:134 +msgid "Comment author must have a previously approved comment" +msgstr "El autor del comentario debe tener un comentario previamente aprobado" + +#: wp-admin/options-discussion.php:138 wp-admin/options-discussion.php:139 +msgid "Comment Moderation" +msgstr "Moderación de comentarios" + +#: wp-admin/options-discussion.php:140 +msgid "Hold a comment in the queue if it contains %s or more links. (A common characteristic of comment spam is a large number of hyperlinks.)" +msgstr "Mantener un comentario en espera si contiene más de %s enlaces (una característica común del spam en comentarios es el gran número de enlaces)." + +#: wp-admin/options-discussion.php:142 +msgid "When a comment contains any of these words in its content, name, URL, e-mail, or IP, it will be held in the moderation queue. One word or IP per line. It will match inside words, so “press” will match “WordPress”." +msgstr "Mantener en la cola de moderación todo comentario que incluya cualquiera de las siguientes palabras en su contenido, nombre, URL, e-mail o IP. Una palabra o IP por línea. Atención a las coincidencias en el interior de palabras: “press” coincidirá con “WordPress”." + +#: wp-admin/options-discussion.php:149 wp-admin/options-discussion.php:150 +msgid "Comment Blacklist" +msgstr "Lista negra de comentarios" + +#: wp-admin/options-discussion.php:151 +msgid "When a comment contains any of these words in its content, name, URL, e-mail, or IP, it will be marked as spam. One word or IP per line. It will match inside words, so “press” will match “WordPress”." +msgstr "Cuando un comentario contenga cualquiera de estas palabras en su contenido, nombre, URL, correo electrónico, o IP, será marcado como spam. Una palabra o IP por línea. Tendrá en cuenta las coincidencias parciales, así que “press” coincidirá con “WordPress”." + +#: wp-admin/options-discussion.php:160 +msgid "Avatars" +msgstr "Avatares" + +#: wp-admin/options-discussion.php:168 wp-admin/options-discussion.php:169 +msgid "Avatar Display" +msgstr "Visibilidad" + +#: wp-admin/options-discussion.php:171 +msgid "Don’t show Avatars" +msgstr "No mostrar avatares" + +#: wp-admin/options-discussion.php:171 +msgid "Show Avatars" +msgstr "Mostrar avatares" + +#: wp-admin/options-discussion.php:180 wp-admin/options-discussion.php:181 +msgid "Maximum Rating" +msgstr "Calificación máxima" + +#: wp-admin/options-discussion.php:186 +msgid "G — Suitable for all audiences" +msgstr "G — Para todos los públicos" + +#: wp-admin/options-discussion.php:188 +msgid "PG — Possibly offensive, usually for audiences 13 and above" +msgstr "PG — Posiblemente ofensivo, normalmente para mayores de 13 años" + +#: wp-admin/options-discussion.php:190 +msgid "R — Intended for adult audiences above 17" +msgstr "R — Destinado a un público adulto mayor de 17" + +#: wp-admin/options-discussion.php:192 +msgid "X — Even more mature than above" +msgstr "X — Contenido más adulto que los anteriores." + +#: wp-admin/options-discussion.php:203 wp-admin/options-discussion.php:204 +msgid "Default Avatar" +msgstr "Avatar por defecto" + +#: wp-admin/options-discussion.php:206 +msgid "For users without a custom avatar of their own, you can either display a generic logo or a generated one based on their e-mail address." +msgstr "Para usuarios que no tengan un avatar personalizado podemos mostrar uno genérico o uno basado en su dirección de correo electrónico." + +#: wp-admin/options-discussion.php:210 +msgid "Mystery Man" +msgstr "Hombre misterioso" + +#: wp-admin/options-discussion.php:211 +msgid "Blank" +msgstr "Sin avatar" + +#: wp-admin/options-discussion.php:212 +msgid "Gravatar Logo" +msgstr "Logo de Gravatar" + +#: wp-admin/options-discussion.php:213 +msgid "Identicon (Generated)" +msgstr "Identicon (autogenerado)" + +#: wp-admin/options-discussion.php:214 +msgid "Wavatar (Generated)" +msgstr "Wavatar (autogenerado)" + +#: wp-admin/options-discussion.php:215 +msgid "MonsterID (Generated)" +msgstr "MonsterID (autogenerado)" + +#: wp-admin/options-general.php:15 +msgid "General Settings" +msgstr "Ajustes generales" + +#: wp-admin/options-general.php:18 +msgctxt "timezone date format" +msgid "Y-m-d G:i:s" +msgstr "d-m-Y G:i" + +#: wp-admin/options-general.php:89 +msgid "Tagline" +msgstr "Descripción corta" + +#: wp-admin/options-general.php:95 +msgid "WordPress address (URL)" +msgstr "Dirección de WordPress (URL)" + +#: wp-admin/options-general.php:104 wp-admin/options-general.php:123 +msgid "E-mail address" +msgstr "Dirección de correo electrónico" + +#: wp-admin/options-general.php:106 +msgid "This address is used for admin purposes, like new user notification." +msgstr "Esta dirección se usa sólo con fines administrativos, como para la notificación de nuevos usuarios." + +#: wp-admin/options-general.php:109 wp-admin/options-general.php:110 +msgid "Membership" +msgstr "Miembros" + +#: wp-admin/options-general.php:112 +msgid "Anyone can register" +msgstr "Cualquiera puede registrarse" + +#: wp-admin/options-general.php:116 +msgid "New User Default Role" +msgstr "Perfil predeterminado para nuevos usuarios" + +#: wp-admin/options-general.php:158 +msgid "Timezone" +msgstr "Zona horaria" + +#: wp-admin/options-general.php:165 +msgid "UTC time is %s" +msgstr "La hora UTC es %s" + +#: wp-admin/options-general.php:167 +msgid "Local time is %1$s" +msgstr "La hora local es %1$s" + +#: wp-admin/options-general.php:170 +msgid "Choose a city in the same timezone as you." +msgstr "Elige una ciudad que esté en la misma zona horaria que la tuya." + +#: wp-admin/options-general.php:181 +msgid "This timezone is currently in standard time." +msgstr "Esta zona horaria se encuentra actualmente en horario de invierno." + +#: wp-admin/options-general.php:203 +msgid "Standard time begins on: %s." +msgstr "El horario de invierno comienza el: %s." + +#: wp-includes/class-wp-xmlrpc-server.php:326 wp-admin/options-general.php:219 +#: wp-admin/options-general.php:221 +msgid "Date Format" +msgstr "Formato de fecha" + +#: wp-admin/options-general.php:244 wp-admin/options-general.php:276 +msgid "Custom:" +msgstr "Personalizado:" + +#: wp-includes/class-wp-xmlrpc-server.php:331 wp-admin/options-general.php:252 +#: wp-admin/options-general.php:254 +msgid "Time Format" +msgstr "Formato de hora" + +#: wp-admin/options-general.php:283 +msgid "Week Starts On" +msgstr "La semana comienza el" + +#: wp-admin/options-head.php:16 wp-admin/options.php:158 +msgid "Settings saved." +msgstr "Ajustes guardados." + +#: wp-admin/options-media.php:15 +msgid "Media Settings" +msgstr "Ajustes de medios" + +#: wp-admin/options-media.php:39 +msgid "Image sizes" +msgstr "Tamaño de las imágenes" + +#: wp-admin/options-media.php:40 +msgid "The sizes listed below determine the maximum dimensions in pixels to use when inserting an image into the body of a post." +msgstr "Los tamaños que se listan a continuación indican las dimensiones máximas a utilizar para insertar una imagen en el contenido de una entrada." + +#: wp-admin/options-media.php:44 +msgid "Thumbnail size" +msgstr "Tamaño de la miniatura" + +#: wp-includes/js/tinymce/langs/wp-langs.php:495 +#: wp-includes/js/tinymce/langs/wp-langs.php:500 wp-admin/options-media.php:48 +#: wp-admin/options-media.php:94 +msgid "Height" +msgstr "Altura" + +#: wp-admin/options-media.php:51 +msgid "Crop thumbnail to exact dimensions (normally thumbnails are proportional)" +msgstr "Recortar las miniaturas en las dimensiones exactas (normalmente, las miniaturas son proporcionales)" + +#: wp-admin/options-media.php:56 wp-admin/options-media.php:57 +msgid "Medium size" +msgstr "Tamaño medio" + +#: wp-admin/options-media.php:58 wp-admin/options-media.php:68 +msgid "Max Width" +msgstr "Anchura máxima" + +#: wp-admin/options-media.php:60 wp-admin/options-media.php:70 +msgid "Max Height" +msgstr "Altura máxima" + +#: wp-admin/options-media.php:66 wp-admin/options-media.php:67 +msgid "Large size" +msgstr "Tamaño grande" + +#: wp-admin/options-media.php:78 +msgid "Embeds" +msgstr "Incrustados" + +#: wp-admin/options-media.php:83 +msgid "Auto-embeds" +msgstr "Auto-incrustados" + +#: wp-admin/options-media.php:90 +msgid "Maximum embed size" +msgstr "Tamaño máximo de incrustación" + +#: wp-admin/options-media.php:96 +msgid "If the width value is left blank, embeds will default to the max width of your theme." +msgstr "Si el valor del ancho se deja vacío, lo que incrustes se verá al valor máximo de ancho de tu tema." + +#: wp-admin/options-media.php:104 +msgid "Uploading Files" +msgstr "Subida de archivos" + +#: wp-admin/options-media.php:107 +msgid "Store uploads in this folder" +msgstr "Guardar los archivos subidos en esta carpeta" + +#: wp-admin/options-media.php:109 +msgid "Default is wp-content/uploads" +msgstr "El predeterminado es wp-content/uploads" + +#: wp-admin/options-media.php:114 +msgid "Full URL path to files" +msgstr "Ruta URL completa a los archivos" + +#: wp-admin/options-media.php:116 +msgid "Configuring this is optional. By default, it should be blank." +msgstr "Esta configuración es opcional. Por defecto debería estar en blanco." + +#: wp-admin/options-media.php:124 +msgid "Organize my uploads into month- and year-based folders" +msgstr "Organizar mis archivos subidos en carpetas basadas en mes y año" + +#: wp-admin/options-permalink.php:15 +msgid "Permalink Settings" +msgstr "Ajustes de los enlaces permanentes" + +#: wp-admin/options-permalink.php:133 +msgid "You should update your web.config now" +msgstr "Ahora debes actualizar tu web.config" + +#: wp-admin/options-permalink.php:135 +msgid "Permalink structure updated. Remove write access on web.config file now!" +msgstr "La estructura de enlaces permanentes se ha actualizado. Elimina el acceso de escritura en el archivo web.config ahora mismo." + +#: wp-admin/options-permalink.php:137 +msgid "Permalink structure updated" +msgstr "Estructura de enlaces permanentes actualizada" + +#: wp-admin/options-permalink.php:140 +msgid "You should update your .htaccess now." +msgstr "Ahora debes actualizar tu .htaccess" + +#: wp-admin/options-permalink.php:142 wp-admin/options-permalink.php:145 +msgid "Permalink structure updated." +msgstr "Estructura de enlaces permanentes actualizada." + +#: wp-admin/options-permalink.php:158 +msgid "By default WordPress uses web URLs which have question marks and lots of numbers in them, however WordPress offers you the ability to create a custom URL structure for your permalinks and archives. This can improve the aesthetics, usability, and forward-compatibility of your links. A number of tags are available, and here are some examples to get you started." +msgstr "Por defecto, WordPress usa URLs que tengan signos de interrogación y un montón de números. Sin embargo, WordPress ofrece la posibilidad de crear una estructura de URL para tus enlaces permanentes y archivos. Esto puede mejorar la estética, usabilidad y compatibilidad de tus enlaces. Hay disponibles ciertas etiquetas, y aquí hay algunos ejemplos para comenzar." + +#: wp-admin/options-permalink.php:174 +msgid "Common settings" +msgstr "Ajustes habituales" + +#: wp-includes/js/tinymce/langs/wp-langs.php:217 +#: wp-admin/options-permalink.php:177 +msgid "Default" +msgstr "Predeterminado" + +#: wp-admin/options-permalink.php:181 +msgid "Day and name" +msgstr "Día y nombre" + +#: wp-admin/options-permalink.php:185 +msgid "Month and name" +msgstr "Mes y nombre" + +#: wp-admin/options-permalink.php:189 +msgid "Numeric" +msgstr "Numérico" + +#: wp-admin/options-permalink.php:195 +msgid "Custom Structure" +msgstr "Estructura personalizada" + +#: wp-admin/options-permalink.php:205 +msgid "Optional" +msgstr "Opcional" + +#: wp-admin/options-permalink.php:207 +msgid "If you like, you may enter custom structures for your category and tag URLs here. For example, using topics as your category base would make your category links like http://example.org/topics/uncategorized/. If you leave these blank the defaults will be used." +msgstr "Si quieres, puedes introducir estructuras personalizadas para las URLs de las categorías y etiquetas. Por ejemplo, usar secciones como categoría base mostraría tus enlaces de categoría como http://ejemplo.org/index.php/secciones/general/. Si dejas esto en blanco se usará la opción predeterminada." + +#: wp-admin/options-permalink.php:209 +msgid "If you like, you may enter custom structures for your category and tag URLs here. For example, using topics as your category base would make your category links like http://example.org/index.php/topics/uncategorized/. If you leave these blank the defaults will be used." +msgstr "Si quieres, puedes introducir estructuras personalizadas para las URLs de las categorías y etiquetas. Por ejemplo, usar secciones como categoría base haría tus enlaces de categoría como http://ejemplo.org/index.php/secciones/general/. Si dejas esto en blanco se usará la opción predeterminada." + +#: wp-admin/options-permalink.php:214 +msgid "Category base" +msgstr "Categoría base" + +#: wp-admin/options-permalink.php:218 +msgid "Tag base" +msgstr "Etiqueta base" + +#: wp-admin/options-permalink.php:232 +msgid "If your web.config file were writable, we could do this automatically, but it isn’t so this is the url rewrite rule you should have in your web.config file. Click in the field and press CTRL + a to select all. Then insert this rule inside of the /<configuration>/<system.webServer>/<rewrite>/<rules> element in web.config file." +msgstr "Si tu archivo web.config tuviera permisos de escritura los cambios se harían automáticamente. Al no ser así, a continuación tienes las reglas de mod_rewrite que debes agregar manualmente a tu archivo web.config que se encuentra en el directorio raíz de WordPress. Haz clic en el área de texto y pulsa CTRL + a para seleccionar todo el texto. Después copia y pega las reglas de la configuración /<configuration>/<system.webServer>/<rewrite>/<rules> en tu archivo web.config." + +#: wp-admin/options-permalink.php:237 +msgid "If you temporarily make your web.config file writable for us to generate rewrite rules automatically, do not forget to revert the permissions after rule has been saved." +msgstr "Si temporalmente tienes que hacer el web.config editable para que podamos generar automaticamente las reglas de reescritura, no te olvides de volverlo a poner como estaba." + +#: wp-admin/options-permalink.php:239 +msgid "If the root directory of your site were writable, we could do this automatically, but it isn’t so this is the url rewrite rule you should have in your web.config file. Create a new file, called web.config in the root directory of your site. Click in the field and press CTRL + a to select all. Then insert this code into the web.config file." +msgstr "Si la carpeta raíz de tu sitio tuviera permisos de escritura, podríamos hacer este cambio automáticamente. Al no tener permisos de escritura, deberás editar tu web.config y añadirla a mano. Crea un nuevo archivo en la carpeta raíz de tu sitio y llámalo web.config. Haz clic en el siguiente campo y teclea CTRL + a para seleccionarlo todo. Luego pega este código en el fichero web.config." + +#: wp-admin/options-permalink.php:244 +msgid "If you temporarily make your site’s root directory writable for us to generate the web.config file automatically, do not forget to revert the permissions after the file has been created." +msgstr "Si das permisos temporales de escritura a la carpeta raíz de tu sitio para que se genere el archivo web.config automáticamente, no olvides revertir los permisos después de que se cree el archivo." + +#: wp-admin/options-permalink.php:249 +msgid "If your .htaccess file were writable, we could do this automatically, but it isn’t so these are the mod_rewrite rules you should have in your .htaccess file. Click in the field and press CTRL + a to select all." +msgstr "Si tu archivo .htaccess tuviera permisos de escritura los cambios se harían automáticamente, pero si no fuera así, aquí tienes las reglas de mod_rewrite que debes agregar manualmente a tu archivo .htaccess. Haz clic en el área de texto y pulsa CTRL + a o COMANDO + a para seleccionarlo todo." + +#: wp-admin/options-privacy.php:15 +msgid "Privacy Settings" +msgstr "Ajustes de privacidad" + +#: wp-admin/options-privacy.php:44 +msgid "I would like to block search engines, but allow normal visitors" +msgstr "Quiero bloquear los motores de búsqueda, pero permitir visitantes normales." + +#: wp-admin/options-reading.php:15 +msgid "Reading Settings" +msgstr "Ajustes de lectura" + +#: wp-admin/options-reading.php:78 wp-admin/options-reading.php:79 +msgid "Front page displays" +msgstr "La página inicial mostrará" + +#: wp-admin/options-reading.php:82 +msgid "Your latest posts" +msgstr "Tus últimas entradas" + +#: wp-admin/options-reading.php:87 +msgid "A static page (select below)" +msgstr "Una página estática (seleccionar abajo)" + +#: wp-admin/options-reading.php:91 +msgid "Front page: %s" +msgstr "Página inicial: %s" + +#: wp-admin/options-reading.php:92 +msgid "Posts page: %s" +msgstr "Página de entradas: %s" + +#: wp-admin/options-reading.php:95 +msgid "Warning: these pages should not be the same!" +msgstr "Atención: estas páginas no pueden ser las mismas." + +#: wp-admin/options-reading.php:101 +msgid "Blog pages show at most" +msgstr "Número máximo de entradas a mostrar en el sitio" + +#: wp-admin/options-reading.php:103 +msgid "posts" +msgstr "entradas" + +#: wp-admin/options-reading.php:107 +msgid "Syndication feeds show the most recent" +msgstr "Número máximo de entradas a mostrar en el feed" + +#: wp-admin/options-reading.php:111 wp-admin/options-reading.php:112 +msgid "For each article in a feed, show" +msgstr "Mostrar, para cada entrada en el feed," + +#: wp-admin/options-reading.php:113 +msgid "Full text" +msgstr "Texto completo" + +#: wp-admin/options-reading.php:114 +msgid "Summary" +msgstr "Resumen" + +#: wp-admin/options-reading.php:119 +msgid "Encoding for pages and feeds" +msgstr "Codificación para páginas y feeds" + +#: wp-admin/options-writing.php:15 +msgid "Writing Settings" +msgstr "Ajustes de escritura" + +#: wp-admin/options-writing.php:38 +msgid "Size of the post box" +msgstr "Tamaño de la caja de texto" + +#: wp-admin/options-writing.php:40 +msgid "lines" +msgstr "líneas" + +#: wp-admin/options-writing.php:43 wp-admin/options-writing.php:44 +msgid "Formatting" +msgstr "Formato" + +#: wp-admin/options-writing.php:47 +msgid "Convert emoticons like :-) and :-P to graphics on display" +msgstr "Convertir emoticonos como :-) y :-P a gráficos en pantalla" + +#: wp-admin/options-writing.php:48 +msgid "WordPress should correct invalidly nested XHTML automatically" +msgstr "WordPress corregirá de forma automática el XHTML incorrectamente anidado" + +#: wp-admin/options-writing.php:52 +msgid "Default Post Category" +msgstr "Categoría predeterminada para las entradas" + +#: wp-admin/options-writing.php:77 +msgid "Default Link Category" +msgstr "Categoría predeterminada para enlaces" + +#: wp-admin/options-writing.php:132 +msgid "Remote Publishing" +msgstr "Publicación remota" + +#: wp-admin/options-writing.php:133 +msgid "To post to WordPress from a desktop blogging client or remote website that uses the Atom Publishing Protocol or one of the XML-RPC publishing interfaces you must enable them below." +msgstr "Para enviar una entrada a WordPress desde un cliente de escritorio o sitio web que utilice el protocolo de publicación Atom o uno de los interfaces de publicación XML-RPC, debes autorizarlos antes." + +#: wp-admin/options-writing.php:136 wp-admin/options-writing.php:137 +msgid "Atom Publishing Protocol" +msgstr "Protocolo de publicación Atom" + +#: wp-admin/options-writing.php:140 +msgid "Enable the Atom Publishing Protocol." +msgstr "Activar el protocolo de publicación Atom." + +#: wp-admin/options-writing.php:144 wp-admin/options-writing.php:145 +#: wp-admin/credits.php:170 +msgid "XML-RPC" +msgstr "XML-RPC" + +#: wp-admin/options-writing.php:148 +msgid "Enable the WordPress, Movable Type, MetaWeblog and Blogger XML-RPC publishing protocols." +msgstr "Activar los protocolos de publicación XML-RPC para WordPress, Movable Type, MetaWeblog y Blogger." + +#: wp-admin/options-writing.php:99 +msgid "Post via e-mail" +msgstr "Publicar por correo electrónico" + +#: wp-admin/options-writing.php:100 +msgid "To post to WordPress by e-mail you must set up a secret e-mail account with POP3 access. Any mail received at this address will be posted, so it’s a good idea to keep this address very secret. Here are three random strings you could use: %s, %s, %s." +msgstr "Para publicar en WordPress por correo electrónico debes crear una cuenta de correo electrónico secreta con acceso POP3. Todo correo recibido en esta dirección será publicado, por ello es buena idea que mantengas esa dirección totalmente secreta. Aquí tienes tres cadenas aleatorias que puedes usar como nombre de cuenta: %s, %s, %s." + +#: wp-admin/options-writing.php:104 +msgid "Mail Server" +msgstr "Servidor de correo" + +#: wp-admin/options-writing.php:106 +msgid "Port" +msgstr "Puerto" + +#: wp-admin/options-writing.php:111 +msgid "Login Name" +msgstr "Nombre de acceso" + +#: wp-admin/options-writing.php:121 +msgid "Default Mail Category" +msgstr "Categoría predeterminada para publicar por correo electrónico" + +#: wp-admin/options-writing.php:155 +msgid "Update Services" +msgstr "Servicios de actualización" + +#: wp-admin/options-writing.php:159 +msgid "When you publish a new post, WordPress automatically notifies the following site update services. For more about this, see Update Services on the Codex. Separate multiple service URLs with line breaks." +msgstr "Cuando publicas una entrada nueva, WordPress lo notifica automáticamente a los siguientes servicios de actualización. Para más información, visita Update Services en el Codex. Separa las URL de distintos servicios con saltos de línea." + +#: wp-admin/options.php:113 +msgid "Error: options page not found." +msgstr "Error: no se encuentra la página de opciones." + +#: wp-admin/options.php:173 +msgid "All Settings" +msgstr "Todos los ajustes" + +#: wp-admin/plugin-editor.php:20 +msgid "Edit Plugins" +msgstr "Editar plugins" + +#: wp-admin/plugin-editor.php:104 +msgid "No such file exists! Double check the name and try again." +msgstr "¡El archivo no existe! Comprueba el nombre e inténtalo de nuevo." + +#: wp-admin/plugin-editor.php:111 +msgid "Files of this type are not editable." +msgstr "Los archivos de este tipo no son editables." + +#: wp-admin/theme-editor.php:122 +msgid "Function Name..." +msgstr "Nombre de la función..." + +#: wp-admin/plugin-editor.php:149 wp-admin/theme-editor.php:134 +msgid "File edited successfully." +msgstr "El archivo ha sido editado correctamente." + +#: wp-admin/plugin-editor.php:151 +msgid "This plugin has been deactivated because your changes resulted in a fatal error." +msgstr "El plugin ha sido desactivado porque tus cambios han provocado un error fatal." + +#: wp-admin/plugin-editor.php:167 +msgid "Editing %s (active)" +msgstr "Editando %s (activo)" + +#: wp-admin/plugin-editor.php:169 +msgid "Browsing %s (active)" +msgstr "Examinando %s (activo)" + +#: wp-admin/plugin-editor.php:172 +msgid "Editing %s (inactive)" +msgstr "Editando %s (inactivo)" + +#: wp-admin/plugin-editor.php:174 +msgid "Browsing %s (inactive)" +msgstr "Examinando %s (inactivo)" + +#: wp-admin/plugin-editor.php:180 +msgid "Select plugin to edit:" +msgstr "Elige el plugin a editar:" + +#: wp-admin/plugin-editor.php:202 +msgid "Plugin Files" +msgstr "Archivos del plugin" + +#: wp-admin/plugin-editor.php:231 wp-admin/theme-editor.php:233 +msgid "Documentation:" +msgstr "Documentación:" + +#: wp-admin/plugin-editor.php:231 wp-admin/theme-editor.php:235 +msgid "Lookup" +msgstr "Buscar" + +#: wp-admin/plugin-editor.php:235 +msgid "Warning: Making changes to active plugins is not recommended. If your changes cause a fatal error, the plugin will be automatically deactivated." +msgstr "Atención: No es recomendable realizar cambios en plugins activos. Si tus cambios provocan un error fatal, el plugin se desactivará automáticamente." + +#: wp-admin/plugin-editor.php:241 +msgid "Update File and Attempt to Reactivate" +msgstr "Actualizar archivo e intentar reactivarlo" + +#: wp-admin/plugin-editor.php:243 wp-admin/theme-editor.php:246 +msgid "Update File" +msgstr "Actualizar archivo" + +#: wp-admin/plugin-editor.php:248 wp-admin/theme-editor.php:248 +msgid "You need to make this file writable before you can save your changes. See the Codex for more information." +msgstr "Para guardar los cambios, es necesario que el archivo tenga permisos de escritura. Visita el codex para obtener más información." + +#: wp-admin/includes/class-wp-plugin-install-list-table.php:33 +msgctxt "Plugin Installer" +msgid "Featured" +msgstr "Destacados" + +#: wp-admin/includes/class-wp-plugin-install-list-table.php:34 +msgctxt "Plugin Installer" +msgid "Popular" +msgstr "Populares" + +#: wp-admin/includes/class-wp-plugin-install-list-table.php:35 +msgctxt "Plugin Installer" +msgid "Newest" +msgstr "Recientes" + +#: wp-admin/includes/class-wp-plugin-install-list-table.php:36 +msgctxt "Plugin Installer" +msgid "Recently Updated" +msgstr "Actualizados recientemente" + +#: wp-admin/plugins.php:263 +msgid "%1$s by %2$s" +msgstr "%1$s por %2$s" + +#: wp-admin/plugins.php:272 +msgid "Are you sure you wish to delete these files?" +msgstr "¿Estás seguro de que deseas eliminar estos archivos?" + +#: wp-admin/plugins.php:282 +msgid "Yes, Delete these files" +msgstr "Sí, quiero borrar estos archivos" + +#: wp-admin/plugins.php:285 +msgid "No, Return me to the plugin list" +msgstr "No, quiero volver a la lista de plugins" + +#: wp-admin/plugins.php:288 +msgid "Click to view entire list of files which will be deleted" +msgstr "Pulsa aquí para ver la lista completa de archivos que serán eliminados" + +#: wp-admin/plugins.php:322 +msgid "Plugins extend and expand the functionality of WordPress. Once a plugin is installed, you may activate it or deactivate it here." +msgstr "Los plugins amplían las funcionalidades de WordPress. Una vez instalados, puedes activarlos o desactivarlos desde aquí." + +#: wp-admin/plugins.php:325 +msgid "If something goes wrong with a plugin and you can’t use WordPress, delete or rename that file in the %s directory and it will be automatically deactivated." +msgstr "Si algo va mal con un plugin y no puedes utilizar tu WordPress, borra o renombra ese archivo en el directorio %s y se desactivará automáticamente." + +#: wp-admin/plugins.php:339 +msgid "The plugin %s has been deactivated due to an error: %s" +msgstr "El plugin %s se ha desactivado debido a un error: %s" + +#: wp-admin/plugins.php:349 +msgid "Plugin could not be activated because it triggered a fatal error." +msgstr "El plugin no ha podido activarse porque ha provocado un error fatal." + +#: wp-admin/plugins.php:364 +msgid "Plugin could not be deleted due to an error: %s" +msgstr "El plugin no se ha podido eliminar debido a un error: %s" + +#: wp-admin/plugins.php:366 +msgid "The selected plugins have been deleted." +msgstr "Los plugins elegidos han sido eliminados." + +#: wp-admin/plugins.php:369 +msgid "Plugin activated." +msgstr "El plugin ha sido activado." + +#: wp-admin/plugins.php:371 +msgid "Selected plugins activated." +msgstr "Los plugins elegidos han sido activados." + +#: wp-admin/plugins.php:373 +msgid "Plugin deactivated." +msgstr "El plugin ha sido desactivado." + +#: wp-admin/plugins.php:375 +msgid "Selected plugins deactivated." +msgstr "Los plugins elegidos han sido desactivados." + +#: wp-admin/plugins.php:377 +msgid "No out of date plugins were selected." +msgstr "Ningún plugin actualizable elegido." + +#: wp-includes/js/tinymce/langs/wp-langs.php:307 +#: wp-admin/includes/class-wp-plugins-list-table.php:193 +msgid "Plugin" +msgstr "Plugin" + +#: wp-admin/includes/class-wp-plugins-list-table.php:368 +#: wp-admin/includes/class-wp-plugins-list-table.php:377 +msgid "Deactivate this plugin" +msgstr "Desactivar este plugin" + +#: wp-admin/includes/class-wp-plugins-list-table.php:368 +msgid "Network Deactivate" +msgstr "Desactivar para la red" + +#: wp-admin/includes/class-wp-upgrader.php:1285 +#: wp-admin/includes/class-wp-plugins-list-table.php:371 +msgid "Activate this plugin for all sites in this network" +msgstr "Activar este plugin para todos los sitios en esta red" + +#: wp-admin/includes/class-wp-upgrader.php:1285 +#: wp-admin/includes/class-wp-plugins-list-table.php:371 +msgid "Network Activate" +msgstr "Activar para la red" + +#: wp-admin/includes/class-wp-plugins-list-table.php:387 +msgid "Open this file in the Plugin Editor" +msgstr "Abrir este archivo en el editor de plugins" + +#: wp-admin/includes/class-wp-plugins-list-table.php:373 +#: wp-admin/includes/class-wp-plugins-list-table.php:382 +msgid "Delete this plugin" +msgstr "Borrar este plugin" + +#: wp-admin/includes/class-wp-plugins-list-table.php:437 +msgid "Visit plugin site" +msgstr "Visitar la web del plugin" + +#: wp-admin/includes/class-wp-plugins-list-table.php:292 +msgid "Clear List" +msgstr "Limpiar lista" + +#: wp-admin/includes/class-wp-plugins-list-table.php:212 +msgctxt "plugins" +msgid "All (%s)" +msgid_plural "All (%s)" +msgstr[0] "Todo (%s)" +msgstr[1] "Todos (%s)" + +#: wp-admin/includes/class-wp-plugins-list-table.php:215 +msgid "Active (%s)" +msgid_plural "Active (%s)" +msgstr[0] "Activo (%s)" +msgstr[1] "Activos (%s)" + +#: wp-admin/includes/class-wp-plugins-list-table.php:218 +msgid "Recently Active (%s)" +msgid_plural "Recently Active (%s)" +msgstr[0] "Activo recientemente (%s)" +msgstr[1] "Activos recientemente (%s)" + +#: wp-admin/includes/class-wp-plugins-list-table.php:221 +msgid "Inactive (%s)" +msgid_plural "Inactive (%s)" +msgstr[0] "Inactivo (%s)" +msgstr[1] "Inactivos (%s)" + +#: wp-admin/includes/class-wp-plugins-list-table.php:224 +msgid "Network (%s)" +msgid_plural "Network (%s)" +msgstr[0] "Red (%s)" +msgstr[1] "Red (%s)" + +#: wp-admin/includes/class-wp-plugins-list-table.php:183 +msgid "No plugins found." +msgstr "No se encontraron plugins." + +#: wp-admin/includes/class-wp-plugins-list-table.php:185 +msgid "You do not appear to have any plugins available at this time." +msgstr "No parece que tengas plugins disponibles en este momento." + +#: wp-admin/post.php:149 +msgid "You attempted to edit an item that doesn’t exist. Perhaps it was deleted?" +msgstr "Lo que intentas editar no existe. ¿Habrá sido borrado?" + +#: wp-admin/async-upload.php:38 wp-admin/post.php:152 +#: wp-admin/edit-tags.php:227 +msgid "You are not allowed to edit this item." +msgstr "No tienes autorización para editar esto." + +#: wp-admin/post.php:155 +msgid "You can’t edit this item because it is in the Trash. Please restore it and try again." +msgstr "No puedes editar esto ya que está en la Papelera. Sácala de la Papelera e inténtalo de nuevo." + +#: wp-admin/async-upload.php:35 wp-admin/post.php:158 +msgid "Unknown post type." +msgstr "Tipo de entrada desconocida." + +#: wp-admin/press-this.php:132 +msgid "Embed Code" +msgstr "Incrustar código" + +#: wp-admin/press-this.php:135 +msgid "Insert Video" +msgstr "Insertar vídeo" + +#: wp-admin/press-this.php:161 +msgid "Click to insert." +msgstr "Clic para insertar." + +#: wp-includes/js/tinymce/wp-mce-help.php:255 wp-admin/press-this.php:165 +#: wp-admin/press-this.php:193 +msgid "Insert Image" +msgstr "Insertar imagen" + +#: wp-admin/press-this.php:263 +msgid "Unable to retrieve images or no images on page." +msgstr "No se pueden extraer imágenes o no hay imágenes en la página." + +#: wp-admin/press-this.php:315 +msgid "click images to select" +msgstr "haz clic en las imágenes para seleccionar" + +#: wp-admin/press-this.php:315 +msgid "Add from URL" +msgstr "Añadir desde URL" + +#: wp-admin/press-this.php:315 +msgid "Refresh" +msgstr "Actualizar" + +#: wp-admin/press-this.php:417 +msgid "Loading..." +msgstr "Cargando..." + +#: wp-admin/press-this.php:570 wp-admin/press-this.php:574 +msgid "Post Tags" +msgstr "Etiquetas de las entradas" + +#: wp-admin/press-this.php:600 +msgid "Your post has been saved." +msgstr "Tu entrada ha sido guardada correctamente." + +#: wp-admin/press-this.php:600 +msgid "View post" +msgstr "Ver entrada" + +#: wp-admin/press-this.php:600 +msgid "Close Window" +msgstr "Cerrar ventana" + +#: wp-admin/press-this.php:626 wp-admin/press-this.php:627 +msgid "Insert an Image" +msgstr "Insertar imagen" + +#: wp-admin/press-this.php:629 +msgid "Embed a Video" +msgstr "Insertar vídeo" + +#: wp-includes/general-template.php:1808 wp-includes/general-template.php:1813 +#: wp-admin/includes/post.php:1789 wp-admin/press-this.php:616 +msgid "HTML" +msgstr "HTML" + +#: wp-includes/general-template.php:1809 wp-includes/general-template.php:1814 +#: wp-admin/includes/post.php:1788 wp-admin/press-this.php:617 +msgid "Visual" +msgstr "Visual" + +#: wp-admin/press-this.php:640 +msgid "via " +msgstr "vía " + +#: wp-admin/revision.php:96 +msgid "Compare Revisions of “%1$s”" +msgstr "Comparar revisiones de “%s”" + +#: wp-admin/revision.php:122 +msgid "Revision for “%1$s” created on %2$s" +msgstr "Revisión para “%1$s” creada el %2$s" + +#: wp-admin/revision.php:162 +msgid "Older: %s" +msgstr "Anteriores: %s" + +#: wp-admin/revision.php:163 +msgid "Newer: %s" +msgstr "Recientes: %s" + +#: wp-admin/revision.php:196 +msgid "These revisions are identical." +msgstr "Estas revisiones son idénticas." + +#: wp-includes/default-widgets.php:66 wp-includes/default-widgets.php:196 +#: wp-includes/default-widgets.php:262 wp-includes/default-widgets.php:317 +#: wp-includes/default-widgets.php:357 wp-includes/default-widgets.php:403 +#: wp-includes/default-widgets.php:489 wp-includes/default-widgets.php:582 +#: wp-includes/default-widgets.php:679 wp-includes/default-widgets.php:1026 +#: wp-includes/default-widgets.php:1099 +#: wp-content/plugins/akismet/widget.php:51 +msgid "Title:" +msgstr "Título:" + +#: wp-admin/themes.php:123 wp-admin/includes/class-wp-themes-list-table.php:193 +msgid "Tags:" +msgstr "Etiquetas:" + +#: wp-includes/script-loader.php:336 wp-includes/taxonomy.php:411 +msgid "Separate tags with commas" +msgstr "Separa las etiquetas con comas." + +#: wp-admin/theme-editor.php:20 +msgid "Edit Themes" +msgstr "Editar temas" + +#: wp-admin/theme-editor.php:52 +msgid "The requested theme does not exist." +msgstr "El tema solicitado no existe." + +#: wp-admin/theme-editor.php:152 +msgid "Select theme to edit:" +msgstr "Elige el tema a editar:" + +#: wp-admin/theme-editor.php:173 +msgid "Templates" +msgstr "Plantillas" + +#: wp-admin/theme-editor.php:254 +msgid "Oops, no such file exists! Double check the name and try again, merci." +msgstr "¡El archivo no existe! Comprueba el nombre e inténtalo de nuevo, gracias." + +#: wp-admin/includes/class-wp-theme-install-list-table.php:33 +msgctxt "Theme Installer" +msgid "Featured" +msgstr "Destacados" + +#: wp-admin/includes/class-wp-theme-install-list-table.php:35 +msgctxt "Theme Installer" +msgid "Newest" +msgstr "Recientes" + +#: wp-admin/includes/class-wp-theme-install-list-table.php:36 +msgctxt "Theme Installer" +msgid "Recently Updated" +msgstr "Actualizados recientemente" + +#: wp-admin/themes.php:61 +msgid "The active theme is broken. Reverting to the default theme." +msgstr "El tema activo está dañado. Volviendo al tema por defecto." + +#: wp-admin/themes.php:66 +msgid "New theme activated. Visit site" +msgstr "Nuevo tema activado. Visitar sitio" + +#: wp-admin/themes.php:69 +msgid "Theme deleted." +msgstr "El tema ha sido eliminado." + +#: wp-admin/themes.php:82 +msgid "Current Theme" +msgstr "Tema actual" + +#: wp-admin/themes.php:85 +msgid "Current theme preview" +msgstr "Vista previa del tema actual" + +#: wp-admin/themes.php:89 wp-admin/includes/class-wp-themes-list-table.php:183 +msgid "%1$s %2$s by %3$s" +msgstr "%1$s %2$s por %3$s" + +#: wp-admin/includes/class-wp-themes-list-table.php:190 +msgid "All of this theme’s files are located in %2$s." +msgstr "Todos los archivos de este tema se encuentran en %2$s." + +#: wp-admin/themes.php:139 +msgid "Available Themes" +msgstr "Temas disponibles" + +#: wp-admin/includes/class-wp-themes-list-table.php:162 +msgid "Preview of “%s”" +msgstr "Vista previa de “%s”" + +#: wp-admin/includes/class-wp-themes-list-table.php:171 +msgid "" +"You are about to delete this theme '%s'\n" +" 'Cancel' to stop, 'OK' to delete." +msgstr "" +"Estás a punto de borrar este tema '%s'\n" +" 'Aceptar' para borrar, 'Cancelar' para salir." + +#: wp-admin/themes.php:207 +msgid "Broken Themes" +msgstr "Temas dañados" + +#: wp-admin/tools.php:33 wp-admin/options-writing.php:89 +msgid "Press This is a bookmarklet: a little app that runs in your browser and lets you grab bits of the web." +msgstr "Publicar esto es un marcador: una pequeña aplicación que se ejecuta en el navegador y permite coger secciones de la web." + +#: wp-admin/tools.php:36 wp-admin/options-writing.php:91 +msgid "Drag-and-drop the following link to your bookmarks bar or right click it and add it to your favorites for a posting shortcut." +msgstr "Arrastra el siguente enlace y colócalo en tu barra de marcadores o haz clic con el botón derecho para añadirlo en tu lista de favoritos como un atajo de publicación de entradas." + +#: wp-admin/update-core.php:36 +msgid "Download nightly build" +msgstr "Descargando la última versión de desarrollo" + +#: wp-admin/update-core.php:56 +msgid "Download %s" +msgstr "Descargar %s" + +#: wp-admin/update-core.php:78 +msgid "Hide this update" +msgstr "Ocultar esta actualización" + +#: wp-admin/update-core.php:80 +msgid "Bring back this update" +msgstr "Volver a mostrar esta actualización" + +#: wp-admin/update-core.php:83 +msgid "This localized version contains both the translation and various other localization fixes. You can skip upgrading if you want to keep your current translation." +msgstr "Esta versión traducida contiene tanto la traducción como otros ajustes de traducción. Puedes saltarte la actualización si quieres mantener la traducción actual." + +#: wp-admin/update-core.php:95 wp-admin/update-core.php:107 +msgid "Show hidden updates" +msgstr "Mostrar actualizaciones ocultas" + +#: wp-admin/update-core.php:96 +msgid "Hide hidden updates" +msgstr "Ocultar actualizaciones ocultas" + +#: wp-includes/js/tinymce/langs/wp-langs.php:150 wp-admin/update-core.php:211 +#: wp-admin/update-core.php:218 wp-admin/update-core.php:284 +#: wp-admin/update-core.php:291 wp-admin/includes/nav-menu.php:781 +#: wp-admin/includes/nav-menu.php:958 +msgid "Select All" +msgstr "Elegir todo" + +#: wp-admin/update-core.php:227 +msgid "Compatibility with WordPress %1$s: 100%% (according to its author)" +msgstr "Compatibilidad con WordPress %1$s: 100%% (según su autor)" + +#: wp-admin/update-core.php:230 wp-admin/update-core.php:238 +msgid "Compatibility with WordPress %1$s: %2$d%% (%3$d \"works\" votes out of %4$d total)" +msgstr "Compatibilidad con WordPress %1$s: %2$d%% (%3$d votos de \"funciona\" de un total de %4$d)" + +#: wp-admin/update-core.php:232 wp-admin/update-core.php:240 +msgid "Compatibility with WordPress %1$s: Unknown" +msgstr "Compatibilidad con WordPress %1$s: Desconocida" + +#: wp-admin/update-core.php:362 +msgid "Installation Failed" +msgstr "Instalación fallida" + +#: wp-admin/update.php:78 +msgid "Plugin Reactivation" +msgstr "Reactivación del plugin" + +#: wp-admin/update.php:80 +msgid "Plugin reactivated successfully." +msgstr "El plugin ha sido reactivado." + +#: wp-admin/update.php:83 +msgid "Plugin failed to reactivate due to a fatal error." +msgstr "El plugin no ha sido reactivado debido a un error fatal." + +#: wp-admin/update.php:108 +msgid "Installing Plugin: %s" +msgstr "Instalando plugin: %s" + +#: wp-admin/update.php:130 +msgid "Upload Plugin" +msgstr "Subir plugin" + +#: wp-admin/update.php:135 +msgid "Installing Plugin from uploaded file: %s" +msgstr "Instalando plugin desde el archivo: %s" + +#: wp-admin/update.php:211 +msgid "Installing Theme: %s" +msgstr "Instalando tema: %s" + +#: wp-admin/update.php:230 +msgid "Upload Theme" +msgstr "Subir tema" + +#: wp-admin/update.php:237 +msgid "Installing Theme from uploaded file: %s" +msgstr "Instalando tema desde el archivo: %s" + +#: wp-admin/upgrade.php:61 +msgid "Your WordPress database is already up-to-date!" +msgstr "¡Tu base de datos de WordPress ya está actualizada!" + +#: wp-admin/upgrade.php:98 +msgid "%s queries" +msgstr "%s consultas" + +#: wp-admin/upgrade.php:100 +msgid "%s seconds" +msgstr "%s segundos" + +#: wp-admin/upload.php:42 +msgid "You are not allowed to scan for lost attachments." +msgstr "No tienes autorización para buscar adjuntos perdidos." + +#: wp-admin/upload.php:95 +msgid "You are not allowed to move this post to the trash." +msgstr "No tienes autorización para mover esta entrada a la papelera." + +#: wp-admin/upload.php:105 +msgid "You are not allowed to move this post out of the trash." +msgstr "No tienes autorización para sacar esta entrada de la papelera." + +#: wp-admin/upload.php:115 +msgid "You are not allowed to delete this post." +msgstr "No tienes autorización para borrar esta entrada." + +#: wp-admin/upload.php:171 +msgid "Reattached %d attachment." +msgid_plural "Reattached %d attachments." +msgstr[0] "Se ha vuelto a adjuntar %d adjunto." +msgstr[1] "Se han vuelto a adjuntar %d adjuntos." + +#: wp-admin/upload.php:176 +msgid "Media attachment permanently deleted." +msgid_plural "%d media attachments permanently deleted." +msgstr[0] "Medio adjunto borrado permanentemente." +msgstr[1] "%d medios adjuntos borrados permanentemente." + +#: wp-admin/upload.php:181 +msgid "Media attachment moved to the trash." +msgid_plural "%d media attachments moved to the trash." +msgstr[0] "Medio adjunto movido a la papelera." +msgstr[1] "%d medios adjuntos movidos a la papelera." + +#: wp-admin/upload.php:187 +msgid "Media attachment restored from the trash." +msgid_plural "%d media attachments restored from the trash." +msgstr[0] "Medio adjunto restaurado de la papelera." +msgstr[1] "%d medios adjuntos restaurados de la papelera." + +#: wp-admin/upload.php:192 +msgid "Media permanently deleted." +msgstr "Medio borrado permanentemente." + +#: wp-admin/upload.php:193 +msgid "Error saving media attachment." +msgstr "Error al guardar el archivo." + +#: wp-admin/upload.php:194 +msgid "Media moved to the trash." +msgstr "Medios movidos a la papelera." + +#: wp-admin/upload.php:195 +msgid "Media restored from the trash." +msgstr "Medios restaurados de la papelera." + +#: wp-admin/includes/class-wp-media-list-table.php:57 +msgctxt "uploaded files" +msgid "All (%s)" +msgid_plural "All (%s)" +msgstr[0] "Todo (%s)" +msgstr[1] "Todos (%s)" + +#: wp-admin/includes/class-wp-media-list-table.php:69 +msgctxt "detached files" +msgid "Unattached (%s)" +msgid_plural "Unattached (%s)" +msgstr[0] "Sin adjuntar (%s)" +msgstr[1] "Sin adjuntar (%s)" + +#: wp-admin/includes/class-wp-media-list-table.php:72 +msgctxt "uploaded files" +msgid "Trash (%s)" +msgid_plural "Trash (%s)" +msgstr[0] "Papelera (%s)" +msgstr[1] "Papelera (%s)" + +#: wp-admin/includes/class-wp-media-list-table.php:81 +msgid "Attach to a post" +msgstr "Adjuntar a una entrada" + +#: wp-admin/includes/class-wp-media-list-table.php:100 +msgid "Scan for lost attachments" +msgstr "Buscar adjuntos perdidos" + +#: wp-admin/user-edit.php:28 +msgid "Edit User" +msgstr "Editar usuario" + +#: wp-admin/user-edit.php:22 wp-admin/user-edit.php:24 +msgid "Invalid user ID." +msgstr "El ID del usuario no es válido." + +#: wp-admin/user-edit.php:66 +msgid "Use https" +msgstr "Usar https" + +#: wp-admin/user-edit.php:67 +msgid "Always use https when visiting the admin" +msgstr "Usar siempre https para visitar la administración" + +#: wp-admin/user-edit.php:75 wp-admin/user-edit.php:102 +#: wp-admin/user-edit.php:149 +msgid "You do not have permission to edit this user." +msgstr "No tienes autorización para editar este usuario." + +#: wp-admin/user-edit.php:159 +msgid "User updated." +msgstr "El usuario ha sido actualizado." + +#: wp-admin/user-edit.php:193 +msgid "Personal Options" +msgstr "Opciones personales" + +#: wp-admin/user-edit.php:198 +msgid "Visual Editor" +msgstr "Editor visual" + +#: wp-admin/user-edit.php:199 +msgid "Disable the visual editor when writing" +msgstr "Desactivar el editor visual al escribir" + +#: wp-admin/includes/misc.php:567 wp-admin/user-edit.php:204 +msgid "Admin Color Scheme" +msgstr "Esquema de color de administración" + +#: wp-admin/user-edit.php:212 +msgid "Enable keyboard shortcuts for comment moderation." +msgstr "Activar los atajos del teclado para la moderación de comentarios." + +#: wp-admin/user-new.php:296 wp-admin/user-edit.php:274 +msgid "First Name" +msgstr "Nombre" + +#: wp-admin/user-new.php:300 wp-admin/user-edit.php:279 +msgid "Last Name" +msgstr "Apellidos" + +#: wp-admin/user-edit.php:284 +msgid "Nickname" +msgstr "Alias" + +#: wp-includes/theme-compat/comments.php:78 +#: wp-includes/theme-compat/comments.php:81 wp-admin/user-new.php:287 +#: wp-admin/user-new.php:291 wp-admin/user-edit.php:284 +#: wp-admin/user-edit.php:329 +msgid "(required)" +msgstr "(requerido)" + +#: wp-admin/user-edit.php:289 +msgid "Display name publicly as" +msgstr "Mostrar este nombre públicamente" + +#: wp-admin/user-edit.php:325 +msgid "Contact Info" +msgstr "Información de contacto" + +#: wp-includes/theme-compat/comments.php:84 +#: wp-includes/comment-template.php:1527 wp-admin/user-new.php:304 +#: wp-admin/user-edit.php:342 +msgid "Website" +msgstr "Web" + +#: wp-admin/user-edit.php:358 +msgid "About Yourself" +msgstr "Acerca de ti" + +#: wp-admin/user-edit.php:358 +msgid "About the user" +msgstr "Acerca del usuario" + +#: wp-admin/user-edit.php:362 +msgid "Biographical Info" +msgstr "Información biográfica" + +#: wp-admin/user-edit.php:364 +msgid "Share a little biographical information to fill out your profile. This may be shown publicly." +msgstr "Incluye alguna información biográfica en tu perfil. Podrá mostrarse públicamente." + +#: wp-admin/user-edit.php:372 +msgid "New Password" +msgstr "Nueva contraseña" + +#: wp-admin/user-edit.php:373 +msgid "If you would like to change the password type a new one. Otherwise leave this blank." +msgstr "Si deseas cambiar la contraseña del usuario, escribe aquí dos veces la nueva. En caso contrario, deja las casillas en blanco." + +#: wp-admin/user-edit.php:374 +msgid "Type your new password again." +msgstr "Teclea tu nueva contraseña otra vez." + +#: wp-admin/user-edit.php:393 +msgid "Additional Capabilities" +msgstr "Capacidades adicionales" + +#: wp-admin/user-edit.php:412 +msgid "Update Profile" +msgstr "Actualizar perfil" + +#: wp-admin/user-edit.php:412 +msgid "Update User" +msgstr "Actualizar usuario" + +#: wp-admin/user-new.php:75 +msgid "" +"Hi,\n" +"\n" +"You have been invited to join '%s' at\n" +"%s as a %s.\n" +"Please click the following link to confirm the invite:\n" +"%s\n" +msgstr "" +"Hola,\n" +"\n" +"Has sido invitado a participar de '%s' en\n" +"%s como %s.\n" +"Por favor, haz clic en el enlace para aceptar la invitación:\n" +"%s\n" + +#: wp-admin/user-new.php:76 +msgid "[%s] Joining confirmation" +msgstr "[%s] Esperando confirmación" + +#: wp-admin/user-new.php:129 wp-admin/user-new.php:265 wp-admin/menu.php:213 +#: wp-admin/menu.php:215 +msgid "Add New User" +msgstr "Añadir nuevo usuario" + +#: wp-admin/user-new.php:163 +msgid "Invitation email sent to new user. A confirmation link must be clicked before their account is created." +msgstr "La invitación ha sido enviada al nuevo usuario por correo electrónico. Deberá hacer clic en el enlace de confirmación para que su cuenta sea creada." + +#: wp-admin/user-new.php:309 +msgid "(twice, required)" +msgstr "(dos veces, requerido)" + +#: wp-admin/user-new.php:319 +msgid "Send Password?" +msgstr "¿Enviar Contraseña?" + +#: wp-admin/user-new.php:320 +msgid "Send this password to the new user by email." +msgstr "Enviar esta contraseña al nuevo usuario por correo electrónico." + +#: wp-admin/user-new.php:253 wp-admin/user-new.php:337 +msgid "Skip Confirmation Email" +msgstr "No enviar el correo electrónico de confirmación" + +#: wp-admin/users.php:52 wp-admin/users.php:69 +msgid "You can’t edit that user." +msgstr "No puedes editar ese usuario." + +#: wp-admin/users.php:101 wp-admin/users.php:148 +msgid "You can’t delete users." +msgstr "No puedes borrar usuarios." + +#: wp-admin/users.php:163 +msgid "Delete Users" +msgstr "Borrar usuarios" + +#: wp-admin/users.php:172 +msgid "ID #%1s: %2s The current user will not be deleted." +msgstr "ID #%1s: %2s El usuario actual no se borrará." + +#: wp-admin/users.php:174 wp-admin/users.php:277 +msgid "ID #%1s: %2s" +msgstr "ID #%1s: %2s" + +#: wp-admin/users.php:181 +msgid "What should be done with posts and links owned by this user?" +msgid_plural "What should be done with posts and links owned by these users?" +msgstr[0] "¿Qué debe hacerse con los enlaces y entradas que le pertenecen?" +msgstr[1] "" + +#: wp-admin/users.php:184 +msgid "Delete all posts and links." +msgstr "Borrar todas las entradas y enlaces." + +#: wp-admin/users.php:186 +msgid "Attribute all posts and links to:" +msgstr "Atribuir todas las entradas y enlaces a:" + +#: wp-admin/users.php:190 +msgid "Confirm Deletion" +msgstr "Confirmar borrado" + +#: wp-admin/users.php:192 +msgid "There are no valid users selected for deletion." +msgstr "No se han seleccionado usuarios válidos para borrar." + +#: wp-admin/users.php:315 +msgid "%s user deleted" +msgid_plural "%s users deleted" +msgstr[0] "%s usuario borrado" +msgstr[1] "%s usuarios borrados" + +#: wp-admin/users.php:318 +msgid "New user created." +msgstr "Nuevo usuario creado." + +#: wp-admin/users.php:321 +msgid "Changed roles." +msgstr "Cambiar perfil." + +#: wp-admin/users.php:324 +msgid "The current user’s role must have user editing capabilities." +msgstr "El perfil del usuario actual debería poder editar usuarios." + +#: wp-admin/users.php:325 +msgid "Other user roles have been changed." +msgstr "Se han cambiado los perfiles de los otros usuarios." + +#: wp-admin/users.php:328 +msgid "You can’t delete the current user." +msgstr "No puedes borrar el usuario actual." + +#: wp-admin/users.php:329 +msgid "Other users have been deleted." +msgstr "Se han eliminado los otros usuarios." + +#: wp-admin/includes/class-wp-users-list-table.php:101 +msgctxt "users" +msgid "All (%s)" +msgid_plural "All (%s)" +msgstr[0] "Todo (%s)" +msgstr[1] "Todos (%s)" + +#: wp-admin/includes/class-wp-users-list-table.php:115 +msgid "%1$s (%2$s)" +msgstr "%1$s (%2$s)" + +#: wp-admin/includes/class-wp-users-list-table.php:143 +#: wp-admin/includes/class-wp-users-list-table.php:145 +msgid "Change role to…" +msgstr "Cambiar perfil a…" + +#: wp-admin/includes/class-wp-users-list-table.php:148 +msgid "Change" +msgstr "Cambiar" + +#: wp-includes/functions.php:3236 wp-includes/admin-bar.php:308 +#: wp-admin/widgets.php:33 +msgid "Widgets" +msgstr "Widgets" + +#: wp-admin/widgets.php:51 wp-admin/widgets.php:374 +msgid "Inactive Widgets" +msgstr "Widgets inactivos" + +#: wp-admin/widgets.php:143 +msgid "No Sidebars Defined" +msgstr "No hay barras laterales definidas" + +#: wp-admin/widgets.php:145 +msgid "The theme you are currently using isn’t widget-aware, meaning that it has no sidebars that you are able to change. For information on making your theme widget-aware, please follow these instructions." +msgstr "Estás viendo este mensaje porque el tema que estás usando actualmente no está preparado para widgets. Esto significa que no tiene barras laterales que puedas cambiar. Para información de cómo preparar tu tema para widgets, por favor sigue estas instrucciones." + +#: wp-admin/widgets.php:265 +msgid "Widget %s" +msgstr "Widget %s" + +#: wp-admin/widgets.php:276 +msgid "Select both the sidebar for this widget and the position of the widget in that sidebar." +msgstr "Selecciona la barra lateral y la posición en la que irá el widget." + +#: wp-admin/custom-background.php:252 wp-admin/widgets.php:278 +msgid "Position" +msgstr "Posición" + +#: wp-admin/widgets.php:316 +msgid "Save Widget" +msgstr "Guardar Widget" + +#: wp-admin/widgets.php:332 +msgid "Changes saved." +msgstr "Cambios guardados." + +#: wp-admin/widgets.php:336 +msgid "Error while saving." +msgstr "Error al guardar los cambios." + +#: wp-admin/widgets.php:337 +msgid "Error in displaying the widget settings form." +msgstr "Error al mostrar el formulario con las opciones del widget." + +#: wp-admin/widgets.php:360 +msgid "Available Widgets" +msgstr "Widgets disponibles" + +#: wp-admin/widgets.php:362 +msgid "Drag widgets from here to a sidebar on the right to activate them. Drag widgets back here to deactivate them and delete their settings." +msgstr "Arrastra los widgets de aquí a la barra de la derecha para activarlos. Arrastra los widgets aquí desde la barra de la derecha para desactivarlos y eliminar su configuración." + +#: wp-admin/widgets.php:377 +msgid "Drag widgets here to remove them from the sidebar but keep their settings." +msgstr "Arrastra los widgets aquí para eliminarlos de la barra lateral pero manteniendo su configuración." + +#: wp-app.php:420 +msgid "Sorry, you do not have the right to edit/publish new posts." +msgstr "Lo sentimos, no tienes autorización para editar/publicar nuevas entradas." + +#: wp-includes/class-wp-xmlrpc-server.php:2038 +#: wp-includes/class-wp-xmlrpc-server.php:2405 wp-app.php:445 wp-app.php:640 +#: wp-app.php:826 +msgid "Sorry, your entry could not be posted. Something wrong happened." +msgstr "Disculpa, ha sido imposible publicar la entrada. Algo ha ocurrido." + +#: wp-app.php:472 +msgid "Sorry, you do not have the right to access this post." +msgstr "Lo sentimos, no tienes autorización para acceder a esta entrada." + +#: wp-includes/class-wp-xmlrpc-server.php:2078 wp-app.php:506 wp-app.php:672 +#: wp-app.php:745 wp-app.php:795 +msgid "Sorry, you do not have the right to edit this post." +msgstr "Lo sentimos, no tienes autorización para editar esta entrada." + +#: wp-includes/class-wp-xmlrpc-server.php:2094 wp-app.php:529 wp-app.php:688 +msgid "For some strange yet very annoying reason, this post could not be edited." +msgstr "Por alguna extraña razón esta entrada no puede editarse." + +#: wp-includes/class-wp-xmlrpc-server.php:2128 wp-app.php:551 wp-app.php:709 +msgid "Sorry, you do not have the right to delete this post." +msgstr "Lo sentimos, no tienes autorización para borrar esta entrada." + +#: wp-includes/class-wp-xmlrpc-server.php:2133 wp-app.php:559 wp-app.php:724 +msgid "For some strange yet very annoying reason, this post could not be deleted." +msgstr "Por alguna extraña y desagradable razón esta entrada no puede borrarse." + +#: wp-app.php:577 +msgid "Sorry, you do not have permission to upload files." +msgstr "Lo sentimos, no tienes autorización para subir archivos." + +#: wp-comments-post.php:36 +msgid "Sorry, comments are closed for this item." +msgstr "Disculpa, los comentarios están cerrados." + +#: wp-comments-post.php:71 +msgid "Sorry, you must be logged in to post a comment." +msgstr "Disculpa, debes identificarte para escribir un comentario." + +#: wp-comments-post.php:78 +msgid "Error: please fill the required fields (name, email)." +msgstr "Error: por favor, completa los campos requeridos (nombre, correo electrónico)." + +#: wp-comments-post.php:80 +msgid "Error: please enter a valid email address." +msgstr "Error: por favor, escribe un correo electrónico válido." + +#: wp-content/plugins/akismet/admin.php:40 +#: wp-content/plugins/akismet/admin.php:137 +msgid "Akismet Configuration" +msgstr "Configuración de Akismet" + +#: wp-content/plugins/akismet/admin.php:122 +msgid "Your key has been cleared." +msgstr "Tu clave ha sido eliminada." + +#: wp-content/plugins/akismet/admin.php:123 +msgid "Your key has been verified. Happy blogging!" +msgstr "Tu clave ha sido verificada. ¡Disfruta tu sitio!" + +#: wp-content/plugins/akismet/admin.php:124 +msgid "The key you entered is invalid. Please double-check it." +msgstr "La clave que has introducido no es válida. Por favor compruébala." + +#: wp-content/plugins/akismet/admin.php:125 +msgid "The key you entered could not be verified because a connection to akismet.com could not be established. Please check your server configuration." +msgstr "La clave que has introducido no se ha podido verificar porque no se ha podido realizar la conexión con akismet.com. Por favor, comprueba la configuración de tu servidor." + +#: wp-content/plugins/akismet/admin.php:126 +msgid "There was a problem connecting to the Akismet server. Please check your server configuration." +msgstr "Hubo un problema al conectar con el servidor de Akismet. Por favor, comprueba la configuración de tu servidor." + +#: wp-content/plugins/akismet/admin.php:127 +msgid "Please enter an API key. (Get your key.)" +msgstr "Por favor introduce una clave de API. (Consigue tu clave.)" + +#: wp-content/plugins/akismet/admin.php:128 +msgid "This key is valid." +msgstr "La clave es válida." + +#: wp-content/plugins/akismet/admin.php:129 +msgid "The key below was previously validated but a connection to akismet.com can not be established at this time. Please check your server configuration." +msgstr "La clave mostrada fue validada anteriormente pero no se puede realizar una conexión con akismet.com en este momento. Por favor, comprueba la configuración de tu servidor." + +#: wp-content/plugins/akismet/admin.php:152 +msgid "Why might my key be invalid?" +msgstr "¿Por qué no es válida mi clave?" + +#: wp-content/plugins/akismet/admin.php:153 +msgid "This can mean one of two things, either you copied the key wrong or that the plugin is unable to reach the Akismet servers, which is most often caused by an issue with your web host around firewalls or similar." +msgstr "Esto puede significar una de estas dos cosas: que has copiado mal la clave o que el plugin no es capaz de encontrar los servidores de Akismet, que a menudo suele ocurrir por un problema con tu alojamiento web con los cortafuegos o algo similar." + +#: wp-content/plugins/akismet/admin.php:159 +msgid "Update options »" +msgstr "Actualizar opciones »" + +#: wp-content/plugins/akismet/admin.php:164 +msgid "Server Connectivity" +msgstr "Conectividad del servidor" + +#: wp-content/plugins/akismet/admin.php:177 +msgid "Unable to reach some Akismet servers." +msgstr "No se puede acceder a ningún servidor de Akismet." + +#: wp-content/plugins/akismet/admin.php:178 +msgid "A network problem or firewall is blocking some connections from your web server to Akismet.com. Akismet is working but this may cause problems during times of network congestion. Please contact your web host or firewall administrator and give them this information about Akismet and firewalls." +msgstr "Un problema en la red o en el firewall está bloqueando algunas conexiones de su servidor web para Akismet.com. Akismet está funcionando pero esto te puede causar problemas cuando la red esté saturada. Por favor, ponte en contacto con tuproveedor e infórmales sobre este problema." + +#: wp-content/plugins/akismet/admin.php:182 +msgid "Unable to reach any Akismet servers." +msgstr "No se puede acceder a ningún servidor de Akismet." + +#: wp-content/plugins/akismet/admin.php:183 +msgid "A network problem or firewall is blocking all connections from your web server to Akismet.com. Akismet cannot work correctly until this is fixed. Please contact your web host or firewall administrator and give them this information about Akismet and firewalls." +msgstr "Un problema en la red o en el firewall está bloqueando algunas conexiones de tu servidor web para Akismet.com. Akismet no está funcionando correctamente. Por favor, ponte en contacto con tu proveedor e infórmales sobre este problema." + +#: wp-content/plugins/akismet/admin.php:187 +msgid "All Akismet servers are available." +msgstr "Todos los servidores Akismet están disponibles." + +#: wp-content/plugins/akismet/admin.php:188 +msgid "Akismet is working correctly. All servers are accessible." +msgstr "Akismet está funcionando correctamente. Se puede acceder a todos los servidores." + +#: wp-content/plugins/akismet/admin.php:168 +msgid "Network functions are disabled." +msgstr "Las funciones de red están desactivadas." + +#: wp-content/plugins/akismet/admin.php:193 +msgid "Unable to find Akismet servers." +msgstr "No se pudieron encontrar los servidores de Akismet." + +#: wp-content/plugins/akismet/admin.php:194 +msgid "A DNS problem or firewall is preventing all access from your web server to Akismet.com. Akismet cannot work correctly until this is fixed. Please contact your web host or firewall administrator and give them this information about Akismet and firewalls." +msgstr "Un problema de DNS o en el firewall impide el acceso de su servidor a Akismet.com. Akismet no puede funcionar correctamente con este problema. Por favor, ponte en contacto con tu proveedor e infórmales sobre este problema." + +#: wp-content/plugins/akismet/admin.php:202 +msgid "Akismet server" +msgstr "Servidor Akismet" + +#: wp-content/plugins/akismet/admin.php:202 +msgid "Network Status" +msgstr "Estado de la red" + +#: wp-content/plugins/akismet/admin.php:219 +msgid "Last checked %s ago." +msgstr "Última consulta hace %s." + +#: wp-content/plugins/akismet/admin.php:220 +msgid "Check network status »" +msgstr "Comprueba el estado de la red »" + +#: wp-content/plugins/akismet/admin.php:231 +msgid "Akismet Stats" +msgstr "Estadísticas de Akismet" + +#: wp-content/plugins/akismet/admin.php:290 +msgid "Akismet is almost ready." +msgstr "Akismet casi está preparado." + +#: wp-content/plugins/akismet/admin.php:302 +msgid "Akismet has detected a problem." +msgstr "Akismet ha detectado un problema." + +#: wp-content/plugins/akismet/legacy.php:47 +msgid "Akismet Spam (%s)" +msgstr "Spam en Akismet (%s)" + +#: wp-content/plugins/akismet/legacy.php:49 +#: wp-content/plugins/akismet/legacy.php:51 +msgid "Akismet Spam" +msgstr "Spam en Akismet" + +#: wp-content/plugins/akismet/legacy.php:61 +#: wp-content/plugins/akismet/legacy.php:80 +msgid "You do not have sufficient permission to moderate comments." +msgstr "No tienes autorización para moderar comentarios." + +#: wp-content/plugins/akismet/legacy.php:96 +msgid "%1$s comments recovered." +msgstr "%1$s comentario ha sido recuperado." + +#: wp-content/plugins/akismet/legacy.php:100 +msgid "All spam deleted." +msgstr "Todo el spam ha sido borrado." + +#: wp-content/plugins/akismet/legacy.php:148 +msgid "Caught Spam" +msgstr "Spam capturado" + +#: wp-content/plugins/akismet/legacy.php:153 +msgid "Akismet has caught %1$s spam for you since you first installed it." +msgstr "Akismet ha capturado %1$s spam desde la primera vez que lo instalaste." + +#: wp-content/plugins/akismet/legacy.php:160 +msgid "You have no spam currently in the queue. Must be your lucky day. :)" +msgstr "En este momento no tienes spam en cola. Debe ser tu día de suerte. :)" + +#: wp-content/plugins/akismet/legacy.php:163 +msgid "You can delete all of the spam from your database with a single click. This operation cannot be undone, so you may wish to check to ensure that no legitimate comments got through first. Spam is automatically deleted after 15 days, so don’t sweat it." +msgstr "Puedes borrar todo el spam de tu base de datos con un solo clic. Esta operación no es reversible así que puede que quieras antes comprobar si hay comentarios legítimos. El spam se borra automáticamente a los 15 días, así que no te agobies." + +#: wp-content/plugins/akismet/legacy.php:169 +#: wp-content/plugins/akismet/legacy.php:347 +msgid "There are currently %1$s comments identified as spam." +msgstr "En este momento hay %1$s comentarios identificados como spam." + +#: wp-content/plugins/akismet/legacy.php:169 +#: wp-content/plugins/akismet/legacy.php:347 +msgid "Delete all" +msgstr "Borrar todos" + +#: wp-content/plugins/akismet/legacy.php:178 +msgid "These are the latest comments identified as spam by Akismet. If you see any mistakes, simply mark the comment as \"not spam\" and Akismet will learn from the submission. If you wish to recover a comment from spam, simply select the comment, and click Not Spam. After 15 days we clean out the junk for you." +msgstr "Estos son los últimos comentarios identificados como spam por Akismet. Si encuentras algún error, sólo tienes que marcarlo como \"No es spam\" y Akismet aprenderá al recibirlo. Si deseas recuperar un comentario, selecciónalo y haz clic en \"No es spam\". Tras 15 días, la basura desaparecerá sola." + +#: wp-admin/export.php:135 wp-admin/export.php:141 wp-admin/export.php:158 +#: wp-admin/export.php:173 wp-admin/export.php:190 +#: wp-content/plugins/akismet/legacy.php:209 +msgid "All" +msgstr "Todo" + +#: wp-content/plugins/akismet/legacy.php:232 +msgid "Search Spam »" +msgstr "Buscar spam »" + +#: wp-includes/link-template.php:1665 wp-includes/link-template.php:1701 +#: wp-content/plugins/akismet/legacy.php:239 +#: wp-content/plugins/akismet/legacy.php:306 +msgid "« Previous Page" +msgstr "« Página anterior" + +#: wp-includes/link-template.php:1594 wp-includes/link-template.php:1702 +#: wp-content/plugins/akismet/legacy.php:260 +#: wp-content/plugins/akismet/legacy.php:327 +msgid "Next Page »" +msgstr "Página siguiente »" + +#: wp-content/plugins/akismet/legacy.php:282 +msgid "IP:" +msgstr "IP:" + +#: wp-content/plugins/akismet/legacy.php:333 +msgid "De-spam marked comments »" +msgstr "Quitar marca de spam »" + +#: wp-content/plugins/akismet/legacy.php:335 +msgid "Comments you de-spam will be submitted to Akismet as mistakes so it can learn and get better." +msgstr "Los comentarios a los que quites la marca de \"spam\" se enviarán a Akismet como errores para que vaya aprendiendo y mejorando." + +#: wp-admin/includes/nav-menu.php:709 wp-admin/includes/nav-menu.php:943 +#: wp-content/plugins/akismet/legacy.php:340 +msgid "No results found." +msgstr "Sin resultados." + +#: wp-content/plugins/akismet/admin.php:281 +msgid "Akismet has protected your site from %3$s spam comments." +msgid_plural "Akismet has protected your site from %3$s spam comments." +msgstr[0] "Akismet ha protegido tu sitio de %3$s comentarios de spam." +msgstr[1] "Akismet ha protegido tu sitio de %3$s comentarios de spam." + +#: wp-content/plugins/akismet/legacy.php:385 +msgid "Recheck Queue for Spam" +msgstr "Volver a comprobar cola de spam" + +#: wp-content/plugins/akismet/admin.php:478 +msgid "Check for Spam" +msgstr "Comprobar la lista de spam" + +#: wp-includes/feed-atom-comments.php:19 +msgid "Comments on %s" +msgstr "Comentarios en %s" + +#: wp-includes/theme-compat/sidebar.php:75 wp-includes/default-widgets.php:299 +msgid "Powered by WordPress, state-of-the-art semantic personal publishing platform." +msgstr "Gestionado con WordPress, una avanzada plataforma semántica de publicación personal." + +#: wp-includes/comment-template.php:987 +msgid "Enter your password to view comments." +msgstr "Escribe tu contraseña para ver los comentarios." + +#: wp-includes/comment-template.php:582 wp-includes/comment-template.php:974 +msgid "No Comments" +msgstr "No hay comentarios" + +#: wp-includes/comment-template.php:584 wp-includes/comment-template.php:975 +msgid "1 Comment" +msgstr "1 comentario" + +#: wp-includes/comment-template.php:580 wp-includes/comment-template.php:976 +msgid "% Comments" +msgstr "% comentarios" + +#: wp-includes/link-template.php:731 wp-includes/link-template.php:938 +#: wp-includes/link-template.php:1013 wp-includes/link-template.php:1054 +msgid "Edit This" +msgstr "Editar Esto" + +#: wp-includes/theme-compat/comments.php:66 +#: wp-includes/comment-template.php:1535 +msgid "You must be logged in to post a comment." +msgstr "Disculpa, debes iniciar sesión para escribir un comentario." + +#: wp-includes/category-template.php:1030 +msgid "Tags: " +msgstr "Etiquetas: " + +#: wp-includes/post-template.php:185 +msgid "(more...)" +msgstr "(más...)" + +#: wp-includes/post-template.php:625 +msgid "Pages:" +msgstr "Páginas:" + +#: wp-admin/export.php:134 +msgid "Categories:" +msgstr "Categorías:" + +#: wp-includes/default-widgets.php:298 +msgid "The latest comments to all posts in RSS" +msgstr "Últimos comentarios a todas las entradas en RSS" + +#: wp-includes/default-widgets.php:298 +msgid "Comments RSS" +msgstr "RSS de los comentarios" + +#: wp-includes/comment-template.php:1355 +msgid "%s says:" +msgstr "%s dice:" + +#: wp-includes/comment-template.php:1358 +msgid "Your comment is awaiting moderation." +msgstr "Tu comentario está pendiente de moderación" + +#: wp-includes/comment-template.php:1365 +msgid "%1$s at %2$s" +msgstr "%1$s a las %2$s" + +#: wp-includes/comment-template.php:1365 +msgid "(Edit)" +msgstr "(Editar)" + +#: wp-includes/category-template.php:59 wp-includes/category-template.php:174 +#: wp-includes/category-template.php:177 wp-includes/category-template.php:184 +#: wp-includes/category-template.php:197 wp-includes/category-template.php:200 +#: wp-includes/category-template.php:207 +msgid "View all posts in %s" +msgstr "Ver todas las entradas en %s" + +#: wp-includes/theme-compat/sidebar.php:69 wp-includes/default-widgets.php:283 +#: wp-includes/default-widgets.php:288 +msgid "Meta" +msgstr "Meta" + +#: wp-includes/atomlib.php:133 +msgid "XML error: %s at line %d" +msgstr "Error de XML: %s en la línea %d" + +#: wp-includes/author-template.php:143 +msgid "Visit %s’s website" +msgstr "Visitar el sitio de %s" + +#: wp-includes/author-template.php:211 wp-includes/author-template.php:325 +msgid "Posts by %s" +msgstr "Entradas de %s" + +#: wp-includes/bookmark-template.php:82 +msgid "Last updated: %s" +msgstr "Última actualización: %s" + +#: wp-includes/bookmark-template.php:206 +msgid "Bookmarks" +msgstr "Marcadores" + +#: wp-includes/capabilities.php:723 +msgid "Usage of user levels by plugins and themes is deprecated. Use roles and capabilities instead." +msgstr "El uso de niveles de usuarios por plugins y temas está obsoleto. Usa los perfiles y capacidades en su lugar." + +#: wp-includes/category-template.php:419 +msgid "No categories" +msgstr "No hay categorías" + +#: wp-includes/category-template.php:568 +msgid "%s topic" +msgid_plural "%s topics" +msgstr[0] "%s tema" +msgstr[1] "%s temas" + +#: wp-includes/class-pop3.php:82 +msgid "No server specified" +msgstr "Servidor no especificado" + +#: wp-includes/class-pop3.php:90 wp-includes/class-pop3.php:102 +#: wp-includes/class-pop3.php:123 wp-includes/class-pop3.php:246 +#: wp-includes/class-pop3.php:300 wp-includes/class-pop3.php:311 +#: wp-includes/class-pop3.php:359 wp-includes/class-pop3.php:393 +#: wp-includes/class-pop3.php:426 wp-includes/class-pop3.php:525 +#: wp-includes/class-pop3.php:548 +msgid "Error " +msgstr "Error " + +#: wp-includes/class-pop3.php:115 +msgid "no login ID submitted" +msgstr "no se ha enviado el ID de usuario" + +#: wp-includes/class-pop3.php:118 wp-includes/class-pop3.php:138 +msgid "connection not established" +msgstr "no se estableció la conexión" + +#: wp-includes/class-pop3.php:135 wp-includes/class-pop3.php:171 +msgid "No password submitted" +msgstr "No se envió la contraseña" + +#: wp-includes/class-pop3.php:143 +msgid "Authentication failed" +msgstr "Autentificación fallida" + +#: wp-includes/class-pop3.php:162 wp-includes/class-pop3.php:205 +#: wp-includes/class-pop3.php:230 wp-includes/class-pop3.php:272 +#: wp-includes/class-pop3.php:346 wp-includes/class-pop3.php:386 +#: wp-includes/class-pop3.php:416 wp-includes/class-pop3.php:450 +#: wp-includes/class-pop3.php:513 wp-includes/class-pop3.php:578 +msgid "No connection to server" +msgstr "No hay conexión con el servidor." + +#: wp-includes/class-pop3.php:168 +msgid "No login ID submitted" +msgstr "No se ha enviado el ID de usuario" + +#: wp-includes/class-pop3.php:176 +msgid "No server banner" +msgstr "No hay identificación del servidor" + +#: wp-includes/class-pop3.php:176 wp-includes/class-pop3.php:186 +msgid "abort" +msgstr "cancelar" + +#: wp-includes/class-pop3.php:186 +msgid "apop authentication failed" +msgstr "Falló la autenticación apop" + +#: wp-includes/class-pop3.php:323 +msgid "Premature end of list" +msgstr "Fin de la lista prematuro" + +#: wp-includes/class-pop3.php:456 +msgid "Empty command string" +msgstr "Cadena de comandos vacía" + +#: wp-includes/class-pop3.php:476 +msgid "connection does not exist" +msgstr "conexión inexistente" + +#: wp-includes/class-pop3.php:583 +msgid "No msg number submitted" +msgstr "No se envió ningún número de mensaje" + +#: wp-includes/class-pop3.php:589 +msgid "Command failed " +msgstr "Comando fallido" + +#: wp-includes/category-template.php:837 +msgid "View all posts filed under %s" +msgstr "Ver todas las entradas archivadas en %s" + +#: wp-includes/category-template.php:852 +msgid "Feed for all posts filed under %s" +msgstr "Feed para todas las entradas archivadas en %s" + +#: wp-includes/comment-template.php:977 +msgid "Comments Off" +msgstr "Comentarios desactivados" + +#: wp-includes/comment-template.php:1014 +msgid "Comment on %s" +msgstr "Comentarios en %s" + +#: wp-includes/comment-template.php:1040 +msgid "Log in to Reply" +msgstr "Inicia sesión para responder" + +#: wp-includes/comment-template.php:1100 +msgid "Leave a Comment" +msgstr "Dejar un comentario" + +#: wp-includes/comment-template.php:1101 +msgid "Log in to leave a Comment" +msgstr "Inicia sesión para dejar un comentario" + +#: wp-includes/comment-template.php:1140 +msgid "Click here to cancel reply." +msgstr "Clic para cancelar respuesta." + +#: wp-includes/theme-compat/comments.php:59 +#: wp-includes/comment-template.php:1197 wp-includes/comment-template.php:1541 +msgid "Leave a Reply" +msgstr "Deja un comentario" + +#: wp-includes/theme-compat/comments.php:59 +#: wp-includes/comment-template.php:1198 wp-includes/comment-template.php:1542 +msgid "Leave a Reply to %s" +msgstr "Responder a %s" + +#: wp-admin/comment.php:126 +msgid "Permanently Delete Comment" +msgstr "Borrar comentario permanentemente" + +#: wp-admin/comment.php:129 +msgid "You are about to approve the following comment:" +msgstr "Estás a punto de aprobar el siguiente comentario:" + +#: wp-admin/comment.php:130 +msgid "Approve Comment" +msgstr "Aprobar comentario" + +#: wp-admin/theme-editor.php:241 wp-admin/comment.php:151 +#: wp-admin/plugins.php:250 +msgid "Caution:" +msgstr "Atención:" + +#: wp-includes/theme-compat/sidebar.php:21 wp-includes/post-template.php:1418 +#: wp-includes/js/tinymce/langs/wp-langs.php:308 +#: wp-admin/edit-form-advanced.php:150 wp-admin/comment.php:155 +#: wp-admin/includes/class-wp-posts-list-table.php:274 +#: wp-admin/includes/class-wp-posts-list-table.php:781 +#: wp-admin/includes/plugin-install.php:127 +#: wp-admin/includes/class-wp-comments-list-table.php:254 +#: wp-admin/includes/class-wp-comments-list-table.php:525 +#: wp-admin/includes/theme-install.php:62 +#: wp-admin/includes/class-wp-media-list-table.php:135 +#: wp-admin/includes/meta-boxes.php:524 wp-admin/edit-form-comment.php:86 +msgid "Author" +msgstr "Autor" + +#: wp-includes/theme-compat/comments-popup.php:80 wp-login.php:520 +#: wp-admin/user-new.php:229 wp-admin/user-new.php:291 wp-admin/comment.php:160 +#: wp-admin/includes/class-wp-users-list-table.php:165 +#: wp-admin/includes/template.php:356 wp-admin/user-edit.php:329 +msgid "E-mail" +msgstr "Correo electrónico" + +#: wp-admin/comment.php:166 wp-admin/includes/media.php:2229 +#: wp-admin/includes/internal-linking.php:79 wp-admin/includes/template.php:361 +#: wp-admin/includes/template.php:730 wp-admin/includes/nav-menu.php:127 +#: wp-admin/includes/nav-menu.php:550 +#: wp-admin/includes/class-wp-links-list-table.php:81 +#: wp-admin/press-this.php:180 +msgid "URL" +msgstr "URL" + +#: wp-includes/comment-template.php:678 wp-includes/comment-template.php:1534 +#: wp-admin/comment.php:171 +msgctxt "noun" +msgid "Comment" +msgstr "Comentario" + +#: wp-includes/functions.php:2710 wp-includes/functions.php:2712 +#: wp-admin/comment.php:176 +msgid "Are you sure you want to do this?" +msgstr "¿Seguro que quieres hacer esto?" + +#: wp-admin/custom-header.php:580 wp-admin/comment.php:182 +#: wp-admin/includes/class-wp-links-list-table.php:110 +msgid "No" +msgstr "No" + +#: wp-admin/comment.php:282 wp-admin/includes/media.php:1767 +msgid "Unknown action." +msgstr "Acción desconocida." + +#: wp-admin/custom-background.php:169 wp-admin/includes/theme.php:305 +msgid "Custom Background" +msgstr "Fondo personalizado" + +#: wp-admin/custom-background.php:172 +msgid "Background updated. Visit your site to see how it looks." +msgstr "Fondo actualizado. Visita tu sitio para ver cómo queda." + +#: wp-admin/custom-header.php:508 wp-admin/custom-background.php:236 +msgid "Choose an image from your computer:" +msgstr "Elige una imagen desde tu ordenador:" + +#: wp-admin/custom-header.php:512 wp-admin/custom-background.php:239 +#: wp-admin/includes/media.php:1579 wp-admin/includes/media.php:1581 +#: wp-admin/includes/class-wp-theme-install-list-table.php:32 +#: wp-admin/includes/template.php:1467 +#: wp-admin/includes/class-wp-plugin-install-list-table.php:32 +msgid "Upload" +msgstr "Subir" + +#: wp-admin/includes/template.php:2202 wp-admin/options.php:219 +msgid "Save Changes" +msgstr "Guardar cambios" + +#: wp-admin/custom-header.php:468 wp-admin/includes/theme.php:307 +msgid "Custom Header" +msgstr "Cabecera personalizada" + +#: wp-admin/custom-header.php:472 +msgid "Header updated. Visit your site to see how it looks." +msgstr "Cabezera actualizada. Visita tu sitio para ver los cambios." + +#: wp-admin/custom-header.php:669 wp-admin/custom-header.php:730 +msgid "Image could not be processed. Please go back and try again." +msgstr "La imagen no se pudo procesar. Por favor, prueba de nuevo." + +#: wp-admin/custom-header.php:669 wp-admin/custom-header.php:730 +msgid "Image Processing Error" +msgstr "Error en el procesado de la imagen" + +#: wp-admin/custom-header.php:686 +msgid "Choose the part of the image you want to use as your header." +msgstr "Elige la parte de la imagen que quieras usar como cabecera." + +#: wp-admin/custom-header.php:780 +msgid "You do not have permission to customize headers." +msgstr "No tienes autorización para personalizar cabeceras." + +#: wp-admin/includes/dashboard.php:590 +#: wp-admin/includes/class-wp-posts-list-table.php:527 +#: wp-admin/includes/class-wp-posts-list-table.php:533 +#: wp-admin/includes/class-wp-terms-list-table.php:255 +#: wp-admin/includes/class-wp-media-list-table.php:205 +#: wp-admin/includes/class-wp-media-list-table.php:218 +#: wp-admin/includes/class-wp-links-list-table.php:136 +msgid "Edit “%s”" +msgstr "Editar “%s”" + +#: wp-includes/script-loader.php:339 wp-includes/script-loader.php:366 +#: wp-admin/includes/dashboard.php:697 +#: wp-admin/includes/class-wp-posts-list-table.php:194 +#: wp-admin/includes/class-wp-posts-list-table.php:542 +#: wp-admin/includes/class-wp-comments-list-table.php:414 +#: wp-admin/includes/class-wp-users-list-table.php:246 +#: wp-admin/includes/class-wp-plugins-list-table.php:387 +#: wp-admin/includes/class-wp-terms-list-table.php:259 +#: wp-admin/includes/class-wp-media-list-table.php:337 +#: wp-admin/includes/class-wp-media-list-table.php:351 +#: wp-admin/includes/post.php:1205 +#: wp-admin/includes/class-wp-links-list-table.php:139 +#: wp-admin/includes/widgets.php:182 wp-admin/includes/meta-boxes.php:84 +#: wp-admin/includes/meta-boxes.php:130 wp-admin/includes/meta-boxes.php:182 +#: wp-admin/edit-form-comment.php:62 +msgid "Edit" +msgstr "Editar" + +#: wp-includes/post-template.php:1376 +#: wp-admin/includes/class-wp-posts-list-table.php:192 +#: wp-admin/includes/class-wp-posts-list-table.php:547 +#: wp-admin/includes/class-wp-comments-list-table.php:195 +#: wp-admin/includes/class-wp-comments-list-table.php:404 +#: wp-admin/includes/class-wp-media-list-table.php:354 +msgid "Restore" +msgstr "Restaurar" + +#: wp-admin/includes/class-wp-posts-list-table.php:549 +#: wp-admin/includes/class-wp-media-list-table.php:340 +#: wp-admin/includes/class-wp-media-list-table.php:356 +msgid "Trash" +msgstr "Papelera" + +#: wp-admin/includes/dashboard.php:701 +#: wp-admin/includes/class-wp-posts-list-table.php:197 +#: wp-admin/includes/class-wp-posts-list-table.php:551 +#: wp-admin/includes/media.php:1315 +#: wp-admin/includes/class-wp-comments-list-table.php:200 +#: wp-admin/includes/class-wp-comments-list-table.php:408 +#: wp-admin/includes/class-wp-media-list-table.php:79 +#: wp-admin/includes/class-wp-media-list-table.php:343 +#: wp-admin/includes/class-wp-media-list-table.php:359 +#: wp-admin/includes/meta-boxes.php:198 wp-admin/edit-form-comment.php:71 +msgid "Delete Permanently" +msgstr "Borrar permanentemente" + +#: wp-admin/includes/class-wp-posts-list-table.php:558 +#: wp-admin/includes/class-wp-media-list-table.php:345 +#: wp-admin/includes/class-wp-media-list-table.php:364 +msgid "View “%s”" +msgstr "Ver “%s”" + +#: wp-admin/includes/class-wp-posts-list-table.php:558 +#: wp-admin/includes/class-wp-terms-list-table.php:264 +#: wp-admin/includes/class-wp-media-list-table.php:345 +#: wp-admin/includes/class-wp-media-list-table.php:364 +msgid "View" +msgstr "Ver" + +#: wp-admin/includes/class-wp-posts-list-table.php:639 +#: wp-admin/includes/class-wp-media-list-table.php:250 +msgid "No Tags" +msgstr "Sin etiquetas" + +#: wp-admin/includes/class-wp-posts-list-table.php:571 +#: wp-admin/includes/class-wp-media-list-table.php:265 +msgid "Unpublished" +msgstr "Sin publicar" + +#: wp-admin/includes/dashboard.php:590 +#: wp-admin/includes/class-wp-posts-list-table.php:574 +#: wp-admin/includes/class-wp-media-list-table.php:267 +msgid "Y/m/d g:i:s A" +msgstr "d/m/Y G:i" + +#: wp-admin/includes/class-wp-media-list-table.php:272 +msgid "%s from now" +msgstr "%s desde ahora" + +#: wp-admin/includes/class-wp-posts-list-table.php:581 +#: wp-admin/includes/plugin-install.php:313 +#: wp-admin/includes/class-wp-comments-list-table.php:333 +#: wp-admin/includes/theme-install.php:165 +#: wp-admin/includes/class-wp-media-list-table.php:274 +#: wp-content/plugins/akismet/admin.php:369 +#: wp-content/plugins/akismet/admin.php:397 +msgid "%s ago" +msgstr "hace %s" + +#: wp-admin/includes/class-wp-media-list-table.php:297 +msgid "(Unattached)" +msgstr "(Sin adjuntar)" + +#: wp-admin/includes/class-wp-media-list-table.php:298 +#: wp-admin/includes/class-wp-media-list-table.php:347 +msgid "Attach" +msgstr "Adjuntar" + +#: wp-admin/includes/class-wp-list-table.php:429 +msgid "%s pending" +msgstr "%s pendientes" + +#: wp-admin/includes/class-wp-media-list-table.php:126 +msgid "No media attachments found." +msgstr "No se han encontrado adjuntos." + +#: wp-admin/link-manager.php:64 wp-admin/edit-comments.php:143 +#: wp-admin/edit.php:191 wp-admin/upload.php:159 wp-admin/users.php:369 +#: wp-admin/plugins.php:387 wp-admin/edit-tags.php:242 +msgid "Search results for “%s”" +msgstr "Resultados de búsqueda para “%s”" + +#: wp-admin/edit-comments.php:173 +msgid "%s comment approved" +msgid_plural "%s comments approved" +msgstr[0] "%s comentario aprobado" +msgstr[1] "%s comentarios aprobados" + +#: wp-admin/edit-comments.php:177 +msgid "%s comment marked as spam." +msgid_plural "%s comments marked as spam." +msgstr[0] "%s comentario marcado como spam." +msgstr[1] "%s comentarios marcados como spam." + +#: wp-includes/js/tinymce/langs/wp-langs.php:267 +#: wp-includes/js/tinymce/wp-mce-help.php:236 wp-admin/edit-comments.php:177 +#: wp-admin/edit-comments.php:185 wp-admin/edit.php:223 wp-admin/upload.php:182 +#: wp-admin/upload.php:194 wp-admin/includes/image-edit.php:56 +#: wp-admin/includes/media.php:1324 wp-admin/includes/template.php:406 +#: wp-admin/includes/template.php:409 +msgid "Undo" +msgstr "Deshacer" + +#: wp-admin/edit-comments.php:181 +msgid "%s comment restored from the spam" +msgid_plural "%s comments restored from the spam" +msgstr[0] "%s comentario recuperado de spam" +msgstr[1] "%s comentarios recuperados de spam" + +#: wp-admin/edit-comments.php:192 +msgid "%s comment permanently deleted" +msgid_plural "%s comments permanently deleted" +msgstr[0] "%s comentario borrado permanentemente" +msgstr[1] "%s comentarios borrados permanentemente" + +#: wp-admin/includes/class-wp-comments-list-table.php:146 +msgctxt "comments" +msgid "All" +msgid_plural "All" +msgstr[0] "Todo" +msgstr[1] "Todos" + +#: wp-admin/includes/class-wp-comments-list-table.php:147 +msgid "Pending (%s)" +msgid_plural "Pending (%s)" +msgstr[0] "Pendiente (%s)" +msgstr[1] "Pendientes (%s)" + +#: wp-admin/includes/class-wp-comments-list-table.php:148 +msgid "Approved" +msgid_plural "Approved" +msgstr[0] "Aprobado" +msgstr[1] "Aprobados" + +#: wp-admin/includes/class-wp-comments-list-table.php:149 +msgid "Spam (%s)" +msgid_plural "Spam (%s)" +msgstr[0] "Spam (%s)" +msgstr[1] "Spam (%s)" + +#: wp-admin/includes/class-wp-comments-list-table.php:150 +msgid "Trash (%s)" +msgid_plural "Trash (%s)" +msgstr[0] "Papelera (%s)" +msgstr[1] "Papelera (%s)" + +#: wp-admin/edit-comments.php:217 +msgid "Search Comments" +msgstr "Buscar comentarios" + +#: wp-admin/includes/deprecated.php:563 +msgid "Displaying %s–%s of %s" +msgstr "Mostrando %s–%s de %s" + +#: wp-admin/includes/class-wp-list-table.php:290 +msgid "Bulk Actions" +msgstr "Acciones en lote" + +#: wp-admin/includes/dashboard.php:696 +#: wp-admin/includes/class-wp-comments-list-table.php:188 +#: wp-admin/includes/class-wp-comments-list-table.php:391 +#: wp-admin/includes/class-wp-comments-list-table.php:396 +msgid "Unapprove" +msgstr "Rechazar" + +#: wp-admin/includes/dashboard.php:695 +#: wp-admin/includes/class-wp-comments-list-table.php:190 +#: wp-admin/includes/class-wp-comments-list-table.php:393 +#: wp-admin/includes/class-wp-comments-list-table.php:395 +msgid "Approve" +msgstr "Aprobar" + +#: wp-content/plugins/akismet/legacy.php:288 +msgid "Not Spam" +msgstr "No es spam" + +#: wp-admin/includes/class-wp-posts-list-table.php:199 +#: wp-admin/includes/media.php:1323 +#: wp-admin/includes/class-wp-comments-list-table.php:202 +#: wp-admin/includes/meta-boxes.php:200 wp-admin/edit-form-comment.php:71 +msgid "Move to Trash" +msgstr "Mover a la papelera" + +#: wp-includes/js/tinymce/langs/wp-langs.php:16 +#: wp-admin/includes/template.php:1954 +#: wp-admin/includes/class-wp-list-table.php:300 +msgid "Apply" +msgstr "Aplicar" + +#: wp-admin/includes/class-wp-comments-list-table.php:215 +msgid "Show all comment types" +msgstr "Mostrar todos los comentarios" + +#: wp-includes/theme-compat/comments-popup.php:33 +#: wp-admin/edit-form-advanced.php:143 wp-admin/edit-comments.php:110 +#: wp-admin/edit-comments.php:140 +#: wp-admin/includes/class-wp-posts-list-table.php:284 +#: wp-admin/includes/class-wp-posts-list-table.php:901 +#: wp-admin/includes/class-wp-comments-list-table.php:218 +#: wp-admin/includes/file.php:16 wp-admin/includes/template.php:1468 +#: wp-admin/includes/template.php:1781 +#: wp-content/plugins/akismet/legacy.php:214 +msgid "Comments" +msgstr "Comentarios" + +#: wp-admin/includes/class-wp-posts-list-table.php:910 +#: wp-admin/includes/class-wp-comments-list-table.php:219 +msgid "Pings" +msgstr "Pings" + +#: wp-admin/includes/class-wp-posts-list-table.php:225 +#: wp-admin/includes/class-wp-comments-list-table.php:227 +#: wp-admin/includes/class-wp-media-list-table.php:96 +#: wp-admin/includes/class-wp-links-list-table.php:71 +msgid "Filter" +msgstr "Filtrar" + +#: wp-admin/includes/class-wp-comments-list-table.php:232 +msgid "Empty Spam" +msgstr "Vaciar spam" + +#: wp-admin/includes/class-wp-posts-list-table.php:229 +#: wp-admin/includes/class-wp-comments-list-table.php:232 +#: wp-admin/includes/class-wp-media-list-table.php:102 +msgid "Empty Trash" +msgstr "Vaciar papelera" + +#: wp-admin/includes/class-wp-comments-list-table.php:133 +msgid "No comments awaiting moderation… yet." +msgstr "No hay comentarios pendientes de moderación." + +#: wp-admin/includes/class-wp-comments-list-table.php:135 +msgid "No comments found." +msgstr "Sin comentarios." + +#: wp-admin/edit-form-advanced.php:33 +msgid "Post updated. View post" +msgstr "Entrada actualizada. Vista previa" + +#: wp-admin/edit-form-advanced.php:34 wp-admin/edit-form-advanced.php:50 +msgid "Custom field updated." +msgstr "Campo personalizado actualizado." + +#: wp-admin/edit-form-advanced.php:35 wp-admin/edit-form-advanced.php:51 +msgid "Custom field deleted." +msgstr "Campo personalizado borrado." + +#: wp-admin/edit-form-advanced.php:36 +msgid "Post updated." +msgstr "Entrada actualizada." + +#: wp-admin/edit-form-advanced.php:38 +msgid "Post restored to revision from %s" +msgstr "Entrada restaurada a la revisión %s" + +#: wp-admin/edit-form-advanced.php:39 +msgid "Post published. View post" +msgstr "Entrada publicada. Ver entrada" + +#: wp-admin/edit-form-advanced.php:40 +msgid "Post saved." +msgstr "Entrada guardada." + +#: wp-admin/edit-form-advanced.php:41 +msgid "Post submitted. Preview post" +msgstr "Entrada enviada. Vista previa" + +#: wp-admin/edit-form-advanced.php:42 +msgid "Post scheduled for: %1$s. Preview post" +msgstr "Entrada programada el: %1$s. Vista previa" + +#: wp-admin/edit-form-advanced.php:44 wp-admin/edit-form-advanced.php:57 +#: wp-admin/includes/meta-boxes.php:159 wp-admin/edit-form-comment.php:58 +msgid "M j, Y @ G:i" +msgstr "j F Y G:i a" + +#: wp-admin/edit-form-advanced.php:45 +msgid "Post draft updated. Preview post" +msgstr "Entrada actualizada. Vista previa" + +#: wp-admin/edit-form-advanced.php:49 +msgid "Page updated. View page" +msgstr "Página actualizada. Vista previa" + +#: wp-admin/edit-form-advanced.php:52 +msgid "Page updated." +msgstr "Página actualizada." + +#: wp-admin/edit-form-advanced.php:53 +msgid "Page restored to revision from %s" +msgstr "Página restaurada desde la revisión %s" + +#: wp-admin/edit-form-advanced.php:54 +msgid "Page published. View page" +msgstr "Página publicada. Vista previa" + +#: wp-admin/edit-form-advanced.php:56 +msgid "Page submitted. Preview page" +msgstr "Página enviada. Vista previa" + +#: wp-admin/edit-form-advanced.php:57 +msgid "Page scheduled for: %1$s. Preview page" +msgstr "Página programada para: %1$s. Vista previa" + +#: wp-admin/edit-form-advanced.php:58 +msgid "Page draft updated. Preview page" +msgstr "Borrador de página actualizado. Vista previa" + +#: wp-admin/edit-form-advanced.php:91 +msgid "There is an autosave of this post that is more recent than the version below. View the autosave" +msgstr "Hay una copia automática de esta entrada con fecha más reciente que la de la versión mostrada. Ver la copia automática" + +#: wp-includes/script-loader.php:345 wp-admin/edit-form-advanced.php:103 +#: wp-admin/includes/dashboard.php:559 wp-admin/includes/meta-boxes.php:215 +#: wp-admin/includes/meta-boxes.php:216 wp-admin/press-this.php:490 +msgid "Publish" +msgstr "Publicar" + +#: wp-admin/edit-form-advanced.php:123 +msgid "Attributes" +msgstr "Atributos" + +#: wp-includes/post.php:4689 wp-admin/edit-form-advanced.php:130 +#: wp-admin/includes/meta-boxes.php:382 +msgid "Excerpt" +msgstr "Extracto" + +#: wp-admin/edit-form-advanced.php:133 +msgid "Send Trackbacks" +msgstr "Enviar trackbacks" + +#: wp-admin/edit-form-advanced.php:136 +msgid "Custom Fields" +msgstr "Campos personalizados" + +#: wp-admin/edit-form-advanced.php:140 wp-admin/includes/dashboard.php:332 +#: wp-admin/menu.php:231 +msgid "Discussion" +msgstr "Comentarios" + +#: wp-admin/edit-form-advanced.php:146 +#: wp-admin/includes/class-wp-posts-list-table.php:749 +#: wp-admin/includes/class-wp-terms-list-table.php:102 +#: wp-admin/includes/class-wp-terms-list-table.php:344 +#: wp-admin/includes/meta-boxes.php:509 +msgid "Slug" +msgstr "Slug" + +#: wp-includes/post.php:70 wp-admin/revision.php:97 wp-admin/revision.php:123 +#: wp-admin/edit-form-advanced.php:154 +msgid "Revisions" +msgstr "Revisiones" + +#: wp-admin/edit-form-advanced.php:280 wp-admin/admin-ajax.php:1542 +msgid "Last edited by %1$s on %2$s at %3$s" +msgstr "Última edición por %1$s el %2$s a las %3$s" + +#: wp-admin/edit-form-advanced.php:282 wp-admin/admin-ajax.php:1544 +msgid "Last edited on %1$s at %2$s" +msgstr "Última edición el %1$s a las %2$s" + +#: wp-admin/edit-form-comment.php:17 +msgid "Editing Comment # %s" +msgstr "Editando comentario # %s" + +#: wp-admin/edit-form-comment.php:42 +msgid "View Comment" +msgstr "Ver comentario" + +#: wp-includes/comment.php:389 wp-admin/edit-form-comment.php:50 +msgctxt "adjective" +msgid "Approved" +msgstr "Aprobado" + +#: wp-includes/comment.php:391 wp-admin/edit-form-comment.php:52 +msgctxt "adjective" +msgid "Spam" +msgstr "Spam" + +#: wp-admin/edit-form-comment.php:59 +msgid "Submitted on: %1$s" +msgstr "Enviado el: %1$s" + +#: wp-admin/includes/template.php:372 wp-admin/edit-form-comment.php:74 +msgid "Update Comment" +msgstr "Actualizar comentario" + +#: wp-admin/edit-form-comment.php:91 +msgid "Name:" +msgstr "Nombre:" + +#: wp-admin/edit-form-comment.php:98 +msgid "E-mail (%s):" +msgstr "Correo electrónico (%s):" + +#: wp-admin/edit-form-comment.php:98 +msgid "send e-mail" +msgstr "enviar correo electrónico" + +#: wp-admin/edit-form-comment.php:100 +msgid "E-mail:" +msgstr "Correo electrónico:" + +#: wp-admin/edit-form-comment.php:109 +msgid "visit site" +msgstr "visitar sitio" + +#: wp-admin/edit-form-comment.php:110 +msgid "URL (%s):" +msgstr "URL (%s):" + +#: wp-admin/edit-form-comment.php:112 +msgid "URL:" +msgstr "URL:" + +#: wp-includes/taxonomy.php:62 wp-admin/menu.php:97 +msgid "Link Categories" +msgstr "Categorías de enlaces" + +#: wp-includes/taxonomy.php:401 +msgid "Search Categories" +msgstr "Buscar categorías" + +#: wp-admin/includes/class-wp-themes-list-table.php:171 +#: wp-admin/includes/media.php:1317 +#: wp-admin/includes/class-wp-users-list-table.php:130 +#: wp-admin/includes/class-wp-users-list-table.php:252 +#: wp-admin/includes/template.php:505 +#: wp-admin/includes/class-wp-plugins-list-table.php:268 +#: wp-admin/includes/class-wp-plugins-list-table.php:373 +#: wp-admin/includes/class-wp-plugins-list-table.php:382 +#: wp-admin/includes/class-wp-terms-list-table.php:83 +#: wp-admin/includes/class-wp-terms-list-table.php:263 +#: wp-admin/includes/class-wp-links-list-table.php:47 +#: wp-admin/includes/class-wp-links-list-table.php:140 +#: wp-admin/includes/widgets.php:206 wp-admin/includes/meta-boxes.php:627 +#: wp-admin/widgets.php:314 +msgid "Delete" +msgstr "Borrar" + +#: wp-admin/edit-tags.php:342 wp-admin/edit-tag-form.php:48 +msgid "The “slug” is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens." +msgstr "El “slug” es la versión amigable de la URL del nombre. Suele estar en minúsculas y contiene sólo letras, números y guiones." + +#: wp-admin/edit-tags.php:357 +msgid "The description is not prominent by default; however, some themes may show it." +msgstr "La descripción no suele mostrarse por defecto, sin embargo hay algunos temas que puede que la muestren." + +#: wp-includes/taxonomy.php:67 +msgid "Edit Link Category" +msgstr "Editar categoría del enlace" + +#: wp-includes/taxonomy.php:408 +msgid "Update Category" +msgstr "Actualizar categoría" + +#: wp-admin/edit-link-form.php:14 +msgid "Links / Edit Link" +msgstr "Enlaces / Editar enlace" + +#: wp-admin/edit-link-form.php:15 wp-admin/includes/meta-boxes.php:633 +msgid "Update Link" +msgstr "Actualizar enlace" + +#: wp-admin/edit-link-form.php:19 +msgid "Links / Add New Link" +msgstr "Enlaces / Añadir nuevo enlace" + +#: wp-includes/script-loader.php:280 wp-admin/edit-link-form.php:20 +#: wp-admin/includes/meta-boxes.php:635 +msgid "Add Link" +msgstr "Añadir enlace" + +#: wp-includes/js/tinymce/langs/wp-langs.php:110 wp-admin/edit-link-form.php:27 +#: wp-admin/includes/image-edit.php:75 wp-admin/includes/nav-menu.php:516 +#: wp-admin/includes/post.php:1779 wp-admin/includes/widgets.php:211 +#: wp-admin/includes/meta-boxes.php:25 wp-admin/includes/meta-boxes.php:602 +msgid "Save" +msgstr "Guardar" + +#: wp-includes/theme-compat/sidebar.php:63 +#: wp-includes/category-template.php:427 wp-includes/default-widgets.php:422 +#: wp-includes/default-widgets.php:428 wp-admin/edit-link-form.php:28 +#: wp-admin/includes/class-wp-posts-list-table.php:277 +#: wp-admin/includes/class-wp-links-list-table.php:82 +#: wp-admin/press-this.php:518 +msgid "Categories" +msgstr "Categorías" + +#: wp-includes/js/tinymce/langs/wp-langs.php:344 +#: wp-includes/js/tinymce/langs/wp-langs.php:395 wp-admin/edit-link-form.php:29 +#: wp-admin/includes/meta-boxes.php:699 +msgid "Target" +msgstr "Destino" + +#: wp-admin/edit-link-form.php:30 wp-admin/includes/nav-menu.php:161 +#: wp-admin/includes/nav-menu.php:1144 +msgid "Link Relationship (XFN)" +msgstr "Relación con el enlace (XFN)" + +#: wp-includes/js/tinymce/langs/wp-langs.php:358 +#: wp-includes/js/tinymce/wp-mce-help.php:201 wp-admin/edit-link-form.php:31 +msgid "Advanced" +msgstr "Avanzado" + +#: wp-admin/edit-link-form.php:59 +msgid "Link added." +msgstr "Enlace añadido." + +#: wp-includes/theme-compat/comments.php:78 +#: wp-includes/theme-compat/comments-popup.php:75 +#: wp-includes/comment-template.php:1523 +#: wp-admin/includes/class-wp-users-list-table.php:164 +#: wp-admin/includes/template.php:351 wp-admin/user-edit.php:233 +msgid "Name" +msgstr "Nombre" + +#: wp-admin/edit-link-form.php:89 +msgid "Example: Nifty blogging software" +msgstr "Ejemplo: Estupendo software de publicación" + +#: wp-admin/edit-link-form.php:94 +msgid "Web Address" +msgstr "Dirección web" + +#: wp-admin/edit-link-form.php:97 +msgid "Example: http://wordpress.org/ — don’t forget the http://" +msgstr "Ejemplo: http://wordpress.org/ —no olvides poner http://" + +#: wp-admin/edit-link-form.php:102 wp-admin/themes.php:213 +#: wp-admin/includes/media.php:1098 +#: wp-admin/includes/class-wp-plugins-list-table.php:194 +#: wp-admin/includes/nav-menu.php:167 wp-admin/includes/nav-menu.php:1145 +#: wp-admin/includes/class-wp-terms-list-table.php:101 +#: wp-admin/includes/class-wp-plugin-install-list-table.php:144 +#: wp-admin/press-this.php:151 wp-admin/press-this.php:186 +msgid "Description" +msgstr "Descripción" + +#: wp-admin/edit-link-form.php:105 +msgid "This will be shown when someone hovers over the link in the blogroll, or optionally below the link." +msgstr "Esto se mostrará cuando alguien pase el cursor sobre el enlace en los sitios de interés, u opcionalmente a debajo del enlace." + +#: wp-admin/edit-tags.php:336 wp-admin/edit-tag-form.php:42 +msgid "The name is how it appears on your site." +msgstr "El nombre es cómo aparecerá en tu sitio." + +#: wp-includes/deprecated.php:707 wp-includes/js/tinymce/langs/wp-langs.php:484 +#: wp-admin/includes/media.php:850 wp-admin/includes/media.php:944 +#: wp-admin/includes/media.php:2131 wp-admin/includes/media.php:2147 +#: wp-admin/includes/class-wp-users-list-table.php:264 +#: wp-admin/edit-tags.php:348 wp-admin/edit-tag-form.php:55 +msgid "None" +msgstr "Ninguna" + +#: wp-admin/edit-tags.php:350 wp-admin/edit-tag-form.php:57 +msgid "Categories, unlike tags, can have a hierarchy. You might have a Jazz category, and under that have children categories for Bebop and Big Band. Totally optional." +msgstr "Las categorías, a diferencia de las etiquetas, pueden tener jerarquías. Podrías tener una categoría de Jazz, y por debajo las categorías Bebop y Big Band. Totalmente opcional." + +#: wp-admin/edit-tag-form.php:65 +msgid "The description is not prominent by default, however some themes may show it." +msgstr "La descripción no suele mostrarse por defecto, sin embargo hay algunas plantillas que puede que la muestren." + +#: wp-includes/taxonomy.php:1972 wp-includes/taxonomy.php:2274 +#: wp-admin/includes/class-wp-terms-list-table.php:23 +msgid "Invalid taxonomy" +msgstr "Taxonomia no válida" + +#: wp-includes/taxonomy.php:406 +msgid "Edit Tag" +msgstr "Editar etiqueta" + +#: wp-admin/edit-tags.php:229 +msgid "Item added." +msgstr "Añadido." + +#: wp-admin/edit-tags.php:230 +msgid "Item deleted." +msgstr "Eliminado." + +#: wp-admin/edit-tags.php:231 +msgid "Item updated." +msgstr "Actualizado." + +#: wp-admin/edit-tags.php:232 +msgid "Item not added." +msgstr "No añadido." + +#: wp-admin/edit-tags.php:234 +msgid "Items deleted." +msgstr "Eliminados." + +#: wp-admin/edit-tags.php:275 +msgid "Note:
    Deleting a category does not delete the posts in that category. Instead, posts that were only assigned to the deleted category are set to the category %s." +msgstr "Nota:
    Al borrar una categoría no borrarás las entradas que hay en ella. En su lugar, las entradas que sólo estén asignadas a esa categoría se asignarán a la categoría %s." + +#: wp-admin/upload.php:98 +msgid "Error in moving to trash..." +msgstr "Error al mover a la papelera..." + +#: wp-admin/upload.php:108 +msgid "Error in restoring from trash..." +msgstr "Error al restaurar de la papelera..." + +#: wp-admin/edit.php:109 wp-admin/post.php:248 +msgid "You are not allowed to delete this item." +msgstr "No tienes autorización para borrar este elemento." + +#: wp-admin/edit.php:113 wp-admin/edit.php:116 wp-admin/upload.php:118 +msgid "Error in deleting..." +msgstr "Error al borrar..." + +#: wp-includes/post.php:1179 wp-admin/menu.php:77 +msgctxt "post" +msgid "Add New" +msgstr "Añadir nueva" + +#: wp-admin/edit.php:196 +msgid "This has been saved." +msgstr "Se ha guardado." + +#: wp-includes/post.php:1183 wp-admin/edit.php:196 +#: wp-content/plugins/akismet/legacy.php:294 +msgid "View Post" +msgstr "Ver entrada" + +#: wp-includes/post.php:1181 wp-admin/edit.php:196 wp-admin/press-this.php:600 +msgid "Edit Post" +msgstr "Editar entrada" + +#: wp-admin/edit.php:203 +msgid "%s post updated." +msgid_plural "%s posts updated." +msgstr[0] "%s entrada actualizada." +msgstr[1] "%s entradas actualizadas." + +#: wp-admin/edit.php:211 +msgid "%s item not updated, somebody is editing it." +msgid_plural "%s items not updated, somebody is editing them." +msgstr[0] "%s no se ha actualizado, alguien lo está editando." +msgstr[1] "%s no se han actualizado, alguien los está editando." + +#: wp-admin/edit.php:216 +msgid "Item permanently deleted." +msgid_plural "%s items permanently deleted." +msgstr[0] "Borrado permanentemente." +msgstr[1] "%s borrados permanentemente." + +#: wp-admin/includes/class-wp-posts-list-table.php:145 +msgctxt "posts" +msgid "Mine (%s)" +msgid_plural "Mine (%s)" +msgstr[0] "Mío (%s)" +msgstr[1] "Míos (%s)" + +#: wp-admin/includes/class-wp-posts-list-table.php:156 +msgctxt "posts" +msgid "All (%s)" +msgid_plural "All (%s)" +msgstr[0] "Todo (%s)" +msgstr[1] "Todos (%s)" + +#: wp-admin/includes/media.php:2018 +#: wp-admin/includes/class-wp-list-table.php:374 +msgid "Show all dates" +msgstr "Mostrar todas las fechas" + +#: wp-admin/includes/class-wp-posts-list-table.php:215 +#: wp-admin/includes/class-wp-links-list-table.php:64 +msgid "View all categories" +msgstr "Ver todas las categorías" + +#: wp-admin/includes/class-wp-list-table.php:402 +msgid "List View" +msgstr "Ver lista" + +#: wp-admin/includes/class-wp-list-table.php:403 +msgid "Excerpt View" +msgstr "Ver extracto" + +#: wp-admin/export.php:17 wp-admin/menu.php:221 +msgid "Export" +msgstr "Exportar" + +#: wp-admin/export.php:121 +msgid "When you click the button below WordPress will create an XML file for you to save to your computer." +msgstr "Cuando hagas clic en el botón de abajo, WordPress creará un archivo XML para que lo guardes en tu ordenador." + +#: wp-admin/export.php:122 +msgid "This format, which we call WordPress eXtended RSS or WXR, will contain your posts, pages, comments, custom fields, categories, and tags." +msgstr "Este formato, que llamamos WordPress eXtended RSS (RSS ampliado de WordPress) o WXR, contendrá todas tus entradas, comentarios, campos personalizados, categorías y etiquetas." + +#: wp-admin/export.php:202 +msgid "Download Export File" +msgstr "Descargar el archivo de exportación" + +#: wp-admin/import.php:93 +msgid "No importers are available." +msgstr "No hay importadores disponibles." + +#: wp-admin/upgrade.php:62 wp-admin/upgrade.php:94 +#: wp-admin/includes/media.php:1319 +msgid "Continue" +msgstr "Continuar" + +#: wp-admin/export.php:131 wp-admin/includes/class-wp-users-list-table.php:167 +#: wp-admin/includes/class-wp-terms-list-table.php:110 wp-admin/menu.php:74 +msgid "Posts" +msgstr "Entradas" + +#: wp-admin/import.php:30 +msgid "Blogger" +msgstr "Blogger" + +#: wp-admin/users.php:17 wp-admin/includes/template.php:1473 +#: wp-admin/menu.php:196 +msgid "Users" +msgstr "Usuarios" + +#: wp-includes/script-loader.php:434 +msgid "Done" +msgstr "Hecho" + +#: wp-includes/comment-template.php:30 wp-includes/theme.php:236 +msgid "Anonymous" +msgstr "Anónimo" + +#: wp-admin/import.php:32 +msgid "LiveJournal" +msgstr "LiveJournal" + +#: wp-admin/options-reading.php:91 wp-admin/options-reading.php:92 +#: wp-admin/includes/template.php:548 wp-admin/widgets.php:295 +msgid "— Select —" +msgstr "— Seleccionar —" + +#: wp-includes/post-template.php:1216 wp-admin/includes/dashboard.php:186 +msgid "Submit" +msgstr "Enviar" + +#: wp-admin/import.php:33 +msgid "Movable Type and TypePad" +msgstr "Movable Type y TypePad" + +#: wp-admin/import.php:34 wp-admin/includes/upgrade.php:129 +msgid "Blogroll" +msgstr "Sitios de interés" + +#: wp-includes/default-widgets.php:698 wp-admin/import.php:35 +msgid "RSS" +msgstr "RSS" + +#: wp-includes/functions.php:2375 +msgid "Invalid file type" +msgstr "Tipo de archivo no válido" + +#: wp-admin/includes/bookmark.php:192 +msgid "Could not update link in the database" +msgstr "No ha sido posible actualizar el enlace en la base de datos." + +#: wp-admin/includes/bookmark.php:199 +msgid "Could not insert link into the database" +msgstr "No ha sido posible insertar el enlace en la base de datos." + +#: wp-admin/includes/class-wp-filesystem-base.php:212 +msgid "Changing to %s" +msgstr "Cambiando a %s" + +#: wp-admin/includes/class-wp-filesystem-base.php:221 +msgid "Found %s" +msgstr "Encontrado %s" + +#: wp-admin/includes/class-wp-filesystem-ftpext.php:28 +msgid "The ftp PHP extension is not available" +msgstr "La extensión PHP de FTP no está disponible." + +#: wp-admin/includes/class-wp-filesystem-ftpsockets.php:38 +#: wp-admin/includes/class-wp-filesystem-ftpext.php:44 +msgid "FTP hostname is required" +msgstr "El nombre del servidor del FTP es necesario" + +#: wp-admin/includes/class-wp-filesystem-ftpsockets.php:47 +#: wp-admin/includes/class-wp-filesystem-ftpext.php:53 +msgid "FTP username is required" +msgstr "El nombre de usuario del FTP es necesario" + +#: wp-admin/includes/class-wp-filesystem-ftpsockets.php:52 +#: wp-admin/includes/class-wp-filesystem-ftpext.php:58 +msgid "FTP password is required" +msgstr "La contraseña del FTP es necesaria" + +#: wp-admin/includes/class-wp-filesystem-ftpsockets.php:64 +#: wp-admin/includes/class-wp-filesystem-ftpsockets.php:69 +#: wp-admin/includes/class-wp-filesystem-ftpext.php:74 +msgid "Failed to connect to FTP Server %1$s:%2$s" +msgstr "Ha sido imposible conectar con el servidor FTP %1$s:%2$s" + +#: wp-admin/includes/class-wp-filesystem-ssh2.php:117 +#: wp-admin/includes/class-wp-filesystem-ftpsockets.php:74 +#: wp-admin/includes/class-wp-filesystem-ftpext.php:79 +msgid "Username/Password incorrect for %s" +msgstr "Nombre de usuario y/o contraseña incorrecto/s para %s" + +#: wp-admin/includes/class-wp-filesystem-ssh2.php:57 +msgid "The ssh2 PHP extension is not available" +msgstr "La extesión PHP de SSH2 no está disponible" + +#: wp-admin/includes/class-wp-filesystem-ssh2.php:61 +msgid "The ssh2 PHP extension is available, however, we require the PHP5 function stream_get_contents()" +msgstr "La extensión ssh2 de PHP está disponible, no obstante es necesaria la función de PHP5 stream_get_contents()" + +#: wp-admin/includes/class-wp-filesystem-ssh2.php:72 +msgid "SSH2 hostname is required" +msgstr "El nombre del servidor del SSH2 es necesario" + +#: wp-admin/includes/class-wp-filesystem-ssh2.php:88 +msgid "SSH2 username is required" +msgstr "El nombre de usuario del SSH2 es necesario" + +#: wp-admin/includes/class-wp-filesystem-ssh2.php:96 +msgid "SSH2 password is required" +msgstr "La contraseña del SSH2 es necesaria" + +#: wp-admin/includes/class-wp-filesystem-ssh2.php:111 +msgid "Failed to connect to SSH2 Server %1$s:%2$s" +msgstr "Ha sido imposible conectar con el SSH2 %1$s:%2$s" + +#: wp-admin/includes/class-wp-filesystem-ssh2.php:122 +msgid "Public and Private keys incorrect for %s" +msgstr "Claves públicas y privadas incorrectas para %s" + +#: wp-admin/includes/class-wp-filesystem-ssh2.php:138 +msgid "Unable to perform command: %s" +msgstr "No se pudo realizar el comando: %s" + +#: wp-admin/includes/class-wp-upgrader.php:41 +msgid "Invalid Data provided." +msgstr "Datos facilitado no válidos." + +#: wp-admin/includes/file.php:518 wp-admin/includes/class-wp-upgrader.php:42 +#: wp-admin/includes/plugin.php:684 wp-admin/includes/theme.php:85 +msgid "Could not access filesystem." +msgstr "No ha sido posible acceder al sistema de archivos." + +#: wp-admin/includes/class-wp-upgrader.php:43 wp-admin/includes/plugin.php:687 +#: wp-admin/includes/theme.php:88 +msgid "Filesystem error." +msgstr "Error del sistema de archivos." + +#: wp-admin/includes/class-wp-upgrader.php:44 +msgid "Unable to locate WordPress Root directory." +msgstr "Ha sido imposible localizar el directorio de WordPress." + +#: wp-admin/includes/class-wp-upgrader.php:45 +msgid "Unable to locate WordPress Content directory (wp-content)." +msgstr "Ha sido imposible localizar el directorio de contenidos de WordPress (wp-content)." + +#: wp-admin/includes/class-wp-upgrader.php:46 wp-admin/includes/plugin.php:692 +msgid "Unable to locate WordPress Plugin directory." +msgstr "Ha sido imposible localizar el directorio de plugins de WordPress." + +#: wp-admin/includes/class-wp-upgrader.php:47 +msgid "Unable to locate WordPress Theme directory." +msgstr "Ha sido imposible localizar el directorio de temas de WordPress." + +#: wp-admin/includes/class-wp-upgrader.php:49 +msgid "Unable to locate needed folder (%s)." +msgstr "Ha sido imposible localizar la carpeta %s." + +#: wp-admin/includes/class-wp-upgrader.php:51 +msgid "Download failed." +msgstr "Descarga fallida." + +#: wp-admin/includes/class-wp-upgrader.php:52 +#: wp-admin/includes/update-core.php:368 +msgid "Installing the latest version…" +msgstr "Instalando última versión…" + +#: wp-admin/includes/class-wp-upgrader.php:53 +msgid "Destination folder already exists." +msgstr "La carpeta ya existe." + +#: wp-admin/includes/file.php:612 wp-admin/includes/file.php:704 +#: wp-admin/includes/file.php:763 wp-admin/includes/class-wp-upgrader.php:54 +#: wp-admin/includes/update-core.php:513 +msgid "Could not create directory." +msgstr "No ha sido posible crear el directorio" + +#: wp-admin/includes/file.php:578 wp-admin/includes/file.php:672 +#: wp-admin/includes/class-wp-upgrader.php:55 +msgid "Incompatible Archive." +msgstr "Archivo incompatible." + +#: wp-admin/includes/class-wp-upgrader.php:57 +msgid "Enabling Maintenance mode…" +msgstr "Activando el modo mantenimiento…" + +#: wp-admin/includes/class-wp-upgrader.php:58 +msgid "Disabling Maintenance mode…" +msgstr "Desactivando el modo de mantenimiento…" + +#: wp-admin/includes/class-wp-upgrader.php:369 +msgid "The plugin is at the latest version." +msgstr "Tienes la última versión del plugin." + +#: wp-admin/includes/class-wp-upgrader.php:371 +#: wp-admin/includes/class-wp-upgrader.php:611 +#: wp-admin/includes/class-wp-upgrader.php:864 +msgid "Downloading update from %s…" +msgstr "Descargando paquete de instalación desde %s…" + +#: wp-admin/includes/class-wp-upgrader.php:372 +#: wp-admin/includes/class-wp-upgrader.php:612 +#: wp-admin/includes/class-wp-upgrader.php:865 +msgid "Unpacking the update…" +msgstr "Descomprimiendo actualización…" + +#: wp-admin/includes/class-wp-upgrader.php:373 +msgid "Deactivating the plugin…" +msgstr "Desactivando el plugin…" + +#: wp-admin/includes/class-wp-upgrader.php:374 +msgid "Removing the old version of the plugin…" +msgstr "Eliminando la antigua versión del plugin…" + +#: wp-admin/includes/class-wp-upgrader.php:375 +msgid "Could not remove the old plugin." +msgstr "No ha sido posible eliminar la versión anterior del plugin." + +#: wp-admin/includes/class-wp-upgrader.php:381 +#: wp-admin/includes/class-wp-upgrader.php:620 +msgid "Install package not available." +msgstr "El paquete de instalación no está disponible." + +#: wp-admin/includes/class-wp-upgrader.php:382 +#: wp-admin/includes/class-wp-upgrader.php:621 +msgid "Downloading install package from %s…" +msgstr "Descargando el archivo de instalación de %s…" + +#: wp-admin/includes/class-wp-upgrader.php:383 +#: wp-admin/includes/class-wp-upgrader.php:622 +msgid "Unpacking the package…" +msgstr "Descomprimiendo…" + +#: wp-admin/includes/class-wp-upgrader.php:384 +msgid "Installing the plugin…" +msgstr "Instalando el plugin…" + +#: wp-admin/includes/class-wp-upgrader.php:385 +msgid "Plugin install failed." +msgstr "Fallo en la instalación del plugin." + +#: wp-admin/includes/class-wp-upgrader.php:386 +msgid "Plugin installed successfully." +msgstr "Plugin instalado correctamente." + +#: wp-admin/includes/class-wp-upgrader.php:609 +msgid "The theme is at the latest version." +msgstr "Tienes la última versión del tema." + +#: wp-admin/includes/class-wp-upgrader.php:613 +msgid "Removing the old version of the theme…" +msgstr "Eliminando la antigua versión del tema…" + +#: wp-admin/includes/class-wp-upgrader.php:614 +msgid "Could not remove the old theme." +msgstr "No ha sido posible eliminar la versión anterior del tema." + +#: wp-admin/includes/class-wp-upgrader.php:623 +msgid "Installing the theme…" +msgstr "Instalando el tema…" + +#: wp-admin/includes/class-wp-upgrader.php:624 +msgid "Theme install failed." +msgstr "Fallo en la instalación del tema." + +#: wp-admin/includes/class-wp-upgrader.php:625 +msgid "Theme installed successfully." +msgstr "El tema se ha instalado correctamente." + +#: wp-admin/includes/class-wp-upgrader.php:862 +msgid "WordPress is at the latest version." +msgstr "Tienes la última versión de WordPress." + +#: wp-admin/includes/class-wp-upgrader.php:866 +msgid "Could not copy files." +msgstr "No ha sido posible copiar los archivos." + +#: wp-admin/includes/class-wp-upgrader.php:1040 +msgid "Reactivating the plugin…" +msgstr "Reactivando el plugin…" + +#: wp-admin/includes/class-wp-upgrader.php:1045 +#: wp-admin/includes/class-wp-upgrader.php:1280 +#: wp-admin/includes/class-wp-upgrader.php:1282 +#: wp-admin/includes/class-wp-plugins-list-table.php:379 +msgid "Activate this plugin" +msgstr "Activar este plugin" + +#: wp-admin/includes/class-wp-upgrader.php:1045 +#: wp-admin/includes/class-wp-upgrader.php:1282 +msgid "Activate Plugin" +msgstr "Activar plugin" + +#: wp-admin/includes/class-wp-upgrader.php:1046 +#: wp-admin/includes/class-wp-upgrader.php:1201 +#: wp-admin/includes/class-wp-upgrader.php:1294 +msgid "Return to Plugins page" +msgstr "Volver a la página de plugins" + +#: wp-admin/includes/class-wp-upgrader.php:1268 +msgid "Successfully installed the plugin %s %s." +msgstr "El plugin %s %s se ha instalado correctamente." + +#: wp-admin/includes/class-wp-upgrader.php:1292 +msgid "Return to Plugin Installer" +msgstr "Volver al instalador de plugins" + +#: wp-admin/includes/class-wp-upgrader.php:1333 +msgid "Successfully installed the theme %1$s %2$s." +msgstr "El tema %1$s %2$s se ha instalado correctamente." + +#: wp-admin/includes/class-wp-posts-list-table.php:556 +#: wp-admin/includes/class-wp-themes-list-table.php:169 +#: wp-admin/includes/class-wp-upgrader.php:1352 +#: wp-admin/includes/class-wp-upgrader.php:1405 +#: wp-admin/includes/theme-install.php:145 +#: wp-admin/includes/theme-install.php:153 +msgid "Preview “%s”" +msgstr "Vista previa “%s”" + +#: wp-includes/js/tinymce/langs/wp-langs.php:96 +#: wp-includes/js/tinymce/langs/wp-langs.php:362 wp-admin/custom-header.php:481 +#: wp-admin/custom-background.php:184 +#: wp-admin/includes/class-wp-posts-list-table.php:556 +#: wp-admin/includes/class-wp-themes-list-table.php:169 +#: wp-admin/includes/class-wp-upgrader.php:1352 +#: wp-admin/includes/class-wp-upgrader.php:1405 +#: wp-admin/includes/theme-install.php:145 wp-admin/includes/meta-boxes.php:48 +msgid "Preview" +msgstr "Vista previa" + +#: wp-admin/includes/class-wp-themes-list-table.php:166 +#: wp-admin/includes/class-wp-upgrader.php:1353 +#: wp-admin/includes/class-wp-upgrader.php:1406 +msgid "Activate “%s”" +msgstr "Activar “%s”" + +#: wp-admin/includes/class-wp-upgrader.php:1357 +msgid "Return to Theme Installer" +msgstr "Volver al instalador de temas" + +#: wp-admin/includes/class-wp-upgrader.php:1359 +msgid "Themes page" +msgstr "Página de temas" + +#: wp-admin/includes/class-wp-upgrader.php:1233 +#: wp-admin/includes/class-wp-upgrader.php:1359 +#: wp-admin/includes/class-wp-upgrader.php:1412 +msgid "Return to Themes page" +msgstr "Volver a la página de temas" + +#: wp-admin/includes/class-wp-upgrader.php:1438 +msgid "Please select a file" +msgstr "Por favor elige un archivo" + +#: wp-admin/includes/file.php:329 wp-admin/includes/file.php:451 +#: wp-admin/includes/class-wp-upgrader.php:1452 +msgid "The uploaded file could not be moved to %s." +msgstr "El archivo subido no se ha podido mover a %s." + +#: wp-admin/includes/dashboard.php:40 wp-admin/includes/dashboard.php:43 +msgid "Right Now" +msgstr "Ahora mismo" + +#: wp-includes/default-widgets.php:600 wp-includes/default-widgets.php:638 +#: wp-admin/includes/dashboard.php:53 +msgid "Recent Comments" +msgstr "Comentarios recientes" + +#: wp-admin/includes/dashboard.php:70 +msgid "Incoming Links" +msgstr "Enlaces entrantes" + +#: wp-includes/js/tinymce/langs/wp-langs.php:306 wp-admin/update-core.php:190 +#: wp-admin/update-core.php:202 wp-admin/includes/dashboard.php:75 +#: wp-admin/plugins.php:331 +msgid "Plugins" +msgstr "Plugins" + +#: wp-admin/includes/dashboard.php:79 +msgid "QuickPress" +msgstr "Publicación rápida" + +#: wp-admin/includes/dashboard.php:83 +msgid "Recent Drafts" +msgstr "Últimos borradores" + +#: wp-admin/includes/dashboard.php:104 +msgid "http://planet.wordpress.org/" +msgstr "http://planet.wordpress.org/" + +#: wp-admin/includes/dashboard.php:105 +msgid "http://planet.wordpress.org/feed/" +msgstr "http://planet.wordpress.org/feed/" + +#: wp-admin/includes/dashboard.php:106 +msgid "Other WordPress News" +msgstr "Otras noticias sobre WordPress" + +#: wp-admin/includes/dashboard.php:129 wp-admin/includes/dashboard.php:599 +msgid "View all" +msgstr "Ver todo" + +#: wp-includes/script-loader.php:338 wp-includes/script-loader.php:365 +#: wp-includes/js/tinymce/langs/wp-langs.php:19 +#: wp-admin/includes/dashboard.php:156 +#: wp-admin/includes/class-wp-posts-list-table.php:996 +#: wp-admin/includes/image-edit.php:74 wp-admin/includes/media.php:1320 +#: wp-admin/includes/media.php:1582 wp-admin/includes/internal-linking.php:115 +#: wp-admin/includes/template.php:370 wp-admin/includes/template.php:559 +#: wp-admin/includes/template.php:646 wp-admin/includes/theme-install.php:285 +#: wp-admin/includes/nav-menu.php:190 +#: wp-admin/includes/class-wp-terms-list-table.php:365 +#: wp-admin/includes/meta-boxes.php:104 wp-admin/includes/meta-boxes.php:150 +#: wp-admin/press-this.php:135 wp-admin/press-this.php:165 +#: wp-admin/press-this.php:193 wp-admin/press-this.php:315 +#: wp-admin/widgets.php:311 +msgid "Cancel" +msgstr "Cancelar" + +#: wp-admin/includes/dashboard.php:160 +msgid "Configure" +msgstr "Configurar" + +#: wp-admin/includes/dashboard.php:266 +msgid "Post" +msgid_plural "Posts" +msgstr[0] "Entrada" +msgstr[1] "Entradas" + +#: wp-admin/includes/dashboard.php:337 +msgid "Comment" +msgid_plural "Comments" +msgstr[0] "Comentario" +msgstr[1] "Comentarios" + +#: wp-admin/includes/dashboard.php:294 +msgid "Page" +msgid_plural "Pages" +msgstr[0] "Página" +msgstr[1] "Páginas" + +#: wp-admin/includes/dashboard.php:349 +msgctxt "Right Now" +msgid "Approved" +msgid_plural "Approved" +msgstr[0] "Aprobado" +msgstr[1] "Aprobados" + +#: wp-admin/includes/dashboard.php:306 +msgid "Category" +msgid_plural "Categories" +msgstr[0] "Categoría" +msgstr[1] "Categorías" + +#: wp-admin/includes/dashboard.php:361 +msgid "Pending" +msgid_plural "Pending" +msgstr[0] "Pendiente" +msgstr[1] "Pendientes" + +#: wp-admin/includes/dashboard.php:318 +msgid "Tag" +msgid_plural "Tags" +msgstr[0] "Etiqueta" +msgstr[1] "Etiquetas" + +#: wp-admin/includes/dashboard.php:407 +msgid "Theme %1$s with %2$s Widget" +msgid_plural "Theme %1$s with %2$s Widgets" +msgstr[0] "Tema %1$s con %2$s widget" +msgstr[1] "Tema %1$s con %2$s widgets" + +#: wp-admin/includes/dashboard.php:411 +msgid "Theme %1$s" +msgstr "Tema %1$s" + +#: wp-admin/includes/dashboard.php:413 +msgid "Theme %1$s" +msgstr "Tema %1$s" + +#: wp-admin/includes/dashboard.php:490 +msgid "Post submitted. Preview post | Edit post" +msgstr "Entrada enviada. Previsualizar entrada | Editar entrada" + +#: wp-admin/includes/dashboard.php:505 +msgid "You can also try %s, easy blogging from anywhere on the Web." +msgstr "También puedes probar %s para crear fácilmente entradas desde cualquier web." + +#: wp-admin/tools.php:32 wp-admin/tools.php:37 wp-admin/options-writing.php:88 +#: wp-admin/options-writing.php:92 wp-admin/includes/dashboard.php:505 +#: wp-admin/press-this.php:327 wp-admin/press-this.php:484 +msgid "Press This" +msgstr "Publicar esto" + +#: wp-includes/post.php:4688 wp-admin/includes/dashboard.php:261 +#: wp-admin/includes/dashboard.php:539 +msgid "Content" +msgstr "Contenido" + +#: wp-includes/default-widgets.php:1000 wp-admin/includes/dashboard.php:546 +#: wp-admin/includes/class-wp-posts-list-table.php:280 +msgid "Tags" +msgstr "Etiquetas" + +#: wp-includes/script-loader.php:349 wp-admin/includes/dashboard.php:556 +#: wp-admin/includes/meta-boxes.php:31 wp-admin/press-this.php:488 +msgid "Save Draft" +msgstr "Guardar borrador" + +#: wp-admin/includes/dashboard.php:557 +msgid "Reset" +msgstr "Reiniciar" + +#: wp-admin/includes/dashboard.php:559 wp-admin/includes/meta-boxes.php:219 +#: wp-admin/includes/meta-boxes.php:220 wp-admin/press-this.php:493 +msgid "Submit for Review" +msgstr "Enviar para revisión" + +#: wp-admin/includes/dashboard.php:602 +msgid "There are no drafts at the moment" +msgstr "En este momento no hay borradores" + +#: wp-includes/theme-compat/comments-popup.php:62 +#: wp-admin/includes/dashboard.php:661 wp-admin/includes/meta-boxes.php:480 +msgid "No comments yet." +msgstr "Aún no hay comentarios." + +#: wp-admin/includes/dashboard.php:695 +#: wp-admin/includes/class-wp-comments-list-table.php:393 +#: wp-admin/includes/class-wp-comments-list-table.php:395 +msgid "Approve this comment" +msgstr "Aprobar este comentario" + +#: wp-admin/includes/dashboard.php:696 +#: wp-admin/includes/class-wp-comments-list-table.php:391 +#: wp-admin/includes/class-wp-comments-list-table.php:396 +msgid "Unapprove this comment" +msgstr "Rechazar este comentario" + +#: wp-includes/link-template.php:1015 wp-admin/edit-comments.php:197 +#: wp-admin/edit-comments.php:203 wp-admin/includes/dashboard.php:697 +#: wp-admin/includes/class-wp-comments-list-table.php:414 +msgid "Edit comment" +msgstr "Editar comentario" + +#: wp-admin/includes/dashboard.php:698 +#: wp-admin/includes/class-wp-comments-list-table.php:417 +msgid "Reply to this comment" +msgstr "Responder a este comentario" + +#: wp-includes/script-loader.php:321 wp-includes/comment-template.php:1039 +#: wp-admin/includes/dashboard.php:698 +#: wp-admin/includes/class-wp-comments-list-table.php:417 +msgid "Reply" +msgstr "Responder" + +#: wp-admin/includes/dashboard.php:699 +#: wp-admin/includes/class-wp-comments-list-table.php:400 +msgid "Mark this comment as spam" +msgstr "Marcar este comentario como spam" + +#: wp-admin/includes/dashboard.php:699 +#: wp-admin/includes/class-wp-comments-list-table.php:400 +msgctxt "verb" +msgid "Spam" +msgstr "Spam" + +#: wp-admin/includes/dashboard.php:703 +#: wp-admin/includes/class-wp-comments-list-table.php:410 +msgid "Move this comment to the trash" +msgstr "Mover este comentario a la papelera" + +#: wp-admin/includes/dashboard.php:703 +#: wp-admin/includes/class-wp-comments-list-table.php:410 +msgctxt "verb" +msgid "Trash" +msgstr "Enviar a la Papelera" + +#: wp-admin/includes/dashboard.php:729 +msgid "From %1$s on %2$s%3$s" +msgstr "De %1$s en %2$s%3$s" + +#: wp-admin/includes/dashboard.php:730 +msgid "[Pending]" +msgstr "[Pendiente]" + +#: wp-includes/comment-template.php:680 wp-admin/includes/dashboard.php:737 +msgid "Pingback" +msgstr "Pingback" + +#: wp-includes/comment-template.php:679 wp-admin/includes/dashboard.php:740 +msgid "Trackback" +msgstr "Trackback" + +#: wp-admin/includes/dashboard.php:749 +msgctxt "dashboard" +msgid "%1$s on %2$s" +msgstr "%1$s en %2$s" + +#: wp-includes/default-widgets.php:682 wp-admin/includes/dashboard.php:780 +msgid "Number of comments to show:" +msgstr "Número de comentarios a mostrar:" + +#: wp-admin/includes/dashboard.php:1038 +msgid "Loading…" +msgstr "Cargando…" + +#: wp-admin/includes/dashboard.php:1038 +msgid "This widget requires JavaScript." +msgstr "Este widget requiere Javascript." + +#: wp-includes/default-widgets.php:788 wp-admin/includes/dashboard.php:801 +#: wp-admin/includes/dashboard.php:917 +msgid "RSS Error: %s" +msgstr "Error en el RSS: %s" + +#: wp-admin/includes/dashboard.php:808 +msgid "This dashboard widget queries Google Blog Search so that when another blog links to your site it will show up here. It has found no incoming links… yet. It’s okay — there is no rush." +msgstr "Este widget de escritorio consulta a la Búsqueda de blogs de Google de modo que cuando otro blog enlace a su sitio se mostrará aquí. No se ha encontrado ningún enlace entrante… aún. Está bien, no hay prisa." + +#: wp-admin/includes/dashboard.php:832 wp-admin/includes/dashboard.php:834 +#: wp-admin/includes/post.php:1304 +msgid "Somebody" +msgstr "Alguien" + +#: wp-admin/includes/dashboard.php:846 +msgid "%1$s linked here saying, \"%3$s\"" +msgstr "%1$s enlazó aquí diciendo, \"%3$s\"" + +#: wp-admin/includes/dashboard.php:849 +msgid "%1$s linked here saying, \"%3$s\"" +msgstr "%1$s enlazó aquí diciendo, \"%3$s\"" + +#: wp-admin/includes/dashboard.php:854 +msgid "on %4$s" +msgstr "en %4$s" + +#: wp-admin/includes/dashboard.php:956 +msgid "Most Popular" +msgstr "Más populares" + +#: wp-admin/includes/dashboard.php:956 +msgid "Newest Plugins" +msgstr "Plugins recientes" + +#: wp-admin/includes/dashboard.php:956 +msgid "Recently Updated" +msgstr "Actualizados recientemente" + +#: wp-admin/includes/dashboard.php:1014 wp-admin/includes/theme-install.php:143 +msgid "Install" +msgstr "Instalar" + +#: wp-includes/default-widgets.php:734 wp-admin/includes/dashboard.php:1118 +msgid "Unknown Feed" +msgstr "Feed desconocido" + +#: wp-admin/includes/file.php:11 +msgid "Main Index Template" +msgstr "Plantilla de la página principal" + +#: wp-admin/includes/file.php:12 wp-admin/includes/file.php:40 +msgid "Stylesheet" +msgstr "Hoja de estilos" + +#: wp-admin/includes/file.php:15 +msgid "RTL Stylesheet" +msgstr "Hoja de estilos RTL" + +#: wp-admin/includes/file.php:17 +msgid "Popup Comments" +msgstr "Comentarios emergentes" + +#: wp-admin/includes/file.php:18 +msgid "Footer" +msgstr "Pie de página" + +#: wp-includes/admin-bar.php:317 wp-admin/custom-header.php:86 +#: wp-admin/includes/file.php:19 +msgid "Header" +msgstr "Cabecera" + +#: wp-includes/widgets.php:490 wp-admin/includes/file.php:20 +#: wp-admin/widgets.php:278 +msgid "Sidebar" +msgstr "Barra lateral" + +#: wp-includes/theme-compat/sidebar.php:57 wp-includes/default-widgets.php:218 +#: wp-includes/default-widgets.php:225 wp-admin/includes/file.php:21 +msgid "Archives" +msgstr "Archivos" + +#: wp-admin/includes/file.php:24 +msgid "Category Template" +msgstr "Plantilla de categoría" + +#: wp-admin/includes/file.php:25 wp-admin/includes/meta-boxes.php:572 +msgid "Page Template" +msgstr "Plantilla de página" + +#: wp-admin/includes/class-wp-theme-install-list-table.php:31 +#: wp-admin/includes/file.php:26 +#: wp-admin/includes/class-wp-plugin-install-list-table.php:31 +msgid "Search Results" +msgstr "Resultados de la búsqueda" + +#: wp-admin/includes/file.php:27 +msgid "Search Form" +msgstr "Formulario de búsqueda" + +#: wp-admin/includes/file.php:28 +msgid "Single Post" +msgstr "Entrada individual" + +#: wp-admin/includes/file.php:29 +msgid "404 Template" +msgstr "Error 404 (página no encontrada)" + +#: wp-admin/includes/file.php:30 +msgid "Links Template" +msgstr "Plantilla de enlaces" + +#: wp-admin/includes/file.php:31 +msgid "Theme Functions" +msgstr "Funciones del tema" + +#: wp-admin/includes/file.php:32 +msgid "Attachment Template" +msgstr "Plantilla de archivos adjuntos" + +#: wp-admin/includes/file.php:33 +msgid "Image Attachment Template" +msgstr "Plantilla de imagen adjunta" + +#: wp-admin/includes/file.php:34 +msgid "Video Attachment Template" +msgstr "Plantilla de vídeo adjunto" + +#: wp-admin/includes/file.php:35 +msgid "Audio Attachment Template" +msgstr "Plantilla de audio adjunto" + +#: wp-admin/includes/file.php:36 +msgid "Application Attachment Template" +msgstr "Plantilla de aplicación adjunta" + +#: wp-admin/includes/file.php:37 +msgid "my-hacks.php (legacy hacks support)" +msgstr "my-hacks.php (soporte para hacks)" + +#: wp-admin/includes/file.php:38 +msgid ".htaccess (for rewrite rules )" +msgstr ".htaccess (para reglas de reescritura)" + +#: wp-admin/includes/file.php:41 +msgid "Comments Template" +msgstr "Plantilla de comentarios" + +#: wp-admin/includes/file.php:42 +msgid "Popup Comments Template" +msgstr "Plantilla de comentarios emergentes" + +#: wp-admin/includes/file.php:202 +msgid "Sorry, can’t edit files with “..” in the name. If you are trying to edit a file in your WordPress home directory, you can just type the name of the file in." +msgstr "Disculpa, no puedes editar archivos con \"..\" en el nombre. Si estás intentando editar un archivo en tu directorio raíz de WordPress, simplemente escribe el nombre del archivo." + +#: wp-admin/includes/file.php:208 +msgid "Sorry, that file cannot be edited." +msgstr "Disculpa, ese archivo no puede editarse." + +#: wp-admin/includes/file.php:381 +msgid "The uploaded file exceeds the upload_max_filesize directive in php.ini." +msgstr "El archivo a subir sobrepasa la directiva upload_max_filesize (tamaño máximo de subida) en php.ini." + +#: wp-admin/includes/file.php:382 +msgid "The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form." +msgstr "El archivo a subir sobrepasa la directiva MAX_FILE_SIZE (tamaño máximo de archivo) especificada en el formulario HTML." + +#: wp-admin/includes/file.php:257 wp-admin/includes/file.php:383 +msgid "The uploaded file was only partially uploaded." +msgstr "Sólo se ha podido subir una parte del archivo." + +#: wp-admin/includes/file.php:258 wp-admin/includes/file.php:384 +msgid "No file was uploaded." +msgstr "No se ha subido ningún archivo." + +#: wp-admin/includes/file.php:260 wp-admin/includes/file.php:386 +msgid "Missing a temporary folder." +msgstr "Falta un directorio temporal." + +#: wp-admin/includes/file.php:261 wp-admin/includes/file.php:387 +msgid "Failed to write file to disk." +msgstr "El archivo no se ha podido grabar en el disco." + +#: wp-admin/includes/file.php:262 wp-admin/includes/file.php:388 +msgid "File upload stopped by extension." +msgstr "Subida de archivo detenida a causa de la extensión." + +#: wp-admin/includes/file.php:279 wp-admin/includes/file.php:404 +msgid "Invalid form submission." +msgstr "Se envió un formulario erróneo." + +#: wp-admin/includes/file.php:290 wp-admin/includes/import.php:63 +msgid "File is empty. Please upload something more substantial. This error could also be caused by uploads being disabled in your php.ini or by post_max_size being defined as smaller than upload_max_filesize in php.ini." +msgstr "El archivo está vacío. Por favor, sube algo con más sustancia. Este error puede que lo provoque que tu fichero php.ini tenga inhabilitadas las subidas o porque post_max_size esté definido más pequeño que el upload_max_filesize en php.ini." + +#: wp-admin/includes/file.php:296 +msgid "Specified file failed upload test." +msgstr "El archivo indicado no cumple los requisitos de subida." + +#: wp-admin/includes/file.php:412 +msgid "File is empty. Please upload something more substantial. This error could also be caused by uploads being disabled in your php.ini." +msgstr "El archivo está vacío. Por favor, sube algo con más sustancia. Este error podría ser causado porque las subidas está desactivadas en tu php.ini." + +#: wp-admin/includes/file.php:416 +msgid "Specified file does not exist." +msgstr "El archivo especificado no existe." + +#: wp-admin/includes/file.php:480 +msgid "Invalid URL Provided." +msgstr "La URL especificada no es válido." + +#: wp-admin/includes/file.php:484 +msgid "Could not create Temporary file." +msgstr "No ha sido posible crear el archivo temporal." + +#: wp-admin/includes/file.php:582 wp-admin/includes/file.php:618 +msgid "Could not retrieve file from archive." +msgstr "No se puede recuperar el archivo." + +#: wp-admin/includes/file.php:628 +msgid "Could not extract file from archive." +msgstr "No podemos descomprimir el archivo." + +#: wp-admin/includes/file.php:631 wp-admin/includes/file.php:717 +#: wp-admin/includes/file.php:758 wp-admin/includes/update-core.php:421 +#: wp-admin/includes/update-core.php:508 +msgid "Could not copy file." +msgstr "No ha sido posible copiar el archivo." + +#: wp-admin/includes/file.php:675 +msgid "Empty archive." +msgstr "Archivo vacío." + +#: wp-admin/includes/file.php:948 +msgid "Error: There was an error connecting to the server, Please verify the settings are correct." +msgstr "Error: Se ha producido un error en la conexión con el servidor. Por favor, verifica que la configuración es correcta." + +#: wp-admin/includes/file.php:956 +msgid "FTP" +msgstr "FTP" + +#: wp-admin/includes/file.php:958 +msgid "FTPS (SSL)" +msgstr "FTPS (SSL)" + +#: wp-admin/includes/file.php:960 +msgid "SSH2" +msgstr "SSH2" + +#: wp-admin/includes/file.php:981 +msgid "Connection Information" +msgstr "Datos de conexión" + +#: wp-admin/includes/file.php:1003 +msgid "Hostname" +msgstr "Servidor" + +#: wp-includes/general-template.php:258 wp-login.php:516 wp-login.php:636 +#: wp-admin/user-new.php:287 wp-admin/install.php:101 wp-admin/install.php:225 +#: wp-admin/includes/file.php:983 +#: wp-admin/includes/class-wp-users-list-table.php:163 +#: wp-admin/user-edit.php:237 +msgid "Username" +msgstr "Nombre de usuario" + +#: wp-includes/general-template.php:259 wp-login.php:640 +#: wp-admin/user-new.php:309 wp-admin/install.php:229 +#: wp-admin/options-writing.php:115 +#: wp-admin/includes/class-wp-posts-list-table.php:796 +#: wp-admin/includes/file.php:984 +msgid "Password" +msgstr "Contraseña" + +#: wp-admin/includes/file.php:1019 +msgid "Authentication Keys" +msgstr "Claves de autentificación" + +#: wp-admin/includes/file.php:1021 +msgid "Public Key:" +msgstr "Clave pública:" + +#: wp-admin/includes/file.php:1022 +msgid "Private Key:" +msgstr "Clave privada:" + +#: wp-admin/includes/file.php:1025 +msgid "Enter the location on the server where the keys are located. If a passphrase is needed, enter that in the password field above." +msgstr "Introduce la dirección del servidor en el que se encuentran las claves. Si es necesaria una contraseña, introdúcela en el campo de contraseña." + +#: wp-admin/includes/file.php:1030 wp-admin/includes/file.php:1032 +msgid "Connection Type" +msgstr "Tipo de conexión" + +#: wp-admin/includes/file.php:1051 +msgid "Proceed" +msgstr "Ejecutar" + +#: wp-admin/includes/image-edit.php:19 wp-admin/includes/image-edit.php:545 +msgid "Image data does not exist. Please re-upload the image." +msgstr "No existen datos de la imagen. Por favor, vuelve a subir la imagen." + +#: wp-admin/includes/image-edit.php:40 +msgid "Crop" +msgstr "Recortar" + +#: wp-admin/includes/image-edit.php:44 +msgid "Rotate counter-clockwise" +msgstr "Rotar en sentido contrario a las agujas del reloj." + +#: wp-admin/includes/image-edit.php:45 +msgid "Rotate clockwise" +msgstr "Rotar en el sentido de las agujas del reloj." + +#: wp-admin/includes/image-edit.php:47 +msgid "Image rotation is not supported by your web host (function imagerotate() is missing)" +msgstr "Tu hosting no soporta la rotación de imágenes (no tiene la función imagerotate())" + +#: wp-admin/includes/image-edit.php:53 +msgid "Flip vertically" +msgstr "Voltear verticalmente" + +#: wp-admin/includes/image-edit.php:54 +msgid "Flip horizontally" +msgstr "Voltear horizontalmente" + +#: wp-includes/js/tinymce/langs/wp-langs.php:268 +#: wp-includes/js/tinymce/wp-mce-help.php:236 +#: wp-admin/includes/image-edit.php:57 +msgid "Redo" +msgstr "Rehacer" + +#: wp-admin/includes/image-edit.php:82 +msgid "Scale Image" +msgstr "Escalar imagen" + +#: wp-admin/includes/image-edit.php:84 +msgid "You can proportionally scale the original image. For best results the scaling should be done before performing any other operations on it like crop, rotate, etc. Note that if you make the image larger it may become fuzzy." +msgstr "Puedes escalar proporcionalmente la imagen original. Para obtener los mejores resultados es mejor escalar la imagen antes de realizar otras operaciones como recortar, rotar, etc. Date cuenta de que si haces más grande la imagen puede verse borrosa." + +#: wp-admin/includes/image-edit.php:85 +msgid "Original dimensions %s" +msgstr "Dimensiones originales %s" + +#: wp-includes/js/tinymce/langs/wp-langs.php:374 +#: wp-admin/includes/image-edit.php:89 +msgid "Scale" +msgstr "Escala" + +#: wp-admin/custom-background.php:222 wp-admin/custom-background.php:226 +#: wp-admin/includes/image-edit.php:97 +msgid "Restore Original Image" +msgstr "Restaurar imagen original" + +#: wp-admin/includes/image-edit.php:99 +msgid "Discard any changes and restore the original image." +msgstr "Descartar todos los cambios y restaurar la imagen original." + +#: wp-admin/includes/image-edit.php:102 +msgid "Previously edited copies of the image will not be deleted." +msgstr "Las copias de la imagen editadas previamente no se borrarán." + +#: wp-admin/includes/image-edit.php:106 +msgid "Restore image" +msgstr "Restaurar imagen" + +#: wp-admin/includes/image-edit.php:117 +msgid "Image Crop" +msgstr "Recortar imagen" + +#: wp-admin/includes/image-edit.php:118 wp-admin/includes/image-edit.php:164 +msgid "(help)" +msgstr "(ayuda)" + +#: wp-admin/includes/image-edit.php:120 +msgid "The image can be cropped by clicking on it and dragging to select the desired part. While dragging the dimensions of the selection are displayed below." +msgstr "Puedes recortar la imagen haciendo clic en ella y arrastrando la parte deseada. Mientras arrastras, abajo se muestran las dimensiones." + +#: wp-admin/includes/image-edit.php:121 wp-admin/user-edit.php:211 +msgid "Keyboard Shortcuts" +msgstr "Atajos de teclado" + +#: wp-admin/includes/image-edit.php:123 +msgid "Arrow: move by 10px" +msgstr "Flecha: mover 10px" + +#: wp-admin/includes/image-edit.php:124 +msgid "Shift + arrow: move by 1px" +msgstr "May + flecha: mover 1px" + +#: wp-admin/includes/image-edit.php:125 +msgid "Ctrl + arrow: resize by 10px" +msgstr "Control + flecha: redimensiona en 10px" + +#: wp-admin/includes/image-edit.php:126 +msgid "Ctrl + Shift + arrow: resize by 1px" +msgstr "Control + May + flecha: redimensiona en 1 px" + +#: wp-admin/includes/image-edit.php:127 +msgid "Shift + drag: lock aspect ratio" +msgstr "May + arrastrar: bloquea relación de aspecto" + +#: wp-admin/includes/image-edit.php:130 +msgid "Crop Aspect Ratio" +msgstr "Relación de aspecto de la zona a recortar" + +#: wp-admin/includes/image-edit.php:131 +msgid "You can specify the crop selection aspect ratio then hold down the Shift key while dragging to lock it. The values can be 1:1 (square), 4:3, 16:9, etc. If there is a selection, specifying aspect ratio will set it immediately." +msgstr "Puedes especificar la relación de aspecto de la zona seleccionada para recortar y luego mantener la tecla mayúsculas mientras arrastras para bloquearlo. Los valores pueden ser 1:1 (cuadrado), 4:3, 16:9, etc. Si hay una selección, al especificar la relación de aspecto se establece al instante." + +#: wp-admin/includes/image-edit.php:133 +msgid "Crop Selection" +msgstr "Selección de recorte" + +#: wp-admin/includes/image-edit.php:134 +msgid "Once started, the selection can be adjusted by entering new values (in pixels). Note that these values are scaled to approximately match the original image dimensions. The minimum selection size equals the thumbnail size as set in the Media settings." +msgstr "Una vez comiences, la selección puede ajustarse introduciendo nuevos valores (en pixels). Date cuenta que estos valores se escalan para que se ajusten, aproximadamente, a las dimensiones de la imagen original. El tamaño de selección mínimo se iguala al tamaño de miniatura establecido en las opciones de Multimedia." + +#: wp-admin/includes/image-edit.php:139 +msgid "Aspect ratio:" +msgstr "Relación de aspecto:" + +#: wp-admin/includes/image-edit.php:148 +msgid "Selection:" +msgstr "Selección:" + +#: wp-admin/includes/image-edit.php:163 +msgid "Thumbnail Settings" +msgstr "Opciones de miniatura" + +#: wp-admin/includes/image-edit.php:165 +msgid "The thumbnail image can be cropped differently. For example it can be square or contain only a portion of the original image to showcase it better. Here you can select whether to apply changes to all image sizes or make the thumbnail different." +msgstr "La imagen de miniatura puede recortarse de manera diferente. Por ejemplo, puede ser cuadrada, o contener sólo una parte de la imagen original para que se ajuste mejor. Aquí puedes elegir si aplicar los cambios a todos los tamaños de imagen o hacer una miniatura diferente." + +#: wp-admin/includes/image-edit.php:169 +msgid "Current thumbnail" +msgstr "Miniatura actual" + +#: wp-admin/includes/image-edit.php:173 +msgid "Apply changes to:" +msgstr "Aplicar cambios a:" + +#: wp-admin/includes/image-edit.php:177 +msgid "All image sizes" +msgstr "Todos los tamaños de imagen" + +#: wp-includes/js/tinymce/langs/wp-langs.php:486 +#: wp-admin/includes/image-edit.php:181 wp-admin/includes/media.php:876 +msgid "Thumbnail" +msgstr "Miniatura" + +#: wp-admin/includes/image-edit.php:185 +msgid "All sizes except thumbnail" +msgstr "Todos los tamaños excepto la miniatura" + +#: wp-admin/includes/image-edit.php:195 +msgid "There are unsaved changes that will be lost. 'OK' to continue, 'Cancel' to return to the Image Editor." +msgstr "Hay cambios sin guardar que se perderán. 'Aceptar' para continuar, 'Cancelar' para volver al Editor de imágenes." + +#: wp-admin/includes/image-edit.php:428 +msgid "Cannot load image metadata." +msgstr "No se pudieron cargar los metadatos de la imagen." + +#: wp-admin/includes/image-edit.php:483 +msgid "Cannot save image metadata." +msgstr "No se pudieron guardar los metadatos de la imagen." + +#: wp-admin/includes/image-edit.php:488 +msgid "Image metadata is inconsistent." +msgstr "Los metadatos de la imagen son inconsistentes." + +#: wp-admin/includes/image-edit.php:490 +msgid "Image restored successfully." +msgstr "Imagen restaurada con éxito." + +#: wp-admin/includes/image-edit.php:503 +msgid "Unable to create new image." +msgstr "No se pudo crear una imagen nueva." + +#: wp-admin/includes/image-edit.php:529 +msgid "Error while saving the scaled image. Please reload the page and try again." +msgstr "Error al tratar de guardar la imagen escalada. Vuelve a cargar la página e inténtalo de nuevo." + +#: wp-admin/includes/image-edit.php:537 +msgid "Nothing to save, the image has not changed." +msgstr "Nada que guardar, la imagen no ha cambiado." + +#: wp-admin/includes/image-edit.php:580 +msgid "Unable to save the image." +msgstr "No se pudo guardar la imagen." + +#: wp-admin/includes/image-edit.php:665 +msgid "Image saved" +msgstr "Imagen guardada" + +#: wp-includes/media.php:247 +msgid "File “%s” doesn’t exist?" +msgstr "¿El archivo “%s” no existe?" + +#: wp-includes/media.php:250 +msgid "The GD image library is not installed." +msgstr "La librería de imágenes GD no está instalada." + +#: wp-includes/media.php:257 +msgid "File “%s” is not an image." +msgstr "El archivo “%s” no es una imagen." + +#: wp-admin/includes/media.php:18 +msgid "From Computer" +msgstr "Desde el ordenador" + +#: wp-admin/includes/media.php:19 +msgid "From URL" +msgstr "Desde una URL" + +#: wp-admin/includes/media.php:20 +msgid "Gallery" +msgstr "Galería" + +#: wp-admin/upload.php:133 wp-admin/includes/media.php:21 +msgid "Media Library" +msgstr "Librería multimedia" + +#: wp-admin/includes/media.php:53 +msgid "Gallery (%s)" +msgstr "Galería (%s)" + +#: wp-admin/includes/media.php:316 +msgid "Uploads" +msgstr "Archivos subidos" + +#: wp-admin/includes/media.php:316 wp-admin/includes/template.php:1558 +msgid "WordPress" +msgstr "WordPress" + +#: wp-admin/includes/media.php:398 +msgid "Upload/Insert %s" +msgstr "Subir/Insertar %s" + +#: wp-includes/js/tinymce/langs/wp-langs.php:472 +#: wp-admin/includes/media.php:396 +msgid "Add Media" +msgstr "Añadir objeto" + +#: wp-includes/js/tinymce/langs/wp-langs.php:473 +#: wp-admin/includes/media.php:390 +msgid "Add an Image" +msgstr "Añadir una imagen" + +#: wp-includes/js/tinymce/langs/wp-langs.php:474 +#: wp-admin/includes/media.php:392 +msgid "Add Video" +msgstr "Añadir un vídeo" + +#: wp-includes/js/tinymce/langs/wp-langs.php:475 +#: wp-admin/includes/media.php:394 +msgid "Add Audio" +msgstr "Añadir un archivo de audio" + +#: wp-admin/admin-ajax.php:1529 wp-admin/includes/media.php:562 +#: wp-admin/includes/media.php:667 wp-admin/includes/media.php:726 +#: wp-admin/includes/media.php:782 wp-admin/includes/post.php:1835 +msgid "Saved." +msgstr "Guardado." + +#: wp-includes/js/tinymce/langs/wp-langs.php:77 +#: wp-includes/js/tinymce/langs/wp-langs.php:340 +#: wp-includes/js/tinymce/langs/wp-langs.php:439 +#: wp-admin/custom-background.php:256 wp-admin/includes/media.php:850 +#: wp-admin/includes/media.php:2133 +msgid "Left" +msgstr "Izquierda" + +#: wp-includes/js/tinymce/langs/wp-langs.php:78 +#: wp-includes/js/tinymce/langs/wp-langs.php:419 +#: wp-includes/js/tinymce/langs/wp-langs.php:440 +#: wp-admin/custom-background.php:260 wp-admin/includes/media.php:850 +#: wp-admin/includes/media.php:2135 +msgid "Center" +msgstr "Centrar" + +#: wp-includes/js/tinymce/langs/wp-langs.php:79 +#: wp-includes/js/tinymce/langs/wp-langs.php:341 +#: wp-includes/js/tinymce/langs/wp-langs.php:437 +#: wp-admin/custom-background.php:264 wp-admin/includes/media.php:850 +#: wp-admin/includes/media.php:2137 +msgid "Right" +msgstr "Derecha" + +#: wp-includes/js/tinymce/langs/wp-langs.php:487 +#: wp-admin/includes/media.php:876 +msgid "Medium" +msgstr "Medio" + +#: wp-admin/includes/media.php:876 +msgid "Large" +msgstr "Grande" + +#: wp-includes/js/tinymce/langs/wp-langs.php:488 +#: wp-admin/includes/media.php:876 +msgid "Full Size" +msgstr "Tamaño completo" + +#: wp-includes/js/tinymce/langs/wp-langs.php:485 +#: wp-admin/includes/media.php:913 +msgid "Size" +msgstr "Tamaño" + +#: wp-admin/includes/media.php:945 wp-admin/includes/media.php:1113 +msgid "File URL" +msgstr "URL del archivo" + +#: wp-admin/includes/media.php:946 +msgid "Post URL" +msgstr "URL de la entrada" + +#: wp-includes/js/tinymce/langs/wp-langs.php:513 +#: wp-admin/includes/media.php:969 wp-admin/includes/media.php:2121 +msgid "Alternate Text" +msgstr "Texto alternativo" + +#: wp-admin/includes/media.php:970 wp-admin/includes/media.php:2124 +msgid "Alt text for the image, e.g. “The Mona Lisa”" +msgstr "Texto alternativo (alt) de la imagen, por ejemplo “La Mona Lisa”" + +#: wp-includes/js/tinymce/langs/wp-langs.php:76 +#: wp-includes/js/tinymce/langs/wp-langs.php:333 +#: wp-admin/includes/media.php:974 wp-admin/includes/media.php:2128 +msgid "Alignment" +msgstr "Alineación" + +#: wp-admin/includes/media.php:1030 +msgid "Empty Title filled from filename." +msgstr "Título vacío rellenado desde el nombre de fichero." + +#: wp-includes/js/tinymce/langs/wp-langs.php:512 +#: wp-admin/includes/media.php:1094 +msgid "Caption" +msgstr "Leyenda" + +#: wp-includes/js/tinymce/langs/wp-langs.php:343 +#: wp-admin/includes/media.php:1103 +msgid "Link URL" +msgstr "URL del enlace" + +#: wp-includes/js/tinymce/langs/wp-langs.php:491 +#: wp-admin/includes/media.php:1106 wp-admin/includes/media.php:2149 +msgid "Enter a link URL or click above for presets." +msgstr "Introduce una URL para el enlace o clic sobre el actual." + +#: wp-admin/includes/class-wp-posts-list-table.php:861 +#: wp-admin/includes/media.php:1109 wp-admin/includes/media.php:1817 +#: wp-admin/includes/meta-boxes.php:578 wp-admin/includes/meta-boxes.php:579 +msgid "Order" +msgstr "Orden" + +#: wp-admin/includes/media.php:1117 +msgid "Location of the uploaded file." +msgstr "Ubicación del archivo subido." + +#: wp-admin/includes/media.php:1214 wp-admin/includes/media.php:1803 +msgid "Show" +msgstr "Mostrar" + +#: wp-admin/includes/media.php:1215 wp-admin/includes/media.php:1804 +msgid "Hide" +msgstr "Ocultar" + +#: wp-includes/js/tinymce/langs/wp-langs.php:481 +#: wp-admin/includes/media.php:1270 +msgid "Edit Image" +msgstr "Editar imagen" + +#: wp-admin/includes/media.php:1288 +msgid "File name:" +msgstr "Nombre de archivo:" + +#: wp-admin/includes/media.php:1289 +msgid "File type:" +msgstr "Tipo de archivo:" + +#: wp-admin/includes/media.php:1290 +msgid "Upload date:" +msgstr "Fecha de subida:" + +#: wp-admin/includes/media.php:1292 +msgid "Dimensions:" +msgstr "Dimensiones:" + +#: wp-admin/includes/media.php:1312 wp-admin/includes/media.php:2257 +#: wp-admin/includes/media.php:2266 +msgid "Insert into Post" +msgstr "Insertar en la entrada" + +#: wp-admin/includes/media.php:1318 +msgid "You are about to delete %s." +msgstr "Estás a punto de eliminar %s." + +#: wp-admin/includes/media.php:1525 +msgid "Select Files" +msgstr "Elegir archivos" + +#: wp-admin/includes/media.php:1566 +msgid "Choose files to upload" +msgstr "Elige los archivos a subir" + +#: wp-admin/includes/media.php:1568 +msgid "Cancel Upload" +msgstr "Cancelar la subida" + +#: wp-admin/includes/media.php:1572 +msgid "After a file has been uploaded, you can add titles and descriptions." +msgstr "Después de subir un archivo, puedes agregar el título y la descripcion." + +#: wp-admin/includes/media.php:1618 +msgid "Add media files from your computer" +msgstr "Añadir archivos desde tu ordenador" + +#: wp-admin/includes/media.php:1647 wp-admin/includes/media.php:1827 +#: wp-admin/includes/media.php:2068 wp-admin/media-upload.php:96 +msgid "Save all changes" +msgstr "Guardar todos los cambios" + +#: wp-admin/includes/media.php:1679 +msgid "Add media file from URL" +msgstr "Añadir archivo desde una URL" + +#: wp-admin/includes/media.php:1802 +msgid "All Tabs:" +msgstr "Todas las pestañas:" + +#: wp-admin/includes/media.php:1806 +msgid "Sort Order:" +msgstr "Ordenar:" + +#: wp-admin/includes/media.php:1807 wp-admin/includes/media.php:1875 +msgid "Ascending" +msgstr "Ascendente" + +#: wp-admin/includes/media.php:1808 wp-admin/includes/media.php:1878 +msgid "Descending" +msgstr "Descendente" + +#: wp-includes/post.php:53 wp-admin/includes/media.php:1816 +#: wp-admin/menu.php:88 wp-admin/menu.php:232 +msgid "Media" +msgstr "Multimedia" + +#: wp-includes/post-template.php:1419 wp-admin/includes/media.php:1818 +msgid "Actions" +msgstr "Acciones" + +#: wp-admin/includes/media.php:1834 +msgid "Gallery Settings" +msgstr "Opciones de la galería" + +#: wp-admin/includes/media.php:1839 +msgid "Link thumbnails to:" +msgstr "Enlazar miniaturas a:" + +#: wp-admin/includes/media.php:1844 +msgid "Image File" +msgstr "Archivo de imagen" + +#: wp-admin/includes/media.php:1847 +msgid "Attachment Page" +msgstr "Página de adjuntos" + +#: wp-admin/includes/media.php:1854 +msgid "Order images by:" +msgstr "Ordenar imágenes por:" + +#: wp-admin/includes/media.php:1859 +msgid "Menu order" +msgstr "Orden del menú" + +#: wp-admin/includes/media.php:1861 +msgid "Date/Time" +msgstr "Fecha/Hora" + +#: wp-admin/includes/media.php:1862 +msgid "Random" +msgstr "Aleatorio" + +#: wp-admin/includes/media.php:1870 +msgid "Order:" +msgstr "Orden:" + +#: wp-admin/includes/media.php:1885 +msgid "Gallery columns:" +msgstr "Columnas de la galería" + +#: wp-admin/includes/media.php:1905 +msgid "Insert gallery" +msgstr "Insertar galería" + +#: wp-admin/includes/media.php:1906 +msgid "Update gallery settings" +msgstr "Actualizar ajustes de la galería" + +#: wp-admin/upload.php:210 wp-admin/includes/media.php:1949 +#: wp-admin/includes/media.php:1951 +msgid "Search Media" +msgstr "Buscar medios" + +#: wp-admin/includes/media.php:1974 +msgid "All Types" +msgstr "Todos los tipos" + +#: wp-admin/includes/media.php:2038 +msgid "Filter »" +msgstr "Filtrar »" + +#: wp-admin/includes/media.php:2087 +msgid "Image Caption" +msgstr "Leyenda de la imagen" + +#: wp-admin/includes/media.php:2101 +msgid "Insert an image from another web site" +msgstr "Insertar una imagen desde otra web" + +#: wp-includes/js/tinymce/langs/wp-langs.php:326 +#: wp-admin/includes/media.php:2105 +msgid "Image URL" +msgstr "URL de la imagen" + +#: wp-admin/includes/media.php:2113 +msgid "Image Title" +msgstr "Título de la imagen" + +#: wp-admin/includes/media.php:2143 +msgid "Link Image To:" +msgstr "Enlazar la imagen a:" + +#: wp-admin/includes/media.php:2148 +msgid "Link to image" +msgstr "Enlace a la imagen" + +#: wp-admin/includes/media.php:2169 +msgid "Audio File URL" +msgstr "URL del archivo de audio" + +#: wp-admin/includes/media.php:2181 +msgid "Link text, e.g. “Still Alive by Jonathan Coulton”" +msgstr "Texto del enlace, por ejemplo “Still Alive por Jonathan Coulton”" + +#: wp-admin/includes/media.php:2199 +msgid "Video URL" +msgstr "URL del vídeo" + +#: wp-admin/includes/media.php:2241 +msgid "Link text, e.g. “Ransom Demands (PDF)”" +msgstr "Texto del enlace, por ejemplo \"Peticiones de rescate (PDF)\"" + +#: wp-admin/includes/media.php:2297 +msgid "You are using the Flash uploader. Problems? Try the Browser uploader instead." +msgstr "Estás usando la subida de archivos mediante Flash. ¿Tienes problemas?, prueba el cargador del navegador." + +#: wp-admin/includes/media.php:2308 +msgid "You are using the Browser uploader." +msgstr "Estás usando el cargador del navegador." + +#: wp-admin/includes/media.php:2312 +msgid "Try the Flash uploader instead." +msgstr "Prueba el cargador Flash en su lugar." + +#: wp-includes/script-loader.php:348 wp-admin/includes/meta-boxes.php:33 +msgid "Save as Pending" +msgstr "Guardar como pendiente" + +#: wp-admin/includes/meta-boxes.php:42 +msgid "Preview Changes" +msgstr "Vista previa de los cambios" + +#: wp-admin/export.php:156 wp-admin/export.php:188 +#: wp-admin/includes/meta-boxes.php:60 +msgid "Status:" +msgstr "Estado:" + +#: wp-includes/script-loader.php:354 wp-admin/includes/meta-boxes.php:65 +#: wp-admin/includes/meta-boxes.php:92 +msgid "Privately Published" +msgstr "Publicada como privada" + +#: wp-includes/script-loader.php:337 wp-admin/includes/template.php:645 +#: wp-admin/includes/meta-boxes.php:103 wp-admin/includes/meta-boxes.php:149 +msgid "OK" +msgstr "Aceptar" + +#: wp-admin/includes/meta-boxes.php:111 +msgid "Visibility:" +msgstr "Visibilidad:" + +#: wp-includes/script-loader.php:350 wp-includes/post.php:598 +#: wp-includes/post.php:618 wp-admin/includes/class-wp-posts-list-table.php:808 +#: wp-admin/includes/class-wp-posts-list-table.php:950 +#: wp-admin/includes/template.php:1635 wp-admin/includes/meta-boxes.php:116 +#: wp-admin/includes/meta-boxes.php:146 +msgid "Private" +msgstr "Privada" + +#: wp-admin/includes/template.php:1633 wp-admin/includes/meta-boxes.php:119 +#: wp-admin/includes/meta-boxes.php:144 +msgid "Password protected" +msgstr "Protegida con contraseña" + +#: wp-includes/script-loader.php:352 wp-admin/includes/meta-boxes.php:122 +msgid "Public, Sticky" +msgstr "Pública, Fija" + +#: wp-includes/script-loader.php:351 wp-admin/includes/meta-boxes.php:125 +#: wp-admin/includes/meta-boxes.php:140 +msgid "Public" +msgstr "Público" + +#: wp-admin/includes/meta-boxes.php:142 +msgid "Stick this post to the front page" +msgstr "Fijar esta entrada en la página principal" + +#: wp-admin/includes/meta-boxes.php:162 +msgid "Scheduled for: %1$s" +msgstr "Programada para:%1$s" + +#: wp-admin/includes/meta-boxes.php:164 +msgid "Published on: %1$s" +msgstr "Publicada el: %1$s" + +#: wp-admin/includes/meta-boxes.php:166 wp-admin/includes/meta-boxes.php:174 +msgid "Publish immediately" +msgstr "Publicar inmediatamente" + +#: wp-admin/includes/meta-boxes.php:168 +msgid "Schedule for: %1$s" +msgstr "Programar para:%1$s" + +#: wp-admin/includes/meta-boxes.php:170 +msgid "Publish on: %1$s" +msgstr "Publicar el: %1$s" + +#: wp-includes/script-loader.php:346 wp-admin/includes/meta-boxes.php:212 +#: wp-admin/includes/meta-boxes.php:213 +msgid "Schedule" +msgstr "Programar" + +#: wp-includes/script-loader.php:279 wp-includes/script-loader.php:347 +#: wp-includes/js/tinymce/langs/wp-langs.php:18 +#: wp-admin/includes/class-wp-posts-list-table.php:999 +#: wp-admin/includes/class-wp-posts-list-table.php:1001 +#: wp-admin/includes/class-wp-posts-list-table.php:1004 +#: wp-admin/includes/internal-linking.php:118 +#: wp-admin/includes/template.php:507 +#: wp-admin/includes/class-wp-plugins-list-table.php:266 +#: wp-admin/includes/post.php:1779 wp-admin/includes/meta-boxes.php:224 +#: wp-admin/includes/meta-boxes.php:225 wp-admin/edit-tag-form.php:90 +msgid "Update" +msgstr "Actualizar" + +#: wp-includes/taxonomy.php:412 +msgid "Add or remove tags" +msgstr "Añadir o quitar etiquetas" + +#: wp-includes/script-loader.php:296 wp-includes/script-loader.php:334 +#: wp-admin/includes/widgets.php:182 wp-admin/includes/meta-boxes.php:293 +#: wp-admin/includes/meta-boxes.php:682 wp-admin/press-this.php:578 +msgid "Add" +msgstr "Añadir" + +#: wp-includes/taxonomy.php:403 wp-admin/includes/meta-boxes.php:656 +msgid "All Categories" +msgstr "Todas las categorías" + +#: wp-admin/includes/nav-menu.php:878 wp-admin/includes/meta-boxes.php:327 +#: wp-admin/includes/meta-boxes.php:657 wp-admin/press-this.php:524 +msgid "Most Used" +msgstr "Más utilizadas" + +#: wp-admin/includes/meta-boxes.php:678 wp-admin/includes/meta-boxes.php:680 +msgid "+ Add New Category" +msgstr "+ Añadir categoría nueva " + +#: wp-admin/includes/meta-boxes.php:681 +msgid "New category name" +msgstr "Nombre nueva categoría" + +#: wp-admin/includes/meta-boxes.php:383 +msgid "Excerpts are optional hand-crafted summaries of your content that can be used in your theme. Learn more about manual excerpts." +msgstr "Los extractos son resúmenes opcionales de tu contenido hechos \"ex-profeso\" que puedes usar en tu tema. Aprende algo acerca de los extractos manuales." + +#: wp-admin/includes/meta-boxes.php:398 +msgid "Already pinged:" +msgstr "Pingbacks enviados:" + +#: wp-admin/includes/meta-boxes.php:407 +msgid "Send trackbacks to:" +msgstr "Enviar trackbacks a:" + +#: wp-admin/includes/meta-boxes.php:407 +msgid "Separate multiple URLs with spaces" +msgstr "Separar varias URLs con espacios" + +#: wp-admin/includes/meta-boxes.php:431 +msgid "Custom fields can be used to add extra metadata to a post that you can use in your theme." +msgstr "Los campos personalizados se pueden usar para añadir metadatos adicionales a una entrada y luego mostrarlos en tu tema. ." + +#: wp-admin/includes/meta-boxes.php:448 +msgid "Allow trackbacks and pingbacks on this page." +msgstr "Permitir trackbacks y pingbacks en esta página." + +#: wp-admin/includes/meta-boxes.php:448 +msgid "http://codex.wordpress.org/Introduction_to_Blogging#Managing_Comments" +msgstr "http://codex.wordpress.org/Introduction_to_Blogging#Managing_Comments" + +#: wp-admin/includes/meta-boxes.php:489 +msgid "Show comments" +msgstr "Mostrar comentarios" + +#: wp-admin/includes/class-wp-posts-list-table.php:847 +#: wp-admin/includes/meta-boxes.php:562 wp-admin/includes/meta-boxes.php:563 +msgid "Parent" +msgstr "Superior" + +#: wp-admin/includes/class-wp-posts-list-table.php:849 +msgid "Main Page (no parent)" +msgstr "Página principal (sin superior)" + +#: wp-admin/includes/class-wp-posts-list-table.php:868 +#: wp-admin/includes/meta-boxes.php:571 +msgid "Template" +msgstr "Plantilla" + +#: wp-admin/includes/class-wp-posts-list-table.php:873 +#: wp-admin/includes/meta-boxes.php:573 +msgid "Default Template" +msgstr "Plantilla predeterminada" + +#: wp-admin/includes/meta-boxes.php:608 +msgid "Visit Link" +msgstr "Visitar enlace" + +#: wp-admin/includes/meta-boxes.php:616 +msgid "Keep this link private" +msgstr "Mantener este enlace como privado" + +#: wp-admin/includes/class-wp-links-list-table.php:140 +#: wp-admin/includes/meta-boxes.php:627 +msgid "" +"You are about to delete this link '%s'\n" +" 'Cancel' to stop, 'OK' to delete." +msgstr "" +"Estás a punto de borrar este enlace '%s'\n" +" 'Cancelar' para borrar, 'Aceptar' para borrarlo." + +#: wp-admin/includes/meta-boxes.php:702 +msgid "_blank — new window or tab." +msgstr "_blank — nueva ventana o pestaña." + +#: wp-admin/includes/meta-boxes.php:705 +msgid "_top — current window or tab, with no frames." +msgstr "_top — ventana o pestaña actual, sin marcos." + +#: wp-admin/includes/meta-boxes.php:708 +msgid "_none — same window or tab." +msgstr "_none — misma ventana o pestaña." + +#: wp-admin/includes/meta-boxes.php:710 +msgid "Choose the target frame for your link." +msgstr "Ellige el marco de destino para tu enlace." + +#: wp-admin/includes/meta-boxes.php:757 +msgid "rel:" +msgstr "rel:" + +#: wp-admin/includes/meta-boxes.php:764 wp-admin/includes/meta-boxes.php:765 +msgid "identity" +msgstr "identidad" + +#: wp-admin/includes/meta-boxes.php:768 +msgid "another web address of mine" +msgstr "otra dirección web mía" + +#: wp-admin/includes/meta-boxes.php:772 wp-admin/includes/meta-boxes.php:773 +msgid "friendship" +msgstr "amistad" + +#: wp-admin/includes/meta-boxes.php:775 +msgid "contact" +msgstr "contacto" + +#: wp-admin/includes/meta-boxes.php:777 +msgid "acquaintance" +msgstr "conocido" + +#: wp-admin/includes/meta-boxes.php:779 +msgid "friend" +msgstr "amigo" + +#: wp-admin/includes/meta-boxes.php:781 wp-admin/includes/meta-boxes.php:814 +#: wp-admin/includes/meta-boxes.php:837 +msgid "none" +msgstr "ninguno" + +#: wp-admin/includes/meta-boxes.php:785 wp-admin/includes/meta-boxes.php:786 +msgid "physical" +msgstr "físico" + +#: wp-admin/includes/meta-boxes.php:789 +msgid "met" +msgstr "conocido en persona" + +#: wp-admin/includes/meta-boxes.php:793 wp-admin/includes/meta-boxes.php:794 +msgid "professional" +msgstr "profesional" + +#: wp-admin/includes/meta-boxes.php:797 +msgid "co-worker" +msgstr "compañero de trabajo" + +#: wp-admin/includes/meta-boxes.php:800 +msgid "colleague" +msgstr "colega" + +#: wp-admin/includes/meta-boxes.php:804 wp-admin/includes/meta-boxes.php:805 +msgid "geographical" +msgstr "geográfico" + +#: wp-admin/includes/meta-boxes.php:808 +msgid "co-resident" +msgstr "co-residente" + +#: wp-admin/includes/meta-boxes.php:811 +msgid "neighbor" +msgstr "vecino" + +#: wp-admin/includes/meta-boxes.php:818 wp-admin/includes/meta-boxes.php:819 +msgid "family" +msgstr "familia" + +#: wp-admin/includes/meta-boxes.php:822 +msgid "child" +msgstr "hija/o" + +#: wp-admin/includes/meta-boxes.php:825 +msgid "kin" +msgstr "pariente" + +#: wp-admin/includes/meta-boxes.php:828 +msgid "parent" +msgstr "padre/madre" + +#: wp-admin/includes/meta-boxes.php:831 +msgid "sibling" +msgstr "hermano/a" + +#: wp-admin/includes/meta-boxes.php:834 +msgid "spouse" +msgstr "cónyuge" + +#: wp-admin/includes/meta-boxes.php:841 wp-admin/includes/meta-boxes.php:842 +msgid "romantic" +msgstr "romántica" + +#: wp-admin/includes/meta-boxes.php:845 +msgid "muse" +msgstr "inspiración" + +#: wp-admin/includes/meta-boxes.php:848 +msgid "crush" +msgstr "flechazo" + +#: wp-admin/includes/meta-boxes.php:851 +msgid "date" +msgstr "fecha" + +#: wp-admin/includes/meta-boxes.php:854 +msgid "sweetheart" +msgstr "pareja" + +#: wp-admin/includes/meta-boxes.php:861 +msgid "If the link is to a person, you can specify your relationship with them using the above form. If you would like to learn more about the idea check out XFN." +msgstr "Si el enlace es a una persona, puedes especificar tu relación con ella utilizando el formulario de arriba. Si deseas aprender más acerca de cómo funciona esto revisa el XFN." + +#: wp-admin/includes/meta-boxes.php:877 +msgid "Image Address" +msgstr "Dirección de la imagen" + +#: wp-admin/includes/meta-boxes.php:881 +msgid "RSS Address" +msgstr "Dirección RSS" + +#: wp-admin/includes/meta-boxes.php:885 +msgid "Notes" +msgstr "Notas" + +#: wp-admin/includes/class-wp-links-list-table.php:85 +#: wp-admin/includes/meta-boxes.php:889 +#: wp-admin/includes/class-wp-plugin-install-list-table.php:143 +msgid "Rating" +msgstr "Valoración" + +#: wp-admin/includes/meta-boxes.php:898 +msgid "(Leave at 0 for no rating.)" +msgstr "(Dejalo en 0 para no valorar.)" + +#: wp-admin/includes/dashboard.php:1150 +msgid "Storage Space" +msgstr "Espacio de almacenamiento" + +#: wp-admin/includes/dashboard.php:1155 +msgid "Space Allowed" +msgstr "Espacio permitido" + +#: wp-admin/includes/dashboard.php:1163 +msgid "Space Used" +msgstr "Espacio utilizado" + +#: wp-admin/includes/menu.php:225 +msgid "You do not have sufficient permissions to access this page." +msgstr "No tienes suficientes permisos para acceder a esta página" + +#: wp-includes/script-loader.php:242 wp-admin/async-upload.php:55 +#: wp-admin/includes/dashboard.php:1193 +msgid "Dismiss" +msgstr "Omitir" + +#: wp-admin/includes/plugin-install.php:84 +msgid "Plugins extend and expand the functionality of WordPress. You may automatically install plugins from the WordPress Plugin Directory or upload a plugin in .zip format via this page." +msgstr "Los plugins amplían las funciones de WordPress. Puedes instalarlos automáticamente desde el directorio de plugins de WordPress o subir un plugin en formato .zip desde esta página." + +#: wp-includes/class-wp-admin-bar.php:104 wp-includes/default-widgets.php:175 +#: wp-includes/general-template.php:163 wp-admin/includes/plugin-install.php:86 +#: wp-admin/includes/class-wp-theme-install-list-table.php:29 +#: wp-admin/includes/internal-linking.php:93 +#: wp-admin/includes/template.php:1358 wp-admin/includes/template.php:1360 +#: wp-admin/includes/theme-install.php:66 wp-admin/includes/nav-menu.php:666 +#: wp-admin/includes/nav-menu.php:695 wp-admin/includes/nav-menu.php:697 +#: wp-admin/includes/nav-menu.php:880 wp-admin/includes/nav-menu.php:929 +#: wp-admin/includes/nav-menu.php:931 +#: wp-admin/includes/class-wp-plugin-install-list-table.php:29 +#: wp-content/plugins/akismet/legacy.php:176 +msgid "Search" +msgstr "Buscar" + +#: wp-admin/includes/plugin-install.php:87 +msgid "Search for plugins by keyword, author, or tag." +msgstr "Búsqueda de plugins por palabra clave, autor o etiqueta." + +#: wp-admin/includes/plugin-install.php:90 +msgid "Popular tags" +msgstr "Etiquetas populares" + +#: wp-admin/includes/plugin-install.php:91 +msgid "You may also browse based on the most popular tags in the Plugin Directory:" +msgstr "También puedes ver las etiquetas más populares del directorio de plugins:" + +#: wp-admin/includes/plugin-install.php:108 +msgid "%d plugin" +msgstr "%d plugin" + +#: wp-admin/includes/plugin-install.php:108 +msgid "%d plugins" +msgstr "%d plugins" + +#: wp-admin/includes/plugin-install.php:126 +#: wp-admin/includes/theme-install.php:61 +msgid "Term" +msgstr "Término" + +#: wp-admin/includes/plugin-install.php:131 +#: wp-admin/includes/plugin-install.php:132 +msgid "Search Plugins" +msgstr "Buscar plugins" + +#: wp-admin/includes/plugin-install.php:144 +msgid "Install a plugin in .zip format" +msgstr "Instalar un plugin en formato .zip" + +#: wp-admin/includes/plugin-install.php:145 +msgid "If you have a plugin in a .zip format, you may install it by uploading it here." +msgstr "Si tienes un plugin en un archivo .zip, puedes subirlo e instalarlo desde aquí." + +#: wp-admin/includes/plugin-install.php:148 +msgid "Plugin zip file" +msgstr "Archivo .zip del plugin" + +#: wp-admin/includes/plugin-install.php:150 +#: wp-admin/includes/plugin-install.php:289 +#: wp-admin/includes/theme-install.php:122 +#: wp-admin/includes/theme-install.php:291 +#: wp-admin/includes/class-wp-plugin-install-list-table.php:200 +msgid "Install Now" +msgstr "Instalar ahora" + +#: wp-includes/js/tinymce/langs/wp-langs.php:309 +#: wp-admin/includes/class-wp-plugin-install-list-table.php:142 +msgid "Version" +msgstr "Versión" + +#: wp-admin/includes/class-wp-plugin-install-list-table.php:97 +msgid "No plugins match your request." +msgstr "No hay plugins que mostrar." + +#: wp-admin/includes/class-wp-plugins-list-table.php:434 +#: wp-admin/includes/plugin.php:145 +#: wp-admin/includes/class-wp-plugin-install-list-table.php:185 +msgid "By %s" +msgstr "Por %s" + +#: wp-admin/includes/plugin-install.php:328 +#: wp-admin/includes/plugin-install.php:336 +#: wp-admin/includes/theme-install.php:173 +#: wp-admin/includes/class-wp-plugin-install-list-table.php:221 +msgid "(based on %s rating)" +msgid_plural "(based on %s ratings)" +msgstr[0] "(basado en %s voto)" +msgstr[1] "(basado en %s votos)" + +#: wp-admin/includes/plugin-install.php:330 +#: wp-admin/includes/theme-install.php:175 +#: wp-admin/includes/class-wp-plugin-install-list-table.php:230 +msgid "5 stars" +msgstr "5 estrellas" + +#: wp-admin/includes/plugin-install.php:331 +#: wp-admin/includes/theme-install.php:176 +#: wp-admin/includes/class-wp-plugin-install-list-table.php:231 +msgid "4 stars" +msgstr "4 estrellas" + +#: wp-admin/includes/plugin-install.php:332 +#: wp-admin/includes/theme-install.php:177 +#: wp-admin/includes/class-wp-plugin-install-list-table.php:232 +msgid "3 stars" +msgstr "3 estrellas" + +#: wp-admin/includes/plugin-install.php:333 +#: wp-admin/includes/theme-install.php:178 +#: wp-admin/includes/class-wp-plugin-install-list-table.php:233 +msgid "2 stars" +msgstr "2 estrellas" + +#: wp-admin/includes/plugin-install.php:334 +#: wp-admin/includes/theme-install.php:179 +#: wp-admin/includes/class-wp-plugin-install-list-table.php:234 +msgid "1 star" +msgstr "1 estrella" + +#: wp-admin/includes/plugin-install.php:264 wp-admin/update.php:103 +msgid "Plugin Install" +msgstr "Instalar plugin" + +#: wp-admin/includes/plugin-install.php:293 +#: wp-admin/includes/theme-install.php:296 +msgid "Install Update Now" +msgstr "Instalar actualización ahora" + +#: wp-admin/includes/plugin-install.php:296 +msgid "Newer Version (%s) Installed" +msgstr "Instalada la última versión (%s)" + +#: wp-admin/includes/plugin-install.php:299 +msgid "Latest Version Installed" +msgstr "Instalada la última versión" + +#: wp-admin/includes/plugin-install.php:305 +msgid "FYI" +msgstr "FYI" + +#: wp-includes/js/tinymce/wp-mce-help.php:270 +#: wp-admin/includes/plugin-install.php:308 +#: wp-admin/includes/theme-install.php:162 +msgid "Version:" +msgstr "Versión:" + +#: wp-admin/includes/plugin-install.php:310 +#: wp-admin/includes/theme-install.php:163 +msgid "Author:" +msgstr "Autor:" + +#: wp-admin/includes/plugin-install.php:312 +#: wp-admin/includes/theme-install.php:165 +msgid "Last Updated:" +msgstr "Última actualización:" + +#: wp-admin/includes/plugin-install.php:315 +#: wp-admin/includes/theme-install.php:167 +msgid "Requires WordPress Version:" +msgstr "Requiere la versión de WordPress:" + +#: wp-admin/includes/plugin-install.php:315 +#: wp-admin/includes/theme-install.php:167 +msgid "%s or higher" +msgstr "%s o superior" + +#: wp-admin/includes/plugin-install.php:317 +#: wp-admin/includes/theme-install.php:169 +msgid "Compatible up to:" +msgstr "Compatible con:" + +#: wp-admin/includes/plugin-install.php:319 +#: wp-admin/includes/theme-install.php:171 +msgid "Downloaded:" +msgstr "Descargado:" + +#: wp-admin/includes/plugin-install.php:319 +#: wp-admin/includes/theme-install.php:171 +msgid "%s time" +msgid_plural "%s times" +msgstr[0] "%s vez" +msgstr[1] "%s veces" + +#: wp-admin/includes/plugin-install.php:321 +msgid "WordPress.org Plugin Page »" +msgstr "Página de plugins de WordPress.org »" + +#: wp-admin/includes/plugin-install.php:323 +msgid "Plugin Homepage »" +msgstr "Página del plugin »" + +#: wp-admin/includes/plugin-install.php:327 +msgid "Average Rating" +msgstr "Puntuación promedio" + +#: wp-admin/includes/plugin-install.php:342 +msgid "Warning: This plugin has not been tested with your current version of WordPress." +msgstr "Atención: Este plugin no ha sido probado en esta versión de WordPress." + +#: wp-admin/includes/plugin-install.php:345 +msgid "Warning: This plugin has not been marked as compatible with your version of WordPress." +msgstr "Atención: Este plugin no es compatible con esta versión de WordPress." + +#: wp-admin/includes/plugin.php:92 +msgid "The %1$s plugin header is deprecated. Use %2$s instead." +msgstr "La cabecera del plugin %1$s es obsoleta. Usa %2$s en su lugar." + +#: wp-admin/includes/plugin.php:136 +msgid "Visit plugin homepage" +msgstr "Visitar la web del plugin" + +#: wp-includes/theme.php:242 +#: wp-admin/includes/class-wp-plugins-list-table.php:433 +#: wp-admin/includes/plugin.php:141 +msgid "Visit author homepage" +msgstr "Visitar la web del autor" + +#: wp-admin/includes/plugin.php:541 +msgid "The plugin generated unexpected output." +msgstr "El plugin ha generado una respuesta insesperada." + +#: wp-admin/includes/plugin.php:629 +msgid "One of the plugins is invalid." +msgstr "Uno de los plugins no es válido." + +#: wp-admin/includes/plugin.php:715 +msgid "Could not fully remove the plugin(s) %s." +msgstr "No se pudo/ieron eliminar completamente el/los plugin/s %s." + +#: wp-admin/includes/plugin.php:776 +msgid "Invalid plugin path." +msgstr "La ruta del plugin no es válida." + +#: wp-admin/includes/plugin.php:778 +msgid "Plugin file does not exist." +msgstr "El archivo del plugin no existe." + +#: wp-admin/includes/plugin.php:782 +msgid "The plugin does not have a valid header." +msgstr "El plugin no tiene una cabecera válida." + +#: wp-admin/includes/post.php:59 +msgid "You are not allowed to edit pages as this user." +msgstr "No tienes autorización para editar páginas con este nombre de usuario." + +#: wp-admin/includes/post.php:60 +msgid "You are not allowed to create pages as this user." +msgstr "No tienes autorización para crear páginas con ese nombre de usuario." + +#: wp-admin/includes/post.php:64 +msgid "You are not allowed to edit posts as this user." +msgstr "No tienes autorización para editar entradas con este nombre de usuario." + +#: wp-admin/includes/post.php:65 +msgid "You are not allowed to post as this user." +msgstr "No tienes autorización para publicar con este nombre de usuario." + +#: wp-admin/includes/post.php:282 +msgid "You are not allowed to edit pages." +msgstr "No tienes autorización para editar páginas." + +#: wp-admin/includes/post.php:284 +msgid "You are not allowed to edit posts." +msgstr "No tienes autorización para editar entradas." + +#: wp-admin/includes/post.php:423 +msgid "Auto Draft" +msgstr "Borrador automático" + +#: wp-admin/includes/post.php:987 +msgid "Images" +msgstr "Imágenes" + +#: wp-admin/includes/post.php:987 +msgid "Manage Images" +msgstr "Administrar imágenes" + +#: wp-admin/includes/post.php:987 +msgid "Image (%s)" +msgid_plural "Images (%s)" +msgstr[0] "Imagen (%s)" +msgstr[1] "Imágenes (%s)" + +#: wp-admin/includes/post.php:988 +msgid "Audio" +msgstr "Audio" + +#: wp-admin/includes/post.php:988 +msgid "Manage Audio" +msgstr "Administrar audio" + +#: wp-admin/includes/post.php:988 +msgid "Audio (%s)" +msgid_plural "Audio (%s)" +msgstr[0] "Audio (%s)" +msgstr[1] "Audio (%s)" + +#: wp-admin/includes/post.php:989 +msgid "Video" +msgstr "Vídeo" + +#: wp-admin/includes/post.php:989 +msgid "Manage Video" +msgstr "Administrar vídeo" + +#: wp-admin/includes/post.php:989 +msgid "Video (%s)" +msgid_plural "Video (%s)" +msgstr[0] "Vídeo (%s)" +msgstr[1] "Vídeos (%s)" + +#: wp-includes/post.php:1183 +msgid "View Page" +msgstr "Ver página" + +#: wp-admin/includes/post.php:1168 +msgid "Click to edit this part of the permalink" +msgstr "Haz clic para editar esta parte del enlace permanente" + +#: wp-admin/includes/post.php:1170 +msgid "Temporary permalink. Click to edit this part." +msgstr "Enlace permanente temporal. Haz clic para editar esta parte." + +#: wp-admin/includes/post.php:1174 wp-admin/includes/post.php:1202 +msgid "Permalink:" +msgstr "Enlace permanente:" + +#: wp-admin/includes/post.php:1176 +msgid "Change Permalinks" +msgstr "Enlaces permanentes" + +#: wp-admin/includes/post.php:1308 +msgid "Warning: %s is currently editing this post" +msgstr "Atención: %s está editando actualmente esta entrada" + +#: wp-admin/includes/post.php:1311 +msgid "Warning: %s is currently editing this page" +msgstr "Atención: %s está editando actualmente esta página" + +#: wp-admin/includes/post.php:1314 +msgid "Warning: %s is currently editing this." +msgstr "Atención: %s está editando actualmente esto." + +#: wp-admin/includes/post.php:1372 +msgid "Preview not available. Please save as a draft first." +msgstr "Vista previa no disponible. Por favor, guarda antes el borrador." + +#: wp-admin/includes/schema.php:202 +msgid "Just another WordPress site" +msgstr "Otro sitio realizado con WordPress" + +#: wp-admin/options-general.php:225 wp-admin/includes/schema.php:223 +msgid "F j, Y" +msgstr "j F, Y" + +#: wp-admin/options-general.php:258 wp-admin/includes/schema.php:225 +msgid "g:i a" +msgstr "G:i" + +#: wp-admin/includes/schema.php:227 +msgid "F j, Y g:i a" +msgstr "j F, Y G:i" + +#: wp-admin/includes/schema.php:329 +msgid "Just another %s site" +msgstr "Otro sitio más de %s" + +#: wp-admin/includes/schema.php:397 +msgctxt "User role" +msgid "Administrator" +msgstr "Administrador" + +#: wp-admin/includes/schema.php:399 +msgctxt "User role" +msgid "Editor" +msgstr "Editor" + +#: wp-admin/includes/schema.php:401 +msgctxt "User role" +msgid "Author" +msgstr "Autor" + +#: wp-admin/includes/schema.php:403 +msgctxt "User role" +msgid "Contributor" +msgstr "Colaborador" + +#: wp-admin/includes/schema.php:405 +msgctxt "User role" +msgid "Subscriber" +msgstr "Suscriptor" + +#: wp-admin/includes/upgrade.php:199 wp-admin/includes/schema.php:712 +msgid "Welcome to SITE_NAME. This is your first post. Edit or delete it, then start blogging!" +msgstr "Te damos la bienvenida a SITE_NAME. Este es tu primer artículo. Edítalo o bórralo... ¡y comienza a publicar!" + +#: wp-admin/includes/schema.php:769 +msgid "Warning! Wildcard DNS may not be configured correctly!" +msgstr "¡Atención! ¡Puede que las DNS no estén configuradas correctamente." + +#: wp-admin/includes/class-wp-posts-list-table.php:732 +#: wp-admin/includes/class-wp-comments-list-table.php:415 +#: wp-admin/includes/class-wp-terms-list-table.php:336 +msgid "Quick Edit" +msgstr "Edición rápida" + +#: wp-admin/includes/class-wp-posts-list-table.php:543 +#: wp-admin/includes/class-wp-comments-list-table.php:415 +#: wp-admin/includes/class-wp-terms-list-table.php:260 +msgid "Quick Edit" +msgstr "Edición rápida" + +#: wp-admin/includes/class-wp-posts-list-table.php:271 +msgctxt "column name" +msgid "Title" +msgstr "Título" + +#: wp-admin/includes/class-wp-media-list-table.php:134 +msgctxt "column name" +msgid "File" +msgstr "Archivo" + +#: wp-admin/includes/class-wp-media-list-table.php:139 +msgctxt "column name" +msgid "Attached to" +msgstr "Adjunto a" + +#: wp-admin/includes/class-wp-media-list-table.php:143 +msgctxt "column name" +msgid "Date" +msgstr "Fecha" + +#: wp-admin/includes/class-wp-comments-list-table.php:255 +#: wp-admin/includes/class-wp-comments-list-table.php:526 +msgctxt "column name" +msgid "Comment" +msgstr "Comentario" + +#: wp-admin/includes/class-wp-links-list-table.php:83 +msgid "Relationship" +msgstr "Relación con el enlace (XFN)" + +#: wp-admin/includes/class-wp-links-list-table.php:84 +msgid "Visible" +msgstr "Visible" + +#: wp-includes/default-widgets.php:94 wp-admin/link-manager.php:40 +#: wp-admin/includes/class-wp-terms-list-table.php:106 wp-admin/menu.php:93 +msgid "Links" +msgstr "Enlaces" + +#: wp-admin/user-new.php:245 wp-admin/user-new.php:325 +#: wp-admin/includes/class-wp-users-list-table.php:166 +msgid "Role" +msgstr "Perfil" + +#: wp-admin/includes/class-wp-posts-list-table.php:732 +msgid "Bulk Edit" +msgstr "Edición masiva" + +#: wp-admin/includes/class-wp-posts-list-table.php:777 +#: wp-admin/includes/class-wp-posts-list-table.php:851 +#: wp-admin/includes/class-wp-posts-list-table.php:871 +#: wp-admin/includes/class-wp-posts-list-table.php:903 +#: wp-admin/includes/class-wp-posts-list-table.php:912 +#: wp-admin/includes/class-wp-posts-list-table.php:944 +#: wp-admin/includes/class-wp-posts-list-table.php:965 +msgid "— No Change —" +msgstr "— Sin cambios —" + +#: wp-admin/includes/class-wp-posts-list-table.php:803 +msgid "–OR–" +msgstr "–O–" + +#: wp-admin/includes/class-wp-posts-list-table.php:823 +msgid "[more]" +msgstr "[más]" + +#: wp-admin/includes/class-wp-posts-list-table.php:824 +msgid "[less]" +msgstr "[menos]" + +#: wp-admin/includes/class-wp-posts-list-table.php:904 +#: wp-admin/includes/class-wp-posts-list-table.php:913 +msgid "Allow" +msgstr "Permitir" + +#: wp-admin/includes/class-wp-posts-list-table.php:905 +#: wp-admin/includes/class-wp-posts-list-table.php:914 +msgid "Do not allow" +msgstr "No permitir" + +#: wp-admin/includes/class-wp-posts-list-table.php:926 +msgid "Allow Comments" +msgstr "Permitir comentarios" + +#: wp-admin/includes/class-wp-posts-list-table.php:931 +msgid "Allow Pings" +msgstr "Permitir pings" + +#: wp-admin/includes/class-wp-posts-list-table.php:963 +#: wp-admin/includes/class-wp-posts-list-table.php:966 +#: wp-admin/includes/template.php:1642 +msgid "Sticky" +msgstr "Fija" + +#: wp-admin/includes/class-wp-posts-list-table.php:967 +msgid "Not Sticky" +msgstr "No es fija" + +#: wp-admin/includes/class-wp-posts-list-table.php:975 +msgid "Make this post sticky" +msgstr "Marcar esta entrada como fija" + +#: wp-admin/includes/class-wp-posts-list-table.php:596 +msgid "Missed schedule" +msgstr "Programación perdida" + +#: wp-admin/includes/class-wp-posts-list-table.php:600 +msgid "Last Modified" +msgstr "Última modificación" + +#: wp-includes/category-template.php:161 +#: wp-admin/includes/class-wp-posts-list-table.php:619 +#: wp-admin/includes/upgrade.php:109 +msgid "Uncategorized" +msgstr "Sin categoría" + +#: wp-includes/pluggable.php:1262 +#: wp-admin/includes/class-wp-users-list-table.php:291 +msgid "E-mail: %s" +msgstr "Correo electrónico: %s" + +#: wp-admin/includes/class-wp-users-list-table.php:300 +msgid "View posts by this author" +msgstr "Ver las entradas de este autor" + +#: wp-admin/includes/class-wp-comments-list-table.php:335 +msgid "Y/m/d \\a\\t g:i A" +msgstr "d/m/Y \\a\\t G:i" + +#: wp-admin/includes/class-wp-comments-list-table.php:362 +msgid "In reply to %2$s." +msgstr "En respuesta a %2$s." + +#: wp-admin/includes/class-wp-comments-list-table.php:475 +msgid "Y/m/d \\a\\t g:ia" +msgstr "d/m/Y \\a\\t G:i" + +#: wp-admin/includes/template.php:347 +msgid "Reply to Comment" +msgstr "Responder al comentarío" + +#: wp-admin/includes/template.php:373 +msgid "Submit Reply" +msgstr "Enviar respuesta" + +#: wp-admin/includes/template.php:406 +msgid "Comment by %s moved to the trash." +msgstr "Comentario de %s movido a la papelera." + +#: wp-admin/includes/template.php:409 +msgid "Comment by %s marked as spam." +msgstr "El comentario de %s se ha marcado como spam." + +#: wp-admin/includes/template.php:429 wp-admin/includes/template.php:444 +#: wp-admin/includes/template.php:512 wp-admin/includes/template.php:539 +msgid "Value" +msgstr "Valor" + +#: wp-admin/includes/template.php:502 +msgid "Key" +msgstr "Clave" + +#: wp-admin/includes/template.php:534 +msgid "Add New Custom Field:" +msgstr "Añadir nuevo campo personalizado:" + +#: wp-admin/includes/template.php:558 +msgid "Enter new" +msgstr "Nuevo" + +#: wp-admin/includes/template.php:568 +msgid "Add Custom Field" +msgstr "Añadir un campo personalizado" + +#: wp-admin/includes/template.php:630 +msgid "%1$s%2$s, %3$s @ %4$s : %5$s" +msgstr "%1$s%2$s, %3$s @ %4$s : %5$s" + +#: wp-admin/includes/template.php:735 +msgid "Thumbnail linked to file" +msgstr "Miniatura enlazada al archivo" + +#: wp-admin/includes/template.php:735 +msgid "Image linked to file" +msgstr "Imagen enlazada al archivo" + +#: wp-admin/includes/template.php:739 +msgid "Thumbnail linked to page" +msgstr "Miniatura enlazada a la página" + +#: wp-admin/includes/template.php:739 +msgid "Image linked to page" +msgstr "Imagen enlazada a la página" + +#: wp-admin/includes/template.php:744 +msgid "Link to file" +msgstr "Enlace al archivo" + +#: wp-admin/includes/template.php:748 +msgid "Link to page" +msgstr "Enlace a la página" + +#: wp-admin/includes/template.php:843 +msgid "Before you can upload your import file, you will need to fix the following error:" +msgstr "Antes de poder subir el fichero de importación, debes resolver el siguiente error:" + +#: wp-admin/includes/template.php:849 +msgid "Choose a file from your computer:" +msgstr "Elige un archivo de tu ordenador:" + +#: wp-admin/includes/template.php:849 +msgid "Maximum size: %s" +msgstr "Tamaño máximo: %s" + +#: wp-admin/includes/template.php:854 +msgid "Upload file and import" +msgstr "Subir archivo e importar" + +#: wp-admin/includes/template.php:967 wp-admin/press-this.php:483 +#: wp-admin/press-this.php:517 wp-admin/press-this.php:567 +msgid "Click to toggle" +msgstr "Haz clic para cambiar" + +#: wp-admin/includes/template.php:1349 +msgid "Find Posts or Pages" +msgstr "Buscar entradas o páginas" + +#: wp-includes/theme-compat/sidebar.php:55 wp-includes/post-template.php:810 +#: wp-includes/default-widgets.php:18 wp-includes/default-widgets.php:24 +#: wp-admin/export.php:167 wp-admin/menu.php:99 +msgid "Pages" +msgstr "Páginas" + +#: wp-includes/script-loader.php:200 +#: wp-includes/js/tinymce/langs/wp-langs.php:20 +#: wp-includes/js/tinymce/wp-mce-help.php:284 wp-login.php:582 +#: wp-admin/includes/template.php:1376 wp-admin/includes/widgets.php:207 +msgid "Close" +msgstr "Cerrar" + +#: wp-admin/plugin-editor.php:195 wp-admin/theme-editor.php:164 +#: wp-admin/includes/template.php:1377 +#: wp-admin/includes/class-wp-plugins-list-table.php:396 +#: wp-admin/nav-menus.php:497 +msgid "Select" +msgstr "Elegir" + +#: wp-includes/post.php:1182 wp-admin/includes/template.php:1466 +msgid "New Page" +msgstr "Nueva página" + +#: wp-admin/includes/template.php:1425 +msgid "New Media" +msgstr "Añadir medio" + +#: wp-admin/media.php:45 wp-admin/includes/template.php:1428 +msgid "Edit Media" +msgstr "Editar multimedia" + +#: wp-admin/includes/template.php:1433 +msgid "New Link" +msgstr "Añadir enlace" + +#: wp-admin/includes/template.php:1435 +msgid "Edit Links" +msgstr "Editar enlaces" + +#: wp-admin/includes/template.php:1438 +msgid "New User" +msgstr "Añadir usuario" + +#: wp-admin/includes/template.php:1441 +msgid "Edit Users" +msgstr "Editar usuarios" + +#: wp-admin/plugin-install.php:27 wp-admin/includes/template.php:1444 +msgid "Install Plugins" +msgstr "Instalar plugins" + +#: wp-admin/includes/template.php:1447 +msgid "Manage Plugins" +msgstr "Administrar plugins" + +#: wp-admin/theme-install.php:27 wp-admin/includes/template.php:1450 +#: wp-admin/update.php:206 +msgid "Install Themes" +msgstr "Instalar temas" + +#: wp-admin/themes.php:35 wp-admin/includes/template.php:1453 +msgid "Manage Themes" +msgstr "Administrar temas" + +#: wp-includes/post.php:1182 wp-includes/admin-bar.php:141 +#: wp-admin/includes/template.php:1456 wp-admin/includes/template.php:1464 +msgid "New Post" +msgstr "Nueva entrada" + +#: wp-admin/includes/template.php:1465 +msgid "Drafts" +msgstr "Borradores" + +#: wp-includes/script-loader.php:281 wp-includes/script-loader.php:393 +#: wp-admin/includes/template.php:1522 +msgid "(no title)" +msgstr "(sin título)" + +#: wp-admin/includes/template.php:1640 +msgctxt "post state" +msgid "Pending" +msgstr "Pendiente" + +#: wp-admin/includes/template.php:1743 +msgid "Enable accessibility mode" +msgstr "Activar modo de accesibilidad" + +#: wp-admin/includes/template.php:1743 +msgid "Disable accessibility mode" +msgstr "Desactivar modo de accesibilidad" + +#: wp-admin/includes/class-wp-themes-list-table.php:168 +#: wp-admin/includes/class-wp-upgrader.php:1353 +#: wp-admin/includes/class-wp-upgrader.php:1406 +#: wp-admin/includes/class-wp-plugins-list-table.php:258 +#: wp-admin/includes/class-wp-plugins-list-table.php:379 +msgid "Activate" +msgstr "Activar" + +#: wp-includes/post-template.php:1216 wp-admin/includes/meta-boxes.php:145 +msgid "Password:" +msgstr "Contraseña:" + +#: wp-admin/admin-ajax.php:36 +msgid "ALERT: You are logged out! Could not save draft. Please log in again." +msgstr "ATENCIÓN: ¡No has iniciado la sesión! No se pudo guardar el borrador. Vuelve a iniciar la sesión." + +#: wp-admin/includes/media.php:1997 wp-admin/includes/nav-menu.php:627 +#: wp-admin/includes/nav-menu.php:844 +msgid "«" +msgstr "«" + +#: wp-admin/includes/media.php:1998 wp-admin/includes/nav-menu.php:628 +#: wp-admin/includes/nav-menu.php:845 +msgid "»" +msgstr "»" + +#: wp-admin/admin-ajax.php:455 +msgid "Comment %d does not exist" +msgstr "El comentario %d no existe" + +#: wp-admin/includes/taxonomy.php:100 +msgid "You did not enter a category name." +msgstr "No has introducido un nombre de categoría." + +#: wp-admin/admin-ajax.php:577 +msgid "No tags found!" +msgstr "¡No se han encontrado etiquetas!" + +#: wp-admin/admin-ajax.php:641 +msgid "Error: you are replying to a comment on a draft post." +msgstr "Error: estás respondiendo a un comentario de una entrada en borrador." + +#: wp-admin/admin-ajax.php:656 +msgid "Sorry, you must be logged in to reply to a comment." +msgstr "Lo siento, tienes que iniciar sesión para responder a un comentario." + +#: wp-admin/admin-ajax.php:660 wp-admin/admin-ajax.php:722 +#: wp-comments-post.php:84 +msgid "Error: please type a comment." +msgstr "Error: por favor, escribe un comentario." + +#: wp-admin/admin-ajax.php:843 wp-admin/admin-ajax.php:848 +#: wp-admin/admin-ajax.php:868 +msgid "Please provide a custom field value." +msgstr "Por favor, pon algún valor en el campo personalizado." + +#: wp-admin/admin-ajax.php:918 +msgid "User %s added" +msgstr "Usuario %s añadido" + +#: wp-admin/admin-ajax.php:938 +msgid "g:i:s a" +msgstr "G:i:s" + +#: wp-admin/admin-ajax.php:940 +msgid "Draft saved at %s." +msgstr "Borrador guardado a las %s." + +#: wp-admin/admin-ajax.php:958 wp-admin/admin-ajax.php:1191 +msgid "Someone" +msgstr "Alguien" + +#: wp-admin/admin-ajax.php:967 wp-admin/admin-ajax.php:1181 +#: wp-admin/includes/post.php:156 wp-admin/includes/post.php:1388 +msgid "You are not allowed to edit this page." +msgstr "No tienes autorización para editar esta página." + +#: wp-admin/upload.php:62 wp-admin/admin-ajax.php:970 +#: wp-admin/admin-ajax.php:1184 wp-admin/includes/post.php:158 +#: wp-admin/includes/post.php:1391 +msgid "You are not allowed to edit this post." +msgstr "No tienes autorización para editar esta entrada." + +#: wp-admin/admin-ajax.php:1192 +msgid "Saving is disabled: %s is currently editing this page." +msgstr "Guardar está desactivado: %s está ahora mismo editando esta página." + +#: wp-admin/admin-ajax.php:1192 +msgid "Saving is disabled: %s is currently editing this post." +msgstr "Guardar está desactivado: %s está ahora mismo editando esta entrada." + +#: wp-admin/user-new.php:14 wp-admin/user-new.php:16 wp-admin/user-new.php:59 +#: wp-admin/user-new.php:86 wp-admin/themes.php:13 wp-admin/themes.php:26 +#: wp-admin/edit-comments.php:12 wp-admin/edit.php:24 wp-admin/post-new.php:34 +#: wp-admin/users.php:13 wp-admin/users.php:78 +#: wp-admin/includes/bookmark.php:30 wp-admin/press-this.php:17 +#: wp-admin/widgets.php:16 wp-admin/plugins.php:16 wp-admin/edit-tags.php:13 +#: wp-admin/edit-tags.php:40 wp-admin/edit-tags.php:78 +#: wp-admin/edit-tags.php:92 wp-admin/edit-tags.php:129 +#: wp-admin/nav-menus.php:23 wp-admin/options.php:35 wp-admin/options.php:59 +#: wp-content/plugins/akismet/admin.php:58 +msgid "Cheatin’ uh?" +msgstr "¡Haciendo trampas! ¿eh?" + +#: wp-admin/admin-ajax.php:1258 wp-admin/admin-ajax.php:1265 +#: wp-admin/edit-tags.php:233 +msgid "Item not updated." +msgstr "No actualizado." + +#: wp-includes/post.php:1185 +msgid "No posts found." +msgstr "No se encontraron entradas." + +#: wp-includes/post.php:4687 wp-includes/js/tinymce/langs/wp-langs.php:347 +#: wp-includes/js/tinymce/langs/wp-langs.php:511 wp-admin/admin-ajax.php:1302 +#: wp-admin/includes/dashboard.php:528 +#: wp-admin/includes/class-wp-posts-list-table.php:744 +#: wp-admin/includes/media.php:1089 wp-admin/includes/media.php:1860 +#: wp-admin/includes/media.php:2176 wp-admin/includes/media.php:2206 +#: wp-admin/includes/media.php:2236 wp-admin/includes/internal-linking.php:82 +msgid "Title" +msgstr "Título" + +#: wp-admin/admin-ajax.php:1302 +#: wp-admin/includes/class-wp-posts-list-table.php:286 +#: wp-admin/includes/class-wp-posts-list-table.php:757 +msgid "Date" +msgstr "Fecha" + +#: wp-admin/admin-ajax.php:1302 +#: wp-admin/includes/class-wp-posts-list-table.php:941 +#: wp-admin/edit-form-comment.php:35 +msgid "Status" +msgstr "Estado" + +#: wp-includes/script-loader.php:355 wp-includes/post.php:599 +#: wp-includes/post.php:619 wp-admin/admin-ajax.php:1308 +#: wp-admin/includes/class-wp-posts-list-table.php:593 +#: wp-admin/includes/class-wp-posts-list-table.php:947 +#: wp-admin/includes/meta-boxes.php:68 wp-admin/includes/meta-boxes.php:90 +msgid "Published" +msgstr "Publicada" + +#: wp-admin/admin-ajax.php:1311 +#: wp-admin/includes/class-wp-posts-list-table.php:598 +#: wp-admin/includes/class-wp-posts-list-table.php:948 +#: wp-admin/includes/meta-boxes.php:71 wp-admin/includes/meta-boxes.php:94 +msgid "Scheduled" +msgstr "Programada" + +#: wp-includes/post.php:597 wp-admin/admin-ajax.php:1314 +#: wp-admin/includes/class-wp-posts-list-table.php:953 +#: wp-admin/includes/meta-boxes.php:74 wp-admin/includes/meta-boxes.php:96 +msgid "Pending Review" +msgstr "Pendiente de revisión" + +#: wp-includes/post.php:596 wp-includes/post.php:617 +#: wp-admin/admin-ajax.php:1317 +#: wp-admin/includes/class-wp-posts-list-table.php:954 +#: wp-admin/includes/template.php:1637 wp-admin/includes/meta-boxes.php:78 +#: wp-admin/includes/meta-boxes.php:98 wp-admin/includes/meta-boxes.php:100 +msgid "Draft" +msgstr "Borrador" + +#: wp-admin/admin-ajax.php:1325 +#: wp-admin/includes/class-wp-posts-list-table.php:583 +#: wp-admin/includes/class-wp-comments-list-table.php:355 +#: wp-admin/includes/internal-linking.php:51 +#: wp-admin/includes/class-wp-media-list-table.php:276 +#: wp-admin/includes/class-wp-media-list-table.php:292 +msgid "Y/m/d" +msgstr "d/m/Y" + +#: wp-admin/admin-footer.php:23 +msgid "Thank you for creating with WordPress." +msgstr "Gracias por crear con WordPress." + +#: wp-admin/admin-footer.php:24 +msgid "Documentation" +msgstr "Documentación" + +#: wp-admin/admin-footer.php:26 +msgid "Feedback" +msgstr "Feedback" + +#: wp-includes/admin-bar.php:106 wp-includes/admin-bar.php:145 +#: wp-admin/admin-header.php:122 wp-admin/admin-header.php:142 +msgid "Visit Site" +msgstr "Visitar sitio" + +#: wp-includes/admin-bar.php:92 wp-admin/admin-header.php:165 +msgid "Log Out" +msgstr "Cerrar sesión" + +#: wp-admin/admin.php:154 +msgid "Invalid plugin page" +msgstr "Página de plugin no válida" + +#: wp-admin/admin.php:158 +msgid "Cannot load %s." +msgstr "No se pudo cargar %s." + +#: wp-admin/admin.php:179 +msgid "You are not allowed to import." +msgstr "No tienes autorización para importar." + +#: wp-admin/import.php:17 wp-admin/menu.php:220 wp-admin/admin.php:197 +msgid "Import" +msgstr "Importar" + +#: wp-admin/async-upload.php:29 wp-admin/upload.php:13 +#: wp-admin/media-upload.php:19 wp-app.php:599 wp-app.php:787 +msgid "You do not have permission to upload files." +msgstr "No tienes autorización para subir archivos." + +#: wp-admin/comment.php:46 wp-admin/edit-form-comment.php:16 +#: wp-admin/edit-form-comment.php:27 +msgid "Edit Comment" +msgstr "Editar comentario" + +#: wp-admin/comment.php:61 wp-admin/comment.php:215 +#: wp-admin/edit-comments.php:152 +msgid "Oops, no comment with this ID." +msgstr "Vaya, no hay comentarios con ese ID." + +#: wp-admin/comment.php:61 wp-admin/comment.php:215 +msgid "Go back" +msgstr "Volver atrás" + +#: wp-admin/comment.php:217 wp-admin/edit-comments.php:155 +#: wp-admin/includes/comment.php:37 +msgid "You are not allowed to edit comments on this post." +msgstr "No tienes autorización para editar comentarios en esta entrada." + +#: wp-admin/comment.php:67 +msgid "This comment is in the Trash. Please move it out of the Trash if you want to edit it." +msgstr "Este comentario está en la papelera. Por favor, sácalo de la papelera si quieres editarlo." + +#: wp-admin/comment.php:117 +msgid "You are about to mark the following comment as spam:" +msgstr "Estás a punto de marcar el siguiente comentario como spam:" + +#: wp-admin/comment.php:118 +msgid "Spam Comment" +msgstr "Comentario spam" + +#: wp-admin/comment.php:121 +msgid "You are about to move the following comment to the Trash:" +msgstr "Estás a punto de mover el siguiente comentario a la basura:" + +#: wp-admin/comment.php:122 +msgid "Trash Comment" +msgstr "Enviar comentario a la papelera" + +#: wp-admin/comment.php:125 +msgid "You are about to delete the following comment:" +msgstr "Estás a punto de borrar el siguiente comentario:" \ No newline at end of file diff --git a/src/wp-content/languages/ms-es_ES.mo b/src/wp-content/languages/ms-es_ES.mo new file mode 100644 index 0000000..f57136c Binary files /dev/null and b/src/wp-content/languages/ms-es_ES.mo differ diff --git a/src/wp-content/languages/ms-es_ES.po b/src/wp-content/languages/ms-es_ES.po new file mode 100644 index 0000000..fc919a2 --- /dev/null +++ b/src/wp-content/languages/ms-es_ES.po @@ -0,0 +1,2262 @@ +# Translation of Multisite in Spanish (Spain) +# This file is distributed under the same license as the Multisite package. +msgid "" +msgstr "" +"PO-Revision-Date: 2011-07-05 06:00:26+0000\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: GlotPress/0.1\n" +"Project-Id-Version: Multisite\n" + +#: wp-admin/includes/ms.php:514 +msgid "If you reached this screen by accident and meant to visit one of your own sites, here are some shortcuts to help you find your way." +msgstr "Si has llegado a esta pantalla por accedente y querías visitar uno de tus sitios, aquí hay algunos enlaces que te pueden ayudar a encontrar tu camino." + +#: wp-includes/ms-functions.php:1307 +msgid "" +"Dear User,\n" +"\n" +"Your new SITE_NAME site has been successfully set up at:\n" +"BLOG_URL\n" +"\n" +"You can log in to the administrator account with the following information:\n" +"Username: USERNAME\n" +"Password: PASSWORD\n" +"Log in here: BLOG_URLwp-login.php\n" +"\n" +"We hope you enjoy your new site. Thanks!\n" +"\n" +"--The Team @ SITE_NAME" +msgstr "" +"Estimado usuario,\n" +"\n" +"Tu nuevo sitio SITE_NAME se ha creado y configurado con éxito en:\n" +"BLOG_URL\n" +"\n" +"Puedes acceder a tu cuenta de administrador con la siguiente información:\n" +"Usuario: USERNAME\n" +"Contraseña: PASSWORD\n" +"Accede aquí: BLOG_URLwp-login.php\n" +"\n" +"Esperamos que disfrutes tu nuevo sitio. ¡Gracias!\n" +"\n" +"--El equipo @ SITE_NAME" + +#: wp-admin/network/user-new.php:46 +msgid "Cannot add user." +msgstr "No se pudo añadir el usuario." + +#: wp-admin/network/site-users.php:161 wp-admin/network/site-settings.php:72 +#: wp-admin/network/site-info.php:82 wp-admin/network/site-themes.php:128 +msgid "Edit Site: %2$s" +msgstr "Editar sitio: %2$s" + +#: wp-admin/network/sites.php:37 +msgid "Clicking on bold headings can re-sort this table." +msgstr "Haciendo clic en las cabeceras en negrita puedes reordenar esta tabla." + +#: wp-admin/network/index.php:29 +msgid "The Right Now box provides the network administrator with links to the screens to either create a new site or user, or to search existing users and sites. Screen for Sites and Users are also accessible through the left-hand navigation in the Network Admin section." +msgstr "La caja Ahora mismo ofrece al administrador de la red enlaces a las pantallas para crear nuevos usuarios o sitios, o para buscar usuarios y sitios existentes. La pantalla de Sitios y usuarios también está disponible en la navegación de la izquierda en la sección de Administrar red." + +#: wp-admin/network/user-new.php:21 +msgid "Add User will set up a new user account on the network and send that person an email with username and password." +msgstr "Añadir usuario configurará una nueva cuenta de usuario en la red y enviará a esa persona un correo electrónico con su usuario y contraseña." + +#: wp-admin/network/themes.php:181 +msgid "Themes can be enabled on a site by site basis by the network admin on the Edit Site screen (which has a Themes tab); get there via the Edit action link on the All Sites screen. Only network admins are able to install or edit themes." +msgstr "Los temas puede activarlos el administrador de la red sitio a sitio en la pantalla de Editar sitiio (que tiene una pestaña Temas); puedes llegar ahí desde el enlace de acción Editar de la pantalla Todos los sitios. Solo los administradores de red pueden instalar o editar temas. " + +#: wp-admin/network/upgrade.php:22 +msgid "Only use this screen once you have updated to a new version of WordPress through Updates/Available Updates (via the Network Administration navigation menu or the Admin Bar). Clicking the Update Network button will step through each site in the network, five at a time, and make sure any database updates are applied." +msgstr "Usa solamente esta pantalla una vez hayas actualizado a una versión de WordPress desde Actualizaciones disponibles (desde el menú de navegación de Administrar red o la barra de administración). Si haces clic en el botón Actualizar red empezará la actualización en cada sitio, de cinco en cinco, y asegúrate de que se actualizan las bases de datos." + +#: wp-admin/network.php:109 +msgid "The next screen for Network Setup will give you individually-generated lines of code to add to your wp-config.php and .htaccess files. Make sure the settings of your FTP client make files starting with a dot visible, so that you can find .htaccess; you may have to create this file if it really is not there. Make backup copies of those two files." +msgstr "La siguiente pantalla para configurar la red te ofrecerá líneas de código autogeneradas para ti para que las añadas a tus archivos wp-config.php y .htaccess. Asegúrate de que los ajustes de tu cliente FTP permiten que los ficheros con un punto delante se muestren, para que puedas ver el fichero .htaccess; puede que tengas que crear este archivo si no estuviera ya creado. Haz copias de seguridad de esos dos archivos." + +#: wp-admin/network/menu.php:77 +msgid "Available Updates" +msgstr "Actualizaciones disponibles" + +#: wp-admin/network/menu.php:17 +msgid "All Sites" +msgstr "Todos los sitios" + +#: wp-admin/network/menu.php:33 +msgid "Installed Themes" +msgstr "Temas instalados" + +#: wp-admin/network/menu.php:52 +msgid "Network Settings" +msgstr "Ajustes de red" + +#: wp-activate.php:92 +msgid "Your account is now activated. Log in or go back to the homepage." +msgstr "Tu cuenta se ha activado. Accede o vuelve a la página de inicio." + +#: wp-admin/network/settings.php:31 +msgid "Super admins can no longer be added on the Options screen. You must now go to the list of existing users on Network Admin > Users and click on Username or the Edit action link below that name. This goes to an Edit User page where you can check a box to grant super admin privileges." +msgstr "Los super administadores ya no pueden añadirse en la pantalla de Ajustes. Ahora debes ir a la lista de usuarios existentes en Administrar red > Usuarios y hacer clic en el enlace de acción de Usuario o Editar debajo del nombre. Esto te lleva a una página de Editar usuario en la que puedes marcar una casilla que le dará privilegios de administrador." + +#: wp-admin/network.php:111 +msgid "Once you add this code and refresh your browser, multisite should be enabled. This screen will keep an archive of the added code. You can toggle between Network Admin and Site Admin by clicking on the Howdy (Username) dropdown in the upper right of the administration area." +msgstr "Una vez añadas este código y refresques tu navegador se activará multisitio. Esta pantalla mantendrá un registro del código añadido. Puedes alternar entre Administrador de red y Administrador de sitio haciendo clic en el desplegable Hola (Usuario) de la parte superior derecha del área de administración." + +#: wp-activate.php:90 +msgid "Your account is now activated. View your site or Log in" +msgstr "Tu cuenta se ha activado. Visualiza tu sitio o Accede" + +#: wp-admin/includes/ms.php:511 wp-admin/includes/ms.php:513 +msgid "You attempted to access the \"%1$s\" dashboard, but you do not currently have privileges on this site. If you believe you should be able to access the \"%1$s\" dashboard, please contact your network administrator." +msgstr "Has tratado de acceder al escritorio de \"%1$s\" pero no tienes permisos en este sitio. Si crees qeu deberías poder acceder al escritorio de \"%1$s\" contacta con tu administrador de red." + +#: wp-admin/includes/ms.php:525 +msgid "Visit Dashboard" +msgstr "Visitar escritorio" + +#: wp-admin/includes/ms.php:516 +msgid "Your Sites" +msgstr "Tus sitios" + +#: wp-admin/includes/ms.php:525 +msgid "View Site" +msgstr "Ver sitio" + +#: wp-admin/my-sites.php:45 +msgid "Documentation on My Sites" +msgstr "Documentación sobre Mis sitios" + +#: wp-admin/network.php:115 +msgid "Documentation on the Network Screen" +msgstr "Documentación sobre la pantalla de red" + +#: wp-admin/network/themes.php:210 +msgctxt "network" +msgid "Theme deleted." +msgid_plural "%s themes deleted." +msgstr[0] "Tema borrado." +msgstr[1] "%s temas borrados." + +#: wp-admin/network/user-new.php:25 wp-admin/network/index.php:32 +#: wp-admin/network/site-users.php:32 wp-admin/network/site-settings.php:27 +#: wp-admin/network/site-new.php:24 wp-admin/network/users.php:42 +#: wp-admin/network/sites.php:40 wp-admin/network/site-info.php:27 +#: wp-admin/network/site-themes.php:32 +msgid "Support Forums" +msgstr "Foros de soporte" + +#: wp-admin/network/themes.php:142 +msgid "Yes, Delete this theme" +msgid_plural "Yes, Delete these themes" +msgstr[0] "Sí, borrar este tema" +msgstr[1] "Sí, borrar estos temas" + +#: wp-admin/network/themes.php:128 +msgid "You are about to remove the following theme:" +msgid_plural "You are about to remove the following themes:" +msgstr[0] "Estás a punto de borrar el siguiente tema:" +msgstr[1] "Estás a punto de borrar los siguientes temas:" + +#: wp-admin/network/themes.php:145 +msgid "No, Return me to the theme list" +msgstr "No, devuélveme a la lista de temas" + +#: wp-admin/network/themes.php:214 +msgid "You cannot delete a theme while it is active on the main site." +msgstr "No puedes borrar un tema si está activo en el sitio principal." + +#: wp-admin/network/themes.php:125 +msgid "Delete Theme" +msgid_plural "Delete Themes" +msgstr[0] "Borrar tema" +msgstr[1] "Borrar temas" + +#: wp-admin/network/themes.php:81 +msgid "You do not have sufficient permissions to delete themes for this site." +msgstr "No tienes suficientes permisos para borrar temas en este sitio." + +#: wp-admin/network/themes.php:127 +msgid "This theme may be active on other sites in the network." +msgid_plural "These themes may be active on other sites in the network." +msgstr[0] "Este tema podría estar activo en otros sitios de la red." +msgstr[1] "Estos temas podrían estar activos en otros sitios de la red." + +#: wp-admin/includes/class-wp-ms-themes-list-table.php:291 +msgid "Delete this theme" +msgstr "Borrar este tema" + +#: wp-admin/network/themes.php:133 +msgid "Are you sure you wish to delete these themes?" +msgstr "¿Estás seguro de que quieres borrar estos temas?" + +#: wp-admin/network/site-users.php:26 wp-admin/network/site-settings.php:21 +#: wp-admin/network/site-info.php:21 wp-admin/network/site-themes.php:26 +msgid "Info - The domain and path are rarely edited as this can cause the site to not work properly. The Registered date and Last Updated date are displayed. Network admins can mark a site as archived, spam, deleted and mature, to remove from public listings or disable." +msgstr "Información: El dominio y la ruta raramente se editan porque podría provocar que el sistema no funcionase correctamente. Se muestran las fechas de registro y de la última actualización. Los administradores de red puede marcar un sitio como guardado, spam, borrado y de contenido pata adultos, para borrarlo de las listas públicas o desactivado." + +#: wp-admin/network/site-users.php:28 wp-admin/network/site-settings.php:23 +#: wp-admin/network/site-info.php:23 wp-admin/network/site-themes.php:28 +msgid "Themes - This area shows themes that are not already enabled across the network. Enabling a theme in this menu makes it accessible to this site. It does not activate the theme, but allows it to show in the site’s Appearance menu. To enable a theme for the entire network, see the Network Themes screen." +msgstr "Temas - Esta área muestra temas que yo no están activos en la red. Activando un tema en este menú hará que esté disponible para este sitio. No activa el tema pero permite que se muestre en el menú de Aspecto del sitio. Para activar un tema para toda la red ve a la pantalla de Temas de la red." + +#: wp-admin/network/menu.php:74 +msgid "Updates" +msgstr "Actualizar" + +#: wp-admin/network/themes.php:183 +msgid "Documentation on Network Themes" +msgstr "Documentación sobre Temas de la red" + +#: wp-admin/network/upgrade.php:26 +msgid "Documentation on Update Network" +msgstr "Documentación sobre Actualizar red" + +#: wp-admin/network.php:114 +msgid "Documentation on Creating a Network" +msgstr "Documentación sobre Crear una red" + +#: wp-admin/network/site-users.php:27 wp-admin/network/site-settings.php:22 +#: wp-admin/network/site-info.php:22 wp-admin/network/site-themes.php:27 +msgid "Users - This displays the users associated with this site. You can also change their role, reset their password, or remove them from the site. Removing the user from the site does not remove the user from the network." +msgstr "Usuarios - Esto muestra los usuarios asociados a este sitio. También puedes cambiar su perfil, reiniciar su contraseña o borrarlos del sitio. Borrar un usuario del sitio no borra al usuario de la red." + +#: wp-admin/network/index.php:31 +msgid "Documentation on the Network Admin" +msgstr "Documentación sobre Administrador de la red" + +#: wp-admin/network/settings.php:33 +msgid "Documentation on Network Settings" +msgstr "Documentación sobre Ajustes de la red" + +#: wp-admin/network/user-new.php:24 wp-admin/network/users.php:41 +msgid "Documentation on Network Users" +msgstr "Documentación sobre Usuarios de la red" + +#: wp-admin/network/menu.php:29 +msgid "Themes %s" +msgstr "Temas %s" + +#: wp-admin/network/site-users.php:31 wp-admin/network/site-settings.php:26 +#: wp-admin/network/site-new.php:23 wp-admin/network/sites.php:39 +#: wp-admin/network/site-info.php:26 wp-admin/network/site-themes.php:31 +msgid "Documentation on Site Management" +msgstr "Documentación sobre Gestión del sitio" + +#: wp-admin/network/site-new.php:20 +msgid "This screen is for Super Admins to add new sites to the network. This is not affected by the registration settings." +msgstr "Esta pantalla es para que los Super administradores añadan nuevos sitios a la red. No le afectan los ajustes de registro." + +#: wp-admin/network/site-users.php:25 wp-admin/network/site-settings.php:20 +#: wp-admin/network/site-info.php:20 wp-admin/network/site-themes.php:25 +msgid "The menu is for editing information specific to individual sites, particularly if the admin area of a site is unavailable." +msgstr "El meno es para editar información específica de sitios individuadles, especialmente si el área de administrador de un sitio no está disponible." + +#: wp-admin/network/site-users.php:29 wp-admin/network/site-settings.php:24 +#: wp-admin/network/site-info.php:24 wp-admin/network/site-themes.php:29 +msgid "Settings - This page shows a list of all settings associated with this site. Some are created by WordPress and others are created by plugins you activate. Note that some fields are grayed out and say Serialized Data. You cannot modify these values due to the way the setting is stored in the database." +msgstr "Ajustes - Esta página muestra una lista de todos los ajustes asociados a este sitio. Algunos han sido creados por WordPerss y otros los crean los plugins que activas. Observa que algunos campos están oscurecidos y muestran Serialized data. No puedes modificar estos valores por el modo en que el ajuste está almacenado en la base de datos." + +#: wp-includes/ms-functions.php:930 +msgid "The user is already active." +msgstr "El usuario ya esta activo." + +#: wp-admin/network/site-users.php:242 +msgid "You may add from existing network users, or set up a new user to add to this site." +msgstr "Puedes añadir usuarios que ya sean de la red, o añadir uno nuevo para incorporarlo a este sitio." + +#: wp-admin/network/site-users.php:240 +msgid "Add User to This Site" +msgstr "Añadir un usuario a este sitio" + +#: wp-admin/network/site-users.php:244 +msgid "You may add from existing network users to this site." +msgstr "Puedes añadir usuarios que ya sean de la red a este sitio." + +#: wp-admin/network.php:343 wp-admin/network.php:345 +msgid "Caution: We recommend you back up your existing wp-config.php and %s files." +msgstr "Cuidado: Te recomendamos que hagas copia de seguridad de tus archivos wp-config.php y %s." + +#: wp-admin/includes/class-wp-ms-themes-list-table.php:236 +#: wp-admin/includes/class-wp-ms-themes-list-table.php:283 +msgid "Network Enable" +msgstr "Activar para la red" + +#: wp-admin/includes/class-wp-ms-themes-list-table.php:238 +#: wp-admin/includes/class-wp-ms-themes-list-table.php:285 +msgid "Network Disable" +msgstr "Desactivar para la red" + +#: wp-signup.php:87 +msgid "Your address will be %s." +msgstr "Tu dirección será %s." + +#: wp-signup.php:86 +msgid "domain" +msgstr "dominio" + +#: wp-admin/network/settings.php:105 +msgid "Allow site administrators to add new users to their site via the \"Users → Add New\" page." +msgstr "Permite a los administradores de sitio añadir nuevos usuarios a su sitio a través de la página \"Usuarios → Añadir nuevo\"." + +#: wp-admin/network/sites.php:99 wp-admin/network/menu.php:18 +msgctxt "site" +msgid "Add New" +msgstr "Añadir nuevo" + +#: wp-admin/includes/class-wp-ms-themes-list-table.php:201 +msgctxt "themes" +msgid "All (%s)" +msgid_plural "All (%s)" +msgstr[0] "(%s)" +msgstr[1] "Todos (%s)" + +#: wp-admin/includes/class-wp-ms-themes-list-table.php:204 +msgid "Enabled (%s)" +msgid_plural "Enabled (%s)" +msgstr[0] "(%s) activo" +msgstr[1] "(%s) activos" + +#: wp-admin/includes/class-wp-ms-users-list-table.php:97 +msgid "Super Admin (%s)" +msgid_plural "Super Admins (%s)" +msgstr[0] "(%s) Super administrador" +msgstr[1] "(%s) Super administradores" + +#: wp-admin/includes/class-wp-ms-themes-list-table.php:238 +#: wp-admin/includes/class-wp-ms-themes-list-table.php:285 +msgid "Disable" +msgstr "Desactivar" + +#: wp-admin/includes/class-wp-ms-themes-list-table.php:337 +msgid "Visit Theme Site" +msgstr "Visitar el sitio del tema" + +#: wp-admin/network/site-themes.php:22 +msgid "You do not have sufficient permissions to manage themes for this site." +msgstr "No tienes suficentes permisos para administrar temas en este sitio." + +#: wp-admin/network/themes.php:22 +msgid "You do not have sufficient permissions to manage network themes." +msgstr "No tienes suficientes permisos para administrar temas de la red." + +#: wp-admin/includes/class-wp-ms-themes-list-table.php:170 +msgid "No themes found." +msgstr "No se han encontrado temas." + +#: wp-admin/includes/class-wp-ms-themes-list-table.php:172 +msgid "You do not appear to have any themes available at this time." +msgstr "Parece ser que no hay temas disponibles en este momento." + +#: wp-admin/includes/class-wp-ms-themes-list-table.php:288 +msgid "Open this theme in the Theme Editor" +msgstr "Abre este tema en el editor de temas" + +#: wp-admin/includes/class-wp-ms-themes-list-table.php:285 +msgid "Disable this theme" +msgstr "Desactiva este tema" + +#: wp-admin/includes/class-wp-ms-themes-list-table.php:283 +msgid "Enable this theme" +msgstr "Activa este tema" + +#: wp-admin/includes/class-wp-ms-themes-list-table.php:337 +msgid "Visit theme homepage" +msgstr "Visita el sitio del tema" + +#: wp-admin/includes/class-wp-ms-themes-list-table.php:207 +msgid "Disabled (%s)" +msgid_plural "Disabled (%s)" +msgstr[0] "(%s) desactivado" +msgstr[1] "(%s) desactivados" + +#: wp-admin/network/themes.php:212 wp-admin/network/site-themes.php:161 +msgid "No theme selected." +msgstr "Ningún tema seleccionado." + +#: wp-admin/network/themes.php:207 wp-admin/network/site-themes.php:159 +msgid "Theme disabled." +msgid_plural "%s themes disabled." +msgstr[0] "Tema desactivado." +msgstr[1] "%s temas desactivados." + +#: wp-admin/network/themes.php:204 wp-admin/network/site-themes.php:156 +msgid "Theme enabled." +msgid_plural "%s themes enabled." +msgstr[0] "Tema activado" +msgstr[1] "%s temas activados." + +#: wp-admin/network/site-users.php:214 +msgid "Enter the username and email." +msgstr "Introduce el nombre de usuario y email." + +#: wp-admin/network/site-users.php:211 +msgid "User created." +msgstr "Usuario creado." + +#: wp-admin/network/site-users.php:202 +msgid "Select a user to change role." +msgstr "Elige un usuario para cambiar su perfil." + +#: wp-admin/network/site-users.php:208 +msgid "Select a user to remove." +msgstr "Elige un usuario para borrarlo." + +#: wp-admin/network/site-users.php:193 +msgid "User is already a member of this site." +msgstr "El usuario ya es miembro de este sitio." + +#: wp-admin/network/site-users.php:196 +msgid "Enter the username of an existing user." +msgstr "Introduce el nombre de usuario de un usuario existente." + +#: wp-admin/network/sites.php:61 +msgid "You do not have permission to delete that site." +msgstr "No tienes permisos para borrar ese sitio." + +#: wp-admin/network/edit.php:204 +msgid "You are not allowed to delete the site." +msgstr "No tienes permisos para borrar este sitio." + +#: wp-admin/network/edit.php:42 +msgid "Warning! User %s cannot be deleted." +msgstr "¡Aviso! El usuario %s no puede borrarse." + +#: wp-admin/network/settings.php:240 +msgid "Language Settings" +msgstr "Ajustes de idioma" + +#: wp-admin/network/site-themes.php:164 +msgid "Network enabled themes are not shown on this screen." +msgstr "Los temas activos de la red no se muestran en esta pantalla." + +#: wp-admin/network/user-new.php:17 +msgid "You do not have sufficient permissions to add users to this network." +msgstr "No tienes suficientes permisos para añadir usuarios a esta red." + +#: wp-admin/network/themes.php:176 wp-admin/network/site-themes.php:125 +msgctxt "themes per page (screen options)" +msgid "Themes" +msgstr "Temas" + +#: wp-admin/network.php:145 +msgid "The constant DO_NOT_UPGRADE_GLOBAL_TABLES cannot be defined when creating a network." +msgstr "La constante DO_NOT_UPGRADE_GLOBAL_TABLES no puede definirse al crear una red." + +#: wp-admin/network/user-new.php:98 wp-admin/network/site-users.php:270 +msgid "Add User" +msgstr "Añadir usuario" + +#: wp-admin/network/sites.php:32 +msgid "Dashboard leads to the Dashboard for that site." +msgstr "Escritorio te lleva al escritorio de ese sitio." + +#: wp-admin/network/sites.php:34 +msgid "Delete which is a permanent action after the confirmation screens." +msgstr "Borrar es una acción permanente tras las pantallas de confirmación." + +#: wp-admin/network/site-users.php:175 wp-admin/network/site-settings.php:88 +#: wp-admin/network/site-info.php:98 wp-admin/network/site-themes.php:142 +msgid "Info" +msgstr "Información" + +#: wp-admin/network/site-info.php:78 +msgid "Site info updated." +msgstr "Información del sitio actualizada." + +#: wp-admin/network/site-users.php:38 wp-admin/network/site-settings.php:33 +#: wp-admin/network/site-info.php:33 wp-admin/network/site-themes.php:49 +msgid "Invalid site ID." +msgstr "ID de sitio no válido." + +#: wp-admin/network/site-users.php:17 wp-admin/network/site-settings.php:17 +#: wp-admin/network/site-info.php:17 +msgid "You do not have sufficient permissions to edit this site." +msgstr "No tienes suficientes permisos para editar este sitio." + +#: wp-admin/network/site-settings.php:68 +msgid "Site options updated." +msgstr "Opciones del sitio actualizadas." + +#: wp-admin/network/site-users.php:162 wp-admin/network/site-settings.php:73 +#: wp-admin/network/site-info.php:83 wp-admin/network/site-themes.php:129 +msgid "Edit Site: %s" +msgstr "Editar sitio: %s" + +#: wp-admin/network/themes.php:196 wp-admin/network/menu.php:34 +msgctxt "theme" +msgid "Add New" +msgstr "Añadir nuevo" + +#: wp-admin/network/sites.php:28 +msgid "Add New takes you to the Add New Site screen. You can search for a site by Name, ID number, or IP address. Screen Options allows you to choose how many sites to display on one page." +msgstr "Añadir nuevo te lleva a la pantalla de Añadir nuevo sitiio. Puedes buscar un sitio por nombre, número de ID o dirección IP. Las Opciones de pantalla te permiten elegir cuantos sitios mostrar por página." + +#: wp-admin/network/site-new.php:98 wp-admin/network/site-new.php:107 +msgid "Add New Site" +msgstr "Añadir nuevo sitio" + +#: wp-admin/network/site-new.php:17 +msgid "You do not have sufficient permissions to add sites to this network." +msgstr "No tienes suficientes permisos para añadir sitios a esta red." + +#: wp-admin/network/menu.php:46 +msgctxt "plugin editor" +msgid "Add New" +msgstr "Añadir nuevo" + +#: wp-admin/network/sites.php:25 +msgctxt "sites per page (screen options)" +msgid "Sites" +msgstr "Sitios" + +#: wp-admin/network/sites.php:31 +msgid "An Edit link to a separate Edit Site screen." +msgstr "Un enlace de Editar que lleva a otra pantalla de Editar sitio." + +#: wp-admin/network.php:354 +msgid "Create a blogs.dir directory at %s/blogs.dir. This directory is used to store uploaded media for your additional sites and must be writeable by the web server." +msgstr "Crea un directorio blogs.dir en %s/blogs.dir. Este directorio se utiliza para almacenar los archivos de medios subidos en tus sitios adicionales y el servidor web debe tener permisos de escritura." + +#: wp-includes/ms-functions.php:527 +msgid "Only lowercase letters (a-z) and numbers are allowed." +msgstr "Sólo se permiten minúsculas (a-z) y números." + +#: wp-activate.php:66 +msgid "Your account has been activated. You may now log in to the site using your chosen username of “%2$s”. Please check your email inbox at %3$s for your password and login instructions. If you do not receive an email, please check your junk or spam folder. If you still do not receive an email within an hour, you can reset your password." +msgstr "Se ha activado tu cuenta. Ahora puedes acceder al sitio usando el nombre de usuario que elegiste de “%2$s”. Por favor, revisa tu bandeja de entrada del correo electrónico %3$s para obtener tu contraseña e instrucciones de acceso. Si no recibes un correo electrónico revisa la carpeta de spam. Si aún así no recibes un correo electrónico en una hora puedes reiniciar tu contraseña aquí." + +#: wp-includes/ms-load.php:238 +msgid "Read the bug report page. Some of the guidelines there may help you figure out what went wrong." +msgstr "Lee la página de errores. Algunas de las guías que hay ahí pueden ayudarte a hacerte una idea sobre qué ha ido mal." + +#: wp-includes/ms-functions.php:839 wp-includes/ms-functions.php:890 +msgid "[%1$s] Activate %2$s" +msgstr "[%1$s] Activar %2$s" + +#: wp-includes/ms-load.php:213 +msgid "No site defined on this host. If you are the owner of this site, please check Debugging a WordPress Network for help." +msgstr "No se ha definido un sitio para este servidor. Si eres el propietario de este sitio, por favor, consulta Arreglando una red de WordPress para tener ayuda." + +#: wp-admin/includes/ms.php:35 +msgid "This file is too big. Files must be less than %1$s KB in size." +msgstr "Este archivo es demasiado grande. Los archivos deben ser de un tamaño menor a %1$s KB." + +#: wp-admin/network/edit.php:52 +msgid "What should be done with posts and links owned by %s?" +msgstr "¿Qué debe hacerse con las entradas y enlaces de %s?" + +#: wp-admin/network/edit.php:45 +msgid "Warning! User cannot be deleted. The user %s is a network admnistrator." +msgstr "¡Atención! Este usuario no puede borrarse. El usuario %s es el administrador de la red." + +#: wp-admin/network/edit.php:29 +msgid "Transfer or delete posts and links before deleting users." +msgstr "Transfiere o borra las entradas y enlaces antes de borrar usuarios." + +#: wp-admin/includes/ms.php:40 +msgid "Back" +msgstr "Atrás" + +#: wp-admin/includes/ms.php:37 +msgid "You have used your space quota. Please delete files before uploading." +msgstr "Has usado tu cuota de espacio asignada. Por favor, borra archivos antes de subir alguno más." + +#: wp-admin/network/edit.php:405 +msgid "Warning! User cannot be modified. The user %s is a network administrator." +msgstr "¡Atención! El usuario no puede modificarse. El usuario %s es el administrador de la red." + +#: wp-admin/includes/ms.php:33 +msgid "Not enough space to upload. %1$s KB needed." +msgstr "No hay espacio suficiente para subir. Se necesitan %1$s KB." + +#: wp-admin/network/edit.php:70 +msgid "Site: %s" +msgstr "Sitio: %s" + +#: wp-admin/includes/ms.php:221 +msgid "" +"Dear user,\n" +"\n" +"You recently requested to have the administration email address on\n" +"your site changed.\n" +"If this is correct, please click on the following link to change it:\n" +"###ADMIN_URL###\n" +"\n" +"You can safely ignore and delete this email if you do not want to\n" +"take this action.\n" +"\n" +"This email has been sent to ###EMAIL###\n" +"\n" +"Regards,\n" +"All at ###SITENAME###\n" +"###SITEURL### " +msgstr "" +"Estimado usuario,\n" +"\n" +"Has solicitado recientemente el cambio de la \n" +"dirección de correo electrónico de administración de tu sitio.\n" +"Si es correcto, haz clic en el siguiente enlace para cambiarla:\n" +"###ADMIN_URL###\n" +"\n" +"Si no quieres hacerlo, puedes ignorar el correo y borrarlo tranquilamente.\n" +"\n" +"Este correo ha sido enviado a ###EMAIL###\n" +"\n" +"Saludos,\n" +"La gente de ###SITENAME###\n" +"###SITEURL### " + +#: wp-admin/includes/ms.php:242 +msgid "[%s] New Admin Email Address" +msgstr "[%s] Nueva dirección de correo electrónico del administrador." + +#: wp-admin/includes/ms.php:258 +msgid "ERROR: The e-mail address isn't correct." +msgstr "ERROR: La dirección de correo electrónico no es correcta." + +#: wp-admin/includes/ms.php:263 +msgid "ERROR: The e-mail address is already used." +msgstr "ERROR: Esa dirección de correo electrónico ya está siendo utilizada." + +#: wp-admin/includes/ms.php:275 +msgid "" +"Dear user,\n" +"\n" +"You recently requested to have the email address on your account changed.\n" +"If this is correct, please click on the following link to change it:\n" +"###ADMIN_URL###\n" +"\n" +"You can safely ignore and delete this email if you do not want to\n" +"take this action.\n" +"\n" +"This email has been sent to ###EMAIL###\n" +"\n" +"Regards,\n" +"All at ###SITENAME###\n" +"###SITEURL###" +msgstr "" +"Estimado usuario,\n" +"\n" +"Recientemente has solicitado el cambio de dirección de correo electrónico de tu cuenta..\n" +"Si es así haz clic en el siguiente enlace para cambiarla:\n" +"###ADMIN_URL###\n" +"\n" +"Si no quieres hacerlo puedes ignorar y borrar este correo electrónico con tranquilidad.\n" +"\n" +"Este correo electrónico se ha enviado a ###EMAIL###\n" +"\n" +"Atentamente,\n" +"El equipo de ###SITENAME###\n" +"###SITEURL###" + +#: wp-admin/includes/ms.php:295 +msgid "[%s] New Email Address" +msgstr "[%s] Nuevo correo electrónico" + +#: wp-admin/includes/ms.php:303 +msgid "Your email address has not been updated yet. Please check your inbox at %s for a confirmation email." +msgstr "Tu correo electrónico no ha sido actualizado todavía. Por favor, revisa tu bandeja de entrada de %s para ver el correo electrónico de confirmación." + +#: wp-admin/includes/ms.php:413 +msgid "GB" +msgstr "GB" + +#: wp-admin/includes/ms.php:416 +msgid "MB" +msgstr "MB" + +#: wp-admin/includes/ms.php:419 +msgid "Used: %1s%% of %2s" +msgstr "Utilizado: %1s%% de %2s" + +#: wp-admin/includes/ms.php:556 +msgid "British English" +msgstr "Inglés británico" + +#: wp-admin/includes/ms.php:566 +msgid "English" +msgstr "Inglés" + +#: wp-admin/includes/ms.php:586 +msgid "Warning! WordPress encrypts user cookies, but you must add the following lines to wp-config.php for it to be more secure." +msgstr "¡Atención! WordPress encripta las cookies de los usuarios, pero debes añadir las siguientes líneas a wp-config.php para que sea más seguro." + +#: wp-admin/includes/ms.php:587 +msgid "Before the line /* That's all, stop editing! Happy blogging. */ please add this code:" +msgstr "Antes de la línea /* ¡Eso es todo, deja de editar! ¡Feliz blogging!. */ por favor, añade el siguiente código:" + +#: wp-admin/includes/ms.php:600 +msgid "Thank you for Updating! Please visit the Update Network page to update all your sites." +msgstr "¡Gracias por actualizar!. Por favor, visita Actualizar red para actualizar todos tus sitios." + +#: wp-admin/includes/ms.php:633 +msgid "Primary Site" +msgstr "Sitio principal" + +#: wp-admin/includes/ms.php:552 +msgid "American English" +msgstr "Inglés americano" + +#: wp-admin/includes/ms.php:432 +msgid "MB (Leave blank for network default)" +msgstr "MB (Déjalo en blanco para dejar la cuota de la red por defecto)" + +#: wp-admin/includes/ms.php:431 +msgid "Site Upload Space Quota " +msgstr "Cuota de espacio de subida del sitio" + +#: wp-admin/includes/ms.php:680 +msgid "The %1$s file is deprecated. Please remove it and update your server rewrite rules to use %2$s instead." +msgstr "El archivo %1$s es obsoleto. Por favor, elimínalo y actualiza las reglas de re-escritura de tu servidor para usar %2$s en su lugar." + +#: wp-admin/network/settings.php:25 +msgid "Dashboard Site is an option to give a site to users who do not have a site on the system. Their default role is Subscriber, but that default can be changed. The Admin Notice Feed can provide a notice on all dashboards of the latest post via RSS or Atom, or provide no such notice if left blank." +msgstr "El escritorio del sitio es una opción para dar un sitio a usuarios que no tienen uno en el sistema. Su perfil por defecto es suscriptor, pero puede cambiarse. El feed de avisos del administrador puede, a través de RSS o Atom, ofrecer avisos de las últimas entradas en todos los escritorios o, si lo dejas en blanco, no mostrar aviso alguno." + +#: wp-admin/network/site-new.php:21 +msgid "If the admin email for the new site does not exist in the database, a new user will also be created." +msgstr "Si el correo electrónico del administrador para el nuevo sitio no existe en la base de datos también se creará un nuevo usuario." + +#: wp-admin/network/sites.php:33 +msgid "Deactivate, Archive, and Spam which lead to confirmation screens. These actions can be reversed later." +msgstr "Desactivar, Archivar y Spam te llevan a pantallas de confirmación. Estas acciones pueden revertirse más tarde." + +#: wp-admin/network/sites.php:36 +msgid "The site ID is used internally, and is not shown on the front end of the site or to users/viewers." +msgstr "El ID de sitio se usa internamente, y no se muestra en la parte visible del sitio o a los usuarios/visitantes." + +#: wp-admin/network/sites.php:30 +msgid "Hovering over each site reveals seven options (three for the primary site):" +msgstr "Al pasar el cursor sobre cada sitio se muestran siete opciones (tres para el sitio primario):" + +#: wp-admin/network.php:110 +msgid "Add a blogs.dir directory under /wp-content and add the designated lines of code to wp-config.php (just before /*...stop editing...*/) and .htaccess (replacing the existing WordPress rules)." +msgstr "Crea un directorio blogs.dir bajo /wp-content y añade las líneas de código definidas a wp-config.php (justo antes de /*...deja de editar...*/) y a .htaccess (reemplazando las reglas existentes de WordPress)." + +#: wp-admin/network.php:107 +msgid "This screen allows you to configure a network as having subdomains (site1.example.com) or subdirectories (example.com/site1). Subdomains require wildcard subdomains to be enabled in Apache and DNS records, if your host allows it." +msgstr "Esta pantalla te permite configurar una red que contenga subdominios (site1.example.com) or subdirectories (example.com/site1). Los subdominios requieren registros DNS y activar los comodines (wildcards) en Apache, si tu alojamiento lo permite." + +#: wp-admin/network/settings.php:24 +msgid "Operational settings has fields for the network’s name and admin email." +msgstr "Los ajustes operacionales tienen campos para el nombre de red y el correo electrónico del administrador." + +#: wp-admin/network/users.php:36 +msgid "You can also go to the user’s profile page by clicking on the individual username." +msgstr "También puedes ir a la página de perfil del usuario haciendo clic en el nombre de usuario concreto." + +#: wp-admin/network/users.php:38 +msgid "The bulk action will permanently delete selected users, or mark/unmark those selected as spam. Spam users will have posts removed and will be unable to sign up again with the same email addresses." +msgstr "La acción en lote borrará permanentemente los usuarios seleccionados, o marca/desmarca los seleccionados como spam. Se borrarán las entradas de los usuarios spam y no podrán acceder de nuevo con la misma dirección de correo electrónico. " + +#: wp-admin/network/settings.php:28 +msgid "Upload settings control the size of the uploaded files and the amount of available upload space for each site. You can change the default value for specific sites when you edit a particular site. Allowed file types are also listed (space separated only)." +msgstr "Los ajustes de subida controlan el tamaño para la subida de archivos y la cantidad de espacio de subida disponible para cada sitio. Puedes cambiar el valor por defecto para sitios específicos cuando edites un sitio en concreto. También se listan los tipos de archivo permitidos (separados solo por espacios)." + +#: wp-admin/my-sites.php:43 +msgid "Up until WordPress version 3.0, what is now called a Multi-site Network had to be installed separately as WordPress MU (multi-user)." +msgstr "Hasta la versión 3.0 de WordPress, lo que ahora se le llama red multisitio tenía que instalarse aparte como WordPress MU (multiusuario)." + +#: wp-admin/includes/class-wp-ms-themes-list-table.php:180 +msgid "Theme" +msgstr "Tema" + +#: wp-admin/network/index.php:28 +msgid "Blogs are now called Sites; Site is now called Network." +msgstr "Los blogs se llaman ahora sitios; al sitio ahora se le llama red." + +#: wp-admin/network/index.php:27 +msgid "Site Admin is now Super Admin (we highly encourage you to get yourself a cape!)." +msgstr "El administrador del sitio es ahora Super administrador (te recomendamos encarecidamente que te protejas)" + +#: wp-includes/ms-load.php:232 +msgid "If you are the owner of this network please check that MySQL is running properly and all tables are error free." +msgstr "Si eres el propietario de esta red comprueba que MySQL se está ejecutando adecuadamente y que niguna de las tablas tiene errores." + +#: wp-includes/ms-load.php:231 +msgid "If your site does not display, please contact the owner of this network." +msgstr "Si tu sitio no se muestra contacta con el propietario de esta red." + +#: wp-admin/includes/class-wp-ms-users-list-table.php:76 +msgctxt "user" +msgid "Not Spam" +msgstr "No es spam" + +#: wp-admin/includes/class-wp-ms-users-list-table.php:75 +msgctxt "user" +msgid "Mark as Spam" +msgstr "Marcar como spam" + +#: wp-admin/network.php:153 +msgid "Once the network is created, you may reactivate your plugins." +msgstr "Una vez que se cree la red podrás reactivar tus plugins." + +#: wp-admin/network/sites.php:35 +msgid "Visit to go to the frontend site live." +msgstr "Visitar para ir a la portada del sitio público." + +#: wp-admin/network.php:347 +msgid "Caution: We recommend you back up your existing wp-config.php file." +msgstr "Atención: Recomendamos realizar una copia de seguridad de tu archivo wp-config.php." + +#: wp-admin/network/index.php:26 +msgid "Until WordPress 3.0, running multiple sites required using WordPress MU instead of regular WordPress. In version 3.0, these applications have merged. If you are a former MU user, you should be aware of the following changes:" +msgstr "Antes de WordPress 3.0, para hacer funcionar múltiples sitios se requería usar WordPress MU en vez de WordPress normal. En la versión 3.0, estas aplicaciones se han fusionado. Si eres usuario o conocedor de MU debes ser consciente de los siguientes cambios:" + +#: wp-admin/network/settings.php:29 +msgid "Checkboxes for media upload buttons set which are shown in the visual editor. If unchecked, a generic upload button is still visible; other media types can still be uploaded if on the allowed file types list." +msgstr "Las casillas seleccionables para los botones de subida de multimedia hacen que se muestren en el editor visual. Si está desmarcado, un botón genérico se mantendrá visible. Otros tipos de archivos multimedia pueden continuar subiéndose." + +#: wp-admin/network/settings.php:27 +msgid "New site settings are defaults applied when a new site is created in the network. These include welcome email for when a new site or user account is registered, and what᾿s put in the first post, page, comment, comment author, and comment URL." +msgstr "Los ajustes para nuevos sitios se aplican cuando se crea un nuevo sitio en la red. Esto incluye correo electrónico de bienvenida cuando se registra un nuevo sitio o cuenta de usuario y que poner en la primera entrada, página, comentario, autor del comentario y la URL del comentario." + +#: wp-admin/network/themes.php:179 +msgid "This screen enables and disables the inclusion of themes available to choose in the Appearance menu for each site. It does not activate or deactivate which theme a site is currently using." +msgstr "Esta pantalla activa o desactiva la inclusión en la disponibilidad de Temas para los sitios en el menú Apariencia de cada sitio. No activa o desactiva que temas se están usando en cada sitio." + +#: wp-admin/my-sites.php:42 +msgid "This screen shows an individual user all of their sites in this network, and also allows that user to set a primary site. He or she can use the links under each site to visit either the frontend or the dashboard for that site." +msgstr "Esta pantalla muestra los usuarios de forma individual con todos sus sitios en la red y también permite al usuario marcar un sitio como principal. Él o ella pueden usar los enlaces bajo cada sitio para visitar la portada o el escritorio de cada sitio." + +#: wp-admin/network/themes.php:180 +msgid "If the network admin disables a theme that is in use, it can still remain selected on that site. If another theme is chosen, the disabled theme will not appear in the site’s Appearance > Themes screen." +msgstr "Si el administrador de la red desactiva un tema que está en uso, podrá continuar seleccionado en el sitio que lo tenga en uso. Si en el sitio selecciona otro tema, el tema ya no le aparecerá en la pantalla Apariencia > Temas." + +#: wp-admin/network/settings.php:23 +msgid "This screen sets and changes options for the network as a whole. The first site is the main site in the network and network options are pulled from that original site’s options." +msgstr "Esta pantalla establece y cambia las opciones para toda la red. El primer sitio es el sitio principal de la red y las opciones de red serán pasadas desde las opciones del sitio original." + +#: wp-admin/network/settings.php:26 +msgid "Registration settings can disable/enable public signups. If you let others sign up for a site, install spam plugins. Spaces, not commas, should separate names banned as sites for this network." +msgstr "Los ajustes de registro pueden activar/desactivar el registro público. Si permites que la gente registre un sitio, instala un plugins de spam. Espacio, sin comas, debes separar los nombres para sitios no permitidos para esta red." + +#: wp-admin/network/settings.php:30 +msgid "Menu setting enables/disables the plugin menus from appearing for non super admins, so that only super admins, not site admins, have access to activate plugins." +msgstr "En ajustes de menú se activa o desactiva que aparezca o no el menú plugins para los usuarios que no son Super Admin. Es decir, solo los Super Admins, no los Admin, tienen acceso a los plugins." + +#: wp-admin/network/sites.php:29 +msgid "This is the main table of all sites on this network. Switch between list and excerpt views by using the icons above the right side of the table." +msgstr "Esta es la tabla principal de todos los sitios de la red. Cambia de vista listado o fragmento usando los iconos de la parte superior derecha de la tabla." + +#: wp-admin/network/user-new.php:22 +msgid "Users who are signed up to the network without a site are added as subscribers to the main or primary dashboard site, giving them profile pages to manage their accounts. These users will only see Dashboard and My Sites in the main navigation until a site is created for them." +msgstr "Los usuarios que se registran en la red sin crear un sitio son añadidos al escritorio del sitio principal, dándoles unas páginas de perfil para gestionar sus cuentas. Estos usuarios solo verán el escritorio y Mis sitios en la navegación principal hasta que creen su propio sitio." + +#: wp-admin/network/users.php:37 +msgid "You can sort the table by clicking on any of the bold headings and switch between list and excerpt views by using the icons in the upper right." +msgstr "Puedes ordenar la tabla haciendo clic en cualquiera de las cabeceras en negritas y cambiando entre listado y extracto haciendo clic en los iconos de arriba a la derecha." + +#: wp-admin/network/users.php:35 +msgid "Hover over any user on the list to make the edit links appear. The Edit link on the left will take you to his or her Edit User profile page; the Edit link on the right by any site name goes to an Edit Site screen for that site." +msgstr "Pasa el cursor por encima de cualquiera de los usuarios de este listado para que aparezcan los enlaces de edición. El enlace Editar de la izquierda te llevará a su página de perfil Editar Usuario. El enlace Editar de la derecha de cualquiera de los nombre de los sitios te lleva a la pantalla del sitio Editar Sitio." + +#: wp-admin/network/upgrade.php:24 +msgid "If this process fails for any reason, users logging in to their sites will force the same update." +msgstr "Si este proceso falla por cualquier circunstancia, cuando los usuarios accedan a su sitio forzaran esta misma actualización." + +#: wp-admin/network/upgrade.php:23 +msgid "If a version update to core has not happened, clicking this button won’t affect anything." +msgstr "Si no se ha actualizado el núcleo, hacer clic en este botón no afectará en nada." + +#: wp-admin/network/users.php:34 +msgid "This table shows all users across the network and the sites to which they are assigned." +msgstr "Esta tabla muestra todos los usuarios de la red y los sitios que tienen asignados." + +#: wp-admin/network/users.php:39 +msgid "You can make an existing user an additional super admin by going to the Edit User profile page and checking the box to grant that privilege." +msgstr "Puedes hacer a un usuario existente Super Admin. Ve a la página del perfil Editar usuario y marca la casilla para darle este privilegio." + +#: wp-admin/network.php:108 +msgid "Choose subdomains or subdirectories; this can only be switched afterwards by reconfiguring your install. Fill out the network details, and click install. If this does not work, you may have to add a wildcard DNS record (for subdomains) or change to another setting in Permalinks (for subdirectories)." +msgstr "Elige subdominios o subdirectorios. Esto solo puede cambiarse reconfigurando tu instalación. Rellena los detalles de la red y haz clic en instalar. Si no funciona, deberás añadir un registro DNS (para los subdominios) o cambiar a otro ajuste de enlaces permanentes (para los subdirectorios)." + +#: wp-admin/network.php:112 +msgid "The choice of subdirectory sites is disabled if this setup is more than a month old because of permalink problems with “/blog/” from the main site. This disabling will be addressed soon in a future version." +msgstr "La posibilidad de sitios en subdirectorios está desactivada si el sitio tiene más de un mes ya que hay un problema con los enlaces permanentes que incluyen “/blog/” en el sitio principal. Esta desactivación se resolverá pronto en futuras versiones." + +#: wp-admin/network/site-new.php:44 +msgid "The following words are reserved for use by WordPress functions and cannot be used as blog names: %s" +msgstr "Las siguientes palabras están reservadas para el uso en las funciones de WordPress y no pueden ser usadas como nombre del sitio: %s" + +#: wp-admin/network/upgrade.php:61 +msgid "Warning! Problem updating %1$s. Your server may not be able to connect to sites running on it. Error message: %2$s" +msgstr "¡Atención! Problema al actualizar %1$s. Tu servidor no puede conectar con el sitio que está funcionando en él. Mensaje de Error: %2$s" + +#: wp-signup.php:391 +msgctxt "Multisite active signup type" +msgid "user" +msgstr "usuario" + +#: wp-signup.php:390 +msgctxt "Multisite active signup type" +msgid "blog" +msgstr "blog" + +#: wp-signup.php:389 +msgctxt "Multisite active signup type" +msgid "none" +msgstr "ninguno" + +#: wp-signup.php:388 +msgctxt "Multisite active signup type" +msgid "all" +msgstr "todo" + +#: wp-admin/network.php:252 wp-admin/network.php:262 wp-admin/network.php:269 +msgid "The main site in a sub-directory install will need to use a modified permalink structure, potentially breaking existing links." +msgstr "El sitio principal en un subdirectorio de instalación tendrá que utilizar una estructura de enlaces permanentes modificada, lo que podría romper los vínculos existentes." + +#: wp-admin/network.php:268 +msgid "Because your install is not new, the sites in your WordPress network must use sub-domains." +msgstr "Cómo como tu instalación no es nueva, los sitios de tu red deberán utilizar subdominios." + +#: wp-admin/network.php:474 +msgid "Add the following to your web.config file in %s, replacing other WordPress rules:" +msgstr "Añade lo siguiente a tu archivo web.config en %s, remplazando las reglas existentes de WordPress:" + +#: wp-admin/network.php:184 wp-admin/network.php:356 +msgid "Networks may not be fully compatible with custom wp-content directories." +msgstr "Las redes puede que no sean totalmente compatibles con directorios wp-content personalizados" + +#: wp-admin/network.php:216 +msgid "Sub-domains" +msgstr "Subdominios" + +#: wp-admin/network.php:220 +msgid "Sub-directories" +msgstr "Subdirectorios" + +#: wp-admin/includes/class-wp-ms-sites-list-table.php:127 +msgctxt "site" +msgid "Mark as Spam" +msgstr "Marcar como spam" + +#: wp-signup.php:435 +msgid "Sorry, new registrations are not allowed at this time." +msgstr "Disculpa, los nuevos registros están deshabilitados." + +#: wp-signup.php:365 +msgid "Check your inbox at %s and click the link given." +msgstr "Comprueba la bandeja de entrada de %s y haz clic en el enlace que encontrarás." + +#: wp-signup.php:371 +msgid "Wait a little longer. Sometimes delivery of email can be delayed by processes outside of our control." +msgstr "Espera un poco más. Hay veces, que el correo electrónico puede tardar en salir, por razones que escapan a nuestro control." + +#: wp-signup.php:372 +msgid "Check the junk or spam folder of your email client. Sometime emails wind up there by mistake." +msgstr "Comprueba la carpeta de correo basura, correo no deseado o spam de tu cliente de correo electrónico o correo web. A veces los correos electrónicos acaban ahí por equivocación." + +#: wp-signup.php:394 +msgid "Greetings Site Administrator! You are currently allowing “%s” registrations. To change or disable registration go to your Options page." +msgstr "¡Felicidades administrador del sitio! Ahora ya permites registros de “%s”. Para cambiarlo o desactivar los registros ve a tu página de opciones." + +#: wp-signup.php:373 +msgid "Have you entered your email correctly? You have entered %s, if it’s incorrect, you will not receive your email." +msgstr "¿Has introducido tu correo electrónico correctamente? Has introducido %s, si es incorrecto no lo recibirás." + +#: wp-signup.php:102 +msgid "Allow my site to appear in search engines like Google, Technorati, and in public listings around this network." +msgstr "Permitir que mi sitio aparezca en motores de búsqueda como Google y Technorati y en los listados públicos de esta red." + +#: wp-signup.php:141 +msgid "We send your registration email to this address. (Double-check your email address before continuing.)" +msgstr "Enviaremos los datos de registro a esta dirección de correo electrónico. Comprueba bien esta dirección antes de continuar." + +#: wp-admin/network.php:511 +msgid "Once you complete these steps, your network is enabled and configured. You will have to log in again." +msgstr "Una vez que completes estos pasos tu red estará activa y configurada. Deberás acceder de nuevo." + +#: wp-admin/network.php:267 +msgid "Sub-domain Install" +msgstr "Instalación en subdominio" + +#: wp-admin/network.php:153 +msgid "Please deactivate your plugins before enabling the Network feature." +msgstr "Por favor, desactiva tus plugins antes de activar la función de red." + +#: wp-includes/ms-default-constants.php:113 +msgid "The constant VHOST is deprecated. Use the boolean constant SUBDOMAIN_INSTALL in wp-config.php to enable a subdomain configuration. Use is_subdomain_install() to check whether a subdomain configuration is enabled." +msgstr "La constante VHOST está obsoleta. Usa la constante booleana/lógica SUBDOMAIN_INSTALL en wp-config.php para habilitar la configuración de subdominios. Usa is_subdomain_install() para comprobar si la configuración de subdominios está activada." + +#: wp-includes/ms-default-constants.php:115 +msgid "Conflicting values for the constants VHOST and SUBDOMAIN_INSTALL. The value of SUBDOMAIN_INSTALL will be assumed to be your subdomain configuration setting." +msgstr "Hay valores en conflicto para las constantes VHOST y SUBDOMAIN_INSTALL. Se asumirá que el valor de la configuración de subdominio es SUBDOMAIN_INSTALL." + +#: wp-admin/includes/class-wp-ms-themes-list-table.php:236 +#: wp-admin/includes/class-wp-ms-themes-list-table.php:283 +msgid "Enable" +msgstr "Activar" + +#: wp-admin/includes/class-wp-ms-sites-list-table.php:232 +msgctxt "%1$s: site name. %2$s: site tagline." +msgid "%1$s – %2$s" +msgstr "%1$s – %2$s" + +#: wp-admin/includes/class-wp-ms-sites-list-table.php:148 +#: wp-admin/network/site-info.php:138 +msgctxt "site" +msgid "Registered" +msgstr "Registrado" + +#: wp-admin/includes/class-wp-ms-sites-list-table.php:128 +#: wp-admin/includes/class-wp-ms-sites-list-table.php:258 +msgctxt "site" +msgid "Not Spam" +msgstr "No es Spam" + +#: wp-admin/includes/class-wp-ms-users-list-table.php:117 +msgctxt "user" +msgid "Registered" +msgstr "Registrado" + +#: wp-admin/includes/class-wp-ms-sites-list-table.php:255 +msgctxt "verb; site" +msgid "Archive" +msgstr "Archivar" + +#: wp-admin/includes/class-wp-ms-sites-list-table.php:173 +#: wp-admin/includes/class-wp-ms-sites-list-table.php:260 +#: wp-admin/network/site-info.php:149 +msgctxt "site" +msgid "Spam" +msgstr "Spam" + +#: wp-includes/ms-load.php:236 +msgid "Could not find site %1$s. Searched for table %2$s in database %3$s. Is that right?" +msgstr "No podemos encontrar el sitio %1$s. Buscamos la tabla %2$sen la base de datos %3$s. ¿Es correcto?" + +#: wp-includes/ms-load.php:227 +msgid "Error establishing database connection" +msgstr "Error estableciendo conexión con la base de datos" + +#: wp-includes/ms-load.php:234 +msgid "Database tables are missing. This means that MySQL is not running, WordPress was not installed properly, or someone deleted %s. You really should look at your database now." +msgstr "Se han perdido las tablas de la base de datos. Esto quiere decir que MySQL no está funcionando, WordPress no ha sido instalado correctamente, o alguien ha eliminado %s. Realmente, debes revisar tu base de datos ahora mismo." + +#: wp-includes/ms-functions.php:1116 +msgid "" +"New Site: %1s\n" +"URL: %2s\n" +"Remote IP: %3s\n" +"\n" +"Disable these notifications: %4s" +msgstr "" +"Nuevo sitio: %1s\n" +"URL: %2s\n" +"IP Remota: %3s\n" +"\n" +"Desactivar estas notificaciones: %4s" + +#: wp-includes/ms-functions.php:691 +msgid "Sorry, that site already exists!" +msgstr "Disculpa, este sitio ya existe." + +#: wp-includes/ms-functions.php:829 +msgid "" +"To activate your blog, please click the following link:\n" +"\n" +"%s\n" +"\n" +"After you activate, you will receive *another email* with your login.\n" +"\n" +"After you activate, you can visit your site here:\n" +"\n" +"%s" +msgstr "" +"Para activar tu sitio haz clic en el siguiente enlace:\n" +"\n" +"%s\n" +"\n" +"Después de activarlo recibirás *otro correo electrónico* con tus datos de acceso.\n" +"\n" +"Después de activarlo, podrás visitar tu sitio aquí:\n" +"\n" +"%s" + +#: wp-includes/ms-functions.php:1123 +msgid "New Site Registration: %s" +msgstr "Nuevo sitio registrado: %s" + +#: wp-includes/ms-functions.php:663 +msgid "Sorry, site names may not contain the character “_”!" +msgstr "¡Lo sentimos, el nombre del sitio no puede contener el caracter “_”!" + +#: wp-includes/ms-functions.php:649 +msgid "Please enter a site name" +msgstr "Por favor, introduce un nombre de sitio" + +#: wp-includes/ms-functions.php:1343 +msgid "New %1$s Site: %2$s" +msgstr "Nuevo sitio en %1$s: %2$s" + +#: wp-includes/ms-functions.php:1057 +msgid "Site already exists." +msgstr "El sitio ya existe." + +#: wp-includes/ms-functions.php:932 +msgid "The site is already active." +msgstr "El sitio ya está activado." + +#: wp-includes/ms-functions.php:660 +msgid "Site name must be at least 4 characters" +msgstr "El nombre del sitio debe tener una extensión mínima de 4 caracteres." + +#: wp-includes/ms-functions.php:1063 +msgid "Could not create site." +msgstr "No se pudo crear el sitio." + +#: wp-includes/ms-functions.php:680 +msgid "Please enter a site title" +msgstr "Por favor, introduce un título para el sitio" + +#: wp-includes/ms-functions.php:673 +msgid "Sorry, site names must have letters too!" +msgstr "Disculpa, el nombre del sitio, también debe contener letras." + +#: wp-includes/ms-functions.php:667 +msgid "Sorry, you may not use that site name." +msgstr "Lo sentimos, no puedes utilizar este nombre para el sitio." + +#: wp-includes/ms-functions.php:695 +msgid "Sorry, that site is reserved!" +msgstr "Disculpa, este nombre de sitio está reservado" + +#: wp-includes/ms-functions.php:706 +msgid "That site is currently reserved but may be available in a couple days." +msgstr "Este nombre de sitio está reservado, pero puede estar libre en un par de días." + +#: wp-includes/ms-functions.php:324 +msgid "Error: problem creating site entry." +msgstr "Error: problema al crear entrada el el sitio." + +#: wp-includes/ms-functions.php:317 +msgid "Error: Site URL already taken." +msgstr "Error: URL del sitio ya escogida." + +#: wp-admin/includes/class-wp-ms-sites-list-table.php:120 +msgid "No sites found." +msgstr "No se encontraron sitios." + +#: wp-includes/ms-load.php:101 +msgid "This site has been archived or suspended." +msgstr "Este sitio ha sido archivado o suspendido." + +#: wp-includes/ms-settings.php:124 +msgid "No site by that name on this system." +msgstr "No existe ningún sitio en el sistema con este nombre." + +#: wp-includes/ms-load.php:211 +msgid "That site does not exist. Please try %s." +msgstr "Este sitio no existe. Por favor, prueba %s." + +#: wp-includes/ms-functions.php:1829 +msgid "You have been added to this site. Please visit the homepage or login using your username and password." +msgstr "Has sido añadido a este sitio. Por favor, visita la página de Inicio o Identifícate usando tu nombre de usuario y contraseña." + +#: wp-includes/ms-functions.php:1827 +msgid "An error occurred adding you to this site. Back to the homepage." +msgstr "Hubo un error añadiéndote a este sitio. Volver a la página de inicio." + +#: wp-includes/ms-functions.php:1829 +msgid "Success" +msgstr "¡Lo lograste!" + +#: wp-includes/ms-functions.php:1751 +msgid "This file is too big. Files must be less than %d KB in size." +msgstr "Este archivo es demasiado grande. Los archivos deben tener un tamaño inferior a %d KB." + +#: wp-activate.php:68 +msgid "Your site at %2$s is active. You may now log in to your site using your chosen username of “%3$s”. Please check your email inbox at %4$s for your password and login instructions. If you do not receive an email, please check your junk or spam folder. If you still do not receive an email within an hour, you can reset your password." +msgstr "Tu sitio en %2$s está activo. Ahora puedes acceder a tu sitio usando el nombre de usuario elegido de “%3$s”. Por favor, revisa la bandeja de entrada de %4$s para ver tu contraseña e instrucciones de acceso. Si no recibes un correo electrónico revisa la bandeja de spam. Si ni aún así recibieras un correo electrónico en una hora puedes reiniciar tu contraseña." + +#: wp-signup.php:87 +msgid "Must be at least 4 characters, letters and numbers only. It cannot be changed, so choose carefully!" +msgstr "Debe tener al menos 4 caracteres, letras y números solamente. ¡No se puede cambiar, así que elige con cuidado!" + +#: wp-signup.php:407 +msgid "You must first log in, and then you can create a new site." +msgstr "Primero debes iniciar sesión, después podrás crear un sitio nuevo." + +#: wp-signup.php:437 +msgid "You are logged in already. No need to register again!" +msgstr "Ya te has identificado. ¡No necesitas registrarte de nuevo!" + +#: wp-signup.php:173 +msgid "Welcome back, %s. By filling out the form below, you can add another site to your account. There is no limit to the number of sites you can have, so create to your heart’s content, but write responsibly!" +msgstr "Bienvenido de nuevo %s. Rellenando el siguiente formulario, puedes añadir otro sitio a tu cuenta. No hay límite en el número de sitios que puedas tener, por tanto, crea los que necesites, pero escribe con responsabilidad." + +#: wp-signup.php:443 +msgid "

    The site you were looking for, %s does not exist, but you can create it now!

    " +msgstr "

    El sitio que estás buscando, %s no existe pero puedes crearlo ahora.

    " + +#: wp-includes/ms-functions.php:551 +msgid "Sorry, usernames may not contain the character “_”!" +msgstr "¡Lo sentimos, nombres de usuario no puede contener el caracter “_”!" + +#: wp-signup.php:445 +msgid "

    The site you were looking for, %s, does not exist.

    " +msgstr "

    El sitio que has estado buscando, %s, no existe.

    " + +#: wp-signup.php:369 +msgid "If you haven’t received your email yet, there are a number of things you can do:" +msgstr "Si todavía no has recibido el correo electrónico, hay una serie de acciones que puedes realizar:" + +#: wp-includes/ms-settings.php:15 +msgid "Configuration error in wp-config.php. $base is set to BASE when it should be like / or /blogs/." +msgstr "Error de configuración en wp-config.php. $base está definido como BASE cuando debería ser parecido a / o /sitios/." + +#: wp-includes/ms-load.php:239 +msgid "If you’re still stuck with this message, then check that your database contains the following tables:" +msgstr "Si todavía estás atascado con este mensaje, comprueba que tu base de datos contiene las siguientes tablas:" + +#: wp-signup.php:225 +msgid "http://%2$s is your new site. Log in as “%4$s” using your existing password." +msgstr "http://%2$s es tu nuevo sitio. Accede como “%4$s” usando tu contraseña actual." + +#: wp-admin/my-sites.php:34 +msgid "The primary site you chose does not exist." +msgstr "El sitio principal que has elegido no existe." + +#: wp-admin/network/settings.php:126 +msgid "If you want to limit site registrations to certain domains. One domain per line." +msgstr "Si quieres limitar el registro de sitios a determinados dominios. Un dominio por línea." + +#: wp-admin/network/settings.php:136 +msgid "If you want to ban domains from site registrations. One domain per line." +msgstr "Si quieres banear dominios del registro de sitios. Un dominio por línea." + +#: wp-admin/network/settings.php:214 +msgid "The media upload buttons to display on the “Write Post” page. Make sure you update the allowed upload file types below as well." +msgstr "Los botones de subida de archivos a mostrar en la página de “Nueva entrada”. Asegúrate de actualizar también los tipos de archivo permitidos." + +#: wp-admin/network.php:237 wp-admin/network.php:277 +msgid "The internet address of your network will be %s." +msgstr "La dirección en internet de tu red será %s." + +#: wp-admin/network.php:190 +msgid "Fill in the information below and you’ll be on your way to creating a network of WordPress sites. We will create configuration files in the next step." +msgstr "Completa la información siguiente y estarás en el camino de crear una red de sitios con WordPress. Crearemos los archivos de configuración en el siguiente paso." + +#: wp-admin/network/settings.php:86 +msgid "If registration is disabled, please set NOBLOGREDIRECT in wp-config.php to a URL you will redirect visitors to if they visit a non-existent site." +msgstr "Si el registro está deshabilitado, por favor, define NOBLOGREDIRECT en wp-config.php con la URL que quieres que se redirija a los visitantes que visitan un sitio inexistente." + +#: wp-admin/network/site-new.php:34 +msgid "Can’t create an empty site." +msgstr "No se puede crear un sitio vacío." + +#: wp-admin/network/upgrade.php:66 +msgid "If your browser doesn’t start loading the next page automatically, click this link:" +msgstr "Si tu navegador no carga la siguiente página de forma automática haz clic en este enlace:" + +#: wp-admin/network.php:212 +msgid "You will need a wildcard DNS record if you are going to use the virtual host (sub-domain) functionality." +msgstr "Necesitarás crear un registro DNS si vas a utilizar la funcionalidad de servidor vitual (sub-dominios)." + +#: wp-admin/network.php:232 +msgid "We recommend you change your siteurl to %1$s before enabling the network feature. It will still be possible to visit your site using the www prefix with an address like %2$s but any links will not have the www prefix." +msgstr "Te recomendamos que cambies la URL de tu sitio a %1$s antes de activar la función de red. Seguirá siendo posible visitar tu sitio con el prefijo www con una dirección como %2$s, pero ningún enlace tendrá el prefijo www." + +#: wp-admin/network.php:202 +msgid "Please make sure the Apache mod_rewrite module is installed as it will be used at the end of this installation." +msgstr "Por favor, asegúrate de que el módulo Apache mod_rewrite está instalado, ya que será utilizado al finalizar la instalación." + +#: wp-admin/network.php:358 +msgid "Add the following to your wp-config.php file in %s above the line reading /* That’s all, stop editing! Happy blogging. */:" +msgstr "Añade lo siguiente a tu archivo wp-config.php en %s sobre la línea que dice /* ¡Eso es todo, no hay que editar nada más! Feliz blogging. */:" + +#: wp-admin/network/sites.php:79 +msgid "Site marked as spam." +msgstr "Sitio marcado como spam." + +#: wp-admin/network/sites.php:52 +msgid "Sites marked as spam." +msgstr "Sitios marcados como spam." + +#: wp-admin/network/sites.php:49 +msgid "Sites removed from spam." +msgstr "Sitios eliminados de spam." + +#: wp-admin/network/users.php:59 +msgid "Users removed from spam." +msgstr "Usuarios eliminados de spam." + +#: wp-admin/network/sites.php:76 +msgid "Site removed from spam." +msgstr "Sitio eliminado de spam." + +#: wp-admin/network.php:138 +msgid "Your WordPress address must match your Site address before creating a Network. See General Settings." +msgstr "Tu dirección de WordPress debe coincidir con la dirección de tu sitio antes de crear una red. Mira en Ajustes generales." + +#: wp-admin/network.php:259 +msgid "Because your install is in a directory, the sites in your WordPress network must use sub-directories." +msgstr "Cómo lo has instalado en un subdirectorio, los sitios en tu red de WordPress, deben usar subdirectorios." + +#: wp-admin/network/sites.php:55 +msgid "Sites deleted." +msgstr "Sitios eliminados." + +#: wp-admin/network/sites.php:58 +msgid "Site deleted." +msgstr "Sitio eliminado." + +#: wp-admin/network/site-new.php:95 +msgid "Site added." +msgstr "Sitio añadido." + +#: wp-admin/includes/class-wp-ms-sites-list-table.php:255 +msgid "You are about to archive the site %s." +msgstr "Estás apunto de archivar el sitio %s." + +#: wp-admin/network/users.php:56 +msgid "Users marked as spam." +msgstr "Usuario marcado como spam." + +#: wp-admin/includes/class-wp-ms-sites-list-table.php:258 +msgid "You are about to unspam the site %s." +msgstr "Estás a punto de sacar el sitio %s de spam." + +#: wp-admin/network/site-info.php:134 +msgid "Update siteurl and home as well." +msgstr "Actualizar siteurl y portada" + +#: wp-admin/includes/class-wp-ms-sites-list-table.php:260 +msgid "You are about to mark the site %s as spam." +msgstr "Estás a punto de marcar el sitio %s como spam." + +#: wp-admin/network/sites.php:73 +msgid "Site deactivated." +msgstr "Sitio desactivado." + +#: wp-admin/network/sites.php:70 +msgid "Site activated." +msgstr "Sitio activado." + +#: wp-admin/network/sites.php:67 +msgid "Site unarchived." +msgstr "Sitio desarchivado." + +#: wp-admin/includes/class-wp-ms-sites-list-table.php:263 +msgid "You are about to delete the site %s." +msgstr "Estás a punto de eliminar el sitio %s." + +#: wp-admin/network/users.php:62 +msgid "Users deleted." +msgstr "Usuarios eliminados." + +#: wp-admin/includes/class-wp-ms-sites-list-table.php:253 +msgid "You are about to unarchive the site %s." +msgstr "Estás a punto de desarchiva el sitio %s." + +#: wp-admin/network/users.php:53 +msgid "User deleted." +msgstr "Usuario eliminado." + +#: wp-admin/network/sites.php:64 +msgid "Site archived." +msgstr "Sitio archivado." + +#: wp-admin/ms-delete-site.php:17 +msgid "You do not have sufficient permissions to delete this site." +msgstr "No tienes suficientes permisos para eliminar este sitio." + +#: wp-admin/ms-delete-site.php:44 +msgid "" +"Dear User,\n" +"You recently clicked the 'Delete Site' link on your site and filled in a\n" +"form on that page.\n" +"If you really want to delete your site, click the link below. You will not\n" +"be asked to confirm again so only click this link if you are absolutely certain:\n" +"###URL_DELETE###\n" +"\n" +"If you delete your site, please consider opening a new site here\n" +"some time in the future! (But remember your current site and username\n" +"are gone forever.)\n" +"\n" +"Thanks for using the site,\n" +"Webmaster\n" +"###SITE_NAME###" +msgstr "" +"Apreciado usuario,\n" +"Recientemente has hecho clic en el enlace \"Eliminar sitio\" de tu sitio, y has completado\n" +"un formulario en esa página.\n" +"Si realmente quieres eliminar tu sitio, sigue el enlace siguiente. No serás\n" +"preguntado de nuevo para confirmar esta acción, es decir, haz clic si estás totalmente seguro:\n" +"###URL_DELETE###\n" +"\n" +"Si eliminas tu sitio, por favor, considera crear uno nuevo aquí mismo\n" +"en el futuro. (Pero recuerda que tu nombre de usuario y tu sitio\n" +"desaparecerán para siempre.)\n" +"\n" +"Gracias por usar nuestro sitio,\n" +"Webmaster\n" +"###SITE_NAME###" + +#: wp-admin/ms-delete-site.php:75 +msgid "I'm sure I want to permanently disable my site, and I am aware I can never get it back or use %s again." +msgstr "Estoy seguro que quiero desactivar mi sitio de forma permanente y estoy avisado que NUNCA MÁS podré usar de nuevo %s." + +#: wp-admin/ms-delete-site.php:76 +msgid "Delete My Site Permanently" +msgstr "Eliminar mi sitio de forma permanente" + +#: wp-admin/network/edit.php:105 +msgid "You probably need to go back to the options page." +msgstr "Probablemente debes volver a opciones de página." + +#: wp-admin/network/site-new.php:55 +msgid "Invalid email address." +msgstr "Dirección de correo electrónico no válida." + +#: wp-admin/network/site-new.php:71 +msgid "There was an error creating the user." +msgstr "Hubo un error al crear el usuario." + +#: wp-admin/network/edit.php:222 wp-admin/network/edit.php:323 +msgid "You are not allowed to change the current site." +msgstr "No estás autorizado a cambiar el sitio actual." + +#: wp-admin/ms-delete-site.php:70 +msgid "Remember, once deleted your site cannot be restored." +msgstr "Recuerda, una vez que elimines tu sitio, no se podrá recuperar." + +#: wp-admin/ms-delete-site.php:69 +msgid "If you do not want to use your %s site any more, you can delete it using the form below. When you click Delete My Site Permanently you will be sent an email with a link in it. Click on this link to delete your site." +msgstr "Si no quieres usar más tu sitio %s, puedes eliminarlo mediante el formulario siguiente. Cuando hagas clic en Eliminar mi sitio de forma permanente enviarás un correo electrónico con un enlace en él. Siguiendo ese enlace, tu sitio será eliminado." + +#: wp-admin/ms-delete-site.php:65 +msgid "Thank you. Please check your email for a link to confirm your action. Your site will not be deleted until this link is clicked. " +msgstr "Gracias. Por favor, comprueba tu correo electrónico para seguir el enlace. Tu sitio no será eliminado hasta que hagas clic en ese enlace." + +#: wp-admin/ms-delete-site.php:62 +msgid "Delete My Site" +msgstr "Eliminar mi sitio" + +#: wp-admin/ms-delete-site.php:22 +msgid "Thank you for using %s, your site has been deleted. Happy trails to you until we meet again." +msgstr "Gracias por usar %s, tu sitio ha sido eliminado. Seremos muy felices si volvemos a saber de ti." + +#: wp-admin/network.php:217 +msgctxt "subdomain examples" +msgid "like site1.%1$s and site2.%1$s" +msgstr "cómo sitio1.%1$s y sitio2.%1$s" + +#: wp-admin/network.php:221 +msgctxt "subdirectory examples" +msgid "like %1$s/site1 and %1$s/site2" +msgstr "cómo %1$s/sitio1 and %1$s/sitio2" + +#: wp-includes/ms-settings.php:38 +msgid "Multisite only works without the port number in the URL." +msgstr "El multisitio sólo funciona sin el número del puerto en la URL." + +#: wp-admin/network/settings.php:231 +msgctxt "File size in kilobytes" +msgid "%s KB" +msgstr "%s KB" + +#: wp-admin/network/settings.php:67 +msgid "Registration and support emails will come from this address. An address such as support@%s is recommended." +msgstr "Los correo electrónicos de registro y de soporte vendrán de esta dirección. Se recomienda un correo electrónico del tipo soporte@%s." + +#: wp-admin/network/settings.php:209 +msgid "Media upload buttons" +msgstr "Botones de subida de archivos" + +#: wp-admin/network/settings.php:225 +msgid "Upload file types" +msgstr "Tipos de archivo permitidos" + +#: wp-admin/network/settings.php:220 +msgid "Limit total size of files uploaded to %s MB" +msgstr "Tamaño máximo de espacio para archivos subidos %s MB" + +#: wp-admin/network.php:184 wp-admin/network.php:204 wp-admin/network.php:252 +#: wp-admin/network.php:262 +msgid "Warning!" +msgstr "¡Aviso!" + +#: wp-admin/network.php:202 +msgid "Note:" +msgstr "Nota:" + +#: wp-admin/network.php:206 +msgid "If mod_rewrite is disabled, ask your administrator to enable that module, or look at the Apache documentation or elsewhere for help setting it up." +msgstr "Si mod_rewrite está deshabilitado, pide a su administrador que active ese módulo, o revise la documentación de Apache o en otros sitios para conseguir ayuda para su configuración." + +#: wp-admin/network.php:204 +msgid "It looks like the Apache mod_rewrite module is not installed." +msgstr "Parece que el módulo mod_rewrite de Apache no está instalado." + +#: wp-admin/network/settings.php:194 +msgid "The author of the first comment on a new site." +msgstr "El autor del primer comentario en un sitio nuevo." + +#: wp-admin/network/settings.php:168 +msgid "The first post on a new site." +msgstr "La primera entrada en un sitio nuevo." + +#: wp-admin/network/settings.php:177 +msgid "The first page on a new site." +msgstr "La primera página en un sitio nuevo." + +#: wp-admin/network/settings.php:186 +msgid "The first comment on a new site." +msgstr "El primer comentario en un sitio nuevo." + +#: wp-admin/network/settings.php:202 +msgid "The URL for the first comment on a new site." +msgstr "La URL para el primer comentario en un nuevo sitio." + +#: wp-admin/network/upgrade.php:52 +msgid "All done!" +msgstr "¡Todo hecho!" + +#: wp-admin/network.php:27 +msgid "The Network creation panel is not for WordPress MU networks." +msgstr "El panel de creación de la Red no es para redes de WordPress MU." + +#: wp-admin/network.php:186 +msgctxt "Default network name" +msgid "%s Sites" +msgstr "%s sitios" + +#: wp-admin/network.php:176 +msgid "ERROR: The network could not be created." +msgstr "ERROR: La red no ha podido crearse." + +#: wp-admin/network/settings.php:83 +msgid "Logged in users may register new sites." +msgstr "Solo los usuarios identificados, pueden crear sitios." + +#: wp-admin/network/settings.php:84 +msgid "Both sites and user accounts can be registered." +msgstr "Pueden ser creados sitios y usuarios." + +#: wp-admin/network/settings.php:82 +msgid "User accounts may be registered." +msgstr "Solo las cuentas de usuario pueden ser creadas." + +#: wp-admin/network/settings.php:81 +msgid "Registration is disabled." +msgstr "Los registros están deshabilitados." + +#: wp-admin/network/settings.php:258 +msgid "Enable administration menus" +msgstr "Activar menús de administración" + +#: wp-admin/network/settings.php:51 +msgid "Operational Settings" +msgstr "Ajustes operacionales" + +#: wp-admin/network/settings.php:255 +msgid "Menu Settings" +msgstr "Ajustes de menú" + +#: wp-admin/network/settings.php:206 +msgid "Upload Settings" +msgstr "Ajustes de subidas" + +#: wp-admin/network/settings.php:141 +msgid "New Site Settings" +msgstr "Ajustes para sitios nuevos" + +#: wp-admin/network/settings.php:71 +msgid "Registration Settings" +msgstr "Ajustes de registro" + +#: wp-admin/network.php:326 +msgid "The original configuration steps are shown here for reference." +msgstr "Los pasos de configuración originales se muestran aquí para tenerlos como referencia." + +#: wp-admin/network.php:164 +msgid "Return to Dashboard" +msgstr "Volver al escritorio" + +#: wp-admin/network.php:163 +msgid "You cannot use port numbers such as %s." +msgstr "No puedes usar números de puerto como %s." + +#: wp-admin/network.php:153 wp-admin/network.php:331 wp-admin/network.php:356 +msgid "Warning:" +msgstr "Advertencia:" + +#: wp-admin/network.php:331 +msgid "An existing WordPress network was detected." +msgstr "Se ha detectado una red de WordPress existente." + +#: wp-admin/network.php:332 +msgid "Please complete the configuration steps. To create a new network, you will need to empty or remove the network database tables." +msgstr "Por favor, completa los pasos de configuración. Para crear una nueva red necesitarás vaciar o eliminar las tablas de la red en la base de datos." + +#: wp-admin/network.php:96 +msgid "You must define the WP_ALLOW_MULTISITE constant as true in your wp-config.php file to allow creation of a Network." +msgstr "Debes definir la constante WP_ALLOW_MULTISITE como true en tu archivo wp-config.php para permitir la creación de una red." + +#: wp-admin/network/site-new.php:51 +msgid "Missing or invalid site address." +msgstr "La dirección del sitio no está o no es válida." + +#: wp-admin/network/site-new.php:53 +msgid "Missing email address." +msgstr "Falta la dirección de correo electrónico." + +#: wp-admin/network.php:249 +msgid "Because you are using localhost, the sites in your WordPress network must use sub-directories. Consider using localhost.localdomain if you wish to use sub-domains." +msgstr "Cómo estás usando localhost los sitios en tu red de WordPress deben estar en subdirectorios. Considera usar localhost.localdomain si deseas usar subdominios." + +#: wp-admin/network.php:247 wp-admin/network.php:257 +msgid "Sub-directory Install" +msgstr "Instalación en subdirectorio" + +#: wp-admin/network.php:389 +msgid "To make your installation more secure, you should also add:" +msgstr "Para hacer tu instalación más segura debes añadir lo siguiente:" + +#: wp-admin/network.php:389 +msgid "This unique authentication key is also missing from your wp-config.php file." +msgid_plural "These unique authentication keys are also missing from your wp-config.php file." +msgstr[0] "Esta clave de autentificación tampoco se encuentra en tu archivo wp-config.php" +msgstr[1] "Estas claves de autentificación tampoco se encuentran en tu archivo wp-config.php" + +#: wp-admin/network.php:503 +msgid "Add the following to your .htaccess file in %s, replacing other WordPress rules:" +msgstr "Añade lo siguiente a tu archivo .htaccess en %s, remplazando las reglas existentes de WordPress:" + +#: wp-admin/network.php:340 +msgid "Complete the following steps to enable the features for creating a network of sites." +msgstr "Completa los siguientes pasos para activar la función de creación de red de sitios." + +#: wp-admin/network/upgrade.php:18 wp-admin/network/upgrade.php:37 +#: wp-admin/network/upgrade.php:79 wp-admin/network/menu.php:78 +msgid "Update Network" +msgstr "Actualizar red" + +#: wp-admin/network/upgrade.php:78 +msgid "You can update all the sites on your network through this page. It works by calling the update script of each site automatically. Hit the link below to update." +msgstr "Puedes actualizar todos los sitios de tu red mediante esta página. Funciona haciendo una llamada al script de actualización de forma automatizada. Haz clic en el enlace siguiente para actualizarlos." + +#: wp-admin/network.php:102 +msgid "Create a Network of WordPress Sites" +msgstr "Crear una red de sitios de WordPress" + +#: wp-admin/network.php:162 +msgid "You cannot install a network of sites with your server address." +msgstr "No puedes instalar una red de sitios con tu dirección de servidor." + +#: wp-admin/network.php:189 +msgid "Welcome to the Network installation process!" +msgstr "¡Bienvenido al proceso de instalación de la red!" + +#: wp-admin/network.php:210 +msgid "Addresses of Sites in your Network" +msgstr "Direcciones de los sitios en tu red" + +#: wp-admin/network.php:285 +msgid "What would you like to call your network?" +msgstr "¿Cómo quieres llamar a tu red?" + +#: wp-admin/network.php:211 +msgid "Please choose whether you would like sites in your WordPress network to use sub-domains or sub-directories. You cannot change this later." +msgstr "Por favor, elige como quieres que estén los sitios en tu red de WordPress, subdominios o subdirectorios. No podrás cambiarlo más tarde." + +#: wp-admin/network.php:243 +msgid "Network Details" +msgstr "Detalles de la red" + +#: wp-admin/network.php:282 +msgid "Network Title" +msgstr "Título de la red" + +#: wp-admin/network.php:289 +msgid "Admin E-mail Address" +msgstr "Dirección de correo electrónico del Administrador" + +#: wp-admin/network.php:339 +msgid "Enabling the Network" +msgstr "Activando la red" + +#: wp-signup.php:223 +msgid "The site %s is yours." +msgstr "El sitio %s es tuyo." + +#: wp-signup.php:193 +msgid "Create Site" +msgstr "Crear sitio" + +#: wp-signup.php:188 +msgid "If you’re not going to use a great site domain, leave it for a new user. Now have at it!" +msgstr "Si no vas a usar un dominio de un sitio, por favor, libéralo para que otro lo pueda usar. Ahora ¡consigue uno!" + +#: wp-signup.php:179 +msgid "Sites you are already a member of:" +msgstr "Eres miembro de los siguientes sitios:" + +#: wp-includes/ms-load.php:94 +msgid "This site has not been activated yet. If you are having problems activating your site, please contact %1$s." +msgstr "Este sitio aún no ha sido activado. Si estas teniendo problemas en el proceso de activación, por favor contacta con %1$s." + +#: wp-signup.php:92 +msgid "Site Title:" +msgstr "Título del sitio:" + +#: wp-signup.php:71 +msgid "Site Domain:" +msgstr "Dominio del sitio:" + +#: wp-signup.php:69 +msgid "Site Name:" +msgstr "Nombre del sitio:" + +#: wp-signup.php:84 +msgid "sitename" +msgstr "nombresitio" + +#: wp-signup.php:167 +msgid "Get another %s site in seconds" +msgstr "Consigue otro sitio en %s en segundos" + +#: wp-signup.php:362 +msgid "Congratulations! Your new site, %s, is almost ready." +msgstr "¡Felicidades! Tu nuevo sitio , %s, ya está listo." + +#: wp-signup.php:421 +msgid "Site registration has been disabled." +msgstr "No se permiten nuevos registros de sitios." + +#: wp-signup.php:265 +msgid "Gimme a site!" +msgstr "¡Dame un sitio!" + +#: wp-signup.php:364 +msgid "But, before you can start using your site, you must activate it." +msgstr "Pero, antes de que puedas comenzar a usar tu sitio, debes activarlo." + +#: wp-signup.php:366 +msgid "If you do not activate your site within two days, you will have to sign up again." +msgstr "Si no activas tu sitio en dos días, deberás registrarte de nuevo." + +#: wp-admin/network/settings.php:63 +msgid "Network Admin Email" +msgstr "Correo electrónico del administrador de la red" + +#: wp-admin/network/settings.php:54 +msgid "Network Name" +msgstr "Nombre de la red" + +#: wp-admin/network/site-new.php:83 +msgid "[%s] New Site Created" +msgstr "[%s] Nuevo sitio creado" + +#: wp-admin/network/site-new.php:82 +msgid "" +"New site created by %1s\n" +"\n" +"Address: http://%2s\n" +"Name: %3s" +msgstr "" +"Nuevo sitio creado por %1s\n" +"\n" +"Dirección: http://%2s\n" +"Nombre: %3s" + +#: wp-admin/network/edit.php:328 +msgid "WordPress › Confirm your action" +msgstr "WordPress › Confirma tu acción" + +#: wp-admin/network/settings.php:150 +msgid "The welcome email sent to new site owners." +msgstr "El correo electrónico de bienvenida enviado a los dueños de sitios nuevos." + +#: wp-admin/network/settings.php:218 +msgid "Site upload space" +msgstr "Espacio de subidas para el sitio" + +#: wp-admin/includes/class-wp-ms-sites-list-table.php:248 +msgid "You are about to activate the site %s" +msgstr "Estás a punto de activar el sitio %s" + +#: wp-admin/network/settings.php:98 +msgid "Send the network admin an email notification every time someone registers a site or user account." +msgstr "Enviar al administrador un correo electrónico cada vez que alguien se registre o registre un sitio." + +#: wp-admin/network/settings.php:114 +msgid "Users are not allowed to register these sites. Separate names by spaces." +msgstr "Los usuarios no tienes permiso para crear estos sitios. Separa los nombres mediante espacios." + +#: wp-admin/includes/class-wp-ms-sites-list-table.php:250 +msgid "You are about to deactivate the site %s" +msgstr "Estás a punto desactivar el sitio %s" + +#: wp-admin/network/upgrade.php:66 +msgid "Next Sites" +msgstr "Sitios siguientes" + +#: wp-includes/ms-functions.php:214 wp-includes/ms-functions.php:276 +msgid "That user does not exist." +msgstr "Este usuario no existe" + +#: wp-includes/ms-functions.php:534 +msgid "Please enter a username" +msgstr "Por favor, introduce un nombre de usuario." + +#: wp-includes/ms-functions.php:654 +msgid "Only lowercase letters and numbers allowed" +msgstr "Solo se permiten minúsculas y números" + +#: wp-includes/ms-functions.php:542 +msgid "That username is not allowed" +msgstr "Este nombre de usuario no está permitido" + +#: wp-includes/ms-functions.php:545 +msgid "You cannot use that email address to signup. We are having problems with them blocking some of our email. Please use another email provider." +msgstr "No puedes usar este correo electrónico para registrarte. Estamos teniendo problemas con él, bloquea nuestros correos electrónicos. Por favor, usa otro proveedor." + +#: wp-includes/ms-functions.php:548 +msgid "Username must be at least 4 characters" +msgstr "El nombre de usuario debe tener una extensión mínima de 4 caracteres." + +#: wp-includes/ms-functions.php:557 +msgid "Sorry, usernames must have letters too!" +msgstr "Disculpa, el nombre de usuario, también debe contener letras." + +#: wp-includes/ms-functions.php:560 +msgid "Please enter a correct email address" +msgstr "Por favor, introduce un correo electrónico válido" + +#: wp-includes/ms-functions.php:566 +msgid "Sorry, that email address is not allowed!" +msgstr "Disculpa, este correo electrónico no está permitido" + +#: wp-includes/ms-functions.php:571 +msgid "Sorry, that username already exists!" +msgstr "Disculpa, este usuario ya existe." + +#: wp-includes/ms-functions.php:575 +msgid "Sorry, that email address is already used!" +msgstr "Disculpa, este correo electrónico ya está en uso." + +#: wp-includes/ms-functions.php:587 +msgid "That username is currently reserved but may be available in a couple of days." +msgstr "Este nombre de usuario está reservado, pero podría estar libre en un par de días" + +#: wp-includes/ms-functions.php:590 +msgid "username and email used" +msgstr "nombre de usuario y correo electrónico en uso" + +#: wp-includes/ms-functions.php:600 +msgid "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." +msgstr "Este correo electrónico ya ha sido usado. Por favor, comprueba tu bandeja de entrada. Podría estar libre en un par de días si no haces nada." + +#: wp-includes/ms-functions.php:657 +msgid "That name is not allowed" +msgstr "Este nombre no está permitido" + +#: wp-includes/ms-functions.php:882 +msgid "" +"To activate your user, please click the following link:\n" +"\n" +"%s\n" +"\n" +"After you activate, you will receive *another email* with your login.\n" +"\n" +msgstr "" +"Para activar tu usuario, por favor, sigue el siguiente enlace:\n" +"\n" +"%s\n" +"\n" +"Después de la activación, recibirás *otro correo electrónico* con tu identificación.\n" +"\n" + +#: wp-includes/ms-functions.php:926 +msgid "Invalid activation key." +msgstr "Clave de activación inválida" + +#: wp-includes/ms-functions.php:948 +msgid "Could not create user" +msgstr "No podemos crear el usuario" + +#: wp-includes/ms-functions.php:956 +msgid "That username is already activated." +msgstr "Este usuario, ya está activado." + +#: wp-includes/ms-functions.php:1150 +msgid "" +"New User: %1s\n" +"Remote IP: %2s\n" +"\n" +"Disable these notifications: %3s" +msgstr "" +"Nuevo usuario: %1s\n" +"IP Remota: %2s\n" +"\n" +"Desactivar estas notificaciones: %3s" + +#: wp-includes/ms-functions.php:1156 +msgid "New User Registration: %s" +msgstr "Nuevo registro de usuario: %s" + +#: wp-includes/ms-functions.php:1229 +msgid "

    Already Installed

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

    " +msgstr "

    Ya instalado

    WordPress parece estar instalado. Si deseas reinstalar, por favor, borra las tablas de la base de datos.

    " + +#: wp-includes/ms-functions.php:1391 +msgid "New %1$s User: %2$s" +msgstr "Nuevo %1$s usuario: %2$s" + +#: wp-includes/ms-functions.php:1572 +msgid "Sorry, you have used your space allocation. Please delete some files to upload more files." +msgstr "Disculpa. Has usado todo tu espacio. Por favor, borra algunos archivos para poder subir nuevos." + +#: wp-includes/ms-functions.php:1782 +msgid "Please try again!" +msgstr "Por favor, vuelve a intentarlo." + +#: wp-includes/ms-functions.php:1989 +msgid "" +"Dear User,\n" +"\n" +"Your new account is set up.\n" +"\n" +"You can log in with the following information:\n" +"Username: USERNAME\n" +"Password: PASSWORD\n" +"LOGINLINK\n" +"\n" +"Thanks!\n" +"\n" +"--The Team @ SITE_NAME" +msgstr "" +"Apreciado usuario,\n" +"\n" +"Tu nueva cuenta está configurada.\n" +"\n" +"Puedes identificarte con la siguiente información:\n" +"Usuario: USERNAME\n" +"Clave: PASSWORD\n" +"LOGINLINK\n" +"\n" +"¡Gracias!\n" +"\n" +"--El equipo de SITE_NAME" + +#: wp-includes/ms-load.php:87 +msgid "This user has elected to delete their account and the content is no longer available." +msgstr "Este usuario ha decidido eliminar su cuenta y ya no están los contenidos." + +#: wp-includes/ms-settings.php:123 +msgid "Database tables are missing." +msgstr "No se encuentran tablas de la base de datos." + +#: wp-admin/network.php:138 wp-admin/network.php:145 wp-admin/network.php:162 +msgid "Error:" +msgstr "Error:" + +#: wp-signup.php:101 +msgid "Privacy:" +msgstr "Privacidad:" + +#: wp-signup.php:134 +msgid "(Must be at least 4 characters, letters and numbers only.)" +msgstr "(Deben tener como mínimo 4 caracteres, solo letras y números.)" + +#: wp-signup.php:137 +msgid "Email Address:" +msgstr "Dirección de correo electrónico:" + +#: wp-signup.php:170 +msgid "There was a problem, please correct the form below and try again." +msgstr "Hubo un problema, revisa el formulario y prueba de nuevo." + +#: wp-signup.php:252 +msgid "Get your own %s account in seconds" +msgstr "Consigue tu propia cuenta %s en segundos." + +#: wp-signup.php:268 +msgid "Just a username, please." +msgstr "Solo el nombre de usuario, gracias." + +#: wp-signup.php:272 +msgid "Next" +msgstr "Siguiente" + +#: wp-signup.php:299 +msgid "%s is your new username" +msgstr "%s es tu nuevo nombre de usuario" + +#: wp-signup.php:300 +msgid "But, before you can start using your new username, you must activate it." +msgstr "Pero, antes de poder comenzar a usar tu nuevo nombre de usuario, debes activarlo." + +#: wp-signup.php:301 +msgid "Check your inbox at %1$s and click the link given." +msgstr "Comprueba la bandeja de entrada de %1$s y haz clic en el enlace que encontrarás." + +#: wp-signup.php:302 +msgid "If you do not activate your username within two days, you will have to sign up again." +msgstr "Si no activas tu nombre de usuario en dos días, deberás registrarte de nuevo." + +#: wp-signup.php:328 +msgid "Signup" +msgstr "Registrarse" + +#: wp-signup.php:367 +msgid "Still waiting for your email?" +msgstr "¿Continúas esperando el correo electrónico?" + +#: wp-signup.php:400 +msgid "Registration has been disabled." +msgstr "Los registros están deshabilitados." + +#: wp-signup.php:415 +msgid "User registration has been disabled." +msgstr "No se permite el registro de nuevos usuarios." + +#: wp-admin/my-sites.php:13 wp-admin/ms-delete-site.php:13 +#: wp-admin/network/user-new.php:14 wp-admin/network/index.php:17 +#: wp-admin/network/themes.php:14 wp-admin/network/plugin-editor.php:14 +#: wp-admin/network/plugin-install.php:17 wp-admin/network/site-users.php:14 +#: wp-admin/network/theme-editor.php:14 wp-admin/network/setup.php:14 +#: wp-admin/network/site-settings.php:14 wp-admin/network/site-new.php:14 +#: wp-admin/network/edit.php:14 wp-admin/network/theme-install.php:17 +#: wp-admin/network/users.php:14 wp-admin/network/upgrade.php:14 +#: wp-admin/network/update-core.php:14 wp-admin/network/sites.php:14 +#: wp-admin/network/settings.php:14 wp-admin/network/user-edit.php:14 +#: wp-admin/network/site-info.php:14 wp-admin/network/plugins.php:14 +#: wp-admin/network/profile.php:14 wp-admin/network/update.php:17 +#: wp-admin/network/site-themes.php:14 wp-admin/network/admin.php:16 +msgid "Multisite support is not enabled." +msgstr "El soporte multisitio no está activado." + +#: wp-admin/network/user-new.php:31 wp-admin/network/index.php:20 +#: wp-admin/network/site-users.php:42 wp-admin/network/site-settings.php:37 +#: wp-admin/network/site-new.php:31 wp-admin/network/edit.php:102 +#: wp-admin/network/edit.php:175 wp-admin/network/edit.php:192 +#: wp-admin/network/edit.php:236 wp-admin/network/edit.php:246 +#: wp-admin/network/edit.php:256 wp-admin/network/edit.php:267 +#: wp-admin/network/edit.php:278 wp-admin/network/edit.php:288 +#: wp-admin/network/edit.php:298 wp-admin/network/edit.php:308 +#: wp-admin/network/edit.php:355 wp-admin/network/edit.php:376 +#: wp-admin/network/edit.php:391 wp-admin/network/edit.php:442 +#: wp-admin/network/users.php:17 wp-admin/network/upgrade.php:33 +#: wp-admin/network/sites.php:17 wp-admin/network/settings.php:17 +#: wp-admin/network/site-info.php:37 wp-admin/network/site-themes.php:55 +msgid "You do not have permission to access this page." +msgstr "No tienes autorización para acceder a esta página" + +#: wp-admin/ms-delete-site.php:24 +msgid "I'm sorry, the link you clicked is stale. Please select another option." +msgstr "Lo sentimos, el enlace pulsado está caducado. Por favor, elige otra opción." + +#: wp-admin/network/edit.php:344 +msgid "Confirm" +msgstr "Confirmar" + +#: wp-admin/network/user-new.php:34 +msgid "Cannot create an empty user." +msgstr "No se puede crear un usuario vacio" + +#: wp-admin/network/site-users.php:217 +msgid "Duplicated username or email address." +msgstr "Nombre de usuario o correo electrónico duplicado." + +#: wp-admin/network/settings.php:58 +msgid "What you would like to call this website." +msgstr "Como quieres llamar a este sitio." + +#: wp-admin/network/settings.php:74 +msgid "Allow new registrations" +msgstr "Permitir nuevos registros" + +#: wp-admin/network/settings.php:92 +msgid "Registration notification" +msgstr "Notificación de registro" + +#: wp-admin/network/settings.php:103 +msgid "Add New Users" +msgstr "Añadir nuevo usuario" + +#: wp-admin/network/settings.php:110 +msgid "Banned Names" +msgstr "Nombre no permitidos" + +#: wp-admin/network/settings.php:119 +msgid "Limited Email Registrations" +msgstr "Limitar el registro de correo electrónico a" + +#: wp-admin/network/settings.php:131 +msgid "Banned Email Domains" +msgstr "Dominios de correo electrónico no permitidos" + +#: wp-admin/network/settings.php:145 +msgid "Welcome Email" +msgstr "Correo electrónico de bienvenida" + +#: wp-admin/network/settings.php:154 +msgid "Welcome User Email" +msgstr "Correo electrónico de bienvenida al usuario" + +#: wp-admin/network/settings.php:159 +msgid "The welcome email sent to new users." +msgstr "El correo electrónico de bienvenida enviado a los nuevos usuarios." + +#: wp-admin/network/settings.php:172 +msgid "First Page" +msgstr "Primera página" + +#: wp-admin/network/settings.php:181 +msgid "First Comment" +msgstr "Primer comentario" + +#: wp-admin/network/settings.php:190 +msgid "First Comment Author" +msgstr "Autor del primer comentario" + +#: wp-admin/network/settings.php:198 +msgid "First Comment URL" +msgstr "URL del primer comentario" + +#: wp-admin/network/settings.php:212 +msgid "Videos" +msgstr "Vídeos" + +#: wp-admin/network/settings.php:213 +msgid "Music" +msgstr "Música" + +#: wp-admin/network/settings.php:230 +msgid "Max upload file size" +msgstr "Tamaño máximo de archivo" + +#: wp-admin/network/settings.php:243 +msgid "Default Language" +msgstr "Idioma prederterminado." + +#: wp-admin/includes/class-wp-ms-sites-list-table.php:143 +#: wp-admin/network/site-new.php:120 wp-admin/network/site-new.php:122 +#: wp-admin/network/site-info.php:119 +msgid "Domain" +msgstr "Dominio" + +#: wp-admin/includes/class-wp-ms-sites-list-table.php:147 +#: wp-admin/network/site-info.php:142 +msgid "Last Updated" +msgstr "Última actualización" + +#: wp-admin/includes/class-wp-ms-sites-list-table.php:172 +#: wp-admin/network/site-info.php:148 +msgid "Archived" +msgstr "Archivado" + +#: wp-admin/includes/class-wp-ms-sites-list-table.php:175 +#: wp-admin/network/site-info.php:152 +msgid "Mature" +msgstr "Adulto" + +#: wp-admin/includes/class-wp-ms-sites-list-table.php:174 +#: wp-admin/network/site-info.php:150 +msgid "Deleted" +msgstr "Borrado" + +#: wp-admin/includes/class-wp-ms-sites-list-table.php:253 +msgid "Unarchive" +msgstr "Desarchivar" + +#: wp-admin/my-sites.php:95 +#: wp-admin/includes/class-wp-ms-sites-list-table.php:266 +msgid "Visit" +msgstr "Visitar" + +#: wp-admin/includes/class-wp-ms-sites-list-table.php:281 +msgid "Never" +msgstr "Nunca" + +#: wp-admin/includes/class-wp-ms-sites-list-table.php:302 +msgid "Only showing first 5 users." +msgstr "Mostrando solo los 5 primeros usuarios." + +#: wp-admin/includes/class-wp-ms-sites-list-table.php:302 +msgid "More" +msgstr "Más" + +#: wp-admin/network/site-new.php:140 +msgid "Add Site" +msgstr "Añadir sitio" + +#: wp-admin/network/site-new.php:117 +msgid "Site Address" +msgstr "Dirección del sitio" + +#: wp-admin/network/site-new.php:124 +msgid "Only the characters a-z and 0-9 recommended." +msgstr "Solo se recomiendan los caracters a-z y 0-9." + +#: wp-admin/network/site-new.php:133 +msgid "Admin Email" +msgstr "Correo electrónico del administrador" + +#: wp-admin/network/site-new.php:137 +msgid "A new user will be created if the above email address is not in the database." +msgstr "Se creará un usuario nuevo si el correo electrónico no está en la base de datos" + +#: wp-admin/network/site-new.php:137 +msgid "The username and password will be mailed to this email address." +msgstr "El nombre de usuario y la contraseña se enviarán a este correo electrónico." + +#: wp-admin/includes/class-wp-ms-users-list-table.php:82 +msgid "No users found." +msgstr "No se encontraron usuarios." + +#: wp-admin/network/user-new.php:94 wp-admin/network/site-users.php:302 +msgid "Username and password will be mailed to the above email address." +msgstr "Se enviarán el nombre de usuario y la contraseña a esta dirección de correo electrónico." + +#: wp-admin/my-sites.php:16 +msgid "You do not have sufficient permissions to view this page." +msgstr "No tienes permisos suficientes para ver esta página" + +#: wp-admin/my-sites.php:23 +msgid "You must be a member of at least one site to use this page." +msgstr "Debes ser miembro de, al menos, un sitio para usar esta página." + +#: wp-admin/my-sites.php:68 +msgid "Global Settings" +msgstr "Ajustes globales" + +#: wp-admin/network.php:231 wp-admin/network.php:235 wp-admin/network.php:275 +msgid "Server Address" +msgstr "Dirección del servidor" + +#: wp-admin/network.php:292 +msgid "Your email address." +msgstr "Tu dirección de correo electrónico." + +#: wp-admin/includes/ms-deprecated.php:30 +msgid "Sorry, you must delete files before you can upload any more." +msgstr "Disculpa, debes borrar archivos antes de subir nuevos." + +#: wp-activate.php:43 +msgid "Activation Key Required" +msgstr "Requiere clave de activación" + +#: wp-activate.php:46 +msgid "Activation Key:" +msgstr "Clave de activación:" + +#: wp-activate.php:62 wp-activate.php:82 +msgid "Your account is now active!" +msgstr "¡Tu cuenta ahora está activada!" + +#: wp-activate.php:73 +msgid "An error occurred during the activation" +msgstr "Ha habido un error en la activación" + +#: wp-activate.php:85 wp-signup.php:129 +msgid "Username:" +msgstr "Nombre de usuario:" \ No newline at end of file diff --git a/src/wp-content/plugins/akismet/admin.php b/src/wp-content/plugins/akismet/admin.php new file mode 100644 index 0000000..91cedb2 --- /dev/null +++ b/src/wp-content/plugins/akismet/admin.php @@ -0,0 +1,750 @@ +

    ".sprintf(__('Akismet %s requires WordPress 3.0 or higher.'), AKISMET_VERSION) ." ".sprintf(__('Please upgrade WordPress to a current version, or downgrade to version 2.4 of the Akismet plugin.'), 'http://codex.wordpress.org/Upgrading_WordPress', 'http://wordpress.org/extend/plugins/akismet/download/'). "

    + "; + } + add_action('admin_notices', 'akismet_version_warning'); + + return; + } + + if ( function_exists( 'get_plugin_page_hook' ) ) + $hook = get_plugin_page_hook( 'akismet-stats-display', 'index.php' ); + else + $hook = 'dashboard_page_akismet-stats-display'; + add_action('admin_head-'.$hook, 'akismet_stats_script'); + add_meta_box('akismet-status', __('Comment History'), 'akismet_comment_status_meta_box', 'comment', 'normal'); + wp_register_style('akismet.css', AKISMET_PLUGIN_URL . 'akismet.css'); + wp_enqueue_style('akismet.css'); + wp_register_script('akismet.js', AKISMET_PLUGIN_URL . 'akismet.js', array('jquery')); + wp_enqueue_script('akismet.js'); +} +add_action('admin_init', 'akismet_admin_init'); + +function akismet_nonce_field($action = -1) { return wp_nonce_field($action); } +$akismet_nonce = 'akismet-update-key'; + +function akismet_config_page() { + if ( function_exists('add_submenu_page') ) + add_submenu_page('plugins.php', __('Akismet Configuration'), __('Akismet Configuration'), 'manage_options', 'akismet-key-config', 'akismet_conf'); +} + +function akismet_plugin_action_links( $links, $file ) { + if ( $file == plugin_basename( dirname(__FILE__).'/akismet.php' ) ) { + $links[] = ''.__('Settings').''; + } + + return $links; +} + +add_filter( 'plugin_action_links', 'akismet_plugin_action_links', 10, 2 ); + +function akismet_conf() { + global $akismet_nonce, $wpcom_api_key; + + if ( isset($_POST['submit']) ) { + if ( function_exists('current_user_can') && !current_user_can('manage_options') ) + die(__('Cheatin’ uh?')); + + check_admin_referer( $akismet_nonce ); + $key = preg_replace( '/[^a-h0-9]/i', '', $_POST['key'] ); + $home_url = parse_url( get_bloginfo('url') ); + + if ( empty($key) ) { + $key_status = 'empty'; + $ms[] = 'new_key_empty'; + delete_option('wordpress_api_key'); + } elseif ( empty($home_url['host']) ) { + $key_status = 'empty'; + $ms[] = 'bad_home_url'; + } else { + $key_status = akismet_verify_key( $key ); + } + + if ( $key_status == 'valid' ) { + update_option('wordpress_api_key', $key); + $ms[] = 'new_key_valid'; + } else if ( $key_status == 'invalid' ) { + $ms[] = 'new_key_invalid'; + } else if ( $key_status == 'failed' ) { + $ms[] = 'new_key_failed'; + } + + if ( isset( $_POST['akismet_discard_month'] ) ) + update_option( 'akismet_discard_month', 'true' ); + else + update_option( 'akismet_discard_month', 'false' ); + + if ( isset( $_POST['akismet_show_user_comments_approved'] ) ) + update_option( 'akismet_show_user_comments_approved', 'true' ); + else + update_option( 'akismet_show_user_comments_approved', 'false' ); + + } elseif ( isset($_POST['check']) ) { + akismet_get_server_connectivity(0); + } + + if ( empty( $key_status) || $key_status != 'valid' ) { + $key = get_option('wordpress_api_key'); + if ( empty( $key ) ) { + if ( empty( $key_status ) || $key_status != 'failed' ) { + if ( akismet_verify_key( '1234567890ab' ) == 'failed' ) + $ms[] = 'no_connection'; + else + $ms[] = 'key_empty'; + } + $key_status = 'empty'; + } else { + $key_status = akismet_verify_key( $key ); + } + if ( $key_status == 'valid' ) { + $ms[] = 'key_valid'; + } else if ( $key_status == 'invalid' ) { + delete_option('wordpress_api_key'); + $ms[] = 'key_empty'; + } else if ( !empty($key) && $key_status == 'failed' ) { + $ms[] = 'key_failed'; + } + } + + $messages = array( + 'new_key_empty' => array('color' => 'aa0', 'text' => __('Your key has been cleared.')), + 'new_key_valid' => array('color' => '4AB915', 'text' => __('Your key has been verified. Happy blogging!')), + 'new_key_invalid' => array('color' => '888', 'text' => __('The key you entered is invalid. Please double-check it.')), + 'new_key_failed' => array('color' => '888', 'text' => __('The key you entered could not be verified because a connection to akismet.com could not be established. Please check your server configuration.')), + 'no_connection' => array('color' => '888', 'text' => __('There was a problem connecting to the Akismet server. Please check your server configuration.')), + 'key_empty' => array('color' => 'aa0', 'text' => sprintf(__('Please enter an API key. (Get your key.)'), 'http://akismet.com/get/')), + 'key_valid' => array('color' => '4AB915', 'text' => __('This key is valid.')), + 'key_failed' => array('color' => 'aa0', 'text' => __('The key below was previously validated but a connection to akismet.com can not be established at this time. Please check your server configuration.')), + 'bad_home_url' => array('color' => '888', 'text' => sprintf( __('Your WordPress home URL %s is invalid. Please fix the home option.'), esc_html( get_bloginfo('url') ), admin_url('options.php#home') ) ), + ); +?> + +

    + +
    +

    + +

    Sign up success! Please check your email for your Akismet API Key and enter it below.' ); ?>

    + +
    +
    + +

    Akismet will greatly reduce or even completely eliminate the comment and trackback spam you get on your site. If one does happen to get through, simply mark it as "spam" on the moderation screen and Akismet will learn from the mistakes. If you don\'t have an API key yet, you can get one at Akismet.com.'), 'http://akismet.com/', 'http://akismet.com/get/'); ?>

    + +

    + +

    + +

    (What is this?'); ?>)

    + +

    +

    + + + +

    +

    +

    +
    + +
    + +

    + +

    +

    fsockopen or gethostbynamel functions. Akismet cannot work correctly until this is fixed. Please contact your web host or firewall administrator and give them this information about Akismet\'s system requirements.'), 'http://blog.akismet.com/akismet-hosting-faq/'); ?>

    + 0 ) { + // some connections work, some fail + if ( $fail_count > 0 && $fail_count < count($servers) ) { ?> +

    +

    this information about Akismet and firewalls.'), 'http://blog.akismet.com/akismet-hosting-faq/'); ?>

    + 0 ) { ?> +

    +

    Akismet cannot work correctly until this is fixed. Please contact your web host or firewall administrator and give them this information about Akismet and firewalls.'), 'http://blog.akismet.com/akismet-hosting-faq/'); ?>

    + +

    +

    + +

    +

    Akismet cannot work correctly until this is fixed. Please contact your web host or firewall administrator and give them this information about Akismet and firewalls.'), 'http://blog.akismet.com/akismet-hosting-faq/'); ?>

    + + + + + $status ) { + $color = ( $status ? '#4AB915' : '#888'); + ?> + + + + + + +
    +

    +

    +

    Click here to confirm that Akismet.com is up.'), 'http://status.automattic.com/9931/136079/Akismet-API', 'http://status.automattic.com/9931/136079/Akismet-API' ); ?>

    +
    + +
    +
    + + +
    + +
    + ' . _x( 'Spam', 'comments' ) . ''; + global $submenu; + if ( isset( $submenu['edit-comments.php'] ) ) + $link = 'edit-comments.php'; + else + $link = 'edit.php'; + echo '

    '.sprintf( _n( 'Akismet has protected your site from %3$s spam comments.', 'Akismet has protected your site from %3$s spam comments.', $count ), 'http://akismet.com/', clean_url("$link?page=akismet-admin"), number_format_i18n($count) ).'

    '; +} +add_action('activity_box_end', 'akismet_stats'); + +function akismet_admin_warnings() { + global $wpcom_api_key; + if ( !get_option('wordpress_api_key') && !$wpcom_api_key && !isset($_POST['submit']) ) { + function akismet_warning() { + echo " +

    ".__('Akismet is almost ready.')." ".sprintf(__('You must enter your Akismet API key for it to work.'), "plugins.php?page=akismet-key-config")."

    + "; + } + add_action('admin_notices', 'akismet_warning'); + return; + } elseif ( ( empty($_SERVER['SCRIPT_FILENAME']) || basename($_SERVER['SCRIPT_FILENAME']) == 'edit-comments.php' ) && wp_next_scheduled('akismet_schedule_cron_recheck') ) { + function akismet_warning() { + global $wpdb; + $waiting = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->commentmeta WHERE meta_key = 'akismet_error'" ) ); + $next_check = human_time_diff( wp_next_scheduled('akismet_schedule_cron_recheck') ); + if ( $waiting > 0 ) + echo " +

    ".__('Akismet has detected a problem.')." ".sprintf(_n('A server or network problem prevented Akismet from checking %d comment. It has been temporarily held for moderation and will be automatically re-checked in %s.', 'A server or network problem prevented Akismet from checking %d comments. They have been temporarily held for moderation and will be automatically re-checked in %s.', $waiting), number_format_i18n( $waiting ), $next_check)."

    + "; + } + add_action('admin_notices', 'akismet_warning'); + return; + } +} + +// FIXME placeholder + +function akismet_comment_row_action( $a, $comment ) { + + // failsafe for old WP versions + if ( !function_exists('add_comment_meta') ) + return $a; + + $akismet_result = get_comment_meta( $comment->comment_ID, 'akismet_result', true ); + $user_result = get_comment_meta( $comment->comment_ID, 'akismet_user_result', true); + $comment_status = wp_get_comment_status( $comment->comment_ID ); + $desc = null; + if ( !$user_result || $user_result == $akismet_result ) { + // Show the original Akismet result if the user hasn't overridden it, or if their decision was the same + if ( $akismet_result == 'true' && $comment_status != 'spam' && $comment_status != 'trash' ) + $desc = __( 'Flagged as spam by Akismet' ); + elseif ( $akismet_result == 'false' && $comment_status == 'spam' ) + $desc = __( 'Cleared by Akismet' ); + } else { + $who = get_comment_meta( $comment->comment_ID, 'akismet_user', true ); + if ( $user_result == 'true' ) + $desc = sprintf( __('Flagged as spam by %s'), $who ); + else + $desc = sprintf( __('Un-spammed by %s'), $who ); + } + + // add a History item to the hover links, just after Edit + if ( $akismet_result ) { + $b = array(); + foreach ( $a as $k => $item ) { + $b[ $k ] = $item; + if ( $k == 'edit' ) + $b['history'] = ' '. __('History') . ''; + } + + $a = $b; + } + + if ( $desc ) + echo ''.htmlspecialchars($desc).''; + + if ( apply_filters( 'akismet_show_user_comments_approved', get_option('akismet_show_user_comments_approved') ) == 'true' ) { + $comment_count = akismet_get_user_comments_approved( $comment->user_id, $comment->comment_author_email, $comment->comment_author, $comment->comment_author_url ); + $comment_count = intval( $comment_count ); + echo ''; + } + + return $a; +} + +add_filter( 'comment_row_actions', 'akismet_comment_row_action', 10, 2 ); + +function akismet_comment_status_meta_box($comment) { + $history = akismet_get_comment_history( $comment->comment_ID ); + + if ( $history ) { + echo '
    '; + foreach ( $history as $row ) { + $time = date( 'D d M Y @ h:i:m a', $row['time'] ) . ' GMT'; + echo '
    ' . sprintf( __('%s ago'), human_time_diff( $row['time'] ) ) . ' - '; + echo htmlspecialchars( $row['message'] ) . '
    '; + } + + echo '
    '; + + } +} + + +// add an extra column header to the comments screen +function akismet_comments_columns( $columns ) { + $columns[ 'akismet' ] = __( 'Akismet' ); + return $columns; +} + +#add_filter( 'manage_edit-comments_columns', 'akismet_comments_columns' ); + +// Show stuff in the extra column +function akismet_comment_column_row( $column, $comment_id ) { + if ( $column != 'akismet' ) + return; + + $history = akismet_get_comment_history( $comment_id ); + + if ( $history ) { + echo '
    '; + foreach ( $history as $row ) { + echo '
    ' . sprintf( __('%s ago'), human_time_diff( $row['time'] ) ) . '
    '; + echo '
    ' . htmlspecialchars( $row['message'] ) . '
    '; + } + + echo '
    '; + } +} + +#add_action( 'manage_comments_custom_column', 'akismet_comment_column_row', 10, 2 ); + +// END FIXME + +// call out URLS in comments +function akismet_text_add_link_callback( $m ) { + + // bare link? + if ( $m[4] == $m[2] ) + return ''.$m[4].''; + else + return ''.$m[4].''; +} + +function akismet_text_add_link_class( $comment_text ) { + + return preg_replace_callback( '#]*)href="([^"]+)"([^>]*)>(.*?)#i', 'akismet_text_add_link_callback', $comment_text ); +} + +add_filter('comment_text', 'akismet_text_add_link_class'); + + +// WP 2.5+ +function akismet_rightnow() { + global $submenu, $wp_db_version; + + // clean_url was deprecated in WP 3.0 + $esc_url = 'clean_url'; + if ( function_exists( 'esc_url' ) ) + $esc_url = 'esc_url'; + + if ( 8645 < $wp_db_version ) // 2.7 + $link = 'edit-comments.php?comment_status=spam'; + elseif ( isset( $submenu['edit-comments.php'] ) ) + $link = 'edit-comments.php?page=akismet-admin'; + else + $link = 'edit.php?page=akismet-admin'; + + if ( $count = get_option('akismet_spam_count') ) { + $intro = sprintf( _n( + 'Akismet has protected your site from %2$s spam comment already. ', + 'Akismet has protected your site from %2$s spam comments already. ', + $count + ), 'http://akismet.com/', number_format_i18n( $count ) ); + } else { + $intro = sprintf( __('Akismet blocks spam from getting to your blog. '), 'http://akismet.com/' ); + } + + if ( $queue_count = akismet_spam_count() ) { + $queue_text = sprintf( _n( + 'There\'s %1$s comment in your spam queue right now.', + 'There are %1$s comments in your spam queue right now.', + $queue_count + ), number_format_i18n( $queue_count ), $esc_url($link) ); + } else { + $queue_text = sprintf( __( "There's nothing in your spam queue at the moment." ), $esc_url($link) ); + } + + $text = $intro . '
    ' . $queue_text; + echo "

    $text

    \n"; +} + +add_action('rightnow_end', 'akismet_rightnow'); + + +// For WP >= 2.5 +function akismet_check_for_spam_button($comment_status) { + if ( 'approved' == $comment_status ) + return; + if ( function_exists('plugins_url') ) + $link = 'admin.php?action=akismet_recheck_queue'; + else + $link = 'edit-comments.php?page=akismet-admin&recheckqueue=true&noheader=true'; + echo "
    " . __('Check for Spam') . ""; +} +add_action('manage_comments_nav', 'akismet_check_for_spam_button'); + +function akismet_submit_nonspam_comment ( $comment_id ) { + global $wpdb, $akismet_api_host, $akismet_api_port, $current_user, $current_site; + $comment_id = (int) $comment_id; + + $comment = $wpdb->get_row("SELECT * FROM $wpdb->comments WHERE comment_ID = '$comment_id'"); + if ( !$comment ) // it was deleted + return; + + // use the original version stored in comment_meta if available + $as_submitted = get_comment_meta( $comment_id, 'akismet_as_submitted', true); + if ( $as_submitted && is_array($as_submitted) && isset($as_submitted['comment_content']) ) { + $comment = (object) array_merge( (array)$comment, $as_submitted ); + } + + $comment->blog = get_bloginfo('url'); + $comment->blog_lang = get_locale(); + $comment->blog_charset = get_option('blog_charset'); + $comment->permalink = get_permalink($comment->comment_post_ID); + $comment->reporter_ip = $_SERVER['REMOTE_ADDR']; + if ( is_object($current_user) ) { + $comment->reporter = $current_user->user_login; + } + if ( is_object($current_site) ) { + $comment->site_domain = $current_site->domain; + } + + $comment->user_role = ''; + if ( isset( $comment->user_ID ) ) + $comment->user_role = akismet_get_user_roles($comment->user_ID); + + if ( akismet_test_mode() ) + $comment->is_test = 'true'; + + $query_string = ''; + foreach ( $comment as $key => $data ) + $query_string .= $key . '=' . urlencode( stripslashes($data) ) . '&'; + + $response = akismet_http_post($query_string, $akismet_api_host, "/1.1/submit-ham", $akismet_api_port); + if ( $comment->reporter ) { + akismet_update_comment_history( $comment_id, sprintf( __('%s reported this comment as not spam'), $comment->reporter ), 'report-ham' ); + update_comment_meta( $comment_id, 'akismet_user_result', 'false' ); + update_comment_meta( $comment_id, 'akismet_user', $comment->reporter ); + } + + do_action('akismet_submit_nonspam_comment', $comment_id, $response[1]); +} + +function akismet_submit_spam_comment ( $comment_id ) { + global $wpdb, $akismet_api_host, $akismet_api_port, $current_user, $current_site; + $comment_id = (int) $comment_id; + + $comment = $wpdb->get_row("SELECT * FROM $wpdb->comments WHERE comment_ID = '$comment_id'"); + if ( !$comment ) // it was deleted + return; + if ( 'spam' != $comment->comment_approved ) + return; + + // use the original version stored in comment_meta if available + $as_submitted = get_comment_meta( $comment_id, 'akismet_as_submitted', true); + if ( $as_submitted && is_array($as_submitted) && isset($as_submitted['comment_content']) ) { + $comment = (object) array_merge( (array)$comment, $as_submitted ); + } + + $comment->blog = get_bloginfo('url'); + $comment->blog_lang = get_locale(); + $comment->blog_charset = get_option('blog_charset'); + $comment->permalink = get_permalink($comment->comment_post_ID); + $comment->reporter_ip = $_SERVER['REMOTE_ADDR']; + if ( is_object($current_user) ) { + $comment->reporter = $current_user->user_login; + } + if ( is_object($current_site) ) { + $comment->site_domain = $current_site->domain; + } + + $comment->user_role = ''; + if ( isset( $comment->user_ID ) ) + $comment->user_role = akismet_get_user_roles($comment->user_ID); + + if ( akismet_test_mode() ) + $comment->is_test = 'true'; + + $query_string = ''; + foreach ( $comment as $key => $data ) + $query_string .= $key . '=' . urlencode( stripslashes($data) ) . '&'; + + $response = akismet_http_post($query_string, $akismet_api_host, "/1.1/submit-spam", $akismet_api_port); + if ( $comment->reporter ) { + akismet_update_comment_history( $comment_id, sprintf( __('%s reported this comment as spam'), $comment->reporter ), 'report-spam' ); + update_comment_meta( $comment_id, 'akismet_user_result', 'true' ); + update_comment_meta( $comment_id, 'akismet_user', $comment->reporter ); + } + do_action('akismet_submit_spam_comment', $comment_id, $response[1]); +} + +// For WP 2.7+ +function akismet_transition_comment_status( $new_status, $old_status, $comment ) { + if ( $new_status == $old_status ) + return; + + # we don't need to record a history item for deleted comments + if ( $new_status == 'delete' ) + return; + + if ( !is_admin() ) + return; + + if ( !current_user_can( 'edit_post', $comment->comment_post_ID ) && !current_user_can( 'moderate_comments' ) ) + return; + + if ( defined('WP_IMPORTING') && WP_IMPORTING == true ) + return; + + global $current_user; + $reporter = ''; + if ( is_object( $current_user ) ) + $reporter = $current_user->user_login; + + // Assumption alert: + // We want to submit comments to Akismet only when a moderator explicitly spams or approves it - not if the status + // is changed automatically by another plugin. Unfortunately WordPress doesn't provide an unambiguous way to + // determine why the transition_comment_status action was triggered. And there are several different ways by which + // to spam and unspam comments: bulk actions, ajax, links in moderation emails, the dashboard, and perhaps others. + // We'll assume that this is an explicit user action if POST or GET has an 'action' key. + if ( isset($_POST['action']) || isset($_GET['action']) ) { + if ( $new_status == 'spam' && ( $old_status == 'approved' || $old_status == 'unapproved' || !$old_status ) ) { + return akismet_submit_spam_comment( $comment->comment_ID ); + } elseif ( $old_status == 'spam' && ( $new_status == 'approved' || $new_status == 'unapproved' ) ) { + return akismet_submit_nonspam_comment( $comment->comment_ID ); + } + } + + if ( !get_comment_meta( $comment->comment_ID, 'akismet_rechecking' ) ) + akismet_update_comment_history( $comment->comment_ID, sprintf( __('%s changed the comment status to %s'), $reporter, $new_status ), 'status-' . $new_status ); +} + +add_action( 'transition_comment_status', 'akismet_transition_comment_status', 10, 3 ); + +// Total spam in queue +// get_option( 'akismet_spam_count' ) is the total caught ever +function akismet_spam_count( $type = false ) { + global $wpdb; + + if ( !$type ) { // total + $count = wp_cache_get( 'akismet_spam_count', 'widget' ); + if ( false === $count ) { + if ( function_exists('wp_count_comments') ) { + $count = wp_count_comments(); + $count = $count->spam; + } else { + $count = (int) $wpdb->get_var("SELECT COUNT(comment_ID) FROM $wpdb->comments WHERE comment_approved = 'spam'"); + } + wp_cache_set( 'akismet_spam_count', $count, 'widget', 3600 ); + } + return $count; + } elseif ( 'comments' == $type || 'comment' == $type ) { // comments + $type = ''; + } else { // pingback, trackback, ... + $type = $wpdb->escape( $type ); + } + + return (int) $wpdb->get_var("SELECT COUNT(comment_ID) FROM $wpdb->comments WHERE comment_approved = 'spam' AND comment_type='$type'"); +} + + +function akismet_recheck_queue() { + global $wpdb, $akismet_api_host, $akismet_api_port; + + if ( ! ( isset( $_GET['recheckqueue'] ) || ( isset( $_REQUEST['action'] ) && 'akismet_recheck_queue' == $_REQUEST['action'] ) ) ) + return; + + $moderation = $wpdb->get_results( "SELECT * FROM $wpdb->comments WHERE comment_approved = '0'", ARRAY_A ); + foreach ( (array) $moderation as $c ) { + $c['user_ip'] = $c['comment_author_IP']; + $c['user_agent'] = $c['comment_agent']; + $c['referrer'] = ''; + $c['blog'] = get_bloginfo('url'); + $c['blog_lang'] = get_locale(); + $c['blog_charset'] = get_option('blog_charset'); + $c['permalink'] = get_permalink($c['comment_post_ID']); + + $c['user_role'] = ''; + if ( isset( $c['user_ID'] ) ) + $c['user_role'] = akismet_get_user_roles($c['user_ID']); + + if ( akismet_test_mode() ) + $c['is_test'] = 'true'; + + $id = (int) $c['comment_ID']; + + $query_string = ''; + foreach ( $c as $key => $data ) + $query_string .= $key . '=' . urlencode( stripslashes($data) ) . '&'; + + $response = akismet_http_post($query_string, $akismet_api_host, '/1.1/comment-check', $akismet_api_port); + if ( 'true' == $response[1] ) { + wp_set_comment_status($c['comment_ID'], 'spam'); + update_comment_meta( $c['comment_ID'], 'akismet_result', 'true' ); + akismet_update_comment_history( $c['comment_ID'], __('Akismet re-checked and caught this comment as spam'), 'check-spam' ); + + } elseif ( 'false' == $response[1] ) { + update_comment_meta( $c['comment_ID'], 'akismet_result', 'false' ); + akismet_update_comment_history( $c['comment_ID'], __('Akismet re-checked and cleared this comment'), 'check-ham' ); + // abnormal result: error + } else { + update_comment_meta( $c['comment_ID'], 'akismet_result', 'error' ); + akismet_update_comment_history( $c['comment_ID'], sprintf( __('Akismet was unable to re-check this comment (response: %s)'), $response[1]), 'check-error' ); + } + + } + wp_redirect( $_SERVER['HTTP_REFERER'] ); + exit; +} + +add_action('admin_action_akismet_recheck_queue', 'akismet_recheck_queue'); + +// Check connectivity between the WordPress blog and Akismet's servers. +// Returns an associative array of server IP addresses, where the key is the IP address, and value is true (available) or false (unable to connect). +function akismet_check_server_connectivity() { + global $akismet_api_host, $akismet_api_port, $wpcom_api_key; + + $test_host = 'rest.akismet.com'; + + // Some web hosts may disable one or both functions + if ( !function_exists('fsockopen') || !function_exists('gethostbynamel') ) + return array(); + + $ips = gethostbynamel($test_host); + if ( !$ips || !is_array($ips) || !count($ips) ) + return array(); + + $servers = array(); + foreach ( $ips as $ip ) { + $response = akismet_verify_key( akismet_get_key(), $ip ); + // even if the key is invalid, at least we know we have connectivity + if ( $response == 'valid' || $response == 'invalid' ) + $servers[$ip] = true; + else + $servers[$ip] = false; + } + + return $servers; +} + +// Check the server connectivity and store the results in an option. +// Cached results will be used if not older than the specified timeout in seconds; use $cache_timeout = 0 to force an update. +// Returns the same associative array as akismet_check_server_connectivity() +function akismet_get_server_connectivity( $cache_timeout = 86400 ) { + $servers = get_option('akismet_available_servers'); + if ( (time() - get_option('akismet_connectivity_time') < $cache_timeout) && $servers !== false ) + return $servers; + + // There's a race condition here but the effect is harmless. + $servers = akismet_check_server_connectivity(); + update_option('akismet_available_servers', $servers); + update_option('akismet_connectivity_time', time()); + return $servers; +} + +// Returns true if server connectivity was OK at the last check, false if there was a problem that needs to be fixed. +function akismet_server_connectivity_ok() { + // skip the check on WPMU because the status page is hidden + global $wpcom_api_key; + if ( $wpcom_api_key ) + return true; + $servers = akismet_get_server_connectivity(); + return !( empty($servers) || !count($servers) || count( array_filter($servers) ) < count($servers) ); +} + diff --git a/src/wp-content/plugins/akismet/akismet.css b/src/wp-content/plugins/akismet/akismet.css new file mode 100644 index 0000000..6bc8458 --- /dev/null +++ b/src/wp-content/plugins/akismet/akismet.css @@ -0,0 +1,7 @@ +#submitted-on { position: relative; } +#the-comment-list .author .akismet-user-comment-count { display: inline; } +#dashboard_recent_comments .akismet-status { display: none; } /* never show the flagged by text on the dashboard */ +.akismet-status { float: right; } +.akismet-status a { color: #AAA; font-style: italic; } +span.comment-link a { text-decoration: underline; } +span.comment-link:after { content: " " attr(title) " "; color: #aaa; text-decoration: none; } diff --git a/src/wp-content/plugins/akismet/akismet.gif b/src/wp-content/plugins/akismet/akismet.gif new file mode 100644 index 0000000..0b93a89 Binary files /dev/null and b/src/wp-content/plugins/akismet/akismet.gif differ diff --git a/src/wp-content/plugins/akismet/akismet.js b/src/wp-content/plugins/akismet/akismet.js new file mode 100644 index 0000000..3908935 --- /dev/null +++ b/src/wp-content/plugins/akismet/akismet.js @@ -0,0 +1,10 @@ +jQuery(document).ready(function () { + jQuery('.akismet-status').each(function () { + var thisId = jQuery(this).attr('commentid'); + jQuery(this).prependTo('#comment-' + thisId + ' .column-comment div:first-child'); + }); + jQuery('.akismet-user-comment-count').each(function () { + var thisId = jQuery(this).attr('commentid'); + jQuery(this).insertAfter('#comment-' + thisId + ' .author strong:first').show(); + }); +}); diff --git a/src/wp-content/plugins/akismet/akismet.php b/src/wp-content/plugins/akismet/akismet.php new file mode 100644 index 0000000..f453745 --- /dev/null +++ b/src/wp-content/plugins/akismet/akismet.php @@ -0,0 +1,512 @@ +protect your blog from comment and trackback spam. It keeps your site protected from spam even while you sleep. To get started: 1) Click the "Activate" link to the left of this description, 2) Sign up for an Akismet API key, and 3) Go to your Akismet configuration page, and save your API key. +Version: 2.5.3 +Author: Automattic +Author URI: http://automattic.com/wordpress-plugins/ +License: GPLv2 or later +*/ + +/* +This program 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. + +This program 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 this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + +define('AKISMET_VERSION', '2.5.3'); +define('AKISMET_PLUGIN_URL', plugin_dir_url( __FILE__ )); + +/** If you hardcode a WP.com API key here, all key config screens will be hidden */ +if ( defined('WPCOM_API_KEY') ) + $wpcom_api_key = constant('WPCOM_API_KEY'); +else + $wpcom_api_key = ''; + +// Make sure we don't expose any info if called directly +if ( !function_exists( 'add_action' ) ) { + echo "Hi there! I'm just a plugin, not much I can do when called directly."; + exit; +} + +if ( isset($wp_db_version) && $wp_db_version <= 9872 ) + include_once dirname( __FILE__ ) . '/legacy.php'; + +include_once dirname( __FILE__ ) . '/widget.php'; + +if ( is_admin() ) + require_once dirname( __FILE__ ) . '/admin.php'; + +function akismet_init() { + global $wpcom_api_key, $akismet_api_host, $akismet_api_port; + + if ( $wpcom_api_key ) + $akismet_api_host = $wpcom_api_key . '.rest.akismet.com'; + else + $akismet_api_host = get_option('wordpress_api_key') . '.rest.akismet.com'; + + $akismet_api_port = 80; +} +add_action('init', 'akismet_init'); + +function akismet_get_key() { + global $wpcom_api_key; + if ( !empty($wpcom_api_key) ) + return $wpcom_api_key; + return get_option('wordpress_api_key'); +} + +function akismet_verify_key( $key, $ip = null ) { + global $akismet_api_host, $akismet_api_port, $wpcom_api_key; + $blog = urlencode( get_option('home') ); + if ( $wpcom_api_key ) + $key = $wpcom_api_key; + $response = akismet_http_post("key=$key&blog=$blog", 'rest.akismet.com', '/1.1/verify-key', $akismet_api_port, $ip); + if ( !is_array($response) || !isset($response[1]) || $response[1] != 'valid' && $response[1] != 'invalid' ) + return 'failed'; + return $response[1]; +} + +// if we're in debug or test modes, use a reduced service level so as not to polute training or stats data +function akismet_test_mode() { + if ( defined('AKISMET_TEST_MODE') && AKISMET_TEST_MODE ) + return true; + return false; +} + +// return a comma-separated list of role names for the given user +function akismet_get_user_roles($user_id ) { + $roles = false; + + if ( !class_exists('WP_User') ) + return false; + + if ( $user_id > 0 ) { + $comment_user = new WP_User($user_id); + if ( isset($comment_user->roles) ) + $roles = join(',', $comment_user->roles); + } + + if ( is_multisite() && is_super_admin( $user_id ) ) { + if ( empty( $roles ) ) { + $roles = 'super_admin'; + } else { + $comment_user->roles[] = 'super_admin'; + $roles = join( ',', $comment_user->roles ); + } + } + + return $roles; +} + +// Returns array with headers in $response[0] and body in $response[1] +function akismet_http_post($request, $host, $path, $port = 80, $ip=null) { + global $wp_version; + + $akismet_ua = "WordPress/{$wp_version} | "; + $akismet_ua .= 'Akismet/' . constant( 'AKISMET_VERSION' ); + + $content_length = strlen( $request ); + + $http_host = $host; + // use a specific IP if provided + // needed by akismet_check_server_connectivity() + if ( $ip && long2ip( ip2long( $ip ) ) ) { + $http_host = $ip; + } else { + $http_host = $host; + } + + // use the WP HTTP class if it is available + if ( function_exists( 'wp_remote_post' ) ) { + $http_args = array( + 'body' => $request, + 'headers' => array( + 'Content-Type' => 'application/x-www-form-urlencoded; ' . + 'charset=' . get_option( 'blog_charset' ), + 'Host' => $host, + 'User-Agent' => $akismet_ua + ), + 'httpversion' => '1.0', + 'timeout' => 15 + ); + $akismet_url = "http://{$http_host}{$path}"; + $response = wp_remote_post( $akismet_url, $http_args ); + if ( is_wp_error( $response ) ) + return ''; + + return array( $response['headers'], $response['body'] ); + } else { + $http_request = "POST $path HTTP/1.0\r\n"; + $http_request .= "Host: $host\r\n"; + $http_request .= 'Content-Type: application/x-www-form-urlencoded; charset=' . get_option('blog_charset') . "\r\n"; + $http_request .= "Content-Length: {$content_length}\r\n"; + $http_request .= "User-Agent: {$akismet_ua}\r\n"; + $http_request .= "\r\n"; + $http_request .= $request; + + $response = ''; + if( false != ( $fs = @fsockopen( $http_host, $port, $errno, $errstr, 10 ) ) ) { + fwrite( $fs, $http_request ); + + while ( !feof( $fs ) ) + $response .= fgets( $fs, 1160 ); // One TCP-IP packet + fclose( $fs ); + $response = explode( "\r\n\r\n", $response, 2 ); + } + return $response; + } +} + +// filter handler used to return a spam result to pre_comment_approved +function akismet_result_spam( $approved ) { + // bump the counter here instead of when the filter is added to reduce the possibility of overcounting + if ( $incr = apply_filters('akismet_spam_count_incr', 1) ) + update_option( 'akismet_spam_count', get_option('akismet_spam_count') + $incr ); + // this is a one-shot deal + remove_filter( 'pre_comment_approved', 'akismet_result_spam' ); + return 'spam'; +} + +function akismet_result_hold( $approved ) { + // once only + remove_filter( 'pre_comment_approved', 'akismet_result_hold' ); + return '0'; +} + +// how many approved comments does this author have? +function akismet_get_user_comments_approved( $user_id, $comment_author_email, $comment_author, $comment_author_url ) { + global $wpdb; + + if ( !empty($user_id) ) + return $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->comments WHERE user_id = %d AND comment_approved = 1", $user_id ) ); + + if ( !empty($comment_author_email) ) + return $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->comments WHERE comment_author_email = %s AND comment_author = %s AND comment_author_url = %s AND comment_approved = 1", $comment_author_email, $comment_author, $comment_author_url ) ); + + return 0; +} + +function akismet_microtime() { + $mtime = explode( ' ', microtime() ); + return $mtime[1] + $mtime[0]; +} + +// log an event for a given comment, storing it in comment_meta +function akismet_update_comment_history( $comment_id, $message, $event=null ) { + global $current_user; + + // failsafe for old WP versions + if ( !function_exists('add_comment_meta') ) + return false; + + $user = ''; + if ( is_object($current_user) && isset($current_user->user_login) ) + $user = $current_user->user_login; + + $event = array( + 'time' => akismet_microtime(), + 'message' => $message, + 'event' => $event, + 'user' => $user, + ); + + // $unique = false so as to allow multiple values per comment + $r = add_comment_meta( $comment_id, 'akismet_history', $event, false ); +} + +// get the full comment history for a given comment, as an array in reverse chronological order +function akismet_get_comment_history( $comment_id ) { + + // failsafe for old WP versions + if ( !function_exists('add_comment_meta') ) + return false; + + $history = get_comment_meta( $comment_id, 'akismet_history', false ); + usort( $history, 'akismet_cmp_time' ); + return $history; +} + +function akismet_cmp_time( $a, $b ) { + return $a['time'] > $b['time'] ? -1 : 1; +} + +// this fires on wp_insert_comment. we can't update comment_meta when akismet_auto_check_comment() runs +// because we don't know the comment ID at that point. +function akismet_auto_check_update_meta( $id, $comment ) { + global $akismet_last_comment; + + // failsafe for old WP versions + if ( !function_exists('add_comment_meta') ) + return false; + + // wp_insert_comment() might be called in other contexts, so make sure this is the same comment + // as was checked by akismet_auto_check_comment + if ( is_object($comment) && !empty($akismet_last_comment) && is_array($akismet_last_comment) ) { + if ( intval($akismet_last_comment['comment_post_ID']) == intval($comment->comment_post_ID) + && $akismet_last_comment['comment_author'] == $comment->comment_author + && $akismet_last_comment['comment_author_email'] == $comment->comment_author_email ) { + // normal result: true or false + if ( $akismet_last_comment['akismet_result'] == 'true' ) { + update_comment_meta( $comment->comment_ID, 'akismet_result', 'true' ); + akismet_update_comment_history( $comment->comment_ID, __('Akismet caught this comment as spam'), 'check-spam' ); + if ( $comment->comment_approved != 'spam' ) + akismet_update_comment_history( $comment->comment_ID, sprintf( __('Comment status was changed to %s'), $comment->comment_approved), 'status-changed'.$comment->comment_approved ); + } elseif ( $akismet_last_comment['akismet_result'] == 'false' ) { + update_comment_meta( $comment->comment_ID, 'akismet_result', 'false' ); + akismet_update_comment_history( $comment->comment_ID, __('Akismet cleared this comment'), 'check-ham' ); + if ( $comment->comment_approved == 'spam' ) { + if ( wp_blacklist_check($comment->comment_author, $comment->comment_author_email, $comment->comment_author_url, $comment->comment_content, $comment->comment_author_IP, $comment->comment_agent) ) + akismet_update_comment_history( $comment->comment_ID, __('Comment was caught by wp_blacklist_check'), 'wp-blacklisted' ); + else + akismet_update_comment_history( $comment->comment_ID, sprintf( __('Comment status was changed to %s'), $comment->comment_approved), 'status-changed-'.$comment->comment_approved ); + } + // abnormal result: error + } else { + update_comment_meta( $comment->comment_ID, 'akismet_error', time() ); + akismet_update_comment_history( $comment->comment_ID, sprintf( __('Akismet was unable to check this comment (response: %s), will automatically retry again later.'), $akismet_last_comment['akismet_result']), 'check-error' ); + } + + // record the complete original data as submitted for checking + if ( isset($akismet_last_comment['comment_as_submitted']) ) + update_comment_meta( $comment->comment_ID, 'akismet_as_submitted', $akismet_last_comment['comment_as_submitted'] ); + } + } +} + +add_action( 'wp_insert_comment', 'akismet_auto_check_update_meta', 10, 2 ); + + +function akismet_auto_check_comment( $commentdata ) { + global $akismet_api_host, $akismet_api_port, $akismet_last_comment; + + $comment = $commentdata; + $comment['user_ip'] = $_SERVER['REMOTE_ADDR']; + $comment['user_agent'] = $_SERVER['HTTP_USER_AGENT']; + $comment['referrer'] = $_SERVER['HTTP_REFERER']; + $comment['blog'] = get_option('home'); + $comment['blog_lang'] = get_locale(); + $comment['blog_charset'] = get_option('blog_charset'); + $comment['permalink'] = get_permalink($comment['comment_post_ID']); + + $comment['user_role'] = akismet_get_user_roles($comment['user_ID']); + + $akismet_nonce_option = apply_filters( 'akismet_comment_nonce', get_option( 'akismet_comment_nonce' ) ); + $comment['akismet_comment_nonce'] = 'inactive'; + if ( $akismet_nonce_option == 'true' || $akismet_nonce_option == '' ) { + $comment['akismet_comment_nonce'] = 'failed'; + if ( isset( $_POST['akismet_comment_nonce'] ) && wp_verify_nonce( $_POST['akismet_comment_nonce'], 'akismet_comment_nonce_' . $comment['comment_post_ID'] ) ) + $comment['akismet_comment_nonce'] = 'passed'; + + // comment reply in wp-admin + if ( isset( $_POST['_ajax_nonce-replyto-comment'] ) && check_ajax_referer( 'replyto-comment', '_ajax_nonce-replyto-comment' ) ) + $comment['akismet_comment_nonce'] = 'passed'; + + } + + if ( akismet_test_mode() ) + $comment['is_test'] = 'true'; + + foreach ($_POST as $key => $value ) { + if ( is_string($value) ) + $comment["POST_{$key}"] = $value; + } + + $ignore = array( 'HTTP_COOKIE', 'HTTP_COOKIE2', 'PHP_AUTH_PW' ); + + foreach ( $_SERVER as $key => $value ) { + if ( !in_array( $key, $ignore ) && is_string($value) ) + $comment["$key"] = $value; + else + $comment["$key"] = ''; + } + + $query_string = ''; + foreach ( $comment as $key => $data ) + $query_string .= $key . '=' . urlencode( stripslashes($data) ) . '&'; + + $commentdata['comment_as_submitted'] = $comment; + + $response = akismet_http_post($query_string, $akismet_api_host, '/1.1/comment-check', $akismet_api_port); + $commentdata['akismet_result'] = $response[1]; + if ( 'true' == $response[1] ) { + // akismet_spam_count will be incremented later by akismet_result_spam() + add_filter('pre_comment_approved', 'akismet_result_spam'); + + do_action( 'akismet_spam_caught' ); + + $post = get_post( $comment['comment_post_ID'] ); + $last_updated = strtotime( $post->post_modified_gmt ); + $diff = time() - $last_updated; + $diff = $diff / 86400; + + if ( $post->post_type == 'post' && $diff > 30 && get_option( 'akismet_discard_month' ) == 'true' && empty($comment['user_ID']) ) { + // akismet_result_spam() won't be called so bump the counter here + if ( $incr = apply_filters('akismet_spam_count_incr', 1) ) + update_option( 'akismet_spam_count', get_option('akismet_spam_count') + $incr ); + wp_redirect( $_SERVER['HTTP_REFERER'] ); + die(); + } + } + + // if the response is neither true nor false, hold the comment for moderation and schedule a recheck + if ( 'true' != $response[1] && 'false' != $response[1] ) { + add_filter('pre_comment_approved', 'akismet_result_hold'); + wp_schedule_single_event( time() + 1200, 'akismet_schedule_cron_recheck' ); + } + + if ( function_exists('wp_next_scheduled') && function_exists('wp_schedule_event') ) { + // WP 2.1+: delete old comments daily + if ( !wp_next_scheduled('akismet_scheduled_delete') ) + wp_schedule_event(time(), 'daily', 'akismet_scheduled_delete'); + } elseif ( (mt_rand(1, 10) == 3) ) { + // WP 2.0: run this one time in ten + akismet_delete_old(); + } + $akismet_last_comment = $commentdata; + return $commentdata; +} + +add_action('preprocess_comment', 'akismet_auto_check_comment', 1); + +function akismet_delete_old() { + global $wpdb; + $now_gmt = current_time('mysql', 1); + $comment_ids = $wpdb->get_col("SELECT comment_id FROM $wpdb->comments WHERE DATE_SUB('$now_gmt', INTERVAL 15 DAY) > comment_date_gmt AND comment_approved = 'spam'"); + if ( empty( $comment_ids ) ) + return; + + $comma_comment_ids = implode( ', ', array_map('intval', $comment_ids) ); + + do_action( 'delete_comment', $comment_ids ); + $wpdb->query("DELETE FROM $wpdb->comments WHERE comment_id IN ( $comma_comment_ids )"); + $wpdb->query("DELETE FROM $wpdb->commentmeta WHERE comment_id IN ( $comma_comment_ids )"); + clean_comment_cache( $comment_ids ); + $n = mt_rand(1, 5000); + if ( apply_filters('akismet_optimize_table', ($n == 11)) ) // lucky number + $wpdb->query("OPTIMIZE TABLE $wpdb->comments"); + +} + +add_action('akismet_scheduled_delete', 'akismet_delete_old'); + +function akismet_check_db_comment( $id, $recheck_reason = 'recheck_queue' ) { + global $wpdb, $akismet_api_host, $akismet_api_port; + + $id = (int) $id; + $c = $wpdb->get_row( "SELECT * FROM $wpdb->comments WHERE comment_ID = '$id'", ARRAY_A ); + if ( !$c ) + return; + + $c['user_ip'] = $c['comment_author_IP']; + $c['user_agent'] = $c['comment_agent']; + $c['referrer'] = ''; + $c['blog'] = get_option('home'); + $c['blog_lang'] = get_locale(); + $c['blog_charset'] = get_option('blog_charset'); + $c['permalink'] = get_permalink($c['comment_post_ID']); + $id = $c['comment_ID']; + if ( akismet_test_mode() ) + $c['is_test'] = 'true'; + $c['recheck_reason'] = $recheck_reason; + + $query_string = ''; + foreach ( $c as $key => $data ) + $query_string .= $key . '=' . urlencode( stripslashes($data) ) . '&'; + + $response = akismet_http_post($query_string, $akismet_api_host, '/1.1/comment-check', $akismet_api_port); + return $response[1]; +} + +function akismet_cron_recheck() { + global $wpdb; + + delete_option('akismet_available_servers'); + + $comment_errors = $wpdb->get_col( " + SELECT comment_id + FROM {$wpdb->prefix}commentmeta + WHERE meta_key = 'akismet_error' + LIMIT 100 + " ); + + foreach ( (array) $comment_errors as $comment_id ) { + // if the comment no longer exists, remove the meta entry from the queue to avoid getting stuck + if ( !get_comment( $comment_id ) ) { + delete_comment_meta( $comment_id, 'akismet_error' ); + continue; + } + + add_comment_meta( $comment_id, 'akismet_rechecking', true ); + $status = akismet_check_db_comment( $comment_id, 'retry' ); + + $msg = ''; + if ( $status == 'true' ) { + $msg = __( 'Akismet caught this comment as spam during an automatic retry.' ); + } elseif ( $status == 'false' ) { + $msg = __( 'Akismet cleared this comment during an automatic retry.' ); + } + + // If we got back a legit response then update the comment history + // other wise just bail now and try again later. No point in + // re-trying all the comments once we hit one failure. + if ( !empty( $msg ) ) { + delete_comment_meta( $comment_id, 'akismet_error' ); + akismet_update_comment_history( $comment_id, $msg, 'cron-retry' ); + update_comment_meta( $comment_id, 'akismet_result', $status ); + // make sure the comment status is still pending. if it isn't, that means the user has already moved it elsewhere. + $comment = get_comment( $comment_id ); + if ( $comment && 'unapproved' == wp_get_comment_status( $comment_id ) ) { + if ( $status == 'true' ) { + wp_spam_comment( $comment_id ); + } elseif ( $status == 'false' ) { + // comment is good, but it's still in the pending queue. depending on the moderation settings + // we may need to change it to approved. + if ( check_comment($comment->comment_author, $comment->comment_author_email, $comment->comment_author_url, $comment->comment_content, $comment->comment_author_IP, $comment->comment_agent, $comment->comment_type) ) + wp_set_comment_status( $comment_id, 1 ); + } + } + } else { + delete_comment_meta( $comment_id, 'akismet_rechecking' ); + wp_schedule_single_event( time() + 1200, 'akismet_schedule_cron_recheck' ); + return; + } + } + + $remaining = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->commentmeta WHERE meta_key = 'akismet_error'" ) ); + if ( $remaining && !wp_next_scheduled('akismet_schedule_cron_recheck') ) { + wp_schedule_single_event( time() + 1200, 'akismet_schedule_cron_recheck' ); + } +} +add_action( 'akismet_schedule_cron_recheck', 'akismet_cron_recheck' ); + +function akismet_add_comment_nonce( $post_id ) { + echo '

    '; + wp_nonce_field( 'akismet_comment_nonce_' . $post_id, 'akismet_comment_nonce', FALSE ); + echo '

    '; +} + +$akismet_comment_nonce_option = apply_filters( 'akismet_comment_nonce', get_option( 'akismet_comment_nonce' ) ); + +if ( $akismet_comment_nonce_option == 'true' || $akismet_comment_nonce_option == '' ) + add_action( 'comment_form', 'akismet_add_comment_nonce' ); + +if ( '3.0.5' == $wp_version ) { + remove_filter( 'comment_text', 'wp_kses_data' ); + if ( is_admin() ) + add_filter( 'comment_text', 'wp_kses_post' ); +} diff --git a/src/wp-content/plugins/akismet/legacy.php b/src/wp-content/plugins/akismet/legacy.php new file mode 100644 index 0000000..d5d53b0 --- /dev/null +++ b/src/wp-content/plugins/akismet/legacy.php @@ -0,0 +1,396 @@ +escape( $type ); + return $wpdb->get_results( "SELECT * FROM $wpdb->comments WHERE comment_approved = 'spam' AND comment_type='$type' ORDER BY comment_date DESC LIMIT $start, $end"); + } + + // All + return $wpdb->get_results( "SELECT * FROM $wpdb->comments WHERE comment_approved = 'spam' ORDER BY comment_date DESC LIMIT $start, $end"); +} + +// Totals for each comment type +// returns array( type => count, ... ) +function akismet_spam_totals() { + global $wpdb; + $totals = $wpdb->get_results( "SELECT comment_type, COUNT(*) AS cc FROM $wpdb->comments WHERE comment_approved = 'spam' GROUP BY comment_type" ); + $return = array(); + foreach ( $totals as $total ) + $return[$total->comment_type ? $total->comment_type : 'comment'] = $total->cc; + return $return; +} + +function akismet_manage_page() { + global $wpdb, $submenu, $wp_db_version; + + // WP 2.7 has its own spam management page + if ( 8645 <= $wp_db_version ) + return; + + $count = sprintf(__('Akismet Spam (%s)'), akismet_spam_count()); + if ( isset( $submenu['edit-comments.php'] ) ) + add_submenu_page('edit-comments.php', __('Akismet Spam'), $count, 'moderate_comments', 'akismet-admin', 'akismet_caught' ); + elseif ( function_exists('add_management_page') ) + add_management_page(__('Akismet Spam'), $count, 'moderate_comments', 'akismet-admin', 'akismet_caught'); +} + +function akismet_caught() { + global $wpdb, $comment, $akismet_caught, $akismet_nonce; + + akismet_recheck_queue(); + if (isset($_POST['submit']) && 'recover' == $_POST['action'] && ! empty($_POST['not_spam'])) { + check_admin_referer( $akismet_nonce ); + if ( function_exists('current_user_can') && !current_user_can('moderate_comments') ) + die(__('You do not have sufficient permission to moderate comments.')); + + $i = 0; + foreach ($_POST['not_spam'] as $comment): + $comment = (int) $comment; + if ( function_exists('wp_set_comment_status') ) + wp_set_comment_status($comment, 'approve'); + else + $wpdb->query("UPDATE $wpdb->comments SET comment_approved = '1' WHERE comment_ID = '$comment'"); + akismet_submit_nonspam_comment($comment); + ++$i; + endforeach; + $to = add_query_arg( 'recovered', $i, $_SERVER['HTTP_REFERER'] ); + wp_redirect( $to ); + exit; + } + if ('delete' == $_POST['action']) { + check_admin_referer( $akismet_nonce ); + if ( function_exists('current_user_can') && !current_user_can('moderate_comments') ) + die(__('You do not have sufficient permission to moderate comments.')); + + $delete_time = $wpdb->escape( $_POST['display_time'] ); + $comment_ids = $wpdb->get_col( "SELECT comment_id FROM $wpdb->comments WHERE comment_approved = 'spam' AND '$delete_time' > comment_date_gmt" ); + if ( !empty( $comment_ids ) ) { + do_action( 'delete_comment', $comment_ids ); + $wpdb->query( "DELETE FROM $wpdb->comments WHERE comment_id IN ( " . implode( ', ', $comment_ids ) . " )"); + wp_cache_delete( 'akismet_spam_count', 'widget' ); + } + $to = add_query_arg( 'deleted', 'all', $_SERVER['HTTP_REFERER'] ); + wp_redirect( $to ); + exit; + } + +if ( isset( $_GET['recovered'] ) ) { + $i = (int) $_GET['recovered']; + echo '

    ' . sprintf(__('%1$s comments recovered.'), $i) . "

    "; +} + +if (isset( $_GET['deleted'] ) ) + echo '

    ' . __('All spam deleted.') . '

    '; + +if ( isset( $GLOBALS['submenu']['edit-comments.php'] ) ) + $link = 'edit-comments.php'; +else + $link = 'edit.php'; +?> + +
    +

    + +

    %1$s spam for you since you first installed it.'), number_format_i18n($count) ); ?>

    +'.__('You have no spam currently in the queue. Must be your lucky day. :)').'

    '; + echo '
    '; +} else { + echo '

    '.__('You can delete all of the spam from your database with a single click. This operation cannot be undone, so you may wish to check to ensure that no legitimate comments got through first. Spam is automatically deleted after 15 days, so don’t sweat it.').'

    '; +?> + +
    + + +    + +
    + +
    +
    + +

    + +'.__('These are the latest comments identified as spam by Akismet. If you see any mistakes, simply mark the comment as "not spam" and Akismet will learn from the submission. If you wish to recover a comment from spam, simply select the comment, and click Not Spam. After 15 days we clean out the junk for you.').'

    '; ?> + +escape($_POST['s']); + $comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE + (comment_author LIKE '%$s%' OR + comment_author_email LIKE '%$s%' OR + comment_author_url LIKE ('%$s%') OR + comment_author_IP LIKE ('%$s%') OR + comment_content LIKE ('%$s%') ) AND + comment_approved = 'spam' + ORDER BY comment_date DESC"); +} else { + if ( isset( $_GET['apage'] ) ) + $page = (int) $_GET['apage']; + else + $page = 1; + + if ( $page < 2 ) + $page = 1; + + $current_type = false; + if ( isset( $_GET['ctype'] ) ) + $current_type = preg_replace( '|[^a-z]|', '', $_GET['ctype'] ); + + $comments = akismet_spam_comments( $current_type, $page ); + $total = akismet_spam_count( $current_type ); + $totals = akismet_spam_totals(); +?> +
      +
    • >
    • + $type_count ) { + if ( 'comment' == $type ) { + $type = 'comments'; + $show = __('Comments'); + } else { + $show = ucwords( $type ); + } + $type_count = number_format_i18n( $type_count ); + $extra = $current_type === $type ? ' class="active"' : ''; + echo "
    • $show ($type_count)
    • "; +} +do_action( 'akismet_tabs' ); // so plugins can add more tabs easily +?> +
    + +
    " id="akismetsearch"> +

    +

    +
    + 50 ) { +$total_pages = ceil( $total / 50 ); +$r = ''; +if ( 1 < $page ) { + $args['apage'] = ( 1 == $page - 1 ) ? '' : $page - 1; + $r .= '' . "\n"; +} +if ( ( $total_pages = ceil( $total / 50 ) ) > 1 ) { + for ( $page_num = 1; $page_num <= $total_pages; $page_num++ ) : + if ( $page == $page_num ) : + $r .= "$page_num\n"; + else : + $p = false; + if ( $page_num < 3 || ( $page_num >= $page - 3 && $page_num <= $page + 3 ) || $page_num > $total_pages - 3 ) : + $args['apage'] = ( 1 == $page_num ) ? '' : $page_num; + $r .= '' . ( $page_num ) . "\n"; + $in = true; + elseif ( $in == true ) : + $r .= "...\n"; + $in = false; + endif; + endif; + endfor; +} +if ( ( $page ) * 50 < $total || -1 == $total ) { + $args['apage'] = $page + 1; + $r .= '' . "\n"; +} +echo "

    $r

    "; +?> + + +
    + + +
      +comment_date); + $post = get_post($comment->comment_post_ID); + $post_title = $post->post_title; + if ($i % 2) $class = 'class="alternate"'; + else $class = ''; + echo "\n\t
    • "; + ?> + +

      comment_author_email) { ?>| comment_author_url && 'http://' != $comment->comment_author_url) { ?> | |

      + + + +

      — [ +comment_post_ID); +$post_title = wp_specialchars( $post->post_title, 'double' ); +$post_title = ('' == $post_title) ? "# $comment->comment_post_ID" : $post_title; +?> + ]

      + + + +
    + 50 ) { +$total_pages = ceil( $total / 50 ); +$r = ''; +if ( 1 < $page ) { + $args['apage'] = ( 1 == $page - 1 ) ? '' : $page - 1; + $r .= '' . "\n"; +} +if ( ( $total_pages = ceil( $total / 50 ) ) > 1 ) { + for ( $page_num = 1; $page_num <= $total_pages; $page_num++ ) : + if ( $page == $page_num ) : + $r .= "$page_num\n"; + else : + $p = false; + if ( $page_num < 3 || ( $page_num >= $page - 3 && $page_num <= $page + 3 ) || $page_num > $total_pages - 3 ) : + $args['apage'] = ( 1 == $page_num ) ? '' : $page_num; + $r .= '' . ( $page_num ) . "\n"; + $in = true; + elseif ( $in == true ) : + $r .= "...\n"; + $in = false; + endif; + endif; + endfor; +} +if ( ( $page ) * 50 < $total || -1 == $total ) { + $args['apage'] = $page + 1; + $r .= '' . "\n"; +} +echo "

    $r

    "; +} +?> +

    + +

    +

    +
    + +

    + + + +
    + +

    +    +

    +
    + +
    +" . __('Recheck Queue for Spam') . ""; + $page = str_replace( '
    ', '
    ' . $button, $page ); + return $page; + } + + if ( $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->comments WHERE comment_approved = '0'" ) ) + ob_start( 'akismet_recheck_button' ); +} + +// This option causes tons of FPs, was removed in 2.1 +function akismet_kill_proxy_check( $option ) { return 0; } +add_filter('option_open_proxy_check', 'akismet_kill_proxy_check'); diff --git a/src/wp-content/plugins/akismet/readme.txt b/src/wp-content/plugins/akismet/readme.txt new file mode 100644 index 0000000..fbd3513 --- /dev/null +++ b/src/wp-content/plugins/akismet/readme.txt @@ -0,0 +1,130 @@ +=== Akismet === +Contributors: matt, ryan, andy, mdawaffe, tellyworth, josephscott, lessbloat, automattic +Tags: akismet, comments, spam +Requires at least: 3.0 +Tested up to: 3.1 +Stable tag: 2.5.3 +License: GPLv2 or later + +Akismet checks your comments against the Akismet web service to see if they look like spam or not. + +== Description == + +Akismet checks your comments against the Akismet web service to see if they look like spam or not and lets you +review the spam it catches under your blog's "Comments" admin screen. + +Major new features in Akismet 2.5 include: + +* A comment status history, so you can easily see which comments were caught or cleared by Akismet, and which were spammed or unspammed by a moderator +* Links are highlighted in the comment body, to reveal hidden or misleading links +* If your web host is unable to reach Akismet's servers, the plugin will automatically retry when your connection is back up +* Moderators can see the number of approved comments for each user +* Spam and Unspam reports now include more information, to help improve accuracy + +PS: You'll need an [Akismet.com API key](http://akismet.com/get/) to use it. Keys are free for personal blogs, with paid subscriptions available for businesses and commercial sites. + +== Installation == + +Upload the Akismet plugin to your blog, Activate it, then enter your [Akismet.com API key](http://akismet.com/get/). + +1, 2, 3: You're done! + +== Changelog == + += 2.5.3 = +* Specify the license is GPL v2 or later +* Fix a bug that could result in orphaned commentmeta entries +* Include hotfix for WordPress 3.0.5 filter issue + += 2.5.2 = + +* Properly format the comment count for author counts +* Look for super admins on multisite installs when looking up user roles +* Increase the HTTP request timeout +* Removed padding for author approved count +* Fix typo in function name +* Set Akismet stats iframe height to fixed 2500px. Better to have one tall scroll bar than two side by side. + += 2.5.1 = + +* Fix a bug that caused the "Auto delete" option to fail to discard comments correctly +* Remove the comment nonce form field from the 'Akismet Configuration' page in favor of using a filter, akismet_comment_nonce +* Fixed padding bug in "author" column of posts screen +* Added margin-top to "cleared by ..." badges on dashboard +* Fix possible error when calling akismet_cron_recheck() +* Fix more PHP warnings +* Clean up XHTML warnings for comment nonce +* Fix for possible condition where scheduled comment re-checks could get stuck +* Clean up the comment meta details after deleting a comment +* Only show the status badge if the comment status has been changed by someone/something other than Akismet +* Show a 'History' link in the row-actions +* Translation fixes +* Reduced font-size on author name +* Moved "flagged by..." notification to top right corner of comment container and removed heavy styling +* Hid "flagged by..." notification while on dashboard + += 2.5.0 = + +* Track comment actions under 'Akismet Status' on the edit comment screen +* Fix a few remaining deprecated function calls ( props Mike Glendinning ) +* Use HTTPS for the stats IFRAME when wp-admin is using HTTPS +* Use the WordPress HTTP class if available +* Move the admin UI code to a separate file, only loaded when needed +* Add cron retry feature, to replace the old connectivity check +* Display Akismet status badge beside each comment +* Record history for each comment, and display it on the edit page +* Record the complete comment as originally submitted in comment_meta, to use when reporting spam and ham +* Highlight links in comment content +* New option, "Show the number of comments you've approved beside each comment author." +* New option, "Use a nonce on the comment form." + += 2.4.0 = + +* Spell out that the license is GPLv2 +* Fix PHP warnings +* Fix WordPress deprecated function calls +* Fire the delete_comment action when deleting comments +* Move code specific for older WP versions to legacy.php +* General code clean up + += 2.3.0 = + +* Fix "Are you sure" nonce message on config screen in WPMU +* Fix XHTML compliance issue in sidebar widget +* Change author link; remove some old references to WordPress.com accounts +* Localize the widget title (core ticket #13879) + += 2.2.9 = + +* Eliminate a potential conflict with some plugins that may cause spurious reports + += 2.2.8 = + +* Fix bug in initial comment check for ipv6 addresses +* Report comments as ham when they are moved from spam to moderation +* Report comments as ham when clicking undo after spam +* Use transition_comment_status action when available instead of older actions for spam/ham submissions +* Better diagnostic messages when PHP network functions are unavailable +* Better handling of comments by logged-in users + += 2.2.7 = + +* Add a new AKISMET_VERSION constant +* Reduce the possibility of over-counting spam when another spam filter plugin is in use +* Disable the connectivity check when the API key is hard-coded for WPMU + += 2.2.6 = + +* Fix a global warning introduced in 2.2.5 +* Add changelog and additional readme.txt tags +* Fix an array conversion warning in some versions of PHP +* Support a new WPCOM_API_KEY constant for easier use with WordPress MU + += 2.2.5 = + +* Include a new Server Connectivity diagnostic check, to detect problems caused by firewalls + += 2.2.4 = + +* Fixed a key problem affecting the stats feature in WordPress MU +* Provide additional blog information in Akismet API calls diff --git a/src/wp-content/plugins/akismet/widget.php b/src/wp-content/plugins/akismet/widget.php new file mode 100644 index 0000000..e9a3f62 --- /dev/null +++ b/src/wp-content/plugins/akismet/widget.php @@ -0,0 +1,90 @@ + + + + + + + + +

    + + + +
    ', '', $count ), number_format_i18n( $count ) ); +} diff --git a/src/wp-content/plugins/hello.php b/src/wp-content/plugins/hello.php new file mode 100644 index 0000000..d2287e2 --- /dev/null +++ b/src/wp-content/plugins/hello.php @@ -0,0 +1,82 @@ +Hello, Dolly in the upper right of your admin screen on every page. +Author: Matt Mullenweg +Version: 1.6 +Author URI: http://ma.tt/ +*/ + +function hello_dolly_get_lyric() { + /** These are the lyrics to Hello Dolly */ + $lyrics = "Hello, Dolly +Well, hello, Dolly +It's so nice to have you back where you belong +You're lookin' swell, Dolly +I can tell, Dolly +You're still glowin', you're still crowin' +You're still goin' strong +We feel the room swayin' +While the band's playin' +One of your old favourite songs from way back when +So, take her wrap, fellas +Find her an empty lap, fellas +Dolly'll never go away again +Hello, Dolly +Well, hello, Dolly +It's so nice to have you back where you belong +You're lookin' swell, Dolly +I can tell, Dolly +You're still glowin', you're still crowin' +You're still goin' strong +We feel the room swayin' +While the band's playin' +One of your old favourite songs from way back when +Golly, gee, fellas +Find her a vacant knee, fellas +Dolly'll never go away +Dolly'll never go away +Dolly'll never go away again"; + + // Here we split it into lines + $lyrics = explode( "\n", $lyrics ); + + // And then randomly choose a line + return wptexturize( $lyrics[ mt_rand( 0, count( $lyrics ) - 1 ) ] ); +} + +// This just echoes the chosen line, we'll position it later +function hello_dolly() { + $chosen = hello_dolly_get_lyric(); + echo "

    $chosen

    "; +} + +// Now we set that function up to execute when the admin_notices action is called +add_action( 'admin_notices', 'hello_dolly' ); + +// We need some CSS to position the paragraph +function dolly_css() { + // This makes sure that the positioning is also good for right-to-left languages + $x = is_rtl() ? 'left' : 'right'; + + echo " + + "; +} + +add_action( 'admin_head', 'dolly_css' ); + +?> diff --git a/src/wp-content/plugins/index.php b/src/wp-content/plugins/index.php new file mode 100644 index 0000000..4e6c07c --- /dev/null +++ b/src/wp-content/plugins/index.php @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/src/wp-content/themes/Broadside/404.php b/src/wp-content/themes/Broadside/404.php new file mode 100644 index 0000000..be7339d --- /dev/null +++ b/src/wp-content/themes/Broadside/404.php @@ -0,0 +1,5 @@ + +
    +

    +
    + \ No newline at end of file diff --git a/src/wp-content/themes/Broadside/admin/css/admin-style.css b/src/wp-content/themes/Broadside/admin/css/admin-style.css new file mode 100644 index 0000000..7304476 --- /dev/null +++ b/src/wp-content/themes/Broadside/admin/css/admin-style.css @@ -0,0 +1,220 @@ +/*-------------------------------------------------------------------------------------------*/ +/* OptionsFramework Admin Styles */ +/*-------------------------------------------------------------------------------------------*/ + +.updated { + max-width:764px; + margin-bottom:0px !important; +} +#optionsframework { + position:relative; + z-index: 0; + max-width:780px; + background:#fff; +} +#optionsframework p { + margin-bottom:0; + padding-bottom:10px; +} +#optionsframework .section { + padding:10px 10px 0; +} +#optionsframework .group .section:last-of-type { + padding-bottom:40px; +} +#optionsframework .section .heading { + padding:10px 0px; + margin:0 0 15px; + border-bottom: 1px solid #dfdfdf; +} +#optionsframework .section .controls { + float: left; + min-width:350px; + width: 54%; + padding-right:2%; +} +#optionsframework .section .explain { + max-width:38%; + float: left; + font-size: 12px; + line-height:16px; + color: #777; +} +#optionsframework .section-checkbox .controls { + min-width:25px; + width:25px +} +#optionsframework .section-checkbox .explain { + max-width:93%; +} +#optionsframework .section-color .controls { + min-width:125px; + width:125px +} +#optionsframework .controls input, #optionsframework .controls select, #optionsframework .controls textarea { + margin-bottom: 10px; + width:100%; +} +#optionsframework .section-radio label, #optionsframework .section-multicheck label { + float:left; +} +#optionsframework input.checkbox, #optionsframework input.of-radio { + width: 30px; + float:left; + clear:both; +} +#optionsframework .controls .of-color { + float:left; + width: 80px; + margin-left:5px; + margin-right:5px; +} +#optionsframework .controls .of-typography-size { + width:80px; + margin-left:5px; + float:left +} +#optionsframework .controls .of-typography-unit { + width:50px; + margin-left:5px; + float:left +} +#optionsframework .controls .of-typography-face { + width:100px; + margin-left:5px; + float:left +} +#optionsframework .controls .of-typography-style { + width:80px; + margin-left:5px; + margin-right:5px; + float:left +} +#optionsframework .of-background-properties { + clear:both; + margin-top: 18px; +} +#optionsframework .controls .of-background-repeat { + width:125px; + margin-right:5px; + float:left +} +#optionsframework .controls .of-background-position { + width:125px; + margin-right:5px; + float:left +} +#optionsframework .controls .of-background-attachment { + width:125px; + margin-right:5px; + float:left +} +#optionsframework div.section-background .controls input.upload { + width:47%; +} +#optionsframework .controls .of-radio-img-img { + border:3px solid #f9f9f9; + margin:0 5px 10px 0; + display:none; + cursor:pointer; + float:left; +} +#optionsframework .controls .of-radio-img-selected { + border:3px solid #ccc +} +#optionsframework .controls .of-radio-img-img:hover { + opacity:.8; +} +#optionsframework .controls .of-border-width { + width:80px; + float:left +} +#optionsframework .controls .of-border-style { + width:120px; + float:left +} +#optionsframework .hide { + display:none; +} +#optionsframework .of-option-image { + max-width:340px; + margin:3px 0 18px 0; +} +#optionsframework .mini .controls select, #optionsframework .section .mini .controls { + width: 140px; +} +#optionsframework .mini .controls input, #optionsframework .mini .controls { + min-width:140px; + width: 140px; +} +#optionsframework .mini .explain { + max-width:74%; +} +/* Image Uploader */ + +#optionsframework .controls input.upload { + width:80%; +} +#optionsframework .controls input.upload_button { + float:right; + width:45px; + border-color:#BBBBBB; + cursor:pointer; + height:16px; +} +#optionsframework .controls input.upload_button:hover { + border-color:#666666; + color:#000; +} +#optionsframework .screenshot { + float:left; + margin-left:1px; + position:relative; + width:344px; + margin-top:3px; +} +#optionsframework .screenshot img { + background:#FAFAFA; + border-color:#ccc #eee #eee #ccc; + border-style:solid; + border-width:1px; + float:left; + max-width:334px; + padding:4px; + margin-bottom:10px; +} +#optionsframework .screenshot .mlu_remove { + background:url("../images/ico-delete.png") no-repeat; + border:medium none; + bottom:4px; + display:block; + float:left; + height:16px; + padding:0; + position:absolute; + left:-4px; + text-indent:-9999px; + width:16px; +} +#optionsframework .screenshot .no_image .file_link { + margin-left: 20px; +} +#optionsframework .screenshot .no_image .mlu_remove { + bottom: 0px; +} +#optionsframework .reset-button { + float:left; + cursor:pointer; +} + +/* Bottom Section */ + +#optionsframework-submit { + padding: 7px 10px; + border-top: 1px solid #ECECEC; + background-color: #F1F1F1; + background-image: -moz-linear-gradient(center top , #F9F9F9, #ECECEC); +} +#optionsframework .button-primary { + float:right; +} \ No newline at end of file diff --git a/src/wp-content/themes/Broadside/admin/css/colorpicker.css b/src/wp-content/themes/Broadside/admin/css/colorpicker.css new file mode 100644 index 0000000..8f66acc --- /dev/null +++ b/src/wp-content/themes/Broadside/admin/css/colorpicker.css @@ -0,0 +1,177 @@ +.colorpicker { + width: 356px; + height: 176px; + overflow: hidden; + position: absolute; + background: url(../images/colorpicker/colorpicker_background.png); + font-family: Arial, Helvetica, sans-serif; + display: none; +} +.colorpicker_color { + width: 150px; + height: 150px; + left: 14px; + top: 13px; + position: absolute; + background: #f00; + overflow: hidden; + cursor: crosshair; +} +.colorpicker_color div { + position: absolute; + top: 0; + left: 0; + width: 150px; + height: 150px; + background: url(../images/colorpicker/colorpicker_overlay.png); +} +.colorpicker_color div div { + position: absolute; + top: 0; + left: 0; + width: 11px; + height: 11px; + overflow: hidden; + background: url(../images/colorpicker/colorpicker_select.gif); + margin: -5px 0 0 -5px; +} +.colorpicker_hue { + position: absolute; + top: 13px; + left: 171px; + width: 35px; + height: 150px; + cursor: n-resize; +} +.colorpicker_hue div { + position: absolute; + width: 35px; + height: 9px; + overflow: hidden; + background: url(../images/colorpicker/colorpicker_indic.gif) left top; + margin: -4px 0 0 0; + left: 0px; +} +.colorpicker_new_color { + position: absolute; + width: 60px; + height: 30px; + left: 213px; + top: 13px; + background: #f00; +} +.colorpicker_current_color { + position: absolute; + width: 60px; + height: 30px; + left: 283px; + top: 13px; + background: #f00; +} +.colorpicker input { + background-color: transparent; + border: 1px solid transparent; + position: absolute; + font-size: 10px; + font-family: Arial, Helvetica, sans-serif; + color: #898989; + top: 4px; + right: 11px; + text-align: right; + margin: 0; + padding: 0; + height: 12px; +} +.colorpicker_hex { + position: absolute; + width: 72px; + height: 22px; + background: url(../images/colorpicker/colorpicker_hex.png) top; + left: 212px; + top: 142px; +} +.colorpicker_hex input { + right: 6px; +} +.colorpicker_field { + height: 22px; + width: 62px; + background-position: top; + position: absolute; +} +.colorpicker_field span { + position: absolute; + width: 12px; + height: 22px; + overflow: hidden; + top: 0; + right: 0; + cursor: n-resize; +} +.colorpicker_rgb_r { + background-image: url(../images/colorpicker/colorpicker_rgb_r.png); + top: 52px; + left: 212px; +} +.colorpicker_rgb_g { + background-image: url(../images/colorpicker/colorpicker_rgb_g.png); + top: 82px; + left: 212px; +} +.colorpicker_rgb_b { + background-image: url(../images/colorpicker/colorpicker_rgb_b.png); + top: 112px; + left: 212px; +} +.colorpicker_hsb_h { + background-image: url(../images/colorpicker/colorpicker_hsb_h.png); + top: 52px; + left: 282px; +} +.colorpicker_hsb_s { + background-image: url(../images/colorpicker/colorpicker_hsb_s.png); + top: 82px; + left: 282px; +} +.colorpicker_hsb_b { + background-image: url(../images/colorpicker/colorpicker_hsb_b.png); + top: 112px; + left: 282px; +} +.colorpicker_submit { + position: absolute; + width: 22px; + height: 22px; + background: url(../images/colorpicker/colorpicker_submit.png) top; + left: 322px; + top: 142px; + overflow: hidden; +} +.colorpicker_focus { + background-position: center; +} +.colorpicker_hex.colorpicker_focus { + background-position: bottom; +} +.colorpicker_submit.colorpicker_focus { + background-position: bottom; +} +.colorpicker_slider { + background-position: bottom; +} + +.colorSelector { + position: relative; + width: 27px; + height: 27px; + background: url(../images/colorpicker/select.png); + float:left; +} +.colorSelector div { + position: absolute; + top: 4px; + left: 3px; + width: 21px; + height: 19px; + background: url(../images/colorpicker/select.png) center; +} \ No newline at end of file diff --git a/src/wp-content/themes/Broadside/admin/images/colorpicker/blank.gif b/src/wp-content/themes/Broadside/admin/images/colorpicker/blank.gif new file mode 100644 index 0000000..8368bae Binary files /dev/null and b/src/wp-content/themes/Broadside/admin/images/colorpicker/blank.gif differ diff --git a/src/wp-content/themes/Broadside/admin/images/colorpicker/colorpicker_background.png b/src/wp-content/themes/Broadside/admin/images/colorpicker/colorpicker_background.png new file mode 100644 index 0000000..8401572 Binary files /dev/null and b/src/wp-content/themes/Broadside/admin/images/colorpicker/colorpicker_background.png differ diff --git a/src/wp-content/themes/Broadside/admin/images/colorpicker/colorpicker_hex.png b/src/wp-content/themes/Broadside/admin/images/colorpicker/colorpicker_hex.png new file mode 100644 index 0000000..4e532d7 Binary files /dev/null and b/src/wp-content/themes/Broadside/admin/images/colorpicker/colorpicker_hex.png differ diff --git a/src/wp-content/themes/Broadside/admin/images/colorpicker/colorpicker_hsb_b.png b/src/wp-content/themes/Broadside/admin/images/colorpicker/colorpicker_hsb_b.png new file mode 100644 index 0000000..dfac595 Binary files /dev/null and b/src/wp-content/themes/Broadside/admin/images/colorpicker/colorpicker_hsb_b.png differ diff --git a/src/wp-content/themes/Broadside/admin/images/colorpicker/colorpicker_hsb_h.png b/src/wp-content/themes/Broadside/admin/images/colorpicker/colorpicker_hsb_h.png new file mode 100644 index 0000000..3977ed9 Binary files /dev/null and b/src/wp-content/themes/Broadside/admin/images/colorpicker/colorpicker_hsb_h.png differ diff --git a/src/wp-content/themes/Broadside/admin/images/colorpicker/colorpicker_hsb_s.png b/src/wp-content/themes/Broadside/admin/images/colorpicker/colorpicker_hsb_s.png new file mode 100644 index 0000000..a2a6997 Binary files /dev/null and b/src/wp-content/themes/Broadside/admin/images/colorpicker/colorpicker_hsb_s.png differ diff --git a/src/wp-content/themes/Broadside/admin/images/colorpicker/colorpicker_indic.gif b/src/wp-content/themes/Broadside/admin/images/colorpicker/colorpicker_indic.gif new file mode 100644 index 0000000..f9fa95e Binary files /dev/null and b/src/wp-content/themes/Broadside/admin/images/colorpicker/colorpicker_indic.gif differ diff --git a/src/wp-content/themes/Broadside/admin/images/colorpicker/colorpicker_overlay.png b/src/wp-content/themes/Broadside/admin/images/colorpicker/colorpicker_overlay.png new file mode 100644 index 0000000..561cdd9 Binary files /dev/null and b/src/wp-content/themes/Broadside/admin/images/colorpicker/colorpicker_overlay.png differ diff --git a/src/wp-content/themes/Broadside/admin/images/colorpicker/colorpicker_rgb_b.png b/src/wp-content/themes/Broadside/admin/images/colorpicker/colorpicker_rgb_b.png new file mode 100644 index 0000000..dfac595 Binary files /dev/null and b/src/wp-content/themes/Broadside/admin/images/colorpicker/colorpicker_rgb_b.png differ diff --git a/src/wp-content/themes/Broadside/admin/images/colorpicker/colorpicker_rgb_g.png b/src/wp-content/themes/Broadside/admin/images/colorpicker/colorpicker_rgb_g.png new file mode 100644 index 0000000..72b3276 Binary files /dev/null and b/src/wp-content/themes/Broadside/admin/images/colorpicker/colorpicker_rgb_g.png differ diff --git a/src/wp-content/themes/Broadside/admin/images/colorpicker/colorpicker_rgb_r.png b/src/wp-content/themes/Broadside/admin/images/colorpicker/colorpicker_rgb_r.png new file mode 100644 index 0000000..4855fe0 Binary files /dev/null and b/src/wp-content/themes/Broadside/admin/images/colorpicker/colorpicker_rgb_r.png differ diff --git a/src/wp-content/themes/Broadside/admin/images/colorpicker/colorpicker_select.gif b/src/wp-content/themes/Broadside/admin/images/colorpicker/colorpicker_select.gif new file mode 100644 index 0000000..599f7f1 Binary files /dev/null and b/src/wp-content/themes/Broadside/admin/images/colorpicker/colorpicker_select.gif differ diff --git a/src/wp-content/themes/Broadside/admin/images/colorpicker/colorpicker_submit.png b/src/wp-content/themes/Broadside/admin/images/colorpicker/colorpicker_submit.png new file mode 100644 index 0000000..7f4c082 Binary files /dev/null and b/src/wp-content/themes/Broadside/admin/images/colorpicker/colorpicker_submit.png differ diff --git a/src/wp-content/themes/Broadside/admin/images/colorpicker/select.png b/src/wp-content/themes/Broadside/admin/images/colorpicker/select.png new file mode 100644 index 0000000..bfc46dc Binary files /dev/null and b/src/wp-content/themes/Broadside/admin/images/colorpicker/select.png differ diff --git a/src/wp-content/themes/Broadside/admin/images/ico-delete.png b/src/wp-content/themes/Broadside/admin/images/ico-delete.png new file mode 100644 index 0000000..08f2493 Binary files /dev/null and b/src/wp-content/themes/Broadside/admin/images/ico-delete.png differ diff --git a/src/wp-content/themes/Broadside/admin/js/colorpicker.js b/src/wp-content/themes/Broadside/admin/js/colorpicker.js new file mode 100644 index 0000000..634884b --- /dev/null +++ b/src/wp-content/themes/Broadside/admin/js/colorpicker.js @@ -0,0 +1,455 @@ +/** + * + * Color picker + * Author: Stefan Petre www.eyecon.ro + * + * Dependencies: jQuery + * + */ +(function ($) { + var ColorPicker = function () { + var + ids = {}, + inAction, + charMin = 65, + visible, + tpl = '
    ', + defaults = { + eventName: 'click', + onShow: function () {}, + onBeforeShow: function(){}, + onHide: function () {}, + onChange: function () {}, + onSubmit: function () {}, + color: 'ff0000', + livePreview: true, + flat: false + }, + fillRGBFields = function (hsb, cal) { + var rgb = HSBToRGB(hsb); + $(cal).data('colorpicker').fields + .eq(1).val(rgb.r).end() + .eq(2).val(rgb.g).end() + .eq(3).val(rgb.b).end(); + }, + fillHSBFields = function (hsb, cal) { + $(cal).data('colorpicker').fields + .eq(4).val(hsb.h).end() + .eq(5).val(hsb.s).end() + .eq(6).val(hsb.b).end(); + }, + fillHexFields = function (hsb, cal) { + $(cal).data('colorpicker').fields + .eq(0).val(HSBToHex(hsb)).end(); + }, + setSelector = function (hsb, cal) { + $(cal).data('colorpicker').selector.css('backgroundColor', '#' + HSBToHex({h: hsb.h, s: 100, b: 100})); + $(cal).data('colorpicker').selectorIndic.css({ + left: parseInt(150 * hsb.s/100, 10), + top: parseInt(150 * (100-hsb.b)/100, 10) + }); + }, + setHue = function (hsb, cal) { + $(cal).data('colorpicker').hue.css('top', parseInt(150 - 150 * hsb.h/360, 10)); + }, + setCurrentColor = function (hsb, cal) { + $(cal).data('colorpicker').currentColor.css('backgroundColor', '#' + HSBToHex(hsb)); + }, + setNewColor = function (hsb, cal) { + $(cal).data('colorpicker').newColor.css('backgroundColor', '#' + HSBToHex(hsb)); + }, + keyDown = function (ev) { + var pressedKey = ev.charCode || ev.keyCode || -1; + if ((pressedKey > charMin && pressedKey <= 90) || pressedKey == 32) { + return false; + } + var cal = $(this).parent().parent(); + if (cal.data('colorpicker').livePreview === true) { + change.apply(this); + } + }, + change = function (ev) { + var cal = $(this).parent().parent(), col; + if (this.parentNode.className.indexOf('_hex') > 0) { + cal.data('colorpicker').color = col = HexToHSB(fixHex(this.value)); + } else if (this.parentNode.className.indexOf('_hsb') > 0) { + cal.data('colorpicker').color = col = fixHSB({ + h: parseInt(cal.data('colorpicker').fields.eq(4).val(), 10), + s: parseInt(cal.data('colorpicker').fields.eq(5).val(), 10), + b: parseInt(cal.data('colorpicker').fields.eq(6).val(), 10) + }); + } else { + cal.data('colorpicker').color = col = RGBToHSB(fixRGB({ + r: parseInt(cal.data('colorpicker').fields.eq(1).val(), 10), + g: parseInt(cal.data('colorpicker').fields.eq(2).val(), 10), + b: parseInt(cal.data('colorpicker').fields.eq(3).val(), 10) + })); + } + if (ev) { + fillRGBFields(col, cal.get(0)); + fillHexFields(col, cal.get(0)); + fillHSBFields(col, cal.get(0)); + } + setSelector(col, cal.get(0)); + setHue(col, cal.get(0)); + setNewColor(col, cal.get(0)); + cal.data('colorpicker').onChange.apply(cal, [col, HSBToHex(col), HSBToRGB(col)]); + }, + blur = function (ev) { + var cal = $(this).parent().parent(); + cal.data('colorpicker').fields.parent().removeClass('colorpicker_focus') + }, + focus = function () { + charMin = this.parentNode.className.indexOf('_hex') > 0 ? 70 : 65; + $(this).parent().parent().data('colorpicker').fields.parent().removeClass('colorpicker_focus'); + $(this).parent().addClass('colorpicker_focus'); + }, + downIncrement = function (ev) { + var field = $(this).parent().find('input').focus(); + var current = { + el: $(this).parent().addClass('colorpicker_slider'), + max: this.parentNode.className.indexOf('_hsb_h') > 0 ? 360 : (this.parentNode.className.indexOf('_hsb') > 0 ? 100 : 255), + y: ev.pageY, + field: field, + val: parseInt(field.val(), 10), + preview: $(this).parent().parent().data('colorpicker').livePreview + }; + $(document).bind('mouseup', current, upIncrement); + $(document).bind('mousemove', current, moveIncrement); + }, + moveIncrement = function (ev) { + ev.data.field.val(Math.max(0, Math.min(ev.data.max, parseInt(ev.data.val + ev.pageY - ev.data.y, 10)))); + if (ev.data.preview) { + change.apply(ev.data.field.get(0), [true]); + } + return false; + }, + upIncrement = function (ev) { + change.apply(ev.data.field.get(0), [true]); + ev.data.el.removeClass('colorpicker_slider').find('input').focus(); + $(document).unbind('mouseup', upIncrement); + $(document).unbind('mousemove', moveIncrement); + return false; + }, + downHue = function (ev) { + var current = { + cal: $(this).parent(), + y: $(this).offset().top + }; + current.preview = current.cal.data('colorpicker').livePreview; + $(document).bind('mouseup', current, upHue); + $(document).bind('mousemove', current, moveHue); + }, + moveHue = function (ev) { + change.apply( + ev.data.cal.data('colorpicker') + .fields + .eq(4) + .val(parseInt(360*(150 - Math.max(0,Math.min(150,(ev.pageY - ev.data.y))))/150, 10)) + .get(0), + [ev.data.preview] + ); + return false; + }, + upHue = function (ev) { + fillRGBFields(ev.data.cal.data('colorpicker').color, ev.data.cal.get(0)); + fillHexFields(ev.data.cal.data('colorpicker').color, ev.data.cal.get(0)); + $(document).unbind('mouseup', upHue); + $(document).unbind('mousemove', moveHue); + return false; + }, + downSelector = function (ev) { + var current = { + cal: $(this).parent(), + pos: $(this).offset() + }; + current.preview = current.cal.data('colorpicker').livePreview; + $(document).bind('mouseup', current, upSelector); + $(document).bind('mousemove', current, moveSelector); + }, + moveSelector = function (ev) { + change.apply( + ev.data.cal.data('colorpicker') + .fields + .eq(6) + .val(parseInt(100*(150 - Math.max(0,Math.min(150,(ev.pageY - ev.data.pos.top))))/150, 10)) + .end() + .eq(5) + .val(parseInt(100*(Math.max(0,Math.min(150,(ev.pageX - ev.data.pos.left))))/150, 10)) + .get(0), + [ev.data.preview] + ); + return false; + }, + upSelector = function (ev) { + fillRGBFields(ev.data.cal.data('colorpicker').color, ev.data.cal.get(0)); + fillHexFields(ev.data.cal.data('colorpicker').color, ev.data.cal.get(0)); + $(document).unbind('mouseup', upSelector); + $(document).unbind('mousemove', moveSelector); + return false; + }, + enterSubmit = function (ev) { + $(this).addClass('colorpicker_focus'); + }, + leaveSubmit = function (ev) { + $(this).removeClass('colorpicker_focus'); + }, + clickSubmit = function (ev) { + var cal = $(this).parent(); + var col = cal.data('colorpicker').color; + cal.data('colorpicker').origColor = col; + setCurrentColor(col, cal.get(0)); + cal.data('colorpicker').onSubmit(col, HSBToHex(col), HSBToRGB(col)); + cal.hide(); + }, + show = function (ev) { + var cal = $('#' + $(this).data('colorpickerId')); + cal.data('colorpicker').onBeforeShow.apply(this, [cal.get(0)]); + var pos = $(this).offset(); + var viewPort = getViewport(); + var top = pos.top + this.offsetHeight; + var left = pos.left; + if (top + 176 > viewPort.t + viewPort.h) { + top -= this.offsetHeight + 176; + } else { + top += 5; + } + if (left + 356 > viewPort.l + viewPort.w) { + left -= 356; + } + cal.css({left: left + 'px', top: top + 'px'}); + if (cal.data('colorpicker').onShow.apply(this, [cal.get(0)]) != false) { + cal.show(); + } + $(document).bind('mousedown', {cal: cal}, hide); + return false; + }, + hide = function (ev) { + if (!isChildOf(ev.data.cal.get(0), ev.target, ev.data.cal.get(0))) { + if (ev.data.cal.data('colorpicker').onHide.apply(this, [ev.data.cal.get(0)]) != false) { + ev.data.cal.hide(); + } + $(document).unbind('mousedown', hide); + } + }, + isChildOf = function(parentEl, el, container) { + if (parentEl == el) { + return true; + } + if (parentEl.contains) { + return parentEl.contains(el); + } + if ( parentEl.compareDocumentPosition ) { + return !!(parentEl.compareDocumentPosition(el) & 16); + } + var prEl = el.parentNode; + while(prEl && prEl != container) { + if (prEl == parentEl) + return true; + prEl = prEl.parentNode; + } + return false; + }, + getViewport = function () { + var m = document.compatMode == 'CSS1Compat'; + return { + l : window.pageXOffset || (m ? document.documentElement.scrollLeft : document.body.scrollLeft), + t : window.pageYOffset || (m ? document.documentElement.scrollTop : document.body.scrollTop), + w : window.innerWidth || (m ? document.documentElement.clientWidth : document.body.clientWidth), + h : window.innerHeight || (m ? document.documentElement.clientHeight : document.body.clientHeight) + }; + }, + fixHSB = function (hsb) { + return { + h: Math.min(360, Math.max(0, hsb.h)), + s: Math.min(100, Math.max(0, hsb.s)), + b: Math.min(100, Math.max(0, hsb.b)) + }; + }, + fixRGB = function (rgb) { + return { + r: Math.min(255, Math.max(0, rgb.r)), + g: Math.min(255, Math.max(0, rgb.g)), + b: Math.min(255, Math.max(0, rgb.b)) + }; + }, + fixHex = function (hex) { + var len = 6 - hex.length; + if (len > 0) { + var o = []; + for (var i=0; i -1) ? hex.substring(1) : hex), 16); + return {r: hex >> 16, g: (hex & 0x00FF00) >> 8, b: (hex & 0x0000FF)}; + }, + HexToHSB = function (hex) { + return RGBToHSB(HexToRGB(hex)); + }, + RGBToHSB = function (rgb) { + var hsb = {}; + hsb.b = Math.max(Math.max(rgb.r,rgb.g),rgb.b); + hsb.s = (hsb.b <= 0) ? 0 : Math.round(100*(hsb.b - Math.min(Math.min(rgb.r,rgb.g),rgb.b))/hsb.b); + hsb.b = Math.round((hsb.b /255)*100); + if((rgb.r==rgb.g) && (rgb.g==rgb.b)) hsb.h = 0; + else if(rgb.r>=rgb.g && rgb.g>=rgb.b) hsb.h = 60*(rgb.g-rgb.b)/(rgb.r-rgb.b); + else if(rgb.g>=rgb.r && rgb.r>=rgb.b) hsb.h = 60 + 60*(rgb.g-rgb.r)/(rgb.g-rgb.b); + else if(rgb.g>=rgb.b && rgb.b>=rgb.r) hsb.h = 120 + 60*(rgb.b-rgb.r)/(rgb.g-rgb.r); + else if(rgb.b>=rgb.g && rgb.g>=rgb.r) hsb.h = 180 + 60*(rgb.b-rgb.g)/(rgb.b-rgb.r); + else if(rgb.b>=rgb.r && rgb.r>=rgb.g) hsb.h = 240 + 60*(rgb.r-rgb.g)/(rgb.b-rgb.g); + else if(rgb.r>=rgb.b && rgb.b>=rgb.g) hsb.h = 300 + 60*(rgb.r-rgb.b)/(rgb.r-rgb.g); + else hsb.h = 0; + hsb.h = Math.round(hsb.h); + return hsb; + }, + HSBToRGB = function (hsb) { + var rgb = {}; + var h = Math.round(hsb.h); + var s = Math.round(hsb.s*255/100); + var v = Math.round(hsb.b*255/100); + if(s == 0) { + rgb.r = rgb.g = rgb.b = v; + } else { + var t1 = v; + var t2 = (255-s)*v/255; + var t3 = (t1-t2)*(h%60)/60; + if(h==360) h = 0; + if(h<60) {rgb.r=t1; rgb.b=t2; rgb.g=t2+t3} + else if(h<120) {rgb.g=t1; rgb.b=t2; rgb.r=t1-t3} + else if(h<180) {rgb.g=t1; rgb.r=t2; rgb.b=t2+t3} + else if(h<240) {rgb.b=t1; rgb.r=t2; rgb.g=t1-t3} + else if(h<300) {rgb.b=t1; rgb.g=t2; rgb.r=t2+t3} + else if(h<360) {rgb.r=t1; rgb.g=t2; rgb.b=t1-t3} + else {rgb.r=0; rgb.g=0; rgb.b=0} + } + return {r:Math.round(rgb.r), g:Math.round(rgb.g), b:Math.round(rgb.b)}; + }, + RGBToHex = function (rgb) { + var hex = [ + rgb.r.toString(16), + rgb.g.toString(16), + rgb.b.toString(16) + ]; + $.each(hex, function (nr, val) { + if (val.length == 1) { + hex[nr] = '0' + val; + } + }); + return hex.join(''); + }, + HSBToHex = function (hsb) { + return RGBToHex(HSBToRGB(hsb)); + }; + return { + init: function (options) { + options = $.extend({}, defaults, options||{}); + if (typeof options.color == 'string') { + options.color = HexToHSB(options.color); + } else if (options.color.r != undefined && options.color.g != undefined && options.color.b != undefined) { + options.color = RGBToHSB(options.color); + } else if (options.color.h != undefined && options.color.s != undefined && options.color.b != undefined) { + options.color = fixHSB(options.color); + } else { + return this; + } + options.origColor = options.color; + return this.each(function () { + if (!$(this).data('colorpickerId')) { + var id = 'collorpicker_' + parseInt(Math.random() * 1000); + $(this).data('colorpickerId', id); + var cal = $(tpl).attr('id', id); + if (options.flat) { + cal.appendTo(this).show(); + } else { + cal.appendTo(document.body); + } + options.fields = cal + .find('input') + .bind('keydown', keyDown) + .bind('change', change) + .bind('blur', blur) + .bind('focus', focus); + cal.find('span').bind('mousedown', downIncrement); + options.selector = cal.find('div.colorpicker_color').bind('mousedown', downSelector); + options.selectorIndic = options.selector.find('div div'); + options.hue = cal.find('div.colorpicker_hue div'); + cal.find('div.colorpicker_hue').bind('mousedown', downHue); + options.newColor = cal.find('div.colorpicker_new_color'); + options.currentColor = cal.find('div.colorpicker_current_color'); + cal.data('colorpicker', options); + cal.find('div.colorpicker_submit') + .bind('mouseenter', enterSubmit) + .bind('mouseleave', leaveSubmit) + .bind('click', clickSubmit); + fillRGBFields(options.color, cal.get(0)); + fillHSBFields(options.color, cal.get(0)); + fillHexFields(options.color, cal.get(0)); + setHue(options.color, cal.get(0)); + setSelector(options.color, cal.get(0)); + setCurrentColor(options.color, cal.get(0)); + setNewColor(options.color, cal.get(0)); + if (options.flat) { + cal.css({ + position: 'relative', + display: 'block' + }); + } else { + $(this).bind(options.eventName, show); + } + } + }); + }, + showPicker: function() { + return this.each( function () { + if ($(this).data('colorpickerId')) { + show.apply(this); + } + }); + }, + hidePicker: function() { + return this.each( function () { + if ($(this).data('colorpickerId')) { + $('#' + $(this).data('colorpickerId')).hide(); + } + }); + }, + setColor: function(col) { + if (typeof col == 'string') { + col = HexToHSB(col); + } else if (col.r != undefined && col.g != undefined && col.b != undefined) { + col = RGBToHSB(col); + } else if (col.h != undefined && col.s != undefined && col.b != undefined) { + col = fixHSB(col); + } else { + return this; + } + return this.each(function(){ + if ($(this).data('colorpickerId')) { + var cal = $('#' + $(this).data('colorpickerId')); + cal.data('colorpicker').color = col; + cal.data('colorpicker').origColor = col; + fillRGBFields(col, cal.get(0)); + fillHSBFields(col, cal.get(0)); + fillHexFields(col, cal.get(0)); + setHue(col, cal.get(0)); + setSelector(col, cal.get(0)); + setCurrentColor(col, cal.get(0)); + setNewColor(col, cal.get(0)); + } + }); + } + }; + }(); + $.fn.extend({ + ColorPicker: ColorPicker.init, + ColorPickerHide: ColorPicker.hide, + ColorPickerShow: ColorPicker.show, + ColorPickerSetColor: ColorPicker.setColor + }); +})(jQuery) \ No newline at end of file diff --git a/src/wp-content/themes/Broadside/admin/js/of-medialibrary-uploader.js b/src/wp-content/themes/Broadside/admin/js/of-medialibrary-uploader.js new file mode 100644 index 0000000..eaa0afe --- /dev/null +++ b/src/wp-content/themes/Broadside/admin/js/of-medialibrary-uploader.js @@ -0,0 +1,163 @@ +/*-----------------------------------------------------------------------------------*/ +/* WooFramework Media Library-driven AJAX File Uploader Module +/* JavaScript Functions (2010-11-05) +/* +/* The code below is designed to work as a part of the WooFramework Media Library-driven +/* AJAX File Uploader Module. It is included only on screens where this module is used. +/* +/* Used with (very) slight modifications for Options Framework. +/*-----------------------------------------------------------------------------------*/ + +(function ($) { + + optionsframeworkMLU = { + +/*-----------------------------------------------------------------------------------*/ +/* Remove file when the "remove" button is clicked. +/*-----------------------------------------------------------------------------------*/ + + removeFile: function () { + + $('.mlu_remove').live('click', function(event) { + $(this).hide(); + $(this).parents().parents().children('.upload').attr('value', ''); + $(this).parents('.screenshot').slideUp(); + $(this).parents('.screenshot').siblings('.of-background-properties').hide(); //remove background properties + return false; + }); + + // Hide the delete button on the first row + $('a.delete-inline', "#option-1").hide(); + + }, // End removeFile + +/*-----------------------------------------------------------------------------------*/ +/* Replace the default file upload field with a customised version. +/*-----------------------------------------------------------------------------------*/ + + recreateFileField: function () { + + $('input.file').each(function(){ + var uploadbutton = ''; + $(this).wrap('
    '); + $(this).addClass('file').css('opacity', 0); //set to invisible + $(this).parent().append($('
    ').append($('').attr('id',$(this).attr('id')+'_file')).val( $(this).val() ).append(uploadbutton)); + + $(this).bind('change', function() { + $('#'+$(this).attr('id')+'_file').val($(this).val()); + }); + $(this).bind('mouseout', function() { + $('#'+$(this).attr('id')+'_file').val($(this).val()); + }); + }); + + }, // End recreateFileField + +/*-----------------------------------------------------------------------------------*/ +/* Use a custom function when working with the Media Uploads popup. +/* Requires jQuery, Media Upload and Thickbox JavaScripts. +/*-----------------------------------------------------------------------------------*/ + + mediaUpload: function () { + + jQuery.noConflict(); + + $( 'input.upload_button' ).removeAttr('style'); + + var formfield, + formID, + btnContent = true, + tbframe_interval; + // On Click + $('input.upload_button').live("click", function () { + formfield = $(this).prev('input').attr('id'); + formID = $(this).attr('rel'); + + //Change "insert into post" to "Use this Button" + tbframe_interval = setInterval(function() {jQuery('#TB_iframeContent').contents().find('.savesend .button').val('Use This Image');}, 2000); + + // Display a custom title for each Thickbox popup. + var woo_title = ''; + + if ( $(this).parents('.section').find('.heading') ) { woo_title = $(this).parents('.section').find('.heading').text(); } // End IF Statement + + tb_show( woo_title, 'media-upload.php?post_id='+formID+'&TB_iframe=1' ); + return false; + }); + + window.original_send_to_editor = window.send_to_editor; + window.send_to_editor = function(html) { + + if (formfield) { + + //clear interval for "Use this Button" so button text resets + clearInterval(tbframe_interval); + + // itemurl = $(html).attr('href'); // Use the URL to the main image. + + if ( $(html).html(html).find('img').length > 0 ) { + + itemurl = $(html).html(html).find('img').attr('src'); // Use the URL to the size selected. + + } else { + + // It's not an image. Get the URL to the file instead. + + var htmlBits = html.split("'"); // jQuery seems to strip out XHTML when assigning the string to an object. Use alternate method. + itemurl = htmlBits[1]; // Use the URL to the file. + + var itemtitle = htmlBits[2]; + + itemtitle = itemtitle.replace( '>', '' ); + itemtitle = itemtitle.replace( '', '' ); + + } // End IF Statement + + var image = /(^.*\.jpg|jpeg|png|gif|ico*)/gi; + var document = /(^.*\.pdf|doc|docx|ppt|pptx|odt*)/gi; + var audio = /(^.*\.mp3|m4a|ogg|wav*)/gi; + var video = /(^.*\.mp4|m4v|mov|wmv|avi|mpg|ogv|3gp|3g2*)/gi; + + if (itemurl.match(image)) { + btnContent = 'Remove Image'; + } else { + + // No output preview if it's not an image. + // btnContent = ''; + // Standard generic output if it's not an image. + + html = 'View File'; + btnContent = '
    '+html+'Remove
    '; + } + + $('#' + formfield).val(itemurl); + // $('#' + formfield).next().next('div').slideDown().html(btnContent); + $('#' + formfield).siblings('.screenshot').slideDown().html(btnContent); + $('#' + formfield).siblings('.of-background-properties').show(); //show background properties + tb_remove(); + + } else { + window.original_send_to_editor(html); + } + + // Clear the formfield value so the other media library popups can work as they are meant to. - 2010-11-11. + formfield = ''; + } + + } // End mediaUpload + + }; // End optionsframeworkMLU Object // Don't remove this, or the sky will fall on your head. + +/*-----------------------------------------------------------------------------------*/ +/* Execute the above methods in the optionsframeworkMLU object. +/*-----------------------------------------------------------------------------------*/ + + $(document).ready(function () { + + optionsframeworkMLU.removeFile(); + optionsframeworkMLU.recreateFileField(); + optionsframeworkMLU.mediaUpload(); + + }); + +})(jQuery); \ No newline at end of file diff --git a/src/wp-content/themes/Broadside/admin/js/options-custom.js b/src/wp-content/themes/Broadside/admin/js/options-custom.js new file mode 100644 index 0000000..788570e --- /dev/null +++ b/src/wp-content/themes/Broadside/admin/js/options-custom.js @@ -0,0 +1,101 @@ +/** + * Prints out the inline javascript needed for the colorpicker and choosing + * the tabs in the panel. + */ + +jQuery(document).ready(function($) { + + // Fade out the save message + $('.fade').delay(1000).fadeOut(1000); + + // Color Picker + $('.colorSelector').each(function(){ + var Othis = this; //cache a copy of the this variable for use inside nested function + var initialColor = $(Othis).next('input').attr('value'); + $(this).ColorPicker({ + color: initialColor, + onShow: function (colpkr) { + $(colpkr).fadeIn(500); + return false; + }, + onHide: function (colpkr) { + $(colpkr).fadeOut(500); + return false; + }, + onChange: function (hsb, hex, rgb) { + $(Othis).children('div').css('backgroundColor', '#' + hex); + $(Othis).next('input').attr('value','#' + hex); + } + }); + }); //end color picker + + // Switches option sections + $('.group').hide(); + var activetab = ''; + if (typeof(localStorage) != 'undefined' ) { + activetab = localStorage.getItem("activetab"); + } + if (activetab != '' && $(activetab).length ) { + $(activetab).fadeIn(); + } else { + $('.group:first').fadeIn(); + } + $('.group .collapsed').each(function(){ + $(this).find('input:checked').parent().parent().parent().nextAll().each( + function(){ + if ($(this).hasClass('last')) { + $(this).removeClass('hidden'); + return false; + } + $(this).filter('.hidden').removeClass('hidden'); + }); + }); + + if (activetab != '' && $(activetab + '-tab').length ) { + $(activetab + '-tab').addClass('nav-tab-active'); + } + else { + $('.nav-tab-wrapper a:first').addClass('nav-tab-active'); + } + $('.nav-tab-wrapper a').click(function(evt) { + $('.nav-tab-wrapper a').removeClass('nav-tab-active'); + $(this).addClass('nav-tab-active').blur(); + var clicked_group = $(this).attr('href'); + if (typeof(localStorage) != 'undefined' ) { + localStorage.setItem("activetab", $(this).attr('href')); + } + $('.group').hide(); + $(clicked_group).fadeIn(); + evt.preventDefault(); + }); + + $('.group .collapsed input:checkbox').click(unhideHidden); + + function unhideHidden(){ + if ($(this).attr('checked')) { + $(this).parent().parent().parent().nextAll().removeClass('hidden'); + } + else { + $(this).parent().parent().parent().nextAll().each( + function(){ + if ($(this).filter('.last').length) { + $(this).addClass('hidden'); + return false; + } + $(this).addClass('hidden'); + }); + + } + } + + // Image Options + $('.of-radio-img-img').click(function(){ + $(this).parent().parent().find('.of-radio-img-img').removeClass('of-radio-img-selected'); + $(this).addClass('of-radio-img-selected'); + }); + + $('.of-radio-img-label').hide(); + $('.of-radio-img-img').show(); + $('.of-radio-img-radio').hide(); + +}); \ No newline at end of file diff --git a/src/wp-content/themes/Broadside/admin/options-framework.php b/src/wp-content/themes/Broadside/admin/options-framework.php new file mode 100644 index 0000000..c366e2d --- /dev/null +++ b/src/wp-content/themes/Broadside/admin/options-framework.php @@ -0,0 +1,389 @@ + + +
    + + + +
    +
    +
    + + + + +
    + + +
    +
    +
    +
    +
    +
    + + $value ) { + $input[$id][$key] = '0'; + } + } + + // For a value to be submitted to database it must pass through a sanitization filter + if ( has_filter( 'of_sanitize_' . $option['type'] ) ) { + $clean[$id] = apply_filters( 'of_sanitize_' . $option['type'], $input[$id], $option ); + } + } + + add_settings_error( 'options-framework', 'save_options', __( 'Options saved.', 'optionsframework' ), 'updated fade' ); + return $clean; + } + + /* + * Request Not Recognized. + */ + + return of_get_default_values(); +} + +/** + * Format Configuration Array. + * + * Get an array of all default values as set in + * options.php. The 'id','std' and 'type' keys need + * to be defined in the configuration array. In the + * event that these keys are not present the option + * will not be included in this function's output. + * + * @return array Rey-keyed options configuration array. + * + * @access private + */ + +function of_get_default_values() { + $output = array(); + $config = optionsframework_options(); + foreach ( (array) $config as $option ) { + if ( ! isset( $option['id'] ) ) { + continue; + } + if ( ! isset( $option['std'] ) ) { + continue; + } + if ( ! isset( $option['type'] ) ) { + continue; + } + if ( has_filter( 'of_sanitize_' . $option['type'] ) ) { + $output[$option['id']] = apply_filters( 'of_sanitize_' . $option['type'], $option['std'], $option ); + } + } + return $output; +} + +/** + * Add Theme Options menu item to Admin Bar. + */ + +add_action( 'wp_before_admin_bar_render', 'optionsframework_adminbar' ); + +function optionsframework_adminbar() { + + global $wp_admin_bar; + + $wp_admin_bar->add_menu( array( + 'parent' => 'appearance', + 'id' => 'of_theme_options', + 'title' => __( 'Theme Options' ), + 'href' => admin_url( 'themes.php?page=options-framework' ) + )); +} + +if ( ! function_exists( 'of_get_option' ) ) { + + /** + * Get Option. + * + * Helper function to return the theme option value. + * If no value has been saved, it returns $default. + * Needed because options are saved as serialized strings. + */ + + function of_get_option( $name, $default = false ) { + $config = get_option( 'optionsframework' ); + + if ( ! isset( $config['id'] ) ) { + return $default; + } + + $options = get_option( $config['id'] ); + + if ( isset( $options[$name] ) ) { + return $options[$name]; + } + + return $default; + } +} \ No newline at end of file diff --git a/src/wp-content/themes/Broadside/admin/options-interface.php b/src/wp-content/themes/Broadside/admin/options-interface.php new file mode 100644 index 0000000..aa89463 --- /dev/null +++ b/src/wp-content/themes/Broadside/admin/options-interface.php @@ -0,0 +1,312 @@ +'."\n"; + $output .= '

    ' . esc_html( $value['name'] ) . '

    ' . "\n"; + $output .= '
    ' . "\n" . '
    ' . "\n"; + } + + // Set default value to $val + if ( isset( $value['std']) ) { + $val = $value['std']; + } + + // If the option is already saved, ovveride $val + if ( ($value['type'] != 'heading') && ($value['type'] != 'info')) { + if ( isset($settings[($value['id'])]) ) { + $val = $settings[($value['id'])]; + // Striping slashes of non-array options + if (!is_array($val)) { + $val = stripslashes($val); + } + } + } + + switch ( $value['type'] ) { + + // Basic text input + case 'text': + $output .= ''; + break; + + // Textarea + case 'textarea': + $cols = '8'; + $ta_value = ''; + + if(isset($value['options'])){ + $ta_options = $value['options']; + if(isset($ta_options['cols'])){ + $cols = $ta_options['cols']; + } else { $cols = '8'; } + } + + $val = stripslashes( $val ); + + $output .= ''; + break; + + // Select Box + case ($value['type'] == 'select'): + $output .= ''; + break; + + + // Radio Box + case "radio": + $name = $option_name .'['. $value['id'] .']'; + foreach ($value['options'] as $key => $option) { + $id = $option_name . '-' . $value['id'] .'-'. $key; + $output .= ''; + } + break; + + // Image Selectors + case "images": + $name = $option_name .'['. $value['id'] .']'; + foreach ( $value['options'] as $key => $option ) { + $selected = ''; + $checked = ''; + if ( $val != '' ) { + if ( $val == $key ) { + $selected = ' of-radio-img-selected'; + $checked = ' checked="checked"'; + } + } + $output .= ''; + $output .= '
    ' . esc_html( $key ) . '
    '; + $output .= '' . $option .''; + } + break; + + // Checkbox + case "checkbox": + $output .= ''; + break; + + // Multicheck + case "multicheck": + foreach ($value['options'] as $key => $option) { + $checked = ''; + $label = $option; + $option = preg_replace('/\W/', '', strtolower($key)); + + $id = $option_name . '-' . $value['id'] . '-'. $option; + $name = $option_name . '[' . $value['id'] . '][' . $option .']'; + + if ( isset($val[$option]) ) { + $checked = checked($val[$option], 1, false); + } + + $output .= ''; + } + break; + + // Color picker + case "color": + $output .= '
    '; + $output .= ''; + break; + + // Uploader + case "upload": + $output .= optionsframework_medialibrary_uploader( $value['id'], $val, null ); // New AJAX Uploader using Media Library + break; + + // Typography + case 'typography': + + $typography_stored = $val; + + // Font Size + $output .= ''; + + // Font Face + $output .= ''; + + // Font Weight + $output .= ''; + + // Font Color + $output .= '
    '; + $output .= ''; + + break; + + // Background + case 'background': + + $background = $val; + + // Background Color + $output .= '
    '; + $output .= ''; + + // Background Image - New AJAX Uploader using Media Library + if (!isset($background['image'])) { + $background['image'] = ''; + } + + $output .= optionsframework_medialibrary_uploader( $value['id'], $background['image'], null, '',0,'image'); + $class = 'of-background-properties'; + if ( '' == $background['image'] ) { + $class .= ' hide'; + } + $output .= '
    '; + + // Background Repeat + $output .= ''; + + // Background Position + $output .= ''; + + // Background Attachment + $output .= ''; + $output .= '
    '; + + break; + + // Info + case "info": + $class = 'section'; + if ( isset( $value['type'] ) ) { + $class .= ' section-' . $value['type']; + } + if ( isset( $value['class'] ) ) { + $class .= ' ' . $value['class']; + } + + $output .= '
    ' . "\n"; + if ( isset($value['name']) ) { + $output .= '

    ' . esc_html( $value['name'] ) . '

    ' . "\n"; + } + if ( $value['desc'] ) { + $output .= apply_filters('of_sanitize_info', $value['desc'] ) . "\n"; + } + $output .= '
    ' . "\n"; + break; + + // Heading for Navigation + case "heading": + if($counter >= 2){ + $output .= '
    '."\n"; + } + $jquery_click_hook = preg_replace('/\W/', '', strtolower($value['name']) ); + $jquery_click_hook = "of-option-" . $jquery_click_hook; + $menu .= '' . esc_html( $value['name'] ) . ''; + $output .= '
    '; + $output .= '

    ' . esc_html( $value['name'] ) . '

    ' . "\n"; + break; + } + + if ( ( $value['type'] != "heading" ) && ( $value['type'] != "info" ) ) { + if ( $value['type'] != "checkbox" ) { + $output .= '
    '; + } + $explain_value = ''; + if ( isset( $value['desc'] ) ) { + $explain_value = $value['desc']; + } + $output .= '
    ' . wp_kses( $explain_value, $allowedtags) . '
    '."\n"; + $output .= '
    '."\n"; + } + } + $output .= '
    '; + return array($output,$menu); +} \ No newline at end of file diff --git a/src/wp-content/themes/Broadside/admin/options-medialibrary-uploader.php b/src/wp-content/themes/Broadside/admin/options-medialibrary-uploader.php new file mode 100644 index 0000000..296e17d --- /dev/null +++ b/src/wp-content/themes/Broadside/admin/options-medialibrary-uploader.php @@ -0,0 +1,291 @@ + array( + 'name' => __( 'Options Framework Internal Container' ), + ), + 'public' => true, + 'show_ui' => false, + 'capability_type' => 'post', + 'hierarchical' => false, + 'rewrite' => false, + 'supports' => array( 'title', 'editor' ), + 'query_var' => false, + 'can_export' => true, + 'show_in_nav_menus' => false + ) ); + } +} + +/** + * Adds the Thickbox CSS file and specific loading and button images to the header + * on the pages where this function is called. + */ + +if ( ! function_exists( 'optionsframework_mlu_css' ) ) { + + function optionsframework_mlu_css () { + + $_html = ''; + $_html .= '' . "\n"; + $_html .= '' . "\n"; + + echo $_html; + + } + +} + +/** + * Registers and enqueues (loads) the necessary JavaScript file for working with the + * Media Library-driven AJAX File Uploader Module. + */ + +if ( ! function_exists( 'optionsframework_mlu_js' ) ) { + + function optionsframework_mlu_js () { + + // Registers custom scripts for the Media Library AJAX uploader. + wp_register_script( 'of-medialibrary-uploader', OPTIONS_FRAMEWORK_DIRECTORY .'js/of-medialibrary-uploader.js', array( 'jquery', 'thickbox' ) ); + wp_enqueue_script( 'of-medialibrary-uploader' ); + wp_enqueue_script( 'media-upload' ); + } + +} + +/** + * Media Uploader Using the WordPress Media Library. + * + * Parameters: + * - string $_id - A token to identify this field (the name). + * - string $_value - The value of the field, if present. + * - string $_mode - The display mode of the field. + * - string $_desc - An optional description of the field. + * - int $_postid - An optional post id (used in the meta boxes). + * + * Dependencies: + * - optionsframework_mlu_get_silentpost() + */ + +if ( ! function_exists( 'optionsframework_medialibrary_uploader' ) ) { + + function optionsframework_medialibrary_uploader( $_id, $_value, $_mode = 'full', $_desc = '', $_postid = 0, $_name = '') { + + $optionsframework_settings = get_option('optionsframework'); + + // Gets the unique option id + $option_name = $optionsframework_settings['id']; + + $output = ''; + $id = ''; + $class = ''; + $int = ''; + $value = ''; + $name = ''; + + $id = strip_tags( strtolower( $_id ) ); + // Change for each field, using a "silent" post. If no post is present, one will be created. + $int = optionsframework_mlu_get_silentpost( $id ); + + // If a value is passed and we don't have a stored value, use the value that's passed through. + if ( $_value != '' && $value == '' ) { + $value = $_value; + } + + if ($_name != '') { + $name = $option_name.'['.$id.']['.$_name.']'; + } + else { + $name = $option_name.'['.$id.']'; + } + + if ( $value ) { $class = ' has-file'; } + $output .= '' . "\n"; + $output .= '' . "\n"; + + if ( $_desc != '' ) { + $output .= '' . $_desc . '' . "\n"; + } + + $output .= '
    ' . "\n"; + + if ( $value != '' ) { + $remove = 'Remove'; + $image = preg_match( '/(^.*\.jpg|jpeg|png|gif|ico*)/i', $value ); + if ( $image ) { + $output .= ''.$remove.''; + } else { + $parts = explode( "/", $value ); + for( $i = 0; $i < sizeof( $parts ); ++$i ) { + $title = $parts[$i]; + } + + // No output preview if it's not an image. + $output .= ''; + + // Standard generic output if it's not an image. + $title = __( 'View File', 'optionsframework' ); + $output .= '
    '.$title.'' . $remove . '
    '; + } + } + $output .= '
    ' . "\n"; + return $output; + } +} + +/** + * Uses "silent" posts in the database to store relationships for images. + * This also creates the facility to collect galleries of, for example, logo images. + * + * Return: $_postid. + * + * If no "silent" post is present, one will be created with the type "optionsframework" + * and the post_name of "of-$_token". + * + * Example Usage: + * optionsframework_mlu_get_silentpost ( 'of_logo' ); + */ + +if ( ! function_exists( 'optionsframework_mlu_get_silentpost' ) ) { + + function optionsframework_mlu_get_silentpost ( $_token ) { + + global $wpdb; + $_id = 0; + + // Check if the token is valid against a whitelist. + // $_whitelist = array( 'of_logo', 'of_custom_favicon', 'of_ad_top_image' ); + // Sanitise the token. + + $_token = strtolower( str_replace( ' ', '_', $_token ) ); + + // if ( in_array( $_token, $_whitelist ) ) { + if ( $_token ) { + + // Tell the function what to look for in a post. + + $_args = array( 'post_type' => 'optionsframework', 'post_name' => 'of-' . $_token, 'post_status' => 'draft', 'comment_status' => 'closed', 'ping_status' => 'closed' ); + + // Look in the database for a "silent" post that meets our criteria. + $query = 'SELECT ID FROM ' . $wpdb->posts . ' WHERE post_parent = 0'; + foreach ( $_args as $k => $v ) { + $query .= ' AND ' . $k . ' = "' . $v . '"'; + } // End FOREACH Loop + + $query .= ' LIMIT 1'; + $_posts = $wpdb->get_row( $query ); + + // If we've got a post, loop through and get it's ID. + if ( count( $_posts ) ) { + $_id = $_posts->ID; + } else { + + // If no post is present, insert one. + // Prepare some additional data to go with the post insertion. + $_words = explode( '_', $_token ); + $_title = join( ' ', $_words ); + $_title = ucwords( $_title ); + $_post_data = array( 'post_title' => $_title ); + $_post_data = array_merge( $_post_data, $_args ); + $_id = wp_insert_post( $_post_data ); + } + } + return $_id; + } +} + +/** + * Trigger code inside the Media Library popup. + */ + +if ( ! function_exists( 'optionsframework_mlu_insidepopup' ) ) { + + function optionsframework_mlu_insidepopup () { + + if ( isset( $_REQUEST['is_optionsframework'] ) && $_REQUEST['is_optionsframework'] == 'yes' ) { + + add_action( 'admin_head', 'optionsframework_mlu_js_popup' ); + add_filter( 'media_upload_tabs', 'optionsframework_mlu_modify_tabs' ); + } + } +} + +if ( ! function_exists( 'optionsframework_mlu_js_popup' ) ) { + + function optionsframework_mlu_js_popup () { + + $_of_title = $_REQUEST['of_title']; + if ( ! $_of_title ) { $_of_title = 'file'; } // End IF Statement +?> + + $value ) { + $output[$key] = "0"; + } + foreach( $input as $key => $value ) { + if ( array_key_exists( $key, $option['options'] ) && $value ) { + $output[$key] = "1"; + } + } + } + return $output; +} +add_filter( 'of_sanitize_multicheck', 'of_sanitize_multicheck', 10, 2 ); + +/* Color Picker */ + +add_filter( 'of_sanitize_color', 'of_sanitize_hex' ); + +/* Uploader */ + +function of_sanitize_upload( $input ) { + $output = ''; + $filetype = wp_check_filetype($input); + if ( $filetype["ext"] ) { + $output = $input; + } + return $output; +} +add_filter( 'of_sanitize_upload', 'of_sanitize_upload' ); + +/* Check that the key value sent is valid */ + +function of_sanitize_enum( $input, $option ) { + $output = ''; + if ( array_key_exists( $input, $option['options'] ) ) { + $output = $input; + } + return $output; +} + +/* Background */ + +function of_sanitize_background( $input ) { + $output = wp_parse_args( $input, array( + 'color' => '', + 'image' => '', + 'repeat' => 'repeat', + 'position' => 'top center', + 'attachment' => 'scroll' + ) ); + + $output['color'] = apply_filters( 'of_sanitize_hex', $input['color'] ); + $output['image'] = apply_filters( 'of_sanitize_upload', $input['image'] ); + $output['repeat'] = apply_filters( 'of_background_repeat', $input['repeat'] ); + $output['position'] = apply_filters( 'of_background_position', $input['position'] ); + $output['attachment'] = apply_filters( 'of_background_attachment', $input['attachment'] ); + + return $output; +} +add_filter( 'of_sanitize_background', 'of_sanitize_background' ); + +function of_sanitize_background_repeat( $value ) { + $recognized = of_recognized_background_repeat(); + if ( array_key_exists( $value, $recognized ) ) { + return $value; + } + return apply_filters( 'of_default_background_repeat', current( $recognized ) ); +} +add_filter( 'of_background_repeat', 'of_sanitize_background_repeat' ); + +function of_sanitize_background_position( $value ) { + $recognized = of_recognized_background_position(); + if ( array_key_exists( $value, $recognized ) ) { + return $value; + } + return apply_filters( 'of_default_background_position', current( $recognized ) ); +} +add_filter( 'of_background_position', 'of_sanitize_background_position' ); + +function of_sanitize_background_attachment( $value ) { + $recognized = of_recognized_background_attachment(); + if ( array_key_exists( $value, $recognized ) ) { + return $value; + } + return apply_filters( 'of_default_background_attachment', current( $recognized ) ); +} +add_filter( 'of_background_attachment', 'of_sanitize_background_attachment' ); + + +/* Typography */ + +function of_sanitize_typography( $input ) { + $output = wp_parse_args( $input, array( + 'size' => '', + 'face' => '', + 'style' => '', + 'color' => '' + ) ); + + $output['size'] = apply_filters( 'of_font_size', $output['size'] ); + $output['face'] = apply_filters( 'of_font_face', $output['face'] ); + $output['style'] = apply_filters( 'of_font_style', $output['style'] ); + $output['color'] = apply_filters( 'of_color', $output['color'] ); + + return $output; +} +add_filter( 'of_sanitize_typography', 'of_sanitize_typography' ); + + +function of_sanitize_font_size( $value ) { + $recognized = of_recognized_font_sizes(); + $value = preg_replace('/px/','', $value); + if ( in_array( (int) $value, $recognized ) ) { + return (int) $value; + } + return (int) apply_filters( 'of_default_font_size', $recognized ); +} +add_filter( 'of_font_face', 'of_sanitize_font_face' ); + + +function of_sanitize_font_style( $value ) { + $recognized = of_recognized_font_styles(); + if ( array_key_exists( $value, $recognized ) ) { + return $value; + } + return apply_filters( 'of_default_font_style', current( $recognized ) ); +} +add_filter( 'of_font_style', 'of_sanitize_font_style' ); + + +function of_sanitize_font_face( $value ) { + $recognized = of_recognized_font_faces(); + if ( array_key_exists( $value, $recognized ) ) { + return $value; + } + return apply_filters( 'of_default_font_face', current( $recognized ) ); +} +add_filter( 'of_font_face', 'of_sanitize_font_face' ); + +/** + * Get recognized background repeat settings + * + * @return array + * + */ +function of_recognized_background_repeat() { + $default = array( + 'no-repeat' => 'No Repeat', + 'repeat-x' => 'Repeat Horizontally', + 'repeat-y' => 'Repeat Vertically', + 'repeat' => 'Repeat All', + ); + return apply_filters( 'of_recognized_background_repeat', $default ); +} + +/** + * Get recognized background positions + * + * @return array + * + */ +function of_recognized_background_position() { + $default = array( + 'top left' => 'Top Left', + 'top center' => 'Top Center', + 'top right' => 'Top Right', + 'center left' => 'Middle Left', + 'center center' => 'Middle Center', + 'center right' => 'Middle Right', + 'bottom left' => 'Bottom Left', + 'bottom center' => 'Bottom Center', + 'bottom right' => 'Bottom Right' + ); + return apply_filters( 'of_recognized_background_position', $default ); +} + +/** + * Get recognized background attachment + * + * @return array + * + */ +function of_recognized_background_attachment() { + $default = array( + 'scroll' => 'Scroll Normally', + 'fixed' => 'Fixed in Place' + ); + return apply_filters( 'of_recognized_background_attachment', $default ); +} + +/** + * Sanitize a color represented in hexidecimal notation. + * + * @param string Color in hexidecimal notation. "#" may or may not be prepended to the string. + * @param string The value that this function should return if it cannot be recognized as a color. + * @return string + * + */ + +function of_sanitize_hex( $hex, $default = '' ) { + if ( of_validate_hex( $hex ) ) { + return $hex; + } + return $default; +} + +/** + * Get recognized font sizes. + * + * Returns an indexed array of all recognized font sizes. + * Values are integers and represent a range of sizes from + * smallest to largest. + * + * @return array + */ + +function of_recognized_font_sizes() { + $sizes = range( 9, 71 ); + $sizes = apply_filters( 'of_recognized_font_sizes', $sizes ); + $sizes = array_map( 'absint', $sizes ); + return $sizes; +} + +/** + * Get recognized font faces. + * + * Returns an array of all recognized font faces. + * Keys are intended to be stored in the database + * while values are ready for display in in html. + * + * @return array + * + */ +function of_recognized_font_faces() { + $default = array( + 'arial' => 'Arial', + 'verdana' => 'Verdana, Geneva', + 'trebuchet' => 'Trebuchet', + 'georgia' => 'Georgia', + 'times' => 'Times New Roman', + 'tahoma' => 'Tahoma, Geneva', + 'palatino' => 'Palatino', + 'helvetica' => 'Helvetica*' + ); + return apply_filters( 'of_recognized_font_faces', $default ); +} + +/** + * Get recognized font styles. + * + * Returns an array of all recognized font styles. + * Keys are intended to be stored in the database + * while values are ready for display in in html. + * + * @return array + * + */ +function of_recognized_font_styles() { + $default = array( + 'normal' => 'Normal', + 'italic' => 'Italic', + 'bold' => 'Bold', + 'bold italic' => 'Bold Italic' + ); + return apply_filters( 'of_recognized_font_styles', $default ); +} + +/** + * Is a given string a color formatted in hexidecimal notation? + * + * @param string Color in hexidecimal notation. "#" may or may not be prepended to the string. + * @return bool + * + */ + +function of_validate_hex( $hex ) { + $hex = trim( $hex ); + /* Strip recognized prefixes. */ + if ( 0 === strpos( $hex, '#' ) ) { + $hex = substr( $hex, 1 ); + } + elseif ( 0 === strpos( $hex, '%23' ) ) { + $hex = substr( $hex, 3 ); + } + /* Regex match. */ + if ( 0 === preg_match( '/^[0-9a-fA-F]{6}$/', $hex ) ) { + return false; + } + else { + return true; + } +} \ No newline at end of file diff --git a/src/wp-content/themes/Broadside/archive.php b/src/wp-content/themes/Broadside/archive.php new file mode 100644 index 0000000..41f0bd2 --- /dev/null +++ b/src/wp-content/themes/Broadside/archive.php @@ -0,0 +1,79 @@ + + +
    + + +
    +

    + + ' . get_the_date() . '' ); ?> + + ' . get_the_date( 'F Y' ) . '' ); ?> + + ' . get_the_date( 'Y' ) . '' ); ?> + + + +

    +
    + +
    px;"> + + + + + + + + +
    > + +
    + + +
    +
    +
    +

    + Posted by in | +
    +
    +
    + +
    +
    + +
    + + + + + + +
    +
    +

    +
    + +
    +

    +
    +
    + + + + + + + + + + + +
    +
    + \ No newline at end of file diff --git a/src/wp-content/themes/Broadside/author.php b/src/wp-content/themes/Broadside/author.php new file mode 100644 index 0000000..a80b577 --- /dev/null +++ b/src/wp-content/themes/Broadside/author.php @@ -0,0 +1,87 @@ + +
    + + +
    +

    + +

    + +
    + + +
    px;"> + + + + + + + + + + + + + + +
    > + +
    + + +
    +
    +
    +

    + Posted by in | +
    +
    +
    + +
    +
    + +
    + + + + + + + + + + + + + +
    +
    + \ No newline at end of file diff --git a/src/wp-content/themes/Broadside/bebas-neue/BebasNeue-webfont.eot b/src/wp-content/themes/Broadside/bebas-neue/BebasNeue-webfont.eot new file mode 100644 index 0000000..1086d78 Binary files /dev/null and b/src/wp-content/themes/Broadside/bebas-neue/BebasNeue-webfont.eot differ diff --git a/src/wp-content/themes/Broadside/bebas-neue/BebasNeue-webfont.svg b/src/wp-content/themes/Broadside/bebas-neue/BebasNeue-webfont.svg new file mode 100644 index 0000000..f3839d2 --- /dev/null +++ b/src/wp-content/themes/Broadside/bebas-neue/BebasNeue-webfont.svg @@ -0,0 +1,443 @@ + + + + +This is a custom SVG webfont generated by Font Squirrel. +Copyright : Copyright c 2010 by Ryoichi Tsunekawa All rights reserved +Designer : Ryoichi Tsunekawa +Foundry : Ryoichi Tsunekawa + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/wp-content/themes/Broadside/bebas-neue/BebasNeue-webfont.ttf b/src/wp-content/themes/Broadside/bebas-neue/BebasNeue-webfont.ttf new file mode 100644 index 0000000..e6943f4 Binary files /dev/null and b/src/wp-content/themes/Broadside/bebas-neue/BebasNeue-webfont.ttf differ diff --git a/src/wp-content/themes/Broadside/bebas-neue/BebasNeue-webfont.woff b/src/wp-content/themes/Broadside/bebas-neue/BebasNeue-webfont.woff new file mode 100644 index 0000000..009d3d1 Binary files /dev/null and b/src/wp-content/themes/Broadside/bebas-neue/BebasNeue-webfont.woff differ diff --git a/src/wp-content/themes/Broadside/bebas-neue/Dharma Type Font License.txt b/src/wp-content/themes/Broadside/bebas-neue/Dharma Type Font License.txt new file mode 100644 index 0000000..6b441ab --- /dev/null +++ b/src/wp-content/themes/Broadside/bebas-neue/Dharma Type Font License.txt @@ -0,0 +1,57 @@ +____________________________________________________________________________________________________ + _____ _ _ __ ____ _ _ __ ______ _ _ ____ _____ + / ) / / / | / ) / /| / | / | / / ) / ' +---/----/----/___ /-----/__|----/___ /----/| /-|----/__|--------/--------|---/-----/____/----/__---- + / / / / / | / | / |/ | / | / | / / / +_/____/____/____/_____/____|__/_____|___/__/___|__/____|______/__________|_/_____/_________/____ ___ + / + (_ / DHARMA TYPE FREE FONTs + + +EULA ( the End User License Agreement ) + +This document is a legal agreement between you the end user, and Dharma Type. +By using or installing Dharma Type font(s), you agree to be bound by the terms of this Agreement. + +1. You may use this font for both commercial and non-commercial works at no charge. +2. You may use this font to create images on the website or printed matter on papre, logomark.....up to you. +3. You may not sell this font without permission. +4. You may not redistribute this font without permission. +5. You may not modify, adapt, translate, reverse engineer, decompile, disassemble, or create derivative works based on this font. +6. This font are Copyrighted by Ryoichi Tsunekawa. All rights reserved. You may not claim copyrgiht rights for this font. +7. DISCLAIMER +This font is provided to you free of charge. +Dharma Type give no warranty in relation to this font, and you use this at your own risk. +Dharma Type will not be liable for any damage to your system, any loss or corruption of any data or software, +or any other loss or damage that you may suffer as a result of downloading or using this font, whether it results from our negligence or in any other way. + +Here is a list of things you could do, Only if you want to: +* Link http://dharmatype.com/ or credit "Dharma Type" +* Tell me what did you use this font for. + + +FAQ + +Q_ Can I use this for a commercial product? +A_ Yes, You can! + +Q_ Can I use this on a web page via css @font-face? +A_ Yes, You can! + +Q_ Can I donate $ to you? +A_ Yes, You can! ( Paypal: info@flat-it.com ) + + + +Contact_______________________________ + +info@dharmatype.com + +Dharma Type (http://dharmatype.com) + | + |___ Flat it type foundry + | + |___ Prop-a-ganda + | + |___ Holiday Type +______________________________________ \ No newline at end of file diff --git a/src/wp-content/themes/Broadside/bebas-neue/demo.html b/src/wp-content/themes/Broadside/bebas-neue/demo.html new file mode 100644 index 0000000..7f78095 --- /dev/null +++ b/src/wp-content/themes/Broadside/bebas-neue/demo.html @@ -0,0 +1,33 @@ + + + + + + + Font Face Demo + + + + + +
    +

    FONT-FACE DEMO FOR THE BEBAS NEUE FONT

    + + + +

    Bebas Neue Regular - Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

    + +
    + + diff --git a/src/wp-content/themes/Broadside/bebas-neue/stylesheet.css b/src/wp-content/themes/Broadside/bebas-neue/stylesheet.css new file mode 100644 index 0000000..0fe07c9 --- /dev/null +++ b/src/wp-content/themes/Broadside/bebas-neue/stylesheet.css @@ -0,0 +1,16 @@ +/* Generated by Font Squirrel (http://www.fontsquirrel.com) on August 1, 2011 12:28:43 PM America/New_York */ + + + +@font-face { + font-family: 'BebasNeueRegular'; + src: url('BebasNeue-webfont.eot'); + src: url('BebasNeue-webfont.eot?#iefix') format('embedded-opentype'), + url('BebasNeue-webfont.woff') format('woff'), + url('BebasNeue-webfont.ttf') format('truetype'), + url('BebasNeue-webfont.svg#BebasNeueRegular') format('svg'); + font-weight: normal; + font-style: normal; + +} + diff --git a/src/wp-content/themes/Broadside/category.php b/src/wp-content/themes/Broadside/category.php new file mode 100644 index 0000000..0c60854 --- /dev/null +++ b/src/wp-content/themes/Broadside/category.php @@ -0,0 +1,78 @@ + +
    + + +
    +

    ' . single_cat_title( '', false ) . '' ); + ?>

    +
    + + +
    px;"> + + + + ' . $category_description . '
    ' ); + ?> + + + + + + +
    > + +
    + + +
    +
    +
    +

    + Posted by in | +
    +
    +
    + +
    +
    + +
    + + + + + + + +
    +
    +

    +
    + +
    +

    + +
    +
    + + + + + + + + + + +
    +
    + \ No newline at end of file diff --git a/src/wp-content/themes/Broadside/comments.php b/src/wp-content/themes/Broadside/comments.php new file mode 100644 index 0000000..83257d6 --- /dev/null +++ b/src/wp-content/themes/Broadside/comments.php @@ -0,0 +1,63 @@ +
    + +

    +
    + + + + + +

    + ' . get_the_title() . '' ); + ?> +

    + + 1 && get_option( 'page_comments' ) ) : // are there comments to navigate through ?> + + + +
      + 'twentyeleven_comment' ) ); + ?> +
    + + 1 && get_option( 'page_comments' ) ) : // are there comments to navigate through ?> + + + + +

    + + + + + diff --git a/src/wp-content/themes/Broadside/contact.php b/src/wp-content/themes/Broadside/contact.php new file mode 100644 index 0000000..b46b308 --- /dev/null +++ b/src/wp-content/themes/Broadside/contact.php @@ -0,0 +1,128 @@ + +' . "\r\n" . 'Reply-To: ' . $email; + + mail($emailTo, 'Your Website Subject', $body, $headers); //Replace Your Website Subject + $emailSent = true; + } +} +?> + + +
    +
    +

    + ID, 'pyre_heading_sub', true)): ?> +

    ID, 'pyre_heading_sub', true); ?>

    + +
    + +
    px;"> + + +
    +
    + +
    +
    + +
    +
    +
    + +

    Please check if you've filled all the fields with valid information. Thank you.

    + + + +

    Email Successfully Sent!

    + + +
    +
    + + +
    + +
    + + +
    + +
    + + +
    + +
    +
    +
    + + Facebook + + + Twitter + + + Flickr + + + Vimeo + + + Google + + + StumbleUpon + + + YouTube + + + E-Mail + +
    +
    +
    + +
    + +
    +
    + + \ No newline at end of file diff --git a/src/wp-content/themes/Broadside/css/fancybox.css b/src/wp-content/themes/Broadside/css/fancybox.css new file mode 100644 index 0000000..cec22bc --- /dev/null +++ b/src/wp-content/themes/Broadside/css/fancybox.css @@ -0,0 +1,359 @@ +/* + * FancyBox - jQuery Plugin + * Simple and fancy lightbox alternative + * + * Examples and documentation at: http://fancybox.net + * + * Copyright (c) 2008 - 2010 Janis Skarnelis + * That said, it is hardly a one-person project. Many people have submitted bugs, code, and offered their advice freely. Their support is greatly appreciated. + * + * Version: 1.3.4 (11/11/2010) + * Requires: jQuery v1.3+ + * + * Dual licensed under the MIT and GPL licenses: + * http://www.opensource.org/licenses/mit-license.php + * http://www.gnu.org/licenses/gpl.html + */ + +#fancybox-loading { + position: fixed; + top: 50%; + left: 50%; + width: 40px; + height: 40px; + margin-top: -20px; + margin-left: -20px; + cursor: pointer; + overflow: hidden; + z-index: 1104; + display: none; +} + +#fancybox-loading div { + position: absolute; + top: 0; + left: 0; + width: 40px; + height: 480px; + background-image: url('../images/fancybox/fancybox.png'); +} + +#fancybox-overlay { + position: absolute; + top: 0; + left: 0; + width: 100%; + z-index: 1100; + display: none; +} + +#fancybox-tmp { + padding: 0; + margin: 0; + border: 0; + overflow: auto; + display: none; +} + +#fancybox-wrap { + position: absolute; + top: 0; + left: 0; + padding: 20px; + z-index: 1101; + outline: none; + display: none; +} + +#fancybox-outer { + position: relative; + width: 100%; + height: 100%; + background: #fff; +} + +#fancybox-content { + width: 0; + height: 0; + padding: 0; + outline: none; + position: relative; + overflow: hidden; + z-index: 1102; + border: 0px solid #fff; +} + +#fancybox-hide-sel-frame { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + background: transparent; + z-index: 1101; +} + +#fancybox-close { + position: absolute; + top: -15px; + right: -15px; + width: 30px; + height: 30px; + background: transparent url('../images/fancybox/fancybox.png') -40px 0px; + cursor: pointer; + z-index: 1103; + display: none; +} + +#fancybox-error { + color: #444; + font: normal 12px/20px Arial; + padding: 14px; + margin: 0; +} + +#fancybox-img { + width: 100%; + height: 100%; + padding: 0; + margin: 0; + border: none; + outline: none; + line-height: 0; + vertical-align: top; +} + +#fancybox-frame { + width: 100%; + height: 100%; + border: none; + display: block; +} + +#fancybox-left, #fancybox-right { + position: absolute; + bottom: 0px; + height: 100%; + width: 35%; + cursor: pointer; + outline: none; + background: transparent url('../images/fancybox/blank.gif'); + z-index: 1102; + display: none; +} + +#fancybox-left { + left: 0px; +} + +#fancybox-right { + right: 0px; +} + +#fancybox-left-ico, #fancybox-right-ico { + position: absolute; + top: 50%; + left: -9999px; + width: 30px; + height: 30px; + margin-top: -15px; + cursor: pointer; + z-index: 1102; + display: block; +} + +#fancybox-left-ico { + background-image: url('../images/fancybox/fancybox.png'); + background-position: -40px -30px; +} + +#fancybox-right-ico { + background-image: url('../images/fancybox/fancybox.png'); + background-position: -40px -60px; +} + +#fancybox-left:hover, #fancybox-right:hover { + visibility: visible; /* IE6 */ +} + +#fancybox-left:hover span { + left: 20px; +} + +#fancybox-right:hover span { + left: auto; + right: 20px; +} + +.fancybox-bg { + position: absolute; + padding: 0; + margin: 0; + border: 0; + width: 20px; + height: 20px; + z-index: 1001; +} + +#fancybox-bg-n { + top: -20px; + left: 0; + width: 100%; + background-image: url('../images/fancybox/fancybox-x.png'); +} + +#fancybox-bg-ne { + top: -20px; + right: -20px; + background-image: url('../images/fancybox/fancybox.png'); + background-position: -40px -162px; +} + +#fancybox-bg-e { + top: 0; + right: -20px; + height: 100%; + background-image: url('../images/fancybox/fancybox-y.png'); + background-position: -20px 0px; +} + +#fancybox-bg-se { + bottom: -20px; + right: -20px; + background-image: url('../images/fancybox/fancybox.png'); + background-position: -40px -182px; +} + +#fancybox-bg-s { + bottom: -20px; + left: 0; + width: 100%; + background-image: url('../images/fancybox/fancybox-x.png'); + background-position: 0px -20px; +} + +#fancybox-bg-sw { + bottom: -20px; + left: -20px; + background-image: url('../images/fancybox/fancybox.png'); + background-position: -40px -142px; +} + +#fancybox-bg-w { + top: 0; + left: -20px; + height: 100%; + background-image: url('../images/fancybox/fancybox-y.png'); +} + +#fancybox-bg-nw { + top: -20px; + left: -20px; + background-image: url('../images/fancybox/fancybox.png'); + background-position: -40px -122px; +} + +#fancybox-title { + font-family: Helvetica; + font-size: 12px; + z-index: 1102; +} + +.fancybox-title-inside { + padding-bottom: 10px; + text-align: center; + color: #333; + background: #fff; + position: relative; +} + +.fancybox-title-outside { + padding-top: 10px; + color: #fff; +} + +.fancybox-title-over { + position: absolute; + bottom: 0; + left: 0; + color: #FFF; + text-align: left; +} + +#fancybox-title-over { + padding: 10px; + background-image: url('../images/fancybox/fancy_title_over.png'); + display: block; +} + +.fancybox-title-float { + position: absolute; + left: 0; + bottom: -20px; + height: 32px; +} + +#fancybox-title-float-wrap { + border: none; + border-collapse: collapse; + width: auto; +} + +#fancybox-title-float-wrap td { + border: none; + white-space: nowrap; +} + +#fancybox-title-float-left { + padding: 0 0 0 15px; + background: url('../images/fancybox/fancybox.png') -40px -90px no-repeat; +} + +#fancybox-title-float-main { + color: #FFF; + line-height: 29px; + font-weight: bold; + padding: 0 0 3px 0; + background: url('../images/fancybox/fancybox-x.png') 0px -40px; +} + +#fancybox-title-float-right { + padding: 0 0 0 15px; + background: url('../images/fancybox/fancybox.png') -55px -90px no-repeat; +} + +/* IE6 */ + +.fancybox-ie6 #fancybox-close { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_close.png', sizingMethod='scale'); } + +.fancybox-ie6 #fancybox-left-ico { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_nav_left.png', sizingMethod='scale'); } +.fancybox-ie6 #fancybox-right-ico { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_nav_right.png', sizingMethod='scale'); } + +.fancybox-ie6 #fancybox-title-over { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_title_over.png', sizingMethod='scale'); zoom: 1; } +.fancybox-ie6 #fancybox-title-float-left { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_title_left.png', sizingMethod='scale'); } +.fancybox-ie6 #fancybox-title-float-main { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_title_main.png', sizingMethod='scale'); } +.fancybox-ie6 #fancybox-title-float-right { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_title_right.png', sizingMethod='scale'); } + +.fancybox-ie6 #fancybox-bg-w, .fancybox-ie6 #fancybox-bg-e, .fancybox-ie6 #fancybox-left, .fancybox-ie6 #fancybox-right, #fancybox-hide-sel-frame { + height: expression(this.parentNode.clientHeight + "px"); +} + +#fancybox-loading.fancybox-ie6 { + position: absolute; margin-top: 0; + top: expression( (-20 + (document.documentElement.clientHeight ? document.documentElement.clientHeight/2 : document.body.clientHeight/2 ) + ( ignoreMe = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop )) + 'px'); +} + +#fancybox-loading.fancybox-ie6 div { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_loading.png', sizingMethod='scale'); } + +/* IE6, IE7, IE8 */ + +.fancybox-ie .fancybox-bg { background: transparent !important; } + +.fancybox-ie #fancybox-bg-n { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_shadow_n.png', sizingMethod='scale'); } +.fancybox-ie #fancybox-bg-ne { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_shadow_ne.png', sizingMethod='scale'); } +.fancybox-ie #fancybox-bg-e { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_shadow_e.png', sizingMethod='scale'); } +.fancybox-ie #fancybox-bg-se { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_shadow_se.png', sizingMethod='scale'); } +.fancybox-ie #fancybox-bg-s { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_shadow_s.png', sizingMethod='scale'); } +.fancybox-ie #fancybox-bg-sw { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_shadow_sw.png', sizingMethod='scale'); } +.fancybox-ie #fancybox-bg-w { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_shadow_w.png', sizingMethod='scale'); } +.fancybox-ie #fancybox-bg-nw { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_shadow_nw.png', sizingMethod='scale'); } \ No newline at end of file diff --git a/src/wp-content/themes/Broadside/css/ie7.css b/src/wp-content/themes/Broadside/css/ie7.css new file mode 100644 index 0000000..d7d1624 --- /dev/null +++ b/src/wp-content/themes/Broadside/css/ie7.css @@ -0,0 +1,2 @@ +html {overflow:hidden; max-height:100%;} +.side-barheading {display:none;} \ No newline at end of file diff --git a/src/wp-content/themes/Broadside/css/navigation.css b/src/wp-content/themes/Broadside/css/navigation.css new file mode 100644 index 0000000..4884a0b --- /dev/null +++ b/src/wp-content/themes/Broadside/css/navigation.css @@ -0,0 +1,174 @@ +/*** DEMO SKIN ***/ +/*** adding sf-vertical in addition to sf-menu creates a vertical menu ***/ + +.navigation-space {line-height:1px;} + +.sf-vertical, .sf-vertical li { + width: 165px !important; +} + +.sf-menu li li a {margin-left:15px; } +.sf-vertical {padding:38px 0 28px 0 !important; position:relative; z-index:3000;} +.sf-menu { + float: left; +} +.sf-menu a { + padding: 2px 0px 2px 1px; + text-decoration:none; + font-size:17px; +} +.sf-menu li li a, .sf-menu li .current-menu-item a { + background-position: 0px -155px !important; + opacity:1; filter:alpha(opacity=100); + padding:7px 0 4px 1px; + font-size:16px; +} +.sf-menu .current-menu-item a, .sf-menu li .current-menu-item a:hover {padding-left:7px; opacity:0.7; filter:alpha(opacity=70); } +.sf-menu .current-menu-item .sliding-element a {padding-left:0px; opacity:1; filter:alpha(opacity=100); background:none; } +.sf-menu a:hover {opacity:0.7;filter:alpha(opacity=70); } +.sf-menu li li a:hover, .sf-menu .current-menu-item .sliding-element a:hover, .sf-menu li .current-menu-item a:hover {background-position: 0px 9px !important;} +.sf-menu li li:hover, .sf-menu li li.sfHover, +.sf-menu li li a:focus, .sf-menu li li a:hover, .sf-menu li li a:active { + outline: 0; +} + + +/*** ESSENTIAL STYLES ***/ +.sf-menu, .sf-menu * { + margin: 0; + padding: 0; + list-style: none; +} +.sf-menu { + line-height: 1.0; +} +.sf-menu ul { + position: absolute; + top: -999em; + width: 165px; /* left offset of submenus need to match (see below) */ +} +.sf-menu ul li { + width: 100%; +} +.sf-menu li:hover { + visibility: inherit; /* fixes IE7 'sticky bug' */ +} +.sf-menu li { + float: left; + position: relative; +} +.sf-menu a { + display: block; + position: relative; +} +.sf-menu li:hover ul, +.sf-menu li.sfHover ul { + left: 0; + top: 2.5em; /* match top ul list item height */ + z-index: 99; +} +ul.sf-menu li:hover li ul, +ul.sf-menu li.sfHover li ul { + top: -999em; +} +ul.sf-menu li li:hover ul, +ul.sf-menu li li.sfHover ul { + left: 165px; /* match ul width */ + top: 0; +} +ul.sf-menu li li:hover li ul, +ul.sf-menu li li.sfHover li ul { + top: -999em; +} +ul.sf-menu li li li:hover ul, +ul.sf-menu li li li.sfHover ul { + left: 165px; /* match ul width */ + top: 0; +} + + +/*** arrows **/ +.sf-menu a.sf-with-ul { + padding-right: 2.25em; + min-width: 1px; /* trigger IE7 hasLayout so spans position accurately */ +} +.sf-menu li li a > .sf-sub-indicator {top: 9px; } +.sf-sub-indicator { + position: absolute; + display: block; + right: 1.45em; + top: 1.75em; /* IE6 only */ + width: 10px; + height: 10px; + text-indent: -999em; + overflow: hidden; + background: url('../images/arrows-ffffff.png') no-repeat -10px -100px; /* 8-bit indexed alpha png. IE6 gets solid image only */ +} +a > .sf-sub-indicator { /* give all except IE6 the correct values */ + top: 4px; + background-position: 0 -100px; /* use translucent arrow for modern browsers*/ +} +/* apply hovers to modern browsers */ +a:focus > .sf-sub-indicator, +a:hover > .sf-sub-indicator, +a:active > .sf-sub-indicator, +li:hover > a > .sf-sub-indicator, +li.sfHover > a > .sf-sub-indicator { + background-position: -10px -100px; /* arrow hovers for modern browsers*/ +} + +/* point right for anchors in subs */ +.sf-menu ul .sf-sub-indicator { background-position: -10px 0; } +.sf-menu ul a > .sf-sub-indicator { background-position: 0 0; } +/* apply hovers to modern browsers */ +.sf-menu ul a:focus > .sf-sub-indicator, +.sf-menu ul a:hover > .sf-sub-indicator, +.sf-menu ul a:active > .sf-sub-indicator, +.sf-menu ul li:hover > a > .sf-sub-indicator, +.sf-menu ul li.sfHover > a > .sf-sub-indicator { + background-position: -10px 0; /* arrow hovers for modern browsers*/ +} + +/*** shadows for all but IE6 ***/ +.sf-shadow ul { + background: url('../images/shadow.png') no-repeat bottom right; + padding: 0 8px 9px 0; + -moz-border-radius-bottomleft: 17px; + -moz-border-radius-topright: 17px; + -webkit-border-top-right-radius: 17px; + -webkit-border-bottom-left-radius: 17px; +} +.sf-shadow ul.sf-shadow-off { + background: transparent; +} + +/* this lacks ul at the start of the selector, so the styles from the main CSS file override it where needed */ +.sf-vertical li:hover ul, +.sf-vertical li.sfHover ul { + left: 165px; /* match ul width */ + top: 0; +} + + +/*** adding sf-vertical in addition to sf-menu creates a vertical menu ***/ +.sf-vertical, .sf-vertical li { +} +/* this lacks ul at the start of the selector, so the styles from the main CSS file override it where needed */ +.sf-vertical li:hover ul, +.sf-vertical li.sfHover ul { + left: 165px; /* match ul width */ + top: 0; +} + +/*** alter arrow directions ***/ +.sf-vertical .sf-sub-indicator { background-position: -10px 0; } /* IE6 gets solid image only */ +.sf-vertical a > .sf-sub-indicator { background-position: 0 0; } /* use translucent arrow for modern browsers*/ + +/* hover arrow direction for modern browsers*/ +.sf-vertical a:focus > .sf-sub-indicator, +.sf-vertical a:hover > .sf-sub-indicator, +.sf-vertical a:active > .sf-sub-indicator, +.sf-vertical li:hover > a > .sf-sub-indicator, +.sf-vertical li.sfHover > a > .sf-sub-indicator { + background-position: -10px 0; /* arrow hovers for modern browsers*/ +} diff --git a/src/wp-content/themes/Broadside/css/orbit-1.2.3.css b/src/wp-content/themes/Broadside/css/orbit-1.2.3.css new file mode 100644 index 0000000..32c5f16 --- /dev/null +++ b/src/wp-content/themes/Broadside/css/orbit-1.2.3.css @@ -0,0 +1,203 @@ +/* CSS for jQuery Orbit Plugin 1.2.3 + * www.ZURB.com/playground + * Copyright 2010, ZURB + * Free to use under the MIT license. + * http://www.opensource.org/licenses/mit-license.php + + + +/* PUT IN YOUR SLIDER ID AND SIZE TO MAKE LOAD BEAUTIFULLY + ================================================== */ + + #featured { + width: 980px; + background: #000 url('../images/orbit/loading.gif') no-repeat center center; + overflow: hidden; + } + + #featured div {width:980px; display:block;} + +#featured>img, +#featured>div, +#featured>a { display: none; } + + +/* CONTAINER + ================================================== */ + +div.orbit-wrapper { + width: 1px; + height: 1px; + position: relative; } + +div.orbit { + width: 1px; + height: 1px; + position: relative; + overflow: hidden } + +div.orbit>img { + position: absolute; + top: 0; + left: 0; + display: none; } + +div.orbit>a { + border: none; + position: absolute; + top: 0; + left: 0; + line-height: 0; + display: none; } + +.orbit>div { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; } + +/* Note: If your slider only uses content or anchors, you're going to want to put the width and height declarations on the ".orbit>div" and "div.orbit>a" tags in addition to just the .orbit-wrapper */ + + +/* TIMER + ================================================== */ + +div.timer { + width: 20px; + height: 20px; + overflow: hidden; + position: absolute; + bottom: 22px; + right: 25px; + opacity: .8; + cursor: pointer; + z-index: 1001; } + +span.rotator { + display: block; + width: 20px; + height: 20px; + position: absolute; + top: 0; + left: -10px; + background: url(../images/orbit/rotator-black2.png) no-repeat; + z-index: 3; } + +span.mask { + display: block; + width: 10px; + height: 20px; + position: absolute; + top: 0; + right: 0; + z-index: 2; + overflow: hidden; } + +span.rotator.move { + left: 0 } + +span.mask.move { + width: 20px; + left: 0; + background: url(../images/orbit/timer-black2.png) repeat 0 0; } + +span.pause { + display: block; + width: 20px; + height: 20px; + position: absolute; + top: 0; + left: 0; + background: url(../images/orbit/pause-black2.png) no-repeat; + z-index: 4; + opacity: 0; } + +span.pause.active { + background: url(../images/orbit/pause-black2.png) no-repeat 0 -20px } + +div.timer:hover span.pause, +span.pause.active { + opacity: 1 } + + +/* CAPTIONS + ================================================== */ + +.orbit-caption { + display: none; + font-family: "HelveticaNeue", "Helvetica-Neue", Helvetica, Arial, sans-serif; } + +.orbit-wrapper .orbit-caption { + background: #000; + background: rgba(0,0,0,.6); + z-index: 1000; + color: #fff; + text-align: center; + padding: 7px 0; + font-size: 13px; + position: absolute; + right: 0; + bottom: 0; + width: 100%; } + + +/* DIRECTIONAL NAV + ================================================== */ + +div.slider-nav { + display: block } + +div.slider-nav span { + width:26px; + height: 44px; + text-indent: -9999px; + position: absolute; + z-index: 1000; + top: 50%; + margin-top: -22px; + cursor: pointer; } + +div.slider-nav span.right { + background: url(../images/orbit/arrows-new.png) -26px 0px no-repeat; + right: 15px; } + +div.slider-nav span.left { + background: url(../images/orbit/arrows-new.png) 0px 0px no-repeat; + left: 15px; } + +/* BULLET NAV + ================================================== */ + +.orbit-bullets { + position: absolute; + z-index: 1000; + list-style: none; + bottom: -3px; + left: 50%; + margin-left: -38px; + padding: 0; } + +.orbit-bullets li { + float: left; + margin-left: 5px; + cursor: pointer; + color: #999; + text-indent: -9999px; + background: url(../images/orbit/bullets2.png) no-repeat top left; + width: 10px; + height: 10px; + overflow: hidden; } + +.orbit-bullets li.active { + color: #222; + background-position: top right; } + +.orbit-bullets li.has-thumb { + background: none; + width: 100px; + height: 75px; } + +.orbit-bullets li.active.has-thumb { + background-position: 0 0; + border-top: 2px solid #000; } \ No newline at end of file diff --git a/src/wp-content/themes/Broadside/css/reset.css b/src/wp-content/themes/Broadside/css/reset.css new file mode 100644 index 0000000..99a0211 --- /dev/null +++ b/src/wp-content/themes/Broadside/css/reset.css @@ -0,0 +1 @@ +html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,font,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td{margin:0;padding:0;border:0;outline:0;font-size:100%;vertical-align:baseline;background:transparent}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:'';content:none}:focus{outline:0}ins{text-decoration:none}del{text-decoration:line-through}table{border-collapse:collapse;border-spacing:0} \ No newline at end of file diff --git a/src/wp-content/themes/Broadside/css/standard.css b/src/wp-content/themes/Broadside/css/standard.css new file mode 100644 index 0000000..7d6abb3 --- /dev/null +++ b/src/wp-content/themes/Broadside/css/standard.css @@ -0,0 +1,546 @@ +/* DEFAULT STYLES */ +body { + background:#e8e8e8; + font-size:12px; + line-height:18px; + min-width:1000px; + min-height:20px; + font-family: "Lucida Sans Unicode", "Lucida Grande", Arial, sans-serif; +} +* { margin: 0; outline: none; } +p {padding-bottom:18px;} +ul {margin-bottom:24px;} +.sf-menu, .blog-post .comments, #respond input#submit {font-family: 'BebasNeueRegular', arial, serif;} +#randomdiv {font-family: "Lucida Sans Unicode", "Lucida Grande", Arial, sans-serif;} +h1, h2, h3, h4, h5, h6, .sub-navigation, #next_link2, #previous_link2, .prev_link a, .next_link a, form#contactform input.submit-form {text-transform:uppercase; font-weight:normal; font-family: 'BebasNeueRegular', arial, serif;} +h1 a, h2 a, h3 a, h4 a, h5 a, h6 a { text-decoration:none; } +h1 { font-size:42px; line-height:38px; margin-bottom:3px;} +h2 { font-size:35px; line-height:32px; margin-bottom:2px;} +h3 { font-size:27px; line-height:24px; margin-bottom:2px; } +h4 { font-size:24px; line-height:22px; margin-bottom:2px;} +h5 {font-size:18px; line-height:19px; margin-bottom:2px;} +h6 {font-size:14px; line-height:24px; margin-bottom:2px;} +iframe {border:0px; margin:0px; padding:0px; } +img.noborder {border:none !important;} +#bg { position: fixed; top: 0; left: 0; } +.bgwidth { width: 100%; } +.bgheight { height: 100%; } +.center-align {text-align:center;} +.left-align {text-align:left;} +.right-align {text-align:right;} +.alignright {float:right; margin:0 0 10px 10px;} +.alignleft {float:left; margin:0 10px 10px 0;} +.aligncenter { text-align:center; display: block; margin:4px auto 10px auto;} + +.bypostauthor {} +.sticky {} +.wp-caption {} +.wp-caption-text {} +.gallery-caption {} + + +/* Generated by Font Squirrel (http://www.fontsquirrel.com) on May 27, 2011 05:06:46 PM America/New_York */ +@font-face { + font-family: 'BebasNeueRegular'; + src: url('../bebas-neue/BebasNeue-webfont.eot'); + src: url('../bebas-neue/BebasNeue-webfont.eot?#iefix') format('embedded-opentype'), + url('../bebas-neue/BebasNeue-webfont.woff') format('woff'), + url('../bebas-neue/BebasNeue-webfont.ttf') format('truetype'), + url('../bebas-neue/BebasNeue-webfont.svg#BebasNeueRegular') format('svg'); + font-weight: normal; + font-style: normal; + +} + +/* BODY LINK COLOUR AND MISC COLORS */ +body, a, .side-barheading h2, ul.sub-navigation li a, .content-heading h5, .content-heading h6 {color:#515151;} /* Dark Grey Color for Links and some Headings Default: #515151 */ + +a:hover {color:#000;} /* Main hover link color */ +#footer, #footer a {color:#fff;} /* Footer Text and Link Color Default #fff */ +#footer a:hover {color:#e7e7e7;} /* Footer Link Hover Color Default #e7e7e7 */ +.sf-menu a, .sf-menu a:visited { color: #fff;} /* Color for the Navigation link Default #fff */ +.light-fonts, .light-fonts h1, .light-fonts a, .light-fonts h1, .navigation-menu h1 {color:#fff;} /* .light-fonts class Font Color Default #fff*/ +.light-fonts a:hover {color:#e7e7e7;} /* .light-fonts class Link Font Color Default #e7e7e7 */ +.custom-color {color:#fcc73c;} /* Custom Color Orange Used in Space Template Index Page Default #fcc73c */ + + + + + +/* CAROUSEL and SCROLL HEIGHTS */ +.content-container .list_carousel li { height:292px;} /* Default Carousel Container Height */ +.portfolio-carousel ul li {height:290px !important;} /* Portfolio Carousel Image Gallery Height */ +.content-container .news_carousel li { height:356px;} /* Latest Carousel News Regular Height */ +.news_carousel .scroll-pane { height:315px;} /* Latest News Carousel Scrolling Height */ + + +/* MENU AND NAVIGATION POSITIONING AND WIDTH */ +#featured { position: relative; float:right;} +#left-container { float:left; width:270px; position:relative; } +.navigation-menu {width:180px; z-index:16; position:relative; top:0; } +.side-barheading {width:180px; z-index:5; position:absolute; right:0; top:170px; } +.logo-menu {text-align:center; position:relative; top:0; z-index:15; } +.bottom-box .logo-menu {margin-bottom:65px;} +.top-box { position:absolute; top:0px; right:0px; } +.bottom-box {position:absolute; bottom:0px; right:0px; } +.hover-box {padding:6px 15px 2px 15px; } +.navigation-menu h1 {font-size:14px; margin:0px; line-height:17px; } +.navigation-menu h1:hover {cursor:pointer;} +ul.sub-navigation {width:650px; margin:5px 0 -25px 0; } +ul.sub-navigation li {display:inline;} +ul.sub-navigation li a {margin-right:25px; font-size:18px; text-decoration:none;} +.logo-menu a img {margin-bottom:-5px;} + +/* MAIN STYLES */ +#box-container {position:absolute; width:100%; top:50%;} +.content-container {float:right; display:inline-block; width:650px; padding:60px 50px 0px 0px; position:relative; z-index:5;} +#page-wrap { position: relative; width:980px; margin:0 auto; } +#container {background:white; width:980px; margin-bottom:5px; } +.featured-heading {margin:145px 180px 0 0; text-align:right; } +.featured-text {width:200px; float:right; margin-right:50px;} +.featured-heading2 {margin:120px 180px 0 0; text-align:right; } +.content-heading {padding-left:25px; width:625px; overflow:hidden;} +.latest-news-heading {float:left; position:absolute; left:0px; top:75px; z-index:25; } +blockquote {font-style:italic; line-height:22px; font-size:13px; color:#626262; background:url(../images/blockquote.png) 15px 9px no-repeat; padding:5px 0 0 50px; margin-bottom:20px;} +.content-container ul, .content-container ol {padding-bottom:18px;} +.content-container ul.checkmark li { margin-left:0px; background:url(../images/checkmark.png) 0px 4px no-repeat; padding:0 0 2px 20px; list-style:none;} +.content-container ul.arrow li { margin-left:0px; background:url(../images/sidebar-arrow.png) 0px 4px no-repeat; padding:0 0 2px 20px; list-style:none;} +.content-container ul li {list-style:disc; margin-left:20px;} +.content-container ol li {list-style:decimal; margin-left:23px;} +a.button, a.big-button {font-family: Arial, sans-serif; display: inline-block; text-decoration: none; line-height: 1; border-radius: 4px; -moz-border-radius: 4px; padding: 10px 19px 11px 19px;} +a.button {font-size:12px; font-weight:bold; color:#858585; background: #f6f6f6 url(../images/big-button-overlay.png) top left repeat-x; -moz-box-shadow: 0 1px 3px #ccc; -webkit-box-shadow: 0 1px 3px #ccc box-shadow:0 1px 3px #ccc; border-bottom: 1px solid #b8b8b8; position: relative; cursor: pointer;} +a.button:hover {background-color:#fff; color:#787878;} +a.big-button {font-size:14px; font-weight:bold; color:#fff; background: #434343 url(../images/big-button-overlay.png) top left repeat-x; -webkit-border-radius: 4px; -moz-box-shadow: 0 1px 4px #999; -webkit-box-shadow: 0 1px 4px #999; box-shadow:0 1px 4px #999; border-bottom: 1px solid #343434; position: relative; cursor: pointer; } +a.big-button:hover {background-color:#373737; color:#fff;} +table {border:1px solid #ccc; background:#ecebeb; width:100%; margin:8px 0 0 0; } +table td {padding:8px; border:1px solid #d6d6d6;} +table thead th {border:1px solid #ccc;} +table thead {background:#dadada;} +table tfoot td {padding:5px;} +table thead th {padding:8px 0 8px 0;} +table .t-headings {font-weight:bold; font-size:115%; background:#dadada;} +table .t-footer {background:#e1e1e1; text-align:center; font-size:90%; font-style:italic;} +.team-member {padding:10px 0 10px 0;overflow:hidden;width:100%;} +.team-member h5 {margin-bottom:3px; padding-top:5px;} +.team-member img {margin-right:15px; float:left;} +.divider {border-bottom:1px solid #b7b7b7; color:#9f9f9f; margin-bottom:30px; padding-bottom:10px;} +.content-container h1#error404 {padding:165px 0px 0px 85px;} +.page-header {padding-bottom:10px;} + +/* BLOG SECTION STYLES */ + +.blog-post {width:585px; overflow:hidden; margin-right:15px;} +.blog-post .blog-image {float:left; margin-right:25px; margin-bottom:18px;} +.post-heading { overflow:hidden; padding-bottom:5px; } +.blog-post .post-data {font-size:11px; float:left;} +.post-data h3 {margin-bottom:5px;} +.blog-post .comments {position:absolute; right:12px; text-align:center; width:31px; height:34px; font-size:15px; } +.blog-post .comments a {color:#949494; margin-top:2px; background:url(../images/blog-comments.png) 0px 0px no-repeat; display:block; width:32px; height:28px; text-decoration:none; padding-top:6px;} +.blog-post .comments a:hover {color:#6a6a6a; background:url(../images/blog-comments.png) 0px -34px no-repeat;} +.type-portfolio .post-heading .comments {display:none;} + +.comment-author, .comment-author cite {font-style:normal; padding-bottom:2px; font-size:12px;} +span.fn {font-size:14px;} +.comment-meta {font-size:10px; margin-bottom:4px;} +.comment-meta a {text-decoration:none;} +#reply-title {font-size:22px; line-height:24px;} +#comments ol.commentlist p {padding-bottom:12px;} +.comment-author img.avatar {float:left; margin:0px 15px 24px 0px; position:relative; top:-2px;} +p.form-allowed-tags {font-size:11px; line-height:16px;} +code {font-family: monospace, sans-serif; display:block; padding-top:5px;} + +#comments h2#comments-title {font-size:20px; line-height:24px; margin-bottom:15px;} +#comments ol.commentlist li {list-style:none; margin:0px 0px 15px 0px; padding:0px 0px 0px 0px; border-bottom:1px solid #b7b7b7;} +#reply-title a#cancel-comment-reply-link {font-size:18px; padding-left:5px;} +#comments ol.commentlist li ul.children {margin-bottom:0px; padding-bottom:0px;} +#comments ol.commentlist li ul.children li {margin:0px 0px 0px 0px; padding:15px 0px 0px 50px; border-top:1px solid #b7b7b7; border-bottom:none;} + +.reply a {border:1px solid #4c4c4c; display:inline-block; padding:1px 10px; margin-bottom:15px; font-size:9px; text-decoration:none;} +.reply a:hover {border:1px solid #000; color:#000; -webkit-box-shadow: 0px 0px 4px #6a9ec9; -moz-box-shadow: 0px 2px 4px #6a9ec9; box-shadow: 0px 0px 4px #6a9ec9;} +.light-fonts .reply a {border:1px solid #B7B7B7;} +.light-fonts .reply a:hover {border:1px solid #d6d6d6; color:#fff;} +#respond input#submit {border:1px solid #4c4c4c; background:url(../images/none.gif);cursor:pointer; font-size:12px; line-height:1; text-decoration:none !important; width:100px; padding:5px 10px 4px 10px; } +input#submit:hover {background:#000; color:#000; -webkit-box-shadow: 0px 0px 4px #6a9ec9; -moz-box-shadow: 0px 2px 4px #6a9ec9; box-shadow: 0px 0px 4px #6a9ec9;} +.light-fonts #respond input#submit {border-color:#B7B7B7; color:#fff;} +.light-fonts #respond input#submit:hover {border-color:#d6d6d6; color:#fff;} +#respond span.required {color:red; position:relative; right:2px; } +label {vertical-align:top;} +input:focus, textarea:focus { border: 1px solid #bddae3; -webkit-box-shadow: 0px 0px 4px #6a9ec9; -moz-box-shadow: 0px 2px 4px #6a9ec9; box-shadow: 0px 0px 4px #6a9ec9;} + +#respond label {font-size:11px;} +#respond input, #respond textarea { background:url(../images/none.gif); border-style:solid; border-width:1px; font-size:13px; padding:4px; border-color:#4c4c4c; display:block;} +.light-fonts #respond input, .light-fonts #respond textarea { border-color:#B7B7B7;} +p.comment-form-author, p.comment-form-email, p.comment-form-url, p.comment-form-comment, p.comment-notes {padding-bottom:10px;} + +#author-info {padding-top:15px;} +#author-avatar {float:left; margin:0px 15px 15px 0px;} +#author-description h4 {margin-bottom:7px;} + +/* CONTACT FORM STYLES */ +form#contactform input, form#contactform textarea, #contact-wrapper input.error, #contact-wrapper textarea.error, #contact-wrapper div {color:#515151;} +.light-fonts form#contactform input, .light-fonts form#contactform textarea, .light-fonts #contact-wrapper input.error, .light-fonts #contact-wrapper textarea.error, .light-fonts form#contactform input.submit-form {color:#fff;} +.light-fonts #contact-wrapper p.success {color:#fff; margin-bottom:0px; padding-bottom:10px;} +#contact-wrapper p.success {color:#00a651; margin-bottom:0px;} +#contact-wrapper .error {color:#888;} +.light-fonts #contact-wrapper div {color:#ccc;} +body.contact-body {background:transparent !important; } +.contact-form #social-icons {float:none; position:absolute; bottom:0px; right:0px;} +.contact-details {border-right:1px solid #888; margin:25px 40px 25px 25px; font-size:13px;} +.contact-form {margin:25px 0 25px 0; } +#contact-wrapper { width:290px; overflow:hidden; display:block; font-size:13px;} +#contact-wrapper div { clear:both; font-size:11px;} +#contact-wrapper label { display:block; float:right; width:auto; position:relative; right:35px; top:5px; } +form#contactform textarea {float:none !important; margin-bottom:9px !important;} +#contact-wrapper .error { font-style:italic; margin-bottom:2px; margin-top:2px; font-size:10px; float:left; right:0px; top:0px;} +#contact-wrapper input.error {font-size:12px; font-style:normal; margin-top:0px;} +form#contactform input { width:205px; } + +.light-fonts form#contactform input, .light-fonts form#contactform textarea, .light-fonts form#contactform input.submit-form {border-color:#B7B7B7;} +form#contactform input, form#contactform textarea, form#contactform input.submit-form {border-color:#4c4c4c;} +form#contactform input, form#contactform textarea { font-family: "Lucida Sans Unicode", "Lucida Grande", Arial, sans-serif; font-size:12px; float:left; margin-bottom:15px; background:url(../images/none.gif); border-style:solid; border-width:1px; padding:4px; } +form#contactform input.submit-form {color:#555; cursor:pointer; display:inline-block; font-size:12px; line-height:1; text-decoration:none !important; width:100px; padding:5px 11px 4px 11px; } +form#contactform input.submit-form:hover {color:#000; border-color:#000; -webkit-box-shadow: 0px 0px 4px #6a9ec9; -moz-box-shadow: 0px 0px 4px #6a9ec9; box-shadow: 0px 0px 4px #6a9ec9;} +.light-fonts form#contactform input.submit-form:hover {color:#fff; border-color:#d6d6d6; -webkit-box-shadow: 0px 0px 4px #6a9ec9; -moz-box-shadow: 0px 0px 4px #6a9ec9; box-shadow: 0px 0px 4px #6a9ec9;} + +/* CONTACT FORM 7 STYLES */ +.wpcf7 input, .wpcf7 textarea { background:url(../images/none.gif); border-style:solid; border-width:1px; font-size:13px; padding:4px; border-color:#4c4c4c; display:block; } +.light-fonts .wpcf7 input, .light-fonts .wpcf7 textarea { border-color:#B7B7B7; color:#fff;} +.wpcf7 p {padding-bottom:10px; font-size:11px;} +.wpcf7-submit {cursor:pointer;} +.wpcf7-submit:hover { color:#000; border-color:#000; -webkit-box-shadow: 0px 0px 4px #6a9ec9; -moz-box-shadow: 0px 0px 4px #6a9ec9; box-shadow: 0px 0px 4px #6a9ec9;} +.light-fonts .wpcf7-submit:hover {color:#fff; border-color:#d6d6d6; } + + +/* FOOTER STYLES */ +#footer {width:980px; overflow:hidden; font-size:10px;} +#social-icons {float:left; padding:3px 0px 0px 1px;} +#social-icons img {margin-right:2px;} +#copyright {float:right; text-align:right; padding-right:2px;} + + + +/* CAROUSEL STYLES */ +.list_carousel, .portfolio_carousel, .news_carousel { + margin: 0; + width: 600px; +} +.list_carousel ul, .portfolio_carousel ul, .news_carousel ul { + width: 600px; + margin: 0; + padding: 0; + list-style: none; + display: block; +} +.portfolio-carousel ul li { + text-align:center !important; +} +.content-container .list_carousel li { + width: 570px; + padding: 0; + margin:0 0 0 30px; + display: block; + float: left; +} +.news_carousel .scroll-pane { + width:370px; + float:none; + overflow: auto; + margin:0px; + padding:0 8px 0 0; +} + +.news_carousel .news-post { + width:370px; + padding:25px; + background:#fff; + color:#888; + display:block; +} +.news_carousel .pagination {margin-top:7px;} + +.content-container .news_carousel li { + width: 475px; + padding: 0; + margin:0 0 0 125px; + display: block; + float: left; + list-style:none; +} +.date-stamp h1, .date-stamp h2, .date-stamp h3, .date-stamp h5, .date-stamp h4, .date-stamp h6 {} +.date-stamp {} +.news_carousel .news-post a {color:#515151;} +.news_carousel .news-post a:hover {color:#000;} +.content-container .portfolio_carousel li a { display:block; height:210px; width:135px; text-decoration:none; color:#888;} +.content-container .portfolio_carousel li a:hover {background:#282828;} +.content-container .portfolio_carousel li a:hover img, .thumbnails a:hover img { + opacity: 0.8; + filter: alpha(opacity=80); + -webkit-transition: opacity .5s ease-in-out; + -moz-transition: opacity .5s ease-in-out; + -o-transition: opacity .5s ease-in-out; + transition: opacity .5s ease-in-out; +} + +.content-container .portfolio_carousel li { + width: 135px; + height:210px; + padding: 0; + margin:0 15px 0 0; + display: block; + float: left; + background:#222; + color:#888; + font-size:10px; +} +.content-container .portfolio_carousel .description {padding:12px;} +.content-container .portfolio_carousel li h5, .content-container .portfolio_carousel li h6, .content-container .portfolio_carousel li h4 { + color:#fff; +} +.content-container .portfolio_carousel li a {} +.clearfix { + float: none; + clear: both; +} +.prev_link a { + float: left; + margin-left: 10px; + padding-top:5px; +} +.next_link a { + float: right; + margin-right: 10px; + padding-top:5px; +} + +a.next.disabled, a.prev.disabled, a.next.disabled span, a.prev.disabled span { + cursor:default; + color:#ccc !important; +} + + +#previous_link2 { + float: left; + margin-left: 10px; + padding-top:5px; +} +#next_link2 { + float: right; + margin-right: 10px; + padding-top:5px; +} +a#previous_link2-arrow, a#next_link2-arrow { + background:url(../images/arrow-navigation.png) top left no-repeat; + width:20px; + text-indent:-9999px; + display:block; + margin-top:15px; +} +a#next_link2-arrow {background-position: top right !important;} + +a#previous_link2-arrow.disabled, a#next_link2-arrow.disabled { + opacity:0.4; + filter: alpha(opacity=40); +} +a#next_link2, a#previous_link2 {text-decoration:none; font-size:13px;} +a#previous_link2 span {padding-left:5px;} + + +.prev_link a, .next_link a { + background:url(../images/arrow-navigation.png) top left no-repeat; + width:20px; + text-indent:-9999px; + display:block; + margin-top:15px; +} +.next_link a {background-position: top right !important;} + +.prev_link a.disabled, .next_link a.disabled { + opacity:0.4; + filter: alpha(opacity=40); +} + +.pagination {text-align:center; padding-top:5px; width:300px; margin:0 auto;} + +.pagination a { + background: url(../images/orbit/bullets2.png) no-repeat top left; + width: 10px; + height: 10px; + overflow: hidden; + display:inline-block; + cursor: pointer; + margin-left: 5px; +} + +.pagination a.selected { + color: #222; + background-position: top right; +} +.pagination a span { + display:none; + } +.next_link a, .prev_link a {text-decoration:none; font-size:13px;} +.next_link a span {padding-right:5px;} +.prev_link a span {padding-left:5px;} + + + +/* COLUMN LAYOUTS */ +.column-container {width:100%; overflow:hidden;} +.col_1_1,.col_1_2,.col_2_2,.col_1_3,.col_2_3,.col_3_3,.col_1-2_3,.col_2-3_3,.col_1_4,.col_2_4,.col_3_4,.col_4_4,.col_1-2_4,.col_2-3_4,.col_3-4_4,.col_1-3_4,.col_2-4_4,.col_1_5,.col_2_5,.col_3_5,.col_4_5,.col_5_5,.col_1-2_5,.col_2-3_5,.col_3-4_5,.col_4-5_5,.col_1-3_5,.col_2-4_5,.col_3-5_5,.col_1-4_5,.col_2-5_5{float:left;display:inline;overflow:hidden;} +* html .col_1_1,* html .col_1_2,* html .col_2_2,* html .col_1_3,* html .col_2_3,* html .col_3_3,* html .col_1-2_3,* html .col_2-3_3,* html .col_1_4,* html .col_2_4,* html .col_3_4,* html .col_4_4,* html .col_1-2_4,* html .col_2-3_4,* html .col_3-4_4,* html .col_1-3_4,* html .col_2-4_4,* html .col_1_5,* html .col_2_5,* html .col_3_5,* html .col_4_5,* html .col_5_5,* html .col_1-2_5,* html .col_2-3_5,* html .col_3-4_5,* html .col_4-5_5,* html .col_1-3_5,* html .col_2-4_5,* html .col_3-5_5,* html .col_1-4_5,* html .col_2-5_5{margin-left:-.04em;} +.col_1_1{width:100%;} +.col_1_2,.col_2_2{width:50%;} +.col_1_3,.col_2_3,.col_3_3{width:33.33%;} +.col_1-2_3,.col_2-3_3{width:66.66%;} +.col_1_4,.col_2_4,.col_3_4,.col_4_4{width:25%;} +.col_1-2_4,.col_2-3_4,.col_3-4_4{width:50%;} +.col_1-3_4,.col_2-4_4{width:75%;} +.col_1_5,.col_2_5,.col_3_5,.col_4_5,.col_5_5{width:20%;} +.col_1-2_5,.col_2-3_5,.col_3-4_5,.col_4-5_5{width:40%;} +.col_1-3_5,.col_2-4_5,.col_3-5_5{width:60%;} +.col_1-4_5,.col_2-5_5{width:80%;} +.content{padding:0 10px;overflow:hidden;} +.col_1_2 .content,.col_1_3 .content,.col_1-2_3 .content,.col_1_4 .content,.col_1-2_4 .content,.col_1-3_4 .content,.col_1_5 .content,.col_1-2_5 .content,.col_1-3_5 .content,.col_1-4_5 .content,.col_1-2_5 .content,.col_1-3_5 .content,.col_1-4_5 .content{padding-left:0;} +.col_2_2 .content,.col_3_3 .content,.col_2-3_3 .content,.col_4_4 .content,.col_3-4_4 .content,.col_2-4_4 .content,.col_5_5 .content,.col_4-5_5 .content,.col_3-5_5 .content,.col_2-5_5 .content,.col_4-5_5 .content,.col_3-5_5 .content,.col_2-5_5 .content{padding-right:0;} +.clear, .clearboth {clear:both;display:block;overflow:hidden;visibility:hidden;width:0;height:0;} + +.last {padding-right:0px !important; padding-left: 0px !important;} + + +/* + * CSS Styles that are needed by jScrollPane for it to operate correctly. + * + * Include this stylesheet in your site or copy and paste the styles below into your stylesheet - jScrollPane + * may not operate correctly without them. + */ + + /* Styles specific to this particular page */ +.scroll-pane +{ + width: 600px; + float:right; + overflow: auto; + margin-top:14px; + padding:0 8px 0 0; +} + +.list_carousel .scroll-pane, .portfolio_carousel .scroll-pane {width:570px; float:none; margin:0px; } + +.horizontal-only +{ + height: auto; + max-height: 200px; +} + +.jspContainer +{ + overflow: hidden; + position: relative; +} + +.jspPane +{ + position: absolute; +} + +.jspVerticalBar +{ + position: absolute; + top: 0; + right: 0; + width: 7px; + height: 100%; + background: red; +} + +.jspHorizontalBar +{ + position: absolute; + bottom: 0; + left: 0; + width: 100%; + height: 16px; + background: red; +} + +.jspVerticalBar *, +.jspHorizontalBar * +{ + margin: 0; + padding: 0; +} + +.jspCap +{ + display: none; +} + +.jspHorizontalBar .jspCap +{ + float: left; +} + +.jspTrack +{ + background: #ccc; + position: relative; +} + +.jspDrag +{ + position: relative; + top: 0; + left: 0; + cursor: pointer; +} + +.jspHorizontalBar .jspTrack, +.jspHorizontalBar .jspDrag +{ + float: left; + height: 100%; +} + +.jspArrow +{ + background: #50506d; + text-indent: -20000px; + display: block; + cursor: pointer; +} + +.jspArrow.jspDisabled +{ + cursor: default; + background: #80808d; +} + +.jspVerticalBar .jspArrow +{ + height: 16px; +} + +.jspHorizontalBar .jspArrow +{ + width: 16px; + float: left; + height: 100%; +} + +.jspVerticalBar .jspArrow:focus +{ + outline: none; +} + +.jspCorner +{ + background: #eeeef4; + float: left; + height: 100%; +} + +/* Yuk! CSS Hack for IE6 3 pixel bug :( */ +* html .jspCorner +{ + margin: 0 -3px 0 0; +} diff --git a/src/wp-content/themes/Broadside/footer.php b/src/wp-content/themes/Broadside/footer.php new file mode 100644 index 0000000..bfc5fb4 --- /dev/null +++ b/src/wp-content/themes/Broadside/footer.php @@ -0,0 +1,146 @@ + + + + + + + + + + + + + + + + + + + + + + '; ?> + + '; ?> + + + \ No newline at end of file diff --git a/src/wp-content/themes/Broadside/framework/bootstrap.php b/src/wp-content/themes/Broadside/framework/bootstrap.php new file mode 100644 index 0000000..168177c --- /dev/null +++ b/src/wp-content/themes/Broadside/framework/bootstrap.php @@ -0,0 +1,4 @@ + \ No newline at end of file diff --git a/src/wp-content/themes/Broadside/framework/metaboxes.php b/src/wp-content/themes/Broadside/framework/metaboxes.php new file mode 100644 index 0000000..f449cbf --- /dev/null +++ b/src/wp-content/themes/Broadside/framework/metaboxes.php @@ -0,0 +1,127 @@ +add_meta_box('post_options', 'Post Options', 'post'); + $this->add_meta_box('page_options', 'Page Options', 'page'); + $this->add_meta_box('portfolio_options', 'Portfolio Options', 'portfolio'); + //$this->add_meta_box('team_options', 'Team Options', 'team'); + } + + public function add_meta_box($id, $label, $post_type) + { + add_meta_box( + 'pyre_' . $id, + __($label, 'Avenue'), + array($this, $id), + $post_type + ); + } + + public function save_meta_boxes($post_id) + { + if(defined( 'DOING_AUTOSAVE') && DOING_AUTOSAVE) { + return; + } + + foreach($_POST as $key => $value) { + update_post_meta($post_id, $key, $value); + } + } + + public function post_options() + { + include 'views/metaboxes/style.php'; + include 'views/metaboxes/post_options.php'; + } + + public function page_options() + { + include 'views/metaboxes/style.php'; + include 'views/metaboxes/page_options.php'; + } + + public function portfolio_options() + { + include 'views/metaboxes/style.php'; + include 'views/metaboxes/portfolio_options.php'; + } + + public function text($id, $label, $desc, $html = '') + { + global $post; + + $html .= '
    '; + $html .= ''; + $html .= '
    '; + $html .= ''; + if($desc) { + $html .= '

    ' . $desc . '

    '; + } + $html .= '
    '; + $html .= '
    '; + + echo $html; + } + + public function textarea($id, $label, $desc, $html = '') + { + global $post; + + $html .= '
    '; + $html .= ''; + $html .= '
    '; + $html .= ''; + if($desc) { + $html .= '

    ' . $desc . '

    '; + } + $html .= '
    '; + $html .= '
    '; + + echo $html; + } + + public function select($id, $label, $options, $desc, $html = '') + { + global $post; + + $html .= '
    '; + $html .= ''; + $html .= '
    '; + $html .= ''; + if($desc) { + $html .= '

    ' . $desc . '

    '; + } + $html .= '
    '; + $html .= '
    '; + + echo $html; + } + +} + +$metaboxes = new PyreThemeFrameworkMetaboxes; \ No newline at end of file diff --git a/src/wp-content/themes/Broadside/framework/views/metaboxes/page_options.php b/src/wp-content/themes/Broadside/framework/views/metaboxes/page_options.php new file mode 100644 index 0000000..46b7ce0 --- /dev/null +++ b/src/wp-content/themes/Broadside/framework/views/metaboxes/page_options.php @@ -0,0 +1,49 @@ +
    +select( 'font_color', + 'Font Color', + array('light' => 'Light', 'dark' => 'Dark'), + '' + ); +?> +textarea( 'background_images', + 'Background Image(s)', + 'Add link(s) to background image separated by a comma but no spaces.' + ); +?> +text( 'heading_sub', + 'Sub-headline', + '' + ); +?> +text( 'heading_1', + 'Sidebar Headline', + '' + ); +?> +text( 'heading_2', + 'Sidebar Sub-headline', + '' + ); +?> +term_id] = $type->name; + } +} + +if($types) { +$this->select( 'portfolio_type', + 'Portfolio Type', + $types_array, + 'Note: Portfolio Type only applies on Portfolio Page Templates. See documentation for details.' + ); +} +?> +
    \ No newline at end of file diff --git a/src/wp-content/themes/Broadside/framework/views/metaboxes/portfolio_options.php b/src/wp-content/themes/Broadside/framework/views/metaboxes/portfolio_options.php new file mode 100644 index 0000000..d5d91ec --- /dev/null +++ b/src/wp-content/themes/Broadside/framework/views/metaboxes/portfolio_options.php @@ -0,0 +1,6 @@ +text( 'video_link', + 'Video Player Link', + 'Use the video embed link without any code. Example: http://player.vimeo.com/video/22884674' + ); +?> \ No newline at end of file diff --git a/src/wp-content/themes/Broadside/framework/views/metaboxes/post_options.php b/src/wp-content/themes/Broadside/framework/views/metaboxes/post_options.php new file mode 100644 index 0000000..c316b1f --- /dev/null +++ b/src/wp-content/themes/Broadside/framework/views/metaboxes/post_options.php @@ -0,0 +1,2 @@ +
    +
    \ No newline at end of file diff --git a/src/wp-content/themes/Broadside/framework/views/metaboxes/style.php b/src/wp-content/themes/Broadside/framework/views/metaboxes/style.php new file mode 100644 index 0000000..00efc6b --- /dev/null +++ b/src/wp-content/themes/Broadside/framework/views/metaboxes/style.php @@ -0,0 +1,10 @@ + \ No newline at end of file diff --git a/src/wp-content/themes/Broadside/functions.php b/src/wp-content/themes/Broadside/functions.php new file mode 100644 index 0000000..72c6cb8 --- /dev/null +++ b/src/wp-content/themes/Broadside/functions.php @@ -0,0 +1,170 @@ + array( + 'name' => 'Portfolio', + 'singular_name' => 'Portfolio' + ), + 'public' => true, + 'has_archive' => true, + 'rewrite' => array('slug' => 'portfolio'), + 'supports' => array('title', 'editor', 'thumbnail'), + 'can_export' => true, + ) + ); + + register_taxonomy('type', 'portfolio', array('hierarchical' => true, 'label' => 'Type', 'query_var' => true, 'rewrite' => true)); + +} + + +function get_progression($args) { + $output = get_option('admin_email'); + return apply_filters('get_progression', $output); +} + + + +// Include boostrap file for the pyre theme framework +include_once('framework/bootstrap.php'); + +if ( ! function_exists( 'twentyeleven_comment' ) ) : +/** + * Template for comments and pingbacks. + * + * To override this walker in a child theme without modifying the comments template + * simply create your own twentyeleven_comment(), and that function will be used instead. + * + * Used as a callback by wp_list_comments() for displaying the comments. + * + * @since Twenty Eleven 1.0 + */ +function twentyeleven_comment( $comment, $args, $depth ) { + $GLOBALS['comment'] = $comment; + switch ( $comment->comment_type ) : + case 'pingback' : + case 'trackback' : + ?> +
  • +

    ', '' ); ?>

    + +
  • id="li-comment-"> +
    +
    +
    + comment_parent ) + $avatar_size = 39; + + echo get_avatar( $comment, $avatar_size ); + + /* translators: 1: comment author, 2: date and time */ + printf( __( '%1$s on %2$s said:', 'twentyeleven' ), + sprintf( '%s', get_comment_author_link() ), + sprintf( '', + esc_url( get_comment_link( $comment->comment_ID ) ), + get_comment_time( 'c' ), + /* translators: 1: date, 2: time */ + sprintf( __( '%1$s at %2$s', 'twentyeleven' ), get_comment_date(), get_comment_time() ) + ) + ); + ?> + + ', '' ); ?> +
    + + comment_approved == '0' ) : ?> + +
    + + +
    + +
    + +
    + __( 'Reply ', 'twentyeleven' ), 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?> +
    +
    + + + + + + +> + + + <?php echo of_get_option('home_title'); ?> + + <?php bloginfo('name'); ?> <?php wp_title(' - ', true, 'left'); ?> + + + + + + + + + + + + + + + + + '; ?> + /* MAIN CONTAINER HEIGHT SIZE */ + #container, #left-container, #featured, #featured div { height:px; } + #featured { margin-top:-px;} + #box-container {height:px; margin-top:-px; } /* Margin-top is half of the total height */ + + /* MAIN HIGHLIGHTED COLOUR FOR HEADINGS */ + h1, h2, h3, h4, h5, h6, ul.sub-navigation li a:hover, ul.sub-navigation li.current-menu-item a, ul.sub-navigation li.current_page_item a, a.prev span, a.next span, a.prev:hover, a.next:hover, .light-fonts .content-heading h5, .light-fonts .content-heading h6 {color:;} + + /* MAIN BACKGROUND COLOUR FOR MENU AND LOGO */ + .logo-menu, .navigation-menu, .sf-vertical li, .jspDrag {background-color:;} + .sf-menu .current-menu-item a, .sf-menu a:hover, .sf-menu .current-menu-item .sliding-element a:hover {background: url(/images/nav-arrow.png) 0px 5px no-repeat;} + '; ?> + + + '; ?> + + '; ?> + + + + '; ?> + + '; ?> + + + + + + + + + + + + + + + + + + + + +ID, 'pyre_font_color', true) == 'light') { + $class = 'light-fonts'; +} +$page_for_posts = get_option('page_for_posts'); +if((is_home() || is_single()) && get_option('page_for_posts') && get_post_meta($page_for_posts, 'pyre_font_color', true) == 'light') { + $class = 'light-fonts'; +} +?> + +" id="bg" alt="background"> + +
    +
    + +
    + +
    + +
    -box"> + +
    + + + + +
    + +
    + + +

    + +
    + + + + ID; ?> + +
    + +
    + + +

    + +
    + + + +
    -box"> + +
    + +
    +
    \ No newline at end of file diff --git a/src/wp-content/themes/Broadside/homepage.php b/src/wp-content/themes/Broadside/homepage.php new file mode 100644 index 0000000..42b9006 --- /dev/null +++ b/src/wp-content/themes/Broadside/homepage.php @@ -0,0 +1,18 @@ + +
    + + + + +
    + \ No newline at end of file diff --git a/src/wp-content/themes/Broadside/images/1col.png b/src/wp-content/themes/Broadside/images/1col.png new file mode 100644 index 0000000..32bddc1 Binary files /dev/null and b/src/wp-content/themes/Broadside/images/1col.png differ diff --git a/src/wp-content/themes/Broadside/images/2cl.png b/src/wp-content/themes/Broadside/images/2cl.png new file mode 100644 index 0000000..def0bcd Binary files /dev/null and b/src/wp-content/themes/Broadside/images/2cl.png differ diff --git a/src/wp-content/themes/Broadside/images/2cr.png b/src/wp-content/themes/Broadside/images/2cr.png new file mode 100644 index 0000000..2aed4f9 Binary files /dev/null and b/src/wp-content/themes/Broadside/images/2cr.png differ diff --git a/src/wp-content/themes/Broadside/images/arrow-navigation.png b/src/wp-content/themes/Broadside/images/arrow-navigation.png new file mode 100644 index 0000000..cb60989 Binary files /dev/null and b/src/wp-content/themes/Broadside/images/arrow-navigation.png differ diff --git a/src/wp-content/themes/Broadside/images/arrows-ffffff.png b/src/wp-content/themes/Broadside/images/arrows-ffffff.png new file mode 100644 index 0000000..995df52 Binary files /dev/null and b/src/wp-content/themes/Broadside/images/arrows-ffffff.png differ diff --git a/src/wp-content/themes/Broadside/images/background-dark.jpg b/src/wp-content/themes/Broadside/images/background-dark.jpg new file mode 100644 index 0000000..79d1ded Binary files /dev/null and b/src/wp-content/themes/Broadside/images/background-dark.jpg differ diff --git a/src/wp-content/themes/Broadside/images/background.jpg b/src/wp-content/themes/Broadside/images/background.jpg new file mode 100644 index 0000000..7393c20 Binary files /dev/null and b/src/wp-content/themes/Broadside/images/background.jpg differ diff --git a/src/wp-content/themes/Broadside/images/backgrounds/about-background.jpg b/src/wp-content/themes/Broadside/images/backgrounds/about-background.jpg new file mode 100644 index 0000000..76d796e Binary files /dev/null and b/src/wp-content/themes/Broadside/images/backgrounds/about-background.jpg differ diff --git a/src/wp-content/themes/Broadside/images/backgrounds/background-image-600tall.jpg b/src/wp-content/themes/Broadside/images/backgrounds/background-image-600tall.jpg new file mode 100644 index 0000000..c080162 Binary files /dev/null and b/src/wp-content/themes/Broadside/images/backgrounds/background-image-600tall.jpg differ diff --git a/src/wp-content/themes/Broadside/images/backgrounds/background2-image-600tall.jpg b/src/wp-content/themes/Broadside/images/backgrounds/background2-image-600tall.jpg new file mode 100644 index 0000000..ff6f962 Binary files /dev/null and b/src/wp-content/themes/Broadside/images/backgrounds/background2-image-600tall.jpg differ diff --git a/src/wp-content/themes/Broadside/images/backgrounds/background3-image-600tall.jpg b/src/wp-content/themes/Broadside/images/backgrounds/background3-image-600tall.jpg new file mode 100644 index 0000000..cad95a9 Binary files /dev/null and b/src/wp-content/themes/Broadside/images/backgrounds/background3-image-600tall.jpg differ diff --git a/src/wp-content/themes/Broadside/images/backgrounds/background4-image-600tall.jpg b/src/wp-content/themes/Broadside/images/backgrounds/background4-image-600tall.jpg new file mode 100644 index 0000000..c8248cb Binary files /dev/null and b/src/wp-content/themes/Broadside/images/backgrounds/background4-image-600tall.jpg differ diff --git a/src/wp-content/themes/Broadside/images/backgrounds/blog-background-tall.jpg b/src/wp-content/themes/Broadside/images/backgrounds/blog-background-tall.jpg new file mode 100644 index 0000000..741f098 Binary files /dev/null and b/src/wp-content/themes/Broadside/images/backgrounds/blog-background-tall.jpg differ diff --git a/src/wp-content/themes/Broadside/images/backgrounds/blog-background.jpg b/src/wp-content/themes/Broadside/images/backgrounds/blog-background.jpg new file mode 100644 index 0000000..f36b338 Binary files /dev/null and b/src/wp-content/themes/Broadside/images/backgrounds/blog-background.jpg differ diff --git a/src/wp-content/themes/Broadside/images/backgrounds/company-background.jpg b/src/wp-content/themes/Broadside/images/backgrounds/company-background.jpg new file mode 100644 index 0000000..147d0e2 Binary files /dev/null and b/src/wp-content/themes/Broadside/images/backgrounds/company-background.jpg differ diff --git a/src/wp-content/themes/Broadside/images/backgrounds/contact-background-tall.jpg b/src/wp-content/themes/Broadside/images/backgrounds/contact-background-tall.jpg new file mode 100644 index 0000000..eeea4f1 Binary files /dev/null and b/src/wp-content/themes/Broadside/images/backgrounds/contact-background-tall.jpg differ diff --git a/src/wp-content/themes/Broadside/images/backgrounds/contact-background.jpg b/src/wp-content/themes/Broadside/images/backgrounds/contact-background.jpg new file mode 100644 index 0000000..c032622 Binary files /dev/null and b/src/wp-content/themes/Broadside/images/backgrounds/contact-background.jpg differ diff --git a/src/wp-content/themes/Broadside/images/backgrounds/img_1.jpg b/src/wp-content/themes/Broadside/images/backgrounds/img_1.jpg new file mode 100644 index 0000000..1256e5f Binary files /dev/null and b/src/wp-content/themes/Broadside/images/backgrounds/img_1.jpg differ diff --git a/src/wp-content/themes/Broadside/images/backgrounds/img_2.jpg b/src/wp-content/themes/Broadside/images/backgrounds/img_2.jpg new file mode 100644 index 0000000..1226b38 Binary files /dev/null and b/src/wp-content/themes/Broadside/images/backgrounds/img_2.jpg differ diff --git a/src/wp-content/themes/Broadside/images/backgrounds/img_3.jpg b/src/wp-content/themes/Broadside/images/backgrounds/img_3.jpg new file mode 100644 index 0000000..2ce461b Binary files /dev/null and b/src/wp-content/themes/Broadside/images/backgrounds/img_3.jpg differ diff --git a/src/wp-content/themes/Broadside/images/backgrounds/img_4.jpg b/src/wp-content/themes/Broadside/images/backgrounds/img_4.jpg new file mode 100644 index 0000000..decea22 Binary files /dev/null and b/src/wp-content/themes/Broadside/images/backgrounds/img_4.jpg differ diff --git a/src/wp-content/themes/Broadside/images/backgrounds/news-background-tall.jpg b/src/wp-content/themes/Broadside/images/backgrounds/news-background-tall.jpg new file mode 100644 index 0000000..6427cea Binary files /dev/null and b/src/wp-content/themes/Broadside/images/backgrounds/news-background-tall.jpg differ diff --git a/src/wp-content/themes/Broadside/images/backgrounds/news-background.jpg b/src/wp-content/themes/Broadside/images/backgrounds/news-background.jpg new file mode 100644 index 0000000..fed4853 Binary files /dev/null and b/src/wp-content/themes/Broadside/images/backgrounds/news-background.jpg differ diff --git a/src/wp-content/themes/Broadside/images/backgrounds/portfolio-background.jpg b/src/wp-content/themes/Broadside/images/backgrounds/portfolio-background.jpg new file mode 100644 index 0000000..06333be Binary files /dev/null and b/src/wp-content/themes/Broadside/images/backgrounds/portfolio-background.jpg differ diff --git a/src/wp-content/themes/Broadside/images/backgrounds/projects-background.jpg b/src/wp-content/themes/Broadside/images/backgrounds/projects-background.jpg new file mode 100644 index 0000000..8ed92a3 Binary files /dev/null and b/src/wp-content/themes/Broadside/images/backgrounds/projects-background.jpg differ diff --git a/src/wp-content/themes/Broadside/images/backgrounds/services-background-tall.jpg b/src/wp-content/themes/Broadside/images/backgrounds/services-background-tall.jpg new file mode 100644 index 0000000..9b9fa04 Binary files /dev/null and b/src/wp-content/themes/Broadside/images/backgrounds/services-background-tall.jpg differ diff --git a/src/wp-content/themes/Broadside/images/backgrounds/services-background.jpg b/src/wp-content/themes/Broadside/images/backgrounds/services-background.jpg new file mode 100644 index 0000000..fd6eb10 Binary files /dev/null and b/src/wp-content/themes/Broadside/images/backgrounds/services-background.jpg differ diff --git a/src/wp-content/themes/Broadside/images/big-button-overlay.png b/src/wp-content/themes/Broadside/images/big-button-overlay.png new file mode 100644 index 0000000..bb18bc2 Binary files /dev/null and b/src/wp-content/themes/Broadside/images/big-button-overlay.png differ diff --git a/src/wp-content/themes/Broadside/images/blockquote.png b/src/wp-content/themes/Broadside/images/blockquote.png new file mode 100644 index 0000000..987f5b1 Binary files /dev/null and b/src/wp-content/themes/Broadside/images/blockquote.png differ diff --git a/src/wp-content/themes/Broadside/images/blog-comments.png b/src/wp-content/themes/Broadside/images/blog-comments.png new file mode 100644 index 0000000..c41ed9c Binary files /dev/null and b/src/wp-content/themes/Broadside/images/blog-comments.png differ diff --git a/src/wp-content/themes/Broadside/images/checkmark.png b/src/wp-content/themes/Broadside/images/checkmark.png new file mode 100644 index 0000000..97aafb1 Binary files /dev/null and b/src/wp-content/themes/Broadside/images/checkmark.png differ diff --git a/src/wp-content/themes/Broadside/images/fancybox/blank.gif b/src/wp-content/themes/Broadside/images/fancybox/blank.gif new file mode 100644 index 0000000..35d42e8 Binary files /dev/null and b/src/wp-content/themes/Broadside/images/fancybox/blank.gif differ diff --git a/src/wp-content/themes/Broadside/images/fancybox/fancy_close.png b/src/wp-content/themes/Broadside/images/fancybox/fancy_close.png new file mode 100644 index 0000000..0703530 Binary files /dev/null and b/src/wp-content/themes/Broadside/images/fancybox/fancy_close.png differ diff --git a/src/wp-content/themes/Broadside/images/fancybox/fancy_loading.png b/src/wp-content/themes/Broadside/images/fancybox/fancy_loading.png new file mode 100644 index 0000000..2503017 Binary files /dev/null and b/src/wp-content/themes/Broadside/images/fancybox/fancy_loading.png differ diff --git a/src/wp-content/themes/Broadside/images/fancybox/fancy_nav_left.png b/src/wp-content/themes/Broadside/images/fancybox/fancy_nav_left.png new file mode 100644 index 0000000..ebaa6a4 Binary files /dev/null and b/src/wp-content/themes/Broadside/images/fancybox/fancy_nav_left.png differ diff --git a/src/wp-content/themes/Broadside/images/fancybox/fancy_nav_right.png b/src/wp-content/themes/Broadside/images/fancybox/fancy_nav_right.png new file mode 100644 index 0000000..873294e Binary files /dev/null and b/src/wp-content/themes/Broadside/images/fancybox/fancy_nav_right.png differ diff --git a/src/wp-content/themes/Broadside/images/fancybox/fancy_shadow_e.png b/src/wp-content/themes/Broadside/images/fancybox/fancy_shadow_e.png new file mode 100644 index 0000000..2eda089 Binary files /dev/null and b/src/wp-content/themes/Broadside/images/fancybox/fancy_shadow_e.png differ diff --git a/src/wp-content/themes/Broadside/images/fancybox/fancy_shadow_n.png b/src/wp-content/themes/Broadside/images/fancybox/fancy_shadow_n.png new file mode 100644 index 0000000..69aa10e Binary files /dev/null and b/src/wp-content/themes/Broadside/images/fancybox/fancy_shadow_n.png differ diff --git a/src/wp-content/themes/Broadside/images/fancybox/fancy_shadow_ne.png b/src/wp-content/themes/Broadside/images/fancybox/fancy_shadow_ne.png new file mode 100644 index 0000000..79f6980 Binary files /dev/null and b/src/wp-content/themes/Broadside/images/fancybox/fancy_shadow_ne.png differ diff --git a/src/wp-content/themes/Broadside/images/fancybox/fancy_shadow_nw.png b/src/wp-content/themes/Broadside/images/fancybox/fancy_shadow_nw.png new file mode 100644 index 0000000..7182cd9 Binary files /dev/null and b/src/wp-content/themes/Broadside/images/fancybox/fancy_shadow_nw.png differ diff --git a/src/wp-content/themes/Broadside/images/fancybox/fancy_shadow_s.png b/src/wp-content/themes/Broadside/images/fancybox/fancy_shadow_s.png new file mode 100644 index 0000000..d8858bf Binary files /dev/null and b/src/wp-content/themes/Broadside/images/fancybox/fancy_shadow_s.png differ diff --git a/src/wp-content/themes/Broadside/images/fancybox/fancy_shadow_se.png b/src/wp-content/themes/Broadside/images/fancybox/fancy_shadow_se.png new file mode 100644 index 0000000..541e3ff Binary files /dev/null and b/src/wp-content/themes/Broadside/images/fancybox/fancy_shadow_se.png differ diff --git a/src/wp-content/themes/Broadside/images/fancybox/fancy_shadow_sw.png b/src/wp-content/themes/Broadside/images/fancybox/fancy_shadow_sw.png new file mode 100644 index 0000000..b451689 Binary files /dev/null and b/src/wp-content/themes/Broadside/images/fancybox/fancy_shadow_sw.png differ diff --git a/src/wp-content/themes/Broadside/images/fancybox/fancy_shadow_w.png b/src/wp-content/themes/Broadside/images/fancybox/fancy_shadow_w.png new file mode 100644 index 0000000..8a4e4a8 Binary files /dev/null and b/src/wp-content/themes/Broadside/images/fancybox/fancy_shadow_w.png differ diff --git a/src/wp-content/themes/Broadside/images/fancybox/fancy_title_left.png b/src/wp-content/themes/Broadside/images/fancybox/fancy_title_left.png new file mode 100644 index 0000000..6049223 Binary files /dev/null and b/src/wp-content/themes/Broadside/images/fancybox/fancy_title_left.png differ diff --git a/src/wp-content/themes/Broadside/images/fancybox/fancy_title_main.png b/src/wp-content/themes/Broadside/images/fancybox/fancy_title_main.png new file mode 100644 index 0000000..8044271 Binary files /dev/null and b/src/wp-content/themes/Broadside/images/fancybox/fancy_title_main.png differ diff --git a/src/wp-content/themes/Broadside/images/fancybox/fancy_title_over.png b/src/wp-content/themes/Broadside/images/fancybox/fancy_title_over.png new file mode 100644 index 0000000..d9f458f Binary files /dev/null and b/src/wp-content/themes/Broadside/images/fancybox/fancy_title_over.png differ diff --git a/src/wp-content/themes/Broadside/images/fancybox/fancy_title_right.png b/src/wp-content/themes/Broadside/images/fancybox/fancy_title_right.png new file mode 100644 index 0000000..e36d9db Binary files /dev/null and b/src/wp-content/themes/Broadside/images/fancybox/fancy_title_right.png differ diff --git a/src/wp-content/themes/Broadside/images/fancybox/fancybox-x.png b/src/wp-content/themes/Broadside/images/fancybox/fancybox-x.png new file mode 100644 index 0000000..c2130f8 Binary files /dev/null and b/src/wp-content/themes/Broadside/images/fancybox/fancybox-x.png differ diff --git a/src/wp-content/themes/Broadside/images/fancybox/fancybox-y.png b/src/wp-content/themes/Broadside/images/fancybox/fancybox-y.png new file mode 100644 index 0000000..7ef399b Binary files /dev/null and b/src/wp-content/themes/Broadside/images/fancybox/fancybox-y.png differ diff --git a/src/wp-content/themes/Broadside/images/fancybox/fancybox.png b/src/wp-content/themes/Broadside/images/fancybox/fancybox.png new file mode 100644 index 0000000..65e14f6 Binary files /dev/null and b/src/wp-content/themes/Broadside/images/fancybox/fancybox.png differ diff --git a/src/wp-content/themes/Broadside/images/logo-space.png b/src/wp-content/themes/Broadside/images/logo-space.png new file mode 100644 index 0000000..50251af Binary files /dev/null and b/src/wp-content/themes/Broadside/images/logo-space.png differ diff --git a/src/wp-content/themes/Broadside/images/logo.png b/src/wp-content/themes/Broadside/images/logo.png new file mode 100644 index 0000000..240f8fa Binary files /dev/null and b/src/wp-content/themes/Broadside/images/logo.png differ diff --git a/src/wp-content/themes/Broadside/images/nav-arrow.png b/src/wp-content/themes/Broadside/images/nav-arrow.png new file mode 100644 index 0000000..20d595a Binary files /dev/null and b/src/wp-content/themes/Broadside/images/nav-arrow.png differ diff --git a/src/wp-content/themes/Broadside/images/orbit/arrows-new.png b/src/wp-content/themes/Broadside/images/orbit/arrows-new.png new file mode 100644 index 0000000..e39a65f Binary files /dev/null and b/src/wp-content/themes/Broadside/images/orbit/arrows-new.png differ diff --git a/src/wp-content/themes/Broadside/images/orbit/bullets.jpg b/src/wp-content/themes/Broadside/images/orbit/bullets.jpg new file mode 100644 index 0000000..f3c734f Binary files /dev/null and b/src/wp-content/themes/Broadside/images/orbit/bullets.jpg differ diff --git a/src/wp-content/themes/Broadside/images/orbit/bullets.png b/src/wp-content/themes/Broadside/images/orbit/bullets.png new file mode 100644 index 0000000..8147763 Binary files /dev/null and b/src/wp-content/themes/Broadside/images/orbit/bullets.png differ diff --git a/src/wp-content/themes/Broadside/images/orbit/bullets2.png b/src/wp-content/themes/Broadside/images/orbit/bullets2.png new file mode 100644 index 0000000..1090c4a Binary files /dev/null and b/src/wp-content/themes/Broadside/images/orbit/bullets2.png differ diff --git a/src/wp-content/themes/Broadside/images/orbit/left-arrow.png b/src/wp-content/themes/Broadside/images/orbit/left-arrow.png new file mode 100644 index 0000000..e832021 Binary files /dev/null and b/src/wp-content/themes/Broadside/images/orbit/left-arrow.png differ diff --git a/src/wp-content/themes/Broadside/images/orbit/loading.gif b/src/wp-content/themes/Broadside/images/orbit/loading.gif new file mode 100644 index 0000000..969f505 Binary files /dev/null and b/src/wp-content/themes/Broadside/images/orbit/loading.gif differ diff --git a/src/wp-content/themes/Broadside/images/orbit/mask-black.png b/src/wp-content/themes/Broadside/images/orbit/mask-black.png new file mode 100644 index 0000000..ea62557 Binary files /dev/null and b/src/wp-content/themes/Broadside/images/orbit/mask-black.png differ diff --git a/src/wp-content/themes/Broadside/images/orbit/mask-black2.png b/src/wp-content/themes/Broadside/images/orbit/mask-black2.png new file mode 100644 index 0000000..7582356 Binary files /dev/null and b/src/wp-content/themes/Broadside/images/orbit/mask-black2.png differ diff --git a/src/wp-content/themes/Broadside/images/orbit/pause-black.png b/src/wp-content/themes/Broadside/images/orbit/pause-black.png new file mode 100644 index 0000000..3268f70 Binary files /dev/null and b/src/wp-content/themes/Broadside/images/orbit/pause-black.png differ diff --git a/src/wp-content/themes/Broadside/images/orbit/pause-black2.png b/src/wp-content/themes/Broadside/images/orbit/pause-black2.png new file mode 100644 index 0000000..ebee229 Binary files /dev/null and b/src/wp-content/themes/Broadside/images/orbit/pause-black2.png differ diff --git a/src/wp-content/themes/Broadside/images/orbit/right-arrow.png b/src/wp-content/themes/Broadside/images/orbit/right-arrow.png new file mode 100644 index 0000000..e4e0345 Binary files /dev/null and b/src/wp-content/themes/Broadside/images/orbit/right-arrow.png differ diff --git a/src/wp-content/themes/Broadside/images/orbit/rotator-black.png b/src/wp-content/themes/Broadside/images/orbit/rotator-black.png new file mode 100644 index 0000000..53d9535 Binary files /dev/null and b/src/wp-content/themes/Broadside/images/orbit/rotator-black.png differ diff --git a/src/wp-content/themes/Broadside/images/orbit/rotator-black2.png b/src/wp-content/themes/Broadside/images/orbit/rotator-black2.png new file mode 100644 index 0000000..372792d Binary files /dev/null and b/src/wp-content/themes/Broadside/images/orbit/rotator-black2.png differ diff --git a/src/wp-content/themes/Broadside/images/orbit/timer-black.png b/src/wp-content/themes/Broadside/images/orbit/timer-black.png new file mode 100644 index 0000000..ea62557 Binary files /dev/null and b/src/wp-content/themes/Broadside/images/orbit/timer-black.png differ diff --git a/src/wp-content/themes/Broadside/images/orbit/timer-black2.png b/src/wp-content/themes/Broadside/images/orbit/timer-black2.png new file mode 100644 index 0000000..7582356 Binary files /dev/null and b/src/wp-content/themes/Broadside/images/orbit/timer-black2.png differ diff --git a/src/wp-content/themes/Broadside/images/photo-left.jpg b/src/wp-content/themes/Broadside/images/photo-left.jpg new file mode 100644 index 0000000..1fc7555 Binary files /dev/null and b/src/wp-content/themes/Broadside/images/photo-left.jpg differ diff --git a/src/wp-content/themes/Broadside/images/photo-right.jpg b/src/wp-content/themes/Broadside/images/photo-right.jpg new file mode 100644 index 0000000..3742d70 Binary files /dev/null and b/src/wp-content/themes/Broadside/images/photo-right.jpg differ diff --git a/src/wp-content/themes/Broadside/images/portfolio/blog-img_2.jpg b/src/wp-content/themes/Broadside/images/portfolio/blog-img_2.jpg new file mode 100644 index 0000000..00ff445 Binary files /dev/null and b/src/wp-content/themes/Broadside/images/portfolio/blog-img_2.jpg differ diff --git a/src/wp-content/themes/Broadside/images/portfolio/blog-img_3.jpg b/src/wp-content/themes/Broadside/images/portfolio/blog-img_3.jpg new file mode 100644 index 0000000..f309057 Binary files /dev/null and b/src/wp-content/themes/Broadside/images/portfolio/blog-img_3.jpg differ diff --git a/src/wp-content/themes/Broadside/images/portfolio/blog-img_4.jpg b/src/wp-content/themes/Broadside/images/portfolio/blog-img_4.jpg new file mode 100644 index 0000000..7b68a28 Binary files /dev/null and b/src/wp-content/themes/Broadside/images/portfolio/blog-img_4.jpg differ diff --git a/src/wp-content/themes/Broadside/images/portfolio/blog-post-image.jpg b/src/wp-content/themes/Broadside/images/portfolio/blog-post-image.jpg new file mode 100644 index 0000000..ccbe42a Binary files /dev/null and b/src/wp-content/themes/Broadside/images/portfolio/blog-post-image.jpg differ diff --git a/src/wp-content/themes/Broadside/images/portfolio/contact-filler.jpg b/src/wp-content/themes/Broadside/images/portfolio/contact-filler.jpg new file mode 100644 index 0000000..d3a90c5 Binary files /dev/null and b/src/wp-content/themes/Broadside/images/portfolio/contact-filler.jpg differ diff --git a/src/wp-content/themes/Broadside/images/portfolio/img_1-tall.jpg b/src/wp-content/themes/Broadside/images/portfolio/img_1-tall.jpg new file mode 100644 index 0000000..c080162 Binary files /dev/null and b/src/wp-content/themes/Broadside/images/portfolio/img_1-tall.jpg differ diff --git a/src/wp-content/themes/Broadside/images/portfolio/img_1.jpg b/src/wp-content/themes/Broadside/images/portfolio/img_1.jpg new file mode 100644 index 0000000..1256e5f Binary files /dev/null and b/src/wp-content/themes/Broadside/images/portfolio/img_1.jpg differ diff --git a/src/wp-content/themes/Broadside/images/portfolio/img_2-tall.jpg b/src/wp-content/themes/Broadside/images/portfolio/img_2-tall.jpg new file mode 100644 index 0000000..ff6f962 Binary files /dev/null and b/src/wp-content/themes/Broadside/images/portfolio/img_2-tall.jpg differ diff --git a/src/wp-content/themes/Broadside/images/portfolio/img_2.jpg b/src/wp-content/themes/Broadside/images/portfolio/img_2.jpg new file mode 100644 index 0000000..1226b38 Binary files /dev/null and b/src/wp-content/themes/Broadside/images/portfolio/img_2.jpg differ diff --git a/src/wp-content/themes/Broadside/images/portfolio/img_3-tall.jpg b/src/wp-content/themes/Broadside/images/portfolio/img_3-tall.jpg new file mode 100644 index 0000000..cad95a9 Binary files /dev/null and b/src/wp-content/themes/Broadside/images/portfolio/img_3-tall.jpg differ diff --git a/src/wp-content/themes/Broadside/images/portfolio/img_3.jpg b/src/wp-content/themes/Broadside/images/portfolio/img_3.jpg new file mode 100644 index 0000000..2ce461b Binary files /dev/null and b/src/wp-content/themes/Broadside/images/portfolio/img_3.jpg differ diff --git a/src/wp-content/themes/Broadside/images/portfolio/img_4.jpg b/src/wp-content/themes/Broadside/images/portfolio/img_4.jpg new file mode 100644 index 0000000..decea22 Binary files /dev/null and b/src/wp-content/themes/Broadside/images/portfolio/img_4.jpg differ diff --git a/src/wp-content/themes/Broadside/images/portfolio/img_5.jpg b/src/wp-content/themes/Broadside/images/portfolio/img_5.jpg new file mode 100644 index 0000000..1226b38 Binary files /dev/null and b/src/wp-content/themes/Broadside/images/portfolio/img_5.jpg differ diff --git a/src/wp-content/themes/Broadside/images/portfolio/img_6.jpg b/src/wp-content/themes/Broadside/images/portfolio/img_6.jpg new file mode 100644 index 0000000..1256e5f Binary files /dev/null and b/src/wp-content/themes/Broadside/images/portfolio/img_6.jpg differ diff --git a/src/wp-content/themes/Broadside/images/portfolio/img_7-tall.jpg b/src/wp-content/themes/Broadside/images/portfolio/img_7-tall.jpg new file mode 100644 index 0000000..c8248cb Binary files /dev/null and b/src/wp-content/themes/Broadside/images/portfolio/img_7-tall.jpg differ diff --git a/src/wp-content/themes/Broadside/images/portfolio/img_7.jpg b/src/wp-content/themes/Broadside/images/portfolio/img_7.jpg new file mode 100644 index 0000000..2ce461b Binary files /dev/null and b/src/wp-content/themes/Broadside/images/portfolio/img_7.jpg differ diff --git a/src/wp-content/themes/Broadside/images/portfolio/img_8-tall.jpg b/src/wp-content/themes/Broadside/images/portfolio/img_8-tall.jpg new file mode 100644 index 0000000..4fe0a43 Binary files /dev/null and b/src/wp-content/themes/Broadside/images/portfolio/img_8-tall.jpg differ diff --git a/src/wp-content/themes/Broadside/images/portfolio/img_8.jpg b/src/wp-content/themes/Broadside/images/portfolio/img_8.jpg new file mode 100644 index 0000000..decea22 Binary files /dev/null and b/src/wp-content/themes/Broadside/images/portfolio/img_8.jpg differ diff --git a/src/wp-content/themes/Broadside/images/portfolio/lightbox-thumbnail.jpg b/src/wp-content/themes/Broadside/images/portfolio/lightbox-thumbnail.jpg new file mode 100644 index 0000000..884e30b Binary files /dev/null and b/src/wp-content/themes/Broadside/images/portfolio/lightbox-thumbnail.jpg differ diff --git a/src/wp-content/themes/Broadside/images/portfolio/lightbox.jpg b/src/wp-content/themes/Broadside/images/portfolio/lightbox.jpg new file mode 100644 index 0000000..55c95a8 Binary files /dev/null and b/src/wp-content/themes/Broadside/images/portfolio/lightbox.jpg differ diff --git a/src/wp-content/themes/Broadside/images/portfolio/minigallery_img1.png b/src/wp-content/themes/Broadside/images/portfolio/minigallery_img1.png new file mode 100644 index 0000000..d7f923f Binary files /dev/null and b/src/wp-content/themes/Broadside/images/portfolio/minigallery_img1.png differ diff --git a/src/wp-content/themes/Broadside/images/portfolio/minigallery_img2.png b/src/wp-content/themes/Broadside/images/portfolio/minigallery_img2.png new file mode 100644 index 0000000..d7f923f Binary files /dev/null and b/src/wp-content/themes/Broadside/images/portfolio/minigallery_img2.png differ diff --git a/src/wp-content/themes/Broadside/images/portfolio/minigallery_img3.png b/src/wp-content/themes/Broadside/images/portfolio/minigallery_img3.png new file mode 100644 index 0000000..d7f923f Binary files /dev/null and b/src/wp-content/themes/Broadside/images/portfolio/minigallery_img3.png differ diff --git a/src/wp-content/themes/Broadside/images/portfolio/minigallery_img4.png b/src/wp-content/themes/Broadside/images/portfolio/minigallery_img4.png new file mode 100644 index 0000000..d7f923f Binary files /dev/null and b/src/wp-content/themes/Broadside/images/portfolio/minigallery_img4.png differ diff --git a/src/wp-content/themes/Broadside/images/portfolio/photo-center-thumbnail.jpg b/src/wp-content/themes/Broadside/images/portfolio/photo-center-thumbnail.jpg new file mode 100644 index 0000000..7b5c2ed Binary files /dev/null and b/src/wp-content/themes/Broadside/images/portfolio/photo-center-thumbnail.jpg differ diff --git a/src/wp-content/themes/Broadside/images/portfolio/photo-center.jpg b/src/wp-content/themes/Broadside/images/portfolio/photo-center.jpg new file mode 100644 index 0000000..419ddcd Binary files /dev/null and b/src/wp-content/themes/Broadside/images/portfolio/photo-center.jpg differ diff --git a/src/wp-content/themes/Broadside/images/portfolio/photo-left.jpg b/src/wp-content/themes/Broadside/images/portfolio/photo-left.jpg new file mode 100644 index 0000000..ea3f513 Binary files /dev/null and b/src/wp-content/themes/Broadside/images/portfolio/photo-left.jpg differ diff --git a/src/wp-content/themes/Broadside/images/portfolio/photo-right.jpg b/src/wp-content/themes/Broadside/images/portfolio/photo-right.jpg new file mode 100644 index 0000000..1d9956b Binary files /dev/null and b/src/wp-content/themes/Broadside/images/portfolio/photo-right.jpg differ diff --git a/src/wp-content/themes/Broadside/images/portfolio/portfolio-item1-thumb.jpg b/src/wp-content/themes/Broadside/images/portfolio/portfolio-item1-thumb.jpg new file mode 100644 index 0000000..803afcc Binary files /dev/null and b/src/wp-content/themes/Broadside/images/portfolio/portfolio-item1-thumb.jpg differ diff --git a/src/wp-content/themes/Broadside/images/portfolio/portfolio-item2-thumb.jpg b/src/wp-content/themes/Broadside/images/portfolio/portfolio-item2-thumb.jpg new file mode 100644 index 0000000..55ad67c Binary files /dev/null and b/src/wp-content/themes/Broadside/images/portfolio/portfolio-item2-thumb.jpg differ diff --git a/src/wp-content/themes/Broadside/images/portfolio/portfolio-item3-thumb.jpg b/src/wp-content/themes/Broadside/images/portfolio/portfolio-item3-thumb.jpg new file mode 100644 index 0000000..f56d3da Binary files /dev/null and b/src/wp-content/themes/Broadside/images/portfolio/portfolio-item3-thumb.jpg differ diff --git a/src/wp-content/themes/Broadside/images/portfolio/portfolio-item4-thumb.jpg b/src/wp-content/themes/Broadside/images/portfolio/portfolio-item4-thumb.jpg new file mode 100644 index 0000000..1e3fb1f Binary files /dev/null and b/src/wp-content/themes/Broadside/images/portfolio/portfolio-item4-thumb.jpg differ diff --git a/src/wp-content/themes/Broadside/images/portfolio/portfolio-item5-thumb.jpg b/src/wp-content/themes/Broadside/images/portfolio/portfolio-item5-thumb.jpg new file mode 100644 index 0000000..06b45b3 Binary files /dev/null and b/src/wp-content/themes/Broadside/images/portfolio/portfolio-item5-thumb.jpg differ diff --git a/src/wp-content/themes/Broadside/images/portfolio/portfolio-item6-thumb.jpg b/src/wp-content/themes/Broadside/images/portfolio/portfolio-item6-thumb.jpg new file mode 100644 index 0000000..2825941 Binary files /dev/null and b/src/wp-content/themes/Broadside/images/portfolio/portfolio-item6-thumb.jpg differ diff --git a/src/wp-content/themes/Broadside/images/portfolio/portfolio-item7-thumb.jpg b/src/wp-content/themes/Broadside/images/portfolio/portfolio-item7-thumb.jpg new file mode 100644 index 0000000..1006a60 Binary files /dev/null and b/src/wp-content/themes/Broadside/images/portfolio/portfolio-item7-thumb.jpg differ diff --git a/src/wp-content/themes/Broadside/images/portfolio/portfolio-item8-thumb.jpg b/src/wp-content/themes/Broadside/images/portfolio/portfolio-item8-thumb.jpg new file mode 100644 index 0000000..bfa7f7e Binary files /dev/null and b/src/wp-content/themes/Broadside/images/portfolio/portfolio-item8-thumb.jpg differ diff --git a/src/wp-content/themes/Broadside/images/portfolio/sample_img_2.png b/src/wp-content/themes/Broadside/images/portfolio/sample_img_2.png new file mode 100644 index 0000000..056dc8f Binary files /dev/null and b/src/wp-content/themes/Broadside/images/portfolio/sample_img_2.png differ diff --git a/src/wp-content/themes/Broadside/images/portfolio/sample_img_3.png b/src/wp-content/themes/Broadside/images/portfolio/sample_img_3.png new file mode 100644 index 0000000..8cabefb Binary files /dev/null and b/src/wp-content/themes/Broadside/images/portfolio/sample_img_3.png differ diff --git a/src/wp-content/themes/Broadside/images/portfolio/sample_img_4.png b/src/wp-content/themes/Broadside/images/portfolio/sample_img_4.png new file mode 100644 index 0000000..8cabefb Binary files /dev/null and b/src/wp-content/themes/Broadside/images/portfolio/sample_img_4.png differ diff --git a/src/wp-content/themes/Broadside/images/portfolio/sample_img_5.png b/src/wp-content/themes/Broadside/images/portfolio/sample_img_5.png new file mode 100644 index 0000000..8cabefb Binary files /dev/null and b/src/wp-content/themes/Broadside/images/portfolio/sample_img_5.png differ diff --git a/src/wp-content/themes/Broadside/images/portfolio/sample_img_6.png b/src/wp-content/themes/Broadside/images/portfolio/sample_img_6.png new file mode 100644 index 0000000..25fc7b2 Binary files /dev/null and b/src/wp-content/themes/Broadside/images/portfolio/sample_img_6.png differ diff --git a/src/wp-content/themes/Broadside/images/portfolio/services_img_sample_5.png b/src/wp-content/themes/Broadside/images/portfolio/services_img_sample_5.png new file mode 100644 index 0000000..b5771fa Binary files /dev/null and b/src/wp-content/themes/Broadside/images/portfolio/services_img_sample_5.png differ diff --git a/src/wp-content/themes/Broadside/images/portfolio/video-thumnail.jpg b/src/wp-content/themes/Broadside/images/portfolio/video-thumnail.jpg new file mode 100644 index 0000000..2d80e5c Binary files /dev/null and b/src/wp-content/themes/Broadside/images/portfolio/video-thumnail.jpg differ diff --git a/src/wp-content/themes/Broadside/images/services_img_sample_1.png b/src/wp-content/themes/Broadside/images/services_img_sample_1.png new file mode 100644 index 0000000..1f5bcb6 Binary files /dev/null and b/src/wp-content/themes/Broadside/images/services_img_sample_1.png differ diff --git a/src/wp-content/themes/Broadside/images/services_img_sample_2.png b/src/wp-content/themes/Broadside/images/services_img_sample_2.png new file mode 100644 index 0000000..001410b Binary files /dev/null and b/src/wp-content/themes/Broadside/images/services_img_sample_2.png differ diff --git a/src/wp-content/themes/Broadside/images/services_img_sample_3.png b/src/wp-content/themes/Broadside/images/services_img_sample_3.png new file mode 100644 index 0000000..bfc9d88 Binary files /dev/null and b/src/wp-content/themes/Broadside/images/services_img_sample_3.png differ diff --git a/src/wp-content/themes/Broadside/images/shadow.png b/src/wp-content/themes/Broadside/images/shadow.png new file mode 100644 index 0000000..c04d21b Binary files /dev/null and b/src/wp-content/themes/Broadside/images/shadow.png differ diff --git a/src/wp-content/themes/Broadside/images/sidebar-arrow.png b/src/wp-content/themes/Broadside/images/sidebar-arrow.png new file mode 100644 index 0000000..6ac1455 Binary files /dev/null and b/src/wp-content/themes/Broadside/images/sidebar-arrow.png differ diff --git a/src/wp-content/themes/Broadside/images/social-icons/email_16.png b/src/wp-content/themes/Broadside/images/social-icons/email_16.png new file mode 100644 index 0000000..2cabb17 Binary files /dev/null and b/src/wp-content/themes/Broadside/images/social-icons/email_16.png differ diff --git a/src/wp-content/themes/Broadside/images/social-icons/facebook_16.png b/src/wp-content/themes/Broadside/images/social-icons/facebook_16.png new file mode 100644 index 0000000..f0faf29 Binary files /dev/null and b/src/wp-content/themes/Broadside/images/social-icons/facebook_16.png differ diff --git a/src/wp-content/themes/Broadside/images/social-icons/flickr_16.png b/src/wp-content/themes/Broadside/images/social-icons/flickr_16.png new file mode 100644 index 0000000..4a6b134 Binary files /dev/null and b/src/wp-content/themes/Broadside/images/social-icons/flickr_16.png differ diff --git a/src/wp-content/themes/Broadside/images/social-icons/google_16.png b/src/wp-content/themes/Broadside/images/social-icons/google_16.png new file mode 100644 index 0000000..aeaca23 Binary files /dev/null and b/src/wp-content/themes/Broadside/images/social-icons/google_16.png differ diff --git a/src/wp-content/themes/Broadside/images/social-icons/stumbleupon_16.png b/src/wp-content/themes/Broadside/images/social-icons/stumbleupon_16.png new file mode 100644 index 0000000..484ba49 Binary files /dev/null and b/src/wp-content/themes/Broadside/images/social-icons/stumbleupon_16.png differ diff --git a/src/wp-content/themes/Broadside/images/social-icons/twitter_16.png b/src/wp-content/themes/Broadside/images/social-icons/twitter_16.png new file mode 100644 index 0000000..2bcd957 Binary files /dev/null and b/src/wp-content/themes/Broadside/images/social-icons/twitter_16.png differ diff --git a/src/wp-content/themes/Broadside/images/social-icons/vimeo_16.png b/src/wp-content/themes/Broadside/images/social-icons/vimeo_16.png new file mode 100644 index 0000000..dc6fc51 Binary files /dev/null and b/src/wp-content/themes/Broadside/images/social-icons/vimeo_16.png differ diff --git a/src/wp-content/themes/Broadside/images/social-icons/youtube_16.png b/src/wp-content/themes/Broadside/images/social-icons/youtube_16.png new file mode 100644 index 0000000..2281d7f Binary files /dev/null and b/src/wp-content/themes/Broadside/images/social-icons/youtube_16.png differ diff --git a/src/wp-content/themes/Broadside/images/team-member.png b/src/wp-content/themes/Broadside/images/team-member.png new file mode 100644 index 0000000..8469d65 Binary files /dev/null and b/src/wp-content/themes/Broadside/images/team-member.png differ diff --git a/src/wp-content/themes/Broadside/index.php b/src/wp-content/themes/Broadside/index.php new file mode 100644 index 0000000..7f0f25d --- /dev/null +++ b/src/wp-content/themes/Broadside/index.php @@ -0,0 +1,49 @@ + +
    + + +
    +

    + +

    + +
    + +
    px;"> + + + +
    > + +
    + + +
    +
    +
    +

    + Posted by in | +
    +
    +
    + +
    +
    + +
    + + + + + + + + + +
    +
    + \ No newline at end of file diff --git a/src/wp-content/themes/Broadside/js/custom-no-hover.js b/src/wp-content/themes/Broadside/js/custom-no-hover.js new file mode 100644 index 0000000..e5f636b --- /dev/null +++ b/src/wp-content/themes/Broadside/js/custom-no-hover.js @@ -0,0 +1,147 @@ +//Lightbox Code +jQuery(document).ready(function($) { + $("a.fancylightbox").fancybox({ + 'titleShow' : true, + 'titlePosition' : 'over', + 'transitionIn' : 'fade', + 'transitionOut' : 'fade', + 'overlayOpacity': '0.5', + 'overlayColor' : '#333' + }); + $("a[rel=portfolio]").fancybox({ + 'titleShow' : true, + 'titlePosition' : 'over', + 'transitionIn' : 'elastic', + 'transitionOut' : 'elastic', + 'overlayOpacity': '0.5', + 'overlayColor' : '#333' + }); + $(".videolightbox").fancybox({ + 'titleShow' : false, + 'transitionIn' : 'fade', + 'transitionOut' : 'fade', + 'type' : 'iframe', + 'overlayOpacity': '0.5', + 'overlayColor' : '#333' + }); + $(".buttonvideolightbox").fancybox({ + 'titleShow' : false, + 'transitionIn' : 'fade', + 'transitionOut' : 'fade', + 'type' : 'iframe', + 'overlayOpacity': '0.5', + 'overlayColor' : '#333' + }); + $(".iframe-popup").fancybox({ + 'width' : '75%', + 'height' : '75%', + 'autoScale' : false, + 'transitionIn' : 'none', + 'transitionOut' : 'none', + 'type' : 'iframe' + }); +}); + +//Transparency Adjustments +jQuery(document).ready(function($) { + $('.transparent').each(function() { + $(this).hover( + function() { + $(this).stop().animate({ opacity: 0.6 }, 400); + }, + function() { + $(this).stop().animate({ opacity: 1.0 }, 400); + }) + }); +}); + + + + +//Hover Menu +jQuery(document).ready(function($) +{ + slide(".sf-menu", 7, 0, 150, .8); +}); + +function slide(navigation_id, pad_out, pad_in, time, multiplier) +{ + // creates the target paths + var list_elements = navigation_id + " li"; + var link_elements = list_elements + " a"; + + // initiates the timer used for the sliding animation + var timer = 0; + + // creates the slide animation for all list elements + jQuery(list_elements).each(function(i) + { + // margin left = - ([width of element] + [total vertical padding of element]) + jQuery(this).css("margin-left","-180px"); + // updates timer + timer = (timer*multiplier + time); + jQuery(this).animate({ marginLeft: "0" }, timer); + jQuery(this).animate({ marginLeft: "0" }, timer); + jQuery(this).animate({ marginLeft: "0" }, timer); + }); + + // creates the hover-slide effect for all link elements + jQuery(link_elements).each(function(i) + { + jQuery(this).hover( + function() + { + jQuery(this).animate({ paddingLeft: pad_out }, 150); + }, + function() + { + jQuery(this).animate({ paddingLeft: pad_in }, 150); + }); + }); +} + + + + +//IE7 Z-Index Fix +jQuery(document).ready(function($) { + if ($.browser.msie && parseInt($.browser.version) == 7) { + var zIndexNumber = 1000; + + $('div').each(function() { + $(this).css('zIndex', zIndexNumber); + zIndexNumber -= 10; + }); + } +}); + + + + +//Full Screen Background Image Load +jQuery(window).load(function() { + + var theWindow = jQuery(window), + $bg = jQuery("#bg"), + aspectRatio = $bg.width() / $bg.height(); + + function resizeBg() { + + if ( (theWindow.width() / theWindow.height()) < aspectRatio ) { + $bg + .removeClass() + .addClass('bgheight'); + } else { + $bg + .removeClass() + .addClass('bgwidth'); + } + + } + + theWindow.resize(function() { + resizeBg(); + }).trigger("resize"); + +}); + diff --git a/src/wp-content/themes/Broadside/js/custom.js b/src/wp-content/themes/Broadside/js/custom.js new file mode 100644 index 0000000..0321b90 --- /dev/null +++ b/src/wp-content/themes/Broadside/js/custom.js @@ -0,0 +1,159 @@ +//Lightbox Code +jQuery(document).ready(function($) { + $("a.fancylightbox").fancybox({ + 'titleShow' : true, + 'titlePosition' : 'over', + 'transitionIn' : 'fade', + 'transitionOut' : 'fade', + 'overlayOpacity': '0.5', + 'overlayColor' : '#333' + }); + $("a[rel=portfolio]").fancybox({ + 'titleShow' : true, + 'titlePosition' : 'over', + 'transitionIn' : 'elastic', + 'transitionOut' : 'elastic', + 'overlayOpacity': '0.5', + 'overlayColor' : '#333' + }); + $(".videolightbox").fancybox({ + 'titleShow' : false, + 'transitionIn' : 'fade', + 'transitionOut' : 'fade', + 'type' : 'iframe', + 'overlayOpacity': '0.5', + 'overlayColor' : '#333' + }); + $(".buttonvideolightbox").fancybox({ + 'titleShow' : false, + 'transitionIn' : 'fade', + 'transitionOut' : 'fade', + 'type' : 'iframe', + 'overlayOpacity': '0.5', + 'overlayColor' : '#333' + }); + $(".iframe-popup").fancybox({ + 'width' : '75%', + 'height' : '75%', + 'autoScale' : false, + 'transitionIn' : 'none', + 'transitionOut' : 'none', + 'type' : 'iframe' + }); +}); + +//Transparency Adjustments +jQuery(document).ready(function($) { + $('.transparent').each(function() { + $(this).hover( + function() { + $(this).stop().animate({ opacity: 0.6 }, 400); + }, + function() { + $(this).stop().animate({ opacity: 1.0 }, 400); + }) + }); +}); + + + +//View/Hide Menu +jQuery(document).ready(function($) { + $(".sf-menu").hide(); + $(".hover-box").hoverIntent( + function(){ + $(".sf-menu").stop(true, true).slideDown('medium'); + }, + function(){ + $(".sf-menu").slideUp('medium'); + } + ); +}); + + +//Hover Menu +jQuery(document).ready(function($) +{ + slide(".sf-menu", 7, 0, 150, .8); +}); + +function slide(navigation_id, pad_out, pad_in, time, multiplier) +{ + // creates the target paths + var list_elements = navigation_id + " li"; + var link_elements = list_elements + " a"; + + // initiates the timer used for the sliding animation + var timer = 0; + + // creates the slide animation for all list elements + jQuery(list_elements).each(function(i) + { + // margin left = - ([width of element] + [total vertical padding of element]) + jQuery(this).css("margin-left","-180px"); + // updates timer + timer = (timer*multiplier + time); + jQuery(this).animate({ marginLeft: "0" }, timer); + jQuery(this).animate({ marginLeft: "0" }, timer); + jQuery(this).animate({ marginLeft: "0" }, timer); + }); + + // creates the hover-slide effect for all link elements + jQuery(link_elements).each(function(i) + { + jQuery(this).hover( + function() + { + jQuery(this).animate({ paddingLeft: pad_out }, 150); + }, + function() + { + jQuery(this).animate({ paddingLeft: pad_in }, 150); + }); + }); +} + + + + +//IE7 Z-Index Fix +jQuery(document).ready(function($) { + if ($.browser.msie && parseInt($.browser.version) == 7) { + var zIndexNumber = 1000; + + $('div').each(function() { + $(this).css('zIndex', zIndexNumber); + zIndexNumber -= 10; + }); + } +}); + + + + +//Full Screen Background Image Load +jQuery(window).load(function() { + + var theWindow = jQuery(window), + $bg = jQuery("#bg"), + aspectRatio = $bg.width() / $bg.height(); + + function resizeBg() { + + if ( (theWindow.width() / theWindow.height()) < aspectRatio ) { + $bg + .removeClass() + .addClass('bgheight'); + } else { + $bg + .removeClass() + .addClass('bgwidth'); + } + + } + + theWindow.resize(function() { + resizeBg(); + }).trigger("resize"); + +}); \ No newline at end of file diff --git a/src/wp-content/themes/Broadside/js/hoverIntent.js b/src/wp-content/themes/Broadside/js/hoverIntent.js new file mode 100644 index 0000000..91da57b --- /dev/null +++ b/src/wp-content/themes/Broadside/js/hoverIntent.js @@ -0,0 +1,84 @@ +(function($){ + /* hoverIntent by Brian Cherne */ + $.fn.hoverIntent = function(f,g) { + // default configuration options + var cfg = { + sensitivity: 7, + interval: 100, + timeout: 0 + }; + // override configuration options with user supplied object + cfg = $.extend(cfg, g ? { over: f, out: g } : f ); + + // instantiate variables + // cX, cY = current X and Y position of mouse, updated by mousemove event + // pX, pY = previous X and Y position of mouse, set by mouseover and polling interval + var cX, cY, pX, pY; + + // A private function for getting mouse position + var track = function(ev) { + cX = ev.pageX; + cY = ev.pageY; + }; + + // A private function for comparing current and previous mouse position + var compare = function(ev,ob) { + ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t); + // compare mouse positions to see if they've crossed the threshold + if ( ( Math.abs(pX-cX) + Math.abs(pY-cY) ) < cfg.sensitivity ) { + $(ob).unbind("mousemove",track); + // set hoverIntent state to true (so mouseOut can be called) + ob.hoverIntent_s = 1; + return cfg.over.apply(ob,[ev]); + } else { + // set previous coordinates for next time + pX = cX; pY = cY; + // use self-calling timeout, guarantees intervals are spaced out properly (avoids JavaScript timer bugs) + ob.hoverIntent_t = setTimeout( function(){compare(ev, ob);} , cfg.interval ); + } + }; + + // A private function for delaying the mouseOut function + var delay = function(ev,ob) { + ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t); + ob.hoverIntent_s = 0; + return cfg.out.apply(ob,[ev]); + }; + + // A private function for handling mouse 'hovering' + var handleHover = function(e) { + // next three lines copied from jQuery.hover, ignore children onMouseOver/onMouseOut + var p = (e.type == "mouseover" ? e.fromElement : e.toElement) || e.relatedTarget; + while ( p && p != this ) { try { p = p.parentNode; } catch(e) { p = this; } } + if ( p == this ) { return false; } + + // copy objects to be passed into t (required for event object to be passed in IE) + var ev = jQuery.extend({},e); + var ob = this; + + // cancel hoverIntent timer if it exists + if (ob.hoverIntent_t) { ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t); } + + // else e.type == "onmouseover" + if (e.type == "mouseover") { + // set "previous" X and Y position based on initial entry point + pX = ev.pageX; pY = ev.pageY; + // update "current" X and Y position based on mousemove + $(ob).bind("mousemove",track); + // start polling interval (self-calling timeout) to compare mouse coordinates over time + if (ob.hoverIntent_s != 1) { ob.hoverIntent_t = setTimeout( function(){compare(ev,ob);} , cfg.interval );} + + // else e.type == "onmouseout" + } else { + // unbind expensive mousemove event + $(ob).unbind("mousemove",track); + // if hoverIntent state is true, then call the mouseOut function after the specified delay + if (ob.hoverIntent_s == 1) { ob.hoverIntent_t = setTimeout( function(){delay(ev,ob);} , cfg.timeout );} + } + }; + + // bind the function to the two event listeners + return this.mouseover(handleHover).mouseout(handleHover); + }; + +})(jQuery); \ No newline at end of file diff --git a/src/wp-content/themes/Broadside/js/jquery.carouFredSel-4.1.0-packed.js b/src/wp-content/themes/Broadside/js/jquery.carouFredSel-4.1.0-packed.js new file mode 100644 index 0000000..88b0663 --- /dev/null +++ b/src/wp-content/themes/Broadside/js/jquery.carouFredSel-4.1.0-packed.js @@ -0,0 +1,15 @@ +/* + * jQuery carouFredSel 4.1.0 + * Demo's and documentation: + * caroufredsel.frebsite.nl + * + * Copyright (c) 2010 Fred Heusschen + * www.frebsite.nl + * + * Dual licensed under the MIT and GPL licenses. + * http://en.wikipedia.org/wiki/MIT_License + * http://en.wikipedia.org/wiki/GNU_General_Public_License + */ + + +eval(function(p,a,c,k,e,r){e=function(c){return(c35?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}('(z($){$.1n.1o=z(o){q(S.W==0)A 16(\'4d 4e 2W.\');q(S.W>1){A S.1p(z(){$(S).1o(o)})}B l=S,$19=l[0],$r=$(S);l.2X=z(o,a){q(y o!=\'1a\')o={};q(y o.U==\'J\'){q(o.U<=2Y)o.U={u:o.U};F o.U={13:o.U}}F{q(y o.U==\'1d\')o.U={Y:o.U}}q(y o.u==\'J\')o.u={C:o.u};F q(y o.u==\'1d\')o.u={C:o.u,1M:o.u,24:o.u};q(a){25=$.1N(G,{},$.1n.1o.2Z,o)}4=$.1N(G,{},$.1n.1o.2Z,o);4.26=P;1v=(4.1v==\'3l\'||4.1v==\'1w\')?\'M\':\'N\';q(4.1v==\'3m\'||4.1v==\'1w\'){4.w=[\'1M\',\'3n\',\'3o\',\'24\',\'3p\',\'3q\',\'1w\',\'2m\',\'1O\',0,1,2,3]}F{4.w=[\'24\',\'3p\',\'3q\',\'1M\',\'3n\',\'3o\',\'2m\',\'1w\',\'1P\',3,2,1,0]}B b=K($r);B c=30(b,4,5,P);q(4[4.w[3]]==\'E\'){4[4.w[3]]=c;4.u[4.w[3]]=c}q(!4.u[4.w[3]]){4.u[4.w[3]]=(31(b,4,5))?\'X\':b[4.w[5]](G)}q(!4[4.w[3]]){4[4.w[3]]=4.u[4.w[3]]}q(!4.u[4.w[0]]){4.u[4.w[0]]=(31(b,4,2))?\'X\':b[4.w[2]](G)}q(!4.u.C&&4.u[4.w[0]]==\'X\'){4.u.C=\'X\'}q(!4.u.C&&!4[4.w[0]]){q(4.u[4.w[0]]!=\'X\'){4[4.w[0]]=32(n.1Q(),4,1)}}q(!4.u.C){4.u.C=(y 4[4.w[0]]==\'J\'&&4.u[4.w[0]]!=\'X\')?1B.3r(4[4.w[0]]/4.u[4.w[0]]):\'X\'}q(!4[4.w[0]]){4[4.w[0]]=(4.u.C!=\'X\'&&4.u[4.w[0]]!=\'X\')?4.u.C*4.u[4.w[0]]:\'X\'}q(4.u.C==\'X\'){4.26=G;4.33=(4[4.w[0]]==\'X\')?32(n.1Q(),4,1):4[4.w[0]];q(4.H===P||4.H===0){4[4.w[0]]=\'X\'}4.u.C=27($r,4,0)}F{q(4.H===P){4.H=0}}q(y 4.H==\'1b\'){4.H=(4[4.w[0]]==\'X\')?0:\'E\'}4.u.1C=4.u.C;4.R=P;q(4.H==\'E\'){4.H=[0,0,0,0];q(4[4.w[0]]!=\'X\'){4.R=\'E\';B p=2n(3s($r,4),4);4.H[4.w[10]]=p[0];4.H[4.w[12]]=p[0]}q(4[4.w[3]]!=\'X\'){B p=(4[4.w[3]]-c)/2;q(p<0)p=0;4.H[4.w[9]]=p;4.H[4.w[11]]=p}}F{4.H=3t(4.H);4.R=(4.H[0]==0&&4.H[1]==0&&4.H[2]==0&&4.H[3]==0)?P:G}q(y 4.u.2o!=\'J\')4.u.2o=(4.26)?1:4.u.C;q(y 4.U.u!=\'J\')4.U.u=(4.26)?\'X\':4.u.C;q(y 4.U.13!=\'J\')4.U.13=4f;4.E=28(4.E,P,G);4.N=28(4.N);4.M=28(4.M);4.V=28(4.V,G);4.E=$.1N(G,{},4.U,4.E);4.N=$.1N(G,{},4.U,4.N);4.M=$.1N(G,{},4.U,4.M);4.V=$.1N(G,{},4.U,4.V);q(y 4.V.2p!=\'14\')4.V.2p=P;q(y 4.V.34!=\'z\')4.V.34=$.1n.1o.3u;q(y 4.E.Z!=\'14\')4.E.Z=G;q(y 4.E.29!=\'14\')4.E.29=G;q(y 4.E.35!=\'J\')4.E.35=0;q(y 4.E.1D!=\'J\')4.E.1D=(4.E.13<10)?4g:4.E.13*5};l.3v=z(){q($r.L(\'1E\')==\'3w\'||$r.L(\'1E\')==\'4h\'){16(\'4i 4j-4k "1E" 4l 4m "4n" 4o "3x".\')}n.L({1E:\'3x\',4p:\'3y\',2a:$r.L(\'2a\'),1O:$r.L(\'1O\'),1P:$r.L(\'1P\'),2b:$r.L(\'2b\')});$r.17(\'3z\',{1M:$r.L(\'1M\'),24:$r.L(\'24\'),2a:$r.L(\'2a\'),1O:$r.L(\'1O\'),1P:$r.L(\'1P\'),2b:$r.L(\'2b\'),\'36\':$r.L(\'36\'),1E:$r.L(\'1E\'),2m:$r.L(\'2m\'),1w:$r.L(\'1w\')}).L({2a:0,1O:0,1P:0,2b:0,\'36\':\'4q\',1E:\'3w\'});q(4.R){K($r).1p(z(){B m=1x($(S).L(4.w[8]));q(1F(m))m=0;$(S).17(\'1g\',m)})}2q(4,I)};l.3A=z(){l.3a();$r.15(\'1q\',z(e,g){q(y g!=\'14\')g=P;q(g)2c=G;q(2r!=1R)4r(2r);q(2s!=1R)3B(2s);q(2t!=1R)3B(2t);B a=4.E.1D-1S,1G=2u-1B.3b(a*2u/4.E.1D);q(1G!=0){q(4.E.3C)4.E.3C.1c($19,1G,a)}});$r.15(\'Z\',z(e,d,f,g){$r.D(\'1q\');q(!4.E.Z)A;q(y g!=\'14\'){q(y f==\'14\')g=f;F q(y d==\'14\')g=d;F g=P}q(y f!=\'J\'){q(y d==\'J\')f=d;F f=0}q(d!=\'N\'&&d!=\'M\')d=1v;q(g)2c=P;q(2c)A;B a=4.E.1D-1S,3D=a+f;1G=2u-1B.3b(a*2u/4.E.1D);2r=3E(z(){q($r.1r(\':3c\')){$r.D(\'Z\',d)}F{1S=0;$r.D(d,4.E)}},3D);q(4.E.1T===\'4s\'){2s=4t(z(){1S+=2Y},2Y)}q(1G==0){q(4.E.3F)4.E.3F.1c($19,1G,a)}q(4.E.3G){2t=3E(z(){4.E.3G.1c($19,1G,a)},f)}});$r.15(\'N M\',z(e){q(2c||$r.1r(\':3c\')||$r.1r(\':3y\')){e.3H();A}q(4.u.2o>=I){16(\'1U 3I u: 2v 2w\');e.3H();A}1S=0});q(4.26){$r.15(\'N\',z(e,a,b){q(y a==\'J\')b=a;q(y a!=\'1a\')a=4.N;q(y b!=\'J\')b=(y a.u==\'J\')?a.u:4.u.C;2d=b;4.u.1C=4.u.C;B c=K($r);q(4.R){1e(c,4)}4.u.C=3J($r,4,2d);b=4.u.C-4.u.1C+2d;q(b<=0){4.u.C=27($r,4,I-2d);b=2d}q(4.R){1e(c,4,G)}$r.D(\'2x\',[a,b])});$r.15(\'M\',z(e,a,b){q(y a==\'J\')b=a;q(y a!=\'1a\')a=4.M;q(y b!=\'J\')b=(y a.u==\'J\')?a.u:4.u.C;4.u.1C=4.u.C;B c=K($r);1e(c,4);4.u.C=27($r,4,b);q(4.u.1C-b>=4.u.C){4.u.C=27($r,4,++b)}1e(c,4,G);$r.D(\'2y\',[a,b])})}F{$r.15(\'N\',z(e,a,b){$r.D(\'2x\',[a,b])});$r.15(\'M\',z(e,a,b){$r.D(\'2y\',[a,b])})}$r.15(\'2x\',z(e,b,c){q(y b==\'J\')c=b;q(y b!=\'1a\')b=4.N;q(y c!=\'J\')c=(y b.u==\'J\')?b.u:4.u.C;q(y c!=\'J\')A 16(\'1U a 2z J: 2v 2w\');q(b.2A&&!b.2A.1c($19))A;q(!4.1H){B d=I-O;q(d-c<0){c=d}q(O==0){c=0}}O+=c;q(O>=I)O-=I;q(!4.1H){q(O==0&&c!=0&&b.2B)b.2B.1c($19);q(4.2C){q(c==0){$r.D(\'M\',I-4.u.C);A}}F{q(O==0&&4.N.T)4.N.T.2D(\'2e\');q(4.M.T)4.M.T.3d(\'2e\')}}q(c==0)A;K($r,\':2f(\'+(I-c-1)+\')\').4u($r);q(I<4.u.C+c)K($r,\':1h(\'+((4.u.C+c)-I)+\')\').3K(G).3e($r);B f=3L($r,4,c),1j=3f($r,4),1I=K($r,\':1k(\'+(c-1)+\')\'),1l=f.1i(\':1V\'),1s=1j.1i(\':1V\');q(4.R){1e(1l,4);1e(1s,4)}q(4.R==\'E\'){B p=2n(3f($r,4,c),4)}B g=1W(K($r,\':1h(\'+c+\')\'),4,0),1y=2E(2F(1j,4,G),4,!4.R);q(4.R){1e(1l,4,4.H[4.w[10]]);1e(1I,4,4.H[4.w[12]])}q(4.R==\'E\'){4.H[4.w[9]]=p[1];4.H[4.w[10]]=p[0];4.H[4.w[11]]=p[1];4.H[4.w[12]]=p[0]}B h={},3g={},1X={},1Y={},Q=b.13;q(Q==\'E\')Q=4.U.13/4.U.u*c;F q(Q<=0)Q=0;F q(Q<10)Q=g/Q;q(b.2G)b.2G.1c($19,f,1j,1y,Q);q(4.R){B i=4.H[4.w[12]];1X[4.w[8]]=1I.17(\'1g\');3g[4.w[8]]=1s.17(\'1g\')+4.H[4.w[10]];1Y[4.w[8]]=1l.17(\'1g\');1I.1J().1t(1X,{13:Q,Y:b.Y});1s.1J().1t(3g,{13:Q,Y:b.Y});1l.1J().1t(1Y,{13:Q,Y:b.Y})}F{B i=0}h[4.w[6]]=i;q(4[4.w[0]]==\'X\'||4[4.w[3]]==\'X\'){n.1J().1t(1y,{13:Q,Y:b.Y})}B j=c;$r.L(4.w[6],-g);$r.1t(h,{13:Q,Y:b.Y,3M:z(){q(b.2H)b.2H.1c($19,f,1j,1y);q(I<4.u.C+c){K($r,\':2f(\'+(I-1)+\')\').2g()}B a=K($r,\':1k(\'+(4.u.C+c-1)+\')\');q(4.R)a.L(4.w[8],a.17(\'1g\'))}});$r.D(\'1K\').D(\'Z\',Q)});$r.15(\'2y\',z(e,c,d){q(y c==\'J\')d=c;q(y c!=\'1a\')c=4.M;q(y d!=\'J\')d=(y c.u==\'J\')?c.u:4.u.C;q(y d!=\'J\')A 16(\'1U a 2z J: 2v 2w\');q(c.2A&&!c.2A.1c($19))A;q(!4.1H){q(O==0){q(d>I-4.u.C){d=I-4.u.C}}F{q(O-d<4.u.C){d=O-4.u.C}}}O-=d;q(O<0)O+=I;q(!4.1H){q(O==4.u.C&&d!=0&&c.2B)c.2B.1c($19);q(4.2C){q(d==0){$r.D(\'N\',I-4.u.C);A}}F{q(O==4.u.C&&4.M.T)4.M.T.2D(\'2e\');q(4.N.T)4.N.T.3d(\'2e\')}}q(d==0)A;q(I<4.u.C+d)K($r,\':1h(\'+((4.u.C+d)-I)+\')\').3K(G).3e($r);B f=3N($r,4),1j=3h($r,4,d),1I=f.1i(\':1k(\'+(d-1)+\')\'),1l=f.1i(\':1V\'),1s=1j.1i(\':1V\');q(4.R){1e(1l,4);1e(1s,4)}q(4.R==\'E\'){B p=2n(3h($r,4,d),4)}B g=1W(K($r,\':1h(\'+d+\')\'),4,0),1y=2E(2F(1j,4,G),4,!4.R);q(4.R){1e(1l,4,4.H[4.w[10]]);1e(1s,4,4.H[4.w[10]])}q(4.R==\'E\'){4.H[4.w[9]]=p[1];4.H[4.w[10]]=p[0];4.H[4.w[11]]=p[1];4.H[4.w[12]]=p[0]}B h={},1Y={},1X={},Q=c.13;q(Q==\'E\')Q=4.U.13/4.U.u*d;F q(Q<=0)Q=0;F q(Q<10)Q=g/Q;q(c.2G)c.2G.1c($19,f,1j,1y,Q);q(4.R){1Y[4.w[8]]=1l.17(\'1g\');1X[4.w[8]]=1I.17(\'1g\')+4.H[4.w[12]];1s.L(4.w[8],1s.17(\'1g\')+4.H[4.w[10]]);1l.1J().1t(1Y,{13:Q,Y:c.Y});1I.1J().1t(1X,{13:Q,Y:c.Y})}h[4.w[6]]=-g;q(4[4.w[0]]==\'X\'||4[4.w[3]]==\'X\'){n.1J().1t(1y,{13:Q,Y:c.Y})}B i=d;$r.1t(h,{13:Q,Y:c.Y,3M:z(){q(c.2H)c.2H.1c($19,f,1j,1y);q(I<4.u.C+i){K($r,\':2f(\'+(I-1)+\')\').2g()}B a=(4.R)?4.H[4.w[12]]:0;$r.L(4.w[6],a);B b=K($r,\':1h(\'+i+\')\').3e($r).1i(\':1V\');q(4.R)b.L(4.w[8],b.17(\'1g\'))}});$r.D(\'1K\').D(\'Z\',Q)});$r.15(\'1Z\',z(e,a,b,c,d){q($r.1r(\':3c\'))A;a=2h(a,b,c,O,I,$r);q(a==0)A;q(y d!=\'1a\')d=P;q(4.1H){q(aa)$r.D(\'M\',[d,a]);F $r.D(\'N\',[d,I-a])}});$r.15(\'3O\',z(e,a,b,c,d){q(y a==\'1a\'&&y a.2i==\'1b\')a=$(a);q(y a==\'1d\')a=$(a);q(y a!=\'1a\'||y a.2i==\'1b\'||a.W==0)A 16(\'1U a 2z 1a.\');q(y b==\'1b\'||b==\'3P\'){$r.3i(a)}F{b=2h(b,d,c,O,I,$r);B f=K($r,\':1k(\'+b+\')\');q(4.R){a.1p(z(){B m=1x($(S).L(4.w[8]));q(1F(m))m=0;$(S).17(\'1g\',m)})}q(f.W){q(b=I)O-=I;f.4v(a)}F{$r.3i(a)}}I=K($r).W;$r.D(\'20\');2j($r,4);2q(4,I);$r.D(\'1K\',G)});$r.15(\'3Q\',z(e,a,b,c){q(y a==\'1b\'||a==\'3P\'){K($r,\':1V\').2g()}F{a=2h(a,c,b,O,I,$r);B d=K($r,\':1k(\'+a+\')\');q(d.W){q(a0&&K($r).3T($(h))!=-1){$(S).18(\'21\').21(z(e){e.1u();$r.D(\'1Z\',h)})}})});$r.15(\'2I\',z(e,a){q(O==0)B b=0;F B b=I-O;q(y a==\'z\')a.1c($19,b)});$r.15(\'22\',z(e,a,b){q(y a==\'z\'){a.1c($19,4)}F q(y b==\'z\'){B c=3U(\'4.\'+a);q(y c==\'1b\')c=\'\';b.1c($19,c)}F q(y a!=\'1b\'&&y b!=\'1b\'){3U(\'25.\'+a+\' = b\');l.2X(25);2j($r,4)}});$r.15(\'1L\',z(e){$r.D(\'1q\').L($r.17(\'3z\'));l.3a();n.4y($r)});$r.15(\'1K\',z(e,b){q(!4.V.1f)A;q(y b==\'14\'&&b){K(4.V.1f).2g();2k(B a=0;a<1B.3b(I/4.u.C);a++){B i=K($r,\':1k(\'+2h(a*4.u.C,0,G,O,I,$r)+\')\');4.V.1f.3i(4.V.34(a+1,i))}K(4.V.1f).18(\'21\').1p(z(a){$(S).21(z(e){e.1u();$r.D(\'1Z\',[a*4.u.C,0,G,4.V])})})}B c=(O==0)?0:1B.4z((I-O)/4.u.C);K(4.V.1f).3d(\'2W\').1i(\':1k(\'+c+\')\').2D(\'2W\')})};l.3a=z(){$r.18(\'1q\').18(\'Z\').18(\'N\').18(\'M\').18(\'2x\').18(\'2y\').18(\'1Z\').18(\'3O\').18(\'3Q\').18(\'20\').18(\'1L\').18(\'1K\').18(\'2I\').18(\'22\')};l.3V=z(){q(4.E.1T&&4.E.Z){n.2J(z(){$r.D(\'1q\')},z(){$r.D(\'Z\')})}q(4.N.T){4.N.T.21(z(e){e.1u();$r.D(\'N\')});q(4.N.1T&&4.E.Z){4.N.T.2J(z(){$r.D(\'1q\')},z(){$r.D(\'Z\')})}q(!4.1H&&!4.2C){4.N.T.2D(\'2e\')}}q($.1n.1m){q(4.N.1m){n.1m(z(e,a){q(a>0){e.1u();2K=(y 4.N.1m==\'J\')?4.N.1m:\'\';$r.D(\'N\',2K)}})}q(4.M.1m){n.1m(z(e,a){q(a<0){e.1u();2K=(y 4.M.1m==\'J\')?4.M.1m:\'\';$r.D(\'M\',2K)}})}}q(4.M.T){4.M.T.21(z(e){e.1u();$r.D(\'M\')});q(4.M.1T&&4.E.Z){4.M.T.2J(z(){$r.D(\'1q\')},z(){$r.D(\'Z\')})}}q(4.V.1f){$r.D(\'1K\',G);q(4.V.1T&&4.E.Z){4.V.1f.2J(z(){$r.D(\'1q\')},z(){$r.D(\'Z\')})}}q(4.M.1z||4.N.1z){$(3W).3X(z(e){B k=e.3Y;q(k==4.M.1z){e.1u();$r.D(\'M\')}q(k==4.N.1z){e.1u();$r.D(\'N\')}})}q(4.V.2p){$(3W).3X(z(e){B k=e.3Y;q(k>=49&&k<4A){k=(k-49)*4.u.C;q(k<=I){e.1u();$r.D(\'1Z\',[k,0,G,4.V])}}})}q(4.E.Z){$r.D(\'Z\',4.E.35);q($.1n.29&&4.E.29){$r.29(\'1q\',\'Z\')}}};l.22=z(a,b){16(\'2L "22" 2M 2N 1r 2O, 2P 2Q "22" 2R 2S.\');B c=P;B d=z(a){c=a};q(!a)a=d;q(!b)b=d;$r.D(\'22\',[a,b]);A c};l.3Z=z(){16(\'2L "3Z" 2M 2N 1r 2O, 2P 2Q "2I" 2R 2S.\');B b=P;$r.D(\'2I\',z(a){b=a});A b};l.1L=z(){16(\'2L "1L" 2M 2N 1r 2O, 2P 2Q "1L" 2R 2S.\');$r.D(\'1L\');A l};l.41=z(a,b){16(\'2L "41" 2M 2N 1r 2O, 2P 2Q "20" 2R 2S.\');$r.D(\'20\',[a,b]);A l};q($r.1Q().1r(\'.42\')){B n=$r.1Q();$r.D(\'1L\')}B n=$r.4B(\'<4C 4D="42" />\').1Q(),4={},25=o,I=K($r).W,O=0,2r=1R,2s=1R,2t=1R,1S=0,2c=P,1v=\'M\';l.2X(25,G);l.3v();l.3A();l.3V();$r.D(\'20\');2j($r,4,P);q(4.u.1A!==0&&4.u.1A!==P){B s=4.u.1A;q(s===G){s=2T.4E.3S;q(!s.W)s=0}q(s===\'43\'){s=1B.3r(1B.43()*I)}$r.D(\'1Z\',[s,0,G,{13:0}])}A S};$.1n.1o.2Z={2C:G,1H:G,1v:\'1w\',u:{1A:0},U:{Y:\'4F\',1T:P,1m:P}};$.1n.1o.3u=z(a,b){A\'<44>\'+a+\'\'};z 2q(o,t){q(o.u.2o>=t){16(\'1U 3I u: 2v 2w\');B f=\'4H\'}F{B f=\'4I\'}q(o.N.T)o.N.T[f]();q(o.M.T)o.M.T[f]();q(o.V.1f)o.V.1f[f]()}z 3j(k){q(k==\'3m\')A 39;q(k==\'1w\')A 37;q(k==\'3l\')A 38;q(k==\'4J\')A 40;A-1}z 28(a,b,c){q(y b!=\'14\')b=P;q(y c!=\'14\')c=P;q(y a==\'1b\')a={};q(y a==\'1d\'){B d=3j(a);q(d==-1)a=$(a);F a=d}q(b){q(y a==\'14\')a={2p:a};q(y a.2i!=\'1b\')a={1f:a};q(y a.1f==\'1d\')a.1f=$(a.1f)}F q(c){q(y a==\'14\')a={Z:a};q(y a==\'J\')a={1D:a};q(y a.45!=\'1a\')a.45={}}F{q(y a.2i!=\'1b\')a={T:a};q(y a==\'J\')a={1z:a};q(y a.T==\'1d\')a.T=$(a.T);q(y a.1z==\'1d\')a.1z=3j(a.1z)}A a}z 2h(a,b,c,d,e,f){q(y a==\'1d\'){q(1F(a))a=$(a);F a=1x(a)}q(y a==\'1a\'){q(y a.2i==\'1b\')a=$(a);a=K(f).3T(a);q(a==-1)a=0;q(y c!=\'14\')c=P}F{q(y c!=\'14\')c=G}q(1F(a))a=0;F a=1x(a);q(1F(b))b=0;F b=1x(b);q(c){a+=d}a+=b;q(e>0){46(a>=e){a-=e}46(a<0){a+=e}}A a}z K(c,f){q(y f!=\'1d\')f=\'\';A $(\'> *\'+f,c)}z 3s(c,o){A K(c,\':1h(\'+o.u.C+\')\')}z 3L(c,o,n){A K(c,\':1h(\'+(o.u.1C+n)+\'):2f(\'+(n-1)+\')\')}z 3f(c,o){A K(c,\':1h(\'+o.u.C+\')\')}z 3N(c,o){A K(c,\':1h(\'+o.u.1C+\')\')}z 3h(c,o,n){A K(c,\':1h(\'+(o.u.C+n)+\'):2f(\'+(n-1)+\')\')}z 1e(i,o,m){B x=(y m==\'14\')?m:P;q(y m!=\'J\')m=0;i.1p(z(){B t=1x($(S).L(o.w[8]));q(1F(t))t=0;$(S).17(\'47\',t);$(S).L(o.w[8],((x)?$(S).17(\'47\'):m+$(S).17(\'1g\')))})}z 2F(i,o,a){48=1W(i,o,0,a);4a=2l(i,o,3,a);A[48,4a]}z 2l(i,o,a,b){q(y b!=\'14\')b=P;q(y o[o.w[a]]==\'J\'&&b)A o[o.w[a]];q(y o.u[o.w[a]]==\'J\')A o.u[o.w[a]];A 30(i,o,a+2)}z 30(i,o,a){B s=0;i.1p(z(){B m=$(S)[o.w[a]](G);q(s-1)?[\'4M\',\'4N\']:[\'4O\',\'4P\'];2k(a=0;a<3k.W;a++){B m=1x(b.L(3k[a]));q(1F(m))m=0;d-=m}A d}z 1W(i,o,a,b){q(y b!=\'14\')b=P;q(y o[o.w[a]]==\'J\'&&b)A o[o.w[a]];q(y o.u[o.w[a]]==\'J\')A o.u[o.w[a]]*i.W;A 4b(i,o,a+2)}z 4b(i,o,a){B s=0;i.1p(z(){s+=$(S)[o.w[a]](G)});A s}z 31(i,o,a){B s=P,v=P;i.1p(z(){c=$(S)[o.w[a]]();q(s===P)s=c;F q(s!=c)v=G});A v}z 2E(a,o,p){q(y p!=\'14\')p=G;B b=(o.R&&p)?o.H:[0,0,0,0];B c={};c[o.w[0]]=a[0]+b[1]+b[3];c[o.w[3]]=a[1]+b[0]+b[2];A c}z 2j(a,o,p){B b=a.1Q(),$i=K(a),$l=$i.1i(\':1k(\'+(o.u.C-1)+\')\');b.L(2E(2F($i.1i(\':1h(\'+o.u.C+\')\'),o,G),o,p));q(o.R){$l.L(o.w[8],$l.17(\'1g\')+o.H[o.w[10]]);a.L(o.w[7],o.H[o.w[9]]);a.L(o.w[6],o.H[o.w[12]])}a.L(o.w[0],1W($i,o,0)*2);a.L(o.w[3],2l($i,o,3))}z 3t(p){q(y p==\'1b\')A[0,0,0,0];q(y p==\'J\')A[p,p,p,p];F q(y p==\'1d\')p=p.4c(\'4Q\').4R(\'\').4c(\' \');q(y p!=\'1a\'){A[0,0,0,0]}2k(i 4S p){p[i]=1x(p[i])}4T(p.W){2U 0:A[0,0,0,0];2U 1:A[p[0],p[0],p[0],p[0]];2U 2:A[p[0],p[1],p[0],p[1]];2U 3:A[p[0],p[1],p[2],p[1]];4U:A[p[0],p[1],p[2],p[3]]}}z 2n(a,o){B b=(y o[o.w[3]]==\'J\')?o[o.w[3]]:2l(a,o,3);A[(o[o.w[0]]-1W(a,o,0))/2,(b-2l(a,o,3))/2]}z 3J(b,o,c){B d=K(b),23=0,1A=o.u.C-c-1,x=0;q(1A<0)1A=d.W-1;2k(B a=1A;a>=0;a--){23+=d.1i(\':1k(\'+a+\')\')[o.w[2]](G);q(23>o.33)A x;q(a==0)a=d.W;x++}}z 27(b,o,c){B d=K(b),23=0,x=0;2k(B a=c;a<=d.W-1;a++){23+=d.1i(\':1k(\'+a+\')\')[o.w[2]](G);q(23>o.33)A x;q(a==d.W-1)a=-1;x++}}z 16(m){q(y m==\'1d\')m=\'1o: \'+m;q(2T.2V&&2T.2V.16)2T.2V.16(m);F 4V{2V.16(m)}4W(4X){}A P}$.1n.3R=z(o){A S.1o(o)}})(4Y);',62,309,'||||opts||||||||||||||||||||||if|cfs|||items||dimensions||typeof|function|return|var|visible|trigger|auto|else|true|padding|totalItems|number|getItems|css|next|prev|firstItem|false|a_dur|usePadding|this|button|scroll|pagination|length|variable|easing|play||||duration|boolean|bind|log|data|unbind|tt0|object|undefined|call|string|resetMargin|container|cfs_origCssMargin|lt|filter|c_new|eq|l_old|mousewheel|fn|carouFredSel|each|pause|is|l_new|animate|preventDefault|direction|left|parseInt|w_siz|key|start|Math|oldVisible|pauseDuration|position|isNaN|perc|circular|l_cur|stop|updatePageStatus|destroy|width|extend|marginRight|marginBottom|parent|null|pauseTimePassed|pauseOnHover|Not|last|getTotalSize|a_cur|a_old|slideTo|linkAnchors|click|configuration|total|height|opts_orig|variableVisible|getVisibleItemsNext|getNaviObject|nap|marginTop|marginLeft|pausedGlobal|oI|disabled|gt|remove|getItemIndex|jquery|setSizes|for|getLargestSize|top|getAutoPadding|minimum|keys|showNavi|autoTimeout|autoInterval|timerInterval|100|not|scrolling|slidePrev|slideNext|valid|conditions|onEnd|infinite|addClass|mapWrapperSizes|getSizes|onBefore|onAfter|currentPosition|hover|num|The|public|method|deprecated|use|the|custom|event|window|case|console|selected|init|50|defaults|getTrueLargestSize|hasVariableSizes|getTrueInnerSize|maxDimention|anchorBuilder|delay|float||||unbind_events|ceil|animated|removeClass|appendTo|getNewItemsPrev|a_new|getNewItemsNext|append|getKeyCode|arr|up|right|innerWidth|outerWidth|innerHeight|outerHeight|floor|getCurrentItems|getPadding|pageAnchorBuilder|build|absolute|relative|hidden|cfs_origCss|bind_events|clearInterval|onPausePause|dur2|setTimeout|onPauseEnd|onPauseStart|stopImmediatePropagation|enough|getVisibleItemsPrev|clone|getOldItemsPrev|complete|getOldItemsNext|insertItem|end|removeItem|caroufredsel|hash|index|eval|bind_buttons|document|keyup|keyCode|current_position||link_anchors|caroufredsel_wrapper|random|span|timer|while|cfs_tempCssMargin|s1||s2|getTotalSizeVariable|split|No|element|500|2500|fixed|Carousels|CSS|attribute|should|be|static|or|overflow|none|clearTimeout|resume|setInterval|prependTo|before|body|find|replaceWith|round|58|wrap|div|class|location|swing|href|hide|show|down|toLowerCase|indexOf|paddingLeft|paddingRight|paddingTop|paddingBottom|px|join|in|switch|default|try|catch|err|jQuery'.split('|'),0,{})) \ No newline at end of file diff --git a/src/wp-content/themes/Broadside/js/jquery.fancybox.js b/src/wp-content/themes/Broadside/js/jquery.fancybox.js new file mode 100644 index 0000000..1373ed0 --- /dev/null +++ b/src/wp-content/themes/Broadside/js/jquery.fancybox.js @@ -0,0 +1,46 @@ +/* + * FancyBox - jQuery Plugin + * Simple and fancy lightbox alternative + * + * Examples and documentation at: http://fancybox.net + * + * Copyright (c) 2008 - 2010 Janis Skarnelis + * That said, it is hardly a one-person project. Many people have submitted bugs, code, and offered their advice freely. Their support is greatly appreciated. + * + * Version: 1.3.4 (11/11/2010) + * Requires: jQuery v1.3+ + * + * Dual licensed under the MIT and GPL licenses: + * http://www.opensource.org/licenses/mit-license.php + * http://www.gnu.org/licenses/gpl.html + */ + +;(function(b){var m,t,u,f,D,j,E,n,z,A,q=0,e={},o=[],p=0,d={},l=[],G=null,v=new Image,J=/\.(jpg|gif|png|bmp|jpeg)(.*)?$/i,W=/[^\.]\.(swf)\s*$/i,K,L=1,y=0,s="",r,i,h=false,B=b.extend(b("
    ")[0],{prop:0}),M=b.browser.msie&&b.browser.version<7&&!window.XMLHttpRequest,N=function(){t.hide();v.onerror=v.onload=null;G&&G.abort();m.empty()},O=function(){if(false===e.onError(o,q,e)){t.hide();h=false}else{e.titleShow=false;e.width="auto";e.height="auto";m.html('

    The requested content cannot be loaded.
    Please try again later.

    '); +F()}},I=function(){var a=o[q],c,g,k,C,P,w;N();e=b.extend({},b.fn.fancybox.defaults,typeof b(a).data("fancybox")=="undefined"?e:b(a).data("fancybox"));w=e.onStart(o,q,e);if(w===false)h=false;else{if(typeof w=="object")e=b.extend(e,w);k=e.title||(a.nodeName?b(a).attr("title"):a.title)||"";if(a.nodeName&&!e.orig)e.orig=b(a).children("img:first").length?b(a).children("img:first"):b(a);if(k===""&&e.orig&&e.titleFromAlt)k=e.orig.attr("alt");c=e.href||(a.nodeName?b(a).attr("href"):a.href)||null;if(/^(?:javascript)/i.test(c)|| +c=="#")c=null;if(e.type){g=e.type;if(!c)c=e.content}else if(e.content)g="html";else if(c)g=c.match(J)?"image":c.match(W)?"swf":b(a).hasClass("iframe")?"iframe":c.indexOf("#")===0?"inline":"ajax";if(g){if(g=="inline"){a=c.substr(c.indexOf("#"));g=b(a).length>0?"inline":"ajax"}e.type=g;e.href=c;e.title=k;if(e.autoDimensions)if(e.type=="html"||e.type=="inline"||e.type=="ajax"){e.width="auto";e.height="auto"}else e.autoDimensions=false;if(e.modal){e.overlayShow=true;e.hideOnOverlayClick=false;e.hideOnContentClick= +false;e.enableEscapeButton=false;e.showCloseButton=false}e.padding=parseInt(e.padding,10);e.margin=parseInt(e.margin,10);m.css("padding",e.padding+e.margin);b(".fancybox-inline-tmp").unbind("fancybox-cancel").bind("fancybox-change",function(){b(this).replaceWith(j.children())});switch(g){case "html":m.html(e.content);F();break;case "inline":if(b(a).parent().is("#fancybox-content")===true){h=false;break}b('
    ').hide().insertBefore(b(a)).bind("fancybox-cleanup",function(){b(this).replaceWith(j.children())}).bind("fancybox-cancel", +function(){b(this).replaceWith(m.children())});b(a).appendTo(m);F();break;case "image":h=false;b.fancybox.showActivity();v=new Image;v.onerror=function(){O()};v.onload=function(){h=true;v.onerror=v.onload=null;e.width=v.width;e.height=v.height;b("").attr({id:"fancybox-img",src:v.src,alt:e.title}).appendTo(m);Q()};v.src=c;break;case "swf":e.scrolling="no";C='';P="";b.each(e.swf,function(x,H){C+='';P+=" "+x+'="'+H+'"'});C+='";m.html(C);F();break;case "ajax":h=false;b.fancybox.showActivity();e.ajax.win=e.ajax.success;G=b.ajax(b.extend({},e.ajax,{url:c,data:e.ajax.data||{},error:function(x){x.status>0&&O()},success:function(x,H,R){if((typeof R=="object"?R:G).status==200){if(typeof e.ajax.win== +"function"){w=e.ajax.win(c,x,H,R);if(w===false){t.hide();return}else if(typeof w=="string"||typeof w=="object")x=w}m.html(x);F()}}}));break;case "iframe":Q()}}else O()}},F=function(){var a=e.width,c=e.height;a=a.toString().indexOf("%")>-1?parseInt((b(window).width()-e.margin*2)*parseFloat(a)/100,10)+"px":a=="auto"?"auto":a+"px";c=c.toString().indexOf("%")>-1?parseInt((b(window).height()-e.margin*2)*parseFloat(c)/100,10)+"px":c=="auto"?"auto":c+"px";m.wrapInner('
    ');e.width=m.width();e.height=m.height();Q()},Q=function(){var a,c;t.hide();if(f.is(":visible")&&false===d.onCleanup(l,p,d)){b.event.trigger("fancybox-cancel");h=false}else{h=true;b(j.add(u)).unbind();b(window).unbind("resize.fb scroll.fb");b(document).unbind("keydown.fb");f.is(":visible")&&d.titlePosition!=="outside"&&f.css("height",f.height());l=o;p=q;d=e;if(d.overlayShow){u.css({"background-color":d.overlayColor, +opacity:d.overlayOpacity,cursor:d.hideOnOverlayClick?"pointer":"auto",height:b(document).height()});if(!u.is(":visible")){M&&b("select:not(#fancybox-tmp select)").filter(function(){return this.style.visibility!=="hidden"}).css({visibility:"hidden"}).one("fancybox-cleanup",function(){this.style.visibility="inherit"});u.show()}}else u.hide();i=X();s=d.title||"";y=0;n.empty().removeAttr("style").removeClass();if(d.titleShow!==false){if(b.isFunction(d.titleFormat))a=d.titleFormat(s,l,p,d);else a=s&&s.length? +d.titlePosition=="float"?'
    '+s+'
    ':'
    '+s+"
    ":false;s=a;if(!(!s||s==="")){n.addClass("fancybox-title-"+d.titlePosition).html(s).appendTo("body").show();switch(d.titlePosition){case "inside":n.css({width:i.width-d.padding*2,marginLeft:d.padding,marginRight:d.padding}); +y=n.outerHeight(true);n.appendTo(D);i.height+=y;break;case "over":n.css({marginLeft:d.padding,width:i.width-d.padding*2,bottom:d.padding}).appendTo(D);break;case "float":n.css("left",parseInt((n.width()-i.width-40)/2,10)*-1).appendTo(f);break;default:n.css({width:i.width-d.padding*2,paddingLeft:d.padding,paddingRight:d.padding}).appendTo(f)}}}n.hide();if(f.is(":visible")){b(E.add(z).add(A)).hide();a=f.position();r={top:a.top,left:a.left,width:f.width(),height:f.height()};c=r.width==i.width&&r.height== +i.height;j.fadeTo(d.changeFade,0.3,function(){var g=function(){j.html(m.contents()).fadeTo(d.changeFade,1,S)};b.event.trigger("fancybox-change");j.empty().removeAttr("filter").css({"border-width":d.padding,width:i.width-d.padding*2,height:e.autoDimensions?"auto":i.height-y-d.padding*2});if(c)g();else{B.prop=0;b(B).animate({prop:1},{duration:d.changeSpeed,easing:d.easingChange,step:T,complete:g})}})}else{f.removeAttr("style");j.css("border-width",d.padding);if(d.transitionIn=="elastic"){r=V();j.html(m.contents()); +f.show();if(d.opacity)i.opacity=0;B.prop=0;b(B).animate({prop:1},{duration:d.speedIn,easing:d.easingIn,step:T,complete:S})}else{d.titlePosition=="inside"&&y>0&&n.show();j.css({width:i.width-d.padding*2,height:e.autoDimensions?"auto":i.height-y-d.padding*2}).html(m.contents());f.css(i).fadeIn(d.transitionIn=="none"?0:d.speedIn,S)}}}},Y=function(){if(d.enableEscapeButton||d.enableKeyboardNav)b(document).bind("keydown.fb",function(a){if(a.keyCode==27&&d.enableEscapeButton){a.preventDefault();b.fancybox.close()}else if((a.keyCode== +37||a.keyCode==39)&&d.enableKeyboardNav&&a.target.tagName!=="INPUT"&&a.target.tagName!=="TEXTAREA"&&a.target.tagName!=="SELECT"){a.preventDefault();b.fancybox[a.keyCode==37?"prev":"next"]()}});if(d.showNavArrows){if(d.cyclic&&l.length>1||p!==0)z.show();if(d.cyclic&&l.length>1||p!=l.length-1)A.show()}else{z.hide();A.hide()}},S=function(){if(!b.support.opacity){j.get(0).style.removeAttribute("filter");f.get(0).style.removeAttribute("filter")}e.autoDimensions&&j.css("height","auto");f.css("height","auto"); +s&&s.length&&n.show();d.showCloseButton&&E.show();Y();d.hideOnContentClick&&j.bind("click",b.fancybox.close);d.hideOnOverlayClick&&u.bind("click",b.fancybox.close);b(window).bind("resize.fb",b.fancybox.resize);d.centerOnScroll&&b(window).bind("scroll.fb",b.fancybox.center);if(d.type=="iframe")b('').appendTo(j); +f.show();h=false;b.fancybox.center();d.onComplete(l,p,d);var a,c;if(l.length-1>p){a=l[p+1].href;if(typeof a!=="undefined"&&a.match(J)){c=new Image;c.src=a}}if(p>0){a=l[p-1].href;if(typeof a!=="undefined"&&a.match(J)){c=new Image;c.src=a}}},T=function(a){var c={width:parseInt(r.width+(i.width-r.width)*a,10),height:parseInt(r.height+(i.height-r.height)*a,10),top:parseInt(r.top+(i.top-r.top)*a,10),left:parseInt(r.left+(i.left-r.left)*a,10)};if(typeof i.opacity!=="undefined")c.opacity=a<0.5?0.5:a;f.css(c); +j.css({width:c.width-d.padding*2,height:c.height-y*a-d.padding*2})},U=function(){return[b(window).width()-d.margin*2,b(window).height()-d.margin*2,b(document).scrollLeft()+d.margin,b(document).scrollTop()+d.margin]},X=function(){var a=U(),c={},g=d.autoScale,k=d.padding*2;c.width=d.width.toString().indexOf("%")>-1?parseInt(a[0]*parseFloat(d.width)/100,10):d.width+k;c.height=d.height.toString().indexOf("%")>-1?parseInt(a[1]*parseFloat(d.height)/100,10):d.height+k;if(g&&(c.width>a[0]||c.height>a[1]))if(e.type== +"image"||e.type=="swf"){g=d.width/d.height;if(c.width>a[0]){c.width=a[0];c.height=parseInt((c.width-k)/g+k,10)}if(c.height>a[1]){c.height=a[1];c.width=parseInt((c.height-k)*g+k,10)}}else{c.width=Math.min(c.width,a[0]);c.height=Math.min(c.height,a[1])}c.top=parseInt(Math.max(a[3]-20,a[3]+(a[1]-c.height-40)*0.5),10);c.left=parseInt(Math.max(a[2]-20,a[2]+(a[0]-c.width-40)*0.5),10);return c},V=function(){var a=e.orig?b(e.orig):false,c={};if(a&&a.length){c=a.offset();c.top+=parseInt(a.css("paddingTop"), +10)||0;c.left+=parseInt(a.css("paddingLeft"),10)||0;c.top+=parseInt(a.css("border-top-width"),10)||0;c.left+=parseInt(a.css("border-left-width"),10)||0;c.width=a.width();c.height=a.height();c={width:c.width+d.padding*2,height:c.height+d.padding*2,top:c.top-d.padding-20,left:c.left-d.padding-20}}else{a=U();c={width:d.padding*2,height:d.padding*2,top:parseInt(a[3]+a[1]*0.5,10),left:parseInt(a[2]+a[0]*0.5,10)}}return c},Z=function(){if(t.is(":visible")){b("div",t).css("top",L*-40+"px");L=(L+1)%12}else clearInterval(K)}; +b.fn.fancybox=function(a){if(!b(this).length)return this;b(this).data("fancybox",b.extend({},a,b.metadata?b(this).metadata():{})).unbind("click.fb").bind("click.fb",function(c){c.preventDefault();if(!h){h=true;b(this).blur();o=[];q=0;c=b(this).attr("rel")||"";if(!c||c==""||c==="nofollow")o.push(this);else{o=b("a[rel="+c+"], area[rel="+c+"]");q=o.index(this)}I()}});return this};b.fancybox=function(a,c){var g;if(!h){h=true;g=typeof c!=="undefined"?c:{};o=[];q=parseInt(g.index,10)||0;if(b.isArray(a)){for(var k= +0,C=a.length;ko.length||q<0)q=0;I()}};b.fancybox.showActivity=function(){clearInterval(K);t.show();K=setInterval(Z,66)};b.fancybox.hideActivity=function(){t.hide()};b.fancybox.next=function(){return b.fancybox.pos(p+ +1)};b.fancybox.prev=function(){return b.fancybox.pos(p-1)};b.fancybox.pos=function(a){if(!h){a=parseInt(a);o=l;if(a>-1&&a1){q=a>=l.length?0:l.length-1;I()}}};b.fancybox.cancel=function(){if(!h){h=true;b.event.trigger("fancybox-cancel");N();e.onCancel(o,q,e);h=false}};b.fancybox.close=function(){function a(){u.fadeOut("fast");n.empty().hide();f.hide();b.event.trigger("fancybox-cleanup");j.empty();d.onClosed(l,p,d);l=e=[];p=q=0;d=e={};h=false}if(!(h||f.is(":hidden"))){h= +true;if(d&&false===d.onCleanup(l,p,d))h=false;else{N();b(E.add(z).add(A)).hide();b(j.add(u)).unbind();b(window).unbind("resize.fb scroll.fb");b(document).unbind("keydown.fb");j.find("iframe").attr("src",M&&/^https/i.test(window.location.href||"")?"javascript:void(false)":"about:blank");d.titlePosition!=="inside"&&n.empty();f.stop();if(d.transitionOut=="elastic"){r=V();var c=f.position();i={top:c.top,left:c.left,width:f.width(),height:f.height()};if(d.opacity)i.opacity=1;n.empty().hide();B.prop=1; +b(B).animate({prop:0},{duration:d.speedOut,easing:d.easingOut,step:T,complete:a})}else f.fadeOut(d.transitionOut=="none"?0:d.speedOut,a)}}};b.fancybox.resize=function(){u.is(":visible")&&u.css("height",b(document).height());b.fancybox.center(true)};b.fancybox.center=function(a){var c,g;if(!h){g=a===true?1:0;c=U();!g&&(f.width()>c[0]||f.height()>c[1])||f.stop().animate({top:parseInt(Math.max(c[3]-20,c[3]+(c[1]-j.height()-40)*0.5-d.padding)),left:parseInt(Math.max(c[2]-20,c[2]+(c[0]-j.width()-40)*0.5- +d.padding))},typeof a=="number"?a:200)}};b.fancybox.init=function(){if(!b("#fancybox-wrap").length){b("body").append(m=b('
    '),t=b('
    '),u=b('
    '),f=b('
    '));D=b('
    ').append('
    ').appendTo(f); +D.append(j=b('
    '),E=b(''),n=b('
    '),z=b(''),A=b(''));E.click(b.fancybox.close);t.click(b.fancybox.cancel);z.click(function(a){a.preventDefault();b.fancybox.prev()});A.click(function(a){a.preventDefault();b.fancybox.next()}); +b.fn.mousewheel&&f.bind("mousewheel.fb",function(a,c){if(h)a.preventDefault();else if(b(a.target).get(0).clientHeight==0||b(a.target).get(0).scrollHeight===b(a.target).get(0).clientHeight){a.preventDefault();b.fancybox[c>0?"prev":"next"]()}});b.support.opacity||f.addClass("fancybox-ie");if(M){t.addClass("fancybox-ie6");f.addClass("fancybox-ie6");b('').prependTo(D)}}}; +b.fn.fancybox.defaults={padding:10,margin:40,opacity:false,modal:false,cyclic:false,scrolling:"auto",width:560,height:340,autoScale:true,autoDimensions:true,centerOnScroll:false,ajax:{},swf:{wmode:"transparent"},hideOnOverlayClick:true,hideOnContentClick:false,overlayShow:true,overlayOpacity:0.7,overlayColor:"#777",titleShow:true,titlePosition:"float",titleFormat:null,titleFromAlt:false,transitionIn:"fade",transitionOut:"fade",speedIn:300,speedOut:300,changeSpeed:300,changeFade:"fast",easingIn:"swing", +easingOut:"swing",showCloseButton:true,showNavArrows:true,enableEscapeButton:true,enableKeyboardNav:true,onStart:function(){},onCancel:function(){},onComplete:function(){},onCleanup:function(){},onClosed:function(){},onError:function(){}};b(document).ready(function(){b.fancybox.init()})})(jQuery); \ No newline at end of file diff --git a/src/wp-content/themes/Broadside/js/jquery.jscrollpane.min.js b/src/wp-content/themes/Broadside/js/jquery.jscrollpane.min.js new file mode 100644 index 0000000..5742335 --- /dev/null +++ b/src/wp-content/themes/Broadside/js/jquery.jscrollpane.min.js @@ -0,0 +1,11 @@ +/* + * jScrollPane - v2.0.0beta10 - 2011-04-17 + * http://jscrollpane.kelvinluck.com/ + * + * Copyright (c) 2010 Kelvin Luck + * Dual licensed under the MIT and GPL licenses. + */ +(function(b,a,c){b.fn.jScrollPane=function(f){function d(E,P){var aA,R=this,Z,al,w,an,U,aa,z,r,aB,aG,aw,j,J,i,k,ab,V,ar,Y,u,B,at,ag,ao,H,m,av,az,y,ax,aJ,g,M,ak=true,Q=true,aI=false,l=false,aq=E.clone(false,false).empty(),ad=b.fn.mwheelIntent?"mwheelIntent.jsp":"mousewheel.jsp";aJ=E.css("paddingTop")+" "+E.css("paddingRight")+" "+E.css("paddingBottom")+" "+E.css("paddingLeft");g=(parseInt(E.css("paddingLeft"),10)||0)+(parseInt(E.css("paddingRight"),10)||0);function au(aS){var aN,aP,aO,aL,aK,aR,aQ=false,aM=false;aA=aS;if(Z===c){aK=E.scrollTop();aR=E.scrollLeft();E.css({overflow:"hidden",padding:0});al=E.innerWidth()+g;w=E.innerHeight();E.width(al);Z=b('
    ').css("padding",aJ).append(E.children());an=b('
    ').css({width:al+"px",height:w+"px"}).append(Z).appendTo(E)}else{E.css("width","");aQ=aA.stickToBottom&&L();aM=aA.stickToRight&&C();aL=E.innerWidth()+g!=al||E.outerHeight()!=w;if(aL){al=E.innerWidth()+g;w=E.innerHeight();an.css({width:al+"px",height:w+"px"})}if(!aL&&M==U&&Z.outerHeight()==aa){E.width(al);return}M=U;Z.css("width","");E.width(al);an.find(">.jspVerticalBar,>.jspHorizontalBar").remove().end()}Z.css("overflow","auto");if(aS.contentWidth){U=aS.contentWidth}else{U=Z[0].scrollWidth}aa=Z[0].scrollHeight;Z.css("overflow","");z=U/al;r=aa/w;aB=r>1;aG=z>1;if(!(aG||aB)){E.removeClass("jspScrollable");Z.css({top:0,width:an.width()-g});o();F();S();x();aj()}else{E.addClass("jspScrollable");aN=aA.maintainPosition&&(J||ab);if(aN){aP=aE();aO=aC()}aH();A();G();if(aN){O(aM?(U-al):aP,false);N(aQ?(aa-w):aO,false)}K();ah();ap();if(aA.enableKeyboardNavigation){T()}if(aA.clickOnTrack){q()}D();if(aA.hijackInternalLinks){n()}}if(aA.autoReinitialise&&!ax){ax=setInterval(function(){au(aA)},aA.autoReinitialiseDelay)}else{if(!aA.autoReinitialise&&ax){clearInterval(ax)}}aK&&E.scrollTop(0)&&N(aK,false);aR&&E.scrollLeft(0)&&O(aR,false);E.trigger("jsp-initialised",[aG||aB])}function aH(){if(aB){an.append(b('
    ').append(b('
    '),b('
    ').append(b('
    ').append(b('
    '),b('
    '))),b('
    ')));V=an.find(">.jspVerticalBar");ar=V.find(">.jspTrack");aw=ar.find(">.jspDrag");if(aA.showArrows){at=b('').bind("mousedown.jsp",aF(0,-1)).bind("click.jsp",aD);ag=b('').bind("mousedown.jsp",aF(0,1)).bind("click.jsp",aD);if(aA.arrowScrollOnHover){at.bind("mouseover.jsp",aF(0,-1,at));ag.bind("mouseover.jsp",aF(0,1,ag))}am(ar,aA.verticalArrowPositions,at,ag)}u=w;an.find(">.jspVerticalBar>.jspCap:visible,>.jspVerticalBar>.jspArrow").each(function(){u-=b(this).outerHeight()});aw.hover(function(){aw.addClass("jspHover")},function(){aw.removeClass("jspHover")}).bind("mousedown.jsp",function(aK){b("html").bind("dragstart.jsp selectstart.jsp",aD);aw.addClass("jspActive");var s=aK.pageY-aw.position().top;b("html").bind("mousemove.jsp",function(aL){W(aL.pageY-s,false)}).bind("mouseup.jsp mouseleave.jsp",ay);return false});p()}}function p(){ar.height(u+"px");J=0;Y=aA.verticalGutter+ar.outerWidth();Z.width(al-Y-g);try{if(V.position().left===0){Z.css("margin-left",Y+"px")}}catch(s){}}function A(){if(aG){an.append(b('
    ').append(b('
    '),b('
    ').append(b('
    ').append(b('
    '),b('
    '))),b('
    ')));ao=an.find(">.jspHorizontalBar");H=ao.find(">.jspTrack");i=H.find(">.jspDrag");if(aA.showArrows){az=b('').bind("mousedown.jsp",aF(-1,0)).bind("click.jsp",aD);y=b('').bind("mousedown.jsp",aF(1,0)).bind("click.jsp",aD); +if(aA.arrowScrollOnHover){az.bind("mouseover.jsp",aF(-1,0,az));y.bind("mouseover.jsp",aF(1,0,y))}am(H,aA.horizontalArrowPositions,az,y)}i.hover(function(){i.addClass("jspHover")},function(){i.removeClass("jspHover")}).bind("mousedown.jsp",function(aK){b("html").bind("dragstart.jsp selectstart.jsp",aD);i.addClass("jspActive");var s=aK.pageX-i.position().left;b("html").bind("mousemove.jsp",function(aL){X(aL.pageX-s,false)}).bind("mouseup.jsp mouseleave.jsp",ay);return false});m=an.innerWidth();ai()}}function ai(){an.find(">.jspHorizontalBar>.jspCap:visible,>.jspHorizontalBar>.jspArrow").each(function(){m-=b(this).outerWidth()});H.width(m+"px");ab=0}function G(){if(aG&&aB){var aK=H.outerHeight(),s=ar.outerWidth();u-=aK;b(ao).find(">.jspCap:visible,>.jspArrow").each(function(){m+=b(this).outerWidth()});m-=s;w-=s;al-=aK;H.parent().append(b('
    ').css("width",aK+"px"));p();ai()}if(aG){Z.width((an.outerWidth()-g)+"px")}aa=Z.outerHeight();r=aa/w;if(aG){av=Math.ceil(1/z*m);if(av>aA.horizontalDragMaxWidth){av=aA.horizontalDragMaxWidth}else{if(avaA.verticalDragMaxHeight){B=aA.verticalDragMaxHeight}else{if(BaU){R.scrollByY(-aR)}else{W(aU)}}else{if(aO>0){if(J+aSaU){R.scrollByX(-aR)}else{X(aU)}}else{if(aO>0){if(ab+aSj){s=j}}if(aK===c){aK=aA.animateScroll}if(aK){R.animate(aw,"top",s,ae)}else{aw.css("top",s);ae(s)}}function ae(aK){if(aK===c){aK=aw.position().top}an.scrollTop(0);J=aK;var aN=J===0,aL=J==j,aM=aK/j,s=-aM*(aa-w);if(ak!=aN||aI!=aL){ak=aN;aI=aL;E.trigger("jsp-arrow-change",[ak,aI,Q,l])}v(aN,aL);Z.css("top",s);E.trigger("jsp-scroll-y",[-s,aN,aL]).trigger("scroll")}function X(aK,s){if(!aG){return}if(aK<0){aK=0}else{if(aK>k){aK=k}}if(s===c){s=aA.animateScroll}if(s){R.animate(i,"left",aK,af) +}else{i.css("left",aK);af(aK)}}function af(aK){if(aK===c){aK=i.position().left}an.scrollTop(0);ab=aK;var aN=ab===0,aM=ab==k,aL=aK/k,s=-aL*(U-al);if(Q!=aN||l!=aM){Q=aN;l=aM;E.trigger("jsp-arrow-change",[ak,aI,Q,l])}t(aN,aM);Z.css("left",s);E.trigger("jsp-scroll-x",[-s,aN,aM]).trigger("scroll")}function v(aK,s){if(aA.showArrows){at[aK?"addClass":"removeClass"]("jspDisabled");ag[s?"addClass":"removeClass"]("jspDisabled")}}function t(aK,s){if(aA.showArrows){az[aK?"addClass":"removeClass"]("jspDisabled");y[s?"addClass":"removeClass"]("jspDisabled")}}function N(s,aK){var aL=s/(aa-w);W(aL*j,aK)}function O(aK,s){var aL=aK/(U-al);X(aL*k,s)}function ac(aX,aS,aL){var aP,aM,aN,s=0,aW=0,aK,aR,aQ,aU,aT,aV;try{aP=b(aX)}catch(aO){return}aM=aP.outerHeight();aN=aP.outerWidth();an.scrollTop(0);an.scrollLeft(0);while(!aP.is(".jspPane")){s+=aP.position().top;aW+=aP.position().left;aP=aP.offsetParent();if(/^body|html$/i.test(aP[0].nodeName)){return}}aK=aC();aQ=aK+w;if(saQ){aT=s-w+aM+aA.verticalGutter}}if(aT){N(aT,aL)}aR=aE();aU=aR+al;if(aWaU){aV=aW-al+aN+aA.horizontalGutter}}if(aV){O(aV,aL)}}function aE(){return -Z.position().left}function aC(){return -Z.position().top}function L(){var s=aa-w;return(s>20)&&(s-aC()<10)}function C(){var s=U-al;return(s>20)&&(s-aE()<10)}function ah(){an.unbind(ad).bind(ad,function(aN,aO,aM,aK){var aL=ab,s=J;R.scrollBy(aM*aA.mouseWheelSpeed,-aK*aA.mouseWheelSpeed,false);return aL==ab&&s==J})}function o(){an.unbind(ad)}function aD(){return false}function K(){Z.find(":input,a").unbind("focus.jsp").bind("focus.jsp",function(s){ac(s.target,false)})}function F(){Z.find(":input,a").unbind("focus.jsp")}function T(){var s,aK,aM=[];aG&&aM.push(ao[0]);aB&&aM.push(V[0]);Z.focus(function(){E.focus()});E.attr("tabindex",0).unbind("keydown.jsp keypress.jsp").bind("keydown.jsp",function(aP){if(aP.target!==this&&!(aM.length&&b(aP.target).closest(aM).length)){return}var aO=ab,aN=J;switch(aP.keyCode){case 40:case 38:case 34:case 32:case 33:case 39:case 37:s=aP.keyCode;aL();break;case 35:N(aa-w);s=null;break;case 36:N(0);s=null;break}aK=aP.keyCode==s&&aO!=ab||aN!=J;return !aK}).bind("keypress.jsp",function(aN){if(aN.keyCode==s){aL()}return !aK});if(aA.hideFocus){E.css("outline","none");if("hideFocus" in an[0]){E.attr("hideFocus",true)}}else{E.css("outline","");if("hideFocus" in an[0]){E.attr("hideFocus",false)}}function aL(){var aO=ab,aN=J;switch(s){case 40:R.scrollByY(aA.keyboardSpeed,false);break;case 38:R.scrollByY(-aA.keyboardSpeed,false);break;case 34:case 32:R.scrollByY(w*aA.scrollPagePercent,false);break;case 33:R.scrollByY(-w*aA.scrollPagePercent,false);break;case 39:R.scrollByX(aA.keyboardSpeed,false);break;case 37:R.scrollByX(-aA.keyboardSpeed,false);break}aK=aO!=ab||aN!=J;return aK}}function S(){E.attr("tabindex","-1").removeAttr("tabindex").unbind("keydown.jsp keypress.jsp")}function D(){if(location.hash&&location.hash.length>1){var aL,aK;try{aL=b(location.hash)}catch(s){return}if(aL.length&&Z.find(location.hash)){if(an.scrollTop()===0){aK=setInterval(function(){if(an.scrollTop()>0){ac(location.hash,true);b(document).scrollTop(an.position().top);clearInterval(aK)}},50)}else{ac(location.hash,true);b(document).scrollTop(an.position().top)}}}}function aj(){b("a.jspHijack").unbind("click.jsp-hijack").removeClass("jspHijack")}function n(){aj();b("a[href^=#]").addClass("jspHijack").bind("click.jsp-hijack",function(){var s=this.href.split("#"),aK;if(s.length>1){aK=s[1];if(aK.length>0&&Z.find("#"+aK).length>0){ac("#"+aK,true);return false}}})}function ap(){var aL,aK,aN,aM,aO,s=false;an.unbind("touchstart.jsp touchmove.jsp touchend.jsp click.jsp-touchclick").bind("touchstart.jsp",function(aP){var aQ=aP.originalEvent.touches[0];aL=aE();aK=aC();aN=aQ.pageX;aM=aQ.pageY;aO=false;s=true}).bind("touchmove.jsp",function(aS){if(!s){return}var aR=aS.originalEvent.touches[0],aQ=ab,aP=J;R.scrollTo(aL+aN-aR.pageX,aK+aM-aR.pageY);aO=aO||Math.abs(aN-aR.pageX)>5||Math.abs(aM-aR.pageY)>5; +return aQ==ab&&aP==J}).bind("touchend.jsp",function(aP){s=false}).bind("click.jsp-touchclick",function(aP){if(aO){aO=false;return false}})}function h(){var s=aC(),aK=aE();E.removeClass("jspScrollable").unbind(".jsp");E.replaceWith(aq.append(Z.children()));aq.scrollTop(s);aq.scrollLeft(aK)}b.extend(R,{reinitialise:function(aK){aK=b.extend({},aA,aK);au(aK)},scrollToElement:function(aL,aK,s){ac(aL,aK,s)},scrollTo:function(aL,s,aK){O(aL,aK);N(s,aK)},scrollToX:function(aK,s){O(aK,s)},scrollToY:function(s,aK){N(s,aK)},scrollToPercentX:function(aK,s){O(aK*(U-al),s)},scrollToPercentY:function(aK,s){N(aK*(aa-w),s)},scrollBy:function(aK,s,aL){R.scrollByX(aK,aL);R.scrollByY(s,aL)},scrollByX:function(s,aL){var aK=aE()+s,aM=aK/(U-al);X(aM*k,aL)},scrollByY:function(s,aL){var aK=aC()+s,aM=aK/(aa-w);W(aM*j,aL)},positionDragX:function(s,aK){X(s,aK)},positionDragY:function(aK,s){W(aK,s)},animate:function(aK,aN,s,aM){var aL={};aL[aN]=s;aK.animate(aL,{duration:aA.animateDuration,ease:aA.animateEase,queue:false,step:aM})},getContentPositionX:function(){return aE()},getContentPositionY:function(){return aC()},getContentWidth:function(){return U},getContentHeight:function(){return aa},getPercentScrolledX:function(){return aE()/(U-al)},getPercentScrolledY:function(){return aC()/(aa-w)},getIsScrollableH:function(){return aG},getIsScrollableV:function(){return aB},getContentPane:function(){return Z},scrollToBottom:function(s){W(j,s)},hijackInternalLinks:function(){n()},destroy:function(){h()}});au(P)}f=b.extend({},b.fn.jScrollPane.defaults,f);b.each(["mouseWheelSpeed","arrowButtonSpeed","trackClickSpeed","keyboardSpeed"],function(){f[this]=f[this]||f.speed});var e;this.each(function(){var g=b(this),h=g.data("jsp");if(h){h.reinitialise(f)}else{h=new d(g,f);g.data("jsp",h)}e=e?e.add(g):g});return e};b.fn.jScrollPane.defaults={showArrows:false,maintainPosition:true,stickToBottom:false,stickToRight:false,clickOnTrack:true,autoReinitialise:false,autoReinitialiseDelay:500,verticalDragMinHeight:0,verticalDragMaxHeight:99999,horizontalDragMinWidth:0,horizontalDragMaxWidth:99999,contentWidth:c,animateScroll:false,animateDuration:300,animateEase:"linear",hijackInternalLinks:false,verticalGutter:4,horizontalGutter:4,mouseWheelSpeed:0,arrowButtonSpeed:0,arrowRepeatFreq:50,arrowScrollOnHover:false,trackClickSpeed:0,trackClickRepeatFreq:70,verticalArrowPositions:"split",horizontalArrowPositions:"split",enableKeyboardNavigation:true,hideFocus:false,keyboardSpeed:0,initialDelay:300,speed:30,scrollPagePercent:0.8}})(jQuery,this); \ No newline at end of file diff --git a/src/wp-content/themes/Broadside/js/jquery.mousewheel.js b/src/wp-content/themes/Broadside/js/jquery.mousewheel.js new file mode 100644 index 0000000..b793241 --- /dev/null +++ b/src/wp-content/themes/Broadside/js/jquery.mousewheel.js @@ -0,0 +1,78 @@ +/*! Copyright (c) 2010 Brandon Aaron (http://brandonaaron.net) + * Licensed under the MIT License (LICENSE.txt). + * + * Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers. + * Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix. + * Thanks to: Seamus Leahy for adding deltaX and deltaY + * + * Version: 3.0.4 + * + * Requires: 1.2.2+ + */ + +(function($) { + +var types = ['DOMMouseScroll', 'mousewheel']; + +$.event.special.mousewheel = { + setup: function() { + if ( this.addEventListener ) { + for ( var i=types.length; i; ) { + this.addEventListener( types[--i], handler, false ); + } + } else { + this.onmousewheel = handler; + } + }, + + teardown: function() { + if ( this.removeEventListener ) { + for ( var i=types.length; i; ) { + this.removeEventListener( types[--i], handler, false ); + } + } else { + this.onmousewheel = null; + } + } +}; + +$.fn.extend({ + mousewheel: function(fn) { + return fn ? this.bind("mousewheel", fn) : this.trigger("mousewheel"); + }, + + unmousewheel: function(fn) { + return this.unbind("mousewheel", fn); + } +}); + + +function handler(event) { + var orgEvent = event || window.event, args = [].slice.call( arguments, 1 ), delta = 0, returnValue = true, deltaX = 0, deltaY = 0; + event = $.event.fix(orgEvent); + event.type = "mousewheel"; + + // Old school scrollwheel delta + if ( event.wheelDelta ) { delta = event.wheelDelta/120; } + if ( event.detail ) { delta = -event.detail/3; } + + // New school multidimensional scroll (touchpads) deltas + deltaY = delta; + + // Gecko + if ( orgEvent.axis !== undefined && orgEvent.axis === orgEvent.HORIZONTAL_AXIS ) { + deltaY = 0; + deltaX = -1*delta; + } + + // Webkit + if ( orgEvent.wheelDeltaY !== undefined ) { deltaY = orgEvent.wheelDeltaY/120; } + if ( orgEvent.wheelDeltaX !== undefined ) { deltaX = -1*orgEvent.wheelDeltaX/120; } + + // Add event and delta to the front of the arguments + args.unshift(event, delta, deltaX, deltaY); + + return $.event.handle.apply(this, args); +} + +})(jQuery); \ No newline at end of file diff --git a/src/wp-content/themes/Broadside/js/jquery.orbit-1.2.3.min.js b/src/wp-content/themes/Broadside/js/jquery.orbit-1.2.3.min.js new file mode 100644 index 0000000..13acb8d --- /dev/null +++ b/src/wp-content/themes/Broadside/js/jquery.orbit-1.2.3.min.js @@ -0,0 +1,17 @@ +/* + * jQuery Orbit Plugin 1.2.3 + * www.ZURB.com/playground + * Copyright 2010, ZURB + * Free to use under the MIT license. + * http://www.opensource.org/licenses/mit-license.php +*/ + +(function(d){d.fn.orbit=function(a){a=d.extend({animation:"horizontal-push",animationSpeed:600,timer:!0,advanceSpeed:4E3,pauseOnHover:!1,startClockOnMouseOut:!1,startClockOnMouseOutAfter:1E3,directionalNav:!0,captions:!0,captionAnimation:"fade",captionAnimationSpeed:600,bullets:!1,bulletThumbs:!1,bulletThumbLocation:"",afterSlideChange:function(){}},a);return this.each(function(){function q(){if(!a.timer||a.timer=="false")return!1;else r.is(":hidden")?s=setInterval(function(){l("next")},a.advanceSpeed): +(o=!0,x.removeClass("active"),s=setInterval(function(){var a="rotate("+m+"deg)";m+=2;t.css({"-webkit-transform":a,"-moz-transform":a,"-o-transform":a});m>180&&(t.addClass("move"),z.addClass("move"));m>360&&(t.removeClass("move"),z.removeClass("move"),m=0,l("next"))},a.advanceSpeed/180))}function n(){if(!a.timer||a.timer=="false")return!1;else o=!1,clearInterval(s),x.addClass("active")}function A(){if(!a.captions||a.captions=="false")return!1;else{var y=e.eq(b).data("caption");(_captionHTML=d(y).html())? +(j.attr("id",y).html(_captionHTML),a.captionAnimation=="none"&&j.show(),a.captionAnimation=="fade"&&j.fadeIn(a.captionAnimationSpeed),a.captionAnimation=="slideOpen"&&j.slideDown(a.captionAnimationSpeed)):(a.captionAnimation=="none"&&j.hide(),a.captionAnimation=="fade"&&j.fadeOut(a.captionAnimationSpeed),a.captionAnimation=="slideOpen"&&j.slideUp(a.captionAnimationSpeed))}}function B(){if(a.bullets)D.children("li").removeClass("active").eq(b).addClass("active");else return!1}function l(d){function c(){e.eq(f).css({"z-index":1}); +u=!1;a.afterSlideChange.call(this)}var f=b,g=d;if(f==g)return!1;if(e.length=="1")return!1;u||(u=!0,d=="next"?(b++,b==p&&(b=0)):d=="prev"?(b--,b<0&&(b=p-1)):(b=d,fb&&(g="prev")),B(),e.eq(f).css({"z-index":2}),a.animation=="fade"&&e.eq(b).css({opacity:0,"z-index":3}).animate({opacity:1},a.animationSpeed,c),a.animation=="horizontal-slide"&&(g=="next"&&e.eq(b).css({left:h,"z-index":3}).animate({left:0},a.animationSpeed,c),g=="prev"&&e.eq(b).css({left:-h,"z-index":3}).animate({left:0},a.animationSpeed, +c)),a.animation=="vertical-slide"&&(g=="prev"&&e.eq(b).css({top:v,"z-index":3}).animate({top:0},a.animationSpeed,c),g=="next"&&e.eq(b).css({top:-v,"z-index":3}).animate({top:0},a.animationSpeed,c)),a.animation=="horizontal-push"&&(g=="next"&&(e.eq(b).css({left:h,"z-index":3}).animate({left:0},a.animationSpeed,c),e.eq(f).animate({left:-h},a.animationSpeed)),g=="prev"&&(e.eq(b).css({left:-h,"z-index":3}).animate({left:0},a.animationSpeed,c),e.eq(f).animate({left:h},a.animationSpeed))),A())}var b=0, +p=0,h,v,u,f=d(this).addClass("orbit"),c=f.wrap('
    ').parent();f.add(h).width("1px").height("1px");var e=f.children("img, a, div");e.each(function(){var a=d(this),b=a.width(),a=a.height();b>f.width()&&(f.add(c).width(b),h=f.width());a>f.height()&&(f.add(c).height(a),v=f.height());p++});if(e.length==1)a.directionalNav=!1,a.timer=!1,a.bullets=!1;e.eq(b).css({"z-index":3}).fadeIn(function(){e.css({display:"block"})});if(a.timer){c.append('
    '); +var r=d("div.timer"),o;if(r.length!=0){var t=d("div.timer span.rotator"),z=d("div.timer span.mask"),x=d("div.timer span.pause"),m=0,s;q();r.click(function(){o?n():q()});if(a.startClockOnMouseOut){var C;c.mouseleave(function(){C=setTimeout(function(){o||q()},a.startClockOnMouseOutAfter)});c.mouseenter(function(){clearTimeout(C)})}}}a.pauseOnHover&&c.mouseenter(function(){n()});if(a.captions){c.append('
    ');var j=c.children(".orbit-caption");A()}if(a.directionalNav){if(a.directionalNav== +"false")return!1;c.append('
    RightLeft
    ');var k=c.children("div.slider-nav").children("span.left"),w=c.children("div.slider-nav").children("span.right");k.click(function(){n();l("prev")});w.click(function(){n();l("next")})}if(a.bullets){c.append('
      ');var D=d("ul.orbit-bullets");for(i=0;i"+(i+1)+"
    • ");if(a.bulletThumbs&&(w=e.eq(i).data("thumb")))k=d('
    • '+ +i+"
    • "),k.css({background:"url("+a.bulletThumbLocation+w+") no-repeat"});d("ul.orbit-bullets").append(k);k.data("index",i);k.click(function(){n();l(d(this).data("index"))})}B()}})}})(jQuery); \ No newline at end of file diff --git a/src/wp-content/themes/Broadside/js/jquery.validate.min.js b/src/wp-content/themes/Broadside/js/jquery.validate.min.js new file mode 100644 index 0000000..6264866 --- /dev/null +++ b/src/wp-content/themes/Broadside/js/jquery.validate.min.js @@ -0,0 +1,16 @@ +/* + * jQuery validation plug-in 1.7 + * + * http://bassistance.de/jquery-plugins/jquery-plugin-validation/ + * http://docs.jquery.com/Plugins/Validation + * + * Copyright (c) 2006 - 2008 Jörn Zaefferer + * + * $Id: jquery.validate.js 6403 2009-06-17 14:27:16Z joern.zaefferer $ + * + * Dual licensed under the MIT and GPL licenses: + * http://www.opensource.org/licenses/mit-license.php + * http://www.gnu.org/licenses/gpl.html + */ +(function($){$.extend($.fn,{validate:function(options){if(!this.length){options&&options.debug&&window.console&&console.warn("nothing selected, can't validate, returning nothing");return;}var validator=$.data(this[0],'validator');if(validator){return validator;}validator=new $.validator(options,this[0]);$.data(this[0],'validator',validator);if(validator.settings.onsubmit){this.find("input, button").filter(".cancel").click(function(){validator.cancelSubmit=true;});if(validator.settings.submitHandler){this.find("input, button").filter(":submit").click(function(){validator.submitButton=this;});}this.submit(function(event){if(validator.settings.debug)event.preventDefault();function handle(){if(validator.settings.submitHandler){if(validator.submitButton){var hidden=$("").attr("name",validator.submitButton.name).val(validator.submitButton.value).appendTo(validator.currentForm);}validator.settings.submitHandler.call(validator,validator.currentForm);if(validator.submitButton){hidden.remove();}return false;}return true;}if(validator.cancelSubmit){validator.cancelSubmit=false;return handle();}if(validator.form()){if(validator.pendingRequest){validator.formSubmitted=true;return false;}return handle();}else{validator.focusInvalid();return false;}});}return validator;},valid:function(){if($(this[0]).is('form')){return this.validate().form();}else{var valid=true;var validator=$(this[0].form).validate();this.each(function(){valid&=validator.element(this);});return valid;}},removeAttrs:function(attributes){var result={},$element=this;$.each(attributes.split(/\s/),function(index,value){result[value]=$element.attr(value);$element.removeAttr(value);});return result;},rules:function(command,argument){var element=this[0];if(command){var settings=$.data(element.form,'validator').settings;var staticRules=settings.rules;var existingRules=$.validator.staticRules(element);switch(command){case"add":$.extend(existingRules,$.validator.normalizeRule(argument));staticRules[element.name]=existingRules;if(argument.messages)settings.messages[element.name]=$.extend(settings.messages[element.name],argument.messages);break;case"remove":if(!argument){delete staticRules[element.name];return existingRules;}var filtered={};$.each(argument.split(/\s/),function(index,method){filtered[method]=existingRules[method];delete existingRules[method];});return filtered;}}var data=$.validator.normalizeRules($.extend({},$.validator.metadataRules(element),$.validator.classRules(element),$.validator.attributeRules(element),$.validator.staticRules(element)),element);if(data.required){var param=data.required;delete data.required;data=$.extend({required:param},data);}return data;}});$.extend($.expr[":"],{blank:function(a){return!$.trim(""+a.value);},filled:function(a){return!!$.trim(""+a.value);},unchecked:function(a){return!a.checked;}});$.validator=function(options,form){this.settings=$.extend(true,{},$.validator.defaults,options);this.currentForm=form;this.init();};$.validator.format=function(source,params){if(arguments.length==1)return function(){var args=$.makeArray(arguments);args.unshift(source);return $.validator.format.apply(this,args);};if(arguments.length>2&¶ms.constructor!=Array){params=$.makeArray(arguments).slice(1);}if(params.constructor!=Array){params=[params];}$.each(params,function(i,n){source=source.replace(new RegExp("\\{"+i+"\\}","g"),n);});return source;};$.extend($.validator,{defaults:{messages:{},groups:{},rules:{},errorClass:"error",validClass:"valid",errorElement:"label",focusInvalid:true,errorContainer:$([]),errorLabelContainer:$([]),onsubmit:true,ignore:[],ignoreTitle:false,onfocusin:function(element){this.lastActive=element;if(this.settings.focusCleanup&&!this.blockFocusCleanup){this.settings.unhighlight&&this.settings.unhighlight.call(this,element,this.settings.errorClass,this.settings.validClass);this.errorsFor(element).hide();}},onfocusout:function(element){if(!this.checkable(element)&&(element.name in this.submitted||!this.optional(element))){this.element(element);}},onkeyup:function(element){if(element.name in this.submitted||element==this.lastElement){this.element(element);}},onclick:function(element){if(element.name in this.submitted)this.element(element);else if(element.parentNode.name in this.submitted)this.element(element.parentNode);},highlight:function(element,errorClass,validClass){$(element).addClass(errorClass).removeClass(validClass);},unhighlight:function(element,errorClass,validClass){$(element).removeClass(errorClass).addClass(validClass);}},setDefaults:function(settings){$.extend($.validator.defaults,settings);},messages:{required:"This field is required.",remote:"Please fix this field.",email:"Please enter a valid email address.",url:"Please enter a valid URL.",date:"Please enter a valid date.",dateISO:"Please enter a valid date (ISO).",number:"Please enter a valid number.",digits:"Please enter only digits.",creditcard:"Please enter a valid credit card number.",equalTo:"Please enter the same value again.",accept:"Please enter a value with a valid extension.",maxlength:$.validator.format("Please enter no more than {0} characters."),minlength:$.validator.format("Please enter at least {0} characters."),rangelength:$.validator.format("Please enter a value between {0} and {1} characters long."),range:$.validator.format("Please enter a value between {0} and {1}."),max:$.validator.format("Please enter a value less than or equal to {0}."),min:$.validator.format("Please enter a value greater than or equal to {0}.")},autoCreateRanges:false,prototype:{init:function(){this.labelContainer=$(this.settings.errorLabelContainer);this.errorContext=this.labelContainer.length&&this.labelContainer||$(this.currentForm);this.containers=$(this.settings.errorContainer).add(this.settings.errorLabelContainer);this.submitted={};this.valueCache={};this.pendingRequest=0;this.pending={};this.invalid={};this.reset();var groups=(this.groups={});$.each(this.settings.groups,function(key,value){$.each(value.split(/\s/),function(index,name){groups[name]=key;});});var rules=this.settings.rules;$.each(rules,function(key,value){rules[key]=$.validator.normalizeRule(value);});function delegate(event){var validator=$.data(this[0].form,"validator"),eventType="on"+event.type.replace(/^validate/,"");validator.settings[eventType]&&validator.settings[eventType].call(validator,this[0]);}$(this.currentForm).validateDelegate(":text, :password, :file, select, textarea","focusin focusout keyup",delegate).validateDelegate(":radio, :checkbox, select, option","click",delegate);if(this.settings.invalidHandler)$(this.currentForm).bind("invalid-form.validate",this.settings.invalidHandler);},form:function(){this.checkForm();$.extend(this.submitted,this.errorMap);this.invalid=$.extend({},this.errorMap);if(!this.valid())$(this.currentForm).triggerHandler("invalid-form",[this]);this.showErrors();return this.valid();},checkForm:function(){this.prepareForm();for(var i=0,elements=(this.currentElements=this.elements());elements[i];i++){this.check(elements[i]);}return this.valid();},element:function(element){element=this.clean(element);this.lastElement=element;this.prepareElement(element);this.currentElements=$(element);var result=this.check(element);if(result){delete this.invalid[element.name];}else{this.invalid[element.name]=true;}if(!this.numberOfInvalids()){this.toHide=this.toHide.add(this.containers);}this.showErrors();return result;},showErrors:function(errors){if(errors){$.extend(this.errorMap,errors);this.errorList=[];for(var name in errors){this.errorList.push({message:errors[name],element:this.findByName(name)[0]});}this.successList=$.grep(this.successList,function(element){return!(element.name in errors);});}this.settings.showErrors?this.settings.showErrors.call(this,this.errorMap,this.errorList):this.defaultShowErrors();},resetForm:function(){if($.fn.resetForm)$(this.currentForm).resetForm();this.submitted={};this.prepareForm();this.hideErrors();this.elements().removeClass(this.settings.errorClass);},numberOfInvalids:function(){return this.objectLength(this.invalid);},objectLength:function(obj){var count=0;for(var i in obj)count++;return count;},hideErrors:function(){this.addWrapper(this.toHide).hide();},valid:function(){return this.size()==0;},size:function(){return this.errorList.length;},focusInvalid:function(){if(this.settings.focusInvalid){try{$(this.findLastActive()||this.errorList.length&&this.errorList[0].element||[]).filter(":visible").focus().trigger("focusin");}catch(e){}}},findLastActive:function(){var lastActive=this.lastActive;return lastActive&&$.grep(this.errorList,function(n){return n.element.name==lastActive.name;}).length==1&&lastActive;},elements:function(){var validator=this,rulesCache={};return $([]).add(this.currentForm.elements).filter(":input").not(":submit, :reset, :image, [disabled]").not(this.settings.ignore).filter(function(){!this.name&&validator.settings.debug&&window.console&&console.error("%o has no name assigned",this);if(this.name in rulesCache||!validator.objectLength($(this).rules()))return false;rulesCache[this.name]=true;return true;});},clean:function(selector){return $(selector)[0];},errors:function(){return $(this.settings.errorElement+"."+this.settings.errorClass,this.errorContext);},reset:function(){this.successList=[];this.errorList=[];this.errorMap={};this.toShow=$([]);this.toHide=$([]);this.currentElements=$([]);},prepareForm:function(){this.reset();this.toHide=this.errors().add(this.containers);},prepareElement:function(element){this.reset();this.toHide=this.errorsFor(element);},check:function(element){element=this.clean(element);if(this.checkable(element)){element=this.findByName(element.name)[0];}var rules=$(element).rules();var dependencyMismatch=false;for(method in rules){var rule={method:method,parameters:rules[method]};try{var result=$.validator.methods[method].call(this,element.value.replace(/\r/g,""),element,rule.parameters);if(result=="dependency-mismatch"){dependencyMismatch=true;continue;}dependencyMismatch=false;if(result=="pending"){this.toHide=this.toHide.not(this.errorsFor(element));return;}if(!result){this.formatAndAdd(element,rule);return false;}}catch(e){this.settings.debug&&window.console&&console.log("exception occured when checking element "+element.id ++", check the '"+rule.method+"' method",e);throw e;}}if(dependencyMismatch)return;if(this.objectLength(rules))this.successList.push(element);return true;},customMetaMessage:function(element,method){if(!$.metadata)return;var meta=this.settings.meta?$(element).metadata()[this.settings.meta]:$(element).metadata();return meta&&meta.messages&&meta.messages[method];},customMessage:function(name,method){var m=this.settings.messages[name];return m&&(m.constructor==String?m:m[method]);},findDefined:function(){for(var i=0;iWarning: No message defined for "+element.name+"");},formatAndAdd:function(element,rule){var message=this.defaultMessage(element,rule.method),theregex=/\$?\{(\d+)\}/g;if(typeof message=="function"){message=message.call(this,rule.parameters,element);}else if(theregex.test(message)){message=jQuery.format(message.replace(theregex,'{$1}'),rule.parameters);}this.errorList.push({message:message,element:element});this.errorMap[element.name]=message;this.submitted[element.name]=message;},addWrapper:function(toToggle){if(this.settings.wrapper)toToggle=toToggle.add(toToggle.parent(this.settings.wrapper));return toToggle;},defaultShowErrors:function(){for(var i=0;this.errorList[i];i++){var error=this.errorList[i];this.settings.highlight&&this.settings.highlight.call(this,error.element,this.settings.errorClass,this.settings.validClass);this.showLabel(error.element,error.message);}if(this.errorList.length){this.toShow=this.toShow.add(this.containers);}if(this.settings.success){for(var i=0;this.successList[i];i++){this.showLabel(this.successList[i]);}}if(this.settings.unhighlight){for(var i=0,elements=this.validElements();elements[i];i++){this.settings.unhighlight.call(this,elements[i],this.settings.errorClass,this.settings.validClass);}}this.toHide=this.toHide.not(this.toShow);this.hideErrors();this.addWrapper(this.toShow).show();},validElements:function(){return this.currentElements.not(this.invalidElements());},invalidElements:function(){return $(this.errorList).map(function(){return this.element;});},showLabel:function(element,message){var label=this.errorsFor(element);if(label.length){label.removeClass().addClass(this.settings.errorClass);label.attr("generated")&&label.html(message);}else{label=$("<"+this.settings.errorElement+"/>").attr({"for":this.idOrName(element),generated:true}).addClass(this.settings.errorClass).html(message||"");if(this.settings.wrapper){label=label.hide().show().wrap("<"+this.settings.wrapper+"/>").parent();}if(!this.labelContainer.append(label).length)this.settings.errorPlacement?this.settings.errorPlacement(label,$(element)):label.insertAfter(element);}if(!message&&this.settings.success){label.text("");typeof this.settings.success=="string"?label.addClass(this.settings.success):this.settings.success(label);}this.toShow=this.toShow.add(label);},errorsFor:function(element){var name=this.idOrName(element);return this.errors().filter(function(){return $(this).attr('for')==name;});},idOrName:function(element){return this.groups[element.name]||(this.checkable(element)?element.name:element.id||element.name);},checkable:function(element){return/radio|checkbox/i.test(element.type);},findByName:function(name){var form=this.currentForm;return $(document.getElementsByName(name)).map(function(index,element){return element.form==form&&element.name==name&&element||null;});},getLength:function(value,element){switch(element.nodeName.toLowerCase()){case'select':return $("option:selected",element).length;case'input':if(this.checkable(element))return this.findByName(element.name).filter(':checked').length;}return value.length;},depend:function(param,element){return this.dependTypes[typeof param]?this.dependTypes[typeof param](param,element):true;},dependTypes:{"boolean":function(param,element){return param;},"string":function(param,element){return!!$(param,element.form).length;},"function":function(param,element){return param(element);}},optional:function(element){return!$.validator.methods.required.call(this,$.trim(element.value),element)&&"dependency-mismatch";},startRequest:function(element){if(!this.pending[element.name]){this.pendingRequest++;this.pending[element.name]=true;}},stopRequest:function(element,valid){this.pendingRequest--;if(this.pendingRequest<0)this.pendingRequest=0;delete this.pending[element.name];if(valid&&this.pendingRequest==0&&this.formSubmitted&&this.form()){$(this.currentForm).submit();this.formSubmitted=false;}else if(!valid&&this.pendingRequest==0&&this.formSubmitted){$(this.currentForm).triggerHandler("invalid-form",[this]);this.formSubmitted=false;}},previousValue:function(element){return $.data(element,"previousValue")||$.data(element,"previousValue",{old:null,valid:true,message:this.defaultMessage(element,"remote")});}},classRuleSettings:{required:{required:true},email:{email:true},url:{url:true},date:{date:true},dateISO:{dateISO:true},dateDE:{dateDE:true},number:{number:true},numberDE:{numberDE:true},digits:{digits:true},creditcard:{creditcard:true}},addClassRules:function(className,rules){className.constructor==String?this.classRuleSettings[className]=rules:$.extend(this.classRuleSettings,className);},classRules:function(element){var rules={};var classes=$(element).attr('class');classes&&$.each(classes.split(' '),function(){if(this in $.validator.classRuleSettings){$.extend(rules,$.validator.classRuleSettings[this]);}});return rules;},attributeRules:function(element){var rules={};var $element=$(element);for(method in $.validator.methods){var value=$element.attr(method);if(value){rules[method]=value;}}if(rules.maxlength&&/-1|2147483647|524288/.test(rules.maxlength)){delete rules.maxlength;}return rules;},metadataRules:function(element){if(!$.metadata)return{};var meta=$.data(element.form,'validator').settings.meta;return meta?$(element).metadata()[meta]:$(element).metadata();},staticRules:function(element){var rules={};var validator=$.data(element.form,'validator');if(validator.settings.rules){rules=$.validator.normalizeRule(validator.settings.rules[element.name])||{};}return rules;},normalizeRules:function(rules,element){$.each(rules,function(prop,val){if(val===false){delete rules[prop];return;}if(val.param||val.depends){var keepRule=true;switch(typeof val.depends){case"string":keepRule=!!$(val.depends,element.form).length;break;case"function":keepRule=val.depends.call(element,element);break;}if(keepRule){rules[prop]=val.param!==undefined?val.param:true;}else{delete rules[prop];}}});$.each(rules,function(rule,parameter){rules[rule]=$.isFunction(parameter)?parameter(element):parameter;});$.each(['minlength','maxlength','min','max'],function(){if(rules[this]){rules[this]=Number(rules[this]);}});$.each(['rangelength','range'],function(){if(rules[this]){rules[this]=[Number(rules[this][0]),Number(rules[this][1])];}});if($.validator.autoCreateRanges){if(rules.min&&rules.max){rules.range=[rules.min,rules.max];delete rules.min;delete rules.max;}if(rules.minlength&&rules.maxlength){rules.rangelength=[rules.minlength,rules.maxlength];delete rules.minlength;delete rules.maxlength;}}if(rules.messages){delete rules.messages;}return rules;},normalizeRule:function(data){if(typeof data=="string"){var transformed={};$.each(data.split(/\s/),function(){transformed[this]=true;});data=transformed;}return data;},addMethod:function(name,method,message){$.validator.methods[name]=method;$.validator.messages[name]=message!=undefined?message:$.validator.messages[name];if(method.length<3){$.validator.addClassRules(name,$.validator.normalizeRule(name));}},methods:{required:function(value,element,param){if(!this.depend(param,element))return"dependency-mismatch";switch(element.nodeName.toLowerCase()){case'select':var val=$(element).val();return val&&val.length>0;case'input':if(this.checkable(element))return this.getLength(value,element)>0;default:return $.trim(value).length>0;}},remote:function(value,element,param){if(this.optional(element))return"dependency-mismatch";var previous=this.previousValue(element);if(!this.settings.messages[element.name])this.settings.messages[element.name]={};previous.originalMessage=this.settings.messages[element.name].remote;this.settings.messages[element.name].remote=previous.message;param=typeof param=="string"&&{url:param}||param;if(previous.old!==value){previous.old=value;var validator=this;this.startRequest(element);var data={};data[element.name]=value;$.ajax($.extend(true,{url:param,mode:"abort",port:"validate"+element.name,dataType:"json",data:data,success:function(response){validator.settings.messages[element.name].remote=previous.originalMessage;var valid=response===true;if(valid){var submitted=validator.formSubmitted;validator.prepareElement(element);validator.formSubmitted=submitted;validator.successList.push(element);validator.showErrors();}else{var errors={};var message=(previous.message=response||validator.defaultMessage(element,"remote"));errors[element.name]=$.isFunction(message)?message(value):message;validator.showErrors(errors);}previous.valid=valid;validator.stopRequest(element,valid);}},param));return"pending";}else if(this.pending[element.name]){return"pending";}return previous.valid;},minlength:function(value,element,param){return this.optional(element)||this.getLength($.trim(value),element)>=param;},maxlength:function(value,element,param){return this.optional(element)||this.getLength($.trim(value),element)<=param;},rangelength:function(value,element,param){var length=this.getLength($.trim(value),element);return this.optional(element)||(length>=param[0]&&length<=param[1]);},min:function(value,element,param){return this.optional(element)||value>=param;},max:function(value,element,param){return this.optional(element)||value<=param;},range:function(value,element,param){return this.optional(element)||(value>=param[0]&&value<=param[1]);},email:function(value,element){return this.optional(element)||/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i.test(value);},url:function(value,element){return this.optional(element)||/^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(value);},date:function(value,element){return this.optional(element)||!/Invalid|NaN/.test(new Date(value));},dateISO:function(value,element){return this.optional(element)||/^\d{4}[\/-]\d{1,2}[\/-]\d{1,2}$/.test(value);},number:function(value,element){return this.optional(element)||/^-?(?:\d+|\d{1,3}(?:,\d{3})+)(?:\.\d+)?$/.test(value);},digits:function(value,element){return this.optional(element)||/^\d+$/.test(value);},creditcard:function(value,element){if(this.optional(element))return"dependency-mismatch";if(/[^0-9-]+/.test(value))return false;var nCheck=0,nDigit=0,bEven=false;value=value.replace(/\D/g,"");for(var n=value.length-1;n>=0;n--){var cDigit=value.charAt(n);var nDigit=parseInt(cDigit,10);if(bEven){if((nDigit*=2)>9)nDigit-=9;}nCheck+=nDigit;bEven=!bEven;}return(nCheck%10)==0;},accept:function(value,element,param){param=typeof param=="string"?param.replace(/,/g,'|'):"png|jpe?g|gif";return this.optional(element)||value.match(new RegExp(".("+param+")$","i"));},equalTo:function(value,element,param){var target=$(param).unbind(".validate-equalTo").bind("blur.validate-equalTo",function(){$(element).valid();});return value==target.val();}}});$.format=$.validator.format;})(jQuery);;(function($){var ajax=$.ajax;var pendingRequests={};$.ajax=function(settings){settings=$.extend(settings,$.extend({},$.ajaxSettings,settings));var port=settings.port;if(settings.mode=="abort"){if(pendingRequests[port]){pendingRequests[port].abort();}return(pendingRequests[port]=ajax.apply(this,arguments));}return ajax.apply(this,arguments);};})(jQuery);;(function($){if(!jQuery.event.special.focusin&&!jQuery.event.special.focusout&&document.addEventListener){$.each({focus:'focusin',blur:'focusout'},function(original,fix){$.event.special[fix]={setup:function(){this.addEventListener(original,handler,true);},teardown:function(){this.removeEventListener(original,handler,true);},handler:function(e){arguments[0]=$.event.fix(e);arguments[0].type=fix;return $.event.handle.apply(this,arguments);}};function handler(e){e=$.event.fix(e);e.type=fix;return $.event.handle.call(this,e);}});};$.extend($.fn,{validateDelegate:function(delegate,type,handler){return this.bind(type,function(event){var target=$(event.target);if(target.is(delegate)){return handler.apply(target,arguments);}});}});})(jQuery); \ No newline at end of file diff --git a/src/wp-content/themes/Broadside/js/superfish.js b/src/wp-content/themes/Broadside/js/superfish.js new file mode 100644 index 0000000..c6a9c7d --- /dev/null +++ b/src/wp-content/themes/Broadside/js/superfish.js @@ -0,0 +1,121 @@ + +/* + * Superfish v1.4.8 - jQuery menu widget + * Copyright (c) 2008 Joel Birch + * + * Dual licensed under the MIT and GPL licenses: + * http://www.opensource.org/licenses/mit-license.php + * http://www.gnu.org/licenses/gpl.html + * + * CHANGELOG: http://users.tpg.com.au/j_birch/plugins/superfish/changelog.txt + */ + +;(function($){ + $.fn.superfish = function(op){ + + var sf = $.fn.superfish, + c = sf.c, + $arrow = $([' »'].join('')), + over = function(){ + var $$ = $(this), menu = getMenu($$); + clearTimeout(menu.sfTimer); + $$.showSuperfishUl().siblings().hideSuperfishUl(); + }, + out = function(){ + var $$ = $(this), menu = getMenu($$), o = sf.op; + clearTimeout(menu.sfTimer); + menu.sfTimer=setTimeout(function(){ + o.retainPath=($.inArray($$[0],o.$path)>-1); + $$.hideSuperfishUl(); + if (o.$path.length && $$.parents(['li.',o.hoverClass].join('')).length<1){over.call(o.$path);} + },o.delay); + }, + getMenu = function($menu){ + var menu = $menu.parents(['ul.',c.menuClass,':first'].join(''))[0]; + sf.op = sf.o[menu.serial]; + return menu; + }, + addArrow = function($a){ $a.addClass(c.anchorClass).append($arrow.clone()); }; + + return this.each(function() { + var s = this.serial = sf.o.length; + var o = $.extend({},sf.defaults,op); + o.$path = $('li.'+o.pathClass,this).slice(0,o.pathLevels).each(function(){ + $(this).addClass([o.hoverClass,c.bcClass].join(' ')) + .filter('li:has(ul)').removeClass(o.pathClass); + }); + sf.o[s] = sf.op = o; + + $('li:has(ul)',this)[($.fn.hoverIntent && !o.disableHI) ? 'hoverIntent' : 'hover'](over,out).each(function() { + if (o.autoArrows) addArrow( $('>a:first-child',this) ); + }) + .not('.'+c.bcClass) + .hideSuperfishUl(); + + var $a = $('a',this); + $a.each(function(i){ + var $li = $a.eq(i).parents('li'); + $a.eq(i).focus(function(){over.call($li);}).blur(function(){out.call($li);}); + }); + o.onInit.call(this); + + }).each(function() { + var menuClasses = [c.menuClass]; + if (sf.op.dropShadows && !($.browser.msie && $.browser.version < 7)) menuClasses.push(c.shadowClass); + $(this).addClass(menuClasses.join(' ')); + }); + }; + + var sf = $.fn.superfish; + sf.o = []; + sf.op = {}; + sf.IE7fix = function(){ + var o = sf.op; + if ($.browser.msie && $.browser.version > 6 && o.dropShadows && o.animation.opacity!=undefined) + this.toggleClass(sf.c.shadowClass+'-off'); + }; + sf.c = { + bcClass : 'sf-breadcrumb', + menuClass : 'sf-js-enabled', + anchorClass : 'sf-with-ul', + arrowClass : 'sf-sub-indicator', + shadowClass : 'sf-shadow' + }; + sf.defaults = { + hoverClass : 'sfHover', + pathClass : 'overideThisToUse', + pathLevels : 1, + delay : 800, + animation : {opacity:'show'}, + speed : 'normal', + autoArrows : true, + dropShadows : true, + disableHI : false, // true disables hoverIntent detection + onInit : function(){}, // callback functions + onBeforeShow: function(){}, + onShow : function(){}, + onHide : function(){} + }; + $.fn.extend({ + hideSuperfishUl : function(){ + var o = sf.op, + not = (o.retainPath===true) ? o.$path : ''; + o.retainPath = false; + var $ul = $(['li.',o.hoverClass].join(''),this).add(this).not(not).removeClass(o.hoverClass) + .find('>ul').hide().css('visibility','hidden'); + o.onHide.call($ul); + return this; + }, + showSuperfishUl : function(){ + var o = sf.op, + sh = sf.c.shadowClass+'-off', + $ul = this.addClass(o.hoverClass) + .find('>ul:hidden').css('visibility','visible'); + sf.IE7fix.call($ul); + o.onBeforeShow.call($ul); + $ul.animate(o.animation,o.speed,function(){ sf.IE7fix.call($ul); o.onShow.call($ul); }); + return this; + } + }); + +})(jQuery); diff --git a/src/wp-content/themes/Broadside/options.php b/src/wp-content/themes/Broadside/options.php new file mode 100644 index 0000000..5946578 --- /dev/null +++ b/src/wp-content/themes/Broadside/options.php @@ -0,0 +1,276 @@ +cat_ID] = $category->cat_name; + } + + // Pull all the pages into an array + $options_pages = array(); + $options_pages_obj = get_pages('sort_column=post_parent,menu_order'); + $options_pages[''] = 'Select a page:'; + foreach ($options_pages_obj as $page) { + $options_pages[$page->ID] = $page->post_title; + } + + // If using image radio buttons, define a directory path + $imagepath = get_bloginfo('stylesheet_directory') . '/images/'; + + $options = array(); + + $options[] = array("name" => "Basic Settings", + "type" => "heading"); + + $options[] = array( "name" => "Email Address", + "desc" => "Enter the email address that you would like to use for the social-networking icons.", + "id" => "email_address", + "std" => "", + "type" => "text"); + + $options[] = array( "name" => "Footer Text", + "desc" => "Add your copyright phrase or any text to be displayed below the footer (e.g. Copyright 2012. Designed by ProgressionStudios)", + "id" => "footer_text", + "std" => "Copyright © 2011 – MQ –
      info@mqarquitects.com", + "type" => "textarea"); + + $options[] = array("name" => "Social Settings", + "type" => "heading"); + + $options[] = array( "name" => "Facebook Link", + "desc" => "Enter the Facebook Link that you would like to use for the social-networking icons. Note: Use http://", + "id" => "facebook_link", + "std" => "", + "type" => "text"); + + $options[] = array( "name" => "Twitter ID", + "desc" => "Enter the Twitter Link that you would like to use for the social-networking icons. Use http://", + "id" => "twitter_id", + "std" => "", + "type" => "text"); + + $options[] = array( "name" => "Flickr Link", + "desc" => "Enter the Flickr Link that you would like to use for the social-networking icons. Use http://", + "id" => "flickr_link", + "std" => "", + "type" => "text"); + + $options[] = array( "name" => "Vimeo Link", + "desc" => "Enter the Vimeo Link that you would like to use for the social-networking icons. Use http://", + "id" => "vimeo_link", + "std" => "", + "type" => "text"); + + $options[] = array( "name" => "Google Link", + "desc" => "Enter the Google Link that you would like to use for the social-networking icons. Use http://", + "id" => "google_link", + "std" => "", + "type" => "text"); + + $options[] = array( "name" => "StumbleUpon Link", + "desc" => "Enter the StumbleUpon Link that you would like to use for the social-networking icons. Use http://", + "id" => "Stumbleupon_link", + "std" => "", + "type" => "text"); + + $options[] = array( "name" => "Youtube Link", + "desc" => "Enter the Youtube Link that you would like to use for the social-networking icons. Use http://", + "id" => "youtube_link", + "std" => "", + "type" => "text"); + + $options[] = array("name" => "Appearence", + "type" => "heading"); + + $options[] = array( "name" => "Logo", + "desc" => "Use the upload button to upload your site's logo and then click 'Use this image'. The Maximum width is 270px. The navigation menu is 180px wide. Note: You will have to resize your own logo before uploading.", + "id" => "logo", + "std" => get_template_directory_uri() . "/images/logo.png", + "type" => "upload"); + + $options[] = array( "name" => "Logo Position", + "desc" => "This changes the Logo position to the top or bottom. Note: The Navigation position should be set to the opposite.", + "id" => "logo_position", + "std" => "top", + "type" => "select", + "class" => "mini", + "options" => array('top' => 'Top', 'bottom' => 'Bottom')); + + $options[] = array( "name" => "Navigation Position", + "desc" => "This changes the Navigation position to the top or bottom. Note: The Logo position should be set to the opposite.", + "id" => "nav_position", + "std" => "bottom", + "type" => "select", + "class" => "mini", + "options" => array('top' => 'Top', 'bottom' => 'Bottom')); + + $options[] = array( "name" => "Favicon", + "desc" => "Use the upload button to upload your favicon (bookmark icon) and then click 'Use this image'.", + "id" => "favicon", + "std" => "", + "type" => "upload"); + + $options[] = array( "name" => "Default Background (Required)", + "desc" => "This is used for the default background image of your website. It will automatically be resized to fit your browser window. Use the upload button to upload your own background and then click 'Use this image'. The default image(in case you delete it) should be located at: /wp-content/themes/Broadside/images/background.jpg", + "id" => "default_bg", + "std" => get_template_directory_uri() . "/images/background.jpg", + "type" => "upload"); + + $options[] = array( "name" => "Default Content Background (Required)", + "desc" => "This is a content background image of your website. It will automatically be resized to fit your content window. Use the upload button to upload your own background and then click 'Use this image'. The default image(in case you delete it) should be located at: /wp-content/themes/Broadside/images/backgrounds/blog-background.jpg", + "id" => "blog_bg", + "std" => get_template_directory_uri() . "/images/backgrounds/blog-background.jpg", + "type" => "upload"); + + $options[] = array( "name" => "Site Height", + "desc" => "Use this to adjust your site overall height. 'The Space' Live Preview is 600px tall, and 'The Architects' Live Preview is 500px tall. ", + "id" => "site_height", + "std" => "500", + "class" => "mini", + "type" => "text"); + + $options[] = array( "name" => "Scrollbar Height", + "desc" => "Use this to adjust at what height the scrollbar will be activated. This will depend on how tall you adjust your site height. ", + "id" => "scrollbar_height", + "std" => "330", + "class" => "mini", + "type" => "text"); + + $options[] = array( "name" => "Menu Background", + "desc" => "Use this to change the Menu background color. This includes the navigation and logo background. The default for 'The Space' is #b8174d and the default for 'The Architects' is #f20a0a.", + "id" => "menu_bg", + "std" => "#f20a0a", + "type" => "color"); + + $options[] = array( "name" => "Headings Color", + "desc" => "Use this to change the main headings color. The default for 'The Space' is #000000 and the default for 'The Architects' is #f20a0a.", + "id" => "headings_color", + "std" => "#f20a0a", + "type" => "color"); + + $options[] = array( "name" => "Static Menu", + "desc" => "Use this setting to remove the show/hide on the navigation menu. When marked yes, the navigation menu will be visible at all times.", + "id" => "static_menu", + "std" => "no", + "type" => "select", + "class" => "mini", + "options" => array('yes' => 'Yes', 'no' => 'No')); + + $options[] = array("name" => "Tools", + "type" => "heading"); + + $options[] = array( "name" => "Homepage Title", + "desc" => "Enter a title for the homepage, leave blank if you want to use an auto generated one.", + "id" => "home_title", + "std" => "", + "type" => "text"); + + $options[] = array( "name" => "Homepage Meta Description", + "desc" => "Enter a description for the homepage, about 140 characters.", + "id" => "home_meta", + "std" => "", + "type" => "text"); + + $options[] = array( "name" => "Tracking Code", + "desc" => "Paste your tracking code here e.g. Google Analytics etc... without script tags", + "id" => "tracking_code", + "std" => "", + "type" => "textarea"); + + $options[] = array( "name" => "404 Error Message Text", + "desc" => "Enter your custom 404 error message.", + "id" => "404_error", + "std" => "404 Page Not Found", + "type" => "textarea"); + + $options[] = array( "name" => "Custom CSS", + "desc" => "Past your custom css here... without script tags", + "id" => "custom_css", + "std" => "", + "type" => "textarea"); + + $options[] = array( "name" => "Custom Javascript", + "desc" => "Past your custom JavaScript code here... without script tags", + "id" => "custom_js", + "std" => "", + "type" => "textarea"); + + $options[] = array("name" => "Slider Settings", + "type" => "heading"); + + $options[] = array( "name" => "Animation", + "desc" => "Choose a transition effect between slides.", + "id" => "animation", + "std" => "fade", + "type" => "select", + "class" => "mini", + "options" => array('fade' => 'Fade', 'horizontal-slide' => 'Horizontal Slide', 'vertical-slide' => 'Vertical Slide', 'horizontal-push' => 'Horizontal Push')); + + $options[] = array( "name" => "Animation Speed", + "desc" => "Duration of animation between images (the time the images changes in).", + "id" => "speed", + "std" => "1200", + "class" => "mini", + "type" => "text"); + + $options[] = array( "name" => "Timer", + "desc" => "Show the timer countdown and autoplay. Note: If turned off, autoplay is off.", + "id" => "timer", + "std" => "true", + "type" => "select", + "class" => "mini", + "options" => array('true' => 'On', 'false' => 'Off')); + + $options[] = array( "name" => "Transition Speed", + "desc" => "How long each slide will show.", + "id" => "transition", + "std" => "4000", + "class" => "mini", + "type" => "text"); + + $options[] = array( "name" => "Arrows", + "desc" => "Show the next/previous navigation.", + "id" => "arrows", + "std" => "false", + "type" => "select", + "class" => "mini", + "options" => array('true' => 'On', 'false' => 'Off')); + + $options[] = array( "name" => "Bullets", + "desc" => "Show the bullet navigation.", + "id" => "bullets", + "std" => "false", + "type" => "select", + "class" => "mini", + "options" => array('true' => 'On', 'false' => 'Off')); + + return $options; +} \ No newline at end of file diff --git a/src/wp-content/themes/Broadside/page.php b/src/wp-content/themes/Broadside/page.php new file mode 100644 index 0000000..5f2dfc3 --- /dev/null +++ b/src/wp-content/themes/Broadside/page.php @@ -0,0 +1,37 @@ + +
      +
      +

      post_title; ?>

      + ID, 'pyre_heading_sub', true)): ?> +

      ID, 'pyre_heading_sub', true); ?>

      + +
      + post_parent) { + $children = wp_list_pages('sort_column=menu_order&title_li=&child_of=' . $post->post_parent . '&depth=1&echo=0'); + } + else { + $children = wp_list_pages('sort_column=menu_order&title_li=&child_of=' . $post->ID . '&depth=1&echo=0'); + } + + if ($children) { ?> + + + + + +
      px;"> + + + +
      +
      + \ No newline at end of file diff --git a/src/wp-content/themes/Broadside/portfolio-full.php b/src/wp-content/themes/Broadside/portfolio-full.php new file mode 100644 index 0000000..6bd5a34 --- /dev/null +++ b/src/wp-content/themes/Broadside/portfolio-full.php @@ -0,0 +1,12 @@ + +
      +
      +

      post_title; ?>

      + ID, 'pyre_heading_sub', true)): ?> +

      ID, 'pyre_heading_sub', true); ?>

      + +
      +
      + \ No newline at end of file diff --git a/src/wp-content/themes/Broadside/portfolio-gallery.php b/src/wp-content/themes/Broadside/portfolio-gallery.php new file mode 100644 index 0000000..052775c --- /dev/null +++ b/src/wp-content/themes/Broadside/portfolio-gallery.php @@ -0,0 +1,89 @@ + +
      +
      +

      post_title; ?>

      + ID, 'pyre_heading_sub', true)): ?> +

      ID, 'pyre_heading_sub', true); ?>

      + +
      + +
      px;"> + + + + + + + + +
      +
      + \ No newline at end of file diff --git a/src/wp-content/themes/Broadside/portfolio-scrolling.php b/src/wp-content/themes/Broadside/portfolio-scrolling.php new file mode 100644 index 0000000..622d78a --- /dev/null +++ b/src/wp-content/themes/Broadside/portfolio-scrolling.php @@ -0,0 +1,97 @@ + +
      +
      +

      post_title; ?>

      + ID, 'pyre_heading_sub', true)): ?> +

      ID, 'pyre_heading_sub', true); ?>

      + +
      + +
      px;"> + + + + + + + + +
      +
      + \ No newline at end of file diff --git a/src/wp-content/themes/Broadside/portfolio-thumbnails.php b/src/wp-content/themes/Broadside/portfolio-thumbnails.php new file mode 100644 index 0000000..b8d5471 --- /dev/null +++ b/src/wp-content/themes/Broadside/portfolio-thumbnails.php @@ -0,0 +1,68 @@ + +
      +
      +

      post_title; ?>

      + ID, 'pyre_heading_sub', true)): ?> +

      ID, 'pyre_heading_sub', true); ?>

      + +
      + +
      px;"> + + +
      + + ID, 'pyre_portfolio_type', true); + $args = array( + 'showposts' => '-1', + 'post_type' => 'portfolio', + 'tax_query' => array( + array( + 'taxonomy' => 'type', + 'field' => 'id', + 'terms' => $portfolio_type + ) + ) + ); + $portfolio = new WP_Query($args); + $count = 1; + while($portfolio->have_posts()): $portfolio->the_post(); + if($count == 5) { + $count = 1; + } + ?> + +
      + ID), 'full'); ?> + ID, 'pyre_video_link', true)): ?> + + + + + + + + +
      + + +
      +
      + + + + + + + +
      + + + +
      + +
      + \ No newline at end of file diff --git a/src/wp-content/themes/Broadside/screenshot.png b/src/wp-content/themes/Broadside/screenshot.png new file mode 100644 index 0000000..48b2d76 Binary files /dev/null and b/src/wp-content/themes/Broadside/screenshot.png differ diff --git a/src/wp-content/themes/Broadside/services.php b/src/wp-content/themes/Broadside/services.php new file mode 100644 index 0000000..03dc360 --- /dev/null +++ b/src/wp-content/themes/Broadside/services.php @@ -0,0 +1,88 @@ + +
      +
      +

      post_title; ?>

      + ID, 'pyre_heading_sub', true)): ?> +

      ID, 'pyre_heading_sub', true); ?>

      + +
      + + +
      px;"> + + + + + + + +
      + + +
      + \ No newline at end of file diff --git a/src/wp-content/themes/Broadside/shortcodes.php b/src/wp-content/themes/Broadside/shortcodes.php new file mode 100644 index 0000000..78517e6 --- /dev/null +++ b/src/wp-content/themes/Broadside/shortcodes.php @@ -0,0 +1,331 @@ +[' => '[', + ']

      ' => ']', + ']
      ' => ']' + ); + + $content = strtr($content, $array); + + return $content; + } + +////////////////////////////////////////////////////////////////// +// Youtube shortcode +////////////////////////////////////////////////////////////////// +add_shortcode('youtube', 'shortcode_youtube'); + function shortcode_youtube($atts) { + $atts = shortcode_atts( + array( + 'id' => '', + 'width' => 600, + 'height' => 360 + ), $atts); + + return '
      '; + } + +////////////////////////////////////////////////////////////////// +// Vimeo shortcode +////////////////////////////////////////////////////////////////// +add_shortcode('vimeo', 'shortcode_vimeo'); + function shortcode_vimeo($atts) { + $atts = shortcode_atts( + array( + 'id' => '', + 'width' => 600, + 'height' => 360 + ), $atts); + + return '
      '; + } + +////////////////////////////////////////////////////////////////// +// SoundCloud shortcode +////////////////////////////////////////////////////////////////// +add_shortcode('soundcloud', 'shortcode_soundcloud'); + function shortcode_soundcloud($atts) { + $atts = shortcode_atts( + array( + 'url' => '', + 'width' => '100%', + 'height' => 81, + 'comments' => 'true', + 'auto_play' => 'true', + 'color' => 'ff7700', + ), $atts); + + return ''; + } + +////////////////////////////////////////////////////////////////// +// Button shortcode +////////////////////////////////////////////////////////////////// +add_shortcode('button', 'shortcode_button'); + function shortcode_button($atts, $content = null) { + $atts = shortcode_atts( + array( + 'color' => 'light', + 'link' => '#', + 'target' => '', + ), $atts); + + if($atts['color'] == 'light') { + $class = 'button'; + } else { + $class = 'big-button'; + } + + return '' .do_shortcode($content). ''; + } + +////////////////////////////////////////////////////////////////// +// Dropcap shortcode +////////////////////////////////////////////////////////////////// +add_shortcode('dropcap', 'shortcode_dropcap'); + function shortcode_dropcap( $atts, $content = null ) { + + return '' .do_shortcode($content). ''; + +} + +////////////////////////////////////////////////////////////////// +// Highlight shortcode +////////////////////////////////////////////////////////////////// +add_shortcode('highlight', 'shortcode_highlight'); + function shortcode_highlight($atts, $content = null) { + $atts = shortcode_atts( + array( + 'color' => 'yellow', + ), $atts); + + if($atts['color'] == 'black') { + return '' .do_shortcode($content). ''; + } else { + return '' .do_shortcode($content). ''; + } + + } + +////////////////////////////////////////////////////////////////// +// Check list shortcode +////////////////////////////////////////////////////////////////// +add_shortcode('checklist', 'shortcode_checklist'); + function shortcode_checklist( $atts, $content = null ) { + + $content = str_replace('
        ', '
          ', do_shortcode($content)); + $content = str_replace('
        • ', '
        • ', do_shortcode($content)); + + return $content; + +} + +////////////////////////////////////////////////////////////////// +// Arrow list shortcode +////////////////////////////////////////////////////////////////// +add_shortcode('arrowlist', 'shortcode_badlist'); + function shortcode_badlist( $atts, $content = null ) { + + $content = str_replace('
            ', '
              ', do_shortcode($content)); + $content = str_replace('
            • ', '
            • ', do_shortcode($content)); + + return $content; + +} + +////////////////////////////////////////////////////////////////// +// Tabs shortcode +////////////////////////////////////////////////////////////////// +add_shortcode('tabs', 'shortcode_tabs'); + function shortcode_tabs( $atts, $content = null ) { + extract(shortcode_atts(array( + ), $atts)); + + $out .= '
              '; + + $out .= '
                '; + foreach ($atts as $key => $tab) { + $out .= '
              • ' . $tab . '
              • '; + } + $out .= '
              '; + + $out .= '
              '; + + $out .= do_shortcode($content) .'
              '; + + return $out; +} + +add_shortcode('tab', 'shortcode_tab'); + function shortcode_tab( $atts, $content = null ) { + extract(shortcode_atts(array( + ), $atts)); + + $out .= '
              ' . do_shortcode($content) .'
              '; + + return $out; +} + +////////////////////////////////////////////////////////////////// +// Toggle shortcode +////////////////////////////////////////////////////////////////// +add_shortcode('toggle', 'shortcode_toggle'); + function shortcode_toggle( $atts, $content = null ) { + extract(shortcode_atts(array( + 'title' => '', + ), $atts)); + + $out .= '
              ' .$title. '
              '; + $out .= '
              '; + $out .= '
              '; + $out .= do_shortcode($content); + $out .= '
              '; + $out .= '
              '; + + return $out; +} + +////////////////////////////////////////////////////////////////// +// Column one_half shortcode +////////////////////////////////////////////////////////////////// +add_shortcode('one_half', 'shortcode_one_half'); + function shortcode_one_half($atts, $content = null) { + $atts = shortcode_atts( + array( + 'last' => 'no', + ), $atts); + + if($atts['last'] == 'yes') { + return '
              ' .do_shortcode($content). '
              '; + } else { + return '
              ' .do_shortcode($content). '
              '; + } + + } + +////////////////////////////////////////////////////////////////// +// Column one_third shortcode +////////////////////////////////////////////////////////////////// +add_shortcode('one_third', 'shortcode_one_third'); + function shortcode_one_third($atts, $content = null) { + $atts = shortcode_atts( + array( + 'last' => 'no', + ), $atts); + + if($atts['last'] == 'yes') { + return '
              ' .do_shortcode($content). '
              '; + } else { + return '
              ' .do_shortcode($content). '
              '; + } + + } + +////////////////////////////////////////////////////////////////// +// Column two_third shortcode +////////////////////////////////////////////////////////////////// +add_shortcode('two_third', 'shortcode_two_third'); + function shortcode_two_third($atts, $content = null) { + $atts = shortcode_atts( + array( + 'last' => 'no', + ), $atts); + + if($atts['last'] == 'yes') { + return '
              ' .do_shortcode($content). '
              '; + } else { + return '
              ' .do_shortcode($content). '
              '; + } + + } + +////////////////////////////////////////////////////////////////// +// Column one_fourth shortcode +////////////////////////////////////////////////////////////////// +add_shortcode('one_fourth', 'shortcode_one_fourth'); + function shortcode_one_fourth($atts, $content = null) { + $atts = shortcode_atts( + array( + 'last' => 'no', + ), $atts); + + if($atts['last'] == 'yes') { + return '
              ' .do_shortcode($content). '
              '; + } else { + return '
              ' .do_shortcode($content). '
              '; + } + + } + +////////////////////////////////////////////////////////////////// +// Column three_fourth shortcode +////////////////////////////////////////////////////////////////// +add_shortcode('three_fourth', 'shortcode_three_fourth'); + function shortcode_three_fourth($atts, $content = null) { + $atts = shortcode_atts( + array( + 'last' => 'no', + ), $atts); + + if($atts['last'] == 'yes') { + return '
              ' .do_shortcode($content). '
              '; + } else { + return '
              ' .do_shortcode($content). '
              '; + } + + } + +////////////////////////////////////////////////////////////////// +// Person shortcode +////////////////////////////////////////////////////////////////// +add_shortcode('person', 'shortcode_person'); + function shortcode_person($atts, $content = null) { +$html = << + +
              {$atts['name']}
              +
              {$atts['title']}
              +

              {$content}

              + +
              +EOF; + return $html; + } + +////////////////////////////////////////////////////////////////// +// Add buttons to tinyMCE +////////////////////////////////////////////////////////////////// +add_action('init', 'add_button'); + +function add_button() { + if ( current_user_can('edit_posts') && current_user_can('edit_pages') ) + { + add_filter('mce_external_plugins', 'add_plugin'); + add_filter('mce_buttons_3', 'register_button'); + } +} + +function register_button($buttons) { + array_push($buttons, "button", "checklist", "arrowlist", "one_half", "one_third", "two_third", "one_fourth", "three_fourth", "person"); + return $buttons; +} + +function add_plugin($plugin_array) { + $plugin_array['button'] = get_template_directory_uri().'/tinymce/customcodes.js'; + $plugin_array['checklist'] = get_template_directory_uri().'/tinymce/customcodes.js'; + $plugin_array['arrowlist'] = get_template_directory_uri().'/tinymce/customcodes.js'; + $plugin_array['one_half'] = get_template_directory_uri().'/tinymce/customcodes.js'; + $plugin_array['one_third'] = get_template_directory_uri().'//tinymce/customcodes.js'; + $plugin_array['two_third'] = get_template_directory_uri().'/tinymce/customcodes.js'; + $plugin_array['one_fourth'] = get_template_directory_uri().'/tinymce/customcodes.js'; + $plugin_array['three_fourth'] = get_template_directory_uri().'/tinymce/customcodes.js'; + $plugin_array['person'] = get_template_directory_uri().'/tinymce/customcodes.js'; + + return $plugin_array; +} \ No newline at end of file diff --git a/src/wp-content/themes/Broadside/single.php b/src/wp-content/themes/Broadside/single.php new file mode 100644 index 0000000..3ff778d --- /dev/null +++ b/src/wp-content/themes/Broadside/single.php @@ -0,0 +1,50 @@ + +
              + + +
              +

              + +

              + +
              + +
              px;"> + + + +
              > + + ID), 'full'); ?> +
              + + +
              +
              +
              +

              + Posted by in | +
              +
              +
              + +
              +
              + +
              + + + + + +
              + + + +
              + \ No newline at end of file diff --git a/src/wp-content/themes/Broadside/style.css b/src/wp-content/themes/Broadside/style.css new file mode 100644 index 0000000..0972743 --- /dev/null +++ b/src/wp-content/themes/Broadside/style.css @@ -0,0 +1,16 @@ +/* +Theme Name: Broadside +Theme URI: http://www.progressionstudios.com +Description: Theme for Portfolio +Version: 1.0 +Author: ProgressionStudios +Author URI: http://themeforest.net/user/ProgressionStudios/profile?ref=ProgressionStudios +License: GNU General Public License version 3.0 +License URI: http://www.gnu.org/licenses/gpl-3.0.html +*/ + +@import url(css/reset.css); +@import url(css/standard.css); /* Main Styles */ +@import url(css/navigation.css); /* Navigation Styles */ +@import url(css/orbit-1.2.3.css); /* Featured Slider Styles */ +@import url(css/fancybox.css); /* LightBox Styles */ \ No newline at end of file diff --git a/src/wp-content/themes/Broadside/timthumb.php b/src/wp-content/themes/Broadside/timthumb.php new file mode 100644 index 0000000..a40d7e9 --- /dev/null +++ b/src/wp-content/themes/Broadside/timthumb.php @@ -0,0 +1,1188 @@ + /dev/null 2>&1 & + Then set WEBSHOT_XVFB_RUNNING = true below. This will save your server having to fire off a new Xvfb server and shut it down every time a new shot is generated. + You will need to take responsibility for keeping Xvfb running in case it crashes. (It seems pretty stable) + You will also need to take responsibility for server security if you're running Xvfb as root. + + +*/ +if(! defined('WEBSHOT_ENABLED') ) define ('WEBSHOT_ENABLED', false); //Beta feature. Adding webshot=1 to your query string will cause the script to return a browser screenshot rather than try to fetch an image. +if(! defined('WEBSHOT_CUTYCAPT') ) define ('WEBSHOT_CUTYCAPT', '/usr/local/bin/CutyCapt'); //The path to CutyCapt. +if(! defined('WEBSHOT_XVFB') ) define ('WEBSHOT_XVFB', '/usr/bin/xvfb-run'); //The path to the Xvfb server +if(! defined('WEBSHOT_SCREEN_X') ) define ('WEBSHOT_SCREEN_X', '1024'); //1024 works ok +if(! defined('WEBSHOT_SCREEN_Y') ) define ('WEBSHOT_SCREEN_Y', '768'); //768 works ok +if(! defined('WEBSHOT_COLOR_DEPTH') ) define ('WEBSHOT_COLOR_DEPTH', '24'); //I haven't tested anything besides 24 +if(! defined('WEBSHOT_IMAGE_FORMAT') ) define ('WEBSHOT_IMAGE_FORMAT', 'png'); //png is about 2.5 times the size of jpg but is a LOT better quality +if(! defined('WEBSHOT_TIMEOUT') ) define ('WEBSHOT_TIMEOUT', '20'); //Seconds to wait for a webshot +if(! defined('WEBSHOT_USER_AGENT') ) define ('WEBSHOT_USER_AGENT', "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.2.18) Gecko/20110614 Firefox/3.6.18"); //I hate to do this, but a non-browser robot user agent might not show what humans see. So we pretend to be Firefox +if(! defined('WEBSHOT_JAVASCRIPT_ON') ) define ('WEBSHOT_JAVASCRIPT_ON', true); //Setting to false might give you a slight speedup and block ads. But it could cause other issues. +if(! defined('WEBSHOT_JAVA_ON') ) define ('WEBSHOT_JAVA_ON', false); //Have only tested this as fase +if(! defined('WEBSHOT_PLUGINS_ON') ) define ('WEBSHOT_PLUGINS_ON', true); //Enable flash and other plugins +if(! defined('WEBSHOT_PROXY') ) define ('WEBSHOT_PROXY', ''); //In case you're behind a proxy server. +if(! defined('WEBSHOT_XVFB_RUNNING') ) define ('WEBSHOT_XVFB_RUNNING', false); //ADVANCED: Enable this if you've got Xvfb running in the background. + + +// If ALLOW_EXTERNAL is true and ALLOW_ALL_EXTERNAL_SITES is false, then external images will only be fetched from these domains and their subdomains. +if(! isset($ALLOWED_SITES)){ + $ALLOWED_SITES = array ( + 'flickr.com', + 'picasa.com', + 'img.youtube.com', + 'upload.wikimedia.org', + 'photobucket.com', + 'imgur.com', + 'imageshack.us', + 'tinypic.com' + ); +} +// ------------------------------------------------------------- +// -------------- STOP EDITING CONFIGURATION HERE -------------- +// ------------------------------------------------------------- + +timthumb::start(); + +class timthumb { + protected $src = ""; + protected $is404 = false; + protected $docRoot = ""; + protected $lastURLError = false; + protected $localImage = ""; + protected $localImageMTime = 0; + protected $url = false; + protected $myHost = ""; + protected $isURL = false; + protected $cachefile = ''; + protected $errors = array(); + protected $toDeletes = array(); + protected $cacheDirectory = ''; + protected $startTime = 0; + protected $lastBenchTime = 0; + protected $cropTop = false; + protected $salt = ""; + protected $fileCacheVersion = 1; //Generally if timthumb.php is modifed (upgraded) then the salt changes and all cache files are recreated. This is a backup mechanism to force regen. + protected $filePrependSecurityBlock = "handleErrors(); + $tim->securityChecks(); + if($tim->tryBrowserCache()){ + exit(0); + } + $tim->handleErrors(); + if(FILE_CACHE_ENABLED && $tim->tryServerCache()){ + exit(0); + } + $tim->handleErrors(); + $tim->run(); + $tim->handleErrors(); + exit(0); + } + public function __construct(){ + global $ALLOWED_SITES; + $this->startTime = microtime(true); + $this->debug(1, "Starting new request from " . $this->getIP() . " to " . $_SERVER['REQUEST_URI']); + $this->calcDocRoot(); + //On windows systems I'm assuming fileinode returns an empty string or a number that doesn't change. Check this. + $this->salt = @filemtime(__FILE__) . '-' . @fileinode(__FILE__); + $this->debug(3, "Salt is: " . $this->salt); + if(FILE_CACHE_DIRECTORY){ + if(! is_dir(FILE_CACHE_DIRECTORY)){ + @mkdir(FILE_CACHE_DIRECTORY); + if(! is_dir(FILE_CACHE_DIRECTORY)){ + $this->error("Could not create the file cache directory."); + return false; + } + } + $this->cacheDirectory = FILE_CACHE_DIRECTORY; + touch($this->cacheDirectory . '/index.html'); + } else { + $this->cacheDirectory = sys_get_temp_dir(); + } + //Clean the cache before we do anything because we don't want the first visitor after FILE_CACHE_TIME_BETWEEN_CLEANS expires to get a stale image. + $this->cleanCache(); + + $this->myHost = preg_replace('/^www\./i', '', $_SERVER['HTTP_HOST']); + $this->src = $this->param('src'); + $this->url = parse_url($this->src); + if(strlen($this->src) <= 3){ + $this->error("No image specified"); + return false; + } + if(BLOCK_EXTERNAL_LEECHERS && array_key_exists('HTTP_REFERER', $_SERVER) && (! preg_match('/^https?:\/\/(?:www\.)?' . $this->myHost . '(?:$|\/)/i', $_SERVER['HTTP_REFERER']))){ + $imgData = base64_decode("R0lGODlhUAAMAIAAAP8AAP///yH5BAAHAP8ALAAAAABQAAwAAAJpjI+py+0Po5y0OgAMjjv01YUZ\nOGplhWXfNa6JCLnWkXplrcBmW+spbwvaVr/cDyg7IoFC2KbYVC2NQ5MQ4ZNao9Ynzjl9ScNYpneb\nDULB3RP6JuPuaGfuuV4fumf8PuvqFyhYtjdoeFgAADs="); + header('Content-Type: image/gif'); + header('Content-Length: ' . sizeof($imgData)); + header('Cache-Control: no-store, no-cache, must-revalidate, max-age=0'); + header("Pragma: no-cache"); + header('Expires: ' . gmdate ('D, d M Y H:i:s', time())); + echo $imgData; + return false; + exit(0); + } + if(preg_match('/https?:\/\/(?:www\.)?' . $this->myHost . '(?:$|\/)/i', $this->src)){ + $this->src = preg_replace('/https?:\/\/(?:www\.)?' . $this->myHost . '/i', '', $this->src); + } + if(preg_match('/^https?:\/\/[^\/]+/i', $this->src)){ + $this->debug(2, "Is a request for an external URL: " . $this->src); + $this->isURL = true; + } else { + $this->debug(2, "Is a request for an internal file: " . $this->src); + } + if($this->isURL && (! ALLOW_EXTERNAL)){ + $this->error("You are not allowed to fetch images from an external website."); + return false; + } + if($this->isURL){ + if(ALLOW_ALL_EXTERNAL_SITES){ + $this->debug(2, "Fetching from all external sites is enabled."); + } else { + $this->debug(2, "Fetching only from selected external sites is enabled."); + $allowed = false; + foreach($ALLOWED_SITES as $site){ + if (preg_match ('/(?:^|\.)' . $site . '$/i', $this->url['host'])) { + $this->debug(3, "URL hostname {$this->url['host']} matches $site so allowing."); + $allowed = true; + } + } + if(! $allowed){ + return $this->error("You may not fetch images from that site. To enable this site in timthumb, you can either add it to \$ALLOWED_SITES and set ALLOW_EXTERNAL=true. Or you can set ALLOW_ALL_EXTERNAL_SITES=true, depending on your security needs."); + } + } + } + + $cachePrefix = ($this->isURL ? 'timthumb_ext_' : 'timthumb_int_'); + if($this->isURL){ + $this->cachefile = $this->cacheDirectory . '/' . $cachePrefix . md5($this->salt . $_SERVER ['QUERY_STRING'] . $this->fileCacheVersion) . FILE_CACHE_SUFFIX; + } else { + $this->localImage = $this->getLocalImagePath($this->src); + if(! $this->localImage){ + $this->debug(1, "Could not find the local image: {$this->localImage}"); + $this->error("Could not find the internal image you specified."); + $this->set404(); + return false; + } + $this->debug(1, "Local image path is {$this->localImage}"); + $this->localImageMTime = @filemtime($this->localImage); + //We include the mtime of the local file in case in changes on disk. + $this->cachefile = $this->cacheDirectory . '/' . $cachePrefix . md5($this->salt . $this->localImageMTime . $_SERVER ['QUERY_STRING'] . $this->fileCacheVersion) . FILE_CACHE_SUFFIX; + } + $this->debug(2, "Cache file is: " . $this->cachefile); + + return true; + } + public function __destruct(){ + foreach($this->toDeletes as $del){ + $this->debug(2, "Deleting temp file $del"); + @unlink($del); + } + } + public function run(){ + if($this->isURL){ + if(! ALLOW_EXTERNAL){ + $this->debug(1, "Got a request for an external image but ALLOW_EXTERNAL is disabled so returning error msg."); + $this->error("You are not allowed to fetch images from an external website."); + return false; + } + $this->debug(3, "Got request for external image. Starting serveExternalImage."); + if($this->param('webshot')){ + if(WEBSHOT_ENABLED){ + $this->debug(3, "webshot param is set, so we're going to take a webshot."); + $this->serveWebshot(); + } else { + $this->error("You added the webshot parameter but webshots are disabled on this server. You need to set WEBSHOT_ENABLED == true to enable webshots."); + } + } else { + $this->debug(3, "webshot is NOT set so we're going to try to fetch a regular image."); + $this->serveExternalImage(); + + } + } else { + $this->debug(3, "Got request for internal image. Starting serveInternalImage()"); + $this->serveInternalImage(); + } + return true; + } + protected function handleErrors(){ + if($this->haveErrors()){ + if(NOT_FOUND_IMAGE && $this->is404()){ + if($this->serveImg(NOT_FOUND_IMAGE)){ + exit(0); + } else { + $this->error("Additionally, the 404 image that is configured could not be found or there was an error serving it."); + } + } + if(ERROR_IMAGE){ + if($this->serveImg(ERROR_IMAGE)){ + exit(0); + } else { + $this->error("Additionally, the error image that is configured could not be found or there was an error serving it."); + } + } + + $this->serveErrors(); + exit(0); + } + return false; + } + protected function tryBrowserCache(){ + if(BROWSER_CACHE_DISABLE){ $this->debug(3, "Browser caching is disabled"); return false; } + if(!empty($_SERVER['HTTP_IF_MODIFIED_SINCE']) ){ + $this->debug(3, "Got a conditional get"); + $mtime = false; + //We've already checked if the real file exists in the constructor + if(! is_file($this->cachefile)){ + //If we don't have something cached, regenerate the cached image. + return false; + } + if($this->localImageMTime){ + $mtime = $this->localImageMTime; + $this->debug(3, "Local real file's modification time is $mtime"); + } else if(is_file($this->cachefile)){ //If it's not a local request then use the mtime of the cached file to determine the 304 + $mtime = @filemtime($this->cachefile); + $this->debug(3, "Cached file's modification time is $mtime"); + } + if(! $mtime){ return false; } + + $iftime = strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']); + $this->debug(3, "The conditional get's if-modified-since unixtime is $iftime"); + if($iftime < 1){ + $this->debug(3, "Got an invalid conditional get modified since time. Returning false."); + return false; + } + if($iftime < $mtime){ //Real file or cache file has been modified since last request, so force refetch. + $this->debug(3, "File has been modified since last fetch."); + return false; + } else { //Otherwise serve a 304 + $this->debug(3, "File has not been modified since last get, so serving a 304."); + header ('HTTP/1.1 304 Not Modified'); + $this->debug(1, "Returning 304 not modified"); + return true; + } + } + return false; + } + protected function tryServerCache(){ + $this->debug(3, "Trying server cache"); + if(file_exists($this->cachefile)){ + $this->debug(3, "Cachefile {$this->cachefile} exists"); + if($this->isURL){ + $this->debug(3, "This is an external request, so checking if the cachefile is empty which means the request failed previously."); + if(filesize($this->cachefile) < 1){ + $this->debug(3, "Found an empty cachefile indicating a failed earlier request. Checking how old it is."); + //Fetching error occured previously + if(time() - @filemtime($this->cachefile) > WAIT_BETWEEN_FETCH_ERRORS){ + $this->debug(3, "File is older than " . WAIT_BETWEEN_FETCH_ERRORS . " seconds. Deleting and returning false so app can try and load file."); + @unlink($this->cachefile); + return false; //to indicate we didn't serve from cache and app should try and load + } else { + $this->debug(3, "Empty cachefile is still fresh so returning message saying we had an error fetching this image from remote host."); + $this->set404(); + $this->error("An error occured fetching image."); + return false; + } + } + } else { + $this->debug(3, "Trying to serve cachefile {$this->cachefile}"); + } + if($this->serveCacheFile()){ + $this->debug(3, "Succesfully served cachefile {$this->cachefile}"); + return true; + } else { + $this->debug(3, "Failed to serve cachefile {$this->cachefile} - Deleting it from cache."); + //Image serving failed. We can't retry at this point, but lets remove it from cache so the next request recreates it + @unlink($this->cachefile); + return true; + } + } + } + protected function error($err){ + $this->debug(3, "Adding error message: $err"); + $this->errors[] = $err; + return false; + + } + protected function haveErrors(){ + if(sizeof($this->errors) > 0){ + return true; + } + return false; + } + protected function serveErrors(){ + $html = '
                '; + foreach($this->errors as $err){ + $html .= '
              • ' . htmlentities($err) . '
              • '; + } + $html .= '
              '; + header ('HTTP/1.1 400 Bad Request'); + echo '

              A TimThumb error has occured

              The following error(s) occured:
              ' . $html . '
              '; + echo '
              Query String : ' . htmlentities ($_SERVER['QUERY_STRING']); + echo '
              TimThumb version : ' . VERSION . ''; + } + protected function serveInternalImage(){ + $this->debug(3, "Local image path is $this->localImage"); + if(! $this->localImage){ + $this->sanityFail("localImage not set after verifying it earlier in the code."); + return false; + } + $fileSize = filesize($this->localImage); + if($fileSize > MAX_FILE_SIZE){ + $this->error("The file you specified is greater than the maximum allowed file size."); + return false; + } + if($fileSize <= 0){ + $this->error("The file you specified is <= 0 bytes."); + return false; + } + $this->debug(3, "Calling processImageAndWriteToCache() for local image."); + if($this->processImageAndWriteToCache($this->localImage)){ + $this->serveCacheFile(); + return true; + } else { + return false; + } + } + protected function cleanCache(){ + $this->debug(3, "cleanCache() called"); + $lastCleanFile = $this->cacheDirectory . '/timthumb_cacheLastCleanTime.touch'; + + //If this is a new timthumb installation we need to create the file + if(! is_file($lastCleanFile)){ + $this->debug(1, "File tracking last clean doesn't exist. Creating $lastCleanFile"); + touch($lastCleanFile); + return; + } + if(@filemtime($lastCleanFile) < (time() - FILE_CACHE_TIME_BETWEEN_CLEANS) ){ //Cache was last cleaned more than 1 day ago + $this->debug(1, "Cache was last cleaned more than " . FILE_CACHE_TIME_BETWEEN_CLEANS . " seconds ago. Cleaning now."); + // Very slight race condition here, but worst case we'll have 2 or 3 servers cleaning the cache simultaneously once a day. + touch($lastCleanFile); + $files = glob($this->cacheDirectory . '/*' . FILE_CACHE_SUFFIX); + $timeAgo = time() - FILE_CACHE_MAX_FILE_AGE; + foreach($files as $file){ + if(@filemtime($file) < $timeAgo){ + $this->debug(3, "Deleting cache file $file older than max age: " . FILE_CACHE_MAX_FILE_AGE . " seconds"); + @unlink($file); + } + } + return true; + } else { + $this->debug(3, "Cache was cleaned less than " . FILE_CACHE_TIME_BETWEEN_CLEANS . " seconds ago so no cleaning needed."); + } + return false; + } + protected function processImageAndWriteToCache($localImage){ + $sData = getimagesize($localImage); + $origType = $sData[2]; + $mimeType = $sData['mime']; + + $this->debug(3, "Mime type of image is $mimeType"); + if(! preg_match('/^image\/(?:gif|jpg|jpeg|png)$/i', $mimeType)){ + return $this->error("The image being resized is not a valid gif, jpg or png."); + } + + if (!function_exists ('imagecreatetruecolor')) { + return $this->error('GD Library Error: imagecreatetruecolor does not exist - please contact your webhost and ask them to install the GD library'); + } + + if (function_exists ('imagefilter') && defined ('IMG_FILTER_NEGATE')) { + $imageFilters = array ( + 1 => array (IMG_FILTER_NEGATE, 0), + 2 => array (IMG_FILTER_GRAYSCALE, 0), + 3 => array (IMG_FILTER_BRIGHTNESS, 1), + 4 => array (IMG_FILTER_CONTRAST, 1), + 5 => array (IMG_FILTER_COLORIZE, 4), + 6 => array (IMG_FILTER_EDGEDETECT, 0), + 7 => array (IMG_FILTER_EMBOSS, 0), + 8 => array (IMG_FILTER_GAUSSIAN_BLUR, 0), + 9 => array (IMG_FILTER_SELECTIVE_BLUR, 0), + 10 => array (IMG_FILTER_MEAN_REMOVAL, 0), + 11 => array (IMG_FILTER_SMOOTH, 0), + ); + } + + // get standard input properties + $new_width = (int) abs ($this->param('w', 0)); + $new_height = (int) abs ($this->param('h', 0)); + $zoom_crop = (int) $this->param('zc', 1); + $quality = (int) abs ($this->param('q', 90)); + $align = $this->cropTop ? 't' : $this->param('a', 'c'); + $filters = $this->param('f', ''); + $sharpen = (bool) $this->param('s', 0); + $canvas_color = $this->param('cc', 'ffffff'); + + // set default width and height if neither are set already + if ($new_width == 0 && $new_height == 0) { + $new_width = 100; + $new_height = 100; + } + + // ensure size limits can not be abused + $new_width = min ($new_width, MAX_WIDTH); + $new_height = min ($new_height, MAX_HEIGHT); + + // set memory limit to be able to have enough space to resize larger images + $this->setMemoryLimit(); + + // open the existing image + $image = $this->openImage ($mimeType, $localImage); + if ($image === false) { + return $this->error('Unable to open image.'); + } + + // Get original width and height + $width = imagesx ($image); + $height = imagesy ($image); + $origin_x = 0; + $origin_y = 0; + + // generate new w/h if not provided + if ($new_width && !$new_height) { + $new_height = floor ($height * ($new_width / $width)); + } else if ($new_height && !$new_width) { + $new_width = floor ($width * ($new_height / $height)); + } + + // scale down and add borders + if ($zoom_crop == 3) { + + $final_height = $height * ($new_width / $width); + + if ($final_height > $new_height) { + $new_width = $width * ($new_height / $height); + } else { + $new_height = $final_height; + } + + } + + // create a new true color image + $canvas = imagecreatetruecolor ($new_width, $new_height); + imagealphablending ($canvas, false); + + if (strlen ($canvas_color) < 6) { + $canvas_color = 'ffffff'; + } + + $canvas_color_R = hexdec (substr ($canvas_color, 0, 2)); + $canvas_color_G = hexdec (substr ($canvas_color, 2, 2)); + $canvas_color_B = hexdec (substr ($canvas_color, 2, 2)); + + // Create a new transparent color for image + $color = imagecolorallocatealpha ($canvas, $canvas_color_R, $canvas_color_G, $canvas_color_B, 127); + + // Completely fill the background of the new image with allocated color. + imagefill ($canvas, 0, 0, $color); + + // scale down and add borders + if ($zoom_crop == 2) { + + $final_height = $height * ($new_width / $width); + + if ($final_height > $new_height) { + + $origin_x = $new_width / 2; + $new_width = $width * ($new_height / $height); + $origin_x = round ($origin_x - ($new_width / 2)); + + } else { + + $origin_y = $new_height / 2; + $new_height = $final_height; + $origin_y = round ($origin_y - ($new_height / 2)); + + } + + } + + // Restore transparency blending + imagesavealpha ($canvas, true); + + if ($zoom_crop > 0) { + + $src_x = $src_y = 0; + $src_w = $width; + $src_h = $height; + + $cmp_x = $width / $new_width; + $cmp_y = $height / $new_height; + + // calculate x or y coordinate and width or height of source + if ($cmp_x > $cmp_y) { + + $src_w = round ($width / $cmp_x * $cmp_y); + $src_x = round (($width - ($width / $cmp_x * $cmp_y)) / 2); + + } else if ($cmp_y > $cmp_x) { + + $src_h = round ($height / $cmp_y * $cmp_x); + $src_y = round (($height - ($height / $cmp_y * $cmp_x)) / 2); + + } + + // positional cropping! + if ($align) { + if (strpos ($align, 't') !== false) { + $src_y = 0; + } + if (strpos ($align, 'b') !== false) { + $src_y = $height - $src_h; + } + if (strpos ($align, 'l') !== false) { + $src_x = 0; + } + if (strpos ($align, 'r') !== false) { + $src_x = $width - $src_w; + } + } + + imagecopyresampled ($canvas, $image, $origin_x, $origin_y, $src_x, $src_y, $new_width, $new_height, $src_w, $src_h); + + } else { + + // copy and resize part of an image with resampling + imagecopyresampled ($canvas, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height); + + } + + if ($filters != '' && function_exists ('imagefilter') && defined ('IMG_FILTER_NEGATE')) { + // apply filters to image + $filterList = explode ('|', $filters); + foreach ($filterList as $fl) { + + $filterSettings = explode (',', $fl); + if (isset ($imageFilters[$filterSettings[0]])) { + + for ($i = 0; $i < 4; $i ++) { + if (!isset ($filterSettings[$i])) { + $filterSettings[$i] = null; + } else { + $filterSettings[$i] = (int) $filterSettings[$i]; + } + } + + switch ($imageFilters[$filterSettings[0]][1]) { + + case 1: + + imagefilter ($canvas, $imageFilters[$filterSettings[0]][0], $filterSettings[1]); + break; + + case 2: + + imagefilter ($canvas, $imageFilters[$filterSettings[0]][0], $filterSettings[1], $filterSettings[2]); + break; + + case 3: + + imagefilter ($canvas, $imageFilters[$filterSettings[0]][0], $filterSettings[1], $filterSettings[2], $filterSettings[3]); + break; + + case 4: + + imagefilter ($canvas, $imageFilters[$filterSettings[0]][0], $filterSettings[1], $filterSettings[2], $filterSettings[3], $filterSettings[4]); + break; + + default: + + imagefilter ($canvas, $imageFilters[$filterSettings[0]][0]); + break; + + } + } + } + } + + // sharpen image + if ($sharpen && function_exists ('imageconvolution')) { + + $sharpenMatrix = array ( + array (-1,-1,-1), + array (-1,16,-1), + array (-1,-1,-1), + ); + + $divisor = 8; + $offset = 0; + + imageconvolution ($canvas, $sharpenMatrix, $divisor, $offset); + + } + //Straight from Wordpress core code. Reduces filesize by up to 70% for PNG's + if ( (IMAGETYPE_PNG == $origType || IMAGETYPE_GIF == $origType) && function_exists('imageistruecolor') && !imageistruecolor( $image ) ){ + imagetruecolortopalette( $canvas, false, imagecolorstotal( $image ) ); + } + + $imgType = ""; + $tempfile = tempnam($this->cacheDirectory, 'timthumb_tmpimg_'); + if(preg_match('/^image\/(?:jpg|jpeg)$/i', $mimeType)){ + $imgType = 'jpg'; + imagejpeg($canvas, $tempfile, $quality); + } else if(preg_match('/^image\/png$/i', $mimeType)){ + $imgType = 'png'; + imagepng($canvas, $tempfile, floor($quality * 0.09)); + } else if(preg_match('/^image\/gif$/i', $mimeType)){ + $imgType = 'gif'; + imagegif($canvas, $tempfile); + } else { + return $this->sanityFail("Could not match mime type after verifying it previously."); + } + + if($imgType == 'png' && OPTIPNG_ENABLED && OPTIPNG_PATH && @is_file(OPTIPNG_PATH)){ + $exec = OPTIPNG_PATH; + $this->debug(3, "optipng'ing $tempfile"); + $presize = filesize($tempfile); + $out = `$exec -o1 $tempfile`; //you can use up to -o7 but it really slows things down + clearstatcache(); + $aftersize = filesize($tempfile); + $sizeDrop = $presize - $aftersize; + if($sizeDrop > 0){ + $this->debug(1, "optipng reduced size by $sizeDrop"); + } else if($sizeDrop < 0){ + $this->debug(1, "optipng increased size! Difference was: $sizeDrop"); + } else { + $this->debug(1, "optipng did not change image size."); + } + } else if($imgType == 'png' && PNGCRUSH_ENABLED && PNGCRUSH_PATH && @is_file(PNGCRUSH_PATH)){ + $exec = PNGCRUSH_PATH; + $tempfile2 = tempnam($this->cacheDirectory, 'timthumb_tmpimg_'); + $this->debug(3, "pngcrush'ing $tempfile to $tempfile2"); + $out = `$exec $tempfile $tempfile2`; + $todel = ""; + if(is_file($tempfile2)){ + $sizeDrop = filesize($tempfile) - filesize($tempfile2); + if($sizeDrop > 0){ + $this->debug(1, "pngcrush was succesful and gave a $sizeDrop byte size reduction"); + $todel = $tempfile; + $tempfile = $tempfile2; + } else { + $this->debug(1, "pngcrush did not reduce file size. Difference was $sizeDrop bytes."); + $todel = $tempfile2; + } + } else { + $this->debug(3, "pngcrush failed with output: $out"); + $todel = $tempfile2; + } + @unlink($todel); + } + + $this->debug(3, "Rewriting image with security header."); + $tempfile4 = tempnam($this->cacheDirectory, 'timthumb_tmpimg_'); + $context = stream_context_create (); + $fp = fopen($tempfile,'r',0,$context); + file_put_contents($tempfile4, $this->filePrependSecurityBlock . $imgType . ' ?' . '>'); //6 extra bytes, first 3 being image type + file_put_contents($tempfile4, $fp, FILE_APPEND); + fclose($fp); + @unlink($tempfile); + $this->debug(3, "Locking and replacing cache file."); + $lockFile = $this->cachefile . '.lock'; + $fh = fopen($lockFile, 'w'); + if(! $fh){ + return $this->error("Could not open the lockfile for writing an image."); + } + if(flock($fh, LOCK_EX)){ + @unlink($this->cachefile); //rename generally overwrites, but doing this in case of platform specific quirks. File might not exist yet. + rename($tempfile4, $this->cachefile); + flock($fh, LOCK_UN); + fclose($fh); + @unlink($lockFile); + } else { + fclose($fh); + @unlink($lockFile); + @unlink($tempfile4); + return $this->error("Could not get a lock for writing."); + } + $this->debug(3, "Done image replace with security header. Cleaning up and running cleanCache()"); + imagedestroy($canvas); + return true; + } + protected function calcDocRoot(){ + $docRoot = @$_SERVER['DOCUMENT_ROOT']; + if(!isset($docRoot)){ + $this->debug(3, "DOCUMENT_ROOT is not set. This is probably windows. Starting search 1."); + if(isset($_SERVER['SCRIPT_FILENAME'])){ + $docRoot = str_replace( '\\', '/', substr($_SERVER['SCRIPT_FILENAME'], 0, 0-strlen($_SERVER['PHP_SELF']))); + $this->debug(3, "Generated docRoot using SCRIPT_FILENAME and PHP_SELF as: $docRoot"); + } + } + if(!isset($docRoot)){ + $this->debug(3, "DOCUMENT_ROOT still is not set. Starting search 2."); + if(isset($_SERVER['PATH_TRANSLATED'])){ + $docRoot = str_replace( '\\', '/', substr(str_replace('\\\\', '\\', $_SERVER['PATH_TRANSLATED']), 0, 0-strlen($_SERVER['PHP_SELF']))); + $this->debug(3, "Generated docRoot using PATH_TRANSLATED and PHP_SELF as: $docRoot"); + } + } + if($docRoot){ $docRoot = preg_replace('/\/$/', '', $docRoot); } + $this->debug(3, "Doc root is: " . $docRoot); + $this->docRoot = $docRoot; + + } + protected function getLocalImagePath($src){ + $src = preg_replace('/^\//', '', $src); //strip off the leading '/' + $realDocRoot = realpath($this->docRoot); //See issue 224. Using realpath as a windows fix. + if(! $this->docRoot){ + $this->debug(3, "We have no document root set, so as a last resort, lets check if the image is in the current dir and serve that."); + //We don't support serving images outside the current dir if we don't have a doc root for security reasons. + $file = preg_replace('/^.*?([^\/\\\\]+)$/', '$1', $src); //strip off any path info and just leave the filename. + if(is_file($file)){ + return realpath($file); + } + return $this->error("Could not find your website document root and the file specified doesn't exist in timthumbs directory. We don't support serving files outside timthumb's directory without a document root for security reasons."); + } //Do not go past this point without docRoot set + + //Try src under docRoot + if(file_exists ($this->docRoot . '/' . $src)) { + $this->debug(3, "Found file as " . $this->docRoot . '/' . $src); + $real = realpath($this->docRoot . '/' . $src); + if(strpos($real, $realDocRoot) === 0){ + return $real; + } else { + $this->debug(1, "Security block: The file specified occurs outside the document root."); + //allow search to continue + } + } + //Check absolute paths and then verify the real path is under doc root + $absolute = realpath('/' . $src); + if($absolute && file_exists($absolute)){ //realpath does file_exists check, so can probably skip the exists check here + $this->debug(3, "Found absolute path: $absolute"); + if(! $this->docRoot){ $this->sanityFail("docRoot not set when checking absolute path."); } + if(strpos($absolute, $realDocRoot) === 0){ + return $absolute; + } else { + $this->debug(1, "Security block: The file specified occurs outside the document root."); + //and continue search + } + } + $base = $this->docRoot; + foreach (explode('/', str_replace($this->docRoot, '', $_SERVER['SCRIPT_FILENAME'])) as $sub){ + $base .= $sub . '/'; + $this->debug(3, "Trying file as: " . $base . $src); + if(file_exists($base . $src)){ + $this->debug(3, "Found file as: " . $base . $src); + $real = realpath($base . $src); + if(strpos($real, $realDocRoot) === 0){ + return $real; + } else { + $this->debug(1, "Security block: The file specified occurs outside the document root."); + //And continue search + } + } + } + return false; + } + protected function toDelete($name){ + $this->debug(3, "Scheduling file $name to delete on destruct."); + $this->toDeletes[] = $name; + } + protected function serveWebshot(){ + $this->debug(3, "Starting serveWebshot"); + $instr = "Please follow the instructions at http://code.google.com/p/timthumb/ to set your server up for taking website screenshots."; + if(! is_file(WEBSHOT_CUTYCAPT)){ + return $this->error("CutyCapt is not installed. $instr"); + } + if(! is_file(WEBSHOT_XVFB)){ + return $this->Error("Xvfb is not installed. $instr"); + } + $cuty = WEBSHOT_CUTYCAPT; + $xv = WEBSHOT_XVFB; + $screenX = WEBSHOT_SCREEN_X; + $screenY = WEBSHOT_SCREEN_Y; + $colDepth = WEBSHOT_COLOR_DEPTH; + $format = WEBSHOT_IMAGE_FORMAT; + $timeout = WEBSHOT_TIMEOUT * 1000; + $ua = WEBSHOT_USER_AGENT; + $jsOn = WEBSHOT_JAVASCRIPT_ON ? 'on' : 'off'; + $javaOn = WEBSHOT_JAVA_ON ? 'on' : 'off'; + $pluginsOn = WEBSHOT_PLUGINS_ON ? 'on' : 'off'; + $proxy = WEBSHOT_PROXY ? ' --http-proxy=' . WEBSHOT_PROXY : ''; + $tempfile = tempnam($this->cacheDirectory, 'timthumb_webshot'); + $url = $this->src; + if(! preg_match('/^https?:\/\/[a-zA-Z0-9\.\-]+/i', $url)){ + return $this->error("Invalid URL supplied."); + } + $url = preg_replace('/[^A-Za-z0-9\-\.\_\~:\/\?\#\[\]\@\!\$\&\'\(\)\*\+\,\;\=]+/', '', $url); //RFC 3986 + //Very important we don't allow injection of shell commands here. URL is between quotes and we are only allowing through chars allowed by a the RFC + // which AFAIKT can't be used for shell injection. + if(WEBSHOT_XVFB_RUNNING){ + putenv('DISPLAY=:100.0'); + $command = "$cuty $proxy --max-wait=$timeout --user-agent=\"$ua\" --javascript=$jsOn --java=$javaOn --plugins=$pluginsOn --js-can-open-windows=off --url=\"$url\" --out-format=$format --out=$tempfile"; + } else { + $command = "$xv --server-args=\"-screen 0, {$screenX}x{$screenY}x{$colDepth}\" $cuty $proxy --max-wait=$timeout --user-agent=\"$ua\" --javascript=$jsOn --java=$javaOn --plugins=$pluginsOn --js-can-open-windows=off --url=\"$url\" --out-format=$format --out=$tempfile"; + } + $this->debug(3, "Executing command: $command"); + $out = `$command`; + $this->debug(3, "Received output: $out"); + if(! is_file($tempfile)){ + $this->set404(); + return $this->error("The command to create a thumbnail failed."); + } + $this->cropTop = true; + if($this->processImageAndWriteToCache($tempfile)){ + $this->debug(3, "Image processed succesfully. Serving from cache"); + return $this->serveCacheFile(); + } else { + return false; + } + } + protected function serveExternalImage(){ + if(! preg_match('/^https?:\/\/[a-zA-Z0-9\-\.]+/i', $this->src)){ + $this->error("Invalid URL supplied."); + return false; + } + $tempfile = tempnam($this->cacheDirectory, 'timthumb'); + $this->debug(3, "Fetching external image into temporary file $tempfile"); + $this->toDelete($tempfile); + #fetch file here + if(! $this->getURL($this->src, $tempfile)){ + @unlink($this->cachefile); + touch($this->cachefile); + $this->debug(3, "Error fetching URL: " . $this->lastURLError); + $this->error("Error reading the URL you specified from remote host." . $this->lastURLError); + return false; + } + + $mimeType = $this->getMimeType($tempfile); + if(! preg_match("/^image\/(?:jpg|jpeg|gif|png)$/i", $mimeType)){ + $this->debug(3, "Remote file has invalid mime type: $mimeType"); + @unlink($this->cachefile); + touch($this->cachefile); + $this->error("The remote file is not a valid image."); + return false; + } + if($this->processImageAndWriteToCache($tempfile)){ + $this->debug(3, "Image processed succesfully. Serving from cache"); + return $this->serveCacheFile(); + } else { + return false; + } + } + public static function curlWrite($h, $d){ + fwrite(self::$curlFH, $d); + self::$curlDataWritten += strlen($d); + if(self::$curlDataWritten > MAX_FILE_SIZE){ + return 0; + } else { + return strlen($d); + } + } + protected function serveCacheFile(){ + $this->debug(3, "Serving {$this->cachefile}"); + if(! is_file($this->cachefile)){ + $this->error("serveCacheFile called in timthumb but we couldn't find the cached file."); + return false; + } + $fp = fopen($this->cachefile, 'rb'); + if(! $fp){ return $this->error("Could not open cachefile."); } + fseek($fp, strlen($this->filePrependSecurityBlock), SEEK_SET); + $imgType = fread($fp, 3); + fseek($fp, 3, SEEK_CUR); + if(ftell($fp) != strlen($this->filePrependSecurityBlock) + 6){ + @unlink($this->cachefile); + return $this->error("The cached image file seems to be corrupt."); + } + $imageDataSize = filesize($this->cachefile) - (strlen($this->filePrependSecurityBlock) + 6); + $this->sendImageHeaders($imgType, $imageDataSize); + $bytesSent = @fpassthru($fp); + fclose($fp); + if($bytesSent > 0){ + return true; + } + $content = file_get_contents ($this->cachefile); + if ($content != FALSE) { + $content = substr($content, strlen($this->filePrependSecurityBlock) + 6); + echo $content; + $this->debug(3, "Served using file_get_contents and echo"); + return true; + } else { + $this->error("Cache file could not be loaded."); + return false; + } + } + protected function sendImageHeaders($mimeType, $dataSize){ + if(! preg_match('/^image\//i', $mimeType)){ + $mimeType = 'image/' . $mimeType; + } + if(strtolower($mimeType) == 'image/jpg'){ + $mimeType = 'image/jpeg'; + } + $gmdate_expires = gmdate ('D, d M Y H:i:s', strtotime ('now +10 days')) . ' GMT'; + $gmdate_modified = gmdate ('D, d M Y H:i:s') . ' GMT'; + // send content headers then display image + header ('Content-Type: ' . $mimeType); + header ('Accept-Ranges: none'); //Changed this because we don't accept range requests + header ('Last-Modified: ' . $gmdate_modified); + header ('Content-Length: ' . $dataSize); + if(BROWSER_CACHE_DISABLE){ + $this->debug(3, "Browser cache is disabled so setting non-caching headers."); + header('Cache-Control: no-store, no-cache, must-revalidate, max-age=0'); + header("Pragma: no-cache"); + header('Expires: ' . gmdate ('D, d M Y H:i:s', time())); + } else { + $this->debug(3, "Browser caching is enabled"); + header('Cache-Control: max-age=' . BROWSER_CACHE_MAX_AGE . ', must-revalidate'); + header('Expires: ' . $gmdate_expires); + } + return true; + } + protected function securityChecks(){ + } + protected function param($property, $default = ''){ + if (isset ($_GET[$property])) { + return $_GET[$property]; + } else { + return $default; + } + } + protected function openImage($mimeType, $src){ + switch ($mimeType) { + case 'image/jpg': //This isn't a valid mime type so we should probably remove it + $image = imagecreatefromjpeg ($src); + break; + case 'image/jpeg': + $image = imagecreatefromjpeg ($src); + break; + + case 'image/png': + $image = imagecreatefrompng ($src); + break; + + case 'image/gif': + $image = imagecreatefromgif ($src); + break; + } + + return $image; + } + protected function getIP(){ + $rem = @$_SERVER["REMOTE_ADDR"]; + $ff = @$_SERVER["HTTP_X_FORWARDED_FOR"]; + $ci = @$_SERVER["HTTP_CLIENT_IP"]; + if(preg_match('/^(?:192\.168|172\.16|10\.|127\.)/', $rem)){ + if($ff){ return $ff; } + if($ci){ return $ci; } + return $rem; + } else { + if($rem){ return $rem; } + if($ff){ return $ff; } + if($ci){ return $ci; } + return "UNKNOWN"; + } + } + protected function debug($level, $msg){ + if(DEBUG_ON && $level <= DEBUG_LEVEL){ + $execTime = sprintf('%.6f', microtime(true) - $this->startTime); + $tick = sprintf('%.6f', 0); + if($this->lastBenchTime > 0){ + $tick = sprintf('%.6f', microtime(true) - $this->lastBenchTime); + } + $this->lastBenchTime = microtime(true); + error_log("TimThumb Debug line " . __LINE__ . " [$execTime : $tick]: $msg"); + } + } + protected function sanityFail($msg){ + return $this->error("There is a problem in the timthumb code. Message: Please report this error at timthumb's bug tracking page: $msg"); + } + protected function getMimeType($file){ + $info = getimagesize($file); + if(is_array($info) && $info['mime']){ + return $info['mime']; + } + return ''; + } + protected function setMemoryLimit(){ + $inimem = ini_get('memory_limit'); + $inibytes = timthumb::returnBytes($inimem); + $ourbytes = timthumb::returnBytes(MEMORY_LIMIT); + if($inibytes < $ourbytes){ + ini_set ('memory_limit', MEMORY_LIMIT); + $this->debug(3, "Increased memory from $inimem to " . MEMORY_LIMIT); + } else { + $this->debug(3, "Not adjusting memory size because the current setting is " . $inimem . " and our size of " . MEMORY_LIMIT . " is smaller."); + } + } + protected static function returnBytes($size_str){ + switch (substr ($size_str, -1)) + { + case 'M': case 'm': return (int)$size_str * 1048576; + case 'K': case 'k': return (int)$size_str * 1024; + case 'G': case 'g': return (int)$size_str * 1073741824; + default: return $size_str; + } + } + protected function getURL($url, $tempfile){ + $this->lastURLError = false; + $url = preg_replace('/ /', '%20', $url); + if(function_exists('curl_init')){ + $this->debug(3, "Curl is installed so using it to fetch URL."); + self::$curlFH = fopen($tempfile, 'w'); + if(! self::$curlFH){ + $this->error("Could not open $tempfile for writing."); + return false; + } + self::$curlDataWritten = 0; + $this->debug(3, "Fetching url with curl: $url"); + $curl = curl_init($url); + curl_setopt ($curl, CURLOPT_TIMEOUT, CURL_TIMEOUT); + curl_setopt ($curl, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.742.122 Safari/534.30"); + curl_setopt ($curl, CURLOPT_RETURNTRANSFER, TRUE); + curl_setopt ($curl, CURLOPT_HEADER, 0); + curl_setopt ($curl, CURLOPT_SSL_VERIFYPEER, FALSE); + curl_setopt ($curl, CURLOPT_WRITEFUNCTION, 'timthumb::curlWrite'); + @curl_setopt ($curl, CURLOPT_FOLLOWLOCATION, true); + @curl_setopt ($curl, CURLOPT_MAXREDIRS, 10); + + $curlResult = curl_exec($curl); + fclose(self::$curlFH); + $httpStatus = curl_getinfo($curl, CURLINFO_HTTP_CODE); + if($httpStatus == 404){ + $this->set404(); + } + if($curlResult){ + curl_close($curl); + return true; + } else { + $this->lastURLError = curl_error($curl); + curl_close($curl); + return false; + } + } else { + $img = @file_get_contents ($url); + if($img === false){ + $err = error_get_last(); + if(is_array($err) && $err['message']){ + $this->lastURLError = $err['message']; + } else { + $this->lastURLError = $err; + } + if(preg_match('/404/', $this->lastURLError)){ + $this->set404(); + } + + return false; + } + if(! file_put_contents($tempfile, $img)){ + $this->error("Could not write to $tempfile."); + return false; + } + return true; + } + + } + protected function serveImg($file){ + $s = getimagesize($file); + if(! ($s && $s['mime'])){ + return false; + } + header ('Content-Type: ' . $s['mime']); + header ('Content-Length: ' . filesize($file) ); + header ('Cache-Control: no-store, no-cache, must-revalidate, max-age=0'); + header ("Pragma: no-cache"); + $bytes = @readfile($file); + if($bytes > 0){ + return true; + } + $content = @file_get_contents ($file); + if ($content != FALSE){ + echo $content; + return true; + } + return false; + + } + protected function set404(){ + $this->is404 = true; + } + protected function is404(){ + return $this->is404; + } +} +?> \ No newline at end of file diff --git a/src/wp-content/themes/Broadside/tinymce/button-12.png b/src/wp-content/themes/Broadside/tinymce/button-12.png new file mode 100644 index 0000000..51d3773 Binary files /dev/null and b/src/wp-content/themes/Broadside/tinymce/button-12.png differ diff --git a/src/wp-content/themes/Broadside/tinymce/button-13.png b/src/wp-content/themes/Broadside/tinymce/button-13.png new file mode 100644 index 0000000..60d0d75 Binary files /dev/null and b/src/wp-content/themes/Broadside/tinymce/button-13.png differ diff --git a/src/wp-content/themes/Broadside/tinymce/button-14.png b/src/wp-content/themes/Broadside/tinymce/button-14.png new file mode 100644 index 0000000..105aa30 Binary files /dev/null and b/src/wp-content/themes/Broadside/tinymce/button-14.png differ diff --git a/src/wp-content/themes/Broadside/tinymce/button-23.png b/src/wp-content/themes/Broadside/tinymce/button-23.png new file mode 100644 index 0000000..3e5a144 Binary files /dev/null and b/src/wp-content/themes/Broadside/tinymce/button-23.png differ diff --git a/src/wp-content/themes/Broadside/tinymce/button-34.png b/src/wp-content/themes/Broadside/tinymce/button-34.png new file mode 100644 index 0000000..0702810 Binary files /dev/null and b/src/wp-content/themes/Broadside/tinymce/button-34.png differ diff --git a/src/wp-content/themes/Broadside/tinymce/button-arrow.png b/src/wp-content/themes/Broadside/tinymce/button-arrow.png new file mode 100644 index 0000000..7b37fef Binary files /dev/null and b/src/wp-content/themes/Broadside/tinymce/button-arrow.png differ diff --git a/src/wp-content/themes/Broadside/tinymce/button-badlist.png b/src/wp-content/themes/Broadside/tinymce/button-badlist.png new file mode 100644 index 0000000..2628be2 Binary files /dev/null and b/src/wp-content/themes/Broadside/tinymce/button-badlist.png differ diff --git a/src/wp-content/themes/Broadside/tinymce/button-button.png b/src/wp-content/themes/Broadside/tinymce/button-button.png new file mode 100644 index 0000000..8c3bc22 Binary files /dev/null and b/src/wp-content/themes/Broadside/tinymce/button-button.png differ diff --git a/src/wp-content/themes/Broadside/tinymce/button-checklist.png b/src/wp-content/themes/Broadside/tinymce/button-checklist.png new file mode 100644 index 0000000..77b86d8 Binary files /dev/null and b/src/wp-content/themes/Broadside/tinymce/button-checklist.png differ diff --git a/src/wp-content/themes/Broadside/tinymce/button-dropcap.png b/src/wp-content/themes/Broadside/tinymce/button-dropcap.png new file mode 100644 index 0000000..dbcca9b Binary files /dev/null and b/src/wp-content/themes/Broadside/tinymce/button-dropcap.png differ diff --git a/src/wp-content/themes/Broadside/tinymce/button-gameinfo.png b/src/wp-content/themes/Broadside/tinymce/button-gameinfo.png new file mode 100644 index 0000000..f0a23bd Binary files /dev/null and b/src/wp-content/themes/Broadside/tinymce/button-gameinfo.png differ diff --git a/src/wp-content/themes/Broadside/tinymce/button-highlight.png b/src/wp-content/themes/Broadside/tinymce/button-highlight.png new file mode 100644 index 0000000..248adfa Binary files /dev/null and b/src/wp-content/themes/Broadside/tinymce/button-highlight.png differ diff --git a/src/wp-content/themes/Broadside/tinymce/button-tabs.png b/src/wp-content/themes/Broadside/tinymce/button-tabs.png new file mode 100644 index 0000000..2c40f3d Binary files /dev/null and b/src/wp-content/themes/Broadside/tinymce/button-tabs.png differ diff --git a/src/wp-content/themes/Broadside/tinymce/button-team.png b/src/wp-content/themes/Broadside/tinymce/button-team.png new file mode 100644 index 0000000..40b2044 Binary files /dev/null and b/src/wp-content/themes/Broadside/tinymce/button-team.png differ diff --git a/src/wp-content/themes/Broadside/tinymce/button-toggle.png b/src/wp-content/themes/Broadside/tinymce/button-toggle.png new file mode 100644 index 0000000..033fbeb Binary files /dev/null and b/src/wp-content/themes/Broadside/tinymce/button-toggle.png differ diff --git a/src/wp-content/themes/Broadside/tinymce/button-vimeo.png b/src/wp-content/themes/Broadside/tinymce/button-vimeo.png new file mode 100644 index 0000000..b906e2d Binary files /dev/null and b/src/wp-content/themes/Broadside/tinymce/button-vimeo.png differ diff --git a/src/wp-content/themes/Broadside/tinymce/button-youtube.png b/src/wp-content/themes/Broadside/tinymce/button-youtube.png new file mode 100644 index 0000000..9f3cb40 Binary files /dev/null and b/src/wp-content/themes/Broadside/tinymce/button-youtube.png differ diff --git a/src/wp-content/themes/Broadside/tinymce/customcodes.js b/src/wp-content/themes/Broadside/tinymce/customcodes.js new file mode 100644 index 0000000..4695041 --- /dev/null +++ b/src/wp-content/themes/Broadside/tinymce/customcodes.js @@ -0,0 +1,350 @@ +////////////////////////////////////////////////////////////////// +// Add Youtube button +////////////////////////////////////////////////////////////////// +(function() { + tinymce.create('tinymce.plugins.youtube', { + init : function(ed, url) { + ed.addButton('youtube', { + title : 'Add a Youtube video', + image : url+'/button-youtube.png', + onclick : function() { + ed.selection.setContent('[youtube id="Enter video ID (eg. Wq4Y7ztznKc)" width="600" height="350"]'); + + } + }); + }, + createControl : function(n, cm) { + return null; + }, + }); + tinymce.PluginManager.add('youtube', tinymce.plugins.youtube); +})(); + +////////////////////////////////////////////////////////////////// +// Add Vimeo button +////////////////////////////////////////////////////////////////// +(function() { + tinymce.create('tinymce.plugins.vimeo', { + init : function(ed, url) { + ed.addButton('vimeo', { + title : 'Add a Vimeo video', + image : url+'/button-vimeo.png', + onclick : function() { + ed.selection.setContent('[vimeo id="Enter video ID (eg. 10145153)" width="600" height="350"]'); + + } + }); + }, + createControl : function(n, cm) { + return null; + }, + }); + tinymce.PluginManager.add('vimeo', tinymce.plugins.vimeo); +})(); + +////////////////////////////////////////////////////////////////// +//Add SoundCloud button +////////////////////////////////////////////////////////////////// +(function() { + tinymce.create('tinymce.plugins.soundcloud', { + init : function(ed, url) { + ed.addButton('soundcloud', { + title : 'Add a SoundCloud widget', + image : url+'/soundcloud.png', + onclick : function() { + ed.selection.setContent('[soundcloud url="http://api.soundcloud.com/tracks/15565763" comments="true" auto_play="false" color="ff7700" width="100%" height="81"]'); + + } + }); + }, + createControl : function(n, cm) { + return null; + }, + }); + tinymce.PluginManager.add('soundcloud', tinymce.plugins.soundcloud); +})(); + +////////////////////////////////////////////////////////////////// +// Add Button button +////////////////////////////////////////////////////////////////// +(function() { + tinymce.create('tinymce.plugins.button', { + init : function(ed, url) { + ed.addButton('button', { + title : 'Add a button', + image : url+'/button-button.png', + onclick : function() { + ed.selection.setContent('[button color="light or dark" link="" target=""]Text here[/button]'); + + } + }); + }, + createControl : function(n, cm) { + return null; + }, + }); + tinymce.PluginManager.add('button', tinymce.plugins.button); +})(); + +////////////////////////////////////////////////////////////////// +// Add Dropcap button +////////////////////////////////////////////////////////////////// +(function() { + tinymce.create('tinymce.plugins.dropcap', { + init : function(ed, url) { + ed.addButton('dropcap', { + title : 'Add a dropcap', + image : url+'/button-dropcap.png', + onclick : function() { + ed.selection.setContent('[dropcap]...[/dropcap]'); + + } + }); + }, + createControl : function(n, cm) { + return null; + }, + }); + tinymce.PluginManager.add('dropcap', tinymce.plugins.dropcap); +})(); + +////////////////////////////////////////////////////////////////// +// Add Highlight button +////////////////////////////////////////////////////////////////// +(function() { + tinymce.create('tinymce.plugins.highlight', { + init : function(ed, url) { + ed.addButton('highlight', { + title : 'Add a highlight', + image : url+'/button-highlight.png', + onclick : function() { + ed.selection.setContent('[highlight color="eg. yellow, black"]...[/highlight]'); + + } + }); + }, + createControl : function(n, cm) { + return null; + }, + }); + tinymce.PluginManager.add('highlight', tinymce.plugins.highlight); +})(); + +////////////////////////////////////////////////////////////////// +// Add Checklist button +////////////////////////////////////////////////////////////////// +(function() { + tinymce.create('tinymce.plugins.checklist', { + init : function(ed, url) { + ed.addButton('checklist', { + title : 'Add a checklist', + image : url+'/button-checklist.png', + onclick : function() { + ed.selection.setContent('[checklist]
                \r
              • Item #1
              • \r
              • Item #2
              • \r
              • Item #3
              • \r
              [/checklist]'); + + } + }); + }, + createControl : function(n, cm) { + return null; + }, + }); + tinymce.PluginManager.add('checklist', tinymce.plugins.checklist); +})(); + +////////////////////////////////////////////////////////////////// +// Add an arrow list button +////////////////////////////////////////////////////////////////// +(function() { + tinymce.create('tinymce.plugins.arrowlist', { + init : function(ed, url) { + ed.addButton('arrowlist', { + title : 'Add an arrow list', + image : url+'/button-arrow.png', + onclick : function() { + ed.selection.setContent('[arrowlist]
                \r
              • Item #1
              • \r
              • Item #2
              • \r
              • Item #3
              • \r
              [/arrowlist]'); + + } + }); + }, + createControl : function(n, cm) { + return null; + }, + }); + tinymce.PluginManager.add('arrowlist', tinymce.plugins.arrowlist); +})(); + +////////////////////////////////////////////////////////////////// +// Add Tabs button +////////////////////////////////////////////////////////////////// +(function() { + tinymce.create('tinymce.plugins.tabs', { + init : function(ed, url) { + ed.addButton('tabs', { + title : 'Add tabs', + image : url+'/button-tabs.png', + onclick : function() { + ed.selection.setContent('[tabs tab1=\"Tab 1\" tab2=\"Tab 2\" tab3=\"Tab 3\"]

              [tab id=1]Tab content 1[/tab]
              [tab id=2]Tab content 2[/tab]
              [tab id=3]Tab content 3[/tab]

              [/tabs]'); + + } + }); + }, + createControl : function(n, cm) { + return null; + }, + }); + tinymce.PluginManager.add('tabs', tinymce.plugins.tabs); +})(); + +////////////////////////////////////////////////////////////////// +// Add Toggle button +////////////////////////////////////////////////////////////////// +(function() { + tinymce.create('tinymce.plugins.toggle', { + init : function(ed, url) { + ed.addButton('toggle', { + title : 'Add a toggle', + image : url+'/button-toggle.png', + onclick : function() { + ed.selection.setContent('[toggle title=""]...[/toggle]'); + + } + }); + }, + createControl : function(n, cm) { + return null; + }, + }); + tinymce.PluginManager.add('toggle', tinymce.plugins.toggle); +})(); + +////////////////////////////////////////////////////////////////// +// Add One_half button +////////////////////////////////////////////////////////////////// +(function() { + tinymce.create('tinymce.plugins.one_half', { + init : function(ed, url) { + ed.addButton('one_half', { + title : 'Add a one_half column', + image : url+'/button-12.png', + onclick : function() { + ed.selection.setContent('[one_half last="no"]...[/one_half]'); + + } + }); + }, + createControl : function(n, cm) { + return null; + }, + }); + tinymce.PluginManager.add('one_half', tinymce.plugins.one_half); +})(); + +////////////////////////////////////////////////////////////////// +// Add One_half button +////////////////////////////////////////////////////////////////// +(function() { + tinymce.create('tinymce.plugins.one_third', { + init : function(ed, url) { + ed.addButton('one_third', { + title : 'Add a one_third column', + image : url+'/button-13.png', + onclick : function() { + ed.selection.setContent('[one_third last="no"]...[/one_third]'); + + } + }); + }, + createControl : function(n, cm) { + return null; + }, + }); + tinymce.PluginManager.add('one_third', tinymce.plugins.one_third); +})(); + +////////////////////////////////////////////////////////////////// +// Add Two_half button +////////////////////////////////////////////////////////////////// +(function() { + tinymce.create('tinymce.plugins.two_third', { + init : function(ed, url) { + ed.addButton('two_third', { + title : 'Add a two_third column', + image : url+'/button-23.png', + onclick : function() { + ed.selection.setContent('[two_third last="no"]...[/two_third]'); + + } + }); + }, + createControl : function(n, cm) { + return null; + }, + }); + tinymce.PluginManager.add('two_third', tinymce.plugins.two_third); +})(); + +////////////////////////////////////////////////////////////////// +// Add one_fourth button +////////////////////////////////////////////////////////////////// +(function() { + tinymce.create('tinymce.plugins.one_fourth', { + init : function(ed, url) { + ed.addButton('one_fourth', { + title : 'Add a one_fourth column', + image : url+'/button-14.png', + onclick : function() { + ed.selection.setContent('[one_fourth last="no"]...[/one_fourth]'); + + } + }); + }, + createControl : function(n, cm) { + return null; + }, + }); + tinymce.PluginManager.add('one_fourth', tinymce.plugins.one_fourth); +})(); + +////////////////////////////////////////////////////////////////// +// Add three_fourth button +////////////////////////////////////////////////////////////////// +(function() { + tinymce.create('tinymce.plugins.three_fourth', { + init : function(ed, url) { + ed.addButton('three_fourth', { + title : 'Add a three_fourth column', + image : url+'/button-34.png', + onclick : function() { + ed.selection.setContent('[three_fourth last="no"]...[/three_fourth]'); + + } + }); + }, + createControl : function(n, cm) { + return null; + }, + }); + tinymce.PluginManager.add('three_fourth', tinymce.plugins.three_fourth); +})(); + +////////////////////////////////////////////////////////////////// +//Add person button +////////////////////////////////////////////////////////////////// +(function() { + tinymce.create('tinymce.plugins.person', { + init : function(ed, url) { + ed.addButton('person', { + title : 'Add a person', + image : url+'/button-team.png', + onclick : function() { + ed.selection.setContent('[person name="" image="" title=""]Fusce ut elit eget tellus accumsan suscipit id ut neque. In ornare, lectus vitae luctus pharetra, augue lacus scelerisque leo, vitae pharetra neque arcu ac nunc. Nulla dictum luctus dolor ut tincidunt.[/person]'); + } + }); + }, + createControl : function(n, cm) { + return null; + }, + }); + tinymce.PluginManager.add('person', tinymce.plugins.person); +})(); \ No newline at end of file diff --git a/src/wp-content/themes/Broadside/tinymce/soundcloud.png b/src/wp-content/themes/Broadside/tinymce/soundcloud.png new file mode 100644 index 0000000..2c47c25 Binary files /dev/null and b/src/wp-content/themes/Broadside/tinymce/soundcloud.png differ diff --git a/src/wp-content/themes/Broadside/video.php b/src/wp-content/themes/Broadside/video.php new file mode 100644 index 0000000..18ff2a2 --- /dev/null +++ b/src/wp-content/themes/Broadside/video.php @@ -0,0 +1,4 @@ + + \ No newline at end of file diff --git a/src/wp-content/themes/index.php b/src/wp-content/themes/index.php new file mode 100644 index 0000000..4e6c07c --- /dev/null +++ b/src/wp-content/themes/index.php @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/src/wp-content/themes/twentyeleven/404.php b/src/wp-content/themes/twentyeleven/404.php new file mode 100644 index 0000000..03e0651 --- /dev/null +++ b/src/wp-content/themes/twentyeleven/404.php @@ -0,0 +1,48 @@ + + +
              +
              + +
              +
              +

              +
              + +
              +

              + + + + 10 ), array( 'widget_id' => '404' ) ); ?> + +
              +

              +
                + 'count', 'order' => 'DESC', 'show_count' => 1, 'title_li' => '', 'number' => 10 ) ); ?> +
              +
              + + ' . sprintf( __( 'Try looking in the monthly archives. %1$s', 'twentyeleven' ), convert_smilies( ':)' ) ) . '

              '; + the_widget( 'WP_Widget_Archives', array('count' => 0 , 'dropdown' => 1 ), array( 'after_title' => ''.$archive_content ) ); + ?> + + + +
              +
              + +
              +
              + + \ No newline at end of file diff --git a/src/wp-content/themes/twentyeleven/archive.php b/src/wp-content/themes/twentyeleven/archive.php new file mode 100644 index 0000000..22873b6 --- /dev/null +++ b/src/wp-content/themes/twentyeleven/archive.php @@ -0,0 +1,72 @@ + + +
              +
              + + + + + + + + + + + + + + + + + + +
              +
              +

              +
              + +
              +

              + +
              +
              + + + +
              +
              + + + \ No newline at end of file diff --git a/src/wp-content/themes/twentyeleven/author.php b/src/wp-content/themes/twentyeleven/author.php new file mode 100644 index 0000000..f9a2bfd --- /dev/null +++ b/src/wp-content/themes/twentyeleven/author.php @@ -0,0 +1,89 @@ + + +
              +
              + + + + + + + + + + + + +
              +
              + +
              +
              +

              + +
              +
              + + + + + + + + + + + + + +
              +
              +

              +
              + +
              +

              + +
              +
              + + + +
              +
              + + + \ No newline at end of file diff --git a/src/wp-content/themes/twentyeleven/category.php b/src/wp-content/themes/twentyeleven/category.php new file mode 100644 index 0000000..539cbbd --- /dev/null +++ b/src/wp-content/themes/twentyeleven/category.php @@ -0,0 +1,65 @@ + + +
              +
              + + + +
              ' ); + ?> + + + + + + + + + + + + + + + +
              +
              +

              +
              + +
              +

              + +
              +
              + + + + +
              + + + diff --git a/src/wp-content/themes/twentyeleven/colors/dark.css b/src/wp-content/themes/twentyeleven/colors/dark.css new file mode 100644 index 0000000..c2b35e8 --- /dev/null +++ b/src/wp-content/themes/twentyeleven/colors/dark.css @@ -0,0 +1,618 @@ +/* + A dark color scheme for Twenty Eleven +*/ + +/* =Global +----------------------------------------------- */ + +body { + background: #1d1d1d; + color: #bbb; +} +#page { + background: #0f0f0f; +} + +/* Headings */ +hr { + background-color: #333; +} + +/* Text elements */ +blockquote cite { + color: #999; +} +pre { + background: #0b0b0b; +} +code, kbd { + font: 13px Monaco, Consolas, "Andale Mono", "DejaVu Sans Mono", monospace; +} +abbr, acronym, dfn { + border-bottom: 1px dotted #999; +} +ins { + background: #00063f; +} +input[type=text], +.post-password-required input[type=password], +textarea { + border: 1px solid #222; +} +input[type=text]:focus, +textarea:focus { +} +input#s { + background-color: #ddd; +} + +/* Links */ +a { +} + + +/* =Header +----------------------------------------------- */ + +#branding { + border-top: 2px solid #0a0a0a; +} +#site-title a { + color: #eee; +} +#site-title a:hover, +#site-title a:focus, +#site-title a:active { +} +#site-description { + color: #858585; +} +#branding #s { + background-color: #ddd; +} + + +/* =Menu +----------------------------------------------- */ + +#access { + background: #333; /* Show a solid color for older browsers */ + background: -moz-linear-gradient(#383838, #272727); + background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#383838), to(#272727)); /* older webkit syntax */ + background: -webkit-linear-gradient(#383838, #272727); + border-bottom: 1px solid #222; +} + +/* =Content +----------------------------------------------- */ + +.page-title { + color: #ccc; +} +.hentry { + border-color: #222; +} +.entry-title { + color: #ddd; +} +.entry-title, +.entry-title a { + color: #ddd; +} +.entry-title a:hover, +.entry-title a:focus, +.entry-title a:active { +} +.entry-meta { + color: #999; +} +.entry-content h1, +.entry-content h2, +.comment-content h1, +.comment-content h2 { + color: #fff; +} +.entry-content table, +.comment-content table { + border-color: #222; +} +.entry-content th, +.comment-content th { + color: #999; +} +.entry-content td, +.comment-content td { + border-color: #222; +} +.page-link { +} +.page-link a { + background: #242424; + color: #bbb; +} +.page-link a:hover { + background: #999; + color: #000; +} +.entry-meta .edit-link a { + background: #242424; + color: #bbb; +} +.entry-meta .edit-link a:hover, +.entry-meta .edit-link a:focus, +.entry-meta .edit-link a:active { + background: #999; + color: #000; +} + +/* Images */ +.wp-caption { + background: #2c2c2c; +} +.wp-caption .wp-caption-text { + color: #999; +} +.wp-caption .wp-caption-text:before { + color: #999; +} + +/* Image borders */ +img[class*="wp-image-"], +#content .gallery .gallery-icon img { + border-color: #2c2c2c; +} +.wp-caption img { + border-color: #2c2c2c; +} +a:focus img[class*="wp-image-"], +a:hover img[class*="wp-image-"], +a:active img[class*="wp-image-"] { + background: #2c2c2c; + border-color: #444; +} +.wp-caption a:focus img, +.wp-caption a:active img, +.wp-caption a:hover img { + background: #0f0f0f; + border-color: #2c2c2c; +} + +/* Password Protected Posts */ +.post-password-required input[type=password] { + background: #ddd; +} +.post-password-required input[type=password]:focus { + background: #fff; +} + +/* Author Info */ +.singular #author-info { + background: #060606; + border-color: #222; +} +.archive #author-info { + border-color: #222; +} +#author-avatar img { + background: #000; + -webkit-box-shadow: 0 1px 2px #444; + -moz-box-shadow: 0 1px 2px #444; + box-shadow: 0 1px 2px #444; +} +#author-description h2 { + color: #fff; +} + +/* Comments link */ +.entry-header .comments-link a { + background: #282828 url(../images/comment-bubble-dark.png) no-repeat; + border-color: #222; + color: #888; +} + +.rtl .entry-header .comments-link a { + background-image: url(../images/comment-bubble-dark-rtl.png); +} +/* Singular content styles for Posts and Pages */ +.singular .entry-title { + color: #fff; +} + + +/* =Status +----------------------------------------------- */ + +.format-status img.avatar { + -webkit-box-shadow: 0 1px 2px #333; + -moz-box-shadow: 0 1px 2px #333; + box-shadow: 0 1px 2px #333; +} + + +/* =Quote +----------------------------------------------- */ + +.format-quote blockquote { + color: #aaa; +} + + +/* =Image +----------------------------------------------- */ + +.indexed.format-image .wp-caption { + background: #242424; +} +.indexed.format-image .entry-meta .edit-link a { + color: #ddd; +} +.indexed.format-image .entry-meta .edit-link a:hover { + color: #fff; +} + + +/* =error404 +----------------------------------------------- */ +.error404 #main #searchform { + background: #060606; + border-color: #222; +} + + +/* =Showcase +----------------------------------------------- */ + +h1.showcase-heading { + color: #ccc; +} + +/* Intro */ +article.intro { + background: #060606; +} +article.intro .entry-content { + color: #eee; +} +article.intro .edit-link a { + background: #555; + color: #000; +} +article.intro .edit-link a:hover { + background: #888; +} + +/* Featured post */ +section.featured-post .hentry { + color: #999; +} + +/* Small featured post */ +section.featured-post .attachment-small-feature { + border-color: #444; +} +section.featured-post .attachment-small-feature:hover { + border-color: #777; +} +article.feature-image.small .entry-summary { + color: #aaa; +} +article.feature-image.small .entry-summary p a { + background: #ddd; + color: #111; +} +article.feature-image.small .entry-summary p a:hover { + color: #40220c; +} + +/* Large featured post */ +article.feature-image.large .entry-title a { + background: #ddd; + background: rgba(0,0,0,0.8); + color: #fff; +} +section.feature-image.large:hover .entry-title a, +section.feature-image.large .entry-title:hover a { + background: #111; + background: rgba(255,255,255,0.8); + color: #000; +} +section.feature-image.large img { + border-bottom: 1px solid #222; +} + +/* Featured Slider */ +.featured-posts { + border-color: #222; +} +.featured-posts section.featured-post { + background: #000; +} +.featured-post .feature-text:after, +.featured-post .feature-image.small:after { + background: -moz-linear-gradient(top, rgba(0,0,0,0) 0%, rgba(0,0,0,1) 100%); /* FF3.6+ */ + background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(0,0,0,0)), color-stop(100%,rgba(0,0,0,1))); /* Chrome,Safari4+ */ + background: -webkit-linear-gradient(top, rgba(0,0,0,0) 0%,rgba(0,0,0,1) 100%); /* Chrome10+,Safari5.1+ */ + background: -o-linear-gradient(top, rgba(0,0,0,0) 0%,rgba(0,0,0,1) 100%); /* Opera11.10+ */ + background: -ms-linear-gradient(top, rgba(0,0,0,0) 0%,rgba(0,0,0,1) 100%); /* IE10+ */ + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#00000000', endColorstr='#000000',GradientType=0 ); /* IE6-9 */ + background: linear-gradient(top, rgba(0,0,0,0) 0%,rgba(0,0,0,1) 100%); /* W3C */ +} +.feature-slider a { + background: #c3c3c3; + background: rgba(60,60,60,0.9); + -webkit-box-shadow: inset 1px 1px 5px rgba(0,0,0,0.5), inset 0 0 2px rgba(255,255,255,0.5); + -moz-box-shadow: inset 1px 1px 5px rgba(0,0,0,0.5), inset 0 0 2px rgba(255,255,255,0.5); + box-shadow: inset 1px 1px 5px rgba(0,0,0,0.5), inset 0 0 2px rgba(255,255,255,0.5); +} +.feature-slider a.active { + background: #000; + background: rgba(255,255,255,0.8); + -webkit-box-shadow: inset 1px 1px 5px rgba(0,0,0,0.4), inset 0 0 2px rgba(255,255,255,0.8); + -moz-box-shadow: inset 1px 1px 5px rgba(0,0,0,0.4), inset 0 0 2px rgba(255,255,255,0.8); + box-shadow: inset 1px 1px 5px rgba(0,0,0,0.4), inset 0 0 2px rgba(255,255,255,0.8); +} + +/* Recent Posts */ +section.recent-posts .other-recent-posts { + border-color: #222; +} +section.recent-posts .other-recent-posts .entry-title { + border-color: #222; +} +section.recent-posts .other-recent-posts a[rel="bookmark"] { + color: #ccc; +} +section.recent-posts .other-recent-posts a[rel="bookmark"]:hover { +} +section.recent-posts .other-recent-posts .comments-link a, +section.recent-posts .other-recent-posts .comments-link > span { + border-color: #959595; + color: #bbb; +} +section.recent-posts .other-recent-posts .comments-link > span { + border-color: #444; + color: #777; +} +section.recent-posts .other-recent-posts .comments-link a:hover { +} + + +/* =Attachments +----------------------------------------------- */ + +.image-attachment div.attachment { + background: #060606; + border-color: #222; +} +.image-attachment div.attachment a img { + border-color: #060606; +} +.image-attachment div.attachment a:focus img, +.image-attachment div.attachment a:hover img, +.image-attachment div.attachment a:active img { + border-color: #2c2c2c; + background: #0f0f0f; +} + + +/* =Widgets +----------------------------------------------- */ + +.widget-title { + color: #ccc; +} +.widget ul li { + color: #888; +} + +/* Search Widget */ +.widget_search #searchsubmit { + background: #222; + border-color: #333; + -webkit-box-shadow: inset 0px -1px 1px rgba(0, 0, 0, 0.09); + -moz-box-shadow: inset 0px -1px 1px rgba(0, 0, 0, 0.09); + box-shadow: inset 0px -1px 1px rgba(0, 0, 0, 0.09); + color: #777; +} +.widget_search #searchsubmit:active { + -webkit-box-shadow: inset 0px 1px 1px rgba(0, 0, 0, 0.1); + -moz-box-shadow: inset 0px 1px 1px rgba(0, 0, 0, 0.1); + box-shadow: inset 0px 1px 1px rgba(0, 0, 0, 0.1); + color: #40220c; +} + +/* Calendar Widget */ +.widget_calendar #wp-calendar { + color: #aaa; +} +.widget_calendar #wp-calendar th { + background: #0b0b0b; + border-color: #333; +} +.widget_calendar #wp-calendar tfoot td { + background: #0b0b0b; + border-color: #333; +} + + +/* =Comments +----------------------------------------------- */ + +#comments-title { + color: #bbb; +} +.nocomments { + color: #555; +} +.commentlist > li.comment { + background: #090909; + border-color: #222; +} +.commentlist .children li.comment { + background: #000; + border-color: #222; +} +.rtl .commentlist .children li.comment { + border-color: #222; +} +.comment-meta { + color: #999; +} +a.comment-reply-link { + background: #242424; + color: #bbb; +} +li.bypostauthor a.comment-reply-link { + background: #111; +} +a.comment-reply-link:hover, +a.comment-reply-link:focus, +a.comment-reply-link:active, +li.bypostauthor a.comment-reply-link:hover, +li.bypostauthor a.comment-reply-link:focus, +li.bypostauthor a.comment-reply-link:active { + background: #999; + color: #000; +} +.commentlist > li:before { + content: url(../images/comment-arrow-dark.png); +} +.rtl .commentlist > li:before { + content: url(../images/comment-arrow-dark-rtl.png); +} + +/* Post author highlighting */ +.commentlist > li.bypostauthor { + background: #222; + border-color: #2c2c2c; +} +.commentlist > li.bypostauthor:before { + content: url(../images/comment-arrow-bypostauthor-dark.png); +} +.rtl .commentlist > li.bypostauthor:before { + content: url(../images/comment-arrow-bypostauthor-dark-rtl.png); +} + +/* Post Author threaded comments */ +.commentlist .children > li.bypostauthor { + background: #222; + border-color: #2c2c2c; +} +.commentlist > li.bypostauthor .comment-meta { + color: #a8a8a8; +} + +/* Comment Form */ +#respond { + background: #222; + border-color: #2c2c2c; +} +#respond input[type="text"], +#respond textarea { + background: #000; + border: 4px solid #111; + -webkit-box-shadow: inset 0 1px 3px rgba(51,51,51,0.95); + -moz-box-shadow: inset 0 1px 3px rgba(51,51,51,0.95); + box-shadow: inset 0 1px 3px rgba(51,51,51,0.95); + color: #bbb; +} +#respond .comment-form-author label, +#respond .comment-form-email label, +#respond .comment-form-url label, +#respond .comment-form-comment label { + background: #111; + -webkit-box-shadow: 1px 2px 2px rgba(51,51,51,0.8); + -moz-box-shadow: 1px 2px 2px rgba(51,51,51,0.8); + box-shadow: 1px 1px 2px rgba(51,51,51,0.8); + color: #aaa; +} +.rtl #respond .comment-form-author label, +.rtl #respond .comment-form-email label, +.rtl #respond .comment-form-url label, +.rtl #respond .comment-form-comment label { + -webkit-box-shadow: -1px 2px 2px rgba(51,51,51,0.8); + -moz-box-shadow: -1px 2px 2px rgba(51,51,51,0.8); + box-shadow: -1px 1px 2px rgba(51,51,51,0.8); +} +#respond .comment-form-author .required, +#respond .comment-form-email .required { + color: #42caff; +} +#respond input#submit { + background: #ddd; + -webkit-box-shadow: 0px 1px 2px rgba(0,0,0,0.3); + -moz-box-shadow: 0px 1px 2px rgba(0,0,0,0.3); + box-shadow: 0px 1px 2px rgba(0,0,0,0.3); + color: #111; + text-shadow: 0 -1px 0 rgba(0,0,0,0.3); +} +#respond input#submit:active { + color: #40220c; +} +#respond #cancel-comment-reply-link { + color: #999; +} +#reply-title { + color: #ccc; +} +#cancel-comment-reply-link { + color: #777; +} +#cancel-comment-reply-link:focus, +#cancel-comment-reply-link:active, +#cancel-comment-reply-link:hover { + color: #00b4cc; +} + + +/* =Footer +----------------------------------------------- */ + +#supplementary { + border-color: #222; +} + +/* Site Generator Line */ +#site-generator { + background: #060606; + border-color: #000; +} + + +/* =Print +----------------------------------------------- */ + +@media print { + body { + color: #333; + background: none !important; + } + #page { + background: none !important; + } + + /* Comments */ + .commentlist > li.comment { + } + + /* Post author highlighting */ + .commentlist > li.bypostauthor { + color: #333; + } + .commentlist > li.bypostauthor .comment-meta { + color: #959595; + } + .commentlist > li:before { + content: none !important; + } + + /* Post Author threaded comments */ + .commentlist .children > li.bypostauthor { + background: #fff; + border-color: #ddd; + } + .commentlist .children > li.bypostauthor > article, + .commentlist .children > li.bypostauthor > article .comment-meta { + color: #959595; + } +} \ No newline at end of file diff --git a/src/wp-content/themes/twentyeleven/comments.php b/src/wp-content/themes/twentyeleven/comments.php new file mode 100644 index 0000000..359b001 --- /dev/null +++ b/src/wp-content/themes/twentyeleven/comments.php @@ -0,0 +1,77 @@ + +
              + +

              +
              + + + + + +

              + ' . get_the_title() . '' ); + ?> +

              + + 1 && get_option( 'page_comments' ) ) : // are there comments to navigate through ?> + + + +
                + 'twentyeleven_comment' ) ); + ?> +
              + + 1 && get_option( 'page_comments' ) ) : // are there comments to navigate through ?> + + + + +

              + + + + + diff --git a/src/wp-content/themes/twentyeleven/content-aside.php b/src/wp-content/themes/twentyeleven/content-aside.php new file mode 100644 index 0000000..a70638a --- /dev/null +++ b/src/wp-content/themes/twentyeleven/content-aside.php @@ -0,0 +1,46 @@ + + +
              > +
              +
              +

              +

              +
              + + + + +
              + + +
              + +
              + +
              + →', 'twentyeleven' ) ); ?> + '' ) ); ?> +
              + + +
              + + + | + ' . __( 'Leave a reply', 'twentyeleven' ) . '', __( '1 Reply', 'twentyeleven' ), __( '% Replies', 'twentyeleven' ) ); ?> + + ', '' ); ?> +
              +
              diff --git a/src/wp-content/themes/twentyeleven/content-featured.php b/src/wp-content/themes/twentyeleven/content-featured.php new file mode 100644 index 0000000..ce92641 --- /dev/null +++ b/src/wp-content/themes/twentyeleven/content-featured.php @@ -0,0 +1,47 @@ + +
              > +
              +

              + + +
              + +
              + + '' ) ); ?> +
              + +
              + permalink.', 'twentyeleven' ); + } else { + $utility_text = __( 'This entry was posted in %1$s. Bookmark the permalink.', 'twentyeleven' ); + } + printf( + $utility_text, + /* translators: used between list items, there is a space after the comma */ + get_the_category_list( __( ', ', 'twentyeleven' ) ), + $tag_list, + esc_url( get_permalink() ), + the_title_attribute( 'echo=0' ) + ); + ?> + + ', '' ); ?> +
              +
              diff --git a/src/wp-content/themes/twentyeleven/content-gallery.php b/src/wp-content/themes/twentyeleven/content-gallery.php new file mode 100644 index 0000000..302a51e --- /dev/null +++ b/src/wp-content/themes/twentyeleven/content-gallery.php @@ -0,0 +1,92 @@ + + +
              > +
              +
              +

              +

              +
              + + +
              + + +
              + +
              + +
              + + →', 'twentyeleven' ) ); ?> + + + $post->ID, 'post_type' => 'attachment', 'post_mime_type' => 'image', 'orderby' => 'menu_order', 'order' => 'ASC', 'numberposts' => 999 ) ); + if ( $images ) : + $total_images = count( $images ); + $image = array_shift( $images ); + $image_img_tag = wp_get_attachment_image( $image->ID, 'thumbnail' ); + ?> + + + +

              %2$s photo.', 'This gallery contains %2$s photos.', $total_images, 'twentyeleven' ), + 'href="' . esc_url( get_permalink() ) . '" title="' . sprintf( esc_attr__( 'Permalink to %s', 'twentyeleven' ), the_title_attribute( 'echo=0' ) ) . '" rel="bookmark"', + number_format_i18n( $total_images ) + ); ?>

              + + + + '' ) ); ?> +
              + + +
              + + + + Posted in %2$s', 'twentyeleven' ), 'entry-utility-prep entry-utility-prep-cat-links', $categories_list ); + $show_sep = true; ?> + + + + | + + + Tagged %2$s', 'twentyeleven' ), 'entry-utility-prep entry-utility-prep-tag-links', $tags_list ); + $show_sep = true; ?> + + + + + + | + + ' . __( 'Leave a Reply', 'twentyeleven' ) . '', __( '1 Reply', 'twentyeleven' ), __( '% Replies', 'twentyeleven' ) ); ?> + + + ', '' ); ?> +
              +
              diff --git a/src/wp-content/themes/twentyeleven/content-image.php b/src/wp-content/themes/twentyeleven/content-image.php new file mode 100644 index 0000000..58aaf12 --- /dev/null +++ b/src/wp-content/themes/twentyeleven/content-image.php @@ -0,0 +1,70 @@ + +
              > +
              +
              +

              +

              +
              + + + + +
              + +
              + →', 'twentyeleven' ) ); ?> + '' ) ); ?> +
              + +
              + + + + ', '' ); ?> +
              +
              diff --git a/src/wp-content/themes/twentyeleven/content-intro.php b/src/wp-content/themes/twentyeleven/content-intro.php new file mode 100644 index 0000000..573112d --- /dev/null +++ b/src/wp-content/themes/twentyeleven/content-intro.php @@ -0,0 +1,21 @@ + + +
              > +
              +

              +
              + +
              + + '' ) ); ?> + ', '' ); ?> +
              +
              diff --git a/src/wp-content/themes/twentyeleven/content-link.php b/src/wp-content/themes/twentyeleven/content-link.php new file mode 100644 index 0000000..4981ec6 --- /dev/null +++ b/src/wp-content/themes/twentyeleven/content-link.php @@ -0,0 +1,46 @@ + + +
              > +
              +
              +

              +

              +
              + + + + +
              + + +
              + +
              + +
              + →', 'twentyeleven' ) ); ?> + '' ) ); ?> +
              + + +
              + + + | + ' . __( 'Leave a reply', 'twentyeleven' ) . '', __( '1 Reply', 'twentyeleven' ), __( '% Replies', 'twentyeleven' ) ); ?> + + ', '' ); ?> +
              +
              diff --git a/src/wp-content/themes/twentyeleven/content-page.php b/src/wp-content/themes/twentyeleven/content-page.php new file mode 100644 index 0000000..c499842 --- /dev/null +++ b/src/wp-content/themes/twentyeleven/content-page.php @@ -0,0 +1,23 @@ + + +
              > +
              +

              +
              + +
              + + '' ) ); ?> +
              +
              + ', '' ); ?> +
              +
              diff --git a/src/wp-content/themes/twentyeleven/content-quote.php b/src/wp-content/themes/twentyeleven/content-quote.php new file mode 100644 index 0000000..a4d600a --- /dev/null +++ b/src/wp-content/themes/twentyeleven/content-quote.php @@ -0,0 +1,74 @@ + + +
              > +
              +
              +

              +

              +
              + + + + + + +
              + + +
              + +
              + +
              + →', 'twentyeleven' ) ); ?> + '' ) ); ?> +
              + + +
              + + + + Posted in %2$s', 'twentyeleven' ), 'entry-utility-prep entry-utility-prep-cat-links', $categories_list ); + $show_sep = true; ?> + + + + | + + + Tagged %2$s', 'twentyeleven' ), 'entry-utility-prep entry-utility-prep-tag-links', $tags_list ); + $show_sep = true; ?> + + + + + + | + + ' . __( 'Leave a reply', 'twentyeleven' ) . '', __( '1 Reply', 'twentyeleven' ), __( '% Replies', 'twentyeleven' ) ); ?> + + + ', '' ); ?> +
              +
              diff --git a/src/wp-content/themes/twentyeleven/content-single.php b/src/wp-content/themes/twentyeleven/content-single.php new file mode 100644 index 0000000..c246b74 --- /dev/null +++ b/src/wp-content/themes/twentyeleven/content-single.php @@ -0,0 +1,71 @@ + + +
              > +
              +

              + + + + +
              + +
              + + '' ) ); ?> +
              + +
              + %5$s. Bookmark the permalink.', 'twentyeleven' ); + } elseif ( '' != $categories_list ) { + $utility_text = __( 'This entry was posted in %1$s by %5$s. Bookmark the permalink.', 'twentyeleven' ); + } else { + $utility_text = __( 'This entry was posted by %5$s. Bookmark the permalink.', 'twentyeleven' ); + } + + printf( + $utility_text, + $categories_list, + $tag_list, + esc_url( get_permalink() ), + the_title_attribute( 'echo=0' ), + get_the_author(), + esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ) + ); + ?> + ', '' ); ?> + + + + +
              +
              diff --git a/src/wp-content/themes/twentyeleven/content-status.php b/src/wp-content/themes/twentyeleven/content-status.php new file mode 100644 index 0000000..c6b2e80 --- /dev/null +++ b/src/wp-content/themes/twentyeleven/content-status.php @@ -0,0 +1,47 @@ + + +
              > +
              +
              +

              +

              +
              + + + + +
              + + +
              + +
              + +
              +
              + + →', 'twentyeleven' ) ); ?> + '' ) ); ?> +
              + + +
              + + + | + ' . __( 'Leave a reply', 'twentyeleven' ) . '', __( '1 Reply', 'twentyeleven' ), __( '% Replies', 'twentyeleven' ) ); ?> + + ', '' ); ?> +
              +
              diff --git a/src/wp-content/themes/twentyeleven/content.php b/src/wp-content/themes/twentyeleven/content.php new file mode 100644 index 0000000..3631e78 --- /dev/null +++ b/src/wp-content/themes/twentyeleven/content.php @@ -0,0 +1,82 @@ + + +
              > +
              + +
              +

              +

              +
              + +

              + + + + + + + + + +
              + + +
              + +
              + +
              + →', 'twentyeleven' ) ); ?> + '' ) ); ?> +
              + + +
              + + + + + Posted in %2$s', 'twentyeleven' ), 'entry-utility-prep entry-utility-prep-cat-links', $categories_list ); + $show_sep = true; ?> + + + + | + + + Tagged %2$s', 'twentyeleven' ), 'entry-utility-prep entry-utility-prep-tag-links', $tags_list ); + $show_sep = true; ?> + + + + + + + | + + ' . __( 'Leave a reply', 'twentyeleven' ) . '', __( '1 Reply', 'twentyeleven' ), __( '% Replies', 'twentyeleven' ) ); ?> + + + ', '' ); ?> +
              +
              diff --git a/src/wp-content/themes/twentyeleven/editor-style-rtl.css b/src/wp-content/themes/twentyeleven/editor-style-rtl.css new file mode 100644 index 0000000..5783776 --- /dev/null +++ b/src/wp-content/themes/twentyeleven/editor-style-rtl.css @@ -0,0 +1,24 @@ +/* +Theme Name: Twenty Eleven +*/ +/* +Used to style the TinyMCE editor. +*/ +html .mceContentBody { + direction: rtl; + unicode-bidi: embed; + float: right; + max-width: 584px; +} +* { + font-family: Arial, Tahoma, sans-serif; +} +ul, ol { + margin: 0 2.5em 1.625em 0; +} +blockquote { + font-style: normal; +} +table { + text-align: right; +} \ No newline at end of file diff --git a/src/wp-content/themes/twentyeleven/editor-style.css b/src/wp-content/themes/twentyeleven/editor-style.css new file mode 100644 index 0000000..2641a07 --- /dev/null +++ b/src/wp-content/themes/twentyeleven/editor-style.css @@ -0,0 +1,311 @@ +/* +Theme Name: Twenty Eleven +Description: Used to style the TinyMCE editor. +*/ + +html .mceContentBody { + max-width: 584px; +} +* { + color: inherit; + font: 15px "Helvetica Neue", Helvetica, Arial, sans-serif; + font-style: inherit; + font-weight: inherit; + line-height: 1.625; +} +body { + color: #333; + font: 15px "Helvetica Neue", Helvetica, Arial, "Nimbus Sans L", sans-serif; + font-weight: 300; + line-height: 1.625; +} + +/* Headings */ +h1,h2,h3,h4,h5,h6 { + clear: both; +} +h1, +h2 { + color: #000; + font-size: 15px; + font-weight: bold; + margin: 0 0 .8125em; +} +h3 { + font-size: 10px; + letter-spacing: 0.1em; + line-height: 2.6em; + text-transform: uppercase; +} +h4, h5, h6 { + font-size: 14px; + margin: 0; +} +hr { + background-color: #ccc; + border: 0; + height: 1px; + margin-bottom: 1.625em; +} + +/* Text elements */ +p, ul, ol, dl { + font-weight: 300; +} +p { + margin-bottom: 1.625em; +} +ul, ol { + margin: 0 0 1.625em 2.5em; + padding: 0; +} +ul { + list-style: square; +} +ol { + list-style-type: decimal; +} +ol ol { + list-style: upper-alpha; +} +ol ol ol { + list-style: lower-roman; +} +ol ol ol ol { + list-style: lower-alpha; +} +ul ul, ol ol, ul ol, ol ul { + margin-bottom: 0; +} +dl { + margin: 0 1.625em; +} +dt { + font-size: 15px; + font-weight: bold; +} +dd { + margin: 0 0 1.625em; +} +strong { + font-weight: bold; +} +cite, em, i { + font-style: italic; +} +cite { + border: none; +} +big { + font-size: 131.25%; +} +.mceContentBody blockquote, +.mceContentBody blockquote p { + font-family: Georgia, "Bitstream Charter", serif !important; + font-style: italic !important; + font-weight: normal; + margin: 0 3em; +} +.mceContentBody blockquote em, +.mceContentBody blockquote i, +.mceContentBody blockquote cite { + font-style: normal; +} +.mceContentBody blockquote cite { + color: #666; + font: 12px "Helvetica Neue", Helvetica, Arial, sans-serif; + font-weight: 300; + letter-spacing: 0.05em; + text-transform: uppercase; +} +pre { + background: #f4f4f4; + font: 13px "Courier 10 Pitch", Courier, monospace; + line-height: 1.5; + margin-bottom: 1.625em; + padding: 0.75em 1.625em; +} +code, kbd, code var { + font: 13px Monaco, Consolas, "Andale Mono", "DejaVu Sans Mono", monospace; +} +abbr, acronym, dfn { + border-bottom: 1px dotted #666; + cursor: help; +} +address { + display: block; + margin: 0 0 1.625em; +} +del { + color: #333; +} +ins { + background: #fff9c0; + border: none; + color: #333; + text-decoration: none; +} +sup, +sub { + font-size: 10px; + height: 0; + line-height: 1; + position: relative; + vertical-align: baseline; +} +sup { + bottom: 1ex; +} +sub { + top: .5ex; +} +input[type=text], +textarea { + background: #fafafa; + -moz-box-shadow: inset 0 1px 1px rgba(0,0,0,0.1); + -webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,0.1); + box-shadow: inset 0 1px 1px rgba(0,0,0,0.1); + border: 1px solid #ddd; + color: #888; +} +input[type=text]:focus, +textarea:focus { + color: #333; +} +textarea { + padding-left: 3px; + width: 98%; +} +input[type=text] { + padding: 3px; +} + +/* Links */ +a, +a em, +a strong { + color: #1b8be0; + text-decoration: none; +} +a:focus, +a:active, +a:hover { + text-decoration: underline; +} + +/* Alignment */ +.alignleft { + display: inline; + float: left; + margin-right: 1.625em; +} +.alignright { + display: inline; + float: right; + margin-left: 1.625em; +} +.aligncenter { + clear: both; + display: block; + margin-left: auto; + margin-right: auto; +} + +/* Tables */ +table { + border: none !important; + border-bottom: 1px solid #ddd !important; + border-collapse: collapse; + border-spacing: 0; + text-align: left; + margin: 0 0 1.625em; + width: 100%; +} +tr th { + border: none !important; + color: #666; + font-size: 10px; + font-weight: 500; + letter-spacing: 0.1em; + line-height: 2.6em; + text-transform: uppercase; +} +td { + border: none !important; + border-top: 1px solid #ddd !important; + padding: 6px 10px 6px 0; +} + +/* Images */ +img[class*="wp-image-"] { + height: auto; + max-width: 97.5%; +} +img.size-full { + width: auto; /* Prevent stretching of full-size images in IE8 */ +} +img.wp-smiley { + border: none; + margin-bottom: 0; + margin-top: 0; + padding: 0; +} +p img, +.wp-caption { + margin-top: 0.4em; +} +img { + border: 1px solid #ddd; + padding: 6px; +} +img.alignleft, +img.alignright, +img.aligncenter { + margin-bottom: 1.625em; +} +.wp-caption { + background: #eee; + border: none; + margin-bottom: 1.625em; + max-width: 96%; + padding: 9px; +} +.wp-caption img { + display: block; + margin: 5px auto 0 !important; + max-width: 98%; + border-color: #eee; +} +.wp-caption .wp-caption-text, +.wp-caption-dd { + color: #666; + font-family: Georgia, serif !important; + font-size: 12px; + margin: 0 0 0.6em 0 !important; + padding: 0 0 5px 40px; + position: relative; + text-align: left; +} +.wp-caption .wp-caption-text:before { + color: #666; + content: '\2014'; + font-size: 14px; + font-style: normal; + font-weight: bold; + margin-right: 5px; + position: absolute; + left: 10px; + top: 7px; +} +a:focus img[class*="wp-image-"], +a:hover img[class*="wp-image-"], +a:active img[class*="wp-image-"] { + background: #eee; + border-color: #bbb; +} +.wp-caption a:focus img, +.wp-caption a:active img, +.wp-caption a:hover img { + background: #fff; + border-color: #ddd; +} \ No newline at end of file diff --git a/src/wp-content/themes/twentyeleven/footer.php b/src/wp-content/themes/twentyeleven/footer.php new file mode 100644 index 0000000..9fa6225 --- /dev/null +++ b/src/wp-content/themes/twentyeleven/footer.php @@ -0,0 +1,34 @@ + + + + +
              + + + +
              + + +
              +
              + + + + + + \ No newline at end of file diff --git a/src/wp-content/themes/twentyeleven/functions.php b/src/wp-content/themes/twentyeleven/functions.php new file mode 100644 index 0000000..1997eb2 --- /dev/null +++ b/src/wp-content/themes/twentyeleven/functions.php @@ -0,0 +1,593 @@ + + * add_action( 'after_setup_theme', 'my_child_theme_setup' ); + * function my_child_theme_setup() { + * // We are providing our own filter for excerpt_length (or using the unfiltered value) + * remove_filter( 'excerpt_length', 'twentyeleven_excerpt_length' ); + * ... + * } + * + * + * For more information on hooks, actions, and filters, see http://codex.wordpress.org/Plugin_API. + * + * @package WordPress + * @subpackage Twenty_Eleven + * @since Twenty Eleven 1.0 + */ + +/** + * Set the content width based on the theme's design and stylesheet. + */ +if ( ! isset( $content_width ) ) + $content_width = 584; + +/** + * Tell WordPress to run twentyeleven_setup() when the 'after_setup_theme' hook is run. + */ +add_action( 'after_setup_theme', 'twentyeleven_setup' ); + +if ( ! function_exists( 'twentyeleven_setup' ) ): +/** + * Sets up theme defaults and registers support for various WordPress features. + * + * Note that this function is hooked into the after_setup_theme hook, which runs + * before the init hook. The init hook is too late for some features, such as indicating + * support post thumbnails. + * + * To override twentyeleven_setup() in a child theme, add your own twentyeleven_setup to your child theme's + * functions.php file. + * + * @uses load_theme_textdomain() For translation/localization support. + * @uses add_editor_style() To style the visual editor. + * @uses add_theme_support() To add support for post thumbnails, automatic feed links, and Post Formats. + * @uses register_nav_menus() To add support for navigation menus. + * @uses add_custom_background() To add support for a custom background. + * @uses add_custom_image_header() To add support for a custom header. + * @uses register_default_headers() To register the default custom header images provided with the theme. + * @uses set_post_thumbnail_size() To set a custom post thumbnail size. + * + * @since Twenty Eleven 1.0 + */ +function twentyeleven_setup() { + + /* Make Twenty Eleven available for translation. + * Translations can be added to the /languages/ directory. + * If you're building a theme based on Twenty Eleven, use a find and replace + * to change 'twentyeleven' to the name of your theme in all the template files. + */ + load_theme_textdomain( 'twentyeleven', TEMPLATEPATH . '/languages' ); + + $locale = get_locale(); + $locale_file = TEMPLATEPATH . "/languages/$locale.php"; + if ( is_readable( $locale_file ) ) + require_once( $locale_file ); + + // This theme styles the visual editor with editor-style.css to match the theme style. + add_editor_style(); + + // Load up our theme options page and related code. + require( dirname( __FILE__ ) . '/inc/theme-options.php' ); + + // Grab Twenty Eleven's Ephemera widget. + require( dirname( __FILE__ ) . '/inc/widgets.php' ); + + // Add default posts and comments RSS feed links to . + add_theme_support( 'automatic-feed-links' ); + + // This theme uses wp_nav_menu() in one location. + register_nav_menu( 'primary', __( 'Primary Menu', 'twentyeleven' ) ); + + // Add support for a variety of post formats + add_theme_support( 'post-formats', array( 'aside', 'link', 'gallery', 'status', 'quote', 'image' ) ); + + // Add support for custom backgrounds + add_custom_background(); + + // This theme uses Featured Images (also known as post thumbnails) for per-post/per-page Custom Header images + add_theme_support( 'post-thumbnails' ); + + // The next four constants set how Twenty Eleven supports custom headers. + + // The default header text color + define( 'HEADER_TEXTCOLOR', '000' ); + + // By leaving empty, we allow for random image rotation. + define( 'HEADER_IMAGE', '' ); + + // The height and width of your custom header. + // Add a filter to twentyeleven_header_image_width and twentyeleven_header_image_height to change these values. + define( 'HEADER_IMAGE_WIDTH', apply_filters( 'twentyeleven_header_image_width', 1000 ) ); + define( 'HEADER_IMAGE_HEIGHT', apply_filters( 'twentyeleven_header_image_height', 288 ) ); + + // We'll be using post thumbnails for custom header images on posts and pages. + // We want them to be the size of the header image that we just defined + // Larger images will be auto-cropped to fit, smaller ones will be ignored. See header.php. + set_post_thumbnail_size( HEADER_IMAGE_WIDTH, HEADER_IMAGE_HEIGHT, true ); + + // Add Twenty Eleven's custom image sizes + add_image_size( 'large-feature', HEADER_IMAGE_WIDTH, HEADER_IMAGE_HEIGHT, true ); // Used for large feature (header) images + add_image_size( 'small-feature', 500, 300 ); // Used for featured posts if a large-feature doesn't exist + + // Turn on random header image rotation by default. + add_theme_support( 'custom-header', array( 'random-default' => true ) ); + + // Add a way for the custom header to be styled in the admin panel that controls + // custom headers. See twentyeleven_admin_header_style(), below. + add_custom_image_header( 'twentyeleven_header_style', 'twentyeleven_admin_header_style', 'twentyeleven_admin_header_image' ); + + // ... and thus ends the changeable header business. + + // Default custom headers packaged with the theme. %s is a placeholder for the theme template directory URI. + register_default_headers( array( + 'wheel' => array( + 'url' => '%s/images/headers/wheel.jpg', + 'thumbnail_url' => '%s/images/headers/wheel-thumbnail.jpg', + /* translators: header image description */ + 'description' => __( 'Wheel', 'twentyeleven' ) + ), + 'shore' => array( + 'url' => '%s/images/headers/shore.jpg', + 'thumbnail_url' => '%s/images/headers/shore-thumbnail.jpg', + /* translators: header image description */ + 'description' => __( 'Shore', 'twentyeleven' ) + ), + 'trolley' => array( + 'url' => '%s/images/headers/trolley.jpg', + 'thumbnail_url' => '%s/images/headers/trolley-thumbnail.jpg', + /* translators: header image description */ + 'description' => __( 'Trolley', 'twentyeleven' ) + ), + 'pine-cone' => array( + 'url' => '%s/images/headers/pine-cone.jpg', + 'thumbnail_url' => '%s/images/headers/pine-cone-thumbnail.jpg', + /* translators: header image description */ + 'description' => __( 'Pine Cone', 'twentyeleven' ) + ), + 'chessboard' => array( + 'url' => '%s/images/headers/chessboard.jpg', + 'thumbnail_url' => '%s/images/headers/chessboard-thumbnail.jpg', + /* translators: header image description */ + 'description' => __( 'Chessboard', 'twentyeleven' ) + ), + 'lanterns' => array( + 'url' => '%s/images/headers/lanterns.jpg', + 'thumbnail_url' => '%s/images/headers/lanterns-thumbnail.jpg', + /* translators: header image description */ + 'description' => __( 'Lanterns', 'twentyeleven' ) + ), + 'willow' => array( + 'url' => '%s/images/headers/willow.jpg', + 'thumbnail_url' => '%s/images/headers/willow-thumbnail.jpg', + /* translators: header image description */ + 'description' => __( 'Willow', 'twentyeleven' ) + ), + 'hanoi' => array( + 'url' => '%s/images/headers/hanoi.jpg', + 'thumbnail_url' => '%s/images/headers/hanoi-thumbnail.jpg', + /* translators: header image description */ + 'description' => __( 'Hanoi Plant', 'twentyeleven' ) + ) + ) ); +} +endif; // twentyeleven_setup + +if ( ! function_exists( 'twentyeleven_header_style' ) ) : +/** + * Styles the header image and text displayed on the blog + * + * @since Twenty Eleven 1.0 + */ +function twentyeleven_header_style() { + + // If no custom options for text are set, let's bail + // get_header_textcolor() options: HEADER_TEXTCOLOR is default, hide text (returns 'blank') or any hex value + if ( HEADER_TEXTCOLOR == get_header_textcolor() ) + return; + // If we get this far, we have custom styles. Let's do this. + ?> + + Header admin panel. + * + * Referenced via add_custom_image_header() in twentyeleven_setup(). + * + * @since Twenty Eleven 1.0 + */ +function twentyeleven_admin_header_style() { +?> + + Header admin panel. + * + * Referenced via add_custom_image_header() in twentyeleven_setup(). + * + * @since Twenty Eleven 1.0 + */ +function twentyeleven_admin_header_image() { ?> + +' . __( 'Continue reading ', 'twentyeleven' ) . ''; +} + +/** + * Replaces "[...]" (appended to automatically generated excerpts) with an ellipsis and twentyeleven_continue_reading_link(). + * + * To override this in a child theme, remove the filter and add your own + * function tied to the excerpt_more filter hook. + */ +function twentyeleven_auto_excerpt_more( $more ) { + return ' …' . twentyeleven_continue_reading_link(); +} +add_filter( 'excerpt_more', 'twentyeleven_auto_excerpt_more' ); + +/** + * Adds a pretty "Continue Reading" link to custom post excerpts. + * + * To override this link in a child theme, remove the filter and add your own + * function tied to the get_the_excerpt filter hook. + */ +function twentyeleven_custom_excerpt_more( $output ) { + if ( has_excerpt() && ! is_attachment() ) { + $output .= twentyeleven_continue_reading_link(); + } + return $output; +} +add_filter( 'get_the_excerpt', 'twentyeleven_custom_excerpt_more' ); + +/** + * Get our wp_nav_menu() fallback, wp_page_menu(), to show a home link. + */ +function twentyeleven_page_menu_args( $args ) { + $args['show_home'] = true; + return $args; +} +add_filter( 'wp_page_menu_args', 'twentyeleven_page_menu_args' ); + +/** + * Register our sidebars and widgetized areas. Also register the default Epherma widget. + * + * @since Twenty Eleven 1.0 + */ +function twentyeleven_widgets_init() { + + register_widget( 'Twenty_Eleven_Ephemera_Widget' ); + + register_sidebar( array( + 'name' => __( 'Main Sidebar', 'twentyeleven' ), + 'id' => 'sidebar-1', + 'before_widget' => '", + 'before_title' => '

              ', + 'after_title' => '

              ', + ) ); + + register_sidebar( array( + 'name' => __( 'Showcase Sidebar', 'twentyeleven' ), + 'id' => 'sidebar-2', + 'description' => __( 'The sidebar for the optional Showcase Template', 'twentyeleven' ), + 'before_widget' => '", + 'before_title' => '

              ', + 'after_title' => '

              ', + ) ); + + register_sidebar( array( + 'name' => __( 'Footer Area One', 'twentyeleven' ), + 'id' => 'sidebar-3', + 'description' => __( 'An optional widget area for your site footer', 'twentyeleven' ), + 'before_widget' => '", + 'before_title' => '

              ', + 'after_title' => '

              ', + ) ); + + register_sidebar( array( + 'name' => __( 'Footer Area Two', 'twentyeleven' ), + 'id' => 'sidebar-4', + 'description' => __( 'An optional widget area for your site footer', 'twentyeleven' ), + 'before_widget' => '", + 'before_title' => '

              ', + 'after_title' => '

              ', + ) ); + + register_sidebar( array( + 'name' => __( 'Footer Area Three', 'twentyeleven' ), + 'id' => 'sidebar-5', + 'description' => __( 'An optional widget area for your site footer', 'twentyeleven' ), + 'before_widget' => '", + 'before_title' => '

              ', + 'after_title' => '

              ', + ) ); +} +add_action( 'widgets_init', 'twentyeleven_widgets_init' ); + +/** + * Display navigation to next/previous pages when applicable + */ +function twentyeleven_content_nav( $nav_id ) { + global $wp_query; + + if ( $wp_query->max_num_pages > 1 ) : ?> + + ]*?href=[\'"](.+?)[\'"]/is', get_the_content(), $matches ) ) + return false; + + return esc_url_raw( $matches[1] ); +} + +/** + * Count the number of footer sidebars to enable dynamic classes for the footer + */ +function twentyeleven_footer_sidebar_class() { + $count = 0; + + if ( is_active_sidebar( 'sidebar-3' ) ) + $count++; + + if ( is_active_sidebar( 'sidebar-4' ) ) + $count++; + + if ( is_active_sidebar( 'sidebar-5' ) ) + $count++; + + $class = ''; + + switch ( $count ) { + case '1': + $class = 'one'; + break; + case '2': + $class = 'two'; + break; + case '3': + $class = 'three'; + break; + } + + if ( $class ) + echo 'class="' . $class . '"'; +} + +if ( ! function_exists( 'twentyeleven_comment' ) ) : +/** + * Template for comments and pingbacks. + * + * To override this walker in a child theme without modifying the comments template + * simply create your own twentyeleven_comment(), and that function will be used instead. + * + * Used as a callback by wp_list_comments() for displaying the comments. + * + * @since Twenty Eleven 1.0 + */ +function twentyeleven_comment( $comment, $args, $depth ) { + $GLOBALS['comment'] = $comment; + switch ( $comment->comment_type ) : + case 'pingback' : + case 'trackback' : + ?> +
            • +

              ', '' ); ?>

              + +
            • id="li-comment-"> +
              +
              +
              + comment_parent ) + $avatar_size = 39; + + echo get_avatar( $comment, $avatar_size ); + + /* translators: 1: comment author, 2: date and time */ + printf( __( '%1$s on %2$s said:', 'twentyeleven' ), + sprintf( '%s', get_comment_author_link() ), + sprintf( '', + esc_url( get_comment_link( $comment->comment_ID ) ), + get_comment_time( 'c' ), + /* translators: 1: date, 2: time */ + sprintf( __( '%1$s at %2$s', 'twentyeleven' ), get_comment_date(), get_comment_time() ) + ) + ); + ?> + + ', '' ); ?> +
              + + comment_approved == '0' ) : ?> + +
              + + +
              + +
              + +
              + __( 'Reply ', 'twentyeleven' ), 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?> +
              +
              + + Posted on by ', 'twentyeleven' ), + esc_url( get_permalink() ), + esc_attr( get_the_time() ), + esc_attr( get_the_date( 'c' ) ), + esc_html( get_the_date() ), + esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ), + sprintf( esc_attr__( 'View all posts by %s', 'twentyeleven' ), get_the_author() ), + esc_html( get_the_author() ) + ); +} +endif; + +/** + * Adds two classes to the array of body classes. + * The first is if the site has only had one author with published posts. + * The second is if a singular post being displayed + * + * @since Twenty Eleven 1.0 + */ +function twentyeleven_body_classes( $classes ) { + + if ( ! is_multi_author() ) { + $classes[] = 'single-author'; + } + + if ( is_singular() && ! is_home() && ! is_page_template( 'showcase.php' ) && ! is_page_template( 'sidebar-page.php' ) ) + $classes[] = 'singular'; + + return $classes; +} +add_filter( 'body_class', 'twentyeleven_body_classes' ); + diff --git a/src/wp-content/themes/twentyeleven/header.php b/src/wp-content/themes/twentyeleven/header.php new file mode 100644 index 0000000..b1be094 --- /dev/null +++ b/src/wp-content/themes/twentyeleven/header.php @@ -0,0 +1,123 @@ + section and everything up till
              + * + * @package WordPress + * @subpackage Twenty_Eleven + * @since Twenty Eleven 1.0 + */ +?> + + + + +> + + + + +<?php + /* + * Print the <title> tag based on what is being viewed. + */ + global $page, $paged; + + wp_title( '|', true, 'right' ); + + // Add the blog name. + bloginfo( 'name' ); + + // Add the blog description for the home/front page. + $site_description = get_bloginfo( 'description', 'display' ); + if ( $site_description && ( is_home() || is_front_page() ) ) + echo " | $site_description"; + + // Add a page number if necessary: + if ( $paged >= 2 || $page >= 2 ) + echo ' | ' . sprintf( __( 'Page %s', 'twentyeleven' ), max( $paged, $page ) ); + + ?> + + + + + + * tag of your theme, or you will break many plugins, which + * generally use this hook to add elements to such + * as styles, scripts, and meta tags. + */ + wp_head(); +?> + + +> +
              + + + +
              \ No newline at end of file diff --git a/src/wp-content/themes/twentyeleven/image.php b/src/wp-content/themes/twentyeleven/image.php new file mode 100644 index 0000000..c6c8544 --- /dev/null +++ b/src/wp-content/themes/twentyeleven/image.php @@ -0,0 +1,101 @@ + + +
              +
              + + + + + +
              > +
              +

              + + + +
              + +
              + +
              +
              + $post->post_parent, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => 'menu_order ID' ) ) ); + foreach ( $attachments as $k => $attachment ) { + if ( $attachment->ID == $post->ID ) + break; + } + $k++; + // If there is more than 1 attachment in a gallery + if ( count( $attachments ) > 1 ) { + if ( isset( $attachments[ $k ] ) ) + // get the URL of the next image attachment + $next_attachment_url = get_attachment_link( $attachments[ $k ]->ID ); + else + // or get the URL of the first image attachment + $next_attachment_url = get_attachment_link( $attachments[ 0 ]->ID ); + } else { + // or, if there's only 1 image, get the URL of the image + $next_attachment_url = wp_get_attachment_url(); + } +?> + ID, array( $attachment_size, 1024 ) ); // filterable image width with 1024px limit for image height. + ?> + + post_excerpt ) ) : ?> +
              + +
              + +
              + +
              + +
              + + '' ) ); ?> +
              + +
              + +
              + + + +
              +
              + + \ No newline at end of file diff --git a/src/wp-content/themes/twentyeleven/images/comment-arrow-bypostauthor-dark-rtl.png b/src/wp-content/themes/twentyeleven/images/comment-arrow-bypostauthor-dark-rtl.png new file mode 100644 index 0000000..46dac85 Binary files /dev/null and b/src/wp-content/themes/twentyeleven/images/comment-arrow-bypostauthor-dark-rtl.png differ diff --git a/src/wp-content/themes/twentyeleven/images/comment-arrow-bypostauthor-dark.png b/src/wp-content/themes/twentyeleven/images/comment-arrow-bypostauthor-dark.png new file mode 100644 index 0000000..e32e285 Binary files /dev/null and b/src/wp-content/themes/twentyeleven/images/comment-arrow-bypostauthor-dark.png differ diff --git a/src/wp-content/themes/twentyeleven/images/comment-arrow-bypostauthor-rtl.png b/src/wp-content/themes/twentyeleven/images/comment-arrow-bypostauthor-rtl.png new file mode 100644 index 0000000..9ae83f0 Binary files /dev/null and b/src/wp-content/themes/twentyeleven/images/comment-arrow-bypostauthor-rtl.png differ diff --git a/src/wp-content/themes/twentyeleven/images/comment-arrow-bypostauthor.png b/src/wp-content/themes/twentyeleven/images/comment-arrow-bypostauthor.png new file mode 100644 index 0000000..bf9d3d9 Binary files /dev/null and b/src/wp-content/themes/twentyeleven/images/comment-arrow-bypostauthor.png differ diff --git a/src/wp-content/themes/twentyeleven/images/comment-arrow-dark-rtl.png b/src/wp-content/themes/twentyeleven/images/comment-arrow-dark-rtl.png new file mode 100644 index 0000000..3644fdd Binary files /dev/null and b/src/wp-content/themes/twentyeleven/images/comment-arrow-dark-rtl.png differ diff --git a/src/wp-content/themes/twentyeleven/images/comment-arrow-dark.png b/src/wp-content/themes/twentyeleven/images/comment-arrow-dark.png new file mode 100644 index 0000000..f9b624b Binary files /dev/null and b/src/wp-content/themes/twentyeleven/images/comment-arrow-dark.png differ diff --git a/src/wp-content/themes/twentyeleven/images/comment-arrow-rtl.png b/src/wp-content/themes/twentyeleven/images/comment-arrow-rtl.png new file mode 100644 index 0000000..e3fb1fd Binary files /dev/null and b/src/wp-content/themes/twentyeleven/images/comment-arrow-rtl.png differ diff --git a/src/wp-content/themes/twentyeleven/images/comment-arrow.png b/src/wp-content/themes/twentyeleven/images/comment-arrow.png new file mode 100644 index 0000000..60a6d5d Binary files /dev/null and b/src/wp-content/themes/twentyeleven/images/comment-arrow.png differ diff --git a/src/wp-content/themes/twentyeleven/images/comment-bubble-dark-rtl.png b/src/wp-content/themes/twentyeleven/images/comment-bubble-dark-rtl.png new file mode 100644 index 0000000..3a43135 Binary files /dev/null and b/src/wp-content/themes/twentyeleven/images/comment-bubble-dark-rtl.png differ diff --git a/src/wp-content/themes/twentyeleven/images/comment-bubble-dark.png b/src/wp-content/themes/twentyeleven/images/comment-bubble-dark.png new file mode 100644 index 0000000..6bf8797 Binary files /dev/null and b/src/wp-content/themes/twentyeleven/images/comment-bubble-dark.png differ diff --git a/src/wp-content/themes/twentyeleven/images/comment-bubble-rtl.png b/src/wp-content/themes/twentyeleven/images/comment-bubble-rtl.png new file mode 100644 index 0000000..bdfde17 Binary files /dev/null and b/src/wp-content/themes/twentyeleven/images/comment-bubble-rtl.png differ diff --git a/src/wp-content/themes/twentyeleven/images/comment-bubble.png b/src/wp-content/themes/twentyeleven/images/comment-bubble.png new file mode 100644 index 0000000..1901194 Binary files /dev/null and b/src/wp-content/themes/twentyeleven/images/comment-bubble.png differ diff --git a/src/wp-content/themes/twentyeleven/images/headers/chessboard-thumbnail.jpg b/src/wp-content/themes/twentyeleven/images/headers/chessboard-thumbnail.jpg new file mode 100644 index 0000000..e8c84d3 Binary files /dev/null and b/src/wp-content/themes/twentyeleven/images/headers/chessboard-thumbnail.jpg differ diff --git a/src/wp-content/themes/twentyeleven/images/headers/chessboard.jpg b/src/wp-content/themes/twentyeleven/images/headers/chessboard.jpg new file mode 100644 index 0000000..4fd9377 Binary files /dev/null and b/src/wp-content/themes/twentyeleven/images/headers/chessboard.jpg differ diff --git a/src/wp-content/themes/twentyeleven/images/headers/hanoi-thumbnail.jpg b/src/wp-content/themes/twentyeleven/images/headers/hanoi-thumbnail.jpg new file mode 100644 index 0000000..9fc963f Binary files /dev/null and b/src/wp-content/themes/twentyeleven/images/headers/hanoi-thumbnail.jpg differ diff --git a/src/wp-content/themes/twentyeleven/images/headers/hanoi.jpg b/src/wp-content/themes/twentyeleven/images/headers/hanoi.jpg new file mode 100644 index 0000000..37d73f1 Binary files /dev/null and b/src/wp-content/themes/twentyeleven/images/headers/hanoi.jpg differ diff --git a/src/wp-content/themes/twentyeleven/images/headers/lanterns-thumbnail.jpg b/src/wp-content/themes/twentyeleven/images/headers/lanterns-thumbnail.jpg new file mode 100644 index 0000000..1713f37 Binary files /dev/null and b/src/wp-content/themes/twentyeleven/images/headers/lanterns-thumbnail.jpg differ diff --git a/src/wp-content/themes/twentyeleven/images/headers/lanterns.jpg b/src/wp-content/themes/twentyeleven/images/headers/lanterns.jpg new file mode 100644 index 0000000..3a25db4 Binary files /dev/null and b/src/wp-content/themes/twentyeleven/images/headers/lanterns.jpg differ diff --git a/src/wp-content/themes/twentyeleven/images/headers/pine-cone-thumbnail.jpg b/src/wp-content/themes/twentyeleven/images/headers/pine-cone-thumbnail.jpg new file mode 100644 index 0000000..248fe00 Binary files /dev/null and b/src/wp-content/themes/twentyeleven/images/headers/pine-cone-thumbnail.jpg differ diff --git a/src/wp-content/themes/twentyeleven/images/headers/pine-cone.jpg b/src/wp-content/themes/twentyeleven/images/headers/pine-cone.jpg new file mode 100644 index 0000000..b70bf7c Binary files /dev/null and b/src/wp-content/themes/twentyeleven/images/headers/pine-cone.jpg differ diff --git a/src/wp-content/themes/twentyeleven/images/headers/shore-thumbnail.jpg b/src/wp-content/themes/twentyeleven/images/headers/shore-thumbnail.jpg new file mode 100644 index 0000000..5e5e740 Binary files /dev/null and b/src/wp-content/themes/twentyeleven/images/headers/shore-thumbnail.jpg differ diff --git a/src/wp-content/themes/twentyeleven/images/headers/shore.jpg b/src/wp-content/themes/twentyeleven/images/headers/shore.jpg new file mode 100644 index 0000000..2375630 Binary files /dev/null and b/src/wp-content/themes/twentyeleven/images/headers/shore.jpg differ diff --git a/src/wp-content/themes/twentyeleven/images/headers/trolley-thumbnail.jpg b/src/wp-content/themes/twentyeleven/images/headers/trolley-thumbnail.jpg new file mode 100644 index 0000000..d2ee200 Binary files /dev/null and b/src/wp-content/themes/twentyeleven/images/headers/trolley-thumbnail.jpg differ diff --git a/src/wp-content/themes/twentyeleven/images/headers/trolley.jpg b/src/wp-content/themes/twentyeleven/images/headers/trolley.jpg new file mode 100644 index 0000000..61c8956 Binary files /dev/null and b/src/wp-content/themes/twentyeleven/images/headers/trolley.jpg differ diff --git a/src/wp-content/themes/twentyeleven/images/headers/wheel-thumbnail.jpg b/src/wp-content/themes/twentyeleven/images/headers/wheel-thumbnail.jpg new file mode 100644 index 0000000..d7fa971 Binary files /dev/null and b/src/wp-content/themes/twentyeleven/images/headers/wheel-thumbnail.jpg differ diff --git a/src/wp-content/themes/twentyeleven/images/headers/wheel.jpg b/src/wp-content/themes/twentyeleven/images/headers/wheel.jpg new file mode 100644 index 0000000..a6155ff Binary files /dev/null and b/src/wp-content/themes/twentyeleven/images/headers/wheel.jpg differ diff --git a/src/wp-content/themes/twentyeleven/images/headers/willow-thumbnail.jpg b/src/wp-content/themes/twentyeleven/images/headers/willow-thumbnail.jpg new file mode 100644 index 0000000..240fff8 Binary files /dev/null and b/src/wp-content/themes/twentyeleven/images/headers/willow-thumbnail.jpg differ diff --git a/src/wp-content/themes/twentyeleven/images/headers/willow.jpg b/src/wp-content/themes/twentyeleven/images/headers/willow.jpg new file mode 100644 index 0000000..61bd538 Binary files /dev/null and b/src/wp-content/themes/twentyeleven/images/headers/willow.jpg differ diff --git a/src/wp-content/themes/twentyeleven/images/search.png b/src/wp-content/themes/twentyeleven/images/search.png new file mode 100644 index 0000000..1f9d828 Binary files /dev/null and b/src/wp-content/themes/twentyeleven/images/search.png differ diff --git a/src/wp-content/themes/twentyeleven/images/wordpress.png b/src/wp-content/themes/twentyeleven/images/wordpress.png new file mode 100644 index 0000000..4a15056 Binary files /dev/null and b/src/wp-content/themes/twentyeleven/images/wordpress.png differ diff --git a/src/wp-content/themes/twentyeleven/inc/images/content-sidebar.png b/src/wp-content/themes/twentyeleven/inc/images/content-sidebar.png new file mode 100644 index 0000000..f4d4794 Binary files /dev/null and b/src/wp-content/themes/twentyeleven/inc/images/content-sidebar.png differ diff --git a/src/wp-content/themes/twentyeleven/inc/images/content.png b/src/wp-content/themes/twentyeleven/inc/images/content.png new file mode 100644 index 0000000..6cf1da4 Binary files /dev/null and b/src/wp-content/themes/twentyeleven/inc/images/content.png differ diff --git a/src/wp-content/themes/twentyeleven/inc/images/dark.png b/src/wp-content/themes/twentyeleven/inc/images/dark.png new file mode 100644 index 0000000..55eda66 Binary files /dev/null and b/src/wp-content/themes/twentyeleven/inc/images/dark.png differ diff --git a/src/wp-content/themes/twentyeleven/inc/images/light.png b/src/wp-content/themes/twentyeleven/inc/images/light.png new file mode 100644 index 0000000..51b1b7a Binary files /dev/null and b/src/wp-content/themes/twentyeleven/inc/images/light.png differ diff --git a/src/wp-content/themes/twentyeleven/inc/images/sidebar-content.png b/src/wp-content/themes/twentyeleven/inc/images/sidebar-content.png new file mode 100644 index 0000000..de52023 Binary files /dev/null and b/src/wp-content/themes/twentyeleven/inc/images/sidebar-content.png differ diff --git a/src/wp-content/themes/twentyeleven/inc/theme-options.css b/src/wp-content/themes/twentyeleven/inc/theme-options.css new file mode 100644 index 0000000..464ab8c --- /dev/null +++ b/src/wp-content/themes/twentyeleven/inc/theme-options.css @@ -0,0 +1,35 @@ +#wpcontent select option { + padding-right: 5px; +} +.image-radio-option td { + padding-top: 15px; +} +.image-radio-option label { + display: block; + float: left; + margin: 0 30px 20px 2px; + position: relative; +} +.image-radio-option input { + margin: 0 0 10px; +} +.image-radio-option span { + display: block; + width: 136px; +} +.image-radio-option img { + margin: 0 0 0 -2px; +} +#link-color-example { + -moz-border-radius: 4px; + -webkit-border-radius: 4px; + border-radius: 4px; + border: 1px solid #dfdfdf; + margin: 0 7px 0 3px; + padding: 4px 14px; +} + +body.rtl .image-radio-option label { + float: right; + margin: 0 2px 20px 30px; +} diff --git a/src/wp-content/themes/twentyeleven/inc/theme-options.js b/src/wp-content/themes/twentyeleven/inc/theme-options.js new file mode 100644 index 0000000..4cfaec1 --- /dev/null +++ b/src/wp-content/themes/twentyeleven/inc/theme-options.js @@ -0,0 +1,52 @@ +var farbtastic; + +(function($){ + var pickColor = function(a) { + farbtastic.setColor(a); + $('#link-color').val(a); + $('#link-color-example').css('background-color', a); + }; + + $(document).ready( function() { + $('#default-color').wrapInner(''); + + farbtastic = $.farbtastic('#colorPickerDiv', pickColor); + + pickColor( $('#link-color').val() ); + + $('.pickcolor').click( function(e) { + $('#colorPickerDiv').show(); + e.preventDefault(); + }); + + $('#link-color').keyup( function() { + var a = $('#link-color').val(), + b = a; + + a = a.replace(/[^a-fA-F0-9]/, ''); + if ( '#' + a !== b ) + $('#link-color').val(a); + if ( a.length === 3 || a.length === 6 ) + pickColor( '#' + a ); + }); + + $(document).mousedown( function() { + $('#colorPickerDiv').hide(); + }); + + $('#default-color a').click( function(e) { + pickColor( '#' + this.innerHTML.replace(/[^a-fA-F0-9]/, '') ); + e.preventDefault(); + }); + + $('.image-radio-option.color-scheme input:radio').change( function() { + var currentDefault = $('#default-color a'), + newDefault = $(this).next().val(); + + if ( $('#link-color').val() == currentDefault.text() ) + pickColor( newDefault ); + + currentDefault.text( newDefault ); + }); + }); +})(jQuery); \ No newline at end of file diff --git a/src/wp-content/themes/twentyeleven/inc/theme-options.php b/src/wp-content/themes/twentyeleven/inc/theme-options.php new file mode 100644 index 0000000..34e29f7 --- /dev/null +++ b/src/wp-content/themes/twentyeleven/inc/theme-options.php @@ -0,0 +1,408 @@ +' . __( 'Some themes provide customization options that are grouped together on a Theme Options screen. If you change themes, options may change or disappear, as they are theme-specific. Your current theme, Twenty Eleven, provides the following Theme Options:', 'twentyeleven' ) . '

              ' . + '
                ' . + '
              1. ' . __( 'Color Scheme: You can choose a color palette of "Light" (light background with dark text) or "Dark" (dark background with light text) for your site.', 'twentyeleven' ) . '
              2. ' . + '
              3. ' . __( 'Link Color: You can choose the color used for text links on your site. You can enter the HTML color or hex code, or you can choose visually by clicking the "Select a Color" button to pick from a color wheel.', 'twentyeleven' ) . '
              4. ' . + '
              5. ' . __( 'Default Layout: You can choose if you want your site’s default layout to have a sidebar on the left, the right, or not at all.', 'twentyeleven' ) . '
              6. ' . + '
              ' . + '

              ' . __( 'Remember to click "Save Changes" to save any changes you have made to the theme options.', 'twentyeleven' ) . '

              ' . + '

              ' . __( 'For more information:', 'twentyeleven' ) . '

              ' . + '

              ' . __( 'Documentation on Theme Options', 'twentyeleven' ) . '

              ' . + '

              ' . __( 'Support Forums', 'twentyeleven' ) . '

              '; + + add_contextual_help( $theme_page, $help ); +} +add_action( 'admin_menu', 'twentyeleven_theme_options_add_page' ); + +/** + * Returns an array of color schemes registered for Twenty Eleven. + * + * @since Twenty Eleven 1.0 + */ +function twentyeleven_color_schemes() { + $color_scheme_options = array( + 'light' => array( + 'value' => 'light', + 'label' => __( 'Light', 'twentyeleven' ), + 'thumbnail' => get_template_directory_uri() . '/inc/images/light.png', + 'default_link_color' => '#1b8be0', + ), + 'dark' => array( + 'value' => 'dark', + 'label' => __( 'Dark', 'twentyeleven' ), + 'thumbnail' => get_template_directory_uri() . '/inc/images/dark.png', + 'default_link_color' => '#e4741f', + ), + ); + + return apply_filters( 'twentyeleven_color_schemes', $color_scheme_options ); +} + +/** + * Returns an array of layout options registered for Twenty Eleven. + * + * @since Twenty Eleven 1.0 + */ +function twentyeleven_layouts() { + $layout_options = array( + 'content-sidebar' => array( + 'value' => 'content-sidebar', + 'label' => __( 'Content on left', 'twentyeleven' ), + 'thumbnail' => get_template_directory_uri() . '/inc/images/content-sidebar.png', + ), + 'sidebar-content' => array( + 'value' => 'sidebar-content', + 'label' => __( 'Content on right', 'twentyeleven' ), + 'thumbnail' => get_template_directory_uri() . '/inc/images/sidebar-content.png', + ), + 'content' => array( + 'value' => 'content', + 'label' => __( 'One-column, no sidebar', 'twentyeleven' ), + 'thumbnail' => get_template_directory_uri() . '/inc/images/content.png', + ), + ); + + return apply_filters( 'twentyeleven_layouts', $layout_options ); +} + +/** + * Returns the default options for Twenty Eleven. + * + * @since Twenty Eleven 1.0 + */ +function twentyeleven_get_default_theme_options() { + $default_theme_options = array( + 'color_scheme' => 'light', + 'link_color' => twentyeleven_get_default_link_color( 'light' ), + 'theme_layout' => 'content-sidebar', + ); + + if ( is_rtl() ) + $default_theme_options['theme_layout'] = 'sidebar-content'; + + return apply_filters( 'twentyeleven_default_theme_options', $default_theme_options ); +} + +/** + * Returns the default link color for Twenty Eleven, based on color scheme. + * + * @since Twenty Eleven 1.0 + * + * @param $string $color_scheme Color scheme. Defaults to the active color scheme. + * @return $string Color. +*/ +function twentyeleven_get_default_link_color( $color_scheme = null ) { + if ( null === $color_scheme ) { + $options = twentyeleven_get_theme_options(); + $color_scheme = $options['color_scheme']; + } + + $color_schemes = twentyeleven_color_schemes(); + if ( ! isset( $color_schemes[ $color_scheme ] ) ) + return false; + + return $color_schemes[ $color_scheme ]['default_link_color']; +} + +/** + * Returns the options array for Twenty Eleven. + * + * @since Twenty Eleven 1.0 + */ +function twentyeleven_get_theme_options() { + return get_option( 'twentyeleven_theme_options', twentyeleven_get_default_theme_options() ); +} + +/** + * Returns the options array for Twenty Eleven. + * + * @since Twenty Eleven 1.2 + */ +function twentyeleven_theme_options_render_page() { + ?> +
              + +

              + + +
              + + + + + + + + + + + + + + + +
              +
              + +
              + +
              + +
              +
              +
              + + + + +
              + ' . twentyeleven_get_default_link_color( $options['color_scheme'] ) . '' ); ?> +
              +
              +
              + +
              + +
              + +
              +
              + + +
              +
              + + + 'widget_twentyeleven_ephemera', 'description' => __( 'Use this widget to list your recent Aside, Status, Quote, and Link posts', 'twentyeleven' ) ); + $this->WP_Widget( 'widget_twentyeleven_ephemera', __( 'Twenty Eleven Ephemera', 'twentyeleven' ), $widget_ops ); + $this->alt_option_name = 'widget_twentyeleven_ephemera'; + + add_action( 'save_post', array(&$this, 'flush_widget_cache' ) ); + add_action( 'deleted_post', array(&$this, 'flush_widget_cache' ) ); + add_action( 'switch_theme', array(&$this, 'flush_widget_cache' ) ); + } + + /** + * Outputs the HTML for this widget. + * + * @param array An array of standard parameters for widgets in this theme + * @param array An array of settings for this widget instance + * @return void Echoes it's output + **/ + function widget( $args, $instance ) { + $cache = wp_cache_get( 'widget_twentyeleven_ephemera', 'widget' ); + + if ( !is_array( $cache ) ) + $cache = array(); + + if ( ! isset( $args['widget_id'] ) ) + $args['widget_id'] = null; + + if ( isset( $cache[$args['widget_id']] ) ) { + echo $cache[$args['widget_id']]; + return; + } + + ob_start(); + extract( $args, EXTR_SKIP ); + + $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? __( 'Ephemera', 'twentyeleven' ) : $instance['title'], $instance, $this->id_base); + + if ( ! isset( $instance['number'] ) ) + $instance['number'] = '10'; + + if ( ! $number = absint( $instance['number'] ) ) + $number = 10; + + $ephemera_args = array( + 'order' => 'DESC', + 'posts_per_page' => $number, + 'no_found_rows' => true, + 'post_status' => 'publish', + 'post__not_in' => get_option( 'sticky_posts' ), + 'tax_query' => array( + array( + 'taxonomy' => 'post_format', + 'terms' => array( 'post-format-aside', 'post-format-link', 'post-format-status', 'post-format-quote' ), + 'field' => 'slug', + 'operator' => 'IN', + ), + ), + ); + $ephemera = new WP_Query( $ephemera_args ); + + if ( $ephemera->have_posts() ) : + + echo $before_widget; + echo $before_title; + echo $title; // Can set this with a widget option, or omit altogether + echo $after_title; + + ?> +
                + have_posts() ) : $ephemera->the_post(); ?> + + + +
              1. + + + comments →', 'twentyeleven' ), __( '1 comment →', 'twentyeleven' ), __( '% comments →', 'twentyeleven' ) ); ?> + +
              2. + + + +
              3. + +   + + comments →', 'twentyeleven' ), __( '1 comment →', 'twentyeleven' ), __( '% comments →', 'twentyeleven' ) ); ?> + +
              4. + + + + +
              + flush_widget_cache(); + + $alloptions = wp_cache_get( 'alloptions', 'options' ); + if ( isset( $alloptions['widget_twentyeleven_ephemera'] ) ) + delete_option( 'widget_twentyeleven_ephemera' ); + + return $instance; + } + + function flush_widget_cache() { + wp_cache_delete( 'widget_twentyeleven_ephemera', 'widget' ); + } + + /** + * Displays the form for this widget on the Widgets page of the WP Admin area. + **/ + function form( $instance ) { + $title = isset( $instance['title']) ? esc_attr( $instance['title'] ) : ''; + $number = isset( $instance['number'] ) ? absint( $instance['number'] ) : 10; +?> +

              +

              + +

              +

              + + +
              +
              + + + + + + + + + + + + + + + + +
              +
              +

              +
              + +
              +

              + +
              +
              + + + +
              +
              + + + \ No newline at end of file diff --git a/src/wp-content/themes/twentyeleven/js/html5.js b/src/wp-content/themes/twentyeleven/js/html5.js new file mode 100644 index 0000000..6dd03a4 --- /dev/null +++ b/src/wp-content/themes/twentyeleven/js/html5.js @@ -0,0 +1,3 @@ +// html5shiv MIT @rem remysharp.com/html5-enabling-script +// iepp v1.6.2 MIT @jon_neal iecss.com/print-protector +/*@cc_on(function(a,b){function r(a){var b=-1;while(++b";return a.childNodes.length!==1}())){a.iepp=a.iepp||{};var c=a.iepp,d=c.html5elements||"abbr|article|aside|audio|canvas|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",e=d.split("|"),f=e.length,g=new RegExp("(^|\\s)("+d+")","gi"),h=new RegExp("<(/*)("+d+")","gi"),i=/^\s*[\{\}]\s*$/,j=new RegExp("(^|[^\\n]*?\\s)("+d+")([^\\n]*)({[\\n\\w\\W]*?})","gi"),k=b.createDocumentFragment(),l=b.documentElement,m=l.firstChild,n=b.createElement("body"),o=b.createElement("style"),p=/print|all/,q;c.getCSS=function(a,b){if(a+""===undefined)return"";var d=-1,e=a.length,f,g=[];while(++d%5$s. Bookmark the permalink." +msgstr "Esta entrada fue publicada por %5$s. Guarda el enlace permanente." + +#: functions.php:544 +msgid "Reply " +msgstr "Responder " + +#: single.php:20 +msgid "Next " +msgstr "Siguiente " + +#: single.php:19 +msgid " Previous" +msgstr " Anterior" + +#: content-image.php:64 +msgid "1 Reply" +msgstr "1 Respuesta" + +#: content-quote.php:24 content.php:30 content-image.php:21 +#: content-aside.php:22 content-status.php:21 content-link.php:22 +msgctxt "comments number" +msgid "%" +msgstr "%" + +#: content-quote.php:24 content.php:30 content-image.php:21 +#: content-aside.php:22 content-status.php:21 content-link.php:22 +msgctxt "comments number" +msgid "1" +msgstr "1" + +#: content-gallery.php:87 +msgid "Leave a Reply" +msgstr "Deja una respuesta" + +#: content-quote.php:24 content.php:30 content-image.php:21 +#: content-image.php:64 content-aside.php:22 content-status.php:21 +#: content-link.php:22 +msgid "Reply" +msgstr "Responder" + +#: content-image.php:64 +msgid "% Replies" +msgstr "% Respuestas" + +#: image.php:18 +msgid "Image navigation" +msgstr "Navegador de imágenes" + +#: functions.php:526 +msgid "%1$s at %2$s" +msgstr "%1$s en %2$s" + +#: functions.php:520 +msgid "%1$s on %2$s said:" +msgstr "%1$s en %2$s dijo:" + +#: index.php:41 category.php:54 tag.php:54 author.php:78 archive.php:61 +msgid "Apologies, but no results were found for the requested archive. Perhaps searching will help find a related post." +msgstr "Disculpa, pero no se han encontrado resultados para el archivo solicitado. Tal vez una nueva búsqueda ayudará a encontrar una entrada relacionada." + +#: content-image.php:34 +msgid " by %6$s" +msgstr " por %6$s" + +#: functions.php:562 +msgid "Posted on by %7$s" +msgstr "Publicado el por %7$s" + +#: inc/theme-options.php:261 +msgid "Default Layout" +msgstr "Diseño por defecto" + +#: inc/theme-options.php:98 +msgid "Documentation on Theme Options" +msgstr "Documentación de Opciones del Tema" + +#: inc/theme-options.php:99 +msgid "Support Forums" +msgstr "Foros de soporte" + +#: inc/theme-options.php:97 +msgid "For more information:" +msgstr "Para más información:" + +#: inc/theme-options.php:96 +msgid "Remember to click \"Save Changes\" to save any changes you have made to the theme options." +msgstr "Recuerde hacer clic en \"Guardar cambios\" para guardar los cambios realizados a las opciones del tema." + +#: header.php:115 +msgid "Skip to primary content" +msgstr "Ir al contenido principal" + +#: header.php:116 +msgid "Skip to secondary content" +msgstr "Ir al contenido secundario" + +#: inc/theme-options.php:148 +msgid "One-column, no sidebar" +msgstr "Una columna, sin barra lateral" + +#: inc/theme-options.php:90 +msgid "Some themes provide customization options that are grouped together on a Theme Options screen. If you change themes, options may change or disappear, as they are theme-specific. Your current theme, Twenty Eleven, provides the following Theme Options:" +msgstr "Algunos temas ofrecen opciones de personalización que se agrupan en una pantalla de Opciones del tema. Si cambias los temas, las opciones pueden cambiar o desaparecer, ya que pertenecen a un tema específico. El tema actual, Twenty Eleven, ofrece las siguientes opciones:" + +#: inc/theme-options.php:92 +msgid "Color Scheme: You can choose a color palette of \"Light\" (light background with dark text) or \"Dark\" (dark background with light text) for your site." +msgstr "Combinación de colores: Puedes elegir una paleta de colores para \"Light\" (fondo blanco y texto oscuro) o \"Dark\" (fondo oscuro y texto claro) para su sitio." + +#: inc/theme-options.php:93 +msgid "Link Color: You can choose the color used for text links on your site. You can enter the HTML color or hex code, or you can choose visually by clicking the \"Select a Color\" button to pick from a color wheel." +msgstr "Color de enlace: Puedes elegir el color que se utiliza para los enlaces en el texto de su sitio. Puedes introducir el código de color HTML en hexadecimal, o puedes elegirlo visualmente haciendo clic en \"Seleccionar un color\" para elegir de la rueda de color." + +#: inc/theme-options.php:94 +msgid "Default Layout: You can choose if you want your site’s default layout to have a sidebar on the left, the right, or not at all." +msgstr "Diseño por defecto: Puedes elegir si deseas que el diseño de tu sitio web por defecto tenga una barra lateral a la izquierda, a la derecha, o que no tenga barra lateral." + +#: content-quote.php:44 content-quote.php:54 content.php:51 content.php:61 +#: content-image.php:47 content-image.php:56 content-single.php:30 +#: content-single.php:33 content-gallery.php:62 content-gallery.php:72 +#: content-featured.php:29 content-featured.php:38 +msgid ", " +msgstr ", " + +#: content-quote.php:48 content.php:55 content-image.php:51 +#: content-gallery.php:66 +msgid "Posted in %2$s" +msgstr "Publicado en %2$s" + +#: content-quote.php:60 content.php:67 content-image.php:59 +#: content-gallery.php:78 +msgid "Tagged %2$s" +msgstr "Etiquetado %2$s" + +#: footer.php:26 +msgid "Semantic Personal Publishing Platform" +msgstr "Plataforma semántica de publicación personal" + +#: footer.php:26 +msgid "Proudly powered by %s" +msgstr "Funciona con %s" + +#: content-status.php:16 +msgid "Status" +msgstr "Estado" + +#: content-quote.php:15 +msgid "Quote" +msgstr "Cita" + +#: content-gallery.php:17 +msgid "Gallery" +msgstr "Galería" + +#: content-link.php:17 +msgid "Link" +msgstr "Enlace" + +#: content-image.php:16 +msgid "Image" +msgstr "Imagen" + +#: content-aside.php:17 +msgid "Aside" +msgstr "Minientrada" + +msgid "The 2011 theme for WordPress is sophisticated, lightweight, and adaptable. Make it yours with a custom menu, header image, and background -- then go further with available theme options for light or dark color scheme, custom link colors, and three layout choices. Twenty Eleven comes equipped with a Showcase page template that transforms your front page into a showcase to show off your best content, widget support galore (sidebar, three footer areas, and a Showcase page widget area), and a custom \"Ephemera\" widget to display your Aside, Link, Quote, or Status posts. Included are styles for print and for the admin editor, support for featured images (as custom header images on posts and pages and as large images on featured \"sticky\" posts), and special styles for six different post formats." +msgstr "El tema de 2011 para WordPress es sofisticado, ligero y adaptable. Hazlo tuyo con un menú personalizado, imagen de cabecera, y el fondo – y puedes modificarlo con las opciones disponibles para el tema como colores claros u oscuros, colores personalizados para enlaces, y tres opciones de diseño. Twenty Eleven viene equipado con una plantilla para hacer de tu primera página en un escaparate y mostrar ty mejor contenido, soporte para muchos widgets (barra lateral, tres zonas de pie de página, y un área para la plantilla escaparate), y un widget, \"Ephemera\", para mostrar Minientradas, Enlaces, Citas o mensajes de estado. Se incluyen estilos para impresión y para el editor, soporte para imágenes destacadas (como imágenes de cabecera personalizada en blogs y páginas e imágenes de gran tamaño para mensajes \"fijos\"), y estilos especiales para seis formatos diferentes entradas." + +#: content.php:16 +msgid "Featured" +msgstr "Destacado" + +msgid "dark, light, white, black, gray, one-column, two-columns, left-sidebar, right-sidebar, fixed-width, flexible-width, custom-background, custom-colors, custom-header, custom-menu, editor-style, featured-image-header, featured-images, full-width-template, microformats, post-formats, rtl-language-support, sticky-post, theme-options, translation-ready" +msgstr "dark, light, white, black, gray, one-column, two-columns, left-sidebar, right-sidebar, fixed-width, flexible-width, custom-background, custom-colors, custom-header, custom-menu, editor-style, featured-image-header, featured-images, full-width-template, microformats, post-formats, rtl-language-support, sticky-post, theme-options, translation-ready" + +#: archive.php:25 +msgid "Daily Archives: %s" +msgstr "Archivos diarios: %s" + +#: inc/theme-options.php:248 inc/theme-options.php:250 +msgid "Link Color" +msgstr "Color de los enlaces" + +#: archive.php:27 +msgid "Monthly Archives: %s" +msgstr "Archivos Mensuales: %s" + +#: inc/widgets.php:19 +msgid "Use this widget to list your recent Aside, Status, Quote, and Link posts" +msgstr "Utiliza este widget para listar tus Minientradas, Estados, Citas y Enlaces recientes" + +#: inc/theme-options.php:253 +msgid "Select a Color" +msgstr "Selecciona un color" + +#: inc/theme-options.php:256 +msgid "Default color: %s" +msgstr "Color por defecto: %s" + +#: archive.php:29 +msgid "Yearly Archives: %s" +msgstr "Archivo Anual: %s" + +#: functions.php:191 +msgid "Hanoi Plant" +msgstr "Planta Hanoi" + +#: inc/theme-options.php:143 +msgid "Content on right" +msgstr "Contenido a la derecha" + +#: inc/theme-options.php:138 +msgid "Content on left" +msgstr "Contenido a la izquierda" + +#: inc/theme-options.php:120 +msgid "Dark" +msgstr "Oscuro" + +#: inc/theme-options.php:114 +msgid "Light" +msgstr "Claro" + +#: inc/theme-options.php:213 +msgid "%s Theme Options" +msgstr "Opciones del tema %s" + +#: inc/theme-options.php:80 inc/theme-options.php:81 +msgid "Theme Options" +msgstr "Opciones del tema" + +#: inc/theme-options.php:225 inc/theme-options.php:227 +#: inc/theme-options.php:263 +msgid "Color Scheme" +msgstr "Combinación de colores" + +#: functions.php:179 +msgid "Lanterns" +msgstr "Linternas" + +#: functions.php:185 +msgid "Willow" +msgstr "Sauce" + +#: functions.php:173 +msgid "Chessboard" +msgstr "Tablero de ajedrez" + +#: functions.php:167 +msgid "Pine Cone" +msgstr "Pino" + +#: functions.php:149 +msgid "Wheel" +msgstr "Rueda" + +#: showcase.php:143 +msgid "Featuring: %s" +msgstr "Destacando: %s" + +#: functions.php:155 +msgid "Shore" +msgstr "Tierra" + +#: functions.php:161 +msgid "Trolley" +msgstr "Carretilla" + +#: inc/widgets.php:93 inc/widgets.php:109 +msgid "1 comment →" +msgstr "1 comentario →" + +#: content-single.php:60 author.php:49 +msgid "About %s" +msgstr "Acerca de %s" + +#: inc/widgets.php:93 inc/widgets.php:109 +msgid "0 comments →" +msgstr "0 comentarios →" + +#: inc/widgets.php:52 +msgid "Ephemera" +msgstr "Ephemera" + +#: footer.php:26 +msgid "http://wordpress.org/" +msgstr "http://es.wordpress.org/" + +msgid "the WordPress team" +msgstr "el equipo de WordPress" + +#: comments.php:42 comments.php:62 +msgid "Newer Comments →" +msgstr "Comentarios recientes →" + +#: comments.php:41 comments.php:61 +msgid "← Older Comments" +msgstr "← Comentarios antiguos" + +#: comments.php:17 +msgid "This post is password protected. Enter the password to view any comments." +msgstr "Esta entrada está protegida. Introduce la contraseña para ver los comentarios." + +#: comments.php:72 +msgid "Comments are closed." +msgstr "Los comentarios están cerrados." + +#: content-quote.php:14 showcase.php:113 showcase.php:192 content.php:15 +#: content.php:19 content-image.php:15 content-gallery.php:16 +#: content-gallery.php:48 content-aside.php:16 content-status.php:15 +#: inc/widgets.php:91 content-link.php:16 content-featured.php:14 +msgid "Permalink to %s" +msgstr "Enlace permanente a %s" + +#: inc/widgets.php:107 +msgid "Link to %s" +msgstr "Enlace a %s" + +#: inc/widgets.php:159 +msgid "Title:" +msgstr "Título:" + +#: archive.php:31 +msgid "Blog Archives" +msgstr "Archivo del sitio" + +#: 404.php:17 +msgid "This is somewhat embarrassing, isn’t it?" +msgstr "Esto es algo embarazoso, ¿verdad?" + +#: category.php:19 +msgid "Category Archives: %s" +msgstr "Archivo de la categoría: %s" + +#: comments.php:40 comments.php:60 +msgid "Comment navigation" +msgstr "Navegación de comentarios" + +#: comments.php:33 +msgid "One thought on “%2$s”" +msgid_plural "%1$s thoughts on “%2$s”" +msgstr[0] "Un pensamiento en “%2$s”" +msgstr[1] "%1$s pensamientos en “%2$s”" + +#: search.php:46 +msgid "Sorry, but nothing matched your search criteria. Please try again with some different keywords." +msgstr "Lo sentimos, pero nada coincide con tus búsqueda. Por favor, prueba de nuevo con diferentes palabras clave." + +#: inc/widgets.php:20 +msgid "Twenty Eleven Ephemera" +msgstr "Twenty Eleven Ephemera" + +#: tag.php:19 +msgid "Tag Archives: %s" +msgstr "Archivo de la etiqueta: %s" + +#: author.php:28 +msgid "Author Archives: %s" +msgstr "Archivo del Autor: %s" + +#: search.php:18 +msgid "Search Results for: %s" +msgstr "Resultados de la búsqueda para: %s" + +#: index.php:37 category.php:50 tag.php:50 author.php:74 search.php:42 +#: archive.php:57 +msgid "Nothing Found" +msgstr "No se ha encontrado nada" + +#: searchform.php:11 searchform.php:12 searchform.php:13 +msgid "Search" +msgstr "Buscar" + +#: showcase.php:70 +msgid "Featured Post" +msgstr "Entradas destacadas" + +#: showcase.php:153 +msgid "Recent Posts" +msgstr "Entradas recientes" + +#: sidebar.php:19 +msgid "Archives" +msgstr "Archivos" + +#: sidebar.php:26 +msgid "Meta" +msgstr "Meta" + +#: 404.php:28 +msgid "Most Used Categories" +msgstr "Categorías más usadas" + +#: 404.php:36 +msgid "Try looking in the monthly archives. %1$s" +msgstr "Trata de buscar en los archivos mensuales. %1$s" + +#: 404.php:21 +msgid "It seems we can’t find what you’re looking for. Perhaps searching, or one of the links below, can help." +msgstr "Parece que no podemos encontrar lo que estás buscando. Tal vez una búsqueda, o uno de los enlaces que aparecen a continuación, pueden ayudarte." + +#: inc/widgets.php:162 +msgid "Number of posts to show:" +msgstr "Número de entradas a mostrar:" + +msgid "Twenty Eleven" +msgstr "Twenty Eleven" + +msgid "http://wordpress.org/extend/themes/twentyeleven" +msgstr "http://wordpress.org/extend/themes/twentyeleven" + +#: inc/widgets.php:93 inc/widgets.php:109 +msgid "% comments →" +msgstr "% comentarios →" + +#: content-quote.php:35 content.php:41 content-image.php:27 +#: content-gallery.php:32 content-aside.php:33 functions.php:327 +#: content-status.php:34 content-link.php:33 +msgid "Continue reading " +msgstr "Sigue leyendo " + +#: content-quote.php:36 content.php:42 content-image.php:28 +#: content-single.php:24 content-intro.php:18 content-gallery.php:54 +#: content-aside.php:34 image.php:89 content-status.php:35 content-page.php:18 +#: content-link.php:34 content-featured.php:23 +msgid "Pages:" +msgstr "Páginas:" + +#: content-image.php:39 functions.php:568 +msgid "View all posts by %s" +msgstr "Ver todas las entradas de %s" + +#: content-quote.php:69 showcase.php:194 content.php:77 content-gallery.php:87 +#: content-aside.php:42 content-status.php:43 content-link.php:42 +msgid "% Replies" +msgstr "% Respuestas" + +#: content-quote.php:69 showcase.php:194 content.php:77 content-gallery.php:87 +#: content-aside.php:42 content-status.php:43 content-link.php:42 +msgid "1 Reply" +msgstr "1 Respuesta" + +#: content-quote.php:72 content.php:80 content-image.php:68 +#: content-single.php:52 content-intro.php:19 content-gallery.php:90 +#: content-aside.php:44 image.php:40 functions.php:503 functions.php:531 +#: content-status.php:45 content-page.php:21 content-link.php:44 +#: content-featured.php:45 +msgid "Edit" +msgstr "Editar" + +#: content-single.php:37 +msgid "This entry was posted in %1$s by %5$s. Bookmark the permalink." +msgstr "Esta entrada fue publicada en %1$s por %5$s. Guarda el enlace permanente." + +#: content-single.php:35 +msgid "This entry was posted in %1$s and tagged %2$s by %5$s. Bookmark the permalink." +msgstr "Esta entrada fue publicada en %1$s y etiquetada %2$s por %5$s. Guarda enlace permanente." + +#: content-quote.php:69 showcase.php:194 content.php:77 content-aside.php:42 +#: content-status.php:43 content-link.php:42 +msgid "Leave a reply" +msgstr "Deja una respuesta" + +#: content-featured.php:33 +msgid "This entry was posted in %1$s. Bookmark the permalink." +msgstr "Esta entrada fue publicada en %1$s. Guarda el enlace permanente." + +#: content-gallery.php:47 +msgid "This gallery contains %2$s photo." +msgid_plural "This gallery contains %2$s photos." +msgstr[0] "Esta galería contiene %2$s foto " +msgstr[1] "Esta galería contiene %2$s fotos " + +#: image.php:30 +msgid "Published %2$s at %4$s × %5$s in %7$s" +msgstr "Publicado el %2$s en %4$s × %5$s en %7$s" + +#: image.php:20 +msgid "Next →" +msgstr "Siguiente →" + +#: image.php:19 +msgid "← Previous" +msgstr "← Anterior" + +#: header.php:113 +msgid "Main menu" +msgstr "Menú principal" + +#: header.php:45 +msgid "Page %s" +msgstr "Página %s" + +#: functions.php:503 +msgid "Pingback:" +msgstr "Pingback: " + +#: functions.php:535 +msgid "Your comment is awaiting moderation." +msgstr "Tu comentario está pendiente de moderación." + +#: functions.php:434 +msgid "Newer posts " +msgstr "Entradas más nuevas " + +#: functions.php:433 +msgid " Older posts" +msgstr " Entradas más antiguas" + +#: functions.php:432 single.php:18 +msgid "Post navigation" +msgstr "Navegador de artículos" + +#: functions.php:413 +msgid "Footer Area Three" +msgstr "Área 3 del pie" + +#: functions.php:403 +msgid "Footer Area Two" +msgstr "Área 2 del pie" + +#: functions.php:395 functions.php:405 functions.php:415 +msgid "An optional widget area for your site footer" +msgstr "Una zona opcional para widgets en el pie de tu sitio" + +#: functions.php:393 +msgid "Footer Area One" +msgstr "Área 1 del pie" + +#: functions.php:385 +msgid "The sidebar for the optional Showcase Template" +msgstr "La barra lateral para la plantilla de Escaparate opcional" + +#: functions.php:383 +msgid "Showcase Sidebar" +msgstr "Barra lateral de la plantilla Escaparate" + +#: functions.php:374 +msgid "Main Sidebar" +msgstr "Barra lateral principal" + +#: functions.php:101 +msgid "Primary Menu" +msgstr "Menú Principal" + +#: content-single.php:64 +msgid "View all posts by %s " +msgstr "Ver todas las entradas por %s " + +#: content-featured.php:31 +msgid "This entry was posted in %1$s and tagged %2$s. Bookmark the permalink." +msgstr "Esta entrada fue publicada en %1$s y etiquetada %2$s. Guarda el enlace permanente." \ No newline at end of file diff --git a/src/wp-content/themes/twentyeleven/languages/twentyeleven.pot b/src/wp-content/themes/twentyeleven/languages/twentyeleven.pot new file mode 100644 index 0000000..1cdd5e2 --- /dev/null +++ b/src/wp-content/themes/twentyeleven/languages/twentyeleven.pot @@ -0,0 +1,654 @@ +# Copyright (C) 2010 Twenty Eleven +# This file is distributed under the same license as the Twenty Eleven package. +msgid "" +msgstr "" +"Project-Id-Version: Twenty Eleven 1.0\n" +"Report-Msgid-Bugs-To: http://wordpress.org/tag/twentyeleven\n" +"POT-Creation-Date: 2011-06-30 22:47:23+00:00\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"PO-Revision-Date: 2010-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" + +#: content-quote.php:14 showcase.php:113 showcase.php:192 content.php:15 +#: content.php:19 content-image.php:15 content-gallery.php:16 +#: content-gallery.php:48 content-aside.php:16 content-status.php:15 +#: inc/widgets.php:91 content-link.php:16 content-featured.php:14 +msgid "Permalink to %s" +msgstr "" + +#: content-quote.php:15 +msgid "Quote" +msgstr "" + +#: content-quote.php:24 content.php:30 content-image.php:21 +#: content-image.php:64 content-aside.php:22 content-status.php:21 +#: content-link.php:22 +msgid "Reply" +msgstr "" + +#: content-quote.php:24 content.php:30 content-image.php:21 +#: content-aside.php:22 content-status.php:21 content-link.php:22 +msgctxt "comments number" +msgid "1" +msgstr "" + +#: content-quote.php:24 content.php:30 content-image.php:21 +#: content-aside.php:22 content-status.php:21 content-link.php:22 +msgctxt "comments number" +msgid "%" +msgstr "" + +#: content-quote.php:35 content.php:41 content-image.php:27 +#: content-gallery.php:32 content-aside.php:33 functions.php:327 +#: content-status.php:34 content-link.php:33 +msgid "Continue reading " +msgstr "" + +#: content-quote.php:36 content.php:42 content-image.php:28 +#: content-single.php:24 content-intro.php:18 content-gallery.php:54 +#: content-aside.php:34 image.php:89 content-status.php:35 content-page.php:18 +#: content-link.php:34 content-featured.php:23 +msgid "Pages:" +msgstr "" + +#. translators: used between list items, there is a space after the comma +#: content-quote.php:44 content-quote.php:54 content.php:51 content.php:61 +#: content-image.php:47 content-image.php:56 content-single.php:30 +#: content-single.php:33 content-gallery.php:62 content-gallery.php:72 +#: content-featured.php:29 content-featured.php:38 +msgid ", " +msgstr "" + +#: content-quote.php:48 content.php:55 content-image.php:51 +#: content-gallery.php:66 +msgid "Posted in %2$s" +msgstr "" + +#: content-quote.php:60 content.php:67 content-image.php:59 +#: content-gallery.php:78 +msgid "Tagged %2$s" +msgstr "" + +#: content-quote.php:69 showcase.php:194 content.php:77 content-aside.php:42 +#: content-status.php:43 content-link.php:42 +msgid "Leave a reply" +msgstr "" + +#: content-quote.php:69 showcase.php:194 content.php:77 content-gallery.php:87 +#: content-aside.php:42 content-status.php:43 content-link.php:42 +msgid "1 Reply" +msgstr "" + +#: content-quote.php:69 showcase.php:194 content.php:77 content-gallery.php:87 +#: content-aside.php:42 content-status.php:43 content-link.php:42 +msgid "% Replies" +msgstr "" + +#: content-quote.php:72 content.php:80 content-image.php:68 +#: content-single.php:52 content-intro.php:19 content-gallery.php:90 +#: content-aside.php:44 image.php:40 functions.php:503 functions.php:531 +#: content-status.php:45 content-page.php:21 content-link.php:44 +#: content-featured.php:45 +msgid "Edit" +msgstr "" + +#: showcase.php:70 +msgid "Featured Post" +msgstr "" + +#: showcase.php:143 +msgid "Featuring: %s" +msgstr "" + +#: showcase.php:153 +msgid "Recent Posts" +msgstr "" + +#: index.php:37 category.php:50 tag.php:50 author.php:74 search.php:42 +#: archive.php:57 +msgid "Nothing Found" +msgstr "" + +#: index.php:41 category.php:54 tag.php:54 author.php:78 archive.php:61 +msgid "" +"Apologies, but no results were found for the requested archive. Perhaps " +"searching will help find a related post." +msgstr "" + +#: content.php:16 +msgid "Featured" +msgstr "" + +#. #-#-#-#-# twentyeleven.pot (Twenty Eleven 1.0) #-#-#-#-# +#. Author URI of the plugin/theme +#: footer.php:26 +msgid "http://wordpress.org/" +msgstr "" + +#: footer.php:26 +msgid "Semantic Personal Publishing Platform" +msgstr "" + +#: footer.php:26 +msgid "Proudly powered by %s" +msgstr "" + +#: category.php:19 +msgid "Category Archives: %s" +msgstr "" + +#: content-image.php:16 +msgid "Image" +msgstr "" + +#: content-image.php:34 +msgid "" +" by " +" %6$s" +msgstr "" + +#: content-image.php:39 functions.php:568 +msgid "View all posts by %s" +msgstr "" + +#: content-image.php:64 +msgid "1 Reply" +msgstr "" + +#: content-image.php:64 +msgid "% Replies" +msgstr "" + +#: sidebar.php:19 +msgid "Archives" +msgstr "" + +#: sidebar.php:26 +msgid "Meta" +msgstr "" + +#: content-single.php:35 +msgid "" +"This entry was posted in %1$s and tagged %2$s by %5$s. " +"Bookmark the permalink." +msgstr "" + +#: content-single.php:37 +msgid "" +"This entry was posted in %1$s by %5$s. Bookmark the permalink." +msgstr "" + +#: content-single.php:39 +msgid "" +"This entry was posted by %5$s. Bookmark the permalink." +msgstr "" + +#: content-single.php:60 author.php:49 +msgid "About %s" +msgstr "" + +#: content-single.php:64 +msgid "View all posts by %s " +msgstr "" + +#: tag.php:19 +msgid "Tag Archives: %s" +msgstr "" + +#: content-gallery.php:17 +msgid "Gallery" +msgstr "" + +#: content-gallery.php:47 +msgid "This gallery contains %2$s photo." +msgid_plural "This gallery contains %2$s photos." +msgstr[0] "" +msgstr[1] "" + +#: content-gallery.php:87 +msgid "Leave a Reply" +msgstr "" + +#: comments.php:17 +msgid "" +"This post is password protected. Enter the password to view any comments." +msgstr "" + +#: comments.php:33 +msgid "One thought on “%2$s”" +msgid_plural "%1$s thoughts on “%2$s”" +msgstr[0] "" +msgstr[1] "" + +#: comments.php:40 comments.php:60 +msgid "Comment navigation" +msgstr "" + +#: comments.php:41 comments.php:61 +msgid "← Older Comments" +msgstr "" + +#: comments.php:42 comments.php:62 +msgid "Newer Comments →" +msgstr "" + +#: comments.php:72 +msgid "Comments are closed." +msgstr "" + +#: content-aside.php:17 +msgid "Aside" +msgstr "" + +#: 404.php:17 +msgid "This is somewhat embarrassing, isn’t it?" +msgstr "" + +#: 404.php:21 +msgid "" +"It seems we can’t find what you’re looking for. Perhaps " +"searching, or one of the links below, can help." +msgstr "" + +#: 404.php:28 +msgid "Most Used Categories" +msgstr "" + +#. translators: %1$s: smilie +#: 404.php:36 +msgid "Try looking in the monthly archives. %1$s" +msgstr "" + +#: image.php:18 +msgid "Image navigation" +msgstr "" + +#: image.php:19 +msgid "← Previous" +msgstr "" + +#: image.php:20 +msgid "Next →" +msgstr "" + +#: image.php:30 +msgid "" +"Published %2$s " +"at %4$s × %5$s " +"in %7$s" +msgstr "" + +#: functions.php:101 +msgid "Primary Menu" +msgstr "" + +#. translators: header image description +#: functions.php:149 +msgid "Wheel" +msgstr "" + +#. translators: header image description +#: functions.php:155 +msgid "Shore" +msgstr "" + +#. translators: header image description +#: functions.php:161 +msgid "Trolley" +msgstr "" + +#. translators: header image description +#: functions.php:167 +msgid "Pine Cone" +msgstr "" + +#. translators: header image description +#: functions.php:173 +msgid "Chessboard" +msgstr "" + +#. translators: header image description +#: functions.php:179 +msgid "Lanterns" +msgstr "" + +#. translators: header image description +#: functions.php:185 +msgid "Willow" +msgstr "" + +#. translators: header image description +#: functions.php:191 +msgid "Hanoi Plant" +msgstr "" + +#: functions.php:374 +msgid "Main Sidebar" +msgstr "" + +#: functions.php:383 +msgid "Showcase Sidebar" +msgstr "" + +#: functions.php:385 +msgid "The sidebar for the optional Showcase Template" +msgstr "" + +#: functions.php:393 +msgid "Footer Area One" +msgstr "" + +#: functions.php:395 functions.php:405 functions.php:415 +msgid "An optional widget area for your site footer" +msgstr "" + +#: functions.php:403 +msgid "Footer Area Two" +msgstr "" + +#: functions.php:413 +msgid "Footer Area Three" +msgstr "" + +#: functions.php:432 single.php:18 +msgid "Post navigation" +msgstr "" + +#: functions.php:433 +msgid " Older posts" +msgstr "" + +#: functions.php:434 +msgid "Newer posts " +msgstr "" + +#: functions.php:503 +msgid "Pingback:" +msgstr "" + +#. translators: 1: comment author, 2: date and time +#: functions.php:520 +msgid "%1$s on %2$s said:" +msgstr "" + +#. translators: 1: date, 2: time +#: functions.php:526 +msgid "%1$s at %2$s" +msgstr "" + +#: functions.php:535 +msgid "Your comment is awaiting moderation." +msgstr "" + +#: functions.php:544 +msgid "Reply " +msgstr "" + +#: functions.php:562 +msgid "" +"Posted on by %7$s" +msgstr "" + +#: header.php:45 +msgid "Page %s" +msgstr "" + +#: header.php:113 +msgid "Main menu" +msgstr "" + +#: header.php:115 +msgid "Skip to primary content" +msgstr "" + +#: header.php:116 +msgid "Skip to secondary content" +msgstr "" + +#: author.php:28 +msgid "Author Archives: %s" +msgstr "" + +#: content-status.php:16 +msgid "Status" +msgstr "" + +#: inc/theme-options.php:80 inc/theme-options.php:81 +msgid "Theme Options" +msgstr "" + +#: inc/theme-options.php:90 +msgid "" +"Some themes provide customization options that are grouped together on a " +"Theme Options screen. If you change themes, options may change or disappear, " +"as they are theme-specific. Your current theme, Twenty Eleven, provides the " +"following Theme Options:" +msgstr "" + +#: inc/theme-options.php:92 +msgid "" +"Color Scheme: You can choose a color palette of \"Light" +"\" (light background with dark text) or \"Dark\" (dark background with light " +"text) for your site." +msgstr "" + +#: inc/theme-options.php:93 +msgid "" +"Link Color: You can choose the color used for text links on " +"your site. You can enter the HTML color or hex code, or you can choose " +"visually by clicking the \"Select a Color\" button to pick from a color " +"wheel." +msgstr "" + +#: inc/theme-options.php:94 +msgid "" +"Default Layout: You can choose if you want your site’" +"s default layout to have a sidebar on the left, the right, or not at all." +msgstr "" + +#: inc/theme-options.php:96 +msgid "" +"Remember to click \"Save Changes\" to save any changes you have made to the " +"theme options." +msgstr "" + +#: inc/theme-options.php:97 +msgid "For more information:" +msgstr "" + +#: inc/theme-options.php:98 +msgid "" +"Documentation on Theme Options" +msgstr "" + +#: inc/theme-options.php:99 +msgid "" +"Support Forums" +msgstr "" + +#: inc/theme-options.php:114 +msgid "Light" +msgstr "" + +#: inc/theme-options.php:120 +msgid "Dark" +msgstr "" + +#: inc/theme-options.php:138 +msgid "Content on left" +msgstr "" + +#: inc/theme-options.php:143 +msgid "Content on right" +msgstr "" + +#: inc/theme-options.php:148 +msgid "One-column, no sidebar" +msgstr "" + +#: inc/theme-options.php:213 +msgid "%s Theme Options" +msgstr "" + +#: inc/theme-options.php:225 inc/theme-options.php:227 +#: inc/theme-options.php:263 +msgid "Color Scheme" +msgstr "" + +#: inc/theme-options.php:248 inc/theme-options.php:250 +msgid "Link Color" +msgstr "" + +#: inc/theme-options.php:253 +msgid "Select a Color" +msgstr "" + +#: inc/theme-options.php:256 +msgid "Default color: %s" +msgstr "" + +#: inc/theme-options.php:261 +msgid "Default Layout" +msgstr "" + +#: inc/widgets.php:19 +msgid "" +"Use this widget to list your recent Aside, Status, Quote, and Link posts" +msgstr "" + +#: inc/widgets.php:20 +msgid "Twenty Eleven Ephemera" +msgstr "" + +#: inc/widgets.php:52 +msgid "Ephemera" +msgstr "" + +#: inc/widgets.php:93 inc/widgets.php:109 +msgid "0 comments →" +msgstr "" + +#: inc/widgets.php:93 inc/widgets.php:109 +msgid "1 comment →" +msgstr "" + +#: inc/widgets.php:93 inc/widgets.php:109 +msgid "% comments →" +msgstr "" + +#: inc/widgets.php:107 +msgid "Link to %s" +msgstr "" + +#: inc/widgets.php:159 +msgid "Title:" +msgstr "" + +#: inc/widgets.php:162 +msgid "Number of posts to show:" +msgstr "" + +#: search.php:18 +msgid "Search Results for: %s" +msgstr "" + +#: search.php:46 +msgid "" +"Sorry, but nothing matched your search criteria. Please try again with some " +"different keywords." +msgstr "" + +#: archive.php:25 +msgid "Daily Archives: %s" +msgstr "" + +#: archive.php:27 +msgid "Monthly Archives: %s" +msgstr "" + +#: archive.php:29 +msgid "Yearly Archives: %s" +msgstr "" + +#: archive.php:31 +msgid "Blog Archives" +msgstr "" + +#: content-link.php:17 +msgid "Link" +msgstr "" + +#: content-featured.php:31 +msgid "" +"This entry was posted in %1$s and tagged %2$s. Bookmark the permalink." +msgstr "" + +#: content-featured.php:33 +msgid "" +"This entry was posted in %1$s. Bookmark the permalink." +msgstr "" + +#: single.php:19 +msgid " Previous" +msgstr "" + +#: single.php:20 +msgid "Next " +msgstr "" + +#: searchform.php:11 searchform.php:12 searchform.php:13 +msgid "Search" +msgstr "" + +#. Theme Name of the plugin/theme +msgid "Twenty Eleven" +msgstr "" + +#. Theme URI of the plugin/theme +msgid "http://wordpress.org/extend/themes/twentyeleven" +msgstr "" + +#. Description of the plugin/theme +msgid "" +"The 2011 theme for WordPress is sophisticated, lightweight, and adaptable. " +"Make it yours with a custom menu, header image, and background -- then go " +"further with available theme options for light or dark color scheme, custom " +"link colors, and three layout choices. Twenty Eleven comes equipped with a " +"Showcase page template that transforms your front page into a showcase to " +"show off your best content, widget support galore (sidebar, three footer " +"areas, and a Showcase page widget area), and a custom \"Ephemera\" widget to " +"display your Aside, Link, Quote, or Status posts. Included are styles for " +"print and for the admin editor, support for featured images (as custom " +"header images on posts and pages and as large images on featured \"sticky\" " +"posts), and special styles for six different post formats." +msgstr "" + +#. Author of the plugin/theme +msgid "the WordPress team" +msgstr "" + +#. Tags of the plugin/theme +msgid "" +"dark, light, white, black, gray, one-column, two-columns, left-sidebar, " +"right-sidebar, fixed-width, flexible-width, custom-background, custom-" +"colors, custom-header, custom-menu, editor-style, featured-image-header, " +"featured-images, full-width-template, microformats, post-formats, rtl-" +"language-support, sticky-post, theme-options, translation-ready" +msgstr "" diff --git a/src/wp-content/themes/twentyeleven/license.txt b/src/wp-content/themes/twentyeleven/license.txt new file mode 100644 index 0000000..5fbe4a7 --- /dev/null +++ b/src/wp-content/themes/twentyeleven/license.txt @@ -0,0 +1,281 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 51 Franklin St, Fifth Floor, Boston, MA 02110, 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 + diff --git a/src/wp-content/themes/twentyeleven/page.php b/src/wp-content/themes/twentyeleven/page.php new file mode 100644 index 0000000..3b96e52 --- /dev/null +++ b/src/wp-content/themes/twentyeleven/page.php @@ -0,0 +1,29 @@ + + +
              +
              + + + + + + + +
              +
              + + \ No newline at end of file diff --git a/src/wp-content/themes/twentyeleven/readme.txt b/src/wp-content/themes/twentyeleven/readme.txt new file mode 100644 index 0000000..e803014 --- /dev/null +++ b/src/wp-content/themes/twentyeleven/readme.txt @@ -0,0 +1,5 @@ += TWENTY ELEVEN = + +* by the WordPress team, http://wordpress.org/ + +== ABOUT TWENTY ELEVEN == \ No newline at end of file diff --git a/src/wp-content/themes/twentyeleven/rtl.css b/src/wp-content/themes/twentyeleven/rtl.css new file mode 100644 index 0000000..7b67e1f --- /dev/null +++ b/src/wp-content/themes/twentyeleven/rtl.css @@ -0,0 +1,582 @@ +/* +Theme Name: Twenty Eleven + +Adding support for language written in a Right To Left (RTL) direction is easy - +it's just a matter of overwriting all the horizontal positioning attributes +of your CSS stylesheet in a separate stylesheet file named rtl.css. + +http://codex.wordpress.org/Right_to_Left_Language_Support + +*/ + +/* =Reset reset +----------------------------------------------- */ + +caption, th, td { + text-align: right; +} + +/* =Structure +----------------------------------------------- */ + +body { + direction:rtl; + unicode-bidi:embed; +} + +/* Showcase */ +.page-template-showcase-php section.recent-posts { + float: left; + margin: 0 31% 0 0; +} +.page-template-showcase-php #main .widget-area { + float: right; + margin: 0 0 0 -22.15%; +} + +/* One column */ + +.one-column article.feature-image.small .entry-summary a { + left: auto; + right: -9%; +} + +/* Simplify the pullquotes and pull styles */ +.one-column.singular .entry-meta .edit-link a { + right: 0px; + left: auto; +} +/* Make sure we have room for our comment avatars */ +.one-column .commentlist > li.comment { + margin-left: 0; + margin-right: 102px; +} +/* Make sure the logo and search form don't collide */ +.one-column #branding #searchform { + right: auto; + left: 40px; +} +/* Talking avatars take up too much room at this size */ +.one-column .commentlist > li.comment { + margin-right: 0; +} +.one-column .commentlist > li.comment .comment-meta, +.one-column .commentlist > li.comment .comment-content { + margin-right: 0; + margin-left: 85px; +} +.one-column .commentlist .avatar { + right: auto; + left: 1.625em; +} +.one-column .commentlist .children .avatar { + left: auto; + right: 2.2em; +} + +/* =Global +----------------------------------------------- */ + +/* Text elements */ +p { + margin-bottom: 1.625em; +} +ul, ol { + margin: 0 2.5em 1.625em 0; +} +.ltr ul, ol { + margin: 0 0 1.625em 2.5em; +} +blockquote { + font-family: Arial, sans-serif; +} +blockquote em, blockquote i, blockquote cite { + font-style: normal; +} + +/* Forms */ +textarea { + padding-left: 0; + padding-right: 3px; +} +input#s { + background-position: 97% 6px; + padding: 4px 28px 4px 10px; +} + +/* Assistive text */ +#access a.assistive-text:active, +#access a.assistive-text:focus { + left: auto; + right: 7.6%; +} + +/* =Header +----------------------------------------------- */ + +#site-title { + margin-right: 0; + margin-left: 270px; +} + +#site-description { + margin: 0 0 3.65625em 270px; +} + +/* =Menu +-------------------------------------------------------------- */ + +#access { + float: right; +} +#access ul { + margin: 0 -0.8125em 0 0; + padding-right: 0; +} +#access li { + float: right; +} +#access ul ul { + float: right; + left: auto; + right: 0; +} +#access ul ul ul { + left: auto; + right: 100%; +} + +/* Search Form */ +#branding #searchform { + right: auto; + left: 7.6%; + text-align: left; +} +#branding #s { + float: left; +} +#branding .only-search + #access div { + padding-right: 0; + padding-left: 205px; +} + + +/* =Content +----------------------------------------------- */ +.entry-title, +.entry-header .entry-meta { + padding-right: 0; + padding-left: 76px; +} +.entry-content td, +.comment-content td { + padding: 6px 0 6px 10px; +} +.page-link span { + margin-right: 0; + margin-left: 6px; +} +.entry-meta .edit-link a { + float: left; +} +/* Images */ + +.wp-caption .wp-caption-text, +.gallery-caption { + font-family: Arial, sans-serif; +} +.wp-caption .wp-caption-text { + padding: 10px 40px 5px 0px; +} +.wp-caption .wp-caption-text:before { + margin-right: 0; + margin-left: 5px; + left: auto; + right: 10px; +} +#content .gallery-columns-4 .gallery-item { + padding-right:0; + padding-left:2%; +} + +/* Author Info */ +.singular #author-info { + margin: 2.2em -35.4% 0 -35.6%; +} +#author-avatar { + float: right; + margin-right: 0; + margin-left: -78px; +} +#author-description { + float: right; + margin-left: 0; + margin-right: 108px; +} +/* Comments link */ +.entry-header .comments-link a { + background-image: url(images/comment-bubble-rtl.png); + right: auto; + left: 0; +} + +/* + Post Formats Headings +*/ +.singular .entry-title, +.singular .entry-header .entry-meta { + padding-left: 0; +} +.singular .entry-header .entry-meta { + left: auto; + right: 0; +} +.singular .entry-meta .edit-link a { + left: auto; + right: 50px; +} + + +/* =Gallery +----------------------------------------------- */ + +.format-gallery .gallery-thumb { + float: right; + margin: .375em 0 0 1.625em; +} + + +/* =Status +----------------------------------------------- */ + +.format-status img.avatar { + float: right; + margin: 4px 0 2px 10px; +} + + +/* =Image +----------------------------------------------- */ + +.indexed.format-image div.entry-meta { + float: right; +} +/* =error404 +---------------------- +------------------------- */ +.error404 #main .widget { + float: right; + margin-right: auto; + margin-left: 3.7%; +} +.error404 #main .widget_archive { + margin-left: 0; +} +.error404 #main .widget_tag_cloud { + margin-left: 0; +} + +/* =Showcase +----------------------------------------------- */ + +article.intro .edit-link a { + right: auto; + left: 20px; +} + +/* Featured post */ +section.featured-post { + float: right; +} + +/* Small featured post */ +section.featured-post .attachment-small-feature { + float: left; + margin: 0 0 1.625em -8.9%; + right: auto; + left: -15px; +} +article.feature-image.small { + float: right; +} +article.feature-image.small .entry-summary p a { + left:auto; + right: -23.8%; + padding: 9px 85px 9px 26px; +} + +/* Large featured post */ +section.feature-image.large .hentry { + left:auto; + right: 9%; + margin: 1.625em 0 0 9%; +} +/* Featured Slider */ +.featured-posts .showcase-heading { + padding-left: 0; + padding-right: 8.9%; +} +.featured-posts section.featured-post { + left: auto; + right: 0; +} +#content .feature-slider { + right: auto; + left: 8.9%; +} +.feature-slider li { + float: right; +} +/* Recent Posts */ +section.recent-posts .other-recent-posts a[rel="bookmark"] { + float: right; +} +section.recent-posts .other-recent-posts .comments-link a, +section.recent-posts .other-recent-posts .comments-link > span { + padding: 0.3125em 1em 0.3125em 0; + left: 0; + text-align: left; +} + +/* =Attachments +----------------------------------------------- */ + +/* =Navigation +-------------------------------------------------------------- */ + +.nav-previous { + float: right; +} +.nav-next { + float: left; + text-align: left; +} + +/* Singular navigation */ +#nav-single { + float: left; + text-align: left; +} +#nav-single .nav-next { + padding-left: 0; + padding-right: .5em; +} + + +/* =Widgets +----------------------------------------------- */ + +.widget ul ul { + margin-left: 0; + margin-right: 1.5em; +} + +/* Twitter */ +.widget_twitter .timesince { + margin-right: 0; + margin-left: -10px; + text-align: left; +} + +/* =Comments +----------------------------------------------- */ + +.commentlist .children li.comment { + border-left: none; + border-right: 1px solid #ddd; + -moz-border-radius: 3px 0 0 3px; + border-radius: 3px 0 0 3px; +} +.commentlist .children li.comment .comment-meta { + margin-left: 0; + margin-right: 50px; +} +.commentlist .avatar { + left: auto; + right: -102px; +} +.commentlist > li:before { + content: url(images/comment-arrow-rtl.png); + left:auto; + right: -21px; +} +.commentlist > li.pingback:before { + content: ''; +} +.commentlist .children .avatar { + left: auto; + right: 2.2em; +} + +/* Post author highlighting */ +.commentlist > li.bypostauthor:before { + content: url(images/comment-arrow-bypostauthor-rtl.png); +} + +/* sidebar-page.php comments */ +/* Make sure we have room for our comment avatars */ +.page-template-sidebar-page-php .commentlist > li.comment, +.page-template-sidebar-page-php.commentlist .pingback { + margin-left: 0; + margin-right: 102px; +} + +/* Comment Form */ +#respond .comment-form-author label, +#respond .comment-form-email label, +#respond .comment-form-url label, +#respond .comment-form-comment label { + left: auto; + right: 4px; +} +#respond .comment-form-author label, +#respond .comment-form-email label, +#respond .comment-form-url label, +#respond .comment-form-comment label { + -webkit-box-shadow: -1px 2px 2px rgba(204,204,204,0.8); + -moz-box-shadow: -1px 2px 2px rgba(204,204,204,0.8); + box-shadow: -1px 2px 2px rgba(204,204,204,0.8); +} +#respond .comment-form-author .required, +#respond .comment-form-email .required { + left: auto; + right: 75%; +} +#respond .form-submit { + float: left; +} +#respond input#submit { + left: auto; + right: 30px; + padding: 5px 22px 5px 42px; +} +#respond #cancel-comment-reply-link { + margin-left: 0; + margin-right: 10px; +} +#cancel-comment-reply-link { + right: auto; + left: 1.625em; +} + +/* =Footer +----------------------------------------------- */ + +/* Two Footer Widget Areas */ +#supplementary.two .widget-area { + float: right; + margin-right: 0; + margin-left: 3.7%; +} +#supplementary.two .widget-area + .widget-area { + margin-left: 0; +} + +/* Three Footer Widget Areas */ +#supplementary.three .widget-area { + float: right; + margin-right: 0; + margin-left: 3.7%; +} +#supplementary.three .widget-area + .widget-area + .widget-area { + margin-left: 0; +} + +/* Site Generator Line */ +#site-generator .sep { + background-position: right center; +} + + +/* =Responsive Structure +----------------------------------------------- */ + +@media (max-width: 800px) { + /* Simplify the showcase template when small feature */ + section.featured-post .attachment-small-feature, + .one-column section.featured-post .attachment-small-feature { + float: right; + } + article.feature-image.small { + float: left; + } + article.feature-image.small .entry-summary p a { + right: 0; + } + .singular .entry-meta .edit-link a { + left: auto; + right: 0px; + } + /* Make sure we have room for our comment avatars */ + .commentlist > li.comment, + .commentlist .pingback { + margin-left: 0; + margin-right: 102px; + } + /* No need to float footer widgets at this size */ + #colophon #supplementary .widget-area { + margin-left: 0; + } + /* No need to float 404 widgets at this size */ + .error404 #main .widget { + margin-left: 0; + } +} +@media (max-width: 650px) { + /* @media (max-width: 650px) Reduce font-sizes for better readability on smaller devices */ + #site-title, + #site-description { + margin-left: 0; + } + /* Talking avatars take up too much room at this size */ + .commentlist > li.comment, + .commentlist > li.pingback { + margin-right: 0 !important; + } + .commentlist .children .avatar { + left: auto; + right: 2.2em; + } + /* Use the available space in the smaller comment form */ + #respond .comment-form-author .required, + #respond .comment-form-email .required { + left: auto; + right: 95%; + } + #content .gallery-columns-3 .gallery-item { + padding-right: 0; + padding-left:2%; + } +} +@media (max-width: 450px) { + #content .gallery-columns-2 .gallery-item { + padding-right:0; + padding-left:4%; + } +} + +/* =Print +----------------------------------------------- */ + +@media print { + #primary { + float: right; + } + /* Comments */ + .commentlist .avatar { + left: auto; + right: 2.2em; + } + .commentlist li.comment .comment-meta { + margin-left: 0; + margin-right: 50px; + } +} + +/* =IE7 +----------------------------------------------- */ + +#ie7 section.recent-posts { + margin-right: 0; + margin-left: 7.6%; +} diff --git a/src/wp-content/themes/twentyeleven/screenshot.png b/src/wp-content/themes/twentyeleven/screenshot.png new file mode 100644 index 0000000..b1fb07f Binary files /dev/null and b/src/wp-content/themes/twentyeleven/screenshot.png differ diff --git a/src/wp-content/themes/twentyeleven/search.php b/src/wp-content/themes/twentyeleven/search.php new file mode 100644 index 0000000..bf45c2f --- /dev/null +++ b/src/wp-content/themes/twentyeleven/search.php @@ -0,0 +1,57 @@ + + +
              +
              + + + + + + + + + + + + + + + + + + +
              +
              +

              +
              + +
              +

              + +
              +
              + + + +
              +
              + + + \ No newline at end of file diff --git a/src/wp-content/themes/twentyeleven/searchform.php b/src/wp-content/themes/twentyeleven/searchform.php new file mode 100644 index 0000000..b83ec1e --- /dev/null +++ b/src/wp-content/themes/twentyeleven/searchform.php @@ -0,0 +1,14 @@ + +
              + + + +
              diff --git a/src/wp-content/themes/twentyeleven/showcase.php b/src/wp-content/themes/twentyeleven/showcase.php new file mode 100644 index 0000000..58e85e2 --- /dev/null +++ b/src/wp-content/themes/twentyeleven/showcase.php @@ -0,0 +1,220 @@ + + +
              +
              + + + + + + $sticky, + 'post_status' => 'publish', + 'posts_per_page' => 10, + 'no_found_rows' => true, + ); + + // The Featured Posts query. + $featured = new WP_Query( $featured_args ); + + // Proceed only if published posts exist + if ( $featured->have_posts() ) : + + /** + * We will need to count featured posts starting from zero + * to create the slider navigation. + */ + $counter_slider = 0; + + ?> + + + + + +
              +

              + + 'DESC', + 'post__not_in' => get_option( 'sticky_posts' ), + 'tax_query' => array( + array( + 'taxonomy' => 'post_format', + 'terms' => array( 'post-format-aside', 'post-format-link', 'post-format-quote', 'post-format-status' ), + 'field' => 'slug', + 'operator' => 'NOT IN', + ), + ), + 'no_found_rows' => true, + ); + + // Our new query for the Recent Posts section. + $recent = new WP_Query( $recent_args ); + + // The first Recent post is displayed normally + if ( $recent->have_posts() ) : $recent->the_post(); + + // Set $more to 0 in order to only get the first part of the post. + global $more; + $more = 0; + + get_template_part( 'content', get_post_format() ); + + echo '
                '; + + endif; + + // For all other recent posts, just display the title and comment status. + while ( $recent->have_posts() ) : $recent->the_post(); ?> + +
              1. + + + ' . __( 'Leave a reply', 'twentyeleven' ) . '', __( '1 Reply', 'twentyeleven' ), __( '% Replies', 'twentyeleven' ) ); ?> + +
              2. + + + if ( $recent->post_count > 0 ) + echo '
              '; + ?> +
              + + + +
              +
              + + \ No newline at end of file diff --git a/src/wp-content/themes/twentyeleven/sidebar-footer.php b/src/wp-content/themes/twentyeleven/sidebar-footer.php new file mode 100644 index 0000000..cbcb49b --- /dev/null +++ b/src/wp-content/themes/twentyeleven/sidebar-footer.php @@ -0,0 +1,42 @@ + + + +
              > + + + + + + + + + + + +
              \ No newline at end of file diff --git a/src/wp-content/themes/twentyeleven/sidebar-page.php b/src/wp-content/themes/twentyeleven/sidebar-page.php new file mode 100644 index 0000000..d47e4ee --- /dev/null +++ b/src/wp-content/themes/twentyeleven/sidebar-page.php @@ -0,0 +1,26 @@ + + +
              +
              + + + + + + + +
              +
              + + + \ No newline at end of file diff --git a/src/wp-content/themes/twentyeleven/sidebar.php b/src/wp-content/themes/twentyeleven/sidebar.php new file mode 100644 index 0000000..0f08571 --- /dev/null +++ b/src/wp-content/themes/twentyeleven/sidebar.php @@ -0,0 +1,36 @@ + + + \ No newline at end of file diff --git a/src/wp-content/themes/twentyeleven/single.php b/src/wp-content/themes/twentyeleven/single.php new file mode 100644 index 0000000..01ab460 --- /dev/null +++ b/src/wp-content/themes/twentyeleven/single.php @@ -0,0 +1,32 @@ + + +
              +
              + + + + + + + + + + + +
              +
              + + \ No newline at end of file diff --git a/src/wp-content/themes/twentyeleven/style.css b/src/wp-content/themes/twentyeleven/style.css new file mode 100644 index 0000000..68254b5 --- /dev/null +++ b/src/wp-content/themes/twentyeleven/style.css @@ -0,0 +1,2670 @@ +/* +Theme Name: Twenty Eleven +Theme URI: http://wordpress.org/extend/themes/twentyeleven +Author: the WordPress team +Author URI: http://wordpress.org/ +Description: The 2011 theme for WordPress is sophisticated, lightweight, and adaptable. Make it yours with a custom menu, header image, and background -- then go further with available theme options for light or dark color scheme, custom link colors, and three layout choices. Twenty Eleven comes equipped with a Showcase page template that transforms your front page into a showcase to show off your best content, widget support galore (sidebar, three footer areas, and a Showcase page widget area), and a custom "Ephemera" widget to display your Aside, Link, Quote, or Status posts. Included are styles for print and for the admin editor, support for featured images (as custom header images on posts and pages and as large images on featured "sticky" posts), and special styles for six different post formats. +Version: 1.2 +License: GNU General Public License +License URI: license.txt +Tags: dark, light, white, black, gray, one-column, two-columns, left-sidebar, right-sidebar, fixed-width, flexible-width, custom-background, custom-colors, custom-header, custom-menu, editor-style, featured-image-header, featured-images, full-width-template, microformats, post-formats, rtl-language-support, sticky-post, theme-options, translation-ready +*/ + +/* =Reset default browser CSS. Based on work by Eric Meyer: http://meyerweb.com/eric/tools/css/reset/index.html +-------------------------------------------------------------- */ + +html, body, div, span, applet, object, iframe, +h1, h2, h3, h4, h5, h6, p, blockquote, pre, +a, abbr, acronym, address, big, cite, code, +del, dfn, em, font, ins, kbd, q, s, samp, +small, strike, strong, sub, sup, tt, var, +dl, dt, dd, ol, ul, li, +fieldset, form, label, legend, +table, caption, tbody, tfoot, thead, tr, th, td { + border: 0; + font-family: inherit; + font-size: 100%; + font-style: inherit; + font-weight: inherit; + margin: 0; + outline: 0; + padding: 0; + vertical-align: baseline; +} +:focus {/* remember to define focus styles! */ + outline: 0; +} +body { + background: #fff; + line-height: 1; +} +ol, ul { + list-style: none; +} +table {/* tables still need 'cellspacing="0"' in the markup */ + border-collapse: separate; + border-spacing: 0; +} +caption, th, td { + font-weight: normal; + text-align: left; +} +blockquote:before, blockquote:after, +q:before, q:after { + content: ""; +} +blockquote, q { + quotes: "" ""; +} +a img { + border: 0; +} +article, aside, details, figcaption, figure, +footer, header, hgroup, menu, nav, section { + display: block; +} + + +/* =Structure +----------------------------------------------- */ + +body { + padding: 0 2em; +} +#page { + margin: 2em auto; + max-width: 1000px; +} +#branding hgroup { + margin: 0 7.6%; +} +#access div { + margin: 0 7.6%; +} +#primary { + float: left; + margin: 0 -26.4% 0 0; + width: 100%; +} +#content { + margin: 0 34% 0 7.6%; + width: 58.4%; +} +#secondary { + float: right; + margin-right: 7.6%; + width: 18.8%; +} + +/* Singular */ +.singular #primary { + margin: 0; +} +.singular #content, +.left-sidebar.singular #content { + margin: 0 7.6%; + position: relative; + width: auto; +} +.singular .entry-header, +.singular .entry-content, +.singular footer.entry-meta, +.singular #comments-title { + margin: 0 auto; + width: 68.9%; +} + +/* Attachments */ +.singular .image-attachment .entry-content { + margin: 0 auto; + width: auto; +} +.singular .image-attachment .entry-description { + margin: 0 auto; + width: 68.9%; +} + +/* Showcase */ +.page-template-showcase-php #primary, +.left-sidebar.page-template-showcase-php #primary { + margin: 0; +} +.page-template-showcase-php #content, +.left-sidebar.page-template-showcase-php #content { + margin: 0 7.6%; + width: auto; +} +.page-template-showcase-php section.recent-posts { + float: right; + margin: 0 0 0 31%; + width: 69%; +} +.page-template-showcase-php #main .widget-area { + float: left; + margin: 0 -22.15% 0 0; + width: 22.15%; +} + +/* error404 */ +.error404 #primary { + float: none; + margin: 0; +} +.error404 #primary #content { + margin: 0 7.6%; + width: auto; +} + +/* Alignment */ +.alignleft { + display: inline; + float: left; + margin-right: 1.625em; +} +.alignright { + display: inline; + float: right; + margin-left: 1.625em; +} +.aligncenter { + clear: both; + display: block; + margin-left: auto; + margin-right: auto; +} + +/* Right Content */ +.left-sidebar #primary { + float: right; + margin: 0 0 0 -26.4%; + width: 100%; +} +.left-sidebar #content { + margin: 0 7.6% 0 34%; + width: 58.4%; +} +.left-sidebar #secondary { + float: left; + margin-left: 7.6%; + margin-right: 0; + width: 18.8%; +} + +/* One column */ +.one-column #page { + max-width: 690px; +} +.one-column #content { + margin: 0 7.6%; + width: auto; +} +.one-column #nav-below { + border-bottom: 1px solid #ddd; + margin-bottom: 1.625em; +} +.one-column #secondary { + float: none; + margin: 0 7.6%; + width: auto; +} +/* Simplify the showcase template */ +.one-column .page-template-showcase-php section.recent-posts { + float: none; + margin: 0; + width: 100%; +} +.one-column .page-template-showcase-php #main .widget-area { + float: none; + margin: 0; + width: auto; +} +.one-column .page-template-showcase-php .other-recent-posts { + border-bottom: 1px solid #ddd; +} +/* Simplify the showcase template when small feature */ +.one-column section.featured-post .attachment-small-feature { + border: none; + display: block; + height: auto; + max-width: 60%; + position: static; +} +.one-column article.feature-image.small { + margin: 0 0 1.625em; + padding: 0; +} +.one-column article.feature-image.small .entry-title { + font-size: 20px; + line-height: 1.3em; +} +.one-column article.feature-image.small .entry-summary { + height: 150px; + overflow: hidden; + padding: 0; + text-overflow: ellipsis; +} +.one-column article.feature-image.small .entry-summary a { + left: -9%; +} +/* Remove the margin on singular articles */ +.one-column.singular .entry-header, +.one-column.singular .entry-content, +.one-column.singular footer.entry-meta, +.one-column.singular #comments-title { + width: 100%; +} +/* Simplify the pullquotes and pull styles */ +.one-column.singular blockquote.pull { + margin: 0 0 1.625em; +} +.one-column.singular .pull.alignleft { + margin: 0 1.625em 0 0; +} +.one-column.singular .pull.alignright { + margin: 0 0 0 1.625em; +} +.one-column.singular .entry-meta .edit-link a { + position: absolute; + left: 0; + top: 40px; +} +.one-column.singular #author-info { + margin: 2.2em -8.8% 0; + padding: 20px 8.8%; +} +/* Make sure we have room for our comment avatars */ +.one-column .commentlist > li.comment { + margin-left: 102px; + width: auto; +} +/* Make sure the logo and search form don't collide */ +.one-column #branding #searchform { + right: 40px; + top: 4em; +} +/* Talking avatars take up too much room at this size */ +.one-column .commentlist > li.comment { + margin-left: 0; +} +.one-column .commentlist > li.comment .comment-meta, +.one-column .commentlist > li.comment .comment-content { + margin-right: 85px; +} +.one-column .commentlist .avatar { + background: transparent; + display: block; + padding: 0; + top: 1.625em; + left: auto; + right: 1.625em; +} +.one-column .commentlist .children .avatar { + background: none; + padding: 0; + position: absolute; + top: 2.2em; + left: 2.2em; +} +.one-column #respond { + width: auto; +} + + +/* =Global +----------------------------------------------- */ + +body, input, textarea { + color: #373737; + font: 15px "Helvetica Neue", Helvetica, Arial, sans-serif; + font-weight: 300; + line-height: 1.625; +} +body { + background: #e2e2e2; +} +#page { + background: #fff; +} + +/* Headings */ +h1,h2,h3,h4,h5,h6 { + clear: both; +} +hr { + background-color: #ccc; + border: 0; + height: 1px; + margin-bottom: 1.625em; +} + +/* Text elements */ +p { + margin-bottom: 1.625em; +} +ul, ol { + margin: 0 0 1.625em 2.5em; +} +ul { + list-style: square; +} +ol { + list-style-type: decimal; +} +ol ol { + list-style: upper-alpha; +} +ol ol ol { + list-style: lower-roman; +} +ol ol ol ol { + list-style: lower-alpha; +} +ul ul, ol ol, ul ol, ol ul { + margin-bottom: 0; +} +dl { + margin: 0 1.625em; +} +dt { + font-weight: bold; +} +dd { + margin-bottom: 1.625em; +} +strong { + font-weight: bold; +} +cite, em, i { + font-style: italic; +} +blockquote { + font-family: Georgia, "Bitstream Charter", serif; + font-style: italic; + font-weight: normal; + margin: 0 3em; +} +blockquote em, blockquote i, blockquote cite { + font-style: normal; +} +blockquote cite { + color: #666; + font: 12px "Helvetica Neue", Helvetica, Arial, sans-serif; + font-weight: 300; + letter-spacing: 0.05em; + text-transform: uppercase; +} +pre { + background: #f4f4f4; + font: 13px "Courier 10 Pitch", Courier, monospace; + line-height: 1.5; + margin-bottom: 1.625em; + overflow: auto; + padding: 0.75em 1.625em; +} +code, kbd { + font: 13px Monaco, Consolas, "Andale Mono", "DejaVu Sans Mono", monospace; +} +abbr, acronym, dfn { + border-bottom: 1px dotted #666; + cursor: help; +} +address { + display: block; + margin: 0 0 1.625em; +} +ins { + background: #fff9c0; + text-decoration: none; +} +sup, +sub { + font-size: 10px; + height: 0; + line-height: 1; + position: relative; + vertical-align: baseline; +} +sup { + bottom: 1ex; +} +sub { + top: .5ex; +} + +/* Forms */ +input[type=text], +input[type=password], +textarea { + background: #fafafa; + -moz-box-shadow: inset 0 1px 1px rgba(0,0,0,0.1); + -webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,0.1); + box-shadow: inset 0 1px 1px rgba(0,0,0,0.1); + border: 1px solid #ddd; + color: #888; +} +input[type=text]:focus, +textarea:focus { + color: #373737; +} +textarea { + padding-left: 3px; + width: 98%; +} +input[type=text] { + padding: 3px; +} +input#s { + background: url(images/search.png) no-repeat 5px 6px; + -moz-border-radius: 2px; + border-radius: 2px; + font-size: 14px; + height: 22px; + line-height: 1.2em; + padding: 4px 10px 4px 28px; +} +input#searchsubmit { + display: none; +} + +/* Links */ +a { + color: #1982d1; + text-decoration: none; +} +a:focus, +a:active, +a:hover { + text-decoration: underline; +} + +/* Assistive text */ +.assistive-text { + position: absolute !important; + clip: rect(1px 1px 1px 1px); /* IE6, IE7 */ + clip: rect(1px, 1px, 1px, 1px); +} +#access a.assistive-text:active, +#access a.assistive-text:focus { + background: #eee; + border-bottom: 1px solid #ddd; + color: #1982d1; + clip: auto !important; + font-size: 12px; + position: absolute; + text-decoration: underline; + top: 0; + left: 7.6%; +} + + +/* =Header +----------------------------------------------- */ + +#branding { + border-top: 2px solid #bbb; + padding-bottom: 10px; + position: relative; + z-index: 2; +} +#site-title { + margin-right: 270px; + padding: 3.65625em 0 0; +} +#site-title a { + color: #111; + font-size: 30px; + font-weight: bold; + line-height: 36px; + text-decoration: none; +} +#site-title a:hover, +#site-title a:focus, +#site-title a:active { + color: #1982d1; +} +#site-description { + color: #7a7a7a; + font-size: 14px; + margin: 0 270px 3.65625em 0; +} +#branding img { + height: auto; + margin-bottom: -7px; + width: 100%; +} + + +/* =Menu +-------------------------------------------------------------- */ + +#access { + background: #222; /* Show a solid color for older browsers */ + background: -moz-linear-gradient(#252525, #0a0a0a); + background: -o-linear-gradient(#252525, #0a0a0a); + background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#252525), to(#0a0a0a)); /* older webkit syntax */ + background: -webkit-linear-gradient(#252525, #0a0a0a); + -webkit-box-shadow: rgba(0, 0, 0, 0.4) 0px 1px 2px; + -moz-box-shadow: rgba(0, 0, 0, 0.4) 0px 1px 2px; + box-shadow: rgba(0, 0, 0, 0.4) 0px 1px 2px; + clear: both; + display: block; + float: left; + margin: 0 auto 6px; + width: 100%; +} +#access ul { + font-size: 13px; + list-style: none; + margin: 0 0 0 -0.8125em; + padding-left: 0; +} +#access li { + float: left; + position: relative; +} +#access a { + color: #eee; + display: block; + line-height: 3.333em; + padding: 0 1.2125em; + text-decoration: none; +} +#access ul ul { + -moz-box-shadow: 0 3px 3px rgba(0,0,0,0.2); + -webkit-box-shadow: 0 3px 3px rgba(0,0,0,0.2); + box-shadow: 0 3px 3px rgba(0,0,0,0.2); + display: none; + float: left; + margin: 0; + position: absolute; + top: 3.333em; + left: 0; + width: 188px; + z-index: 99999; +} +#access ul ul ul { + left: 100%; + top: 0; +} +#access ul ul a { + background: #f9f9f9; + border-bottom: 1px dotted #ddd; + color: #444; + font-size: 13px; + font-weight: normal; + height: auto; + line-height: 1.4em; + padding: 10px 10px; + width: 168px; +} +#access li:hover > a, +#access ul ul :hover > a, +#access a:focus { + background: #efefef; +} +#access li:hover > a, +#access a:focus { + background: #f9f9f9; /* Show a solid color for older browsers */ + background: -moz-linear-gradient(#f9f9f9, #e5e5e5); + background: -o-linear-gradient(#f9f9f9, #e5e5e5); + background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#f9f9f9), to(#e5e5e5)); /* Older webkit syntax */ + background: -webkit-linear-gradient(#f9f9f9, #e5e5e5); + color: #373737; +} +#access ul li:hover > ul { + display: block; +} +#access .current_page_item > a, +#access .current_page_ancestor > a { + font-weight: bold; +} + +/* Search Form */ +#branding #searchform { + position: absolute; + top: 3.8em; + right: 7.6%; + text-align: right; +} +#branding #searchform div { + margin: 0; +} +#branding #s { + float: right; + -webkit-transition-duration: 400ms; + -webkit-transition-property: width, background; + -webkit-transition-timing-function: ease; + -moz-transition-duration: 400ms; + -moz-transition-property: width, background; + -moz-transition-timing-function: ease; + -o-transition-duration: 400ms; + -o-transition-property: width, background; + -o-transition-timing-function: ease; + width: 72px; +} +#branding #s:focus { + background-color: #f9f9f9; + width: 196px; +} +#branding #searchsubmit { + display: none; +} +#branding .only-search #searchform { + top: 5px; + z-index: 1; +} +#branding .only-search #s { + background-color: #666; + border-color: #000; + color: #222; +} +#branding .only-search #s, +#branding .only-search #s:focus { + width: 85%; +} +#branding .only-search #s:focus { + background-color: #bbb; +} +#branding .with-image #searchform { + top: auto; + bottom: -27px; + max-width: 195px; +} +#branding .only-search + #access div { + padding-right: 205px; +} + + +/* =Content +----------------------------------------------- */ + +#main { + clear: both; + padding: 1.625em 0 0; +} +.page-title { + color: #666; + font-size: 10px; + font-weight: 500; + letter-spacing: 0.1em; + line-height: 2.6em; + margin: 0 0 2.6em; + text-transform: uppercase; +} +.page-title a { + font-size: 12px; + font-weight: bold; + letter-spacing: 0; + text-transform: none; +} +.hentry, +.no-results { + border-bottom: 1px solid #ddd; + margin: 0 0 1.625em; + padding: 0 0 1.625em; + position: relative; +} +.hentry:last-child, +.no-results { + border-bottom: none; +} +.blog .sticky .entry-header .entry-meta { + clip: rect(1px 1px 1px 1px); /* IE6, IE7 */ + clip: rect(1px, 1px, 1px, 1px); + position: absolute !important; +} +.entry-title, +.entry-header .entry-meta { + padding-right: 76px; +} +.entry-title { + clear: both; + color: #222; + font-size: 26px; + font-weight: bold; + line-height: 1.5em; + padding-bottom: .3em; + padding-top: 15px; +} +.entry-title, +.entry-title a { + color: #222; + text-decoration: none; +} +.entry-title a:hover, +.entry-title a:focus, +.entry-title a:active { + color: #1982d1; +} +.entry-meta { + color: #666; + clear: both; + font-size: 12px; + line-height: 18px; +} +.entry-meta a { + font-weight: bold; +} +.single-author .entry-meta .by-author { + display: none; +} +.entry-content, +.entry-summary { + padding: 1.625em 0 0; +} +.entry-content h1, +.entry-content h2, +.comment-content h1, +.comment-content h2 { + color: #000; + font-weight: bold; + margin: 0 0 .8125em; +} +.entry-content h3, +.comment-content h3 { + font-size: 10px; + letter-spacing: 0.1em; + line-height: 2.6em; + text-transform: uppercase; +} +.entry-content table, +.comment-content table { + border-bottom: 1px solid #ddd; + margin: 0 0 1.625em; + width: 100%; +} +.entry-content th, +.comment-content th { + color: #666; + font-size: 10px; + font-weight: 500; + letter-spacing: 0.1em; + line-height: 2.6em; + text-transform: uppercase; +} +.entry-content td, +.comment-content td { + border-top: 1px solid #ddd; + padding: 6px 10px 6px 0; +} +.entry-content #s { + width: 75%; +} +.comment-content ul, +.comment-content ol { + margin-bottom: 1.625em; +} +.comment-content ul ul, +.comment-content ol ol, +.comment-content ul ol, +.comment-content ol ul { + margin-bottom: 0; +} +dl.gallery-item { + margin: 0; +} +.page-link { + clear: both; + display: block; + margin: 0 0 1.625em; +} +.page-link a { + background: #eee; + color: #373737; + margin: 0; + padding: 2px 3px; + text-decoration: none; +} +.page-link a:hover { + background: #888; + color: #fff; + font-weight: bold; +} +.page-link span { + margin-right: 6px; +} +.entry-meta .edit-link a, +.commentlist .edit-link a { + background: #eee; + -moz-border-radius: 3px; + border-radius: 3px; + color: #666; + float: right; + font-size: 12px; + line-height: 1.5em; + font-weight: 300; + text-decoration: none; + padding: 0 8px; +} +.entry-meta .edit-link a:hover, +.commentlist .edit-link a:hover { + background: #888; + color: #fff; +} +.entry-content .edit-link { + clear: both; + display: block; +} + +/* Images */ +.entry-content img, +.comment-content img, +.widget img { + max-width: 97.5%; /* Fluid images for posts, comments, and widgets */ +} +img[class*="align"], +img[class*="wp-image-"] { + height: auto; /* Make sure images with WordPress-added height and width attributes are scaled correctly */ +} +img.size-full { + max-width: 97.5%; + width: auto; /* Prevent stretching of full-size images with height and width attributes in IE8 */ +} +.entry-content img.wp-smiley { + border: none; + margin-bottom: 0; + margin-top: 0; + padding: 0; +} +img.alignleft, +img.alignright, +img.aligncenter { + margin-bottom: 1.625em; +} +p img, +.wp-caption { + margin-top: 0.4em; +} +.wp-caption { + background: #eee; + margin-bottom: 1.625em; + max-width: 96%; + padding: 9px; +} +.wp-caption img { + display: block; + margin: 0 auto; + max-width: 98%; +} +.wp-caption .wp-caption-text, +.gallery-caption { + color: #666; + font-family: Georgia, serif; + font-size: 12px; +} +.wp-caption .wp-caption-text { + margin-bottom: 0.6em; + padding: 10px 0 5px 40px; + position: relative; +} +.wp-caption .wp-caption-text:before { + color: #666; + content: '\2014'; + font-size: 14px; + font-style: normal; + font-weight: bold; + margin-right: 5px; + position: absolute; + left: 10px; + top: 7px; +} +#content .gallery { + margin: 0 auto 1.625em; +} +#content .gallery a img { + border: none; +} +img#wpstats { + display: block; + margin: 0 auto 1.625em; +} +#content .gallery-columns-4 .gallery-item { + width: 23%; + padding-right: 2%; +} +#content .gallery-columns-4 .gallery-item img { + width: 100%; + height: auto; +} + +/* Image borders */ +img[class*="align"], +img[class*="wp-image-"], +#content .gallery .gallery-icon img {/* Add fancy borders to all WordPress-added images but not things like badges and icons and the like */ + border: 1px solid #ddd; + padding: 6px; +} +.wp-caption img { + border-color: #eee; +} +a:focus img[class*="align"], +a:hover img[class*="align"], +a:active img[class*="align"], +a:focus img[class*="wp-image-"], +a:hover img[class*="wp-image-"], +a:active img[class*="wp-image-"], +#content .gallery .gallery-icon a:focus img, +#content .gallery .gallery-icon a:hover img, +#content .gallery .gallery-icon a:active img {/* Add some useful style to those fancy borders for linked images ... */ + background: #eee; + border-color: #bbb; +} +.wp-caption a:focus img, +.wp-caption a:active img, +.wp-caption a:hover img {/* ... including captioned images! */ + background: #fff; + border-color: #ddd; +} + +/* Password Protected Posts */ +.post-password-required .entry-header .comments-link { + margin: 1.625em 0 0; +} +.post-password-required input[type=password] { + margin: 0.8125em 0; +} +.post-password-required input[type=password]:focus { + background: #f7f7f7; +} + +/* Author Info */ +#author-info { + font-size: 12px; + overflow: hidden; +} +.singular #author-info { + background: #f9f9f9; + border-top: 1px solid #ddd; + border-bottom: 1px solid #ddd; + margin: 2.2em -35.6% 0 -35.4%; + padding: 20px 35.4%; +} +.archive #author-info { + border-bottom: 1px solid #ddd; + margin: 0 0 2.2em; + padding: 0 0 2.2em; +} +#author-avatar { + float: left; + margin-right: -78px; +} +#author-avatar img { + background: #fff; + -moz-border-radius: 3px; + border-radius: 3px; + -webkit-box-shadow: 0 1px 2px #bbb; + -moz-box-shadow: 0 1px 2px #bbb; + box-shadow: 0 1px 2px #bbb; + padding: 3px; +} +#author-description { + float: left; + margin-left: 108px; +} +#author-description h2 { + color: #000; + font-size: 15px; + font-weight: bold; + margin: 5px 0 10px; +} + +/* Comments link */ +.entry-header .comments-link a { + background: #eee url(images/comment-bubble.png) no-repeat; + color: #666; + font-size: 13px; + font-weight: normal; + line-height: 35px; + overflow: hidden; + padding: 0 0 0; + position: absolute; + top: 1.5em; + right: 0; + text-align: center; + text-decoration: none; + width: 43px; + height: 36px; +} +.entry-header .comments-link a:hover, +.entry-header .comments-link a:focus, +.entry-header .comments-link a:active { + background-color: #1982d1; + color: #fff; + color: rgba(255,255,255,0.8); +} +.entry-header .comments-link .leave-reply { + visibility: hidden; +} + +/* +Post Formats Headings +To hide the headings, display: none the ".entry-header .entry-format" selector, +and remove the padding rules below. +*/ +.entry-header .entry-format { + color: #666; + font-size: 10px; + font-weight: 500; + letter-spacing: 0.1em; + line-height: 2.6em; + position: absolute; + text-transform: uppercase; + top: -5px; +} +.entry-header hgroup .entry-title { + padding-top: 15px; +} +article.format-aside .entry-content, +article.format-link .entry-content, +article.format-status .entry-content { + padding: 20px 0 0; +} +.recent-posts .entry-header .entry-format { + display: none; +} +.recent-posts .entry-header hgroup .entry-title { + padding-top: 0; +} + +/* Singular content styles for Posts and Pages */ +.singular .hentry { + border-bottom: none; + padding: 4.875em 0 0; + position: relative; +} +.singular.page .hentry { + padding: 3.5em 0 0; +} +.singular .entry-title { + color: #000; + font-size: 36px; + font-weight: bold; + line-height: 48px; +} +.singular .entry-title, +.singular .entry-header .entry-meta { + padding-right: 0; +} +.singular .entry-header .entry-meta { + position: absolute; + top: 0; + left: 0; +} +blockquote.pull { + font-size: 21px; + font-weight: bold; + line-height: 1.6125em; + margin: 0 0 1.625em; + text-align: center; +} +.singular blockquote.pull { + margin: 0 -22.25% 1.625em; +} +.pull.alignleft { + margin: 0 1.625em 0 0; + text-align: right; + width: 33%; +} +.singular .pull.alignleft { + margin: 0 1.625em 0 -22.25%; +} +.pull.alignright { + margin: 0 0 0 1.625em; + text-align: left; + width: 33%; +} +.singular .pull.alignright { + margin: 0 -22.25% 0 1.625em; +} +.singular blockquote.pull.alignleft, +.singular blockquote.pull.alignright { + width: 33%; +} +.singular .entry-meta .edit-link a { + bottom: auto; + left: 50px; + position: absolute; + right: auto; + top: 80px; +} + + +/* =Aside +----------------------------------------------- */ + +.format-aside .entry-title, +.format-aside .entry-header .comments-link { + display: none; +} +.singular .format-aside .entry-title { + display: block; +} +.format-aside .entry-content { + padding: 0; +} +.singular .format-aside .entry-content { + padding: 1.625em 0 0; +} + + +/* =Link +----------------------------------------------- */ + +.format-link .entry-title, +.format-link .entry-header .comments-link { + display: none; +} +.singular .format-link .entry-title { + display: block; +} +.format-link .entry-content { + padding: 0; +} +.singular .format-link .entry-content { + padding: 1.625em 0 0; +} + + +/* =Gallery +----------------------------------------------- */ + +.format-gallery .gallery-thumb { + float: left; + display: block; + margin: .375em 1.625em 0 0; +} + + +/* =Status +----------------------------------------------- */ + +.format-status .entry-title, +.format-status .entry-header .comments-link { + display: none; +} +.singular .format-status .entry-title { + display: block; +} +.format-status .entry-content { + padding: 0; +} +.singular .format-status .entry-content { + padding: 1.625em 0 0; +} +.format-status img.avatar { + -moz-border-radius: 3px; + border-radius: 3px; + -webkit-box-shadow: 0 1px 2px #ccc; + -moz-box-shadow: 0 1px 2px #ccc; + box-shadow: 0 1px 2px #ccc; + float: left; + margin: 4px 10px 2px 0; + padding: 0; +} + + +/* =Quote +----------------------------------------------- */ + +.format-quote blockquote { + color: #555; + font-size: 17px; + margin: 0; +} + + +/* =Image +----------------------------------------------- */ + +.indexed.format-image .entry-header { + min-height: 61px; /* Prevent the comment icon from colliding with the image when there is no title */ +} +.indexed.format-image .entry-content { + padding-top: 0.5em; +} +.indexed.format-image p, +.indexed.format-image p img { + margin-bottom: 0; +} +.indexed.format-image footer.entry-meta { + background: #ddd; + margin-top: -7px; + padding: 20px 30px; + overflow: hidden; +} +.indexed.format-image div.entry-meta { + display: inline-block; + float: left; + width: 35%; +} +.indexed.format-image div.entry-meta + div.entry-meta { + float: none; + width: 65%; +} +.indexed.format-image .entry-meta span.cat-links, +.indexed.format-image .entry-meta span.tag-links, +.indexed.format-image .entry-meta span.comments-link { + display: block; +} +.indexed.format-image footer.entry-meta a { + color: #444; +} +.indexed.format-image footer.entry-meta a:hover { + color: #fff; +} +#content .indexed.format-image img { + border: none; + max-width: 100%; + padding: 0; +} +.indexed.format-image .wp-caption { + background: #111; + margin-bottom: 0; + max-width: 96%; + padding: 11px; +} +.indexed.format-image .wp-caption .wp-caption-text { + color: #ddd; +} +.indexed.format-image .wp-caption .wp-caption-text:before { + color: #444; +} +.indexed.format-image a:hover img { + opacity: 0.8; +} + + +/* =error404 +----------------------------------------------- */ + +.error404 #main #searchform { + background: #f9f9f9; + border: 1px solid #ddd; + border-width: 1px 0; + margin: 0 -8.9% 1.625em; + overflow: hidden; + padding: 1.625em 8.9%; +} +.error404 #main #s { + width: 95%; +} +.error404 #main .widget { + clear: none; + float: left; + margin-right: 3.7%; + width: 30.85%; +} +.error404 #main .widget_archive { + margin-right: 0; +} +.error404 #main .widget_tag_cloud { + float: none; + margin-right: 0; + width: 100%; +} +.error404 .widgettitle { + font-size: 10px; + letter-spacing: 0.1em; + line-height: 2.6em; + text-transform: uppercase; +} + + +/* =Showcase +----------------------------------------------- */ + +h1.showcase-heading { + color: #666; + font-size: 10px; + font-weight: 500; + letter-spacing: 0.1em; + line-height: 2.6em; + text-transform: uppercase; +} + +/* Intro */ +article.intro { + background: #f9f9f9; + border-bottom: none; + margin: -1.855em -8.9% 1.625em; + padding: 0 8.9%; +} +article.intro .entry-title { + display: none; +} +article.intro .entry-content { + color: #111; + font-size: 16px; + padding: 1.625em 0 0.625em; +} +article.intro .edit-link a { + background: #aaa; + -moz-border-radius: 3px; + border-radius: 3px; + color: #fff; + font-size: 12px; + padding: 0 8px; + position: absolute; + top: 30px; + right: 20px; + text-decoration: none; +} +article.intro .edit-link a:hover, +article.intro .edit-link a:focus, +article.intro .edit-link a:active { + background: #777; +} + +/* Featured post */ +section.featured-post { + float: left; + margin: -1.625em -8.9% 1.625em; + padding: 1.625em 8.9% 0; + position: relative; + width: 100%; +} +section.featured-post .hentry { + border: none; + color: #666; + margin: 0; +} +section.featured-post .entry-meta { + clip: rect(1px 1px 1px 1px); /* IE6, IE7 */ + clip: rect(1px, 1px, 1px, 1px); + position: absolute !important; +} + +/* Small featured post */ +section.featured-post .attachment-small-feature { + float: right; + height: auto; + margin: 0 -8.9% 1.625em 0; + max-width: 59%; + position: relative; + right: -15px; +} +section.featured-post.small { + padding-top: 0; +} +section.featured-post .attachment-small-feature:hover, +section.featured-post .attachment-small-feature:focus, +section.featured-post .attachment-small-feature:active { + opacity: .8; +} +article.feature-image.small { + float: left; + margin: 0 0 1.625em; + width: 45%; +} +article.feature-image.small .entry-title { + line-height: 1.2em; +} +article.feature-image.small .entry-summary { + color: #555; + font-size: 13px; +} +article.feature-image.small .entry-summary p a { + background: #222; + color: #eee; + display: block; + left: -23.8%; + padding: 9px 26px 9px 85px; + position: relative; + text-decoration: none; + top: 20px; + width: 180px; + z-index: 1; +} +article.feature-image.small .entry-summary p a:hover { + background: #1982d1; + color: #eee; + color: rgba(255,255,255,0.8); +} + +/* Large featured post */ +section.feature-image.large { + border: none; + max-height: 288px; + padding: 0; + width: 100%; +} +section.feature-image.large .showcase-heading { + display: none; +} +section.feature-image.large .hentry { + border-bottom: none; + left: 9%; + margin: 1.625em 9% 0 0; + position: absolute; + top: 0; +} +article.feature-image.large .entry-title a { + background: #222; + background: rgba(0,0,0,0.8); + -moz-border-radius: 3px; + border-radius: 3px; + color: #fff; + display: inline-block; + font-weight: 300; + padding: .2em 20px; +} +section.feature-image.large:hover .entry-title a, +section.feature-image.large .entry-title:hover a { + background: #eee; + background: rgba(255,255,255,0.8); + color: #222; +} +article.feature-image.large .entry-summary { + display: none; +} +section.feature-image.large img { + display: block; + height: auto; + max-width: 117.9%; + padding: 0 0 6px; +} + +/* Featured Slider */ +.featured-posts { + border-bottom: 1px solid #ddd; + display: block; + height: 328px; + margin: 1.625em -8.9% 20px; + max-width: 1000px; + padding: 0; + position: relative; + overflow: hidden; +} +.featured-posts .showcase-heading { + padding-left: 8.9%; +} +.featured-posts section.featured-post { + background: #fff; + height: 288px; + left: 0; + margin: 0; + position: absolute; + top: 30px; + width: auto; +} +.featured-posts section.featured-post.large { + max-width: 100%; + overflow: hidden; +} +.featured-posts section.featured-post { + -webkit-transition-duration: 200ms; + -webkit-transition-property: opacity, visibility; + -webkit-transition-timing-function: ease; + -moz-transition-duration: 200ms; + -moz-transition-property: opacity, visibility; + -moz-transition-timing-function: ease; +} +.featured-posts section.featured-post { + opacity: 0; + visibility: hidden; +} +.featured-posts #featured-post-1 { + opacity: 1; + visibility: visible; +} +.featured-post .feature-text:after, +.featured-post .feature-image.small:after { + content: ' '; + background: -moz-linear-gradient(top, rgba(255,255,255,0) 0%, rgba(255,255,255,1) 100%); /* FF3.6+ */ + background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(255,255,255,0)), color-stop(100%,rgba(255,255,255,1))); /* Chrome,Safari4+ */ + background: -webkit-linear-gradient(top, rgba(255,255,255,0) 0%,rgba(255,255,255,1) 100%); /* Chrome10+,Safari5.1+ */ + background: -o-linear-gradient(top, rgba(255,255,255,0) 0%,rgba(255,255,255,1) 100%); /* Opera11.10+ */ + background: -ms-linear-gradient(top, rgba(255,255,255,0) 0%,rgba(255,255,255,1) 100%); /* IE10+ */ + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#00ffffff', endColorstr='#ffffff',GradientType=0 ); /* IE6-9 */ + background: linear-gradient(top, rgba(255,255,255,0) 0%,rgba(255,255,255,1) 100%); /* W3C */ + width: 100%; + height: 45px; + position: absolute; + top: 230px; +} +.featured-post .feature-image.small:after { + top: 253px; +} +#content .feature-slider { + top: 5px; + right: 8.9%; + overflow: visible; + position: absolute; +} +.feature-slider ul { + list-style-type: none; + margin: 0; +} +.feature-slider li { + float: left; + margin: 0 6px; +} +.feature-slider a { + background: #3c3c3c; + background: rgba(60,60,60,0.9); + -moz-border-radius: 12px; + border-radius: 12px; + -webkit-box-shadow: inset 1px 1px 5px rgba(0,0,0,0.5), inset 0 0 2px rgba(255,255,255,0.5); + -moz-box-shadow: inset 1px 1px 5px rgba(0,0,0,0.5), inset 0 0 2px rgba(255,255,255,0.5); + box-shadow: inset 1px 1px 5px rgba(0,0,0,0.5), inset 0 0 2px rgba(255,255,255,0.5); + display: block; + width: 14px; + height: 14px; +} +.feature-slider a.active { + background: #1982d1; + -webkit-box-shadow: inset 1px 1px 5px rgba(0,0,0,0.4), inset 0 0 2px rgba(255,255,255,0.8); + -moz-box-shadow: inset 1px 1px 5px rgba(0,0,0,0.4), inset 0 0 2px rgba(255,255,255,0.8); + box-shadow: inset 1px 1px 5px rgba(0,0,0,0.4), inset 0 0 2px rgba(255,255,255,0.8); + cursor: default; + opacity: 0.5; +} + +/* Recent Posts */ +section.recent-posts { + padding: 0 0 1.625em; +} +section.recent-posts .hentry { + border: none; + margin: 0; +} +section.recent-posts .other-recent-posts { + border-bottom: 1px solid #ddd; + list-style: none; + margin: 0; +} +section.recent-posts .other-recent-posts li { + padding: 0.3125em 0; + position: relative; +} +section.recent-posts .other-recent-posts .entry-title { + border-top: 1px solid #ddd; + font-size: 17px; +} +section.recent-posts .other-recent-posts a[rel="bookmark"] { + color: #373737; + float: left; + max-width: 84%; +} +section.recent-posts .other-recent-posts a[rel="bookmark"]:after { + content: '-'; + color: transparent; + font-size: 11px; +} +section.recent-posts .other-recent-posts a[rel="bookmark"]:hover { +} +section.recent-posts .other-recent-posts .comments-link a, +section.recent-posts .other-recent-posts .comments-link > span { + border-bottom: 2px solid #999; + bottom: -2px; + color: #444; + display: block; + font-size: 10px; + font-weight: 500; + line-height: 2.76333em; + padding: 0.3125em 0 0.3125em 1em; + position: absolute; + right: 0; + text-align: right; + text-transform: uppercase; + z-index: 1; +} +section.recent-posts .other-recent-posts .comments-link > span { + border-color: #bbb; + color: #888; +} +section.recent-posts .other-recent-posts .comments-link a:hover { + color: #1982d1; + border-color: #1982d1; +} +section.recent-posts .other-recent-posts li:after { + clear: both; + content: '.'; + display: block; + height: 0; + visibility: hidden; +} + + +/* =Attachments +----------------------------------------------- */ + +.image-attachment div.attachment { + background: #f9f9f9; + border: 1px solid #ddd; + border-width: 1px 0; + margin: 0 -8.9% 1.625em; + overflow: hidden; + padding: 1.625em 1.625em 0; + text-align: center; +} +.image-attachment div.attachment img { + display: block; + height: auto; + margin: 0 auto 1.625em; + max-width: 100%; +} +.image-attachment div.attachment a img { + border-color: #f9f9f9; +} +.image-attachment div.attachment a:focus img, +.image-attachment div.attachment a:hover img, +.image-attachment div.attachment a:active img { + border-color: #ddd; + background: #fff; +} +.image-attachment .entry-caption p { + font-size: 10px; + letter-spacing: 0.1em; + line-height: 2.6em; + margin: 0 0 2.6em; + text-transform: uppercase; +} + + +/* =Navigation +-------------------------------------------------------------- */ + +#content nav { + clear: both; + overflow: hidden; + padding: 0 0 1.625em; +} +#content nav a { + font-size: 12px; + font-weight: bold; + line-height: 2.2em; +} +#nav-above { + padding: 0 0 1.625em; +} +#nav-above { + display: none; +} +.paged #nav-above { + display: block; +} +.nav-previous { + float: left; + width: 50%; +} +.nav-next { + float: right; + text-align: right; + width: 50%; +} +#content nav .meta-nav { + font-weight: normal; +} + +/* Singular navigation */ +#nav-single { + float: right; + position: relative; + top: -0.3em; + text-align: right; + width: 100%; + z-index: 1; +} +#nav-single .nav-previous, +#nav-single .nav-next { + float: none; + width: auto; +} +#nav-single .nav-next { + padding-left: .5em; +} + + +/* =Widgets +----------------------------------------------- */ + +.widget-area { + font-size: 12px; +} +.widget { + clear: both; + margin: 0 0 2.2em; +} +.widget-title { + color: #666; + font-size: 10px; + font-weight: 500; + letter-spacing: 0.1em; + line-height: 2.6em; + text-transform: uppercase; +} +.widget ul { + font-size: 15px; + margin: 0; +} +.widget ul ul { + margin-left: 1.5em; +} +.widget ul li { + color: #777; + font-size: 13px; +} +.widget a { + font-weight: bold; + text-decoration: none; +} +.widget a:hover, +.widget a:focus, +.widget a:active { + text-decoration: underline; +} + +/* Search Widget */ +.widget_search form { + margin: 0 0 1.625em; +} +.widget_search #s { + width: 77%; +} +.widget_search #searchsubmit { + background: #ddd; + border: 1px solid #ccc; + -webkit-box-shadow: inset 0px -1px 1px rgba(0, 0, 0, 0.09); + -moz-box-shadow: inset 0px -1px 1px rgba(0, 0, 0, 0.09); + box-shadow: inset 0px -1px 1px rgba(0, 0, 0, 0.09); + color: #888; + font-size: 13px; + line-height: 25px; + position: relative; + top: -2px; +} +.widget_search #searchsubmit:active { + background: #1982d1; + border-color: #0861a5; + -webkit-box-shadow: inset 0px 1px 1px rgba(0, 0, 0, 0.1); + -moz-box-shadow: inset 0px 1px 1px rgba(0, 0, 0, 0.1); + box-shadow: inset 0px 1px 1px rgba(0, 0, 0, 0.1); + color: #bfddf3; +} + +/* Ephemera Widget */ +section.ephemera ol, +.widget_twentyeleven_ephemera ol { + list-style: square; + margin: 5px 0 0; +} +.widget_twentyeleven_ephemera .widget-entry-title { + font-size: 15px; + font-weight: bold; + padding: 0; +} +.widget_twentyeleven_ephemera .comments-link a, +.widget_twentyeleven_ephemera .comments-link > span { + color: #666; + display: block; + font-size: 10px; + font-weight: 500; + line-height: 2.76333em; + text-transform: uppercase; +} +section.ephemera .entry-title .comments-link a:hover, +.widget_twentyeleven_ephemera .entry-title .comments-link a:hover { +} +section.ephemera .entry-title a span { + color: #29628d; +} + +/* Twitter */ +.widget_twitter li { + list-style-type: none; + margin-bottom: 14px; +} +.widget_twitter .timesince { + display: block; + font-size: 11px; + margin-right: -10px; + text-align: right; +} + +/* Widget Image */ +.widget_image img { + height: auto; + max-width: 100%; +} + +/* Calendar Widget */ + +.widget_calendar #wp-calendar { + color: #555; + width: 95%; + text-align: center; +} +.widget_calendar #wp-calendar caption, +.widget_calendar #wp-calendar td, +.widget_calendar #wp-calendar th { + text-align: center; +} +.widget_calendar #wp-calendar caption { + font-size: 11px; + font-weight: 500; + padding: 5px 0 3px 0; + text-transform: uppercase; +} +.widget_calendar #wp-calendar th { + background: #f4f4f4; + border-top: 1px solid #ccc; + border-bottom: 1px solid #ccc; + font-weight: bold; +} +.widget_calendar #wp-calendar tfoot td { + background: #f4f4f4; + border-top: 1px solid #ccc; + border-bottom: 1px solid #ccc; +} + + +/* =Comments +----------------------------------------------- */ + +#comments-title { + color: #666; + font-size: 10px; + font-weight: 500; + line-height: 2.6em; + padding: 0 0 2.6em; + text-transform: uppercase; +} +.nopassword, +.nocomments { + color: #aaa; + font-size: 24px; + font-weight: 100; + margin: 26px 0; + text-align: center; +} +.commentlist { + list-style: none; + margin: 0 auto; + width: 68.9%; +} +.content .commentlist, +.page-template-sidebar-page-php .commentlist { + width: 100%; /* reset the width for the one-column and sidebar page layout */ +} +.commentlist > li.comment { + background: #f6f6f6; + border: 1px solid #ddd; + -moz-border-radius: 3px; + border-radius: 3px; + margin: 0 0 1.625em; + padding: 1.625em; + position: relative; +} +.commentlist .pingback { + margin: 0 0 1.625em; + padding: 0 1.625em; +} +.commentlist .children { + list-style: none; + margin: 0; +} +.commentlist .children li.comment { + background: #fff; + border-left: 1px solid #ddd; + -moz-border-radius: 0 3px 3px 0; + border-radius: 0 3px 3px 0; + margin: 1.625em 0 0; + padding: 1.625em; + position: relative; +} +.commentlist .children li.comment .fn { + display: block; +} +.comment-meta .fn { + font-style: normal; +} +.comment-meta { + color: #666; + font-size: 12px; + line-height: 2.2em; +} +.commentlist .children li.comment .comment-meta { + line-height: 1.625em; + margin-left: 50px; +} +.commentlist .children li.comment .comment-content { + margin: 1.625em 0 0; +} +.comment-meta a { + font-weight: bold; +} +.comment-meta a:focus, +.comment-meta a:active, +.comment-meta a:hover { +} +.commentlist .avatar { + -moz-border-radius: 3px; + border-radius: 3px; + -webkit-box-shadow: 0 1px 2px #ccc; + -moz-box-shadow: 0 1px 2px #ccc; + box-shadow: 0 1px 2px #ccc; + left: -102px; + padding: 0; + position: absolute; + top: 0; +} +.commentlist > li:before { + content: url(images/comment-arrow.png); + left: -21px; + position: absolute; +} +.commentlist > li.pingback:before { + content: ''; +} +.commentlist .children .avatar { + background: none; + -webkit-box-shadow: none; + -moz-box-shadow: none; + box-shadow: none; + left: 2.2em; + padding: 0; + top: 2.2em; +} +a.comment-reply-link { + background: #eee; + -moz-border-radius: 3px; + border-radius: 3px; + color: #666; + display: inline-block; + font-size: 12px; + padding: 0 8px; + text-decoration: none; +} +a.comment-reply-link:hover, +a.comment-reply-link:focus, +a.comment-reply-link:active { + background: #888; + color: #fff; +} +a.comment-reply-link > span { + display: inline-block; + position: relative; + top: -1px; +} + +/* Post author highlighting */ +.commentlist > li.bypostauthor { + background: #ddd; + border-color: #d3d3d3; +} +.commentlist > li.bypostauthor .comment-meta { + color: #575757; +} +.commentlist > li.bypostauthor .comment-meta a:focus, +.commentlist > li.bypostauthor .comment-meta a:active, +.commentlist > li.bypostauthor .comment-meta a:hover { +} +.commentlist > li.bypostauthor:before { + content: url(images/comment-arrow-bypostauthor.png); +} + +/* Post Author threaded comments */ +.commentlist .children > li.bypostauthor { + background: #ddd; + border-color: #d3d3d3; +} + +/* sidebar-page.php comments */ +/* Make sure we have room for our comment avatars */ +.page-template-sidebar-page-php .commentlist > li.comment, +.page-template-sidebar-page-php.commentlist .pingback { + margin-left: 102px; + width: auto; +} +/* And a full-width comment form */ +.page-template-sidebar-page-php #respond { + width: auto; +} + +/* Comment Form */ +#respond { + background: #ddd; + border: 1px solid #d3d3d3; + -moz-border-radius: 3px; + border-radius: 3px; + margin: 0 auto 1.625em; + padding: 1.625em; + position: relative; + width: 68.9%; +} +#respond input[type="text"], +#respond textarea { + background: #fff; + border: 4px solid #eee; + -moz-border-radius: 5px; + border-radius: 5px; + -webkit-box-shadow: inset 0 1px 3px rgba(204,204,204,0.95); + -moz-box-shadow: inset 0 1px 3px rgba(204,204,204,0.95); + box-shadow: inset 0 1px 3px rgba(204,204,204,0.95); + position: relative; + padding: 10px; + text-indent: 80px; +} +#respond .comment-form-author, +#respond .comment-form-email, +#respond .comment-form-url, +#respond .comment-form-comment { + position: relative; +} +#respond .comment-form-author label, +#respond .comment-form-email label, +#respond .comment-form-url label, +#respond .comment-form-comment label { + background: #eee; + -webkit-box-shadow: 1px 2px 2px rgba(204,204,204,0.8); + -moz-box-shadow: 1px 2px 2px rgba(204,204,204,0.8); + box-shadow: 1px 2px 2px rgba(204,204,204,0.8); + color: #555; + display: inline-block; + font-size: 13px; + left: 4px; + min-width: 60px; + padding: 4px 10px; + position: relative; + top: 40px; + z-index: 1; +} +#respond input[type="text"]:focus, +#respond textarea:focus { + text-indent: 0; + z-index: 1; +} +#respond textarea { + resize: vertical; + width: 95%; +} +#respond .comment-form-author .required, +#respond .comment-form-email .required { + color: #bd3500; + font-size: 22px; + font-weight: bold; + left: 75%; + position: absolute; + top: 45px; + z-index: 1; +} +#respond .comment-notes, +#respond .logged-in-as { + font-size: 13px; +} +#respond p { + margin: 10px 0; +} +#respond .form-submit { + float: right; + margin: -20px 0 10px; +} +#respond input#submit { + background: #222; + border: none; + -moz-border-radius: 3px; + border-radius: 3px; + -webkit-box-shadow: 0px 1px 2px rgba(0,0,0,0.3); + -moz-box-shadow: 0px 1px 2px rgba(0,0,0,0.3); + box-shadow: 0px 1px 2px rgba(0,0,0,0.3); + color: #eee; + cursor: pointer; + font-size: 15px; + margin: 20px 0; + padding: 5px 42px 5px 22px; + position: relative; + left: 30px; + text-shadow: 0 -1px 0 rgba(0,0,0,0.3); +} +#respond input#submit:active { + background: #1982d1; + color: #bfddf3; +} +#respond #cancel-comment-reply-link { + color: #666; + margin-left: 10px; + text-decoration: none; +} +#respond .logged-in-as a:hover, +#respond #cancel-comment-reply-link:hover { + text-decoration: underline; +} +.commentlist #respond { + margin: 1.625em 0 0; + width: auto; +} +#reply-title { + color: #373737; + font-size: 24px; + font-weight: bold; + line-height: 30px; +} +#cancel-comment-reply-link { + color: #888; + display: block; + font-size: 10px; + font-weight: normal; + line-height: 2.2em; + letter-spacing: 0.05em; + position: absolute; + right: 1.625em; + text-decoration: none; + text-transform: uppercase; + top: 1.1em; +} +#cancel-comment-reply-link:focus, +#cancel-comment-reply-link:active, +#cancel-comment-reply-link:hover { + color: #ff4b33; +} +#respond label { + line-height: 2.2em; +} +#respond input[type=text] { + display: block; + height: 24px; + width: 75%; +} +#respond p { + font-size: 12px; +} +p.comment-form-comment { + margin: 0; +} +.form-allowed-tags { + display: none; +} + + +/* =Footer +----------------------------------------------- */ + +#colophon { + clear: both; +} +#supplementary { + border-top: 1px solid #ddd; + padding: 1.625em 7.6%; + overflow: hidden; +} + +/* Two Footer Widget Areas */ +#supplementary.two .widget-area { + float: left; + margin-right: 3.7%; + width: 48.1%; +} +#supplementary.two .widget-area + .widget-area { + margin-right: 0; +} + +/* Three Footer Widget Areas */ +#supplementary.three .widget-area { + float: left; + margin-right: 3.7%; + width: 30.85%; +} +#supplementary.three .widget-area + .widget-area + .widget-area { + margin-right: 0; +} + +/* Site Generator Line */ +#site-generator { + background: #f9f9f9; + border-top: 1px solid #ddd; + color: #666; + font-size: 12px; + line-height: 2.2em; + padding: 2.2em 0.5em; + text-align: center; +} +#site-generator a { + color: #555; + font-weight: bold; +} +#site-generator .sep { + background: url(images/wordpress.png) center left no-repeat; + color: transparent; + display: inline-block; + height: 16px; + line-height: 16px; + margin: 0 7px; + width: 16px; +} + + +/* =Responsive Structure +----------------------------------------------- */ + +@media (max-width: 800px) { + /* Simplify the basic layout */ + #main #content { + margin: 0 7.6%; + width: auto; + } + #nav-below { + border-bottom: 1px solid #ddd; + margin-bottom: 1.625em; + } + #main #secondary { + float: none; + margin: 0 7.6%; + width: auto; + } + /* Simplify the showcase template */ + .page-template-showcase-php .featured-posts { + min-height: 280px; + } + .featured-posts section.featured-post { + height: auto; + } + .page-template-showcase-php section.recent-posts { + float: none; + margin: 0; + width: 100%; + } + .page-template-showcase-php #main .widget-area { + float: none; + margin: 0; + width: auto; + } + .page-template-showcase-php .other-recent-posts { + border-bottom: 1px solid #ddd; + } + /* Simplify the showcase template when small feature */ + section.featured-post .attachment-small-feature, + .one-column section.featured-post .attachment-small-feature { + border: none; + display: block; + float: left; + height: auto; + margin: 0.625em auto 1.025em; + max-width: 30%; + position: static; + } + article.feature-image.small { + float: right; + margin: 0 0 1.625em; + width: 64%; + } + .one-column article.feature-image.small .entry-summary { + height: auto; + } + article.feature-image.small .entry-summary p a { + left: 0; + padding-left: 20px; + padding-right: 20px; + width: auto; + } + /* Remove the margin on singular articles */ + .singular .entry-header, + .singular .entry-content, + .singular footer.entry-meta, + .singular #comments-title { + width: 100%; + } + /* Simplify the pullquotes and pull styles */ + .singular blockquote.pull { + margin: 0 0 1.625em; + } + .singular .pull.alignleft { + margin: 0 1.625em 0 0; + } + .singular .pull.alignright { + margin: 0 0 0 1.625em; + } + .singular .entry-meta .edit-link a { + left: 0; + position: absolute; + top: 40px; + } + .singular #author-info { + margin: 2.2em -8.8% 0; + padding: 20px 8.8%; + } + /* Make sure we have room for our comment avatars */ + .commentlist { + width: 100%; + } + .commentlist > li.comment, + .commentlist .pingback { + margin-left: 102px; + width: auto; + } + /* And a full-width comment form */ + #respond { + width: auto; + } + /* No need to float footer widgets at this size */ + #colophon #supplementary .widget-area { + float: none; + margin-right: 0; + width: auto; + } + /* No need to float 404 widgets at this size */ + .error404 #main .widget { + float: none; + margin-right: 0; + width: auto; + } + /* Make sure embeds fit their containers */ + embed, + object { + max-width: 100%; + } + +} +@media (max-width: 650px) { + /* @media (max-width: 650px) Reduce font-sizes for better readability on smaller devices */ + body, input, textarea { + font-size: 13px; + } + #site-title a { + font-size: 24px; + } + #site-description { + font-size: 12px; + } + #access ul { + font-size: 12px; + } + article.intro .entry-content { + font-size: 12px; + } + .entry-title { + font-size: 21px; + } + .featured-post .entry-title { + font-size: 14px; + } + .singular .entry-title { + font-size: 28px; + } + .entry-meta { + font-size: 12px; + } + blockquote { + margin: 0; + } + blockquote.pull { + font-size: 17px; + } + /* Reposition the site title and description slightly */ + #site-title { + padding: 5.30625em 0 0; + } + #site-title, + #site-description { + margin-right: 0; + } + /* Make sure the logo and search form don't collide */ + #branding #searchform { + top: 1.625em !important; + } + /* Floated content doesn't work well at this size */ + .alignleft, + .alignright { + float: none; + margin-left: 0; + margin-right: 0; + } + /* Make sure the post-post navigation doesn't collide with anything */ + #nav-single { + display: block; + position: static; + } + .singular .hentry { + padding: 1.625em 0 0; + } + .singular.page .hentry { + padding: 1.625em 0 0; + } + /* Talking avatars take up too much room at this size */ + .commentlist > li.comment, + .commentlist > li.pingback { + margin-left: 0 !important; + } + .commentlist .avatar { + background: transparent; + display: block; + padding: 0; + position: static; + } + .commentlist .children .avatar { + background: none; + left: 2.2em; + padding: 0; + position: absolute; + top: 2.2em; + } + /* Use the available space in the smaller comment form */ + #respond input[type="text"] { + width: 95%; + } + #respond .comment-form-author .required, + #respond .comment-form-email .required { + left: 95%; + } + #content .gallery-columns-3 .gallery-item { + width: 31%; + padding-right: 2%; + } + #content .gallery-columns-3 .gallery-item img { + width: 100%; + height: auto; + } + +} +@media (max-width: 450px) { + #content .gallery-columns-2 .gallery-item { + width: 45%; + padding-right: 4%; + } + #content .gallery-columns-2 .gallery-item img { + width: 100%; + height: auto; + } + +} +@media only screen and (min-device-width: 320px) and (max-device-width: 480px) { + body { + padding: 0; + } + #page { + margin-top: 0; + } + #branding { + border-top: none; + } + +} + + +/* =Print +----------------------------------------------- */ + +@media print { + body { + background: none !important; + font-size: 10pt; + } + footer.entry-meta a[rel=bookmark]:link:after, + footer.entry-meta a[rel=bookmark]:visited:after { + content: " [" attr(href) "] "; /* Show URLs */ + } + #page { + clear: both !important; + display: block !important; + float: none !important; + max-width: 100%; + position: relative !important; + } + #branding { + border-top: none !important; + padding: 0; + } + #branding hgroup { + margin: 0; + } + #site-title a { + font-size: 21pt; + } + #site-description { + font-size: 10pt; + } + #branding #searchform { + display: none; + } + #branding img { + display: none; + } + #access { + display: none; + } + #main { + border-top: none; + box-shadow: none; + } + #primary { + float: left; + margin: 0; + width: 100%; + } + #content { + margin: 0; + width: auto; + } + .singular #content { + margin: 0; + width: 100%; + } + .singular .entry-header .entry-meta { + position: static; + } + .entry-meta .edit-link a { + display: none; + } + #content nav { + display: none; + } + .singular .entry-header, + .singular .entry-content, + .singular footer.entry-meta, + .singular #comments-title { + margin: 0; + width: 100%; + } + .singular .hentry { + padding: 0; + } + .entry-title, + .singular .entry-title { + font-size: 21pt; + } + .entry-meta { + font-size: 10pt; + } + .entry-header .comments-link { + display: none; + } + .page-link { + display: none; + } + .singular #author-info { + background: none; + border-bottom: none; + border-top: none; + margin: 2.2em 0 0; + padding: 0; + } + #respond { + display: none; + } + .widget-area { + display: none; + } + #colophon { + display: none; + } + + /* Comments */ + .commentlist > li.comment { + background: none; + border: 1px solid #ddd; + -moz-border-radius: 3px 3px 3px 3px; + border-radius: 3px 3px 3px 3px; + margin: 0 auto 1.625em; + padding: 1.625em; + position: relative; + width: auto; + } + .commentlist .avatar { + height: 39px; + left: 2.2em; + top: 2.2em; + width: 39px; + } + .commentlist li.comment .comment-meta { + line-height: 1.625em; + margin-left: 50px; + } + .commentlist li.comment .fn { + display: block; + } + .commentlist li.comment .comment-content { + margin: 1.625em 0 0; + } + .commentlist .comment-edit-link { + display: none; + } + .commentlist > li::before, + .commentlist > li.bypostauthor::before { + content: ''; + } + .commentlist .reply { + display: none; + } + + /* Post author highlighting */ + .commentlist > li.bypostauthor { + color: #444; + } + .commentlist > li.bypostauthor .comment-meta { + color: #666; + } + .commentlist > li.bypostauthor:before { + content: none; + } + + /* Post Author threaded comments */ + .commentlist .children > li.bypostauthor { + background: #fff; + border-color: #ddd; + } + .commentlist .children > li.bypostauthor > article, + .commentlist .children > li.bypostauthor > article .comment-meta { + color: #666; + } + +} + + +/* =IE7 +----------------------------------------------- */ + +#ie7 article.intro { + margin-left: -7.6%; + margin-right: -7.6%; + padding-left: -7.6%; + padding-right: -7.6%; + max-width: 1000px; +} +#ie7 section.featured-post { + margin-left: -7.6%; + margin-right: -7.6%; + max-width: 850px; +} +#ie7 section.recent-posts { + margin-right: 7.6%; +} diff --git a/src/wp-content/themes/twentyeleven/tag.php b/src/wp-content/themes/twentyeleven/tag.php new file mode 100644 index 0000000..8180a8c --- /dev/null +++ b/src/wp-content/themes/twentyeleven/tag.php @@ -0,0 +1,65 @@ + + +
              +
              + + + +
              ' ); + ?> + + + + + + + + + + + + + + + +
              +
              +

              +
              + +
              +

              + +
              +
              + + + +
              + + + + diff --git a/src/wp-content/themes/twentyten/404.php b/src/wp-content/themes/twentyten/404.php new file mode 100644 index 0000000..3baea81 --- /dev/null +++ b/src/wp-content/themes/twentyten/404.php @@ -0,0 +1,30 @@ + + +
              +
              + +
              +

              +
              +

              + +
              +
              + +
              +
              + + + \ No newline at end of file diff --git a/src/wp-content/themes/twentyten/archive.php b/src/wp-content/themes/twentyten/archive.php new file mode 100644 index 0000000..0707e18 --- /dev/null +++ b/src/wp-content/themes/twentyten/archive.php @@ -0,0 +1,61 @@ + + +
              +
              + + + +

              + + %s', 'twentyten' ), get_the_date() ); ?> + + %s', 'twentyten' ), get_the_date( 'F Y' ) ); ?> + + %s', 'twentyten' ), get_the_date( 'Y' ) ); ?> + + + +

              + + + +
              +
              + + + diff --git a/src/wp-content/themes/twentyten/attachment.php b/src/wp-content/themes/twentyten/attachment.php new file mode 100644 index 0000000..5b35936 --- /dev/null +++ b/src/wp-content/themes/twentyten/attachment.php @@ -0,0 +1,26 @@ + + +
              +
              + + + +
              +
              + + diff --git a/src/wp-content/themes/twentyten/author.php b/src/wp-content/themes/twentyten/author.php new file mode 100644 index 0000000..2bd48c8 --- /dev/null +++ b/src/wp-content/themes/twentyten/author.php @@ -0,0 +1,60 @@ + + +
              +
              + + + +

              " . get_the_author() . "" ); ?>

              + + +
              +
              + +
              +
              +

              + +
              +
              + + + +
              +
              + + + diff --git a/src/wp-content/themes/twentyten/category.php b/src/wp-content/themes/twentyten/category.php new file mode 100644 index 0000000..0792e1f --- /dev/null +++ b/src/wp-content/themes/twentyten/category.php @@ -0,0 +1,34 @@ + + +
              +
              + +

              ' . single_cat_title( '', false ) . '' ); + ?>

              + ' . $category_description . '
              '; + + /* Run the loop for the category page to output the posts. + * If you want to overload this in a child theme then include a file + * called loop-category.php and that will be used instead. + */ + get_template_part( 'loop', 'category' ); + ?> + +
              +
              + + + diff --git a/src/wp-content/themes/twentyten/comments.php b/src/wp-content/themes/twentyten/comments.php new file mode 100644 index 0000000..7863ca1 --- /dev/null +++ b/src/wp-content/themes/twentyten/comments.php @@ -0,0 +1,79 @@ + + +
              + +

              +
              + + + + + +

              ' . get_the_title() . '' ); + ?>

              + + 1 && get_option( 'page_comments' ) ) : // Are there comments to navigate through? ?> + + + +
                + 'twentyten_comment' ) ); + ?> +
              + + 1 && get_option( 'page_comments' ) ) : // Are there comments to navigate through? ?> + + + + +

              + + + + + + +
              diff --git a/src/wp-content/themes/twentyten/editor-style-rtl.css b/src/wp-content/themes/twentyten/editor-style-rtl.css new file mode 100644 index 0000000..2c69a7c --- /dev/null +++ b/src/wp-content/themes/twentyten/editor-style-rtl.css @@ -0,0 +1,56 @@ +/* +Theme Name: Twenty Ten +*/ +/* +Used to style the TinyMCE editor. +*/ +html .mceContentBody{ + direction:rtl; + unicode-bidi:embed; + float:right; +} +* { + font-family: Arial, Tahoma, sans-serif; +} +/* Text elements */ +ul { + margin: 0 -18px 18px 0; +} +ol { + margin: 0 -18px 18px 0; +} +dd { + margin-right: 0; +} +blockquote { + font-style: normal; +} +table { + text-align: right; + margin: 0 0 24px -1px; +} +html .mceContentBody{ + direction:rtl; + unicode-bidi:embed; + float:right; +} +* { + font-family: Arial, Tahoma, sans-serif; +} +/* Text elements */ +ul { + margin: 0 -18px 18px 0; +} +ol { + margin: 0 -18px 18px 0; +} +dd { + margin-right: 0; +} +blockquote { + font-style: normal; +} +table { + text-align: right; + margin: 0 0 24px -1px; +} \ No newline at end of file diff --git a/src/wp-content/themes/twentyten/editor-style.css b/src/wp-content/themes/twentyten/editor-style.css new file mode 100644 index 0000000..7d05135 --- /dev/null +++ b/src/wp-content/themes/twentyten/editor-style.css @@ -0,0 +1,292 @@ +/* +Theme Name: Twenty Ten +Description: Used to style the TinyMCE editor. +*/ +html .mceContentBody { + max-width: 640px; +} +* { + color: #444; + font-family: Georgia, "Bitstream Charter", serif; + line-height: 1.5; +} +p, +dl, +td, +th, +ul, +ol, +blockquote { + font-size: 16px; +} +tr th, +thead th, +label, +tr th, +thead th { + font-family: "Helvetica Neue", Arial, Helvetica, "Nimbus Sans L", sans-serif; +} +pre { + font-family: "Courier 10 Pitch", Courier, monospace; +} +code, code var { + font-family: Monaco, Consolas, "Andale Mono", "DejaVu Sans Mono", monospace; +} +body, input, textarea { + font-size: 12px; + line-height: 18px; +} +hr { + background-color: #e7e7e7; + border: 0; + clear: both; + height: 1px; + margin-bottom: 18px; +} +/* Text elements */ +p { + margin-bottom: 18px; +} +ul { + list-style: square; + margin: 0 0 18px 1.5em; +} +ol { + list-style: decimal; + margin: 0 0 18px 1.5em; +} +ol ol { + list-style: upper-alpha; +} +ol ol ol { + list-style: lower-roman; +} +ol ol ol ol { + list-style: lower-alpha; +} +ul ul, +ol ol, +ul ol, +ol ul { + margin-bottom: 0; +} +dl { + margin: 0 0 24px 0; +} +dt { + font-weight: bold; +} +dd { + margin-bottom: 18px; +} +strong { + color: #000; + font-weight: bold; +} +cite, +em, +i { + border: none; + font-style: italic; +} +big { + font-size: 131.25%; +} +ins { + background: #ffc; + border: none; + color: #333; +} +del { + text-decoration: line-through; + color: #555; +} +blockquote { + font-style: italic; + padding: 0 3em; +} +blockquote cite, +blockquote em, +blockquote i { + font-style: normal; +} +pre { + background: #f7f7f7; + color: #222; + line-height: 18px; + margin-bottom: 18px; + padding: 1.5em; +} +abbr, +acronym { + border-bottom: 1px dotted #666; + cursor: help; +} +ins { + text-decoration: none; +} +sup, +sub { + font-size: 10px; + height: 0; + line-height: 1; + position: relative; + vertical-align: baseline; +} +sup { + bottom: 1ex; +} +sub { + top: .5ex; +} +a:link { + color: #06c; +} +a:visited { + color: #743399; +} +a:active, +a:hover { + color: #ff4b33; +} +p, +ul, +ol, +dd, +pre, +hr { + margin-bottom: 24px; +} +ul ul, +ol ol, +ul ol, +ol ul { + margin-bottom: 0; +} +pre, +kbd, +tt, +var { + font-size: 15px; + line-height: 21px; +} +code { + font-size: 13px; +} +strong, +b, +dt, +th { + color: #000; +} +h1, +h2, +h3, +h4, +h5, +h6 { + color: #000; + font-weight: normal; + line-height: 1.5em; + margin: 0 0 20px 0; +} +h1 { + font-size: 2.4em; +} +h2 { + font-size: 1.8em; +} +h3 { + font-size: 1.4em; +} +h4 { + font-size: 1.2em; +} +h5 { + font-size: 1em; +} +h6 { + font-size: 0.9em; +} +table { + border: 1px solid #e7e7e7 !important; + border-collapse: collapse; + border-spacing: 0; + margin: 0 -1px 24px 0; + text-align: left; + width: 100%; +} +tr th, +thead th { + border: none !important; + color: #888; + font-size: 12px; + font-weight: bold; + line-height: 18px; + padding: 9px 24px; +} +tr td { + border: none !important; + border-top: 1px solid #e7e7e7 !important; + padding: 6px 24px; +} +img { + margin: 0; +} +img.size-auto, +img.size-large, +img.size-full, +img.size-medium { + max-width: 100%; + height: auto; +} +.alignleft, +img.alignleft { + display: inline; + float: left; + margin-right: 24px; + margin-top: 4px; +} +.alignright, +img.alignright { + display: inline; + float: right; + margin-left: 24px; + margin-top: 4px; +} +.aligncenter, +img.aligncenter { + clear: both; + display: block; + margin-left: auto; + margin-right: auto; +} +img.alignleft, +img.alignright, +img.aligncenter { + margin-bottom: 12px; +} +.wp-caption { + background: #f1f1f1; + border: none; + -khtml-border-radius: 0; + -moz-border-radius: 0; + -webkit-border-radius: 0; + border-radius: 0; + color: #888; + font-size: 12px; + line-height: 18px; + margin-bottom: 20px; + max-width: 632px !important; /* prevent too-wide images from breaking layout */ + padding: 4px; + text-align: center; +} +.wp-caption img { + margin: 5px; +} +.wp-caption p.wp-caption-text { + margin: 0 0 4px; +} +.wp-smiley { + margin: 0; +} \ No newline at end of file diff --git a/src/wp-content/themes/twentyten/footer.php b/src/wp-content/themes/twentyten/footer.php new file mode 100644 index 0000000..6d0d1ab --- /dev/null +++ b/src/wp-content/themes/twentyten/footer.php @@ -0,0 +1,50 @@ + + + + + + + + + * tag of your theme, or you will break many plugins, which + * generally use this hook to reference JavaScript files. + */ + + wp_footer(); +?> + + diff --git a/src/wp-content/themes/twentyten/functions.php b/src/wp-content/themes/twentyten/functions.php new file mode 100644 index 0000000..36f5506 --- /dev/null +++ b/src/wp-content/themes/twentyten/functions.php @@ -0,0 +1,508 @@ + + * add_action( 'after_setup_theme', 'my_child_theme_setup' ); + * function my_child_theme_setup() { + * // We are providing our own filter for excerpt_length (or using the unfiltered value) + * remove_filter( 'excerpt_length', 'twentyten_excerpt_length' ); + * ... + * } + * + * + * For more information on hooks, actions, and filters, see http://codex.wordpress.org/Plugin_API. + * + * @package WordPress + * @subpackage Twenty_Ten + * @since Twenty Ten 1.0 + */ + +/** + * Set the content width based on the theme's design and stylesheet. + * + * Used to set the width of images and content. Should be equal to the width the theme + * is designed for, generally via the style.css stylesheet. + */ +if ( ! isset( $content_width ) ) + $content_width = 640; + +/** Tell WordPress to run twentyten_setup() when the 'after_setup_theme' hook is run. */ +add_action( 'after_setup_theme', 'twentyten_setup' ); + +if ( ! function_exists( 'twentyten_setup' ) ): +/** + * Sets up theme defaults and registers support for various WordPress features. + * + * Note that this function is hooked into the after_setup_theme hook, which runs + * before the init hook. The init hook is too late for some features, such as indicating + * support post thumbnails. + * + * To override twentyten_setup() in a child theme, add your own twentyten_setup to your child theme's + * functions.php file. + * + * @uses add_theme_support() To add support for post thumbnails and automatic feed links. + * @uses register_nav_menus() To add support for navigation menus. + * @uses add_custom_background() To add support for a custom background. + * @uses add_editor_style() To style the visual editor. + * @uses load_theme_textdomain() For translation/localization support. + * @uses add_custom_image_header() To add support for a custom header. + * @uses register_default_headers() To register the default custom header images provided with the theme. + * @uses set_post_thumbnail_size() To set a custom post thumbnail size. + * + * @since Twenty Ten 1.0 + */ +function twentyten_setup() { + + // This theme styles the visual editor with editor-style.css to match the theme style. + add_editor_style(); + + // Post Format support. You can also use the legacy "gallery" or "asides" (note the plural) categories. + add_theme_support( 'post-formats', array( 'aside', 'gallery' ) ); + + // This theme uses post thumbnails + add_theme_support( 'post-thumbnails' ); + + // Add default posts and comments RSS feed links to head + add_theme_support( 'automatic-feed-links' ); + + // Make theme available for translation + // Translations can be filed in the /languages/ directory + load_theme_textdomain( 'twentyten', TEMPLATEPATH . '/languages' ); + + $locale = get_locale(); + $locale_file = TEMPLATEPATH . "/languages/$locale.php"; + if ( is_readable( $locale_file ) ) + require_once( $locale_file ); + + // This theme uses wp_nav_menu() in one location. + register_nav_menus( array( + 'primary' => __( 'Primary Navigation', 'twentyten' ), + ) ); + + // This theme allows users to set a custom background + add_custom_background(); + + // Your changeable header business starts here + if ( ! defined( 'HEADER_TEXTCOLOR' ) ) + define( 'HEADER_TEXTCOLOR', '' ); + + // No CSS, just IMG call. The %s is a placeholder for the theme template directory URI. + if ( ! defined( 'HEADER_IMAGE' ) ) + define( 'HEADER_IMAGE', '%s/images/headers/path.jpg' ); + + // The height and width of your custom header. You can hook into the theme's own filters to change these values. + // Add a filter to twentyten_header_image_width and twentyten_header_image_height to change these values. + define( 'HEADER_IMAGE_WIDTH', apply_filters( 'twentyten_header_image_width', 940 ) ); + define( 'HEADER_IMAGE_HEIGHT', apply_filters( 'twentyten_header_image_height', 198 ) ); + + // We'll be using post thumbnails for custom header images on posts and pages. + // We want them to be 940 pixels wide by 198 pixels tall. + // Larger images will be auto-cropped to fit, smaller ones will be ignored. See header.php. + set_post_thumbnail_size( HEADER_IMAGE_WIDTH, HEADER_IMAGE_HEIGHT, true ); + + // Don't support text inside the header image. + if ( ! defined( 'NO_HEADER_TEXT' ) ) + define( 'NO_HEADER_TEXT', true ); + + // Add a way for the custom header to be styled in the admin panel that controls + // custom headers. See twentyten_admin_header_style(), below. + add_custom_image_header( '', 'twentyten_admin_header_style' ); + + // ... and thus ends the changeable header business. + + // Default custom headers packaged with the theme. %s is a placeholder for the theme template directory URI. + register_default_headers( array( + 'berries' => array( + 'url' => '%s/images/headers/berries.jpg', + 'thumbnail_url' => '%s/images/headers/berries-thumbnail.jpg', + /* translators: header image description */ + 'description' => __( 'Berries', 'twentyten' ) + ), + 'cherryblossom' => array( + 'url' => '%s/images/headers/cherryblossoms.jpg', + 'thumbnail_url' => '%s/images/headers/cherryblossoms-thumbnail.jpg', + /* translators: header image description */ + 'description' => __( 'Cherry Blossoms', 'twentyten' ) + ), + 'concave' => array( + 'url' => '%s/images/headers/concave.jpg', + 'thumbnail_url' => '%s/images/headers/concave-thumbnail.jpg', + /* translators: header image description */ + 'description' => __( 'Concave', 'twentyten' ) + ), + 'fern' => array( + 'url' => '%s/images/headers/fern.jpg', + 'thumbnail_url' => '%s/images/headers/fern-thumbnail.jpg', + /* translators: header image description */ + 'description' => __( 'Fern', 'twentyten' ) + ), + 'forestfloor' => array( + 'url' => '%s/images/headers/forestfloor.jpg', + 'thumbnail_url' => '%s/images/headers/forestfloor-thumbnail.jpg', + /* translators: header image description */ + 'description' => __( 'Forest Floor', 'twentyten' ) + ), + 'inkwell' => array( + 'url' => '%s/images/headers/inkwell.jpg', + 'thumbnail_url' => '%s/images/headers/inkwell-thumbnail.jpg', + /* translators: header image description */ + 'description' => __( 'Inkwell', 'twentyten' ) + ), + 'path' => array( + 'url' => '%s/images/headers/path.jpg', + 'thumbnail_url' => '%s/images/headers/path-thumbnail.jpg', + /* translators: header image description */ + 'description' => __( 'Path', 'twentyten' ) + ), + 'sunset' => array( + 'url' => '%s/images/headers/sunset.jpg', + 'thumbnail_url' => '%s/images/headers/sunset-thumbnail.jpg', + /* translators: header image description */ + 'description' => __( 'Sunset', 'twentyten' ) + ) + ) ); +} +endif; + +if ( ! function_exists( 'twentyten_admin_header_style' ) ) : +/** + * Styles the header image displayed on the Appearance > Header admin panel. + * + * Referenced via add_custom_image_header() in twentyten_setup(). + * + * @since Twenty Ten 1.0 + */ +function twentyten_admin_header_style() { +?> + +' . __( 'Continue reading ', 'twentyten' ) . ''; +} + +/** + * Replaces "[...]" (appended to automatically generated excerpts) with an ellipsis and twentyten_continue_reading_link(). + * + * To override this in a child theme, remove the filter and add your own + * function tied to the excerpt_more filter hook. + * + * @since Twenty Ten 1.0 + * @return string An ellipsis + */ +function twentyten_auto_excerpt_more( $more ) { + return ' …' . twentyten_continue_reading_link(); +} +add_filter( 'excerpt_more', 'twentyten_auto_excerpt_more' ); + +/** + * Adds a pretty "Continue Reading" link to custom post excerpts. + * + * To override this link in a child theme, remove the filter and add your own + * function tied to the get_the_excerpt filter hook. + * + * @since Twenty Ten 1.0 + * @return string Excerpt with a pretty "Continue Reading" link + */ +function twentyten_custom_excerpt_more( $output ) { + if ( has_excerpt() && ! is_attachment() ) { + $output .= twentyten_continue_reading_link(); + } + return $output; +} +add_filter( 'get_the_excerpt', 'twentyten_custom_excerpt_more' ); + +/** + * Remove inline styles printed when the gallery shortcode is used. + * + * Galleries are styled by the theme in Twenty Ten's style.css. This is just + * a simple filter call that tells WordPress to not use the default styles. + * + * @since Twenty Ten 1.2 + */ +add_filter( 'use_default_gallery_style', '__return_false' ); + +/** + * Deprecated way to remove inline styles printed when the gallery shortcode is used. + * + * This function is no longer needed or used. Use the use_default_gallery_style + * filter instead, as seen above. + * + * @since Twenty Ten 1.0 + * @deprecated Deprecated in Twenty Ten 1.2 for WordPress 3.1 + * + * @return string The gallery style filter, with the styles themselves removed. + */ +function twentyten_remove_gallery_css( $css ) { + return preg_replace( "##s", '', $css ); +} +// Backwards compatibility with WordPress 3.0. +if ( version_compare( $GLOBALS['wp_version'], '3.1', '<' ) ) + add_filter( 'gallery_style', 'twentyten_remove_gallery_css' ); + +if ( ! function_exists( 'twentyten_comment' ) ) : +/** + * Template for comments and pingbacks. + * + * To override this walker in a child theme without modifying the comments template + * simply create your own twentyten_comment(), and that function will be used instead. + * + * Used as a callback by wp_list_comments() for displaying the comments. + * + * @since Twenty Ten 1.0 + */ +function twentyten_comment( $comment, $args, $depth ) { + $GLOBALS['comment'] = $comment; + switch ( $comment->comment_type ) : + case '' : + ?> +
            • id="li-comment-"> +
              +
              + + says:', 'twentyten' ), sprintf( '%s', get_comment_author_link() ) ); ?> +
              + comment_approved == '0' ) : ?> + +
              + + + + +
              + +
              + $depth, 'max_depth' => $args['max_depth'] ) ) ); ?> +
              +
              + + +
            • +

              + __( 'Primary Widget Area', 'twentyten' ), + 'id' => 'primary-widget-area', + 'description' => __( 'The primary widget area', 'twentyten' ), + 'before_widget' => '
            • ', + 'after_widget' => '
            • ', + 'before_title' => '

              ', + 'after_title' => '

              ', + ) ); + + // Area 2, located below the Primary Widget Area in the sidebar. Empty by default. + register_sidebar( array( + 'name' => __( 'Secondary Widget Area', 'twentyten' ), + 'id' => 'secondary-widget-area', + 'description' => __( 'The secondary widget area', 'twentyten' ), + 'before_widget' => '
            • ', + 'after_widget' => '
            • ', + 'before_title' => '

              ', + 'after_title' => '

              ', + ) ); + + // Area 3, located in the footer. Empty by default. + register_sidebar( array( + 'name' => __( 'First Footer Widget Area', 'twentyten' ), + 'id' => 'first-footer-widget-area', + 'description' => __( 'The first footer widget area', 'twentyten' ), + 'before_widget' => '
            • ', + 'after_widget' => '
            • ', + 'before_title' => '

              ', + 'after_title' => '

              ', + ) ); + + // Area 4, located in the footer. Empty by default. + register_sidebar( array( + 'name' => __( 'Second Footer Widget Area', 'twentyten' ), + 'id' => 'second-footer-widget-area', + 'description' => __( 'The second footer widget area', 'twentyten' ), + 'before_widget' => '
            • ', + 'after_widget' => '
            • ', + 'before_title' => '

              ', + 'after_title' => '

              ', + ) ); + + // Area 5, located in the footer. Empty by default. + register_sidebar( array( + 'name' => __( 'Third Footer Widget Area', 'twentyten' ), + 'id' => 'third-footer-widget-area', + 'description' => __( 'The third footer widget area', 'twentyten' ), + 'before_widget' => '
            • ', + 'after_widget' => '
            • ', + 'before_title' => '

              ', + 'after_title' => '

              ', + ) ); + + // Area 6, located in the footer. Empty by default. + register_sidebar( array( + 'name' => __( 'Fourth Footer Widget Area', 'twentyten' ), + 'id' => 'fourth-footer-widget-area', + 'description' => __( 'The fourth footer widget area', 'twentyten' ), + 'before_widget' => '
            • ', + 'after_widget' => '
            • ', + 'before_title' => '

              ', + 'after_title' => '

              ', + ) ); +} +/** Register sidebars by running twentyten_widgets_init() on the widgets_init hook. */ +add_action( 'widgets_init', 'twentyten_widgets_init' ); + +/** + * Removes the default styles that are packaged with the Recent Comments widget. + * + * To override this in a child theme, remove the filter and optionally add your own + * function tied to the widgets_init action hook. + * + * This function uses a filter (show_recent_comments_widget_style) new in WordPress 3.1 + * to remove the default style. Using Twenty Ten 1.2 in WordPress 3.0 will show the styles, + * but they won't have any effect on the widget in default Twenty Ten styling. + * + * @since Twenty Ten 1.0 + */ +function twentyten_remove_recent_comments_style() { + add_filter( 'show_recent_comments_widget_style', '__return_false' ); +} +add_action( 'widgets_init', 'twentyten_remove_recent_comments_style' ); + +if ( ! function_exists( 'twentyten_posted_on' ) ) : +/** + * Prints HTML with meta information for the current post-date/time and author. + * + * @since Twenty Ten 1.0 + */ +function twentyten_posted_on() { + printf( __( 'Posted on %2$s by %3$s', 'twentyten' ), + 'meta-prep meta-prep-author', + sprintf( '', + get_permalink(), + esc_attr( get_the_time() ), + get_the_date() + ), + sprintf( '%3$s', + get_author_posts_url( get_the_author_meta( 'ID' ) ), + sprintf( esc_attr__( 'View all posts by %s', 'twentyten' ), get_the_author() ), + get_the_author() + ) + ); +} +endif; + +if ( ! function_exists( 'twentyten_posted_in' ) ) : +/** + * Prints HTML with meta information for the current post (category, tags and permalink). + * + * @since Twenty Ten 1.0 + */ +function twentyten_posted_in() { + // Retrieves tag list of current post, separated by commas. + $tag_list = get_the_tag_list( '', ', ' ); + if ( $tag_list ) { + $posted_in = __( 'This entry was posted in %1$s and tagged %2$s. Bookmark the permalink.', 'twentyten' ); + } elseif ( is_object_in_taxonomy( get_post_type(), 'category' ) ) { + $posted_in = __( 'This entry was posted in %1$s. Bookmark the permalink.', 'twentyten' ); + } else { + $posted_in = __( 'Bookmark the permalink.', 'twentyten' ); + } + // Prints the string, replacing the placeholders. + printf( + $posted_in, + get_the_category_list( ', ' ), + $tag_list, + get_permalink(), + the_title_attribute( 'echo=0' ) + ); +} +endif; diff --git a/src/wp-content/themes/twentyten/header.php b/src/wp-content/themes/twentyten/header.php new file mode 100644 index 0000000..54971c9 --- /dev/null +++ b/src/wp-content/themes/twentyten/header.php @@ -0,0 +1,90 @@ + section and everything up till
              + * + * @package WordPress + * @subpackage Twenty_Ten + * @since Twenty Ten 1.0 + */ +?> +> + + +<?php + /* + * Print the <title> tag based on what is being viewed. + */ + global $page, $paged; + + wp_title( '|', true, 'right' ); + + // Add the blog name. + bloginfo( 'name' ); + + // Add the blog description for the home/front page. + $site_description = get_bloginfo( 'description', 'display' ); + if ( $site_description && ( is_home() || is_front_page() ) ) + echo " | $site_description"; + + // Add a page number if necessary: + if ( $paged >= 2 || $page >= 2 ) + echo ' | ' . sprintf( __( 'Page %s', 'twentyten' ), max( $paged, $page ) ); + + ?> + + + + + * tag of your theme, or you will break many plugins, which + * generally use this hook to add elements to such + * as styles, scripts, and meta tags. + */ + wp_head(); +?> + + +> +
              + + +
              diff --git a/src/wp-content/themes/twentyten/images/headers/berries-thumbnail.jpg b/src/wp-content/themes/twentyten/images/headers/berries-thumbnail.jpg new file mode 100644 index 0000000..6e684f4 Binary files /dev/null and b/src/wp-content/themes/twentyten/images/headers/berries-thumbnail.jpg differ diff --git a/src/wp-content/themes/twentyten/images/headers/berries.jpg b/src/wp-content/themes/twentyten/images/headers/berries.jpg new file mode 100644 index 0000000..3031a05 Binary files /dev/null and b/src/wp-content/themes/twentyten/images/headers/berries.jpg differ diff --git a/src/wp-content/themes/twentyten/images/headers/cherryblossoms-thumbnail.jpg b/src/wp-content/themes/twentyten/images/headers/cherryblossoms-thumbnail.jpg new file mode 100644 index 0000000..710049a Binary files /dev/null and b/src/wp-content/themes/twentyten/images/headers/cherryblossoms-thumbnail.jpg differ diff --git a/src/wp-content/themes/twentyten/images/headers/cherryblossoms.jpg b/src/wp-content/themes/twentyten/images/headers/cherryblossoms.jpg new file mode 100644 index 0000000..56e9df0 Binary files /dev/null and b/src/wp-content/themes/twentyten/images/headers/cherryblossoms.jpg differ diff --git a/src/wp-content/themes/twentyten/images/headers/concave-thumbnail.jpg b/src/wp-content/themes/twentyten/images/headers/concave-thumbnail.jpg new file mode 100644 index 0000000..b271867 Binary files /dev/null and b/src/wp-content/themes/twentyten/images/headers/concave-thumbnail.jpg differ diff --git a/src/wp-content/themes/twentyten/images/headers/concave.jpg b/src/wp-content/themes/twentyten/images/headers/concave.jpg new file mode 100644 index 0000000..9970de2 Binary files /dev/null and b/src/wp-content/themes/twentyten/images/headers/concave.jpg differ diff --git a/src/wp-content/themes/twentyten/images/headers/fern-thumbnail.jpg b/src/wp-content/themes/twentyten/images/headers/fern-thumbnail.jpg new file mode 100644 index 0000000..c6113ab Binary files /dev/null and b/src/wp-content/themes/twentyten/images/headers/fern-thumbnail.jpg differ diff --git a/src/wp-content/themes/twentyten/images/headers/fern.jpg b/src/wp-content/themes/twentyten/images/headers/fern.jpg new file mode 100644 index 0000000..fc0b394 Binary files /dev/null and b/src/wp-content/themes/twentyten/images/headers/fern.jpg differ diff --git a/src/wp-content/themes/twentyten/images/headers/forestfloor-thumbnail.jpg b/src/wp-content/themes/twentyten/images/headers/forestfloor-thumbnail.jpg new file mode 100644 index 0000000..b888fc3 Binary files /dev/null and b/src/wp-content/themes/twentyten/images/headers/forestfloor-thumbnail.jpg differ diff --git a/src/wp-content/themes/twentyten/images/headers/forestfloor.jpg b/src/wp-content/themes/twentyten/images/headers/forestfloor.jpg new file mode 100644 index 0000000..4533948 Binary files /dev/null and b/src/wp-content/themes/twentyten/images/headers/forestfloor.jpg differ diff --git a/src/wp-content/themes/twentyten/images/headers/inkwell-thumbnail.jpg b/src/wp-content/themes/twentyten/images/headers/inkwell-thumbnail.jpg new file mode 100644 index 0000000..61e775e Binary files /dev/null and b/src/wp-content/themes/twentyten/images/headers/inkwell-thumbnail.jpg differ diff --git a/src/wp-content/themes/twentyten/images/headers/inkwell.jpg b/src/wp-content/themes/twentyten/images/headers/inkwell.jpg new file mode 100644 index 0000000..82b0b7d Binary files /dev/null and b/src/wp-content/themes/twentyten/images/headers/inkwell.jpg differ diff --git a/src/wp-content/themes/twentyten/images/headers/path-thumbnail.jpg b/src/wp-content/themes/twentyten/images/headers/path-thumbnail.jpg new file mode 100644 index 0000000..0585ec4 Binary files /dev/null and b/src/wp-content/themes/twentyten/images/headers/path-thumbnail.jpg differ diff --git a/src/wp-content/themes/twentyten/images/headers/path.jpg b/src/wp-content/themes/twentyten/images/headers/path.jpg new file mode 100644 index 0000000..d869497 Binary files /dev/null and b/src/wp-content/themes/twentyten/images/headers/path.jpg differ diff --git a/src/wp-content/themes/twentyten/images/headers/sunset-thumbnail.jpg b/src/wp-content/themes/twentyten/images/headers/sunset-thumbnail.jpg new file mode 100644 index 0000000..416c11a Binary files /dev/null and b/src/wp-content/themes/twentyten/images/headers/sunset-thumbnail.jpg differ diff --git a/src/wp-content/themes/twentyten/images/headers/sunset.jpg b/src/wp-content/themes/twentyten/images/headers/sunset.jpg new file mode 100644 index 0000000..66eddaa Binary files /dev/null and b/src/wp-content/themes/twentyten/images/headers/sunset.jpg differ diff --git a/src/wp-content/themes/twentyten/images/wordpress.png b/src/wp-content/themes/twentyten/images/wordpress.png new file mode 100644 index 0000000..224f7c8 Binary files /dev/null and b/src/wp-content/themes/twentyten/images/wordpress.png differ diff --git a/src/wp-content/themes/twentyten/index.php b/src/wp-content/themes/twentyten/index.php new file mode 100644 index 0000000..7bc3fd4 --- /dev/null +++ b/src/wp-content/themes/twentyten/index.php @@ -0,0 +1,32 @@ + + +
              +
              + + +
              +
              + + + diff --git a/src/wp-content/themes/twentyten/languages/es_ES.mo b/src/wp-content/themes/twentyten/languages/es_ES.mo new file mode 100644 index 0000000..cbe868b Binary files /dev/null and b/src/wp-content/themes/twentyten/languages/es_ES.mo differ diff --git a/src/wp-content/themes/twentyten/languages/es_ES.po b/src/wp-content/themes/twentyten/languages/es_ES.po new file mode 100644 index 0000000..392f37d --- /dev/null +++ b/src/wp-content/themes/twentyten/languages/es_ES.po @@ -0,0 +1,364 @@ +# Translation of Twenty Ten in Spanish (Spain) +# This file is distributed under the same license as the Twenty Ten package. +msgid "" +msgstr "" +"PO-Revision-Date: 2011-07-05 06:00:17+0000\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: GlotPress/0.1\n" +"Project-Id-Version: Twenty Ten\n" + +#: loop.php:82 +msgid "This gallery contains %2$s photo." +msgid_plural "This gallery contains %2$s photos." +msgstr[0] "Esta galería contiene %2$s foto " +msgstr[1] "Esta galería contiene %2$s fotos " + +#: loop.php:93 +msgid "View Galleries" +msgstr "Ver galerías" + +msgid "black, blue, white, two-columns, fixed-width, custom-header, custom-background, threaded-comments, sticky-post, translation-ready, microformats, rtl-language-support, editor-style, custom-menu" +msgstr "negro, azul, blanco, dos-columnas, ancho-fijo, cabecera-personalizada, fondo-personalizado, comentarios-anidados, entrada-fija, microformatos, soporte-idiomas-rtl, editor-estilos, menú-personalizado" + +msgid "The 2010 theme for WordPress is stylish, customizable, simple, and readable -- make it yours with a custom menu, header image, and background. Twenty Ten supports six widgetized areas (two in the sidebar, four in the footer) and featured images (thumbnails for gallery posts and custom header images for posts and pages). It includes stylesheets for print and the admin Visual Editor, special styles for posts in the \"Asides\" and \"Gallery\" categories, and has an optional one-column page template that removes the sidebar." +msgstr "El tema 2010 para WordPress, es elegante, personalizable, sencillo y legible -- hazlo tuyo con un menú, una imagen de cabecera, y un fondo personalizados. Twenty Ten soporta seis áreas para widgets (dos en la barra lateral, cuatro en el pie de página) e imágenes destacadas (miniaturas para las entradas de la galería e imágenes de cabecera personalizadas para las entradas y páginas). Incluye hojas de estilo para impresión y el editor visual del administrador, estilos especiales para las entradas de las categorías \"Citas\" y \"Galería\", y tiene una plantilla opcional de página de una columna que quita la barra lateral." + +#: loop.php:151 +msgid "Posted in %2$s" +msgstr "Publicado en %2$s" + +#: functions.php:467 +msgid "Posted on %2$s by %3$s" +msgstr "Publicado el %2$s por %3$s" + +#: loop.php:160 +msgid "Tagged %2$s" +msgstr "Etiquetado %2$s" + +#: functions.php:497 +msgid "Bookmark the permalink." +msgstr "Guarda el enlace permanente." + +#: loop-single.php:47 +msgid "View all posts by %s " +msgstr "Ver todas las entradas por %s " + +#: comments.php:41 comments.php:60 +msgid " Older Comments" +msgstr " Comentarios antiguos" + +#: loop-attachment.php:23 +msgid " %s" +msgstr " %s" + +#: comments.php:42 comments.php:61 +msgid "Newer Comments " +msgstr "Comentarios nuevos " + +#: functions.php:100 +msgid "Primary Navigation" +msgstr "Navegación primaria" + +#: loop.php:35 +msgid "Apologies, but no results were found for the requested archive. Perhaps searching will help find a related post." +msgstr "Lo sentimos, pero no hay resultados para el archivo solicitado. Puede que la búsqueda te ayude a encontrar una entrada relacionada." + +#: functions.php:330 +msgid "%s says:" +msgstr "%s dijo:" + +#: loop-attachment.php:32 +msgid "By %2$s" +msgstr "Por %2$s" + +#: loop-attachment.php:43 +msgid "Published %2$s" +msgstr "Publicado %2$s" + +#: loop-attachment.php:53 +msgid "Full size is %s pixels" +msgstr "El tamaño completo es de %s pixels" + +#: loop-attachment.php:56 +msgid "Link to full-size image" +msgstr "Enlace a la imagen completa" + +#: author.php:27 +msgid "Author Archives: %s" +msgstr "Archivo del Autor: %s" + +#: footer.php:33 +msgid "Proudly powered by %s." +msgstr "Funciona con %s." + +#: functions.php:357 +msgid "Pingback:" +msgstr "Pingback: " + +#: functions.php:493 +msgid "This entry was posted in %1$s and tagged %2$s. Bookmark the permalink." +msgstr "Esta entrada fue publicada en %1$s y etiquetada %2$s. Guarda el enlace permanente." + +#: functions.php:495 +msgid "This entry was posted in %1$s. Bookmark the permalink." +msgstr "Esta entrada fue publicada en %1$s. Guarda el enlace permanente." + +#: comments.php:35 +msgid "One Response to %2$s" +msgid_plural "%1$s Responses to %2$s" +msgstr[0] "Una respuesta a %2$s" +msgstr[1] "%1$s respuestas a %2$s" + +#: loop.php:106 +msgctxt "asides category slug" +msgid "asides" +msgstr "citas" + +#: loop.php:60 loop.php:95 loop.php:96 +msgctxt "gallery category slug" +msgid "gallery" +msgstr "galería" + +#: functions.php:409 +msgid "Second Footer Widget Area" +msgstr "Segunda área de widgets del pie" + +#: functions.php:398 +msgid "First Footer Widget Area" +msgstr "Primera área de widgets del pie" + +#: functions.php:376 +msgid "Primary Widget Area" +msgstr "Área primaria de widgets" + +#: functions.php:387 +msgid "Secondary Widget Area" +msgstr "Área secundaria de widgets" + +#: functions.php:431 +msgid "Fourth Footer Widget Area" +msgstr "Cuarta área de widgets del pie" + +#: functions.php:420 +msgid "Third Footer Widget Area" +msgstr "Tercera área de widgets del pie" + +#: loop-single.php:22 loop-single.php:62 +msgctxt "Next post link" +msgid "→" +msgstr "→" + +#: loop-single.php:21 loop-single.php:61 +msgctxt "Previous post link" +msgid "←" +msgstr "←" + +#: functions.php:340 functions.php:357 +msgid "(Edit)" +msgstr "(Editar)" + +#: comments.php:72 +msgid "Comments are closed." +msgstr "Los comentarios están cerrados." + +#: loop.php:99 loop.php:122 loop.php:164 +msgid "% Comments" +msgstr "% comentarios" + +#: sidebar.php:34 +msgid "Meta" +msgstr "Meta" + +#: sidebar.php:27 +msgid "Archives" +msgstr "Archivos" + +#: functions.php:333 +msgid "Your comment is awaiting moderation." +msgstr "Tu comentario está pendiente de moderación." + +#: functions.php:340 +msgid "%1$s at %2$s" +msgstr "%1$s en %2$s" + +#: functions.php:182 +msgid "Sunset" +msgstr "Puesta del sol" + +#: functions.php:176 +msgid "Path" +msgstr "Camino" + +#: functions.php:170 +msgid "Inkwell" +msgstr "Tintero" + +#: functions.php:164 +msgid "Forest Floor" +msgstr "Suelo forestal" + +#: functions.php:158 +msgid "Fern" +msgstr "Helecho" + +#: functions.php:152 +msgid "Concave" +msgstr "Cóncavo" + +#: functions.php:146 +msgid "Cherry Blossoms" +msgstr "Cerezos en flor" + +#: functions.php:140 +msgid "Berries" +msgstr "Bayas" + +#: footer.php:33 +msgid "Semantic Personal Publishing Platform" +msgstr "Plataforma semántica de publicación personal" + +#: header.php:33 +msgid "Page %s" +msgstr "Página %s" + +#: loop.php:99 loop.php:122 loop.php:164 +msgid "1 Comment" +msgstr "1 comentario" + +#: loop.php:99 loop.php:122 loop.php:164 +msgid "Leave a comment" +msgstr "Deja un comentario" + +#: loop.php:93 loop.php:96 +msgid "More Galleries" +msgstr "Más galerías" + +#: loop.php:96 +msgid "View posts in the Gallery category" +msgstr "Ver las entradas en la categoría de la galería" + +#: loop.php:62 loop.php:83 loop.php:131 +msgid "Permalink to %s" +msgstr "Enlace permanente a %s" + +#: loop.php:26 loop.php:179 +msgid "Newer posts " +msgstr "Entradas más nuevas " + +#: loop.php:25 loop.php:178 +msgid " Older posts" +msgstr " Entradas más antiguas" + +#: header.php:83 +msgid "Skip to content" +msgstr "Saltar al contenido" + +#: functions.php:433 +msgid "The fourth footer widget area" +msgstr "Cuarta área de widgets del pie" + +#: functions.php:422 +msgid "The third footer widget area" +msgstr "Tercera área de widgets del pie" + +#: functions.php:411 +msgid "The second footer widget area" +msgstr "Segunda área de widgets del pie" + +#: functions.php:400 +msgid "The first footer widget area" +msgstr "Primera área de widgets del pie" + +#: functions.php:389 +msgid "The secondary widget area" +msgstr "Área secundaria de widgets" + +#: functions.php:378 +msgid "The primary widget area" +msgstr "Área primaria de widgets" + +#: comments.php:18 +msgid "This post is password protected. Enter the password to view any comments." +msgstr "Esta entrada está protegida. Introduce la contraseña para ver los comentarios." + +#: category.php:16 +msgid "Category Archives: %s" +msgstr "Archivo de la categoría: %s" + +#: author.php:37 loop-single.php:43 +msgid "About %s" +msgstr "Acerca de %s" + +#: 404.php:16 loop.php:33 +msgid "Not Found" +msgstr "No encontrado" + +#: 404.php:18 +msgid "Apologies, but the page you requested could not be found. Perhaps searching will help." +msgstr "Lo sentimos, pero no podemos encontrar lo que estás buscando. Quizás la búsqueda te ayudará." + +#: archive.php:33 +msgid "Daily Archives: %s" +msgstr "Archivo diario: %s" + +#: archive.php:35 +msgid "Monthly Archives: %s" +msgstr "Archivo mensual: %s" + +#: archive.php:37 +msgid "Yearly Archives: %s" +msgstr "Archivo anual: %s" + +#: archive.php:39 +msgid "Blog Archives" +msgstr "Archivo del sitio" + +#: loop-attachment.php:21 +msgid "Return to %s" +msgstr "Volver a %s" + +#: loop-attachment.php:36 functions.php:476 +msgid "View all posts by %s" +msgstr "Ver todas las entradas de %s" + +#: loop-attachment.php:63 loop-attachment.php:111 loop.php:100 loop.php:123 +#: loop.php:165 loop-page.php:30 loop-single.php:56 +msgid "Edit" +msgstr "Editar" + +#: loop-attachment.php:104 loop.php:115 loop.php:143 functions.php:248 +msgid "Continue reading " +msgstr "Sigue leyendo " + +#: loop-attachment.php:105 loop.php:144 loop-page.php:29 loop-single.php:34 +msgid "Pages:" +msgstr "Páginas:" + +#: tag.php:16 +msgid "Tag Archives: %s" +msgstr "Archivo de la etiqueta: %s" + +msgid "Twenty Ten" +msgstr "Twenty Ten" + +#: footer.php:33 +msgid "http://wordpress.org/" +msgstr "http://es.wordpress.org/" + +msgid "the WordPress team" +msgstr "el equipo de WordPress" + +#: search.php:16 +msgid "Search Results for: %s" +msgstr "Resultados de la búsqueda para: %s" + +#: search.php:26 +msgid "Nothing Found" +msgstr "No se ha encontrado nada" + +#: search.php:28 +msgid "Sorry, but nothing matched your search criteria. Please try again with some different keywords." +msgstr "Lo sentimos, pero nada coincide con tus búsqueda. Por favor, prueba de nuevo con diferentes palabras clave." \ No newline at end of file diff --git a/src/wp-content/themes/twentyten/languages/twentyten.pot b/src/wp-content/themes/twentyten/languages/twentyten.pot new file mode 100644 index 0000000..1384ef1 --- /dev/null +++ b/src/wp-content/themes/twentyten/languages/twentyten.pot @@ -0,0 +1,408 @@ +# Copyright (C) 2010 Twenty Ten +# This file is distributed under the same license as the Twenty Ten package. +msgid "" +msgstr "" +"Project-Id-Version: Twenty Ten 1.2\n" +"Report-Msgid-Bugs-To: http://wordpress.org/tag/twentyten\n" +"POT-Creation-Date: 2011-06-13 13:27:43+00:00\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"PO-Revision-Date: 2010-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" + +#: loop-attachment.php:21 +msgid "Return to %s" +msgstr "" + +#. translators: %s - title of parent post +#: loop-attachment.php:23 +msgid " %s" +msgstr "" + +#: loop-attachment.php:32 +msgid "By %2$s" +msgstr "" + +#: loop-attachment.php:36 functions.php:476 +msgid "View all posts by %s" +msgstr "" + +#: loop-attachment.php:43 +msgid "Published %2$s" +msgstr "" + +#: loop-attachment.php:53 +msgid "Full size is %s pixels" +msgstr "" + +#: loop-attachment.php:56 +msgid "Link to full-size image" +msgstr "" + +#: loop-attachment.php:63 loop-attachment.php:111 loop.php:100 loop.php:123 +#: loop.php:165 loop-page.php:30 loop-single.php:56 +msgid "Edit" +msgstr "" + +#: loop-attachment.php:104 loop.php:115 loop.php:143 functions.php:248 +msgid "Continue reading " +msgstr "" + +#: loop-attachment.php:105 loop.php:144 loop-page.php:29 loop-single.php:34 +msgid "Pages:" +msgstr "" + +#. #-#-#-#-# twentyten.pot (Twenty Ten 1.2) #-#-#-#-# +#. Theme URI of the plugin/theme +#: footer.php:33 +msgid "http://wordpress.org/" +msgstr "" + +#: footer.php:33 +msgid "Semantic Personal Publishing Platform" +msgstr "" + +#: footer.php:33 +msgid "Proudly powered by %s." +msgstr "" + +#: category.php:16 +msgid "Category Archives: %s" +msgstr "" + +#: sidebar.php:27 +msgid "Archives" +msgstr "" + +#: sidebar.php:34 +msgid "Meta" +msgstr "" + +#: tag.php:16 +msgid "Tag Archives: %s" +msgstr "" + +#: comments.php:18 +msgid "" +"This post is password protected. Enter the password to view any comments." +msgstr "" + +#: comments.php:35 +msgid "One Response to %2$s" +msgid_plural "%1$s Responses to %2$s" +msgstr[0] "" +msgstr[1] "" + +#: comments.php:41 comments.php:60 +msgid " Older Comments" +msgstr "" + +#: comments.php:42 comments.php:61 +msgid "Newer Comments " +msgstr "" + +#: comments.php:72 +msgid "Comments are closed." +msgstr "" + +#: 404.php:16 loop.php:33 +msgid "Not Found" +msgstr "" + +#: 404.php:18 +msgid "" +"Apologies, but the page you requested could not be found. Perhaps searching " +"will help." +msgstr "" + +#: loop.php:25 loop.php:178 +msgid " Older posts" +msgstr "" + +#: loop.php:26 loop.php:179 +msgid "Newer posts " +msgstr "" + +#: loop.php:35 +msgid "" +"Apologies, but no results were found for the requested archive. Perhaps " +"searching will help find a related post." +msgstr "" + +#: loop.php:60 loop.php:95 loop.php:96 +msgctxt "gallery category slug" +msgid "gallery" +msgstr "" + +#: loop.php:62 loop.php:83 loop.php:131 +msgid "Permalink to %s" +msgstr "" + +#: loop.php:82 +msgid "This gallery contains %2$s photo." +msgid_plural "This gallery contains %2$s photos." +msgstr[0] "" +msgstr[1] "" + +#: loop.php:93 +msgid "View Galleries" +msgstr "" + +#: loop.php:93 loop.php:96 +msgid "More Galleries" +msgstr "" + +#: loop.php:96 +msgid "View posts in the Gallery category" +msgstr "" + +#: loop.php:99 loop.php:122 loop.php:164 +msgid "Leave a comment" +msgstr "" + +#: loop.php:99 loop.php:122 loop.php:164 +msgid "1 Comment" +msgstr "" + +#: loop.php:99 loop.php:122 loop.php:164 +msgid "% Comments" +msgstr "" + +#: loop.php:106 +msgctxt "asides category slug" +msgid "asides" +msgstr "" + +#: loop.php:151 +msgid "Posted in %2$s" +msgstr "" + +#: loop.php:160 +msgid "Tagged %2$s" +msgstr "" + +#: functions.php:100 +msgid "Primary Navigation" +msgstr "" + +#. translators: header image description +#: functions.php:140 +msgid "Berries" +msgstr "" + +#. translators: header image description +#: functions.php:146 +msgid "Cherry Blossoms" +msgstr "" + +#. translators: header image description +#: functions.php:152 +msgid "Concave" +msgstr "" + +#. translators: header image description +#: functions.php:158 +msgid "Fern" +msgstr "" + +#. translators: header image description +#: functions.php:164 +msgid "Forest Floor" +msgstr "" + +#. translators: header image description +#: functions.php:170 +msgid "Inkwell" +msgstr "" + +#. translators: header image description +#: functions.php:176 +msgid "Path" +msgstr "" + +#. translators: header image description +#: functions.php:182 +msgid "Sunset" +msgstr "" + +#: functions.php:330 +msgid "%s says:" +msgstr "" + +#: functions.php:333 +msgid "Your comment is awaiting moderation." +msgstr "" + +#. translators: 1: date, 2: time +#: functions.php:340 +msgid "%1$s at %2$s" +msgstr "" + +#: functions.php:340 functions.php:357 +msgid "(Edit)" +msgstr "" + +#: functions.php:357 +msgid "Pingback:" +msgstr "" + +#: functions.php:376 +msgid "Primary Widget Area" +msgstr "" + +#: functions.php:378 +msgid "The primary widget area" +msgstr "" + +#: functions.php:387 +msgid "Secondary Widget Area" +msgstr "" + +#: functions.php:389 +msgid "The secondary widget area" +msgstr "" + +#: functions.php:398 +msgid "First Footer Widget Area" +msgstr "" + +#: functions.php:400 +msgid "The first footer widget area" +msgstr "" + +#: functions.php:409 +msgid "Second Footer Widget Area" +msgstr "" + +#: functions.php:411 +msgid "The second footer widget area" +msgstr "" + +#: functions.php:420 +msgid "Third Footer Widget Area" +msgstr "" + +#: functions.php:422 +msgid "The third footer widget area" +msgstr "" + +#: functions.php:431 +msgid "Fourth Footer Widget Area" +msgstr "" + +#: functions.php:433 +msgid "The fourth footer widget area" +msgstr "" + +#: functions.php:467 +msgid "" +"Posted on %2$s by %3$s" +msgstr "" + +#: functions.php:493 +msgid "" +"This entry was posted in %1$s and tagged %2$s. Bookmark the permalink." +msgstr "" + +#: functions.php:495 +msgid "" +"This entry was posted in %1$s. Bookmark the permalink." +msgstr "" + +#: functions.php:497 +msgid "" +"Bookmark the permalink." +msgstr "" + +#: header.php:33 +msgid "Page %s" +msgstr "" + +#: header.php:83 +msgid "Skip to content" +msgstr "" + +#: author.php:27 +msgid "Author Archives: %s" +msgstr "" + +#: author.php:37 loop-single.php:43 +msgid "About %s" +msgstr "" + +#: search.php:16 +msgid "Search Results for: %s" +msgstr "" + +#: search.php:26 +msgid "Nothing Found" +msgstr "" + +#: search.php:28 +msgid "" +"Sorry, but nothing matched your search criteria. Please try again with some " +"different keywords." +msgstr "" + +#: loop-single.php:21 loop-single.php:61 +msgctxt "Previous post link" +msgid "←" +msgstr "" + +#: loop-single.php:22 loop-single.php:62 +msgctxt "Next post link" +msgid "→" +msgstr "" + +#: loop-single.php:47 +msgid "View all posts by %s " +msgstr "" + +#: archive.php:33 +msgid "Daily Archives: %s" +msgstr "" + +#: archive.php:35 +msgid "Monthly Archives: %s" +msgstr "" + +#: archive.php:37 +msgid "Yearly Archives: %s" +msgstr "" + +#: archive.php:39 +msgid "Blog Archives" +msgstr "" + +#. Theme Name of the plugin/theme +msgid "Twenty Ten" +msgstr "" + +#. Description of the plugin/theme +msgid "" +"The 2010 theme for WordPress is stylish, customizable, simple, and readable " +"-- make it yours with a custom menu, header image, and background. Twenty " +"Ten supports six widgetized areas (two in the sidebar, four in the footer) " +"and featured images (thumbnails for gallery posts and custom header images " +"for posts and pages). It includes stylesheets for print and the admin Visual " +"Editor, special styles for posts in the \"Asides\" and \"Gallery\" " +"categories, and has an optional one-column page template that removes the " +"sidebar." +msgstr "" + +#. Author of the plugin/theme +msgid "the WordPress team" +msgstr "" + +#. Tags of the plugin/theme +msgid "" +"black, blue, white, two-columns, fixed-width, custom-header, custom-" +"background, threaded-comments, sticky-post, translation-ready, microformats, " +"rtl-language-support, editor-style, custom-menu" +msgstr "" diff --git a/src/wp-content/themes/twentyten/license.txt b/src/wp-content/themes/twentyten/license.txt new file mode 100644 index 0000000..5fbe4a7 --- /dev/null +++ b/src/wp-content/themes/twentyten/license.txt @@ -0,0 +1,281 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 51 Franklin St, Fifth Floor, Boston, MA 02110, 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 + diff --git a/src/wp-content/themes/twentyten/loop-attachment.php b/src/wp-content/themes/twentyten/loop-attachment.php new file mode 100644 index 0000000..7368200 --- /dev/null +++ b/src/wp-content/themes/twentyten/loop-attachment.php @@ -0,0 +1,117 @@ + + + + + post_parent ) ) : ?> +

              ← %s', 'twentyten' ), get_the_title( $post->post_parent ) ); + ?>

              + + +
              > +

              + + + +
              +
              + $post->post_parent, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => 'menu_order ID' ) ) ); + foreach ( $attachments as $k => $attachment ) { + if ( $attachment->ID == $post->ID ) + break; + } + $k++; + // If there is more than 1 image attachment in a gallery + if ( count( $attachments ) > 1 ) { + if ( isset( $attachments[ $k ] ) ) + // get the URL of the next image attachment + $next_attachment_url = get_attachment_link( $attachments[ $k ]->ID ); + else + // or get the URL of the first image attachment + $next_attachment_url = get_attachment_link( $attachments[ 0 ]->ID ); + } else { + // or, if there's only 1 image attachment, get the URL of the image + $next_attachment_url = wp_get_attachment_url(); + } +?> +

              ID, array( $attachment_width, $attachment_height ) ); // filterable image width with, essentially, no limit for image height. + ?>

              + + + + + +
              +
              post_excerpt ) ) the_excerpt(); ?>
              + +→', 'twentyten' ) ); ?> + '' ) ); ?> + +
              + +
              + + ', '' ); ?> +
              +
              + + + + \ No newline at end of file diff --git a/src/wp-content/themes/twentyten/loop-page.php b/src/wp-content/themes/twentyten/loop-page.php new file mode 100644 index 0000000..252a1d0 --- /dev/null +++ b/src/wp-content/themes/twentyten/loop-page.php @@ -0,0 +1,36 @@ + + + + +
              > + +

              + +

              + + +
              + + '' ) ); ?> + ', '' ); ?> +
              +
              + + + + \ No newline at end of file diff --git a/src/wp-content/themes/twentyten/loop-single.php b/src/wp-content/themes/twentyten/loop-single.php new file mode 100644 index 0000000..c12d47b --- /dev/null +++ b/src/wp-content/themes/twentyten/loop-single.php @@ -0,0 +1,67 @@ + + + + + + +
              > +

              + + + +
              + + '' ) ); ?> +
              + + +
              +
              + +
              + +
              + + +
              + + ', '' ); ?> +
              +
              + + + + + + \ No newline at end of file diff --git a/src/wp-content/themes/twentyten/loop.php b/src/wp-content/themes/twentyten/loop.php new file mode 100644 index 0000000..9dc6297 --- /dev/null +++ b/src/wp-content/themes/twentyten/loop.php @@ -0,0 +1,181 @@ +get_template_part( 'loop', 'index' ); + * + * @package WordPress + * @subpackage Twenty_Ten + * @since Twenty Ten 1.0 + */ +?> + + +max_num_pages > 1 ) : ?> + + + + + +
              +

              +
              +

              + +
              +
              + + + + + + + + ID ) ) || in_category( _x( 'gallery', 'gallery category slug', 'twentyten' ) ) ) : ?> +
              > +

              + + + +
              + + + + $post->ID, 'post_type' => 'attachment', 'post_mime_type' => 'image', 'orderby' => 'menu_order', 'order' => 'ASC', 'numberposts' => 999 ) ); + if ( $images ) : + $total_images = count( $images ); + $image = array_shift( $images ); + $image_img_tag = wp_get_attachment_image( $image->ID, 'thumbnail' ); + ?> + +

              %2$s photo.', 'This gallery contains %2$s photos.', $total_images, 'twentyten' ), + 'href="' . get_permalink() . '" title="' . sprintf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ) . '" rel="bookmark"', + number_format_i18n( $total_images ) + ); ?>

              + + + +
              + +
              + ID ) ) : ?> + + | + + + | + + + | ', '' ); ?> +
              +
              + + + + ID ) ) || in_category( _x( 'asides', 'asides category slug', 'twentyten' ) ) ) : ?> +
              > + + +
              + +
              + +
              + →', 'twentyten' ) ); ?> +
              + + +
              + + | + + | ', '' ); ?> +
              +
              + + + + +
              > +

              + + + + +
              + +
              + +
              + →', 'twentyten' ) ); ?> + '' ) ); ?> +
              + + +
              + + + Posted in %2$s', 'twentyten' ), 'entry-utility-prep entry-utility-prep-cat-links', get_the_category_list( ', ' ) ); ?> + + | + + + + Tagged %2$s', 'twentyten' ), 'entry-utility-prep entry-utility-prep-tag-links', $tags_list ); ?> + + | + + + | ', '' ); ?> +
              +
              + + + + + + + + +max_num_pages > 1 ) : ?> + + diff --git a/src/wp-content/themes/twentyten/onecolumn-page.php b/src/wp-content/themes/twentyten/onecolumn-page.php new file mode 100644 index 0000000..1a8d5b7 --- /dev/null +++ b/src/wp-content/themes/twentyten/onecolumn-page.php @@ -0,0 +1,31 @@ + + +
              +
              + + + +
              +
              + + diff --git a/src/wp-content/themes/twentyten/page.php b/src/wp-content/themes/twentyten/page.php new file mode 100644 index 0000000..1a55042 --- /dev/null +++ b/src/wp-content/themes/twentyten/page.php @@ -0,0 +1,32 @@ + + +
              +
              + + + +
              +
              + + + diff --git a/src/wp-content/themes/twentyten/rtl.css b/src/wp-content/themes/twentyten/rtl.css new file mode 100644 index 0000000..339e6e5 --- /dev/null +++ b/src/wp-content/themes/twentyten/rtl.css @@ -0,0 +1,285 @@ +/* +Theme Name: Twenty Ten +*/ + + +/* +RTL Basics +*/ + + +body { + direction:rtl; + unicode-bidi:embed; +} + + +/* +LAYOUT: Two-Column (Right) +DESCRIPTION: Two-column fixed layout with one sidebar right of content +*/ + +#container { + float: right; + margin: 0 0 0 -240px; +} +#content { + margin: 0 20px 36px 280px; +} +#primary, +#secondary { + float: left; +} +#secondary { + clear: left; +} + + +/* =Fonts +-------------------------------------------------------------- */ +body, +input, +textarea, +.page-title span, +.pingback a.url, +h3#comments-title, +h3#reply-title, +#access .menu, +#access div.menu ul, +#cancel-comment-reply-link, +.form-allowed-tags, +#site-info, +#site-title, +#wp-calendar, +.comment-meta, +.comment-body tr th, +.comment-body thead th, +.entry-content label, +.entry-content tr th, +.entry-content thead th, +.entry-meta, +.entry-title, +.entry-utility, +#respond label, +.navigation, +.page-title, +.pingback p, +.reply, +.widget-title, +input[type=submit] { + font-family: Arial, Tahoma, sans-serif; +} + +/* =Structure +-------------------------------------------------------------- */ + +/* The main theme structure */ +#footer-widget-area .widget-area { + float: right; + margin-left: 20px; + margin-right: 0; +} +#footer-widget-area #fourth { + margin-left: 0; +} +#site-info { + float: right; +} +#site-generator { + float: left; +} + + +/* =Global Elements +-------------------------------------------------------------- */ + +/* Text elements */ +ul, ol { + margin: 0 1.5em 18px 0; +} +blockquote { + font-style: normal; +} + +/* Text meant only for screen readers */ +.screen-reader-text { + left: auto; + text-indent:-9000px; + overflow:hidden; +} + + +/* =Header +-------------------------------------------------------------- */ + +#site-title { + float: right; +} +#site-description { + clear: left; + float: left; + font-style: normal; +} +#branding img { + float: right; +} + +/* =Menu +-------------------------------------------------------------- */ + +#access { + float:right; +} + +#access .menu-header, +div.menu { + margin-right: 12px; + margin-left: 0; +} + +#access .menu-header li, +div.menu li{ + float:right; +} + +#access ul ul { + left:auto; + right:0; + float:right; +} +#access ul ul ul { + left:auto; + right:100%; +} + +/* =Content +-------------------------------------------------------------- */ + +#content table { + text-align: right; + margin: 0 0 24px -1px; +} +.page-title span { + font-style:normal; +} +.entry-title, +.entry-meta { + clear: right; + float: right; + margin-left: 68px; + margin-right: 0; +} + +.entry-content input.file, +.entry-content input.button { + margin-left: 24px; + margin-right:0; +} +.entry-content blockquote.left { + float: right; + margin-right: 0; + margin-left: 24px; + text-align: left; +} +.entry-content blockquote.right { + float: left; + margin-right: 24px; + margin-left: 0; + text-align: right; +} +#entry-author-info #author-avatar { + float: right; + margin: 0 0 0 -104px; +} +#entry-author-info #author-description { + float: right; + margin: 0 104px 0 0; +} + +/* Gallery listing +-------------------------------------------------------------- */ + +.category-gallery .gallery-thumb { + float: right; + margin-left:20px; + margin-right:0; +} + + +/* Images +-------------------------------------------------------------- */ + +#content .gallery .gallery-caption { + margin-right: 0; +} + +#content .gallery .gallery-item { + float: right; +} + +/* =Navigation +-------------------------------------------------------------- */ +.nav-previous { + float: right; +} +.nav-next { + float: left; + text-align:left; +} + +/* =Comments +-------------------------------------------------------------- */ + +.commentlist li.comment { + padding: 0 56px 0 0; +} +.commentlist .avatar { + right: 0; + left: auto; +} +.comment-author .says, #comments .pingback .url { + font-style: normal; +} + +/* Comments form */ +.children #respond { + margin: 0 0 0 48px; +} + +/* =Widget Areas +-------------------------------------------------------------- */ + +.widget-area ul { + margin-right: 0; +} +.widget-area ul ul { + margin-right: 1.3em; + margin-left: 0; +} +#wp-calendar caption { + text-align: right; +} +#wp-calendar tfoot #next { + text-align: left; +} + +/* Main sidebars */ +#main .widget-area ul { + margin-right: 0; + padding: 0 0 0 20px; +} +#main .widget-area ul ul { + margin-right: 1.3em; + margin-left: 0; +} + +/* =Footer +-------------------------------------------------------------- */ +#site-generator { + font-style:normal; +} +#site-generator a { + background-position: right center; + padding-right: 20px; + padding-left: 0; +} \ No newline at end of file diff --git a/src/wp-content/themes/twentyten/screenshot.png b/src/wp-content/themes/twentyten/screenshot.png new file mode 100644 index 0000000..256069f Binary files /dev/null and b/src/wp-content/themes/twentyten/screenshot.png differ diff --git a/src/wp-content/themes/twentyten/search.php b/src/wp-content/themes/twentyten/search.php new file mode 100644 index 0000000..3b198bb --- /dev/null +++ b/src/wp-content/themes/twentyten/search.php @@ -0,0 +1,37 @@ + + +
              +
              + + +

              ' . get_search_query() . '' ); ?>

              + + +
              +

              +
              +

              + +
              +
              + +
              +
              + + + diff --git a/src/wp-content/themes/twentyten/sidebar-footer.php b/src/wp-content/themes/twentyten/sidebar-footer.php new file mode 100644 index 0000000..0e9f702 --- /dev/null +++ b/src/wp-content/themes/twentyten/sidebar-footer.php @@ -0,0 +1,60 @@ + + + + + diff --git a/src/wp-content/themes/twentyten/sidebar.php b/src/wp-content/themes/twentyten/sidebar.php new file mode 100644 index 0000000..8a1664f --- /dev/null +++ b/src/wp-content/themes/twentyten/sidebar.php @@ -0,0 +1,56 @@ + + + + + + + + + diff --git a/src/wp-content/themes/twentyten/single.php b/src/wp-content/themes/twentyten/single.php new file mode 100644 index 0000000..a0dea11 --- /dev/null +++ b/src/wp-content/themes/twentyten/single.php @@ -0,0 +1,27 @@ + + +
              +
              + + + +
              +
              + + + diff --git a/src/wp-content/themes/twentyten/style.css b/src/wp-content/themes/twentyten/style.css new file mode 100644 index 0000000..ee5d61d --- /dev/null +++ b/src/wp-content/themes/twentyten/style.css @@ -0,0 +1,1357 @@ +/* +Theme Name: Twenty Ten +Theme URI: http://wordpress.org/ +Description: The 2010 theme for WordPress is stylish, customizable, simple, and readable -- make it yours with a custom menu, header image, and background. Twenty Ten supports six widgetized areas (two in the sidebar, four in the footer) and featured images (thumbnails for gallery posts and custom header images for posts and pages). It includes stylesheets for print and the admin Visual Editor, special styles for posts in the "Asides" and "Gallery" categories, and has an optional one-column page template that removes the sidebar. +Author: the WordPress team +Version: 1.2 +License: GNU General Public License +License URI: license.txt +Tags: black, blue, white, two-columns, fixed-width, custom-header, custom-background, threaded-comments, sticky-post, translation-ready, microformats, rtl-language-support, editor-style, custom-menu +*/ + + +/* =Reset default browser CSS. Based on work by Eric Meyer: http://meyerweb.com/eric/tools/css/reset/index.html +-------------------------------------------------------------- */ + +html, body, div, span, applet, object, iframe, +h1, h2, h3, h4, h5, h6, p, blockquote, pre, +a, abbr, acronym, address, big, cite, code, +del, dfn, em, font, img, ins, kbd, q, s, samp, +small, strike, strong, sub, sup, tt, var, +b, u, i, center, +dl, dt, dd, ol, ul, li, +fieldset, form, label, legend, +table, caption, tbody, tfoot, thead, tr, th, td { + background: transparent; + border: 0; + margin: 0; + padding: 0; + vertical-align: baseline; +} +body { + line-height: 1; +} +h1, h2, h3, h4, h5, h6 { + clear: both; + font-weight: normal; +} +ol, ul { + list-style: none; +} +blockquote { + quotes: none; +} +blockquote:before, blockquote:after { + content: ''; + content: none; +} +del { + text-decoration: line-through; +} +/* tables still need 'cellspacing="0"' in the markup */ +table { + border-collapse: collapse; + border-spacing: 0; +} +a img { + border: none; +} + +/* =Layout +-------------------------------------------------------------- */ + +/* +LAYOUT: Two columns +DESCRIPTION: Two-column fixed layout with one sidebar right of content +*/ + +#container { + float: left; + margin: 0 -240px 0 0; + width: 100%; +} +#content { + margin: 0 280px 0 20px; +} +#primary, +#secondary { + float: right; + overflow: hidden; + width: 220px; +} +#secondary { + clear: right; +} +#footer { + clear: both; + width: 100%; +} + +/* +LAYOUT: One column, no sidebar +DESCRIPTION: One centered column with no sidebar +*/ + +.one-column #content { + margin: 0 auto; + width: 640px; +} + +/* +LAYOUT: Full width, no sidebar +DESCRIPTION: Full width content with no sidebar; used for attachment pages +*/ + +.single-attachment #content { + margin: 0 auto; + width: 900px; +} + + +/* =Fonts +-------------------------------------------------------------- */ +body, +input, +textarea, +.page-title span, +.pingback a.url { + font-family: Georgia, "Bitstream Charter", serif; +} +h3#comments-title, +h3#reply-title, +#access .menu, +#access div.menu ul, +#cancel-comment-reply-link, +.form-allowed-tags, +#site-info, +#site-title, +#wp-calendar, +.comment-meta, +.comment-body tr th, +.comment-body thead th, +.entry-content label, +.entry-content tr th, +.entry-content thead th, +.entry-meta, +.entry-title, +.entry-utility, +#respond label, +.navigation, +.page-title, +.pingback p, +.reply, +.widget-title, +.wp-caption-text { + font-family: "Helvetica Neue", Arial, Helvetica, "Nimbus Sans L", sans-serif; +} +input[type=submit] { + font-family: "Helvetica Neue", Arial, Helvetica, "Nimbus Sans L", sans-serif; +} +pre { + font-family: "Courier 10 Pitch", Courier, monospace; +} +code { + font-family: Monaco, Consolas, "Andale Mono", "DejaVu Sans Mono", monospace; +} + + +/* =Structure +-------------------------------------------------------------- */ + +/* The main theme structure */ +#access .menu-header, +div.menu, +#colophon, +#branding, +#main, +#wrapper { + margin: 0 auto; + width: 940px; +} +#wrapper { + background: #fff; + margin-top: 20px; + padding: 0 20px; +} + +/* Structure the footer area */ +#footer-widget-area { + overflow: hidden; +} +#footer-widget-area .widget-area { + float: left; + margin-right: 20px; + width: 220px; +} +#footer-widget-area #fourth { + margin-right: 0; +} +#site-info { + float: left; + font-size: 14px; + font-weight: bold; + width: 700px; +} +#site-generator { + float: right; + width: 220px; +} + + +/* =Global Elements +-------------------------------------------------------------- */ + +/* Main global 'theme' and typographic styles */ +body { + background: #f1f1f1; +} +body, +input, +textarea { + color: #666; + font-size: 12px; + line-height: 18px; +} +hr { + background-color: #e7e7e7; + border: 0; + clear: both; + height: 1px; + margin-bottom: 18px; +} + +/* Text elements */ +p { + margin-bottom: 18px; +} +ul { + list-style: square; + margin: 0 0 18px 1.5em; +} +ol { + list-style: decimal; + margin: 0 0 18px 1.5em; +} +ol ol { + list-style: upper-alpha; +} +ol ol ol { + list-style: lower-roman; +} +ol ol ol ol { + list-style: lower-alpha; +} +ul ul, +ol ol, +ul ol, +ol ul { + margin-bottom: 0; +} +dl { + margin: 0 0 24px 0; +} +dt { + font-weight: bold; +} +dd { + margin-bottom: 18px; +} +strong { + font-weight: bold; +} +cite, +em, +i { + font-style: italic; +} +big { + font-size: 131.25%; +} +ins { + background: #ffc; + text-decoration: none; +} +blockquote { + font-style: italic; + padding: 0 3em; +} +blockquote cite, +blockquote em, +blockquote i { + font-style: normal; +} +pre { + background: #f7f7f7; + color: #222; + line-height: 18px; + margin-bottom: 18px; + padding: 1.5em; +} +abbr, +acronym { + border-bottom: 1px dotted #666; + cursor: help; +} +sup, +sub { + height: 0; + line-height: 1; + position: relative; + vertical-align: baseline; +} +sup { + bottom: 1ex; +} +sub { + top: .5ex; +} +input[type="text"], +textarea { + background: #f9f9f9; + border: 1px solid #ccc; + box-shadow: inset 1px 1px 1px rgba(0,0,0,0.1); + -moz-box-shadow: inset 1px 1px 1px rgba(0,0,0,0.1); + -webkit-box-shadow: inset 1px 1px 1px rgba(0,0,0,0.1); + padding: 2px; +} +a:link { + color: #0066cc; +} +a:visited { + color: #743399; +} +a:active, +a:hover { + color: #ff4b33; +} + +/* Text meant only for screen readers */ +.screen-reader-text { + position: absolute; + left: -9000px; +} + + +/* =Header +-------------------------------------------------------------- */ + +#header { + padding: 30px 0 0 0; +} +#site-title { + float: left; + font-size: 30px; + line-height: 36px; + margin: 0 0 18px 0; + width: 700px; +} +#site-title a { + color: #000; + font-weight: bold; + text-decoration: none; +} +#site-description { + clear: right; + float: right; + font-style: italic; + margin: 15px 0 18px 0; + width: 220px; +} + +/* This is the custom header image */ +#branding img { + border-top: 4px solid #000; + border-bottom: 1px solid #000; + display: block; + float: left; +} + + +/* =Menu +-------------------------------------------------------------- */ + +#access { + background: #000; + display: block; + float: left; + margin: 0 auto; + width: 940px; +} +#access .menu-header, +div.menu { + font-size: 13px; + margin-left: 12px; + width: 928px; +} +#access .menu-header ul, +div.menu ul { + list-style: none; + margin: 0; +} +#access .menu-header li, +div.menu li { + float: left; + position: relative; +} +#access a { + color: #aaa; + display: block; + line-height: 38px; + padding: 0 10px; + text-decoration: none; +} +#access ul ul { + box-shadow: 0px 3px 3px rgba(0,0,0,0.2); + -moz-box-shadow: 0px 3px 3px rgba(0,0,0,0.2); + -webkit-box-shadow: 0px 3px 3px rgba(0,0,0,0.2); + display: none; + position: absolute; + top: 38px; + left: 0; + float: left; + width: 180px; + z-index: 99999; +} +#access ul ul li { + min-width: 180px; +} +#access ul ul ul { + left: 100%; + top: 0; +} +#access ul ul a { + background: #333; + line-height: 1em; + padding: 10px; + width: 160px; + height: auto; +} +#access li:hover > a, +#access ul ul :hover > a { + background: #333; + color: #fff; +} +#access ul li:hover > ul { + display: block; +} +#access ul li.current_page_item > a, +#access ul li.current-menu-ancestor > a, +#access ul li.current-menu-item > a, +#access ul li.current-menu-parent > a { + color: #fff; +} +* html #access ul li.current_page_item a, +* html #access ul li.current-menu-ancestor a, +* html #access ul li.current-menu-item a, +* html #access ul li.current-menu-parent a, +* html #access ul li a:hover { + color: #fff; +} + + +/* =Content +-------------------------------------------------------------- */ + +#main { + clear: both; + overflow: hidden; + padding: 40px 0 0 0; +} +#content { + margin-bottom: 36px; +} +#content, +#content input, +#content textarea { + color: #333; + font-size: 16px; + line-height: 24px; +} +#content p, +#content ul, +#content ol, +#content dd, +#content pre, +#content hr { + margin-bottom: 24px; +} +#content ul ul, +#content ol ol, +#content ul ol, +#content ol ul { + margin-bottom: 0; +} +#content pre, +#content kbd, +#content tt, +#content var { + font-size: 15px; + line-height: 21px; +} +#content code { + font-size: 13px; +} +#content dt, +#content th { + color: #000; +} +#content h1, +#content h2, +#content h3, +#content h4, +#content h5, +#content h6 { + color: #000; + line-height: 1.5em; + margin: 0 0 20px 0; +} +#content table { + border: 1px solid #e7e7e7; + margin: 0 -1px 24px 0; + text-align: left; + width: 100%; +} +#content tr th, +#content thead th { + color: #888; + font-size: 12px; + font-weight: bold; + line-height: 18px; + padding: 9px 24px; +} +#content tr td { + border-top: 1px solid #e7e7e7; + padding: 6px 24px; +} +#content tr.odd td { + background: #f2f7fc; +} +.hentry { + margin: 0 0 48px 0; +} +.home .sticky { + background: #f2f7fc; + border-top: 4px solid #000; + margin-left: -20px; + margin-right: -20px; + padding: 18px 20px; +} +.single .hentry { + margin: 0 0 36px 0; +} +.page-title { + color: #000; + font-size: 14px; + font-weight: bold; + margin: 0 0 36px 0; +} +.page-title span { + color: #333; + font-size: 16px; + font-style: italic; + font-weight: normal; +} +.page-title a:link, +.page-title a:visited { + color: #888; + text-decoration: none; +} +.page-title a:active, +.page-title a:hover { + color: #ff4b33; +} +#content .entry-title { + color: #000; + font-size: 21px; + font-weight: bold; + line-height: 1.3em; + margin-bottom: 0; +} +.entry-title a:link, +.entry-title a:visited { + color: #000; + text-decoration: none; +} +.entry-title a:active, +.entry-title a:hover { + color: #ff4b33; +} +.entry-meta { + color: #888; + font-size: 12px; +} +.entry-meta abbr, +.entry-utility abbr { + border: none; +} +.entry-meta abbr:hover, +.entry-utility abbr:hover { + border-bottom: 1px dotted #666; +} +.entry-content, +.entry-summary { + clear: both; + padding: 12px 0 0 0; +} +#content .entry-summary p:last-child { + margin-bottom: 12px; +} +.entry-content fieldset { + border: 1px solid #e7e7e7; + margin: 0 0 24px 0; + padding: 24px; +} +.entry-content fieldset legend { + background: #fff; + color: #000; + font-weight: bold; + padding: 0 24px; +} +.entry-content input { + margin: 0 0 24px 0; +} +.entry-content input.file, +.entry-content input.button { + margin-right: 24px; +} +.entry-content label { + color: #888; + font-size: 12px; +} +.entry-content select { + margin: 0 0 24px 0; +} +.entry-content sup, +.entry-content sub { + font-size: 10px; +} +.entry-content blockquote.left { + float: left; + margin-left: 0; + margin-right: 24px; + text-align: right; + width: 33%; +} +.entry-content blockquote.right { + float: right; + margin-left: 24px; + margin-right: 0; + text-align: left; + width: 33%; +} +.page-link { + clear: both; + color: #000; + font-weight: bold; + margin: 0 0 22px 0; + word-spacing: 0.5em; +} +.page-link a:link, +.page-link a:visited { + background: #f1f1f1; + color: #333; + font-weight: normal; + padding: 0.5em 0.75em; + text-decoration: none; +} +.home .sticky .page-link a { + background: #d9e8f7; +} +.page-link a:active, +.page-link a:hover { + color: #ff4b33; +} +body.page .edit-link { + clear: both; + display: block; +} +#entry-author-info { + background: #f2f7fc; + border-top: 4px solid #000; + clear: both; + font-size: 14px; + line-height: 20px; + margin: 24px 0; + overflow: hidden; + padding: 18px 20px; +} +#entry-author-info #author-avatar { + background: #fff; + border: 1px solid #e7e7e7; + float: left; + height: 60px; + margin: 0 -104px 0 0; + padding: 11px; +} +#entry-author-info #author-description { + float: left; + margin: 0 0 0 104px; +} +#entry-author-info h2 { + color: #000; + font-size: 100%; + font-weight: bold; + margin-bottom: 0; +} +.entry-utility { + clear: both; + color: #888; + font-size: 12px; + line-height: 18px; +} +.entry-meta a, +.entry-utility a { + color: #888; +} +.entry-meta a:hover, +.entry-utility a:hover { + color: #ff4b33; +} +#content .video-player { + padding: 0; +} + + +/* =Asides +-------------------------------------------------------------- */ + +.home #content .format-aside p, +.home #content .category-asides p { + font-size: 14px; + line-height: 20px; + margin-bottom: 10px; + margin-top: 0; +} +.home .hentry.format-aside, +.home .hentry.category-asides { + padding: 0; +} +.home #content .format-aside .entry-content, +.home #content .category-asides .entry-content { + padding-top: 0; +} + + +/* =Gallery listing +-------------------------------------------------------------- */ + +.format-gallery .size-thumbnail img, +.category-gallery .size-thumbnail img { + border: 10px solid #f1f1f1; + margin-bottom: 0; +} +.format-gallery .gallery-thumb, +.category-gallery .gallery-thumb { + float: left; + margin-right: 20px; + margin-top: -4px; +} +.home #content .format-gallery .entry-utility, +.home #content .category-gallery .entry-utility { + padding-top: 4px; +} + + +/* =Attachment pages +-------------------------------------------------------------- */ + +.attachment .entry-content .entry-caption { + font-size: 140%; + margin-top: 24px; +} +.attachment .entry-content .nav-previous a:before { + content: '\2190\00a0'; +} +.attachment .entry-content .nav-next a:after { + content: '\00a0\2192'; +} + + +/* =Images +-------------------------------------------------------------- */ + +/* +Resize images to fit the main content area. +- Applies only to images uploaded via WordPress by targeting size-* classes. +- Other images will be left alone. Use "size-auto" class to apply to other images. +*/ +img.size-auto, +img.size-full, +img.size-large, +img.size-medium, +.attachment img { + max-width: 100%; /* When images are too wide for containing element, force them to fit. */ + height: auto; /* Override height to match resized width for correct aspect ratio. */ +} +.alignleft, +img.alignleft { + display: inline; + float: left; + margin-right: 24px; + margin-top: 4px; +} +.alignright, +img.alignright { + display: inline; + float: right; + margin-left: 24px; + margin-top: 4px; +} +.aligncenter, +img.aligncenter { + clear: both; + display: block; + margin-left: auto; + margin-right: auto; +} +img.alignleft, +img.alignright, +img.aligncenter { + margin-bottom: 12px; +} +.wp-caption { + background: #f1f1f1; + line-height: 18px; + margin-bottom: 20px; + max-width: 632px !important; /* prevent too-wide images from breaking layout */ + padding: 4px; + text-align: center; +} +.wp-caption img { + margin: 5px 5px 0; +} +.wp-caption p.wp-caption-text { + color: #888; + font-size: 12px; + margin: 5px; +} +.wp-smiley { + margin: 0; +} +.gallery { + margin: 0 auto 18px; +} +.gallery .gallery-item { + float: left; + margin-top: 0; + text-align: center; + width: 33%; +} +.gallery-columns-2 .gallery-item { + width: 50%; +} +.gallery-columns-4 .gallery-item { + width: 25%; +} +.gallery img { + border: 2px solid #cfcfcf; +} +.gallery-columns-2 .attachment-medium { + max-width: 92%; + height: auto; +} +.gallery-columns-4 .attachment-thumbnail { + max-width: 84%; + height: auto; +} +.gallery .gallery-caption { + color: #888; + font-size: 12px; + margin: 0 0 12px; +} +.gallery dl { + margin: 0; +} +.gallery img { + border: 10px solid #f1f1f1; +} +.gallery br+br { + display: none; +} +#content .attachment img {/* single attachment images should be centered */ + display: block; + margin: 0 auto; +} + + +/* =Navigation +-------------------------------------------------------------- */ + +.navigation { + color: #888; + font-size: 12px; + line-height: 18px; + overflow: hidden; +} +.navigation a:link, +.navigation a:visited { + color: #888; + text-decoration: none; +} +.navigation a:active, +.navigation a:hover { + color: #ff4b33; +} +.nav-previous { + float: left; + width: 50%; +} +.nav-next { + float: right; + text-align: right; + width: 50%; +} +#nav-above { + margin: 0 0 18px 0; +} +#nav-above { + display: none; +} +.paged #nav-above, +.single #nav-above { + display: block; +} +#nav-below { + margin: -18px 0 0 0; +} + + +/* =Comments +-------------------------------------------------------------- */ +#comments { + clear: both; +} +#comments .navigation { + padding: 0 0 18px 0; +} +h3#comments-title, +h3#reply-title { + color: #000; + font-size: 20px; + font-weight: bold; + margin-bottom: 0; +} +h3#comments-title { + padding: 24px 0; +} +.commentlist { + list-style: none; + margin: 0; +} +.commentlist li.comment { + border-bottom: 1px solid #e7e7e7; + line-height: 24px; + margin: 0 0 24px 0; + padding: 0 0 0 56px; + position: relative; +} +.commentlist li:last-child { + border-bottom: none; + margin-bottom: 0; +} +#comments .comment-body ul, +#comments .comment-body ol { + margin-bottom: 18px; +} +#comments .comment-body p:last-child { + margin-bottom: 6px; +} +#comments .comment-body blockquote p:last-child { + margin-bottom: 24px; +} +.commentlist ol { + list-style: decimal; +} +.commentlist .avatar { + position: absolute; + top: 4px; + left: 0; +} +.comment-author { +} +.comment-author cite { + color: #000; + font-style: normal; + font-weight: bold; +} +.comment-author .says { + font-style: italic; +} +.comment-meta { + font-size: 12px; + margin: 0 0 18px 0; +} +.comment-meta a:link, +.comment-meta a:visited { + color: #888; + text-decoration: none; +} +.comment-meta a:active, +.comment-meta a:hover { + color: #ff4b33; +} +.commentlist .even { +} +.commentlist .bypostauthor { +} +.reply { + font-size: 12px; + padding: 0 0 24px 0; +} +.reply a, +a.comment-edit-link { + color: #888; +} +.reply a:hover, +a.comment-edit-link:hover { + color: #ff4b33; +} +.commentlist .children { + list-style: none; + margin: 0; +} +.commentlist .children li { + border: none; + margin: 0; +} +.nopassword, +.nocomments { + display: none; +} +#comments .pingback { + border-bottom: 1px solid #e7e7e7; + margin-bottom: 18px; + padding-bottom: 18px; +} +.commentlist li.comment+li.pingback { + margin-top: -6px; +} +#comments .pingback p { + color: #888; + display: block; + font-size: 12px; + line-height: 18px; + margin: 0; +} +#comments .pingback .url { + font-size: 13px; + font-style: italic; +} + +/* Comments form */ +input[type=submit] { + color: #333; +} +#respond { + border-top: 1px solid #e7e7e7; + margin: 24px 0; + overflow: hidden; + position: relative; +} +#respond p { + margin: 0; +} +#respond .comment-notes { + margin-bottom: 1em; +} +.form-allowed-tags { + line-height: 1em; +} +.children #respond { + margin: 0 48px 0 0; +} +h3#reply-title { + margin: 18px 0; +} +#comments-list #respond { + margin: 0 0 18px 0; +} +#comments-list ul #respond { + margin: 0; +} +#cancel-comment-reply-link { + font-size: 12px; + font-weight: normal; + line-height: 18px; +} +#respond .required { + color: #ff4b33; + font-weight: bold; +} +#respond label { + color: #888; + font-size: 12px; +} +#respond input { + margin: 0 0 9px; + width: 98%; +} +#respond textarea { + width: 98%; +} +#respond .form-allowed-tags { + color: #888; + font-size: 12px; + line-height: 18px; +} +#respond .form-allowed-tags code { + font-size: 11px; +} +#respond .form-submit { + margin: 12px 0; +} +#respond .form-submit input { + font-size: 14px; + width: auto; +} + + +/* =Widget Areas +-------------------------------------------------------------- */ + +.widget-area ul { + list-style: none; + margin-left: 0; +} +.widget-area ul ul { + list-style: square; + margin-left: 1.3em; +} +.widget-area select { + max-width: 100%; +} +.widget_search #s {/* This keeps the search inputs in line */ + width: 60%; +} +.widget_search label { + display: none; +} +.widget-container { + margin: 0 0 18px 0; +} +.widget-title { + color: #222; + font-weight: bold; +} +.widget-area a:link, +.widget-area a:visited { + text-decoration: none; +} +.widget-area a:active, +.widget-area a:hover { + text-decoration: underline; +} +.widget-area .entry-meta { + font-size: 11px; +} +#wp_tag_cloud div { + line-height: 1.6em; +} +#wp-calendar { + width: 100%; +} +#wp-calendar caption { + color: #222; + font-size: 14px; + font-weight: bold; + padding-bottom: 4px; + text-align: left; +} +#wp-calendar thead { + font-size: 11px; +} +#wp-calendar thead th { +} +#wp-calendar tbody { + color: #aaa; +} +#wp-calendar tbody td { + background: #f5f5f5; + border: 1px solid #fff; + padding: 3px 0 2px; + text-align: center; +} +#wp-calendar tbody .pad { + background: none; +} +#wp-calendar tfoot #next { + text-align: right; +} +.widget_rss a.rsswidget { + color: #000; +} +.widget_rss a.rsswidget:hover { + color: #ff4b33; +} +.widget_rss .widget-title img { + width: 11px; + height: 11px; +} + +/* Main sidebars */ +#main .widget-area ul { + margin-left: 0; + padding: 0 20px 0 0; +} +#main .widget-area ul ul { + border: none; + margin-left: 1.3em; + padding: 0; +} +#primary { +} +#secondary { +} + +/* Footer widget areas */ +#footer-widget-area { +} + + +/* =Footer +-------------------------------------------------------------- */ + +#footer { + margin-bottom: 20px; +} +#colophon { + border-top: 4px solid #000; + margin-top: -4px; + overflow: hidden; + padding: 18px 0; +} +#site-info { + font-weight: bold; +} +#site-info a { + color: #000; + text-decoration: none; +} +#site-generator { + font-style: italic; + position: relative; +} +#site-generator a { + background: url(images/wordpress.png) center left no-repeat; + color: #666; + display: inline-block; + line-height: 16px; + padding-left: 20px; + text-decoration: none; +} +#site-generator a:hover { + text-decoration: underline; +} +img#wpstats { + display: block; + margin: 0 auto 10px; +} + + +/* =Mobile Safari ( iPad, iPhone and iPod Touch ) +-------------------------------------------------------------- */ + +pre { + -webkit-text-size-adjust: 140%; +} +code { + -webkit-text-size-adjust: 160%; +} +#access, +.entry-meta, +.entry-utility, +.navigation, +.widget-area { + -webkit-text-size-adjust: 120%; +} +#site-description { + -webkit-text-size-adjust: none; +} + + +/* =Print Style +-------------------------------------------------------------- */ + +@media print { + body { + background: none !important; + } + #wrapper { + clear: both !important; + display: block !important; + float: none !important; + position: relative !important; + } + #header { + border-bottom: 2pt solid #000; + padding-bottom: 18pt; + } + #colophon { + border-top: 2pt solid #000; + } + #site-title, + #site-description { + float: none; + line-height: 1.4em; + margin: 0; + padding: 0; + } + #site-title { + font-size: 13pt; + } + .entry-content { + font-size: 14pt; + line-height: 1.6em; + } + .entry-title { + font-size: 21pt; + } + #access, + #branding img, + #respond, + .comment-edit-link, + .edit-link, + .navigation, + .page-link, + .widget-area { + display: none !important; + } + #container, + #header, + #footer { + margin: 0; + width: 100%; + } + #content, + .one-column #content { + margin: 24pt 0 0; + width: 100%; + } + .wp-caption p { + font-size: 11pt; + } + #site-info, + #site-generator { + float: none; + width: auto; + } + #colophon { + width: auto; + } + img#wpstats { + display: none; + } + #site-generator a { + margin: 0; + padding: 0; + } + #entry-author-info { + border: 1px solid #e7e7e7; + } + #main { + display: inline; + } + .home .sticky { + border: none; + } +} \ No newline at end of file diff --git a/src/wp-content/themes/twentyten/tag.php b/src/wp-content/themes/twentyten/tag.php new file mode 100644 index 0000000..2c0cb87 --- /dev/null +++ b/src/wp-content/themes/twentyten/tag.php @@ -0,0 +1,30 @@ + + +
              +
              + +

              ' . single_tag_title( '', false ) . '' ); + ?>

              + + +
              +
              + + + diff --git a/src/wp-cron.php b/src/wp-cron.php new file mode 100644 index 0000000..19427c5 --- /dev/null +++ b/src/wp-cron.php @@ -0,0 +1,60 @@ + $local_time ) + die(); + +foreach ($crons as $timestamp => $cronhooks) { + if ( $timestamp > $local_time ) + break; + + foreach ($cronhooks as $hook => $keys) { + + foreach ($keys as $k => $v) { + + $schedule = $v['schedule']; + + if ($schedule != false) { + $new_args = array($timestamp, $schedule, $hook, $v['args']); + call_user_func_array('wp_reschedule_event', $new_args); + } + + wp_unschedule_event($timestamp, $hook, $v['args']); + + do_action_ref_array($hook, $v['args']); + } + } +} + +die(); diff --git a/src/wp-feed.php b/src/wp-feed.php new file mode 100644 index 0000000..afce8cd --- /dev/null +++ b/src/wp-feed.php @@ -0,0 +1,12 @@ + diff --git a/src/wp-includes/Text/Diff.php b/src/wp-includes/Text/Diff.php new file mode 100644 index 0000000..3ba7b4c --- /dev/null +++ b/src/wp-includes/Text/Diff.php @@ -0,0 +1,450 @@ +, and is used/adapted with his permission. + * + * Copyright 2004 Geoffrey T. Dairiki + * Copyright 2004-2010 The Horde Project (http://www.horde.org/) + * + * See the enclosed file COPYING for license information (LGPL). If you did + * not receive this file, see http://opensource.org/licenses/lgpl-license.php. + * + * @package Text_Diff + * @author Geoffrey T. Dairiki + */ +class Text_Diff { + + /** + * Array of changes. + * + * @var array + */ + var $_edits; + + /** + * Computes diffs between sequences of strings. + * + * @param string $engine Name of the diffing engine to use. 'auto' + * will automatically select the best. + * @param array $params Parameters to pass to the diffing engine. + * Normally an array of two arrays, each + * containing the lines from a file. + */ + function Text_Diff($engine, $params) + { + // Backward compatibility workaround. + if (!is_string($engine)) { + $params = array($engine, $params); + $engine = 'auto'; + } + + if ($engine == 'auto') { + $engine = extension_loaded('xdiff') ? 'xdiff' : 'native'; + } else { + $engine = basename($engine); + } + + // WP #7391 + require_once dirname(__FILE__).'/Diff/Engine/' . $engine . '.php'; + $class = 'Text_Diff_Engine_' . $engine; + $diff_engine = new $class(); + + $this->_edits = call_user_func_array(array($diff_engine, 'diff'), $params); + } + + /** + * Returns the array of differences. + */ + function getDiff() + { + return $this->_edits; + } + + /** + * returns the number of new (added) lines in a given diff. + * + * @since Text_Diff 1.1.0 + * + * @return integer The number of new lines + */ + function countAddedLines() + { + $count = 0; + foreach ($this->_edits as $edit) { + if (is_a($edit, 'Text_Diff_Op_add') || + is_a($edit, 'Text_Diff_Op_change')) { + $count += $edit->nfinal(); + } + } + return $count; + } + + /** + * Returns the number of deleted (removed) lines in a given diff. + * + * @since Text_Diff 1.1.0 + * + * @return integer The number of deleted lines + */ + function countDeletedLines() + { + $count = 0; + foreach ($this->_edits as $edit) { + if (is_a($edit, 'Text_Diff_Op_delete') || + is_a($edit, 'Text_Diff_Op_change')) { + $count += $edit->norig(); + } + } + return $count; + } + + /** + * Computes a reversed diff. + * + * Example: + * + * $diff = new Text_Diff($lines1, $lines2); + * $rev = $diff->reverse(); + * + * + * @return Text_Diff A Diff object representing the inverse of the + * original diff. Note that we purposely don't return a + * reference here, since this essentially is a clone() + * method. + */ + function reverse() + { + if (version_compare(zend_version(), '2', '>')) { + $rev = clone($this); + } else { + $rev = $this; + } + $rev->_edits = array(); + foreach ($this->_edits as $edit) { + $rev->_edits[] = $edit->reverse(); + } + return $rev; + } + + /** + * Checks for an empty diff. + * + * @return boolean True if two sequences were identical. + */ + function isEmpty() + { + foreach ($this->_edits as $edit) { + if (!is_a($edit, 'Text_Diff_Op_copy')) { + return false; + } + } + return true; + } + + /** + * Computes the length of the Longest Common Subsequence (LCS). + * + * This is mostly for diagnostic purposes. + * + * @return integer The length of the LCS. + */ + function lcs() + { + $lcs = 0; + foreach ($this->_edits as $edit) { + if (is_a($edit, 'Text_Diff_Op_copy')) { + $lcs += count($edit->orig); + } + } + return $lcs; + } + + /** + * Gets the original set of lines. + * + * This reconstructs the $from_lines parameter passed to the constructor. + * + * @return array The original sequence of strings. + */ + function getOriginal() + { + $lines = array(); + foreach ($this->_edits as $edit) { + if ($edit->orig) { + array_splice($lines, count($lines), 0, $edit->orig); + } + } + return $lines; + } + + /** + * Gets the final set of lines. + * + * This reconstructs the $to_lines parameter passed to the constructor. + * + * @return array The sequence of strings. + */ + function getFinal() + { + $lines = array(); + foreach ($this->_edits as $edit) { + if ($edit->final) { + array_splice($lines, count($lines), 0, $edit->final); + } + } + return $lines; + } + + /** + * Removes trailing newlines from a line of text. This is meant to be used + * with array_walk(). + * + * @param string $line The line to trim. + * @param integer $key The index of the line in the array. Not used. + */ + function trimNewlines(&$line, $key) + { + $line = str_replace(array("\n", "\r"), '', $line); + } + + /** + * Determines the location of the system temporary directory. + * + * @static + * + * @access protected + * + * @return string A directory name which can be used for temp files. + * Returns false if one could not be found. + */ + function _getTempDir() + { + $tmp_locations = array('/tmp', '/var/tmp', 'c:\WUTemp', 'c:\temp', + 'c:\windows\temp', 'c:\winnt\temp'); + + /* Try PHP's upload_tmp_dir directive. */ + $tmp = ini_get('upload_tmp_dir'); + + /* Otherwise, try to determine the TMPDIR environment variable. */ + if (!strlen($tmp)) { + $tmp = getenv('TMPDIR'); + } + + /* If we still cannot determine a value, then cycle through a list of + * preset possibilities. */ + while (!strlen($tmp) && count($tmp_locations)) { + $tmp_check = array_shift($tmp_locations); + if (@is_dir($tmp_check)) { + $tmp = $tmp_check; + } + } + + /* If it is still empty, we have failed, so return false; otherwise + * return the directory determined. */ + return strlen($tmp) ? $tmp : false; + } + + /** + * Checks a diff for validity. + * + * This is here only for debugging purposes. + */ + function _check($from_lines, $to_lines) + { + if (serialize($from_lines) != serialize($this->getOriginal())) { + trigger_error("Reconstructed original doesn't match", E_USER_ERROR); + } + if (serialize($to_lines) != serialize($this->getFinal())) { + trigger_error("Reconstructed final doesn't match", E_USER_ERROR); + } + + $rev = $this->reverse(); + if (serialize($to_lines) != serialize($rev->getOriginal())) { + trigger_error("Reversed original doesn't match", E_USER_ERROR); + } + if (serialize($from_lines) != serialize($rev->getFinal())) { + trigger_error("Reversed final doesn't match", E_USER_ERROR); + } + + $prevtype = null; + foreach ($this->_edits as $edit) { + if ($prevtype == get_class($edit)) { + trigger_error("Edit sequence is non-optimal", E_USER_ERROR); + } + $prevtype = get_class($edit); + } + + return true; + } + +} + +/** + * @package Text_Diff + * @author Geoffrey T. Dairiki + */ +class Text_MappedDiff extends Text_Diff { + + /** + * Computes a diff between sequences of strings. + * + * This can be used to compute things like case-insensitve diffs, or diffs + * which ignore changes in white-space. + * + * @param array $from_lines An array of strings. + * @param array $to_lines An array of strings. + * @param array $mapped_from_lines This array should have the same size + * number of elements as $from_lines. The + * elements in $mapped_from_lines and + * $mapped_to_lines are what is actually + * compared when computing the diff. + * @param array $mapped_to_lines This array should have the same number + * of elements as $to_lines. + */ + function Text_MappedDiff($from_lines, $to_lines, + $mapped_from_lines, $mapped_to_lines) + { + assert(count($from_lines) == count($mapped_from_lines)); + assert(count($to_lines) == count($mapped_to_lines)); + + parent::Text_Diff($mapped_from_lines, $mapped_to_lines); + + $xi = $yi = 0; + for ($i = 0; $i < count($this->_edits); $i++) { + $orig = &$this->_edits[$i]->orig; + if (is_array($orig)) { + $orig = array_slice($from_lines, $xi, count($orig)); + $xi += count($orig); + } + + $final = &$this->_edits[$i]->final; + if (is_array($final)) { + $final = array_slice($to_lines, $yi, count($final)); + $yi += count($final); + } + } + } + +} + +/** + * @package Text_Diff + * @author Geoffrey T. Dairiki + * + * @access private + */ +class Text_Diff_Op { + + var $orig; + var $final; + + function &reverse() + { + trigger_error('Abstract method', E_USER_ERROR); + } + + function norig() + { + return $this->orig ? count($this->orig) : 0; + } + + function nfinal() + { + return $this->final ? count($this->final) : 0; + } + +} + +/** + * @package Text_Diff + * @author Geoffrey T. Dairiki + * + * @access private + */ +class Text_Diff_Op_copy extends Text_Diff_Op { + + function Text_Diff_Op_copy($orig, $final = false) + { + if (!is_array($final)) { + $final = $orig; + } + $this->orig = $orig; + $this->final = $final; + } + + function &reverse() + { + $reverse = &new Text_Diff_Op_copy($this->final, $this->orig); + return $reverse; + } + +} + +/** + * @package Text_Diff + * @author Geoffrey T. Dairiki + * + * @access private + */ +class Text_Diff_Op_delete extends Text_Diff_Op { + + function Text_Diff_Op_delete($lines) + { + $this->orig = $lines; + $this->final = false; + } + + function &reverse() + { + $reverse = &new Text_Diff_Op_add($this->orig); + return $reverse; + } + +} + +/** + * @package Text_Diff + * @author Geoffrey T. Dairiki + * + * @access private + */ +class Text_Diff_Op_add extends Text_Diff_Op { + + function Text_Diff_Op_add($lines) + { + $this->final = $lines; + $this->orig = false; + } + + function &reverse() + { + $reverse = &new Text_Diff_Op_delete($this->final); + return $reverse; + } + +} + +/** + * @package Text_Diff + * @author Geoffrey T. Dairiki + * + * @access private + */ +class Text_Diff_Op_change extends Text_Diff_Op { + + function Text_Diff_Op_change($orig, $final) + { + $this->orig = $orig; + $this->final = $final; + } + + function &reverse() + { + $reverse = &new Text_Diff_Op_change($this->final, $this->orig); + return $reverse; + } + +} diff --git a/src/wp-includes/Text/Diff/Engine/native.php b/src/wp-includes/Text/Diff/Engine/native.php new file mode 100644 index 0000000..93eaef2 --- /dev/null +++ b/src/wp-includes/Text/Diff/Engine/native.php @@ -0,0 +1,436 @@ + 2, and some optimizations) are from + * Geoffrey T. Dairiki . The original PHP version of this + * code was written by him, and is used/adapted with his permission. + * + * Copyright 2004-2010 The Horde Project (http://www.horde.org/) + * + * See the enclosed file COPYING for license information (LGPL). If you did + * not receive this file, see http://opensource.org/licenses/lgpl-license.php. + * + * @author Geoffrey T. Dairiki + * @package Text_Diff + */ +class Text_Diff_Engine_native { + + function diff($from_lines, $to_lines) + { + array_walk($from_lines, array('Text_Diff', 'trimNewlines')); + array_walk($to_lines, array('Text_Diff', 'trimNewlines')); + + $n_from = count($from_lines); + $n_to = count($to_lines); + + $this->xchanged = $this->ychanged = array(); + $this->xv = $this->yv = array(); + $this->xind = $this->yind = array(); + unset($this->seq); + unset($this->in_seq); + unset($this->lcs); + + // Skip leading common lines. + for ($skip = 0; $skip < $n_from && $skip < $n_to; $skip++) { + if ($from_lines[$skip] !== $to_lines[$skip]) { + break; + } + $this->xchanged[$skip] = $this->ychanged[$skip] = false; + } + + // Skip trailing common lines. + $xi = $n_from; $yi = $n_to; + for ($endskip = 0; --$xi > $skip && --$yi > $skip; $endskip++) { + if ($from_lines[$xi] !== $to_lines[$yi]) { + break; + } + $this->xchanged[$xi] = $this->ychanged[$yi] = false; + } + + // Ignore lines which do not exist in both files. + for ($xi = $skip; $xi < $n_from - $endskip; $xi++) { + $xhash[$from_lines[$xi]] = 1; + } + for ($yi = $skip; $yi < $n_to - $endskip; $yi++) { + $line = $to_lines[$yi]; + if (($this->ychanged[$yi] = empty($xhash[$line]))) { + continue; + } + $yhash[$line] = 1; + $this->yv[] = $line; + $this->yind[] = $yi; + } + for ($xi = $skip; $xi < $n_from - $endskip; $xi++) { + $line = $from_lines[$xi]; + if (($this->xchanged[$xi] = empty($yhash[$line]))) { + continue; + } + $this->xv[] = $line; + $this->xind[] = $xi; + } + + // Find the LCS. + $this->_compareseq(0, count($this->xv), 0, count($this->yv)); + + // Merge edits when possible. + $this->_shiftBoundaries($from_lines, $this->xchanged, $this->ychanged); + $this->_shiftBoundaries($to_lines, $this->ychanged, $this->xchanged); + + // Compute the edit operations. + $edits = array(); + $xi = $yi = 0; + while ($xi < $n_from || $yi < $n_to) { + assert($yi < $n_to || $this->xchanged[$xi]); + assert($xi < $n_from || $this->ychanged[$yi]); + + // Skip matching "snake". + $copy = array(); + while ($xi < $n_from && $yi < $n_to + && !$this->xchanged[$xi] && !$this->ychanged[$yi]) { + $copy[] = $from_lines[$xi++]; + ++$yi; + } + if ($copy) { + $edits[] = &new Text_Diff_Op_copy($copy); + } + + // Find deletes & adds. + $delete = array(); + while ($xi < $n_from && $this->xchanged[$xi]) { + $delete[] = $from_lines[$xi++]; + } + + $add = array(); + while ($yi < $n_to && $this->ychanged[$yi]) { + $add[] = $to_lines[$yi++]; + } + + if ($delete && $add) { + $edits[] = &new Text_Diff_Op_change($delete, $add); + } elseif ($delete) { + $edits[] = &new Text_Diff_Op_delete($delete); + } elseif ($add) { + $edits[] = &new Text_Diff_Op_add($add); + } + } + + return $edits; + } + + /** + * Divides the Largest Common Subsequence (LCS) of the sequences (XOFF, + * XLIM) and (YOFF, YLIM) into NCHUNKS approximately equally sized + * segments. + * + * Returns (LCS, PTS). LCS is the length of the LCS. PTS is an array of + * NCHUNKS+1 (X, Y) indexes giving the diving points between sub + * sequences. The first sub-sequence is contained in (X0, X1), (Y0, Y1), + * the second in (X1, X2), (Y1, Y2) and so on. Note that (X0, Y0) == + * (XOFF, YOFF) and (X[NCHUNKS], Y[NCHUNKS]) == (XLIM, YLIM). + * + * This function assumes that the first lines of the specified portions of + * the two files do not match, and likewise that the last lines do not + * match. The caller must trim matching lines from the beginning and end + * of the portions it is going to specify. + */ + function _diag ($xoff, $xlim, $yoff, $ylim, $nchunks) + { + $flip = false; + + if ($xlim - $xoff > $ylim - $yoff) { + /* Things seems faster (I'm not sure I understand why) when the + * shortest sequence is in X. */ + $flip = true; + list ($xoff, $xlim, $yoff, $ylim) + = array($yoff, $ylim, $xoff, $xlim); + } + + if ($flip) { + for ($i = $ylim - 1; $i >= $yoff; $i--) { + $ymatches[$this->xv[$i]][] = $i; + } + } else { + for ($i = $ylim - 1; $i >= $yoff; $i--) { + $ymatches[$this->yv[$i]][] = $i; + } + } + + $this->lcs = 0; + $this->seq[0]= $yoff - 1; + $this->in_seq = array(); + $ymids[0] = array(); + + $numer = $xlim - $xoff + $nchunks - 1; + $x = $xoff; + for ($chunk = 0; $chunk < $nchunks; $chunk++) { + if ($chunk > 0) { + for ($i = 0; $i <= $this->lcs; $i++) { + $ymids[$i][$chunk - 1] = $this->seq[$i]; + } + } + + $x1 = $xoff + (int)(($numer + ($xlim - $xoff) * $chunk) / $nchunks); + for (; $x < $x1; $x++) { + $line = $flip ? $this->yv[$x] : $this->xv[$x]; + if (empty($ymatches[$line])) { + continue; + } + $matches = $ymatches[$line]; + reset($matches); + while (list(, $y) = each($matches)) { + if (empty($this->in_seq[$y])) { + $k = $this->_lcsPos($y); + assert($k > 0); + $ymids[$k] = $ymids[$k - 1]; + break; + } + } + while (list(, $y) = each($matches)) { + if ($y > $this->seq[$k - 1]) { + assert($y <= $this->seq[$k]); + /* Optimization: this is a common case: next match is + * just replacing previous match. */ + $this->in_seq[$this->seq[$k]] = false; + $this->seq[$k] = $y; + $this->in_seq[$y] = 1; + } elseif (empty($this->in_seq[$y])) { + $k = $this->_lcsPos($y); + assert($k > 0); + $ymids[$k] = $ymids[$k - 1]; + } + } + } + } + + $seps[] = $flip ? array($yoff, $xoff) : array($xoff, $yoff); + $ymid = $ymids[$this->lcs]; + for ($n = 0; $n < $nchunks - 1; $n++) { + $x1 = $xoff + (int)(($numer + ($xlim - $xoff) * $n) / $nchunks); + $y1 = $ymid[$n] + 1; + $seps[] = $flip ? array($y1, $x1) : array($x1, $y1); + } + $seps[] = $flip ? array($ylim, $xlim) : array($xlim, $ylim); + + return array($this->lcs, $seps); + } + + function _lcsPos($ypos) + { + $end = $this->lcs; + if ($end == 0 || $ypos > $this->seq[$end]) { + $this->seq[++$this->lcs] = $ypos; + $this->in_seq[$ypos] = 1; + return $this->lcs; + } + + $beg = 1; + while ($beg < $end) { + $mid = (int)(($beg + $end) / 2); + if ($ypos > $this->seq[$mid]) { + $beg = $mid + 1; + } else { + $end = $mid; + } + } + + assert($ypos != $this->seq[$end]); + + $this->in_seq[$this->seq[$end]] = false; + $this->seq[$end] = $ypos; + $this->in_seq[$ypos] = 1; + return $end; + } + + /** + * Finds LCS of two sequences. + * + * The results are recorded in the vectors $this->{x,y}changed[], by + * storing a 1 in the element for each line that is an insertion or + * deletion (ie. is not in the LCS). + * + * The subsequence of file 0 is (XOFF, XLIM) and likewise for file 1. + * + * Note that XLIM, YLIM are exclusive bounds. All line numbers are + * origin-0 and discarded lines are not counted. + */ + function _compareseq ($xoff, $xlim, $yoff, $ylim) + { + /* Slide down the bottom initial diagonal. */ + while ($xoff < $xlim && $yoff < $ylim + && $this->xv[$xoff] == $this->yv[$yoff]) { + ++$xoff; + ++$yoff; + } + + /* Slide up the top initial diagonal. */ + while ($xlim > $xoff && $ylim > $yoff + && $this->xv[$xlim - 1] == $this->yv[$ylim - 1]) { + --$xlim; + --$ylim; + } + + if ($xoff == $xlim || $yoff == $ylim) { + $lcs = 0; + } else { + /* This is ad hoc but seems to work well. $nchunks = + * sqrt(min($xlim - $xoff, $ylim - $yoff) / 2.5); $nchunks = + * max(2,min(8,(int)$nchunks)); */ + $nchunks = min(7, $xlim - $xoff, $ylim - $yoff) + 1; + list($lcs, $seps) + = $this->_diag($xoff, $xlim, $yoff, $ylim, $nchunks); + } + + if ($lcs == 0) { + /* X and Y sequences have no common subsequence: mark all + * changed. */ + while ($yoff < $ylim) { + $this->ychanged[$this->yind[$yoff++]] = 1; + } + while ($xoff < $xlim) { + $this->xchanged[$this->xind[$xoff++]] = 1; + } + } else { + /* Use the partitions to split this problem into subproblems. */ + reset($seps); + $pt1 = $seps[0]; + while ($pt2 = next($seps)) { + $this->_compareseq ($pt1[0], $pt2[0], $pt1[1], $pt2[1]); + $pt1 = $pt2; + } + } + } + + /** + * Adjusts inserts/deletes of identical lines to join changes as much as + * possible. + * + * We do something when a run of changed lines include a line at one end + * and has an excluded, identical line at the other. We are free to + * choose which identical line is included. `compareseq' usually chooses + * the one at the beginning, but usually it is cleaner to consider the + * following identical line to be the "change". + * + * This is extracted verbatim from analyze.c (GNU diffutils-2.7). + */ + function _shiftBoundaries($lines, &$changed, $other_changed) + { + $i = 0; + $j = 0; + + assert('count($lines) == count($changed)'); + $len = count($lines); + $other_len = count($other_changed); + + while (1) { + /* Scan forward to find the beginning of another run of + * changes. Also keep track of the corresponding point in the + * other file. + * + * Throughout this code, $i and $j are adjusted together so that + * the first $i elements of $changed and the first $j elements of + * $other_changed both contain the same number of zeros (unchanged + * lines). + * + * Furthermore, $j is always kept so that $j == $other_len or + * $other_changed[$j] == false. */ + while ($j < $other_len && $other_changed[$j]) { + $j++; + } + + while ($i < $len && ! $changed[$i]) { + assert('$j < $other_len && ! $other_changed[$j]'); + $i++; $j++; + while ($j < $other_len && $other_changed[$j]) { + $j++; + } + } + + if ($i == $len) { + break; + } + + $start = $i; + + /* Find the end of this run of changes. */ + while (++$i < $len && $changed[$i]) { + continue; + } + + do { + /* Record the length of this run of changes, so that we can + * later determine whether the run has grown. */ + $runlength = $i - $start; + + /* Move the changed region back, so long as the previous + * unchanged line matches the last changed one. This merges + * with previous changed regions. */ + while ($start > 0 && $lines[$start - 1] == $lines[$i - 1]) { + $changed[--$start] = 1; + $changed[--$i] = false; + while ($start > 0 && $changed[$start - 1]) { + $start--; + } + assert('$j > 0'); + while ($other_changed[--$j]) { + continue; + } + assert('$j >= 0 && !$other_changed[$j]'); + } + + /* Set CORRESPONDING to the end of the changed run, at the + * last point where it corresponds to a changed run in the + * other file. CORRESPONDING == LEN means no such point has + * been found. */ + $corresponding = $j < $other_len ? $i : $len; + + /* Move the changed region forward, so long as the first + * changed line matches the following unchanged one. This + * merges with following changed regions. Do this second, so + * that if there are no merges, the changed region is moved + * forward as far as possible. */ + while ($i < $len && $lines[$start] == $lines[$i]) { + $changed[$start++] = false; + $changed[$i++] = 1; + while ($i < $len && $changed[$i]) { + $i++; + } + + assert('$j < $other_len && ! $other_changed[$j]'); + $j++; + if ($j < $other_len && $other_changed[$j]) { + $corresponding = $i; + while ($j < $other_len && $other_changed[$j]) { + $j++; + } + } + } + } while ($runlength != $i - $start); + + /* If possible, move the fully-merged run of changes back to a + * corresponding run in the other file. */ + while ($corresponding < $i) { + $changed[--$start] = 1; + $changed[--$i] = 0; + assert('$j > 0'); + while ($other_changed[--$j]) { + continue; + } + assert('$j >= 0 && !$other_changed[$j]'); + } + } + } + +} diff --git a/src/wp-includes/Text/Diff/Engine/shell.php b/src/wp-includes/Text/Diff/Engine/shell.php new file mode 100644 index 0000000..faf3870 --- /dev/null +++ b/src/wp-includes/Text/Diff/Engine/shell.php @@ -0,0 +1,162 @@ + + * @package Text_Diff + * @since 0.3.0 + */ +class Text_Diff_Engine_shell { + + /** + * Path to the diff executable + * + * @var string + */ + var $_diffCommand = 'diff'; + + /** + * Returns the array of differences. + * + * @param array $from_lines lines of text from old file + * @param array $to_lines lines of text from new file + * + * @return array all changes made (array with Text_Diff_Op_* objects) + */ + function diff($from_lines, $to_lines) + { + array_walk($from_lines, array('Text_Diff', 'trimNewlines')); + array_walk($to_lines, array('Text_Diff', 'trimNewlines')); + + $temp_dir = Text_Diff::_getTempDir(); + + // Execute gnu diff or similar to get a standard diff file. + $from_file = tempnam($temp_dir, 'Text_Diff'); + $to_file = tempnam($temp_dir, 'Text_Diff'); + $fp = fopen($from_file, 'w'); + fwrite($fp, implode("\n", $from_lines)); + fclose($fp); + $fp = fopen($to_file, 'w'); + fwrite($fp, implode("\n", $to_lines)); + fclose($fp); + $diff = shell_exec($this->_diffCommand . ' ' . $from_file . ' ' . $to_file); + unlink($from_file); + unlink($to_file); + + if (is_null($diff)) { + // No changes were made + return array(new Text_Diff_Op_copy($from_lines)); + } + + $from_line_no = 1; + $to_line_no = 1; + $edits = array(); + + // Get changed lines by parsing something like: + // 0a1,2 + // 1,2c4,6 + // 1,5d6 + preg_match_all('#^(\d+)(?:,(\d+))?([adc])(\d+)(?:,(\d+))?$#m', $diff, + $matches, PREG_SET_ORDER); + + foreach ($matches as $match) { + if (!isset($match[5])) { + // This paren is not set every time (see regex). + $match[5] = false; + } + + if ($match[3] == 'a') { + $from_line_no--; + } + + if ($match[3] == 'd') { + $to_line_no--; + } + + if ($from_line_no < $match[1] || $to_line_no < $match[4]) { + // copied lines + assert('$match[1] - $from_line_no == $match[4] - $to_line_no'); + array_push($edits, + new Text_Diff_Op_copy( + $this->_getLines($from_lines, $from_line_no, $match[1] - 1), + $this->_getLines($to_lines, $to_line_no, $match[4] - 1))); + } + + switch ($match[3]) { + case 'd': + // deleted lines + array_push($edits, + new Text_Diff_Op_delete( + $this->_getLines($from_lines, $from_line_no, $match[2]))); + $to_line_no++; + break; + + case 'c': + // changed lines + array_push($edits, + new Text_Diff_Op_change( + $this->_getLines($from_lines, $from_line_no, $match[2]), + $this->_getLines($to_lines, $to_line_no, $match[5]))); + break; + + case 'a': + // added lines + array_push($edits, + new Text_Diff_Op_add( + $this->_getLines($to_lines, $to_line_no, $match[5]))); + $from_line_no++; + break; + } + } + + if (!empty($from_lines)) { + // Some lines might still be pending. Add them as copied + array_push($edits, + new Text_Diff_Op_copy( + $this->_getLines($from_lines, $from_line_no, + $from_line_no + count($from_lines) - 1), + $this->_getLines($to_lines, $to_line_no, + $to_line_no + count($to_lines) - 1))); + } + + return $edits; + } + + /** + * Get lines from either the old or new text + * + * @access private + * + * @param array &$text_lines Either $from_lines or $to_lines + * @param int &$line_no Current line number + * @param int $end Optional end line, when we want to chop more + * than one line. + * + * @return array The chopped lines + */ + function _getLines(&$text_lines, &$line_no, $end = false) + { + if (!empty($end)) { + $lines = array(); + // We can shift even more + while ($line_no <= $end) { + array_push($lines, array_shift($text_lines)); + $line_no++; + } + } else { + $lines = array(array_shift($text_lines)); + $line_no++; + } + + return $lines; + } + +} diff --git a/src/wp-includes/Text/Diff/Engine/string.php b/src/wp-includes/Text/Diff/Engine/string.php new file mode 100644 index 0000000..59eb8ad --- /dev/null +++ b/src/wp-includes/Text/Diff/Engine/string.php @@ -0,0 +1,248 @@ + + * $patch = file_get_contents('example.patch'); + * $diff = new Text_Diff('string', array($patch)); + * $renderer = new Text_Diff_Renderer_inline(); + * echo $renderer->render($diff); + * + * + * Copyright 2005 rjan Persson + * Copyright 2005-2010 The Horde Project (http://www.horde.org/) + * + * See the enclosed file COPYING for license information (LGPL). If you did + * not receive this file, see http://opensource.org/licenses/lgpl-license.php. + * + * @author rjan Persson + * @package Text_Diff + * @since 0.2.0 + */ +class Text_Diff_Engine_string { + + /** + * Parses a unified or context diff. + * + * First param contains the whole diff and the second can be used to force + * a specific diff type. If the second parameter is 'autodetect', the + * diff will be examined to find out which type of diff this is. + * + * @param string $diff The diff content. + * @param string $mode The diff mode of the content in $diff. One of + * 'context', 'unified', or 'autodetect'. + * + * @return array List of all diff operations. + */ + function diff($diff, $mode = 'autodetect') + { + // Detect line breaks. + $lnbr = "\n"; + if (strpos($diff, "\r\n") !== false) { + $lnbr = "\r\n"; + } elseif (strpos($diff, "\r") !== false) { + $lnbr = "\r"; + } + + // Make sure we have a line break at the EOF. + if (substr($diff, -strlen($lnbr)) != $lnbr) { + $diff .= $lnbr; + } + + if ($mode != 'autodetect' && $mode != 'context' && $mode != 'unified') { + return PEAR::raiseError('Type of diff is unsupported'); + } + + if ($mode == 'autodetect') { + $context = strpos($diff, '***'); + $unified = strpos($diff, '---'); + if ($context === $unified) { + return PEAR::raiseError('Type of diff could not be detected'); + } elseif ($context === false || $unified === false) { + $mode = $context !== false ? 'context' : 'unified'; + } else { + $mode = $context < $unified ? 'context' : 'unified'; + } + } + + // Split by new line and remove the diff header, if there is one. + $diff = explode($lnbr, $diff); + if (($mode == 'context' && strpos($diff[0], '***') === 0) || + ($mode == 'unified' && strpos($diff[0], '---') === 0)) { + array_shift($diff); + array_shift($diff); + } + + if ($mode == 'context') { + return $this->parseContextDiff($diff); + } else { + return $this->parseUnifiedDiff($diff); + } + } + + /** + * Parses an array containing the unified diff. + * + * @param array $diff Array of lines. + * + * @return array List of all diff operations. + */ + function parseUnifiedDiff($diff) + { + $edits = array(); + $end = count($diff) - 1; + for ($i = 0; $i < $end;) { + $diff1 = array(); + switch (substr($diff[$i], 0, 1)) { + case ' ': + do { + $diff1[] = substr($diff[$i], 1); + } while (++$i < $end && substr($diff[$i], 0, 1) == ' '); + $edits[] = &new Text_Diff_Op_copy($diff1); + break; + + case '+': + // get all new lines + do { + $diff1[] = substr($diff[$i], 1); + } while (++$i < $end && substr($diff[$i], 0, 1) == '+'); + $edits[] = &new Text_Diff_Op_add($diff1); + break; + + case '-': + // get changed or removed lines + $diff2 = array(); + do { + $diff1[] = substr($diff[$i], 1); + } while (++$i < $end && substr($diff[$i], 0, 1) == '-'); + + while ($i < $end && substr($diff[$i], 0, 1) == '+') { + $diff2[] = substr($diff[$i++], 1); + } + if (count($diff2) == 0) { + $edits[] = &new Text_Diff_Op_delete($diff1); + } else { + $edits[] = &new Text_Diff_Op_change($diff1, $diff2); + } + break; + + default: + $i++; + break; + } + } + + return $edits; + } + + /** + * Parses an array containing the context diff. + * + * @param array $diff Array of lines. + * + * @return array List of all diff operations. + */ + function parseContextDiff(&$diff) + { + $edits = array(); + $i = $max_i = $j = $max_j = 0; + $end = count($diff) - 1; + while ($i < $end && $j < $end) { + while ($i >= $max_i && $j >= $max_j) { + // Find the boundaries of the diff output of the two files + for ($i = $j; + $i < $end && substr($diff[$i], 0, 3) == '***'; + $i++); + for ($max_i = $i; + $max_i < $end && substr($diff[$max_i], 0, 3) != '---'; + $max_i++); + for ($j = $max_i; + $j < $end && substr($diff[$j], 0, 3) == '---'; + $j++); + for ($max_j = $j; + $max_j < $end && substr($diff[$max_j], 0, 3) != '***'; + $max_j++); + } + + // find what hasn't been changed + $array = array(); + while ($i < $max_i && + $j < $max_j && + strcmp($diff[$i], $diff[$j]) == 0) { + $array[] = substr($diff[$i], 2); + $i++; + $j++; + } + + while ($i < $max_i && ($max_j-$j) <= 1) { + if ($diff[$i] != '' && substr($diff[$i], 0, 1) != ' ') { + break; + } + $array[] = substr($diff[$i++], 2); + } + + while ($j < $max_j && ($max_i-$i) <= 1) { + if ($diff[$j] != '' && substr($diff[$j], 0, 1) != ' ') { + break; + } + $array[] = substr($diff[$j++], 2); + } + if (count($array) > 0) { + $edits[] = &new Text_Diff_Op_copy($array); + } + + if ($i < $max_i) { + $diff1 = array(); + switch (substr($diff[$i], 0, 1)) { + case '!': + $diff2 = array(); + do { + $diff1[] = substr($diff[$i], 2); + if ($j < $max_j && substr($diff[$j], 0, 1) == '!') { + $diff2[] = substr($diff[$j++], 2); + } + } while (++$i < $max_i && substr($diff[$i], 0, 1) == '!'); + $edits[] = &new Text_Diff_Op_change($diff1, $diff2); + break; + + case '+': + do { + $diff1[] = substr($diff[$i], 2); + } while (++$i < $max_i && substr($diff[$i], 0, 1) == '+'); + $edits[] = &new Text_Diff_Op_add($diff1); + break; + + case '-': + do { + $diff1[] = substr($diff[$i], 2); + } while (++$i < $max_i && substr($diff[$i], 0, 1) == '-'); + $edits[] = &new Text_Diff_Op_delete($diff1); + break; + } + } + + if ($j < $max_j) { + $diff2 = array(); + switch (substr($diff[$j], 0, 1)) { + case '+': + do { + $diff2[] = substr($diff[$j++], 2); + } while ($j < $max_j && substr($diff[$j], 0, 1) == '+'); + $edits[] = &new Text_Diff_Op_add($diff2); + break; + + case '-': + do { + $diff2[] = substr($diff[$j++], 2); + } while ($j < $max_j && substr($diff[$j], 0, 1) == '-'); + $edits[] = &new Text_Diff_Op_delete($diff2); + break; + } + } + } + + return $edits; + } + +} diff --git a/src/wp-includes/Text/Diff/Engine/xdiff.php b/src/wp-includes/Text/Diff/Engine/xdiff.php new file mode 100644 index 0000000..b9f1736 --- /dev/null +++ b/src/wp-includes/Text/Diff/Engine/xdiff.php @@ -0,0 +1,64 @@ + + * @package Text_Diff + */ +class Text_Diff_Engine_xdiff { + + /** + */ + function diff($from_lines, $to_lines) + { + array_walk($from_lines, array('Text_Diff', 'trimNewlines')); + array_walk($to_lines, array('Text_Diff', 'trimNewlines')); + + /* Convert the two input arrays into strings for xdiff processing. */ + $from_string = implode("\n", $from_lines); + $to_string = implode("\n", $to_lines); + + /* Diff the two strings and convert the result to an array. */ + $diff = xdiff_string_diff($from_string, $to_string, count($to_lines)); + $diff = explode("\n", $diff); + + /* Walk through the diff one line at a time. We build the $edits + * array of diff operations by reading the first character of the + * xdiff output (which is in the "unified diff" format). + * + * Note that we don't have enough information to detect "changed" + * lines using this approach, so we can't add Text_Diff_Op_changed + * instances to the $edits array. The result is still perfectly + * valid, albeit a little less descriptive and efficient. */ + $edits = array(); + foreach ($diff as $line) { + if (!strlen($line)) { + continue; + } + switch ($line[0]) { + case ' ': + $edits[] = &new Text_Diff_Op_copy(array(substr($line, 1))); + break; + + case '+': + $edits[] = &new Text_Diff_Op_add(array(substr($line, 1))); + break; + + case '-': + $edits[] = &new Text_Diff_Op_delete(array(substr($line, 1))); + break; + } + } + + return $edits; + } + +} diff --git a/src/wp-includes/Text/Diff/Renderer.php b/src/wp-includes/Text/Diff/Renderer.php new file mode 100644 index 0000000..922f4c0 --- /dev/null +++ b/src/wp-includes/Text/Diff/Renderer.php @@ -0,0 +1,235 @@ + $value) { + $v = '_' . $param; + if (isset($this->$v)) { + $this->$v = $value; + } + } + } + + /** + * Get any renderer parameters. + * + * @return array All parameters of this renderer object. + */ + function getParams() + { + $params = array(); + foreach (get_object_vars($this) as $k => $v) { + if ($k[0] == '_') { + $params[substr($k, 1)] = $v; + } + } + + return $params; + } + + /** + * Renders a diff. + * + * @param Text_Diff $diff A Text_Diff object. + * + * @return string The formatted output. + */ + function render($diff) + { + $xi = $yi = 1; + $block = false; + $context = array(); + + $nlead = $this->_leading_context_lines; + $ntrail = $this->_trailing_context_lines; + + $output = $this->_startDiff(); + + $diffs = $diff->getDiff(); + foreach ($diffs as $i => $edit) { + /* If these are unchanged (copied) lines, and we want to keep + * leading or trailing context lines, extract them from the copy + * block. */ + if (is_a($edit, 'Text_Diff_Op_copy')) { + /* Do we have any diff blocks yet? */ + if (is_array($block)) { + /* How many lines to keep as context from the copy + * block. */ + $keep = $i == count($diffs) - 1 ? $ntrail : $nlead + $ntrail; + if (count($edit->orig) <= $keep) { + /* We have less lines in the block than we want for + * context => keep the whole block. */ + $block[] = $edit; + } else { + if ($ntrail) { + /* Create a new block with as many lines as we need + * for the trailing context. */ + $context = array_slice($edit->orig, 0, $ntrail); + $block[] = &new Text_Diff_Op_copy($context); + } + /* @todo */ + $output .= $this->_block($x0, $ntrail + $xi - $x0, + $y0, $ntrail + $yi - $y0, + $block); + $block = false; + } + } + /* Keep the copy block as the context for the next block. */ + $context = $edit->orig; + } else { + /* Don't we have any diff blocks yet? */ + if (!is_array($block)) { + /* Extract context lines from the preceding copy block. */ + $context = array_slice($context, count($context) - $nlead); + $x0 = $xi - count($context); + $y0 = $yi - count($context); + $block = array(); + if ($context) { + $block[] = &new Text_Diff_Op_copy($context); + } + } + $block[] = $edit; + } + + if ($edit->orig) { + $xi += count($edit->orig); + } + if ($edit->final) { + $yi += count($edit->final); + } + } + + if (is_array($block)) { + $output .= $this->_block($x0, $xi - $x0, + $y0, $yi - $y0, + $block); + } + + return $output . $this->_endDiff(); + } + + function _block($xbeg, $xlen, $ybeg, $ylen, &$edits) + { + $output = $this->_startBlock($this->_blockHeader($xbeg, $xlen, $ybeg, $ylen)); + + foreach ($edits as $edit) { + switch (strtolower(get_class($edit))) { + case 'text_diff_op_copy': + $output .= $this->_context($edit->orig); + break; + + case 'text_diff_op_add': + $output .= $this->_added($edit->final); + break; + + case 'text_diff_op_delete': + $output .= $this->_deleted($edit->orig); + break; + + case 'text_diff_op_change': + $output .= $this->_changed($edit->orig, $edit->final); + break; + } + } + + return $output . $this->_endBlock(); + } + + function _startDiff() + { + return ''; + } + + function _endDiff() + { + return ''; + } + + function _blockHeader($xbeg, $xlen, $ybeg, $ylen) + { + if ($xlen > 1) { + $xbeg .= ',' . ($xbeg + $xlen - 1); + } + if ($ylen > 1) { + $ybeg .= ',' . ($ybeg + $ylen - 1); + } + + // this matches the GNU Diff behaviour + if ($xlen && !$ylen) { + $ybeg--; + } elseif (!$xlen) { + $xbeg--; + } + + return $xbeg . ($xlen ? ($ylen ? 'c' : 'd') : 'a') . $ybeg; + } + + function _startBlock($header) + { + return $header . "\n"; + } + + function _endBlock() + { + return ''; + } + + function _lines($lines, $prefix = ' ') + { + return $prefix . implode("\n$prefix", $lines) . "\n"; + } + + function _context($lines) + { + return $this->_lines($lines, ' '); + } + + function _added($lines) + { + return $this->_lines($lines, '> '); + } + + function _deleted($lines) + { + return $this->_lines($lines, '< '); + } + + function _changed($orig, $final) + { + return $this->_deleted($orig) . "---\n" . $this->_added($final); + } + +} diff --git a/src/wp-includes/Text/Diff/Renderer/inline.php b/src/wp-includes/Text/Diff/Renderer/inline.php new file mode 100644 index 0000000..392bd57 --- /dev/null +++ b/src/wp-includes/Text/Diff/Renderer/inline.php @@ -0,0 +1,206 @@ +'; + + /** + * Suffix for inserted text. + * + * @var string + */ + var $_ins_suffix = ''; + + /** + * Prefix for deleted text. + * + * @var string + */ + var $_del_prefix = ''; + + /** + * Suffix for deleted text. + * + * @var string + */ + var $_del_suffix = ''; + + /** + * Header for each change block. + * + * @var string + */ + var $_block_header = ''; + + /** + * Whether to split down to character-level. + * + * @var boolean + */ + var $_split_characters = false; + + /** + * What are we currently splitting on? Used to recurse to show word-level + * or character-level changes. + * + * @var string + */ + var $_split_level = 'lines'; + + function _blockHeader($xbeg, $xlen, $ybeg, $ylen) + { + return $this->_block_header; + } + + function _startBlock($header) + { + return $header; + } + + function _lines($lines, $prefix = ' ', $encode = true) + { + if ($encode) { + array_walk($lines, array(&$this, '_encode')); + } + + if ($this->_split_level == 'lines') { + return implode("\n", $lines) . "\n"; + } else { + return implode('', $lines); + } + } + + function _added($lines) + { + array_walk($lines, array(&$this, '_encode')); + $lines[0] = $this->_ins_prefix . $lines[0]; + $lines[count($lines) - 1] .= $this->_ins_suffix; + return $this->_lines($lines, ' ', false); + } + + function _deleted($lines, $words = false) + { + array_walk($lines, array(&$this, '_encode')); + $lines[0] = $this->_del_prefix . $lines[0]; + $lines[count($lines) - 1] .= $this->_del_suffix; + return $this->_lines($lines, ' ', false); + } + + function _changed($orig, $final) + { + /* If we've already split on characters, just display. */ + if ($this->_split_level == 'characters') { + return $this->_deleted($orig) + . $this->_added($final); + } + + /* If we've already split on words, just display. */ + if ($this->_split_level == 'words') { + $prefix = ''; + while ($orig[0] !== false && $final[0] !== false && + substr($orig[0], 0, 1) == ' ' && + substr($final[0], 0, 1) == ' ') { + $prefix .= substr($orig[0], 0, 1); + $orig[0] = substr($orig[0], 1); + $final[0] = substr($final[0], 1); + } + return $prefix . $this->_deleted($orig) . $this->_added($final); + } + + $text1 = implode("\n", $orig); + $text2 = implode("\n", $final); + + /* Non-printing newline marker. */ + $nl = "\0"; + + if ($this->_split_characters) { + $diff = new Text_Diff('native', + array(preg_split('//', $text1), + preg_split('//', $text2))); + } else { + /* We want to split on word boundaries, but we need to preserve + * whitespace as well. Therefore we split on words, but include + * all blocks of whitespace in the wordlist. */ + $diff = new Text_Diff('native', + array($this->_splitOnWords($text1, $nl), + $this->_splitOnWords($text2, $nl))); + } + + /* Get the diff in inline format. */ + $renderer = new Text_Diff_Renderer_inline + (array_merge($this->getParams(), + array('split_level' => $this->_split_characters ? 'characters' : 'words'))); + + /* Run the diff and get the output. */ + return str_replace($nl, "\n", $renderer->render($diff)) . "\n"; + } + + function _splitOnWords($string, $newlineEscape = "\n") + { + // Ignore \0; otherwise the while loop will never finish. + $string = str_replace("\0", '', $string); + + $words = array(); + $length = strlen($string); + $pos = 0; + + while ($pos < $length) { + // Eat a word with any preceding whitespace. + $spaces = strspn(substr($string, $pos), " \n"); + $nextpos = strcspn(substr($string, $pos + $spaces), " \n"); + $words[] = str_replace("\n", $newlineEscape, substr($string, $pos, $spaces + $nextpos)); + $pos += $spaces + $nextpos; + } + + return $words; + } + + function _encode(&$string) + { + $string = htmlspecialchars($string); + } + +} diff --git a/src/wp-includes/admin-bar.php b/src/wp-includes/admin-bar.php new file mode 100644 index 0000000..99caaa7 --- /dev/null +++ b/src/wp-includes/admin-bar.php @@ -0,0 +1,450 @@ +initialize(); + $wp_admin_bar->add_menus(); + + return true; +} +add_action( 'init', '_wp_admin_bar_init' ); // Don't remove. Wrong way to disable. + +/** + * Render the admin bar to the page based on the $wp_admin_bar->menu member var. + * This is called very late on the footer actions so that it will render after anything else being + * added to the footer. + * + * It includes the action "admin_bar_menu" which should be used to hook in and + * add new menus to the admin bar. That way you can be sure that you are adding at most optimal point, + * right before the admin bar is rendered. This also gives you access to the $post global, among others. + * + * @since 3.1.0 + */ +function wp_admin_bar_render() { + global $wp_admin_bar; + + if ( ! is_admin_bar_showing() || ! is_object( $wp_admin_bar ) ) + return false; + + $wp_admin_bar->load_user_locale_translations(); + + do_action_ref_array( 'admin_bar_menu', array( &$wp_admin_bar ) ); + + do_action( 'wp_before_admin_bar_render' ); + + $wp_admin_bar->render(); + + do_action( 'wp_after_admin_bar_render' ); + + $wp_admin_bar->unload_user_locale_translations(); +} +add_action( 'wp_footer', 'wp_admin_bar_render', 1000 ); +add_action( 'admin_footer', 'wp_admin_bar_render', 1000 ); + +/** + * Add the "My Account" menu and all submenus. + * + * @since 3.1.0 + */ +function wp_admin_bar_my_account_menu( $wp_admin_bar ) { + global $user_identity; + + $user_id = get_current_user_id(); + + if ( 0 != $user_id ) { + /* Add the 'My Account' menu */ + $avatar = get_avatar( get_current_user_id(), 16 ); + $id = ( ! empty( $avatar ) ) ? 'my-account-with-avatar' : 'my-account'; + + $wp_admin_bar->add_menu( array( 'id' => $id, 'title' => $avatar . $user_identity, 'href' => get_edit_profile_url( $user_id ) ) ); + + /* Add the "My Account" sub menus */ + $wp_admin_bar->add_menu( array( 'id' => 'edit-profile', 'parent' => $id, 'title' => __( 'Edit My Profile' ), 'href' => get_edit_profile_url( $user_id ) ) ); + $wp_admin_bar->add_menu( array( 'id' => 'logout', 'parent' => $id, 'title' => __( 'Log Out' ), 'href' => wp_logout_url() ) ); + } +} + +/** + * Add the "Dashboard"/"Visit Site" menu. + * + * @since 3.2.0 + */ +function wp_admin_bar_dashboard_view_site_menu( $wp_admin_bar ) { + $user_id = get_current_user_id(); + + if ( 0 != $user_id ) { + if ( is_admin() ) + $wp_admin_bar->add_menu( array( 'id' => 'view-site', 'title' => __( 'Visit Site' ), 'href' => home_url() ) ); + elseif ( is_multisite() ) + $wp_admin_bar->add_menu( array( 'id' => 'dashboard', 'title' => __( 'Dashboard' ), 'href' => get_dashboard_url( $user_id ) ) ); + else + $wp_admin_bar->add_menu( array( 'id' => 'dashboard', 'title' => __( 'Dashboard' ), 'href' => admin_url() ) ); + } +} + +/** + * Add the "My Sites/[Site Name]" menu and all submenus. + * + * @since 3.1.0 + */ +function wp_admin_bar_my_sites_menu( $wp_admin_bar ) { + global $wpdb; + + /* Add the 'My Sites' menu if the user has more than one site. */ + if ( count( $wp_admin_bar->user->blogs ) <= 1 ) + return; + + $wp_admin_bar->add_menu( array( 'id' => 'my-blogs', 'title' => __( 'My Sites' ), 'href' => admin_url( 'my-sites.php' ) ) ); + + $default = includes_url('images/wpmini-blue.png'); + + foreach ( (array) $wp_admin_bar->user->blogs as $blog ) { + // @todo Replace with some favicon lookup. + //$blavatar = 'Blavatar'; + $blavatar = '' . esc_attr__( 'Blavatar' ) . ''; + + $blogname = empty( $blog->blogname ) ? $blog->domain : $blog->blogname; + + $wp_admin_bar->add_menu( array( 'parent' => 'my-blogs', 'id' => 'blog-' . $blog->userblog_id, 'title' => $blavatar . $blogname, 'href' => get_admin_url($blog->userblog_id) ) ); + $wp_admin_bar->add_menu( array( 'parent' => 'blog-' . $blog->userblog_id, 'id' => 'blog-' . $blog->userblog_id . '-d', 'title' => __( 'Dashboard' ), 'href' => get_admin_url($blog->userblog_id) ) ); + + if ( current_user_can_for_blog( $blog->userblog_id, 'edit_posts' ) ) { + $wp_admin_bar->add_menu( array( 'parent' => 'blog-' . $blog->userblog_id, 'id' => 'blog-' . $blog->userblog_id . '-n', 'title' => __( 'New Post' ), 'href' => get_admin_url($blog->userblog_id, 'post-new.php') ) ); + $wp_admin_bar->add_menu( array( 'parent' => 'blog-' . $blog->userblog_id, 'id' => 'blog-' . $blog->userblog_id . '-c', 'title' => __( 'Manage Comments' ), 'href' => get_admin_url($blog->userblog_id, 'edit-comments.php') ) ); + } + + $wp_admin_bar->add_menu( array( 'parent' => 'blog-' . $blog->userblog_id, 'id' => 'blog-' . $blog->userblog_id . '-v', 'title' => __( 'Visit Site' ), 'href' => get_home_url($blog->userblog_id) ) ); + } +} + +/** + * Provide a shortlink. + * + * @since 3.1.0 + */ +function wp_admin_bar_shortlink_menu( $wp_admin_bar ) { + $short = wp_get_shortlink( 0, 'query' ); + $id = 'get-shortlink'; + + if ( empty( $short ) ) + return; + + $html = ''; + + $wp_admin_bar->add_menu( array( + 'id' => $id, + 'title' => __( 'Shortlink' ), + 'href' => $short, + 'meta' => array( 'html' => $html ), + ) ); +} + +/** + * Provide an edit link for posts and terms. + * + * @since 3.1.0 + */ +function wp_admin_bar_edit_menu( $wp_admin_bar ) { + global $post, $tag; + + if ( is_admin() ) { + $current_screen = get_current_screen(); + + if ( 'post' == $current_screen->base + && 'add' != $current_screen->action + && ( $post_type_object = get_post_type_object( $post->post_type ) ) + && current_user_can( $post_type_object->cap->read_post, $post->ID ) + && ( $post_type_object->public ) ) + { + $wp_admin_bar->add_menu( array( + 'id' => 'view', + 'title' => $post_type_object->labels->view_item, + 'href' => get_permalink( $post->ID ) + ) ); + } elseif ( 'edit-tags' == $current_screen->base + && isset( $tag ) && is_object( $tag ) + && ( $tax = get_taxonomy( $tag->taxonomy ) ) + && $tax->public ) + { + $wp_admin_bar->add_menu( array( + 'id' => 'view', + 'title' => $tax->labels->view_item, + 'href' => get_term_link( $tag ) + ) ); + } + } else { + $current_object = get_queried_object(); + + if ( empty($current_object) ) + return; + + if ( ! empty( $current_object->post_type ) + && ( $post_type_object = get_post_type_object( $current_object->post_type ) ) + && current_user_can( $post_type_object->cap->edit_post, $current_object->ID ) + && ( $post_type_object->show_ui || 'attachment' == $current_object->post_type ) ) + { + $wp_admin_bar->add_menu( array( + 'id' => 'edit', + 'title' => $post_type_object->labels->edit_item, + 'href' => get_edit_post_link( $current_object->ID ) + ) ); + } elseif ( ! empty( $current_object->taxonomy ) + && ( $tax = get_taxonomy( $current_object->taxonomy ) ) + && current_user_can( $tax->cap->edit_terms ) + && $tax->show_ui ) + { + $wp_admin_bar->add_menu( array( + 'id' => 'edit', + 'title' => $tax->labels->edit_item, + 'href' => get_edit_term_link( $current_object->term_id, $current_object->taxonomy ) + ) ); + } + } +} + +/** + * Add "Add New" menu. + * + * @since 3.1.0 + */ +function wp_admin_bar_new_content_menu( $wp_admin_bar ) { + $actions = array(); + foreach ( (array) get_post_types( array( 'show_in_admin_bar' => true ), 'objects' ) as $ptype_obj ) { + if ( ! current_user_can( $ptype_obj->cap->edit_posts ) ) + continue; + + $actions[ 'post-new.php?post_type=' . $ptype_obj->name ] = array( $ptype_obj->labels->name_admin_bar, $ptype_obj->cap->edit_posts, 'new-' . $ptype_obj->name ); + } + + if ( current_user_can( 'upload_files' ) ) + $actions[ 'media-new.php' ] = array( _x( 'Media', 'add new from admin bar' ), 'upload_files', 'new-media' ); + + if ( current_user_can( 'manage_links' ) ) + $actions[ 'link-add.php' ] = array( _x( 'Link', 'add new from admin bar' ), 'manage_links', 'new-link' ); + + if ( current_user_can( 'create_users' ) || current_user_can( 'promote_users' ) ) + $actions[ 'user-new.php' ] = array( _x( 'User', 'add new from admin bar' ), 'create_users', 'new-user' ); + + if ( ! is_multisite() && current_user_can( 'install_themes' ) ) + $actions[ 'theme-install.php' ] = array( _x( 'Theme', 'add new from admin bar' ), 'install_themes', 'new-theme' ); + + if ( ! is_multisite() && current_user_can( 'install_plugins' ) ) + $actions[ 'plugin-install.php' ] = array( _x( 'Plugin', 'add new from admin bar' ), 'install_plugins', 'new-plugin' ); + + if ( empty( $actions ) ) + return; + + $wp_admin_bar->add_menu( array( 'id' => 'new-content', 'title' => _x( 'Add New', 'admin bar menu group label' ), 'href' => admin_url( array_shift( array_keys( $actions ) ) ) ) ); + + foreach ( $actions as $link => $action ) { + $wp_admin_bar->add_menu( array( 'parent' => 'new-content', 'id' => $action[2], 'title' => $action[0], 'href' => admin_url($link) ) ); + } +} + +/** + * Add edit comments link with awaiting moderation count bubble. + * + * @since 3.1.0 + */ +function wp_admin_bar_comments_menu( $wp_admin_bar ) { + if ( !current_user_can('edit_posts') ) + return; + + $awaiting_mod = wp_count_comments(); + $awaiting_mod = $awaiting_mod->moderated; + + $awaiting_mod = $awaiting_mod ? "" . number_format_i18n( $awaiting_mod ) . "" : ''; + $wp_admin_bar->add_menu( array( 'id' => 'comments', 'title' => sprintf( __('Comments %s'), $awaiting_mod ), 'href' => admin_url('edit-comments.php') ) ); +} + +/** + * Add "Appearance" menu with widget and nav menu submenu. + * + * @since 3.1.0 + */ +function wp_admin_bar_appearance_menu( $wp_admin_bar ) { + // You can have edit_theme_options but not switch_themes. + if ( ! current_user_can('switch_themes') && ! current_user_can( 'edit_theme_options' ) ) + return; + + $wp_admin_bar->add_menu( array( 'id' => 'appearance', 'title' => __('Appearance'), 'href' => admin_url('themes.php') ) ); + + if ( ! current_user_can( 'edit_theme_options' ) ) + return; + + if ( current_user_can( 'switch_themes' ) ) + $wp_admin_bar->add_menu( array( 'parent' => 'appearance', 'id' => 'themes', 'title' => __('Themes'), 'href' => admin_url('themes.php') ) ); + + if ( current_theme_supports( 'widgets' ) ) + $wp_admin_bar->add_menu( array( 'parent' => 'appearance', 'id' => 'widgets', 'title' => __('Widgets'), 'href' => admin_url('widgets.php') ) ); + + if ( current_theme_supports( 'menus' ) || current_theme_supports( 'widgets' ) ) + $wp_admin_bar->add_menu( array( 'parent' => 'appearance', 'id' => 'menus', 'title' => __('Menus'), 'href' => admin_url('nav-menus.php') ) ); + + if ( current_theme_supports( 'custom-background' ) ) + $wp_admin_bar->add_menu( array( 'parent' => 'appearance', 'id' => 'background', 'title' => __('Background'), 'href' => admin_url('themes.php?page=custom-background') ) ); + + if ( current_theme_supports( 'custom-header' ) ) + $wp_admin_bar->add_menu( array( 'parent' => 'appearance', 'id' => 'header', 'title' => __('Header'), 'href' => admin_url('themes.php?page=custom-header') ) ); +} + +/** + * Provide an update link if theme/plugin/core updates are available. + * + * @since 3.1.0 + */ +function wp_admin_bar_updates_menu( $wp_admin_bar ) { + if ( !current_user_can('install_plugins') ) + return; + + $plugin_update_count = $theme_update_count = $wordpress_update_count = 0; + $update_plugins = get_site_transient( 'update_plugins' ); + if ( !empty($update_plugins->response) ) + $plugin_update_count = count( $update_plugins->response ); + $update_themes = get_site_transient( 'update_themes' ); + if ( !empty($update_themes->response) ) + $theme_update_count = count( $update_themes->response ); + /* @todo get_core_updates() is only available on admin page loads + $update_wordpress = get_core_updates( array('dismissed' => false) ); + if ( !empty($update_wordpress) && !in_array( $update_wordpress[0]->response, array('development', 'latest') ) ) + $wordpress_update_count = 1; + */ + + $update_count = $plugin_update_count + $theme_update_count + $wordpress_update_count; + + if ( !$update_count ) + return; + + $update_title = array(); + if ( $wordpress_update_count ) + $update_title[] = sprintf(__('%d WordPress Update'), $wordpress_update_count); + if ( $plugin_update_count ) + $update_title[] = sprintf(_n('%d Plugin Update', '%d Plugin Updates', $plugin_update_count), $plugin_update_count); + if ( $theme_update_count ) + $update_title[] = sprintf(_n('%d Theme Update', '%d Theme Updates', $theme_update_count), $theme_update_count); + + $update_title = !empty($update_title) ? esc_attr(implode(', ', $update_title)) : ''; + + $update_title = ""; + $update_title .= sprintf( __('Updates %s'), "" . number_format_i18n($update_count) . '' ); + $update_title .= ''; + + $wp_admin_bar->add_menu( array( 'id' => 'updates', 'title' => $update_title, 'href' => network_admin_url( 'update-core.php' ) ) ); +} + +/** + * Style and scripts for the admin bar. + * + * @since 3.1.0 + * + */ +function wp_admin_bar_header() { ?> + + + + \ No newline at end of file diff --git a/src/wp-includes/atomlib.php b/src/wp-includes/atomlib.php new file mode 100644 index 0000000..e75ca39 --- /dev/null +++ b/src/wp-includes/atomlib.php @@ -0,0 +1,354 @@ + + * @version 0.4 + * @since 2.3 + */ + +/** + * Structure that store common Atom Feed Properties + * + * @package AtomLib + */ +class AtomFeed { + /** + * Stores Links + * @var array + * @access public + */ + var $links = array(); + /** + * Stores Categories + * @var array + * @access public + */ + var $categories = array(); + /** + * Stores Entries + * + * @var array + * @access public + */ + var $entries = array(); +} + +/** + * Structure that store Atom Entry Properties + * + * @package AtomLib + */ +class AtomEntry { + /** + * Stores Links + * @var array + * @access public + */ + var $links = array(); + /** + * Stores Categories + * @var array + * @access public + */ + var $categories = array(); +} + +/** + * AtomLib Atom Parser API + * + * @package AtomLib + */ +class AtomParser { + + var $NS = 'http://www.w3.org/2005/Atom'; + var $ATOM_CONTENT_ELEMENTS = array('content','summary','title','subtitle','rights'); + var $ATOM_SIMPLE_ELEMENTS = array('id','updated','published','draft'); + + var $debug = false; + + var $depth = 0; + var $indent = 2; + var $in_content; + var $ns_contexts = array(); + var $ns_decls = array(); + var $content_ns_decls = array(); + var $content_ns_contexts = array(); + var $is_xhtml = false; + var $is_html = false; + var $is_text = true; + var $skipped_div = false; + + var $FILE = "php://input"; + + var $feed; + var $current; + + function AtomParser() { + + $this->feed = new AtomFeed(); + $this->current = null; + $this->map_attrs_func = create_function('$k,$v', 'return "$k=\"$v\"";'); + $this->map_xmlns_func = create_function('$p,$n', '$xd = "xmlns"; if(strlen($n[0])>0) $xd .= ":{$n[0]}"; return "{$xd}=\"{$n[1]}\"";'); + } + + function _p($msg) { + if($this->debug) { + print str_repeat(" ", $this->depth * $this->indent) . $msg ."\n"; + } + } + + function error_handler($log_level, $log_text, $error_file, $error_line) { + $this->error = $log_text; + } + + function parse() { + + set_error_handler(array(&$this, 'error_handler')); + + array_unshift($this->ns_contexts, array()); + + $parser = xml_parser_create_ns(); + xml_set_object($parser, $this); + xml_set_element_handler($parser, "start_element", "end_element"); + xml_parser_set_option($parser,XML_OPTION_CASE_FOLDING,0); + xml_parser_set_option($parser,XML_OPTION_SKIP_WHITE,0); + xml_set_character_data_handler($parser, "cdata"); + xml_set_default_handler($parser, "_default"); + xml_set_start_namespace_decl_handler($parser, "start_ns"); + xml_set_end_namespace_decl_handler($parser, "end_ns"); + + $this->content = ''; + + $ret = true; + + $fp = fopen($this->FILE, "r"); + while ($data = fread($fp, 4096)) { + if($this->debug) $this->content .= $data; + + if(!xml_parse($parser, $data, feof($fp))) { + trigger_error(sprintf(__('XML error: %s at line %d')."\n", + xml_error_string(xml_get_error_code($xml_parser)), + xml_get_current_line_number($xml_parser))); + $ret = false; + break; + } + } + fclose($fp); + + xml_parser_free($parser); + + restore_error_handler(); + + return $ret; + } + + function start_element($parser, $name, $attrs) { + + $tag = array_pop(split(":", $name)); + + switch($name) { + case $this->NS . ':feed': + $this->current = $this->feed; + break; + case $this->NS . ':entry': + $this->current = new AtomEntry(); + break; + }; + + $this->_p("start_element('$name')"); + #$this->_p(print_r($this->ns_contexts,true)); + #$this->_p('current(' . $this->current . ')'); + + array_unshift($this->ns_contexts, $this->ns_decls); + + $this->depth++; + + if(!empty($this->in_content)) { + + $this->content_ns_decls = array(); + + if($this->is_html || $this->is_text) + trigger_error("Invalid content in element found. Content must not be of type text or html if it contains markup."); + + $attrs_prefix = array(); + + // resolve prefixes for attributes + foreach($attrs as $key => $value) { + $with_prefix = $this->ns_to_prefix($key, true); + $attrs_prefix[$with_prefix[1]] = $this->xml_escape($value); + } + + $attrs_str = join(' ', array_map($this->map_attrs_func, array_keys($attrs_prefix), array_values($attrs_prefix))); + if(strlen($attrs_str) > 0) { + $attrs_str = " " . $attrs_str; + } + + $with_prefix = $this->ns_to_prefix($name); + + if(!$this->is_declared_content_ns($with_prefix[0])) { + array_push($this->content_ns_decls, $with_prefix[0]); + } + + $xmlns_str = ''; + if(count($this->content_ns_decls) > 0) { + array_unshift($this->content_ns_contexts, $this->content_ns_decls); + $xmlns_str .= join(' ', array_map($this->map_xmlns_func, array_keys($this->content_ns_contexts[0]), array_values($this->content_ns_contexts[0]))); + if(strlen($xmlns_str) > 0) { + $xmlns_str = " " . $xmlns_str; + } + } + + array_push($this->in_content, array($tag, $this->depth, "<". $with_prefix[1] ."{$xmlns_str}{$attrs_str}" . ">")); + + } else if(in_array($tag, $this->ATOM_CONTENT_ELEMENTS) || in_array($tag, $this->ATOM_SIMPLE_ELEMENTS)) { + $this->in_content = array(); + $this->is_xhtml = $attrs['type'] == 'xhtml'; + $this->is_html = $attrs['type'] == 'html' || $attrs['type'] == 'text/html'; + $this->is_text = !in_array('type',array_keys($attrs)) || $attrs['type'] == 'text'; + $type = $this->is_xhtml ? 'XHTML' : ($this->is_html ? 'HTML' : ($this->is_text ? 'TEXT' : $attrs['type'])); + + if(in_array('src',array_keys($attrs))) { + $this->current->$tag = $attrs; + } else { + array_push($this->in_content, array($tag,$this->depth, $type)); + } + } else if($tag == 'link') { + array_push($this->current->links, $attrs); + } else if($tag == 'category') { + array_push($this->current->categories, $attrs); + } + + $this->ns_decls = array(); + } + + function end_element($parser, $name) { + + $tag = array_pop(split(":", $name)); + + $ccount = count($this->in_content); + + # if we are *in* content, then let's proceed to serialize it + if(!empty($this->in_content)) { + # if we are ending the original content element + # then let's finalize the content + if($this->in_content[0][0] == $tag && + $this->in_content[0][1] == $this->depth) { + $origtype = $this->in_content[0][2]; + array_shift($this->in_content); + $newcontent = array(); + foreach($this->in_content as $c) { + if(count($c) == 3) { + array_push($newcontent, $c[2]); + } else { + if($this->is_xhtml || $this->is_text) { + array_push($newcontent, $this->xml_escape($c)); + } else { + array_push($newcontent, $c); + } + } + } + if(in_array($tag, $this->ATOM_CONTENT_ELEMENTS)) { + $this->current->$tag = array($origtype, join('',$newcontent)); + } else { + $this->current->$tag = join('',$newcontent); + } + $this->in_content = array(); + } else if($this->in_content[$ccount-1][0] == $tag && + $this->in_content[$ccount-1][1] == $this->depth) { + $this->in_content[$ccount-1][2] = substr($this->in_content[$ccount-1][2],0,-1) . "/>"; + } else { + # else, just finalize the current element's content + $endtag = $this->ns_to_prefix($name); + array_push($this->in_content, array($tag, $this->depth, "")); + } + } + + array_shift($this->ns_contexts); + + $this->depth--; + + if($name == ($this->NS . ':entry')) { + array_push($this->feed->entries, $this->current); + $this->current = null; + } + + $this->_p("end_element('$name')"); + } + + function start_ns($parser, $prefix, $uri) { + $this->_p("starting: " . $prefix . ":" . $uri); + array_push($this->ns_decls, array($prefix,$uri)); + } + + function end_ns($parser, $prefix) { + $this->_p("ending: #" . $prefix . "#"); + } + + function cdata($parser, $data) { + $this->_p("data: #" . str_replace(array("\n"), array("\\n"), trim($data)) . "#"); + if(!empty($this->in_content)) { + array_push($this->in_content, $data); + } + } + + function _default($parser, $data) { + # when does this gets called? + } + + + function ns_to_prefix($qname, $attr=false) { + # split 'http://www.w3.org/1999/xhtml:div' into ('http','//www.w3.org/1999/xhtml','div') + $components = split(":", $qname); + + # grab the last one (e.g 'div') + $name = array_pop($components); + + if(!empty($components)) { + # re-join back the namespace component + $ns = join(":",$components); + foreach($this->ns_contexts as $context) { + foreach($context as $mapping) { + if($mapping[1] == $ns && strlen($mapping[0]) > 0) { + return array($mapping, "$mapping[0]:$name"); + } + } + } + } + + if($attr) { + return array(null, $name); + } else { + foreach($this->ns_contexts as $context) { + foreach($context as $mapping) { + if(strlen($mapping[0]) == 0) { + return array($mapping, $name); + } + } + } + } + } + + function is_declared_content_ns($new_mapping) { + foreach($this->content_ns_contexts as $context) { + foreach($context as $mapping) { + if($new_mapping == $mapping) { + return true; + } + } + } + return false; + } + + function xml_escape($string) + { + return str_replace(array('&','"',"'",'<','>'), + array('&','"',''','<','>'), + $string ); + } +} + +?> diff --git a/src/wp-includes/author-template.php b/src/wp-includes/author-template.php new file mode 100644 index 0000000..f082fb2 --- /dev/null +++ b/src/wp-includes/author-template.php @@ -0,0 +1,401 @@ +display_name : null); +} + +/** + * Display the name of the author of the current post. + * + * The behavior of this function is based off of old functionality predating + * get_the_author(). This function is not deprecated, but is designed to echo + * the value from get_the_author() and as an result of any old theme that might + * still use the old behavior will also pass the value from get_the_author(). + * + * The normal, expected behavior of this function is to echo the author and not + * return it. However, backwards compatiability has to be maintained. + * + * @since 0.71 + * @see get_the_author() + * @link http://codex.wordpress.org/Template_Tags/the_author + * + * @param string $deprecated Deprecated. + * @param string $deprecated_echo Deprecated. Use get_the_author(). Echo the string or return it. + * @return string The author's display name, from get_the_author(). + */ +function the_author( $deprecated = '', $deprecated_echo = true ) { + if ( !empty( $deprecated ) ) + _deprecated_argument( __FUNCTION__, '2.1' ); + if ( $deprecated_echo !== true ) + _deprecated_argument( __FUNCTION__, '1.5', __('Use get_the_author() instead if you do not want the value echoed.') ); + if ( $deprecated_echo ) + echo get_the_author(); + return get_the_author(); +} + +/** + * Retrieve the author who last edited the current post. + * + * @since 2.8 + * @uses $post The current post's DB object. + * @uses get_post_meta() Retrieves the ID of the author who last edited the current post. + * @uses get_userdata() Retrieves the author's DB object. + * @uses apply_filters() Calls 'the_modified_author' hook on the author display name. + * @return string The author's display name. + */ +function get_the_modified_author() { + global $post; + if ( $last_id = get_post_meta($post->ID, '_edit_last', true) ) { + $last_user = get_userdata($last_id); + return apply_filters('the_modified_author', $last_user->display_name); + } +} + +/** + * Display the name of the author who last edited the current post. + * + * @since 2.8 + * @see get_the_author() + * @return string The author's display name, from get_the_modified_author(). + */ +function the_modified_author() { + echo get_the_modified_author(); +} + +/** + * Retrieve the requested data of the author of the current post. + * @link http://codex.wordpress.org/Template_Tags/the_author_meta + * @since 2.8.0 + * @uses $authordata The current author's DB object (if $user_id not specified). + * @param string $field selects the field of the users record. + * @param int $user_id Optional. User ID. + * @return string The author's field from the current author's DB object. + */ +function get_the_author_meta($field = '', $user_id = false) { + if ( ! $user_id ) + global $authordata; + else + $authordata = get_userdata( $user_id ); + + // Keys used as object vars cannot have dashes. + $field = str_replace('-', '', $field); + $field = strtolower($field); + $user_field = "user_$field"; + + if ( 'id' == $field ) + $value = isset($authordata->ID) ? (int)$authordata->ID : 0; + elseif ( isset($authordata->$user_field) ) + $value = $authordata->$user_field; + else + $value = isset($authordata->$field) ? $authordata->$field : ''; + + return apply_filters('get_the_author_' . $field, $value, $user_id); +} + +/** + * Retrieve the requested data of the author of the current post. + * @link http://codex.wordpress.org/Template_Tags/the_author_meta + * @since 2.8.0 + * @param string $field selects the field of the users record. + * @param int $user_id Optional. User ID. + * @echo string The author's field from the current author's DB object. + */ +function the_author_meta($field = '', $user_id = false) { + echo apply_filters('the_author_' . $field, get_the_author_meta($field, $user_id), $user_id); +} + +/** + * Retrieve either author's link or author's name. + * + * If the author has a home page set, return an HTML link, otherwise just return the + * author's name. + * + * @uses get_the_author_meta() + * @uses get_the_author() + */ +function get_the_author_link() { + if ( get_the_author_meta('url') ) { + return '' . get_the_author() . ''; + } else { + return get_the_author(); + } +} + +/** + * Display either author's link or author's name. + * + * If the author has a home page set, echo an HTML link, otherwise just echo the + * author's name. + * + * @link http://codex.wordpress.org/Template_Tags/the_author_link + * @since 2.1 + * @uses get_the_author_link() + */ +function the_author_link() { + echo get_the_author_link(); +} + +/** + * Retrieve the number of posts by the author of the current post. + * + * @since 1.5 + * @uses $post The current post in the Loop's DB object. + * @uses count_user_posts() + * @return int The number of posts by the author. + */ +function get_the_author_posts() { + global $post; + return count_user_posts($post->post_author); +} + +/** + * Display the number of posts by the author of the current post. + * + * @link http://codex.wordpress.org/Template_Tags/the_author_posts + * @since 0.71 + * @uses get_the_author_posts() Echoes returned value from function. + */ +function the_author_posts() { + echo get_the_author_posts(); +} + +/** + * Display an HTML link to the author page of the author of the current post. + * + * Does just echo get_author_posts_url() function, like the others do. The + * reason for this, is that another function is used to help in printing the + * link to the author's posts. + * + * @link http://codex.wordpress.org/Template_Tags/the_author_posts_link + * @since 1.2.0 + * @uses $authordata The current author's DB object. + * @uses get_author_posts_url() + * @uses get_the_author() + * @param string $deprecated Deprecated. + */ +function the_author_posts_link($deprecated = '') { + if ( !empty( $deprecated ) ) + _deprecated_argument( __FUNCTION__, '2.1' ); + + global $authordata; + if ( !is_object( $authordata ) ) + return false; + $link = sprintf( + '', + get_author_posts_url( $authordata->ID, $authordata->user_nicename ), + esc_attr( sprintf( __( 'Posts by %s' ), get_the_author() ) ), + get_the_author() + ); + echo apply_filters( 'the_author_posts_link', $link ); +} + +/** + * Retrieve the URL to the author page for the user with the ID provided. + * + * @since 2.1.0 + * @uses $wp_rewrite WP_Rewrite + * @return string The URL to the author's page. + */ +function get_author_posts_url($author_id, $author_nicename = '') { + global $wp_rewrite; + $auth_ID = (int) $author_id; + $link = $wp_rewrite->get_author_permastruct(); + + if ( empty($link) ) { + $file = home_url( '/' ); + $link = $file . '?author=' . $auth_ID; + } else { + if ( '' == $author_nicename ) { + $user = get_userdata($author_id); + if ( !empty($user->user_nicename) ) + $author_nicename = $user->user_nicename; + } + $link = str_replace('%author%', $author_nicename, $link); + $link = home_url( user_trailingslashit( $link ) ); + } + + $link = apply_filters('author_link', $link, $author_id, $author_nicename); + + return $link; +} + +/** + * List all the authors of the blog, with several options available. + * + *
                + *
              • optioncount (boolean) (false): Show the count in parenthesis next to the + * author's name.
              • + *
              • exclude_admin (boolean) (true): Exclude the 'admin' user that is + * installed bydefault.
              • + *
              • show_fullname (boolean) (false): Show their full names.
              • + *
              • hide_empty (boolean) (true): Don't show authors without any posts.
              • + *
              • feed (string) (''): If isn't empty, show links to author's feeds.
              • + *
              • feed_image (string) (''): If isn't empty, use this image to link to + * feeds.
              • + *
              • echo (boolean) (true): Set to false to return the output, instead of + * echoing.
              • + *
              • style (string) ('list'): Whether to display list of authors in list form + * or as a string.
              • + *
              • html (bool) (true): Whether to list the items in html form or plaintext. + *
              • + *
              + * + * @link http://codex.wordpress.org/Template_Tags/wp_list_authors + * @since 1.2.0 + * @param array $args The argument array. + * @return null|string The output, if echo is set to false. + */ +function wp_list_authors($args = '') { + global $wpdb; + + $defaults = array( + 'orderby' => 'name', 'order' => 'ASC', 'number' => '', + 'optioncount' => false, 'exclude_admin' => true, + 'show_fullname' => false, 'hide_empty' => true, + 'feed' => '', 'feed_image' => '', 'feed_type' => '', 'echo' => true, + 'style' => 'list', 'html' => true + ); + + $args = wp_parse_args( $args, $defaults ); + extract( $args, EXTR_SKIP ); + + $return = ''; + + $query_args = wp_array_slice_assoc( $args, array( 'orderby', 'order', 'number' ) ); + $query_args['fields'] = 'ids'; + $authors = get_users( $query_args ); + + $author_count = array(); + foreach ( (array) $wpdb->get_results("SELECT DISTINCT post_author, COUNT(ID) AS count FROM $wpdb->posts WHERE post_type = 'post' AND " . get_private_posts_cap_sql( 'post' ) . " GROUP BY post_author") as $row ) + $author_count[$row->post_author] = $row->count; + + foreach ( $authors as $author_id ) { + $author = get_userdata( $author_id ); + + if ( $exclude_admin && 'admin' == $author->display_name ) + continue; + + $posts = isset( $author_count[$author->ID] ) ? $author_count[$author->ID] : 0; + + if ( !$posts && $hide_empty ) + continue; + + $link = ''; + + if ( $show_fullname && $author->first_name && $author->last_name ) + $name = "$author->first_name $author->last_name"; + else + $name = $author->display_name; + + if ( !$html ) { + $return .= $name . ', '; + + continue; // No need to go further to process HTML. + } + + if ( 'list' == $style ) { + $return .= '
            • '; + } + + $link = 'display_name) ) . '">' . $name . ''; + + if ( !empty( $feed_image ) || !empty( $feed ) ) { + $link .= ' '; + if ( empty( $feed_image ) ) { + $link .= '('; + } + + $link .= ''; + else + $link .= $name; + + $link .= ''; + + if ( empty( $feed_image ) ) + $link .= ')'; + } + + if ( $optioncount ) + $link .= ' ('. $posts . ')'; + + $return .= $link; + $return .= ( 'list' == $style ) ? '
            • ' : ', '; + } + + $return = rtrim($return, ', '); + + if ( !$echo ) + return $return; + + echo $return; +} + +/** + * Does this site have more than one author + * + * Checks to see if more than one author has published posts. + * + * @since 3.2.0 + * @return bool Whether or not we have more than one author + */ +function is_multi_author() { + global $wpdb; + + if ( false === ( $is_multi_author = wp_cache_get('is_multi_author', 'posts') ) ) { + $rows = (array) $wpdb->get_col("SELECT DISTINCT post_author FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish' LIMIT 2"); + $is_multi_author = 1 < count( $rows ) ? 1 : 0; + wp_cache_set('is_multi_author', $is_multi_author, 'posts'); + } + + return (bool) $is_multi_author; +} + +/** + * Helper function to clear the cache for number of authors. + * + * @private + */ +function __clear_multi_author_cache() { + wp_cache_delete('is_multi_author', 'posts'); +} +add_action('transition_post_status', '__clear_multi_author_cache'); + +?> diff --git a/src/wp-includes/bookmark-template.php b/src/wp-includes/bookmark-template.php new file mode 100644 index 0000000..7c5949c --- /dev/null +++ b/src/wp-includes/bookmark-template.php @@ -0,0 +1,256 @@ +' (string). The html or text to prepend to each + * bookmarks. + * 'after' - Default is '' (string). The html or text to append to each + * bookmarks. + * 'link_before' - Default is '' (string). The html or text to prepend to each + * bookmarks inside the tag. + * 'link_after' - Default is '' (string). The html or text to append to each + * bookmarks inside the tag. + * 'between' - Default is '\n' (string). The string for use in between the link, + * description, and image. + * 'show_rating' - Default is 0 (integer). Whether to show the link rating. + * + * @since 2.1.0 + * @access private + * @usedby wp_list_bookmarks() + * + * @param array $bookmarks List of bookmarks to traverse + * @param string|array $args Optional. Overwrite the defaults. + * @return string Formatted output in HTML + */ +function _walk_bookmarks($bookmarks, $args = '' ) { + $defaults = array( + 'show_updated' => 0, 'show_description' => 0, + 'show_images' => 1, 'show_name' => 0, + 'before' => '
            • ', 'after' => '
            • ', 'between' => "\n", + 'show_rating' => 0, 'link_before' => '', 'link_after' => '' + ); + + $r = wp_parse_args( $args, $defaults ); + extract( $r, EXTR_SKIP ); + + $output = ''; // Blank string to start with. + + foreach ( (array) $bookmarks as $bookmark ) { + if ( !isset($bookmark->recently_updated) ) + $bookmark->recently_updated = false; + $output .= $before; + if ( $show_updated && $bookmark->recently_updated ) + $output .= get_option('links_recently_updated_prepend'); + + $the_link = '#'; + if ( !empty($bookmark->link_url) ) + $the_link = esc_url($bookmark->link_url); + + $desc = esc_attr(sanitize_bookmark_field('link_description', $bookmark->link_description, $bookmark->link_id, 'display')); + $name = esc_attr(sanitize_bookmark_field('link_name', $bookmark->link_name, $bookmark->link_id, 'display')); + $title = $desc; + + if ( $show_updated ) + if ( '00' != substr($bookmark->link_updated_f, 0, 2) ) { + $title .= ' ('; + $title .= sprintf(__('Last updated: %s'), date(get_option('links_updated_date_format'), $bookmark->link_updated_f + (get_option('gmt_offset') * 3600))); + $title .= ')'; + } + + $alt = ' alt="' . $name . ( $show_description ? ' ' . $title : '' ) . '"'; + + if ( '' != $title ) + $title = ' title="' . $title . '"'; + + $rel = $bookmark->link_rel; + if ( '' != $rel ) + $rel = ' rel="' . esc_attr($rel) . '"'; + + $target = $bookmark->link_target; + if ( '' != $target ) + $target = ' target="' . $target . '"'; + + $output .= '
              '; + + $output .= $link_before; + + if ( $bookmark->link_image != null && $show_images ) { + if ( strpos($bookmark->link_image, 'http') === 0 ) + $output .= "link_image\" $alt $title />"; + else // If it's a relative path + $output .= "link_image\" $alt $title />"; + + if ( $show_name ) + $output .= " $name"; + } else { + $output .= $name; + } + + $output .= $link_after; + + $output .= ''; + + if ( $show_updated && $bookmark->recently_updated ) + $output .= get_option('links_recently_updated_append'); + + if ( $show_description && '' != $desc ) + $output .= $between . $desc; + + if ( $show_rating ) + $output .= $between . sanitize_bookmark_field('link_rating', $bookmark->link_rating, $bookmark->link_id, 'display'); + + $output .= "$after\n"; + } // end while + + return $output; +} + +/** + * Retrieve or echo all of the bookmarks. + * + * List of default arguments are as follows: + * 'orderby' - Default is 'name' (string). How to order the links by. String is + * based off of the bookmark scheme. + * 'order' - Default is 'ASC' (string). Either 'ASC' or 'DESC'. Orders in either + * ascending or descending order. + * 'limit' - Default is -1 (integer) or show all. The amount of bookmarks to + * display. + * 'category' - Default is empty string (string). Include the links in what + * category ID(s). + * 'category_name' - Default is empty string (string). Get links by category + * name. + * 'hide_invisible' - Default is 1 (integer). Whether to show (default) or hide + * links marked as 'invisible'. + * 'show_updated' - Default is 0 (integer). Will show the time of when the + * bookmark was last updated. + * 'echo' - Default is 1 (integer). Whether to echo (default) or return the + * formatted bookmarks. + * 'categorize' - Default is 1 (integer). Whether to show links listed by + * category (default) or show links in one column. + * 'show_description' - Default is 0 (integer). Whether to show the description + * of the bookmark. + * + * These options define how the Category name will appear before the category + * links are displayed, if 'categorize' is 1. If 'categorize' is 0, then it will + * display for only the 'title_li' string and only if 'title_li' is not empty. + * 'title_li' - Default is 'Bookmarks' (translatable string). What to show + * before the links appear. + * 'title_before' - Default is '

              ' (string). The HTML or text to show before + * the 'title_li' string. + * 'title_after' - Default is '

              ' (string). The HTML or text to show after + * the 'title_li' string. + * 'class' - Default is 'linkcat' (string). The CSS class to use for the + * 'title_li'. + * + * 'category_before' - Default is '
            • '. String must + * contain '%id' and '%class' to get + * the id of the category and the 'class' argument. These are used for + * formatting in themes. + * Argument will be displayed before the 'title_before' argument. + * 'category_after' - Default is '
            • ' (string). The HTML or text that will + * appear after the list of links. + * + * These are only used if 'categorize' is set to 1 or true. + * 'category_orderby' - Default is 'name'. How to order the bookmark category + * based on term scheme. + * 'category_order' - Default is 'ASC'. Set the order by either ASC (ascending) + * or DESC (descending). + * + * @see _walk_bookmarks() For other arguments that can be set in this function + * and passed to _walk_bookmarks(). + * @see get_bookmarks() For other arguments that can be set in this function and + * passed to get_bookmarks(). + * @link http://codex.wordpress.org/Template_Tags/wp_list_bookmarks + * + * @since 2.1.0 + * @uses _list_bookmarks() Used to iterate over all of the bookmarks and return + * the html + * @uses get_terms() Gets all of the categories that are for links. + * + * @param string|array $args Optional. Overwrite the defaults of the function + * @return string|null Will only return if echo option is set to not echo. + * Default is not return anything. + */ +function wp_list_bookmarks($args = '') { + $defaults = array( + 'orderby' => 'name', 'order' => 'ASC', + 'limit' => -1, 'category' => '', 'exclude_category' => '', + 'category_name' => '', 'hide_invisible' => 1, + 'show_updated' => 0, 'echo' => 1, + 'categorize' => 1, 'title_li' => __('Bookmarks'), + 'title_before' => '

              ', 'title_after' => '

              ', + 'category_orderby' => 'name', 'category_order' => 'ASC', + 'class' => 'linkcat', 'category_before' => '
            • ', + 'category_after' => '
            • ' + ); + + $r = wp_parse_args( $args, $defaults ); + extract( $r, EXTR_SKIP ); + + $output = ''; + + if ( $categorize ) { + //Split the bookmarks into ul's for each category + $cats = get_terms('link_category', array('name__like' => $category_name, 'include' => $category, 'exclude' => $exclude_category, 'orderby' => $category_orderby, 'order' => $category_order, 'hierarchical' => 0)); + + foreach ( (array) $cats as $cat ) { + $params = array_merge($r, array('category'=>$cat->term_id)); + $bookmarks = get_bookmarks($params); + if ( empty($bookmarks) ) + continue; + $output .= str_replace(array('%id', '%class'), array("linkcat-$cat->term_id", $class), $category_before); + $catname = apply_filters( "link_category", $cat->name ); + $output .= "$title_before$catname$title_after\n\t
                \n"; + $output .= _walk_bookmarks($bookmarks, $r); + $output .= "\n\t
              \n$category_after\n"; + } + } else { + //output one single list using title_li for the title + $bookmarks = get_bookmarks($r); + + if ( !empty($bookmarks) ) { + if ( !empty( $title_li ) ){ + $output .= str_replace(array('%id', '%class'), array("linkcat-$category", $class), $category_before); + $output .= "$title_before$title_li$title_after\n\t
                \n"; + $output .= _walk_bookmarks($bookmarks, $r); + $output .= "\n\t
              \n$category_after\n"; + } else { + $output .= _walk_bookmarks($bookmarks, $r); + } + } + } + + $output = apply_filters( 'wp_list_bookmarks', $output ); + + if ( !$echo ) + return $output; + echo $output; +} + +?> diff --git a/src/wp-includes/bookmark.php b/src/wp-includes/bookmark.php new file mode 100644 index 0000000..e118423 --- /dev/null +++ b/src/wp-includes/bookmark.php @@ -0,0 +1,380 @@ +link_id, $bookmark, 'bookmark'); + $_bookmark = $bookmark; + } else { + if ( isset($GLOBALS['link']) && ($GLOBALS['link']->link_id == $bookmark) ) { + $_bookmark = & $GLOBALS['link']; + } elseif ( ! $_bookmark = wp_cache_get($bookmark, 'bookmark') ) { + $_bookmark = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->links WHERE link_id = %d LIMIT 1", $bookmark)); + $_bookmark->link_category = array_unique( wp_get_object_terms($_bookmark->link_id, 'link_category', array('fields' => 'ids')) ); + wp_cache_add($_bookmark->link_id, $_bookmark, 'bookmark'); + } + } + + $_bookmark = sanitize_bookmark($_bookmark, $filter); + + if ( $output == OBJECT ) { + return $_bookmark; + } elseif ( $output == ARRAY_A ) { + return get_object_vars($_bookmark); + } elseif ( $output == ARRAY_N ) { + return array_values(get_object_vars($_bookmark)); + } else { + return $_bookmark; + } +} + +/** + * Retrieve single bookmark data item or field. + * + * @since 2.3.0 + * @uses get_bookmark() Gets bookmark object using $bookmark as ID + * @uses sanitize_bookmark_field() Sanitizes Bookmark field based on $context. + * + * @param string $field The name of the data field to return + * @param int $bookmark The bookmark ID to get field + * @param string $context Optional. The context of how the field will be used. + * @return string + */ +function get_bookmark_field( $field, $bookmark, $context = 'display' ) { + $bookmark = (int) $bookmark; + $bookmark = get_bookmark( $bookmark ); + + if ( is_wp_error($bookmark) ) + return $bookmark; + + if ( !is_object($bookmark) ) + return ''; + + if ( !isset($bookmark->$field) ) + return ''; + + return sanitize_bookmark_field($field, $bookmark->$field, $bookmark->link_id, $context); +} + +/** + * Retrieves the list of bookmarks + * + * Attempts to retrieve from the cache first based on MD5 hash of arguments. If + * that fails, then the query will be built from the arguments and executed. The + * results will be stored to the cache. + * + * List of default arguments are as follows: + * 'orderby' - Default is 'name' (string). How to order the links by. String is + * based off of the bookmark scheme. + * 'order' - Default is 'ASC' (string). Either 'ASC' or 'DESC'. Orders in either + * ascending or descending order. + * 'limit' - Default is -1 (integer) or show all. The amount of bookmarks to + * display. + * 'category' - Default is empty string (string). Include the links in what + * category ID(s). + * 'category_name' - Default is empty string (string). Get links by category + * name. + * 'hide_invisible' - Default is 1 (integer). Whether to show (default) or hide + * links marked as 'invisible'. + * 'show_updated' - Default is 0 (integer). Will show the time of when the + * bookmark was last updated. + * 'include' - Default is empty string (string). Include other categories + * separated by commas. + * 'exclude' - Default is empty string (string). Exclude other categories + * separated by commas. + * + * @since 2.1.0 + * @uses $wpdb Database Object + * @link http://codex.wordpress.org/Template_Tags/get_bookmarks + * + * @param string|array $args List of arguments to overwrite the defaults + * @return array List of bookmark row objects + */ +function get_bookmarks($args = '') { + global $wpdb; + + $defaults = array( + 'orderby' => 'name', 'order' => 'ASC', + 'limit' => -1, 'category' => '', + 'category_name' => '', 'hide_invisible' => 1, + 'show_updated' => 0, 'include' => '', + 'exclude' => '', 'search' => '' + ); + + $r = wp_parse_args( $args, $defaults ); + extract( $r, EXTR_SKIP ); + + $cache = array(); + $key = md5( serialize( $r ) ); + if ( $cache = wp_cache_get( 'get_bookmarks', 'bookmark' ) ) { + if ( is_array($cache) && isset( $cache[ $key ] ) ) + return apply_filters('get_bookmarks', $cache[ $key ], $r ); + } + + if ( !is_array($cache) ) + $cache = array(); + + $inclusions = ''; + if ( !empty($include) ) { + $exclude = ''; //ignore exclude, category, and category_name params if using include + $category = ''; + $category_name = ''; + $inclinks = preg_split('/[\s,]+/',$include); + if ( count($inclinks) ) { + foreach ( $inclinks as $inclink ) { + if (empty($inclusions)) + $inclusions = ' AND ( link_id = ' . intval($inclink) . ' '; + else + $inclusions .= ' OR link_id = ' . intval($inclink) . ' '; + } + } + } + if (!empty($inclusions)) + $inclusions .= ')'; + + $exclusions = ''; + if ( !empty($exclude) ) { + $exlinks = preg_split('/[\s,]+/',$exclude); + if ( count($exlinks) ) { + foreach ( $exlinks as $exlink ) { + if (empty($exclusions)) + $exclusions = ' AND ( link_id <> ' . intval($exlink) . ' '; + else + $exclusions .= ' AND link_id <> ' . intval($exlink) . ' '; + } + } + } + if (!empty($exclusions)) + $exclusions .= ')'; + + if ( !empty($category_name) ) { + if ( $category = get_term_by('name', $category_name, 'link_category') ) { + $category = $category->term_id; + } else { + $cache[ $key ] = array(); + wp_cache_set( 'get_bookmarks', $cache, 'bookmark' ); + return apply_filters( 'get_bookmarks', array(), $r ); + } + } + + if ( ! empty($search) ) { + $search = like_escape($search); + $search = " AND ( (link_url LIKE '%$search%') OR (link_name LIKE '%$search%') OR (link_description LIKE '%$search%') ) "; + } + + $category_query = ''; + $join = ''; + if ( !empty($category) ) { + $incategories = preg_split('/[\s,]+/',$category); + if ( count($incategories) ) { + foreach ( $incategories as $incat ) { + if (empty($category_query)) + $category_query = ' AND ( tt.term_id = ' . intval($incat) . ' '; + else + $category_query .= ' OR tt.term_id = ' . intval($incat) . ' '; + } + } + } + if (!empty($category_query)) { + $category_query .= ") AND taxonomy = 'link_category'"; + $join = " INNER JOIN $wpdb->term_relationships AS tr ON ($wpdb->links.link_id = tr.object_id) INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_taxonomy_id = tr.term_taxonomy_id"; + } + + if ( $show_updated && get_option('links_recently_updated_time') ) { + $recently_updated_test = ", IF (DATE_ADD(link_updated, INTERVAL " . get_option('links_recently_updated_time') . " MINUTE) >= NOW(), 1,0) as recently_updated "; + } else { + $recently_updated_test = ''; + } + + $get_updated = ( $show_updated ) ? ', UNIX_TIMESTAMP(link_updated) AS link_updated_f ' : ''; + + $orderby = strtolower($orderby); + $length = ''; + switch ( $orderby ) { + case 'length': + $length = ", CHAR_LENGTH(link_name) AS length"; + break; + case 'rand': + $orderby = 'rand()'; + break; + case 'link_id': + $orderby = "$wpdb->links.link_id"; + break; + default: + $orderparams = array(); + foreach ( explode(',', $orderby) as $ordparam ) { + $ordparam = trim($ordparam); + if ( in_array( $ordparam, array( 'name', 'url', 'visible', 'rating', 'owner', 'updated' ) ) ) + $orderparams[] = 'link_' . $ordparam; + } + $orderby = implode(',', $orderparams); + } + + if ( empty( $orderby ) ) + $orderby = 'link_name'; + + $order = strtoupper( $order ); + if ( '' !== $order && !in_array( $order, array( 'ASC', 'DESC' ) ) ) + $order = 'ASC'; + + $visible = ''; + if ( $hide_invisible ) + $visible = "AND link_visible = 'Y'"; + + $query = "SELECT * $length $recently_updated_test $get_updated FROM $wpdb->links $join WHERE 1=1 $visible $category_query"; + $query .= " $exclusions $inclusions $search"; + $query .= " ORDER BY $orderby $order"; + if ($limit != -1) + $query .= " LIMIT $limit"; + + $results = $wpdb->get_results($query); + + $cache[ $key ] = $results; + wp_cache_set( 'get_bookmarks', $cache, 'bookmark' ); + + return apply_filters('get_bookmarks', $results, $r); +} + +/** + * Sanitizes all bookmark fields + * + * @since 2.3.0 + * + * @param object|array $bookmark Bookmark row + * @param string $context Optional, default is 'display'. How to filter the + * fields + * @return object|array Same type as $bookmark but with fields sanitized. + */ +function sanitize_bookmark($bookmark, $context = 'display') { + $fields = array('link_id', 'link_url', 'link_name', 'link_image', 'link_target', 'link_category', + 'link_description', 'link_visible', 'link_owner', 'link_rating', 'link_updated', + 'link_rel', 'link_notes', 'link_rss', ); + + if ( is_object($bookmark) ) { + $do_object = true; + $link_id = $bookmark->link_id; + } else { + $do_object = false; + $link_id = $bookmark['link_id']; + } + + foreach ( $fields as $field ) { + if ( $do_object ) { + if ( isset($bookmark->$field) ) + $bookmark->$field = sanitize_bookmark_field($field, $bookmark->$field, $link_id, $context); + } else { + if ( isset($bookmark[$field]) ) + $bookmark[$field] = sanitize_bookmark_field($field, $bookmark[$field], $link_id, $context); + } + } + + return $bookmark; +} + +/** + * Sanitizes a bookmark field + * + * Sanitizes the bookmark fields based on what the field name is. If the field + * has a strict value set, then it will be tested for that, else a more generic + * filtering is applied. After the more strict filter is applied, if the + * $context is 'raw' then the value is immediately return. + * + * Hooks exist for the more generic cases. With the 'edit' context, the + * 'edit_$field' filter will be called and passed the $value and $bookmark_id + * respectively. With the 'db' context, the 'pre_$field' filter is called and + * passed the value. The 'display' context is the final context and has the + * $field has the filter name and is passed the $value, $bookmark_id, and + * $context respectively. + * + * @since 2.3.0 + * + * @param string $field The bookmark field + * @param mixed $value The bookmark field value + * @param int $bookmark_id Bookmark ID + * @param string $context How to filter the field value. Either 'raw', 'edit', + * 'attribute', 'js', 'db', or 'display' + * @return mixed The filtered value + */ +function sanitize_bookmark_field($field, $value, $bookmark_id, $context) { + switch ( $field ) { + case 'link_id' : // ints + case 'link_rating' : + $value = (int) $value; + break; + case 'link_category' : // array( ints ) + $value = array_map('absint', (array) $value); + // We return here so that the categories aren't filtered. + // The 'link_category' filter is for the name of a link category, not an array of a link's link categories + return $value; + break; + case 'link_visible' : // bool stored as Y|N + $value = preg_replace('/[^YNyn]/', '', $value); + break; + case 'link_target' : // "enum" + $targets = array('_top', '_blank'); + if ( ! in_array($value, $targets) ) + $value = ''; + break; + } + + if ( 'raw' == $context ) + return $value; + + if ( 'edit' == $context ) { + $value = apply_filters("edit_$field", $value, $bookmark_id); + + if ( 'link_notes' == $field ) { + $value = esc_html( $value ); // textarea_escaped + } else { + $value = esc_attr($value); + } + } else if ( 'db' == $context ) { + $value = apply_filters("pre_$field", $value); + } else { + // Use display filters by default. + $value = apply_filters($field, $value, $bookmark_id, $context); + + if ( 'attribute' == $context ) + $value = esc_attr($value); + else if ( 'js' == $context ) + $value = esc_js($value); + } + + return $value; +} + +/** + * Deletes bookmark cache + * + * @since 2.7.0 + * @uses wp_cache_delete() Deletes the contents of 'get_bookmarks' + */ +function clean_bookmark_cache($bookmark_id) { + wp_cache_delete( $bookmark_id, 'bookmark' ); + wp_cache_delete( 'get_bookmarks', 'bookmark' ); +} + +?> diff --git a/src/wp-includes/cache.php b/src/wp-includes/cache.php new file mode 100644 index 0000000..f73f02b --- /dev/null +++ b/src/wp-includes/cache.php @@ -0,0 +1,486 @@ +add($key, $data, $flag, $expire); +} + +/** + * Closes the cache. + * + * This function has ceased to do anything since WordPress 2.5. The + * functionality was removed along with the rest of the persistant cache. This + * does not mean that plugins can't implement this function when they need to + * make sure that the cache is cleaned up after WordPress no longer needs it. + * + * @since 2.0.0 + * + * @return bool Always returns True + */ +function wp_cache_close() { + return true; +} + +/** + * Removes the cache contents matching ID and flag. + * + * @since 2.0.0 + * @uses $wp_object_cache Object Cache Class + * @see WP_Object_Cache::delete() + * + * @param int|string $id What the contents in the cache are called + * @param string $flag Where the cache contents are grouped + * @return bool True on successful removal, false on failure + */ +function wp_cache_delete($id, $flag = '') { + global $wp_object_cache; + + return $wp_object_cache->delete($id, $flag); +} + +/** + * Removes all cache items. + * + * @since 2.0.0 + * @uses $wp_object_cache Object Cache Class + * @see WP_Object_Cache::flush() + * + * @return bool Always returns true + */ +function wp_cache_flush() { + global $wp_object_cache; + + return $wp_object_cache->flush(); +} + +/** + * Retrieves the cache contents from the cache by ID and flag. + * + * @since 2.0.0 + * @uses $wp_object_cache Object Cache Class + * @see WP_Object_Cache::get() + * + * @param int|string $id What the contents in the cache are called + * @param string $flag Where the cache contents are grouped + * @return bool|mixed False on failure to retrieve contents or the cache + * contents on success + */ +function wp_cache_get($id, $flag = '') { + global $wp_object_cache; + + return $wp_object_cache->get($id, $flag); +} + +/** + * Sets up Object Cache Global and assigns it. + * + * @since 2.0.0 + * @global WP_Object_Cache $wp_object_cache WordPress Object Cache + */ +function wp_cache_init() { + $GLOBALS['wp_object_cache'] =& new WP_Object_Cache(); +} + +/** + * Replaces the contents of the cache with new data. + * + * @since 2.0.0 + * @uses $wp_object_cache Object Cache Class + * @see WP_Object_Cache::replace() + * + * @param int|string $key What to call the contents in the cache + * @param mixed $data The contents to store in the cache + * @param string $flag Where to group the cache contents + * @param int $expire When to expire the cache contents + * @return bool False if cache ID and group already exists, true on success + */ +function wp_cache_replace($key, $data, $flag = '', $expire = 0) { + global $wp_object_cache; + + return $wp_object_cache->replace($key, $data, $flag, $expire); +} + +/** + * Saves the data to the cache. + * + * @since 2.0 + * @uses $wp_object_cache Object Cache Class + * @see WP_Object_Cache::set() + * + * @param int|string $key What to call the contents in the cache + * @param mixed $data The contents to store in the cache + * @param string $flag Where to group the cache contents + * @param int $expire When to expire the cache contents + * @return bool False if cache ID and group already exists, true on success + */ +function wp_cache_set($key, $data, $flag = '', $expire = 0) { + global $wp_object_cache; + + return $wp_object_cache->set($key, $data, $flag, $expire); +} + +/** + * Adds a group or set of groups to the list of global groups. + * + * @since 2.6.0 + * + * @param string|array $groups A group or an array of groups to add + */ +function wp_cache_add_global_groups( $groups ) { + global $wp_object_cache; + + return $wp_object_cache->add_global_groups($groups); +} + +/** + * Adds a group or set of groups to the list of non-persistent groups. + * + * @since 2.6.0 + * + * @param string|array $groups A group or an array of groups to add + */ +function wp_cache_add_non_persistent_groups( $groups ) { + // Default cache doesn't persist so nothing to do here. + return; +} + +/** + * Reset internal cache keys and structures. If the cache backend uses global blog or site IDs as part of its cache keys, + * this function instructs the backend to reset those keys and perform any cleanup since blog or site IDs have changed since cache init. + * + * @since 2.6.0 + */ +function wp_cache_reset() { + global $wp_object_cache; + + return $wp_object_cache->reset(); +} + +/** + * WordPress Object Cache + * + * The WordPress Object Cache is used to save on trips to the database. The + * Object Cache stores all of the cache data to memory and makes the cache + * contents available by using a key, which is used to name and later retrieve + * the cache contents. + * + * The Object Cache can be replaced by other caching mechanisms by placing files + * in the wp-content folder which is looked at in wp-settings. If that file + * exists, then this file will not be included. + * + * @package WordPress + * @subpackage Cache + * @since 2.0 + */ +class WP_Object_Cache { + + /** + * Holds the cached objects + * + * @var array + * @access private + * @since 2.0.0 + */ + var $cache = array (); + + /** + * Cache objects that do not exist in the cache + * + * @var array + * @access private + * @since 2.0.0 + */ + var $non_existent_objects = array (); + + /** + * The amount of times the cache data was already stored in the cache. + * + * @since 2.5.0 + * @access private + * @var int + */ + var $cache_hits = 0; + + /** + * Amount of times the cache did not have the request in cache + * + * @var int + * @access public + * @since 2.0.0 + */ + var $cache_misses = 0; + + /** + * List of global groups + * + * @var array + * @access protected + * @since 3.0.0 + */ + var $global_groups = array(); + + /** + * Adds data to the cache if it doesn't already exist. + * + * @uses WP_Object_Cache::get Checks to see if the cache already has data. + * @uses WP_Object_Cache::set Sets the data after the checking the cache + * contents existance. + * + * @since 2.0.0 + * + * @param int|string $id What to call the contents in the cache + * @param mixed $data The contents to store in the cache + * @param string $group Where to group the cache contents + * @param int $expire When to expire the cache contents + * @return bool False if cache ID and group already exists, true on success + */ + function add( $id, $data, $group = 'default', $expire = '' ) { + if ( empty ($group) ) + $group = 'default'; + + if (false !== $this->get($id, $group)) + return false; + + return $this->set($id, $data, $group, $expire); + } + + /** + * Sets the list of global groups. + * + * @since 3.0.0 + * + * @param array $groups List of groups that are global. + */ + function add_global_groups( $groups ) { + $groups = (array) $groups; + + $this->global_groups = array_merge($this->global_groups, $groups); + $this->global_groups = array_unique($this->global_groups); + } + + /** + * Remove the contents of the cache ID in the group + * + * If the cache ID does not exist in the group and $force parameter is set + * to false, then nothing will happen. The $force parameter is set to false + * by default. + * + * On success the group and the id will be added to the + * $non_existent_objects property in the class. + * + * @since 2.0.0 + * + * @param int|string $id What the contents in the cache are called + * @param string $group Where the cache contents are grouped + * @param bool $force Optional. Whether to force the unsetting of the cache + * ID in the group + * @return bool False if the contents weren't deleted and true on success + */ + function delete($id, $group = 'default', $force = false) { + if (empty ($group)) + $group = 'default'; + + if (!$force && false === $this->get($id, $group)) + return false; + + unset ($this->cache[$group][$id]); + $this->non_existent_objects[$group][$id] = true; + return true; + } + + /** + * Clears the object cache of all data + * + * @since 2.0.0 + * + * @return bool Always returns true + */ + function flush() { + $this->cache = array (); + + return true; + } + + /** + * Retrieves the cache contents, if it exists + * + * The contents will be first attempted to be retrieved by searching by the + * ID in the cache group. If the cache is hit (success) then the contents + * are returned. + * + * On failure, the $non_existent_objects property is checked and if the + * cache group and ID exist in there the cache misses will not be + * incremented. If not in the nonexistent objects property, then the cache + * misses will be incremented and the cache group and ID will be added to + * the nonexistent objects. + * + * @since 2.0.0 + * + * @param int|string $id What the contents in the cache are called + * @param string $group Where the cache contents are grouped + * @return bool|mixed False on failure to retrieve contents or the cache + * contents on success + */ + function get($id, $group = 'default') { + if ( empty ($group) ) + $group = 'default'; + + if ( isset ($this->cache[$group][$id]) ) { + $this->cache_hits += 1; + if ( is_object($this->cache[$group][$id]) ) + return clone $this->cache[$group][$id]; + else + return $this->cache[$group][$id]; + } + + if ( isset ($this->non_existent_objects[$group][$id]) ) + return false; + + $this->non_existent_objects[$group][$id] = true; + $this->cache_misses += 1; + return false; + } + + /** + * Replace the contents in the cache, if contents already exist + * + * @since 2.0.0 + * @see WP_Object_Cache::set() + * + * @param int|string $id What to call the contents in the cache + * @param mixed $data The contents to store in the cache + * @param string $group Where to group the cache contents + * @param int $expire When to expire the cache contents + * @return bool False if not exists, true if contents were replaced + */ + function replace($id, $data, $group = 'default', $expire = '') { + if (empty ($group)) + $group = 'default'; + + if ( false === $this->get($id, $group) ) + return false; + + return $this->set($id, $data, $group, $expire); + } + + /** + * Reset keys + * + * @since 3.0.0 + */ + function reset() { + // Clear out non-global caches since the blog ID has changed. + foreach ( array_keys($this->cache) as $group ) { + if ( !in_array($group, $this->global_groups) ) + unset($this->cache[$group]); + } + } + + /** + * Sets the data contents into the cache + * + * The cache contents is grouped by the $group parameter followed by the + * $id. This allows for duplicate ids in unique groups. Therefore, naming of + * the group should be used with care and should follow normal function + * naming guidelines outside of core WordPress usage. + * + * The $expire parameter is not used, because the cache will automatically + * expire for each time a page is accessed and PHP finishes. The method is + * more for cache plugins which use files. + * + * @since 2.0.0 + * + * @param int|string $id What to call the contents in the cache + * @param mixed $data The contents to store in the cache + * @param string $group Where to group the cache contents + * @param int $expire Not Used + * @return bool Always returns true + */ + function set($id, $data, $group = 'default', $expire = '') { + if ( empty ($group) ) + $group = 'default'; + + if ( NULL === $data ) + $data = ''; + + if ( is_object($data) ) + $data = clone $data; + + $this->cache[$group][$id] = $data; + + if ( isset($this->non_existent_objects[$group][$id]) ) + unset ($this->non_existent_objects[$group][$id]); + + return true; + } + + /** + * Echoes the stats of the caching. + * + * Gives the cache hits, and cache misses. Also prints every cached group, + * key and the data. + * + * @since 2.0.0 + */ + function stats() { + echo "

              "; + echo "Cache Hits: {$this->cache_hits}
              "; + echo "Cache Misses: {$this->cache_misses}
              "; + echo "

              "; + echo '
                '; + foreach ($this->cache as $group => $cache) { + echo "
              • Group: $group - ( " . number_format( strlen( serialize( $cache ) ) / 1024, 2 ) . 'k )
              • '; + } + echo '
              '; + } + + /** + * Sets up object properties; PHP 5 style constructor + * + * @since 2.0.8 + * @return null|WP_Object_Cache If cache is disabled, returns null. + */ + function __construct() { + /** + * @todo This should be moved to the PHP4 style constructor, PHP5 + * already calls __destruct() + */ + register_shutdown_function(array(&$this, "__destruct")); + } + + /** + * Will save the object cache before object is completely destroyed. + * + * Called upon object destruction, which should be when PHP ends. + * + * @since 2.0.8 + * + * @return bool True value. Won't be used by PHP + */ + function __destruct() { + return true; + } +} +?> diff --git a/src/wp-includes/canonical.php b/src/wp-includes/canonical.php new file mode 100644 index 0000000..453641a --- /dev/null +++ b/src/wp-includes/canonical.php @@ -0,0 +1,433 @@ + $wp_query->post_count && ($id = get_query_var('p')) ) { + + $vars = $wpdb->get_results( $wpdb->prepare("SELECT post_type, post_parent FROM $wpdb->posts WHERE ID = %d", $id) ); + + if ( isset($vars[0]) && $vars = $vars[0] ) { + if ( 'revision' == $vars->post_type && $vars->post_parent > 0 ) + $id = $vars->post_parent; + + if ( $redirect_url = get_permalink($id) ) + $redirect['query'] = remove_query_arg(array('p', 'page_id', 'attachment_id', 'post_type'), $redirect['query']); + } + } + + // These tests give us a WP-generated permalink + if ( is_404() ) { + + // Redirect ?page_id, ?p=, ?attachment_id= to their respective url's + $id = max( get_query_var('p'), get_query_var('page_id'), get_query_var('attachment_id') ); + if ( $id && $redirect_post = get_post($id) ) { + $post_type_obj = get_post_type_object($redirect_post->post_type); + if ( $post_type_obj->public ) { + $redirect_url = get_permalink($redirect_post); + $redirect['query'] = remove_query_arg(array('p', 'page_id', 'attachment_id', 'post_type'), $redirect['query']); + } + } + + if ( ! $redirect_url ) + $redirect_url = redirect_guess_404_permalink(); + + } elseif ( is_object($wp_rewrite) && $wp_rewrite->using_permalinks() ) { + // rewriting of old ?p=X, ?m=2004, ?m=200401, ?m=20040101 + if ( is_attachment() && !empty($_GET['attachment_id']) && ! $redirect_url ) { + if ( $redirect_url = get_attachment_link(get_query_var('attachment_id')) ) + $redirect['query'] = remove_query_arg('attachment_id', $redirect['query']); + } elseif ( is_single() && !empty($_GET['p']) && ! $redirect_url ) { + if ( $redirect_url = get_permalink(get_query_var('p')) ) + $redirect['query'] = remove_query_arg(array('p', 'post_type'), $redirect['query']); + } elseif ( is_single() && !empty($_GET['name']) && ! $redirect_url ) { + if ( $redirect_url = get_permalink( $wp_query->get_queried_object_id() ) ) + $redirect['query'] = remove_query_arg('name', $redirect['query']); + } elseif ( is_page() && !empty($_GET['page_id']) && ! $redirect_url ) { + if ( $redirect_url = get_permalink(get_query_var('page_id')) ) + $redirect['query'] = remove_query_arg('page_id', $redirect['query']); + } elseif ( is_page() && !is_feed() && isset($wp_query->queried_object) && 'page' == get_option('show_on_front') && $wp_query->queried_object->ID == get_option('page_on_front') && ! $redirect_url ) { + $redirect_url = home_url('/'); + } elseif ( is_home() && !empty($_GET['page_id']) && 'page' == get_option('show_on_front') && get_query_var('page_id') == get_option('page_for_posts') && ! $redirect_url ) { + if ( $redirect_url = get_permalink(get_option('page_for_posts')) ) + $redirect['query'] = remove_query_arg('page_id', $redirect['query']); + } elseif ( !empty($_GET['m']) && ( is_year() || is_month() || is_day() ) ) { + $m = get_query_var('m'); + switch ( strlen($m) ) { + case 4: // Yearly + $redirect_url = get_year_link($m); + break; + case 6: // Monthly + $redirect_url = get_month_link( substr($m, 0, 4), substr($m, 4, 2) ); + break; + case 8: // Daily + $redirect_url = get_day_link(substr($m, 0, 4), substr($m, 4, 2), substr($m, 6, 2)); + break; + } + if ( $redirect_url ) + $redirect['query'] = remove_query_arg('m', $redirect['query']); + // now moving on to non ?m=X year/month/day links + } elseif ( is_day() && get_query_var('year') && get_query_var('monthnum') && !empty($_GET['day']) ) { + if ( $redirect_url = get_day_link(get_query_var('year'), get_query_var('monthnum'), get_query_var('day')) ) + $redirect['query'] = remove_query_arg(array('year', 'monthnum', 'day'), $redirect['query']); + } elseif ( is_month() && get_query_var('year') && !empty($_GET['monthnum']) ) { + if ( $redirect_url = get_month_link(get_query_var('year'), get_query_var('monthnum')) ) + $redirect['query'] = remove_query_arg(array('year', 'monthnum'), $redirect['query']); + } elseif ( is_year() && !empty($_GET['year']) ) { + if ( $redirect_url = get_year_link(get_query_var('year')) ) + $redirect['query'] = remove_query_arg('year', $redirect['query']); + } elseif ( is_author() && !empty($_GET['author']) && preg_match( '|^[0-9]+$|', $_GET['author'] ) ) { + $author = get_userdata(get_query_var('author')); + if ( ( false !== $author ) && $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE $wpdb->posts.post_author = %d AND $wpdb->posts.post_status = 'publish' LIMIT 1", $author->ID ) ) ) { + if ( $redirect_url = get_author_posts_url($author->ID, $author->user_nicename) ) + $redirect['query'] = remove_query_arg('author', $redirect['query']); + } + } elseif ( is_category() || is_tag() || is_tax() ) { // Terms (Tags/categories) + + $term_count = 0; + foreach ( $wp_query->tax_query->queries as $tax_query ) + $term_count += count( $tax_query['terms'] ); + + $obj = $wp_query->get_queried_object(); + if ( $term_count <= 1 && !empty($obj->term_id) && ( $tax_url = get_term_link((int)$obj->term_id, $obj->taxonomy) ) && !is_wp_error($tax_url) ) { + if ( !empty($redirect['query']) ) { + // Strip taxonomy query vars off the url. + $qv_remove = array( 'term', 'taxonomy'); + if ( is_category() ) { + $qv_remove[] = 'category_name'; + $qv_remove[] = 'cat'; + } elseif ( is_tag() ) { + $qv_remove[] = 'tag'; + $qv_remove[] = 'tag_id'; + } else { // Custom taxonomies will have a custom query var, remove those too: + $tax_obj = get_taxonomy( $obj->taxonomy ); + if ( false !== $tax_obj->query_var ) + $qv_remove[] = $tax_obj->query_var; + } + + $rewrite_vars = array_diff( array_keys($wp_query->query), array_keys($_GET) ); + + if ( !array_diff($rewrite_vars, array_keys($_GET)) ) { // Check to see if all the Query vars are coming from the rewrite, none are set via $_GET + $redirect['query'] = remove_query_arg($qv_remove, $redirect['query']); //Remove all of the per-tax qv's + + // Create the destination url for this taxonomy + $tax_url = parse_url($tax_url); + if ( ! empty($tax_url['query']) ) { // Taxonomy accessable via ?taxonomy=..&term=.. or any custom qv.. + parse_str($tax_url['query'], $query_vars); + $redirect['query'] = add_query_arg($query_vars, $redirect['query']); + } else { // Taxonomy is accessable via a "pretty-URL" + $redirect['path'] = $tax_url['path']; + } + + } else { // Some query vars are set via $_GET. Unset those from $_GET that exist via the rewrite + foreach ( $qv_remove as $_qv ) { + if ( isset($rewrite_vars[$_qv]) ) + $redirect['query'] = remove_query_arg($_qv, $redirect['query']); + } + } + } + + } + } elseif ( is_single() && strpos($wp_rewrite->permalink_structure, '%category%') !== false ) { + $category = get_category_by_path(get_query_var('category_name')); + $post_terms = wp_get_object_terms($wp_query->get_queried_object_id(), 'category', array('fields' => 'tt_ids')); + if ( (!$category || is_wp_error($category)) || ( !is_wp_error($post_terms) && !empty($post_terms) && !in_array($category->term_taxonomy_id, $post_terms) ) ) + $redirect_url = get_permalink($wp_query->get_queried_object_id()); + } + + // Post Paging + if ( is_singular() && get_query_var('page') && $redirect_url ) { + $redirect_url = trailingslashit( $redirect_url ) . user_trailingslashit( get_query_var( 'page' ), 'single_paged' ); + $redirect['query'] = remove_query_arg( 'page', $redirect['query'] ); + } + + // paging and feeds + if ( get_query_var('paged') || is_feed() || get_query_var('cpage') ) { + while ( preg_match( "#/$wp_rewrite->pagination_base/?[0-9]+?(/+)?$#", $redirect['path'] ) || preg_match( '#/(comments/?)?(feed|rss|rdf|atom|rss2)(/+)?$#', $redirect['path'] ) || preg_match( '#/comment-page-[0-9]+(/+)?$#', $redirect['path'] ) ) { + // Strip off paging and feed + $redirect['path'] = preg_replace("#/$wp_rewrite->pagination_base/?[0-9]+?(/+)?$#", '/', $redirect['path']); // strip off any existing paging + $redirect['path'] = preg_replace('#/(comments/?)?(feed|rss2?|rdf|atom)(/+|$)#', '/', $redirect['path']); // strip off feed endings + $redirect['path'] = preg_replace('#/comment-page-[0-9]+?(/+)?$#', '/', $redirect['path']); // strip off any existing comment paging + } + + $addl_path = ''; + if ( is_feed() && in_array( get_query_var('feed'), $wp_rewrite->feeds ) ) { + $addl_path = !empty( $addl_path ) ? trailingslashit($addl_path) : ''; + if ( get_query_var( 'withcomments' ) ) + $addl_path .= 'comments/'; + $addl_path .= user_trailingslashit( 'feed/' . ( ( get_default_feed() == get_query_var('feed') || 'feed' == get_query_var('feed') ) ? '' : get_query_var('feed') ), 'feed' ); + $redirect['query'] = remove_query_arg( 'feed', $redirect['query'] ); + } + + if ( get_query_var('paged') > 0 ) { + $paged = get_query_var('paged'); + $redirect['query'] = remove_query_arg( 'paged', $redirect['query'] ); + if ( !is_feed() ) { + if ( $paged > 1 && !is_single() ) { + $addl_path = ( !empty( $addl_path ) ? trailingslashit($addl_path) : '' ) . user_trailingslashit("$wp_rewrite->pagination_base/$paged", 'paged'); + } elseif ( !is_single() ) { + $addl_path = !empty( $addl_path ) ? trailingslashit($addl_path) : ''; + } + } elseif ( $paged > 1 ) { + $redirect['query'] = add_query_arg( 'paged', $paged, $redirect['query'] ); + } + } + + if ( get_option('page_comments') && ( ( 'newest' == get_option('default_comments_page') && get_query_var('cpage') > 0 ) || ( 'newest' != get_option('default_comments_page') && get_query_var('cpage') > 1 ) ) ) { + $addl_path = ( !empty( $addl_path ) ? trailingslashit($addl_path) : '' ) . user_trailingslashit( 'comment-page-' . get_query_var('cpage'), 'commentpaged' ); + $redirect['query'] = remove_query_arg( 'cpage', $redirect['query'] ); + } + + $redirect['path'] = user_trailingslashit( preg_replace('|/index.php/?$|', '/', $redirect['path']) ); // strip off trailing /index.php/ + if ( !empty( $addl_path ) && $wp_rewrite->using_index_permalinks() && strpos($redirect['path'], '/index.php/') === false ) + $redirect['path'] = trailingslashit($redirect['path']) . 'index.php/'; + if ( !empty( $addl_path ) ) + $redirect['path'] = trailingslashit($redirect['path']) . $addl_path; + $redirect_url = $redirect['scheme'] . '://' . $redirect['host'] . $redirect['path']; + } + } + + // tack on any additional query vars + $redirect['query'] = preg_replace( '#^\??&*?#', '', $redirect['query'] ); + if ( $redirect_url && !empty($redirect['query']) ) { + parse_str( $redirect['query'], $_parsed_query ); + $redirect = @parse_url($redirect_url); + + if ( ! empty( $_parsed_query['name'] ) && ! empty( $redirect['query'] ) ) { + parse_str( $redirect['query'], $_parsed_redirect_query ); + + if ( empty( $_parsed_redirect_query['name'] ) ) + unset( $_parsed_query['name'] ); + } + + $redirect_url = add_query_arg( $_parsed_query, $redirect_url ); + } + + if ( $redirect_url ) + $redirect = @parse_url($redirect_url); + + // www.example.com vs example.com + $user_home = @parse_url(home_url()); + if ( !empty($user_home['host']) ) + $redirect['host'] = $user_home['host']; + if ( empty($user_home['path']) ) + $user_home['path'] = '/'; + + // Handle ports + if ( !empty($user_home['port']) ) + $redirect['port'] = $user_home['port']; + else + unset($redirect['port']); + + // trailing /index.php + $redirect['path'] = preg_replace('|/index.php/*?$|', '/', $redirect['path']); + + // Remove trailing spaces from the path + $redirect['path'] = preg_replace( '#(%20| )+$#', '', $redirect['path'] ); + + if ( !empty( $redirect['query'] ) ) { + // Remove trailing spaces from certain terminating query string args + $redirect['query'] = preg_replace( '#((p|page_id|cat|tag)=[^&]*?)(%20| )+$#', '$1', $redirect['query'] ); + + // Clean up empty query strings + $redirect['query'] = trim(preg_replace( '#(^|&)(p|page_id|cat|tag)=?(&|$)#', '&', $redirect['query']), '&'); + + // Remove redundant leading ampersands + $redirect['query'] = preg_replace( '#^\??&*?#', '', $redirect['query'] ); + } + + // strip /index.php/ when we're not using PATHINFO permalinks + if ( !$wp_rewrite->using_index_permalinks() ) + $redirect['path'] = str_replace('/index.php/', '/', $redirect['path']); + + // trailing slashes + if ( is_object($wp_rewrite) && $wp_rewrite->using_permalinks() && !is_404() && (!is_front_page() || ( is_front_page() && (get_query_var('paged') > 1) ) ) ) { + $user_ts_type = ''; + if ( get_query_var('paged') > 0 ) { + $user_ts_type = 'paged'; + } else { + foreach ( array('single', 'category', 'page', 'day', 'month', 'year', 'home') as $type ) { + $func = 'is_' . $type; + if ( call_user_func($func) ) { + $user_ts_type = $type; + break; + } + } + } + $redirect['path'] = user_trailingslashit($redirect['path'], $user_ts_type); + } elseif ( is_front_page() ) { + $redirect['path'] = trailingslashit($redirect['path']); + } + + // Strip multiple slashes out of the URL + if ( strpos($redirect['path'], '//') > -1 ) + $redirect['path'] = preg_replace('|/+|', '/', $redirect['path']); + + // Always trailing slash the Front Page URL + if ( trailingslashit( $redirect['path'] ) == trailingslashit( $user_home['path'] ) ) + $redirect['path'] = trailingslashit($redirect['path']); + + // Ignore differences in host capitalization, as this can lead to infinite redirects + // Only redirect no-www <=> yes-www + if ( strtolower($original['host']) == strtolower($redirect['host']) || + ( strtolower($original['host']) != 'www.' . strtolower($redirect['host']) && 'www.' . strtolower($original['host']) != strtolower($redirect['host']) ) ) + $redirect['host'] = $original['host']; + + $compare_original = array($original['host'], $original['path']); + + if ( !empty( $original['port'] ) ) + $compare_original[] = $original['port']; + + if ( !empty( $original['query'] ) ) + $compare_original[] = $original['query']; + + $compare_redirect = array($redirect['host'], $redirect['path']); + + if ( !empty( $redirect['port'] ) ) + $compare_redirect[] = $redirect['port']; + + if ( !empty( $redirect['query'] ) ) + $compare_redirect[] = $redirect['query']; + + if ( $compare_original !== $compare_redirect ) { + $redirect_url = $redirect['scheme'] . '://' . $redirect['host']; + if ( !empty($redirect['port']) ) + $redirect_url .= ':' . $redirect['port']; + $redirect_url .= $redirect['path']; + if ( !empty($redirect['query']) ) + $redirect_url .= '?' . $redirect['query']; + } + + if ( !$redirect_url || $redirect_url == $requested_url ) + return false; + + // Hex encoded octets are case-insensitive. + if ( false !== strpos($requested_url, '%') ) { + if ( !function_exists('lowercase_octets') ) { + function lowercase_octets($matches) { + return strtolower( $matches[0] ); + } + } + $requested_url = preg_replace_callback('|%[a-fA-F0-9][a-fA-F0-9]|', 'lowercase_octets', $requested_url); + } + + // Note that you can use the "redirect_canonical" filter to cancel a canonical redirect for whatever reason by returning FALSE + $redirect_url = apply_filters('redirect_canonical', $redirect_url, $requested_url); + + if ( !$redirect_url || $redirect_url == $requested_url ) // yes, again -- in case the filter aborted the request + return false; + + if ( $do_redirect ) { + // protect against chained redirects + if ( !redirect_canonical($redirect_url, false) ) { + wp_redirect($redirect_url, 301); + exit(); + } else { + // Debug + // die("1: $redirect_url
              2: " . redirect_canonical( $redirect_url, false ) ); + return false; + } + } else { + return $redirect_url; + } +} + +/** + * Attempts to guess correct post based on query vars. + * + * @since 2.3.0 + * @uses $wpdb + * + * @return bool|string Returns False, if it can't find post, returns correct + * location on success. + */ +function redirect_guess_404_permalink() { + global $wpdb; + + if ( !get_query_var('name') ) + return false; + + $where = $wpdb->prepare("post_name LIKE %s", like_escape( get_query_var('name') ) . '%'); + + // if any of post_type, year, monthnum, or day are set, use them to refine the query + if ( get_query_var('post_type') ) + $where .= $wpdb->prepare(" AND post_type = %s", get_query_var('post_type')); + if ( get_query_var('year') ) + $where .= $wpdb->prepare(" AND YEAR(post_date) = %d", get_query_var('year')); + if ( get_query_var('monthnum') ) + $where .= $wpdb->prepare(" AND MONTH(post_date) = %d", get_query_var('monthnum')); + if ( get_query_var('day') ) + $where .= $wpdb->prepare(" AND DAYOFMONTH(post_date) = %d", get_query_var('day')); + + $post_id = $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE $where AND post_status = 'publish'"); + if ( !$post_id ) + return false; + return get_permalink($post_id); +} + +add_action('template_redirect', 'redirect_canonical'); + +?> diff --git a/src/wp-includes/capabilities.php b/src/wp-includes/capabilities.php new file mode 100644 index 0000000..28e7541 --- /dev/null +++ b/src/wp-includes/capabilities.php @@ -0,0 +1,1226 @@ + + * array ( + * 'rolename' => array ( + * 'name' => 'rolename', + * 'capabilities' => array() + * ) + * ) + * + * + * @since 2.0.0 + * @package WordPress + * @subpackage User + */ +class WP_Roles { + /** + * List of roles and capabilities. + * + * @since 2.0.0 + * @access public + * @var array + */ + var $roles; + + /** + * List of the role objects. + * + * @since 2.0.0 + * @access public + * @var array + */ + var $role_objects = array(); + + /** + * List of role names. + * + * @since 2.0.0 + * @access public + * @var array + */ + var $role_names = array(); + + /** + * Option name for storing role list. + * + * @since 2.0.0 + * @access public + * @var string + */ + var $role_key; + + /** + * Whether to use the database for retrieval and storage. + * + * @since 2.1.0 + * @access public + * @var bool + */ + var $use_db = true; + + /** + * Constructor + * + * @since 2.0.0 + */ + function __construct() { + $this->_init(); + } + + /** + * Set up the object properties. + * + * The role key is set to the current prefix for the $wpdb object with + * 'user_roles' appended. If the $wp_user_roles global is set, then it will + * be used and the role option will not be updated or used. + * + * @since 2.1.0 + * @access protected + * @uses $wpdb Used to get the database prefix. + * @global array $wp_user_roles Used to set the 'roles' property value. + */ + function _init () { + global $wpdb, $wp_user_roles; + $this->role_key = $wpdb->prefix . 'user_roles'; + if ( ! empty( $wp_user_roles ) ) { + $this->roles = $wp_user_roles; + $this->use_db = false; + } else { + $this->roles = get_option( $this->role_key ); + } + + if ( empty( $this->roles ) ) + return; + + $this->role_objects = array(); + $this->role_names = array(); + foreach ( (array) $this->roles as $role => $data ) { + $this->role_objects[$role] = new WP_Role( $role, $this->roles[$role]['capabilities'] ); + $this->role_names[$role] = $this->roles[$role]['name']; + } + } + + /** + * Add role name with capabilities to list. + * + * Updates the list of roles, if the role doesn't already exist. + * + * The capabilities are defined in the following format `array( 'read' => true );` + * To explicitly deny a role a capability you set the value for that capability to false. + * + * @since 2.0.0 + * @access public + * + * @param string $role Role name. + * @param string $display_name Role display name. + * @param array $capabilities List of role capabilities in the above format. + * @return null|WP_Role WP_Role object if role is added, null if already exists. + */ + function add_role( $role, $display_name, $capabilities = array() ) { + if ( isset( $this->roles[$role] ) ) + return; + + $this->roles[$role] = array( + 'name' => $display_name, + 'capabilities' => $capabilities + ); + if ( $this->use_db ) + update_option( $this->role_key, $this->roles ); + $this->role_objects[$role] = new WP_Role( $role, $capabilities ); + $this->role_names[$role] = $display_name; + return $this->role_objects[$role]; + } + + /** + * Remove role by name. + * + * @since 2.0.0 + * @access public + * + * @param string $role Role name. + */ + function remove_role( $role ) { + if ( ! isset( $this->role_objects[$role] ) ) + return; + + unset( $this->role_objects[$role] ); + unset( $this->role_names[$role] ); + unset( $this->roles[$role] ); + + if ( $this->use_db ) + update_option( $this->role_key, $this->roles ); + } + + /** + * Add capability to role. + * + * @since 2.0.0 + * @access public + * + * @param string $role Role name. + * @param string $cap Capability name. + * @param bool $grant Optional, default is true. Whether role is capable of performing capability. + */ + function add_cap( $role, $cap, $grant = true ) { + $this->roles[$role]['capabilities'][$cap] = $grant; + if ( $this->use_db ) + update_option( $this->role_key, $this->roles ); + } + + /** + * Remove capability from role. + * + * @since 2.0.0 + * @access public + * + * @param string $role Role name. + * @param string $cap Capability name. + */ + function remove_cap( $role, $cap ) { + unset( $this->roles[$role]['capabilities'][$cap] ); + if ( $this->use_db ) + update_option( $this->role_key, $this->roles ); + } + + /** + * Retrieve role object by name. + * + * @since 2.0.0 + * @access public + * + * @param string $role Role name. + * @return object|null Null, if role does not exist. WP_Role object, if found. + */ + function &get_role( $role ) { + if ( isset( $this->role_objects[$role] ) ) + return $this->role_objects[$role]; + else + return null; + } + + /** + * Retrieve list of role names. + * + * @since 2.0.0 + * @access public + * + * @return array List of role names. + */ + function get_names() { + return $this->role_names; + } + + /** + * Whether role name is currently in the list of available roles. + * + * @since 2.0.0 + * @access public + * + * @param string $role Role name to look up. + * @return bool + */ + function is_role( $role ) + { + return isset( $this->role_names[$role] ); + } +} + +/** + * WordPress Role class. + * + * @since 2.0.0 + * @package WordPress + * @subpackage User + */ +class WP_Role { + /** + * Role name. + * + * @since 2.0.0 + * @access public + * @var string + */ + var $name; + + /** + * List of capabilities the role contains. + * + * @since 2.0.0 + * @access public + * @var array + */ + var $capabilities; + + /** + * Constructor - Set up object properties. + * + * The list of capabilities, must have the key as the name of the capability + * and the value a boolean of whether it is granted to the role. + * + * @since 2.0.0 + * @access public + * + * @param string $role Role name. + * @param array $capabilities List of capabilities. + */ + function __construct( $role, $capabilities ) { + $this->name = $role; + $this->capabilities = $capabilities; + } + + /** + * Assign role a capability. + * + * @see WP_Roles::add_cap() Method uses implementation for role. + * @since 2.0.0 + * @access public + * + * @param string $cap Capability name. + * @param bool $grant Whether role has capability privilege. + */ + function add_cap( $cap, $grant = true ) { + global $wp_roles; + + if ( ! isset( $wp_roles ) ) + $wp_roles = new WP_Roles(); + + $this->capabilities[$cap] = $grant; + $wp_roles->add_cap( $this->name, $cap, $grant ); + } + + /** + * Remove capability from role. + * + * This is a container for {@link WP_Roles::remove_cap()} to remove the + * capability from the role. That is to say, that {@link + * WP_Roles::remove_cap()} implements the functionality, but it also makes + * sense to use this class, because you don't need to enter the role name. + * + * @since 2.0.0 + * @access public + * + * @param string $cap Capability name. + */ + function remove_cap( $cap ) { + global $wp_roles; + + if ( ! isset( $wp_roles ) ) + $wp_roles = new WP_Roles(); + + unset( $this->capabilities[$cap] ); + $wp_roles->remove_cap( $this->name, $cap ); + } + + /** + * Whether role has capability. + * + * The capabilities is passed through the 'role_has_cap' filter. The first + * parameter for the hook is the list of capabilities the class has + * assigned. The second parameter is the capability name to look for. The + * third and final parameter for the hook is the role name. + * + * @since 2.0.0 + * @access public + * + * @param string $cap Capability name. + * @return bool True, if user has capability. False, if doesn't have capability. + */ + function has_cap( $cap ) { + $capabilities = apply_filters( 'role_has_cap', $this->capabilities, $cap, $this->name ); + if ( !empty( $capabilities[$cap] ) ) + return $capabilities[$cap]; + else + return false; + } + +} + +/** + * WordPress User class. + * + * @since 2.0.0 + * @package WordPress + * @subpackage User + */ +class WP_User { + /** + * User data container. + * + * This will be set as properties of the object. + * + * @since 2.0.0 + * @access private + * @var array + */ + var $data; + + /** + * The user's ID. + * + * @since 2.1.0 + * @access public + * @var int + */ + var $ID = 0; + + /** + * The deprecated user's ID. + * + * @since 2.0.0 + * @access public + * @deprecated Use WP_User::$ID + * @see WP_User::$ID + * @var int + */ + var $id = 0; + + /** + * The individual capabilities the user has been given. + * + * @since 2.0.0 + * @access public + * @var array + */ + var $caps = array(); + + /** + * User metadata option name. + * + * @since 2.0.0 + * @access public + * @var string + */ + var $cap_key; + + /** + * The roles the user is part of. + * + * @since 2.0.0 + * @access public + * @var array + */ + var $roles = array(); + + /** + * All capabilities the user has, including individual and role based. + * + * @since 2.0.0 + * @access public + * @var array + */ + var $allcaps = array(); + + /** + * First name of the user. + * + * Created to prevent notices. + * + * @since 2.7.0 + * @access public + * @var string + */ + var $first_name = ''; + + /** + * Last name of the user. + * + * Created to prevent notices. + * + * @since 2.7.0 + * @access public + * @var string + */ + var $last_name = ''; + + /** + * The filter context applied to user data fields. + * + * @since 2.9.0 + * @access private + * @var string + */ + var $filter = null; + + /** + * Constructor - Sets up the object properties. + * + * Retrieves the userdata and then assigns all of the data keys to direct + * properties of the object. Calls {@link WP_User::_init_caps()} after + * setting up the object's user data properties. + * + * @since 2.0.0 + * @access public + * + * @param int|string $id User's ID or username + * @param int $name Optional. User's username + * @param int $blog_id Optional Blog ID, defaults to current blog. + * @return WP_User + */ + function __construct( $id, $name = '', $blog_id = '' ) { + + if ( empty( $id ) && empty( $name ) ) + return; + + if ( ! is_numeric( $id ) ) { + $name = $id; + $id = 0; + } + + if ( ! empty( $id ) ) + $this->data = get_userdata( $id ); + else + $this->data = get_userdatabylogin( $name ); + + if ( empty( $this->data->ID ) ) + return; + + foreach ( get_object_vars( $this->data ) as $key => $value ) { + $this->{$key} = $value; + } + + $this->id = $this->ID; + $this->for_blog( $blog_id ); + } + + /** + * Set up capability object properties. + * + * Will set the value for the 'cap_key' property to current database table + * prefix, followed by 'capabilities'. Will then check to see if the + * property matching the 'cap_key' exists and is an array. If so, it will be + * used. + * + * @since 2.1.0 + * + * @param string $cap_key Optional capability key + * @access protected + */ + function _init_caps( $cap_key = '' ) { + global $wpdb; + if ( empty($cap_key) ) + $this->cap_key = $wpdb->prefix . 'capabilities'; + else + $this->cap_key = $cap_key; + $this->caps = &$this->{$this->cap_key}; + if ( ! is_array( $this->caps ) ) + $this->caps = array(); + $this->get_role_caps(); + } + + /** + * Retrieve all of the role capabilities and merge with individual capabilities. + * + * All of the capabilities of the roles the user belongs to are merged with + * the users individual roles. This also means that the user can be denied + * specific roles that their role might have, but the specific user isn't + * granted permission to. + * + * @since 2.0.0 + * @uses $wp_roles + * @access public + */ + function get_role_caps() { + global $wp_roles; + + if ( ! isset( $wp_roles ) ) + $wp_roles = new WP_Roles(); + + //Filter out caps that are not role names and assign to $this->roles + if ( is_array( $this->caps ) ) + $this->roles = array_filter( array_keys( $this->caps ), array( &$wp_roles, 'is_role' ) ); + + //Build $allcaps from role caps, overlay user's $caps + $this->allcaps = array(); + foreach ( (array) $this->roles as $role ) { + $the_role =& $wp_roles->get_role( $role ); + $this->allcaps = array_merge( (array) $this->allcaps, (array) $the_role->capabilities ); + } + $this->allcaps = array_merge( (array) $this->allcaps, (array) $this->caps ); + } + + /** + * Add role to user. + * + * Updates the user's meta data option with capabilities and roles. + * + * @since 2.0.0 + * @access public + * + * @param string $role Role name. + */ + function add_role( $role ) { + $this->caps[$role] = true; + update_user_meta( $this->ID, $this->cap_key, $this->caps ); + $this->get_role_caps(); + $this->update_user_level_from_caps(); + } + + /** + * Remove role from user. + * + * @since 2.0.0 + * @access public + * + * @param string $role Role name. + */ + function remove_role( $role ) { + if ( !in_array($role, $this->roles) ) + return; + unset( $this->caps[$role] ); + update_user_meta( $this->ID, $this->cap_key, $this->caps ); + $this->get_role_caps(); + $this->update_user_level_from_caps(); + } + + /** + * Set the role of the user. + * + * This will remove the previous roles of the user and assign the user the + * new one. You can set the role to an empty string and it will remove all + * of the roles from the user. + * + * @since 2.0.0 + * @access public + * + * @param string $role Role name. + */ + function set_role( $role ) { + foreach ( (array) $this->roles as $oldrole ) + unset( $this->caps[$oldrole] ); + + if ( 1 == count( $this->roles ) && $role == $this->roles[0] ) + return; + + if ( !empty( $role ) ) { + $this->caps[$role] = true; + $this->roles = array( $role => true ); + } else { + $this->roles = false; + } + update_user_meta( $this->ID, $this->cap_key, $this->caps ); + $this->get_role_caps(); + $this->update_user_level_from_caps(); + do_action( 'set_user_role', $this->ID, $role ); + } + + /** + * Choose the maximum level the user has. + * + * Will compare the level from the $item parameter against the $max + * parameter. If the item is incorrect, then just the $max parameter value + * will be returned. + * + * Used to get the max level based on the capabilities the user has. This + * is also based on roles, so if the user is assigned the Administrator role + * then the capability 'level_10' will exist and the user will get that + * value. + * + * @since 2.0.0 + * @access public + * + * @param int $max Max level of user. + * @param string $item Level capability name. + * @return int Max Level. + */ + function level_reduction( $max, $item ) { + if ( preg_match( '/^level_(10|[0-9])$/i', $item, $matches ) ) { + $level = intval( $matches[1] ); + return max( $max, $level ); + } else { + return $max; + } + } + + /** + * Update the maximum user level for the user. + * + * Updates the 'user_level' user metadata (includes prefix that is the + * database table prefix) with the maximum user level. Gets the value from + * the all of the capabilities that the user has. + * + * @since 2.0.0 + * @access public + */ + function update_user_level_from_caps() { + global $wpdb; + $this->user_level = array_reduce( array_keys( $this->allcaps ), array( &$this, 'level_reduction' ), 0 ); + update_user_meta( $this->ID, $wpdb->prefix . 'user_level', $this->user_level ); + } + + /** + * Add capability and grant or deny access to capability. + * + * @since 2.0.0 + * @access public + * + * @param string $cap Capability name. + * @param bool $grant Whether to grant capability to user. + */ + function add_cap( $cap, $grant = true ) { + $this->caps[$cap] = $grant; + update_user_meta( $this->ID, $this->cap_key, $this->caps ); + } + + /** + * Remove capability from user. + * + * @since 2.0.0 + * @access public + * + * @param string $cap Capability name. + */ + function remove_cap( $cap ) { + if ( empty( $this->caps[$cap] ) ) + return; + unset( $this->caps[$cap] ); + update_user_meta( $this->ID, $this->cap_key, $this->caps ); + } + + /** + * Remove all of the capabilities of the user. + * + * @since 2.1.0 + * @access public + */ + function remove_all_caps() { + global $wpdb; + $this->caps = array(); + delete_user_meta( $this->ID, $this->cap_key ); + delete_user_meta( $this->ID, $wpdb->prefix . 'user_level' ); + $this->get_role_caps(); + } + + /** + * Whether user has capability or role name. + * + * This is useful for looking up whether the user has a specific role + * assigned to the user. The second optional parameter can also be used to + * check for capabilities against a specfic post. + * + * @since 2.0.0 + * @access public + * + * @param string|int $cap Capability or role name to search. + * @param int $post_id Optional. Post ID to check capability against specific post. + * @return bool True, if user has capability; false, if user does not have capability. + */ + function has_cap( $cap ) { + if ( is_numeric( $cap ) ) { + _deprecated_argument( __FUNCTION__, '2.0', __('Usage of user levels by plugins and themes is deprecated. Use roles and capabilities instead.') ); + $cap = $this->translate_level_to_cap( $cap ); + } + + $args = array_slice( func_get_args(), 1 ); + $args = array_merge( array( $cap, $this->ID ), $args ); + $caps = call_user_func_array( 'map_meta_cap', $args ); + + // Multisite super admin has all caps by definition, Unless specifically denied. + if ( is_multisite() && is_super_admin( $this->ID ) ) { + if ( in_array('do_not_allow', $caps) ) + return false; + return true; + } + + // Must have ALL requested caps + $capabilities = apply_filters( 'user_has_cap', $this->allcaps, $caps, $args ); + $capabilities['exist'] = true; // Everyone is allowed to exist + foreach ( (array) $caps as $cap ) { + //echo "Checking cap $cap
              "; + if ( empty( $capabilities[$cap] ) || !$capabilities[$cap] ) + return false; + } + + return true; + } + + /** + * Convert numeric level to level capability name. + * + * Prepends 'level_' to level number. + * + * @since 2.0.0 + * @access public + * + * @param int $level Level number, 1 to 10. + * @return string + */ + function translate_level_to_cap( $level ) { + return 'level_' . $level; + } + + /** + * Set the blog to operate on. Defaults to the current blog. + * + * @since 3.0.0 + * + * @param int $blog_id Optional Blog ID, defaults to current blog. + */ + function for_blog( $blog_id = '' ) { + global $wpdb; + if ( ! empty( $blog_id ) ) + $cap_key = $wpdb->get_blog_prefix( $blog_id ) . 'capabilities'; + else + $cap_key = ''; + $this->_init_caps( $cap_key ); + } +} + +/** + * Map meta capabilities to primitive capabilities. + * + * This does not actually compare whether the user ID has the actual capability, + * just what the capability or capabilities are. Meta capability list value can + * be 'delete_user', 'edit_user', 'remove_user', 'promote_user', 'delete_post', + * 'delete_page', 'edit_post', 'edit_page', 'read_post', or 'read_page'. + * + * @since 2.0.0 + * + * @param string $cap Capability name. + * @param int $user_id User ID. + * @return array Actual capabilities for meta capability. + */ +function map_meta_cap( $cap, $user_id ) { + $args = array_slice( func_get_args(), 2 ); + $caps = array(); + + switch ( $cap ) { + case 'remove_user': + $caps[] = 'remove_users'; + break; + case 'promote_user': + $caps[] = 'promote_users'; + break; + case 'edit_user': + // Allow user to edit itself + if ( isset( $args[0] ) && $user_id == $args[0] ) + break; + // Fall through + case 'edit_users': + // If multisite these caps are allowed only for super admins. + if ( is_multisite() && !is_super_admin( $user_id ) ) + $caps[] = 'do_not_allow'; + else + $caps[] = 'edit_users'; // Explicit due to primitive fall through + break; + case 'delete_post': + case 'delete_page': + $author_data = get_userdata( $user_id ); + $post = get_post( $args[0] ); + + if ( 'revision' == $post->post_type ) { + $post = get_post( $post->post_parent ); + } + + $post_type = get_post_type_object( $post->post_type ); + + if ( ! $post_type->map_meta_cap ) { + $caps[] = $post_type->cap->$cap; + // Prior to 3.1 we would re-call map_meta_cap here. + if ( 'delete_post' == $cap ) + $cap = $post_type->cap->$cap; + break; + } + + if ( '' != $post->post_author ) { + $post_author_data = get_userdata( $post->post_author ); + } else { + // No author set yet, so default to current user for cap checks. + $post_author_data = $author_data; + } + + // If the user is the author... + if ( is_object( $post_author_data ) && $user_id == $post_author_data->ID ) { + // If the post is published... + if ( 'publish' == $post->post_status ) { + $caps[] = $post_type->cap->delete_published_posts; + } elseif ( 'trash' == $post->post_status ) { + if ('publish' == get_post_meta($post->ID, '_wp_trash_meta_status', true) ) + $caps[] = $post_type->cap->delete_published_posts; + } else { + // If the post is draft... + $caps[] = $post_type->cap->delete_posts; + } + } else { + // The user is trying to edit someone else's post. + $caps[] = $post_type->cap->delete_others_posts; + // The post is published, extra cap required. + if ( 'publish' == $post->post_status ) + $caps[] = $post_type->cap->delete_published_posts; + elseif ( 'private' == $post->post_status ) + $caps[] = $post_type->cap->delete_private_posts; + } + break; + // edit_post breaks down to edit_posts, edit_published_posts, or + // edit_others_posts + case 'edit_post': + case 'edit_page': + $author_data = get_userdata( $user_id ); + $post = get_post( $args[0] ); + + if ( 'revision' == $post->post_type ) { + $post = get_post( $post->post_parent ); + } + + $post_type = get_post_type_object( $post->post_type ); + + if ( ! $post_type->map_meta_cap ) { + $caps[] = $post_type->cap->$cap; + // Prior to 3.1 we would re-call map_meta_cap here. + if ( 'edit_post' == $cap ) + $cap = $post_type->cap->$cap; + break; + } + + if ( '' != $post->post_author ) { + $post_author_data = get_userdata( $post->post_author ); + } else { + // No author set yet, so default to current user for cap checks. + $post_author_data = $author_data; + } + + //echo "current user id : $user_id, post author id: " . $post_author_data->ID . "
              "; + // If the user is the author... + if ( is_object( $post_author_data ) && $user_id == $post_author_data->ID ) { + // If the post is published... + if ( 'publish' == $post->post_status ) { + $caps[] = $post_type->cap->edit_published_posts; + } elseif ( 'trash' == $post->post_status ) { + if ('publish' == get_post_meta($post->ID, '_wp_trash_meta_status', true) ) + $caps[] = $post_type->cap->edit_published_posts; + } else { + // If the post is draft... + $caps[] = $post_type->cap->edit_posts; + } + } else { + // The user is trying to edit someone else's post. + $caps[] = $post_type->cap->edit_others_posts; + // The post is published, extra cap required. + if ( 'publish' == $post->post_status ) + $caps[] = $post_type->cap->edit_published_posts; + elseif ( 'private' == $post->post_status ) + $caps[] = $post_type->cap->edit_private_posts; + } + break; + case 'read_post': + case 'read_page': + $author_data = get_userdata( $user_id ); + $post = get_post( $args[0] ); + + if ( 'revision' == $post->post_type ) { + $post = get_post( $post->post_parent ); + } + + $post_type = get_post_type_object( $post->post_type ); + + if ( ! $post_type->map_meta_cap ) { + $caps[] = $post_type->cap->$cap; + // Prior to 3.1 we would re-call map_meta_cap here. + if ( 'read_post' == $cap ) + $cap = $post_type->cap->$cap; + break; + } + + if ( 'private' != $post->post_status ) { + $caps[] = $post_type->cap->read; + break; + } + + if ( '' != $post->post_author ) { + $post_author_data = get_userdata( $post->post_author ); + } else { + // No author set yet, so default to current user for cap checks. + $post_author_data = $author_data; + } + + if ( is_object( $post_author_data ) && $user_id == $post_author_data->ID ) + $caps[] = $post_type->cap->read; + else + $caps[] = $post_type->cap->read_private_posts; + break; + case 'edit_comment': + $comment = get_comment( $args[0] ); + $post = get_post( $comment->comment_post_ID ); + $post_type_object = get_post_type_object( $post->post_type ); + + $caps = map_meta_cap( $post_type_object->cap->edit_post, $user_id, $post->ID ); + break; + case 'unfiltered_upload': + if ( defined('ALLOW_UNFILTERED_UPLOADS') && ALLOW_UNFILTERED_UPLOADS && ( !is_multisite() || is_super_admin( $user_id ) ) ) + $caps[] = $cap; + else + $caps[] = 'do_not_allow'; + break; + case 'edit_files': + case 'edit_plugins': + case 'edit_themes': + if ( defined('DISALLOW_FILE_EDIT') && DISALLOW_FILE_EDIT ) { + $caps[] = 'do_not_allow'; + break; + } + // Fall through if not DISALLOW_FILE_EDIT. + case 'update_plugins': + case 'delete_plugins': + case 'install_plugins': + case 'update_themes': + case 'delete_themes': + case 'install_themes': + case 'update_core': + // Disallow anything that creates, deletes, or edits core, plugin, or theme files. + // Files in uploads are excepted. + if ( defined('DISALLOW_FILE_MODS') && DISALLOW_FILE_MODS ) { + $caps[] = 'do_not_allow'; + break; + } + // Fall through if not DISALLOW_FILE_MODS. + case 'unfiltered_html': + // Disallow unfiltered_html for all users, even admins and super admins. + if ( defined('DISALLOW_UNFILTERED_HTML') && DISALLOW_UNFILTERED_HTML ) { + $caps[] = 'do_not_allow'; + break; + } + // Fall through if not DISALLOW_UNFILTERED_HTML + case 'delete_user': + case 'delete_users': + // If multisite these caps are allowed only for super admins. + if ( is_multisite() && !is_super_admin( $user_id ) ) { + $caps[] = 'do_not_allow'; + } else { + if ( 'delete_user' == $cap ) + $cap = 'delete_users'; + $caps[] = $cap; + } + break; + case 'create_users': + if ( !is_multisite() ) + $caps[] = $cap; + elseif ( is_super_admin() || get_site_option( 'add_new_users' ) ) + $caps[] = $cap; + else + $caps[] = 'do_not_allow'; + break; + default: + // Handle meta capabilities for custom post types. + $post_type_meta_caps = _post_type_meta_capabilities(); + if ( isset( $post_type_meta_caps[ $cap ] ) ) { + $args = array_merge( array( $post_type_meta_caps[ $cap ], $user_id ), $args ); + return call_user_func_array( 'map_meta_cap', $args ); + } + + // If no meta caps match, return the original cap. + $caps[] = $cap; + } + + return apply_filters('map_meta_cap', $caps, $cap, $user_id, $args); +} + +/** + * Whether current user has capability or role. + * + * @since 2.0.0 + * + * @param string $capability Capability or role name. + * @return bool + */ +function current_user_can( $capability ) { + $current_user = wp_get_current_user(); + + if ( empty( $current_user ) ) + return false; + + $args = array_slice( func_get_args(), 1 ); + $args = array_merge( array( $capability ), $args ); + + return call_user_func_array( array( &$current_user, 'has_cap' ), $args ); +} + +/** + * Whether current user has a capability or role for a given blog. + * + * @since 3.0.0 + * + * @param int $blog_id Blog ID + * @param string $capability Capability or role name. + * @return bool + */ +function current_user_can_for_blog( $blog_id, $capability ) { + $current_user = wp_get_current_user(); + + if ( empty( $current_user ) ) + return false; + + // Create new object to avoid stomping the global current_user. + $user = new WP_User( $current_user->id) ; + + // Set the blog id. @todo add blog id arg to WP_User constructor? + $user->for_blog( $blog_id ); + + $args = array_slice( func_get_args(), 2 ); + $args = array_merge( array( $capability ), $args ); + + return call_user_func_array( array( &$user, 'has_cap' ), $args ); +} + +/** + * Whether author of supplied post has capability or role. + * + * @since 2.9.0 + * + * @param int|object $post Post ID or post object. + * @param string $capability Capability or role name. + * @return bool + */ +function author_can( $post, $capability ) { + if ( !$post = get_post($post) ) + return false; + + $author = new WP_User( $post->post_author ); + + if ( empty( $author->ID ) ) + return false; + + $args = array_slice( func_get_args(), 2 ); + $args = array_merge( array( $capability ), $args ); + + return call_user_func_array( array( &$author, 'has_cap' ), $args ); +} + +/** + * Whether a particular user has capability or role. + * + * @since 3.1.0 + * + * @param int|object $user User ID or object. + * @param string $capability Capability or role name. + * @return bool + */ +function user_can( $user, $capability ) { + if ( ! is_object( $user ) ) + $user = new WP_User( $user ); + + if ( ! $user || ! $user->ID ) + return false; + + $args = array_slice( func_get_args(), 2 ); + $args = array_merge( array( $capability ), $args ); + + return call_user_func_array( array( &$user, 'has_cap' ), $args ); +} + +/** + * Retrieve role object. + * + * @see WP_Roles::get_role() Uses method to retrieve role object. + * @since 2.0.0 + * + * @param string $role Role name. + * @return object + */ +function get_role( $role ) { + global $wp_roles; + + if ( ! isset( $wp_roles ) ) + $wp_roles = new WP_Roles(); + + return $wp_roles->get_role( $role ); +} + +/** + * Add role, if it does not exist. + * + * @see WP_Roles::add_role() Uses method to add role. + * @since 2.0.0 + * + * @param string $role Role name. + * @param string $display_name Display name for role. + * @param array $capabilities List of capabilities, e.g. array( 'edit_posts' => true, 'delete_posts' => false ); + * @return null|WP_Role WP_Role object if role is added, null if already exists. + */ +function add_role( $role, $display_name, $capabilities = array() ) { + global $wp_roles; + + if ( ! isset( $wp_roles ) ) + $wp_roles = new WP_Roles(); + + return $wp_roles->add_role( $role, $display_name, $capabilities ); +} + +/** + * Remove role, if it exists. + * + * @see WP_Roles::remove_role() Uses method to remove role. + * @since 2.0.0 + * + * @param string $role Role name. + * @return null + */ +function remove_role( $role ) { + global $wp_roles; + + if ( ! isset( $wp_roles ) ) + $wp_roles = new WP_Roles(); + + return $wp_roles->remove_role( $role ); +} + +/** + * Retrieve a list of super admins. + * + * @since 3.0.0 + * + * @uses $super_admins Super admins global variable, if set. + * + * @return array List of super admin logins + */ +function get_super_admins() { + global $super_admins; + + if ( isset($super_admins) ) + return $super_admins; + else + return get_site_option( 'site_admins', array('admin') ); +} + +/** + * Determine if user is a site admin. + * + * @since 3.0.0 + * + * @param int $user_id (Optional) The ID of a user. Defaults to the current user. + * @return bool True if the user is a site admin. + */ +function is_super_admin( $user_id = false ) { + if ( $user_id ) + $user = new WP_User( $user_id ); + else + $user = wp_get_current_user(); + + if ( empty( $user->id ) ) + return false; + + if ( is_multisite() ) { + $super_admins = get_super_admins(); + if ( is_array( $super_admins ) && in_array( $user->user_login, $super_admins ) ) + return true; + } else { + if ( $user->has_cap('delete_users') ) + return true; + } + + return false; +} + +?> diff --git a/src/wp-includes/category-template.php b/src/wp-includes/category-template.php new file mode 100644 index 0000000..39e6859 --- /dev/null +++ b/src/wp-includes/category-template.php @@ -0,0 +1,1215 @@ +slug; + else + $name = $parent->name; + + if ( $parent->parent && ( $parent->parent != $parent->term_id ) && !in_array( $parent->parent, $visited ) ) { + $visited[] = $parent->parent; + $chain .= get_category_parents( $parent->parent, $link, $separator, $nicename, $visited ); + } + + if ( $link ) + $chain .= 'name ) ) . '">'.$name.'' . $separator; + else + $chain .= $name.$separator; + return $chain; +} + +/** + * Retrieve post categories. + * + * @since 0.71 + * @uses $post + * + * @param int $id Optional, default to current post ID. The post ID. + * @return array + */ +function get_the_category( $id = false ) { + $categories = get_the_terms( $id, 'category' ); + if ( ! $categories ) + $categories = array(); + + $categories = array_values( $categories ); + + foreach ( array_keys( $categories ) as $key ) { + _make_cat_compat( $categories[$key] ); + } + + // Filter name is plural because we return alot of categories (possibly more than #13237) not just one + return apply_filters( 'get_the_categories', $categories ); +} + +/** + * Sort categories by name. + * + * Used by usort() as a callback, should not be used directly. Can actually be + * used to sort any term object. + * + * @since 2.3.0 + * @access private + * + * @param object $a + * @param object $b + * @return int + */ +function _usort_terms_by_name( $a, $b ) { + return strcmp( $a->name, $b->name ); +} + +/** + * Sort categories by ID. + * + * Used by usort() as a callback, should not be used directly. Can actually be + * used to sort any term object. + * + * @since 2.3.0 + * @access private + * + * @param object $a + * @param object $b + * @return int + */ +function _usort_terms_by_ID( $a, $b ) { + if ( $a->term_id > $b->term_id ) + return 1; + elseif ( $a->term_id < $b->term_id ) + return -1; + else + return 0; +} + +/** + * Retrieve category name based on category ID. + * + * @since 0.71 + * + * @param int $cat_ID Category ID. + * @return string Category name. + */ +function get_the_category_by_ID( $cat_ID ) { + $cat_ID = (int) $cat_ID; + $category = &get_category( $cat_ID ); + if ( is_wp_error( $category ) ) + return $category; + return $category->name; +} + +/** + * Retrieve category list in either HTML list or custom format. + * + * @since 1.5.1 + * + * @param string $separator Optional, default is empty string. Separator for between the categories. + * @param string $parents Optional. How to display the parents. + * @param int $post_id Optional. Post ID to retrieve categories. + * @return string + */ +function get_the_category_list( $separator = '', $parents='', $post_id = false ) { + global $wp_rewrite; + $categories = get_the_category( $post_id ); + if ( !is_object_in_taxonomy( get_post_type( $post_id ), 'category' ) ) + return apply_filters( 'the_category', '', $separator, $parents ); + + if ( empty( $categories ) ) + return apply_filters( 'the_category', __( 'Uncategorized' ), $separator, $parents ); + + $rel = ( is_object( $wp_rewrite ) && $wp_rewrite->using_permalinks() ) ? 'rel="category tag"' : 'rel="category"'; + + $thelist = ''; + if ( '' == $separator ) { + $thelist .= ''; + } else { + $i = 0; + foreach ( $categories as $category ) { + if ( 0 < $i ) + $thelist .= $separator; + switch ( strtolower( $parents ) ) { + case 'multiple': + if ( $category->parent ) + $thelist .= get_category_parents( $category->parent, true, $separator ); + $thelist .= 'name ) ) . '" ' . $rel . '>' . $category->name.''; + break; + case 'single': + $thelist .= 'name ) ) . '" ' . $rel . '>'; + if ( $category->parent ) + $thelist .= get_category_parents( $category->parent, false, $separator ); + $thelist .= "$category->name"; + break; + case '': + default: + $thelist .= 'name ) ) . '" ' . $rel . '>' . $category->name.''; + } + ++$i; + } + } + return apply_filters( 'the_category', $thelist, $separator, $parents ); +} + + +/** + * Check if the current post in within any of the given categories. + * + * The given categories are checked against the post's categories' term_ids, names and slugs. + * Categories given as integers will only be checked against the post's categories' term_ids. + * + * Prior to v2.5 of WordPress, category names were not supported. + * Prior to v2.7, category slugs were not supported. + * Prior to v2.7, only one category could be compared: in_category( $single_category ). + * Prior to v2.7, this function could only be used in the WordPress Loop. + * As of 2.7, the function can be used anywhere if it is provided a post ID or post object. + * + * @since 1.2.0 + * + * @param int|string|array $category Category ID, name or slug, or array of said. + * @param int|object $_post Optional. Post to check instead of the current post. (since 2.7.0) + * @return bool True if the current post is in any of the given categories. + */ +function in_category( $category, $post = null ) { + if ( empty( $category ) ) + return false; + + return has_term( $category, 'category', $post ); +} + +/** + * Display the category list for the post. + * + * @since 0.71 + * + * @param string $separator Optional, default is empty string. Separator for between the categories. + * @param string $parents Optional. How to display the parents. + * @param int $post_id Optional. Post ID to retrieve categories. + */ +function the_category( $separator = '', $parents='', $post_id = false ) { + echo get_the_category_list( $separator, $parents, $post_id ); +} + +/** + * Retrieve category description. + * + * @since 1.0.0 + * + * @param int $category Optional. Category ID. Will use global category ID by default. + * @return string Category description, available. + */ +function category_description( $category = 0 ) { + return term_description( $category, 'category' ); +} + +/** + * Display or retrieve the HTML dropdown list of categories. + * + * The list of arguments is below: + * 'show_option_all' (string) - Text to display for showing all categories. + * 'show_option_none' (string) - Text to display for showing no categories. + * 'orderby' (string) default is 'ID' - What column to use for ordering the + * categories. + * 'order' (string) default is 'ASC' - What direction to order categories. + * 'show_last_update' (bool|int) default is 0 - See {@link get_categories()} + * 'show_count' (bool|int) default is 0 - Whether to show how many posts are + * in the category. + * 'hide_empty' (bool|int) default is 1 - Whether to hide categories that + * don't have any posts attached to them. + * 'child_of' (int) default is 0 - See {@link get_categories()}. + * 'exclude' (string) - See {@link get_categories()}. + * 'echo' (bool|int) default is 1 - Whether to display or retrieve content. + * 'depth' (int) - The max depth. + * 'tab_index' (int) - Tab index for select element. + * 'name' (string) - The name attribute value for select element. + * 'id' (string) - The ID attribute value for select element. Defaults to name if omitted. + * 'class' (string) - The class attribute value for select element. + * 'selected' (int) - Which category ID is selected. + * 'taxonomy' (string) - The name of the taxonomy to retrieve. Defaults to category. + * + * The 'hierarchical' argument, which is disabled by default, will override the + * depth argument, unless it is true. When the argument is false, it will + * display all of the categories. When it is enabled it will use the value in + * the 'depth' argument. + * + * @since 2.1.0 + * + * @param string|array $args Optional. Override default arguments. + * @return string HTML content only if 'echo' argument is 0. + */ +function wp_dropdown_categories( $args = '' ) { + $defaults = array( + 'show_option_all' => '', 'show_option_none' => '', + 'orderby' => 'id', 'order' => 'ASC', + 'show_last_update' => 0, 'show_count' => 0, + 'hide_empty' => 1, 'child_of' => 0, + 'exclude' => '', 'echo' => 1, + 'selected' => 0, 'hierarchical' => 0, + 'name' => 'cat', 'id' => '', + 'class' => 'postform', 'depth' => 0, + 'tab_index' => 0, 'taxonomy' => 'category', + 'hide_if_empty' => false + ); + + $defaults['selected'] = ( is_category() ) ? get_query_var( 'cat' ) : 0; + + // Back compat. + if ( isset( $args['type'] ) && 'link' == $args['type'] ) { + _deprecated_argument( __FUNCTION__, '3.0', '' ); + $args['taxonomy'] = 'link_category'; + } + + $r = wp_parse_args( $args, $defaults ); + + if ( !isset( $r['pad_counts'] ) && $r['show_count'] && $r['hierarchical'] ) { + $r['pad_counts'] = true; + } + + $r['include_last_update_time'] = $r['show_last_update']; + extract( $r ); + + $tab_index_attribute = ''; + if ( (int) $tab_index > 0 ) + $tab_index_attribute = " tabindex=\"$tab_index\""; + + $categories = get_terms( $taxonomy, $r ); + $name = esc_attr( $name ); + $class = esc_attr( $class ); + $id = $id ? esc_attr( $id ) : $name; + + if ( ! $r['hide_if_empty'] || ! empty($categories) ) + $output = "\n"; + + + $output = apply_filters( 'wp_dropdown_cats', $output ); + + if ( $echo ) + echo $output; + + return $output; +} + +/** + * Display or retrieve the HTML list of categories. + * + * The list of arguments is below: + * 'show_option_all' (string) - Text to display for showing all categories. + * 'orderby' (string) default is 'ID' - What column to use for ordering the + * categories. + * 'order' (string) default is 'ASC' - What direction to order categories. + * 'show_last_update' (bool|int) default is 0 - See {@link + * walk_category_dropdown_tree()} + * 'show_count' (bool|int) default is 0 - Whether to show how many posts are + * in the category. + * 'hide_empty' (bool|int) default is 1 - Whether to hide categories that + * don't have any posts attached to them. + * 'use_desc_for_title' (bool|int) default is 1 - Whether to use the + * description instead of the category title. + * 'feed' - See {@link get_categories()}. + * 'feed_type' - See {@link get_categories()}. + * 'feed_image' - See {@link get_categories()}. + * 'child_of' (int) default is 0 - See {@link get_categories()}. + * 'exclude' (string) - See {@link get_categories()}. + * 'exclude_tree' (string) - See {@link get_categories()}. + * 'echo' (bool|int) default is 1 - Whether to display or retrieve content. + * 'current_category' (int) - See {@link get_categories()}. + * 'hierarchical' (bool) - See {@link get_categories()}. + * 'title_li' (string) - See {@link get_categories()}. + * 'depth' (int) - The max depth. + * + * @since 2.1.0 + * + * @param string|array $args Optional. Override default arguments. + * @return string HTML content only if 'echo' argument is 0. + */ +function wp_list_categories( $args = '' ) { + $defaults = array( + 'show_option_all' => '', 'show_option_none' => __('No categories'), + 'orderby' => 'name', 'order' => 'ASC', + 'show_last_update' => 0, 'style' => 'list', + 'show_count' => 0, 'hide_empty' => 1, + 'use_desc_for_title' => 1, 'child_of' => 0, + 'feed' => '', 'feed_type' => '', + 'feed_image' => '', 'exclude' => '', + 'exclude_tree' => '', 'current_category' => 0, + 'hierarchical' => true, 'title_li' => __( 'Categories' ), + 'echo' => 1, 'depth' => 0, + 'taxonomy' => 'category' + ); + + $r = wp_parse_args( $args, $defaults ); + + if ( !isset( $r['pad_counts'] ) && $r['show_count'] && $r['hierarchical'] ) + $r['pad_counts'] = true; + + if ( isset( $r['show_date'] ) ) + $r['include_last_update_time'] = $r['show_date']; + + if ( true == $r['hierarchical'] ) { + $r['exclude_tree'] = $r['exclude']; + $r['exclude'] = ''; + } + + if ( !isset( $r['class'] ) ) + $r['class'] = ( 'category' == $r['taxonomy'] ) ? 'categories' : $r['taxonomy']; + + extract( $r ); + + if ( !taxonomy_exists($taxonomy) ) + return false; + + $categories = get_categories( $r ); + + $output = ''; + if ( $title_li && 'list' == $style ) + $output = '
            • ' . $title_li . '
                '; + + if ( empty( $categories ) ) { + if ( ! empty( $show_option_none ) ) { + if ( 'list' == $style ) + $output .= '
              • ' . $show_option_none . '
              • '; + else + $output .= $show_option_none; + } + } else { + if( !empty( $show_option_all ) ) + if ( 'list' == $style ) + $output .= '
              • ' . $show_option_all . '
              • '; + else + $output .= '' . $show_option_all . ''; + + if ( empty( $r['current_category'] ) && ( is_category() || is_tax() || is_tag() ) ) { + $current_term_object = get_queried_object(); + if ( $r['taxonomy'] == $current_term_object->taxonomy ) + $r['current_category'] = get_queried_object_id(); + } + + if ( $hierarchical ) + $depth = $r['depth']; + else + $depth = -1; // Flat. + + $output .= walk_category_tree( $categories, $depth, $r ); + } + + if ( $title_li && 'list' == $style ) + $output .= '
            • '; + + $output = apply_filters( 'wp_list_categories', $output, $args ); + + if ( $echo ) + echo $output; + else + return $output; +} + +/** + * Display tag cloud. + * + * The text size is set by the 'smallest' and 'largest' arguments, which will + * use the 'unit' argument value for the CSS text size unit. The 'format' + * argument can be 'flat' (default), 'list', or 'array'. The flat value for the + * 'format' argument will separate tags with spaces. The list value for the + * 'format' argument will format the tags in a UL HTML list. The array value for + * the 'format' argument will return in PHP array type format. + * + * The 'orderby' argument will accept 'name' or 'count' and defaults to 'name'. + * The 'order' is the direction to sort, defaults to 'ASC' and can be 'DESC'. + * + * The 'number' argument is how many tags to return. By default, the limit will + * be to return the top 45 tags in the tag cloud list. + * + * The 'topic_count_text_callback' argument is a function, which, given the count + * of the posts with that tag, returns a text for the tooltip of the tag link. + * + * The 'exclude' and 'include' arguments are used for the {@link get_tags()} + * function. Only one should be used, because only one will be used and the + * other ignored, if they are both set. + * + * @since 2.3.0 + * + * @param array|string $args Optional. Override default arguments. + * @return array Generated tag cloud, only if no failures and 'array' is set for the 'format' argument. + */ +function wp_tag_cloud( $args = '' ) { + $defaults = array( + 'smallest' => 8, 'largest' => 22, 'unit' => 'pt', 'number' => 45, + 'format' => 'flat', 'separator' => "\n", 'orderby' => 'name', 'order' => 'ASC', + 'exclude' => '', 'include' => '', 'link' => 'view', 'taxonomy' => 'post_tag', 'echo' => true + ); + $args = wp_parse_args( $args, $defaults ); + + $tags = get_terms( $args['taxonomy'], array_merge( $args, array( 'orderby' => 'count', 'order' => 'DESC' ) ) ); // Always query top tags + + if ( empty( $tags ) || is_wp_error( $tags ) ) + return; + + foreach ( $tags as $key => $tag ) { + if ( 'edit' == $args['link'] ) + $link = get_edit_tag_link( $tag->term_id, $tag->taxonomy ); + else + $link = get_term_link( intval($tag->term_id), $tag->taxonomy ); + if ( is_wp_error( $link ) ) + return false; + + $tags[ $key ]->link = $link; + $tags[ $key ]->id = $tag->term_id; + } + + $return = wp_generate_tag_cloud( $tags, $args ); // Here's where those top tags get sorted according to $args + + $return = apply_filters( 'wp_tag_cloud', $return, $args ); + + if ( 'array' == $args['format'] || empty($args['echo']) ) + return $return; + + echo $return; +} + +/** + * Default text for tooltip for tag links + * + * @param integer $count number of posts with that tag + * @return string text for the tooltip of a tag link. + */ +function default_topic_count_text( $count ) { + return sprintf( _n('%s topic', '%s topics', $count), number_format_i18n( $count ) ); +} + +/** + * Default topic count scaling for tag links + * + * @param integer $count number of posts with that tag + * @return integer scaled count + */ +function default_topic_count_scale( $count ) { + return round(log10($count + 1) * 100); +} + + +/** + * Generates a tag cloud (heatmap) from provided data. + * + * The text size is set by the 'smallest' and 'largest' arguments, which will + * use the 'unit' argument value for the CSS text size unit. The 'format' + * argument can be 'flat' (default), 'list', or 'array'. The flat value for the + * 'format' argument will separate tags with spaces. The list value for the + * 'format' argument will format the tags in a UL HTML list. The array value for + * the 'format' argument will return in PHP array type format. + * + * The 'tag_cloud_sort' filter allows you to override the sorting. + * Passed to the filter: $tags array and $args array, has to return the $tags array + * after sorting it. + * + * The 'orderby' argument will accept 'name' or 'count' and defaults to 'name'. + * The 'order' is the direction to sort, defaults to 'ASC' and can be 'DESC' or + * 'RAND'. + * + * The 'number' argument is how many tags to return. By default, the limit will + * be to return the entire tag cloud list. + * + * The 'topic_count_text_callback' argument is a function, which given the count + * of the posts with that tag returns a text for the tooltip of the tag link. + * + * @todo Complete functionality. + * @since 2.3.0 + * + * @param array $tags List of tags. + * @param string|array $args Optional, override default arguments. + * @return string + */ +function wp_generate_tag_cloud( $tags, $args = '' ) { + global $wp_rewrite; + $defaults = array( + 'smallest' => 8, 'largest' => 22, 'unit' => 'pt', 'number' => 0, + 'format' => 'flat', 'separator' => "\n", 'orderby' => 'name', 'order' => 'ASC', + 'topic_count_text_callback' => 'default_topic_count_text', + 'topic_count_scale_callback' => 'default_topic_count_scale', 'filter' => 1, + ); + + if ( !isset( $args['topic_count_text_callback'] ) && isset( $args['single_text'] ) && isset( $args['multiple_text'] ) ) { + $body = 'return sprintf ( + _n(' . var_export($args['single_text'], true) . ', ' . var_export($args['multiple_text'], true) . ', $count), + number_format_i18n( $count ));'; + $args['topic_count_text_callback'] = create_function('$count', $body); + } + + $args = wp_parse_args( $args, $defaults ); + extract( $args ); + + if ( empty( $tags ) ) + return; + + $tags_sorted = apply_filters( 'tag_cloud_sort', $tags, $args ); + if ( $tags_sorted != $tags ) { // the tags have been sorted by a plugin + $tags = $tags_sorted; + unset($tags_sorted); + } else { + if ( 'RAND' == $order ) { + shuffle($tags); + } else { + // SQL cannot save you; this is a second (potentially different) sort on a subset of data. + if ( 'name' == $orderby ) + uasort( $tags, create_function('$a, $b', 'return strnatcasecmp($a->name, $b->name);') ); + else + uasort( $tags, create_function('$a, $b', 'return ($a->count > $b->count);') ); + + if ( 'DESC' == $order ) + $tags = array_reverse( $tags, true ); + } + } + + if ( $number > 0 ) + $tags = array_slice($tags, 0, $number); + + $counts = array(); + $real_counts = array(); // For the alt tag + foreach ( (array) $tags as $key => $tag ) { + $real_counts[ $key ] = $tag->count; + $counts[ $key ] = $topic_count_scale_callback($tag->count); + } + + $min_count = min( $counts ); + $spread = max( $counts ) - $min_count; + if ( $spread <= 0 ) + $spread = 1; + $font_spread = $largest - $smallest; + if ( $font_spread < 0 ) + $font_spread = 1; + $font_step = $font_spread / $spread; + + $a = array(); + + foreach ( $tags as $key => $tag ) { + $count = $counts[ $key ]; + $real_count = $real_counts[ $key ]; + $tag_link = '#' != $tag->link ? esc_url( $tag->link ) : '#'; + $tag_id = isset($tags[ $key ]->id) ? $tags[ $key ]->id : $key; + $tag_name = $tags[ $key ]->name; + $a[] = "$tag_name"; + } + + switch ( $format ) : + case 'array' : + $return =& $a; + break; + case 'list' : + $return = "
                \n\t
              • "; + $return .= join( "
              • \n\t
              • ", $a ); + $return .= "
              • \n
              \n"; + break; + default : + $return = join( $separator, $a ); + break; + endswitch; + + if ( $filter ) + return apply_filters( 'wp_generate_tag_cloud', $return, $tags, $args ); + else + return $return; +} + +/** + * Callback for comparing tags based on name + * + * @since 3.1.0 + * @access private + */ +function _wp_tag_cloud_name_sort_cb( $a, $b ) { + return strnatcasecmp( $a->name, $b->name ); +} + +/** + * Callback for comparing tags based on count + * + * @since 3.1.0 + * @access private + */ +function _wp_tag_cloud_count_sort_cb( $a, $b ) { + return ( $a->count > $b->count ); +} + +// +// Helper functions +// + +/** + * Retrieve HTML list content for category list. + * + * @uses Walker_Category to create HTML list content. + * @since 2.1.0 + * @see Walker_Category::walk() for parameters and return description. + */ +function walk_category_tree() { + $args = func_get_args(); + // the user's options are the third parameter + if ( empty($args[2]['walker']) || !is_a($args[2]['walker'], 'Walker') ) + $walker = new Walker_Category; + else + $walker = $args[2]['walker']; + + return call_user_func_array(array( &$walker, 'walk' ), $args ); +} + +/** + * Retrieve HTML dropdown (select) content for category list. + * + * @uses Walker_CategoryDropdown to create HTML dropdown content. + * @since 2.1.0 + * @see Walker_CategoryDropdown::walk() for parameters and return description. + */ +function walk_category_dropdown_tree() { + $args = func_get_args(); + // the user's options are the third parameter + if ( empty($args[2]['walker']) || !is_a($args[2]['walker'], 'Walker') ) + $walker = new Walker_CategoryDropdown; + else + $walker = $args[2]['walker']; + + return call_user_func_array(array( &$walker, 'walk' ), $args ); +} + +/** + * Create HTML list of categories. + * + * @package WordPress + * @since 2.1.0 + * @uses Walker + */ +class Walker_Category extends Walker { + /** + * @see Walker::$tree_type + * @since 2.1.0 + * @var string + */ + var $tree_type = 'category'; + + /** + * @see Walker::$db_fields + * @since 2.1.0 + * @todo Decouple this + * @var array + */ + var $db_fields = array ('parent' => 'parent', 'id' => 'term_id'); + + /** + * @see Walker::start_lvl() + * @since 2.1.0 + * + * @param string $output Passed by reference. Used to append additional content. + * @param int $depth Depth of category. Used for tab indentation. + * @param array $args Will only append content if style argument value is 'list'. + */ + function start_lvl(&$output, $depth, $args) { + if ( 'list' != $args['style'] ) + return; + + $indent = str_repeat("\t", $depth); + $output .= "$indent
                \n"; + } + + /** + * @see Walker::end_lvl() + * @since 2.1.0 + * + * @param string $output Passed by reference. Used to append additional content. + * @param int $depth Depth of category. Used for tab indentation. + * @param array $args Will only append content if style argument value is 'list'. + */ + function end_lvl(&$output, $depth, $args) { + if ( 'list' != $args['style'] ) + return; + + $indent = str_repeat("\t", $depth); + $output .= "$indent
              \n"; + } + + /** + * @see Walker::start_el() + * @since 2.1.0 + * + * @param string $output Passed by reference. Used to append additional content. + * @param object $category Category data object. + * @param int $depth Depth of category in reference to parents. + * @param array $args + */ + function start_el(&$output, $category, $depth, $args) { + extract($args); + + $cat_name = esc_attr( $category->name ); + $cat_name = apply_filters( 'list_cats', $cat_name, $category ); + $link = 'description) ) + $link .= 'title="' . esc_attr( sprintf(__( 'View all posts filed under %s' ), $cat_name) ) . '"'; + else + $link .= 'title="' . esc_attr( strip_tags( apply_filters( 'category_description', $category->description, $category ) ) ) . '"'; + $link .= '>'; + $link .= $cat_name . ''; + + if ( !empty($feed_image) || !empty($feed) ) { + $link .= ' '; + + if ( empty($feed_image) ) + $link .= '('; + + $link .= ''; + + $link .= ''; + + if ( empty($feed_image) ) + $link .= ')'; + } + + if ( !empty($show_count) ) + $link .= ' (' . intval($category->count) . ')'; + + if ( !empty($show_date) ) + $link .= ' ' . gmdate('Y-m-d', $category->last_update_timestamp); + + if ( 'list' == $args['style'] ) { + $output .= "\tterm_id; + if ( !empty($current_category) ) { + $_current_category = get_term( $current_category, $category->taxonomy ); + if ( $category->term_id == $current_category ) + $class .= ' current-cat'; + elseif ( $category->term_id == $_current_category->parent ) + $class .= ' current-cat-parent'; + } + $output .= ' class="' . $class . '"'; + $output .= ">$link\n"; + } else { + $output .= "\t$link
              \n"; + } + } + + /** + * @see Walker::end_el() + * @since 2.1.0 + * + * @param string $output Passed by reference. Used to append additional content. + * @param object $page Not used. + * @param int $depth Depth of category. Not used. + * @param array $args Only uses 'list' for whether should append to output. + */ + function end_el(&$output, $page, $depth, $args) { + if ( 'list' != $args['style'] ) + return; + + $output .= "\n"; + } + +} + +/** + * Create HTML dropdown list of Categories. + * + * @package WordPress + * @since 2.1.0 + * @uses Walker + */ +class Walker_CategoryDropdown extends Walker { + /** + * @see Walker::$tree_type + * @since 2.1.0 + * @var string + */ + var $tree_type = 'category'; + + /** + * @see Walker::$db_fields + * @since 2.1.0 + * @todo Decouple this + * @var array + */ + var $db_fields = array ('parent' => 'parent', 'id' => 'term_id'); + + /** + * @see Walker::start_el() + * @since 2.1.0 + * + * @param string $output Passed by reference. Used to append additional content. + * @param object $category Category data object. + * @param int $depth Depth of category. Used for padding. + * @param array $args Uses 'selected', 'show_count', and 'show_last_update' keys, if they exist. + */ + function start_el(&$output, $category, $depth, $args) { + $pad = str_repeat(' ', $depth * 3); + + $cat_name = apply_filters('list_cats', $category->name, $category); + $output .= "\t\n"; + } +} + +// +// Tags +// + +/** + * Retrieve the link to the tag. + * + * @since 2.3.0 + * @see get_term_link() + * + * @param int|object $tag Tag ID or object. + * @return string Link on success, empty string if tag does not exist. + */ +function get_tag_link( $tag ) { + if ( ! is_object( $tag ) ) + $tag = (int) $tag; + + $tag = get_term_link( $tag, 'post_tag' ); + + if ( is_wp_error( $tag ) ) + return ''; + + return $tag; +} + +/** + * Retrieve the tags for a post. + * + * @since 2.3.0 + * @uses apply_filters() Calls 'get_the_tags' filter on the list of post tags. + * + * @param int $id Post ID. + * @return array + */ +function get_the_tags( $id = 0 ) { + return apply_filters( 'get_the_tags', get_the_terms( $id, 'post_tag' ) ); +} + +/** + * Retrieve the tags for a post formatted as a string. + * + * @since 2.3.0 + * @uses apply_filters() Calls 'the_tags' filter on string list of tags. + * + * @param string $before Optional. Before tags. + * @param string $sep Optional. Between tags. + * @param string $after Optional. After tags. + * @return string + */ +function get_the_tag_list( $before = '', $sep = '', $after = '' ) { + return apply_filters( 'the_tags', get_the_term_list( 0, 'post_tag', $before, $sep, $after ), $before, $sep, $after); +} + +/** + * Retrieve the tags for a post. + * + * @since 2.3.0 + * + * @param string $before Optional. Before list. + * @param string $sep Optional. Separate items using this. + * @param string $after Optional. After list. + * @return string + */ +function the_tags( $before = null, $sep = ', ', $after = '' ) { + if ( null === $before ) + $before = __('Tags: '); + echo get_the_tag_list($before, $sep, $after); +} + +/** + * Retrieve tag description. + * + * @since 2.8 + * + * @param int $tag Optional. Tag ID. Will use global tag ID by default. + * @return string Tag description, available. + */ +function tag_description( $tag = 0 ) { + return term_description( $tag ); +} + +/** + * Retrieve term description. + * + * @since 2.8 + * + * @param int $term Optional. Term ID. Will use global term ID by default. + * @return string Term description, available. + */ +function term_description( $term = 0, $taxonomy = 'post_tag' ) { + if ( !$term && ( is_tax() || is_tag() || is_category() ) ) { + $term = get_queried_object(); + $taxonomy = $term->taxonomy; + $term = $term->term_id; + } + $description = get_term_field( 'description', $term, $taxonomy ); + return is_wp_error( $description ) ? '' : $description; +} + +/** + * Retrieve the terms of the taxonomy that are attached to the post. + * + * @since 2.5.0 + * + * @param int $id Post ID. Is not optional. + * @param string $taxonomy Taxonomy name. + * @return array|bool False on failure. Array of term objects on success. + */ +function get_the_terms( $id = 0, $taxonomy ) { + global $post; + + $id = (int) $id; + + if ( !$id ) { + if ( !$post->ID ) + return false; + else + $id = (int) $post->ID; + } + + $terms = get_object_term_cache( $id, $taxonomy ); + if ( false === $terms ) { + $terms = wp_get_object_terms( $id, $taxonomy ); + wp_cache_add($id, $terms, $taxonomy . '_relationships'); + } + + $terms = apply_filters( 'get_the_terms', $terms, $id, $taxonomy ); + + if ( empty( $terms ) ) + return false; + + return $terms; +} + +/** + * Retrieve a post's terms as a list with specified format. + * + * @since 2.5.0 + * + * @param int $id Post ID. + * @param string $taxonomy Taxonomy name. + * @param string $before Optional. Before list. + * @param string $sep Optional. Separate items using this. + * @param string $after Optional. After list. + * @return string + */ +function get_the_term_list( $id = 0, $taxonomy, $before = '', $sep = '', $after = '' ) { + $terms = get_the_terms( $id, $taxonomy ); + + if ( is_wp_error( $terms ) ) + return $terms; + + if ( empty( $terms ) ) + return false; + + foreach ( $terms as $term ) { + $link = get_term_link( $term, $taxonomy ); + if ( is_wp_error( $link ) ) + return $link; + $term_links[] = ''; + } + + $term_links = apply_filters( "term_links-$taxonomy", $term_links ); + + return $before . join( $sep, $term_links ) . $after; +} + +/** + * Display the terms in a list. + * + * @since 2.5.0 + * + * @param int $id Post ID. + * @param string $taxonomy Taxonomy name. + * @param string $before Optional. Before list. + * @param string $sep Optional. Separate items using this. + * @param string $after Optional. After list. + * @return null|bool False on WordPress error. Returns null when displaying. + */ +function the_terms( $id = 0, $taxonomy, $before = '', $sep = ', ', $after = '' ) { + $term_list = get_the_term_list( $id, $taxonomy, $before, $sep, $after ); + + if ( is_wp_error( $term_list ) ) + return false; + + echo apply_filters('the_terms', $term_list, $taxonomy, $before, $sep, $after); +} + + +/** + * Check if the current post has any of given category. + * + * @since 3.1.0 + * + * @param string|int|array $tag Optional. The category name/term_id/slug or array of them to check for. + * @param int|object $post Optional. Post to check instead of the current post. + * @return bool True if the current post has any of the given categories (or any category, if no category specified). + */ +function has_category( $category = '', $post = null ) { + return has_term( $category, 'category', $post ); +} + +/** + * Check if the current post has any of given tags. + * + * The given tags are checked against the post's tags' term_ids, names and slugs. + * Tags given as integers will only be checked against the post's tags' term_ids. + * If no tags are given, determines if post has any tags. + * + * Prior to v2.7 of WordPress, tags given as integers would also be checked against the post's tags' names and slugs (in addition to term_ids) + * Prior to v2.7, this function could only be used in the WordPress Loop. + * As of 2.7, the function can be used anywhere if it is provided a post ID or post object. + * + * @since 2.6.0 + * + * @param string|int|array $tag Optional. The tag name/term_id/slug or array of them to check for. + * @param int|object $post Optional. Post to check instead of the current post. (since 2.7.0) + * @return bool True if the current post has any of the given tags (or any tag, if no tag specified). + */ +function has_tag( $tag = '', $post = null ) { + return has_term( $tag, 'post_tag', $post ); +} + +/** + * Check if the current post has any of given terms. + * + * The given terms are checked against the post's terms' term_ids, names and slugs. + * Terms given as integers will only be checked against the post's terms' term_ids. + * If no terms are given, determines if post has any terms. + * + * @since 3.1.0 + * + * @param string|int|array $term Optional. The term name/term_id/slug or array of them to check for. + * @param string $taxonomy Taxonomy name + * @param int|object $post Optional. Post to check instead of the current post. + * @return bool True if the current post has any of the given tags (or any tag, if no tag specified). + */ +function has_term( $term = '', $taxonomy = '', $post = null ) { + $post = get_post($post); + + if ( !$post ) + return false; + + $r = is_object_in_term( $post->ID, $taxonomy, $term ); + if ( is_wp_error( $r ) ) + return false; + + return $r; +} + +?> diff --git a/src/wp-includes/category.php b/src/wp-includes/category.php new file mode 100644 index 0000000..4d02277 --- /dev/null +++ b/src/wp-includes/category.php @@ -0,0 +1,359 @@ + 'ids', 'get' => 'all') ); + wp_cache_add( 'all_category_ids', $cat_ids, 'category' ); + } + + return $cat_ids; +} + +/** + * Retrieve list of category objects. + * + * If you change the type to 'link' in the arguments, then the link categories + * will be returned instead. Also all categories will be updated to be backwards + * compatible with pre-2.3 plugins and themes. + * + * @since 2.1.0 + * @see get_terms() Type of arguments that can be changed. + * @link http://codex.wordpress.org/Function_Reference/get_categories + * + * @param string|array $args Optional. Change the defaults retrieving categories. + * @return array List of categories. + */ +function &get_categories( $args = '' ) { + $defaults = array( 'taxonomy' => 'category' ); + $args = wp_parse_args( $args, $defaults ); + + $taxonomy = apply_filters( 'get_categories_taxonomy', $args['taxonomy'], $args ); + + // Back compat + if ( isset($args['type']) && 'link' == $args['type'] ) { + _deprecated_argument( __FUNCTION__, '3.0', '' ); + $taxonomy = $args['taxonomy'] = 'link_category'; + } + + $categories = (array) 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 1.5.1 + * @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 full path should be matched. + * @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', array('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 name of a category from its ID. + * + * @since 1.0.0 + * + * @param int $cat_id Category ID + * @return string Category name, or an empty string if category doesn't exist. + */ +function get_cat_name( $cat_id ) { + $cat_id = (int) $cat_id; + $category = &get_category( $cat_id ); + if ( ! $category || is_wp_error( $category ) ) + return ''; + 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 ( ! isset($cat1->term_id) ) + $cat1 = &get_category( $cat1 ); + if ( ! isset($cat2->parent) ) + $cat2 = &get_category( $cat2 ); + + if ( empty($cat1->term_id) || empty($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(); + return $return; + } + + $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 */ + + +/** + * 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; + } elseif ( 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']; + } +} + + +?> diff --git a/src/wp-includes/class-IXR.php b/src/wp-includes/class-IXR.php new file mode 100644 index 0000000..9d89f0c --- /dev/null +++ b/src/wp-includes/class-IXR.php @@ -0,0 +1,1065 @@ +data = $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; + } + + /** + * Checks whether or not the supplied array is a struct or not + * + * @param unknown_type $array + * @return boolean + */ + function isStruct($array) + { + $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 + // merged from WP #10698 - this method avoids the RAM usage of preg_replace on very large messages + $header = preg_replace( '/<\?xml.*?\?'.'>/', '', substr($this->message, 0, 100), 1); + $this->message = substr_replace($this->message, $header, 0, 100); + 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'); + $chunk_size = 262144; // 256Kb, parse in chunks to avoid the RAM usage on very large messages + $final = false; + do { + if (strlen($this->message) <= $chunk_size) { + $final = true; + } + $part = substr($this->message, 0, $chunk_size); + $this->message = substr($this->message, $chunk_size); + if (!xml_parse($this->_parser, $part, $final)) { + return false; + } + if ($final) { + break; + } + } while (true); + 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 = (string)trim($this->_currentTagContents); + $valueFlag = true; + break; + case 'dateTime.iso8601': + $value = new IXR_Date(trim($this->_currentTagContents)); + $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($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, $wait = false) + { + $this->setCapabilities(); + if ($callbacks) { + $this->callbacks = $callbacks; + } + $this->setCallbacks(); + if (!$wait) { + $this->serve($data); + } + } + + function serve($data = false) + { + if (!$data) { + if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] !== 'POST') { + header('Content-Type: text/plain'); // merged from WP #9093 + die('XML-RPC server accepts POST requests only.'); + } + + global $HTTP_RAW_POST_DATA; + if (empty($HTTP_RAW_POST_DATA)) { + // workaround for a bug in PHP 5.2.2 - http://bugs.php.net/bug.php?id=41293 + $data = file_get_contents('php://input'); + } else { + $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 (is_string($method) && 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 (!is_callable(array($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; + var $headers = array(); + + // Storage place for an error message + var $error = false; + + function IXR_Client($server, $path = false, $port = 80, $timeout = 15) + { + 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 = 'The Incutio XML-RPC PHP Library'; + $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"; + + // Merged from WP #8145 - allow custom headers + $this->headers['Host'] = $this->server; + $this->headers['Content-Type'] = 'text/xml'; + $this->headers['User-Agent'] = $this->useragent; + $this->headers['Content-Length']= $length; + + foreach( $this->headers as $header => $value ) { + $request .= "{$header}: {$value}{$r}"; + } + $request .= $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'); + return false; + } + fputs($fp, $request); + $contents = ''; + $debugContents = ''; + $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) { + // merged from WP #12559 - remove trim + $contents .= $line; + } + if ($this->debug) { + $debugContents .= $line; + } + } + if ($this->debug) { + echo '
              '.htmlspecialchars($debugContents)."\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; + var $timezone; + + 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); + $this->timezone = ''; + } + + 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); + } +} + +?> diff --git a/src/wp-includes/class-feed.php b/src/wp-includes/class-feed.php new file mode 100644 index 0000000..067f36c --- /dev/null +++ b/src/wp-includes/class-feed.php @@ -0,0 +1,94 @@ +name = 'feed_' . $filename; + $this->mod_name = 'feed_mod_' . $filename; + $this->lifetime = apply_filters('wp_feed_cache_transient_lifetime', $this->lifetime, $filename); + } + + function save($data) { + if ( is_a($data, 'SimplePie') ) + $data = $data->data; + + set_transient($this->name, $data, $this->lifetime); + set_transient($this->mod_name, time(), $this->lifetime); + return true; + } + + function load() { + return get_transient($this->name); + } + + function mtime() { + return get_transient($this->mod_name); + } + + function touch() { + return set_transient($this->mod_name, time(), $this->lifetime); + } + + function unlink() { + delete_transient($this->name); + delete_transient($this->mod_name); + return true; + } +} + +class WP_SimplePie_File extends SimplePie_File { + + function __construct($url, $timeout = 10, $redirects = 5, $headers = null, $useragent = null, $force_fsockopen = false) { + $this->url = $url; + $this->timeout = $timeout; + $this->redirects = $redirects; + $this->headers = $headers; + $this->useragent = $useragent; + + $this->method = SIMPLEPIE_FILE_SOURCE_REMOTE; + + if ( preg_match('/^http(s)?:\/\//i', $url) ) { + $args = array( 'timeout' => $this->timeout, 'redirection' => $this->redirects); + + if ( !empty($this->headers) ) + $args['headers'] = $this->headers; + + if ( SIMPLEPIE_USERAGENT != $this->useragent ) //Use default WP user agent unless custom has been specified + $args['user-agent'] = $this->useragent; + + $res = wp_remote_request($url, $args); + + if ( is_wp_error($res) ) { + $this->error = 'WP HTTP Error: ' . $res->get_error_message(); + $this->success = false; + } else { + $this->headers = wp_remote_retrieve_headers( $res ); + $this->body = wp_remote_retrieve_body( $res ); + $this->status_code = wp_remote_retrieve_response_code( $res ); + } + } else { + if ( ! $this->body = file_get_contents($url) ) { + $this->error = 'file_get_contents could not read the file'; + $this->success = false; + } + } + } +} diff --git a/src/wp-includes/class-http.php b/src/wp-includes/class-http.php new file mode 100644 index 0000000..1cf4404 --- /dev/null +++ b/src/wp-includes/class-http.php @@ -0,0 +1,1725 @@ + 'GET', + 'timeout' => apply_filters( 'http_request_timeout', 5), + 'redirection' => apply_filters( 'http_request_redirection_count', 5), + 'httpversion' => apply_filters( 'http_request_version', '1.0'), + 'user-agent' => apply_filters( 'http_headers_useragent', 'WordPress/' . $wp_version . '; ' . get_bloginfo( 'url' ) ), + 'blocking' => true, + 'headers' => array(), + 'cookies' => array(), + 'body' => null, + 'compress' => false, + 'decompress' => true, + 'sslverify' => true, + 'stream' => false, + 'filename' => null + ); + + + // Pre-parse for the HEAD checks. + $args = wp_parse_args( $args ); + + // By default, Head requests do not cause redirections. + if ( isset($args['method']) && 'HEAD' == $args['method'] ) + $defaults['redirection'] = 0; + + $r = wp_parse_args( $args, $defaults ); + $r = apply_filters( 'http_request_args', $r, $url ); + + // Certain classes decrement this, store a copy of the original value for loop purposes. + $r['_redirection'] = $r['redirection']; + + // Allow plugins to short-circuit the request + $pre = apply_filters( 'pre_http_request', false, $r, $url ); + if ( false !== $pre ) + return $pre; + + $arrURL = parse_url( $url ); + + if ( empty( $url ) || empty( $arrURL['scheme'] ) ) + return new WP_Error('http_request_failed', __('A valid URL was not provided.')); + + if ( $this->block_request( $url ) ) + return new WP_Error( 'http_request_failed', __( 'User has blocked requests through HTTP.' ) ); + + // Determine if this is a https call and pass that on to the transport functions + // so that we can blacklist the transports that do not support ssl verification + $r['ssl'] = $arrURL['scheme'] == 'https' || $arrURL['scheme'] == 'ssl'; + + // Determine if this request is to OUR install of WordPress + $homeURL = parse_url( get_bloginfo( 'url' ) ); + $r['local'] = $homeURL['host'] == $arrURL['host'] || 'localhost' == $arrURL['host']; + unset( $homeURL ); + + // If we are streaming to a file but no filename was given drop it in the WP temp dir + // and pick it's name using the basename of the $url + if ( $r['stream'] && empty( $r['filename'] ) ) + $r['filename'] = get_temp_dir() . basename( $url ); + + // Force some settings if we are streaming to a file and check for existence and perms of destination directory + if ( $r['stream'] ) { + $r['blocking'] = true; + if ( ! is_writable( dirname( $r['filename'] ) ) ) + return new WP_Error( 'http_request_failed', __( 'Destination directory for file streaming does not exist or is not writable.' ) ); + } + + if ( is_null( $r['headers'] ) ) + $r['headers'] = array(); + + if ( ! is_array( $r['headers'] ) ) { + $processedHeaders = WP_Http::processHeaders( $r['headers'] ); + $r['headers'] = $processedHeaders['headers']; + } + + if ( isset( $r['headers']['User-Agent'] ) ) { + $r['user-agent'] = $r['headers']['User-Agent']; + unset( $r['headers']['User-Agent'] ); + } + + if ( isset( $r['headers']['user-agent'] ) ) { + $r['user-agent'] = $r['headers']['user-agent']; + unset( $r['headers']['user-agent'] ); + } + + // Construct Cookie: header if any cookies are set + WP_Http::buildCookieHeader( $r ); + + if ( WP_Http_Encoding::is_available() ) + $r['headers']['Accept-Encoding'] = WP_Http_Encoding::accept_encoding(); + + if ( empty($r['body']) ) { + $r['body'] = null; + // Some servers fail when sending content without the content-length header being set. + // Also, to fix another bug, we only send when doing POST and PUT and the content-length + // header isn't already set. + if ( ($r['method'] == 'POST' || $r['method'] == 'PUT') && ! isset( $r['headers']['Content-Length'] ) ) + $r['headers']['Content-Length'] = 0; + } else { + if ( is_array( $r['body'] ) || is_object( $r['body'] ) ) { + $r['body'] = http_build_query( $r['body'], null, '&' ); + $r['headers']['Content-Type'] = 'application/x-www-form-urlencoded; charset=' . get_option( 'blog_charset' ); + $r['headers']['Content-Length'] = strlen( $r['body'] ); + } + + if ( ! isset( $r['headers']['Content-Length'] ) && ! isset( $r['headers']['content-length'] ) ) + $r['headers']['Content-Length'] = strlen( $r['body'] ); + } + + return $this->_dispatch_request($url, $r); + } + + /** + * Tests which transports are capable of supporting the request. + * + * @since 3.2.0 + * @access private + * + * @param array $args Request arguments + * @param string $url URL to Request + * + * @return string|false Class name for the first transport that claims to support the request. False if no transport claims to support the request. + */ + public function _get_first_available_transport( $args, $url = null ) { + $request_order = array( 'curl', 'streams', 'fsockopen' ); + + // Loop over each transport on each HTTP request looking for one which will serve this request's needs + foreach ( $request_order as $transport ) { + $class = 'WP_HTTP_' . $transport; + + // Check to see if this transport is a possibility, calls the transport statically + if ( !call_user_func( array( $class, 'test' ), $args, $url ) ) + continue; + + return $class; + } + + return false; + } + + /** + * Dispatches a HTTP request to a supporting transport. + * + * Tests each transport in order to find a transport which matches the request arguements. + * Also caches the transport instance to be used later. + * + * The order for blocking requests is cURL, Streams, and finally Fsockopen. + * The order for non-blocking requests is cURL, Streams and Fsockopen(). + * + * There are currently issues with "localhost" not resolving correctly with DNS. This may cause + * an error "failed to open stream: A connection attempt failed because the connected party did + * not properly respond after a period of time, or established connection failed because [the] + * connected host has failed to respond." + * + * @since 3.2.0 + * @access private + * + * @param string $url URL to Request + * @param array $args Request arguments + * @return array|object Array containing 'headers', 'body', 'response', 'cookies', 'filename'. A WP_Error instance upon error + */ + private function _dispatch_request( $url, $args ) { + static $transports = array(); + + $class = $this->_get_first_available_transport( $args, $url ); + if ( !$class ) + return new WP_Error( 'http_failure', __( 'There are no HTTP transports available which can complete the requested request.' ) ); + + // Transport claims to support request, instantiate it and give it a whirl. + if ( empty( $transports[$class] ) ) + $transports[$class] = new $class; + + $response = $transports[$class]->request( $url, $args ); + + do_action( 'http_api_debug', $response, 'response', $class ); + + if ( is_wp_error( $response ) ) + return $response; + + return apply_filters( 'http_response', $response, $args, $url ); + } + + /** + * Uses the POST HTTP method. + * + * Used for sending data that is expected to be in the body. + * + * @access public + * @since 2.7.0 + * + * @param string $url URI resource. + * @param str|array $args Optional. Override the defaults. + * @return array|object Array containing 'headers', 'body', 'response', 'cookies', 'filename'. A WP_Error instance upon error + */ + function post($url, $args = array()) { + $defaults = array('method' => 'POST'); + $r = wp_parse_args( $args, $defaults ); + return $this->request($url, $r); + } + + /** + * Uses the GET HTTP method. + * + * Used for sending data that is expected to be in the body. + * + * @access public + * @since 2.7.0 + * + * @param string $url URI resource. + * @param str|array $args Optional. Override the defaults. + * @return array|object Array containing 'headers', 'body', 'response', 'cookies', 'filename'. A WP_Error instance upon error + */ + function get($url, $args = array()) { + $defaults = array('method' => 'GET'); + $r = wp_parse_args( $args, $defaults ); + return $this->request($url, $r); + } + + /** + * Uses the HEAD HTTP method. + * + * Used for sending data that is expected to be in the body. + * + * @access public + * @since 2.7.0 + * + * @param string $url URI resource. + * @param str|array $args Optional. Override the defaults. + * @return array|object Array containing 'headers', 'body', 'response', 'cookies', 'filename'. A WP_Error instance upon error + */ + function head($url, $args = array()) { + $defaults = array('method' => 'HEAD'); + $r = wp_parse_args( $args, $defaults ); + return $this->request($url, $r); + } + + /** + * Parses the responses and splits the parts into headers and body. + * + * @access public + * @static + * @since 2.7.0 + * + * @param string $strResponse The full response string + * @return array Array with 'headers' and 'body' keys. + */ + function processResponse($strResponse) { + $res = explode("\r\n\r\n", $strResponse, 2); + + return array('headers' => $res[0], 'body' => isset($res[1]) ? $res[1] : ''); + } + + /** + * Transform header string into an array. + * + * If an array is given then it is assumed to be raw header data with numeric keys with the + * headers as the values. No headers must be passed that were already processed. + * + * @access public + * @static + * @since 2.7.0 + * + * @param string|array $headers + * @return array Processed string headers. If duplicate headers are encountered, + * Then a numbered array is returned as the value of that header-key. + */ + function processHeaders($headers) { + // split headers, one per array element + if ( is_string($headers) ) { + // tolerate line terminator: CRLF = LF (RFC 2616 19.3) + $headers = str_replace("\r\n", "\n", $headers); + // unfold folded header fields. LWS = [CRLF] 1*( SP | HT ) , (RFC 2616 2.2) + $headers = preg_replace('/\n[ \t]/', ' ', $headers); + // create the headers array + $headers = explode("\n", $headers); + } + + $response = array('code' => 0, 'message' => ''); + + // If a redirection has taken place, The headers for each page request may have been passed. + // In this case, determine the final HTTP header and parse from there. + for ( $i = count($headers)-1; $i >= 0; $i-- ) { + if ( !empty($headers[$i]) && false === strpos($headers[$i], ':') ) { + $headers = array_splice($headers, $i); + break; + } + } + + $cookies = array(); + $newheaders = array(); + foreach ( (array) $headers as $tempheader ) { + if ( empty($tempheader) ) + continue; + + if ( false === strpos($tempheader, ':') ) { + $stack = explode(' ', $tempheader, 3); + $stack[] = ''; + list( , $response['code'], $response['message']) = $stack; + continue; + } + + list($key, $value) = explode(':', $tempheader, 2); + + if ( !empty( $value ) ) { + $key = strtolower( $key ); + if ( isset( $newheaders[$key] ) ) { + if ( !is_array($newheaders[$key]) ) + $newheaders[$key] = array($newheaders[$key]); + $newheaders[$key][] = trim( $value ); + } else { + $newheaders[$key] = trim( $value ); + } + if ( 'set-cookie' == $key ) + $cookies[] = new WP_Http_Cookie( $value ); + } + } + + return array('response' => $response, 'headers' => $newheaders, 'cookies' => $cookies); + } + + /** + * Takes the arguments for a ::request() and checks for the cookie array. + * + * If it's found, then it's assumed to contain WP_Http_Cookie objects, which are each parsed + * into strings and added to the Cookie: header (within the arguments array). Edits the array by + * reference. + * + * @access public + * @version 2.8.0 + * @static + * + * @param array $r Full array of args passed into ::request() + */ + function buildCookieHeader( &$r ) { + if ( ! empty($r['cookies']) ) { + $cookies_header = ''; + foreach ( (array) $r['cookies'] as $cookie ) { + $cookies_header .= $cookie->getHeaderValue() . '; '; + } + $cookies_header = substr( $cookies_header, 0, -2 ); + $r['headers']['cookie'] = $cookies_header; + } + } + + /** + * Decodes chunk transfer-encoding, based off the HTTP 1.1 specification. + * + * Based off the HTTP http_encoding_dechunk function. Does not support UTF-8. Does not support + * returning footer headers. Shouldn't be too difficult to support it though. + * + * @todo Add support for footer chunked headers. + * @access public + * @since 2.7.0 + * @static + * + * @param string $body Body content + * @return string Chunked decoded body on success or raw body on failure. + */ + function chunkTransferDecode($body) { + $body = str_replace(array("\r\n", "\r"), "\n", $body); + // The body is not chunked encoding or is malformed. + if ( ! preg_match( '/^[0-9a-f]+(\s|\n)+/mi', trim($body) ) ) + return $body; + + $parsedBody = ''; + //$parsedHeaders = array(); Unsupported + + while ( true ) { + $hasChunk = (bool) preg_match( '/^([0-9a-f]+)(\s|\n)+/mi', $body, $match ); + + if ( $hasChunk ) { + if ( empty( $match[1] ) ) + return $body; + + $length = hexdec( $match[1] ); + $chunkLength = strlen( $match[0] ); + + $strBody = substr($body, $chunkLength, $length); + $parsedBody .= $strBody; + + $body = ltrim(str_replace(array($match[0], $strBody), '', $body), "\n"); + + if ( "0" == trim($body) ) + return $parsedBody; // Ignore footer headers. + } else { + return $body; + } + } + } + + /** + * Block requests through the proxy. + * + * Those who are behind a proxy and want to prevent access to certain hosts may do so. This will + * prevent plugins from working and core functionality, if you don't include api.wordpress.org. + * + * You block external URL requests by defining WP_HTTP_BLOCK_EXTERNAL as true in your wp-config.php + * file and this will only allow localhost and your blog to make requests. The constant + * WP_ACCESSIBLE_HOSTS will allow additional hosts to go through for requests. The format of the + * WP_ACCESSIBLE_HOSTS constant is a comma separated list of hostnames to allow, wildcard domains + * are supported, eg *.wordpress.org will allow for all subdomains of wordpress.org to be contacted. + * + * @since 2.8.0 + * @link http://core.trac.wordpress.org/ticket/8927 Allow preventing external requests. + * @link http://core.trac.wordpress.org/ticket/14636 Allow wildcard domains in WP_ACCESSIBLE_HOSTS + * + * @param string $uri URI of url. + * @return bool True to block, false to allow. + */ + function block_request($uri) { + // We don't need to block requests, because nothing is blocked. + if ( ! defined( 'WP_HTTP_BLOCK_EXTERNAL' ) || ! WP_HTTP_BLOCK_EXTERNAL ) + return false; + + // parse_url() only handles http, https type URLs, and will emit E_WARNING on failure. + // This will be displayed on blogs, which is not reasonable. + $check = @parse_url($uri); + + /* Malformed URL, can not process, but this could mean ssl, so let through anyway. + * + * This isn't very security sound. There are instances where a hacker might attempt + * to bypass the proxy and this check. However, the reason for this behavior is that + * WordPress does not do any checking currently for non-proxy requests, so it is keeps with + * the default unsecure nature of the HTTP request. + */ + if ( $check === false ) + return false; + + $home = parse_url( get_option('siteurl') ); + + // Don't block requests back to ourselves by default + if ( $check['host'] == 'localhost' || $check['host'] == $home['host'] ) + return apply_filters('block_local_requests', false); + + if ( !defined('WP_ACCESSIBLE_HOSTS') ) + return true; + + static $accessible_hosts; + static $wildcard_regex = false; + if ( null == $accessible_hosts ) { + $accessible_hosts = preg_split('|,\s*|', WP_ACCESSIBLE_HOSTS); + + if ( false !== strpos(WP_ACCESSIBLE_HOSTS, '*') ) { + $wildcard_regex = array(); + foreach ( $accessible_hosts as $host ) + $wildcard_regex[] = str_replace('\*', '[\w.]+?', preg_quote($host, '/')); + $wildcard_regex = '/^(' . implode('|', $wildcard_regex) . ')$/i'; + } + } + + if ( !empty($wildcard_regex) ) + return !preg_match($wildcard_regex, $check['host']); + else + return !in_array( $check['host'], $accessible_hosts ); //Inverse logic, If its in the array, then we can't access it. + + + + } +} + +/** + * HTTP request method uses fsockopen function to retrieve the url. + * + * This would be the preferred method, but the fsockopen implementation has the most overhead of all + * the HTTP transport implementations. + * + * @package WordPress + * @subpackage HTTP + * @since 2.7.0 + */ +class WP_Http_Fsockopen { + /** + * Send a HTTP request to a URI using fsockopen(). + * + * Does not support non-blocking mode. + * + * @see WP_Http::request For default options descriptions. + * + * @since 2.7 + * @access public + * @param string $url URI resource. + * @param str|array $args Optional. Override the defaults. + * @return array 'headers', 'body', 'response', 'cookies' and 'filename' keys. + */ + function request($url, $args = array()) { + $defaults = array( + 'method' => 'GET', 'timeout' => 5, + 'redirection' => 5, 'httpversion' => '1.0', + 'blocking' => true, + 'headers' => array(), 'body' => null, 'cookies' => array() + ); + + $r = wp_parse_args( $args, $defaults ); + + if ( isset($r['headers']['User-Agent']) ) { + $r['user-agent'] = $r['headers']['User-Agent']; + unset($r['headers']['User-Agent']); + } else if ( isset($r['headers']['user-agent']) ) { + $r['user-agent'] = $r['headers']['user-agent']; + unset($r['headers']['user-agent']); + } + + // Construct Cookie: header if any cookies are set + WP_Http::buildCookieHeader( $r ); + + $iError = null; // Store error number + $strError = null; // Store error string + + $arrURL = parse_url($url); + + $fsockopen_host = $arrURL['host']; + + $secure_transport = false; + + if ( ! isset( $arrURL['port'] ) ) { + if ( ( $arrURL['scheme'] == 'ssl' || $arrURL['scheme'] == 'https' ) && extension_loaded('openssl') ) { + $fsockopen_host = "ssl://$fsockopen_host"; + $arrURL['port'] = 443; + $secure_transport = true; + } else { + $arrURL['port'] = 80; + } + } + + //fsockopen has issues with 'localhost' with IPv6 with certain versions of PHP, It attempts to connect to ::1, + // which fails when the server is not set up for it. For compatibility, always connect to the IPv4 address. + if ( 'localhost' == strtolower($fsockopen_host) ) + $fsockopen_host = '127.0.0.1'; + + // There are issues with the HTTPS and SSL protocols that cause errors that can be safely + // ignored and should be ignored. + if ( true === $secure_transport ) + $error_reporting = error_reporting(0); + + $startDelay = time(); + + $proxy = new WP_HTTP_Proxy(); + + if ( !WP_DEBUG ) { + if ( $proxy->is_enabled() && $proxy->send_through_proxy( $url ) ) + $handle = @fsockopen( $proxy->host(), $proxy->port(), $iError, $strError, $r['timeout'] ); + else + $handle = @fsockopen( $fsockopen_host, $arrURL['port'], $iError, $strError, $r['timeout'] ); + } else { + if ( $proxy->is_enabled() && $proxy->send_through_proxy( $url ) ) + $handle = fsockopen( $proxy->host(), $proxy->port(), $iError, $strError, $r['timeout'] ); + else + $handle = fsockopen( $fsockopen_host, $arrURL['port'], $iError, $strError, $r['timeout'] ); + } + + $endDelay = time(); + + // If the delay is greater than the timeout then fsockopen should't be used, because it will + // cause a long delay. + $elapseDelay = ($endDelay-$startDelay) > $r['timeout']; + if ( true === $elapseDelay ) + add_option( 'disable_fsockopen', $endDelay, null, true ); + + if ( false === $handle ) + return new WP_Error('http_request_failed', $iError . ': ' . $strError); + + $timeout = (int) floor( $r['timeout'] ); + $utimeout = $timeout == $r['timeout'] ? 0 : 1000000 * $r['timeout'] % 1000000; + stream_set_timeout( $handle, $timeout, $utimeout ); + + if ( $proxy->is_enabled() && $proxy->send_through_proxy( $url ) ) //Some proxies require full URL in this field. + $requestPath = $url; + else + $requestPath = $arrURL['path'] . ( isset($arrURL['query']) ? '?' . $arrURL['query'] : '' ); + + if ( empty($requestPath) ) + $requestPath .= '/'; + + $strHeaders = strtoupper($r['method']) . ' ' . $requestPath . ' HTTP/' . $r['httpversion'] . "\r\n"; + + if ( $proxy->is_enabled() && $proxy->send_through_proxy( $url ) ) + $strHeaders .= 'Host: ' . $arrURL['host'] . ':' . $arrURL['port'] . "\r\n"; + else + $strHeaders .= 'Host: ' . $arrURL['host'] . "\r\n"; + + if ( isset($r['user-agent']) ) + $strHeaders .= 'User-agent: ' . $r['user-agent'] . "\r\n"; + + if ( is_array($r['headers']) ) { + foreach ( (array) $r['headers'] as $header => $headerValue ) + $strHeaders .= $header . ': ' . $headerValue . "\r\n"; + } else { + $strHeaders .= $r['headers']; + } + + if ( $proxy->use_authentication() ) + $strHeaders .= $proxy->authentication_header() . "\r\n"; + + $strHeaders .= "\r\n"; + + if ( ! is_null($r['body']) ) + $strHeaders .= $r['body']; + + fwrite($handle, $strHeaders); + + if ( ! $r['blocking'] ) { + fclose($handle); + return array( 'headers' => array(), 'body' => '', 'response' => array('code' => false, 'message' => false), 'cookies' => array() ); + } + + $strResponse = ''; + $bodyStarted = false; + + // If streaming to a file setup the file handle + if ( $r['stream'] ) { + if ( ! WP_DEBUG ) + $stream_handle = @fopen( $r['filename'], 'w+' ); + else + $stream_handle = fopen( $r['filename'], 'w+' ); + if ( ! $stream_handle ) + return new WP_Error( 'http_request_failed', sprintf( __( 'Could not open handle for fopen() to %s' ), $r['filename'] ) ); + + while ( ! feof($handle) ) { + $block = fread( $handle, 4096 ); + if ( $bodyStarted ) { + fwrite( $stream_handle, $block ); + } else { + $strResponse .= $block; + if ( strpos( $strResponse, "\r\n\r\n" ) ) { + $process = WP_Http::processResponse( $strResponse ); + $bodyStarted = true; + fwrite( $stream_handle, $process['body'] ); + unset( $strResponse ); + $process['body'] = ''; + } + } + } + + fclose( $stream_handle ); + + } else { + while ( ! feof($handle) ) + $strResponse .= fread( $handle, 4096 ); + + $process = WP_Http::processResponse( $strResponse ); + unset( $strResponse ); + } + + fclose( $handle ); + + if ( true === $secure_transport ) + error_reporting($error_reporting); + + $arrHeaders = WP_Http::processHeaders( $process['headers'] ); + + // If location is found, then assume redirect and redirect to location. + if ( isset($arrHeaders['headers']['location']) && 0 !== $r['_redirection'] ) { + if ( $r['redirection']-- > 0 ) { + return $this->request($arrHeaders['headers']['location'], $r); + } else { + return new WP_Error('http_request_failed', __('Too many redirects.')); + } + } + + // If the body was chunk encoded, then decode it. + if ( ! empty( $process['body'] ) && isset( $arrHeaders['headers']['transfer-encoding'] ) && 'chunked' == $arrHeaders['headers']['transfer-encoding'] ) + $process['body'] = WP_Http::chunkTransferDecode($process['body']); + + if ( true === $r['decompress'] && true === WP_Http_Encoding::should_decode($arrHeaders['headers']) ) + $process['body'] = WP_Http_Encoding::decompress( $process['body'] ); + + return array( 'headers' => $arrHeaders['headers'], 'body' => $process['body'], 'response' => $arrHeaders['response'], 'cookies' => $arrHeaders['cookies'], 'filename' => $r['filename'] ); + } + + /** + * Whether this class can be used for retrieving an URL. + * + * @since 2.7.0 + * @static + * @return boolean False means this class can not be used, true means it can. + */ + function test( $args = array() ) { + if ( ! function_exists( 'fsockopen' ) ) + return false; + + if ( false !== ($option = get_option( 'disable_fsockopen' )) && time()-$option < 43200 ) // 12 hours + return false; + + $is_ssl = isset( $args['ssl'] ) && $args['ssl']; + + if ( $is_ssl && ! extension_loaded( 'openssl' ) ) + return false; + + return apply_filters( 'use_fsockopen_transport', true, $args ); + } +} + +/** + * HTTP request method uses Streams to retrieve the url. + * + * Requires PHP 5.0+ and uses fopen with stream context. Requires that 'allow_url_fopen' PHP setting + * to be enabled. + * + * Second preferred method for getting the URL, for PHP 5. + * + * @package WordPress + * @subpackage HTTP + * @since 2.7.0 + */ +class WP_Http_Streams { + /** + * Send a HTTP request to a URI using streams with fopen(). + * + * @access public + * @since 2.7.0 + * + * @param string $url + * @param str|array $args Optional. Override the defaults. + * @return array 'headers', 'body', 'response', 'cookies' and 'filename' keys. + */ + function request($url, $args = array()) { + $defaults = array( + 'method' => 'GET', 'timeout' => 5, + 'redirection' => 5, 'httpversion' => '1.0', + 'blocking' => true, + 'headers' => array(), 'body' => null, 'cookies' => array() + ); + + $r = wp_parse_args( $args, $defaults ); + + if ( isset($r['headers']['User-Agent']) ) { + $r['user-agent'] = $r['headers']['User-Agent']; + unset($r['headers']['User-Agent']); + } else if ( isset($r['headers']['user-agent']) ) { + $r['user-agent'] = $r['headers']['user-agent']; + unset($r['headers']['user-agent']); + } + + // Construct Cookie: header if any cookies are set + WP_Http::buildCookieHeader( $r ); + + $arrURL = parse_url($url); + + if ( false === $arrURL ) + return new WP_Error('http_request_failed', sprintf(__('Malformed URL: %s'), $url)); + + if ( 'http' != $arrURL['scheme'] && 'https' != $arrURL['scheme'] ) + $url = preg_replace('|^' . preg_quote($arrURL['scheme'], '|') . '|', 'http', $url); + + // Convert Header array to string. + $strHeaders = ''; + if ( is_array( $r['headers'] ) ) + foreach ( $r['headers'] as $name => $value ) + $strHeaders .= "{$name}: $value\r\n"; + else if ( is_string( $r['headers'] ) ) + $strHeaders = $r['headers']; + + $is_local = isset($args['local']) && $args['local']; + $ssl_verify = isset($args['sslverify']) && $args['sslverify']; + if ( $is_local ) + $ssl_verify = apply_filters('https_local_ssl_verify', $ssl_verify); + elseif ( ! $is_local ) + $ssl_verify = apply_filters('https_ssl_verify', $ssl_verify); + + $arrContext = array('http' => + array( + 'method' => strtoupper($r['method']), + 'user_agent' => $r['user-agent'], + 'max_redirects' => $r['redirection'] + 1, // See #11557 + 'protocol_version' => (float) $r['httpversion'], + 'header' => $strHeaders, + 'ignore_errors' => true, // Return non-200 requests. + 'timeout' => $r['timeout'], + 'ssl' => array( + 'verify_peer' => $ssl_verify, + 'verify_host' => $ssl_verify + ) + ) + ); + + $proxy = new WP_HTTP_Proxy(); + + if ( $proxy->is_enabled() && $proxy->send_through_proxy( $url ) ) { + $arrContext['http']['proxy'] = 'tcp://' . $proxy->host() . ':' . $proxy->port(); + $arrContext['http']['request_fulluri'] = true; + + // We only support Basic authentication so this will only work if that is what your proxy supports. + if ( $proxy->use_authentication() ) + $arrContext['http']['header'] .= $proxy->authentication_header() . "\r\n"; + } + + if ( ! empty($r['body'] ) ) + $arrContext['http']['content'] = $r['body']; + + $context = stream_context_create($arrContext); + + if ( !WP_DEBUG ) + $handle = @fopen($url, 'r', false, $context); + else + $handle = fopen($url, 'r', false, $context); + + if ( ! $handle ) + return new WP_Error('http_request_failed', sprintf(__('Could not open handle for fopen() to %s'), $url)); + + $timeout = (int) floor( $r['timeout'] ); + $utimeout = $timeout == $r['timeout'] ? 0 : 1000000 * $r['timeout'] % 1000000; + stream_set_timeout( $handle, $timeout, $utimeout ); + + if ( ! $r['blocking'] ) { + stream_set_blocking($handle, 0); + fclose($handle); + return array( 'headers' => array(), 'body' => '', 'response' => array('code' => false, 'message' => false), 'cookies' => array() ); + } + + if ( $r['stream'] ) { + if ( ! WP_DEBUG ) + $stream_handle = @fopen( $r['filename'], 'w+' ); + else + $stream_handle = fopen( $r['filename'], 'w+' ); + + if ( ! $stream_handle ) + return new WP_Error( 'http_request_failed', sprintf( __( 'Could not open handle for fopen() to %s' ), $r['filename'] ) ); + + stream_copy_to_stream( $handle, $stream_handle ); + + fclose( $stream_handle ); + $strResponse = ''; + } else { + $strResponse = stream_get_contents( $handle ); + } + + $meta = stream_get_meta_data( $handle ); + + fclose( $handle ); + + $processedHeaders = array(); + if ( isset( $meta['wrapper_data']['headers'] ) ) + $processedHeaders = WP_Http::processHeaders($meta['wrapper_data']['headers']); + else + $processedHeaders = WP_Http::processHeaders($meta['wrapper_data']); + + // Streams does not provide an error code which we can use to see why the request stream stoped. + // We can however test to see if a location header is present and return based on that. + if ( isset($processedHeaders['headers']['location']) && 0 !== $args['_redirection'] ) + return new WP_Error('http_request_failed', __('Too many redirects.')); + + if ( ! empty( $strResponse ) && isset( $processedHeaders['headers']['transfer-encoding'] ) && 'chunked' == $processedHeaders['headers']['transfer-encoding'] ) + $strResponse = WP_Http::chunkTransferDecode($strResponse); + + if ( true === $r['decompress'] && true === WP_Http_Encoding::should_decode($processedHeaders['headers']) ) + $strResponse = WP_Http_Encoding::decompress( $strResponse ); + + return array( 'headers' => $processedHeaders['headers'], 'body' => $strResponse, 'response' => $processedHeaders['response'], 'cookies' => $processedHeaders['cookies'], 'filename' => $r['filename'] ); + } + + /** + * Whether this class can be used for retrieving an URL. + * + * @static + * @access public + * @since 2.7.0 + * + * @return boolean False means this class can not be used, true means it can. + */ + function test( $args = array() ) { + if ( ! function_exists( 'fopen' ) ) + return false; + + if ( ! function_exists( 'ini_get' ) || true != ini_get( 'allow_url_fopen' ) ) + return false; + + $is_ssl = isset( $args['ssl'] ) && $args['ssl']; + + if ( $is_ssl && ! extension_loaded( 'openssl' ) ) + return false; + + return apply_filters( 'use_streams_transport', true, $args ); + } +} + +/** + * HTTP request method uses Curl extension to retrieve the url. + * + * Requires the Curl extension to be installed. + * + * @package WordPress + * @subpackage HTTP + * @since 2.7 + */ +class WP_Http_Curl { + + /** + * Temporary header storage for use with streaming to a file. + * + * @since 3.2.0 + * @access private + * @var string + */ + private $headers = ''; + + /** + * Send a HTTP request to a URI using cURL extension. + * + * @access public + * @since 2.7.0 + * + * @param string $url + * @param str|array $args Optional. Override the defaults. + * @return array 'headers', 'body', 'response', 'cookies' and 'filename' keys. + */ + function request($url, $args = array()) { + $defaults = array( + 'method' => 'GET', 'timeout' => 5, + 'redirection' => 5, 'httpversion' => '1.0', + 'blocking' => true, + 'headers' => array(), 'body' => null, 'cookies' => array() + ); + + $r = wp_parse_args( $args, $defaults ); + + if ( isset($r['headers']['User-Agent']) ) { + $r['user-agent'] = $r['headers']['User-Agent']; + unset($r['headers']['User-Agent']); + } else if ( isset($r['headers']['user-agent']) ) { + $r['user-agent'] = $r['headers']['user-agent']; + unset($r['headers']['user-agent']); + } + + // Construct Cookie: header if any cookies are set. + WP_Http::buildCookieHeader( $r ); + + $handle = curl_init(); + + // cURL offers really easy proxy support. + $proxy = new WP_HTTP_Proxy(); + + if ( $proxy->is_enabled() && $proxy->send_through_proxy( $url ) ) { + + curl_setopt( $handle, CURLOPT_PROXYTYPE, CURLPROXY_HTTP ); + curl_setopt( $handle, CURLOPT_PROXY, $proxy->host() ); + curl_setopt( $handle, CURLOPT_PROXYPORT, $proxy->port() ); + + if ( $proxy->use_authentication() ) { + curl_setopt( $handle, CURLOPT_PROXYAUTH, CURLAUTH_ANY ); + curl_setopt( $handle, CURLOPT_PROXYUSERPWD, $proxy->authentication() ); + } + } + + $is_local = isset($args['local']) && $args['local']; + $ssl_verify = isset($args['sslverify']) && $args['sslverify']; + if ( $is_local ) + $ssl_verify = apply_filters('https_local_ssl_verify', $ssl_verify); + elseif ( ! $is_local ) + $ssl_verify = apply_filters('https_ssl_verify', $ssl_verify); + + + // CURLOPT_TIMEOUT and CURLOPT_CONNECTTIMEOUT expect integers. Have to use ceil since + // a value of 0 will allow an ulimited timeout. + $timeout = (int) ceil( $r['timeout'] ); + curl_setopt( $handle, CURLOPT_CONNECTTIMEOUT, $timeout ); + curl_setopt( $handle, CURLOPT_TIMEOUT, $timeout ); + + curl_setopt( $handle, CURLOPT_URL, $url); + curl_setopt( $handle, CURLOPT_RETURNTRANSFER, true ); + curl_setopt( $handle, CURLOPT_SSL_VERIFYHOST, ( $ssl_verify === true ) ? 2 : false ); + curl_setopt( $handle, CURLOPT_SSL_VERIFYPEER, $ssl_verify ); + curl_setopt( $handle, CURLOPT_USERAGENT, $r['user-agent'] ); + curl_setopt( $handle, CURLOPT_MAXREDIRS, $r['redirection'] ); + + switch ( $r['method'] ) { + case 'HEAD': + curl_setopt( $handle, CURLOPT_NOBODY, true ); + break; + case 'POST': + curl_setopt( $handle, CURLOPT_POST, true ); + curl_setopt( $handle, CURLOPT_POSTFIELDS, $r['body'] ); + break; + case 'PUT': + curl_setopt( $handle, CURLOPT_CUSTOMREQUEST, 'PUT' ); + curl_setopt( $handle, CURLOPT_POSTFIELDS, $r['body'] ); + break; + } + + if ( true === $r['blocking'] ) + curl_setopt( $handle, CURLOPT_HEADERFUNCTION, array( &$this, 'stream_headers' ) ); + + curl_setopt( $handle, CURLOPT_HEADER, false ); + + // If streaming to a file open a file handle, and setup our curl streaming handler + if ( $r['stream'] ) { + if ( ! WP_DEBUG ) + $stream_handle = @fopen( $r['filename'], 'w+' ); + else + $stream_handle = fopen( $r['filename'], 'w+' ); + if ( ! $stream_handle ) + return new WP_Error( 'http_request_failed', sprintf( __( 'Could not open handle for fopen() to %s' ), $r['filename'] ) ); + curl_setopt( $handle, CURLOPT_FILE, $stream_handle ); + } + + // The option doesn't work with safe mode or when open_basedir is set. + if ( !ini_get('safe_mode') && !ini_get('open_basedir') && 0 !== $r['_redirection'] ) + curl_setopt( $handle, CURLOPT_FOLLOWLOCATION, true ); + + if ( !empty( $r['headers'] ) ) { + // cURL expects full header strings in each element + $headers = array(); + foreach ( $r['headers'] as $name => $value ) { + $headers[] = "{$name}: $value"; + } + curl_setopt( $handle, CURLOPT_HTTPHEADER, $headers ); + } + + if ( $r['httpversion'] == '1.0' ) + curl_setopt( $handle, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0 ); + else + curl_setopt( $handle, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1 ); + + // Cookies are not handled by the HTTP API currently. Allow for plugin authors to handle it + // themselves... Although, it is somewhat pointless without some reference. + do_action_ref_array( 'http_api_curl', array(&$handle) ); + + // We don't need to return the body, so don't. Just execute request and return. + if ( ! $r['blocking'] ) { + curl_exec( $handle ); + curl_close( $handle ); + return array( 'headers' => array(), 'body' => '', 'response' => array('code' => false, 'message' => false), 'cookies' => array() ); + } + + $theResponse = curl_exec( $handle ); + $theBody = ''; + $theHeaders = WP_Http::processHeaders( $this->headers ); + + if ( strlen($theResponse) > 0 && ! is_bool( $theResponse ) ) // is_bool: when using $args['stream'], curl_exec will return (bool)true + $theBody = $theResponse; + + // If no response, and It's not a HEAD request with valid headers returned + if ( 0 == strlen($theResponse) && ('HEAD' != $args['method'] || empty($this->headers)) ) { + if ( $curl_error = curl_error($handle) ) + return new WP_Error('http_request_failed', $curl_error); + if ( in_array( curl_getinfo( $handle, CURLINFO_HTTP_CODE ), array(301, 302) ) ) + return new WP_Error('http_request_failed', __('Too many redirects.')); + } + + unset( $this->headers ); + + $response = array(); + $response['code'] = curl_getinfo( $handle, CURLINFO_HTTP_CODE ); + $response['message'] = get_status_header_desc($response['code']); + + curl_close( $handle ); + + if ( $r['stream'] ) + fclose( $stream_handle ); + + // See #11305 - When running under safe mode, redirection is disabled above. Handle it manually. + if ( ! empty( $theHeaders['headers']['location'] ) && ( ini_get( 'safe_mode' ) || ini_get( 'open_basedir' ) ) && 0 !== $r['_redirection'] ) { + if ( $r['redirection']-- > 0 ) { + return $this->request( $theHeaders['headers']['location'], $r ); + } else { + return new WP_Error( 'http_request_failed', __( 'Too many redirects.' ) ); + } + } + + if ( true === $r['decompress'] && true === WP_Http_Encoding::should_decode($theHeaders['headers']) ) + $theBody = WP_Http_Encoding::decompress( $theBody ); + + return array( 'headers' => $theHeaders['headers'], 'body' => $theBody, 'response' => $response, 'cookies' => $theHeaders['cookies'], 'filename' => $r['filename'] ); + } + + /** + * Grab the headers of the cURL request + * + * Each header is sent individually to this callback, so we append to the $header property for temporary storage + * + * @since 3.2.0 + * @access private + * @return int + */ + private function stream_headers( $handle, $headers ) { + $this->headers .= $headers; + return strlen( $headers ); + } + + /** + * Whether this class can be used for retrieving an URL. + * + * @static + * @since 2.7.0 + * + * @return boolean False means this class can not be used, true means it can. + */ + function test( $args = array() ) { + if ( ! function_exists( 'curl_init' ) || ! function_exists( 'curl_exec' ) ) + return false; + + $is_ssl = isset( $args['ssl'] ) && $args['ssl']; + + if ( $is_ssl ) { + $curl_version = curl_version(); + if ( ! (CURL_VERSION_SSL & $curl_version['features']) ) // Does this cURL version support SSL requests? + return false; + } + + return apply_filters( 'use_curl_transport', true, $args ); + } +} + +/** + * Adds Proxy support to the WordPress HTTP API. + * + * There are caveats to proxy support. It requires that defines be made in the wp-config.php file to + * enable proxy support. There are also a few filters that plugins can hook into for some of the + * constants. + * + * Please note that only BASIC authentication is supported by most transports. + * cURL MAY support more methods (such as NTLM authentication) depending on your environment. + * + * The constants are as follows: + *
                + *
              1. WP_PROXY_HOST - Enable proxy support and host for connecting.
              2. + *
              3. WP_PROXY_PORT - Proxy port for connection. No default, must be defined.
              4. + *
              5. WP_PROXY_USERNAME - Proxy username, if it requires authentication.
              6. + *
              7. WP_PROXY_PASSWORD - Proxy password, if it requires authentication.
              8. + *
              9. WP_PROXY_BYPASS_HOSTS - Will prevent the hosts in this list from going through the proxy. + * You do not need to have localhost and the blog host in this list, because they will not be passed + * through the proxy. The list should be presented in a comma separated list, wildcards using * are supported, eg. *.wordpress.org
              10. + *
              + * + * An example can be as seen below. + * + * define('WP_PROXY_HOST', '192.168.84.101'); + * define('WP_PROXY_PORT', '8080'); + * define('WP_PROXY_BYPASS_HOSTS', 'localhost, www.example.com, *.wordpress.org'); + * + * + * @link http://core.trac.wordpress.org/ticket/4011 Proxy support ticket in WordPress. + * @link http://core.trac.wordpress.org/ticket/14636 Allow wildcard domains in WP_PROXY_BYPASS_HOSTS + * @since 2.8 + */ +class WP_HTTP_Proxy { + + /** + * Whether proxy connection should be used. + * + * @since 2.8 + * @use WP_PROXY_HOST + * @use WP_PROXY_PORT + * + * @return bool + */ + function is_enabled() { + return defined('WP_PROXY_HOST') && defined('WP_PROXY_PORT'); + } + + /** + * Whether authentication should be used. + * + * @since 2.8 + * @use WP_PROXY_USERNAME + * @use WP_PROXY_PASSWORD + * + * @return bool + */ + function use_authentication() { + return defined('WP_PROXY_USERNAME') && defined('WP_PROXY_PASSWORD'); + } + + /** + * Retrieve the host for the proxy server. + * + * @since 2.8 + * + * @return string + */ + function host() { + if ( defined('WP_PROXY_HOST') ) + return WP_PROXY_HOST; + + return ''; + } + + /** + * Retrieve the port for the proxy server. + * + * @since 2.8 + * + * @return string + */ + function port() { + if ( defined('WP_PROXY_PORT') ) + return WP_PROXY_PORT; + + return ''; + } + + /** + * Retrieve the username for proxy authentication. + * + * @since 2.8 + * + * @return string + */ + function username() { + if ( defined('WP_PROXY_USERNAME') ) + return WP_PROXY_USERNAME; + + return ''; + } + + /** + * Retrieve the password for proxy authentication. + * + * @since 2.8 + * + * @return string + */ + function password() { + if ( defined('WP_PROXY_PASSWORD') ) + return WP_PROXY_PASSWORD; + + return ''; + } + + /** + * Retrieve authentication string for proxy authentication. + * + * @since 2.8 + * + * @return string + */ + function authentication() { + return $this->username() . ':' . $this->password(); + } + + /** + * Retrieve header string for proxy authentication. + * + * @since 2.8 + * + * @return string + */ + function authentication_header() { + return 'Proxy-Authorization: Basic ' . base64_encode( $this->authentication() ); + } + + /** + * Whether URL should be sent through the proxy server. + * + * We want to keep localhost and the blog URL from being sent through the proxy server, because + * some proxies can not handle this. We also have the constant available for defining other + * hosts that won't be sent through the proxy. + * + * @uses WP_PROXY_BYPASS_HOSTS + * @since 2.8.0 + * + * @param string $uri URI to check. + * @return bool True, to send through the proxy and false if, the proxy should not be used. + */ + function send_through_proxy( $uri ) { + // parse_url() only handles http, https type URLs, and will emit E_WARNING on failure. + // This will be displayed on blogs, which is not reasonable. + $check = @parse_url($uri); + + // Malformed URL, can not process, but this could mean ssl, so let through anyway. + if ( $check === false ) + return true; + + $home = parse_url( get_option('siteurl') ); + + if ( $check['host'] == 'localhost' || $check['host'] == $home['host'] ) + return false; + + if ( !defined('WP_PROXY_BYPASS_HOSTS') ) + return true; + + static $bypass_hosts; + static $wildcard_regex = false; + if ( null == $bypass_hosts ) { + $bypass_hosts = preg_split('|,\s*|', WP_PROXY_BYPASS_HOSTS); + + if ( false !== strpos(WP_PROXY_BYPASS_HOSTS, '*') ) { + $wildcard_regex = array(); + foreach ( $bypass_hosts as $host ) + $wildcard_regex[] = str_replace('\*', '[\w.]+?', preg_quote($host, '/')); + $wildcard_regex = '/^(' . implode('|', $wildcard_regex) . ')$/i'; + } + } + + if ( !empty($wildcard_regex) ) + return !preg_match($wildcard_regex, $check['host']); + else + return !in_array( $check['host'], $bypass_hosts ); + } +} +/** + * Internal representation of a single cookie. + * + * Returned cookies are represented using this class, and when cookies are set, if they are not + * already a WP_Http_Cookie() object, then they are turned into one. + * + * @todo The WordPress convention is to use underscores instead of camelCase for function and method + * names. Need to switch to use underscores instead for the methods. + * + * @package WordPress + * @subpackage HTTP + * @since 2.8.0 + */ +class WP_Http_Cookie { + + /** + * Cookie name. + * + * @since 2.8.0 + * @var string + */ + var $name; + + /** + * Cookie value. + * + * @since 2.8.0 + * @var string + */ + var $value; + + /** + * When the cookie expires. + * + * @since 2.8.0 + * @var string + */ + var $expires; + + /** + * Cookie URL path. + * + * @since 2.8.0 + * @var string + */ + var $path; + + /** + * Cookie Domain. + * + * @since 2.8.0 + * @var string + */ + var $domain; + + /** + * Sets up this cookie object. + * + * The parameter $data should be either an associative array containing the indices names below + * or a header string detailing it. + * + * If it's an array, it should include the following elements: + *
                + *
              1. Name
              2. + *
              3. Value - should NOT be urlencoded already.
              4. + *
              5. Expires - (optional) String or int (UNIX timestamp).
              6. + *
              7. Path (optional)
              8. + *
              9. Domain (optional)
              10. + *
              + * + * @access public + * @since 2.8.0 + * + * @param string|array $data Raw cookie data. + */ + function __construct( $data ) { + if ( is_string( $data ) ) { + // Assume it's a header string direct from a previous request + $pairs = explode( ';', $data ); + + // Special handling for first pair; name=value. Also be careful of "=" in value + $name = trim( substr( $pairs[0], 0, strpos( $pairs[0], '=' ) ) ); + $value = substr( $pairs[0], strpos( $pairs[0], '=' ) + 1 ); + $this->name = $name; + $this->value = urldecode( $value ); + array_shift( $pairs ); //Removes name=value from items. + + // Set everything else as a property + foreach ( $pairs as $pair ) { + $pair = rtrim($pair); + if ( empty($pair) ) //Handles the cookie ending in ; which results in a empty final pair + continue; + + list( $key, $val ) = strpos( $pair, '=' ) ? explode( '=', $pair ) : array( $pair, '' ); + $key = strtolower( trim( $key ) ); + if ( 'expires' == $key ) + $val = strtotime( $val ); + $this->$key = $val; + } + } else { + if ( !isset( $data['name'] ) ) + return false; + + // Set properties based directly on parameters + $this->name = $data['name']; + $this->value = isset( $data['value'] ) ? $data['value'] : ''; + $this->path = isset( $data['path'] ) ? $data['path'] : ''; + $this->domain = isset( $data['domain'] ) ? $data['domain'] : ''; + + if ( isset( $data['expires'] ) ) + $this->expires = is_int( $data['expires'] ) ? $data['expires'] : strtotime( $data['expires'] ); + else + $this->expires = null; + } + } + + /** + * Confirms that it's OK to send this cookie to the URL checked against. + * + * Decision is based on RFC 2109/2965, so look there for details on validity. + * + * @access public + * @since 2.8.0 + * + * @param string $url URL you intend to send this cookie to + * @return boolean TRUE if allowed, FALSE otherwise. + */ + function test( $url ) { + // Expires - if expired then nothing else matters + if ( time() > $this->expires ) + return false; + + // Get details on the URL we're thinking about sending to + $url = parse_url( $url ); + $url['port'] = isset( $url['port'] ) ? $url['port'] : 80; + $url['path'] = isset( $url['path'] ) ? $url['path'] : '/'; + + // Values to use for comparison against the URL + $path = isset( $this->path ) ? $this->path : '/'; + $port = isset( $this->port ) ? $this->port : 80; + $domain = isset( $this->domain ) ? strtolower( $this->domain ) : strtolower( $url['host'] ); + if ( false === stripos( $domain, '.' ) ) + $domain .= '.local'; + + // Host - very basic check that the request URL ends with the domain restriction (minus leading dot) + $domain = substr( $domain, 0, 1 ) == '.' ? substr( $domain, 1 ) : $domain; + if ( substr( $url['host'], -strlen( $domain ) ) != $domain ) + return false; + + // Port - supports "port-lists" in the format: "80,8000,8080" + if ( !in_array( $url['port'], explode( ',', $port) ) ) + return false; + + // Path - request path must start with path restriction + if ( substr( $url['path'], 0, strlen( $path ) ) != $path ) + return false; + + return true; + } + + /** + * Convert cookie name and value back to header string. + * + * @access public + * @since 2.8.0 + * + * @return string Header encoded cookie name and value. + */ + function getHeaderValue() { + if ( empty( $this->name ) || empty( $this->value ) ) + return ''; + + return $this->name . '=' . urlencode( $this->value ); + } + + /** + * Retrieve cookie header for usage in the rest of the WordPress HTTP API. + * + * @access public + * @since 2.8.0 + * + * @return string + */ + function getFullHeader() { + return 'Cookie: ' . $this->getHeaderValue(); + } +} + +/** + * Implementation for deflate and gzip transfer encodings. + * + * Includes RFC 1950, RFC 1951, and RFC 1952. + * + * @since 2.8 + * @package WordPress + * @subpackage HTTP + */ +class WP_Http_Encoding { + + /** + * Compress raw string using the deflate format. + * + * Supports the RFC 1951 standard. + * + * @since 2.8 + * + * @param string $raw String to compress. + * @param int $level Optional, default is 9. Compression level, 9 is highest. + * @param string $supports Optional, not used. When implemented it will choose the right compression based on what the server supports. + * @return string|bool False on failure. + */ + function compress( $raw, $level = 9, $supports = null ) { + return gzdeflate( $raw, $level ); + } + + /** + * Decompression of deflated string. + * + * Will attempt to decompress using the RFC 1950 standard, and if that fails + * then the RFC 1951 standard deflate will be attempted. Finally, the RFC + * 1952 standard gzip decode will be attempted. If all fail, then the + * original compressed string will be returned. + * + * @since 2.8 + * + * @param string $compressed String to decompress. + * @param int $length The optional length of the compressed data. + * @return string|bool False on failure. + */ + function decompress( $compressed, $length = null ) { + + if ( empty($compressed) ) + return $compressed; + + if ( false !== ( $decompressed = @gzinflate( $compressed ) ) ) + return $decompressed; + + if ( false !== ( $decompressed = WP_Http_Encoding::compatible_gzinflate( $compressed ) ) ) + return $decompressed; + + if ( false !== ( $decompressed = @gzuncompress( $compressed ) ) ) + return $decompressed; + + if ( function_exists('gzdecode') ) { + $decompressed = @gzdecode( $compressed ); + + if ( false !== $decompressed ) + return $decompressed; + } + + return $compressed; + } + + /** + * Decompression of deflated string while staying compatible with the majority of servers. + * + * Certain Servers will return deflated data with headers which PHP's gziniflate() + * function cannot handle out of the box. The following function lifted from + * http://au2.php.net/manual/en/function.gzinflate.php#77336 will attempt to deflate + * the various return forms used. + * + * @since 2.8.1 + * @link http://au2.php.net/manual/en/function.gzinflate.php#77336 + * + * @param string $gzData String to decompress. + * @return string|bool False on failure. + */ + function compatible_gzinflate($gzData) { + if ( substr($gzData, 0, 3) == "\x1f\x8b\x08" ) { + $i = 10; + $flg = ord( substr($gzData, 3, 1) ); + if ( $flg > 0 ) { + if ( $flg & 4 ) { + list($xlen) = unpack('v', substr($gzData, $i, 2) ); + $i = $i + 2 + $xlen; + } + if ( $flg & 8 ) + $i = strpos($gzData, "\0", $i) + 1; + if ( $flg & 16 ) + $i = strpos($gzData, "\0", $i) + 1; + if ( $flg & 2 ) + $i = $i + 2; + } + return gzinflate( substr($gzData, $i, -8) ); + } else { + return false; + } + } + + /** + * What encoding types to accept and their priority values. + * + * @since 2.8 + * + * @return string Types of encoding to accept. + */ + function accept_encoding() { + $type = array(); + if ( function_exists( 'gzinflate' ) ) + $type[] = 'deflate;q=1.0'; + + if ( function_exists( 'gzuncompress' ) ) + $type[] = 'compress;q=0.5'; + + if ( function_exists( 'gzdecode' ) ) + $type[] = 'gzip;q=0.5'; + + return implode(', ', $type); + } + + /** + * What enconding the content used when it was compressed to send in the headers. + * + * @since 2.8 + * + * @return string Content-Encoding string to send in the header. + */ + function content_encoding() { + return 'deflate'; + } + + /** + * Whether the content be decoded based on the headers. + * + * @since 2.8 + * + * @param array|string $headers All of the available headers. + * @return bool + */ + function should_decode($headers) { + if ( is_array( $headers ) ) { + if ( array_key_exists('content-encoding', $headers) && ! empty( $headers['content-encoding'] ) ) + return true; + } else if ( is_string( $headers ) ) { + return ( stripos($headers, 'content-encoding:') !== false ); + } + + return false; + } + + /** + * Whether decompression and compression are supported by the PHP version. + * + * Each function is tested instead of checking for the zlib extension, to + * ensure that the functions all exist in the PHP version and aren't + * disabled. + * + * @since 2.8 + * + * @return bool + */ + function is_available() { + return ( function_exists('gzuncompress') || function_exists('gzdeflate') || function_exists('gzinflate') ); + } +} diff --git a/src/wp-includes/class-json.php b/src/wp-includes/class-json.php new file mode 100644 index 0000000..75010df --- /dev/null +++ b/src/wp-includes/class-json.php @@ -0,0 +1,863 @@ + + * @author Matt Knapp + * @author Brett Stimmerman + * @copyright 2005 Michal Migurski + * @version CVS: $Id: JSON.php 288200 2009-09-09 15:41:29Z alan_k $ + * @license http://www.opensource.org/licenses/bsd-license.php + * @link http://pear.php.net/pepr/pepr-proposal-show.php?id=198 + */ + +/** + * Marker constant for Services_JSON::decode(), used to flag stack state + */ +define('SERVICES_JSON_SLICE', 1); + +/** + * Marker constant for Services_JSON::decode(), used to flag stack state + */ +define('SERVICES_JSON_IN_STR', 2); + +/** + * Marker constant for Services_JSON::decode(), used to flag stack state + */ +define('SERVICES_JSON_IN_ARR', 3); + +/** + * Marker constant for Services_JSON::decode(), used to flag stack state + */ +define('SERVICES_JSON_IN_OBJ', 4); + +/** + * Marker constant for Services_JSON::decode(), used to flag stack state + */ +define('SERVICES_JSON_IN_CMT', 5); + +/** + * Behavior switch for Services_JSON::decode() + */ +define('SERVICES_JSON_LOOSE_TYPE', 16); + +/** + * Behavior switch for Services_JSON::decode() + */ +define('SERVICES_JSON_SUPPRESS_ERRORS', 32); + +/** + * Converts to and from JSON format. + * + * Brief example of use: + * + * + * // create a new instance of Services_JSON + * $json = new Services_JSON(); + * + * // convert a complexe value to JSON notation, and send it to the browser + * $value = array('foo', 'bar', array(1, 2, 'baz'), array(3, array(4))); + * $output = $json->encode($value); + * + * print($output); + * // prints: ["foo","bar",[1,2,"baz"],[3,[4]]] + * + * // accept incoming POST data, assumed to be in JSON notation + * $input = file_get_contents('php://input', 1000000); + * $value = $json->decode($input); + * + */ +class Services_JSON +{ + /** + * constructs a new JSON instance + * + * @param int $use object behavior flags; combine with boolean-OR + * + * possible values: + * - SERVICES_JSON_LOOSE_TYPE: loose typing. + * "{...}" syntax creates associative arrays + * instead of objects in decode(). + * - SERVICES_JSON_SUPPRESS_ERRORS: error suppression. + * Values which can't be encoded (e.g. resources) + * appear as NULL instead of throwing errors. + * By default, a deeply-nested resource will + * bubble up with an error, so all return values + * from encode() should be checked with isError() + */ + function Services_JSON($use = 0) + { + $this->use = $use; + } + + /** + * convert a string from one UTF-16 char to one UTF-8 char + * + * Normally should be handled by mb_convert_encoding, but + * provides a slower PHP-only method for installations + * that lack the multibye string extension. + * + * @param string $utf16 UTF-16 character + * @return string UTF-8 character + * @access private + */ + function utf162utf8($utf16) + { + // oh please oh please oh please oh please oh please + if(function_exists('mb_convert_encoding')) { + return mb_convert_encoding($utf16, 'UTF-8', 'UTF-16'); + } + + $bytes = (ord($utf16[0]) << 8) | ord($utf16[1]); + + switch(true) { + case ((0x7F & $bytes) == $bytes): + // this case should never be reached, because we are in ASCII range + // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + return chr(0x7F & $bytes); + + case (0x07FF & $bytes) == $bytes: + // return a 2-byte UTF-8 character + // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + return chr(0xC0 | (($bytes >> 6) & 0x1F)) + . chr(0x80 | ($bytes & 0x3F)); + + case (0xFFFF & $bytes) == $bytes: + // return a 3-byte UTF-8 character + // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + return chr(0xE0 | (($bytes >> 12) & 0x0F)) + . chr(0x80 | (($bytes >> 6) & 0x3F)) + . chr(0x80 | ($bytes & 0x3F)); + } + + // ignoring UTF-32 for now, sorry + return ''; + } + + /** + * convert a string from one UTF-8 char to one UTF-16 char + * + * Normally should be handled by mb_convert_encoding, but + * provides a slower PHP-only method for installations + * that lack the multibye string extension. + * + * @param string $utf8 UTF-8 character + * @return string UTF-16 character + * @access private + */ + function utf82utf16($utf8) + { + // oh please oh please oh please oh please oh please + if(function_exists('mb_convert_encoding')) { + return mb_convert_encoding($utf8, 'UTF-16', 'UTF-8'); + } + + switch(strlen($utf8)) { + case 1: + // this case should never be reached, because we are in ASCII range + // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + return $utf8; + + case 2: + // return a UTF-16 character from a 2-byte UTF-8 char + // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + return chr(0x07 & (ord($utf8[0]) >> 2)) + . chr((0xC0 & (ord($utf8[0]) << 6)) + | (0x3F & ord($utf8[1]))); + + case 3: + // return a UTF-16 character from a 3-byte UTF-8 char + // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + return chr((0xF0 & (ord($utf8[0]) << 4)) + | (0x0F & (ord($utf8[1]) >> 2))) + . chr((0xC0 & (ord($utf8[1]) << 6)) + | (0x7F & ord($utf8[2]))); + } + + // ignoring UTF-32 for now, sorry + return ''; + } + + /** + * encodes an arbitrary variable into JSON format (and sends JSON Header) + * + * @param mixed $var any number, boolean, string, array, or object to be encoded. + * see argument 1 to Services_JSON() above for array-parsing behavior. + * if var is a strng, note that encode() always expects it + * to be in ASCII or UTF-8 format! + * + * @return mixed JSON string representation of input var or an error if a problem occurs + * @access public + */ + function encode($var) + { + header('Content-type: application/json'); + return $this->_encode($var); + } + /** + * encodes an arbitrary variable into JSON format without JSON Header - warning - may allow CSS!!!!) + * + * @param mixed $var any number, boolean, string, array, or object to be encoded. + * see argument 1 to Services_JSON() above for array-parsing behavior. + * if var is a strng, note that encode() always expects it + * to be in ASCII or UTF-8 format! + * + * @return mixed JSON string representation of input var or an error if a problem occurs + * @access public + */ + function encodeUnsafe($var) + { + return $this->_encode($var); + } + /** + * PRIVATE CODE that does the work of encodes an arbitrary variable into JSON format + * + * @param mixed $var any number, boolean, string, array, or object to be encoded. + * see argument 1 to Services_JSON() above for array-parsing behavior. + * if var is a strng, note that encode() always expects it + * to be in ASCII or UTF-8 format! + * + * @return mixed JSON string representation of input var or an error if a problem occurs + * @access public + */ + function _encode($var) + { + + switch (gettype($var)) { + case 'boolean': + return $var ? 'true' : 'false'; + + case 'NULL': + return 'null'; + + case 'integer': + return (int) $var; + + case 'double': + case 'float': + return (float) $var; + + case 'string': + // STRINGS ARE EXPECTED TO BE IN ASCII OR UTF-8 FORMAT + $ascii = ''; + $strlen_var = strlen($var); + + /* + * Iterate over every character in the string, + * escaping with a slash or encoding to UTF-8 where necessary + */ + for ($c = 0; $c < $strlen_var; ++$c) { + + $ord_var_c = ord($var[$c]); + + switch (true) { + case $ord_var_c == 0x08: + $ascii .= '\b'; + break; + case $ord_var_c == 0x09: + $ascii .= '\t'; + break; + case $ord_var_c == 0x0A: + $ascii .= '\n'; + break; + case $ord_var_c == 0x0C: + $ascii .= '\f'; + break; + case $ord_var_c == 0x0D: + $ascii .= '\r'; + break; + + case $ord_var_c == 0x22: + case $ord_var_c == 0x2F: + case $ord_var_c == 0x5C: + // double quote, slash, slosh + $ascii .= '\\'.$var[$c]; + break; + + case (($ord_var_c >= 0x20) && ($ord_var_c <= 0x7F)): + // characters U-00000000 - U-0000007F (same as ASCII) + $ascii .= $var[$c]; + break; + + case (($ord_var_c & 0xE0) == 0xC0): + // characters U-00000080 - U-000007FF, mask 110XXXXX + // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + if ($c+1 >= $strlen_var) { + $c += 1; + $ascii .= '?'; + break; + } + + $char = pack('C*', $ord_var_c, ord($var[$c + 1])); + $c += 1; + $utf16 = $this->utf82utf16($char); + $ascii .= sprintf('\u%04s', bin2hex($utf16)); + break; + + case (($ord_var_c & 0xF0) == 0xE0): + if ($c+2 >= $strlen_var) { + $c += 2; + $ascii .= '?'; + break; + } + // characters U-00000800 - U-0000FFFF, mask 1110XXXX + // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $char = pack('C*', $ord_var_c, + @ord($var[$c + 1]), + @ord($var[$c + 2])); + $c += 2; + $utf16 = $this->utf82utf16($char); + $ascii .= sprintf('\u%04s', bin2hex($utf16)); + break; + + case (($ord_var_c & 0xF8) == 0xF0): + if ($c+3 >= $strlen_var) { + $c += 3; + $ascii .= '?'; + break; + } + // characters U-00010000 - U-001FFFFF, mask 11110XXX + // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $char = pack('C*', $ord_var_c, + ord($var[$c + 1]), + ord($var[$c + 2]), + ord($var[$c + 3])); + $c += 3; + $utf16 = $this->utf82utf16($char); + $ascii .= sprintf('\u%04s', bin2hex($utf16)); + break; + + case (($ord_var_c & 0xFC) == 0xF8): + // characters U-00200000 - U-03FFFFFF, mask 111110XX + // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + if ($c+4 >= $strlen_var) { + $c += 4; + $ascii .= '?'; + break; + } + $char = pack('C*', $ord_var_c, + ord($var[$c + 1]), + ord($var[$c + 2]), + ord($var[$c + 3]), + ord($var[$c + 4])); + $c += 4; + $utf16 = $this->utf82utf16($char); + $ascii .= sprintf('\u%04s', bin2hex($utf16)); + break; + + case (($ord_var_c & 0xFE) == 0xFC): + if ($c+5 >= $strlen_var) { + $c += 5; + $ascii .= '?'; + break; + } + // characters U-04000000 - U-7FFFFFFF, mask 1111110X + // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $char = pack('C*', $ord_var_c, + ord($var[$c + 1]), + ord($var[$c + 2]), + ord($var[$c + 3]), + ord($var[$c + 4]), + ord($var[$c + 5])); + $c += 5; + $utf16 = $this->utf82utf16($char); + $ascii .= sprintf('\u%04s', bin2hex($utf16)); + break; + } + } + return '"'.$ascii.'"'; + + case 'array': + /* + * As per JSON spec if any array key is not an integer + * we must treat the the whole array as an object. We + * also try to catch a sparsely populated associative + * array with numeric keys here because some JS engines + * will create an array with empty indexes up to + * max_index which can cause memory issues and because + * the keys, which may be relevant, will be remapped + * otherwise. + * + * As per the ECMA and JSON specification an object may + * have any string as a property. Unfortunately due to + * a hole in the ECMA specification if the key is a + * ECMA reserved word or starts with a digit the + * parameter is only accessible using ECMAScript's + * bracket notation. + */ + + // treat as a JSON object + if (is_array($var) && count($var) && (array_keys($var) !== range(0, sizeof($var) - 1))) { + $properties = array_map(array($this, 'name_value'), + array_keys($var), + array_values($var)); + + foreach($properties as $property) { + if(Services_JSON::isError($property)) { + return $property; + } + } + + return '{' . join(',', $properties) . '}'; + } + + // treat it like a regular array + $elements = array_map(array($this, '_encode'), $var); + + foreach($elements as $element) { + if(Services_JSON::isError($element)) { + return $element; + } + } + + return '[' . join(',', $elements) . ']'; + + case 'object': + $vars = get_object_vars($var); + + $properties = array_map(array($this, 'name_value'), + array_keys($vars), + array_values($vars)); + + foreach($properties as $property) { + if(Services_JSON::isError($property)) { + return $property; + } + } + + return '{' . join(',', $properties) . '}'; + + default: + return ($this->use & SERVICES_JSON_SUPPRESS_ERRORS) + ? 'null' + : new Services_JSON_Error(gettype($var)." can not be encoded as JSON string"); + } + } + + /** + * array-walking function for use in generating JSON-formatted name-value pairs + * + * @param string $name name of key to use + * @param mixed $value reference to an array element to be encoded + * + * @return string JSON-formatted name-value pair, like '"name":value' + * @access private + */ + function name_value($name, $value) + { + $encoded_value = $this->_encode($value); + + if(Services_JSON::isError($encoded_value)) { + return $encoded_value; + } + + return $this->_encode(strval($name)) . ':' . $encoded_value; + } + + /** + * reduce a string by removing leading and trailing comments and whitespace + * + * @param $str string string value to strip of comments and whitespace + * + * @return string string value stripped of comments and whitespace + * @access private + */ + function reduce_string($str) + { + $str = preg_replace(array( + + // eliminate single line comments in '// ...' form + '#^\s*//(.+)$#m', + + // eliminate multi-line comments in '/* ... */' form, at start of string + '#^\s*/\*(.+)\*/#Us', + + // eliminate multi-line comments in '/* ... */' form, at end of string + '#/\*(.+)\*/\s*$#Us' + + ), '', $str); + + // eliminate extraneous space + return trim($str); + } + + /** + * decodes a JSON string into appropriate variable + * + * @param string $str JSON-formatted string + * + * @return mixed number, boolean, string, array, or object + * corresponding to given JSON input string. + * See argument 1 to Services_JSON() above for object-output behavior. + * Note that decode() always returns strings + * in ASCII or UTF-8 format! + * @access public + */ + function decode($str) + { + $str = $this->reduce_string($str); + + switch (strtolower($str)) { + case 'true': + return true; + + case 'false': + return false; + + case 'null': + return null; + + default: + $m = array(); + + if (is_numeric($str)) { + // Lookie-loo, it's a number + + // This would work on its own, but I'm trying to be + // good about returning integers where appropriate: + // return (float)$str; + + // Return float or int, as appropriate + return ((float)$str == (integer)$str) + ? (integer)$str + : (float)$str; + + } elseif (preg_match('/^("|\').*(\1)$/s', $str, $m) && $m[1] == $m[2]) { + // STRINGS RETURNED IN UTF-8 FORMAT + $delim = substr($str, 0, 1); + $chrs = substr($str, 1, -1); + $utf8 = ''; + $strlen_chrs = strlen($chrs); + + for ($c = 0; $c < $strlen_chrs; ++$c) { + + $substr_chrs_c_2 = substr($chrs, $c, 2); + $ord_chrs_c = ord($chrs[$c]); + + switch (true) { + case $substr_chrs_c_2 == '\b': + $utf8 .= chr(0x08); + ++$c; + break; + case $substr_chrs_c_2 == '\t': + $utf8 .= chr(0x09); + ++$c; + break; + case $substr_chrs_c_2 == '\n': + $utf8 .= chr(0x0A); + ++$c; + break; + case $substr_chrs_c_2 == '\f': + $utf8 .= chr(0x0C); + ++$c; + break; + case $substr_chrs_c_2 == '\r': + $utf8 .= chr(0x0D); + ++$c; + break; + + case $substr_chrs_c_2 == '\\"': + case $substr_chrs_c_2 == '\\\'': + case $substr_chrs_c_2 == '\\\\': + case $substr_chrs_c_2 == '\\/': + if (($delim == '"' && $substr_chrs_c_2 != '\\\'') || + ($delim == "'" && $substr_chrs_c_2 != '\\"')) { + $utf8 .= $chrs[++$c]; + } + break; + + case preg_match('/\\\u[0-9A-F]{4}/i', substr($chrs, $c, 6)): + // single, escaped unicode character + $utf16 = chr(hexdec(substr($chrs, ($c + 2), 2))) + . chr(hexdec(substr($chrs, ($c + 4), 2))); + $utf8 .= $this->utf162utf8($utf16); + $c += 5; + break; + + case ($ord_chrs_c >= 0x20) && ($ord_chrs_c <= 0x7F): + $utf8 .= $chrs[$c]; + break; + + case ($ord_chrs_c & 0xE0) == 0xC0: + // characters U-00000080 - U-000007FF, mask 110XXXXX + //see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $utf8 .= substr($chrs, $c, 2); + ++$c; + break; + + case ($ord_chrs_c & 0xF0) == 0xE0: + // characters U-00000800 - U-0000FFFF, mask 1110XXXX + // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $utf8 .= substr($chrs, $c, 3); + $c += 2; + break; + + case ($ord_chrs_c & 0xF8) == 0xF0: + // characters U-00010000 - U-001FFFFF, mask 11110XXX + // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $utf8 .= substr($chrs, $c, 4); + $c += 3; + break; + + case ($ord_chrs_c & 0xFC) == 0xF8: + // characters U-00200000 - U-03FFFFFF, mask 111110XX + // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $utf8 .= substr($chrs, $c, 5); + $c += 4; + break; + + case ($ord_chrs_c & 0xFE) == 0xFC: + // characters U-04000000 - U-7FFFFFFF, mask 1111110X + // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $utf8 .= substr($chrs, $c, 6); + $c += 5; + break; + + } + + } + + return $utf8; + + } elseif (preg_match('/^\[.*\]$/s', $str) || preg_match('/^\{.*\}$/s', $str)) { + // array, or object notation + + if ($str[0] == '[') { + $stk = array(SERVICES_JSON_IN_ARR); + $arr = array(); + } else { + if ($this->use & SERVICES_JSON_LOOSE_TYPE) { + $stk = array(SERVICES_JSON_IN_OBJ); + $obj = array(); + } else { + $stk = array(SERVICES_JSON_IN_OBJ); + $obj = new stdClass(); + } + } + + array_push($stk, array('what' => SERVICES_JSON_SLICE, + 'where' => 0, + 'delim' => false)); + + $chrs = substr($str, 1, -1); + $chrs = $this->reduce_string($chrs); + + if ($chrs == '') { + if (reset($stk) == SERVICES_JSON_IN_ARR) { + return $arr; + + } else { + return $obj; + + } + } + + //print("\nparsing {$chrs}\n"); + + $strlen_chrs = strlen($chrs); + + for ($c = 0; $c <= $strlen_chrs; ++$c) { + + $top = end($stk); + $substr_chrs_c_2 = substr($chrs, $c, 2); + + if (($c == $strlen_chrs) || (($chrs[$c] == ',') && ($top['what'] == SERVICES_JSON_SLICE))) { + // found a comma that is not inside a string, array, etc., + // OR we've reached the end of the character list + $slice = substr($chrs, $top['where'], ($c - $top['where'])); + array_push($stk, array('what' => SERVICES_JSON_SLICE, 'where' => ($c + 1), 'delim' => false)); + //print("Found split at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n"); + + if (reset($stk) == SERVICES_JSON_IN_ARR) { + // we are in an array, so just push an element onto the stack + array_push($arr, $this->decode($slice)); + + } elseif (reset($stk) == SERVICES_JSON_IN_OBJ) { + // we are in an object, so figure + // out the property name and set an + // element in an associative array, + // for now + $parts = array(); + + if (preg_match('/^\s*(["\'].*[^\\\]["\'])\s*:\s*(\S.*),?$/Uis', $slice, $parts)) { + // "name":value pair + $key = $this->decode($parts[1]); + $val = $this->decode($parts[2]); + + if ($this->use & SERVICES_JSON_LOOSE_TYPE) { + $obj[$key] = $val; + } else { + $obj->$key = $val; + } + } elseif (preg_match('/^\s*(\w+)\s*:\s*(\S.*),?$/Uis', $slice, $parts)) { + // name:value pair, where name is unquoted + $key = $parts[1]; + $val = $this->decode($parts[2]); + + if ($this->use & SERVICES_JSON_LOOSE_TYPE) { + $obj[$key] = $val; + } else { + $obj->$key = $val; + } + } + + } + + } elseif ((($chrs[$c] == '"') || ($chrs[$c] == "'")) && ($top['what'] != SERVICES_JSON_IN_STR)) { + // found a quote, and we are not inside a string + array_push($stk, array('what' => SERVICES_JSON_IN_STR, 'where' => $c, 'delim' => $chrs[$c])); + //print("Found start of string at {$c}\n"); + + } elseif (($chrs[$c] == $top['delim']) && + ($top['what'] == SERVICES_JSON_IN_STR) && + ((strlen(substr($chrs, 0, $c)) - strlen(rtrim(substr($chrs, 0, $c), '\\'))) % 2 != 1)) { + // found a quote, we're in a string, and it's not escaped + // we know that it's not escaped becase there is _not_ an + // odd number of backslashes at the end of the string so far + array_pop($stk); + //print("Found end of string at {$c}: ".substr($chrs, $top['where'], (1 + 1 + $c - $top['where']))."\n"); + + } elseif (($chrs[$c] == '[') && + in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) { + // found a left-bracket, and we are in an array, object, or slice + array_push($stk, array('what' => SERVICES_JSON_IN_ARR, 'where' => $c, 'delim' => false)); + //print("Found start of array at {$c}\n"); + + } elseif (($chrs[$c] == ']') && ($top['what'] == SERVICES_JSON_IN_ARR)) { + // found a right-bracket, and we're in an array + array_pop($stk); + //print("Found end of array at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n"); + + } elseif (($chrs[$c] == '{') && + in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) { + // found a left-brace, and we are in an array, object, or slice + array_push($stk, array('what' => SERVICES_JSON_IN_OBJ, 'where' => $c, 'delim' => false)); + //print("Found start of object at {$c}\n"); + + } elseif (($chrs[$c] == '}') && ($top['what'] == SERVICES_JSON_IN_OBJ)) { + // found a right-brace, and we're in an object + array_pop($stk); + //print("Found end of object at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n"); + + } elseif (($substr_chrs_c_2 == '/*') && + in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) { + // found a comment start, and we are in an array, object, or slice + array_push($stk, array('what' => SERVICES_JSON_IN_CMT, 'where' => $c, 'delim' => false)); + $c++; + //print("Found start of comment at {$c}\n"); + + } elseif (($substr_chrs_c_2 == '*/') && ($top['what'] == SERVICES_JSON_IN_CMT)) { + // found a comment end, and we're in one now + array_pop($stk); + $c++; + + for ($i = $top['where']; $i <= $c; ++$i) + $chrs = substr_replace($chrs, ' ', $i, 1); + + //print("Found end of comment at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n"); + + } + + } + + if (reset($stk) == SERVICES_JSON_IN_ARR) { + return $arr; + + } elseif (reset($stk) == SERVICES_JSON_IN_OBJ) { + return $obj; + + } + + } + } + } + + /** + * @todo Ultimately, this should just call PEAR::isError() + */ + function isError($data, $code = null) + { + if (class_exists('pear')) { + return PEAR::isError($data, $code); + } elseif (is_object($data) && (get_class($data) == 'services_json_error' || + is_subclass_of($data, 'services_json_error'))) { + return true; + } + + return false; + } +} + +if (class_exists('PEAR_Error')) { + + class Services_JSON_Error extends PEAR_Error + { + function Services_JSON_Error($message = 'unknown error', $code = null, + $mode = null, $options = null, $userinfo = null) + { + parent::PEAR_Error($message, $code, $mode, $options, $userinfo); + } + } + +} else { + + /** + * @todo Ultimately, this class shall be descended from PEAR_Error + */ + class Services_JSON_Error + { + function Services_JSON_Error($message = 'unknown error', $code = null, + $mode = null, $options = null, $userinfo = null) + { + + } + } + +} +endif; +?> diff --git a/src/wp-includes/class-oembed.php b/src/wp-includes/class-oembed.php new file mode 100644 index 0000000..8bfe258 --- /dev/null +++ b/src/wp-includes/class-oembed.php @@ -0,0 +1,295 @@ +providers = apply_filters( 'oembed_providers', array( + '#http://(www\.)?youtube.com/watch.*#i' => array( 'http://www.youtube.com/oembed', true ), + 'http://youtu.be/*' => array( 'http://www.youtube.com/oembed', false ), + 'http://blip.tv/*' => array( 'http://blip.tv/oembed/', false ), + '#http://(www\.)?vimeo\.com/.*#i' => array( 'http://www.vimeo.com/api/oembed.{format}', true ), + '#http://(www\.)?dailymotion\.com/.*#i' => array( 'http://www.dailymotion.com/api/oembed', true ), + '#http://(www\.)?flickr\.com/.*#i' => array( 'http://www.flickr.com/services/oembed/', true ), + '#http://(.+)?smugmug\.com/.*#i' => array( 'http://api.smugmug.com/services/oembed/', true ), + '#http://(www\.)?hulu\.com/watch/.*#i' => array( 'http://www.hulu.com/api/oembed.{format}', true ), + '#http://(www\.)?viddler\.com/.*#i' => array( 'http://lab.viddler.com/services/oembed/', true ), + 'http://qik.com/*' => array( 'http://qik.com/api/oembed.{format}', false ), + 'http://revision3.com/*' => array( 'http://revision3.com/api/oembed/', false ), + 'http://i*.photobucket.com/albums/*' => array( 'http://photobucket.com/oembed', false ), + 'http://gi*.photobucket.com/groups/*' => array( 'http://photobucket.com/oembed', false ), + '#http://(www\.)?scribd\.com/.*#i' => array( 'http://www.scribd.com/services/oembed', true ), + 'http://wordpress.tv/*' => array( 'http://wordpress.tv/oembed/', false ), + '#http://(answers|surveys)\.polldaddy.com/.*#i' => array( 'http://polldaddy.com/oembed/', true ), + '#http://(www\.)?funnyordie\.com/videos/.*#i' => array( 'http://www.funnyordie.com/oembed', true ), + ) ); + + // Fix any embeds that contain new lines in the middle of the HTML which breaks wpautop(). + add_filter( 'oembed_dataparse', array(&$this, '_strip_newlines'), 10, 3 ); + } + + /** + * The do-it-all function that takes a URL and attempts to return the HTML. + * + * @see WP_oEmbed::discover() + * @see WP_oEmbed::fetch() + * @see WP_oEmbed::data2html() + * + * @param string $url The URL to the content that should be attempted to be embedded. + * @param array $args Optional arguments. Usually passed from a shortcode. + * @return bool|string False on failure, otherwise the UNSANITIZED (and potentially unsafe) HTML that should be used to embed. + */ + function get_html( $url, $args = '' ) { + $provider = false; + + if ( !isset($args['discover']) ) + $args['discover'] = true; + + foreach ( $this->providers as $matchmask => $data ) { + list( $providerurl, $regex ) = $data; + + // Turn the asterisk-type provider URLs into regex + if ( !$regex ) + $matchmask = '#' . str_replace( '___wildcard___', '(.+)', preg_quote( str_replace( '*', '___wildcard___', $matchmask ), '#' ) ) . '#i'; + + if ( preg_match( $matchmask, $url ) ) { + $provider = str_replace( '{format}', 'json', $providerurl ); // JSON is easier to deal with than XML + break; + } + } + + if ( !$provider && $args['discover'] ) + $provider = $this->discover( $url ); + + if ( !$provider || false === $data = $this->fetch( $provider, $url, $args ) ) + return false; + + return apply_filters( 'oembed_result', $this->data2html( $data, $url ), $url, $args ); + } + + /** + * Attempts to find oEmbed provider discovery tags at the given URL. + * + * @param string $url The URL that should be inspected for discovery tags. + * @return bool|string False on failure, otherwise the oEmbed provider URL. + */ + function discover( $url ) { + $providers = array(); + + // Fetch URL content + if ( $html = wp_remote_retrieve_body( wp_remote_get( $url ) ) ) { + + // types that contain oEmbed provider URLs + $linktypes = apply_filters( 'oembed_linktypes', array( + 'application/json+oembed' => 'json', + 'text/xml+oembed' => 'xml', + 'application/xml+oembed' => 'xml', // Incorrect, but used by at least Vimeo + ) ); + + // Strip + $html = substr( $html, 0, stripos( $html, '' ) ); + + // Do a quick check + $tagfound = false; + foreach ( $linktypes as $linktype => $format ) { + if ( stripos($html, $linktype) ) { + $tagfound = true; + break; + } + } + + if ( $tagfound && preg_match_all( '/]+)>/i', $html, $links ) ) { + foreach ( $links[1] as $link ) { + $atts = shortcode_parse_atts( $link ); + + if ( !empty($atts['type']) && !empty($linktypes[$atts['type']]) && !empty($atts['href']) ) { + $providers[$linktypes[$atts['type']]] = $atts['href']; + + // Stop here if it's JSON (that's all we need) + if ( 'json' == $linktypes[$atts['type']] ) + break; + } + } + } + } + + // JSON is preferred to XML + if ( !empty($providers['json']) ) + return $providers['json']; + elseif ( !empty($providers['xml']) ) + return $providers['xml']; + else + return false; + } + + /** + * Connects to a oEmbed provider and returns the result. + * + * @param string $provider The URL to the oEmbed provider. + * @param string $url The URL to the content that is desired to be embedded. + * @param array $args Optional arguments. Usually passed from a shortcode. + * @return bool|object False on failure, otherwise the result in the form of an object. + */ + function fetch( $provider, $url, $args = '' ) { + $args = wp_parse_args( $args, wp_embed_defaults() ); + + $provider = add_query_arg( 'maxwidth', (int) $args['width'], $provider ); + $provider = add_query_arg( 'maxheight', (int) $args['height'], $provider ); + $provider = add_query_arg( 'url', urlencode($url), $provider ); + + foreach( array( 'json', 'xml' ) as $format ) { + $result = $this->_fetch_with_format( $provider, $format ); + if ( is_wp_error( $result ) && 'not-implemented' == $result->get_error_code() ) + continue; + return ( $result && ! is_wp_error( $result ) ) ? $result : false; + } + return false; + } + + /** + * Fetches result from an oEmbed provider for a specific format and complete provider URL + * + * @since 3.0.0 + * @access private + * @param string $provider_url_with_args URL to the provider with full arguments list (url, maxheight, etc.) + * @param string $format Format to use + * @return bool|object False on failure, otherwise the result in the form of an object. + */ + function _fetch_with_format( $provider_url_with_args, $format ) { + $provider_url_with_args = add_query_arg( 'format', $format, $provider_url_with_args ); + $response = wp_remote_get( $provider_url_with_args ); + if ( 501 == wp_remote_retrieve_response_code( $response ) ) + return new WP_Error( 'not-implemented' ); + if ( ! $body = wp_remote_retrieve_body( $response ) ) + return false; + $parse_method = "_parse_$format"; + return $this->$parse_method( $body ); + } + + /** + * Parses a json response body. + * + * @since 3.0.0 + * @access private + */ + function _parse_json( $response_body ) { + return ( ( $data = json_decode( trim( $response_body ) ) ) && is_object( $data ) ) ? $data : false; + } + + /** + * Parses an XML response body. + * + * @since 3.0.0 + * @access private + */ + function _parse_xml( $response_body ) { + if ( function_exists('simplexml_load_string') ) { + $errors = libxml_use_internal_errors( 'true' ); + $data = simplexml_load_string( $response_body ); + libxml_use_internal_errors( $errors ); + if ( is_object( $data ) ) + return $data; + } + return false; + } + + /** + * Converts a data object from {@link WP_oEmbed::fetch()} and returns the HTML. + * + * @param object $data A data object result from an oEmbed provider. + * @param string $url The URL to the content that is desired to be embedded. + * @return bool|string False on error, otherwise the HTML needed to embed. + */ + function data2html( $data, $url ) { + if ( !is_object($data) || empty($data->type) ) + return false; + + switch ( $data->type ) { + case 'photo': + if ( empty($data->url) || empty($data->width) || empty($data->height) ) + return false; + + $title = ( !empty($data->title) ) ? $data->title : ''; + $return = '' . esc_attr($title) . ''; + break; + + case 'video': + case 'rich': + $return = ( !empty($data->html) ) ? $data->html : false; + break; + + case 'link': + $return = ( !empty($data->title) ) ? '' . esc_html($data->title) . '' : false; + break; + + default; + $return = false; + } + + // You can use this filter to add support for custom data types or to filter the result + return apply_filters( 'oembed_dataparse', $return, $data, $url ); + } + + /** + * Strip any new lines from the HTML. + * + * @access private + * @param string $html Existing HTML. + * @param object $data Data object from WP_oEmbed::data2html() + * @param string $url The original URL passed to oEmbed. + * @return string Possibly modified $html + */ + function _strip_newlines( $html, $data, $url ) { + if ( false !== strpos( $html, "\n" ) ) + $html = str_replace( array( "\r\n", "\n" ), '', $html ); + + return $html; + } +} + +/** + * Returns the initialized {@link WP_oEmbed} object + * + * @since 2.9.0 + * @access private + * + * @see WP_oEmbed + * @uses WP_oEmbed + * + * @return WP_oEmbed object. + */ +function &_wp_oembed_get_object() { + static $wp_oembed; + + if ( is_null($wp_oembed) ) + $wp_oembed = new WP_oEmbed(); + + return $wp_oembed; +} + +?> \ No newline at end of file diff --git a/src/wp-includes/class-phpass.php b/src/wp-includes/class-phpass.php new file mode 100644 index 0000000..ad474bc --- /dev/null +++ b/src/wp-includes/class-phpass.php @@ -0,0 +1,260 @@ + in 2004-2006 and placed in +# the public domain. Revised in subsequent years, still public domain. +# +# There's absolutely no warranty. +# +# Please be sure to update the Version line if you edit this file in any way. +# It is suggested that you leave the main version number intact, but indicate +# your project name (after the slash) and add your own revision information. +# +# Please do not change the "private" password hashing method implemented in +# here, thereby making your hashes incompatible. However, if you must, please +# change the hash type identifier (the "$P$") to something different. +# +# Obviously, since this code is in the public domain, the above are not +# requirements (there can be none), but merely suggestions. +# + +/** + * Portable PHP password hashing framework. + * + * @package phpass + * @version 0.3 / WordPress + * @link http://www.openwall.com/phpass/ + * @since 2.5 + */ +class PasswordHash { + var $itoa64; + var $iteration_count_log2; + var $portable_hashes; + var $random_state; + + function PasswordHash($iteration_count_log2, $portable_hashes) + { + $this->itoa64 = './0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'; + + if ($iteration_count_log2 < 4 || $iteration_count_log2 > 31) + $iteration_count_log2 = 8; + $this->iteration_count_log2 = $iteration_count_log2; + + $this->portable_hashes = $portable_hashes; + + $this->random_state = microtime() . uniqid(rand(), TRUE); // removed getmypid() for compability reasons + } + + function get_random_bytes($count) + { + $output = ''; + if ( @is_readable('/dev/urandom') && + ($fh = @fopen('/dev/urandom', 'rb'))) { + $output = fread($fh, $count); + fclose($fh); + } + + if (strlen($output) < $count) { + $output = ''; + for ($i = 0; $i < $count; $i += 16) { + $this->random_state = + md5(microtime() . $this->random_state); + $output .= + pack('H*', md5($this->random_state)); + } + $output = substr($output, 0, $count); + } + + return $output; + } + + function encode64($input, $count) + { + $output = ''; + $i = 0; + do { + $value = ord($input[$i++]); + $output .= $this->itoa64[$value & 0x3f]; + if ($i < $count) + $value |= ord($input[$i]) << 8; + $output .= $this->itoa64[($value >> 6) & 0x3f]; + if ($i++ >= $count) + break; + if ($i < $count) + $value |= ord($input[$i]) << 16; + $output .= $this->itoa64[($value >> 12) & 0x3f]; + if ($i++ >= $count) + break; + $output .= $this->itoa64[($value >> 18) & 0x3f]; + } while ($i < $count); + + return $output; + } + + function gensalt_private($input) + { + $output = '$P$'; + $output .= $this->itoa64[min($this->iteration_count_log2 + + ((PHP_VERSION >= '5') ? 5 : 3), 30)]; + $output .= $this->encode64($input, 6); + + return $output; + } + + function crypt_private($password, $setting) + { + $output = '*0'; + if (substr($setting, 0, 2) == $output) + $output = '*1'; + + $id = substr($setting, 0, 3); + # We use "$P$", phpBB3 uses "$H$" for the same thing + if ($id != '$P$' && $id != '$H$') + return $output; + + $count_log2 = strpos($this->itoa64, $setting[3]); + if ($count_log2 < 7 || $count_log2 > 30) + return $output; + + $count = 1 << $count_log2; + + $salt = substr($setting, 4, 8); + if (strlen($salt) != 8) + return $output; + + # We're kind of forced to use MD5 here since it's the only + # cryptographic primitive available in all versions of PHP + # currently in use. To implement our own low-level crypto + # in PHP would result in much worse performance and + # consequently in lower iteration counts and hashes that are + # quicker to crack (by non-PHP code). + if (PHP_VERSION >= '5') { + $hash = md5($salt . $password, TRUE); + do { + $hash = md5($hash . $password, TRUE); + } while (--$count); + } else { + $hash = pack('H*', md5($salt . $password)); + do { + $hash = pack('H*', md5($hash . $password)); + } while (--$count); + } + + $output = substr($setting, 0, 12); + $output .= $this->encode64($hash, 16); + + return $output; + } + + function gensalt_extended($input) + { + $count_log2 = min($this->iteration_count_log2 + 8, 24); + # This should be odd to not reveal weak DES keys, and the + # maximum valid value is (2**24 - 1) which is odd anyway. + $count = (1 << $count_log2) - 1; + + $output = '_'; + $output .= $this->itoa64[$count & 0x3f]; + $output .= $this->itoa64[($count >> 6) & 0x3f]; + $output .= $this->itoa64[($count >> 12) & 0x3f]; + $output .= $this->itoa64[($count >> 18) & 0x3f]; + + $output .= $this->encode64($input, 3); + + return $output; + } + + function gensalt_blowfish($input) + { + # This one needs to use a different order of characters and a + # different encoding scheme from the one in encode64() above. + # We care because the last character in our encoded string will + # only represent 2 bits. While two known implementations of + # bcrypt will happily accept and correct a salt string which + # has the 4 unused bits set to non-zero, we do not want to take + # chances and we also do not want to waste an additional byte + # of entropy. + $itoa64 = './ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; + + $output = '$2a$'; + $output .= chr(ord('0') + $this->iteration_count_log2 / 10); + $output .= chr(ord('0') + $this->iteration_count_log2 % 10); + $output .= '$'; + + $i = 0; + do { + $c1 = ord($input[$i++]); + $output .= $itoa64[$c1 >> 2]; + $c1 = ($c1 & 0x03) << 4; + if ($i >= 16) { + $output .= $itoa64[$c1]; + break; + } + + $c2 = ord($input[$i++]); + $c1 |= $c2 >> 4; + $output .= $itoa64[$c1]; + $c1 = ($c2 & 0x0f) << 2; + + $c2 = ord($input[$i++]); + $c1 |= $c2 >> 6; + $output .= $itoa64[$c1]; + $output .= $itoa64[$c2 & 0x3f]; + } while (1); + + return $output; + } + + function HashPassword($password) + { + $random = ''; + + if (CRYPT_BLOWFISH == 1 && !$this->portable_hashes) { + $random = $this->get_random_bytes(16); + $hash = + crypt($password, $this->gensalt_blowfish($random)); + if (strlen($hash) == 60) + return $hash; + } + + if (CRYPT_EXT_DES == 1 && !$this->portable_hashes) { + if (strlen($random) < 3) + $random = $this->get_random_bytes(3); + $hash = + crypt($password, $this->gensalt_extended($random)); + if (strlen($hash) == 20) + return $hash; + } + + if (strlen($random) < 6) + $random = $this->get_random_bytes(6); + $hash = + $this->crypt_private($password, + $this->gensalt_private($random)); + if (strlen($hash) == 34) + return $hash; + + # Returning '*' on error is safe here, but would _not_ be safe + # in a crypt(3)-like function used _both_ for generating new + # hashes and for validating passwords against existing hashes. + return '*'; + } + + function CheckPassword($password, $stored_hash) + { + $hash = $this->crypt_private($password, $stored_hash); + if ($hash[0] == '*') + $hash = crypt($password, $stored_hash); + + return $hash == $stored_hash; + } +} + +?> diff --git a/src/wp-includes/class-phpmailer.php b/src/wp-includes/class-phpmailer.php new file mode 100644 index 0000000..70de3de --- /dev/null +++ b/src/wp-includes/class-phpmailer.php @@ -0,0 +1,2320 @@ +exceptions = ($exceptions == true); + } + + /** + * Sets message type to HTML. + * @param bool $ishtml + * @return void + */ + public function IsHTML($ishtml = true) { + if ($ishtml) { + $this->ContentType = 'text/html'; + } else { + $this->ContentType = 'text/plain'; + } + } + + /** + * Sets Mailer to send message using SMTP. + * @return void + */ + public function IsSMTP() { + $this->Mailer = 'smtp'; + } + + /** + * Sets Mailer to send message using PHP mail() function. + * @return void + */ + public function IsMail() { + $this->Mailer = 'mail'; + } + + /** + * Sets Mailer to send message using the $Sendmail program. + * @return void + */ + public function IsSendmail() { + if (!stristr(ini_get('sendmail_path'), 'sendmail')) { + $this->Sendmail = '/var/qmail/bin/sendmail'; + } + $this->Mailer = 'sendmail'; + } + + /** + * Sets Mailer to send message using the qmail MTA. + * @return void + */ + public function IsQmail() { + if (stristr(ini_get('sendmail_path'), 'qmail')) { + $this->Sendmail = '/var/qmail/bin/sendmail'; + } + $this->Mailer = 'sendmail'; + } + + ///////////////////////////////////////////////// + // METHODS, RECIPIENTS + ///////////////////////////////////////////////// + + /** + * Adds a "To" address. + * @param string $address + * @param string $name + * @return boolean true on success, false if address already used + */ + public function AddAddress($address, $name = '') { + return $this->AddAnAddress('to', $address, $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 boolean true on success, false if address already used + */ + public function AddCC($address, $name = '') { + return $this->AddAnAddress('cc', $address, $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 boolean true on success, false if address already used + */ + public function AddBCC($address, $name = '') { + return $this->AddAnAddress('bcc', $address, $name); + } + + /** + * Adds a "Reply-to" address. + * @param string $address + * @param string $name + * @return boolean + */ + public function AddReplyTo($address, $name = '') { + return $this->AddAnAddress('ReplyTo', $address, $name); + } + + /** + * Adds an address to one of the recipient arrays + * Addresses that have been added already return false, but do not throw exceptions + * @param string $kind One of 'to', 'cc', 'bcc', 'ReplyTo' + * @param string $address The email address to send to + * @param string $name + * @return boolean true on success, false if address already used or invalid in some way + * @access private + */ + private function AddAnAddress($kind, $address, $name = '') { + if (!preg_match('/^(to|cc|bcc|ReplyTo)$/', $kind)) { + echo 'Invalid recipient array: ' . $kind; + return false; + } + $address = trim($address); + $name = trim(preg_replace('/[\r\n]+/', '', $name)); //Strip breaks and trim + if (!self::ValidateAddress($address)) { + $this->SetError($this->Lang('invalid_address').': '. $address); + if ($this->exceptions) { + throw new phpmailerException($this->Lang('invalid_address').': '.$address); + } + echo $this->Lang('invalid_address').': '.$address; + return false; + } + if ($kind != 'ReplyTo') { + if (!isset($this->all_recipients[strtolower($address)])) { + array_push($this->$kind, array($address, $name)); + $this->all_recipients[strtolower($address)] = true; + return true; + } + } else { + if (!array_key_exists(strtolower($address), $this->ReplyTo)) { + $this->ReplyTo[strtolower($address)] = array($address, $name); + return true; + } + } + return false; +} + +/** + * Set the From and FromName properties + * @param string $address + * @param string $name + * @return boolean + */ + public function SetFrom($address, $name = '',$auto=1) { + $address = trim($address); + $name = trim(preg_replace('/[\r\n]+/', '', $name)); //Strip breaks and trim + if (!self::ValidateAddress($address)) { + $this->SetError($this->Lang('invalid_address').': '. $address); + if ($this->exceptions) { + throw new phpmailerException($this->Lang('invalid_address').': '.$address); + } + echo $this->Lang('invalid_address').': '.$address; + return false; + } + $this->From = $address; + $this->FromName = $name; + if ($auto) { + if (empty($this->ReplyTo)) { + $this->AddAnAddress('ReplyTo', $address, $name); + } + if (empty($this->Sender)) { + $this->Sender = $address; + } + } + return true; + } + + /** + * Check that a string looks roughly like an email address should + * Static so it can be used without instantiation + * Tries to use PHP built-in validator in the filter extension (from PHP 5.2), falls back to a reasonably competent regex validator + * Conforms approximately to RFC2822 + * @link http://www.hexillion.com/samples/#Regex Original pattern found here + * @param string $address The email address to check + * @return boolean + * @static + * @access public + */ + public static function ValidateAddress($address) { + if (function_exists('filter_var')) { //Introduced in PHP 5.2 + if(filter_var($address, FILTER_VALIDATE_EMAIL) === FALSE) { + return false; + } else { + return true; + } + } else { + return preg_match('/^(?:[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+\.)*[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+@(?:(?:(?:[a-zA-Z0-9_](?:[a-zA-Z0-9_\-](?!\.)){0,61}[a-zA-Z0-9_-]?\.)+[a-zA-Z0-9_](?:[a-zA-Z0-9_\-](?!$)){0,61}[a-zA-Z0-9_]?)|(?:\[(?:(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\.){3}(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\]))$/', $address); + } + } + + ///////////////////////////////////////////////// + // METHODS, MAIL SENDING + ///////////////////////////////////////////////// + + /** + * 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 + */ + public function Send() { + try { + if ((count($this->to) + count($this->cc) + count($this->bcc)) < 1) { + throw new phpmailerException($this->Lang('provide_address'), self::STOP_CRITICAL); + } + + // 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 (empty($this->Body)) { + throw new phpmailerException($this->Lang('empty_message'), self::STOP_CRITICAL); + } + + // digitally sign with DKIM if enabled + if ($this->DKIM_domain && $this->DKIM_private) { + $header_dkim = $this->DKIM_Add($header,$this->Subject,$body); + $header = str_replace("\r\n","\n",$header_dkim) . $header; + } + + // Choose the mailer and send through it + switch($this->Mailer) { + case 'sendmail': + return $this->SendmailSend($header, $body); + case 'smtp': + return $this->SmtpSend($header, $body); + default: + return $this->MailSend($header, $body); + } + + } catch (phpmailerException $e) { + $this->SetError($e->getMessage()); + if ($this->exceptions) { + throw $e; + } + echo $e->getMessage()."\n"; + return false; + } + } + + /** + * Sends mail using the $Sendmail program. + * @param string $header The message headers + * @param string $body The message body + * @access protected + * @return bool + */ + protected function SendmailSend($header, $body) { + if ($this->Sender != '') { + $sendmail = sprintf("%s -oi -f %s -t", escapeshellcmd($this->Sendmail), escapeshellarg($this->Sender)); + } else { + $sendmail = sprintf("%s -oi -t", escapeshellcmd($this->Sendmail)); + } + if ($this->SingleTo === true) { + foreach ($this->SingleToArray as $key => $val) { + if(!@$mail = popen($sendmail, 'w')) { + throw new phpmailerException($this->Lang('execute') . $this->Sendmail, self::STOP_CRITICAL); + } + fputs($mail, "To: " . $val . "\n"); + fputs($mail, $header); + fputs($mail, $body); + $result = pclose($mail); + // implement call back function if it exists + $isSent = ($result == 0) ? 1 : 0; + $this->doCallback($isSent,$val,$this->cc,$this->bcc,$this->Subject,$body); + if($result != 0) { + throw new phpmailerException($this->Lang('execute') . $this->Sendmail, self::STOP_CRITICAL); + } + } + } else { + if(!@$mail = popen($sendmail, 'w')) { + throw new phpmailerException($this->Lang('execute') . $this->Sendmail, self::STOP_CRITICAL); + } + fputs($mail, $header); + fputs($mail, $body); + $result = pclose($mail); + // implement call back function if it exists + $isSent = ($result == 0) ? 1 : 0; + $this->doCallback($isSent,$this->to,$this->cc,$this->bcc,$this->Subject,$body); + if($result != 0) { + throw new phpmailerException($this->Lang('execute') . $this->Sendmail, self::STOP_CRITICAL); + } + } + return true; + } + + /** + * Sends mail using the PHP mail() function. + * @param string $header The message headers + * @param string $body The message body + * @access protected + * @return bool + */ + protected function MailSend($header, $body) { + $toArr = array(); + foreach($this->to as $t) { + $toArr[] = $this->AddrFormat($t); + } + $to = implode(', ', $toArr); + + $params = sprintf("-oi -f %s", $this->Sender); + if ($this->Sender != '' && strlen(ini_get('safe_mode'))< 1) { + $old_from = ini_get('sendmail_from'); + ini_set('sendmail_from', $this->Sender); + if ($this->SingleTo === true && count($toArr) > 1) { + foreach ($toArr as $key => $val) { + $rt = @mail($val, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header, $params); + // implement call back function if it exists + $isSent = ($rt == 1) ? 1 : 0; + $this->doCallback($isSent,$val,$this->cc,$this->bcc,$this->Subject,$body); + } + } else { + $rt = @mail($to, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header, $params); + // implement call back function if it exists + $isSent = ($rt == 1) ? 1 : 0; + $this->doCallback($isSent,$to,$this->cc,$this->bcc,$this->Subject,$body); + } + } else { + if ($this->SingleTo === true && count($toArr) > 1) { + foreach ($toArr as $key => $val) { + $rt = @mail($val, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header, $params); + // implement call back function if it exists + $isSent = ($rt == 1) ? 1 : 0; + $this->doCallback($isSent,$val,$this->cc,$this->bcc,$this->Subject,$body); + } + } else { + $rt = @mail($to, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header); + // implement call back function if it exists + $isSent = ($rt == 1) ? 1 : 0; + $this->doCallback($isSent,$to,$this->cc,$this->bcc,$this->Subject,$body); + } + } + if (isset($old_from)) { + ini_set('sendmail_from', $old_from); + } + if(!$rt) { + throw new phpmailerException($this->Lang('instantiate'), self::STOP_CRITICAL); + } + return true; + } + + /** + * Sends mail via SMTP using PhpSMTP + * Returns false if there is a bad MAIL FROM, RCPT, or DATA input. + * @param string $header The message headers + * @param string $body The message body + * @uses SMTP + * @access protected + * @return bool + */ + protected function SmtpSend($header, $body) { + require_once $this->PluginDir . 'class-smtp.php'; + $bad_rcpt = array(); + + if(!$this->SmtpConnect()) { + throw new phpmailerException($this->Lang('smtp_connect_failed'), self::STOP_CRITICAL); + } + $smtp_from = ($this->Sender == '') ? $this->From : $this->Sender; + if(!$this->smtp->Mail($smtp_from)) { + throw new phpmailerException($this->Lang('from_failed') . $smtp_from, self::STOP_CRITICAL); + } + + // Attempt to send attach all recipients + foreach($this->to as $to) { + if (!$this->smtp->Recipient($to[0])) { + $bad_rcpt[] = $to[0]; + // implement call back function if it exists + $isSent = 0; + $this->doCallback($isSent,$to[0],'','',$this->Subject,$body); + } else { + // implement call back function if it exists + $isSent = 1; + $this->doCallback($isSent,$to[0],'','',$this->Subject,$body); + } + } + foreach($this->cc as $cc) { + if (!$this->smtp->Recipient($cc[0])) { + $bad_rcpt[] = $cc[0]; + // implement call back function if it exists + $isSent = 0; + $this->doCallback($isSent,'',$cc[0],'',$this->Subject,$body); + } else { + // implement call back function if it exists + $isSent = 1; + $this->doCallback($isSent,'',$cc[0],'',$this->Subject,$body); + } + } + foreach($this->bcc as $bcc) { + if (!$this->smtp->Recipient($bcc[0])) { + $bad_rcpt[] = $bcc[0]; + // implement call back function if it exists + $isSent = 0; + $this->doCallback($isSent,'','',$bcc[0],$this->Subject,$body); + } else { + // implement call back function if it exists + $isSent = 1; + $this->doCallback($isSent,'','',$bcc[0],$this->Subject,$body); + } + } + + + if (count($bad_rcpt) > 0 ) { //Create error message for any bad addresses + $badaddresses = implode(', ', $bad_rcpt); + throw new phpmailerException($this->Lang('recipients_failed') . $badaddresses); + } + if(!$this->smtp->Data($header . $body)) { + throw new phpmailerException($this->Lang('data_not_accepted'), self::STOP_CRITICAL); + } + if($this->SMTPKeepAlive == true) { + $this->smtp->Reset(); + } + return true; + } + + /** + * Initiates a connection to an SMTP server. + * Returns false if the operation failed. + * @uses SMTP + * @access public + * @return bool + */ + public function SmtpConnect() { + if(is_null($this->smtp)) { + $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 + try { + while($index < count($hosts) && !$connection) { + $hostinfo = array(); + if (preg_match('/^(.+):([0-9]+)$/', $hosts[$index], $hostinfo)) { + $host = $hostinfo[1]; + $port = $hostinfo[2]; + } else { + $host = $hosts[$index]; + $port = $this->Port; + } + + $tls = ($this->SMTPSecure == 'tls'); + $ssl = ($this->SMTPSecure == 'ssl'); + + if ($this->smtp->Connect(($ssl ? 'ssl://':'').$host, $port, $this->Timeout)) { + + $hello = ($this->Helo != '' ? $this->Helo : $this->ServerHostname()); + $this->smtp->Hello($hello); + + if ($tls) { + if (!$this->smtp->StartTLS()) { + throw new phpmailerException($this->Lang('tls')); + } + + //We must resend HELO after tls negotiation + $this->smtp->Hello($hello); + } + + $connection = true; + if ($this->SMTPAuth) { + if (!$this->smtp->Authenticate($this->Username, $this->Password)) { + throw new phpmailerException($this->Lang('authenticate')); + } + } + } + $index++; + if (!$connection) { + throw new phpmailerException($this->Lang('connect_host')); + } + } + } catch (phpmailerException $e) { + $this->smtp->Reset(); + throw $e; + } + return true; + } + + /** + * Closes the active SMTP session if one exists. + * @return void + */ + public function SmtpClose() { + if(!is_null($this->smtp)) { + 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 is English. + * @param string $langcode ISO 639-1 2-character language code (e.g. Portuguese: "br") + * @param string $lang_path Path to the language file directory + * @access public + */ + function SetLanguage($langcode = 'en', $lang_path = 'language/') { + //Define full set of translatable strings + $PHPMAILER_LANG = array( + 'provide_address' => 'You must provide at least one recipient email address.', + 'mailer_not_supported' => ' mailer is not supported.', + 'execute' => 'Could not execute: ', + 'instantiate' => 'Could not instantiate mail function.', + 'authenticate' => 'SMTP Error: Could not authenticate.', + 'from_failed' => 'The following From address failed: ', + 'recipients_failed' => 'SMTP Error: The following recipients failed: ', + 'data_not_accepted' => 'SMTP Error: Data not accepted.', + 'connect_host' => 'SMTP Error: Could not connect to SMTP host.', + 'file_access' => 'Could not access file: ', + 'file_open' => 'File Error: Could not open file: ', + 'encoding' => 'Unknown encoding: ', + 'signing' => 'Signing Error: ', + 'smtp_error' => 'SMTP server error: ', + 'empty_message' => 'Message body empty', + 'invalid_address' => 'Invalid address', + 'variable_set' => 'Cannot set or reset variable: ' + ); + //Overwrite language-specific strings. This way we'll never have missing translations - no more "language string failed to load"! + $l = true; + if ($langcode != 'en') { //There is no English translation file + $l = @include $lang_path.'phpmailer.lang-'.$langcode.'.php'; + } + $this->language = $PHPMAILER_LANG; + return ($l == true); //Returns false if language not found + } + + /** + * Return the current array of language strings + * @return array + */ + public function GetTranslations() { + return $this->language; + } + + ///////////////////////////////////////////////// + // METHODS, MESSAGE CREATION + ///////////////////////////////////////////////// + + /** + * Creates recipient headers. + * @access public + * @return string + */ + public function AddrAppend($type, $addr) { + $addr_str = $type . ': '; + $addresses = array(); + foreach ($addr as $a) { + $addresses[] = $this->AddrFormat($a); + } + $addr_str .= implode(', ', $addresses); + $addr_str .= $this->LE; + + return $addr_str; + } + + /** + * Formats an address correctly. + * @access public + * @return string + */ + public function AddrFormat($addr) { + if (empty($addr[1])) { + return $this->SecureHeader($addr[0]); + } else { + return $this->EncodeHeader($this->SecureHeader($addr[1]), 'phrase') . " <" . $this->SecureHeader($addr[0]) . ">"; + } + } + + /** + * Wraps message for use with mailers that do not + * automatically perform wrapping and for quoted-printable. + * Original written by philippe. + * @param string $message The message to wrap + * @param integer $length The line length to wrap to + * @param boolean $qp_mode Whether to run in Quoted-Printable mode + * @access public + * @return string + */ + public function WrapText($message, $length, $qp_mode = false) { + $soft_break = ($qp_mode) ? sprintf(" =%s", $this->LE) : $this->LE; + // If utf-8 encoding is used, we will need to make sure we don't + // split multibyte characters when we wrap + $is_utf8 = (strtolower($this->CharSet) == "utf-8"); + + $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 ($is_utf8) { + $len = $this->UTF8CharBoundary($word, $len); + } elseif (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 ($is_utf8) { + $len = $this->UTF8CharBoundary($word, $len); + } elseif (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; + } + + /** + * Finds last character boundary prior to maxLength in a utf-8 + * quoted (printable) encoded string. + * Original written by Colin Brown. + * @access public + * @param string $encodedText utf-8 QP text + * @param int $maxLength find last character boundary prior to this length + * @return int + */ + public function UTF8CharBoundary($encodedText, $maxLength) { + $foundSplitPos = false; + $lookBack = 3; + while (!$foundSplitPos) { + $lastChunk = substr($encodedText, $maxLength - $lookBack, $lookBack); + $encodedCharPos = strpos($lastChunk, "="); + if ($encodedCharPos !== false) { + // Found start of encoded character byte within $lookBack block. + // Check the encoded byte value (the 2 chars after the '=') + $hex = substr($encodedText, $maxLength - $lookBack + $encodedCharPos + 1, 2); + $dec = hexdec($hex); + if ($dec < 128) { // Single byte character. + // If the encoded char was found at pos 0, it will fit + // otherwise reduce maxLength to start of the encoded char + $maxLength = ($encodedCharPos == 0) ? $maxLength : + $maxLength - ($lookBack - $encodedCharPos); + $foundSplitPos = true; + } elseif ($dec >= 192) { // First byte of a multi byte character + // Reduce maxLength to split at start of character + $maxLength = $maxLength - ($lookBack - $encodedCharPos); + $foundSplitPos = true; + } elseif ($dec < 192) { // Middle byte of a multi byte character, look further back + $lookBack += 3; + } + } else { + // No encoded character found + $foundSplitPos = true; + } + } + return $maxLength; + } + + + /** + * Set the body wrapping. + * @access public + * @return void + */ + public function SetWordWrap() { + if($this->WordWrap < 1) { + return; + } + + switch($this->message_type) { + case 'alt': + 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 public + * @return string The assembled header + */ + public 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', self::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 ($this->SingleTo === true) { + foreach($this->to as $t) { + $this->SingleToArray[] = $this->AddrFormat($t); + } + } else { + if(count($this->to) > 0) { + $result .= $this->AddrAppend('To', $this->to); + } elseif (count($this->cc) == 0) { + $result .= $this->HeaderLine('To', 'undisclosed-recipients:;'); + } + } + } + + $from = array(); + $from[0][0] = trim($this->From); + $from[0][1] = $this->FromName; + $result .= $this->AddrAppend('From', $from); + + // sendmail and mail() extract Cc from the header before sending + if(count($this->cc) > 0) { + $result .= $this->AddrAppend('Cc', $this->cc); + } + + // 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($this->SecureHeader($this->Subject))); + } + + if($this->MessageID != '') { + $result .= $this->HeaderLine('Message-ID',$this->MessageID); + } else { + $result .= sprintf("Message-ID: <%s@%s>%s", $uniq_id, $this->ServerHostname(), $this->LE); + } + $result .= $this->HeaderLine('X-Priority', $this->Priority); + $result .= $this->HeaderLine('X-Mailer', 'PHPMailer '.$this->Version.' (phpmailer.sourceforge.net)'); + + 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]))); + } + if (!$this->sign_key_file) { + $result .= $this->HeaderLine('MIME-Version', '1.0'); + $result .= $this->GetMailMIME(); + } + + return $result; + } + + /** + * Returns the message MIME. + * @access public + * @return string + */ + public function GetMailMIME() { + $result = ''; + 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': + 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 public + * @return string The assembled message body + */ + public function CreateBody() { + $body = ''; + + if ($this->sign_key_file) { + $body .= $this->GetMailMIME(); + } + + $this->SetWordWrap(); + + switch($this->message_type) { + case 'alt': + $body .= $this->GetBoundary($this->boundary[1], '', 'text/plain', ''); + $body .= $this->EncodeString($this->AltBody, $this->Encoding); + $body .= $this->LE.$this->LE; + $body .= $this->GetBoundary($this->boundary[1], '', 'text/html', ''); + $body .= $this->EncodeString($this->Body, $this->Encoding); + $body .= $this->LE.$this->LE; + $body .= $this->EndBoundary($this->boundary[1]); + break; + case 'plain': + $body .= $this->EncodeString($this->Body, $this->Encoding); + break; + case 'attachments': + $body .= $this->GetBoundary($this->boundary[1], '', '', ''); + $body .= $this->EncodeString($this->Body, $this->Encoding); + $body .= $this->LE; + $body .= $this->AttachAll(); + break; + case 'alt_attachments': + $body .= sprintf("--%s%s", $this->boundary[1], $this->LE); + $body .= sprintf("Content-Type: %s;%s" . "\tboundary=\"%s\"%s", 'multipart/alternative', $this->LE, $this->boundary[2], $this->LE.$this->LE); + $body .= $this->GetBoundary($this->boundary[2], '', 'text/plain', '') . $this->LE; // Create text body + $body .= $this->EncodeString($this->AltBody, $this->Encoding); + $body .= $this->LE.$this->LE; + $body .= $this->GetBoundary($this->boundary[2], '', 'text/html', '') . $this->LE; // Create the HTML body + $body .= $this->EncodeString($this->Body, $this->Encoding); + $body .= $this->LE.$this->LE; + $body .= $this->EndBoundary($this->boundary[2]); + $body .= $this->AttachAll(); + break; + } + + if ($this->IsError()) { + $body = ''; + } elseif ($this->sign_key_file) { + try { + $file = tempnam('', 'mail'); + file_put_contents($file, $body); //TODO check this worked + $signed = tempnam("", "signed"); + if (@openssl_pkcs7_sign($file, $signed, "file://".$this->sign_cert_file, array("file://".$this->sign_key_file, $this->sign_key_pass), NULL)) { + @unlink($file); + @unlink($signed); + $body = file_get_contents($signed); + } else { + @unlink($file); + @unlink($signed); + throw new phpmailerException($this->Lang("signing").openssl_error_string()); + } + } catch (phpmailerException $e) { + $body = ''; + if ($this->exceptions) { + throw $e; + } + } + } + + return $body; + } + + /** + * Returns the start of a message boundary. + * @access private + */ + 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 + */ + private function EndBoundary($boundary) { + return $this->LE . '--' . $boundary . '--' . $this->LE; + } + + /** + * Sets the message type. + * @access private + * @return void + */ + private 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 public + * @return string + */ + public function HeaderLine($name, $value) { + return $name . ': ' . $value . $this->LE; + } + + /** + * Returns a formatted mail line. + * @access public + * @return string + */ + public function TextLine($value) { + return $value . $this->LE; + } + + ///////////////////////////////////////////////// + // CLASS METHODS, ATTACHMENTS + ///////////////////////////////////////////////// + + /** + * 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 + */ + public function AddAttachment($path, $name = '', $encoding = 'base64', $type = 'application/octet-stream') { + try { + if ( !@is_file($path) ) { + throw new phpmailerException($this->Lang('file_access') . $path, self::STOP_CONTINUE); + } + $filename = basename($path); + if ( $name == '' ) { + $name = $filename; + } + + $this->attachment[] = array( + 0 => $path, + 1 => $filename, + 2 => $name, + 3 => $encoding, + 4 => $type, + 5 => false, // isStringAttachment + 6 => 'attachment', + 7 => 0 + ); + + } catch (phpmailerException $e) { + $this->SetError($e->getMessage()); + if ($this->exceptions) { + throw $e; + } + echo $e->getMessage()."\n"; + if ( $e->getCode() == self::STOP_CRITICAL ) { + return false; + } + } + return true; + } + + /** + * Return the current array of attachments + * @return array + */ + public function GetAttachments() { + return $this->attachment; + } + + /** + * Attaches all fs, string, and binary attachments to the message. + * Returns an empty string on failure. + * @access private + * @return string + */ + private function AttachAll() { + // Return text of body + $mime = array(); + $cidUniq = array(); + $incl = array(); + + // Add all attachments + foreach ($this->attachment as $attachment) { + // Check for string attachment + $bString = $attachment[5]; + if ($bString) { + $string = $attachment[0]; + } else { + $path = $attachment[0]; + } + + if (in_array($attachment[0], $incl)) { continue; } + $filename = $attachment[1]; + $name = $attachment[2]; + $encoding = $attachment[3]; + $type = $attachment[4]; + $disposition = $attachment[6]; + $cid = $attachment[7]; + $incl[] = $attachment[0]; + if ( $disposition == 'inline' && isset($cidUniq[$cid]) ) { continue; } + $cidUniq[$cid] = true; + + $mime[] = sprintf("--%s%s", $this->boundary[1], $this->LE); + $mime[] = sprintf("Content-Type: %s; name=\"%s\"%s", $type, $this->EncodeHeader($this->SecureHeader($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, $this->EncodeHeader($this->SecureHeader($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. + * @param string $path The full path to the file + * @param string $encoding The encoding to use; one of 'base64', '7bit', '8bit', 'binary', 'quoted-printable' + * @see EncodeFile() + * @access private + * @return string + */ + private function EncodeFile($path, $encoding = 'base64') { + try { + if (!is_readable($path)) { + throw new phpmailerException($this->Lang('file_open') . $path, self::STOP_CONTINUE); + } + if (function_exists('get_magic_quotes')) { + function get_magic_quotes() { + return false; + } + } + if (PHP_VERSION < 6) { + $magic_quotes = get_magic_quotes_runtime(); + set_magic_quotes_runtime(0); + } + $file_buffer = file_get_contents($path); + $file_buffer = $this->EncodeString($file_buffer, $encoding); + if (PHP_VERSION < 6) { set_magic_quotes_runtime($magic_quotes); } + return $file_buffer; + } catch (Exception $e) { + $this->SetError($e->getMessage()); + return ''; + } + } + + /** + * Encodes string to requested format. + * Returns an empty string on failure. + * @param string $str The text to encode + * @param string $encoding The encoding to use; one of 'base64', '7bit', '8bit', 'binary', 'quoted-printable' + * @access public + * @return string + */ + public function EncodeString ($str, $encoding = 'base64') { + $encoded = ''; + switch(strtolower($encoding)) { + case 'base64': + $encoded = chunk_split(base64_encode($str), 76, $this->LE); + break; + case '7bit': + case '8bit': + $encoded = $this->FixEOL($str); + //Make sure it ends with a line break + 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 (shortest) of Q, B, quoted or none. + * @access public + * @return string + */ + public 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'; + if (function_exists('mb_strlen') && $this->HasMultiBytes($str)) { + // Use a custom function which correctly encodes and wraps long + // multibyte strings without breaking lines within a character + $encoded = $this->Base64EncodeWrapMB($str); + } else { + $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; + } + + /** + * Checks if a string contains multibyte characters. + * @access public + * @param string $str multi-byte text to wrap encode + * @return bool + */ + public function HasMultiBytes($str) { + if (function_exists('mb_strlen')) { + return (strlen($str) > mb_strlen($str, $this->CharSet)); + } else { // Assume no multibytes (we can't handle without mbstring functions anyway) + return false; + } + } + + /** + * Correctly encodes and wraps long multibyte strings for mail headers + * without breaking lines within a character. + * Adapted from a function by paravoid at http://uk.php.net/manual/en/function.mb-encode-mimeheader.php + * @access public + * @param string $str multi-byte text to wrap encode + * @return string + */ + public function Base64EncodeWrapMB($str) { + $start = "=?".$this->CharSet."?B?"; + $end = "?="; + $encoded = ""; + + $mb_length = mb_strlen($str, $this->CharSet); + // Each line must have length <= 75, including $start and $end + $length = 75 - strlen($start) - strlen($end); + // Average multi-byte ratio + $ratio = $mb_length / strlen($str); + // Base64 has a 4:3 ratio + $offset = $avgLength = floor($length * $ratio * .75); + + for ($i = 0; $i < $mb_length; $i += $offset) { + $lookBack = 0; + + do { + $offset = $avgLength - $lookBack; + $chunk = mb_substr($str, $i, $offset, $this->CharSet); + $chunk = base64_encode($chunk); + $lookBack++; + } + while (strlen($chunk) > $length); + + $encoded .= $chunk . $this->LE; + } + + // Chomp the last linefeed + $encoded = substr($encoded, 0, -strlen($this->LE)); + return $encoded; + } + + /** + * Encode string to quoted-printable. + * Only uses standard PHP, slow, but will always work + * @access public + * @param string $string the text to encode + * @param integer $line_max Number of chars allowed on a line before wrapping + * @return string + */ + public function EncodeQPphp( $input = '', $line_max = 76, $space_conv = false) { + $hex = array('0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'); + $lines = preg_split('/(?:\r\n|\r|\n)/', $input); + $eol = "\r\n"; + $escape = '='; + $output = ''; + while( list(, $line) = each($lines) ) { + $linlen = strlen($line); + $newline = ''; + for($i = 0; $i < $linlen; $i++) { + $c = substr( $line, $i, 1 ); + $dec = ord( $c ); + if ( ( $i == 0 ) && ( $dec == 46 ) ) { // convert first point in the line into =2E + $c = '=2E'; + } + if ( $dec == 32 ) { + if ( $i == ( $linlen - 1 ) ) { // convert space at eol only + $c = '=20'; + } else if ( $space_conv ) { + $c = '=20'; + } + } elseif ( ($dec == 61) || ($dec < 32 ) || ($dec > 126) ) { // always encode "\t", which is *not* required + $h2 = floor($dec/16); + $h1 = floor($dec%16); + $c = $escape.$hex[$h2].$hex[$h1]; + } + if ( (strlen($newline) + strlen($c)) >= $line_max ) { // CRLF is not counted + $output .= $newline.$escape.$eol; // soft line break; " =\r\n" is okay + $newline = ''; + // check if newline first character will be point or not + if ( $dec == 46 ) { + $c = '=2E'; + } + } + $newline .= $c; + } // end of for + $output .= $newline.$eol; + } // end of while + return $output; + } + + /** + * Encode string to RFC2045 (6.7) quoted-printable format + * Uses a PHP5 stream filter to do the encoding about 64x faster than the old version + * Also results in same content as you started with after decoding + * @see EncodeQPphp() + * @access public + * @param string $string the text to encode + * @param integer $line_max Number of chars allowed on a line before wrapping + * @param boolean $space_conv Dummy param for compatibility with existing EncodeQP function + * @return string + * @author Marcus Bointon + */ + public function EncodeQP($string, $line_max = 76, $space_conv = false) { + if (function_exists('quoted_printable_encode')) { //Use native function if it's available (>= PHP5.3) + return quoted_printable_encode($string); + } + $filters = stream_get_filters(); + if (!in_array('convert.*', $filters)) { //Got convert stream filter? + return $this->EncodeQPphp($string, $line_max, $space_conv); //Fall back to old implementation + } + $fp = fopen('php://temp/', 'r+'); + $string = preg_replace('/\r\n?/', $this->LE, $string); //Normalise line breaks + $params = array('line-length' => $line_max, 'line-break-chars' => $this->LE); + $s = stream_filter_append($fp, 'convert.quoted-printable-encode', STREAM_FILTER_READ, $params); + fputs($fp, $string); + rewind($fp); + $out = stream_get_contents($fp); + stream_filter_remove($s); + $out = preg_replace('/^\./m', '=2E', $out); //Encode . if it is first char on a line, workaround for bug in Exchange + fclose($fp); + return $out; + } + + /** + * Encode string to q encoding. + * @link http://tools.ietf.org/html/rfc2047 + * @param string $str the text to encode + * @param string $position Where the text is going to be used, see the RFC for what that means + * @access public + * @return string + */ + public 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 + //TODO using /e (equivalent to eval()) is probably not a good idea + $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 + */ + public function AddStringAttachment($string, $filename, $encoding = 'base64', $type = 'application/octet-stream') { + // Append to $attachment array + $this->attachment[] = array( + 0 => $string, + 1 => $filename, + 2 => basename($filename), + 3 => $encoding, + 4 => $type, + 5 => true, // isStringAttachment + 6 => 'attachment', + 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 + */ + public 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 + $this->attachment[] = array( + 0 => $path, + 1 => $filename, + 2 => $name, + 3 => $encoding, + 4 => $type, + 5 => false, // isStringAttachment + 6 => 'inline', + 7 => $cid + ); + + return true; + } + + /** + * Returns true if an inline attachment is present. + * @access public + * @return bool + */ + public function InlineImageExists() { + foreach($this->attachment as $attachment) { + if ($attachment[6] == 'inline') { + return true; + } + } + return false; + } + + ///////////////////////////////////////////////// + // CLASS METHODS, MESSAGE RESET + ///////////////////////////////////////////////// + + /** + * Clears all recipients assigned in the TO array. Returns void. + * @return void + */ + public function ClearAddresses() { + foreach($this->to as $to) { + unset($this->all_recipients[strtolower($to[0])]); + } + $this->to = array(); + } + + /** + * Clears all recipients assigned in the CC array. Returns void. + * @return void + */ + public function ClearCCs() { + foreach($this->cc as $cc) { + unset($this->all_recipients[strtolower($cc[0])]); + } + $this->cc = array(); + } + + /** + * Clears all recipients assigned in the BCC array. Returns void. + * @return void + */ + public function ClearBCCs() { + foreach($this->bcc as $bcc) { + unset($this->all_recipients[strtolower($bcc[0])]); + } + $this->bcc = array(); + } + + /** + * Clears all recipients assigned in the ReplyTo array. Returns void. + * @return void + */ + public function ClearReplyTos() { + $this->ReplyTo = array(); + } + + /** + * Clears all recipients assigned in the TO, CC and BCC + * array. Returns void. + * @return void + */ + public function ClearAllRecipients() { + $this->to = array(); + $this->cc = array(); + $this->bcc = array(); + $this->all_recipients = array(); + } + + /** + * Clears all previously set filesystem, string, and binary + * attachments. Returns void. + * @return void + */ + public function ClearAttachments() { + $this->attachment = array(); + } + + /** + * Clears all custom headers. Returns void. + * @return void + */ + public function ClearCustomHeaders() { + $this->CustomHeader = array(); + } + + ///////////////////////////////////////////////// + // CLASS METHODS, MISCELLANEOUS + ///////////////////////////////////////////////// + + /** + * Adds the error message to the error container. + * @access protected + * @return void + */ + protected function SetError($msg) { + $this->error_count++; + if ($this->Mailer == 'smtp' and !is_null($this->smtp)) { + $lasterror = $this->smtp->getError(); + if (!empty($lasterror) and array_key_exists('smtp_msg', $lasterror)) { + $msg .= '

              ' . $this->Lang('smtp_error') . $lasterror['smtp_msg'] . "

              \n"; + } + } + $this->ErrorInfo = $msg; + } + + /** + * Returns the proper RFC 822 formatted date. + * @access public + * @return string + * @static + */ + public static function RFCDate() { + $tz = date('Z'); + $tzs = ($tz < 0) ? '-' : '+'; + $tz = abs($tz); + $tz = (int)($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 server hostname or 'localhost.localdomain' if unknown. + * @access private + * @return string + */ + private function ServerHostname() { + if (!empty($this->Hostname)) { + $result = $this->Hostname; + } elseif (isset($_SERVER['SERVER_NAME'])) { + $result = $_SERVER['SERVER_NAME']; + } else { + $result = 'localhost.localdomain'; + } + + return $result; + } + + /** + * Returns a message in the appropriate language. + * @access private + * @return string + */ + private 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. + * @access public + * @return bool + */ + public function IsError() { + return ($this->error_count > 0); + } + + /** + * Changes every end of line from CR or LF to CRLF. + * @access private + * @return string + */ + private 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. + * @access public + * @return void + */ + public function AddCustomHeader($custom_header) { + $this->CustomHeader[] = explode(':', $custom_header, 2); + } + + /** + * Evaluates the message and returns modifications for inline images and backgrounds + * @access public + * @return $message + */ + public function MsgHTML($message, $basedir = '') { + preg_match_all("/(src|background)=\"(.*)\"/Ui", $message, $images); + if(isset($images[2])) { + foreach($images[2] as $i => $url) { + // do not change urls for absolute images (thanks to corvuscorax) + if (!preg_match('#^[A-z]+://#',$url)) { + $filename = basename($url); + $directory = dirname($url); + ($directory == '.')?$directory='':''; + $cid = 'cid:' . md5($filename); + $ext = pathinfo($filename, PATHINFO_EXTENSION); + $mimeType = self::_mime_types($ext); + if ( strlen($basedir) > 1 && substr($basedir,-1) != '/') { $basedir .= '/'; } + if ( strlen($directory) > 1 && substr($directory,-1) != '/') { $directory .= '/'; } + if ( $this->AddEmbeddedImage($basedir.$directory.$filename, md5($filename), $filename, 'base64',$mimeType) ) { + $message = preg_replace("/".$images[1][$i]."=\"".preg_quote($url, '/')."\"/Ui", $images[1][$i]."=\"".$cid."\"", $message); + } + } + } + } + $this->IsHTML(true); + $this->Body = $message; + $textMsg = trim(strip_tags(preg_replace('/<(head|title|style|script)[^>]*>.*?<\/\\1>/s','',$message))); + if (!empty($textMsg) && empty($this->AltBody)) { + $this->AltBody = html_entity_decode($textMsg); + } + if (empty($this->AltBody)) { + $this->AltBody = 'To view this email message, open it in a program that understands HTML!' . "\n\n"; + } + } + + /** + * Gets the MIME type of the embedded or inline image + * @param string File extension + * @access public + * @return string MIME type of ext + * @static + */ + public static function _mime_types($ext = '') { + $mimes = array( + 'hqx' => 'application/mac-binhex40', + 'cpt' => 'application/mac-compactpro', + 'doc' => 'application/msword', + 'bin' => 'application/macbinary', + 'dms' => 'application/octet-stream', + 'lha' => 'application/octet-stream', + 'lzh' => 'application/octet-stream', + 'exe' => 'application/octet-stream', + 'class' => 'application/octet-stream', + 'psd' => 'application/octet-stream', + 'so' => 'application/octet-stream', + 'sea' => 'application/octet-stream', + 'dll' => 'application/octet-stream', + 'oda' => 'application/oda', + 'pdf' => 'application/pdf', + 'ai' => 'application/postscript', + 'eps' => 'application/postscript', + 'ps' => 'application/postscript', + 'smi' => 'application/smil', + 'smil' => 'application/smil', + 'mif' => 'application/vnd.mif', + 'xls' => 'application/vnd.ms-excel', + 'ppt' => 'application/vnd.ms-powerpoint', + 'wbxml' => 'application/vnd.wap.wbxml', + 'wmlc' => 'application/vnd.wap.wmlc', + 'dcr' => 'application/x-director', + 'dir' => 'application/x-director', + 'dxr' => 'application/x-director', + 'dvi' => 'application/x-dvi', + 'gtar' => 'application/x-gtar', + 'php' => 'application/x-httpd-php', + 'php4' => 'application/x-httpd-php', + 'php3' => 'application/x-httpd-php', + 'phtml' => 'application/x-httpd-php', + 'phps' => 'application/x-httpd-php-source', + 'js' => 'application/x-javascript', + 'swf' => 'application/x-shockwave-flash', + 'sit' => 'application/x-stuffit', + 'tar' => 'application/x-tar', + 'tgz' => 'application/x-tar', + 'xhtml' => 'application/xhtml+xml', + 'xht' => 'application/xhtml+xml', + 'zip' => 'application/zip', + 'mid' => 'audio/midi', + 'midi' => 'audio/midi', + 'mpga' => 'audio/mpeg', + 'mp2' => 'audio/mpeg', + 'mp3' => 'audio/mpeg', + 'aif' => 'audio/x-aiff', + 'aiff' => 'audio/x-aiff', + 'aifc' => 'audio/x-aiff', + 'ram' => 'audio/x-pn-realaudio', + 'rm' => 'audio/x-pn-realaudio', + 'rpm' => 'audio/x-pn-realaudio-plugin', + 'ra' => 'audio/x-realaudio', + 'rv' => 'video/vnd.rn-realvideo', + 'wav' => 'audio/x-wav', + 'bmp' => 'image/bmp', + 'gif' => 'image/gif', + 'jpeg' => 'image/jpeg', + 'jpg' => 'image/jpeg', + 'jpe' => 'image/jpeg', + 'png' => 'image/png', + 'tiff' => 'image/tiff', + 'tif' => 'image/tiff', + 'css' => 'text/css', + 'html' => 'text/html', + 'htm' => 'text/html', + 'shtml' => 'text/html', + 'txt' => 'text/plain', + 'text' => 'text/plain', + 'log' => 'text/plain', + 'rtx' => 'text/richtext', + 'rtf' => 'text/rtf', + 'xml' => 'text/xml', + 'xsl' => 'text/xml', + 'mpeg' => 'video/mpeg', + 'mpg' => 'video/mpeg', + 'mpe' => 'video/mpeg', + 'qt' => 'video/quicktime', + 'mov' => 'video/quicktime', + 'avi' => 'video/x-msvideo', + 'movie' => 'video/x-sgi-movie', + 'doc' => 'application/msword', + 'word' => 'application/msword', + 'xl' => 'application/excel', + 'eml' => 'message/rfc822' + ); + return (!isset($mimes[strtolower($ext)])) ? 'application/octet-stream' : $mimes[strtolower($ext)]; + } + + /** + * Set (or reset) Class Objects (variables) + * + * Usage Example: + * $page->set('X-Priority', '3'); + * + * @access public + * @param string $name Parameter Name + * @param mixed $value Parameter Value + * NOTE: will not work with arrays, there are no arrays to set/reset + * @todo Should this not be using __set() magic function? + */ + public function set($name, $value = '') { + try { + if (isset($this->$name) ) { + $this->$name = $value; + } else { + throw new phpmailerException($this->Lang('variable_set') . $name, self::STOP_CRITICAL); + } + } catch (Exception $e) { + $this->SetError($e->getMessage()); + if ($e->getCode() == self::STOP_CRITICAL) { + return false; + } + } + return true; + } + + /** + * Strips newlines to prevent header injection. + * @access public + * @param string $str String + * @return string + */ + public function SecureHeader($str) { + $str = str_replace("\r", '', $str); + $str = str_replace("\n", '', $str); + return trim($str); + } + + /** + * Set the private key file and password to sign the message. + * + * @access public + * @param string $key_filename Parameter File Name + * @param string $key_pass Password for private key + */ + public function Sign($cert_filename, $key_filename, $key_pass) { + $this->sign_cert_file = $cert_filename; + $this->sign_key_file = $key_filename; + $this->sign_key_pass = $key_pass; + } + + /** + * Set the private key file and password to sign the message. + * + * @access public + * @param string $key_filename Parameter File Name + * @param string $key_pass Password for private key + */ + public function DKIM_QP($txt) { + $tmp=""; + $line=""; + for ($i=0;$iDKIM_private); + if ($this->DKIM_passphrase!='') { + $privKey = openssl_pkey_get_private($privKeyStr,$this->DKIM_passphrase); + } else { + $privKey = $privKeyStr; + } + if (openssl_sign($s, $signature, $privKey)) { + return base64_encode($signature); + } + } + + /** + * Generate DKIM Canonicalization Header + * + * @access public + * @param string $s Header + */ + public function DKIM_HeaderC($s) { + $s=preg_replace("/\r\n\s+/"," ",$s); + $lines=explode("\r\n",$s); + foreach ($lines as $key=>$line) { + list($heading,$value)=explode(":",$line,2); + $heading=strtolower($heading); + $value=preg_replace("/\s+/"," ",$value) ; // Compress useless spaces + $lines[$key]=$heading.":".trim($value) ; // Don't forget to remove WSP around the value + } + $s=implode("\r\n",$lines); + return $s; + } + + /** + * Generate DKIM Canonicalization Body + * + * @access public + * @param string $body Message Body + */ + public function DKIM_BodyC($body) { + if ($body == '') return "\r\n"; + // stabilize line endings + $body=str_replace("\r\n","\n",$body); + $body=str_replace("\n","\r\n",$body); + // END stabilize line endings + while (substr($body,strlen($body)-4,4) == "\r\n\r\n") { + $body=substr($body,0,strlen($body)-2); + } + return $body; + } + + /** + * Create the DKIM header, body, as new header + * + * @access public + * @param string $headers_line Header lines + * @param string $subject Subject + * @param string $body Body + */ + public function DKIM_Add($headers_line,$subject,$body) { + $DKIMsignatureType = 'rsa-sha1'; // Signature & hash algorithms + $DKIMcanonicalization = 'relaxed/simple'; // Canonicalization of header/body + $DKIMquery = 'dns/txt'; // Query method + $DKIMtime = time() ; // Signature Timestamp = seconds since 00:00:00 - Jan 1, 1970 (UTC time zone) + $subject_header = "Subject: $subject"; + $headers = explode("\r\n",$headers_line); + foreach($headers as $header) { + if (strpos($header,'From:') === 0) { + $from_header=$header; + } elseif (strpos($header,'To:') === 0) { + $to_header=$header; + } + } + $from = str_replace('|','=7C',$this->DKIM_QP($from_header)); + $to = str_replace('|','=7C',$this->DKIM_QP($to_header)); + $subject = str_replace('|','=7C',$this->DKIM_QP($subject_header)) ; // Copied header fields (dkim-quoted-printable + $body = $this->DKIM_BodyC($body); + $DKIMlen = strlen($body) ; // Length of body + $DKIMb64 = base64_encode(pack("H*", sha1($body))) ; // Base64 of packed binary SHA-1 hash of body + $ident = ($this->DKIM_identity == '')? '' : " i=" . $this->DKIM_identity . ";"; + $dkimhdrs = "DKIM-Signature: v=1; a=" . $DKIMsignatureType . "; q=" . $DKIMquery . "; l=" . $DKIMlen . "; s=" . $this->DKIM_selector . ";\r\n". + "\tt=" . $DKIMtime . "; c=" . $DKIMcanonicalization . ";\r\n". + "\th=From:To:Subject;\r\n". + "\td=" . $this->DKIM_domain . ";" . $ident . "\r\n". + "\tz=$from\r\n". + "\t|$to\r\n". + "\t|$subject;\r\n". + "\tbh=" . $DKIMb64 . ";\r\n". + "\tb="; + $toSign = $this->DKIM_HeaderC($from_header . "\r\n" . $to_header . "\r\n" . $subject_header . "\r\n" . $dkimhdrs); + $signed = $this->DKIM_Sign($toSign); + return "X-PHPMAILER-DKIM: phpmailer.worxware.com\r\n".$dkimhdrs.$signed."\r\n"; + } + + protected function doCallback($isSent,$to,$cc,$bcc,$subject,$body) { + if (!empty($this->action_function) && function_exists($this->action_function)) { + $params = array($isSent,$to,$cc,$bcc,$subject,$body); + call_user_func_array($this->action_function,$params); + } + } +} + +class phpmailerException extends Exception { + public function errorMessage() { + $errorMsg = '' . $this->getMessage() . "
              \n"; + return $errorMsg; + } +} +?> \ No newline at end of file diff --git a/src/wp-includes/class-pop3.php b/src/wp-includes/class-pop3.php new file mode 100644 index 0000000..d0455d7 --- /dev/null +++ b/src/wp-includes/class-pop3.php @@ -0,0 +1,652 @@ +BUFFER,"integer"); + if( !empty($server) ) { + // Do not allow programs to alter MAILSERVER + // if it is already specified. They can get around + // this if they -really- want to, so don't count on it. + if(empty($this->MAILSERVER)) + $this->MAILSERVER = $server; + } + if(!empty($timeout)) { + settype($timeout,"integer"); + $this->TIMEOUT = $timeout; + if (!ini_get('safe_mode')) + set_time_limit($timeout); + } + return true; + } + + function update_timer () { + if (!ini_get('safe_mode')) + set_time_limit($this->TIMEOUT); + return true; + } + + function connect ($server, $port = 110) { + // Opens a socket to the specified server. Unless overridden, + // port defaults to 110. Returns true on success, false on fail + + // If MAILSERVER is set, override $server with it's value + + if (!isset($port) || !$port) {$port = 110;} + if(!empty($this->MAILSERVER)) + $server = $this->MAILSERVER; + + if(empty($server)){ + $this->ERROR = "POP3 connect: " . _("No server specified"); + unset($this->FP); + return false; + } + + $fp = @fsockopen("$server", $port, $errno, $errstr); + + if(!$fp) { + $this->ERROR = "POP3 connect: " . _("Error ") . "[$errno] [$errstr]"; + unset($this->FP); + return false; + } + + socket_set_blocking($fp,-1); + $this->update_timer(); + $reply = fgets($fp,$this->BUFFER); + $reply = $this->strip_clf($reply); + if($this->DEBUG) + error_log("POP3 SEND [connect: $server] GOT [$reply]",0); + if(!$this->is_ok($reply)) { + $this->ERROR = "POP3 connect: " . _("Error ") . "[$reply]"; + unset($this->FP); + return false; + } + $this->FP = $fp; + $this->BANNER = $this->parse_banner($reply); + return true; + } + + function user ($user = "") { + // Sends the USER command, returns true or false + + if( empty($user) ) { + $this->ERROR = "POP3 user: " . _("no login ID submitted"); + return false; + } elseif(!isset($this->FP)) { + $this->ERROR = "POP3 user: " . _("connection not established"); + return false; + } else { + $reply = $this->send_cmd("USER $user"); + if(!$this->is_ok($reply)) { + $this->ERROR = "POP3 user: " . _("Error ") . "[$reply]"; + return false; + } else + return true; + } + } + + function pass ($pass = "") { + // Sends the PASS command, returns # of msgs in mailbox, + // returns false (undef) on Auth failure + + if(empty($pass)) { + $this->ERROR = "POP3 pass: " . _("No password submitted"); + return false; + } elseif(!isset($this->FP)) { + $this->ERROR = "POP3 pass: " . _("connection not established"); + return false; + } else { + $reply = $this->send_cmd("PASS $pass"); + if(!$this->is_ok($reply)) { + $this->ERROR = "POP3 pass: " . _("Authentication failed") . " [$reply]"; + $this->quit(); + return false; + } else { + // Auth successful. + $count = $this->last("count"); + $this->COUNT = $count; + return $count; + } + } + } + + function apop ($login,$pass) { + // Attempts an APOP login. If this fails, it'll + // try a standard login. YOUR SERVER MUST SUPPORT + // THE USE OF THE APOP COMMAND! + // (apop is optional per rfc1939) + + if(!isset($this->FP)) { + $this->ERROR = "POP3 apop: " . _("No connection to server"); + return false; + } elseif(!$this->ALLOWAPOP) { + $retVal = $this->login($login,$pass); + return $retVal; + } elseif(empty($login)) { + $this->ERROR = "POP3 apop: " . _("No login ID submitted"); + return false; + } elseif(empty($pass)) { + $this->ERROR = "POP3 apop: " . _("No password submitted"); + return false; + } else { + $banner = $this->BANNER; + if( (!$banner) or (empty($banner)) ) { + $this->ERROR = "POP3 apop: " . _("No server banner") . ' - ' . _("abort"); + $retVal = $this->login($login,$pass); + return $retVal; + } else { + $AuthString = $banner; + $AuthString .= $pass; + $APOPString = md5($AuthString); + $cmd = "APOP $login $APOPString"; + $reply = $this->send_cmd($cmd); + if(!$this->is_ok($reply)) { + $this->ERROR = "POP3 apop: " . _("apop authentication failed") . ' - ' . _("abort"); + $retVal = $this->login($login,$pass); + return $retVal; + } else { + // Auth successful. + $count = $this->last("count"); + $this->COUNT = $count; + return $count; + } + } + } + } + + function login ($login = "", $pass = "") { + // Sends both user and pass. Returns # of msgs in mailbox or + // false on failure (or -1, if the error occurs while getting + // the number of messages.) + + if( !isset($this->FP) ) { + $this->ERROR = "POP3 login: " . _("No connection to server"); + return false; + } else { + $fp = $this->FP; + if( !$this->user( $login ) ) { + // Preserve the error generated by user() + return false; + } else { + $count = $this->pass($pass); + if( (!$count) || ($count == -1) ) { + // Preserve the error generated by last() and pass() + return false; + } else + return $count; + } + } + } + + function top ($msgNum, $numLines = "0") { + // Gets the header and first $numLines of the msg body + // returns data in an array with each returned line being + // an array element. If $numLines is empty, returns + // only the header information, and none of the body. + + if(!isset($this->FP)) { + $this->ERROR = "POP3 top: " . _("No connection to server"); + return false; + } + $this->update_timer(); + + $fp = $this->FP; + $buffer = $this->BUFFER; + $cmd = "TOP $msgNum $numLines"; + fwrite($fp, "TOP $msgNum $numLines\r\n"); + $reply = fgets($fp, $buffer); + $reply = $this->strip_clf($reply); + if($this->DEBUG) { + @error_log("POP3 SEND [$cmd] GOT [$reply]",0); + } + if(!$this->is_ok($reply)) + { + $this->ERROR = "POP3 top: " . _("Error ") . "[$reply]"; + return false; + } + + $count = 0; + $MsgArray = array(); + + $line = fgets($fp,$buffer); + while ( !preg_match('/^\.\r\n/',$line)) + { + $MsgArray[$count] = $line; + $count++; + $line = fgets($fp,$buffer); + if(empty($line)) { break; } + } + + return $MsgArray; + } + + function pop_list ($msgNum = "") { + // If called with an argument, returns that msgs' size in octets + // No argument returns an associative array of undeleted + // msg numbers and their sizes in octets + + if(!isset($this->FP)) + { + $this->ERROR = "POP3 pop_list: " . _("No connection to server"); + return false; + } + $fp = $this->FP; + $Total = $this->COUNT; + if( (!$Total) or ($Total == -1) ) + { + return false; + } + if($Total == 0) + { + return array("0","0"); + // return -1; // mailbox empty + } + + $this->update_timer(); + + if(!empty($msgNum)) + { + $cmd = "LIST $msgNum"; + fwrite($fp,"$cmd\r\n"); + $reply = fgets($fp,$this->BUFFER); + $reply = $this->strip_clf($reply); + if($this->DEBUG) { + @error_log("POP3 SEND [$cmd] GOT [$reply]",0); + } + if(!$this->is_ok($reply)) + { + $this->ERROR = "POP3 pop_list: " . _("Error ") . "[$reply]"; + return false; + } + list($junk,$num,$size) = preg_split('/\s+/',$reply); + return $size; + } + $cmd = "LIST"; + $reply = $this->send_cmd($cmd); + if(!$this->is_ok($reply)) + { + $reply = $this->strip_clf($reply); + $this->ERROR = "POP3 pop_list: " . _("Error ") . "[$reply]"; + return false; + } + $MsgArray = array(); + $MsgArray[0] = $Total; + for($msgC=1;$msgC <= $Total; $msgC++) + { + if($msgC > $Total) { break; } + $line = fgets($fp,$this->BUFFER); + $line = $this->strip_clf($line); + if(strpos($line, '.') === 0) + { + $this->ERROR = "POP3 pop_list: " . _("Premature end of list"); + return false; + } + list($thisMsg,$msgSize) = preg_split('/\s+/',$line); + settype($thisMsg,"integer"); + if($thisMsg != $msgC) + { + $MsgArray[$msgC] = "deleted"; + } + else + { + $MsgArray[$msgC] = $msgSize; + } + } + return $MsgArray; + } + + function get ($msgNum) { + // Retrieve the specified msg number. Returns an array + // where each line of the msg is an array element. + + if(!isset($this->FP)) + { + $this->ERROR = "POP3 get: " . _("No connection to server"); + return false; + } + + $this->update_timer(); + + $fp = $this->FP; + $buffer = $this->BUFFER; + $cmd = "RETR $msgNum"; + $reply = $this->send_cmd($cmd); + + if(!$this->is_ok($reply)) + { + $this->ERROR = "POP3 get: " . _("Error ") . "[$reply]"; + return false; + } + + $count = 0; + $MsgArray = array(); + + $line = fgets($fp,$buffer); + while ( !preg_match('/^\.\r\n/',$line)) + { + if ( $line{0} == '.' ) { $line = substr($line,1); } + $MsgArray[$count] = $line; + $count++; + $line = fgets($fp,$buffer); + if(empty($line)) { break; } + } + return $MsgArray; + } + + function last ( $type = "count" ) { + // Returns the highest msg number in the mailbox. + // returns -1 on error, 0+ on success, if type != count + // results in a popstat() call (2 element array returned) + + $last = -1; + if(!isset($this->FP)) + { + $this->ERROR = "POP3 last: " . _("No connection to server"); + return $last; + } + + $reply = $this->send_cmd("STAT"); + if(!$this->is_ok($reply)) + { + $this->ERROR = "POP3 last: " . _("Error ") . "[$reply]"; + return $last; + } + + $Vars = preg_split('/\s+/',$reply); + $count = $Vars[1]; + $size = $Vars[2]; + settype($count,"integer"); + settype($size,"integer"); + if($type != "count") + { + return array($count,$size); + } + return $count; + } + + function reset () { + // Resets the status of the remote server. This includes + // resetting the status of ALL msgs to not be deleted. + // This method automatically closes the connection to the server. + + if(!isset($this->FP)) + { + $this->ERROR = "POP3 reset: " . _("No connection to server"); + return false; + } + $reply = $this->send_cmd("RSET"); + if(!$this->is_ok($reply)) + { + // The POP3 RSET command -never- gives a -ERR + // response - if it ever does, something truely + // wild is going on. + + $this->ERROR = "POP3 reset: " . _("Error ") . "[$reply]"; + @error_log("POP3 reset: ERROR [$reply]",0); + } + $this->quit(); + return true; + } + + function send_cmd ( $cmd = "" ) + { + // Sends a user defined command string to the + // POP server and returns the results. Useful for + // non-compliant or custom POP servers. + // Do NOT includ the \r\n as part of your command + // string - it will be appended automatically. + + // The return value is a standard fgets() call, which + // will read up to $this->BUFFER bytes of data, until it + // encounters a new line, or EOF, whichever happens first. + + // This method works best if $cmd responds with only + // one line of data. + + if(!isset($this->FP)) + { + $this->ERROR = "POP3 send_cmd: " . _("No connection to server"); + return false; + } + + if(empty($cmd)) + { + $this->ERROR = "POP3 send_cmd: " . _("Empty command string"); + return ""; + } + + $fp = $this->FP; + $buffer = $this->BUFFER; + $this->update_timer(); + fwrite($fp,"$cmd\r\n"); + $reply = fgets($fp,$buffer); + $reply = $this->strip_clf($reply); + if($this->DEBUG) { @error_log("POP3 SEND [$cmd] GOT [$reply]",0); } + return $reply; + } + + function quit() { + // Closes the connection to the POP3 server, deleting + // any msgs marked as deleted. + + if(!isset($this->FP)) + { + $this->ERROR = "POP3 quit: " . _("connection does not exist"); + return false; + } + $fp = $this->FP; + $cmd = "QUIT"; + fwrite($fp,"$cmd\r\n"); + $reply = fgets($fp,$this->BUFFER); + $reply = $this->strip_clf($reply); + if($this->DEBUG) { @error_log("POP3 SEND [$cmd] GOT [$reply]",0); } + fclose($fp); + unset($this->FP); + return true; + } + + function popstat () { + // Returns an array of 2 elements. The number of undeleted + // msgs in the mailbox, and the size of the mbox in octets. + + $PopArray = $this->last("array"); + + if($PopArray == -1) { return false; } + + if( (!$PopArray) or (empty($PopArray)) ) + { + return false; + } + return $PopArray; + } + + function uidl ($msgNum = "") + { + // Returns the UIDL of the msg specified. If called with + // no arguments, returns an associative array where each + // undeleted msg num is a key, and the msg's uidl is the element + // Array element 0 will contain the total number of msgs + + if(!isset($this->FP)) { + $this->ERROR = "POP3 uidl: " . _("No connection to server"); + return false; + } + + $fp = $this->FP; + $buffer = $this->BUFFER; + + if(!empty($msgNum)) { + $cmd = "UIDL $msgNum"; + $reply = $this->send_cmd($cmd); + if(!$this->is_ok($reply)) + { + $this->ERROR = "POP3 uidl: " . _("Error ") . "[$reply]"; + return false; + } + list ($ok,$num,$myUidl) = preg_split('/\s+/',$reply); + return $myUidl; + } else { + $this->update_timer(); + + $UIDLArray = array(); + $Total = $this->COUNT; + $UIDLArray[0] = $Total; + + if ($Total < 1) + { + return $UIDLArray; + } + $cmd = "UIDL"; + fwrite($fp, "UIDL\r\n"); + $reply = fgets($fp, $buffer); + $reply = $this->strip_clf($reply); + if($this->DEBUG) { @error_log("POP3 SEND [$cmd] GOT [$reply]",0); } + if(!$this->is_ok($reply)) + { + $this->ERROR = "POP3 uidl: " . _("Error ") . "[$reply]"; + return false; + } + + $line = ""; + $count = 1; + $line = fgets($fp,$buffer); + while ( !preg_match('/^\.\r\n/',$line)) { + list ($msg,$msgUidl) = preg_split('/\s+/',$line); + $msgUidl = $this->strip_clf($msgUidl); + if($count == $msg) { + $UIDLArray[$msg] = $msgUidl; + } + else + { + $UIDLArray[$count] = 'deleted'; + } + $count++; + $line = fgets($fp,$buffer); + } + } + return $UIDLArray; + } + + function delete ($msgNum = "") { + // Flags a specified msg as deleted. The msg will not + // be deleted until a quit() method is called. + + if(!isset($this->FP)) + { + $this->ERROR = "POP3 delete: " . _("No connection to server"); + return false; + } + if(empty($msgNum)) + { + $this->ERROR = "POP3 delete: " . _("No msg number submitted"); + return false; + } + $reply = $this->send_cmd("DELE $msgNum"); + if(!$this->is_ok($reply)) + { + $this->ERROR = "POP3 delete: " . _("Command failed ") . "[$reply]"; + return false; + } + return true; + } + + // ********************************************************* + + // The following methods are internal to the class. + + function is_ok ($cmd = "") { + // Return true or false on +OK or -ERR + + if( empty($cmd) ) + return false; + else + return( stripos($cmd, '+OK') !== false ); + } + + function strip_clf ($text = "") { + // Strips \r\n from server responses + + if(empty($text)) + return $text; + else { + $stripped = str_replace(array("\r","\n"),'',$text); + return $stripped; + } + } + + function parse_banner ( $server_text ) { + $outside = true; + $banner = ""; + $length = strlen($server_text); + for($count =0; $count < $length; $count++) + { + $digit = substr($server_text,$count,1); + if(!empty($digit)) { + if( (!$outside) && ($digit != '<') && ($digit != '>') ) + { + $banner .= $digit; + } + if ($digit == '<') + { + $outside = false; + } + if($digit == '>') + { + $outside = true; + } + } + } + $banner = $this->strip_clf($banner); // Just in case + return "<$banner>"; + } + +} // End class + +// For php4 compatibility +if (!function_exists("stripos")) { + function stripos($haystack, $needle){ + return strpos($haystack, stristr( $haystack, $needle )); + } +} diff --git a/src/wp-includes/class-simplepie.php b/src/wp-includes/class-simplepie.php new file mode 100644 index 0000000..275033a --- /dev/null +++ b/src/wp-includes/class-simplepie.php @@ -0,0 +1,15002 @@ +' . SIMPLEPIE_NAME . ''); + +/** + * No Autodiscovery + * @see SimplePie::set_autodiscovery_level() + */ +define('SIMPLEPIE_LOCATOR_NONE', 0); + +/** + * Feed Link Element Autodiscovery + * @see SimplePie::set_autodiscovery_level() + */ +define('SIMPLEPIE_LOCATOR_AUTODISCOVERY', 1); + +/** + * Local Feed Extension Autodiscovery + * @see SimplePie::set_autodiscovery_level() + */ +define('SIMPLEPIE_LOCATOR_LOCAL_EXTENSION', 2); + +/** + * Local Feed Body Autodiscovery + * @see SimplePie::set_autodiscovery_level() + */ +define('SIMPLEPIE_LOCATOR_LOCAL_BODY', 4); + +/** + * Remote Feed Extension Autodiscovery + * @see SimplePie::set_autodiscovery_level() + */ +define('SIMPLEPIE_LOCATOR_REMOTE_EXTENSION', 8); + +/** + * Remote Feed Body Autodiscovery + * @see SimplePie::set_autodiscovery_level() + */ +define('SIMPLEPIE_LOCATOR_REMOTE_BODY', 16); + +/** + * All Feed Autodiscovery + * @see SimplePie::set_autodiscovery_level() + */ +define('SIMPLEPIE_LOCATOR_ALL', 31); + +/** + * No known feed type + */ +define('SIMPLEPIE_TYPE_NONE', 0); + +/** + * RSS 0.90 + */ +define('SIMPLEPIE_TYPE_RSS_090', 1); + +/** + * RSS 0.91 (Netscape) + */ +define('SIMPLEPIE_TYPE_RSS_091_NETSCAPE', 2); + +/** + * RSS 0.91 (Userland) + */ +define('SIMPLEPIE_TYPE_RSS_091_USERLAND', 4); + +/** + * RSS 0.91 (both Netscape and Userland) + */ +define('SIMPLEPIE_TYPE_RSS_091', 6); + +/** + * RSS 0.92 + */ +define('SIMPLEPIE_TYPE_RSS_092', 8); + +/** + * RSS 0.93 + */ +define('SIMPLEPIE_TYPE_RSS_093', 16); + +/** + * RSS 0.94 + */ +define('SIMPLEPIE_TYPE_RSS_094', 32); + +/** + * RSS 1.0 + */ +define('SIMPLEPIE_TYPE_RSS_10', 64); + +/** + * RSS 2.0 + */ +define('SIMPLEPIE_TYPE_RSS_20', 128); + +/** + * RDF-based RSS + */ +define('SIMPLEPIE_TYPE_RSS_RDF', 65); + +/** + * Non-RDF-based RSS (truly intended as syndication format) + */ +define('SIMPLEPIE_TYPE_RSS_SYNDICATION', 190); + +/** + * All RSS + */ +define('SIMPLEPIE_TYPE_RSS_ALL', 255); + +/** + * Atom 0.3 + */ +define('SIMPLEPIE_TYPE_ATOM_03', 256); + +/** + * Atom 1.0 + */ +define('SIMPLEPIE_TYPE_ATOM_10', 512); + +/** + * All Atom + */ +define('SIMPLEPIE_TYPE_ATOM_ALL', 768); + +/** + * All feed types + */ +define('SIMPLEPIE_TYPE_ALL', 1023); + +/** + * No construct + */ +define('SIMPLEPIE_CONSTRUCT_NONE', 0); + +/** + * Text construct + */ +define('SIMPLEPIE_CONSTRUCT_TEXT', 1); + +/** + * HTML construct + */ +define('SIMPLEPIE_CONSTRUCT_HTML', 2); + +/** + * XHTML construct + */ +define('SIMPLEPIE_CONSTRUCT_XHTML', 4); + +/** + * base64-encoded construct + */ +define('SIMPLEPIE_CONSTRUCT_BASE64', 8); + +/** + * IRI construct + */ +define('SIMPLEPIE_CONSTRUCT_IRI', 16); + +/** + * A construct that might be HTML + */ +define('SIMPLEPIE_CONSTRUCT_MAYBE_HTML', 32); + +/** + * All constructs + */ +define('SIMPLEPIE_CONSTRUCT_ALL', 63); + +/** + * Don't change case + */ +define('SIMPLEPIE_SAME_CASE', 1); + +/** + * Change to lowercase + */ +define('SIMPLEPIE_LOWERCASE', 2); + +/** + * Change to uppercase + */ +define('SIMPLEPIE_UPPERCASE', 4); + +/** + * PCRE for HTML attributes + */ +define('SIMPLEPIE_PCRE_HTML_ATTRIBUTE', '((?:[\x09\x0A\x0B\x0C\x0D\x20]+[^\x09\x0A\x0B\x0C\x0D\x20\x2F\x3E][^\x09\x0A\x0B\x0C\x0D\x20\x2F\x3D\x3E]*(?:[\x09\x0A\x0B\x0C\x0D\x20]*=[\x09\x0A\x0B\x0C\x0D\x20]*(?:"(?:[^"]*)"|\'(?:[^\']*)\'|(?:[^\x09\x0A\x0B\x0C\x0D\x20\x22\x27\x3E][^\x09\x0A\x0B\x0C\x0D\x20\x3E]*)?))?)*)[\x09\x0A\x0B\x0C\x0D\x20]*'); + +/** + * PCRE for XML attributes + */ +define('SIMPLEPIE_PCRE_XML_ATTRIBUTE', '((?:\s+(?:(?:[^\s:]+:)?[^\s:]+)\s*=\s*(?:"(?:[^"]*)"|\'(?:[^\']*)\'))*)\s*'); + +/** + * XML Namespace + */ +define('SIMPLEPIE_NAMESPACE_XML', 'http://www.w3.org/XML/1998/namespace'); + +/** + * Atom 1.0 Namespace + */ +define('SIMPLEPIE_NAMESPACE_ATOM_10', 'http://www.w3.org/2005/Atom'); + +/** + * Atom 0.3 Namespace + */ +define('SIMPLEPIE_NAMESPACE_ATOM_03', 'http://purl.org/atom/ns#'); + +/** + * RDF Namespace + */ +define('SIMPLEPIE_NAMESPACE_RDF', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'); + +/** + * RSS 0.90 Namespace + */ +define('SIMPLEPIE_NAMESPACE_RSS_090', 'http://my.netscape.com/rdf/simple/0.9/'); + +/** + * RSS 1.0 Namespace + */ +define('SIMPLEPIE_NAMESPACE_RSS_10', 'http://purl.org/rss/1.0/'); + +/** + * RSS 1.0 Content Module Namespace + */ +define('SIMPLEPIE_NAMESPACE_RSS_10_MODULES_CONTENT', 'http://purl.org/rss/1.0/modules/content/'); + +/** + * RSS 2.0 Namespace + * (Stupid, I know, but I'm certain it will confuse people less with support.) + */ +define('SIMPLEPIE_NAMESPACE_RSS_20', ''); + +/** + * DC 1.0 Namespace + */ +define('SIMPLEPIE_NAMESPACE_DC_10', 'http://purl.org/dc/elements/1.0/'); + +/** + * DC 1.1 Namespace + */ +define('SIMPLEPIE_NAMESPACE_DC_11', 'http://purl.org/dc/elements/1.1/'); + +/** + * W3C Basic Geo (WGS84 lat/long) Vocabulary Namespace + */ +define('SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO', 'http://www.w3.org/2003/01/geo/wgs84_pos#'); + +/** + * GeoRSS Namespace + */ +define('SIMPLEPIE_NAMESPACE_GEORSS', 'http://www.georss.org/georss'); + +/** + * Media RSS Namespace + */ +define('SIMPLEPIE_NAMESPACE_MEDIARSS', 'http://search.yahoo.com/mrss/'); + +/** + * Wrong Media RSS Namespace + */ +define('SIMPLEPIE_NAMESPACE_MEDIARSS_WRONG', 'http://search.yahoo.com/mrss'); + +/** + * iTunes RSS Namespace + */ +define('SIMPLEPIE_NAMESPACE_ITUNES', 'http://www.itunes.com/dtds/podcast-1.0.dtd'); + +/** + * XHTML Namespace + */ +define('SIMPLEPIE_NAMESPACE_XHTML', 'http://www.w3.org/1999/xhtml'); + +/** + * IANA Link Relations Registry + */ +define('SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY', 'http://www.iana.org/assignments/relation/'); + +/** + * Whether we're running on PHP5 + */ +define('SIMPLEPIE_PHP5', version_compare(PHP_VERSION, '5.0.0', '>=')); + +/** + * No file source + */ +define('SIMPLEPIE_FILE_SOURCE_NONE', 0); + +/** + * Remote file source + */ +define('SIMPLEPIE_FILE_SOURCE_REMOTE', 1); + +/** + * Local file source + */ +define('SIMPLEPIE_FILE_SOURCE_LOCAL', 2); + +/** + * fsockopen() file source + */ +define('SIMPLEPIE_FILE_SOURCE_FSOCKOPEN', 4); + +/** + * cURL file source + */ +define('SIMPLEPIE_FILE_SOURCE_CURL', 8); + +/** + * file_get_contents() file source + */ +define('SIMPLEPIE_FILE_SOURCE_FILE_GET_CONTENTS', 16); + +/** + * SimplePie + * + * @package SimplePie + */ +class SimplePie +{ + /** + * @var array Raw data + * @access private + */ + var $data = array(); + + /** + * @var mixed Error string + * @access private + */ + var $error; + + /** + * @var object Instance of SimplePie_Sanitize (or other class) + * @see SimplePie::set_sanitize_class() + * @access private + */ + var $sanitize; + + /** + * @var string SimplePie Useragent + * @see SimplePie::set_useragent() + * @access private + */ + var $useragent = SIMPLEPIE_USERAGENT; + + /** + * @var string Feed URL + * @see SimplePie::set_feed_url() + * @access private + */ + var $feed_url; + + /** + * @var object Instance of SimplePie_File to use as a feed + * @see SimplePie::set_file() + * @access private + */ + var $file; + + /** + * @var string Raw feed data + * @see SimplePie::set_raw_data() + * @access private + */ + var $raw_data; + + /** + * @var int Timeout for fetching remote files + * @see SimplePie::set_timeout() + * @access private + */ + var $timeout = 10; + + /** + * @var bool Forces fsockopen() to be used for remote files instead + * of cURL, even if a new enough version is installed + * @see SimplePie::force_fsockopen() + * @access private + */ + var $force_fsockopen = false; + + /** + * @var bool Force the given data/URL to be treated as a feed no matter what + * it appears like + * @see SimplePie::force_feed() + * @access private + */ + var $force_feed = false; + + /** + * @var bool Enable/Disable XML dump + * @see SimplePie::enable_xml_dump() + * @access private + */ + var $xml_dump = false; + + /** + * @var bool Enable/Disable Caching + * @see SimplePie::enable_cache() + * @access private + */ + var $cache = true; + + /** + * @var int Cache duration (in seconds) + * @see SimplePie::set_cache_duration() + * @access private + */ + var $cache_duration = 3600; + + /** + * @var int Auto-discovery cache duration (in seconds) + * @see SimplePie::set_autodiscovery_cache_duration() + * @access private + */ + var $autodiscovery_cache_duration = 604800; // 7 Days. + + /** + * @var string Cache location (relative to executing script) + * @see SimplePie::set_cache_location() + * @access private + */ + var $cache_location = './cache'; + + /** + * @var string Function that creates the cache filename + * @see SimplePie::set_cache_name_function() + * @access private + */ + var $cache_name_function = 'md5'; + + /** + * @var bool Reorder feed by date descending + * @see SimplePie::enable_order_by_date() + * @access private + */ + var $order_by_date = true; + + /** + * @var mixed Force input encoding to be set to the follow value + * (false, or anything type-cast to false, disables this feature) + * @see SimplePie::set_input_encoding() + * @access private + */ + var $input_encoding = false; + + /** + * @var int Feed Autodiscovery Level + * @see SimplePie::set_autodiscovery_level() + * @access private + */ + var $autodiscovery = SIMPLEPIE_LOCATOR_ALL; + + /** + * @var string Class used for caching feeds + * @see SimplePie::set_cache_class() + * @access private + */ + var $cache_class = 'SimplePie_Cache'; + + /** + * @var string Class used for locating feeds + * @see SimplePie::set_locator_class() + * @access private + */ + var $locator_class = 'SimplePie_Locator'; + + /** + * @var string Class used for parsing feeds + * @see SimplePie::set_parser_class() + * @access private + */ + var $parser_class = 'SimplePie_Parser'; + + /** + * @var string Class used for fetching feeds + * @see SimplePie::set_file_class() + * @access private + */ + var $file_class = 'SimplePie_File'; + + /** + * @var string Class used for items + * @see SimplePie::set_item_class() + * @access private + */ + var $item_class = 'SimplePie_Item'; + + /** + * @var string Class used for authors + * @see SimplePie::set_author_class() + * @access private + */ + var $author_class = 'SimplePie_Author'; + + /** + * @var string Class used for categories + * @see SimplePie::set_category_class() + * @access private + */ + var $category_class = 'SimplePie_Category'; + + /** + * @var string Class used for enclosures + * @see SimplePie::set_enclosures_class() + * @access private + */ + var $enclosure_class = 'SimplePie_Enclosure'; + + /** + * @var string Class used for Media RSS captions + * @see SimplePie::set_caption_class() + * @access private + */ + var $caption_class = 'SimplePie_Caption'; + + /** + * @var string Class used for Media RSS + * @see SimplePie::set_copyright_class() + * @access private + */ + var $copyright_class = 'SimplePie_Copyright'; + + /** + * @var string Class used for Media RSS + * @see SimplePie::set_credit_class() + * @access private + */ + var $credit_class = 'SimplePie_Credit'; + + /** + * @var string Class used for Media RSS + * @see SimplePie::set_rating_class() + * @access private + */ + var $rating_class = 'SimplePie_Rating'; + + /** + * @var string Class used for Media RSS + * @see SimplePie::set_restriction_class() + * @access private + */ + var $restriction_class = 'SimplePie_Restriction'; + + /** + * @var string Class used for content-type sniffing + * @see SimplePie::set_content_type_sniffer_class() + * @access private + */ + var $content_type_sniffer_class = 'SimplePie_Content_Type_Sniffer'; + + /** + * @var string Class used for item sources. + * @see SimplePie::set_source_class() + * @access private + */ + var $source_class = 'SimplePie_Source'; + + /** + * @var mixed Set javascript query string parameter (false, or + * anything type-cast to false, disables this feature) + * @see SimplePie::set_javascript() + * @access private + */ + var $javascript = 'js'; + + /** + * @var int Maximum number of feeds to check with autodiscovery + * @see SimplePie::set_max_checked_feeds() + * @access private + */ + var $max_checked_feeds = 10; + + /** + * @var array All the feeds found during the autodiscovery process + * @see SimplePie::get_all_discovered_feeds() + * @access private + */ + var $all_discovered_feeds = array(); + + /** + * @var string Web-accessible path to the handler_favicon.php file. + * @see SimplePie::set_favicon_handler() + * @access private + */ + var $favicon_handler = ''; + + /** + * @var string Web-accessible path to the handler_image.php file. + * @see SimplePie::set_image_handler() + * @access private + */ + var $image_handler = ''; + + /** + * @var array Stores the URLs when multiple feeds are being initialized. + * @see SimplePie::set_feed_url() + * @access private + */ + var $multifeed_url = array(); + + /** + * @var array Stores SimplePie objects when multiple feeds initialized. + * @access private + */ + var $multifeed_objects = array(); + + /** + * @var array Stores the get_object_vars() array for use with multifeeds. + * @see SimplePie::set_feed_url() + * @access private + */ + var $config_settings = null; + + /** + * @var integer Stores the number of items to return per-feed with multifeeds. + * @see SimplePie::set_item_limit() + * @access private + */ + var $item_limit = 0; + + /** + * @var array Stores the default attributes to be stripped by strip_attributes(). + * @see SimplePie::strip_attributes() + * @access private + */ + var $strip_attributes = array('bgsound', 'class', 'expr', 'id', 'style', 'onclick', 'onerror', 'onfinish', 'onmouseover', 'onmouseout', 'onfocus', 'onblur', 'lowsrc', 'dynsrc'); + + /** + * @var array Stores the default tags to be stripped by strip_htmltags(). + * @see SimplePie::strip_htmltags() + * @access private + */ + var $strip_htmltags = array('base', 'blink', 'body', 'doctype', 'embed', 'font', 'form', 'frame', 'frameset', 'html', 'iframe', 'input', 'marquee', 'meta', 'noscript', 'object', 'param', 'script', 'style'); + + /** + * The SimplePie class contains feed level data and options + * + * There are two ways that you can create a new SimplePie object. The first + * is by passing a feed URL as a parameter to the SimplePie constructor + * (as well as optionally setting the cache location and cache expiry). This + * will initialise the whole feed with all of the default settings, and you + * can begin accessing methods and properties immediately. + * + * The second way is to create the SimplePie object with no parameters + * at all. This will enable you to set configuration options. After setting + * them, you must initialise the feed using $feed->init(). At that point the + * object's methods and properties will be available to you. This format is + * what is used throughout this documentation. + * + * @access public + * @since 1.0 Preview Release + * @param string $feed_url This is the URL you want to parse. + * @param string $cache_location This is where you want the cache to be stored. + * @param int $cache_duration This is the number of seconds that you want to store the cache file for. + */ + function SimplePie($feed_url = null, $cache_location = null, $cache_duration = null) + { + // Other objects, instances created here so we can set options on them + $this->sanitize =& new SimplePie_Sanitize; + + // Set options if they're passed to the constructor + if ($cache_location !== null) + { + $this->set_cache_location($cache_location); + } + + if ($cache_duration !== null) + { + $this->set_cache_duration($cache_duration); + } + + // Only init the script if we're passed a feed URL + if ($feed_url !== null) + { + $this->set_feed_url($feed_url); + $this->init(); + } + } + + /** + * Used for converting object to a string + */ + function __toString() + { + return md5(serialize($this->data)); + } + + /** + * Remove items that link back to this before destroying this object + */ + function __destruct() + { + if ((version_compare(PHP_VERSION, '5.3', '<') || !gc_enabled()) && !ini_get('zend.ze1_compatibility_mode')) + { + if (!empty($this->data['items'])) + { + foreach ($this->data['items'] as $item) + { + $item->__destruct(); + } + unset($item, $this->data['items']); + } + if (!empty($this->data['ordered_items'])) + { + foreach ($this->data['ordered_items'] as $item) + { + $item->__destruct(); + } + unset($item, $this->data['ordered_items']); + } + } + } + + /** + * Force the given data/URL to be treated as a feed no matter what it + * appears like + * + * @access public + * @since 1.1 + * @param bool $enable Force the given data/URL to be treated as a feed + */ + function force_feed($enable = false) + { + $this->force_feed = (bool) $enable; + } + + /** + * This is the URL of the feed you want to parse. + * + * This allows you to enter the URL of the feed you want to parse, or the + * website you want to try to use auto-discovery on. This takes priority + * over any set raw data. + * + * You can set multiple feeds to mash together by passing an array instead + * of a string for the $url. Remember that with each additional feed comes + * additional processing and resources. + * + * @access public + * @since 1.0 Preview Release + * @param mixed $url This is the URL (or array of URLs) that you want to parse. + * @see SimplePie::set_raw_data() + */ + function set_feed_url($url) + { + if (is_array($url)) + { + $this->multifeed_url = array(); + foreach ($url as $value) + { + $this->multifeed_url[] = SimplePie_Misc::fix_protocol($value, 1); + } + } + else + { + $this->feed_url = SimplePie_Misc::fix_protocol($url, 1); + } + } + + /** + * Provides an instance of SimplePie_File to use as a feed + * + * @access public + * @param object &$file Instance of SimplePie_File (or subclass) + * @return bool True on success, false on failure + */ + function set_file(&$file) + { + if (is_a($file, 'SimplePie_File')) + { + $this->feed_url = $file->url; + $this->file =& $file; + return true; + } + return false; + } + + /** + * Allows you to use a string of RSS/Atom data instead of a remote feed. + * + * If you have a feed available as a string in PHP, you can tell SimplePie + * to parse that data string instead of a remote feed. Any set feed URL + * takes precedence. + * + * @access public + * @since 1.0 Beta 3 + * @param string $data RSS or Atom data as a string. + * @see SimplePie::set_feed_url() + */ + function set_raw_data($data) + { + $this->raw_data = $data; + } + + /** + * Allows you to override the default timeout for fetching remote feeds. + * + * This allows you to change the maximum time the feed's server to respond + * and send the feed back. + * + * @access public + * @since 1.0 Beta 3 + * @param int $timeout The maximum number of seconds to spend waiting to retrieve a feed. + */ + function set_timeout($timeout = 10) + { + $this->timeout = (int) $timeout; + } + + /** + * Forces SimplePie to use fsockopen() instead of the preferred cURL + * functions. + * + * @access public + * @since 1.0 Beta 3 + * @param bool $enable Force fsockopen() to be used + */ + function force_fsockopen($enable = false) + { + $this->force_fsockopen = (bool) $enable; + } + + /** + * Outputs the raw XML content of the feed, after it has gone through + * SimplePie's filters. + * + * Used only for debugging, this function will output the XML content as + * text/xml. When SimplePie reads in a feed, it does a bit of cleaning up + * before trying to parse it. Many parts of the feed are re-written in + * memory, and in the end, you have a parsable feed. XML dump shows you the + * actual XML that SimplePie tries to parse, which may or may not be very + * different from the original feed. + * + * @access public + * @since 1.0 Preview Release + * @param bool $enable Enable XML dump + */ + function enable_xml_dump($enable = false) + { + $this->xml_dump = (bool) $enable; + } + + /** + * Enables/disables caching in SimplePie. + * + * This option allows you to disable caching all-together in SimplePie. + * However, disabling the cache can lead to longer load times. + * + * @access public + * @since 1.0 Preview Release + * @param bool $enable Enable caching + */ + function enable_cache($enable = true) + { + $this->cache = (bool) $enable; + } + + /** + * Set the length of time (in seconds) that the contents of a feed + * will be cached. + * + * @access public + * @param int $seconds The feed content cache duration. + */ + function set_cache_duration($seconds = 3600) + { + $this->cache_duration = (int) $seconds; + } + + /** + * Set the length of time (in seconds) that the autodiscovered feed + * URL will be cached. + * + * @access public + * @param int $seconds The autodiscovered feed URL cache duration. + */ + function set_autodiscovery_cache_duration($seconds = 604800) + { + $this->autodiscovery_cache_duration = (int) $seconds; + } + + /** + * Set the file system location where the cached files should be stored. + * + * @access public + * @param string $location The file system location. + */ + function set_cache_location($location = './cache') + { + $this->cache_location = (string) $location; + } + + /** + * Determines whether feed items should be sorted into reverse chronological order. + * + * @access public + * @param bool $enable Sort as reverse chronological order. + */ + function enable_order_by_date($enable = true) + { + $this->order_by_date = (bool) $enable; + } + + /** + * Allows you to override the character encoding reported by the feed. + * + * @access public + * @param string $encoding Character encoding. + */ + function set_input_encoding($encoding = false) + { + if ($encoding) + { + $this->input_encoding = (string) $encoding; + } + else + { + $this->input_encoding = false; + } + } + + /** + * Set how much feed autodiscovery to do + * + * @access public + * @see SIMPLEPIE_LOCATOR_NONE + * @see SIMPLEPIE_LOCATOR_AUTODISCOVERY + * @see SIMPLEPIE_LOCATOR_LOCAL_EXTENSION + * @see SIMPLEPIE_LOCATOR_LOCAL_BODY + * @see SIMPLEPIE_LOCATOR_REMOTE_EXTENSION + * @see SIMPLEPIE_LOCATOR_REMOTE_BODY + * @see SIMPLEPIE_LOCATOR_ALL + * @param int $level Feed Autodiscovery Level (level can be a + * combination of the above constants, see bitwise OR operator) + */ + function set_autodiscovery_level($level = SIMPLEPIE_LOCATOR_ALL) + { + $this->autodiscovery = (int) $level; + } + + /** + * Allows you to change which class SimplePie uses for caching. + * Useful when you are overloading or extending SimplePie's default classes. + * + * @access public + * @param string $class Name of custom class. + * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation + * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation + */ + function set_cache_class($class = 'SimplePie_Cache') + { + if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Cache')) + { + $this->cache_class = $class; + return true; + } + return false; + } + + /** + * Allows you to change which class SimplePie uses for auto-discovery. + * Useful when you are overloading or extending SimplePie's default classes. + * + * @access public + * @param string $class Name of custom class. + * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation + * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation + */ + function set_locator_class($class = 'SimplePie_Locator') + { + if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Locator')) + { + $this->locator_class = $class; + return true; + } + return false; + } + + /** + * Allows you to change which class SimplePie uses for XML parsing. + * Useful when you are overloading or extending SimplePie's default classes. + * + * @access public + * @param string $class Name of custom class. + * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation + * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation + */ + function set_parser_class($class = 'SimplePie_Parser') + { + if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Parser')) + { + $this->parser_class = $class; + return true; + } + return false; + } + + /** + * Allows you to change which class SimplePie uses for remote file fetching. + * Useful when you are overloading or extending SimplePie's default classes. + * + * @access public + * @param string $class Name of custom class. + * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation + * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation + */ + function set_file_class($class = 'SimplePie_File') + { + if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_File')) + { + $this->file_class = $class; + return true; + } + return false; + } + + /** + * Allows you to change which class SimplePie uses for data sanitization. + * Useful when you are overloading or extending SimplePie's default classes. + * + * @access public + * @param string $class Name of custom class. + * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation + * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation + */ + function set_sanitize_class($class = 'SimplePie_Sanitize') + { + if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Sanitize')) + { + $this->sanitize =& new $class; + return true; + } + return false; + } + + /** + * Allows you to change which class SimplePie uses for handling feed items. + * Useful when you are overloading or extending SimplePie's default classes. + * + * @access public + * @param string $class Name of custom class. + * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation + * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation + */ + function set_item_class($class = 'SimplePie_Item') + { + if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Item')) + { + $this->item_class = $class; + return true; + } + return false; + } + + /** + * Allows you to change which class SimplePie uses for handling author data. + * Useful when you are overloading or extending SimplePie's default classes. + * + * @access public + * @param string $class Name of custom class. + * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation + * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation + */ + function set_author_class($class = 'SimplePie_Author') + { + if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Author')) + { + $this->author_class = $class; + return true; + } + return false; + } + + /** + * Allows you to change which class SimplePie uses for handling category data. + * Useful when you are overloading or extending SimplePie's default classes. + * + * @access public + * @param string $class Name of custom class. + * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation + * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation + */ + function set_category_class($class = 'SimplePie_Category') + { + if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Category')) + { + $this->category_class = $class; + return true; + } + return false; + } + + /** + * Allows you to change which class SimplePie uses for feed enclosures. + * Useful when you are overloading or extending SimplePie's default classes. + * + * @access public + * @param string $class Name of custom class. + * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation + * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation + */ + function set_enclosure_class($class = 'SimplePie_Enclosure') + { + if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Enclosure')) + { + $this->enclosure_class = $class; + return true; + } + return false; + } + + /** + * Allows you to change which class SimplePie uses for captions + * Useful when you are overloading or extending SimplePie's default classes. + * + * @access public + * @param string $class Name of custom class. + * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation + * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation + */ + function set_caption_class($class = 'SimplePie_Caption') + { + if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Caption')) + { + $this->caption_class = $class; + return true; + } + return false; + } + + /** + * Allows you to change which class SimplePie uses for + * Useful when you are overloading or extending SimplePie's default classes. + * + * @access public + * @param string $class Name of custom class. + * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation + * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation + */ + function set_copyright_class($class = 'SimplePie_Copyright') + { + if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Copyright')) + { + $this->copyright_class = $class; + return true; + } + return false; + } + + /** + * Allows you to change which class SimplePie uses for + * Useful when you are overloading or extending SimplePie's default classes. + * + * @access public + * @param string $class Name of custom class. + * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation + * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation + */ + function set_credit_class($class = 'SimplePie_Credit') + { + if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Credit')) + { + $this->credit_class = $class; + return true; + } + return false; + } + + /** + * Allows you to change which class SimplePie uses for + * Useful when you are overloading or extending SimplePie's default classes. + * + * @access public + * @param string $class Name of custom class. + * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation + * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation + */ + function set_rating_class($class = 'SimplePie_Rating') + { + if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Rating')) + { + $this->rating_class = $class; + return true; + } + return false; + } + + /** + * Allows you to change which class SimplePie uses for + * Useful when you are overloading or extending SimplePie's default classes. + * + * @access public + * @param string $class Name of custom class. + * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation + * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation + */ + function set_restriction_class($class = 'SimplePie_Restriction') + { + if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Restriction')) + { + $this->restriction_class = $class; + return true; + } + return false; + } + + /** + * Allows you to change which class SimplePie uses for content-type sniffing. + * Useful when you are overloading or extending SimplePie's default classes. + * + * @access public + * @param string $class Name of custom class. + * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation + * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation + */ + function set_content_type_sniffer_class($class = 'SimplePie_Content_Type_Sniffer') + { + if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Content_Type_Sniffer')) + { + $this->content_type_sniffer_class = $class; + return true; + } + return false; + } + + /** + * Allows you to change which class SimplePie uses item sources. + * Useful when you are overloading or extending SimplePie's default classes. + * + * @access public + * @param string $class Name of custom class. + * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation + * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation + */ + function set_source_class($class = 'SimplePie_Source') + { + if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Source')) + { + $this->source_class = $class; + return true; + } + return false; + } + + /** + * Allows you to override the default user agent string. + * + * @access public + * @param string $ua New user agent string. + */ + function set_useragent($ua = SIMPLEPIE_USERAGENT) + { + $this->useragent = (string) $ua; + } + + /** + * Set callback function to create cache filename with + * + * @access public + * @param mixed $function Callback function + */ + function set_cache_name_function($function = 'md5') + { + if (is_callable($function)) + { + $this->cache_name_function = $function; + } + } + + /** + * Set javascript query string parameter + * + * @access public + * @param mixed $get Javascript query string parameter + */ + function set_javascript($get = 'js') + { + if ($get) + { + $this->javascript = (string) $get; + } + else + { + $this->javascript = false; + } + } + + /** + * Set options to make SP as fast as possible. Forgoes a + * substantial amount of data sanitization in favor of speed. + * + * @access public + * @param bool $set Whether to set them or not + */ + function set_stupidly_fast($set = false) + { + if ($set) + { + $this->enable_order_by_date(false); + $this->remove_div(false); + $this->strip_comments(false); + $this->strip_htmltags(false); + $this->strip_attributes(false); + $this->set_image_handler(false); + } + } + + /** + * Set maximum number of feeds to check with autodiscovery + * + * @access public + * @param int $max Maximum number of feeds to check + */ + function set_max_checked_feeds($max = 10) + { + $this->max_checked_feeds = (int) $max; + } + + function remove_div($enable = true) + { + $this->sanitize->remove_div($enable); + } + + function strip_htmltags($tags = '', $encode = null) + { + if ($tags === '') + { + $tags = $this->strip_htmltags; + } + $this->sanitize->strip_htmltags($tags); + if ($encode !== null) + { + $this->sanitize->encode_instead_of_strip($tags); + } + } + + function encode_instead_of_strip($enable = true) + { + $this->sanitize->encode_instead_of_strip($enable); + } + + function strip_attributes($attribs = '') + { + if ($attribs === '') + { + $attribs = $this->strip_attributes; + } + $this->sanitize->strip_attributes($attribs); + } + + function set_output_encoding($encoding = 'UTF-8') + { + $this->sanitize->set_output_encoding($encoding); + } + + function strip_comments($strip = false) + { + $this->sanitize->strip_comments($strip); + } + + /** + * Set element/attribute key/value pairs of HTML attributes + * containing URLs that need to be resolved relative to the feed + * + * @access public + * @since 1.0 + * @param array $element_attribute Element/attribute key/value pairs + */ + function set_url_replacements($element_attribute = array('a' => 'href', 'area' => 'href', 'blockquote' => 'cite', 'del' => 'cite', 'form' => 'action', 'img' => array('longdesc', 'src'), 'input' => 'src', 'ins' => 'cite', 'q' => 'cite')) + { + $this->sanitize->set_url_replacements($element_attribute); + } + + /** + * Set the handler to enable the display of cached favicons. + * + * @access public + * @param str $page Web-accessible path to the handler_favicon.php file. + * @param str $qs The query string that the value should be passed to. + */ + function set_favicon_handler($page = false, $qs = 'i') + { + if ($page !== false) + { + $this->favicon_handler = $page . '?' . $qs . '='; + } + else + { + $this->favicon_handler = ''; + } + } + + /** + * Set the handler to enable the display of cached images. + * + * @access public + * @param str $page Web-accessible path to the handler_image.php file. + * @param str $qs The query string that the value should be passed to. + */ + function set_image_handler($page = false, $qs = 'i') + { + if ($page !== false) + { + $this->sanitize->set_image_handler($page . '?' . $qs . '='); + } + else + { + $this->image_handler = ''; + } + } + + /** + * Set the limit for items returned per-feed with multifeeds. + * + * @access public + * @param integer $limit The maximum number of items to return. + */ + function set_item_limit($limit = 0) + { + $this->item_limit = (int) $limit; + } + + function init() + { + // Check absolute bare minimum requirements. + if ((function_exists('version_compare') && version_compare(PHP_VERSION, '4.3.0', '<')) || !extension_loaded('xml') || !extension_loaded('pcre')) + { + return false; + } + // Then check the xml extension is sane (i.e., libxml 2.7.x issue on PHP < 5.2.9 and libxml 2.7.0 to 2.7.2 on any version) if we don't have xmlreader. + elseif (!extension_loaded('xmlreader')) + { + static $xml_is_sane = null; + if ($xml_is_sane === null) + { + $parser_check = xml_parser_create(); + xml_parse_into_struct($parser_check, '&', $values); + xml_parser_free($parser_check); + $xml_is_sane = isset($values[0]['value']); + } + if (!$xml_is_sane) + { + return false; + } + } + + if (isset($_GET[$this->javascript])) + { + SimplePie_Misc::output_javascript(); + exit; + } + + // Pass whatever was set with config options over to the sanitizer. + $this->sanitize->pass_cache_data($this->cache, $this->cache_location, $this->cache_name_function, $this->cache_class); + $this->sanitize->pass_file_data($this->file_class, $this->timeout, $this->useragent, $this->force_fsockopen); + + if ($this->feed_url !== null || $this->raw_data !== null) + { + $this->data = array(); + $this->multifeed_objects = array(); + $cache = false; + + if ($this->feed_url !== null) + { + $parsed_feed_url = SimplePie_Misc::parse_url($this->feed_url); + // Decide whether to enable caching + if ($this->cache && $parsed_feed_url['scheme'] !== '') + { + $cache = call_user_func(array($this->cache_class, 'create'), $this->cache_location, call_user_func($this->cache_name_function, $this->feed_url), 'spc'); + } + // If it's enabled and we don't want an XML dump, use the cache + if ($cache && !$this->xml_dump) + { + // Load the Cache + $this->data = $cache->load(); + if (!empty($this->data)) + { + // If the cache is for an outdated build of SimplePie + if (!isset($this->data['build']) || $this->data['build'] !== SIMPLEPIE_BUILD) + { + $cache->unlink(); + $this->data = array(); + } + // If we've hit a collision just rerun it with caching disabled + elseif (isset($this->data['url']) && $this->data['url'] !== $this->feed_url) + { + $cache = false; + $this->data = array(); + } + // If we've got a non feed_url stored (if the page isn't actually a feed, or is a redirect) use that URL. + elseif (isset($this->data['feed_url'])) + { + // If the autodiscovery cache is still valid use it. + if ($cache->mtime() + $this->autodiscovery_cache_duration > time()) + { + // Do not need to do feed autodiscovery yet. + if ($this->data['feed_url'] === $this->data['url']) + { + $cache->unlink(); + $this->data = array(); + } + else + { + $this->set_feed_url($this->data['feed_url']); + return $this->init(); + } + } + } + // Check if the cache has been updated + elseif ($cache->mtime() + $this->cache_duration < time()) + { + // If we have last-modified and/or etag set + if (isset($this->data['headers']['last-modified']) || isset($this->data['headers']['etag'])) + { + $headers = array(); + if (isset($this->data['headers']['last-modified'])) + { + $headers['if-modified-since'] = $this->data['headers']['last-modified']; + } + if (isset($this->data['headers']['etag'])) + { + $headers['if-none-match'] = '"' . $this->data['headers']['etag'] . '"'; + } + $file =& new $this->file_class($this->feed_url, $this->timeout/10, 5, $headers, $this->useragent, $this->force_fsockopen); + if ($file->success) + { + if ($file->status_code === 304) + { + $cache->touch(); + return true; + } + else + { + $headers = $file->headers; + } + } + else + { + unset($file); + } + } + } + // If the cache is still valid, just return true + else + { + return true; + } + } + // If the cache is empty, delete it + else + { + $cache->unlink(); + $this->data = array(); + } + } + // If we don't already have the file (it'll only exist if we've opened it to check if the cache has been modified), open it. + if (!isset($file)) + { + if (is_a($this->file, 'SimplePie_File') && $this->file->url === $this->feed_url) + { + $file =& $this->file; + } + else + { + $file =& new $this->file_class($this->feed_url, $this->timeout, 5, null, $this->useragent, $this->force_fsockopen); + } + } + // If the file connection has an error, set SimplePie::error to that and quit + if (!$file->success && !($file->method & SIMPLEPIE_FILE_SOURCE_REMOTE === 0 || ($file->status_code === 200 || $file->status_code > 206 && $file->status_code < 300))) + { + $this->error = $file->error; + if (!empty($this->data)) + { + return true; + } + else + { + return false; + } + } + + if (!$this->force_feed) + { + // Check if the supplied URL is a feed, if it isn't, look for it. + $locate =& new $this->locator_class($file, $this->timeout, $this->useragent, $this->file_class, $this->max_checked_feeds, $this->content_type_sniffer_class); + if (!$locate->is_feed($file)) + { + // We need to unset this so that if SimplePie::set_file() has been called that object is untouched + unset($file); + if ($file = $locate->find($this->autodiscovery, $this->all_discovered_feeds)) + { + if ($cache) + { + $this->data = array('url' => $this->feed_url, 'feed_url' => $file->url, 'build' => SIMPLEPIE_BUILD); + if (!$cache->save($this)) + { + trigger_error("$this->cache_location is not writeable", E_USER_WARNING); + } + $cache = call_user_func(array($this->cache_class, 'create'), $this->cache_location, call_user_func($this->cache_name_function, $file->url), 'spc'); + } + $this->feed_url = $file->url; + } + else + { + $this->error = "A feed could not be found at $this->feed_url"; + SimplePie_Misc::error($this->error, E_USER_NOTICE, __FILE__, __LINE__); + return false; + } + } + $locate = null; + } + + $headers = $file->headers; + $data = $file->body; + $sniffer =& new $this->content_type_sniffer_class($file); + $sniffed = $sniffer->get_type(); + } + else + { + $data = $this->raw_data; + } + + // Set up array of possible encodings + $encodings = array(); + + // First check to see if input has been overridden. + if ($this->input_encoding !== false) + { + $encodings[] = $this->input_encoding; + } + + $application_types = array('application/xml', 'application/xml-dtd', 'application/xml-external-parsed-entity'); + $text_types = array('text/xml', 'text/xml-external-parsed-entity'); + + // RFC 3023 (only applies to sniffed content) + if (isset($sniffed)) + { + if (in_array($sniffed, $application_types) || substr($sniffed, 0, 12) === 'application/' && substr($sniffed, -4) === '+xml') + { + if (isset($headers['content-type']) && preg_match('/;\x20?charset=([^;]*)/i', $headers['content-type'], $charset)) + { + $encodings[] = strtoupper($charset[1]); + } + $encodings = array_merge($encodings, SimplePie_Misc::xml_encoding($data)); + $encodings[] = 'UTF-8'; + } + elseif (in_array($sniffed, $text_types) || substr($sniffed, 0, 5) === 'text/' && substr($sniffed, -4) === '+xml') + { + if (isset($headers['content-type']) && preg_match('/;\x20?charset=([^;]*)/i', $headers['content-type'], $charset)) + { + $encodings[] = $charset[1]; + } + $encodings[] = 'US-ASCII'; + } + // Text MIME-type default + elseif (substr($sniffed, 0, 5) === 'text/') + { + $encodings[] = 'US-ASCII'; + } + } + + // Fallback to XML 1.0 Appendix F.1/UTF-8/ISO-8859-1 + $encodings = array_merge($encodings, SimplePie_Misc::xml_encoding($data)); + $encodings[] = 'UTF-8'; + $encodings[] = 'ISO-8859-1'; + + // There's no point in trying an encoding twice + $encodings = array_unique($encodings); + + // If we want the XML, just output that with the most likely encoding and quit + if ($this->xml_dump) + { + header('Content-type: text/xml; charset=' . $encodings[0]); + echo $data; + exit; + } + + // Loop through each possible encoding, till we return something, or run out of possibilities + foreach ($encodings as $encoding) + { + // Change the encoding to UTF-8 (as we always use UTF-8 internally) + if ($utf8_data = SimplePie_Misc::change_encoding($data, $encoding, 'UTF-8')) + { + // Create new parser + $parser =& new $this->parser_class(); + + // If it's parsed fine + if ($parser->parse($utf8_data, 'UTF-8')) + { + $this->data = $parser->get_data(); + if ($this->get_type() & ~SIMPLEPIE_TYPE_NONE) + { + if (isset($headers)) + { + $this->data['headers'] = $headers; + } + $this->data['build'] = SIMPLEPIE_BUILD; + + // Cache the file if caching is enabled + if ($cache && !$cache->save($this)) + { + trigger_error("$cache->name is not writeable", E_USER_WARNING); + } + return true; + } + else + { + $this->error = "A feed could not be found at $this->feed_url"; + SimplePie_Misc::error($this->error, E_USER_NOTICE, __FILE__, __LINE__); + return false; + } + } + } + } + if(isset($parser)) + { + // We have an error, just set SimplePie_Misc::error to it and quit + $this->error = sprintf('XML error: %s at line %d, column %d', $parser->get_error_string(), $parser->get_current_line(), $parser->get_current_column()); + } + else + { + $this->error = 'The data could not be converted to UTF-8'; + } + SimplePie_Misc::error($this->error, E_USER_NOTICE, __FILE__, __LINE__); + return false; + } + elseif (!empty($this->multifeed_url)) + { + $i = 0; + $success = 0; + $this->multifeed_objects = array(); + foreach ($this->multifeed_url as $url) + { + if (SIMPLEPIE_PHP5) + { + // This keyword needs to defy coding standards for PHP4 compatibility + $this->multifeed_objects[$i] = clone($this); + } + else + { + $this->multifeed_objects[$i] = $this; + } + $this->multifeed_objects[$i]->set_feed_url($url); + $success |= $this->multifeed_objects[$i]->init(); + $i++; + } + return (bool) $success; + } + else + { + return false; + } + } + + /** + * Return the error message for the occurred error + * + * @access public + * @return string Error message + */ + function error() + { + return $this->error; + } + + function get_encoding() + { + return $this->sanitize->output_encoding; + } + + function handle_content_type($mime = 'text/html') + { + if (!headers_sent()) + { + $header = "Content-type: $mime;"; + if ($this->get_encoding()) + { + $header .= ' charset=' . $this->get_encoding(); + } + else + { + $header .= ' charset=UTF-8'; + } + header($header); + } + } + + function get_type() + { + if (!isset($this->data['type'])) + { + $this->data['type'] = SIMPLEPIE_TYPE_ALL; + if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'])) + { + $this->data['type'] &= SIMPLEPIE_TYPE_ATOM_10; + } + elseif (isset($this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'])) + { + $this->data['type'] &= SIMPLEPIE_TYPE_ATOM_03; + } + elseif (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'])) + { + if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_10]['channel']) + || isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_10]['image']) + || isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_10]['item']) + || isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_10]['textinput'])) + { + $this->data['type'] &= SIMPLEPIE_TYPE_RSS_10; + } + if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_090]['channel']) + || isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_090]['image']) + || isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_090]['item']) + || isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_090]['textinput'])) + { + $this->data['type'] &= SIMPLEPIE_TYPE_RSS_090; + } + } + elseif (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'])) + { + $this->data['type'] &= SIMPLEPIE_TYPE_RSS_ALL; + if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['attribs']['']['version'])) + { + switch (trim($this->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['attribs']['']['version'])) + { + case '0.91': + $this->data['type'] &= SIMPLEPIE_TYPE_RSS_091; + if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_20]['skiphours']['hour'][0]['data'])) + { + switch (trim($this->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_20]['skiphours']['hour'][0]['data'])) + { + case '0': + $this->data['type'] &= SIMPLEPIE_TYPE_RSS_091_NETSCAPE; + break; + + case '24': + $this->data['type'] &= SIMPLEPIE_TYPE_RSS_091_USERLAND; + break; + } + } + break; + + case '0.92': + $this->data['type'] &= SIMPLEPIE_TYPE_RSS_092; + break; + + case '0.93': + $this->data['type'] &= SIMPLEPIE_TYPE_RSS_093; + break; + + case '0.94': + $this->data['type'] &= SIMPLEPIE_TYPE_RSS_094; + break; + + case '2.0': + $this->data['type'] &= SIMPLEPIE_TYPE_RSS_20; + break; + } + } + } + else + { + $this->data['type'] = SIMPLEPIE_TYPE_NONE; + } + } + return $this->data['type']; + } + + /** + * Returns the URL for the favicon of the feed's website. + * + * @todo Cache atom:icon + * @access public + * @since 1.0 + */ + function get_favicon() + { + if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'icon')) + { + return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0])); + } + elseif (($url = $this->get_link()) !== null && preg_match('/^http(s)?:\/\//i', $url)) + { + $favicon = SimplePie_Misc::absolutize_url('/favicon.ico', $url); + + if ($this->cache && $this->favicon_handler) + { + $favicon_filename = call_user_func($this->cache_name_function, $favicon); + $cache = call_user_func(array($this->cache_class, 'create'), $this->cache_location, $favicon_filename, 'spi'); + + if ($cache->load()) + { + return $this->sanitize($this->favicon_handler . $favicon_filename, SIMPLEPIE_CONSTRUCT_IRI); + } + else + { + $file =& new $this->file_class($favicon, $this->timeout / 10, 5, array('X-FORWARDED-FOR' => $_SERVER['REMOTE_ADDR']), $this->useragent, $this->force_fsockopen); + + if ($file->success && ($file->method & SIMPLEPIE_FILE_SOURCE_REMOTE === 0 || ($file->status_code === 200 || $file->status_code > 206 && $file->status_code < 300)) && strlen($file->body) > 0) + { + $sniffer =& new $this->content_type_sniffer_class($file); + if (substr($sniffer->get_type(), 0, 6) === 'image/') + { + if ($cache->save(array('headers' => $file->headers, 'body' => $file->body))) + { + return $this->sanitize($this->favicon_handler . $favicon_filename, SIMPLEPIE_CONSTRUCT_IRI); + } + else + { + trigger_error("$cache->name is not writeable", E_USER_WARNING); + return $this->sanitize($favicon, SIMPLEPIE_CONSTRUCT_IRI); + } + } + // not an image + else + { + return false; + } + } + } + } + else + { + return $this->sanitize($favicon, SIMPLEPIE_CONSTRUCT_IRI); + } + } + return false; + } + + /** + * @todo If we have a perm redirect we should return the new URL + * @todo When we make the above change, let's support as well + * @todo Also, |atom:link|@rel=self + */ + function subscribe_url() + { + if ($this->feed_url !== null) + { + return $this->sanitize($this->feed_url, SIMPLEPIE_CONSTRUCT_IRI); + } + else + { + return null; + } + } + + function subscribe_feed() + { + if ($this->feed_url !== null) + { + return $this->sanitize(SimplePie_Misc::fix_protocol($this->feed_url, 2), SIMPLEPIE_CONSTRUCT_IRI); + } + else + { + return null; + } + } + + function subscribe_outlook() + { + if ($this->feed_url !== null) + { + return $this->sanitize('outlook' . SimplePie_Misc::fix_protocol($this->feed_url, 2), SIMPLEPIE_CONSTRUCT_IRI); + } + else + { + return null; + } + } + + function subscribe_podcast() + { + if ($this->feed_url !== null) + { + return $this->sanitize(SimplePie_Misc::fix_protocol($this->feed_url, 3), SIMPLEPIE_CONSTRUCT_IRI); + } + else + { + return null; + } + } + + function subscribe_itunes() + { + if ($this->feed_url !== null) + { + return $this->sanitize(SimplePie_Misc::fix_protocol($this->feed_url, 4), SIMPLEPIE_CONSTRUCT_IRI); + } + else + { + return null; + } + } + + /** + * Creates the subscribe_* methods' return data + * + * @access private + * @param string $feed_url String to prefix to the feed URL + * @param string $site_url String to prefix to the site URL (and + * suffix to the feed URL) + * @return mixed URL if feed exists, false otherwise + */ + function subscribe_service($feed_url, $site_url = null) + { + if ($this->subscribe_url()) + { + $return = $feed_url . rawurlencode($this->feed_url); + if ($site_url !== null && $this->get_link() !== null) + { + $return .= $site_url . rawurlencode($this->get_link()); + } + return $this->sanitize($return, SIMPLEPIE_CONSTRUCT_IRI); + } + else + { + return null; + } + } + + function subscribe_aol() + { + return $this->subscribe_service('http://feeds.my.aol.com/add.jsp?url='); + } + + function subscribe_bloglines() + { + return $this->subscribe_service('http://www.bloglines.com/sub/'); + } + + function subscribe_eskobo() + { + return $this->subscribe_service('http://www.eskobo.com/?AddToMyPage='); + } + + function subscribe_feedfeeds() + { + return $this->subscribe_service('http://www.feedfeeds.com/add?feed='); + } + + function subscribe_feedster() + { + return $this->subscribe_service('http://www.feedster.com/myfeedster.php?action=addrss&confirm=no&rssurl='); + } + + function subscribe_google() + { + return $this->subscribe_service('http://fusion.google.com/add?feedurl='); + } + + function subscribe_gritwire() + { + return $this->subscribe_service('http://my.gritwire.com/feeds/addExternalFeed.aspx?FeedUrl='); + } + + function subscribe_msn() + { + return $this->subscribe_service('http://my.msn.com/addtomymsn.armx?id=rss&ut=', '&ru='); + } + + function subscribe_netvibes() + { + return $this->subscribe_service('http://www.netvibes.com/subscribe.php?url='); + } + + function subscribe_newsburst() + { + return $this->subscribe_service('http://www.newsburst.com/Source/?add='); + } + + function subscribe_newsgator() + { + return $this->subscribe_service('http://www.newsgator.com/ngs/subscriber/subext.aspx?url='); + } + + function subscribe_odeo() + { + return $this->subscribe_service('http://www.odeo.com/listen/subscribe?feed='); + } + + function subscribe_podnova() + { + return $this->subscribe_service('http://www.podnova.com/index_your_podcasts.srf?action=add&url='); + } + + function subscribe_rojo() + { + return $this->subscribe_service('http://www.rojo.com/add-subscription?resource='); + } + + function subscribe_yahoo() + { + return $this->subscribe_service('http://add.my.yahoo.com/rss?url='); + } + + function get_feed_tags($namespace, $tag) + { + $type = $this->get_type(); + if ($type & SIMPLEPIE_TYPE_ATOM_10) + { + if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0]['child'][$namespace][$tag])) + { + return $this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0]['child'][$namespace][$tag]; + } + } + if ($type & SIMPLEPIE_TYPE_ATOM_03) + { + if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0]['child'][$namespace][$tag])) + { + return $this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0]['child'][$namespace][$tag]; + } + } + if ($type & SIMPLEPIE_TYPE_RSS_RDF) + { + if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][$namespace][$tag])) + { + return $this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][$namespace][$tag]; + } + } + if ($type & SIMPLEPIE_TYPE_RSS_SYNDICATION) + { + if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['child'][$namespace][$tag])) + { + return $this->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['child'][$namespace][$tag]; + } + } + return null; + } + + function get_channel_tags($namespace, $tag) + { + $type = $this->get_type(); + if ($type & SIMPLEPIE_TYPE_ATOM_ALL) + { + if ($return = $this->get_feed_tags($namespace, $tag)) + { + return $return; + } + } + if ($type & SIMPLEPIE_TYPE_RSS_10) + { + if ($channel = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'channel')) + { + if (isset($channel[0]['child'][$namespace][$tag])) + { + return $channel[0]['child'][$namespace][$tag]; + } + } + } + if ($type & SIMPLEPIE_TYPE_RSS_090) + { + if ($channel = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'channel')) + { + if (isset($channel[0]['child'][$namespace][$tag])) + { + return $channel[0]['child'][$namespace][$tag]; + } + } + } + if ($type & SIMPLEPIE_TYPE_RSS_SYNDICATION) + { + if ($channel = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'channel')) + { + if (isset($channel[0]['child'][$namespace][$tag])) + { + return $channel[0]['child'][$namespace][$tag]; + } + } + } + return null; + } + + function get_image_tags($namespace, $tag) + { + $type = $this->get_type(); + if ($type & SIMPLEPIE_TYPE_RSS_10) + { + if ($image = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'image')) + { + if (isset($image[0]['child'][$namespace][$tag])) + { + return $image[0]['child'][$namespace][$tag]; + } + } + } + if ($type & SIMPLEPIE_TYPE_RSS_090) + { + if ($image = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'image')) + { + if (isset($image[0]['child'][$namespace][$tag])) + { + return $image[0]['child'][$namespace][$tag]; + } + } + } + if ($type & SIMPLEPIE_TYPE_RSS_SYNDICATION) + { + if ($image = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'image')) + { + if (isset($image[0]['child'][$namespace][$tag])) + { + return $image[0]['child'][$namespace][$tag]; + } + } + } + return null; + } + + function get_base($element = array()) + { + if (!($this->get_type() & SIMPLEPIE_TYPE_RSS_SYNDICATION) && !empty($element['xml_base_explicit']) && isset($element['xml_base'])) + { + return $element['xml_base']; + } + elseif ($this->get_link() !== null) + { + return $this->get_link(); + } + else + { + return $this->subscribe_url(); + } + } + + function sanitize($data, $type, $base = '') + { + return $this->sanitize->sanitize($data, $type, $base); + } + + function get_title() + { + if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'title')) + { + return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_10_construct_type($return[0]['attribs']), $this->get_base($return[0])); + } + elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'title')) + { + return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_03_construct_type($return[0]['attribs']), $this->get_base($return[0])); + } + elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'title')) + { + return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0])); + } + elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'title')) + { + return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0])); + } + elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'title')) + { + return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0])); + } + elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_11, 'title')) + { + return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_10, 'title')) + { + return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + else + { + return null; + } + } + + function get_category($key = 0) + { + $categories = $this->get_categories(); + if (isset($categories[$key])) + { + return $categories[$key]; + } + else + { + return null; + } + } + + function get_categories() + { + $categories = array(); + + foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'category') as $category) + { + $term = null; + $scheme = null; + $label = null; + if (isset($category['attribs']['']['term'])) + { + $term = $this->sanitize($category['attribs']['']['term'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($category['attribs']['']['scheme'])) + { + $scheme = $this->sanitize($category['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($category['attribs']['']['label'])) + { + $label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT); + } + $categories[] =& new $this->category_class($term, $scheme, $label); + } + foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'category') as $category) + { + // This is really the label, but keep this as the term also for BC. + // Label will also work on retrieving because that falls back to term. + $term = $this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT); + if (isset($category['attribs']['']['domain'])) + { + $scheme = $this->sanitize($category['attribs']['']['domain'], SIMPLEPIE_CONSTRUCT_TEXT); + } + else + { + $scheme = null; + } + $categories[] =& new $this->category_class($term, $scheme, null); + } + foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_11, 'subject') as $category) + { + $categories[] =& new $this->category_class($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null); + } + foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_10, 'subject') as $category) + { + $categories[] =& new $this->category_class($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null); + } + + if (!empty($categories)) + { + return SimplePie_Misc::array_unique($categories); + } + else + { + return null; + } + } + + function get_author($key = 0) + { + $authors = $this->get_authors(); + if (isset($authors[$key])) + { + return $authors[$key]; + } + else + { + return null; + } + } + + function get_authors() + { + $authors = array(); + foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'author') as $author) + { + $name = null; + $uri = null; + $email = null; + if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data'])) + { + $name = $this->sanitize($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data'])) + { + $uri = $this->sanitize($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0])); + } + if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data'])) + { + $email = $this->sanitize($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if ($name !== null || $email !== null || $uri !== null) + { + $authors[] =& new $this->author_class($name, $uri, $email); + } + } + if ($author = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'author')) + { + $name = null; + $url = null; + $email = null; + if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data'])) + { + $name = $this->sanitize($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data'])) + { + $url = $this->sanitize($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0])); + } + if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data'])) + { + $email = $this->sanitize($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if ($name !== null || $email !== null || $url !== null) + { + $authors[] =& new $this->author_class($name, $url, $email); + } + } + foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_11, 'creator') as $author) + { + $authors[] =& new $this->author_class($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null); + } + foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_10, 'creator') as $author) + { + $authors[] =& new $this->author_class($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null); + } + foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'author') as $author) + { + $authors[] =& new $this->author_class($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null); + } + + if (!empty($authors)) + { + return SimplePie_Misc::array_unique($authors); + } + else + { + return null; + } + } + + function get_contributor($key = 0) + { + $contributors = $this->get_contributors(); + if (isset($contributors[$key])) + { + return $contributors[$key]; + } + else + { + return null; + } + } + + function get_contributors() + { + $contributors = array(); + foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'contributor') as $contributor) + { + $name = null; + $uri = null; + $email = null; + if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data'])) + { + $name = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data'])) + { + $uri = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0])); + } + if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data'])) + { + $email = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if ($name !== null || $email !== null || $uri !== null) + { + $contributors[] =& new $this->author_class($name, $uri, $email); + } + } + foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'contributor') as $contributor) + { + $name = null; + $url = null; + $email = null; + if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data'])) + { + $name = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data'])) + { + $url = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0])); + } + if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data'])) + { + $email = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if ($name !== null || $email !== null || $url !== null) + { + $contributors[] =& new $this->author_class($name, $url, $email); + } + } + + if (!empty($contributors)) + { + return SimplePie_Misc::array_unique($contributors); + } + else + { + return null; + } + } + + function get_link($key = 0, $rel = 'alternate') + { + $links = $this->get_links($rel); + if (isset($links[$key])) + { + return $links[$key]; + } + else + { + return null; + } + } + + /** + * Added for parity between the parent-level and the item/entry-level. + */ + function get_permalink() + { + return $this->get_link(0); + } + + function get_links($rel = 'alternate') + { + if (!isset($this->data['links'])) + { + $this->data['links'] = array(); + if ($links = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'link')) + { + foreach ($links as $link) + { + if (isset($link['attribs']['']['href'])) + { + $link_rel = (isset($link['attribs']['']['rel'])) ? $link['attribs']['']['rel'] : 'alternate'; + $this->data['links'][$link_rel][] = $this->sanitize($link['attribs']['']['href'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($link)); + } + } + } + if ($links = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'link')) + { + foreach ($links as $link) + { + if (isset($link['attribs']['']['href'])) + { + $link_rel = (isset($link['attribs']['']['rel'])) ? $link['attribs']['']['rel'] : 'alternate'; + $this->data['links'][$link_rel][] = $this->sanitize($link['attribs']['']['href'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($link)); + + } + } + } + if ($links = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'link')) + { + $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0])); + } + if ($links = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'link')) + { + $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0])); + } + if ($links = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'link')) + { + $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0])); + } + + $keys = array_keys($this->data['links']); + foreach ($keys as $key) + { + if (SimplePie_Misc::is_isegment_nz_nc($key)) + { + if (isset($this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key])) + { + $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key] = array_merge($this->data['links'][$key], $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key]); + $this->data['links'][$key] =& $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key]; + } + else + { + $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key] =& $this->data['links'][$key]; + } + } + elseif (substr($key, 0, 41) === SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY) + { + $this->data['links'][substr($key, 41)] =& $this->data['links'][$key]; + } + $this->data['links'][$key] = array_unique($this->data['links'][$key]); + } + } + + if (isset($this->data['links'][$rel])) + { + return $this->data['links'][$rel]; + } + else + { + return null; + } + } + + function get_all_discovered_feeds() + { + return $this->all_discovered_feeds; + } + + function get_description() + { + if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'subtitle')) + { + return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_10_construct_type($return[0]['attribs']), $this->get_base($return[0])); + } + elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'tagline')) + { + return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_03_construct_type($return[0]['attribs']), $this->get_base($return[0])); + } + elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'description')) + { + return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0])); + } + elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'description')) + { + return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0])); + } + elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'description')) + { + return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($return[0])); + } + elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_11, 'description')) + { + return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_10, 'description')) + { + return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'summary')) + { + return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($return[0])); + } + elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'subtitle')) + { + return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($return[0])); + } + else + { + return null; + } + } + + function get_copyright() + { + if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'rights')) + { + return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_10_construct_type($return[0]['attribs']), $this->get_base($return[0])); + } + elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'copyright')) + { + return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_03_construct_type($return[0]['attribs']), $this->get_base($return[0])); + } + elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'copyright')) + { + return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_11, 'rights')) + { + return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_10, 'rights')) + { + return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + else + { + return null; + } + } + + function get_language() + { + if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'language')) + { + return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_11, 'language')) + { + return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_10, 'language')) + { + return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + elseif (isset($this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0]['xml_lang'])) + { + return $this->sanitize($this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0]['xml_lang'], SIMPLEPIE_CONSTRUCT_TEXT); + } + elseif (isset($this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0]['xml_lang'])) + { + return $this->sanitize($this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0]['xml_lang'], SIMPLEPIE_CONSTRUCT_TEXT); + } + elseif (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['xml_lang'])) + { + return $this->sanitize($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['xml_lang'], SIMPLEPIE_CONSTRUCT_TEXT); + } + elseif (isset($this->data['headers']['content-language'])) + { + return $this->sanitize($this->data['headers']['content-language'], SIMPLEPIE_CONSTRUCT_TEXT); + } + else + { + return null; + } + } + + function get_latitude() + { + if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'lat')) + { + return (float) $return[0]['data']; + } + elseif (($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', $return[0]['data'], $match)) + { + return (float) $match[1]; + } + else + { + return null; + } + } + + function get_longitude() + { + if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'long')) + { + return (float) $return[0]['data']; + } + elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'lon')) + { + return (float) $return[0]['data']; + } + elseif (($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', $return[0]['data'], $match)) + { + return (float) $match[2]; + } + else + { + return null; + } + } + + function get_image_title() + { + if ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'title')) + { + return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'title')) + { + return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'title')) + { + return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_DC_11, 'title')) + { + return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_DC_10, 'title')) + { + return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + else + { + return null; + } + } + + function get_image_url() + { + if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'image')) + { + return $this->sanitize($return[0]['attribs']['']['href'], SIMPLEPIE_CONSTRUCT_IRI); + } + elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'logo')) + { + return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0])); + } + elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'icon')) + { + return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0])); + } + elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'url')) + { + return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0])); + } + elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'url')) + { + return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0])); + } + elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'url')) + { + return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0])); + } + else + { + return null; + } + } + + function get_image_link() + { + if ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'link')) + { + return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0])); + } + elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'link')) + { + return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0])); + } + elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'link')) + { + return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0])); + } + else + { + return null; + } + } + + function get_image_width() + { + if ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'width')) + { + return round($return[0]['data']); + } + elseif ($this->get_type() & SIMPLEPIE_TYPE_RSS_SYNDICATION && $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'url')) + { + return 88.0; + } + else + { + return null; + } + } + + function get_image_height() + { + if ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'height')) + { + return round($return[0]['data']); + } + elseif ($this->get_type() & SIMPLEPIE_TYPE_RSS_SYNDICATION && $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'url')) + { + return 31.0; + } + else + { + return null; + } + } + + function get_item_quantity($max = 0) + { + $max = (int) $max; + $qty = count($this->get_items()); + if ($max === 0) + { + return $qty; + } + else + { + return ($qty > $max) ? $max : $qty; + } + } + + function get_item($key = 0) + { + $items = $this->get_items(); + if (isset($items[$key])) + { + return $items[$key]; + } + else + { + return null; + } + } + + function get_items($start = 0, $end = 0) + { + if (!isset($this->data['items'])) + { + if (!empty($this->multifeed_objects)) + { + $this->data['items'] = SimplePie::merge_items($this->multifeed_objects, $start, $end, $this->item_limit); + } + else + { + $this->data['items'] = array(); + if ($items = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'entry')) + { + $keys = array_keys($items); + foreach ($keys as $key) + { + $this->data['items'][] =& new $this->item_class($this, $items[$key]); + } + } + if ($items = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'entry')) + { + $keys = array_keys($items); + foreach ($keys as $key) + { + $this->data['items'][] =& new $this->item_class($this, $items[$key]); + } + } + if ($items = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'item')) + { + $keys = array_keys($items); + foreach ($keys as $key) + { + $this->data['items'][] =& new $this->item_class($this, $items[$key]); + } + } + if ($items = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'item')) + { + $keys = array_keys($items); + foreach ($keys as $key) + { + $this->data['items'][] =& new $this->item_class($this, $items[$key]); + } + } + if ($items = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'item')) + { + $keys = array_keys($items); + foreach ($keys as $key) + { + $this->data['items'][] =& new $this->item_class($this, $items[$key]); + } + } + } + } + + if (!empty($this->data['items'])) + { + // If we want to order it by date, check if all items have a date, and then sort it + if ($this->order_by_date && empty($this->multifeed_objects)) + { + if (!isset($this->data['ordered_items'])) + { + $do_sort = true; + foreach ($this->data['items'] as $item) + { + if (!$item->get_date('U')) + { + $do_sort = false; + break; + } + } + $item = null; + $this->data['ordered_items'] = $this->data['items']; + if ($do_sort) + { + usort($this->data['ordered_items'], array(&$this, 'sort_items')); + } + } + $items = $this->data['ordered_items']; + } + else + { + $items = $this->data['items']; + } + + // Slice the data as desired + if ($end === 0) + { + return array_slice($items, $start); + } + else + { + return array_slice($items, $start, $end); + } + } + else + { + return array(); + } + } + + /** + * @static + */ + function sort_items($a, $b) + { + return $a->get_date('U') <= $b->get_date('U'); + } + + /** + * @static + */ + function merge_items($urls, $start = 0, $end = 0, $limit = 0) + { + if (is_array($urls) && sizeof($urls) > 0) + { + $items = array(); + foreach ($urls as $arg) + { + if (is_a($arg, 'SimplePie')) + { + $items = array_merge($items, $arg->get_items(0, $limit)); + } + else + { + trigger_error('Arguments must be SimplePie objects', E_USER_WARNING); + } + } + + $do_sort = true; + foreach ($items as $item) + { + if (!$item->get_date('U')) + { + $do_sort = false; + break; + } + } + $item = null; + if ($do_sort) + { + usort($items, array('SimplePie', 'sort_items')); + } + + if ($end === 0) + { + return array_slice($items, $start); + } + else + { + return array_slice($items, $start, $end); + } + } + else + { + trigger_error('Cannot merge zero SimplePie objects', E_USER_WARNING); + return array(); + } + } +} + +class SimplePie_Item +{ + var $feed; + var $data = array(); + + function SimplePie_Item($feed, $data) + { + $this->feed = $feed; + $this->data = $data; + } + + function __toString() + { + return md5(serialize($this->data)); + } + + /** + * Remove items that link back to this before destroying this object + */ + function __destruct() + { + if ((version_compare(PHP_VERSION, '5.3', '<') || !gc_enabled()) && !ini_get('zend.ze1_compatibility_mode')) + { + unset($this->feed); + } + } + + function get_item_tags($namespace, $tag) + { + if (isset($this->data['child'][$namespace][$tag])) + { + return $this->data['child'][$namespace][$tag]; + } + else + { + return null; + } + } + + function get_base($element = array()) + { + return $this->feed->get_base($element); + } + + function sanitize($data, $type, $base = '') + { + return $this->feed->sanitize($data, $type, $base); + } + + function get_feed() + { + return $this->feed; + } + + function get_id($hash = false) + { + if (!$hash) + { + if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'id')) + { + return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'id')) + { + return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'guid')) + { + return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'identifier')) + { + return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'identifier')) + { + return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + elseif (($return = $this->get_permalink()) !== null) + { + return $return; + } + elseif (($return = $this->get_title()) !== null) + { + return $return; + } + } + if ($this->get_permalink() !== null || $this->get_title() !== null) + { + return md5($this->get_permalink() . $this->get_title()); + } + else + { + return md5(serialize($this->data)); + } + } + + function get_title() + { + if (!isset($this->data['title'])) + { + if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'title')) + { + $this->data['title'] = $this->sanitize($return[0]['data'], SimplePie_Misc::atom_10_construct_type($return[0]['attribs']), $this->get_base($return[0])); + } + elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'title')) + { + $this->data['title'] = $this->sanitize($return[0]['data'], SimplePie_Misc::atom_03_construct_type($return[0]['attribs']), $this->get_base($return[0])); + } + elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'title')) + { + $this->data['title'] = $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0])); + } + elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'title')) + { + $this->data['title'] = $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0])); + } + elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'title')) + { + $this->data['title'] = $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0])); + } + elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'title')) + { + $this->data['title'] = $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'title')) + { + $this->data['title'] = $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + else + { + $this->data['title'] = null; + } + } + return $this->data['title']; + } + + function get_description($description_only = false) + { + if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'summary')) + { + return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_10_construct_type($return[0]['attribs']), $this->get_base($return[0])); + } + elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'summary')) + { + return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_03_construct_type($return[0]['attribs']), $this->get_base($return[0])); + } + elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'description')) + { + return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0])); + } + elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'description')) + { + return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($return[0])); + } + elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'description')) + { + return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'description')) + { + return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'summary')) + { + return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($return[0])); + } + elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'subtitle')) + { + return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + elseif (!$description_only) + { + return $this->get_content(true); + } + else + { + return null; + } + } + + function get_content($content_only = false) + { + if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'content')) + { + return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_10_content_construct_type($return[0]['attribs']), $this->get_base($return[0])); + } + elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'content')) + { + return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_03_construct_type($return[0]['attribs']), $this->get_base($return[0])); + } + elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_10_MODULES_CONTENT, 'encoded')) + { + return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($return[0])); + } + elseif (!$content_only) + { + return $this->get_description(true); + } + else + { + return null; + } + } + + function get_category($key = 0) + { + $categories = $this->get_categories(); + if (isset($categories[$key])) + { + return $categories[$key]; + } + else + { + return null; + } + } + + function get_categories() + { + $categories = array(); + + foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'category') as $category) + { + $term = null; + $scheme = null; + $label = null; + if (isset($category['attribs']['']['term'])) + { + $term = $this->sanitize($category['attribs']['']['term'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($category['attribs']['']['scheme'])) + { + $scheme = $this->sanitize($category['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($category['attribs']['']['label'])) + { + $label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT); + } + $categories[] =& new $this->feed->category_class($term, $scheme, $label); + } + foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'category') as $category) + { + // This is really the label, but keep this as the term also for BC. + // Label will also work on retrieving because that falls back to term. + $term = $this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT); + if (isset($category['attribs']['']['domain'])) + { + $scheme = $this->sanitize($category['attribs']['']['domain'], SIMPLEPIE_CONSTRUCT_TEXT); + } + else + { + $scheme = null; + } + $categories[] =& new $this->feed->category_class($term, $scheme, null); + } + foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'subject') as $category) + { + $categories[] =& new $this->feed->category_class($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null); + } + foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'subject') as $category) + { + $categories[] =& new $this->feed->category_class($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null); + } + + if (!empty($categories)) + { + return SimplePie_Misc::array_unique($categories); + } + else + { + return null; + } + } + + function get_author($key = 0) + { + $authors = $this->get_authors(); + if (isset($authors[$key])) + { + return $authors[$key]; + } + else + { + return null; + } + } + + function get_contributor($key = 0) + { + $contributors = $this->get_contributors(); + if (isset($contributors[$key])) + { + return $contributors[$key]; + } + else + { + return null; + } + } + + function get_contributors() + { + $contributors = array(); + foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'contributor') as $contributor) + { + $name = null; + $uri = null; + $email = null; + if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data'])) + { + $name = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data'])) + { + $uri = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0])); + } + if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data'])) + { + $email = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if ($name !== null || $email !== null || $uri !== null) + { + $contributors[] =& new $this->feed->author_class($name, $uri, $email); + } + } + foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'contributor') as $contributor) + { + $name = null; + $url = null; + $email = null; + if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data'])) + { + $name = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data'])) + { + $url = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0])); + } + if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data'])) + { + $email = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if ($name !== null || $email !== null || $url !== null) + { + $contributors[] =& new $this->feed->author_class($name, $url, $email); + } + } + + if (!empty($contributors)) + { + return SimplePie_Misc::array_unique($contributors); + } + else + { + return null; + } + } + + function get_authors() + { + $authors = array(); + foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'author') as $author) + { + $name = null; + $uri = null; + $email = null; + if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data'])) + { + $name = $this->sanitize($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data'])) + { + $uri = $this->sanitize($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0])); + } + if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data'])) + { + $email = $this->sanitize($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if ($name !== null || $email !== null || $uri !== null) + { + $authors[] =& new $this->feed->author_class($name, $uri, $email); + } + } + if ($author = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'author')) + { + $name = null; + $url = null; + $email = null; + if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data'])) + { + $name = $this->sanitize($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data'])) + { + $url = $this->sanitize($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0])); + } + if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data'])) + { + $email = $this->sanitize($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if ($name !== null || $email !== null || $url !== null) + { + $authors[] =& new $this->feed->author_class($name, $url, $email); + } + } + if ($author = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'author')) + { + $authors[] =& new $this->feed->author_class(null, null, $this->sanitize($author[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT)); + } + foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'creator') as $author) + { + $authors[] =& new $this->feed->author_class($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null); + } + foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'creator') as $author) + { + $authors[] =& new $this->feed->author_class($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null); + } + foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'author') as $author) + { + $authors[] =& new $this->feed->author_class($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null); + } + + if (!empty($authors)) + { + return SimplePie_Misc::array_unique($authors); + } + elseif (($source = $this->get_source()) && ($authors = $source->get_authors())) + { + return $authors; + } + elseif ($authors = $this->feed->get_authors()) + { + return $authors; + } + else + { + return null; + } + } + + function get_copyright() + { + if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'rights')) + { + return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_10_construct_type($return[0]['attribs']), $this->get_base($return[0])); + } + elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'rights')) + { + return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'rights')) + { + return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + else + { + return null; + } + } + + function get_date($date_format = 'j F Y, g:i a') + { + if (!isset($this->data['date'])) + { + if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'published')) + { + $this->data['date']['raw'] = $return[0]['data']; + } + elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'updated')) + { + $this->data['date']['raw'] = $return[0]['data']; + } + elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'issued')) + { + $this->data['date']['raw'] = $return[0]['data']; + } + elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'created')) + { + $this->data['date']['raw'] = $return[0]['data']; + } + elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'modified')) + { + $this->data['date']['raw'] = $return[0]['data']; + } + elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'pubDate')) + { + $this->data['date']['raw'] = $return[0]['data']; + } + elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'date')) + { + $this->data['date']['raw'] = $return[0]['data']; + } + elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'date')) + { + $this->data['date']['raw'] = $return[0]['data']; + } + + if (!empty($this->data['date']['raw'])) + { + $parser = SimplePie_Parse_Date::get(); + $this->data['date']['parsed'] = $parser->parse($this->data['date']['raw']); + } + else + { + $this->data['date'] = null; + } + } + if ($this->data['date']) + { + $date_format = (string) $date_format; + switch ($date_format) + { + case '': + return $this->sanitize($this->data['date']['raw'], SIMPLEPIE_CONSTRUCT_TEXT); + + case 'U': + return $this->data['date']['parsed']; + + default: + return date($date_format, $this->data['date']['parsed']); + } + } + else + { + return null; + } + } + + function get_local_date($date_format = '%c') + { + if (!$date_format) + { + return $this->sanitize($this->get_date(''), SIMPLEPIE_CONSTRUCT_TEXT); + } + elseif (($date = $this->get_date('U')) !== null) + { + return strftime($date_format, $date); + } + else + { + return null; + } + } + + function get_permalink() + { + $link = $this->get_link(); + $enclosure = $this->get_enclosure(0); + if ($link !== null) + { + return $link; + } + elseif ($enclosure !== null) + { + return $enclosure->get_link(); + } + else + { + return null; + } + } + + function get_link($key = 0, $rel = 'alternate') + { + $links = $this->get_links($rel); + if ($links[$key] !== null) + { + return $links[$key]; + } + else + { + return null; + } + } + + function get_links($rel = 'alternate') + { + if (!isset($this->data['links'])) + { + $this->data['links'] = array(); + foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'link') as $link) + { + if (isset($link['attribs']['']['href'])) + { + $link_rel = (isset($link['attribs']['']['rel'])) ? $link['attribs']['']['rel'] : 'alternate'; + $this->data['links'][$link_rel][] = $this->sanitize($link['attribs']['']['href'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($link)); + + } + } + foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'link') as $link) + { + if (isset($link['attribs']['']['href'])) + { + $link_rel = (isset($link['attribs']['']['rel'])) ? $link['attribs']['']['rel'] : 'alternate'; + $this->data['links'][$link_rel][] = $this->sanitize($link['attribs']['']['href'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($link)); + } + } + if ($links = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'link')) + { + $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0])); + } + if ($links = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'link')) + { + $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0])); + } + if ($links = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'link')) + { + $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0])); + } + if ($links = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'guid')) + { + if (!isset($links[0]['attribs']['']['isPermaLink']) || strtolower(trim($links[0]['attribs']['']['isPermaLink'])) === 'true') + { + $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0])); + } + } + + $keys = array_keys($this->data['links']); + foreach ($keys as $key) + { + if (SimplePie_Misc::is_isegment_nz_nc($key)) + { + if (isset($this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key])) + { + $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key] = array_merge($this->data['links'][$key], $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key]); + $this->data['links'][$key] =& $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key]; + } + else + { + $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key] =& $this->data['links'][$key]; + } + } + elseif (substr($key, 0, 41) === SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY) + { + $this->data['links'][substr($key, 41)] =& $this->data['links'][$key]; + } + $this->data['links'][$key] = array_unique($this->data['links'][$key]); + } + } + if (isset($this->data['links'][$rel])) + { + return $this->data['links'][$rel]; + } + else + { + return null; + } + } + + /** + * @todo Add ability to prefer one type of content over another (in a media group). + */ + function get_enclosure($key = 0, $prefer = null) + { + $enclosures = $this->get_enclosures(); + if (isset($enclosures[$key])) + { + return $enclosures[$key]; + } + else + { + return null; + } + } + + /** + * Grabs all available enclosures (podcasts, etc.) + * + * Supports the RSS tag, as well as Media RSS and iTunes RSS. + * + * At this point, we're pretty much assuming that all enclosures for an item are the same content. Anything else is too complicated to properly support. + * + * @todo Add support for end-user defined sorting of enclosures by type/handler (so we can prefer the faster-loading FLV over MP4). + * @todo If an element exists at a level, but it's value is empty, we should fall back to the value from the parent (if it exists). + */ + function get_enclosures() + { + if (!isset($this->data['enclosures'])) + { + $this->data['enclosures'] = array(); + + // Elements + $captions_parent = null; + $categories_parent = null; + $copyrights_parent = null; + $credits_parent = null; + $description_parent = null; + $duration_parent = null; + $hashes_parent = null; + $keywords_parent = null; + $player_parent = null; + $ratings_parent = null; + $restrictions_parent = null; + $thumbnails_parent = null; + $title_parent = null; + + // Let's do the channel and item-level ones first, and just re-use them if we need to. + $parent = $this->get_feed(); + + // CAPTIONS + if ($captions = $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'text')) + { + foreach ($captions as $caption) + { + $caption_type = null; + $caption_lang = null; + $caption_startTime = null; + $caption_endTime = null; + $caption_text = null; + if (isset($caption['attribs']['']['type'])) + { + $caption_type = $this->sanitize($caption['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($caption['attribs']['']['lang'])) + { + $caption_lang = $this->sanitize($caption['attribs']['']['lang'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($caption['attribs']['']['start'])) + { + $caption_startTime = $this->sanitize($caption['attribs']['']['start'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($caption['attribs']['']['end'])) + { + $caption_endTime = $this->sanitize($caption['attribs']['']['end'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($caption['data'])) + { + $caption_text = $this->sanitize($caption['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + $captions_parent[] =& new $this->feed->caption_class($caption_type, $caption_lang, $caption_startTime, $caption_endTime, $caption_text); + } + } + elseif ($captions = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'text')) + { + foreach ($captions as $caption) + { + $caption_type = null; + $caption_lang = null; + $caption_startTime = null; + $caption_endTime = null; + $caption_text = null; + if (isset($caption['attribs']['']['type'])) + { + $caption_type = $this->sanitize($caption['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($caption['attribs']['']['lang'])) + { + $caption_lang = $this->sanitize($caption['attribs']['']['lang'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($caption['attribs']['']['start'])) + { + $caption_startTime = $this->sanitize($caption['attribs']['']['start'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($caption['attribs']['']['end'])) + { + $caption_endTime = $this->sanitize($caption['attribs']['']['end'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($caption['data'])) + { + $caption_text = $this->sanitize($caption['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + $captions_parent[] =& new $this->feed->caption_class($caption_type, $caption_lang, $caption_startTime, $caption_endTime, $caption_text); + } + } + if (is_array($captions_parent)) + { + $captions_parent = array_values(SimplePie_Misc::array_unique($captions_parent)); + } + + // CATEGORIES + foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'category') as $category) + { + $term = null; + $scheme = null; + $label = null; + if (isset($category['data'])) + { + $term = $this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($category['attribs']['']['scheme'])) + { + $scheme = $this->sanitize($category['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT); + } + else + { + $scheme = 'http://search.yahoo.com/mrss/category_schema'; + } + if (isset($category['attribs']['']['label'])) + { + $label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT); + } + $categories_parent[] =& new $this->feed->category_class($term, $scheme, $label); + } + foreach ((array) $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'category') as $category) + { + $term = null; + $scheme = null; + $label = null; + if (isset($category['data'])) + { + $term = $this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($category['attribs']['']['scheme'])) + { + $scheme = $this->sanitize($category['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT); + } + else + { + $scheme = 'http://search.yahoo.com/mrss/category_schema'; + } + if (isset($category['attribs']['']['label'])) + { + $label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT); + } + $categories_parent[] =& new $this->feed->category_class($term, $scheme, $label); + } + foreach ((array) $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'category') as $category) + { + $term = null; + $scheme = 'http://www.itunes.com/dtds/podcast-1.0.dtd'; + $label = null; + if (isset($category['attribs']['']['text'])) + { + $label = $this->sanitize($category['attribs']['']['text'], SIMPLEPIE_CONSTRUCT_TEXT); + } + $categories_parent[] =& new $this->feed->category_class($term, $scheme, $label); + + if (isset($category['child'][SIMPLEPIE_NAMESPACE_ITUNES]['category'])) + { + foreach ((array) $category['child'][SIMPLEPIE_NAMESPACE_ITUNES]['category'] as $subcategory) + { + if (isset($subcategory['attribs']['']['text'])) + { + $label = $this->sanitize($subcategory['attribs']['']['text'], SIMPLEPIE_CONSTRUCT_TEXT); + } + $categories_parent[] =& new $this->feed->category_class($term, $scheme, $label); + } + } + } + if (is_array($categories_parent)) + { + $categories_parent = array_values(SimplePie_Misc::array_unique($categories_parent)); + } + + // COPYRIGHT + if ($copyright = $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'copyright')) + { + $copyright_url = null; + $copyright_label = null; + if (isset($copyright[0]['attribs']['']['url'])) + { + $copyright_url = $this->sanitize($copyright[0]['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($copyright[0]['data'])) + { + $copyright_label = $this->sanitize($copyright[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + $copyrights_parent =& new $this->feed->copyright_class($copyright_url, $copyright_label); + } + elseif ($copyright = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'copyright')) + { + $copyright_url = null; + $copyright_label = null; + if (isset($copyright[0]['attribs']['']['url'])) + { + $copyright_url = $this->sanitize($copyright[0]['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($copyright[0]['data'])) + { + $copyright_label = $this->sanitize($copyright[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + $copyrights_parent =& new $this->feed->copyright_class($copyright_url, $copyright_label); + } + + // CREDITS + if ($credits = $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'credit')) + { + foreach ($credits as $credit) + { + $credit_role = null; + $credit_scheme = null; + $credit_name = null; + if (isset($credit['attribs']['']['role'])) + { + $credit_role = $this->sanitize($credit['attribs']['']['role'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($credit['attribs']['']['scheme'])) + { + $credit_scheme = $this->sanitize($credit['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT); + } + else + { + $credit_scheme = 'urn:ebu'; + } + if (isset($credit['data'])) + { + $credit_name = $this->sanitize($credit['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + $credits_parent[] =& new $this->feed->credit_class($credit_role, $credit_scheme, $credit_name); + } + } + elseif ($credits = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'credit')) + { + foreach ($credits as $credit) + { + $credit_role = null; + $credit_scheme = null; + $credit_name = null; + if (isset($credit['attribs']['']['role'])) + { + $credit_role = $this->sanitize($credit['attribs']['']['role'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($credit['attribs']['']['scheme'])) + { + $credit_scheme = $this->sanitize($credit['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT); + } + else + { + $credit_scheme = 'urn:ebu'; + } + if (isset($credit['data'])) + { + $credit_name = $this->sanitize($credit['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + $credits_parent[] =& new $this->feed->credit_class($credit_role, $credit_scheme, $credit_name); + } + } + if (is_array($credits_parent)) + { + $credits_parent = array_values(SimplePie_Misc::array_unique($credits_parent)); + } + + // DESCRIPTION + if ($description_parent = $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'description')) + { + if (isset($description_parent[0]['data'])) + { + $description_parent = $this->sanitize($description_parent[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + } + elseif ($description_parent = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'description')) + { + if (isset($description_parent[0]['data'])) + { + $description_parent = $this->sanitize($description_parent[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + } + + // DURATION + if ($duration_parent = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'duration')) + { + $seconds = null; + $minutes = null; + $hours = null; + if (isset($duration_parent[0]['data'])) + { + $temp = explode(':', $this->sanitize($duration_parent[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT)); + if (sizeof($temp) > 0) + { + $seconds = (int) array_pop($temp); + } + if (sizeof($temp) > 0) + { + $minutes = (int) array_pop($temp); + $seconds += $minutes * 60; + } + if (sizeof($temp) > 0) + { + $hours = (int) array_pop($temp); + $seconds += $hours * 3600; + } + unset($temp); + $duration_parent = $seconds; + } + } + + // HASHES + if ($hashes_iterator = $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'hash')) + { + foreach ($hashes_iterator as $hash) + { + $value = null; + $algo = null; + if (isset($hash['data'])) + { + $value = $this->sanitize($hash['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($hash['attribs']['']['algo'])) + { + $algo = $this->sanitize($hash['attribs']['']['algo'], SIMPLEPIE_CONSTRUCT_TEXT); + } + else + { + $algo = 'md5'; + } + $hashes_parent[] = $algo.':'.$value; + } + } + elseif ($hashes_iterator = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'hash')) + { + foreach ($hashes_iterator as $hash) + { + $value = null; + $algo = null; + if (isset($hash['data'])) + { + $value = $this->sanitize($hash['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($hash['attribs']['']['algo'])) + { + $algo = $this->sanitize($hash['attribs']['']['algo'], SIMPLEPIE_CONSTRUCT_TEXT); + } + else + { + $algo = 'md5'; + } + $hashes_parent[] = $algo.':'.$value; + } + } + if (is_array($hashes_parent)) + { + $hashes_parent = array_values(SimplePie_Misc::array_unique($hashes_parent)); + } + + // KEYWORDS + if ($keywords = $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'keywords')) + { + if (isset($keywords[0]['data'])) + { + $temp = explode(',', $this->sanitize($keywords[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT)); + foreach ($temp as $word) + { + $keywords_parent[] = trim($word); + } + } + unset($temp); + } + elseif ($keywords = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'keywords')) + { + if (isset($keywords[0]['data'])) + { + $temp = explode(',', $this->sanitize($keywords[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT)); + foreach ($temp as $word) + { + $keywords_parent[] = trim($word); + } + } + unset($temp); + } + elseif ($keywords = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'keywords')) + { + if (isset($keywords[0]['data'])) + { + $temp = explode(',', $this->sanitize($keywords[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT)); + foreach ($temp as $word) + { + $keywords_parent[] = trim($word); + } + } + unset($temp); + } + elseif ($keywords = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'keywords')) + { + if (isset($keywords[0]['data'])) + { + $temp = explode(',', $this->sanitize($keywords[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT)); + foreach ($temp as $word) + { + $keywords_parent[] = trim($word); + } + } + unset($temp); + } + if (is_array($keywords_parent)) + { + $keywords_parent = array_values(SimplePie_Misc::array_unique($keywords_parent)); + } + + // PLAYER + if ($player_parent = $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'player')) + { + if (isset($player_parent[0]['attribs']['']['url'])) + { + $player_parent = $this->sanitize($player_parent[0]['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI); + } + } + elseif ($player_parent = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'player')) + { + if (isset($player_parent[0]['attribs']['']['url'])) + { + $player_parent = $this->sanitize($player_parent[0]['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI); + } + } + + // RATINGS + if ($ratings = $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'rating')) + { + foreach ($ratings as $rating) + { + $rating_scheme = null; + $rating_value = null; + if (isset($rating['attribs']['']['scheme'])) + { + $rating_scheme = $this->sanitize($rating['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT); + } + else + { + $rating_scheme = 'urn:simple'; + } + if (isset($rating['data'])) + { + $rating_value = $this->sanitize($rating['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + $ratings_parent[] =& new $this->feed->rating_class($rating_scheme, $rating_value); + } + } + elseif ($ratings = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'explicit')) + { + foreach ($ratings as $rating) + { + $rating_scheme = 'urn:itunes'; + $rating_value = null; + if (isset($rating['data'])) + { + $rating_value = $this->sanitize($rating['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + $ratings_parent[] =& new $this->feed->rating_class($rating_scheme, $rating_value); + } + } + elseif ($ratings = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'rating')) + { + foreach ($ratings as $rating) + { + $rating_scheme = null; + $rating_value = null; + if (isset($rating['attribs']['']['scheme'])) + { + $rating_scheme = $this->sanitize($rating['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT); + } + else + { + $rating_scheme = 'urn:simple'; + } + if (isset($rating['data'])) + { + $rating_value = $this->sanitize($rating['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + $ratings_parent[] =& new $this->feed->rating_class($rating_scheme, $rating_value); + } + } + elseif ($ratings = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'explicit')) + { + foreach ($ratings as $rating) + { + $rating_scheme = 'urn:itunes'; + $rating_value = null; + if (isset($rating['data'])) + { + $rating_value = $this->sanitize($rating['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + $ratings_parent[] =& new $this->feed->rating_class($rating_scheme, $rating_value); + } + } + if (is_array($ratings_parent)) + { + $ratings_parent = array_values(SimplePie_Misc::array_unique($ratings_parent)); + } + + // RESTRICTIONS + if ($restrictions = $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'restriction')) + { + foreach ($restrictions as $restriction) + { + $restriction_relationship = null; + $restriction_type = null; + $restriction_value = null; + if (isset($restriction['attribs']['']['relationship'])) + { + $restriction_relationship = $this->sanitize($restriction['attribs']['']['relationship'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($restriction['attribs']['']['type'])) + { + $restriction_type = $this->sanitize($restriction['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($restriction['data'])) + { + $restriction_value = $this->sanitize($restriction['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + $restrictions_parent[] =& new $this->feed->restriction_class($restriction_relationship, $restriction_type, $restriction_value); + } + } + elseif ($restrictions = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'block')) + { + foreach ($restrictions as $restriction) + { + $restriction_relationship = 'allow'; + $restriction_type = null; + $restriction_value = 'itunes'; + if (isset($restriction['data']) && strtolower($restriction['data']) === 'yes') + { + $restriction_relationship = 'deny'; + } + $restrictions_parent[] =& new $this->feed->restriction_class($restriction_relationship, $restriction_type, $restriction_value); + } + } + elseif ($restrictions = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'restriction')) + { + foreach ($restrictions as $restriction) + { + $restriction_relationship = null; + $restriction_type = null; + $restriction_value = null; + if (isset($restriction['attribs']['']['relationship'])) + { + $restriction_relationship = $this->sanitize($restriction['attribs']['']['relationship'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($restriction['attribs']['']['type'])) + { + $restriction_type = $this->sanitize($restriction['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($restriction['data'])) + { + $restriction_value = $this->sanitize($restriction['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + $restrictions_parent[] =& new $this->feed->restriction_class($restriction_relationship, $restriction_type, $restriction_value); + } + } + elseif ($restrictions = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'block')) + { + foreach ($restrictions as $restriction) + { + $restriction_relationship = 'allow'; + $restriction_type = null; + $restriction_value = 'itunes'; + if (isset($restriction['data']) && strtolower($restriction['data']) === 'yes') + { + $restriction_relationship = 'deny'; + } + $restrictions_parent[] =& new $this->feed->restriction_class($restriction_relationship, $restriction_type, $restriction_value); + } + } + if (is_array($restrictions_parent)) + { + $restrictions_parent = array_values(SimplePie_Misc::array_unique($restrictions_parent)); + } + + // THUMBNAILS + if ($thumbnails = $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'thumbnail')) + { + foreach ($thumbnails as $thumbnail) + { + if (isset($thumbnail['attribs']['']['url'])) + { + $thumbnails_parent[] = $this->sanitize($thumbnail['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI); + } + } + } + elseif ($thumbnails = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'thumbnail')) + { + foreach ($thumbnails as $thumbnail) + { + if (isset($thumbnail['attribs']['']['url'])) + { + $thumbnails_parent[] = $this->sanitize($thumbnail['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI); + } + } + } + + // TITLES + if ($title_parent = $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'title')) + { + if (isset($title_parent[0]['data'])) + { + $title_parent = $this->sanitize($title_parent[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + } + elseif ($title_parent = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'title')) + { + if (isset($title_parent[0]['data'])) + { + $title_parent = $this->sanitize($title_parent[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + } + + // Clear the memory + unset($parent); + + // Attributes + $bitrate = null; + $channels = null; + $duration = null; + $expression = null; + $framerate = null; + $height = null; + $javascript = null; + $lang = null; + $length = null; + $medium = null; + $samplingrate = null; + $type = null; + $url = null; + $width = null; + + // Elements + $captions = null; + $categories = null; + $copyrights = null; + $credits = null; + $description = null; + $hashes = null; + $keywords = null; + $player = null; + $ratings = null; + $restrictions = null; + $thumbnails = null; + $title = null; + + // If we have media:group tags, loop through them. + foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'group') as $group) + { + // If we have media:content tags, loop through them. + foreach ((array) $group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['content'] as $content) + { + if (isset($content['attribs']['']['url'])) + { + // Attributes + $bitrate = null; + $channels = null; + $duration = null; + $expression = null; + $framerate = null; + $height = null; + $javascript = null; + $lang = null; + $length = null; + $medium = null; + $samplingrate = null; + $type = null; + $url = null; + $width = null; + + // Elements + $captions = null; + $categories = null; + $copyrights = null; + $credits = null; + $description = null; + $hashes = null; + $keywords = null; + $player = null; + $ratings = null; + $restrictions = null; + $thumbnails = null; + $title = null; + + // Start checking the attributes of media:content + if (isset($content['attribs']['']['bitrate'])) + { + $bitrate = $this->sanitize($content['attribs']['']['bitrate'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($content['attribs']['']['channels'])) + { + $channels = $this->sanitize($content['attribs']['']['channels'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($content['attribs']['']['duration'])) + { + $duration = $this->sanitize($content['attribs']['']['duration'], SIMPLEPIE_CONSTRUCT_TEXT); + } + else + { + $duration = $duration_parent; + } + if (isset($content['attribs']['']['expression'])) + { + $expression = $this->sanitize($content['attribs']['']['expression'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($content['attribs']['']['framerate'])) + { + $framerate = $this->sanitize($content['attribs']['']['framerate'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($content['attribs']['']['height'])) + { + $height = $this->sanitize($content['attribs']['']['height'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($content['attribs']['']['lang'])) + { + $lang = $this->sanitize($content['attribs']['']['lang'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($content['attribs']['']['fileSize'])) + { + $length = ceil($content['attribs']['']['fileSize']); + } + if (isset($content['attribs']['']['medium'])) + { + $medium = $this->sanitize($content['attribs']['']['medium'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($content['attribs']['']['samplingrate'])) + { + $samplingrate = $this->sanitize($content['attribs']['']['samplingrate'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($content['attribs']['']['type'])) + { + $type = $this->sanitize($content['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($content['attribs']['']['width'])) + { + $width = $this->sanitize($content['attribs']['']['width'], SIMPLEPIE_CONSTRUCT_TEXT); + } + $url = $this->sanitize($content['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI); + + // Checking the other optional media: elements. Priority: media:content, media:group, item, channel + + // CAPTIONS + if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['text'])) + { + foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['text'] as $caption) + { + $caption_type = null; + $caption_lang = null; + $caption_startTime = null; + $caption_endTime = null; + $caption_text = null; + if (isset($caption['attribs']['']['type'])) + { + $caption_type = $this->sanitize($caption['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($caption['attribs']['']['lang'])) + { + $caption_lang = $this->sanitize($caption['attribs']['']['lang'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($caption['attribs']['']['start'])) + { + $caption_startTime = $this->sanitize($caption['attribs']['']['start'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($caption['attribs']['']['end'])) + { + $caption_endTime = $this->sanitize($caption['attribs']['']['end'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($caption['data'])) + { + $caption_text = $this->sanitize($caption['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + $captions[] =& new $this->feed->caption_class($caption_type, $caption_lang, $caption_startTime, $caption_endTime, $caption_text); + } + if (is_array($captions)) + { + $captions = array_values(SimplePie_Misc::array_unique($captions)); + } + } + elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['text'])) + { + foreach ($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['text'] as $caption) + { + $caption_type = null; + $caption_lang = null; + $caption_startTime = null; + $caption_endTime = null; + $caption_text = null; + if (isset($caption['attribs']['']['type'])) + { + $caption_type = $this->sanitize($caption['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($caption['attribs']['']['lang'])) + { + $caption_lang = $this->sanitize($caption['attribs']['']['lang'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($caption['attribs']['']['start'])) + { + $caption_startTime = $this->sanitize($caption['attribs']['']['start'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($caption['attribs']['']['end'])) + { + $caption_endTime = $this->sanitize($caption['attribs']['']['end'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($caption['data'])) + { + $caption_text = $this->sanitize($caption['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + $captions[] =& new $this->feed->caption_class($caption_type, $caption_lang, $caption_startTime, $caption_endTime, $caption_text); + } + if (is_array($captions)) + { + $captions = array_values(SimplePie_Misc::array_unique($captions)); + } + } + else + { + $captions = $captions_parent; + } + + // CATEGORIES + if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['category'])) + { + foreach ((array) $content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['category'] as $category) + { + $term = null; + $scheme = null; + $label = null; + if (isset($category['data'])) + { + $term = $this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($category['attribs']['']['scheme'])) + { + $scheme = $this->sanitize($category['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT); + } + else + { + $scheme = 'http://search.yahoo.com/mrss/category_schema'; + } + if (isset($category['attribs']['']['label'])) + { + $label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT); + } + $categories[] =& new $this->feed->category_class($term, $scheme, $label); + } + } + if (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['category'])) + { + foreach ((array) $group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['category'] as $category) + { + $term = null; + $scheme = null; + $label = null; + if (isset($category['data'])) + { + $term = $this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($category['attribs']['']['scheme'])) + { + $scheme = $this->sanitize($category['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT); + } + else + { + $scheme = 'http://search.yahoo.com/mrss/category_schema'; + } + if (isset($category['attribs']['']['label'])) + { + $label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT); + } + $categories[] =& new $this->feed->category_class($term, $scheme, $label); + } + } + if (is_array($categories) && is_array($categories_parent)) + { + $categories = array_values(SimplePie_Misc::array_unique(array_merge($categories, $categories_parent))); + } + elseif (is_array($categories)) + { + $categories = array_values(SimplePie_Misc::array_unique($categories)); + } + elseif (is_array($categories_parent)) + { + $categories = array_values(SimplePie_Misc::array_unique($categories_parent)); + } + + // COPYRIGHTS + if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'])) + { + $copyright_url = null; + $copyright_label = null; + if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['attribs']['']['url'])) + { + $copyright_url = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['data'])) + { + $copyright_label = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + $copyrights =& new $this->feed->copyright_class($copyright_url, $copyright_label); + } + elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'])) + { + $copyright_url = null; + $copyright_label = null; + if (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['attribs']['']['url'])) + { + $copyright_url = $this->sanitize($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['data'])) + { + $copyright_label = $this->sanitize($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + $copyrights =& new $this->feed->copyright_class($copyright_url, $copyright_label); + } + else + { + $copyrights = $copyrights_parent; + } + + // CREDITS + if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['credit'])) + { + foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['credit'] as $credit) + { + $credit_role = null; + $credit_scheme = null; + $credit_name = null; + if (isset($credit['attribs']['']['role'])) + { + $credit_role = $this->sanitize($credit['attribs']['']['role'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($credit['attribs']['']['scheme'])) + { + $credit_scheme = $this->sanitize($credit['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT); + } + else + { + $credit_scheme = 'urn:ebu'; + } + if (isset($credit['data'])) + { + $credit_name = $this->sanitize($credit['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + $credits[] =& new $this->feed->credit_class($credit_role, $credit_scheme, $credit_name); + } + if (is_array($credits)) + { + $credits = array_values(SimplePie_Misc::array_unique($credits)); + } + } + elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['credit'])) + { + foreach ($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['credit'] as $credit) + { + $credit_role = null; + $credit_scheme = null; + $credit_name = null; + if (isset($credit['attribs']['']['role'])) + { + $credit_role = $this->sanitize($credit['attribs']['']['role'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($credit['attribs']['']['scheme'])) + { + $credit_scheme = $this->sanitize($credit['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT); + } + else + { + $credit_scheme = 'urn:ebu'; + } + if (isset($credit['data'])) + { + $credit_name = $this->sanitize($credit['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + $credits[] =& new $this->feed->credit_class($credit_role, $credit_scheme, $credit_name); + } + if (is_array($credits)) + { + $credits = array_values(SimplePie_Misc::array_unique($credits)); + } + } + else + { + $credits = $credits_parent; + } + + // DESCRIPTION + if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['description'])) + { + $description = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['description'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['description'])) + { + $description = $this->sanitize($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['description'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + else + { + $description = $description_parent; + } + + // HASHES + if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['hash'])) + { + foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['hash'] as $hash) + { + $value = null; + $algo = null; + if (isset($hash['data'])) + { + $value = $this->sanitize($hash['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($hash['attribs']['']['algo'])) + { + $algo = $this->sanitize($hash['attribs']['']['algo'], SIMPLEPIE_CONSTRUCT_TEXT); + } + else + { + $algo = 'md5'; + } + $hashes[] = $algo.':'.$value; + } + if (is_array($hashes)) + { + $hashes = array_values(SimplePie_Misc::array_unique($hashes)); + } + } + elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['hash'])) + { + foreach ($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['hash'] as $hash) + { + $value = null; + $algo = null; + if (isset($hash['data'])) + { + $value = $this->sanitize($hash['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($hash['attribs']['']['algo'])) + { + $algo = $this->sanitize($hash['attribs']['']['algo'], SIMPLEPIE_CONSTRUCT_TEXT); + } + else + { + $algo = 'md5'; + } + $hashes[] = $algo.':'.$value; + } + if (is_array($hashes)) + { + $hashes = array_values(SimplePie_Misc::array_unique($hashes)); + } + } + else + { + $hashes = $hashes_parent; + } + + // KEYWORDS + if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['keywords'])) + { + if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['keywords'][0]['data'])) + { + $temp = explode(',', $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['keywords'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT)); + foreach ($temp as $word) + { + $keywords[] = trim($word); + } + unset($temp); + } + if (is_array($keywords)) + { + $keywords = array_values(SimplePie_Misc::array_unique($keywords)); + } + } + elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['keywords'])) + { + if (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['keywords'][0]['data'])) + { + $temp = explode(',', $this->sanitize($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['keywords'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT)); + foreach ($temp as $word) + { + $keywords[] = trim($word); + } + unset($temp); + } + if (is_array($keywords)) + { + $keywords = array_values(SimplePie_Misc::array_unique($keywords)); + } + } + else + { + $keywords = $keywords_parent; + } + + // PLAYER + if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['player'])) + { + $player = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['player'][0]['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI); + } + elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['player'])) + { + $player = $this->sanitize($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['player'][0]['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI); + } + else + { + $player = $player_parent; + } + + // RATINGS + if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['rating'])) + { + foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['rating'] as $rating) + { + $rating_scheme = null; + $rating_value = null; + if (isset($rating['attribs']['']['scheme'])) + { + $rating_scheme = $this->sanitize($rating['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT); + } + else + { + $rating_scheme = 'urn:simple'; + } + if (isset($rating['data'])) + { + $rating_value = $this->sanitize($rating['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + $ratings[] =& new $this->feed->rating_class($rating_scheme, $rating_value); + } + if (is_array($ratings)) + { + $ratings = array_values(SimplePie_Misc::array_unique($ratings)); + } + } + elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['rating'])) + { + foreach ($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['rating'] as $rating) + { + $rating_scheme = null; + $rating_value = null; + if (isset($rating['attribs']['']['scheme'])) + { + $rating_scheme = $this->sanitize($rating['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT); + } + else + { + $rating_scheme = 'urn:simple'; + } + if (isset($rating['data'])) + { + $rating_value = $this->sanitize($rating['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + $ratings[] =& new $this->feed->rating_class($rating_scheme, $rating_value); + } + if (is_array($ratings)) + { + $ratings = array_values(SimplePie_Misc::array_unique($ratings)); + } + } + else + { + $ratings = $ratings_parent; + } + + // RESTRICTIONS + if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['restriction'])) + { + foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['restriction'] as $restriction) + { + $restriction_relationship = null; + $restriction_type = null; + $restriction_value = null; + if (isset($restriction['attribs']['']['relationship'])) + { + $restriction_relationship = $this->sanitize($restriction['attribs']['']['relationship'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($restriction['attribs']['']['type'])) + { + $restriction_type = $this->sanitize($restriction['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($restriction['data'])) + { + $restriction_value = $this->sanitize($restriction['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + $restrictions[] =& new $this->feed->restriction_class($restriction_relationship, $restriction_type, $restriction_value); + } + if (is_array($restrictions)) + { + $restrictions = array_values(SimplePie_Misc::array_unique($restrictions)); + } + } + elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['restriction'])) + { + foreach ($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['restriction'] as $restriction) + { + $restriction_relationship = null; + $restriction_type = null; + $restriction_value = null; + if (isset($restriction['attribs']['']['relationship'])) + { + $restriction_relationship = $this->sanitize($restriction['attribs']['']['relationship'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($restriction['attribs']['']['type'])) + { + $restriction_type = $this->sanitize($restriction['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($restriction['data'])) + { + $restriction_value = $this->sanitize($restriction['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + $restrictions[] =& new $this->feed->restriction_class($restriction_relationship, $restriction_type, $restriction_value); + } + if (is_array($restrictions)) + { + $restrictions = array_values(SimplePie_Misc::array_unique($restrictions)); + } + } + else + { + $restrictions = $restrictions_parent; + } + + // THUMBNAILS + if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['thumbnail'])) + { + foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['thumbnail'] as $thumbnail) + { + $thumbnails[] = $this->sanitize($thumbnail['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI); + } + if (is_array($thumbnails)) + { + $thumbnails = array_values(SimplePie_Misc::array_unique($thumbnails)); + } + } + elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['thumbnail'])) + { + foreach ($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['thumbnail'] as $thumbnail) + { + $thumbnails[] = $this->sanitize($thumbnail['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI); + } + if (is_array($thumbnails)) + { + $thumbnails = array_values(SimplePie_Misc::array_unique($thumbnails)); + } + } + else + { + $thumbnails = $thumbnails_parent; + } + + // TITLES + if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['title'])) + { + $title = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['title'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['title'])) + { + $title = $this->sanitize($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['title'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + else + { + $title = $title_parent; + } + + $this->data['enclosures'][] =& new $this->feed->enclosure_class($url, $type, $length, $this->feed->javascript, $bitrate, $captions, $categories, $channels, $copyrights, $credits, $description, $duration, $expression, $framerate, $hashes, $height, $keywords, $lang, $medium, $player, $ratings, $restrictions, $samplingrate, $thumbnails, $title, $width); + } + } + } + + // If we have standalone media:content tags, loop through them. + if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['content'])) + { + foreach ((array) $this->data['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['content'] as $content) + { + if (isset($content['attribs']['']['url'])) + { + // Attributes + $bitrate = null; + $channels = null; + $duration = null; + $expression = null; + $framerate = null; + $height = null; + $javascript = null; + $lang = null; + $length = null; + $medium = null; + $samplingrate = null; + $type = null; + $url = null; + $width = null; + + // Elements + $captions = null; + $categories = null; + $copyrights = null; + $credits = null; + $description = null; + $hashes = null; + $keywords = null; + $player = null; + $ratings = null; + $restrictions = null; + $thumbnails = null; + $title = null; + + // Start checking the attributes of media:content + if (isset($content['attribs']['']['bitrate'])) + { + $bitrate = $this->sanitize($content['attribs']['']['bitrate'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($content['attribs']['']['channels'])) + { + $channels = $this->sanitize($content['attribs']['']['channels'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($content['attribs']['']['duration'])) + { + $duration = $this->sanitize($content['attribs']['']['duration'], SIMPLEPIE_CONSTRUCT_TEXT); + } + else + { + $duration = $duration_parent; + } + if (isset($content['attribs']['']['expression'])) + { + $expression = $this->sanitize($content['attribs']['']['expression'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($content['attribs']['']['framerate'])) + { + $framerate = $this->sanitize($content['attribs']['']['framerate'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($content['attribs']['']['height'])) + { + $height = $this->sanitize($content['attribs']['']['height'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($content['attribs']['']['lang'])) + { + $lang = $this->sanitize($content['attribs']['']['lang'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($content['attribs']['']['fileSize'])) + { + $length = ceil($content['attribs']['']['fileSize']); + } + if (isset($content['attribs']['']['medium'])) + { + $medium = $this->sanitize($content['attribs']['']['medium'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($content['attribs']['']['samplingrate'])) + { + $samplingrate = $this->sanitize($content['attribs']['']['samplingrate'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($content['attribs']['']['type'])) + { + $type = $this->sanitize($content['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($content['attribs']['']['width'])) + { + $width = $this->sanitize($content['attribs']['']['width'], SIMPLEPIE_CONSTRUCT_TEXT); + } + $url = $this->sanitize($content['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI); + + // Checking the other optional media: elements. Priority: media:content, media:group, item, channel + + // CAPTIONS + if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['text'])) + { + foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['text'] as $caption) + { + $caption_type = null; + $caption_lang = null; + $caption_startTime = null; + $caption_endTime = null; + $caption_text = null; + if (isset($caption['attribs']['']['type'])) + { + $caption_type = $this->sanitize($caption['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($caption['attribs']['']['lang'])) + { + $caption_lang = $this->sanitize($caption['attribs']['']['lang'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($caption['attribs']['']['start'])) + { + $caption_startTime = $this->sanitize($caption['attribs']['']['start'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($caption['attribs']['']['end'])) + { + $caption_endTime = $this->sanitize($caption['attribs']['']['end'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($caption['data'])) + { + $caption_text = $this->sanitize($caption['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + $captions[] =& new $this->feed->caption_class($caption_type, $caption_lang, $caption_startTime, $caption_endTime, $caption_text); + } + if (is_array($captions)) + { + $captions = array_values(SimplePie_Misc::array_unique($captions)); + } + } + else + { + $captions = $captions_parent; + } + + // CATEGORIES + if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['category'])) + { + foreach ((array) $content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['category'] as $category) + { + $term = null; + $scheme = null; + $label = null; + if (isset($category['data'])) + { + $term = $this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($category['attribs']['']['scheme'])) + { + $scheme = $this->sanitize($category['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT); + } + else + { + $scheme = 'http://search.yahoo.com/mrss/category_schema'; + } + if (isset($category['attribs']['']['label'])) + { + $label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT); + } + $categories[] =& new $this->feed->category_class($term, $scheme, $label); + } + } + if (is_array($categories) && is_array($categories_parent)) + { + $categories = array_values(SimplePie_Misc::array_unique(array_merge($categories, $categories_parent))); + } + elseif (is_array($categories)) + { + $categories = array_values(SimplePie_Misc::array_unique($categories)); + } + elseif (is_array($categories_parent)) + { + $categories = array_values(SimplePie_Misc::array_unique($categories_parent)); + } + else + { + $categories = null; + } + + // COPYRIGHTS + if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'])) + { + $copyright_url = null; + $copyright_label = null; + if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['attribs']['']['url'])) + { + $copyright_url = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['data'])) + { + $copyright_label = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + $copyrights =& new $this->feed->copyright_class($copyright_url, $copyright_label); + } + else + { + $copyrights = $copyrights_parent; + } + + // CREDITS + if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['credit'])) + { + foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['credit'] as $credit) + { + $credit_role = null; + $credit_scheme = null; + $credit_name = null; + if (isset($credit['attribs']['']['role'])) + { + $credit_role = $this->sanitize($credit['attribs']['']['role'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($credit['attribs']['']['scheme'])) + { + $credit_scheme = $this->sanitize($credit['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT); + } + else + { + $credit_scheme = 'urn:ebu'; + } + if (isset($credit['data'])) + { + $credit_name = $this->sanitize($credit['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + $credits[] =& new $this->feed->credit_class($credit_role, $credit_scheme, $credit_name); + } + if (is_array($credits)) + { + $credits = array_values(SimplePie_Misc::array_unique($credits)); + } + } + else + { + $credits = $credits_parent; + } + + // DESCRIPTION + if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['description'])) + { + $description = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['description'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + else + { + $description = $description_parent; + } + + // HASHES + if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['hash'])) + { + foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['hash'] as $hash) + { + $value = null; + $algo = null; + if (isset($hash['data'])) + { + $value = $this->sanitize($hash['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($hash['attribs']['']['algo'])) + { + $algo = $this->sanitize($hash['attribs']['']['algo'], SIMPLEPIE_CONSTRUCT_TEXT); + } + else + { + $algo = 'md5'; + } + $hashes[] = $algo.':'.$value; + } + if (is_array($hashes)) + { + $hashes = array_values(SimplePie_Misc::array_unique($hashes)); + } + } + else + { + $hashes = $hashes_parent; + } + + // KEYWORDS + if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['keywords'])) + { + if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['keywords'][0]['data'])) + { + $temp = explode(',', $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['keywords'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT)); + foreach ($temp as $word) + { + $keywords[] = trim($word); + } + unset($temp); + } + if (is_array($keywords)) + { + $keywords = array_values(SimplePie_Misc::array_unique($keywords)); + } + } + else + { + $keywords = $keywords_parent; + } + + // PLAYER + if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['player'])) + { + $player = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['player'][0]['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI); + } + else + { + $player = $player_parent; + } + + // RATINGS + if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['rating'])) + { + foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['rating'] as $rating) + { + $rating_scheme = null; + $rating_value = null; + if (isset($rating['attribs']['']['scheme'])) + { + $rating_scheme = $this->sanitize($rating['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT); + } + else + { + $rating_scheme = 'urn:simple'; + } + if (isset($rating['data'])) + { + $rating_value = $this->sanitize($rating['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + $ratings[] =& new $this->feed->rating_class($rating_scheme, $rating_value); + } + if (is_array($ratings)) + { + $ratings = array_values(SimplePie_Misc::array_unique($ratings)); + } + } + else + { + $ratings = $ratings_parent; + } + + // RESTRICTIONS + if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['restriction'])) + { + foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['restriction'] as $restriction) + { + $restriction_relationship = null; + $restriction_type = null; + $restriction_value = null; + if (isset($restriction['attribs']['']['relationship'])) + { + $restriction_relationship = $this->sanitize($restriction['attribs']['']['relationship'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($restriction['attribs']['']['type'])) + { + $restriction_type = $this->sanitize($restriction['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($restriction['data'])) + { + $restriction_value = $this->sanitize($restriction['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + $restrictions[] =& new $this->feed->restriction_class($restriction_relationship, $restriction_type, $restriction_value); + } + if (is_array($restrictions)) + { + $restrictions = array_values(SimplePie_Misc::array_unique($restrictions)); + } + } + else + { + $restrictions = $restrictions_parent; + } + + // THUMBNAILS + if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['thumbnail'])) + { + foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['thumbnail'] as $thumbnail) + { + $thumbnails[] = $this->sanitize($thumbnail['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI); + } + if (is_array($thumbnails)) + { + $thumbnails = array_values(SimplePie_Misc::array_unique($thumbnails)); + } + } + else + { + $thumbnails = $thumbnails_parent; + } + + // TITLES + if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['title'])) + { + $title = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['title'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + else + { + $title = $title_parent; + } + + $this->data['enclosures'][] =& new $this->feed->enclosure_class($url, $type, $length, $this->feed->javascript, $bitrate, $captions, $categories, $channels, $copyrights, $credits, $description, $duration, $expression, $framerate, $hashes, $height, $keywords, $lang, $medium, $player, $ratings, $restrictions, $samplingrate, $thumbnails, $title, $width); + } + } + } + + foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'link') as $link) + { + if (isset($link['attribs']['']['href']) && !empty($link['attribs']['']['rel']) && $link['attribs']['']['rel'] === 'enclosure') + { + // Attributes + $bitrate = null; + $channels = null; + $duration = null; + $expression = null; + $framerate = null; + $height = null; + $javascript = null; + $lang = null; + $length = null; + $medium = null; + $samplingrate = null; + $type = null; + $url = null; + $width = null; + + $url = $this->sanitize($link['attribs']['']['href'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($link)); + if (isset($link['attribs']['']['type'])) + { + $type = $this->sanitize($link['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($link['attribs']['']['length'])) + { + $length = ceil($link['attribs']['']['length']); + } + + // Since we don't have group or content for these, we'll just pass the '*_parent' variables directly to the constructor + $this->data['enclosures'][] =& new $this->feed->enclosure_class($url, $type, $length, $this->feed->javascript, $bitrate, $captions_parent, $categories_parent, $channels, $copyrights_parent, $credits_parent, $description_parent, $duration_parent, $expression, $framerate, $hashes_parent, $height, $keywords_parent, $lang, $medium, $player_parent, $ratings_parent, $restrictions_parent, $samplingrate, $thumbnails_parent, $title_parent, $width); + } + } + + foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'link') as $link) + { + if (isset($link['attribs']['']['href']) && !empty($link['attribs']['']['rel']) && $link['attribs']['']['rel'] === 'enclosure') + { + // Attributes + $bitrate = null; + $channels = null; + $duration = null; + $expression = null; + $framerate = null; + $height = null; + $javascript = null; + $lang = null; + $length = null; + $medium = null; + $samplingrate = null; + $type = null; + $url = null; + $width = null; + + $url = $this->sanitize($link['attribs']['']['href'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($link)); + if (isset($link['attribs']['']['type'])) + { + $type = $this->sanitize($link['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($link['attribs']['']['length'])) + { + $length = ceil($link['attribs']['']['length']); + } + + // Since we don't have group or content for these, we'll just pass the '*_parent' variables directly to the constructor + $this->data['enclosures'][] =& new $this->feed->enclosure_class($url, $type, $length, $this->feed->javascript, $bitrate, $captions_parent, $categories_parent, $channels, $copyrights_parent, $credits_parent, $description_parent, $duration_parent, $expression, $framerate, $hashes_parent, $height, $keywords_parent, $lang, $medium, $player_parent, $ratings_parent, $restrictions_parent, $samplingrate, $thumbnails_parent, $title_parent, $width); + } + } + + if ($enclosure = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'enclosure')) + { + if (isset($enclosure[0]['attribs']['']['url'])) + { + // Attributes + $bitrate = null; + $channels = null; + $duration = null; + $expression = null; + $framerate = null; + $height = null; + $javascript = null; + $lang = null; + $length = null; + $medium = null; + $samplingrate = null; + $type = null; + $url = null; + $width = null; + + $url = $this->sanitize($enclosure[0]['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($enclosure[0])); + if (isset($enclosure[0]['attribs']['']['type'])) + { + $type = $this->sanitize($enclosure[0]['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($enclosure[0]['attribs']['']['length'])) + { + $length = ceil($enclosure[0]['attribs']['']['length']); + } + + // Since we don't have group or content for these, we'll just pass the '*_parent' variables directly to the constructor + $this->data['enclosures'][] =& new $this->feed->enclosure_class($url, $type, $length, $this->feed->javascript, $bitrate, $captions_parent, $categories_parent, $channels, $copyrights_parent, $credits_parent, $description_parent, $duration_parent, $expression, $framerate, $hashes_parent, $height, $keywords_parent, $lang, $medium, $player_parent, $ratings_parent, $restrictions_parent, $samplingrate, $thumbnails_parent, $title_parent, $width); + } + } + + if (sizeof($this->data['enclosures']) === 0 && ($url || $type || $length || $bitrate || $captions_parent || $categories_parent || $channels || $copyrights_parent || $credits_parent || $description_parent || $duration_parent || $expression || $framerate || $hashes_parent || $height || $keywords_parent || $lang || $medium || $player_parent || $ratings_parent || $restrictions_parent || $samplingrate || $thumbnails_parent || $title_parent || $width)) + { + // Since we don't have group or content for these, we'll just pass the '*_parent' variables directly to the constructor + $this->data['enclosures'][] =& new $this->feed->enclosure_class($url, $type, $length, $this->feed->javascript, $bitrate, $captions_parent, $categories_parent, $channels, $copyrights_parent, $credits_parent, $description_parent, $duration_parent, $expression, $framerate, $hashes_parent, $height, $keywords_parent, $lang, $medium, $player_parent, $ratings_parent, $restrictions_parent, $samplingrate, $thumbnails_parent, $title_parent, $width); + } + + $this->data['enclosures'] = array_values(SimplePie_Misc::array_unique($this->data['enclosures'])); + } + if (!empty($this->data['enclosures'])) + { + return $this->data['enclosures']; + } + else + { + return null; + } + } + + function get_latitude() + { + if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'lat')) + { + return (float) $return[0]['data']; + } + elseif (($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', $return[0]['data'], $match)) + { + return (float) $match[1]; + } + else + { + return null; + } + } + + function get_longitude() + { + if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'long')) + { + return (float) $return[0]['data']; + } + elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'lon')) + { + return (float) $return[0]['data']; + } + elseif (($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', $return[0]['data'], $match)) + { + return (float) $match[2]; + } + else + { + return null; + } + } + + function get_source() + { + if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'source')) + { + return new $this->feed->source_class($this, $return[0]); + } + else + { + return null; + } + } + + /** + * Creates the add_to_* methods' return data + * + * @access private + * @param string $item_url String to prefix to the item permalink + * @param string $title_url String to prefix to the item title + * (and suffix to the item permalink) + * @return mixed URL if feed exists, false otherwise + */ + function add_to_service($item_url, $title_url = null, $summary_url = null) + { + if ($this->get_permalink() !== null) + { + $return = $item_url . rawurlencode($this->get_permalink()); + if ($title_url !== null && $this->get_title() !== null) + { + $return .= $title_url . rawurlencode($this->get_title()); + } + if ($summary_url !== null && $this->get_description() !== null) + { + $return .= $summary_url . rawurlencode($this->get_description()); + } + return $this->sanitize($return, SIMPLEPIE_CONSTRUCT_IRI); + } + else + { + return null; + } + } + + function add_to_blinklist() + { + return $this->add_to_service('http://www.blinklist.com/index.php?Action=Blink/addblink.php&Description=&Url=', '&Title='); + } + + function add_to_blogmarks() + { + return $this->add_to_service('http://blogmarks.net/my/new.php?mini=1&simple=1&url=', '&title='); + } + + function add_to_delicious() + { + return $this->add_to_service('http://del.icio.us/post/?v=4&url=', '&title='); + } + + function add_to_digg() + { + return $this->add_to_service('http://digg.com/submit?url=', '&title=', '&bodytext='); + } + + function add_to_furl() + { + return $this->add_to_service('http://www.furl.net/storeIt.jsp?u=', '&t='); + } + + function add_to_magnolia() + { + return $this->add_to_service('http://ma.gnolia.com/bookmarklet/add?url=', '&title='); + } + + function add_to_myweb20() + { + return $this->add_to_service('http://myweb2.search.yahoo.com/myresults/bookmarklet?u=', '&t='); + } + + function add_to_newsvine() + { + return $this->add_to_service('http://www.newsvine.com/_wine/save?u=', '&h='); + } + + function add_to_reddit() + { + return $this->add_to_service('http://reddit.com/submit?url=', '&title='); + } + + function add_to_segnalo() + { + return $this->add_to_service('http://segnalo.com/post.html.php?url=', '&title='); + } + + function add_to_simpy() + { + return $this->add_to_service('http://www.simpy.com/simpy/LinkAdd.do?href=', '&title='); + } + + function add_to_spurl() + { + return $this->add_to_service('http://www.spurl.net/spurl.php?v=3&url=', '&title='); + } + + function add_to_wists() + { + return $this->add_to_service('http://wists.com/r.php?c=&r=', '&title='); + } + + function search_technorati() + { + return $this->add_to_service('http://www.technorati.com/search/'); + } +} + +class SimplePie_Source +{ + var $item; + var $data = array(); + + function SimplePie_Source($item, $data) + { + $this->item = $item; + $this->data = $data; + } + + function __toString() + { + return md5(serialize($this->data)); + } + + function get_source_tags($namespace, $tag) + { + if (isset($this->data['child'][$namespace][$tag])) + { + return $this->data['child'][$namespace][$tag]; + } + else + { + return null; + } + } + + function get_base($element = array()) + { + return $this->item->get_base($element); + } + + function sanitize($data, $type, $base = '') + { + return $this->item->sanitize($data, $type, $base); + } + + function get_item() + { + return $this->item; + } + + function get_title() + { + if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'title')) + { + return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_10_construct_type($return[0]['attribs']), $this->get_base($return[0])); + } + elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'title')) + { + return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_03_construct_type($return[0]['attribs']), $this->get_base($return[0])); + } + elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'title')) + { + return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0])); + } + elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'title')) + { + return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0])); + } + elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'title')) + { + return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0])); + } + elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'title')) + { + return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'title')) + { + return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + else + { + return null; + } + } + + function get_category($key = 0) + { + $categories = $this->get_categories(); + if (isset($categories[$key])) + { + return $categories[$key]; + } + else + { + return null; + } + } + + function get_categories() + { + $categories = array(); + + foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'category') as $category) + { + $term = null; + $scheme = null; + $label = null; + if (isset($category['attribs']['']['term'])) + { + $term = $this->sanitize($category['attribs']['']['term'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($category['attribs']['']['scheme'])) + { + $scheme = $this->sanitize($category['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($category['attribs']['']['label'])) + { + $label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT); + } + $categories[] =& new $this->item->feed->category_class($term, $scheme, $label); + } + foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'category') as $category) + { + // This is really the label, but keep this as the term also for BC. + // Label will also work on retrieving because that falls back to term. + $term = $this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT); + if (isset($category['attribs']['']['domain'])) + { + $scheme = $this->sanitize($category['attribs']['']['domain'], SIMPLEPIE_CONSTRUCT_TEXT); + } + else + { + $scheme = null; + } + $categories[] =& new $this->item->feed->category_class($term, $scheme, null); + } + foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'subject') as $category) + { + $categories[] =& new $this->item->feed->category_class($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null); + } + foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'subject') as $category) + { + $categories[] =& new $this->item->feed->category_class($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null); + } + + if (!empty($categories)) + { + return SimplePie_Misc::array_unique($categories); + } + else + { + return null; + } + } + + function get_author($key = 0) + { + $authors = $this->get_authors(); + if (isset($authors[$key])) + { + return $authors[$key]; + } + else + { + return null; + } + } + + function get_authors() + { + $authors = array(); + foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'author') as $author) + { + $name = null; + $uri = null; + $email = null; + if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data'])) + { + $name = $this->sanitize($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data'])) + { + $uri = $this->sanitize($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0])); + } + if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data'])) + { + $email = $this->sanitize($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if ($name !== null || $email !== null || $uri !== null) + { + $authors[] =& new $this->item->feed->author_class($name, $uri, $email); + } + } + if ($author = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'author')) + { + $name = null; + $url = null; + $email = null; + if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data'])) + { + $name = $this->sanitize($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data'])) + { + $url = $this->sanitize($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0])); + } + if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data'])) + { + $email = $this->sanitize($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if ($name !== null || $email !== null || $url !== null) + { + $authors[] =& new $this->item->feed->author_class($name, $url, $email); + } + } + foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'creator') as $author) + { + $authors[] =& new $this->item->feed->author_class($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null); + } + foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'creator') as $author) + { + $authors[] =& new $this->item->feed->author_class($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null); + } + foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'author') as $author) + { + $authors[] =& new $this->item->feed->author_class($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null); + } + + if (!empty($authors)) + { + return SimplePie_Misc::array_unique($authors); + } + else + { + return null; + } + } + + function get_contributor($key = 0) + { + $contributors = $this->get_contributors(); + if (isset($contributors[$key])) + { + return $contributors[$key]; + } + else + { + return null; + } + } + + function get_contributors() + { + $contributors = array(); + foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'contributor') as $contributor) + { + $name = null; + $uri = null; + $email = null; + if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data'])) + { + $name = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data'])) + { + $uri = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0])); + } + if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data'])) + { + $email = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if ($name !== null || $email !== null || $uri !== null) + { + $contributors[] =& new $this->item->feed->author_class($name, $uri, $email); + } + } + foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'contributor') as $contributor) + { + $name = null; + $url = null; + $email = null; + if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data'])) + { + $name = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data'])) + { + $url = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0])); + } + if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data'])) + { + $email = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if ($name !== null || $email !== null || $url !== null) + { + $contributors[] =& new $this->item->feed->author_class($name, $url, $email); + } + } + + if (!empty($contributors)) + { + return SimplePie_Misc::array_unique($contributors); + } + else + { + return null; + } + } + + function get_link($key = 0, $rel = 'alternate') + { + $links = $this->get_links($rel); + if (isset($links[$key])) + { + return $links[$key]; + } + else + { + return null; + } + } + + /** + * Added for parity between the parent-level and the item/entry-level. + */ + function get_permalink() + { + return $this->get_link(0); + } + + function get_links($rel = 'alternate') + { + if (!isset($this->data['links'])) + { + $this->data['links'] = array(); + if ($links = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'link')) + { + foreach ($links as $link) + { + if (isset($link['attribs']['']['href'])) + { + $link_rel = (isset($link['attribs']['']['rel'])) ? $link['attribs']['']['rel'] : 'alternate'; + $this->data['links'][$link_rel][] = $this->sanitize($link['attribs']['']['href'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($link)); + } + } + } + if ($links = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'link')) + { + foreach ($links as $link) + { + if (isset($link['attribs']['']['href'])) + { + $link_rel = (isset($link['attribs']['']['rel'])) ? $link['attribs']['']['rel'] : 'alternate'; + $this->data['links'][$link_rel][] = $this->sanitize($link['attribs']['']['href'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($link)); + + } + } + } + if ($links = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'link')) + { + $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0])); + } + if ($links = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'link')) + { + $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0])); + } + if ($links = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'link')) + { + $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0])); + } + + $keys = array_keys($this->data['links']); + foreach ($keys as $key) + { + if (SimplePie_Misc::is_isegment_nz_nc($key)) + { + if (isset($this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key])) + { + $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key] = array_merge($this->data['links'][$key], $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key]); + $this->data['links'][$key] =& $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key]; + } + else + { + $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key] =& $this->data['links'][$key]; + } + } + elseif (substr($key, 0, 41) === SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY) + { + $this->data['links'][substr($key, 41)] =& $this->data['links'][$key]; + } + $this->data['links'][$key] = array_unique($this->data['links'][$key]); + } + } + + if (isset($this->data['links'][$rel])) + { + return $this->data['links'][$rel]; + } + else + { + return null; + } + } + + function get_description() + { + if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'subtitle')) + { + return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_10_construct_type($return[0]['attribs']), $this->get_base($return[0])); + } + elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'tagline')) + { + return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_03_construct_type($return[0]['attribs']), $this->get_base($return[0])); + } + elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'description')) + { + return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0])); + } + elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'description')) + { + return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0])); + } + elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'description')) + { + return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0])); + } + elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'description')) + { + return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'description')) + { + return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'summary')) + { + return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($return[0])); + } + elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'subtitle')) + { + return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($return[0])); + } + else + { + return null; + } + } + + function get_copyright() + { + if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'rights')) + { + return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_10_construct_type($return[0]['attribs']), $this->get_base($return[0])); + } + elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'copyright')) + { + return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_03_construct_type($return[0]['attribs']), $this->get_base($return[0])); + } + elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'copyright')) + { + return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'rights')) + { + return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'rights')) + { + return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + else + { + return null; + } + } + + function get_language() + { + if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'language')) + { + return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'language')) + { + return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'language')) + { + return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + elseif (isset($this->data['xml_lang'])) + { + return $this->sanitize($this->data['xml_lang'], SIMPLEPIE_CONSTRUCT_TEXT); + } + else + { + return null; + } + } + + function get_latitude() + { + if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'lat')) + { + return (float) $return[0]['data']; + } + elseif (($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', $return[0]['data'], $match)) + { + return (float) $match[1]; + } + else + { + return null; + } + } + + function get_longitude() + { + if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'long')) + { + return (float) $return[0]['data']; + } + elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'lon')) + { + return (float) $return[0]['data']; + } + elseif (($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', $return[0]['data'], $match)) + { + return (float) $match[2]; + } + else + { + return null; + } + } + + function get_image_url() + { + if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'image')) + { + return $this->sanitize($return[0]['attribs']['']['href'], SIMPLEPIE_CONSTRUCT_IRI); + } + elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'logo')) + { + return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0])); + } + elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'icon')) + { + return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0])); + } + else + { + return null; + } + } +} + +class SimplePie_Author +{ + var $name; + var $link; + var $email; + + // Constructor, used to input the data + function SimplePie_Author($name = null, $link = null, $email = null) + { + $this->name = $name; + $this->link = $link; + $this->email = $email; + } + + function __toString() + { + // There is no $this->data here + return md5(serialize($this)); + } + + function get_name() + { + if ($this->name !== null) + { + return $this->name; + } + else + { + return null; + } + } + + function get_link() + { + if ($this->link !== null) + { + return $this->link; + } + else + { + return null; + } + } + + function get_email() + { + if ($this->email !== null) + { + return $this->email; + } + else + { + return null; + } + } +} + +class SimplePie_Category +{ + var $term; + var $scheme; + var $label; + + // Constructor, used to input the data + function SimplePie_Category($term = null, $scheme = null, $label = null) + { + $this->term = $term; + $this->scheme = $scheme; + $this->label = $label; + } + + function __toString() + { + // There is no $this->data here + return md5(serialize($this)); + } + + function get_term() + { + if ($this->term !== null) + { + return $this->term; + } + else + { + return null; + } + } + + function get_scheme() + { + if ($this->scheme !== null) + { + return $this->scheme; + } + else + { + return null; + } + } + + function get_label() + { + if ($this->label !== null) + { + return $this->label; + } + else + { + return $this->get_term(); + } + } +} + +class SimplePie_Enclosure +{ + var $bitrate; + var $captions; + var $categories; + var $channels; + var $copyright; + var $credits; + var $description; + var $duration; + var $expression; + var $framerate; + var $handler; + var $hashes; + var $height; + var $javascript; + var $keywords; + var $lang; + var $length; + var $link; + var $medium; + var $player; + var $ratings; + var $restrictions; + var $samplingrate; + var $thumbnails; + var $title; + var $type; + var $width; + + // Constructor, used to input the data + function SimplePie_Enclosure($link = null, $type = null, $length = null, $javascript = null, $bitrate = null, $captions = null, $categories = null, $channels = null, $copyright = null, $credits = null, $description = null, $duration = null, $expression = null, $framerate = null, $hashes = null, $height = null, $keywords = null, $lang = null, $medium = null, $player = null, $ratings = null, $restrictions = null, $samplingrate = null, $thumbnails = null, $title = null, $width = null) + { + $this->bitrate = $bitrate; + $this->captions = $captions; + $this->categories = $categories; + $this->channels = $channels; + $this->copyright = $copyright; + $this->credits = $credits; + $this->description = $description; + $this->duration = $duration; + $this->expression = $expression; + $this->framerate = $framerate; + $this->hashes = $hashes; + $this->height = $height; + $this->javascript = $javascript; + $this->keywords = $keywords; + $this->lang = $lang; + $this->length = $length; + $this->link = $link; + $this->medium = $medium; + $this->player = $player; + $this->ratings = $ratings; + $this->restrictions = $restrictions; + $this->samplingrate = $samplingrate; + $this->thumbnails = $thumbnails; + $this->title = $title; + $this->type = $type; + $this->width = $width; + if (class_exists('idna_convert')) + { + $idn =& new idna_convert; + $parsed = SimplePie_Misc::parse_url($link); + $this->link = SimplePie_Misc::compress_parse_url($parsed['scheme'], $idn->encode($parsed['authority']), $parsed['path'], $parsed['query'], $parsed['fragment']); + } + $this->handler = $this->get_handler(); // Needs to load last + } + + function __toString() + { + // There is no $this->data here + return md5(serialize($this)); + } + + function get_bitrate() + { + if ($this->bitrate !== null) + { + return $this->bitrate; + } + else + { + return null; + } + } + + function get_caption($key = 0) + { + $captions = $this->get_captions(); + if (isset($captions[$key])) + { + return $captions[$key]; + } + else + { + return null; + } + } + + function get_captions() + { + if ($this->captions !== null) + { + return $this->captions; + } + else + { + return null; + } + } + + function get_category($key = 0) + { + $categories = $this->get_categories(); + if (isset($categories[$key])) + { + return $categories[$key]; + } + else + { + return null; + } + } + + function get_categories() + { + if ($this->categories !== null) + { + return $this->categories; + } + else + { + return null; + } + } + + function get_channels() + { + if ($this->channels !== null) + { + return $this->channels; + } + else + { + return null; + } + } + + function get_copyright() + { + if ($this->copyright !== null) + { + return $this->copyright; + } + else + { + return null; + } + } + + function get_credit($key = 0) + { + $credits = $this->get_credits(); + if (isset($credits[$key])) + { + return $credits[$key]; + } + else + { + return null; + } + } + + function get_credits() + { + if ($this->credits !== null) + { + return $this->credits; + } + else + { + return null; + } + } + + function get_description() + { + if ($this->description !== null) + { + return $this->description; + } + else + { + return null; + } + } + + function get_duration($convert = false) + { + if ($this->duration !== null) + { + if ($convert) + { + $time = SimplePie_Misc::time_hms($this->duration); + return $time; + } + else + { + return $this->duration; + } + } + else + { + return null; + } + } + + function get_expression() + { + if ($this->expression !== null) + { + return $this->expression; + } + else + { + return 'full'; + } + } + + function get_extension() + { + if ($this->link !== null) + { + $url = SimplePie_Misc::parse_url($this->link); + if ($url['path'] !== '') + { + return pathinfo($url['path'], PATHINFO_EXTENSION); + } + } + return null; + } + + function get_framerate() + { + if ($this->framerate !== null) + { + return $this->framerate; + } + else + { + return null; + } + } + + function get_handler() + { + return $this->get_real_type(true); + } + + function get_hash($key = 0) + { + $hashes = $this->get_hashes(); + if (isset($hashes[$key])) + { + return $hashes[$key]; + } + else + { + return null; + } + } + + function get_hashes() + { + if ($this->hashes !== null) + { + return $this->hashes; + } + else + { + return null; + } + } + + function get_height() + { + if ($this->height !== null) + { + return $this->height; + } + else + { + return null; + } + } + + function get_language() + { + if ($this->lang !== null) + { + return $this->lang; + } + else + { + return null; + } + } + + function get_keyword($key = 0) + { + $keywords = $this->get_keywords(); + if (isset($keywords[$key])) + { + return $keywords[$key]; + } + else + { + return null; + } + } + + function get_keywords() + { + if ($this->keywords !== null) + { + return $this->keywords; + } + else + { + return null; + } + } + + function get_length() + { + if ($this->length !== null) + { + return $this->length; + } + else + { + return null; + } + } + + function get_link() + { + if ($this->link !== null) + { + return urldecode($this->link); + } + else + { + return null; + } + } + + function get_medium() + { + if ($this->medium !== null) + { + return $this->medium; + } + else + { + return null; + } + } + + function get_player() + { + if ($this->player !== null) + { + return $this->player; + } + else + { + return null; + } + } + + function get_rating($key = 0) + { + $ratings = $this->get_ratings(); + if (isset($ratings[$key])) + { + return $ratings[$key]; + } + else + { + return null; + } + } + + function get_ratings() + { + if ($this->ratings !== null) + { + return $this->ratings; + } + else + { + return null; + } + } + + function get_restriction($key = 0) + { + $restrictions = $this->get_restrictions(); + if (isset($restrictions[$key])) + { + return $restrictions[$key]; + } + else + { + return null; + } + } + + function get_restrictions() + { + if ($this->restrictions !== null) + { + return $this->restrictions; + } + else + { + return null; + } + } + + function get_sampling_rate() + { + if ($this->samplingrate !== null) + { + return $this->samplingrate; + } + else + { + return null; + } + } + + function get_size() + { + $length = $this->get_length(); + if ($length !== null) + { + return round($length/1048576, 2); + } + else + { + return null; + } + } + + function get_thumbnail($key = 0) + { + $thumbnails = $this->get_thumbnails(); + if (isset($thumbnails[$key])) + { + return $thumbnails[$key]; + } + else + { + return null; + } + } + + function get_thumbnails() + { + if ($this->thumbnails !== null) + { + return $this->thumbnails; + } + else + { + return null; + } + } + + function get_title() + { + if ($this->title !== null) + { + return $this->title; + } + else + { + return null; + } + } + + function get_type() + { + if ($this->type !== null) + { + return $this->type; + } + else + { + return null; + } + } + + function get_width() + { + if ($this->width !== null) + { + return $this->width; + } + else + { + return null; + } + } + + function native_embed($options='') + { + return $this->embed($options, true); + } + + /** + * @todo If the dimensions for media:content are defined, use them when width/height are set to 'auto'. + */ + function embed($options = '', $native = false) + { + // Set up defaults + $audio = ''; + $video = ''; + $alt = ''; + $altclass = ''; + $loop = 'false'; + $width = 'auto'; + $height = 'auto'; + $bgcolor = '#ffffff'; + $mediaplayer = ''; + $widescreen = false; + $handler = $this->get_handler(); + $type = $this->get_real_type(); + + // Process options and reassign values as necessary + if (is_array($options)) + { + extract($options); + } + else + { + $options = explode(',', $options); + foreach($options as $option) + { + $opt = explode(':', $option, 2); + if (isset($opt[0], $opt[1])) + { + $opt[0] = trim($opt[0]); + $opt[1] = trim($opt[1]); + switch ($opt[0]) + { + case 'audio': + $audio = $opt[1]; + break; + + case 'video': + $video = $opt[1]; + break; + + case 'alt': + $alt = $opt[1]; + break; + + case 'altclass': + $altclass = $opt[1]; + break; + + case 'loop': + $loop = $opt[1]; + break; + + case 'width': + $width = $opt[1]; + break; + + case 'height': + $height = $opt[1]; + break; + + case 'bgcolor': + $bgcolor = $opt[1]; + break; + + case 'mediaplayer': + $mediaplayer = $opt[1]; + break; + + case 'widescreen': + $widescreen = $opt[1]; + break; + } + } + } + } + + $mime = explode('/', $type, 2); + $mime = $mime[0]; + + // Process values for 'auto' + if ($width === 'auto') + { + if ($mime === 'video') + { + if ($height === 'auto') + { + $width = 480; + } + elseif ($widescreen) + { + $width = round((intval($height)/9)*16); + } + else + { + $width = round((intval($height)/3)*4); + } + } + else + { + $width = '100%'; + } + } + + if ($height === 'auto') + { + if ($mime === 'audio') + { + $height = 0; + } + elseif ($mime === 'video') + { + if ($width === 'auto') + { + if ($widescreen) + { + $height = 270; + } + else + { + $height = 360; + } + } + elseif ($widescreen) + { + $height = round((intval($width)/16)*9); + } + else + { + $height = round((intval($width)/4)*3); + } + } + else + { + $height = 376; + } + } + elseif ($mime === 'audio') + { + $height = 0; + } + + // Set proper placeholder value + if ($mime === 'audio') + { + $placeholder = $audio; + } + elseif ($mime === 'video') + { + $placeholder = $video; + } + + $embed = ''; + + // Make sure the JS library is included + if (!$native) + { + static $javascript_outputted = null; + if (!$javascript_outputted && $this->javascript) + { + $embed .= ''; + $javascript_outputted = true; + } + } + + // Odeo Feed MP3's + if ($handler === 'odeo') + { + if ($native) + { + $embed .= ''; + } + else + { + $embed .= ''; + } + } + + // Flash + elseif ($handler === 'flash') + { + if ($native) + { + $embed .= "get_link() . "\" pluginspage=\"http://adobe.com/go/getflashplayer\" type=\"$type\" quality=\"high\" width=\"$width\" height=\"$height\" bgcolor=\"$bgcolor\" loop=\"$loop\">"; + } + else + { + $embed .= ""; + } + } + + // Flash Media Player file types. + // Preferred handler for MP3 file types. + elseif ($handler === 'fmedia' || ($handler === 'mp3' && $mediaplayer !== '')) + { + $height += 20; + if ($native) + { + $embed .= "get_link().'?file_extension=.'.$this->get_extension()) . "&autostart=false&repeat=$loop&showdigits=true&showfsbutton=false\">"; + } + else + { + $embed .= ""; + } + } + + // QuickTime 7 file types. Need to test with QuickTime 6. + // Only handle MP3's if the Flash Media Player is not present. + elseif ($handler === 'quicktime' || ($handler === 'mp3' && $mediaplayer === '')) + { + $height += 16; + if ($native) + { + if ($placeholder !== '') + { + $embed .= "get_link() . "\" src=\"$placeholder\" width=\"$width\" height=\"$height\" autoplay=\"false\" target=\"myself\" controller=\"false\" loop=\"$loop\" scale=\"aspect\" bgcolor=\"$bgcolor\" pluginspage=\"http://apple.com/quicktime/download/\">"; + } + else + { + $embed .= "get_link() . "\" width=\"$width\" height=\"$height\" autoplay=\"false\" target=\"myself\" controller=\"true\" loop=\"$loop\" scale=\"aspect\" bgcolor=\"$bgcolor\" pluginspage=\"http://apple.com/quicktime/download/\">"; + } + } + else + { + $embed .= ""; + } + } + + // Windows Media + elseif ($handler === 'wmedia') + { + $height += 45; + if ($native) + { + $embed .= "get_link() . "\" autosize=\"1\" width=\"$width\" height=\"$height\" showcontrols=\"1\" showstatusbar=\"0\" showdisplay=\"0\" autostart=\"0\">"; + } + else + { + $embed .= ""; + } + } + + // Everything else + else $embed .= '' . $alt . ''; + + return $embed; + } + + function get_real_type($find_handler = false) + { + // If it's Odeo, let's get it out of the way. + if (substr(strtolower($this->get_link()), 0, 15) === 'http://odeo.com') + { + return 'odeo'; + } + + // Mime-types by handler. + $types_flash = array('application/x-shockwave-flash', 'application/futuresplash'); // Flash + $types_fmedia = array('video/flv', 'video/x-flv','flv-application/octet-stream'); // Flash Media Player + $types_quicktime = array('audio/3gpp', 'audio/3gpp2', 'audio/aac', 'audio/x-aac', 'audio/aiff', 'audio/x-aiff', 'audio/mid', 'audio/midi', 'audio/x-midi', 'audio/mp4', 'audio/m4a', 'audio/x-m4a', 'audio/wav', 'audio/x-wav', 'video/3gpp', 'video/3gpp2', 'video/m4v', 'video/x-m4v', 'video/mp4', 'video/mpeg', 'video/x-mpeg', 'video/quicktime', 'video/sd-video'); // QuickTime + $types_wmedia = array('application/asx', 'application/x-mplayer2', 'audio/x-ms-wma', 'audio/x-ms-wax', 'video/x-ms-asf-plugin', 'video/x-ms-asf', 'video/x-ms-wm', 'video/x-ms-wmv', 'video/x-ms-wvx'); // Windows Media + $types_mp3 = array('audio/mp3', 'audio/x-mp3', 'audio/mpeg', 'audio/x-mpeg'); // MP3 + + if ($this->get_type() !== null) + { + $type = strtolower($this->type); + } + else + { + $type = null; + } + + // If we encounter an unsupported mime-type, check the file extension and guess intelligently. + if (!in_array($type, array_merge($types_flash, $types_fmedia, $types_quicktime, $types_wmedia, $types_mp3))) + { + switch (strtolower($this->get_extension())) + { + // Audio mime-types + case 'aac': + case 'adts': + $type = 'audio/acc'; + break; + + case 'aif': + case 'aifc': + case 'aiff': + case 'cdda': + $type = 'audio/aiff'; + break; + + case 'bwf': + $type = 'audio/wav'; + break; + + case 'kar': + case 'mid': + case 'midi': + case 'smf': + $type = 'audio/midi'; + break; + + case 'm4a': + $type = 'audio/x-m4a'; + break; + + case 'mp3': + case 'swa': + $type = 'audio/mp3'; + break; + + case 'wav': + $type = 'audio/wav'; + break; + + case 'wax': + $type = 'audio/x-ms-wax'; + break; + + case 'wma': + $type = 'audio/x-ms-wma'; + break; + + // Video mime-types + case '3gp': + case '3gpp': + $type = 'video/3gpp'; + break; + + case '3g2': + case '3gp2': + $type = 'video/3gpp2'; + break; + + case 'asf': + $type = 'video/x-ms-asf'; + break; + + case 'flv': + $type = 'video/x-flv'; + break; + + case 'm1a': + case 'm1s': + case 'm1v': + case 'm15': + case 'm75': + case 'mp2': + case 'mpa': + case 'mpeg': + case 'mpg': + case 'mpm': + case 'mpv': + $type = 'video/mpeg'; + break; + + case 'm4v': + $type = 'video/x-m4v'; + break; + + case 'mov': + case 'qt': + $type = 'video/quicktime'; + break; + + case 'mp4': + case 'mpg4': + $type = 'video/mp4'; + break; + + case 'sdv': + $type = 'video/sd-video'; + break; + + case 'wm': + $type = 'video/x-ms-wm'; + break; + + case 'wmv': + $type = 'video/x-ms-wmv'; + break; + + case 'wvx': + $type = 'video/x-ms-wvx'; + break; + + // Flash mime-types + case 'spl': + $type = 'application/futuresplash'; + break; + + case 'swf': + $type = 'application/x-shockwave-flash'; + break; + } + } + + if ($find_handler) + { + if (in_array($type, $types_flash)) + { + return 'flash'; + } + elseif (in_array($type, $types_fmedia)) + { + return 'fmedia'; + } + elseif (in_array($type, $types_quicktime)) + { + return 'quicktime'; + } + elseif (in_array($type, $types_wmedia)) + { + return 'wmedia'; + } + elseif (in_array($type, $types_mp3)) + { + return 'mp3'; + } + else + { + return null; + } + } + else + { + return $type; + } + } +} + +class SimplePie_Caption +{ + var $type; + var $lang; + var $startTime; + var $endTime; + var $text; + + // Constructor, used to input the data + function SimplePie_Caption($type = null, $lang = null, $startTime = null, $endTime = null, $text = null) + { + $this->type = $type; + $this->lang = $lang; + $this->startTime = $startTime; + $this->endTime = $endTime; + $this->text = $text; + } + + function __toString() + { + // There is no $this->data here + return md5(serialize($this)); + } + + function get_endtime() + { + if ($this->endTime !== null) + { + return $this->endTime; + } + else + { + return null; + } + } + + function get_language() + { + if ($this->lang !== null) + { + return $this->lang; + } + else + { + return null; + } + } + + function get_starttime() + { + if ($this->startTime !== null) + { + return $this->startTime; + } + else + { + return null; + } + } + + function get_text() + { + if ($this->text !== null) + { + return $this->text; + } + else + { + return null; + } + } + + function get_type() + { + if ($this->type !== null) + { + return $this->type; + } + else + { + return null; + } + } +} + +class SimplePie_Credit +{ + var $role; + var $scheme; + var $name; + + // Constructor, used to input the data + function SimplePie_Credit($role = null, $scheme = null, $name = null) + { + $this->role = $role; + $this->scheme = $scheme; + $this->name = $name; + } + + function __toString() + { + // There is no $this->data here + return md5(serialize($this)); + } + + function get_role() + { + if ($this->role !== null) + { + return $this->role; + } + else + { + return null; + } + } + + function get_scheme() + { + if ($this->scheme !== null) + { + return $this->scheme; + } + else + { + return null; + } + } + + function get_name() + { + if ($this->name !== null) + { + return $this->name; + } + else + { + return null; + } + } +} + +class SimplePie_Copyright +{ + var $url; + var $label; + + // Constructor, used to input the data + function SimplePie_Copyright($url = null, $label = null) + { + $this->url = $url; + $this->label = $label; + } + + function __toString() + { + // There is no $this->data here + return md5(serialize($this)); + } + + function get_url() + { + if ($this->url !== null) + { + return $this->url; + } + else + { + return null; + } + } + + function get_attribution() + { + if ($this->label !== null) + { + return $this->label; + } + else + { + return null; + } + } +} + +class SimplePie_Rating +{ + var $scheme; + var $value; + + // Constructor, used to input the data + function SimplePie_Rating($scheme = null, $value = null) + { + $this->scheme = $scheme; + $this->value = $value; + } + + function __toString() + { + // There is no $this->data here + return md5(serialize($this)); + } + + function get_scheme() + { + if ($this->scheme !== null) + { + return $this->scheme; + } + else + { + return null; + } + } + + function get_value() + { + if ($this->value !== null) + { + return $this->value; + } + else + { + return null; + } + } +} + +class SimplePie_Restriction +{ + var $relationship; + var $type; + var $value; + + // Constructor, used to input the data + function SimplePie_Restriction($relationship = null, $type = null, $value = null) + { + $this->relationship = $relationship; + $this->type = $type; + $this->value = $value; + } + + function __toString() + { + // There is no $this->data here + return md5(serialize($this)); + } + + function get_relationship() + { + if ($this->relationship !== null) + { + return $this->relationship; + } + else + { + return null; + } + } + + function get_type() + { + if ($this->type !== null) + { + return $this->type; + } + else + { + return null; + } + } + + function get_value() + { + if ($this->value !== null) + { + return $this->value; + } + else + { + return null; + } + } +} + +/** + * @todo Move to properly supporting RFC2616 (HTTP/1.1) + */ +class SimplePie_File +{ + var $url; + var $useragent; + var $success = true; + var $headers = array(); + var $body; + var $status_code; + var $redirects = 0; + var $error; + var $method = SIMPLEPIE_FILE_SOURCE_NONE; + + function SimplePie_File($url, $timeout = 10, $redirects = 5, $headers = null, $useragent = null, $force_fsockopen = false) + { + if (class_exists('idna_convert')) + { + $idn =& new idna_convert; + $parsed = SimplePie_Misc::parse_url($url); + $url = SimplePie_Misc::compress_parse_url($parsed['scheme'], $idn->encode($parsed['authority']), $parsed['path'], $parsed['query'], $parsed['fragment']); + } + $this->url = $url; + $this->useragent = $useragent; + if (preg_match('/^http(s)?:\/\//i', $url)) + { + if ($useragent === null) + { + $useragent = ini_get('user_agent'); + $this->useragent = $useragent; + } + if (!is_array($headers)) + { + $headers = array(); + } + if (!$force_fsockopen && function_exists('curl_exec')) + { + $this->method = SIMPLEPIE_FILE_SOURCE_REMOTE | SIMPLEPIE_FILE_SOURCE_CURL; + $fp = curl_init(); + $headers2 = array(); + foreach ($headers as $key => $value) + { + $headers2[] = "$key: $value"; + } + if (version_compare(SimplePie_Misc::get_curl_version(), '7.10.5', '>=')) + { + curl_setopt($fp, CURLOPT_ENCODING, ''); + } + curl_setopt($fp, CURLOPT_URL, $url); + curl_setopt($fp, CURLOPT_HEADER, 1); + curl_setopt($fp, CURLOPT_RETURNTRANSFER, 1); + curl_setopt($fp, CURLOPT_TIMEOUT, $timeout); + curl_setopt($fp, CURLOPT_CONNECTTIMEOUT, $timeout); + curl_setopt($fp, CURLOPT_REFERER, $url); + curl_setopt($fp, CURLOPT_USERAGENT, $useragent); + curl_setopt($fp, CURLOPT_HTTPHEADER, $headers2); + if (!ini_get('open_basedir') && !ini_get('safe_mode') && version_compare(SimplePie_Misc::get_curl_version(), '7.15.2', '>=')) + { + curl_setopt($fp, CURLOPT_FOLLOWLOCATION, 1); + curl_setopt($fp, CURLOPT_MAXREDIRS, $redirects); + } + + $this->headers = curl_exec($fp); + if (curl_errno($fp) === 23 || curl_errno($fp) === 61) + { + curl_setopt($fp, CURLOPT_ENCODING, 'none'); + $this->headers = curl_exec($fp); + } + if (curl_errno($fp)) + { + $this->error = 'cURL error ' . curl_errno($fp) . ': ' . curl_error($fp); + $this->success = false; + } + else + { + $info = curl_getinfo($fp); + curl_close($fp); + $this->headers = explode("\r\n\r\n", $this->headers, $info['redirect_count'] + 1); + $this->headers = array_pop($this->headers); + $parser =& new SimplePie_HTTP_Parser($this->headers); + if ($parser->parse()) + { + $this->headers = $parser->headers; + $this->body = $parser->body; + $this->status_code = $parser->status_code; + if ((in_array($this->status_code, array(300, 301, 302, 303, 307)) || $this->status_code > 307 && $this->status_code < 400) && isset($this->headers['location']) && $this->redirects < $redirects) + { + $this->redirects++; + $location = SimplePie_Misc::absolutize_url($this->headers['location'], $url); + return $this->SimplePie_File($location, $timeout, $redirects, $headers, $useragent, $force_fsockopen); + } + } + } + } + else + { + $this->method = SIMPLEPIE_FILE_SOURCE_REMOTE | SIMPLEPIE_FILE_SOURCE_FSOCKOPEN; + $url_parts = parse_url($url); + if (isset($url_parts['scheme']) && strtolower($url_parts['scheme']) === 'https') + { + $url_parts['host'] = "ssl://$url_parts[host]"; + $url_parts['port'] = 443; + } + if (!isset($url_parts['port'])) + { + $url_parts['port'] = 80; + } + $fp = @fsockopen($url_parts['host'], $url_parts['port'], $errno, $errstr, $timeout); + if (!$fp) + { + $this->error = 'fsockopen error: ' . $errstr; + $this->success = false; + } + else + { + stream_set_timeout($fp, $timeout); + if (isset($url_parts['path'])) + { + if (isset($url_parts['query'])) + { + $get = "$url_parts[path]?$url_parts[query]"; + } + else + { + $get = $url_parts['path']; + } + } + else + { + $get = '/'; + } + $out = "GET $get HTTP/1.0\r\n"; + $out .= "Host: $url_parts[host]\r\n"; + $out .= "User-Agent: $useragent\r\n"; + if (extension_loaded('zlib')) + { + $out .= "Accept-Encoding: x-gzip,gzip,deflate\r\n"; + } + + if (isset($url_parts['user']) && isset($url_parts['pass'])) + { + $out .= "Authorization: Basic " . base64_encode("$url_parts[user]:$url_parts[pass]") . "\r\n"; + } + foreach ($headers as $key => $value) + { + $out .= "$key: $value\r\n"; + } + $out .= "Connection: Close\r\n\r\n"; + fwrite($fp, $out); + + $info = stream_get_meta_data($fp); + + $this->headers = ''; + while (!$info['eof'] && !$info['timed_out']) + { + $this->headers .= fread($fp, 1160); + $info = stream_get_meta_data($fp); + } + if (!$info['timed_out']) + { + $parser =& new SimplePie_HTTP_Parser($this->headers); + if ($parser->parse()) + { + $this->headers = $parser->headers; + $this->body = $parser->body; + $this->status_code = $parser->status_code; + if ((in_array($this->status_code, array(300, 301, 302, 303, 307)) || $this->status_code > 307 && $this->status_code < 400) && isset($this->headers['location']) && $this->redirects < $redirects) + { + $this->redirects++; + $location = SimplePie_Misc::absolutize_url($this->headers['location'], $url); + return $this->SimplePie_File($location, $timeout, $redirects, $headers, $useragent, $force_fsockopen); + } + if (isset($this->headers['content-encoding'])) + { + // Hey, we act dumb elsewhere, so let's do that here too + switch (strtolower(trim($this->headers['content-encoding'], "\x09\x0A\x0D\x20"))) + { + case 'gzip': + case 'x-gzip': + $decoder =& new SimplePie_gzdecode($this->body); + if (!$decoder->parse()) + { + $this->error = 'Unable to decode HTTP "gzip" stream'; + $this->success = false; + } + else + { + $this->body = $decoder->data; + } + break; + + case 'deflate': + if (($body = gzuncompress($this->body)) === false) + { + if (($body = gzinflate($this->body)) === false) + { + $this->error = 'Unable to decode HTTP "deflate" stream'; + $this->success = false; + } + } + $this->body = $body; + break; + + default: + $this->error = 'Unknown content coding'; + $this->success = false; + } + } + } + } + else + { + $this->error = 'fsocket timed out'; + $this->success = false; + } + fclose($fp); + } + } + } + else + { + $this->method = SIMPLEPIE_FILE_SOURCE_LOCAL | SIMPLEPIE_FILE_SOURCE_FILE_GET_CONTENTS; + if (!$this->body = file_get_contents($url)) + { + $this->error = 'file_get_contents could not read the file'; + $this->success = false; + } + } + } +} + +/** + * HTTP Response Parser + * + * @package SimplePie + */ +class SimplePie_HTTP_Parser +{ + /** + * HTTP Version + * + * @access public + * @var float + */ + var $http_version = 0.0; + + /** + * Status code + * + * @access public + * @var int + */ + var $status_code = 0; + + /** + * Reason phrase + * + * @access public + * @var string + */ + var $reason = ''; + + /** + * Key/value pairs of the headers + * + * @access public + * @var array + */ + var $headers = array(); + + /** + * Body of the response + * + * @access public + * @var string + */ + var $body = ''; + + /** + * Current state of the state machine + * + * @access private + * @var string + */ + var $state = 'http_version'; + + /** + * Input data + * + * @access private + * @var string + */ + var $data = ''; + + /** + * Input data length (to avoid calling strlen() everytime this is needed) + * + * @access private + * @var int + */ + var $data_length = 0; + + /** + * Current position of the pointer + * + * @var int + * @access private + */ + var $position = 0; + + /** + * Name of the hedaer currently being parsed + * + * @access private + * @var string + */ + var $name = ''; + + /** + * Value of the hedaer currently being parsed + * + * @access private + * @var string + */ + var $value = ''; + + /** + * Create an instance of the class with the input data + * + * @access public + * @param string $data Input data + */ + function SimplePie_HTTP_Parser($data) + { + $this->data = $data; + $this->data_length = strlen($this->data); + } + + /** + * Parse the input data + * + * @access public + * @return bool true on success, false on failure + */ + function parse() + { + while ($this->state && $this->state !== 'emit' && $this->has_data()) + { + $state = $this->state; + $this->$state(); + } + $this->data = ''; + if ($this->state === 'emit' || $this->state === 'body') + { + return true; + } + else + { + $this->http_version = ''; + $this->status_code = ''; + $this->reason = ''; + $this->headers = array(); + $this->body = ''; + return false; + } + } + + /** + * Check whether there is data beyond the pointer + * + * @access private + * @return bool true if there is further data, false if not + */ + function has_data() + { + return (bool) ($this->position < $this->data_length); + } + + /** + * See if the next character is LWS + * + * @access private + * @return bool true if the next character is LWS, false if not + */ + function is_linear_whitespace() + { + return (bool) ($this->data[$this->position] === "\x09" + || $this->data[$this->position] === "\x20" + || ($this->data[$this->position] === "\x0A" + && isset($this->data[$this->position + 1]) + && ($this->data[$this->position + 1] === "\x09" || $this->data[$this->position + 1] === "\x20"))); + } + + /** + * Parse the HTTP version + * + * @access private + */ + function http_version() + { + if (strpos($this->data, "\x0A") !== false && strtoupper(substr($this->data, 0, 5)) === 'HTTP/') + { + $len = strspn($this->data, '0123456789.', 5); + $this->http_version = substr($this->data, 5, $len); + $this->position += 5 + $len; + if (substr_count($this->http_version, '.') <= 1) + { + $this->http_version = (float) $this->http_version; + $this->position += strspn($this->data, "\x09\x20", $this->position); + $this->state = 'status'; + } + else + { + $this->state = false; + } + } + else + { + $this->state = false; + } + } + + /** + * Parse the status code + * + * @access private + */ + function status() + { + if ($len = strspn($this->data, '0123456789', $this->position)) + { + $this->status_code = (int) substr($this->data, $this->position, $len); + $this->position += $len; + $this->state = 'reason'; + } + else + { + $this->state = false; + } + } + + /** + * Parse the reason phrase + * + * @access private + */ + function reason() + { + $len = strcspn($this->data, "\x0A", $this->position); + $this->reason = trim(substr($this->data, $this->position, $len), "\x09\x0D\x20"); + $this->position += $len + 1; + $this->state = 'new_line'; + } + + /** + * Deal with a new line, shifting data around as needed + * + * @access private + */ + function new_line() + { + $this->value = trim($this->value, "\x0D\x20"); + if ($this->name !== '' && $this->value !== '') + { + $this->name = strtolower($this->name); + if (isset($this->headers[$this->name])) + { + $this->headers[$this->name] .= ', ' . $this->value; + } + else + { + $this->headers[$this->name] = $this->value; + } + } + $this->name = ''; + $this->value = ''; + if (substr($this->data[$this->position], 0, 2) === "\x0D\x0A") + { + $this->position += 2; + $this->state = 'body'; + } + elseif ($this->data[$this->position] === "\x0A") + { + $this->position++; + $this->state = 'body'; + } + else + { + $this->state = 'name'; + } + } + + /** + * Parse a header name + * + * @access private + */ + function name() + { + $len = strcspn($this->data, "\x0A:", $this->position); + if (isset($this->data[$this->position + $len])) + { + if ($this->data[$this->position + $len] === "\x0A") + { + $this->position += $len; + $this->state = 'new_line'; + } + else + { + $this->name = substr($this->data, $this->position, $len); + $this->position += $len + 1; + $this->state = 'value'; + } + } + else + { + $this->state = false; + } + } + + /** + * Parse LWS, replacing consecutive LWS characters with a single space + * + * @access private + */ + function linear_whitespace() + { + do + { + if (substr($this->data, $this->position, 2) === "\x0D\x0A") + { + $this->position += 2; + } + elseif ($this->data[$this->position] === "\x0A") + { + $this->position++; + } + $this->position += strspn($this->data, "\x09\x20", $this->position); + } while ($this->has_data() && $this->is_linear_whitespace()); + $this->value .= "\x20"; + } + + /** + * See what state to move to while within non-quoted header values + * + * @access private + */ + function value() + { + if ($this->is_linear_whitespace()) + { + $this->linear_whitespace(); + } + else + { + switch ($this->data[$this->position]) + { + case '"': + $this->position++; + $this->state = 'quote'; + break; + + case "\x0A": + $this->position++; + $this->state = 'new_line'; + break; + + default: + $this->state = 'value_char'; + break; + } + } + } + + /** + * Parse a header value while outside quotes + * + * @access private + */ + function value_char() + { + $len = strcspn($this->data, "\x09\x20\x0A\"", $this->position); + $this->value .= substr($this->data, $this->position, $len); + $this->position += $len; + $this->state = 'value'; + } + + /** + * See what state to move to while within quoted header values + * + * @access private + */ + function quote() + { + if ($this->is_linear_whitespace()) + { + $this->linear_whitespace(); + } + else + { + switch ($this->data[$this->position]) + { + case '"': + $this->position++; + $this->state = 'value'; + break; + + case "\x0A": + $this->position++; + $this->state = 'new_line'; + break; + + case '\\': + $this->position++; + $this->state = 'quote_escaped'; + break; + + default: + $this->state = 'quote_char'; + break; + } + } + } + + /** + * Parse a header value while within quotes + * + * @access private + */ + function quote_char() + { + $len = strcspn($this->data, "\x09\x20\x0A\"\\", $this->position); + $this->value .= substr($this->data, $this->position, $len); + $this->position += $len; + $this->state = 'value'; + } + + /** + * Parse an escaped character within quotes + * + * @access private + */ + function quote_escaped() + { + $this->value .= $this->data[$this->position]; + $this->position++; + $this->state = 'quote'; + } + + /** + * Parse the body + * + * @access private + */ + function body() + { + $this->body = substr($this->data, $this->position); + $this->state = 'emit'; + } +} + +/** + * gzdecode + * + * @package SimplePie + */ +class SimplePie_gzdecode +{ + /** + * Compressed data + * + * @access private + * @see gzdecode::$data + */ + var $compressed_data; + + /** + * Size of compressed data + * + * @access private + */ + var $compressed_size; + + /** + * Minimum size of a valid gzip string + * + * @access private + */ + var $min_compressed_size = 18; + + /** + * Current position of pointer + * + * @access private + */ + var $position = 0; + + /** + * Flags (FLG) + * + * @access private + */ + var $flags; + + /** + * Uncompressed data + * + * @access public + * @see gzdecode::$compressed_data + */ + var $data; + + /** + * Modified time + * + * @access public + */ + var $MTIME; + + /** + * Extra Flags + * + * @access public + */ + var $XFL; + + /** + * Operating System + * + * @access public + */ + var $OS; + + /** + * Subfield ID 1 + * + * @access public + * @see gzdecode::$extra_field + * @see gzdecode::$SI2 + */ + var $SI1; + + /** + * Subfield ID 2 + * + * @access public + * @see gzdecode::$extra_field + * @see gzdecode::$SI1 + */ + var $SI2; + + /** + * Extra field content + * + * @access public + * @see gzdecode::$SI1 + * @see gzdecode::$SI2 + */ + var $extra_field; + + /** + * Original filename + * + * @access public + */ + var $filename; + + /** + * Human readable comment + * + * @access public + */ + var $comment; + + /** + * Don't allow anything to be set + * + * @access public + */ + function __set($name, $value) + { + trigger_error("Cannot write property $name", E_USER_ERROR); + } + + /** + * Set the compressed string and related properties + * + * @access public + */ + function SimplePie_gzdecode($data) + { + $this->compressed_data = $data; + $this->compressed_size = strlen($data); + } + + /** + * Decode the GZIP stream + * + * @access public + */ + function parse() + { + if ($this->compressed_size >= $this->min_compressed_size) + { + // Check ID1, ID2, and CM + if (substr($this->compressed_data, 0, 3) !== "\x1F\x8B\x08") + { + return false; + } + + // Get the FLG (FLaGs) + $this->flags = ord($this->compressed_data[3]); + + // FLG bits above (1 << 4) are reserved + if ($this->flags > 0x1F) + { + return false; + } + + // Advance the pointer after the above + $this->position += 4; + + // MTIME + $mtime = substr($this->compressed_data, $this->position, 4); + // Reverse the string if we're on a big-endian arch because l is the only signed long and is machine endianness + if (current(unpack('S', "\x00\x01")) === 1) + { + $mtime = strrev($mtime); + } + $this->MTIME = current(unpack('l', $mtime)); + $this->position += 4; + + // Get the XFL (eXtra FLags) + $this->XFL = ord($this->compressed_data[$this->position++]); + + // Get the OS (Operating System) + $this->OS = ord($this->compressed_data[$this->position++]); + + // Parse the FEXTRA + if ($this->flags & 4) + { + // Read subfield IDs + $this->SI1 = $this->compressed_data[$this->position++]; + $this->SI2 = $this->compressed_data[$this->position++]; + + // SI2 set to zero is reserved for future use + if ($this->SI2 === "\x00") + { + return false; + } + + // Get the length of the extra field + $len = current(unpack('v', substr($this->compressed_data, $this->position, 2))); + $position += 2; + + // Check the length of the string is still valid + $this->min_compressed_size += $len + 4; + if ($this->compressed_size >= $this->min_compressed_size) + { + // Set the extra field to the given data + $this->extra_field = substr($this->compressed_data, $this->position, $len); + $this->position += $len; + } + else + { + return false; + } + } + + // Parse the FNAME + if ($this->flags & 8) + { + // Get the length of the filename + $len = strcspn($this->compressed_data, "\x00", $this->position); + + // Check the length of the string is still valid + $this->min_compressed_size += $len + 1; + if ($this->compressed_size >= $this->min_compressed_size) + { + // Set the original filename to the given string + $this->filename = substr($this->compressed_data, $this->position, $len); + $this->position += $len + 1; + } + else + { + return false; + } + } + + // Parse the FCOMMENT + if ($this->flags & 16) + { + // Get the length of the comment + $len = strcspn($this->compressed_data, "\x00", $this->position); + + // Check the length of the string is still valid + $this->min_compressed_size += $len + 1; + if ($this->compressed_size >= $this->min_compressed_size) + { + // Set the original comment to the given string + $this->comment = substr($this->compressed_data, $this->position, $len); + $this->position += $len + 1; + } + else + { + return false; + } + } + + // Parse the FHCRC + if ($this->flags & 2) + { + // Check the length of the string is still valid + $this->min_compressed_size += $len + 2; + if ($this->compressed_size >= $this->min_compressed_size) + { + // Read the CRC + $crc = current(unpack('v', substr($this->compressed_data, $this->position, 2))); + + // Check the CRC matches + if ((crc32(substr($this->compressed_data, 0, $this->position)) & 0xFFFF) === $crc) + { + $this->position += 2; + } + else + { + return false; + } + } + else + { + return false; + } + } + + // Decompress the actual data + if (($this->data = gzinflate(substr($this->compressed_data, $this->position, -8))) === false) + { + return false; + } + else + { + $this->position = $this->compressed_size - 8; + } + + // Check CRC of data + $crc = current(unpack('V', substr($this->compressed_data, $this->position, 4))); + $this->position += 4; + /*if (extension_loaded('hash') && sprintf('%u', current(unpack('V', hash('crc32b', $this->data)))) !== sprintf('%u', $crc)) + { + return false; + }*/ + + // Check ISIZE of data + $isize = current(unpack('V', substr($this->compressed_data, $this->position, 4))); + $this->position += 4; + if (sprintf('%u', strlen($this->data) & 0xFFFFFFFF) !== sprintf('%u', $isize)) + { + return false; + } + + // Wow, against all odds, we've actually got a valid gzip string + return true; + } + else + { + return false; + } + } +} + +class SimplePie_Cache +{ + /** + * Don't call the constructor. Please. + * + * @access private + */ + function SimplePie_Cache() + { + trigger_error('Please call SimplePie_Cache::create() instead of the constructor', E_USER_ERROR); + } + + /** + * Create a new SimplePie_Cache object + * + * @static + * @access public + */ + function create($location, $filename, $extension) + { + $location_iri =& new SimplePie_IRI($location); + switch ($location_iri->get_scheme()) + { + case 'mysql': + if (extension_loaded('mysql')) + { + return new SimplePie_Cache_MySQL($location_iri, $filename, $extension); + } + break; + + default: + return new SimplePie_Cache_File($location, $filename, $extension); + } + } +} + +class SimplePie_Cache_File +{ + var $location; + var $filename; + var $extension; + var $name; + + function SimplePie_Cache_File($location, $filename, $extension) + { + $this->location = $location; + $this->filename = $filename; + $this->extension = $extension; + $this->name = "$this->location/$this->filename.$this->extension"; + } + + function save($data) + { + if (file_exists($this->name) && is_writeable($this->name) || file_exists($this->location) && is_writeable($this->location)) + { + if (is_a($data, 'SimplePie')) + { + $data = $data->data; + } + + $data = serialize($data); + + if (function_exists('file_put_contents')) + { + return (bool) file_put_contents($this->name, $data); + } + else + { + $fp = fopen($this->name, 'wb'); + if ($fp) + { + fwrite($fp, $data); + fclose($fp); + return true; + } + } + } + return false; + } + + function load() + { + if (file_exists($this->name) && is_readable($this->name)) + { + return unserialize(file_get_contents($this->name)); + } + return false; + } + + function mtime() + { + if (file_exists($this->name)) + { + return filemtime($this->name); + } + return false; + } + + function touch() + { + if (file_exists($this->name)) + { + return touch($this->name); + } + return false; + } + + function unlink() + { + if (file_exists($this->name)) + { + return unlink($this->name); + } + return false; + } +} + +class SimplePie_Cache_DB +{ + function prepare_simplepie_object_for_cache($data) + { + $items = $data->get_items(); + $items_by_id = array(); + + if (!empty($items)) + { + foreach ($items as $item) + { + $items_by_id[$item->get_id()] = $item; + } + + if (count($items_by_id) !== count($items)) + { + $items_by_id = array(); + foreach ($items as $item) + { + $items_by_id[$item->get_id(true)] = $item; + } + } + + if (isset($data->data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0])) + { + $channel =& $data->data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0]; + } + elseif (isset($data->data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0])) + { + $channel =& $data->data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0]; + } + elseif (isset($data->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0])) + { + $channel =& $data->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]; + } + elseif (isset($data->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_20]['channel'][0])) + { + $channel =& $data->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_20]['channel'][0]; + } + else + { + $channel = null; + } + + if ($channel !== null) + { + if (isset($channel['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['entry'])) + { + unset($channel['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['entry']); + } + if (isset($channel['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['entry'])) + { + unset($channel['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['entry']); + } + if (isset($channel['child'][SIMPLEPIE_NAMESPACE_RSS_10]['item'])) + { + unset($channel['child'][SIMPLEPIE_NAMESPACE_RSS_10]['item']); + } + if (isset($channel['child'][SIMPLEPIE_NAMESPACE_RSS_090]['item'])) + { + unset($channel['child'][SIMPLEPIE_NAMESPACE_RSS_090]['item']); + } + if (isset($channel['child'][SIMPLEPIE_NAMESPACE_RSS_20]['item'])) + { + unset($channel['child'][SIMPLEPIE_NAMESPACE_RSS_20]['item']); + } + } + if (isset($data->data['items'])) + { + unset($data->data['items']); + } + if (isset($data->data['ordered_items'])) + { + unset($data->data['ordered_items']); + } + } + return array(serialize($data->data), $items_by_id); + } +} + +class SimplePie_Cache_MySQL extends SimplePie_Cache_DB +{ + var $mysql; + var $options; + var $id; + + function SimplePie_Cache_MySQL($mysql_location, $name, $extension) + { + $host = $mysql_location->get_host(); + if (SimplePie_Misc::stripos($host, 'unix(') === 0 && substr($host, -1) === ')') + { + $server = ':' . substr($host, 5, -1); + } + else + { + $server = $host; + if ($mysql_location->get_port() !== null) + { + $server .= ':' . $mysql_location->get_port(); + } + } + + if (strpos($mysql_location->get_userinfo(), ':') !== false) + { + list($username, $password) = explode(':', $mysql_location->get_userinfo(), 2); + } + else + { + $username = $mysql_location->get_userinfo(); + $password = null; + } + + if ($this->mysql = mysql_connect($server, $username, $password)) + { + $this->id = $name . $extension; + $this->options = SimplePie_Misc::parse_str($mysql_location->get_query()); + if (!isset($this->options['prefix'][0])) + { + $this->options['prefix'][0] = ''; + } + + if (mysql_select_db(ltrim($mysql_location->get_path(), '/')) + && mysql_query('SET NAMES utf8') + && ($query = mysql_unbuffered_query('SHOW TABLES'))) + { + $db = array(); + while ($row = mysql_fetch_row($query)) + { + $db[] = $row[0]; + } + + if (!in_array($this->options['prefix'][0] . 'cache_data', $db)) + { + if (!mysql_query('CREATE TABLE `' . $this->options['prefix'][0] . 'cache_data` (`id` TEXT CHARACTER SET utf8 NOT NULL, `items` SMALLINT NOT NULL DEFAULT 0, `data` BLOB NOT NULL, `mtime` INT UNSIGNED NOT NULL, UNIQUE (`id`(125)))')) + { + $this->mysql = null; + } + } + + if (!in_array($this->options['prefix'][0] . 'items', $db)) + { + if (!mysql_query('CREATE TABLE `' . $this->options['prefix'][0] . 'items` (`feed_id` TEXT CHARACTER SET utf8 NOT NULL, `id` TEXT CHARACTER SET utf8 NOT NULL, `data` TEXT CHARACTER SET utf8 NOT NULL, `posted` INT UNSIGNED NOT NULL, INDEX `feed_id` (`feed_id`(125)))')) + { + $this->mysql = null; + } + } + } + else + { + $this->mysql = null; + } + } + } + + function save($data) + { + if ($this->mysql) + { + $feed_id = "'" . mysql_real_escape_string($this->id) . "'"; + + if (is_a($data, 'SimplePie')) + { + if (SIMPLEPIE_PHP5) + { + // This keyword needs to defy coding standards for PHP4 compatibility + $data = clone($data); + } + + $prepared = $this->prepare_simplepie_object_for_cache($data); + + if ($query = mysql_query('SELECT `id` FROM `' . $this->options['prefix'][0] . 'cache_data` WHERE `id` = ' . $feed_id, $this->mysql)) + { + if (mysql_num_rows($query)) + { + $items = count($prepared[1]); + if ($items) + { + $sql = 'UPDATE `' . $this->options['prefix'][0] . 'cache_data` SET `items` = ' . $items . ', `data` = \'' . mysql_real_escape_string($prepared[0]) . '\', `mtime` = ' . time() . ' WHERE `id` = ' . $feed_id; + } + else + { + $sql = 'UPDATE `' . $this->options['prefix'][0] . 'cache_data` SET `data` = \'' . mysql_real_escape_string($prepared[0]) . '\', `mtime` = ' . time() . ' WHERE `id` = ' . $feed_id; + } + + if (!mysql_query($sql, $this->mysql)) + { + return false; + } + } + elseif (!mysql_query('INSERT INTO `' . $this->options['prefix'][0] . 'cache_data` (`id`, `items`, `data`, `mtime`) VALUES(' . $feed_id . ', ' . count($prepared[1]) . ', \'' . mysql_real_escape_string($prepared[0]) . '\', ' . time() . ')', $this->mysql)) + { + return false; + } + + $ids = array_keys($prepared[1]); + if (!empty($ids)) + { + foreach ($ids as $id) + { + $database_ids[] = mysql_real_escape_string($id); + } + + if ($query = mysql_unbuffered_query('SELECT `id` FROM `' . $this->options['prefix'][0] . 'items` WHERE `id` = \'' . implode('\' OR `id` = \'', $database_ids) . '\' AND `feed_id` = ' . $feed_id, $this->mysql)) + { + $existing_ids = array(); + while ($row = mysql_fetch_row($query)) + { + $existing_ids[] = $row[0]; + } + + $new_ids = array_diff($ids, $existing_ids); + + foreach ($new_ids as $new_id) + { + if (!($date = $prepared[1][$new_id]->get_date('U'))) + { + $date = time(); + } + + if (!mysql_query('INSERT INTO `' . $this->options['prefix'][0] . 'items` (`feed_id`, `id`, `data`, `posted`) VALUES(' . $feed_id . ', \'' . mysql_real_escape_string($new_id) . '\', \'' . mysql_real_escape_string(serialize($prepared[1][$new_id]->data)) . '\', ' . $date . ')', $this->mysql)) + { + return false; + } + } + return true; + } + } + else + { + return true; + } + } + } + elseif ($query = mysql_query('SELECT `id` FROM `' . $this->options['prefix'][0] . 'cache_data` WHERE `id` = ' . $feed_id, $this->mysql)) + { + if (mysql_num_rows($query)) + { + if (mysql_query('UPDATE `' . $this->options['prefix'][0] . 'cache_data` SET `items` = 0, `data` = \'' . mysql_real_escape_string(serialize($data)) . '\', `mtime` = ' . time() . ' WHERE `id` = ' . $feed_id, $this->mysql)) + { + return true; + } + } + elseif (mysql_query('INSERT INTO `' . $this->options['prefix'][0] . 'cache_data` (`id`, `items`, `data`, `mtime`) VALUES(\'' . mysql_real_escape_string($this->id) . '\', 0, \'' . mysql_real_escape_string(serialize($data)) . '\', ' . time() . ')', $this->mysql)) + { + return true; + } + } + } + return false; + } + + function load() + { + if ($this->mysql && ($query = mysql_query('SELECT `items`, `data` FROM `' . $this->options['prefix'][0] . 'cache_data` WHERE `id` = \'' . mysql_real_escape_string($this->id) . "'", $this->mysql)) && ($row = mysql_fetch_row($query))) + { + $data = unserialize($row[1]); + + if (isset($this->options['items'][0])) + { + $items = (int) $this->options['items'][0]; + } + else + { + $items = (int) $row[0]; + } + + if ($items !== 0) + { + if (isset($data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0])) + { + $feed =& $data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0]; + } + elseif (isset($data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0])) + { + $feed =& $data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0]; + } + elseif (isset($data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0])) + { + $feed =& $data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]; + } + elseif (isset($data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0])) + { + $feed =& $data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]; + } + else + { + $feed = null; + } + + if ($feed !== null) + { + $sql = 'SELECT `data` FROM `' . $this->options['prefix'][0] . 'items` WHERE `feed_id` = \'' . mysql_real_escape_string($this->id) . '\' ORDER BY `posted` DESC'; + if ($items > 0) + { + $sql .= ' LIMIT ' . $items; + } + + if ($query = mysql_unbuffered_query($sql, $this->mysql)) + { + while ($row = mysql_fetch_row($query)) + { + $feed['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['entry'][] = unserialize($row[0]); + } + } + else + { + return false; + } + } + } + return $data; + } + return false; + } + + function mtime() + { + if ($this->mysql && ($query = mysql_query('SELECT `mtime` FROM `' . $this->options['prefix'][0] . 'cache_data` WHERE `id` = \'' . mysql_real_escape_string($this->id) . "'", $this->mysql)) && ($row = mysql_fetch_row($query))) + { + return $row[0]; + } + else + { + return false; + } + } + + function touch() + { + if ($this->mysql && ($query = mysql_query('UPDATE `' . $this->options['prefix'][0] . 'cache_data` SET `mtime` = ' . time() . ' WHERE `id` = \'' . mysql_real_escape_string($this->id) . "'", $this->mysql)) && mysql_affected_rows($this->mysql)) + { + return true; + } + else + { + return false; + } + } + + function unlink() + { + if ($this->mysql && ($query = mysql_query('DELETE FROM `' . $this->options['prefix'][0] . 'cache_data` WHERE `id` = \'' . mysql_real_escape_string($this->id) . "'", $this->mysql)) && ($query2 = mysql_query('DELETE FROM `' . $this->options['prefix'][0] . 'items` WHERE `feed_id` = \'' . mysql_real_escape_string($this->id) . "'", $this->mysql))) + { + return true; + } + else + { + return false; + } + } +} + +class SimplePie_Misc +{ + function time_hms($seconds) + { + $time = ''; + + $hours = floor($seconds / 3600); + $remainder = $seconds % 3600; + if ($hours > 0) + { + $time .= $hours.':'; + } + + $minutes = floor($remainder / 60); + $seconds = $remainder % 60; + if ($minutes < 10 && $hours > 0) + { + $minutes = '0' . $minutes; + } + if ($seconds < 10) + { + $seconds = '0' . $seconds; + } + + $time .= $minutes.':'; + $time .= $seconds; + + return $time; + } + + function absolutize_url($relative, $base) + { + $iri = SimplePie_IRI::absolutize(new SimplePie_IRI($base), $relative); + return $iri->get_iri(); + } + + function remove_dot_segments($input) + { + $output = ''; + while (strpos($input, './') !== false || strpos($input, '/.') !== false || $input === '.' || $input === '..') + { + // A: If the input buffer begins with a prefix of "../" or "./", then remove that prefix from the input buffer; otherwise, + if (strpos($input, '../') === 0) + { + $input = substr($input, 3); + } + elseif (strpos($input, './') === 0) + { + $input = substr($input, 2); + } + // B: if the input buffer begins with a prefix of "/./" or "/.", where "." is a complete path segment, then replace that prefix with "/" in the input buffer; otherwise, + elseif (strpos($input, '/./') === 0) + { + $input = substr_replace($input, '/', 0, 3); + } + elseif ($input === '/.') + { + $input = '/'; + } + // C: if the input buffer begins with a prefix of "/../" or "/..", where ".." is a complete path segment, then replace that prefix with "/" in the input buffer and remove the last segment and its preceding "/" (if any) from the output buffer; otherwise, + elseif (strpos($input, '/../') === 0) + { + $input = substr_replace($input, '/', 0, 4); + $output = substr_replace($output, '', strrpos($output, '/')); + } + elseif ($input === '/..') + { + $input = '/'; + $output = substr_replace($output, '', strrpos($output, '/')); + } + // D: if the input buffer consists only of "." or "..", then remove that from the input buffer; otherwise, + elseif ($input === '.' || $input === '..') + { + $input = ''; + } + // E: move the first path segment in the input buffer to the end of the output buffer, including the initial "/" character (if any) and any subsequent characters up to, but not including, the next "/" character or the end of the input buffer + elseif (($pos = strpos($input, '/', 1)) !== false) + { + $output .= substr($input, 0, $pos); + $input = substr_replace($input, '', 0, $pos); + } + else + { + $output .= $input; + $input = ''; + } + } + return $output . $input; + } + + function get_element($realname, $string) + { + $return = array(); + $name = preg_quote($realname, '/'); + if (preg_match_all("/<($name)" . SIMPLEPIE_PCRE_HTML_ATTRIBUTE . "(>(.*)<\/$name>|(\/)?>)/siU", $string, $matches, PREG_SET_ORDER | PREG_OFFSET_CAPTURE)) + { + for ($i = 0, $total_matches = count($matches); $i < $total_matches; $i++) + { + $return[$i]['tag'] = $realname; + $return[$i]['full'] = $matches[$i][0][0]; + $return[$i]['offset'] = $matches[$i][0][1]; + if (strlen($matches[$i][3][0]) <= 2) + { + $return[$i]['self_closing'] = true; + } + else + { + $return[$i]['self_closing'] = false; + $return[$i]['content'] = $matches[$i][4][0]; + } + $return[$i]['attribs'] = array(); + if (isset($matches[$i][2][0]) && preg_match_all('/[\x09\x0A\x0B\x0C\x0D\x20]+([^\x09\x0A\x0B\x0C\x0D\x20\x2F\x3E][^\x09\x0A\x0B\x0C\x0D\x20\x2F\x3D\x3E]*)(?:[\x09\x0A\x0B\x0C\x0D\x20]*=[\x09\x0A\x0B\x0C\x0D\x20]*(?:"([^"]*)"|\'([^\']*)\'|([^\x09\x0A\x0B\x0C\x0D\x20\x22\x27\x3E][^\x09\x0A\x0B\x0C\x0D\x20\x3E]*)?))?/', ' ' . $matches[$i][2][0] . ' ', $attribs, PREG_SET_ORDER)) + { + for ($j = 0, $total_attribs = count($attribs); $j < $total_attribs; $j++) + { + if (count($attribs[$j]) === 2) + { + $attribs[$j][2] = $attribs[$j][1]; + } + $return[$i]['attribs'][strtolower($attribs[$j][1])]['data'] = SimplePie_Misc::entities_decode(end($attribs[$j]), 'UTF-8'); + } + } + } + } + return $return; + } + + function element_implode($element) + { + $full = "<$element[tag]"; + foreach ($element['attribs'] as $key => $value) + { + $key = strtolower($key); + $full .= " $key=\"" . htmlspecialchars($value['data']) . '"'; + } + if ($element['self_closing']) + { + $full .= ' />'; + } + else + { + $full .= ">$element[content]"; + } + return $full; + } + + function error($message, $level, $file, $line) + { + if ((ini_get('error_reporting') & $level) > 0) + { + switch ($level) + { + case E_USER_ERROR: + $note = 'PHP Error'; + break; + case E_USER_WARNING: + $note = 'PHP Warning'; + break; + case E_USER_NOTICE: + $note = 'PHP Notice'; + break; + default: + $note = 'Unknown Error'; + break; + } + error_log("$note: $message in $file on line $line", 0); + } + return $message; + } + + /** + * If a file has been cached, retrieve and display it. + * + * This is most useful for caching images (get_favicon(), etc.), + * however it works for all cached files. This WILL NOT display ANY + * file/image/page/whatever, but rather only display what has already + * been cached by SimplePie. + * + * @access public + * @see SimplePie::get_favicon() + * @param str $identifier_url URL that is used to identify the content. + * This may or may not be the actual URL of the live content. + * @param str $cache_location Location of SimplePie's cache. Defaults + * to './cache'. + * @param str $cache_extension The file extension that the file was + * cached with. Defaults to 'spc'. + * @param str $cache_class Name of the cache-handling class being used + * in SimplePie. Defaults to 'SimplePie_Cache', and should be left + * as-is unless you've overloaded the class. + * @param str $cache_name_function Obsolete. Exists for backwards + * compatibility reasons only. + */ + function display_cached_file($identifier_url, $cache_location = './cache', $cache_extension = 'spc', $cache_class = 'SimplePie_Cache', $cache_name_function = 'md5') + { + $cache = call_user_func(array($cache_class, 'create'), $cache_location, $identifier_url, $cache_extension); + + if ($file = $cache->load()) + { + if (isset($file['headers']['content-type'])) + { + header('Content-type:' . $file['headers']['content-type']); + } + else + { + header('Content-type: application/octet-stream'); + } + header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 604800) . ' GMT'); // 7 days + echo $file['body']; + exit; + } + + die('Cached file for ' . $identifier_url . ' cannot be found.'); + } + + function fix_protocol($url, $http = 1) + { + $url = SimplePie_Misc::normalize_url($url); + $parsed = SimplePie_Misc::parse_url($url); + if ($parsed['scheme'] !== '' && $parsed['scheme'] !== 'http' && $parsed['scheme'] !== 'https') + { + return SimplePie_Misc::fix_protocol(SimplePie_Misc::compress_parse_url('http', $parsed['authority'], $parsed['path'], $parsed['query'], $parsed['fragment']), $http); + } + + if ($parsed['scheme'] === '' && $parsed['authority'] === '' && !file_exists($url)) + { + return SimplePie_Misc::fix_protocol(SimplePie_Misc::compress_parse_url('http', $parsed['path'], '', $parsed['query'], $parsed['fragment']), $http); + } + + if ($http === 2 && $parsed['scheme'] !== '') + { + return "feed:$url"; + } + elseif ($http === 3 && strtolower($parsed['scheme']) === 'http') + { + return substr_replace($url, 'podcast', 0, 4); + } + elseif ($http === 4 && strtolower($parsed['scheme']) === 'http') + { + return substr_replace($url, 'itpc', 0, 4); + } + else + { + return $url; + } + } + + function parse_url($url) + { + $iri =& new SimplePie_IRI($url); + return array( + 'scheme' => (string) $iri->get_scheme(), + 'authority' => (string) $iri->get_authority(), + 'path' => (string) $iri->get_path(), + 'query' => (string) $iri->get_query(), + 'fragment' => (string) $iri->get_fragment() + ); + } + + function compress_parse_url($scheme = '', $authority = '', $path = '', $query = '', $fragment = '') + { + $iri =& new SimplePie_IRI(''); + $iri->set_scheme($scheme); + $iri->set_authority($authority); + $iri->set_path($path); + $iri->set_query($query); + $iri->set_fragment($fragment); + return $iri->get_iri(); + } + + function normalize_url($url) + { + $iri =& new SimplePie_IRI($url); + return $iri->get_iri(); + } + + function percent_encoding_normalization($match) + { + $integer = hexdec($match[1]); + if ($integer >= 0x41 && $integer <= 0x5A || $integer >= 0x61 && $integer <= 0x7A || $integer >= 0x30 && $integer <= 0x39 || $integer === 0x2D || $integer === 0x2E || $integer === 0x5F || $integer === 0x7E) + { + return chr($integer); + } + else + { + return strtoupper($match[0]); + } + } + + /** + * Remove bad UTF-8 bytes + * + * PCRE Pattern to locate bad bytes in a UTF-8 string comes from W3C + * FAQ: Multilingual Forms (modified to include full ASCII range) + * + * @author Geoffrey Sneddon + * @see http://www.w3.org/International/questions/qa-forms-utf-8 + * @param string $str String to remove bad UTF-8 bytes from + * @return string UTF-8 string + */ + function utf8_bad_replace($str) + { + if (function_exists('iconv') && ($return = @iconv('UTF-8', 'UTF-8//IGNORE', $str))) + { + return $return; + } + elseif (function_exists('mb_convert_encoding') && ($return = @mb_convert_encoding($str, 'UTF-8', 'UTF-8'))) + { + return $return; + } + elseif (preg_match_all('/(?:[\x00-\x7F]|[\xC2-\xDF][\x80-\xBF]|\xE0[\xA0-\xBF][\x80-\xBF]|[\xE1-\xEC\xEE\xEF][\x80-\xBF]{2}|\xED[\x80-\x9F][\x80-\xBF]|\xF0[\x90-\xBF][\x80-\xBF]{2}|[\xF1-\xF3][\x80-\xBF]{3}|\xF4[\x80-\x8F][\x80-\xBF]{2})+/', $str, $matches)) + { + return implode("\xEF\xBF\xBD", $matches[0]); + } + elseif ($str !== '') + { + return "\xEF\xBF\xBD"; + } + else + { + return ''; + } + } + + /** + * Converts a Windows-1252 encoded string to a UTF-8 encoded string + * + * @static + * @access public + * @param string $string Windows-1252 encoded string + * @return string UTF-8 encoded string + */ + function windows_1252_to_utf8($string) + { + static $convert_table = array("\x80" => "\xE2\x82\xAC", "\x81" => "\xEF\xBF\xBD", "\x82" => "\xE2\x80\x9A", "\x83" => "\xC6\x92", "\x84" => "\xE2\x80\x9E", "\x85" => "\xE2\x80\xA6", "\x86" => "\xE2\x80\xA0", "\x87" => "\xE2\x80\xA1", "\x88" => "\xCB\x86", "\x89" => "\xE2\x80\xB0", "\x8A" => "\xC5\xA0", "\x8B" => "\xE2\x80\xB9", "\x8C" => "\xC5\x92", "\x8D" => "\xEF\xBF\xBD", "\x8E" => "\xC5\xBD", "\x8F" => "\xEF\xBF\xBD", "\x90" => "\xEF\xBF\xBD", "\x91" => "\xE2\x80\x98", "\x92" => "\xE2\x80\x99", "\x93" => "\xE2\x80\x9C", "\x94" => "\xE2\x80\x9D", "\x95" => "\xE2\x80\xA2", "\x96" => "\xE2\x80\x93", "\x97" => "\xE2\x80\x94", "\x98" => "\xCB\x9C", "\x99" => "\xE2\x84\xA2", "\x9A" => "\xC5\xA1", "\x9B" => "\xE2\x80\xBA", "\x9C" => "\xC5\x93", "\x9D" => "\xEF\xBF\xBD", "\x9E" => "\xC5\xBE", "\x9F" => "\xC5\xB8", "\xA0" => "\xC2\xA0", "\xA1" => "\xC2\xA1", "\xA2" => "\xC2\xA2", "\xA3" => "\xC2\xA3", "\xA4" => "\xC2\xA4", "\xA5" => "\xC2\xA5", "\xA6" => "\xC2\xA6", "\xA7" => "\xC2\xA7", "\xA8" => "\xC2\xA8", "\xA9" => "\xC2\xA9", "\xAA" => "\xC2\xAA", "\xAB" => "\xC2\xAB", "\xAC" => "\xC2\xAC", "\xAD" => "\xC2\xAD", "\xAE" => "\xC2\xAE", "\xAF" => "\xC2\xAF", "\xB0" => "\xC2\xB0", "\xB1" => "\xC2\xB1", "\xB2" => "\xC2\xB2", "\xB3" => "\xC2\xB3", "\xB4" => "\xC2\xB4", "\xB5" => "\xC2\xB5", "\xB6" => "\xC2\xB6", "\xB7" => "\xC2\xB7", "\xB8" => "\xC2\xB8", "\xB9" => "\xC2\xB9", "\xBA" => "\xC2\xBA", "\xBB" => "\xC2\xBB", "\xBC" => "\xC2\xBC", "\xBD" => "\xC2\xBD", "\xBE" => "\xC2\xBE", "\xBF" => "\xC2\xBF", "\xC0" => "\xC3\x80", "\xC1" => "\xC3\x81", "\xC2" => "\xC3\x82", "\xC3" => "\xC3\x83", "\xC4" => "\xC3\x84", "\xC5" => "\xC3\x85", "\xC6" => "\xC3\x86", "\xC7" => "\xC3\x87", "\xC8" => "\xC3\x88", "\xC9" => "\xC3\x89", "\xCA" => "\xC3\x8A", "\xCB" => "\xC3\x8B", "\xCC" => "\xC3\x8C", "\xCD" => "\xC3\x8D", "\xCE" => "\xC3\x8E", "\xCF" => "\xC3\x8F", "\xD0" => "\xC3\x90", "\xD1" => "\xC3\x91", "\xD2" => "\xC3\x92", "\xD3" => "\xC3\x93", "\xD4" => "\xC3\x94", "\xD5" => "\xC3\x95", "\xD6" => "\xC3\x96", "\xD7" => "\xC3\x97", "\xD8" => "\xC3\x98", "\xD9" => "\xC3\x99", "\xDA" => "\xC3\x9A", "\xDB" => "\xC3\x9B", "\xDC" => "\xC3\x9C", "\xDD" => "\xC3\x9D", "\xDE" => "\xC3\x9E", "\xDF" => "\xC3\x9F", "\xE0" => "\xC3\xA0", "\xE1" => "\xC3\xA1", "\xE2" => "\xC3\xA2", "\xE3" => "\xC3\xA3", "\xE4" => "\xC3\xA4", "\xE5" => "\xC3\xA5", "\xE6" => "\xC3\xA6", "\xE7" => "\xC3\xA7", "\xE8" => "\xC3\xA8", "\xE9" => "\xC3\xA9", "\xEA" => "\xC3\xAA", "\xEB" => "\xC3\xAB", "\xEC" => "\xC3\xAC", "\xED" => "\xC3\xAD", "\xEE" => "\xC3\xAE", "\xEF" => "\xC3\xAF", "\xF0" => "\xC3\xB0", "\xF1" => "\xC3\xB1", "\xF2" => "\xC3\xB2", "\xF3" => "\xC3\xB3", "\xF4" => "\xC3\xB4", "\xF5" => "\xC3\xB5", "\xF6" => "\xC3\xB6", "\xF7" => "\xC3\xB7", "\xF8" => "\xC3\xB8", "\xF9" => "\xC3\xB9", "\xFA" => "\xC3\xBA", "\xFB" => "\xC3\xBB", "\xFC" => "\xC3\xBC", "\xFD" => "\xC3\xBD", "\xFE" => "\xC3\xBE", "\xFF" => "\xC3\xBF"); + + return strtr($string, $convert_table); + } + + function change_encoding($data, $input, $output) + { + $input = SimplePie_Misc::encoding($input); + $output = SimplePie_Misc::encoding($output); + + // We fail to fail on non US-ASCII bytes + if ($input === 'US-ASCII') + { + static $non_ascii_octects = ''; + if (!$non_ascii_octects) + { + for ($i = 0x80; $i <= 0xFF; $i++) + { + $non_ascii_octects .= chr($i); + } + } + $data = substr($data, 0, strcspn($data, $non_ascii_octects)); + } + + // This is first, as behaviour of this is completely predictable + if ($input === 'windows-1252' && $output === 'UTF-8') + { + return SimplePie_Misc::windows_1252_to_utf8($data); + } + // This is second, as behaviour of this varies only with PHP version (the middle part of this expression checks the encoding is supported). + elseif (function_exists('mb_convert_encoding') && @mb_convert_encoding("\x80", 'UTF-16BE', $input) !== "\x00\x80" && ($return = @mb_convert_encoding($data, $output, $input))) + { + return $return; + } + // This is last, as behaviour of this varies with OS userland and PHP version + elseif (function_exists('iconv') && ($return = @iconv($input, $output, $data))) + { + return $return; + } + // If we can't do anything, just fail + else + { + return false; + } + } + + function encoding($charset) + { + // Normalization from UTS #22 + switch (strtolower(preg_replace('/(?:[^a-zA-Z0-9]+|([^0-9])0+)/', '\1', $charset))) + { + case 'adobestandardencoding': + case 'csadobestandardencoding': + return 'Adobe-Standard-Encoding'; + + case 'adobesymbolencoding': + case 'cshppsmath': + return 'Adobe-Symbol-Encoding'; + + case 'ami1251': + case 'amiga1251': + return 'Amiga-1251'; + + case 'ansix31101983': + case 'csat5001983': + case 'csiso99naplps': + case 'isoir99': + case 'naplps': + return 'ANSI_X3.110-1983'; + + case 'arabic7': + case 'asmo449': + case 'csiso89asmo449': + case 'iso9036': + case 'isoir89': + return 'ASMO_449'; + + case 'big5': + case 'csbig5': + case 'xxbig5': + return 'Big5'; + + case 'big5hkscs': + return 'Big5-HKSCS'; + + case 'bocu1': + case 'csbocu1': + return 'BOCU-1'; + + case 'brf': + case 'csbrf': + return 'BRF'; + + case 'bs4730': + case 'csiso4unitedkingdom': + case 'gb': + case 'iso646gb': + case 'isoir4': + case 'uk': + return 'BS_4730'; + + case 'bsviewdata': + case 'csiso47bsviewdata': + case 'isoir47': + return 'BS_viewdata'; + + case 'cesu8': + case 'cscesu8': + return 'CESU-8'; + + case 'ca': + case 'csa71': + case 'csaz243419851': + case 'csiso121canadian1': + case 'iso646ca': + case 'isoir121': + return 'CSA_Z243.4-1985-1'; + + case 'csa72': + case 'csaz243419852': + case 'csiso122canadian2': + case 'iso646ca2': + case 'isoir122': + return 'CSA_Z243.4-1985-2'; + + case 'csaz24341985gr': + case 'csiso123csaz24341985gr': + case 'isoir123': + return 'CSA_Z243.4-1985-gr'; + + case 'csiso139csn369103': + case 'csn369103': + case 'isoir139': + return 'CSN_369103'; + + case 'csdecmcs': + case 'dec': + case 'decmcs': + return 'DEC-MCS'; + + case 'csiso21german': + case 'de': + case 'din66003': + case 'iso646de': + case 'isoir21': + return 'DIN_66003'; + + case 'csdkus': + case 'dkus': + return 'dk-us'; + + case 'csiso646danish': + case 'dk': + case 'ds2089': + case 'iso646dk': + return 'DS_2089'; + + case 'csibmebcdicatde': + case 'ebcdicatde': + return 'EBCDIC-AT-DE'; + + case 'csebcdicatdea': + case 'ebcdicatdea': + return 'EBCDIC-AT-DE-A'; + + case 'csebcdiccafr': + case 'ebcdiccafr': + return 'EBCDIC-CA-FR'; + + case 'csebcdicdkno': + case 'ebcdicdkno': + return 'EBCDIC-DK-NO'; + + case 'csebcdicdknoa': + case 'ebcdicdknoa': + return 'EBCDIC-DK-NO-A'; + + case 'csebcdices': + case 'ebcdices': + return 'EBCDIC-ES'; + + case 'csebcdicesa': + case 'ebcdicesa': + return 'EBCDIC-ES-A'; + + case 'csebcdicess': + case 'ebcdicess': + return 'EBCDIC-ES-S'; + + case 'csebcdicfise': + case 'ebcdicfise': + return 'EBCDIC-FI-SE'; + + case 'csebcdicfisea': + case 'ebcdicfisea': + return 'EBCDIC-FI-SE-A'; + + case 'csebcdicfr': + case 'ebcdicfr': + return 'EBCDIC-FR'; + + case 'csebcdicit': + case 'ebcdicit': + return 'EBCDIC-IT'; + + case 'csebcdicpt': + case 'ebcdicpt': + return 'EBCDIC-PT'; + + case 'csebcdicuk': + case 'ebcdicuk': + return 'EBCDIC-UK'; + + case 'csebcdicus': + case 'ebcdicus': + return 'EBCDIC-US'; + + case 'csiso111ecmacyrillic': + case 'ecmacyrillic': + case 'isoir111': + case 'koi8e': + return 'ECMA-cyrillic'; + + case 'csiso17spanish': + case 'es': + case 'iso646es': + case 'isoir17': + return 'ES'; + + case 'csiso85spanish2': + case 'es2': + case 'iso646es2': + case 'isoir85': + return 'ES2'; + + case 'cseucfixwidjapanese': + case 'extendedunixcodefixedwidthforjapanese': + return 'Extended_UNIX_Code_Fixed_Width_for_Japanese'; + + case 'cseucpkdfmtjapanese': + case 'eucjp': + case 'extendedunixcodepackedformatforjapanese': + return 'Extended_UNIX_Code_Packed_Format_for_Japanese'; + + case 'gb18030': + return 'GB18030'; + + case 'chinese': + case 'cp936': + case 'csgb2312': + case 'csiso58gb231280': + case 'gb2312': + case 'gb231280': + case 'gbk': + case 'isoir58': + case 'ms936': + case 'windows936': + return 'GBK'; + + case 'cn': + case 'csiso57gb1988': + case 'gb198880': + case 'iso646cn': + case 'isoir57': + return 'GB_1988-80'; + + case 'csiso153gost1976874': + case 'gost1976874': + case 'isoir153': + case 'stsev35888': + return 'GOST_19768-74'; + + case 'csiso150': + case 'csiso150greekccitt': + case 'greekccitt': + case 'isoir150': + return 'greek-ccitt'; + + case 'csiso88greek7': + case 'greek7': + case 'isoir88': + return 'greek7'; + + case 'csiso18greek7old': + case 'greek7old': + case 'isoir18': + return 'greek7-old'; + + case 'cshpdesktop': + case 'hpdesktop': + return 'HP-DeskTop'; + + case 'cshplegal': + case 'hplegal': + return 'HP-Legal'; + + case 'cshpmath8': + case 'hpmath8': + return 'HP-Math8'; + + case 'cshppifont': + case 'hppifont': + return 'HP-Pi-font'; + + case 'cshproman8': + case 'hproman8': + case 'r8': + case 'roman8': + return 'hp-roman8'; + + case 'hzgb2312': + return 'HZ-GB-2312'; + + case 'csibmsymbols': + case 'ibmsymbols': + return 'IBM-Symbols'; + + case 'csibmthai': + case 'ibmthai': + return 'IBM-Thai'; + + case 'ccsid858': + case 'cp858': + case 'ibm858': + case 'pcmultilingual850euro': + return 'IBM00858'; + + case 'ccsid924': + case 'cp924': + case 'ebcdiclatin9euro': + case 'ibm924': + return 'IBM00924'; + + case 'ccsid1140': + case 'cp1140': + case 'ebcdicus37euro': + case 'ibm1140': + return 'IBM01140'; + + case 'ccsid1141': + case 'cp1141': + case 'ebcdicde273euro': + case 'ibm1141': + return 'IBM01141'; + + case 'ccsid1142': + case 'cp1142': + case 'ebcdicdk277euro': + case 'ebcdicno277euro': + case 'ibm1142': + return 'IBM01142'; + + case 'ccsid1143': + case 'cp1143': + case 'ebcdicfi278euro': + case 'ebcdicse278euro': + case 'ibm1143': + return 'IBM01143'; + + case 'ccsid1144': + case 'cp1144': + case 'ebcdicit280euro': + case 'ibm1144': + return 'IBM01144'; + + case 'ccsid1145': + case 'cp1145': + case 'ebcdices284euro': + case 'ibm1145': + return 'IBM01145'; + + case 'ccsid1146': + case 'cp1146': + case 'ebcdicgb285euro': + case 'ibm1146': + return 'IBM01146'; + + case 'ccsid1147': + case 'cp1147': + case 'ebcdicfr297euro': + case 'ibm1147': + return 'IBM01147'; + + case 'ccsid1148': + case 'cp1148': + case 'ebcdicinternational500euro': + case 'ibm1148': + return 'IBM01148'; + + case 'ccsid1149': + case 'cp1149': + case 'ebcdicis871euro': + case 'ibm1149': + return 'IBM01149'; + + case 'cp37': + case 'csibm37': + case 'ebcdiccpca': + case 'ebcdiccpnl': + case 'ebcdiccpus': + case 'ebcdiccpwt': + case 'ibm37': + return 'IBM037'; + + case 'cp38': + case 'csibm38': + case 'ebcdicint': + case 'ibm38': + return 'IBM038'; + + case 'cp273': + case 'csibm273': + case 'ibm273': + return 'IBM273'; + + case 'cp274': + case 'csibm274': + case 'ebcdicbe': + case 'ibm274': + return 'IBM274'; + + case 'cp275': + case 'csibm275': + case 'ebcdicbr': + case 'ibm275': + return 'IBM275'; + + case 'csibm277': + case 'ebcdiccpdk': + case 'ebcdiccpno': + case 'ibm277': + return 'IBM277'; + + case 'cp278': + case 'csibm278': + case 'ebcdiccpfi': + case 'ebcdiccpse': + case 'ibm278': + return 'IBM278'; + + case 'cp280': + case 'csibm280': + case 'ebcdiccpit': + case 'ibm280': + return 'IBM280'; + + case 'cp281': + case 'csibm281': + case 'ebcdicjpe': + case 'ibm281': + return 'IBM281'; + + case 'cp284': + case 'csibm284': + case 'ebcdiccpes': + case 'ibm284': + return 'IBM284'; + + case 'cp285': + case 'csibm285': + case 'ebcdiccpgb': + case 'ibm285': + return 'IBM285'; + + case 'cp290': + case 'csibm290': + case 'ebcdicjpkana': + case 'ibm290': + return 'IBM290'; + + case 'cp297': + case 'csibm297': + case 'ebcdiccpfr': + case 'ibm297': + return 'IBM297'; + + case 'cp420': + case 'csibm420': + case 'ebcdiccpar1': + case 'ibm420': + return 'IBM420'; + + case 'cp423': + case 'csibm423': + case 'ebcdiccpgr': + case 'ibm423': + return 'IBM423'; + + case 'cp424': + case 'csibm424': + case 'ebcdiccphe': + case 'ibm424': + return 'IBM424'; + + case '437': + case 'cp437': + case 'cspc8codepage437': + case 'ibm437': + return 'IBM437'; + + case 'cp500': + case 'csibm500': + case 'ebcdiccpbe': + case 'ebcdiccpch': + case 'ibm500': + return 'IBM500'; + + case 'cp775': + case 'cspc775baltic': + case 'ibm775': + return 'IBM775'; + + case '850': + case 'cp850': + case 'cspc850multilingual': + case 'ibm850': + return 'IBM850'; + + case '851': + case 'cp851': + case 'csibm851': + case 'ibm851': + return 'IBM851'; + + case '852': + case 'cp852': + case 'cspcp852': + case 'ibm852': + return 'IBM852'; + + case '855': + case 'cp855': + case 'csibm855': + case 'ibm855': + return 'IBM855'; + + case '857': + case 'cp857': + case 'csibm857': + case 'ibm857': + return 'IBM857'; + + case '860': + case 'cp860': + case 'csibm860': + case 'ibm860': + return 'IBM860'; + + case '861': + case 'cp861': + case 'cpis': + case 'csibm861': + case 'ibm861': + return 'IBM861'; + + case '862': + case 'cp862': + case 'cspc862latinhebrew': + case 'ibm862': + return 'IBM862'; + + case '863': + case 'cp863': + case 'csibm863': + case 'ibm863': + return 'IBM863'; + + case 'cp864': + case 'csibm864': + case 'ibm864': + return 'IBM864'; + + case '865': + case 'cp865': + case 'csibm865': + case 'ibm865': + return 'IBM865'; + + case '866': + case 'cp866': + case 'csibm866': + case 'ibm866': + return 'IBM866'; + + case 'cp868': + case 'cpar': + case 'csibm868': + case 'ibm868': + return 'IBM868'; + + case '869': + case 'cp869': + case 'cpgr': + case 'csibm869': + case 'ibm869': + return 'IBM869'; + + case 'cp870': + case 'csibm870': + case 'ebcdiccproece': + case 'ebcdiccpyu': + case 'ibm870': + return 'IBM870'; + + case 'cp871': + case 'csibm871': + case 'ebcdiccpis': + case 'ibm871': + return 'IBM871'; + + case 'cp880': + case 'csibm880': + case 'ebcdiccyrillic': + case 'ibm880': + return 'IBM880'; + + case 'cp891': + case 'csibm891': + case 'ibm891': + return 'IBM891'; + + case 'cp903': + case 'csibm903': + case 'ibm903': + return 'IBM903'; + + case '904': + case 'cp904': + case 'csibbm904': + case 'ibm904': + return 'IBM904'; + + case 'cp905': + case 'csibm905': + case 'ebcdiccptr': + case 'ibm905': + return 'IBM905'; + + case 'cp918': + case 'csibm918': + case 'ebcdiccpar2': + case 'ibm918': + return 'IBM918'; + + case 'cp1026': + case 'csibm1026': + case 'ibm1026': + return 'IBM1026'; + + case 'ibm1047': + return 'IBM1047'; + + case 'csiso143iecp271': + case 'iecp271': + case 'isoir143': + return 'IEC_P27-1'; + + case 'csiso49inis': + case 'inis': + case 'isoir49': + return 'INIS'; + + case 'csiso50inis8': + case 'inis8': + case 'isoir50': + return 'INIS-8'; + + case 'csiso51iniscyrillic': + case 'iniscyrillic': + case 'isoir51': + return 'INIS-cyrillic'; + + case 'csinvariant': + case 'invariant': + return 'INVARIANT'; + + case 'iso2022cn': + return 'ISO-2022-CN'; + + case 'iso2022cnext': + return 'ISO-2022-CN-EXT'; + + case 'csiso2022jp': + case 'iso2022jp': + return 'ISO-2022-JP'; + + case 'csiso2022jp2': + case 'iso2022jp2': + return 'ISO-2022-JP-2'; + + case 'csiso2022kr': + case 'iso2022kr': + return 'ISO-2022-KR'; + + case 'cswindows30latin1': + case 'iso88591windows30latin1': + return 'ISO-8859-1-Windows-3.0-Latin-1'; + + case 'cswindows31latin1': + case 'iso88591windows31latin1': + return 'ISO-8859-1-Windows-3.1-Latin-1'; + + case 'csisolatin2': + case 'iso88592': + case 'iso885921987': + case 'isoir101': + case 'l2': + case 'latin2': + return 'ISO-8859-2'; + + case 'cswindows31latin2': + case 'iso88592windowslatin2': + return 'ISO-8859-2-Windows-Latin-2'; + + case 'csisolatin3': + case 'iso88593': + case 'iso885931988': + case 'isoir109': + case 'l3': + case 'latin3': + return 'ISO-8859-3'; + + case 'csisolatin4': + case 'iso88594': + case 'iso885941988': + case 'isoir110': + case 'l4': + case 'latin4': + return 'ISO-8859-4'; + + case 'csisolatincyrillic': + case 'cyrillic': + case 'iso88595': + case 'iso885951988': + case 'isoir144': + return 'ISO-8859-5'; + + case 'arabic': + case 'asmo708': + case 'csisolatinarabic': + case 'ecma114': + case 'iso88596': + case 'iso885961987': + case 'isoir127': + return 'ISO-8859-6'; + + case 'csiso88596e': + case 'iso88596e': + return 'ISO-8859-6-E'; + + case 'csiso88596i': + case 'iso88596i': + return 'ISO-8859-6-I'; + + case 'csisolatingreek': + case 'ecma118': + case 'elot928': + case 'greek': + case 'greek8': + case 'iso88597': + case 'iso885971987': + case 'isoir126': + return 'ISO-8859-7'; + + case 'csisolatinhebrew': + case 'hebrew': + case 'iso88598': + case 'iso885981988': + case 'isoir138': + return 'ISO-8859-8'; + + case 'csiso88598e': + case 'iso88598e': + return 'ISO-8859-8-E'; + + case 'csiso88598i': + case 'iso88598i': + return 'ISO-8859-8-I'; + + case 'cswindows31latin5': + case 'iso88599windowslatin5': + return 'ISO-8859-9-Windows-Latin-5'; + + case 'csisolatin6': + case 'iso885910': + case 'iso8859101992': + case 'isoir157': + case 'l6': + case 'latin6': + return 'ISO-8859-10'; + + case 'iso885913': + return 'ISO-8859-13'; + + case 'iso885914': + case 'iso8859141998': + case 'isoceltic': + case 'isoir199': + case 'l8': + case 'latin8': + return 'ISO-8859-14'; + + case 'iso885915': + case 'latin9': + return 'ISO-8859-15'; + + case 'iso885916': + case 'iso8859162001': + case 'isoir226': + case 'l10': + case 'latin10': + return 'ISO-8859-16'; + + case 'iso10646j1': + return 'ISO-10646-J-1'; + + case 'csunicode': + case 'iso10646ucs2': + return 'ISO-10646-UCS-2'; + + case 'csucs4': + case 'iso10646ucs4': + return 'ISO-10646-UCS-4'; + + case 'csunicodeascii': + case 'iso10646ucsbasic': + return 'ISO-10646-UCS-Basic'; + + case 'csunicodelatin1': + case 'iso10646': + case 'iso10646unicodelatin1': + return 'ISO-10646-Unicode-Latin1'; + + case 'csiso10646utf1': + case 'iso10646utf1': + return 'ISO-10646-UTF-1'; + + case 'csiso115481': + case 'iso115481': + case 'isotr115481': + return 'ISO-11548-1'; + + case 'csiso90': + case 'isoir90': + return 'iso-ir-90'; + + case 'csunicodeibm1261': + case 'isounicodeibm1261': + return 'ISO-Unicode-IBM-1261'; + + case 'csunicodeibm1264': + case 'isounicodeibm1264': + return 'ISO-Unicode-IBM-1264'; + + case 'csunicodeibm1265': + case 'isounicodeibm1265': + return 'ISO-Unicode-IBM-1265'; + + case 'csunicodeibm1268': + case 'isounicodeibm1268': + return 'ISO-Unicode-IBM-1268'; + + case 'csunicodeibm1276': + case 'isounicodeibm1276': + return 'ISO-Unicode-IBM-1276'; + + case 'csiso646basic1983': + case 'iso646basic1983': + case 'ref': + return 'ISO_646.basic:1983'; + + case 'csiso2intlrefversion': + case 'irv': + case 'iso646irv1983': + case 'isoir2': + return 'ISO_646.irv:1983'; + + case 'csiso2033': + case 'e13b': + case 'iso20331983': + case 'isoir98': + return 'ISO_2033-1983'; + + case 'csiso5427cyrillic': + case 'iso5427': + case 'isoir37': + return 'ISO_5427'; + + case 'iso5427cyrillic1981': + case 'iso54271981': + case 'isoir54': + return 'ISO_5427:1981'; + + case 'csiso5428greek': + case 'iso54281980': + case 'isoir55': + return 'ISO_5428:1980'; + + case 'csiso6937add': + case 'iso6937225': + case 'isoir152': + return 'ISO_6937-2-25'; + + case 'csisotextcomm': + case 'iso69372add': + case 'isoir142': + return 'ISO_6937-2-add'; + + case 'csiso8859supp': + case 'iso8859supp': + case 'isoir154': + case 'latin125': + return 'ISO_8859-supp'; + + case 'csiso10367box': + case 'iso10367box': + case 'isoir155': + return 'ISO_10367-box'; + + case 'csiso15italian': + case 'iso646it': + case 'isoir15': + case 'it': + return 'IT'; + + case 'csiso13jisc6220jp': + case 'isoir13': + case 'jisc62201969': + case 'jisc62201969jp': + case 'katakana': + case 'x2017': + return 'JIS_C6220-1969-jp'; + + case 'csiso14jisc6220ro': + case 'iso646jp': + case 'isoir14': + case 'jisc62201969ro': + case 'jp': + return 'JIS_C6220-1969-ro'; + + case 'csiso42jisc62261978': + case 'isoir42': + case 'jisc62261978': + return 'JIS_C6226-1978'; + + case 'csiso87jisx208': + case 'isoir87': + case 'jisc62261983': + case 'jisx2081983': + case 'x208': + return 'JIS_C6226-1983'; + + case 'csiso91jisc62291984a': + case 'isoir91': + case 'jisc62291984a': + case 'jpocra': + return 'JIS_C6229-1984-a'; + + case 'csiso92jisc62991984b': + case 'iso646jpocrb': + case 'isoir92': + case 'jisc62291984b': + case 'jpocrb': + return 'JIS_C6229-1984-b'; + + case 'csiso93jis62291984badd': + case 'isoir93': + case 'jisc62291984badd': + case 'jpocrbadd': + return 'JIS_C6229-1984-b-add'; + + case 'csiso94jis62291984hand': + case 'isoir94': + case 'jisc62291984hand': + case 'jpocrhand': + return 'JIS_C6229-1984-hand'; + + case 'csiso95jis62291984handadd': + case 'isoir95': + case 'jisc62291984handadd': + case 'jpocrhandadd': + return 'JIS_C6229-1984-hand-add'; + + case 'csiso96jisc62291984kana': + case 'isoir96': + case 'jisc62291984kana': + return 'JIS_C6229-1984-kana'; + + case 'csjisencoding': + case 'jisencoding': + return 'JIS_Encoding'; + + case 'cshalfwidthkatakana': + case 'jisx201': + case 'x201': + return 'JIS_X0201'; + + case 'csiso159jisx2121990': + case 'isoir159': + case 'jisx2121990': + case 'x212': + return 'JIS_X0212-1990'; + + case 'csiso141jusib1002': + case 'iso646yu': + case 'isoir141': + case 'js': + case 'jusib1002': + case 'yu': + return 'JUS_I.B1.002'; + + case 'csiso147macedonian': + case 'isoir147': + case 'jusib1003mac': + case 'macedonian': + return 'JUS_I.B1.003-mac'; + + case 'csiso146serbian': + case 'isoir146': + case 'jusib1003serb': + case 'serbian': + return 'JUS_I.B1.003-serb'; + + case 'koi7switched': + return 'KOI7-switched'; + + case 'cskoi8r': + case 'koi8r': + return 'KOI8-R'; + + case 'koi8u': + return 'KOI8-U'; + + case 'csksc5636': + case 'iso646kr': + case 'ksc5636': + return 'KSC5636'; + + case 'cskz1048': + case 'kz1048': + case 'rk1048': + case 'strk10482002': + return 'KZ-1048'; + + case 'csiso19latingreek': + case 'isoir19': + case 'latingreek': + return 'latin-greek'; + + case 'csiso27latingreek1': + case 'isoir27': + case 'latingreek1': + return 'Latin-greek-1'; + + case 'csiso158lap': + case 'isoir158': + case 'lap': + case 'latinlap': + return 'latin-lap'; + + case 'csmacintosh': + case 'mac': + case 'macintosh': + return 'macintosh'; + + case 'csmicrosoftpublishing': + case 'microsoftpublishing': + return 'Microsoft-Publishing'; + + case 'csmnem': + case 'mnem': + return 'MNEM'; + + case 'csmnemonic': + case 'mnemonic': + return 'MNEMONIC'; + + case 'csiso86hungarian': + case 'hu': + case 'iso646hu': + case 'isoir86': + case 'msz77953': + return 'MSZ_7795.3'; + + case 'csnatsdano': + case 'isoir91': + case 'natsdano': + return 'NATS-DANO'; + + case 'csnatsdanoadd': + case 'isoir92': + case 'natsdanoadd': + return 'NATS-DANO-ADD'; + + case 'csnatssefi': + case 'isoir81': + case 'natssefi': + return 'NATS-SEFI'; + + case 'csnatssefiadd': + case 'isoir82': + case 'natssefiadd': + return 'NATS-SEFI-ADD'; + + case 'csiso151cuba': + case 'cuba': + case 'iso646cu': + case 'isoir151': + case 'ncnc1081': + return 'NC_NC00-10:81'; + + case 'csiso69french': + case 'fr': + case 'iso646fr': + case 'isoir69': + case 'nfz62010': + return 'NF_Z_62-010'; + + case 'csiso25french': + case 'iso646fr1': + case 'isoir25': + case 'nfz620101973': + return 'NF_Z_62-010_(1973)'; + + case 'csiso60danishnorwegian': + case 'csiso60norwegian1': + case 'iso646no': + case 'isoir60': + case 'no': + case 'ns45511': + return 'NS_4551-1'; + + case 'csiso61norwegian2': + case 'iso646no2': + case 'isoir61': + case 'no2': + case 'ns45512': + return 'NS_4551-2'; + + case 'osdebcdicdf3irv': + return 'OSD_EBCDIC_DF03_IRV'; + + case 'osdebcdicdf41': + return 'OSD_EBCDIC_DF04_1'; + + case 'osdebcdicdf415': + return 'OSD_EBCDIC_DF04_15'; + + case 'cspc8danishnorwegian': + case 'pc8danishnorwegian': + return 'PC8-Danish-Norwegian'; + + case 'cspc8turkish': + case 'pc8turkish': + return 'PC8-Turkish'; + + case 'csiso16portuguese': + case 'iso646pt': + case 'isoir16': + case 'pt': + return 'PT'; + + case 'csiso84portuguese2': + case 'iso646pt2': + case 'isoir84': + case 'pt2': + return 'PT2'; + + case 'cp154': + case 'csptcp154': + case 'cyrillicasian': + case 'pt154': + case 'ptcp154': + return 'PTCP154'; + + case 'scsu': + return 'SCSU'; + + case 'csiso10swedish': + case 'fi': + case 'iso646fi': + case 'iso646se': + case 'isoir10': + case 'se': + case 'sen850200b': + return 'SEN_850200_B'; + + case 'csiso11swedishfornames': + case 'iso646se2': + case 'isoir11': + case 'se2': + case 'sen850200c': + return 'SEN_850200_C'; + + case 'csshiftjis': + case 'mskanji': + case 'shiftjis': + return 'Shift_JIS'; + + case 'csiso102t617bit': + case 'isoir102': + case 't617bit': + return 'T.61-7bit'; + + case 'csiso103t618bit': + case 'isoir103': + case 't61': + case 't618bit': + return 'T.61-8bit'; + + case 'csiso128t101g2': + case 'isoir128': + case 't101g2': + return 'T.101-G2'; + + case 'cstscii': + case 'tscii': + return 'TSCII'; + + case 'csunicode11': + case 'unicode11': + return 'UNICODE-1-1'; + + case 'csunicode11utf7': + case 'unicode11utf7': + return 'UNICODE-1-1-UTF-7'; + + case 'csunknown8bit': + case 'unknown8bit': + return 'UNKNOWN-8BIT'; + + case 'ansix341968': + case 'ansix341986': + case 'ascii': + case 'cp367': + case 'csascii': + case 'ibm367': + case 'iso646irv1991': + case 'iso646us': + case 'isoir6': + case 'us': + case 'usascii': + return 'US-ASCII'; + + case 'csusdk': + case 'usdk': + return 'us-dk'; + + case 'utf7': + return 'UTF-7'; + + case 'utf8': + return 'UTF-8'; + + case 'utf16': + return 'UTF-16'; + + case 'utf16be': + return 'UTF-16BE'; + + case 'utf16le': + return 'UTF-16LE'; + + case 'utf32': + return 'UTF-32'; + + case 'utf32be': + return 'UTF-32BE'; + + case 'utf32le': + return 'UTF-32LE'; + + case 'csventurainternational': + case 'venturainternational': + return 'Ventura-International'; + + case 'csventuramath': + case 'venturamath': + return 'Ventura-Math'; + + case 'csventuraus': + case 'venturaus': + return 'Ventura-US'; + + case 'csiso70videotexsupp1': + case 'isoir70': + case 'videotexsuppl': + return 'videotex-suppl'; + + case 'csviqr': + case 'viqr': + return 'VIQR'; + + case 'csviscii': + case 'viscii': + return 'VISCII'; + + case 'cswindows31j': + case 'windows31j': + return 'Windows-31J'; + + case 'iso885911': + case 'tis620': + return 'windows-874'; + + case 'cseuckr': + case 'csksc56011987': + case 'euckr': + case 'isoir149': + case 'korean': + case 'ksc5601': + case 'ksc56011987': + case 'ksc56011989': + case 'windows949': + return 'windows-949'; + + case 'windows1250': + return 'windows-1250'; + + case 'windows1251': + return 'windows-1251'; + + case 'cp819': + case 'csisolatin1': + case 'ibm819': + case 'iso88591': + case 'iso885911987': + case 'isoir100': + case 'l1': + case 'latin1': + case 'windows1252': + return 'windows-1252'; + + case 'windows1253': + return 'windows-1253'; + + case 'csisolatin5': + case 'iso88599': + case 'iso885991989': + case 'isoir148': + case 'l5': + case 'latin5': + case 'windows1254': + return 'windows-1254'; + + case 'windows1255': + return 'windows-1255'; + + case 'windows1256': + return 'windows-1256'; + + case 'windows1257': + return 'windows-1257'; + + case 'windows1258': + return 'windows-1258'; + + default: + return $charset; + } + } + + function get_curl_version() + { + if (is_array($curl = curl_version())) + { + $curl = $curl['version']; + } + elseif (substr($curl, 0, 5) === 'curl/') + { + $curl = substr($curl, 5, strcspn($curl, "\x09\x0A\x0B\x0C\x0D", 5)); + } + elseif (substr($curl, 0, 8) === 'libcurl/') + { + $curl = substr($curl, 8, strcspn($curl, "\x09\x0A\x0B\x0C\x0D", 8)); + } + else + { + $curl = 0; + } + return $curl; + } + + function is_subclass_of($class1, $class2) + { + if (func_num_args() !== 2) + { + trigger_error('Wrong parameter count for SimplePie_Misc::is_subclass_of()', E_USER_WARNING); + } + elseif (version_compare(PHP_VERSION, '5.0.3', '>=') || is_object($class1)) + { + return is_subclass_of($class1, $class2); + } + elseif (is_string($class1) && is_string($class2)) + { + if (class_exists($class1)) + { + if (class_exists($class2)) + { + $class2 = strtolower($class2); + while ($class1 = strtolower(get_parent_class($class1))) + { + if ($class1 === $class2) + { + return true; + } + } + } + } + else + { + trigger_error('Unknown class passed as parameter', E_USER_WARNNG); + } + } + return false; + } + + /** + * Strip HTML comments + * + * @access public + * @param string $data Data to strip comments from + * @return string Comment stripped string + */ + function strip_comments($data) + { + $output = ''; + while (($start = strpos($data, '', $start)) !== false) + { + $data = substr_replace($data, '', 0, $end + 3); + } + else + { + $data = ''; + } + } + return $output . $data; + } + + function parse_date($dt) + { + $parser = SimplePie_Parse_Date::get(); + return $parser->parse($dt); + } + + /** + * Decode HTML entities + * + * @static + * @access public + * @param string $data Input data + * @return string Output data + */ + function entities_decode($data) + { + $decoder =& new SimplePie_Decode_HTML_Entities($data); + return $decoder->parse(); + } + + /** + * Remove RFC822 comments + * + * @access public + * @param string $data Data to strip comments from + * @return string Comment stripped string + */ + function uncomment_rfc822($string) + { + $string = (string) $string; + $position = 0; + $length = strlen($string); + $depth = 0; + + $output = ''; + + while ($position < $length && ($pos = strpos($string, '(', $position)) !== false) + { + $output .= substr($string, $position, $pos - $position); + $position = $pos + 1; + if ($string[$pos - 1] !== '\\') + { + $depth++; + while ($depth && $position < $length) + { + $position += strcspn($string, '()', $position); + if ($string[$position - 1] === '\\') + { + $position++; + continue; + } + elseif (isset($string[$position])) + { + switch ($string[$position]) + { + case '(': + $depth++; + break; + + case ')': + $depth--; + break; + } + $position++; + } + else + { + break; + } + } + } + else + { + $output .= '('; + } + } + $output .= substr($string, $position); + + return $output; + } + + function parse_mime($mime) + { + if (($pos = strpos($mime, ';')) === false) + { + return trim($mime); + } + else + { + return trim(substr($mime, 0, $pos)); + } + } + + function htmlspecialchars_decode($string, $quote_style) + { + if (function_exists('htmlspecialchars_decode')) + { + return htmlspecialchars_decode($string, $quote_style); + } + else + { + return strtr($string, array_flip(get_html_translation_table(HTML_SPECIALCHARS, $quote_style))); + } + } + + function atom_03_construct_type($attribs) + { + if (isset($attribs['']['mode']) && strtolower(trim($attribs['']['mode']) === 'base64')) + { + $mode = SIMPLEPIE_CONSTRUCT_BASE64; + } + else + { + $mode = SIMPLEPIE_CONSTRUCT_NONE; + } + if (isset($attribs['']['type'])) + { + switch (strtolower(trim($attribs['']['type']))) + { + case 'text': + case 'text/plain': + return SIMPLEPIE_CONSTRUCT_TEXT | $mode; + + case 'html': + case 'text/html': + return SIMPLEPIE_CONSTRUCT_HTML | $mode; + + case 'xhtml': + case 'application/xhtml+xml': + return SIMPLEPIE_CONSTRUCT_XHTML | $mode; + + default: + return SIMPLEPIE_CONSTRUCT_NONE | $mode; + } + } + else + { + return SIMPLEPIE_CONSTRUCT_TEXT | $mode; + } + } + + function atom_10_construct_type($attribs) + { + if (isset($attribs['']['type'])) + { + switch (strtolower(trim($attribs['']['type']))) + { + case 'text': + return SIMPLEPIE_CONSTRUCT_TEXT; + + case 'html': + return SIMPLEPIE_CONSTRUCT_HTML; + + case 'xhtml': + return SIMPLEPIE_CONSTRUCT_XHTML; + + default: + return SIMPLEPIE_CONSTRUCT_NONE; + } + } + return SIMPLEPIE_CONSTRUCT_TEXT; + } + + function atom_10_content_construct_type($attribs) + { + if (isset($attribs['']['type'])) + { + $type = strtolower(trim($attribs['']['type'])); + switch ($type) + { + case 'text': + return SIMPLEPIE_CONSTRUCT_TEXT; + + case 'html': + return SIMPLEPIE_CONSTRUCT_HTML; + + case 'xhtml': + return SIMPLEPIE_CONSTRUCT_XHTML; + } + if (in_array(substr($type, -4), array('+xml', '/xml')) || substr($type, 0, 5) === 'text/') + { + return SIMPLEPIE_CONSTRUCT_NONE; + } + else + { + return SIMPLEPIE_CONSTRUCT_BASE64; + } + } + else + { + return SIMPLEPIE_CONSTRUCT_TEXT; + } + } + + function is_isegment_nz_nc($string) + { + return (bool) preg_match('/^([A-Za-z0-9\-._~\x{A0}-\x{D7FF}\x{F900}-\x{FDCF}\x{FDF0}-\x{FFEF}\x{10000}-\x{1FFFD}\x{20000}-\x{2FFFD}\x{30000}-\x{3FFFD}\x{40000}-\x{4FFFD}\x{50000}-\x{5FFFD}\x{60000}-\x{6FFFD}\x{70000}-\x{7FFFD}\x{80000}-\x{8FFFD}\x{90000}-\x{9FFFD}\x{A0000}-\x{AFFFD}\x{B0000}-\x{BFFFD}\x{C0000}-\x{CFFFD}\x{D0000}-\x{DFFFD}\x{E1000}-\x{EFFFD}!$&\'()*+,;=@]|(%[0-9ABCDEF]{2}))+$/u', $string); + } + + function space_seperated_tokens($string) + { + $space_characters = "\x20\x09\x0A\x0B\x0C\x0D"; + $string_length = strlen($string); + + $position = strspn($string, $space_characters); + $tokens = array(); + + while ($position < $string_length) + { + $len = strcspn($string, $space_characters, $position); + $tokens[] = substr($string, $position, $len); + $position += $len; + $position += strspn($string, $space_characters, $position); + } + + return $tokens; + } + + function array_unique($array) + { + if (version_compare(PHP_VERSION, '5.2', '>=')) + { + return array_unique($array); + } + else + { + $array = (array) $array; + $new_array = array(); + $new_array_strings = array(); + foreach ($array as $key => $value) + { + if (is_object($value)) + { + if (method_exists($value, '__toString')) + { + $cmp = $value->__toString(); + } + else + { + trigger_error('Object of class ' . get_class($value) . ' could not be converted to string', E_USER_ERROR); + } + } + elseif (is_array($value)) + { + $cmp = (string) reset($value); + } + else + { + $cmp = (string) $value; + } + if (!in_array($cmp, $new_array_strings)) + { + $new_array[$key] = $value; + $new_array_strings[] = $cmp; + } + } + return $new_array; + } + } + + /** + * Converts a unicode codepoint to a UTF-8 character + * + * @static + * @access public + * @param int $codepoint Unicode codepoint + * @return string UTF-8 character + */ + function codepoint_to_utf8($codepoint) + { + $codepoint = (int) $codepoint; + if ($codepoint < 0) + { + return false; + } + else if ($codepoint <= 0x7f) + { + return chr($codepoint); + } + else if ($codepoint <= 0x7ff) + { + return chr(0xc0 | ($codepoint >> 6)) . chr(0x80 | ($codepoint & 0x3f)); + } + else if ($codepoint <= 0xffff) + { + return chr(0xe0 | ($codepoint >> 12)) . chr(0x80 | (($codepoint >> 6) & 0x3f)) . chr(0x80 | ($codepoint & 0x3f)); + } + else if ($codepoint <= 0x10ffff) + { + return chr(0xf0 | ($codepoint >> 18)) . chr(0x80 | (($codepoint >> 12) & 0x3f)) . chr(0x80 | (($codepoint >> 6) & 0x3f)) . chr(0x80 | ($codepoint & 0x3f)); + } + else + { + // U+FFFD REPLACEMENT CHARACTER + return "\xEF\xBF\xBD"; + } + } + + /** + * Re-implementation of PHP 5's stripos() + * + * Returns the numeric position of the first occurrence of needle in the + * haystack string. + * + * @static + * @access string + * @param object $haystack + * @param string $needle Note that the needle may be a string of one or more + * characters. If needle is not a string, it is converted to an integer + * and applied as the ordinal value of a character. + * @param int $offset The optional offset parameter allows you to specify which + * character in haystack to start searching. The position returned is still + * relative to the beginning of haystack. + * @return bool If needle is not found, stripos() will return boolean false. + */ + function stripos($haystack, $needle, $offset = 0) + { + if (function_exists('stripos')) + { + return stripos($haystack, $needle, $offset); + } + else + { + if (is_string($needle)) + { + $needle = strtolower($needle); + } + elseif (is_int($needle) || is_bool($needle) || is_double($needle)) + { + $needle = strtolower(chr($needle)); + } + else + { + trigger_error('needle is not a string or an integer', E_USER_WARNING); + return false; + } + + return strpos(strtolower($haystack), $needle, $offset); + } + } + + /** + * Similar to parse_str() + * + * Returns an associative array of name/value pairs, where the value is an + * array of values that have used the same name + * + * @static + * @access string + * @param string $str The input string. + * @return array + */ + function parse_str($str) + { + $return = array(); + $str = explode('&', $str); + + foreach ($str as $section) + { + if (strpos($section, '=') !== false) + { + list($name, $value) = explode('=', $section, 2); + $return[urldecode($name)][] = urldecode($value); + } + else + { + $return[urldecode($section)][] = null; + } + } + + return $return; + } + + /** + * Detect XML encoding, as per XML 1.0 Appendix F.1 + * + * @todo Add support for EBCDIC + * @param string $data XML data + * @return array Possible encodings + */ + function xml_encoding($data) + { + // UTF-32 Big Endian BOM + if (substr($data, 0, 4) === "\x00\x00\xFE\xFF") + { + $encoding[] = 'UTF-32BE'; + } + // UTF-32 Little Endian BOM + elseif (substr($data, 0, 4) === "\xFF\xFE\x00\x00") + { + $encoding[] = 'UTF-32LE'; + } + // UTF-16 Big Endian BOM + elseif (substr($data, 0, 2) === "\xFE\xFF") + { + $encoding[] = 'UTF-16BE'; + } + // UTF-16 Little Endian BOM + elseif (substr($data, 0, 2) === "\xFF\xFE") + { + $encoding[] = 'UTF-16LE'; + } + // UTF-8 BOM + elseif (substr($data, 0, 3) === "\xEF\xBB\xBF") + { + $encoding[] = 'UTF-8'; + } + // UTF-32 Big Endian Without BOM + elseif (substr($data, 0, 20) === "\x00\x00\x00\x3C\x00\x00\x00\x3F\x00\x00\x00\x78\x00\x00\x00\x6D\x00\x00\x00\x6C") + { + if ($pos = strpos($data, "\x00\x00\x00\x3F\x00\x00\x00\x3E")) + { + $parser =& new SimplePie_XML_Declaration_Parser(SimplePie_Misc::change_encoding(substr($data, 20, $pos - 20), 'UTF-32BE', 'UTF-8')); + if ($parser->parse()) + { + $encoding[] = $parser->encoding; + } + } + $encoding[] = 'UTF-32BE'; + } + // UTF-32 Little Endian Without BOM + elseif (substr($data, 0, 20) === "\x3C\x00\x00\x00\x3F\x00\x00\x00\x78\x00\x00\x00\x6D\x00\x00\x00\x6C\x00\x00\x00") + { + if ($pos = strpos($data, "\x3F\x00\x00\x00\x3E\x00\x00\x00")) + { + $parser =& new SimplePie_XML_Declaration_Parser(SimplePie_Misc::change_encoding(substr($data, 20, $pos - 20), 'UTF-32LE', 'UTF-8')); + if ($parser->parse()) + { + $encoding[] = $parser->encoding; + } + } + $encoding[] = 'UTF-32LE'; + } + // UTF-16 Big Endian Without BOM + elseif (substr($data, 0, 10) === "\x00\x3C\x00\x3F\x00\x78\x00\x6D\x00\x6C") + { + if ($pos = strpos($data, "\x00\x3F\x00\x3E")) + { + $parser =& new SimplePie_XML_Declaration_Parser(SimplePie_Misc::change_encoding(substr($data, 20, $pos - 10), 'UTF-16BE', 'UTF-8')); + if ($parser->parse()) + { + $encoding[] = $parser->encoding; + } + } + $encoding[] = 'UTF-16BE'; + } + // UTF-16 Little Endian Without BOM + elseif (substr($data, 0, 10) === "\x3C\x00\x3F\x00\x78\x00\x6D\x00\x6C\x00") + { + if ($pos = strpos($data, "\x3F\x00\x3E\x00")) + { + $parser =& new SimplePie_XML_Declaration_Parser(SimplePie_Misc::change_encoding(substr($data, 20, $pos - 10), 'UTF-16LE', 'UTF-8')); + if ($parser->parse()) + { + $encoding[] = $parser->encoding; + } + } + $encoding[] = 'UTF-16LE'; + } + // US-ASCII (or superset) + elseif (substr($data, 0, 5) === "\x3C\x3F\x78\x6D\x6C") + { + if ($pos = strpos($data, "\x3F\x3E")) + { + $parser =& new SimplePie_XML_Declaration_Parser(substr($data, 5, $pos - 5)); + if ($parser->parse()) + { + $encoding[] = $parser->encoding; + } + } + $encoding[] = 'UTF-8'; + } + // Fallback to UTF-8 + else + { + $encoding[] = 'UTF-8'; + } + return $encoding; + } + + function output_javascript() + { + if (function_exists('ob_gzhandler')) + { + ob_start('ob_gzhandler'); + } + header('Content-type: text/javascript; charset: UTF-8'); + header('Cache-Control: must-revalidate'); + header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 604800) . ' GMT'); // 7 days + ?> +function embed_odeo(link) { + document.writeln(''); +} + +function embed_quicktime(type, bgcolor, width, height, link, placeholder, loop) { + if (placeholder != '') { + document.writeln(''); + } + else { + document.writeln(''); + } +} + +function embed_flash(bgcolor, width, height, link, loop, type) { + document.writeln(''); +} + +function embed_flv(width, height, link, placeholder, loop, player) { + document.writeln(''); +} + +function embed_wmedia(width, height, link) { + document.writeln(''); +} + data = $data; + } + + /** + * Parse the input data + * + * @access public + * @return string Output data + */ + function parse() + { + while (($this->position = strpos($this->data, '&', $this->position)) !== false) + { + $this->consume(); + $this->entity(); + $this->consumed = ''; + } + return $this->data; + } + + /** + * Consume the next byte + * + * @access private + * @return mixed The next byte, or false, if there is no more data + */ + function consume() + { + if (isset($this->data[$this->position])) + { + $this->consumed .= $this->data[$this->position]; + return $this->data[$this->position++]; + } + else + { + return false; + } + } + + /** + * Consume a range of characters + * + * @access private + * @param string $chars Characters to consume + * @return mixed A series of characters that match the range, or false + */ + function consume_range($chars) + { + if ($len = strspn($this->data, $chars, $this->position)) + { + $data = substr($this->data, $this->position, $len); + $this->consumed .= $data; + $this->position += $len; + return $data; + } + else + { + return false; + } + } + + /** + * Unconsume one byte + * + * @access private + */ + function unconsume() + { + $this->consumed = substr($this->consumed, 0, -1); + $this->position--; + } + + /** + * Decode an entity + * + * @access private + */ + function entity() + { + switch ($this->consume()) + { + case "\x09": + case "\x0A": + case "\x0B": + case "\x0B": + case "\x0C": + case "\x20": + case "\x3C": + case "\x26": + case false: + break; + + case "\x23": + switch ($this->consume()) + { + case "\x78": + case "\x58": + $range = '0123456789ABCDEFabcdef'; + $hex = true; + break; + + default: + $range = '0123456789'; + $hex = false; + $this->unconsume(); + break; + } + + if ($codepoint = $this->consume_range($range)) + { + static $windows_1252_specials = array(0x0D => "\x0A", 0x80 => "\xE2\x82\xAC", 0x81 => "\xEF\xBF\xBD", 0x82 => "\xE2\x80\x9A", 0x83 => "\xC6\x92", 0x84 => "\xE2\x80\x9E", 0x85 => "\xE2\x80\xA6", 0x86 => "\xE2\x80\xA0", 0x87 => "\xE2\x80\xA1", 0x88 => "\xCB\x86", 0x89 => "\xE2\x80\xB0", 0x8A => "\xC5\xA0", 0x8B => "\xE2\x80\xB9", 0x8C => "\xC5\x92", 0x8D => "\xEF\xBF\xBD", 0x8E => "\xC5\xBD", 0x8F => "\xEF\xBF\xBD", 0x90 => "\xEF\xBF\xBD", 0x91 => "\xE2\x80\x98", 0x92 => "\xE2\x80\x99", 0x93 => "\xE2\x80\x9C", 0x94 => "\xE2\x80\x9D", 0x95 => "\xE2\x80\xA2", 0x96 => "\xE2\x80\x93", 0x97 => "\xE2\x80\x94", 0x98 => "\xCB\x9C", 0x99 => "\xE2\x84\xA2", 0x9A => "\xC5\xA1", 0x9B => "\xE2\x80\xBA", 0x9C => "\xC5\x93", 0x9D => "\xEF\xBF\xBD", 0x9E => "\xC5\xBE", 0x9F => "\xC5\xB8"); + + if ($hex) + { + $codepoint = hexdec($codepoint); + } + else + { + $codepoint = intval($codepoint); + } + + if (isset($windows_1252_specials[$codepoint])) + { + $replacement = $windows_1252_specials[$codepoint]; + } + else + { + $replacement = SimplePie_Misc::codepoint_to_utf8($codepoint); + } + + if (!in_array($this->consume(), array(';', false), true)) + { + $this->unconsume(); + } + + $consumed_length = strlen($this->consumed); + $this->data = substr_replace($this->data, $replacement, $this->position - $consumed_length, $consumed_length); + $this->position += strlen($replacement) - $consumed_length; + } + break; + + default: + static $entities = array('Aacute' => "\xC3\x81", 'aacute' => "\xC3\xA1", 'Aacute;' => "\xC3\x81", 'aacute;' => "\xC3\xA1", 'Acirc' => "\xC3\x82", 'acirc' => "\xC3\xA2", 'Acirc;' => "\xC3\x82", 'acirc;' => "\xC3\xA2", 'acute' => "\xC2\xB4", 'acute;' => "\xC2\xB4", 'AElig' => "\xC3\x86", 'aelig' => "\xC3\xA6", 'AElig;' => "\xC3\x86", 'aelig;' => "\xC3\xA6", 'Agrave' => "\xC3\x80", 'agrave' => "\xC3\xA0", 'Agrave;' => "\xC3\x80", 'agrave;' => "\xC3\xA0", 'alefsym;' => "\xE2\x84\xB5", 'Alpha;' => "\xCE\x91", 'alpha;' => "\xCE\xB1", 'AMP' => "\x26", 'amp' => "\x26", 'AMP;' => "\x26", 'amp;' => "\x26", 'and;' => "\xE2\x88\xA7", 'ang;' => "\xE2\x88\xA0", 'apos;' => "\x27", 'Aring' => "\xC3\x85", 'aring' => "\xC3\xA5", 'Aring;' => "\xC3\x85", 'aring;' => "\xC3\xA5", 'asymp;' => "\xE2\x89\x88", 'Atilde' => "\xC3\x83", 'atilde' => "\xC3\xA3", 'Atilde;' => "\xC3\x83", 'atilde;' => "\xC3\xA3", 'Auml' => "\xC3\x84", 'auml' => "\xC3\xA4", 'Auml;' => "\xC3\x84", 'auml;' => "\xC3\xA4", 'bdquo;' => "\xE2\x80\x9E", 'Beta;' => "\xCE\x92", 'beta;' => "\xCE\xB2", 'brvbar' => "\xC2\xA6", 'brvbar;' => "\xC2\xA6", 'bull;' => "\xE2\x80\xA2", 'cap;' => "\xE2\x88\xA9", 'Ccedil' => "\xC3\x87", 'ccedil' => "\xC3\xA7", 'Ccedil;' => "\xC3\x87", 'ccedil;' => "\xC3\xA7", 'cedil' => "\xC2\xB8", 'cedil;' => "\xC2\xB8", 'cent' => "\xC2\xA2", 'cent;' => "\xC2\xA2", 'Chi;' => "\xCE\xA7", 'chi;' => "\xCF\x87", 'circ;' => "\xCB\x86", 'clubs;' => "\xE2\x99\xA3", 'cong;' => "\xE2\x89\x85", 'COPY' => "\xC2\xA9", 'copy' => "\xC2\xA9", 'COPY;' => "\xC2\xA9", 'copy;' => "\xC2\xA9", 'crarr;' => "\xE2\x86\xB5", 'cup;' => "\xE2\x88\xAA", 'curren' => "\xC2\xA4", 'curren;' => "\xC2\xA4", 'Dagger;' => "\xE2\x80\xA1", 'dagger;' => "\xE2\x80\xA0", 'dArr;' => "\xE2\x87\x93", 'darr;' => "\xE2\x86\x93", 'deg' => "\xC2\xB0", 'deg;' => "\xC2\xB0", 'Delta;' => "\xCE\x94", 'delta;' => "\xCE\xB4", 'diams;' => "\xE2\x99\xA6", 'divide' => "\xC3\xB7", 'divide;' => "\xC3\xB7", 'Eacute' => "\xC3\x89", 'eacute' => "\xC3\xA9", 'Eacute;' => "\xC3\x89", 'eacute;' => "\xC3\xA9", 'Ecirc' => "\xC3\x8A", 'ecirc' => "\xC3\xAA", 'Ecirc;' => "\xC3\x8A", 'ecirc;' => "\xC3\xAA", 'Egrave' => "\xC3\x88", 'egrave' => "\xC3\xA8", 'Egrave;' => "\xC3\x88", 'egrave;' => "\xC3\xA8", 'empty;' => "\xE2\x88\x85", 'emsp;' => "\xE2\x80\x83", 'ensp;' => "\xE2\x80\x82", 'Epsilon;' => "\xCE\x95", 'epsilon;' => "\xCE\xB5", 'equiv;' => "\xE2\x89\xA1", 'Eta;' => "\xCE\x97", 'eta;' => "\xCE\xB7", 'ETH' => "\xC3\x90", 'eth' => "\xC3\xB0", 'ETH;' => "\xC3\x90", 'eth;' => "\xC3\xB0", 'Euml' => "\xC3\x8B", 'euml' => "\xC3\xAB", 'Euml;' => "\xC3\x8B", 'euml;' => "\xC3\xAB", 'euro;' => "\xE2\x82\xAC", 'exist;' => "\xE2\x88\x83", 'fnof;' => "\xC6\x92", 'forall;' => "\xE2\x88\x80", 'frac12' => "\xC2\xBD", 'frac12;' => "\xC2\xBD", 'frac14' => "\xC2\xBC", 'frac14;' => "\xC2\xBC", 'frac34' => "\xC2\xBE", 'frac34;' => "\xC2\xBE", 'frasl;' => "\xE2\x81\x84", 'Gamma;' => "\xCE\x93", 'gamma;' => "\xCE\xB3", 'ge;' => "\xE2\x89\xA5", 'GT' => "\x3E", 'gt' => "\x3E", 'GT;' => "\x3E", 'gt;' => "\x3E", 'hArr;' => "\xE2\x87\x94", 'harr;' => "\xE2\x86\x94", 'hearts;' => "\xE2\x99\xA5", 'hellip;' => "\xE2\x80\xA6", 'Iacute' => "\xC3\x8D", 'iacute' => "\xC3\xAD", 'Iacute;' => "\xC3\x8D", 'iacute;' => "\xC3\xAD", 'Icirc' => "\xC3\x8E", 'icirc' => "\xC3\xAE", 'Icirc;' => "\xC3\x8E", 'icirc;' => "\xC3\xAE", 'iexcl' => "\xC2\xA1", 'iexcl;' => "\xC2\xA1", 'Igrave' => "\xC3\x8C", 'igrave' => "\xC3\xAC", 'Igrave;' => "\xC3\x8C", 'igrave;' => "\xC3\xAC", 'image;' => "\xE2\x84\x91", 'infin;' => "\xE2\x88\x9E", 'int;' => "\xE2\x88\xAB", 'Iota;' => "\xCE\x99", 'iota;' => "\xCE\xB9", 'iquest' => "\xC2\xBF", 'iquest;' => "\xC2\xBF", 'isin;' => "\xE2\x88\x88", 'Iuml' => "\xC3\x8F", 'iuml' => "\xC3\xAF", 'Iuml;' => "\xC3\x8F", 'iuml;' => "\xC3\xAF", 'Kappa;' => "\xCE\x9A", 'kappa;' => "\xCE\xBA", 'Lambda;' => "\xCE\x9B", 'lambda;' => "\xCE\xBB", 'lang;' => "\xE3\x80\x88", 'laquo' => "\xC2\xAB", 'laquo;' => "\xC2\xAB", 'lArr;' => "\xE2\x87\x90", 'larr;' => "\xE2\x86\x90", 'lceil;' => "\xE2\x8C\x88", 'ldquo;' => "\xE2\x80\x9C", 'le;' => "\xE2\x89\xA4", 'lfloor;' => "\xE2\x8C\x8A", 'lowast;' => "\xE2\x88\x97", 'loz;' => "\xE2\x97\x8A", 'lrm;' => "\xE2\x80\x8E", 'lsaquo;' => "\xE2\x80\xB9", 'lsquo;' => "\xE2\x80\x98", 'LT' => "\x3C", 'lt' => "\x3C", 'LT;' => "\x3C", 'lt;' => "\x3C", 'macr' => "\xC2\xAF", 'macr;' => "\xC2\xAF", 'mdash;' => "\xE2\x80\x94", 'micro' => "\xC2\xB5", 'micro;' => "\xC2\xB5", 'middot' => "\xC2\xB7", 'middot;' => "\xC2\xB7", 'minus;' => "\xE2\x88\x92", 'Mu;' => "\xCE\x9C", 'mu;' => "\xCE\xBC", 'nabla;' => "\xE2\x88\x87", 'nbsp' => "\xC2\xA0", 'nbsp;' => "\xC2\xA0", 'ndash;' => "\xE2\x80\x93", 'ne;' => "\xE2\x89\xA0", 'ni;' => "\xE2\x88\x8B", 'not' => "\xC2\xAC", 'not;' => "\xC2\xAC", 'notin;' => "\xE2\x88\x89", 'nsub;' => "\xE2\x8A\x84", 'Ntilde' => "\xC3\x91", 'ntilde' => "\xC3\xB1", 'Ntilde;' => "\xC3\x91", 'ntilde;' => "\xC3\xB1", 'Nu;' => "\xCE\x9D", 'nu;' => "\xCE\xBD", 'Oacute' => "\xC3\x93", 'oacute' => "\xC3\xB3", 'Oacute;' => "\xC3\x93", 'oacute;' => "\xC3\xB3", 'Ocirc' => "\xC3\x94", 'ocirc' => "\xC3\xB4", 'Ocirc;' => "\xC3\x94", 'ocirc;' => "\xC3\xB4", 'OElig;' => "\xC5\x92", 'oelig;' => "\xC5\x93", 'Ograve' => "\xC3\x92", 'ograve' => "\xC3\xB2", 'Ograve;' => "\xC3\x92", 'ograve;' => "\xC3\xB2", 'oline;' => "\xE2\x80\xBE", 'Omega;' => "\xCE\xA9", 'omega;' => "\xCF\x89", 'Omicron;' => "\xCE\x9F", 'omicron;' => "\xCE\xBF", 'oplus;' => "\xE2\x8A\x95", 'or;' => "\xE2\x88\xA8", 'ordf' => "\xC2\xAA", 'ordf;' => "\xC2\xAA", 'ordm' => "\xC2\xBA", 'ordm;' => "\xC2\xBA", 'Oslash' => "\xC3\x98", 'oslash' => "\xC3\xB8", 'Oslash;' => "\xC3\x98", 'oslash;' => "\xC3\xB8", 'Otilde' => "\xC3\x95", 'otilde' => "\xC3\xB5", 'Otilde;' => "\xC3\x95", 'otilde;' => "\xC3\xB5", 'otimes;' => "\xE2\x8A\x97", 'Ouml' => "\xC3\x96", 'ouml' => "\xC3\xB6", 'Ouml;' => "\xC3\x96", 'ouml;' => "\xC3\xB6", 'para' => "\xC2\xB6", 'para;' => "\xC2\xB6", 'part;' => "\xE2\x88\x82", 'permil;' => "\xE2\x80\xB0", 'perp;' => "\xE2\x8A\xA5", 'Phi;' => "\xCE\xA6", 'phi;' => "\xCF\x86", 'Pi;' => "\xCE\xA0", 'pi;' => "\xCF\x80", 'piv;' => "\xCF\x96", 'plusmn' => "\xC2\xB1", 'plusmn;' => "\xC2\xB1", 'pound' => "\xC2\xA3", 'pound;' => "\xC2\xA3", 'Prime;' => "\xE2\x80\xB3", 'prime;' => "\xE2\x80\xB2", 'prod;' => "\xE2\x88\x8F", 'prop;' => "\xE2\x88\x9D", 'Psi;' => "\xCE\xA8", 'psi;' => "\xCF\x88", 'QUOT' => "\x22", 'quot' => "\x22", 'QUOT;' => "\x22", 'quot;' => "\x22", 'radic;' => "\xE2\x88\x9A", 'rang;' => "\xE3\x80\x89", 'raquo' => "\xC2\xBB", 'raquo;' => "\xC2\xBB", 'rArr;' => "\xE2\x87\x92", 'rarr;' => "\xE2\x86\x92", 'rceil;' => "\xE2\x8C\x89", 'rdquo;' => "\xE2\x80\x9D", 'real;' => "\xE2\x84\x9C", 'REG' => "\xC2\xAE", 'reg' => "\xC2\xAE", 'REG;' => "\xC2\xAE", 'reg;' => "\xC2\xAE", 'rfloor;' => "\xE2\x8C\x8B", 'Rho;' => "\xCE\xA1", 'rho;' => "\xCF\x81", 'rlm;' => "\xE2\x80\x8F", 'rsaquo;' => "\xE2\x80\xBA", 'rsquo;' => "\xE2\x80\x99", 'sbquo;' => "\xE2\x80\x9A", 'Scaron;' => "\xC5\xA0", 'scaron;' => "\xC5\xA1", 'sdot;' => "\xE2\x8B\x85", 'sect' => "\xC2\xA7", 'sect;' => "\xC2\xA7", 'shy' => "\xC2\xAD", 'shy;' => "\xC2\xAD", 'Sigma;' => "\xCE\xA3", 'sigma;' => "\xCF\x83", 'sigmaf;' => "\xCF\x82", 'sim;' => "\xE2\x88\xBC", 'spades;' => "\xE2\x99\xA0", 'sub;' => "\xE2\x8A\x82", 'sube;' => "\xE2\x8A\x86", 'sum;' => "\xE2\x88\x91", 'sup;' => "\xE2\x8A\x83", 'sup1' => "\xC2\xB9", 'sup1;' => "\xC2\xB9", 'sup2' => "\xC2\xB2", 'sup2;' => "\xC2\xB2", 'sup3' => "\xC2\xB3", 'sup3;' => "\xC2\xB3", 'supe;' => "\xE2\x8A\x87", 'szlig' => "\xC3\x9F", 'szlig;' => "\xC3\x9F", 'Tau;' => "\xCE\xA4", 'tau;' => "\xCF\x84", 'there4;' => "\xE2\x88\xB4", 'Theta;' => "\xCE\x98", 'theta;' => "\xCE\xB8", 'thetasym;' => "\xCF\x91", 'thinsp;' => "\xE2\x80\x89", 'THORN' => "\xC3\x9E", 'thorn' => "\xC3\xBE", 'THORN;' => "\xC3\x9E", 'thorn;' => "\xC3\xBE", 'tilde;' => "\xCB\x9C", 'times' => "\xC3\x97", 'times;' => "\xC3\x97", 'TRADE;' => "\xE2\x84\xA2", 'trade;' => "\xE2\x84\xA2", 'Uacute' => "\xC3\x9A", 'uacute' => "\xC3\xBA", 'Uacute;' => "\xC3\x9A", 'uacute;' => "\xC3\xBA", 'uArr;' => "\xE2\x87\x91", 'uarr;' => "\xE2\x86\x91", 'Ucirc' => "\xC3\x9B", 'ucirc' => "\xC3\xBB", 'Ucirc;' => "\xC3\x9B", 'ucirc;' => "\xC3\xBB", 'Ugrave' => "\xC3\x99", 'ugrave' => "\xC3\xB9", 'Ugrave;' => "\xC3\x99", 'ugrave;' => "\xC3\xB9", 'uml' => "\xC2\xA8", 'uml;' => "\xC2\xA8", 'upsih;' => "\xCF\x92", 'Upsilon;' => "\xCE\xA5", 'upsilon;' => "\xCF\x85", 'Uuml' => "\xC3\x9C", 'uuml' => "\xC3\xBC", 'Uuml;' => "\xC3\x9C", 'uuml;' => "\xC3\xBC", 'weierp;' => "\xE2\x84\x98", 'Xi;' => "\xCE\x9E", 'xi;' => "\xCE\xBE", 'Yacute' => "\xC3\x9D", 'yacute' => "\xC3\xBD", 'Yacute;' => "\xC3\x9D", 'yacute;' => "\xC3\xBD", 'yen' => "\xC2\xA5", 'yen;' => "\xC2\xA5", 'yuml' => "\xC3\xBF", 'Yuml;' => "\xC5\xB8", 'yuml;' => "\xC3\xBF", 'Zeta;' => "\xCE\x96", 'zeta;' => "\xCE\xB6", 'zwj;' => "\xE2\x80\x8D", 'zwnj;' => "\xE2\x80\x8C"); + + for ($i = 0, $match = null; $i < 9 && $this->consume() !== false; $i++) + { + $consumed = substr($this->consumed, 1); + if (isset($entities[$consumed])) + { + $match = $consumed; + } + } + + if ($match !== null) + { + $this->data = substr_replace($this->data, $entities[$match], $this->position - strlen($consumed) - 1, strlen($match) + 1); + $this->position += strlen($entities[$match]) - strlen($consumed) - 1; + } + break; + } + } +} + +/** + * IRI parser/serialiser + * + * @package SimplePie + */ +class SimplePie_IRI +{ + /** + * Scheme + * + * @access private + * @var string + */ + var $scheme; + + /** + * User Information + * + * @access private + * @var string + */ + var $userinfo; + + /** + * Host + * + * @access private + * @var string + */ + var $host; + + /** + * Port + * + * @access private + * @var string + */ + var $port; + + /** + * Path + * + * @access private + * @var string + */ + var $path; + + /** + * Query + * + * @access private + * @var string + */ + var $query; + + /** + * Fragment + * + * @access private + * @var string + */ + var $fragment; + + /** + * Whether the object represents a valid IRI + * + * @access private + * @var array + */ + var $valid = array(); + + /** + * Return the entire IRI when you try and read the object as a string + * + * @access public + * @return string + */ + function __toString() + { + return $this->get_iri(); + } + + /** + * Create a new IRI object, from a specified string + * + * @access public + * @param string $iri + * @return SimplePie_IRI + */ + function SimplePie_IRI($iri) + { + $iri = (string) $iri; + if ($iri !== '') + { + $parsed = $this->parse_iri($iri); + $this->set_scheme($parsed['scheme']); + $this->set_authority($parsed['authority']); + $this->set_path($parsed['path']); + $this->set_query($parsed['query']); + $this->set_fragment($parsed['fragment']); + } + } + + /** + * Create a new IRI object by resolving a relative IRI + * + * @static + * @access public + * @param SimplePie_IRI $base Base IRI + * @param string $relative Relative IRI + * @return SimplePie_IRI + */ + function absolutize($base, $relative) + { + $relative = (string) $relative; + if ($relative !== '') + { + $relative =& new SimplePie_IRI($relative); + if ($relative->get_scheme() !== null) + { + $target = $relative; + } + elseif ($base->get_iri() !== null) + { + if ($relative->get_authority() !== null) + { + $target = $relative; + $target->set_scheme($base->get_scheme()); + } + else + { + $target =& new SimplePie_IRI(''); + $target->set_scheme($base->get_scheme()); + $target->set_userinfo($base->get_userinfo()); + $target->set_host($base->get_host()); + $target->set_port($base->get_port()); + if ($relative->get_path() !== null) + { + if (strpos($relative->get_path(), '/') === 0) + { + $target->set_path($relative->get_path()); + } + elseif (($base->get_userinfo() !== null || $base->get_host() !== null || $base->get_port() !== null) && $base->get_path() === null) + { + $target->set_path('/' . $relative->get_path()); + } + elseif (($last_segment = strrpos($base->get_path(), '/')) !== false) + { + $target->set_path(substr($base->get_path(), 0, $last_segment + 1) . $relative->get_path()); + } + else + { + $target->set_path($relative->get_path()); + } + $target->set_query($relative->get_query()); + } + else + { + $target->set_path($base->get_path()); + if ($relative->get_query() !== null) + { + $target->set_query($relative->get_query()); + } + elseif ($base->get_query() !== null) + { + $target->set_query($base->get_query()); + } + } + } + $target->set_fragment($relative->get_fragment()); + } + else + { + // No base URL, just return the relative URL + $target = $relative; + } + } + else + { + $target = $base; + } + return $target; + } + + /** + * Parse an IRI into scheme/authority/path/query/fragment segments + * + * @access private + * @param string $iri + * @return array + */ + function parse_iri($iri) + { + preg_match('/^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/', $iri, $match); + for ($i = count($match); $i <= 9; $i++) + { + $match[$i] = ''; + } + return array('scheme' => $match[2], 'authority' => $match[4], 'path' => $match[5], 'query' => $match[7], 'fragment' => $match[9]); + } + + /** + * Remove dot segments from a path + * + * @access private + * @param string $input + * @return string + */ + function remove_dot_segments($input) + { + $output = ''; + while (strpos($input, './') !== false || strpos($input, '/.') !== false || $input === '.' || $input === '..') + { + // A: If the input buffer begins with a prefix of "../" or "./", then remove that prefix from the input buffer; otherwise, + if (strpos($input, '../') === 0) + { + $input = substr($input, 3); + } + elseif (strpos($input, './') === 0) + { + $input = substr($input, 2); + } + // B: if the input buffer begins with a prefix of "/./" or "/.", where "." is a complete path segment, then replace that prefix with "/" in the input buffer; otherwise, + elseif (strpos($input, '/./') === 0) + { + $input = substr_replace($input, '/', 0, 3); + } + elseif ($input === '/.') + { + $input = '/'; + } + // C: if the input buffer begins with a prefix of "/../" or "/..", where ".." is a complete path segment, then replace that prefix with "/" in the input buffer and remove the last segment and its preceding "/" (if any) from the output buffer; otherwise, + elseif (strpos($input, '/../') === 0) + { + $input = substr_replace($input, '/', 0, 4); + $output = substr_replace($output, '', strrpos($output, '/')); + } + elseif ($input === '/..') + { + $input = '/'; + $output = substr_replace($output, '', strrpos($output, '/')); + } + // D: if the input buffer consists only of "." or "..", then remove that from the input buffer; otherwise, + elseif ($input === '.' || $input === '..') + { + $input = ''; + } + // E: move the first path segment in the input buffer to the end of the output buffer, including the initial "/" character (if any) and any subsequent characters up to, but not including, the next "/" character or the end of the input buffer + elseif (($pos = strpos($input, '/', 1)) !== false) + { + $output .= substr($input, 0, $pos); + $input = substr_replace($input, '', 0, $pos); + } + else + { + $output .= $input; + $input = ''; + } + } + return $output . $input; + } + + /** + * Replace invalid character with percent encoding + * + * @access private + * @param string $string Input string + * @param string $valid_chars Valid characters + * @param int $case Normalise case + * @return string + */ + function replace_invalid_with_pct_encoding($string, $valid_chars, $case = SIMPLEPIE_SAME_CASE) + { + // Normalise case + if ($case & SIMPLEPIE_LOWERCASE) + { + $string = strtolower($string); + } + elseif ($case & SIMPLEPIE_UPPERCASE) + { + $string = strtoupper($string); + } + + // Store position and string length (to avoid constantly recalculating this) + $position = 0; + $strlen = strlen($string); + + // Loop as long as we have invalid characters, advancing the position to the next invalid character + while (($position += strspn($string, $valid_chars, $position)) < $strlen) + { + // If we have a % character + if ($string[$position] === '%') + { + // If we have a pct-encoded section + if ($position + 2 < $strlen && strspn($string, '0123456789ABCDEFabcdef', $position + 1, 2) === 2) + { + // Get the the represented character + $chr = chr(hexdec(substr($string, $position + 1, 2))); + + // If the character is valid, replace the pct-encoded with the actual character while normalising case + if (strpos($valid_chars, $chr) !== false) + { + if ($case & SIMPLEPIE_LOWERCASE) + { + $chr = strtolower($chr); + } + elseif ($case & SIMPLEPIE_UPPERCASE) + { + $chr = strtoupper($chr); + } + $string = substr_replace($string, $chr, $position, 3); + $strlen -= 2; + $position++; + } + + // Otherwise just normalise the pct-encoded to uppercase + else + { + $string = substr_replace($string, strtoupper(substr($string, $position + 1, 2)), $position + 1, 2); + $position += 3; + } + } + // If we don't have a pct-encoded section, just replace the % with its own esccaped form + else + { + $string = substr_replace($string, '%25', $position, 1); + $strlen += 2; + $position += 3; + } + } + // If we have an invalid character, change into its pct-encoded form + else + { + $replacement = sprintf("%%%02X", ord($string[$position])); + $string = str_replace($string[$position], $replacement, $string); + $strlen = strlen($string); + } + } + return $string; + } + + /** + * Check if the object represents a valid IRI + * + * @access public + * @return bool + */ + function is_valid() + { + return array_sum($this->valid) === count($this->valid); + } + + /** + * Set the scheme. Returns true on success, false on failure (if there are + * any invalid characters). + * + * @access public + * @param string $scheme + * @return bool + */ + function set_scheme($scheme) + { + if ($scheme === null || $scheme === '') + { + $this->scheme = null; + } + else + { + $len = strlen($scheme); + switch (true) + { + case $len > 1: + if (!strspn($scheme, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-.', 1)) + { + $this->scheme = null; + $this->valid[__FUNCTION__] = false; + return false; + } + + case $len > 0: + if (!strspn($scheme, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz', 0, 1)) + { + $this->scheme = null; + $this->valid[__FUNCTION__] = false; + return false; + } + } + $this->scheme = strtolower($scheme); + } + $this->valid[__FUNCTION__] = true; + return true; + } + + /** + * Set the authority. Returns true on success, false on failure (if there are + * any invalid characters). + * + * @access public + * @param string $authority + * @return bool + */ + function set_authority($authority) + { + if (($userinfo_end = strrpos($authority, '@')) !== false) + { + $userinfo = substr($authority, 0, $userinfo_end); + $authority = substr($authority, $userinfo_end + 1); + } + else + { + $userinfo = null; + } + + if (($port_start = strpos($authority, ':')) !== false) + { + $port = substr($authority, $port_start + 1); + $authority = substr($authority, 0, $port_start); + } + else + { + $port = null; + } + + return $this->set_userinfo($userinfo) && $this->set_host($authority) && $this->set_port($port); + } + + /** + * Set the userinfo. + * + * @access public + * @param string $userinfo + * @return bool + */ + function set_userinfo($userinfo) + { + if ($userinfo === null || $userinfo === '') + { + $this->userinfo = null; + } + else + { + $this->userinfo = $this->replace_invalid_with_pct_encoding($userinfo, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~!$&\'()*+,;=:'); + } + $this->valid[__FUNCTION__] = true; + return true; + } + + /** + * Set the host. Returns true on success, false on failure (if there are + * any invalid characters). + * + * @access public + * @param string $host + * @return bool + */ + function set_host($host) + { + if ($host === null || $host === '') + { + $this->host = null; + $this->valid[__FUNCTION__] = true; + return true; + } + elseif ($host[0] === '[' && substr($host, -1) === ']') + { + if (Net_IPv6::checkIPv6(substr($host, 1, -1))) + { + $this->host = $host; + $this->valid[__FUNCTION__] = true; + return true; + } + else + { + $this->host = null; + $this->valid[__FUNCTION__] = false; + return false; + } + } + else + { + $this->host = $this->replace_invalid_with_pct_encoding($host, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~!$&\'()*+,;=', SIMPLEPIE_LOWERCASE); + $this->valid[__FUNCTION__] = true; + return true; + } + } + + /** + * Set the port. Returns true on success, false on failure (if there are + * any invalid characters). + * + * @access public + * @param string $port + * @return bool + */ + function set_port($port) + { + if ($port === null || $port === '') + { + $this->port = null; + $this->valid[__FUNCTION__] = true; + return true; + } + elseif (strspn($port, '0123456789') === strlen($port)) + { + $this->port = (int) $port; + $this->valid[__FUNCTION__] = true; + return true; + } + else + { + $this->port = null; + $this->valid[__FUNCTION__] = false; + return false; + } + } + + /** + * Set the path. + * + * @access public + * @param string $path + * @return bool + */ + function set_path($path) + { + if ($path === null || $path === '') + { + $this->path = null; + $this->valid[__FUNCTION__] = true; + return true; + } + elseif (substr($path, 0, 2) === '//' && $this->userinfo === null && $this->host === null && $this->port === null) + { + $this->path = null; + $this->valid[__FUNCTION__] = false; + return false; + } + else + { + $this->path = $this->replace_invalid_with_pct_encoding($path, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~!$&\'()*+,;=@/'); + if ($this->scheme !== null) + { + $this->path = $this->remove_dot_segments($this->path); + } + $this->valid[__FUNCTION__] = true; + return true; + } + } + + /** + * Set the query. + * + * @access public + * @param string $query + * @return bool + */ + function set_query($query) + { + if ($query === null || $query === '') + { + $this->query = null; + } + else + { + $this->query = $this->replace_invalid_with_pct_encoding($query, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~!$&\'()*+,;=:@/?'); + } + $this->valid[__FUNCTION__] = true; + return true; + } + + /** + * Set the fragment. + * + * @access public + * @param string $fragment + * @return bool + */ + function set_fragment($fragment) + { + if ($fragment === null || $fragment === '') + { + $this->fragment = null; + } + else + { + $this->fragment = $this->replace_invalid_with_pct_encoding($fragment, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~!$&\'()*+,;=:@/?'); + } + $this->valid[__FUNCTION__] = true; + return true; + } + + /** + * Get the complete IRI + * + * @access public + * @return string + */ + function get_iri() + { + $iri = ''; + if ($this->scheme !== null) + { + $iri .= $this->scheme . ':'; + } + if (($authority = $this->get_authority()) !== null) + { + $iri .= '//' . $authority; + } + if ($this->path !== null) + { + $iri .= $this->path; + } + if ($this->query !== null) + { + $iri .= '?' . $this->query; + } + if ($this->fragment !== null) + { + $iri .= '#' . $this->fragment; + } + + if ($iri !== '') + { + return $iri; + } + else + { + return null; + } + } + + /** + * Get the scheme + * + * @access public + * @return string + */ + function get_scheme() + { + return $this->scheme; + } + + /** + * Get the complete authority + * + * @access public + * @return string + */ + function get_authority() + { + $authority = ''; + if ($this->userinfo !== null) + { + $authority .= $this->userinfo . '@'; + } + if ($this->host !== null) + { + $authority .= $this->host; + } + if ($this->port !== null) + { + $authority .= ':' . $this->port; + } + + if ($authority !== '') + { + return $authority; + } + else + { + return null; + } + } + + /** + * Get the user information + * + * @access public + * @return string + */ + function get_userinfo() + { + return $this->userinfo; + } + + /** + * Get the host + * + * @access public + * @return string + */ + function get_host() + { + return $this->host; + } + + /** + * Get the port + * + * @access public + * @return string + */ + function get_port() + { + return $this->port; + } + + /** + * Get the path + * + * @access public + * @return string + */ + function get_path() + { + return $this->path; + } + + /** + * Get the query + * + * @access public + * @return string + */ + function get_query() + { + return $this->query; + } + + /** + * Get the fragment + * + * @access public + * @return string + */ + function get_fragment() + { + return $this->fragment; + } +} + +/** + * Class to validate and to work with IPv6 addresses. + * + * @package SimplePie + * @copyright 2003-2005 The PHP Group + * @license http://www.opensource.org/licenses/bsd-license.php + * @link http://pear.php.net/package/Net_IPv6 + * @author Alexander Merz + * @author elfrink at introweb dot nl + * @author Josh Peck + * @author Geoffrey Sneddon + */ +class SimplePie_Net_IPv6 +{ + /** + * Removes a possible existing netmask specification of an IP address. + * + * @param string $ip the (compressed) IP as Hex representation + * @return string the IP the without netmask + * @since 1.1.0 + * @access public + * @static + */ + function removeNetmaskSpec($ip) + { + if (strpos($ip, '/') !== false) + { + list($addr, $nm) = explode('/', $ip); + } + else + { + $addr = $ip; + } + return $addr; + } + + /** + * Uncompresses an IPv6 address + * + * RFC 2373 allows you to compress zeros in an address to '::'. This + * function expects an valid IPv6 address and expands the '::' to + * the required zeros. + * + * Example: FF01::101 -> FF01:0:0:0:0:0:0:101 + * ::1 -> 0:0:0:0:0:0:0:1 + * + * @access public + * @static + * @param string $ip a valid IPv6-address (hex format) + * @return string the uncompressed IPv6-address (hex format) + */ + function Uncompress($ip) + { + $uip = SimplePie_Net_IPv6::removeNetmaskSpec($ip); + $c1 = -1; + $c2 = -1; + if (strpos($ip, '::') !== false) + { + list($ip1, $ip2) = explode('::', $ip); + if ($ip1 === '') + { + $c1 = -1; + } + else + { + $pos = 0; + if (($pos = substr_count($ip1, ':')) > 0) + { + $c1 = $pos; + } + else + { + $c1 = 0; + } + } + if ($ip2 === '') + { + $c2 = -1; + } + else + { + $pos = 0; + if (($pos = substr_count($ip2, ':')) > 0) + { + $c2 = $pos; + } + else + { + $c2 = 0; + } + } + if (strstr($ip2, '.')) + { + $c2++; + } + // :: + if ($c1 === -1 && $c2 === -1) + { + $uip = '0:0:0:0:0:0:0:0'; + } + // ::xxx + else if ($c1 === -1) + { + $fill = str_repeat('0:', 7 - $c2); + $uip = str_replace('::', $fill, $uip); + } + // xxx:: + else if ($c2 === -1) + { + $fill = str_repeat(':0', 7 - $c1); + $uip = str_replace('::', $fill, $uip); + } + // xxx::xxx + else + { + $fill = str_repeat(':0:', 6 - $c2 - $c1); + $uip = str_replace('::', $fill, $uip); + $uip = str_replace('::', ':', $uip); + } + } + return $uip; + } + + /** + * Splits an IPv6 address into the IPv6 and a possible IPv4 part + * + * RFC 2373 allows you to note the last two parts of an IPv6 address as + * an IPv4 compatible address + * + * Example: 0:0:0:0:0:0:13.1.68.3 + * 0:0:0:0:0:FFFF:129.144.52.38 + * + * @access public + * @static + * @param string $ip a valid IPv6-address (hex format) + * @return array [0] contains the IPv6 part, [1] the IPv4 part (hex format) + */ + function SplitV64($ip) + { + $ip = SimplePie_Net_IPv6::Uncompress($ip); + if (strstr($ip, '.')) + { + $pos = strrpos($ip, ':'); + $ip[$pos] = '_'; + $ipPart = explode('_', $ip); + return $ipPart; + } + else + { + return array($ip, ''); + } + } + + /** + * Checks an IPv6 address + * + * Checks if the given IP is IPv6-compatible + * + * @access public + * @static + * @param string $ip a valid IPv6-address + * @return bool true if $ip is an IPv6 address + */ + function checkIPv6($ip) + { + $ipPart = SimplePie_Net_IPv6::SplitV64($ip); + $count = 0; + if (!empty($ipPart[0])) + { + $ipv6 = explode(':', $ipPart[0]); + for ($i = 0; $i < count($ipv6); $i++) + { + $dec = hexdec($ipv6[$i]); + $hex = strtoupper(preg_replace('/^[0]{1,3}(.*[0-9a-fA-F])$/', '\\1', $ipv6[$i])); + if ($ipv6[$i] >= 0 && $dec <= 65535 && $hex === strtoupper(dechex($dec))) + { + $count++; + } + } + if ($count === 8) + { + return true; + } + elseif ($count === 6 && !empty($ipPart[1])) + { + $ipv4 = explode('.', $ipPart[1]); + $count = 0; + foreach ($ipv4 as $ipv4_part) + { + if ($ipv4_part >= 0 && $ipv4_part <= 255 && preg_match('/^\d{1,3}$/', $ipv4_part)) + { + $count++; + } + } + if ($count === 4) + { + return true; + } + } + else + { + return false; + } + + } + else + { + return false; + } + } +} + +/** + * Date Parser + * + * @package SimplePie + */ +class SimplePie_Parse_Date +{ + /** + * Input data + * + * @access protected + * @var string + */ + var $date; + + /** + * List of days, calendar day name => ordinal day number in the week + * + * @access protected + * @var array + */ + var $day = array( + // English + 'mon' => 1, + 'monday' => 1, + 'tue' => 2, + 'tuesday' => 2, + 'wed' => 3, + 'wednesday' => 3, + 'thu' => 4, + 'thursday' => 4, + 'fri' => 5, + 'friday' => 5, + 'sat' => 6, + 'saturday' => 6, + 'sun' => 7, + 'sunday' => 7, + // Dutch + 'maandag' => 1, + 'dinsdag' => 2, + 'woensdag' => 3, + 'donderdag' => 4, + 'vrijdag' => 5, + 'zaterdag' => 6, + 'zondag' => 7, + // French + 'lundi' => 1, + 'mardi' => 2, + 'mercredi' => 3, + 'jeudi' => 4, + 'vendredi' => 5, + 'samedi' => 6, + 'dimanche' => 7, + // German + 'montag' => 1, + 'dienstag' => 2, + 'mittwoch' => 3, + 'donnerstag' => 4, + 'freitag' => 5, + 'samstag' => 6, + 'sonnabend' => 6, + 'sonntag' => 7, + // Italian + 'lunedì' => 1, + 'martedì' => 2, + 'mercoledì' => 3, + 'giovedì' => 4, + 'venerdì' => 5, + 'sabato' => 6, + 'domenica' => 7, + // Spanish + 'lunes' => 1, + 'martes' => 2, + 'miércoles' => 3, + 'jueves' => 4, + 'viernes' => 5, + 'sábado' => 6, + 'domingo' => 7, + // Finnish + 'maanantai' => 1, + 'tiistai' => 2, + 'keskiviikko' => 3, + 'torstai' => 4, + 'perjantai' => 5, + 'lauantai' => 6, + 'sunnuntai' => 7, + // Hungarian + 'hétfő' => 1, + 'kedd' => 2, + 'szerda' => 3, + 'csütörtok' => 4, + 'péntek' => 5, + 'szombat' => 6, + 'vasárnap' => 7, + // Greek + 'Δευ' => 1, + 'Τρι' => 2, + 'Τετ' => 3, + 'Πεμ' => 4, + 'Παρ' => 5, + 'Σαβ' => 6, + 'Κυρ' => 7, + ); + + /** + * List of months, calendar month name => calendar month number + * + * @access protected + * @var array + */ + var $month = array( + // English + 'jan' => 1, + 'january' => 1, + 'feb' => 2, + 'february' => 2, + 'mar' => 3, + 'march' => 3, + 'apr' => 4, + 'april' => 4, + 'may' => 5, + // No long form of May + 'jun' => 6, + 'june' => 6, + 'jul' => 7, + 'july' => 7, + 'aug' => 8, + 'august' => 8, + 'sep' => 9, + 'september' => 8, + 'oct' => 10, + 'october' => 10, + 'nov' => 11, + 'november' => 11, + 'dec' => 12, + 'december' => 12, + // Dutch + 'januari' => 1, + 'februari' => 2, + 'maart' => 3, + 'april' => 4, + 'mei' => 5, + 'juni' => 6, + 'juli' => 7, + 'augustus' => 8, + 'september' => 9, + 'oktober' => 10, + 'november' => 11, + 'december' => 12, + // French + 'janvier' => 1, + 'février' => 2, + 'mars' => 3, + 'avril' => 4, + 'mai' => 5, + 'juin' => 6, + 'juillet' => 7, + 'août' => 8, + 'septembre' => 9, + 'octobre' => 10, + 'novembre' => 11, + 'décembre' => 12, + // German + 'januar' => 1, + 'februar' => 2, + 'märz' => 3, + 'april' => 4, + 'mai' => 5, + 'juni' => 6, + 'juli' => 7, + 'august' => 8, + 'september' => 9, + 'oktober' => 10, + 'november' => 11, + 'dezember' => 12, + // Italian + 'gennaio' => 1, + 'febbraio' => 2, + 'marzo' => 3, + 'aprile' => 4, + 'maggio' => 5, + 'giugno' => 6, + 'luglio' => 7, + 'agosto' => 8, + 'settembre' => 9, + 'ottobre' => 10, + 'novembre' => 11, + 'dicembre' => 12, + // Spanish + 'enero' => 1, + 'febrero' => 2, + 'marzo' => 3, + 'abril' => 4, + 'mayo' => 5, + 'junio' => 6, + 'julio' => 7, + 'agosto' => 8, + 'septiembre' => 9, + 'setiembre' => 9, + 'octubre' => 10, + 'noviembre' => 11, + 'diciembre' => 12, + // Finnish + 'tammikuu' => 1, + 'helmikuu' => 2, + 'maaliskuu' => 3, + 'huhtikuu' => 4, + 'toukokuu' => 5, + 'kesäkuu' => 6, + 'heinäkuu' => 7, + 'elokuu' => 8, + 'suuskuu' => 9, + 'lokakuu' => 10, + 'marras' => 11, + 'joulukuu' => 12, + // Hungarian + 'január' => 1, + 'február' => 2, + 'március' => 3, + 'április' => 4, + 'május' => 5, + 'június' => 6, + 'július' => 7, + 'augusztus' => 8, + 'szeptember' => 9, + 'október' => 10, + 'november' => 11, + 'december' => 12, + // Greek + 'Ιαν' => 1, + 'Φεβ' => 2, + 'Μάώ' => 3, + 'Μαώ' => 3, + 'Απρ' => 4, + 'Μάι' => 5, + 'Μαϊ' => 5, + 'Μαι' => 5, + 'Ιούν' => 6, + 'Ιον' => 6, + 'Ιούλ' => 7, + 'Ιολ' => 7, + 'Αύγ' => 8, + 'Αυγ' => 8, + 'Σεπ' => 9, + 'Οκτ' => 10, + 'Νοέ' => 11, + 'Δεκ' => 12, + ); + + /** + * List of timezones, abbreviation => offset from UTC + * + * @access protected + * @var array + */ + var $timezone = array( + 'ACDT' => 37800, + 'ACIT' => 28800, + 'ACST' => 34200, + 'ACT' => -18000, + 'ACWDT' => 35100, + 'ACWST' => 31500, + 'AEDT' => 39600, + 'AEST' => 36000, + 'AFT' => 16200, + 'AKDT' => -28800, + 'AKST' => -32400, + 'AMDT' => 18000, + 'AMT' => -14400, + 'ANAST' => 46800, + 'ANAT' => 43200, + 'ART' => -10800, + 'AZOST' => -3600, + 'AZST' => 18000, + 'AZT' => 14400, + 'BIOT' => 21600, + 'BIT' => -43200, + 'BOT' => -14400, + 'BRST' => -7200, + 'BRT' => -10800, + 'BST' => 3600, + 'BTT' => 21600, + 'CAST' => 18000, + 'CAT' => 7200, + 'CCT' => 23400, + 'CDT' => -18000, + 'CEDT' => 7200, + 'CET' => 3600, + 'CGST' => -7200, + 'CGT' => -10800, + 'CHADT' => 49500, + 'CHAST' => 45900, + 'CIST' => -28800, + 'CKT' => -36000, + 'CLDT' => -10800, + 'CLST' => -14400, + 'COT' => -18000, + 'CST' => -21600, + 'CVT' => -3600, + 'CXT' => 25200, + 'DAVT' => 25200, + 'DTAT' => 36000, + 'EADT' => -18000, + 'EAST' => -21600, + 'EAT' => 10800, + 'ECT' => -18000, + 'EDT' => -14400, + 'EEST' => 10800, + 'EET' => 7200, + 'EGT' => -3600, + 'EKST' => 21600, + 'EST' => -18000, + 'FJT' => 43200, + 'FKDT' => -10800, + 'FKST' => -14400, + 'FNT' => -7200, + 'GALT' => -21600, + 'GEDT' => 14400, + 'GEST' => 10800, + 'GFT' => -10800, + 'GILT' => 43200, + 'GIT' => -32400, + 'GST' => 14400, + 'GST' => -7200, + 'GYT' => -14400, + 'HAA' => -10800, + 'HAC' => -18000, + 'HADT' => -32400, + 'HAE' => -14400, + 'HAP' => -25200, + 'HAR' => -21600, + 'HAST' => -36000, + 'HAT' => -9000, + 'HAY' => -28800, + 'HKST' => 28800, + 'HMT' => 18000, + 'HNA' => -14400, + 'HNC' => -21600, + 'HNE' => -18000, + 'HNP' => -28800, + 'HNR' => -25200, + 'HNT' => -12600, + 'HNY' => -32400, + 'IRDT' => 16200, + 'IRKST' => 32400, + 'IRKT' => 28800, + 'IRST' => 12600, + 'JFDT' => -10800, + 'JFST' => -14400, + 'JST' => 32400, + 'KGST' => 21600, + 'KGT' => 18000, + 'KOST' => 39600, + 'KOVST' => 28800, + 'KOVT' => 25200, + 'KRAST' => 28800, + 'KRAT' => 25200, + 'KST' => 32400, + 'LHDT' => 39600, + 'LHST' => 37800, + 'LINT' => 50400, + 'LKT' => 21600, + 'MAGST' => 43200, + 'MAGT' => 39600, + 'MAWT' => 21600, + 'MDT' => -21600, + 'MESZ' => 7200, + 'MEZ' => 3600, + 'MHT' => 43200, + 'MIT' => -34200, + 'MNST' => 32400, + 'MSDT' => 14400, + 'MSST' => 10800, + 'MST' => -25200, + 'MUT' => 14400, + 'MVT' => 18000, + 'MYT' => 28800, + 'NCT' => 39600, + 'NDT' => -9000, + 'NFT' => 41400, + 'NMIT' => 36000, + 'NOVST' => 25200, + 'NOVT' => 21600, + 'NPT' => 20700, + 'NRT' => 43200, + 'NST' => -12600, + 'NUT' => -39600, + 'NZDT' => 46800, + 'NZST' => 43200, + 'OMSST' => 25200, + 'OMST' => 21600, + 'PDT' => -25200, + 'PET' => -18000, + 'PETST' => 46800, + 'PETT' => 43200, + 'PGT' => 36000, + 'PHOT' => 46800, + 'PHT' => 28800, + 'PKT' => 18000, + 'PMDT' => -7200, + 'PMST' => -10800, + 'PONT' => 39600, + 'PST' => -28800, + 'PWT' => 32400, + 'PYST' => -10800, + 'PYT' => -14400, + 'RET' => 14400, + 'ROTT' => -10800, + 'SAMST' => 18000, + 'SAMT' => 14400, + 'SAST' => 7200, + 'SBT' => 39600, + 'SCDT' => 46800, + 'SCST' => 43200, + 'SCT' => 14400, + 'SEST' => 3600, + 'SGT' => 28800, + 'SIT' => 28800, + 'SRT' => -10800, + 'SST' => -39600, + 'SYST' => 10800, + 'SYT' => 7200, + 'TFT' => 18000, + 'THAT' => -36000, + 'TJT' => 18000, + 'TKT' => -36000, + 'TMT' => 18000, + 'TOT' => 46800, + 'TPT' => 32400, + 'TRUT' => 36000, + 'TVT' => 43200, + 'TWT' => 28800, + 'UYST' => -7200, + 'UYT' => -10800, + 'UZT' => 18000, + 'VET' => -14400, + 'VLAST' => 39600, + 'VLAT' => 36000, + 'VOST' => 21600, + 'VUT' => 39600, + 'WAST' => 7200, + 'WAT' => 3600, + 'WDT' => 32400, + 'WEST' => 3600, + 'WFT' => 43200, + 'WIB' => 25200, + 'WIT' => 32400, + 'WITA' => 28800, + 'WKST' => 18000, + 'WST' => 28800, + 'YAKST' => 36000, + 'YAKT' => 32400, + 'YAPT' => 36000, + 'YEKST' => 21600, + 'YEKT' => 18000, + ); + + /** + * Cached PCRE for SimplePie_Parse_Date::$day + * + * @access protected + * @var string + */ + var $day_pcre; + + /** + * Cached PCRE for SimplePie_Parse_Date::$month + * + * @access protected + * @var string + */ + var $month_pcre; + + /** + * Array of user-added callback methods + * + * @access private + * @var array + */ + var $built_in = array(); + + /** + * Array of user-added callback methods + * + * @access private + * @var array + */ + var $user = array(); + + /** + * Create new SimplePie_Parse_Date object, and set self::day_pcre, + * self::month_pcre, and self::built_in + * + * @access private + */ + function SimplePie_Parse_Date() + { + $this->day_pcre = '(' . implode(array_keys($this->day), '|') . ')'; + $this->month_pcre = '(' . implode(array_keys($this->month), '|') . ')'; + + static $cache; + if (!isset($cache[get_class($this)])) + { + $all_methods = get_class_methods($this); + + foreach ($all_methods as $method) + { + if (strtolower(substr($method, 0, 5)) === 'date_') + { + $cache[get_class($this)][] = $method; + } + } + } + + foreach ($cache[get_class($this)] as $method) + { + $this->built_in[] = $method; + } + } + + /** + * Get the object + * + * @access public + */ + function get() + { + static $object; + if (!$object) + { + $object =& new SimplePie_Parse_Date; + } + return $object; + } + + /** + * Parse a date + * + * @final + * @access public + * @param string $date Date to parse + * @return int Timestamp corresponding to date string, or false on failure + */ + function parse($date) + { + foreach ($this->user as $method) + { + if (($returned = call_user_func($method, $date)) !== false) + { + return $returned; + } + } + + foreach ($this->built_in as $method) + { + if (($returned = call_user_func(array(&$this, $method), $date)) !== false) + { + return $returned; + } + } + + return false; + } + + /** + * Add a callback method to parse a date + * + * @final + * @access public + * @param callback $callback + */ + function add_callback($callback) + { + if (is_callable($callback)) + { + $this->user[] = $callback; + } + else + { + trigger_error('User-supplied function must be a valid callback', E_USER_WARNING); + } + } + + /** + * Parse a superset of W3C-DTF (allows hyphens and colons to be omitted, as + * well as allowing any of upper or lower case "T", horizontal tabs, or + * spaces to be used as the time seperator (including more than one)) + * + * @access protected + * @return int Timestamp + */ + function date_w3cdtf($date) + { + static $pcre; + if (!$pcre) + { + $year = '([0-9]{4})'; + $month = $day = $hour = $minute = $second = '([0-9]{2})'; + $decimal = '([0-9]*)'; + $zone = '(?:(Z)|([+\-])([0-9]{1,2}):?([0-9]{1,2}))'; + $pcre = '/^' . $year . '(?:-?' . $month . '(?:-?' . $day . '(?:[Tt\x09\x20]+' . $hour . '(?::?' . $minute . '(?::?' . $second . '(?:.' . $decimal . ')?)?)?' . $zone . ')?)?)?$/'; + } + if (preg_match($pcre, $date, $match)) + { + /* + Capturing subpatterns: + 1: Year + 2: Month + 3: Day + 4: Hour + 5: Minute + 6: Second + 7: Decimal fraction of a second + 8: Zulu + 9: Timezone ± + 10: Timezone hours + 11: Timezone minutes + */ + + // Fill in empty matches + for ($i = count($match); $i <= 3; $i++) + { + $match[$i] = '1'; + } + + for ($i = count($match); $i <= 7; $i++) + { + $match[$i] = '0'; + } + + // Numeric timezone + if (isset($match[9]) && $match[9] !== '') + { + $timezone = $match[10] * 3600; + $timezone += $match[11] * 60; + if ($match[9] === '-') + { + $timezone = 0 - $timezone; + } + } + else + { + $timezone = 0; + } + + // Convert the number of seconds to an integer, taking decimals into account + $second = round($match[6] + $match[7] / pow(10, strlen($match[7]))); + + return gmmktime($match[4], $match[5], $second, $match[2], $match[3], $match[1]) - $timezone; + } + else + { + return false; + } + } + + /** + * Remove RFC822 comments + * + * @access protected + * @param string $data Data to strip comments from + * @return string Comment stripped string + */ + function remove_rfc2822_comments($string) + { + $string = (string) $string; + $position = 0; + $length = strlen($string); + $depth = 0; + + $output = ''; + + while ($position < $length && ($pos = strpos($string, '(', $position)) !== false) + { + $output .= substr($string, $position, $pos - $position); + $position = $pos + 1; + if ($string[$pos - 1] !== '\\') + { + $depth++; + while ($depth && $position < $length) + { + $position += strcspn($string, '()', $position); + if ($string[$position - 1] === '\\') + { + $position++; + continue; + } + elseif (isset($string[$position])) + { + switch ($string[$position]) + { + case '(': + $depth++; + break; + + case ')': + $depth--; + break; + } + $position++; + } + else + { + break; + } + } + } + else + { + $output .= '('; + } + } + $output .= substr($string, $position); + + return $output; + } + + /** + * Parse RFC2822's date format + * + * @access protected + * @return int Timestamp + */ + function date_rfc2822($date) + { + static $pcre; + if (!$pcre) + { + $wsp = '[\x09\x20]'; + $fws = '(?:' . $wsp . '+|' . $wsp . '*(?:\x0D\x0A' . $wsp . '+)+)'; + $optional_fws = $fws . '?'; + $day_name = $this->day_pcre; + $month = $this->month_pcre; + $day = '([0-9]{1,2})'; + $hour = $minute = $second = '([0-9]{2})'; + $year = '([0-9]{2,4})'; + $num_zone = '([+\-])([0-9]{2})([0-9]{2})'; + $character_zone = '([A-Z]{1,5})'; + $zone = '(?:' . $num_zone . '|' . $character_zone . ')'; + $pcre = '/(?:' . $optional_fws . $day_name . $optional_fws . ',)?' . $optional_fws . $day . $fws . $month . $fws . $year . $fws . $hour . $optional_fws . ':' . $optional_fws . $minute . '(?:' . $optional_fws . ':' . $optional_fws . $second . ')?' . $fws . $zone . '/i'; + } + if (preg_match($pcre, $this->remove_rfc2822_comments($date), $match)) + { + /* + Capturing subpatterns: + 1: Day name + 2: Day + 3: Month + 4: Year + 5: Hour + 6: Minute + 7: Second + 8: Timezone ± + 9: Timezone hours + 10: Timezone minutes + 11: Alphabetic timezone + */ + + // Find the month number + $month = $this->month[strtolower($match[3])]; + + // Numeric timezone + if ($match[8] !== '') + { + $timezone = $match[9] * 3600; + $timezone += $match[10] * 60; + if ($match[8] === '-') + { + $timezone = 0 - $timezone; + } + } + // Character timezone + elseif (isset($this->timezone[strtoupper($match[11])])) + { + $timezone = $this->timezone[strtoupper($match[11])]; + } + // Assume everything else to be -0000 + else + { + $timezone = 0; + } + + // Deal with 2/3 digit years + if ($match[4] < 50) + { + $match[4] += 2000; + } + elseif ($match[4] < 1000) + { + $match[4] += 1900; + } + + // Second is optional, if it is empty set it to zero + if ($match[7] !== '') + { + $second = $match[7]; + } + else + { + $second = 0; + } + + return gmmktime($match[5], $match[6], $second, $month, $match[2], $match[4]) - $timezone; + } + else + { + return false; + } + } + + /** + * Parse RFC850's date format + * + * @access protected + * @return int Timestamp + */ + function date_rfc850($date) + { + static $pcre; + if (!$pcre) + { + $space = '[\x09\x20]+'; + $day_name = $this->day_pcre; + $month = $this->month_pcre; + $day = '([0-9]{1,2})'; + $year = $hour = $minute = $second = '([0-9]{2})'; + $zone = '([A-Z]{1,5})'; + $pcre = '/^' . $day_name . ',' . $space . $day . '-' . $month . '-' . $year . $space . $hour . ':' . $minute . ':' . $second . $space . $zone . '$/i'; + } + if (preg_match($pcre, $date, $match)) + { + /* + Capturing subpatterns: + 1: Day name + 2: Day + 3: Month + 4: Year + 5: Hour + 6: Minute + 7: Second + 8: Timezone + */ + + // Month + $month = $this->month[strtolower($match[3])]; + + // Character timezone + if (isset($this->timezone[strtoupper($match[8])])) + { + $timezone = $this->timezone[strtoupper($match[8])]; + } + // Assume everything else to be -0000 + else + { + $timezone = 0; + } + + // Deal with 2 digit year + if ($match[4] < 50) + { + $match[4] += 2000; + } + else + { + $match[4] += 1900; + } + + return gmmktime($match[5], $match[6], $match[7], $month, $match[2], $match[4]) - $timezone; + } + else + { + return false; + } + } + + /** + * Parse C99's asctime()'s date format + * + * @access protected + * @return int Timestamp + */ + function date_asctime($date) + { + static $pcre; + if (!$pcre) + { + $space = '[\x09\x20]+'; + $wday_name = $this->day_pcre; + $mon_name = $this->month_pcre; + $day = '([0-9]{1,2})'; + $hour = $sec = $min = '([0-9]{2})'; + $year = '([0-9]{4})'; + $terminator = '\x0A?\x00?'; + $pcre = '/^' . $wday_name . $space . $mon_name . $space . $day . $space . $hour . ':' . $min . ':' . $sec . $space . $year . $terminator . '$/i'; + } + if (preg_match($pcre, $date, $match)) + { + /* + Capturing subpatterns: + 1: Day name + 2: Month + 3: Day + 4: Hour + 5: Minute + 6: Second + 7: Year + */ + + $month = $this->month[strtolower($match[2])]; + return gmmktime($match[4], $match[5], $match[6], $month, $match[3], $match[7]); + } + else + { + return false; + } + } + + /** + * Parse dates using strtotime() + * + * @access protected + * @return int Timestamp + */ + function date_strtotime($date) + { + $strtotime = strtotime($date); + if ($strtotime === -1 || $strtotime === false) + { + return false; + } + else + { + return $strtotime; + } + } +} + +/** + * Content-type sniffing + * + * @package SimplePie + */ +class SimplePie_Content_Type_Sniffer +{ + /** + * File object + * + * @var SimplePie_File + * @access private + */ + var $file; + + /** + * Create an instance of the class with the input file + * + * @access public + * @param SimplePie_Content_Type_Sniffer $file Input file + */ + function SimplePie_Content_Type_Sniffer($file) + { + $this->file = $file; + } + + /** + * Get the Content-Type of the specified file + * + * @access public + * @return string Actual Content-Type + */ + function get_type() + { + if (isset($this->file->headers['content-type'])) + { + if (!isset($this->file->headers['content-encoding']) + && ($this->file->headers['content-type'] === 'text/plain' + || $this->file->headers['content-type'] === 'text/plain; charset=ISO-8859-1' + || $this->file->headers['content-type'] === 'text/plain; charset=iso-8859-1')) + { + return $this->text_or_binary(); + } + + if (($pos = strpos($this->file->headers['content-type'], ';')) !== false) + { + $official = substr($this->file->headers['content-type'], 0, $pos); + } + else + { + $official = $this->file->headers['content-type']; + } + $official = strtolower($official); + + if ($official === 'unknown/unknown' + || $official === 'application/unknown') + { + return $this->unknown(); + } + elseif (substr($official, -4) === '+xml' + || $official === 'text/xml' + || $official === 'application/xml') + { + return $official; + } + elseif (substr($official, 0, 6) === 'image/') + { + if ($return = $this->image()) + { + return $return; + } + else + { + return $official; + } + } + elseif ($official === 'text/html') + { + return $this->feed_or_html(); + } + else + { + return $official; + } + } + else + { + return $this->unknown(); + } + } + + /** + * Sniff text or binary + * + * @access private + * @return string Actual Content-Type + */ + function text_or_binary() + { + if (substr($this->file->body, 0, 2) === "\xFE\xFF" + || substr($this->file->body, 0, 2) === "\xFF\xFE" + || substr($this->file->body, 0, 4) === "\x00\x00\xFE\xFF" + || substr($this->file->body, 0, 3) === "\xEF\xBB\xBF") + { + return 'text/plain'; + } + elseif (preg_match('/[\x00-\x08\x0E-\x1A\x1C-\x1F]/', $this->file->body)) + { + return 'application/octect-stream'; + } + else + { + return 'text/plain'; + } + } + + /** + * Sniff unknown + * + * @access private + * @return string Actual Content-Type + */ + function unknown() + { + $ws = strspn($this->file->body, "\x09\x0A\x0B\x0C\x0D\x20"); + if (strtolower(substr($this->file->body, $ws, 14)) === 'file->body, $ws, 5)) === 'file->body, $ws, 7)) === 'file->body, 0, 5) === '%PDF-') + { + return 'application/pdf'; + } + elseif (substr($this->file->body, 0, 11) === '%!PS-Adobe-') + { + return 'application/postscript'; + } + elseif (substr($this->file->body, 0, 6) === 'GIF87a' + || substr($this->file->body, 0, 6) === 'GIF89a') + { + return 'image/gif'; + } + elseif (substr($this->file->body, 0, 8) === "\x89\x50\x4E\x47\x0D\x0A\x1A\x0A") + { + return 'image/png'; + } + elseif (substr($this->file->body, 0, 3) === "\xFF\xD8\xFF") + { + return 'image/jpeg'; + } + elseif (substr($this->file->body, 0, 2) === "\x42\x4D") + { + return 'image/bmp'; + } + else + { + return $this->text_or_binary(); + } + } + + /** + * Sniff images + * + * @access private + * @return string Actual Content-Type + */ + function image() + { + if (substr($this->file->body, 0, 6) === 'GIF87a' + || substr($this->file->body, 0, 6) === 'GIF89a') + { + return 'image/gif'; + } + elseif (substr($this->file->body, 0, 8) === "\x89\x50\x4E\x47\x0D\x0A\x1A\x0A") + { + return 'image/png'; + } + elseif (substr($this->file->body, 0, 3) === "\xFF\xD8\xFF") + { + return 'image/jpeg'; + } + elseif (substr($this->file->body, 0, 2) === "\x42\x4D") + { + return 'image/bmp'; + } + else + { + return false; + } + } + + /** + * Sniff HTML + * + * @access private + * @return string Actual Content-Type + */ + function feed_or_html() + { + $len = strlen($this->file->body); + $pos = strspn($this->file->body, "\x09\x0A\x0D\x20"); + + while ($pos < $len) + { + switch ($this->file->body[$pos]) + { + case "\x09": + case "\x0A": + case "\x0D": + case "\x20": + $pos += strspn($this->file->body, "\x09\x0A\x0D\x20", $pos); + continue 2; + + case '<': + $pos++; + break; + + default: + return 'text/html'; + } + + if (substr($this->file->body, $pos, 3) === '!--') + { + $pos += 3; + if ($pos < $len && ($pos = strpos($this->file->body, '-->', $pos)) !== false) + { + $pos += 3; + } + else + { + return 'text/html'; + } + } + elseif (substr($this->file->body, $pos, 1) === '!') + { + if ($pos < $len && ($pos = strpos($this->file->body, '>', $pos)) !== false) + { + $pos++; + } + else + { + return 'text/html'; + } + } + elseif (substr($this->file->body, $pos, 1) === '?') + { + if ($pos < $len && ($pos = strpos($this->file->body, '?>', $pos)) !== false) + { + $pos += 2; + } + else + { + return 'text/html'; + } + } + elseif (substr($this->file->body, $pos, 3) === 'rss' + || substr($this->file->body, $pos, 7) === 'rdf:RDF') + { + return 'application/rss+xml'; + } + elseif (substr($this->file->body, $pos, 4) === 'feed') + { + return 'application/atom+xml'; + } + else + { + return 'text/html'; + } + } + + return 'text/html'; + } +} + +/** + * Parses the XML Declaration + * + * @package SimplePie + */ +class SimplePie_XML_Declaration_Parser +{ + /** + * XML Version + * + * @access public + * @var string + */ + var $version = '1.0'; + + /** + * Encoding + * + * @access public + * @var string + */ + var $encoding = 'UTF-8'; + + /** + * Standalone + * + * @access public + * @var bool + */ + var $standalone = false; + + /** + * Current state of the state machine + * + * @access private + * @var string + */ + var $state = 'before_version_name'; + + /** + * Input data + * + * @access private + * @var string + */ + var $data = ''; + + /** + * Input data length (to avoid calling strlen() everytime this is needed) + * + * @access private + * @var int + */ + var $data_length = 0; + + /** + * Current position of the pointer + * + * @var int + * @access private + */ + var $position = 0; + + /** + * Create an instance of the class with the input data + * + * @access public + * @param string $data Input data + */ + function SimplePie_XML_Declaration_Parser($data) + { + $this->data = $data; + $this->data_length = strlen($this->data); + } + + /** + * Parse the input data + * + * @access public + * @return bool true on success, false on failure + */ + function parse() + { + while ($this->state && $this->state !== 'emit' && $this->has_data()) + { + $state = $this->state; + $this->$state(); + } + $this->data = ''; + if ($this->state === 'emit') + { + return true; + } + else + { + $this->version = ''; + $this->encoding = ''; + $this->standalone = ''; + return false; + } + } + + /** + * Check whether there is data beyond the pointer + * + * @access private + * @return bool true if there is further data, false if not + */ + function has_data() + { + return (bool) ($this->position < $this->data_length); + } + + /** + * Advance past any whitespace + * + * @return int Number of whitespace characters passed + */ + function skip_whitespace() + { + $whitespace = strspn($this->data, "\x09\x0A\x0D\x20", $this->position); + $this->position += $whitespace; + return $whitespace; + } + + /** + * Read value + */ + function get_value() + { + $quote = substr($this->data, $this->position, 1); + if ($quote === '"' || $quote === "'") + { + $this->position++; + $len = strcspn($this->data, $quote, $this->position); + if ($this->has_data()) + { + $value = substr($this->data, $this->position, $len); + $this->position += $len + 1; + return $value; + } + } + return false; + } + + function before_version_name() + { + if ($this->skip_whitespace()) + { + $this->state = 'version_name'; + } + else + { + $this->state = false; + } + } + + function version_name() + { + if (substr($this->data, $this->position, 7) === 'version') + { + $this->position += 7; + $this->skip_whitespace(); + $this->state = 'version_equals'; + } + else + { + $this->state = false; + } + } + + function version_equals() + { + if (substr($this->data, $this->position, 1) === '=') + { + $this->position++; + $this->skip_whitespace(); + $this->state = 'version_value'; + } + else + { + $this->state = false; + } + } + + function version_value() + { + if ($this->version = $this->get_value()) + { + $this->skip_whitespace(); + if ($this->has_data()) + { + $this->state = 'encoding_name'; + } + else + { + $this->state = 'emit'; + } + } + else + { + $this->state = 'standalone_name'; + } + } + + function encoding_name() + { + if (substr($this->data, $this->position, 8) === 'encoding') + { + $this->position += 8; + $this->skip_whitespace(); + $this->state = 'encoding_equals'; + } + else + { + $this->state = false; + } + } + + function encoding_equals() + { + if (substr($this->data, $this->position, 1) === '=') + { + $this->position++; + $this->skip_whitespace(); + $this->state = 'encoding_value'; + } + else + { + $this->state = false; + } + } + + function encoding_value() + { + if ($this->encoding = $this->get_value()) + { + $this->skip_whitespace(); + if ($this->has_data()) + { + $this->state = 'standalone_name'; + } + else + { + $this->state = 'emit'; + } + } + else + { + $this->state = false; + } + } + + function standalone_name() + { + if (substr($this->data, $this->position, 10) === 'standalone') + { + $this->position += 10; + $this->skip_whitespace(); + $this->state = 'standalone_equals'; + } + else + { + $this->state = false; + } + } + + function standalone_equals() + { + if (substr($this->data, $this->position, 1) === '=') + { + $this->position++; + $this->skip_whitespace(); + $this->state = 'standalone_value'; + } + else + { + $this->state = false; + } + } + + function standalone_value() + { + if ($standalone = $this->get_value()) + { + switch ($standalone) + { + case 'yes': + $this->standalone = true; + break; + + case 'no': + $this->standalone = false; + break; + + default: + $this->state = false; + return; + } + + $this->skip_whitespace(); + if ($this->has_data()) + { + $this->state = false; + } + else + { + $this->state = 'emit'; + } + } + else + { + $this->state = false; + } + } +} + +class SimplePie_Locator +{ + var $useragent; + var $timeout; + var $file; + var $local = array(); + var $elsewhere = array(); + var $file_class = 'SimplePie_File'; + var $cached_entities = array(); + var $http_base; + var $base; + var $base_location = 0; + var $checked_feeds = 0; + var $max_checked_feeds = 10; + var $content_type_sniffer_class = 'SimplePie_Content_Type_Sniffer'; + + function SimplePie_Locator(&$file, $timeout = 10, $useragent = null, $file_class = 'SimplePie_File', $max_checked_feeds = 10, $content_type_sniffer_class = 'SimplePie_Content_Type_Sniffer') + { + $this->file =& $file; + $this->file_class = $file_class; + $this->useragent = $useragent; + $this->timeout = $timeout; + $this->max_checked_feeds = $max_checked_feeds; + $this->content_type_sniffer_class = $content_type_sniffer_class; + } + + function find($type = SIMPLEPIE_LOCATOR_ALL, &$working) + { + if ($this->is_feed($this->file)) + { + return $this->file; + } + + if ($this->file->method & SIMPLEPIE_FILE_SOURCE_REMOTE) + { + $sniffer =& new $this->content_type_sniffer_class($this->file); + if ($sniffer->get_type() !== 'text/html') + { + return null; + } + } + + if ($type & ~SIMPLEPIE_LOCATOR_NONE) + { + $this->get_base(); + } + + if ($type & SIMPLEPIE_LOCATOR_AUTODISCOVERY && $working = $this->autodiscovery()) + { + return $working[0]; + } + + if ($type & (SIMPLEPIE_LOCATOR_LOCAL_EXTENSION | SIMPLEPIE_LOCATOR_LOCAL_BODY | SIMPLEPIE_LOCATOR_REMOTE_EXTENSION | SIMPLEPIE_LOCATOR_REMOTE_BODY) && $this->get_links()) + { + if ($type & SIMPLEPIE_LOCATOR_LOCAL_EXTENSION && $working = $this->extension($this->local)) + { + return $working; + } + + if ($type & SIMPLEPIE_LOCATOR_LOCAL_BODY && $working = $this->body($this->local)) + { + return $working; + } + + if ($type & SIMPLEPIE_LOCATOR_REMOTE_EXTENSION && $working = $this->extension($this->elsewhere)) + { + return $working; + } + + if ($type & SIMPLEPIE_LOCATOR_REMOTE_BODY && $working = $this->body($this->elsewhere)) + { + return $working; + } + } + return null; + } + + function is_feed(&$file) + { + if ($file->method & SIMPLEPIE_FILE_SOURCE_REMOTE) + { + $sniffer =& new $this->content_type_sniffer_class($file); + $sniffed = $sniffer->get_type(); + if (in_array($sniffed, array('application/rss+xml', 'application/rdf+xml', 'text/rdf', 'application/atom+xml', 'text/xml', 'application/xml'))) + { + return true; + } + else + { + return false; + } + } + elseif ($file->method & SIMPLEPIE_FILE_SOURCE_LOCAL) + { + return true; + } + else + { + return false; + } + } + + function get_base() + { + $this->http_base = $this->file->url; + $this->base = $this->http_base; + $elements = SimplePie_Misc::get_element('base', $this->file->body); + foreach ($elements as $element) + { + if ($element['attribs']['href']['data'] !== '') + { + $this->base = SimplePie_Misc::absolutize_url(trim($element['attribs']['href']['data']), $this->http_base); + $this->base_location = $element['offset']; + break; + } + } + } + + function autodiscovery() + { + $links = array_merge(SimplePie_Misc::get_element('link', $this->file->body), SimplePie_Misc::get_element('a', $this->file->body), SimplePie_Misc::get_element('area', $this->file->body)); + $done = array(); + $feeds = array(); + foreach ($links as $link) + { + if ($this->checked_feeds === $this->max_checked_feeds) + { + break; + } + if (isset($link['attribs']['href']['data']) && isset($link['attribs']['rel']['data'])) + { + $rel = array_unique(SimplePie_Misc::space_seperated_tokens(strtolower($link['attribs']['rel']['data']))); + + if ($this->base_location < $link['offset']) + { + $href = SimplePie_Misc::absolutize_url(trim($link['attribs']['href']['data']), $this->base); + } + else + { + $href = SimplePie_Misc::absolutize_url(trim($link['attribs']['href']['data']), $this->http_base); + } + + if (!in_array($href, $done) && in_array('feed', $rel) || (in_array('alternate', $rel) && !empty($link['attribs']['type']['data']) && in_array(strtolower(SimplePie_Misc::parse_mime($link['attribs']['type']['data'])), array('application/rss+xml', 'application/atom+xml'))) && !isset($feeds[$href])) + { + $this->checked_feeds++; + $feed =& new $this->file_class($href, $this->timeout, 5, null, $this->useragent); + if ($feed->success && ($feed->method & SIMPLEPIE_FILE_SOURCE_REMOTE === 0 || ($feed->status_code === 200 || $feed->status_code > 206 && $feed->status_code < 300)) && $this->is_feed($feed)) + { + $feeds[$href] = $feed; + } + } + $done[] = $href; + } + } + + if (!empty($feeds)) + { + return array_values($feeds); + } + else { + return null; + } + } + + function get_links() + { + $links = SimplePie_Misc::get_element('a', $this->file->body); + foreach ($links as $link) + { + if (isset($link['attribs']['href']['data'])) + { + $href = trim($link['attribs']['href']['data']); + $parsed = SimplePie_Misc::parse_url($href); + if ($parsed['scheme'] === '' || preg_match('/^(http(s)|feed)?$/i', $parsed['scheme'])) + { + if ($this->base_location < $link['offset']) + { + $href = SimplePie_Misc::absolutize_url(trim($link['attribs']['href']['data']), $this->base); + } + else + { + $href = SimplePie_Misc::absolutize_url(trim($link['attribs']['href']['data']), $this->http_base); + } + + $current = SimplePie_Misc::parse_url($this->file->url); + + if ($parsed['authority'] === '' || $parsed['authority'] === $current['authority']) + { + $this->local[] = $href; + } + else + { + $this->elsewhere[] = $href; + } + } + } + } + $this->local = array_unique($this->local); + $this->elsewhere = array_unique($this->elsewhere); + if (!empty($this->local) || !empty($this->elsewhere)) + { + return true; + } + return null; + } + + function extension(&$array) + { + foreach ($array as $key => $value) + { + if ($this->checked_feeds === $this->max_checked_feeds) + { + break; + } + if (in_array(strtolower(strrchr($value, '.')), array('.rss', '.rdf', '.atom', '.xml'))) + { + $this->checked_feeds++; + $feed =& new $this->file_class($value, $this->timeout, 5, null, $this->useragent); + if ($feed->success && ($feed->method & SIMPLEPIE_FILE_SOURCE_REMOTE === 0 || ($feed->status_code === 200 || $feed->status_code > 206 && $feed->status_code < 300)) && $this->is_feed($feed)) + { + return $feed; + } + else + { + unset($array[$key]); + } + } + } + return null; + } + + function body(&$array) + { + foreach ($array as $key => $value) + { + if ($this->checked_feeds === $this->max_checked_feeds) + { + break; + } + if (preg_match('/(rss|rdf|atom|xml)/i', $value)) + { + $this->checked_feeds++; + $feed =& new $this->file_class($value, $this->timeout, 5, null, $this->useragent); + if ($feed->success && ($feed->method & SIMPLEPIE_FILE_SOURCE_REMOTE === 0 || ($feed->status_code === 200 || $feed->status_code > 206 && $feed->status_code < 300)) && $this->is_feed($feed)) + { + return $feed; + } + else + { + unset($array[$key]); + } + } + } + return null; + } +} + +class SimplePie_Parser +{ + var $error_code; + var $error_string; + var $current_line; + var $current_column; + var $current_byte; + var $separator = ' '; + var $namespace = array(''); + var $element = array(''); + var $xml_base = array(''); + var $xml_base_explicit = array(false); + var $xml_lang = array(''); + var $data = array(); + var $datas = array(array()); + var $current_xhtml_construct = -1; + var $encoding; + + function parse(&$data, $encoding) + { + // Use UTF-8 if we get passed US-ASCII, as every US-ASCII character is a UTF-8 character + if (strtoupper($encoding) === 'US-ASCII') + { + $this->encoding = 'UTF-8'; + } + else + { + $this->encoding = $encoding; + } + + // Strip BOM: + // UTF-32 Big Endian BOM + if (substr($data, 0, 4) === "\x00\x00\xFE\xFF") + { + $data = substr($data, 4); + } + // UTF-32 Little Endian BOM + elseif (substr($data, 0, 4) === "\xFF\xFE\x00\x00") + { + $data = substr($data, 4); + } + // UTF-16 Big Endian BOM + elseif (substr($data, 0, 2) === "\xFE\xFF") + { + $data = substr($data, 2); + } + // UTF-16 Little Endian BOM + elseif (substr($data, 0, 2) === "\xFF\xFE") + { + $data = substr($data, 2); + } + // UTF-8 BOM + elseif (substr($data, 0, 3) === "\xEF\xBB\xBF") + { + $data = substr($data, 3); + } + + if (substr($data, 0, 5) === '')) !== false) + { + $declaration =& new SimplePie_XML_Declaration_Parser(substr($data, 5, $pos - 5)); + if ($declaration->parse()) + { + $data = substr($data, $pos + 2); + $data = 'version . '" encoding="' . $encoding . '" standalone="' . (($declaration->standalone) ? 'yes' : 'no') . '"?>' . $data; + } + else + { + $this->error_string = 'SimplePie bug! Please report this!'; + return false; + } + } + + $return = true; + + static $xml_is_sane = null; + if ($xml_is_sane === null) + { + $parser_check = xml_parser_create(); + xml_parse_into_struct($parser_check, '&', $values); + xml_parser_free($parser_check); + $xml_is_sane = isset($values[0]['value']); + } + + // Create the parser + if ($xml_is_sane) + { + $xml = xml_parser_create_ns($this->encoding, $this->separator); + xml_parser_set_option($xml, XML_OPTION_SKIP_WHITE, 1); + xml_parser_set_option($xml, XML_OPTION_CASE_FOLDING, 0); + xml_set_object($xml, $this); + xml_set_character_data_handler($xml, 'cdata'); + xml_set_element_handler($xml, 'tag_open', 'tag_close'); + + // Parse! + if (!xml_parse($xml, $data, true)) + { + $this->error_code = xml_get_error_code($xml); + $this->error_string = xml_error_string($this->error_code); + $return = false; + } + $this->current_line = xml_get_current_line_number($xml); + $this->current_column = xml_get_current_column_number($xml); + $this->current_byte = xml_get_current_byte_index($xml); + xml_parser_free($xml); + return $return; + } + else + { + libxml_clear_errors(); + $xml =& new XMLReader(); + $xml->xml($data); + while (@$xml->read()) + { + switch ($xml->nodeType) + { + + case constant('XMLReader::END_ELEMENT'): + if ($xml->namespaceURI !== '') + { + $tagName = "{$xml->namespaceURI}{$this->separator}{$xml->localName}"; + } + else + { + $tagName = $xml->localName; + } + $this->tag_close(null, $tagName); + break; + case constant('XMLReader::ELEMENT'): + $empty = $xml->isEmptyElement; + if ($xml->namespaceURI !== '') + { + $tagName = "{$xml->namespaceURI}{$this->separator}{$xml->localName}"; + } + else + { + $tagName = $xml->localName; + } + $attributes = array(); + while ($xml->moveToNextAttribute()) + { + if ($xml->namespaceURI !== '') + { + $attrName = "{$xml->namespaceURI}{$this->separator}{$xml->localName}"; + } + else + { + $attrName = $xml->localName; + } + $attributes[$attrName] = $xml->value; + } + $this->tag_open(null, $tagName, $attributes); + if ($empty) + { + $this->tag_close(null, $tagName); + } + break; + case constant('XMLReader::TEXT'): + + case constant('XMLReader::CDATA'): + $this->cdata(null, $xml->value); + break; + } + } + if ($error = libxml_get_last_error()) + { + $this->error_code = $error->code; + $this->error_string = $error->message; + $this->current_line = $error->line; + $this->current_column = $error->column; + return false; + } + else + { + return true; + } + } + } + + function get_error_code() + { + return $this->error_code; + } + + function get_error_string() + { + return $this->error_string; + } + + function get_current_line() + { + return $this->current_line; + } + + function get_current_column() + { + return $this->current_column; + } + + function get_current_byte() + { + return $this->current_byte; + } + + function get_data() + { + return $this->data; + } + + function tag_open($parser, $tag, $attributes) + { + list($this->namespace[], $this->element[]) = $this->split_ns($tag); + + $attribs = array(); + foreach ($attributes as $name => $value) + { + list($attrib_namespace, $attribute) = $this->split_ns($name); + $attribs[$attrib_namespace][$attribute] = $value; + } + + if (isset($attribs[SIMPLEPIE_NAMESPACE_XML]['base'])) + { + $this->xml_base[] = SimplePie_Misc::absolutize_url($attribs[SIMPLEPIE_NAMESPACE_XML]['base'], end($this->xml_base)); + $this->xml_base_explicit[] = true; + } + else + { + $this->xml_base[] = end($this->xml_base); + $this->xml_base_explicit[] = end($this->xml_base_explicit); + } + + if (isset($attribs[SIMPLEPIE_NAMESPACE_XML]['lang'])) + { + $this->xml_lang[] = $attribs[SIMPLEPIE_NAMESPACE_XML]['lang']; + } + else + { + $this->xml_lang[] = end($this->xml_lang); + } + + if ($this->current_xhtml_construct >= 0) + { + $this->current_xhtml_construct++; + if (end($this->namespace) === SIMPLEPIE_NAMESPACE_XHTML) + { + $this->data['data'] .= '<' . end($this->element); + if (isset($attribs[''])) + { + foreach ($attribs[''] as $name => $value) + { + $this->data['data'] .= ' ' . $name . '="' . htmlspecialchars($value, ENT_COMPAT, $this->encoding) . '"'; + } + } + $this->data['data'] .= '>'; + } + } + else + { + $this->datas[] =& $this->data; + $this->data =& $this->data['child'][end($this->namespace)][end($this->element)][]; + $this->data = array('data' => '', 'attribs' => $attribs, 'xml_base' => end($this->xml_base), 'xml_base_explicit' => end($this->xml_base_explicit), 'xml_lang' => end($this->xml_lang)); + if ((end($this->namespace) === SIMPLEPIE_NAMESPACE_ATOM_03 && in_array(end($this->element), array('title', 'tagline', 'copyright', 'info', 'summary', 'content')) && isset($attribs['']['mode']) && $attribs['']['mode'] === 'xml') + || (end($this->namespace) === SIMPLEPIE_NAMESPACE_ATOM_10 && in_array(end($this->element), array('rights', 'subtitle', 'summary', 'info', 'title', 'content')) && isset($attribs['']['type']) && $attribs['']['type'] === 'xhtml')) + { + $this->current_xhtml_construct = 0; + } + } + } + + function cdata($parser, $cdata) + { + if ($this->current_xhtml_construct >= 0) + { + $this->data['data'] .= htmlspecialchars($cdata, ENT_QUOTES, $this->encoding); + } + else + { + $this->data['data'] .= $cdata; + } + } + + function tag_close($parser, $tag) + { + if ($this->current_xhtml_construct >= 0) + { + $this->current_xhtml_construct--; + if (end($this->namespace) === SIMPLEPIE_NAMESPACE_XHTML && !in_array(end($this->element), array('area', 'base', 'basefont', 'br', 'col', 'frame', 'hr', 'img', 'input', 'isindex', 'link', 'meta', 'param'))) + { + $this->data['data'] .= 'element) . '>'; + } + } + if ($this->current_xhtml_construct === -1) + { + $this->data =& $this->datas[count($this->datas) - 1]; + array_pop($this->datas); + } + + array_pop($this->element); + array_pop($this->namespace); + array_pop($this->xml_base); + array_pop($this->xml_base_explicit); + array_pop($this->xml_lang); + } + + function split_ns($string) + { + static $cache = array(); + if (!isset($cache[$string])) + { + if ($pos = strpos($string, $this->separator)) + { + static $separator_length; + if (!$separator_length) + { + $separator_length = strlen($this->separator); + } + $namespace = substr($string, 0, $pos); + $local_name = substr($string, $pos + $separator_length); + if (strtolower($namespace) === SIMPLEPIE_NAMESPACE_ITUNES) + { + $namespace = SIMPLEPIE_NAMESPACE_ITUNES; + } + + // Normalize the Media RSS namespaces + if ($namespace === SIMPLEPIE_NAMESPACE_MEDIARSS_WRONG) + { + $namespace = SIMPLEPIE_NAMESPACE_MEDIARSS; + } + $cache[$string] = array($namespace, $local_name); + } + else + { + $cache[$string] = array('', $string); + } + } + return $cache[$string]; + } +} + +/** + * @todo Move to using an actual HTML parser (this will allow tags to be properly stripped, and to switch between HTML and XHTML), this will also make it easier to shorten a string while preserving HTML tags + */ +class SimplePie_Sanitize +{ + // Private vars + var $base; + + // Options + var $remove_div = true; + var $image_handler = ''; + var $strip_htmltags = array('base', 'blink', 'body', 'doctype', 'embed', 'font', 'form', 'frame', 'frameset', 'html', 'iframe', 'input', 'marquee', 'meta', 'noscript', 'object', 'param', 'script', 'style'); + var $encode_instead_of_strip = false; + var $strip_attributes = array('bgsound', 'class', 'expr', 'id', 'style', 'onclick', 'onerror', 'onfinish', 'onmouseover', 'onmouseout', 'onfocus', 'onblur', 'lowsrc', 'dynsrc'); + var $strip_comments = false; + var $output_encoding = 'UTF-8'; + var $enable_cache = true; + var $cache_location = './cache'; + var $cache_name_function = 'md5'; + var $cache_class = 'SimplePie_Cache'; + var $file_class = 'SimplePie_File'; + var $timeout = 10; + var $useragent = ''; + var $force_fsockopen = false; + + var $replace_url_attributes = array( + 'a' => 'href', + 'area' => 'href', + 'blockquote' => 'cite', + 'del' => 'cite', + 'form' => 'action', + 'img' => array('longdesc', 'src'), + 'input' => 'src', + 'ins' => 'cite', + 'q' => 'cite' + ); + + function remove_div($enable = true) + { + $this->remove_div = (bool) $enable; + } + + function set_image_handler($page = false) + { + if ($page) + { + $this->image_handler = (string) $page; + } + else + { + $this->image_handler = false; + } + } + + function pass_cache_data($enable_cache = true, $cache_location = './cache', $cache_name_function = 'md5', $cache_class = 'SimplePie_Cache') + { + if (isset($enable_cache)) + { + $this->enable_cache = (bool) $enable_cache; + } + + if ($cache_location) + { + $this->cache_location = (string) $cache_location; + } + + if ($cache_name_function) + { + $this->cache_name_function = (string) $cache_name_function; + } + + if ($cache_class) + { + $this->cache_class = (string) $cache_class; + } + } + + function pass_file_data($file_class = 'SimplePie_File', $timeout = 10, $useragent = '', $force_fsockopen = false) + { + if ($file_class) + { + $this->file_class = (string) $file_class; + } + + if ($timeout) + { + $this->timeout = (string) $timeout; + } + + if ($useragent) + { + $this->useragent = (string) $useragent; + } + + if ($force_fsockopen) + { + $this->force_fsockopen = (string) $force_fsockopen; + } + } + + function strip_htmltags($tags = array('base', 'blink', 'body', 'doctype', 'embed', 'font', 'form', 'frame', 'frameset', 'html', 'iframe', 'input', 'marquee', 'meta', 'noscript', 'object', 'param', 'script', 'style')) + { + if ($tags) + { + if (is_array($tags)) + { + $this->strip_htmltags = $tags; + } + else + { + $this->strip_htmltags = explode(',', $tags); + } + } + else + { + $this->strip_htmltags = false; + } + } + + function encode_instead_of_strip($encode = false) + { + $this->encode_instead_of_strip = (bool) $encode; + } + + function strip_attributes($attribs = array('bgsound', 'class', 'expr', 'id', 'style', 'onclick', 'onerror', 'onfinish', 'onmouseover', 'onmouseout', 'onfocus', 'onblur', 'lowsrc', 'dynsrc')) + { + if ($attribs) + { + if (is_array($attribs)) + { + $this->strip_attributes = $attribs; + } + else + { + $this->strip_attributes = explode(',', $attribs); + } + } + else + { + $this->strip_attributes = false; + } + } + + function strip_comments($strip = false) + { + $this->strip_comments = (bool) $strip; + } + + function set_output_encoding($encoding = 'UTF-8') + { + $this->output_encoding = (string) $encoding; + } + + /** + * Set element/attribute key/value pairs of HTML attributes + * containing URLs that need to be resolved relative to the feed + * + * @access public + * @since 1.0 + * @param array $element_attribute Element/attribute key/value pairs + */ + function set_url_replacements($element_attribute = array('a' => 'href', 'area' => 'href', 'blockquote' => 'cite', 'del' => 'cite', 'form' => 'action', 'img' => array('longdesc', 'src'), 'input' => 'src', 'ins' => 'cite', 'q' => 'cite')) + { + $this->replace_url_attributes = (array) $element_attribute; + } + + function sanitize($data, $type, $base = '') + { + $data = trim($data); + if ($data !== '' || $type & SIMPLEPIE_CONSTRUCT_IRI) + { + if ($type & SIMPLEPIE_CONSTRUCT_MAYBE_HTML) + { + if (preg_match('/(&(#(x[0-9a-fA-F]+|[0-9]+)|[a-zA-Z0-9]+)|<\/[A-Za-z][^\x09\x0A\x0B\x0C\x0D\x20\x2F\x3E]*' . SIMPLEPIE_PCRE_HTML_ATTRIBUTE . '>)/', $data)) + { + $type |= SIMPLEPIE_CONSTRUCT_HTML; + } + else + { + $type |= SIMPLEPIE_CONSTRUCT_TEXT; + } + } + + if ($type & SIMPLEPIE_CONSTRUCT_BASE64) + { + $data = base64_decode($data); + } + + if ($type & SIMPLEPIE_CONSTRUCT_XHTML) + { + if ($this->remove_div) + { + $data = preg_replace('/^/', '', $data); + $data = preg_replace('/<\/div>$/', '', $data); + } + else + { + $data = preg_replace('/^/', '
              ', $data); + } + } + + if ($type & (SIMPLEPIE_CONSTRUCT_HTML | SIMPLEPIE_CONSTRUCT_XHTML)) + { + // Strip comments + if ($this->strip_comments) + { + $data = SimplePie_Misc::strip_comments($data); + } + + // Strip out HTML tags and attributes that might cause various security problems. + // Based on recommendations by Mark Pilgrim at: + // http://diveintomark.org/archives/2003/06/12/how_to_consume_rss_safely + if ($this->strip_htmltags) + { + foreach ($this->strip_htmltags as $tag) + { + $pcre = "/<($tag)" . SIMPLEPIE_PCRE_HTML_ATTRIBUTE . "(>(.*)<\/$tag" . SIMPLEPIE_PCRE_HTML_ATTRIBUTE . '>|(\/)?>)/siU'; + while (preg_match($pcre, $data)) + { + $data = preg_replace_callback($pcre, array(&$this, 'do_strip_htmltags'), $data); + } + } + } + + if ($this->strip_attributes) + { + foreach ($this->strip_attributes as $attrib) + { + $data = preg_replace('/(<[A-Za-z][^\x09\x0A\x0B\x0C\x0D\x20\x2F\x3E]*)' . SIMPLEPIE_PCRE_HTML_ATTRIBUTE . trim($attrib) . '(?:\s*=\s*(?:"(?:[^"]*)"|\'(?:[^\']*)\'|(?:[^\x09\x0A\x0B\x0C\x0D\x20\x22\x27\x3E][^\x09\x0A\x0B\x0C\x0D\x20\x3E]*)?))?' . SIMPLEPIE_PCRE_HTML_ATTRIBUTE . '>/', '\1\2\3>', $data); + } + } + + // Replace relative URLs + $this->base = $base; + foreach ($this->replace_url_attributes as $element => $attributes) + { + $data = $this->replace_urls($data, $element, $attributes); + } + + // If image handling (caching, etc.) is enabled, cache and rewrite all the image tags. + if (isset($this->image_handler) && ((string) $this->image_handler) !== '' && $this->enable_cache) + { + $images = SimplePie_Misc::get_element('img', $data); + foreach ($images as $img) + { + if (isset($img['attribs']['src']['data'])) + { + $image_url = call_user_func($this->cache_name_function, $img['attribs']['src']['data']); + $cache = call_user_func(array($this->cache_class, 'create'), $this->cache_location, $image_url, 'spi'); + + if ($cache->load()) + { + $img['attribs']['src']['data'] = $this->image_handler . $image_url; + $data = str_replace($img['full'], SimplePie_Misc::element_implode($img), $data); + } + else + { + $file =& new $this->file_class($img['attribs']['src']['data'], $this->timeout, 5, array('X-FORWARDED-FOR' => $_SERVER['REMOTE_ADDR']), $this->useragent, $this->force_fsockopen); + $headers = $file->headers; + + if ($file->success && ($file->method & SIMPLEPIE_FILE_SOURCE_REMOTE === 0 || ($file->status_code === 200 || $file->status_code > 206 && $file->status_code < 300))) + { + if ($cache->save(array('headers' => $file->headers, 'body' => $file->body))) + { + $img['attribs']['src']['data'] = $this->image_handler . $image_url; + $data = str_replace($img['full'], SimplePie_Misc::element_implode($img), $data); + } + else + { + trigger_error("$this->cache_location is not writeable", E_USER_WARNING); + } + } + } + } + } + } + + // Having (possibly) taken stuff out, there may now be whitespace at the beginning/end of the data + $data = trim($data); + } + + if ($type & SIMPLEPIE_CONSTRUCT_IRI) + { + $data = SimplePie_Misc::absolutize_url($data, $base); + } + + if ($type & (SIMPLEPIE_CONSTRUCT_TEXT | SIMPLEPIE_CONSTRUCT_IRI)) + { + $data = htmlspecialchars($data, ENT_COMPAT, 'UTF-8'); + } + + if ($this->output_encoding !== 'UTF-8') + { + $data = SimplePie_Misc::change_encoding($data, 'UTF-8', $this->output_encoding); + } + } + return $data; + } + + function replace_urls($data, $tag, $attributes) + { + if (!is_array($this->strip_htmltags) || !in_array($tag, $this->strip_htmltags)) + { + $elements = SimplePie_Misc::get_element($tag, $data); + foreach ($elements as $element) + { + if (is_array($attributes)) + { + foreach ($attributes as $attribute) + { + if (isset($element['attribs'][$attribute]['data'])) + { + $element['attribs'][$attribute]['data'] = SimplePie_Misc::absolutize_url($element['attribs'][$attribute]['data'], $this->base); + $new_element = SimplePie_Misc::element_implode($element); + $data = str_replace($element['full'], $new_element, $data); + $element['full'] = $new_element; + } + } + } + elseif (isset($element['attribs'][$attributes]['data'])) + { + $element['attribs'][$attributes]['data'] = SimplePie_Misc::absolutize_url($element['attribs'][$attributes]['data'], $this->base); + $data = str_replace($element['full'], SimplePie_Misc::element_implode($element), $data); + } + } + } + return $data; + } + + function do_strip_htmltags($match) + { + if ($this->encode_instead_of_strip) + { + if (isset($match[4]) && !in_array(strtolower($match[1]), array('script', 'style'))) + { + $match[1] = htmlspecialchars($match[1], ENT_COMPAT, 'UTF-8'); + $match[2] = htmlspecialchars($match[2], ENT_COMPAT, 'UTF-8'); + return "<$match[1]$match[2]>$match[3]</$match[1]>"; + } + else + { + return htmlspecialchars($match[0], ENT_COMPAT, 'UTF-8'); + } + } + elseif (isset($match[4]) && !in_array(strtolower($match[1]), array('script', 'style'))) + { + return $match[4]; + } + else + { + return ''; + } + } +} +endif; +?> diff --git a/src/wp-includes/class-smtp.php b/src/wp-includes/class-smtp.php new file mode 100644 index 0000000..c664d97 --- /dev/null +++ b/src/wp-includes/class-smtp.php @@ -0,0 +1,814 @@ +smtp_conn = 0; + $this->error = null; + $this->helo_rply = null; + + $this->do_debug = 0; + } + + ///////////////////////////////////////////////// + // CONNECTION FUNCTIONS + ///////////////////////////////////////////////// + + /** + * Connect to the server specified on the port specified. + * If the port is not specified use the default SMTP_PORT. + * If tval is specified then a connection will try and be + * established with the server for that number of seconds. + * If tval is not specified the default is 30 seconds to + * try on the connection. + * + * SMTP CODE SUCCESS: 220 + * SMTP CODE FAILURE: 421 + * @access public + * @return bool + */ + public function Connect($host, $port = 0, $tval = 30) { + // set the error val to null so there is no confusion + $this->error = null; + + // make sure we are __not__ connected + if($this->connected()) { + // already connected, generate error + $this->error = array("error" => "Already connected to a server"); + return false; + } + + if(empty($port)) { + $port = $this->SMTP_PORT; + } + + // connect to the smtp server + $this->smtp_conn = @fsockopen($host, // the host of the server + $port, // the port to use + $errno, // error number if any + $errstr, // error message if any + $tval); // give up after ? secs + // verify we connected properly + if(empty($this->smtp_conn)) { + $this->error = array("error" => "Failed to connect to server", + "errno" => $errno, + "errstr" => $errstr); + if($this->do_debug >= 1) { + echo "SMTP -> ERROR: " . $this->error["error"] . ": $errstr ($errno)" . $this->CRLF . '
              '; + } + return false; + } + + // SMTP server can take longer to respond, give longer timeout for first read + // Windows does not have support for this timeout function + if(substr(PHP_OS, 0, 3) != "WIN") + socket_set_timeout($this->smtp_conn, $tval, 0); + + // get any announcement + $announce = $this->get_lines(); + + if($this->do_debug >= 2) { + echo "SMTP -> FROM SERVER:" . $announce . $this->CRLF . '
              '; + } + + return true; + } + + /** + * Initiate a TLS communication with the server. + * + * SMTP CODE 220 Ready to start TLS + * SMTP CODE 501 Syntax error (no parameters allowed) + * SMTP CODE 454 TLS not available due to temporary reason + * @access public + * @return bool success + */ + public function StartTLS() { + $this->error = null; # to avoid confusion + + if(!$this->connected()) { + $this->error = array("error" => "Called StartTLS() without being connected"); + return false; + } + + fputs($this->smtp_conn,"STARTTLS" . $this->CRLF); + + $rply = $this->get_lines(); + $code = substr($rply,0,3); + + if($this->do_debug >= 2) { + echo "SMTP -> FROM SERVER:" . $rply . $this->CRLF . '
              '; + } + + if($code != 220) { + $this->error = + array("error" => "STARTTLS not accepted from server", + "smtp_code" => $code, + "smtp_msg" => substr($rply,4)); + if($this->do_debug >= 1) { + echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '
              '; + } + return false; + } + + // Begin encrypted connection + if(!stream_socket_enable_crypto($this->smtp_conn, true, STREAM_CRYPTO_METHOD_TLS_CLIENT)) { + return false; + } + + return true; + } + + /** + * Performs SMTP authentication. Must be run after running the + * Hello() method. Returns true if successfully authenticated. + * @access public + * @return bool + */ + public function Authenticate($username, $password) { + // Start authentication + fputs($this->smtp_conn,"AUTH LOGIN" . $this->CRLF); + + $rply = $this->get_lines(); + $code = substr($rply,0,3); + + if($code != 334) { + $this->error = + array("error" => "AUTH not accepted from server", + "smtp_code" => $code, + "smtp_msg" => substr($rply,4)); + if($this->do_debug >= 1) { + echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '
              '; + } + return false; + } + + // Send encoded username + fputs($this->smtp_conn, base64_encode($username) . $this->CRLF); + + $rply = $this->get_lines(); + $code = substr($rply,0,3); + + if($code != 334) { + $this->error = + array("error" => "Username not accepted from server", + "smtp_code" => $code, + "smtp_msg" => substr($rply,4)); + if($this->do_debug >= 1) { + echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '
              '; + } + return false; + } + + // Send encoded password + fputs($this->smtp_conn, base64_encode($password) . $this->CRLF); + + $rply = $this->get_lines(); + $code = substr($rply,0,3); + + if($code != 235) { + $this->error = + array("error" => "Password not accepted from server", + "smtp_code" => $code, + "smtp_msg" => substr($rply,4)); + if($this->do_debug >= 1) { + echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '
              '; + } + return false; + } + + return true; + } + + /** + * Returns true if connected to a server otherwise false + * @access public + * @return bool + */ + public function Connected() { + if(!empty($this->smtp_conn)) { + $sock_status = socket_get_status($this->smtp_conn); + if($sock_status["eof"]) { + // the socket is valid but we are not connected + if($this->do_debug >= 1) { + echo "SMTP -> NOTICE:" . $this->CRLF . "EOF caught while checking if connected"; + } + $this->Close(); + return false; + } + return true; // everything looks good + } + return false; + } + + /** + * Closes the socket and cleans up the state of the class. + * It is not considered good to use this function without + * first trying to use QUIT. + * @access public + * @return void + */ + public function Close() { + $this->error = null; // so there is no confusion + $this->helo_rply = null; + if(!empty($this->smtp_conn)) { + // close the connection and cleanup + fclose($this->smtp_conn); + $this->smtp_conn = 0; + } + } + + ///////////////////////////////////////////////// + // SMTP COMMANDS + ///////////////////////////////////////////////// + + /** + * Issues a data command and sends the msg_data to the server + * finializing the mail transaction. $msg_data is the message + * that is to be send with the headers. Each header needs to be + * on a single line followed by a with the message headers + * and the message body being seperated by and additional . + * + * Implements rfc 821: DATA + * + * SMTP CODE INTERMEDIATE: 354 + * [data] + * . + * SMTP CODE SUCCESS: 250 + * SMTP CODE FAILURE: 552,554,451,452 + * SMTP CODE FAILURE: 451,554 + * SMTP CODE ERROR : 500,501,503,421 + * @access public + * @return bool + */ + public function Data($msg_data) { + $this->error = null; // so no confusion is caused + + if(!$this->connected()) { + $this->error = array( + "error" => "Called Data() without being connected"); + return false; + } + + fputs($this->smtp_conn,"DATA" . $this->CRLF); + + $rply = $this->get_lines(); + $code = substr($rply,0,3); + + if($this->do_debug >= 2) { + echo "SMTP -> FROM SERVER:" . $rply . $this->CRLF . '
              '; + } + + if($code != 354) { + $this->error = + array("error" => "DATA command not accepted from server", + "smtp_code" => $code, + "smtp_msg" => substr($rply,4)); + if($this->do_debug >= 1) { + echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '
              '; + } + return false; + } + + /* the server is ready to accept data! + * according to rfc 821 we should not send more than 1000 + * including the CRLF + * characters on a single line so we will break the data up + * into lines by \r and/or \n then if needed we will break + * each of those into smaller lines to fit within the limit. + * in addition we will be looking for lines that start with + * a period '.' and append and additional period '.' to that + * line. NOTE: this does not count towards limit. + */ + + // normalize the line breaks so we know the explode works + $msg_data = str_replace("\r\n","\n",$msg_data); + $msg_data = str_replace("\r","\n",$msg_data); + $lines = explode("\n",$msg_data); + + /* we need to find a good way to determine is headers are + * in the msg_data or if it is a straight msg body + * currently I am assuming rfc 822 definitions of msg headers + * and if the first field of the first line (':' sperated) + * does not contain a space then it _should_ be a header + * and we can process all lines before a blank "" line as + * headers. + */ + + $field = substr($lines[0],0,strpos($lines[0],":")); + $in_headers = false; + if(!empty($field) && !strstr($field," ")) { + $in_headers = true; + } + + $max_line_length = 998; // used below; set here for ease in change + + while(list(,$line) = @each($lines)) { + $lines_out = null; + if($line == "" && $in_headers) { + $in_headers = false; + } + // ok we need to break this line up into several smaller lines + while(strlen($line) > $max_line_length) { + $pos = strrpos(substr($line,0,$max_line_length)," "); + + // Patch to fix DOS attack + if(!$pos) { + $pos = $max_line_length - 1; + $lines_out[] = substr($line,0,$pos); + $line = substr($line,$pos); + } else { + $lines_out[] = substr($line,0,$pos); + $line = substr($line,$pos + 1); + } + + /* if processing headers add a LWSP-char to the front of new line + * rfc 822 on long msg headers + */ + if($in_headers) { + $line = "\t" . $line; + } + } + $lines_out[] = $line; + + // send the lines to the server + while(list(,$line_out) = @each($lines_out)) { + if(strlen($line_out) > 0) + { + if(substr($line_out, 0, 1) == ".") { + $line_out = "." . $line_out; + } + } + fputs($this->smtp_conn,$line_out . $this->CRLF); + } + } + + // message data has been sent + fputs($this->smtp_conn, $this->CRLF . "." . $this->CRLF); + + $rply = $this->get_lines(); + $code = substr($rply,0,3); + + if($this->do_debug >= 2) { + echo "SMTP -> FROM SERVER:" . $rply . $this->CRLF . '
              '; + } + + if($code != 250) { + $this->error = + array("error" => "DATA not accepted from server", + "smtp_code" => $code, + "smtp_msg" => substr($rply,4)); + if($this->do_debug >= 1) { + echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '
              '; + } + return false; + } + return true; + } + + /** + * Sends the HELO command to the smtp server. + * This makes sure that we and the server are in + * the same known state. + * + * Implements from rfc 821: HELO + * + * SMTP CODE SUCCESS: 250 + * SMTP CODE ERROR : 500, 501, 504, 421 + * @access public + * @return bool + */ + public function Hello($host = '') { + $this->error = null; // so no confusion is caused + + if(!$this->connected()) { + $this->error = array( + "error" => "Called Hello() without being connected"); + return false; + } + + // if hostname for HELO was not specified send default + if(empty($host)) { + // determine appropriate default to send to server + $host = "localhost"; + } + + // Send extended hello first (RFC 2821) + if(!$this->SendHello("EHLO", $host)) { + if(!$this->SendHello("HELO", $host)) { + return false; + } + } + + return true; + } + + /** + * Sends a HELO/EHLO command. + * @access private + * @return bool + */ + private function SendHello($hello, $host) { + fputs($this->smtp_conn, $hello . " " . $host . $this->CRLF); + + $rply = $this->get_lines(); + $code = substr($rply,0,3); + + if($this->do_debug >= 2) { + echo "SMTP -> FROM SERVER: " . $rply . $this->CRLF . '
              '; + } + + if($code != 250) { + $this->error = + array("error" => $hello . " not accepted from server", + "smtp_code" => $code, + "smtp_msg" => substr($rply,4)); + if($this->do_debug >= 1) { + echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '
              '; + } + return false; + } + + $this->helo_rply = $rply; + + return true; + } + + /** + * Starts a mail transaction from the email address specified in + * $from. Returns true if successful or false otherwise. If True + * the mail transaction is started and then one or more Recipient + * commands may be called followed by a Data command. + * + * Implements rfc 821: MAIL FROM: + * + * SMTP CODE SUCCESS: 250 + * SMTP CODE SUCCESS: 552,451,452 + * SMTP CODE SUCCESS: 500,501,421 + * @access public + * @return bool + */ + public function Mail($from) { + $this->error = null; // so no confusion is caused + + if(!$this->connected()) { + $this->error = array( + "error" => "Called Mail() without being connected"); + return false; + } + + $useVerp = ($this->do_verp ? "XVERP" : ""); + fputs($this->smtp_conn,"MAIL FROM:<" . $from . ">" . $useVerp . $this->CRLF); + + $rply = $this->get_lines(); + $code = substr($rply,0,3); + + if($this->do_debug >= 2) { + echo "SMTP -> FROM SERVER:" . $rply . $this->CRLF . '
              '; + } + + if($code != 250) { + $this->error = + array("error" => "MAIL not accepted from server", + "smtp_code" => $code, + "smtp_msg" => substr($rply,4)); + if($this->do_debug >= 1) { + echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '
              '; + } + return false; + } + return true; + } + + /** + * Sends the quit command to the server and then closes the socket + * if there is no error or the $close_on_error argument is true. + * + * Implements from rfc 821: QUIT + * + * SMTP CODE SUCCESS: 221 + * SMTP CODE ERROR : 500 + * @access public + * @return bool + */ + public function Quit($close_on_error = true) { + $this->error = null; // so there is no confusion + + if(!$this->connected()) { + $this->error = array( + "error" => "Called Quit() without being connected"); + return false; + } + + // send the quit command to the server + fputs($this->smtp_conn,"quit" . $this->CRLF); + + // get any good-bye messages + $byemsg = $this->get_lines(); + + if($this->do_debug >= 2) { + echo "SMTP -> FROM SERVER:" . $byemsg . $this->CRLF . '
              '; + } + + $rval = true; + $e = null; + + $code = substr($byemsg,0,3); + if($code != 221) { + // use e as a tmp var cause Close will overwrite $this->error + $e = array("error" => "SMTP server rejected quit command", + "smtp_code" => $code, + "smtp_rply" => substr($byemsg,4)); + $rval = false; + if($this->do_debug >= 1) { + echo "SMTP -> ERROR: " . $e["error"] . ": " . $byemsg . $this->CRLF . '
              '; + } + } + + if(empty($e) || $close_on_error) { + $this->Close(); + } + + return $rval; + } + + /** + * Sends the command RCPT to the SMTP server with the TO: argument of $to. + * Returns true if the recipient was accepted false if it was rejected. + * + * Implements from rfc 821: RCPT TO: + * + * SMTP CODE SUCCESS: 250,251 + * SMTP CODE FAILURE: 550,551,552,553,450,451,452 + * SMTP CODE ERROR : 500,501,503,421 + * @access public + * @return bool + */ + public function Recipient($to) { + $this->error = null; // so no confusion is caused + + if(!$this->connected()) { + $this->error = array( + "error" => "Called Recipient() without being connected"); + return false; + } + + fputs($this->smtp_conn,"RCPT TO:<" . $to . ">" . $this->CRLF); + + $rply = $this->get_lines(); + $code = substr($rply,0,3); + + if($this->do_debug >= 2) { + echo "SMTP -> FROM SERVER:" . $rply . $this->CRLF . '
              '; + } + + if($code != 250 && $code != 251) { + $this->error = + array("error" => "RCPT not accepted from server", + "smtp_code" => $code, + "smtp_msg" => substr($rply,4)); + if($this->do_debug >= 1) { + echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '
              '; + } + return false; + } + return true; + } + + /** + * Sends the RSET command to abort and transaction that is + * currently in progress. Returns true if successful false + * otherwise. + * + * Implements rfc 821: RSET + * + * SMTP CODE SUCCESS: 250 + * SMTP CODE ERROR : 500,501,504,421 + * @access public + * @return bool + */ + public function Reset() { + $this->error = null; // so no confusion is caused + + if(!$this->connected()) { + $this->error = array( + "error" => "Called Reset() without being connected"); + return false; + } + + fputs($this->smtp_conn,"RSET" . $this->CRLF); + + $rply = $this->get_lines(); + $code = substr($rply,0,3); + + if($this->do_debug >= 2) { + echo "SMTP -> FROM SERVER:" . $rply . $this->CRLF . '
              '; + } + + if($code != 250) { + $this->error = + array("error" => "RSET failed", + "smtp_code" => $code, + "smtp_msg" => substr($rply,4)); + if($this->do_debug >= 1) { + echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '
              '; + } + return false; + } + + return true; + } + + /** + * Starts a mail transaction from the email address specified in + * $from. Returns true if successful or false otherwise. If True + * the mail transaction is started and then one or more Recipient + * commands may be called followed by a Data command. This command + * will send the message to the users terminal if they are logged + * in and send them an email. + * + * Implements rfc 821: SAML FROM: + * + * SMTP CODE SUCCESS: 250 + * SMTP CODE SUCCESS: 552,451,452 + * SMTP CODE SUCCESS: 500,501,502,421 + * @access public + * @return bool + */ + public function SendAndMail($from) { + $this->error = null; // so no confusion is caused + + if(!$this->connected()) { + $this->error = array( + "error" => "Called SendAndMail() without being connected"); + return false; + } + + fputs($this->smtp_conn,"SAML FROM:" . $from . $this->CRLF); + + $rply = $this->get_lines(); + $code = substr($rply,0,3); + + if($this->do_debug >= 2) { + echo "SMTP -> FROM SERVER:" . $rply . $this->CRLF . '
              '; + } + + if($code != 250) { + $this->error = + array("error" => "SAML not accepted from server", + "smtp_code" => $code, + "smtp_msg" => substr($rply,4)); + if($this->do_debug >= 1) { + echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '
              '; + } + return false; + } + return true; + } + + /** + * This is an optional command for SMTP that this class does not + * support. This method is here to make the RFC821 Definition + * complete for this class and __may__ be implimented in the future + * + * Implements from rfc 821: TURN + * + * SMTP CODE SUCCESS: 250 + * SMTP CODE FAILURE: 502 + * SMTP CODE ERROR : 500, 503 + * @access public + * @return bool + */ + public function Turn() { + $this->error = array("error" => "This method, TURN, of the SMTP ". + "is not implemented"); + if($this->do_debug >= 1) { + echo "SMTP -> NOTICE: " . $this->error["error"] . $this->CRLF . '
              '; + } + return false; + } + + /** + * Get the current error + * @access public + * @return array + */ + public function getError() { + return $this->error; + } + + ///////////////////////////////////////////////// + // INTERNAL FUNCTIONS + ///////////////////////////////////////////////// + + /** + * Read in as many lines as possible + * either before eof or socket timeout occurs on the operation. + * With SMTP we can tell if we have more lines to read if the + * 4th character is '-' symbol. If it is a space then we don't + * need to read anything else. + * @access private + * @return string + */ + private function get_lines() { + $data = ""; + while($str = @fgets($this->smtp_conn,515)) { + if($this->do_debug >= 4) { + echo "SMTP -> get_lines(): \$data was \"$data\"" . $this->CRLF . '
              '; + echo "SMTP -> get_lines(): \$str is \"$str\"" . $this->CRLF . '
              '; + } + $data .= $str; + if($this->do_debug >= 4) { + echo "SMTP -> get_lines(): \$data is \"$data\"" . $this->CRLF . '
              '; + } + // if 4th character is a space, we are done reading, break the loop + if(substr($str,3,1) == " ") { break; } + } + return $data; + } + +} + +?> \ No newline at end of file diff --git a/src/wp-includes/class-snoopy.php b/src/wp-includes/class-snoopy.php new file mode 100644 index 0000000..66ff71f --- /dev/null +++ b/src/wp-includes/class-snoopy.php @@ -0,0 +1,1256 @@ + +Copyright (c): 1999-2008 New Digital Group, all rights reserved +Version: 1.2.4 + + * 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@ohrt.com + +The latest version of Snoopy can be obtained from: +http://snoopy.sourceforge.net/ + +*************************************************/ + +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.4"; // 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 = 500000; // 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), + chr(0xE4), // ANSI ä + chr(0xF6), // ANSI ö + chr(0xFC), // ANSI ü + chr(0xC4), // ANSI Ä + chr(0xD6), // ANSI Ö + chr(0xDC), // ANSI Ü + chr(0xDF), // ANSI ß + ); + + $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"); + + exec($this->curl_path." -k -D \"$headerfile\"".$cmdline_params." \"".escapeshellcmd($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"); + $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; +?> diff --git a/src/wp-includes/class-wp-admin-bar.php b/src/wp-includes/class-wp-admin-bar.php new file mode 100644 index 0000000..7db0fa2 --- /dev/null +++ b/src/wp-includes/class-wp-admin-bar.php @@ -0,0 +1,237 @@ +proto = 'https://'; + + $this->user = new stdClass; + $this->menu = new stdClass; + + /* Populate settings we need for the menu based on the current user. */ + $this->user->blogs = get_blogs_of_user( get_current_user_id() ); + if ( is_multisite() ) { + $this->user->active_blog = get_active_blog_for_user( get_current_user_id() ); + $this->user->domain = empty( $this->user->active_blog ) ? user_admin_url() : trailingslashit( get_home_url( $this->user->active_blog->blog_id ) ); + $this->user->account_domain = $this->user->domain; + } else { + $this->user->active_blog = $this->user->blogs[get_current_blog_id()]; + $this->user->domain = trailingslashit( home_url() ); + $this->user->account_domain = $this->user->domain; + } + $this->user->locale = get_locale(); + + add_action( 'wp_head', 'wp_admin_bar_header' ); + + add_action( 'admin_head', 'wp_admin_bar_header' ); + + if ( current_theme_supports( 'admin-bar' ) ) { + $admin_bar_args = get_theme_support( 'admin-bar' ); // add_theme_support( 'admin-bar', array( 'callback' => '__return_false') ); + $header_callback = $admin_bar_args[0]['callback']; + } + + if ( empty($header_callback) ) + $header_callback = '_admin_bar_bump_cb'; + + add_action('wp_head', $header_callback); + + wp_enqueue_script( 'admin-bar' ); + wp_enqueue_style( 'admin-bar' ); + + do_action( 'admin_bar_init' ); + } + + function add_menu( $args = array() ) { + $defaults = array( + 'title' => false, + 'href' => false, + 'parent' => false, // false for a root menu, pass the ID value for a submenu of that menu. + 'id' => false, // defaults to a sanitized title value. + 'meta' => false // array of any of the following options: array( 'html' => '', 'class' => '', 'onclick' => '', target => '', title => '' ); + ); + + $r = wp_parse_args( $args, $defaults ); + extract( $r, EXTR_SKIP ); + + if ( empty( $title ) ) + return false; + + /* Make sure we have a valid ID */ + if ( empty( $id ) ) + $id = esc_attr( sanitize_title( trim( $title ) ) ); + + if ( ! empty( $parent ) ) { + /* Add the menu to the parent item */ + $child = array( 'id' => $id, 'title' => $title, 'href' => $href ); + + if ( ! empty( $meta ) ) + $child['meta'] = $meta; + + $this->add_node( $parent, $this->menu, $child ); + } else { + /* Add the menu item */ + $this->menu->{$id} = array( 'title' => $title, 'href' => $href ); + + if ( ! empty( $meta ) ) + $this->menu->{$id}['meta'] = $meta; + } + } + + function remove_menu( $id ) { + return $this->remove_node( $id, $this->menu ); + } + + function render() { + ?> +
              + + +
              +
              + + +
              +
              +
              + + menu = null; + } + + /* Helpers */ + function recursive_render( $id, &$menu_item ) { ?> + + +
            • " class=""> + onclick="" target="" title=""> + + +
                + $child_menu_item ) : ?> + recursive_render( $child_id, $child_menu_item ); ?> + +
              + + + + + +
            • $menu_item ) { + if ( $parent_id == $id ) { + $menu->{$parent_id}['children']->{$child['id']} = $child; + $child = null; + return true; + } + + if ( ! empty( $menu->{$id}['children'] ) ) + $this->add_node( $parent_id, $menu->{$id}['children'], $child ); + } + + $child = null; + + return false; + } + + function add_menus() { + add_action( 'admin_bar_menu', 'wp_admin_bar_my_account_menu', 10 ); + add_action( 'admin_bar_menu', 'wp_admin_bar_my_sites_menu', 20 ); + add_action( 'admin_bar_menu', 'wp_admin_bar_dashboard_view_site_menu', 25 ); + add_action( 'admin_bar_menu', 'wp_admin_bar_edit_menu', 30 ); + add_action( 'admin_bar_menu', 'wp_admin_bar_shortlink_menu', 80 ); + add_action( 'admin_bar_menu', 'wp_admin_bar_updates_menu', 70 ); + + if ( !is_network_admin() && !is_user_admin() ) { + add_action( 'admin_bar_menu', 'wp_admin_bar_new_content_menu', 40 ); + add_action( 'admin_bar_menu', 'wp_admin_bar_comments_menu', 50 ); + add_action( 'admin_bar_menu', 'wp_admin_bar_appearance_menu', 60 ); + } + + do_action( 'add_admin_bar_menus' ); + } + + function remove_node( $id, &$menu ) { + if ( isset( $menu->$id ) ) { + unset( $menu->$id ); + return true; + } + + foreach( $menu as $menu_item_id => $menu_item ) { + if ( ! empty( $menu->{$menu_item_id}['children'] ) ) + $this->remove_node( $id, $menu->{$menu_item_id}['children'] ); + } + + return false; + } + + // TODO: Convert to a core feature for multisite or remove + function load_user_locale_translations() { + $this->need_to_change_locale = ( get_locale() != $this->user->locale ); + if ( ! $this->need_to_change_locale ) + return; + /* + $this->previous_translations = get_translations_for_domain( 'default' ); + $this->adminbar_locale_filter = lambda( '$_', '$GLOBALS["wp_admin_bar"]->user->locale;' ); + unload_textdomain( 'default' ); + add_filter( 'locale', $this->adminbar_locale_filter ); + load_default_textdomain(); + $this->changed_locale = true; + */ + } + + function unload_user_locale_translations() { + global $l10n; + if ( ! $this->changed_locale ) + return; + /* + remove_filter( 'locale', $this->adminbar_locale_filter ); + $l10n['default'] = &$this->previous_translations; + */ + } +} +?> diff --git a/src/wp-includes/class-wp-ajax-response.php b/src/wp-includes/class-wp-ajax-response.php new file mode 100644 index 0000000..9c225c1 --- /dev/null +++ b/src/wp-includes/class-wp-ajax-response.php @@ -0,0 +1,138 @@ +add($args); + } + + /** + * Append to XML response based on given arguments. + * + * The arguments that can be passed in the $args parameter are below. It is + * also possible to pass a WP_Error object in either the 'id' or 'data' + * argument. The parameter isn't actually optional, content should be given + * in order to send the correct response. + * + * 'what' argument is a string that is the XMLRPC response type. + * 'action' argument is a boolean or string that acts like a nonce. + * 'id' argument can be WP_Error or an integer. + * 'old_id' argument is false by default or an integer of the previous ID. + * 'position' argument is an integer or a string with -1 = top, 1 = bottom, + * html ID = after, -html ID = before. + * 'data' argument is a string with the content or message. + * 'supplemental' argument is an array of strings that will be children of + * the supplemental element. + * + * @since 2.1.0 + * + * @param string|array $args Override defaults. + * @return string XML response. + */ + function add( $args = '' ) { + $defaults = array( + 'what' => 'object', 'action' => false, + 'id' => '0', 'old_id' => false, + 'position' => 1, + 'data' => '', 'supplemental' => array() + ); + + $r = wp_parse_args( $args, $defaults ); + extract( $r, EXTR_SKIP ); + $position = preg_replace( '/[^a-z0-9:_-]/i', '', $position ); + + if ( is_wp_error($id) ) { + $data = $id; + $id = 0; + } + + $response = ''; + if ( is_wp_error($data) ) { + foreach ( (array) $data->get_error_codes() as $code ) { + $response .= "get_error_message($code) . "]]>"; + if ( !$error_data = $data->get_error_data($code) ) + continue; + $class = ''; + if ( is_object($error_data) ) { + $class = ' class="' . get_class($error_data) . '"'; + $error_data = get_object_vars($error_data); + } + + $response .= ""; + + if ( is_scalar($error_data) ) { + $response .= ""; + } elseif ( is_array($error_data) ) { + foreach ( $error_data as $k => $v ) + $response .= "<$k>"; + } + + $response .= ""; + } + } else { + $response = ""; + } + + $s = ''; + if ( is_array($supplemental) ) { + foreach ( $supplemental as $k => $v ) + $s .= "<$k>"; + $s = "$s"; + } + + if ( false === $action ) + $action = $_POST['action']; + + $x = ''; + $x .= ""; // The action attribute in the xml output is formatted like a nonce action + $x .= "<$what id='$id' " . ( false === $old_id ? '' : "old_id='$old_id' " ) . "position='$position'>"; + $x .= $response; + $x .= $s; + $x .= ""; + $x .= ""; + + $this->responses[] = $x; + return $x; + } + + /** + * Display XML formatted responses. + * + * Sets the content type header to text/xml. + * + * @since 2.1.0 + */ + function send() { + header('Content-Type: text/xml'); + echo ""; + foreach ( (array) $this->responses as $response ) + echo $response; + echo ''; + die(); + } +} + +?> diff --git a/src/wp-includes/class-wp-error.php b/src/wp-includes/class-wp-error.php new file mode 100644 index 0000000..ba4de05 --- /dev/null +++ b/src/wp-includes/class-wp-error.php @@ -0,0 +1,212 @@ +errors[$code][] = $message; + + if ( ! empty($data) ) + $this->error_data[$code] = $data; + } + + /** + * Retrieve all error codes. + * + * @since 2.1.0 + * @access public + * + * @return array List of error codes, if avaiable. + */ + function get_error_codes() { + if ( empty($this->errors) ) + return array(); + + return array_keys($this->errors); + } + + /** + * Retrieve first error code available. + * + * @since 2.1.0 + * @access public + * + * @return string|int Empty string, if no error codes. + */ + function get_error_code() { + $codes = $this->get_error_codes(); + + if ( empty($codes) ) + return ''; + + return $codes[0]; + } + + /** + * Retrieve all error messages or error messages matching code. + * + * @since 2.1.0 + * + * @param string|int $code Optional. Retrieve messages matching code, if exists. + * @return array Error strings on success, or empty array on failure (if using codee parameter). + */ + function get_error_messages($code = '') { + // Return all messages if no code specified. + if ( empty($code) ) { + $all_messages = array(); + foreach ( (array) $this->errors as $code => $messages ) + $all_messages = array_merge($all_messages, $messages); + + return $all_messages; + } + + if ( isset($this->errors[$code]) ) + return $this->errors[$code]; + else + return array(); + } + + /** + * Get single error message. + * + * This will get the first message available for the code. If no code is + * given then the first code available will be used. + * + * @since 2.1.0 + * + * @param string|int $code Optional. Error code to retrieve message. + * @return string + */ + function get_error_message($code = '') { + if ( empty($code) ) + $code = $this->get_error_code(); + $messages = $this->get_error_messages($code); + if ( empty($messages) ) + return ''; + return $messages[0]; + } + + /** + * Retrieve error data for error code. + * + * @since 2.1.0 + * + * @param string|int $code Optional. Error code. + * @return mixed Null, if no errors. + */ + function get_error_data($code = '') { + if ( empty($code) ) + $code = $this->get_error_code(); + + if ( isset($this->error_data[$code]) ) + return $this->error_data[$code]; + return null; + } + + /** + * Append more error messages to list of error messages. + * + * @since 2.1.0 + * @access public + * + * @param string|int $code Error code. + * @param string $message Error message. + * @param mixed $data Optional. Error data. + */ + function add($code, $message, $data = '') { + $this->errors[$code][] = $message; + if ( ! empty($data) ) + $this->error_data[$code] = $data; + } + + /** + * Add data for error code. + * + * The error code can only contain one error data. + * + * @since 2.1.0 + * + * @param mixed $data Error data. + * @param string|int $code Error code. + */ + function add_data($data, $code = '') { + if ( empty($code) ) + $code = $this->get_error_code(); + + $this->error_data[$code] = $data; + } +} + +/** + * Check whether variable is a WordPress Error. + * + * Looks at the object and if a WP_Error class. Does not check to see if the + * parent is also WP_Error, so can't inherit WP_Error and still use this + * function. + * + * @since 2.1.0 + * + * @param mixed $thing Check if unknown variable is WordPress Error object. + * @return bool True, if WP_Error. False, if not WP_Error. + */ +function is_wp_error($thing) { + if ( is_object($thing) && is_a($thing, 'WP_Error') ) + return true; + return false; +} + +?> \ No newline at end of file diff --git a/src/wp-includes/class-wp-http-ixr-client.php b/src/wp-includes/class-wp-http-ixr-client.php new file mode 100644 index 0000000..9e202ed --- /dev/null +++ b/src/wp-includes/class-wp-http-ixr-client.php @@ -0,0 +1,93 @@ +scheme = $bits['scheme']; + $this->server = $bits['host']; + $this->port = isset($bits['port']) ? $bits['port'] : $port; + $this->path = !empty($bits['path']) ? $bits['path'] : '/'; + + // Make absolutely sure we have a path + if ( ! $this->path ) + $this->path = '/'; + } else { + $this->scheme = 'http'; + $this->server = $server; + $this->path = $path; + $this->port = $port; + } + $this->useragent = 'The Incutio XML-RPC PHP Library'; + $this->timeout = $timeout; + } + + function query() { + $args = func_get_args(); + $method = array_shift($args); + $request = new IXR_Request($method, $args); + $xml = $request->getXml(); + + $port = $this->port ? ":$this->port" : ''; + $url = $this->scheme . '://' . $this->server . $port . $this->path; + $args = array( + 'headers' => array('Content-Type' => 'text/xml'), + 'user-agent' => $this->useragent, + 'body' => $xml, + ); + + // Merge Custom headers ala #8145 + foreach ( $this->headers as $header => $value ) + $args['headers'][$header] = $value; + + if ( $this->timeout !== false ) + $args['timeout'] = $this->timeout; + + // Now send the request + if ( $this->debug ) + echo '
              ' . htmlspecialchars($xml) . "\n
              \n\n"; + + $response = wp_remote_post($url, $args); + + if ( is_wp_error($response) ) { + $errno = $response->get_error_code(); + $errorstr = $response->get_error_message(); + $this->error = new IXR_Error(-32300, "transport error: $errno $errorstr"); + return false; + } + + if ( 200 != wp_remote_retrieve_response_code( $response ) ) { + $this->error = new IXR_Error(-32301, 'transport error - HTTP status code was not 200 (' . wp_remote_retrieve_response_code( $response ) . ')'); + return false; + } + + if ( $this->debug ) + echo '
              ' . htmlspecialchars( wp_remote_retrieve_body( $response ) ) . "\n
              \n\n"; + + // Now parse what we've got back + $this->message = new IXR_Message( wp_remote_retrieve_body( $response ) ); + 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; + } +} +?> diff --git a/src/wp-includes/class-wp-walker.php b/src/wp-includes/class-wp-walker.php new file mode 100644 index 0000000..25e0405 --- /dev/null +++ b/src/wp-includes/class-wp-walker.php @@ -0,0 +1,399 @@ +db_fields['id']; + + //display this element + if ( is_array( $args[0] ) ) + $args[0]['has_children'] = ! empty( $children_elements[$element->$id_field] ); + $cb_args = array_merge( array(&$output, $element, $depth), $args); + call_user_func_array(array(&$this, 'start_el'), $cb_args); + + $id = $element->$id_field; + + // descend only when the depth is right and there are childrens for this element + if ( ($max_depth == 0 || $max_depth > $depth+1 ) && isset( $children_elements[$id]) ) { + + foreach( $children_elements[ $id ] as $child ){ + + if ( !isset($newlevel) ) { + $newlevel = true; + //start the child delimiter + $cb_args = array_merge( array(&$output, $depth), $args); + call_user_func_array(array(&$this, 'start_lvl'), $cb_args); + } + $this->display_element( $child, $children_elements, $max_depth, $depth + 1, $args, $output ); + } + unset( $children_elements[ $id ] ); + } + + if ( isset($newlevel) && $newlevel ){ + //end the child delimiter + $cb_args = array_merge( array(&$output, $depth), $args); + call_user_func_array(array(&$this, 'end_lvl'), $cb_args); + } + + //end this element + $cb_args = array_merge( array(&$output, $element, $depth), $args); + call_user_func_array(array(&$this, 'end_el'), $cb_args); + } + + /** + * Display array of elements hierarchically. + * + * It is a generic function which does not assume any existing order of + * elements. max_depth = -1 means flatly display every element. max_depth = + * 0 means display all levels. max_depth > 0 specifies the number of + * display levels. + * + * @since 2.1.0 + * + * @param array $elements + * @param int $max_depth + * @return string + */ + function walk( $elements, $max_depth) { + + $args = array_slice(func_get_args(), 2); + $output = ''; + + if ($max_depth < -1) //invalid parameter + return $output; + + if (empty($elements)) //nothing to walk + return $output; + + $id_field = $this->db_fields['id']; + $parent_field = $this->db_fields['parent']; + + // flat display + if ( -1 == $max_depth ) { + $empty_array = array(); + foreach ( $elements as $e ) + $this->display_element( $e, $empty_array, 1, 0, $args, $output ); + return $output; + } + + /* + * need to display in hierarchical order + * separate elements into two buckets: top level and children elements + * children_elements is two dimensional array, eg. + * children_elements[10][] contains all sub-elements whose parent is 10. + */ + $top_level_elements = array(); + $children_elements = array(); + foreach ( $elements as $e) { + if ( 0 == $e->$parent_field ) + $top_level_elements[] = $e; + else + $children_elements[ $e->$parent_field ][] = $e; + } + + /* + * when none of the elements is top level + * assume the first one must be root of the sub elements + */ + if ( empty($top_level_elements) ) { + + $first = array_slice( $elements, 0, 1 ); + $root = $first[0]; + + $top_level_elements = array(); + $children_elements = array(); + foreach ( $elements as $e) { + if ( $root->$parent_field == $e->$parent_field ) + $top_level_elements[] = $e; + else + $children_elements[ $e->$parent_field ][] = $e; + } + } + + foreach ( $top_level_elements as $e ) + $this->display_element( $e, $children_elements, $max_depth, 0, $args, $output ); + + /* + * if we are displaying all levels, and remaining children_elements is not empty, + * then we got orphans, which should be displayed regardless + */ + if ( ( $max_depth == 0 ) && count( $children_elements ) > 0 ) { + $empty_array = array(); + foreach ( $children_elements as $orphans ) + foreach( $orphans as $op ) + $this->display_element( $op, $empty_array, 1, 0, $args, $output ); + } + + return $output; + } + + /** + * paged_walk() - produce a page of nested elements + * + * Given an array of hierarchical elements, the maximum depth, a specific page number, + * and number of elements per page, this function first determines all top level root elements + * belonging to that page, then lists them and all of their children in hierarchical order. + * + * @package WordPress + * @since 2.7 + * @param int $max_depth = 0 means display all levels; $max_depth > 0 specifies the number of display levels. + * @param int $page_num the specific page number, beginning with 1. + * @return XHTML of the specified page of elements + */ + function paged_walk( $elements, $max_depth, $page_num, $per_page ) { + + /* sanity check */ + if ( empty($elements) || $max_depth < -1 ) + return ''; + + $args = array_slice( func_get_args(), 4 ); + $output = ''; + + $id_field = $this->db_fields['id']; + $parent_field = $this->db_fields['parent']; + + $count = -1; + if ( -1 == $max_depth ) + $total_top = count( $elements ); + if ( $page_num < 1 || $per_page < 0 ) { + // No paging + $paging = false; + $start = 0; + if ( -1 == $max_depth ) + $end = $total_top; + $this->max_pages = 1; + } else { + $paging = true; + $start = ( (int)$page_num - 1 ) * (int)$per_page; + $end = $start + $per_page; + if ( -1 == $max_depth ) + $this->max_pages = ceil($total_top / $per_page); + } + + // flat display + if ( -1 == $max_depth ) { + if ( !empty($args[0]['reverse_top_level']) ) { + $elements = array_reverse( $elements ); + $oldstart = $start; + $start = $total_top - $end; + $end = $total_top - $oldstart; + } + + $empty_array = array(); + foreach ( $elements as $e ) { + $count++; + if ( $count < $start ) + continue; + if ( $count >= $end ) + break; + $this->display_element( $e, $empty_array, 1, 0, $args, $output ); + } + return $output; + } + + /* + * separate elements into two buckets: top level and children elements + * children_elements is two dimensional array, eg. + * children_elements[10][] contains all sub-elements whose parent is 10. + */ + $top_level_elements = array(); + $children_elements = array(); + foreach ( $elements as $e) { + if ( 0 == $e->$parent_field ) + $top_level_elements[] = $e; + else + $children_elements[ $e->$parent_field ][] = $e; + } + + $total_top = count( $top_level_elements ); + if ( $paging ) + $this->max_pages = ceil($total_top / $per_page); + else + $end = $total_top; + + if ( !empty($args[0]['reverse_top_level']) ) { + $top_level_elements = array_reverse( $top_level_elements ); + $oldstart = $start; + $start = $total_top - $end; + $end = $total_top - $oldstart; + } + if ( !empty($args[0]['reverse_children']) ) { + foreach ( $children_elements as $parent => $children ) + $children_elements[$parent] = array_reverse( $children ); + } + + foreach ( $top_level_elements as $e ) { + $count++; + + //for the last page, need to unset earlier children in order to keep track of orphans + if ( $end >= $total_top && $count < $start ) + $this->unset_children( $e, $children_elements ); + + if ( $count < $start ) + continue; + + if ( $count >= $end ) + break; + + $this->display_element( $e, $children_elements, $max_depth, 0, $args, $output ); + } + + if ( $end >= $total_top && count( $children_elements ) > 0 ) { + $empty_array = array(); + foreach ( $children_elements as $orphans ) + foreach( $orphans as $op ) + $this->display_element( $op, $empty_array, 1, 0, $args, $output ); + } + + return $output; + } + + function get_number_of_root_elements( $elements ){ + + $num = 0; + $parent_field = $this->db_fields['parent']; + + foreach ( $elements as $e) { + if ( 0 == $e->$parent_field ) + $num++; + } + return $num; + } + + // unset all the children for a given top level element + function unset_children( $e, &$children_elements ){ + + if ( !$e || !$children_elements ) + return; + + $id_field = $this->db_fields['id']; + $id = $e->$id_field; + + if ( !empty($children_elements[$id]) && is_array($children_elements[$id]) ) + foreach ( (array) $children_elements[$id] as $child ) + $this->unset_children( $child, $children_elements ); + + if ( isset($children_elements[$id]) ) + unset( $children_elements[$id] ); + + } +} + +?> \ No newline at end of file diff --git a/src/wp-includes/class-wp-xmlrpc-server.php b/src/wp-includes/class-wp-xmlrpc-server.php new file mode 100644 index 0000000..9d92cec --- /dev/null +++ b/src/wp-includes/class-wp-xmlrpc-server.php @@ -0,0 +1,3615 @@ +methods = array( + // WordPress API + 'wp.getUsersBlogs' => 'this:wp_getUsersBlogs', + 'wp.getPage' => 'this:wp_getPage', + 'wp.getPages' => 'this:wp_getPages', + 'wp.newPage' => 'this:wp_newPage', + 'wp.deletePage' => 'this:wp_deletePage', + 'wp.editPage' => 'this:wp_editPage', + 'wp.getPageList' => 'this:wp_getPageList', + 'wp.getAuthors' => 'this:wp_getAuthors', + 'wp.getCategories' => 'this:mw_getCategories', // Alias + 'wp.getTags' => 'this:wp_getTags', + 'wp.newCategory' => 'this:wp_newCategory', + 'wp.deleteCategory' => 'this:wp_deleteCategory', + 'wp.suggestCategories' => 'this:wp_suggestCategories', + 'wp.uploadFile' => 'this:mw_newMediaObject', // Alias + 'wp.getCommentCount' => 'this:wp_getCommentCount', + 'wp.getPostStatusList' => 'this:wp_getPostStatusList', + 'wp.getPageStatusList' => 'this:wp_getPageStatusList', + 'wp.getPageTemplates' => 'this:wp_getPageTemplates', + 'wp.getOptions' => 'this:wp_getOptions', + 'wp.setOptions' => 'this:wp_setOptions', + 'wp.getComment' => 'this:wp_getComment', + 'wp.getComments' => 'this:wp_getComments', + 'wp.deleteComment' => 'this:wp_deleteComment', + 'wp.editComment' => 'this:wp_editComment', + 'wp.newComment' => 'this:wp_newComment', + 'wp.getCommentStatusList' => 'this:wp_getCommentStatusList', + 'wp.getMediaItem' => 'this:wp_getMediaItem', + 'wp.getMediaLibrary' => 'this:wp_getMediaLibrary', + 'wp.getPostFormats' => 'this:wp_getPostFormats', + + // Blogger API + 'blogger.getUsersBlogs' => 'this:blogger_getUsersBlogs', + 'blogger.getUserInfo' => 'this:blogger_getUserInfo', + 'blogger.getPost' => 'this:blogger_getPost', + 'blogger.getRecentPosts' => 'this:blogger_getRecentPosts', + 'blogger.getTemplate' => 'this:blogger_getTemplate', + 'blogger.setTemplate' => 'this:blogger_setTemplate', + 'blogger.newPost' => 'this:blogger_newPost', + 'blogger.editPost' => 'this:blogger_editPost', + 'blogger.deletePost' => 'this:blogger_deletePost', + + // MetaWeblog API (with MT extensions to structs) + 'metaWeblog.newPost' => 'this:mw_newPost', + 'metaWeblog.editPost' => 'this:mw_editPost', + 'metaWeblog.getPost' => 'this:mw_getPost', + 'metaWeblog.getRecentPosts' => 'this:mw_getRecentPosts', + 'metaWeblog.getCategories' => 'this:mw_getCategories', + 'metaWeblog.newMediaObject' => 'this:mw_newMediaObject', + + // MetaWeblog API aliases for Blogger API + // see http://www.xmlrpc.com/stories/storyReader$2460 + 'metaWeblog.deletePost' => 'this:blogger_deletePost', + 'metaWeblog.getTemplate' => 'this:blogger_getTemplate', + 'metaWeblog.setTemplate' => 'this:blogger_setTemplate', + 'metaWeblog.getUsersBlogs' => 'this:blogger_getUsersBlogs', + + // MovableType API + 'mt.getCategoryList' => 'this:mt_getCategoryList', + 'mt.getRecentPostTitles' => 'this:mt_getRecentPostTitles', + 'mt.getPostCategories' => 'this:mt_getPostCategories', + 'mt.setPostCategories' => 'this:mt_setPostCategories', + 'mt.supportedMethods' => 'this:mt_supportedMethods', + 'mt.supportedTextFilters' => 'this:mt_supportedTextFilters', + 'mt.getTrackbackPings' => 'this:mt_getTrackbackPings', + 'mt.publishPost' => 'this:mt_publishPost', + + // PingBack + 'pingback.ping' => 'this:pingback_ping', + 'pingback.extensions.getPingbacks' => 'this:pingback_extensions_getPingbacks', + + 'demo.sayHello' => 'this:sayHello', + 'demo.addTwoNumbers' => 'this:addTwoNumbers' + ); + + $this->initialise_blog_option_info( ); + $this->methods = apply_filters('xmlrpc_methods', $this->methods); + } + + function serve_request() { + $this->IXR_Server($this->methods); + } + + /** + * Test XMLRPC API by saying, "Hello!" to client. + * + * @since 1.5.0 + * + * @param array $args Method Parameters. + * @return string + */ + function sayHello($args) { + return 'Hello!'; + } + + /** + * Test XMLRPC API by adding two numbers for client. + * + * @since 1.5.0 + * + * @param array $args Method Parameters. + * @return int + */ + function addTwoNumbers($args) { + $number1 = $args[0]; + $number2 = $args[1]; + return $number1 + $number2; + } + + /** + * Check user's credentials. + * + * @since 1.5.0 + * + * @param string $user_login User's username. + * @param string $user_pass User's password. + * @return bool Whether authentication passed. + * @deprecated use wp_xmlrpc_server::login + * @see wp_xmlrpc_server::login + */ + function login_pass_ok($user_login, $user_pass) { + if ( !get_option( 'enable_xmlrpc' ) ) { + $this->error = new IXR_Error( 405, sprintf( __( 'XML-RPC services are disabled on this site. An admin user can enable them at %s'), admin_url('options-writing.php') ) ); + return false; + } + + if (!user_pass_ok($user_login, $user_pass)) { + $this->error = new IXR_Error(403, __('Bad login/pass combination.')); + return false; + } + return true; + } + + /** + * Log user in. + * + * @since 2.8 + * + * @param string $username User's username. + * @param string $password User's password. + * @return mixed WP_User object if authentication passed, false otherwise + */ + function login($username, $password) { + if ( !get_option( 'enable_xmlrpc' ) ) { + $this->error = new IXR_Error( 405, sprintf( __( 'XML-RPC services are disabled on this site. An admin user can enable them at %s'), admin_url('options-writing.php') ) ); + return false; + } + + $user = wp_authenticate($username, $password); + + if (is_wp_error($user)) { + $this->error = new IXR_Error(403, __('Bad login/pass combination.')); + return false; + } + + wp_set_current_user( $user->ID ); + return $user; + } + + /** + * Sanitize string or array of strings for database. + * + * @since 1.5.2 + * + * @param string|array $array Sanitize single string or array of strings. + * @return string|array Type matches $array and sanitized for the database. + */ + function escape(&$array) { + global $wpdb; + + if (!is_array($array)) { + return($wpdb->escape($array)); + } else { + foreach ( (array) $array as $k => $v ) { + if ( is_array($v) ) { + $this->escape($array[$k]); + } else if ( is_object($v) ) { + //skip + } else { + $array[$k] = $wpdb->escape($v); + } + } + } + } + + /** + * Retrieve custom fields for post. + * + * @since 2.5.0 + * + * @param int $post_id Post ID. + * @return array Custom fields, if exist. + */ + function get_custom_fields($post_id) { + $post_id = (int) $post_id; + + $custom_fields = array(); + + foreach ( (array) has_meta($post_id) as $meta ) { + // Don't expose protected fields. + if ( strpos($meta['meta_key'], '_wp_') === 0 ) { + continue; + } + + $custom_fields[] = array( + "id" => $meta['meta_id'], + "key" => $meta['meta_key'], + "value" => $meta['meta_value'] + ); + } + + return $custom_fields; + } + + /** + * Set custom fields for post. + * + * @since 2.5.0 + * + * @param int $post_id Post ID. + * @param array $fields Custom fields. + */ + function set_custom_fields($post_id, $fields) { + $post_id = (int) $post_id; + + foreach ( (array) $fields as $meta ) { + if ( isset($meta['id']) ) { + $meta['id'] = (int) $meta['id']; + + if ( isset($meta['key']) ) { + update_meta($meta['id'], $meta['key'], $meta['value']); + } + else { + delete_meta($meta['id']); + } + } + else { + $_POST['metakeyinput'] = $meta['key']; + $_POST['metavalue'] = $meta['value']; + add_meta($post_id); + } + } + } + + /** + * Set up blog options property. + * + * Passes property through 'xmlrpc_blog_options' filter. + * + * @since 2.6.0 + */ + function initialise_blog_option_info( ) { + global $wp_version; + + $this->blog_options = array( + // Read only options + 'software_name' => array( + 'desc' => __( 'Software Name' ), + 'readonly' => true, + 'value' => 'WordPress' + ), + 'software_version' => array( + 'desc' => __( 'Software Version' ), + 'readonly' => true, + 'value' => $wp_version + ), + 'blog_url' => array( + 'desc' => __( 'Site URL' ), + 'readonly' => true, + 'option' => 'siteurl' + ), + + // Updatable options + 'time_zone' => array( + 'desc' => __( 'Time Zone' ), + 'readonly' => false, + 'option' => 'gmt_offset' + ), + 'blog_title' => array( + 'desc' => __( 'Site Title' ), + 'readonly' => false, + 'option' => 'blogname' + ), + 'blog_tagline' => array( + 'desc' => __( 'Site Tagline' ), + 'readonly' => false, + 'option' => 'blogdescription' + ), + 'date_format' => array( + 'desc' => __( 'Date Format' ), + 'readonly' => false, + 'option' => 'date_format' + ), + 'time_format' => array( + 'desc' => __( 'Time Format' ), + 'readonly' => false, + 'option' => 'time_format' + ), + 'users_can_register' => array( + 'desc' => __( 'Allow new users to sign up' ), + 'readonly' => false, + 'option' => 'users_can_register' + ), + 'thumbnail_size_w' => array( + 'desc' => __( 'Thumbnail Width' ), + 'readonly' => false, + 'option' => 'thumbnail_size_w' + ), + 'thumbnail_size_h' => array( + 'desc' => __( 'Thumbnail Height' ), + 'readonly' => false, + 'option' => 'thumbnail_size_h' + ), + 'thumbnail_crop' => array( + 'desc' => __( 'Crop thumbnail to exact dimensions' ), + 'readonly' => false, + 'option' => 'thumbnail_crop' + ), + 'medium_size_w' => array( + 'desc' => __( 'Medium size image width' ), + 'readonly' => false, + 'option' => 'medium_size_w' + ), + 'medium_size_h' => array( + 'desc' => __( 'Medium size image height' ), + 'readonly' => false, + 'option' => 'medium_size_h' + ), + 'large_size_w' => array( + 'desc' => __( 'Large size image width' ), + 'readonly' => false, + 'option' => 'large_size_w' + ), + 'large_size_h' => array( + 'desc' => __( 'Large size image height' ), + 'readonly' => false, + 'option' => 'large_size_h' + ) + ); + + $this->blog_options = apply_filters( 'xmlrpc_blog_options', $this->blog_options ); + } + + /** + * Retrieve the blogs of the user. + * + * @since 2.6.0 + * + * @param array $args Method parameters. Contains: + * - username + * - password + * @return array. Contains: + * - 'isAdmin' + * - 'url' + * - 'blogid' + * - 'blogName' + * - 'xmlrpc' - url of xmlrpc endpoint + */ + function wp_getUsersBlogs( $args ) { + global $current_site; + // If this isn't on WPMU then just use blogger_getUsersBlogs + if ( !is_multisite() ) { + array_unshift( $args, 1 ); + return $this->blogger_getUsersBlogs( $args ); + } + + $this->escape( $args ); + + $username = $args[0]; + $password = $args[1]; + + if ( !$user = $this->login($username, $password) ) + return $this->error; + + + do_action( 'xmlrpc_call', 'wp.getUsersBlogs' ); + + $blogs = (array) get_blogs_of_user( $user->ID ); + $struct = array( ); + + foreach ( $blogs as $blog ) { + // Don't include blogs that aren't hosted at this site + if ( $blog->site_id != $current_site->id ) + continue; + + $blog_id = $blog->userblog_id; + switch_to_blog($blog_id); + $is_admin = current_user_can('manage_options'); + + $struct[] = array( + 'isAdmin' => $is_admin, + 'url' => get_option( 'home' ) . '/', + 'blogid' => (string) $blog_id, + 'blogName' => get_option( 'blogname' ), + 'xmlrpc' => site_url( 'xmlrpc.php' ) + ); + + restore_current_blog( ); + } + + return $struct; + } + + /** + * Retrieve page. + * + * @since 2.2.0 + * + * @param array $args Method parameters. Contains: + * - blog_id + * - page_id + * - username + * - password + * @return array + */ + function wp_getPage($args) { + $this->escape($args); + + $blog_id = (int) $args[0]; + $page_id = (int) $args[1]; + $username = $args[2]; + $password = $args[3]; + + if ( !$user = $this->login($username, $password) ) { + return $this->error; + } + + if ( !current_user_can( 'edit_page', $page_id ) ) + return new IXR_Error( 401, __( 'Sorry, you cannot edit this page.' ) ); + + do_action('xmlrpc_call', 'wp.getPage'); + + // Lookup page info. + $page = get_page($page_id); + + // If we found the page then format the data. + if ( $page->ID && ($page->post_type == 'page') ) { + // Get all of the page content and link. + $full_page = get_extended($page->post_content); + $link = post_permalink($page->ID); + + // Get info the page parent if there is one. + $parent_title = ""; + if ( !empty($page->post_parent) ) { + $parent = get_page($page->post_parent); + $parent_title = $parent->post_title; + } + + // Determine comment and ping settings. + $allow_comments = comments_open($page->ID) ? 1 : 0; + $allow_pings = pings_open($page->ID) ? 1 : 0; + + // Format page date. + $page_date = mysql2date('Ymd\TH:i:s', $page->post_date, false); + $page_date_gmt = mysql2date('Ymd\TH:i:s', $page->post_date_gmt, false); + + // For drafts use the GMT version of the date + if ( $page->post_status == 'draft' ) + $page_date_gmt = get_gmt_from_date( mysql2date( 'Y-m-d H:i:s', $page->post_date ), 'Ymd\TH:i:s' ); + + // Pull the categories info together. + $categories = array(); + foreach ( wp_get_post_categories($page->ID) as $cat_id ) { + $categories[] = get_cat_name($cat_id); + } + + // Get the author info. + $author = get_userdata($page->post_author); + + $page_template = get_post_meta( $page->ID, '_wp_page_template', true ); + if ( empty( $page_template ) ) + $page_template = 'default'; + + $page_struct = array( + 'dateCreated' => new IXR_Date($page_date), + 'userid' => $page->post_author, + 'page_id' => $page->ID, + 'page_status' => $page->post_status, + 'description' => $full_page['main'], + 'title' => $page->post_title, + 'link' => $link, + 'permaLink' => $link, + 'categories' => $categories, + 'excerpt' => $page->post_excerpt, + 'text_more' => $full_page['extended'], + 'mt_allow_comments' => $allow_comments, + 'mt_allow_pings' => $allow_pings, + 'wp_slug' => $page->post_name, + 'wp_password' => $page->post_password, + 'wp_author' => $author->display_name, + 'wp_page_parent_id' => $page->post_parent, + 'wp_page_parent_title' => $parent_title, + 'wp_page_order' => $page->menu_order, + 'wp_author_id' => $author->ID, + 'wp_author_display_name' => $author->display_name, + 'date_created_gmt' => new IXR_Date($page_date_gmt), + 'custom_fields' => $this->get_custom_fields($page_id), + 'wp_page_template' => $page_template + ); + + return($page_struct); + } + // If the page doesn't exist indicate that. + else { + return(new IXR_Error(404, __('Sorry, no such page.'))); + } + } + + /** + * Retrieve Pages. + * + * @since 2.2.0 + * + * @param array $args Method parameters. Contains: + * - blog_id + * - username + * - password + * - num_pages + * @return array + */ + function wp_getPages($args) { + $this->escape($args); + + $blog_id = (int) $args[0]; + $username = $args[1]; + $password = $args[2]; + $num_pages = isset($args[3]) ? (int) $args[3] : 10; + + if ( !$user = $this->login($username, $password) ) + return $this->error; + + if ( !current_user_can( 'edit_pages' ) ) + return new IXR_Error( 401, __( 'Sorry, you cannot edit pages.' ) ); + + do_action('xmlrpc_call', 'wp.getPages'); + + $pages = get_posts( array('post_type' => 'page', 'post_status' => 'any', 'numberposts' => $num_pages) ); + $num_pages = count($pages); + + // If we have pages, put together their info. + if ( $num_pages >= 1 ) { + $pages_struct = array(); + + for ( $i = 0; $i < $num_pages; $i++ ) { + $page = wp_xmlrpc_server::wp_getPage(array( + $blog_id, $pages[$i]->ID, $username, $password + )); + $pages_struct[] = $page; + } + + return($pages_struct); + } + // If no pages were found return an error. + else { + return(array()); + } + } + + /** + * Create new page. + * + * @since 2.2.0 + * + * @param array $args Method parameters. See {@link wp_xmlrpc_server::mw_newPost()} + * @return unknown + */ + function wp_newPage($args) { + // Items not escaped here will be escaped in newPost. + $username = $this->escape($args[1]); + $password = $this->escape($args[2]); + $page = $args[3]; + $publish = $args[4]; + + if ( !$user = $this->login($username, $password) ) + return $this->error; + + do_action('xmlrpc_call', 'wp.newPage'); + + // Make sure the user is allowed to add new pages. + if ( !current_user_can('publish_pages') ) + return(new IXR_Error(401, __('Sorry, you cannot add new pages.'))); + + // Mark this as content for a page. + $args[3]["post_type"] = 'page'; + + // Let mw_newPost do all of the heavy lifting. + return($this->mw_newPost($args)); + } + + /** + * Delete page. + * + * @since 2.2.0 + * + * @param array $args Method parameters. + * @return bool True, if success. + */ + function wp_deletePage($args) { + $this->escape($args); + + $blog_id = (int) $args[0]; + $username = $args[1]; + $password = $args[2]; + $page_id = (int) $args[3]; + + if ( !$user = $this->login($username, $password) ) + return $this->error; + + do_action('xmlrpc_call', 'wp.deletePage'); + + // Get the current page based on the page_id and + // make sure it is a page and not a post. + $actual_page = wp_get_single_post($page_id, ARRAY_A); + if ( !$actual_page || ($actual_page['post_type'] != 'page') ) + return(new IXR_Error(404, __('Sorry, no such page.'))); + + // Make sure the user can delete pages. + if ( !current_user_can('delete_page', $page_id) ) + return(new IXR_Error(401, __('Sorry, you do not have the right to delete this page.'))); + + // Attempt to delete the page. + $result = wp_delete_post($page_id); + if ( !$result ) + return(new IXR_Error(500, __('Failed to delete the page.'))); + + return(true); + } + + /** + * Edit page. + * + * @since 2.2.0 + * + * @param array $args Method parameters. + * @return unknown + */ + function wp_editPage($args) { + // Items not escaped here will be escaped in editPost. + $blog_id = (int) $args[0]; + $page_id = (int) $this->escape($args[1]); + $username = $this->escape($args[2]); + $password = $this->escape($args[3]); + $content = $args[4]; + $publish = $args[5]; + + if ( !$user = $this->login($username, $password) ) + return $this->error; + + do_action('xmlrpc_call', 'wp.editPage'); + + // Get the page data and make sure it is a page. + $actual_page = wp_get_single_post($page_id, ARRAY_A); + if ( !$actual_page || ($actual_page['post_type'] != 'page') ) + return(new IXR_Error(404, __('Sorry, no such page.'))); + + // Make sure the user is allowed to edit pages. + if ( !current_user_can('edit_page', $page_id) ) + return(new IXR_Error(401, __('Sorry, you do not have the right to edit this page.'))); + + // Mark this as content for a page. + $content['post_type'] = 'page'; + + // Arrange args in the way mw_editPost understands. + $args = array( + $page_id, + $username, + $password, + $content, + $publish + ); + + // Let mw_editPost do all of the heavy lifting. + return($this->mw_editPost($args)); + } + + /** + * Retrieve page list. + * + * @since 2.2.0 + * + * @param array $args Method parameters. + * @return unknown + */ + function wp_getPageList($args) { + global $wpdb; + + $this->escape($args); + + $blog_id = (int) $args[0]; + $username = $args[1]; + $password = $args[2]; + + if ( !$user = $this->login($username, $password) ) + return $this->error; + + if ( !current_user_can( 'edit_pages' ) ) + return new IXR_Error( 401, __( 'Sorry, you cannot edit pages.' ) ); + + do_action('xmlrpc_call', 'wp.getPageList'); + + // Get list of pages ids and titles + $page_list = $wpdb->get_results(" + SELECT ID page_id, + post_title page_title, + post_parent page_parent_id, + post_date_gmt, + post_date, + post_status + FROM {$wpdb->posts} + WHERE post_type = 'page' + ORDER BY ID + "); + + // The date needs to be formated properly. + $num_pages = count($page_list); + for ( $i = 0; $i < $num_pages; $i++ ) { + $post_date = mysql2date('Ymd\TH:i:s', $page_list[$i]->post_date, false); + $post_date_gmt = mysql2date('Ymd\TH:i:s', $page_list[$i]->post_date_gmt, false); + + $page_list[$i]->dateCreated = new IXR_Date($post_date); + $page_list[$i]->date_created_gmt = new IXR_Date($post_date_gmt); + + // For drafts use the GMT version of the date + if ( $page_list[$i]->post_status == 'draft' ) { + $page_list[$i]->date_created_gmt = get_gmt_from_date( mysql2date( 'Y-m-d H:i:s', $page_list[$i]->post_date ), 'Ymd\TH:i:s' ); + $page_list[$i]->date_created_gmt = new IXR_Date( $page_list[$i]->date_created_gmt ); + } + + unset($page_list[$i]->post_date_gmt); + unset($page_list[$i]->post_date); + unset($page_list[$i]->post_status); + } + + return($page_list); + } + + /** + * Retrieve authors list. + * + * @since 2.2.0 + * + * @param array $args Method parameters. + * @return array + */ + function wp_getAuthors($args) { + + $this->escape($args); + + $blog_id = (int) $args[0]; + $username = $args[1]; + $password = $args[2]; + + if ( !$user = $this->login($username, $password) ) + return $this->error; + + if ( !current_user_can('edit_posts') ) + return(new IXR_Error(401, __('Sorry, you cannot edit posts on this site.'))); + + do_action('xmlrpc_call', 'wp.getAuthors'); + + $authors = array(); + foreach ( get_users( array( 'fields' => array('ID','user_login','display_name') ) ) as $user ) { + $authors[] = array( + 'user_id' => $user->ID, + 'user_login' => $user->user_login, + 'display_name' => $user->display_name + ); + } + + return $authors; + } + + /** + * Get list of all tags + * + * @since 2.7 + * + * @param array $args Method parameters. + * @return array + */ + function wp_getTags( $args ) { + $this->escape( $args ); + + $blog_id = (int) $args[0]; + $username = $args[1]; + $password = $args[2]; + + if ( !$user = $this->login($username, $password) ) + return $this->error; + + if ( !current_user_can( 'edit_posts' ) ) + return new IXR_Error( 401, __( 'Sorry, you must be able to edit posts on this site in order to view tags.' ) ); + + do_action( 'xmlrpc_call', 'wp.getKeywords' ); + + $tags = array( ); + + if ( $all_tags = get_tags() ) { + foreach( (array) $all_tags as $tag ) { + $struct['tag_id'] = $tag->term_id; + $struct['name'] = $tag->name; + $struct['count'] = $tag->count; + $struct['slug'] = $tag->slug; + $struct['html_url'] = esc_html( get_tag_link( $tag->term_id ) ); + $struct['rss_url'] = esc_html( get_tag_feed_link( $tag->term_id ) ); + + $tags[] = $struct; + } + } + + return $tags; + } + + /** + * Create new category. + * + * @since 2.2.0 + * + * @param array $args Method parameters. + * @return int Category ID. + */ + function wp_newCategory($args) { + $this->escape($args); + + $blog_id = (int) $args[0]; + $username = $args[1]; + $password = $args[2]; + $category = $args[3]; + + if ( !$user = $this->login($username, $password) ) + return $this->error; + + do_action('xmlrpc_call', 'wp.newCategory'); + + // Make sure the user is allowed to add a category. + if ( !current_user_can('manage_categories') ) + return(new IXR_Error(401, __('Sorry, you do not have the right to add a category.'))); + + // If no slug was provided make it empty so that + // WordPress will generate one. + if ( empty($category['slug']) ) + $category['slug'] = ''; + + // If no parent_id was provided make it empty + // so that it will be a top level page (no parent). + if ( !isset($category['parent_id']) ) + $category['parent_id'] = ''; + + // If no description was provided make it empty. + if ( empty($category["description"]) ) + $category["description"] = ""; + + $new_category = array( + 'cat_name' => $category['name'], + 'category_nicename' => $category['slug'], + 'category_parent' => $category['parent_id'], + 'category_description' => $category['description'] + ); + + $cat_id = wp_insert_category($new_category, true); + if ( is_wp_error( $cat_id ) ) { + if ( 'term_exists' == $cat_id->get_error_code() ) + return (int) $cat_id->get_error_data(); + else + return(new IXR_Error(500, __('Sorry, the new category failed.'))); + } elseif ( ! $cat_id ) { + return(new IXR_Error(500, __('Sorry, the new category failed.'))); + } + + return($cat_id); + } + + /** + * Remove category. + * + * @since 2.5.0 + * + * @param array $args Method parameters. + * @return mixed See {@link wp_delete_term()} for return info. + */ + function wp_deleteCategory($args) { + $this->escape($args); + + $blog_id = (int) $args[0]; + $username = $args[1]; + $password = $args[2]; + $category_id = (int) $args[3]; + + if ( !$user = $this->login($username, $password) ) + return $this->error; + + do_action('xmlrpc_call', 'wp.deleteCategory'); + + if ( !current_user_can('manage_categories') ) + return new IXR_Error( 401, __( 'Sorry, you do not have the right to delete a category.' ) ); + + return wp_delete_term( $category_id, 'category' ); + } + + /** + * Retrieve category list. + * + * @since 2.2.0 + * + * @param array $args Method parameters. + * @return array + */ + function wp_suggestCategories($args) { + $this->escape($args); + + $blog_id = (int) $args[0]; + $username = $args[1]; + $password = $args[2]; + $category = $args[3]; + $max_results = (int) $args[4]; + + if ( !$user = $this->login($username, $password) ) + return $this->error; + + if ( !current_user_can( 'edit_posts' ) ) + return new IXR_Error( 401, __( 'Sorry, you must be able to edit posts to this site in order to view categories.' ) ); + + do_action('xmlrpc_call', 'wp.suggestCategories'); + + $category_suggestions = array(); + $args = array('get' => 'all', 'number' => $max_results, 'name__like' => $category); + foreach ( (array) get_categories($args) as $cat ) { + $category_suggestions[] = array( + 'category_id' => $cat->term_id, + 'category_name' => $cat->name + ); + } + + return($category_suggestions); + } + + /** + * Retrieve comment. + * + * @since 2.7.0 + * + * @param array $args Method parameters. + * @return array + */ + function wp_getComment($args) { + $this->escape($args); + + $blog_id = (int) $args[0]; + $username = $args[1]; + $password = $args[2]; + $comment_id = (int) $args[3]; + + if ( !$user = $this->login($username, $password) ) + return $this->error; + + if ( !current_user_can( 'moderate_comments' ) ) + return new IXR_Error( 403, __( 'You are not allowed to moderate comments on this site.' ) ); + + do_action('xmlrpc_call', 'wp.getComment'); + + if ( ! $comment = get_comment($comment_id) ) + return new IXR_Error( 404, __( 'Invalid comment ID.' ) ); + + // Format page date. + $comment_date = mysql2date('Ymd\TH:i:s', $comment->comment_date, false); + $comment_date_gmt = mysql2date('Ymd\TH:i:s', $comment->comment_date_gmt, false); + + if ( '0' == $comment->comment_approved ) + $comment_status = 'hold'; + else if ( 'spam' == $comment->comment_approved ) + $comment_status = 'spam'; + else if ( '1' == $comment->comment_approved ) + $comment_status = 'approve'; + else + $comment_status = $comment->comment_approved; + + $link = get_comment_link($comment); + + $comment_struct = array( + 'date_created_gmt' => new IXR_Date($comment_date_gmt), + 'user_id' => $comment->user_id, + 'comment_id' => $comment->comment_ID, + 'parent' => $comment->comment_parent, + 'status' => $comment_status, + 'content' => $comment->comment_content, + 'link' => $link, + 'post_id' => $comment->comment_post_ID, + 'post_title' => get_the_title($comment->comment_post_ID), + 'author' => $comment->comment_author, + 'author_url' => $comment->comment_author_url, + 'author_email' => $comment->comment_author_email, + 'author_ip' => $comment->comment_author_IP, + 'type' => $comment->comment_type, + ); + + return $comment_struct; + } + + /** + * Retrieve comments. + * + * Besides the common blog_id, username, and password arguments, it takes a filter + * array as last argument. + * + * Accepted 'filter' keys are 'status', 'post_id', 'offset', and 'number'. + * + * The defaults are as follows: + * - 'status' - Default is ''. Filter by status (e.g., 'approve', 'hold') + * - 'post_id' - Default is ''. The post where the comment is posted. Empty string shows all comments. + * - 'number' - Default is 10. Total number of media items to retrieve. + * - 'offset' - Default is 0. See {@link WP_Query::query()} for more. + * + * @since 2.7.0 + * + * @param array $args Method parameters. + * @return array. Contains a collection of comments. See {@link wp_xmlrpc_server::wp_getComment()} for a description of each item contents + */ + function wp_getComments($args) { + $raw_args = $args; + $this->escape($args); + + $blog_id = (int) $args[0]; + $username = $args[1]; + $password = $args[2]; + $struct = $args[3]; + + if ( !$user = $this->login($username, $password) ) + return $this->error; + + if ( !current_user_can( 'moderate_comments' ) ) + return new IXR_Error( 401, __( 'Sorry, you cannot edit comments.' ) ); + + do_action('xmlrpc_call', 'wp.getComments'); + + if ( isset($struct['status']) ) + $status = $struct['status']; + else + $status = ''; + + $post_id = ''; + if ( isset($struct['post_id']) ) + $post_id = absint($struct['post_id']); + + $offset = 0; + if ( isset($struct['offset']) ) + $offset = absint($struct['offset']); + + $number = 10; + if ( isset($struct['number']) ) + $number = absint($struct['number']); + + $comments = get_comments( array('status' => $status, 'post_id' => $post_id, 'offset' => $offset, 'number' => $number ) ); + $num_comments = count($comments); + + if ( ! $num_comments ) + return array(); + + $comments_struct = array(); + + // FIXME: we already have the comments, why query them again? + for ( $i = 0; $i < $num_comments; $i++ ) { + $comment = wp_xmlrpc_server::wp_getComment(array( + $raw_args[0], $raw_args[1], $raw_args[2], $comments[$i]->comment_ID, + )); + $comments_struct[] = $comment; + } + + return $comments_struct; + } + + /** + * Delete a comment. + * + * By default, the comment will be moved to the trash instead of deleted. + * See {@link wp_delete_comment()} for more information on + * this behavior. + * + * @since 2.7.0 + * + * @param array $args Method parameters. Contains: + * - blog_id + * - username + * - password + * - comment_id + * @return mixed {@link wp_delete_comment()} + */ + function wp_deleteComment($args) { + $this->escape($args); + + $blog_id = (int) $args[0]; + $username = $args[1]; + $password = $args[2]; + $comment_ID = (int) $args[3]; + + if ( !$user = $this->login($username, $password) ) + return $this->error; + + if ( !current_user_can( 'moderate_comments' ) ) + return new IXR_Error( 403, __( 'You are not allowed to moderate comments on this site.' ) ); + + if ( !current_user_can( 'edit_comment', $comment_ID ) ) + return new IXR_Error( 403, __( 'You are not allowed to moderate comments on this site.' ) ); + + do_action('xmlrpc_call', 'wp.deleteComment'); + + if ( ! get_comment($comment_ID) ) + return new IXR_Error( 404, __( 'Invalid comment ID.' ) ); + + return wp_delete_comment($comment_ID); + } + + /** + * Edit comment. + * + * Besides the common blog_id, username, and password arguments, it takes a + * comment_id integer and a content_struct array as last argument. + * + * The allowed keys in the content_struct array are: + * - 'author' + * - 'author_url' + * - 'author_email' + * - 'content' + * - 'date_created_gmt' + * - 'status'. Common statuses are 'approve', 'hold', 'spam'. See {@link get_comment_statuses()} for more details + * + * @since 2.7.0 + * + * @param array $args. Contains: + * - blog_id + * - username + * - password + * - comment_id + * - content_struct + * @return bool True, on success. + */ + function wp_editComment($args) { + $this->escape($args); + + $blog_id = (int) $args[0]; + $username = $args[1]; + $password = $args[2]; + $comment_ID = (int) $args[3]; + $content_struct = $args[4]; + + if ( !$user = $this->login($username, $password) ) + return $this->error; + + if ( !current_user_can( 'moderate_comments' ) ) + return new IXR_Error( 403, __( 'You are not allowed to moderate comments on this site.' ) ); + + if ( !current_user_can( 'edit_comment', $comment_ID ) ) + return new IXR_Error( 403, __( 'You are not allowed to moderate comments on this site.' ) ); + + do_action('xmlrpc_call', 'wp.editComment'); + + if ( ! get_comment($comment_ID) ) + return new IXR_Error( 404, __( 'Invalid comment ID.' ) ); + + if ( isset($content_struct['status']) ) { + $statuses = get_comment_statuses(); + $statuses = array_keys($statuses); + + if ( ! in_array($content_struct['status'], $statuses) ) + return new IXR_Error( 401, __( 'Invalid comment status.' ) ); + $comment_approved = $content_struct['status']; + } + + // Do some timestamp voodoo + if ( !empty( $content_struct['date_created_gmt'] ) ) { + $dateCreated = str_replace( 'Z', '', $content_struct['date_created_gmt']->getIso() ) . 'Z'; // We know this is supposed to be GMT, so we're going to slap that Z on there by force + $comment_date = get_date_from_gmt(iso8601_to_datetime($dateCreated)); + $comment_date_gmt = iso8601_to_datetime($dateCreated, 'GMT'); + } + + if ( isset($content_struct['content']) ) + $comment_content = $content_struct['content']; + + if ( isset($content_struct['author']) ) + $comment_author = $content_struct['author']; + + if ( isset($content_struct['author_url']) ) + $comment_author_url = $content_struct['author_url']; + + if ( isset($content_struct['author_email']) ) + $comment_author_email = $content_struct['author_email']; + + // We've got all the data -- post it: + $comment = compact('comment_ID', 'comment_content', 'comment_approved', 'comment_date', 'comment_date_gmt', 'comment_author', 'comment_author_email', 'comment_author_url'); + + $result = wp_update_comment($comment); + if ( is_wp_error( $result ) ) + return new IXR_Error(500, $result->get_error_message()); + + if ( !$result ) + return new IXR_Error(500, __('Sorry, the comment could not be edited. Something wrong happened.')); + + return true; + } + + /** + * Create new comment. + * + * @since 2.7.0 + * + * @param array $args Method parameters. + * @return mixed {@link wp_new_comment()} + */ + function wp_newComment($args) { + global $wpdb; + + $this->escape($args); + + $blog_id = (int) $args[0]; + $username = $args[1]; + $password = $args[2]; + $post = $args[3]; + $content_struct = $args[4]; + + $allow_anon = apply_filters('xmlrpc_allow_anonymous_comments', false); + + $user = $this->login($username, $password); + + if ( !$user ) { + $logged_in = false; + if ( $allow_anon && get_option('comment_registration') ) + return new IXR_Error( 403, __( 'You must be registered to comment' ) ); + else if ( !$allow_anon ) + return $this->error; + } else { + $logged_in = true; + } + + if ( is_numeric($post) ) + $post_id = absint($post); + else + $post_id = url_to_postid($post); + + if ( ! $post_id ) + return new IXR_Error( 404, __( 'Invalid post ID.' ) ); + + if ( ! get_post($post_id) ) + return new IXR_Error( 404, __( 'Invalid post ID.' ) ); + + $comment['comment_post_ID'] = $post_id; + + if ( $logged_in ) { + $comment['comment_author'] = $wpdb->escape( $user->display_name ); + $comment['comment_author_email'] = $wpdb->escape( $user->user_email ); + $comment['comment_author_url'] = $wpdb->escape( $user->user_url ); + $comment['user_ID'] = $user->ID; + } else { + $comment['comment_author'] = ''; + if ( isset($content_struct['author']) ) + $comment['comment_author'] = $content_struct['author']; + + $comment['comment_author_email'] = ''; + if ( isset($content_struct['author_email']) ) + $comment['comment_author_email'] = $content_struct['author_email']; + + $comment['comment_author_url'] = ''; + if ( isset($content_struct['author_url']) ) + $comment['comment_author_url'] = $content_struct['author_url']; + + $comment['user_ID'] = 0; + + if ( get_option('require_name_email') ) { + if ( 6 > strlen($comment['comment_author_email']) || '' == $comment['comment_author'] ) + return new IXR_Error( 403, __( 'Comment author name and email are required' ) ); + elseif ( !is_email($comment['comment_author_email']) ) + return new IXR_Error( 403, __( 'A valid email address is required' ) ); + } + } + + $comment['comment_parent'] = isset($content_struct['comment_parent']) ? absint($content_struct['comment_parent']) : 0; + + $comment['comment_content'] = isset($content_struct['content']) ? $content_struct['content'] : null; + + do_action('xmlrpc_call', 'wp.newComment'); + + return wp_new_comment($comment); + } + + /** + * Retrieve all of the comment status. + * + * @since 2.7.0 + * + * @param array $args Method parameters. + * @return array + */ + function wp_getCommentStatusList($args) { + $this->escape( $args ); + + $blog_id = (int) $args[0]; + $username = $args[1]; + $password = $args[2]; + + if ( !$user = $this->login($username, $password) ) + return $this->error; + + if ( !current_user_can( 'moderate_comments' ) ) + return new IXR_Error( 403, __( 'You are not allowed access to details about this site.' ) ); + + do_action('xmlrpc_call', 'wp.getCommentStatusList'); + + return get_comment_statuses( ); + } + + /** + * Retrieve comment count. + * + * @since 2.5.0 + * + * @param array $args Method parameters. + * @return array + */ + function wp_getCommentCount( $args ) { + $this->escape($args); + + $blog_id = (int) $args[0]; + $username = $args[1]; + $password = $args[2]; + $post_id = (int) $args[3]; + + if ( !$user = $this->login($username, $password) ) + return $this->error; + + if ( !current_user_can( 'edit_posts' ) ) + return new IXR_Error( 403, __( 'You are not allowed access to details about comments.' ) ); + + do_action('xmlrpc_call', 'wp.getCommentCount'); + + $count = wp_count_comments( $post_id ); + return array( + 'approved' => $count->approved, + 'awaiting_moderation' => $count->moderated, + 'spam' => $count->spam, + 'total_comments' => $count->total_comments + ); + } + + /** + * Retrieve post statuses. + * + * @since 2.5.0 + * + * @param array $args Method parameters. + * @return array + */ + function wp_getPostStatusList( $args ) { + $this->escape( $args ); + + $blog_id = (int) $args[0]; + $username = $args[1]; + $password = $args[2]; + + if ( !$user = $this->login($username, $password) ) + return $this->error; + + if ( !current_user_can( 'edit_posts' ) ) + return new IXR_Error( 403, __( 'You are not allowed access to details about this site.' ) ); + + do_action('xmlrpc_call', 'wp.getPostStatusList'); + + return get_post_statuses( ); + } + + /** + * Retrieve page statuses. + * + * @since 2.5.0 + * + * @param array $args Method parameters. + * @return array + */ + function wp_getPageStatusList( $args ) { + $this->escape( $args ); + + $blog_id = (int) $args[0]; + $username = $args[1]; + $password = $args[2]; + + if ( !$user = $this->login($username, $password) ) + return $this->error; + + if ( !current_user_can( 'edit_pages' ) ) + return new IXR_Error( 403, __( 'You are not allowed access to details about this site.' ) ); + + do_action('xmlrpc_call', 'wp.getPageStatusList'); + + return get_page_statuses( ); + } + + /** + * Retrieve page templates. + * + * @since 2.6.0 + * + * @param array $args Method parameters. + * @return array + */ + function wp_getPageTemplates( $args ) { + $this->escape( $args ); + + $blog_id = (int) $args[0]; + $username = $args[1]; + $password = $args[2]; + + if ( !$user = $this->login($username, $password) ) + return $this->error; + + if ( !current_user_can( 'edit_pages' ) ) + return new IXR_Error( 403, __( 'You are not allowed access to details about this site.' ) ); + + $templates = get_page_templates( ); + $templates['Default'] = 'default'; + + return $templates; + } + + /** + * Retrieve blog options. + * + * @since 2.6.0 + * + * @param array $args Method parameters. + * @return array + */ + function wp_getOptions( $args ) { + $this->escape( $args ); + + $blog_id = (int) $args[0]; + $username = $args[1]; + $password = $args[2]; + $options = isset( $args[3] ) ? (array) $args[3] : array(); + + if ( !$user = $this->login($username, $password) ) + return $this->error; + + // If no specific options where asked for, return all of them + if ( count( $options ) == 0 ) + $options = array_keys($this->blog_options); + + return $this->_getOptions($options); + } + + /** + * Retrieve blog options value from list. + * + * @since 2.6.0 + * + * @param array $options Options to retrieve. + * @return array + */ + function _getOptions($options) { + $data = array( ); + foreach ( $options as $option ) { + if ( array_key_exists( $option, $this->blog_options ) ) { + $data[$option] = $this->blog_options[$option]; + //Is the value static or dynamic? + if ( isset( $data[$option]['option'] ) ) { + $data[$option]['value'] = get_option( $data[$option]['option'] ); + unset($data[$option]['option']); + } + } + } + + return $data; + } + + /** + * Update blog options. + * + * @since 2.6.0 + * + * @param array $args Method parameters. + * @return unknown + */ + function wp_setOptions( $args ) { + $this->escape( $args ); + + $blog_id = (int) $args[0]; + $username = $args[1]; + $password = $args[2]; + $options = (array) $args[3]; + + if ( !$user = $this->login($username, $password) ) + return $this->error; + + if ( !current_user_can( 'manage_options' ) ) + return new IXR_Error( 403, __( 'You are not allowed to update options.' ) ); + + foreach ( $options as $o_name => $o_value ) { + $option_names[] = $o_name; + if ( !array_key_exists( $o_name, $this->blog_options ) ) + continue; + + if ( $this->blog_options[$o_name]['readonly'] == true ) + continue; + + update_option( $this->blog_options[$o_name]['option'], $o_value ); + } + + //Now return the updated values + return $this->_getOptions($option_names); + } + + /** + * Retrieve a media item by ID + * + * @since 3.1.0 + * + * @param array $args Method parameters. Contains: + * - blog_id + * - username + * - password + * - attachment_id + * @return array. Assocciative array containing: + * - 'date_created_gmt' + * - 'parent' + * - 'link' + * - 'thumbnail' + * - 'title' + * - 'caption' + * - 'description' + * - 'metadata' + */ + function wp_getMediaItem($args) { + $this->escape($args); + + $blog_id = (int) $args[0]; + $username = $args[1]; + $password = $args[2]; + $attachment_id = (int) $args[3]; + + if ( !$user = $this->login($username, $password) ) + return $this->error; + + if ( !current_user_can( 'upload_files' ) ) + return new IXR_Error( 403, __( 'You are not allowed to upload files to this site.' ) ); + + do_action('xmlrpc_call', 'wp.getMediaItem'); + + if ( ! $attachment = get_post($attachment_id) ) + return new IXR_Error( 404, __( 'Invalid attachment ID.' ) ); + + // Format page date. + $attachment_date = mysql2date('Ymd\TH:i:s', $attachment->post_date, false); + $attachment_date_gmt = mysql2date('Ymd\TH:i:s', $attachment->post_date_gmt, false); + + $link = wp_get_attachment_url($attachment->ID); + $thumbnail_link = wp_get_attachment_thumb_url($attachment->ID); + + $attachment_struct = array( + 'date_created_gmt' => new IXR_Date($attachment_date_gmt), + 'parent' => $attachment->post_parent, + 'link' => $link, + 'thumbnail' => $thumbnail_link, + 'title' => $attachment->post_title, + 'caption' => $attachment->post_excerpt, + 'description' => $attachment->post_content, + 'metadata' => wp_get_attachment_metadata($attachment->ID), + ); + + return $attachment_struct; + } + + /** + * Retrieves a collection of media library items (or attachments) + * + * Besides the common blog_id, username, and password arguments, it takes a filter + * array as last argument. + * + * Accepted 'filter' keys are 'parent_id', 'mime_type', 'offset', and 'number'. + * + * The defaults are as follows: + * - 'number' - Default is 5. Total number of media items to retrieve. + * - 'offset' - Default is 0. See {@link WP_Query::query()} for more. + * - 'parent_id' - Default is ''. The post where the media item is attached. Empty string shows all media items. 0 shows unattached media items. + * - 'mime_type' - Default is ''. Filter by mime type (e.g., 'image/jpeg', 'application/pdf') + * + * @since 3.1.0 + * + * @param array $args Method parameters. Contains: + * - blog_id + * - username + * - password + * - filter + * @return array. Contains a collection of media items. See {@link wp_xmlrpc_server::wp_getMediaItem()} for a description of each item contents + */ + function wp_getMediaLibrary($args) { + $raw_args = $args; + $this->escape($args); + + $blog_id = (int) $args[0]; + $username = $args[1]; + $password = $args[2]; + $struct = isset( $args[3] ) ? $args[3] : array() ; + + if ( !$user = $this->login($username, $password) ) + return $this->error; + + if ( !current_user_can( 'upload_files' ) ) + return new IXR_Error( 401, __( 'Sorry, you cannot upload files.' ) ); + + do_action('xmlrpc_call', 'wp.getMediaLibrary'); + + $parent_id = ( isset($struct['parent_id']) ) ? absint($struct['parent_id']) : '' ; + $mime_type = ( isset($struct['mime_type']) ) ? $struct['mime_type'] : '' ; + $offset = ( isset($struct['offset']) ) ? absint($struct['offset']) : 0 ; + $number = ( isset($struct['number']) ) ? absint($struct['number']) : -1 ; + + $attachments = get_posts( array('post_type' => 'attachment', 'post_parent' => $parent_id, 'offset' => $offset, 'numberposts' => $number, 'post_mime_type' => $mime_type ) ); + $num_attachments = count($attachments); + + if ( ! $num_attachments ) + return array(); + + $attachments_struct = array(); + + foreach ($attachments as $attachment ) + $attachments_struct[] = $this->wp_getMediaItem( array( $raw_args[0], $raw_args[1], $raw_args[2], $attachment->ID ) ); + + return $attachments_struct; + } + + /** + * Retrives a list of post formats used by the site + * + * @since 3.1 + * + * @param array $args Method parameters. Contains: + * - blog_id + * - username + * - password + * @return array + */ + function wp_getPostFormats( $args ) { + $this->escape( $args ); + + $blog_id = (int) $args[0]; + $username = $args[1]; + $password = $args[2]; + + if ( !$user = $this->login( $username, $password ) ) + return $this->error; + + do_action( 'xmlrpc_call', 'wp.getPostFormats' ); + + $formats = get_post_format_strings(); + + # find out if they want a list of currently supports formats + if ( isset( $args[3] ) && is_array( $args[3] ) ) { + if ( $args[3]['show-supported'] ) { + if ( current_theme_supports( 'post-formats' ) ) { + $supported = get_theme_support( 'post-formats' ); + + $data['all'] = $formats; + $data['supported'] = $supported[0]; + + $formats = $data; + } + } + } + + return $formats; + } + + /* Blogger API functions. + * specs on http://plant.blogger.com/api and http://groups.yahoo.com/group/bloggerDev/ + */ + + /** + * Retrieve blogs that user owns. + * + * Will make more sense once we support multiple blogs. + * + * @since 1.5.0 + * + * @param array $args Method parameters. + * @return array + */ + function blogger_getUsersBlogs($args) { + if ( is_multisite() ) + return $this->_multisite_getUsersBlogs($args); + + $this->escape($args); + + $username = $args[1]; + $password = $args[2]; + + if ( !$user = $this->login($username, $password) ) + return $this->error; + + do_action('xmlrpc_call', 'blogger.getUsersBlogs'); + + $is_admin = current_user_can('manage_options'); + + $struct = array( + 'isAdmin' => $is_admin, + 'url' => get_option('home') . '/', + 'blogid' => '1', + 'blogName' => get_option('blogname'), + 'xmlrpc' => site_url( 'xmlrpc.php' ) + ); + + return array($struct); + } + + /** + * Private function for retrieving a users blogs for multisite setups + * + * @access protected + */ + function _multisite_getUsersBlogs($args) { + global $current_blog; + $domain = $current_blog->domain; + $path = $current_blog->path . 'xmlrpc.php'; + $protocol = is_ssl() ? 'https' : 'http'; + + $rpc = new IXR_Client("$protocol://{$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(); + } + } + + /** + * Retrieve user's data. + * + * Gives your client some info about you, so you don't have to. + * + * @since 1.5.0 + * + * @param array $args Method parameters. + * @return array + */ + function blogger_getUserInfo($args) { + + $this->escape($args); + + $username = $args[1]; + $password = $args[2]; + + if ( !$user = $this->login($username, $password) ) + return $this->error; + + if ( !current_user_can( 'edit_posts' ) ) + return new IXR_Error( 401, __( 'Sorry, you do not have access to user data on this site.' ) ); + + do_action('xmlrpc_call', 'blogger.getUserInfo'); + + $struct = array( + 'nickname' => $user->nickname, + 'userid' => $user->ID, + 'url' => $user->user_url, + 'lastname' => $user->last_name, + 'firstname' => $user->first_name + ); + + return $struct; + } + + /** + * Retrieve post. + * + * @since 1.5.0 + * + * @param array $args Method parameters. + * @return array + */ + function blogger_getPost($args) { + + $this->escape($args); + + $post_ID = (int) $args[1]; + $username = $args[2]; + $password = $args[3]; + + if ( !$user = $this->login($username, $password) ) + return $this->error; + + if ( !current_user_can( 'edit_post', $post_ID ) ) + return new IXR_Error( 401, __( 'Sorry, you cannot edit this post.' ) ); + + do_action('xmlrpc_call', 'blogger.getPost'); + + $post_data = wp_get_single_post($post_ID, ARRAY_A); + + $categories = implode(',', wp_get_post_categories($post_ID)); + + $content = ''.stripslashes($post_data['post_title']).''; + $content .= ''.$categories.''; + $content .= stripslashes($post_data['post_content']); + + $struct = array( + 'userid' => $post_data['post_author'], + 'dateCreated' => new IXR_Date(mysql2date('Ymd\TH:i:s', $post_data['post_date'], false)), + 'content' => $content, + 'postid' => (string) $post_data['ID'] + ); + + return $struct; + } + + /** + * Retrieve list of recent posts. + * + * @since 1.5.0 + * + * @param array $args Method parameters. + * @return array + */ + function blogger_getRecentPosts($args) { + + $this->escape($args); + + // $args[0] = appkey - ignored + $blog_ID = (int) $args[1]; /* though we don't use it yet */ + $username = $args[2]; + $password = $args[3]; + if ( isset( $args[4] ) ) + $query = array( 'numberposts' => absint( $args[4] ) ); + else + $query = array(); + + if ( !$user = $this->login($username, $password) ) + return $this->error; + + do_action('xmlrpc_call', 'blogger.getRecentPosts'); + + $posts_list = wp_get_recent_posts( $query ); + + if ( !$posts_list ) { + $this->error = new IXR_Error(500, __('Either there are no posts, or something went wrong.')); + return $this->error; + } + + foreach ($posts_list as $entry) { + if ( !current_user_can( 'edit_post', $entry['ID'] ) ) + continue; + + $post_date = mysql2date('Ymd\TH:i:s', $entry['post_date'], false); + $categories = implode(',', wp_get_post_categories($entry['ID'])); + + $content = ''.stripslashes($entry['post_title']).''; + $content .= ''.$categories.''; + $content .= stripslashes($entry['post_content']); + + $struct[] = array( + 'userid' => $entry['post_author'], + 'dateCreated' => new IXR_Date($post_date), + 'content' => $content, + 'postid' => (string) $entry['ID'], + ); + + } + + $recent_posts = array(); + for ( $j=0; $jescape($args); + + $blog_ID = (int) $args[1]; + $username = $args[2]; + $password = $args[3]; + $template = $args[4]; /* could be 'main' or 'archiveIndex', but we don't use it */ + + if ( !$user = $this->login($username, $password) ) + return $this->error; + + do_action('xmlrpc_call', 'blogger.getTemplate'); + + if ( !current_user_can('edit_themes') ) + return new IXR_Error(401, __('Sorry, this user can not edit the template.')); + + /* warning: here we make the assumption that the blog's URL is on the same server */ + $filename = get_option('home') . '/'; + $filename = preg_replace('#https?://.+?/#', $_SERVER['DOCUMENT_ROOT'].'/', $filename); + + $f = fopen($filename, 'r'); + $content = fread($f, filesize($filename)); + fclose($f); + + /* so it is actually editable with a windows/mac client */ + // FIXME: (or delete me) do we really want to cater to bad clients at the expense of good ones by BEEPing up their line breaks? commented. $content = str_replace("\n", "\r\n", $content); + + return $content; + } + + /** + * Updates the content of blog_filename. + * + * @since 1.5.0 + * + * @param array $args Method parameters. + * @return bool True when done. + */ + function blogger_setTemplate($args) { + + $this->escape($args); + + $blog_ID = (int) $args[1]; + $username = $args[2]; + $password = $args[3]; + $content = $args[4]; + $template = $args[5]; /* could be 'main' or 'archiveIndex', but we don't use it */ + + if ( !$user = $this->login($username, $password) ) + return $this->error; + + do_action('xmlrpc_call', 'blogger.setTemplate'); + + if ( !current_user_can('edit_themes') ) + return new IXR_Error(401, __('Sorry, this user cannot edit the template.')); + + /* warning: here we make the assumption that the blog's URL is on the same server */ + $filename = get_option('home') . '/'; + $filename = preg_replace('#https?://.+?/#', $_SERVER['DOCUMENT_ROOT'].'/', $filename); + + if ($f = fopen($filename, 'w+')) { + fwrite($f, $content); + fclose($f); + } else { + return new IXR_Error(500, __('Either the file is not writable, or something wrong happened. The file has not been updated.')); + } + + return true; + } + + /** + * Create new post. + * + * @since 1.5.0 + * + * @param array $args Method parameters. + * @return int + */ + function blogger_newPost($args) { + + $this->escape($args); + + $blog_ID = (int) $args[1]; /* though we don't use it yet */ + $username = $args[2]; + $password = $args[3]; + $content = $args[4]; + $publish = $args[5]; + + if ( !$user = $this->login($username, $password) ) + return $this->error; + + do_action('xmlrpc_call', 'blogger.newPost'); + + $cap = ($publish) ? 'publish_posts' : 'edit_posts'; + if ( !current_user_can($cap) ) + return new IXR_Error(401, __('Sorry, you are not allowed to post on this site.')); + + $post_status = ($publish) ? 'publish' : 'draft'; + + $post_author = $user->ID; + + $post_title = xmlrpc_getposttitle($content); + $post_category = xmlrpc_getpostcategory($content); + $post_content = xmlrpc_removepostdata($content); + + $post_date = current_time('mysql'); + $post_date_gmt = current_time('mysql', 1); + + $post_data = compact('blog_ID', 'post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_title', 'post_category', 'post_status'); + + $post_ID = wp_insert_post($post_data); + if ( is_wp_error( $post_ID ) ) + return new IXR_Error(500, $post_ID->get_error_message()); + + if ( !$post_ID ) + return new IXR_Error(500, __('Sorry, your entry could not be posted. Something wrong happened.')); + + $this->attach_uploads( $post_ID, $post_content ); + + logIO('O', "Posted ! ID: $post_ID"); + + return $post_ID; + } + + /** + * Edit a post. + * + * @since 1.5.0 + * + * @param array $args Method parameters. + * @return bool true when done. + */ + function blogger_editPost($args) { + + $this->escape($args); + + $post_ID = (int) $args[1]; + $username = $args[2]; + $password = $args[3]; + $content = $args[4]; + $publish = $args[5]; + + if ( !$user = $this->login($username, $password) ) + return $this->error; + + do_action('xmlrpc_call', 'blogger.editPost'); + + $actual_post = wp_get_single_post($post_ID,ARRAY_A); + + if ( !$actual_post || $actual_post['post_type'] != 'post' ) + return new IXR_Error(404, __('Sorry, no such post.')); + + $this->escape($actual_post); + + if ( !current_user_can('edit_post', $post_ID) ) + return new IXR_Error(401, __('Sorry, you do not have the right to edit this post.')); + + extract($actual_post, EXTR_SKIP); + + if ( ('publish' == $post_status) && !current_user_can('publish_posts') ) + return new IXR_Error(401, __('Sorry, you do not have the right to publish this post.')); + + $post_title = xmlrpc_getposttitle($content); + $post_category = xmlrpc_getpostcategory($content); + $post_content = xmlrpc_removepostdata($content); + + $postdata = compact('ID', 'post_content', 'post_title', 'post_category', 'post_status', 'post_excerpt'); + + $result = wp_update_post($postdata); + + if ( !$result ) + return new IXR_Error(500, __('For some strange yet very annoying reason, this post could not be edited.')); + + $this->attach_uploads( $ID, $post_content ); + + return true; + } + + /** + * Remove a post. + * + * @since 1.5.0 + * + * @param array $args Method parameters. + * @return bool True when post is deleted. + */ + function blogger_deletePost($args) { + $this->escape($args); + + $post_ID = (int) $args[1]; + $username = $args[2]; + $password = $args[3]; + $publish = $args[4]; + + if ( !$user = $this->login($username, $password) ) + return $this->error; + + do_action('xmlrpc_call', 'blogger.deletePost'); + + $actual_post = wp_get_single_post($post_ID,ARRAY_A); + + if ( !$actual_post || $actual_post['post_type'] != 'post' ) + return new IXR_Error(404, __('Sorry, no such post.')); + + if ( !current_user_can('delete_post', $post_ID) ) + return new IXR_Error(401, __('Sorry, you do not have the right to delete this post.')); + + $result = wp_delete_post($post_ID); + + if ( !$result ) + return new IXR_Error(500, __('For some strange yet very annoying reason, this post could not be deleted.')); + + return true; + } + + /* MetaWeblog API functions + * specs on wherever Dave Winer wants them to be + */ + + /** + * Create a new post. + * + * The 'content_struct' argument must contain: + * - title + * - description + * - mt_excerpt + * - mt_text_more + * - mt_keywords + * - mt_tb_ping_urls + * - categories + * + * Also, it can optionally contain: + * - wp_slug + * - wp_password + * - wp_page_parent_id + * - wp_page_order + * - wp_author_id + * - post_status | page_status - can be 'draft', 'private', 'publish', or 'pending' + * - mt_allow_comments - can be 'open' or 'closed' + * - mt_allow_pings - can be 'open' or 'closed' + * - date_created_gmt + * - dateCreated + * + * @since 1.5.0 + * + * @param array $args Method parameters. Contains: + * - blog_id + * - username + * - password + * - content_struct + * - publish + * @return int + */ + function mw_newPost($args) { + $this->escape($args); + + $blog_ID = (int) $args[0]; // we will support this in the near future + $username = $args[1]; + $password = $args[2]; + $content_struct = $args[3]; + $publish = isset( $args[4] ) ? $args[4] : 0; + + if ( !$user = $this->login($username, $password) ) + return $this->error; + + do_action('xmlrpc_call', 'metaWeblog.newPost'); + + $page_template = ''; + if ( !empty( $content_struct['post_type'] ) ) { + if ( $content_struct['post_type'] == 'page' ) { + if ( $publish ) + $cap = 'publish_pages'; + elseif ('publish' == $content_struct['page_status']) + $cap = 'publish_pages'; + else + $cap = 'edit_pages'; + $error_message = __( 'Sorry, you are not allowed to publish pages on this site.' ); + $post_type = 'page'; + if ( !empty( $content_struct['wp_page_template'] ) ) + $page_template = $content_struct['wp_page_template']; + } elseif ( $content_struct['post_type'] == 'post' ) { + if ( $publish ) + $cap = 'publish_posts'; + elseif ('publish' == $content_struct['post_status']) + $cap = 'publish_posts'; + else + $cap = 'edit_posts'; + $error_message = __( 'Sorry, you are not allowed to publish posts on this site.' ); + $post_type = 'post'; + } else { + // No other post_type values are allowed here + return new IXR_Error( 401, __( 'Invalid post type.' ) ); + } + } else { + if ( $publish ) + $cap = 'publish_posts'; + elseif ('publish' == $content_struct['post_status']) + $cap = 'publish_posts'; + else + $cap = 'edit_posts'; + $error_message = __( 'Sorry, you are not allowed to publish posts on this site.' ); + $post_type = 'post'; + } + + if ( !current_user_can( $cap ) ) + return new IXR_Error( 401, $error_message ); + + // Check for a valid post format if one was given + if ( isset( $content_struct['wp_post_format'] ) ) { + $content_struct['wp_post_format'] = sanitize_key( $content_struct['wp_post_format'] ); + if ( !array_key_exists( $content_struct['wp_post_format'], get_post_format_strings() ) ) { + return new IXR_Error( 404, __( 'Invalid post format' ) ); + } + } + + // Let WordPress generate the post_name (slug) unless + // one has been provided. + $post_name = ""; + if ( isset($content_struct['wp_slug']) ) + $post_name = $content_struct['wp_slug']; + + // Only use a password if one was given. + if ( isset($content_struct['wp_password']) ) + $post_password = $content_struct['wp_password']; + + // Only set a post parent if one was provided. + if ( isset($content_struct['wp_page_parent_id']) ) + $post_parent = $content_struct['wp_page_parent_id']; + + // Only set the menu_order if it was provided. + if ( isset($content_struct['wp_page_order']) ) + $menu_order = $content_struct['wp_page_order']; + + $post_author = $user->ID; + + // If an author id was provided then use it instead. + if ( isset($content_struct['wp_author_id']) && ($user->ID != $content_struct['wp_author_id']) ) { + switch ( $post_type ) { + case "post": + if ( !current_user_can('edit_others_posts') ) + return(new IXR_Error(401, __('You are not allowed to post as this user'))); + break; + case "page": + if ( !current_user_can('edit_others_pages') ) + return(new IXR_Error(401, __('You are not allowed to create pages as this user'))); + break; + default: + return(new IXR_Error(401, __('Invalid post type.'))); + break; + } + $post_author = $content_struct['wp_author_id']; + } + + $post_title = isset( $content_struct['title'] ) ? $content_struct['title'] : null; + $post_content = isset( $content_struct['description'] ) ? $content_struct['description'] : null; + + $post_status = $publish ? 'publish' : 'draft'; + + if ( isset( $content_struct["{$post_type}_status"] ) ) { + switch ( $content_struct["{$post_type}_status"] ) { + case 'draft': + case 'pending': + case 'private': + case 'publish': + $post_status = $content_struct["{$post_type}_status"]; + break; + default: + $post_status = $publish ? 'publish' : 'draft'; + break; + } + } + + $post_excerpt = isset($content_struct['mt_excerpt']) ? $content_struct['mt_excerpt'] : null; + $post_more = isset($content_struct['mt_text_more']) ? $content_struct['mt_text_more'] : null; + + $tags_input = isset($content_struct['mt_keywords']) ? $content_struct['mt_keywords'] : null; + + if ( isset($content_struct['mt_allow_comments']) ) { + if ( !is_numeric($content_struct['mt_allow_comments']) ) { + switch ( $content_struct['mt_allow_comments'] ) { + case 'closed': + $comment_status = 'closed'; + break; + case 'open': + $comment_status = 'open'; + break; + default: + $comment_status = get_option('default_comment_status'); + break; + } + } else { + switch ( (int) $content_struct['mt_allow_comments'] ) { + case 0: + case 2: + $comment_status = 'closed'; + break; + case 1: + $comment_status = 'open'; + break; + default: + $comment_status = get_option('default_comment_status'); + break; + } + } + } else { + $comment_status = get_option('default_comment_status'); + } + + if ( isset($content_struct['mt_allow_pings']) ) { + if ( !is_numeric($content_struct['mt_allow_pings']) ) { + switch ( $content_struct['mt_allow_pings'] ) { + case 'closed': + $ping_status = 'closed'; + break; + case 'open': + $ping_status = 'open'; + break; + default: + $ping_status = get_option('default_ping_status'); + break; + } + } else { + switch ( (int) $content_struct['mt_allow_pings'] ) { + case 0: + $ping_status = 'closed'; + break; + case 1: + $ping_status = 'open'; + break; + default: + $ping_status = get_option('default_ping_status'); + break; + } + } + } else { + $ping_status = get_option('default_ping_status'); + } + + if ( $post_more ) + $post_content = $post_content . '' . $post_more; + + $to_ping = null; + if ( isset( $content_struct['mt_tb_ping_urls'] ) ) { + $to_ping = $content_struct['mt_tb_ping_urls']; + if ( is_array($to_ping) ) + $to_ping = implode(' ', $to_ping); + } + + // Do some timestamp voodoo + if ( !empty( $content_struct['date_created_gmt'] ) ) + $dateCreated = str_replace( 'Z', '', $content_struct['date_created_gmt']->getIso() ) . 'Z'; // We know this is supposed to be GMT, so we're going to slap that Z on there by force + elseif ( !empty( $content_struct['dateCreated']) ) + $dateCreated = $content_struct['dateCreated']->getIso(); + + if ( !empty( $dateCreated ) ) { + $post_date = get_date_from_gmt(iso8601_to_datetime($dateCreated)); + $post_date_gmt = iso8601_to_datetime($dateCreated, 'GMT'); + } else { + $post_date = current_time('mysql'); + $post_date_gmt = current_time('mysql', 1); + } + + $post_category = array(); + if ( isset( $content_struct['categories'] ) ) { + $catnames = $content_struct['categories']; + logIO('O', 'Post cats: ' . var_export($catnames,true)); + + if ( is_array($catnames) ) { + foreach ($catnames as $cat) { + $post_category[] = get_cat_ID($cat); + } + } + } + + // We've got all the data -- post it: + $postdata = compact('post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_title', 'post_category', 'post_status', 'post_excerpt', 'comment_status', 'ping_status', 'to_ping', 'post_type', 'post_name', 'post_password', 'post_parent', 'menu_order', 'tags_input', 'page_template'); + + $post_ID = wp_insert_post($postdata, true); + if ( is_wp_error( $post_ID ) ) + return new IXR_Error(500, $post_ID->get_error_message()); + + if ( !$post_ID ) + return new IXR_Error(500, __('Sorry, your entry could not be posted. Something wrong happened.')); + + // Only posts can be sticky + if ( $post_type == 'post' && isset( $content_struct['sticky'] ) ) { + if ( $content_struct['sticky'] == true ) + stick_post( $post_ID ); + elseif ( $content_struct['sticky'] == false ) + unstick_post( $post_ID ); + } + + if ( isset($content_struct['custom_fields']) ) + $this->set_custom_fields($post_ID, $content_struct['custom_fields']); + + // Handle enclosures + $thisEnclosure = isset($content_struct['enclosure']) ? $content_struct['enclosure'] : null; + $this->add_enclosure_if_new($post_ID, $thisEnclosure); + + $this->attach_uploads( $post_ID, $post_content ); + + // Handle post formats if assigned, value is validated earlier + // in this function + if ( isset( $content_struct['wp_post_format'] ) ) + wp_set_post_terms( $post_ID, array( 'post-format-' . $content_struct['wp_post_format'] ), 'post_format' ); + + logIO('O', "Posted ! ID: $post_ID"); + + return strval($post_ID); + } + + function add_enclosure_if_new($post_ID, $enclosure) { + if ( is_array( $enclosure ) && isset( $enclosure['url'] ) && isset( $enclosure['length'] ) && isset( $enclosure['type'] ) ) { + + $encstring = $enclosure['url'] . "\n" . $enclosure['length'] . "\n" . $enclosure['type']; + $found = false; + foreach ( (array) get_post_custom($post_ID) as $key => $val) { + if ($key == 'enclosure') { + foreach ( (array) $val as $enc ) { + if ($enc == $encstring) { + $found = true; + break 2; + } + } + } + } + if (!$found) + add_post_meta( $post_ID, 'enclosure', $encstring ); + } + } + + /** + * Attach upload to a post. + * + * @since 2.1.0 + * + * @param int $post_ID Post ID. + * @param string $post_content Post Content for attachment. + */ + function attach_uploads( $post_ID, $post_content ) { + global $wpdb; + + // find any unattached files + $attachments = $wpdb->get_results( "SELECT ID, guid FROM {$wpdb->posts} WHERE post_parent = '0' AND post_type = 'attachment'" ); + if ( is_array( $attachments ) ) { + foreach ( $attachments as $file ) { + if ( strpos( $post_content, $file->guid ) !== false ) + $wpdb->update($wpdb->posts, array('post_parent' => $post_ID), array('ID' => $file->ID) ); + } + } + } + + /** + * Edit a post. + * + * @since 1.5.0 + * + * @param array $args Method parameters. + * @return bool True on success. + */ + function mw_editPost($args) { + + $this->escape($args); + + $post_ID = (int) $args[0]; + $username = $args[1]; + $password = $args[2]; + $content_struct = $args[3]; + $publish = $args[4]; + + if ( !$user = $this->login($username, $password) ) + return $this->error; + + do_action('xmlrpc_call', 'metaWeblog.editPost'); + + $cap = ( $publish ) ? 'publish_posts' : 'edit_posts'; + $error_message = __( 'Sorry, you are not allowed to publish posts on this site.' ); + $post_type = 'post'; + $page_template = ''; + if ( !empty( $content_struct['post_type'] ) ) { + if ( $content_struct['post_type'] == 'page' ) { + if ( $publish || 'publish' == $content_struct['page_status'] ) + $cap = 'publish_pages'; + else + $cap = 'edit_pages'; + $error_message = __( 'Sorry, you are not allowed to publish pages on this site.' ); + $post_type = 'page'; + if ( !empty( $content_struct['wp_page_template'] ) ) + $page_template = $content_struct['wp_page_template']; + } elseif ( $content_struct['post_type'] == 'post' ) { + if ( $publish || 'publish' == $content_struct['post_status'] ) + $cap = 'publish_posts'; + else + $cap = 'edit_posts'; + $error_message = __( 'Sorry, you are not allowed to publish posts on this site.' ); + $post_type = 'post'; + } else { + // No other post_type values are allowed here + return new IXR_Error( 401, __( 'Invalid post type.' ) ); + } + } else { + if ( $publish || 'publish' == $content_struct['post_status'] ) + $cap = 'publish_posts'; + else + $cap = 'edit_posts'; + $error_message = __( 'Sorry, you are not allowed to publish posts on this site.' ); + $post_type = 'post'; + } + + if ( !current_user_can( $cap ) ) + return new IXR_Error( 401, $error_message ); + + // Check for a valid post format if one was given + if ( isset( $content_struct['wp_post_format'] ) ) { + $content_struct['wp_post_format'] = sanitize_key( $content_struct['wp_post_format'] ); + if ( !array_key_exists( $content_struct['wp_post_format'], get_post_format_strings() ) ) { + return new IXR_Error( 404, __( 'Invalid post format' ) ); + } + } + + $postdata = wp_get_single_post($post_ID, ARRAY_A); + + // If there is no post data for the give post id, stop + // now and return an error. Other wise a new post will be + // created (which was the old behavior). + if ( empty($postdata["ID"]) ) + return(new IXR_Error(404, __('Invalid post ID.'))); + + $this->escape($postdata); + extract($postdata, EXTR_SKIP); + + // Let WordPress manage slug if none was provided. + $post_name = ""; + $post_name = $postdata['post_name']; + if ( isset($content_struct['wp_slug']) ) + $post_name = $content_struct['wp_slug']; + + // Only use a password if one was given. + if ( isset($content_struct['wp_password']) ) + $post_password = $content_struct['wp_password']; + + // Only set a post parent if one was given. + if ( isset($content_struct['wp_page_parent_id']) ) + $post_parent = $content_struct['wp_page_parent_id']; + + // Only set the menu_order if it was given. + if ( isset($content_struct['wp_page_order']) ) + $menu_order = $content_struct['wp_page_order']; + + $post_author = $postdata['post_author']; + + // Only set the post_author if one is set. + if ( isset($content_struct['wp_author_id']) && ($user->ID != $content_struct['wp_author_id']) ) { + switch ( $post_type ) { + case 'post': + if ( !current_user_can('edit_others_posts') ) + return(new IXR_Error(401, __('You are not allowed to change the post author as this user.'))); + break; + case 'page': + if ( !current_user_can('edit_others_pages') ) + return(new IXR_Error(401, __('You are not allowed to change the page author as this user.'))); + break; + default: + return(new IXR_Error(401, __('Invalid post type.'))); + break; + } + $post_author = $content_struct['wp_author_id']; + } + + if ( isset($content_struct['mt_allow_comments']) ) { + if ( !is_numeric($content_struct['mt_allow_comments']) ) { + switch ( $content_struct['mt_allow_comments'] ) { + case 'closed': + $comment_status = 'closed'; + break; + case 'open': + $comment_status = 'open'; + break; + default: + $comment_status = get_option('default_comment_status'); + break; + } + } else { + switch ( (int) $content_struct['mt_allow_comments'] ) { + case 0: + case 2: + $comment_status = 'closed'; + break; + case 1: + $comment_status = 'open'; + break; + default: + $comment_status = get_option('default_comment_status'); + break; + } + } + } + + if ( isset($content_struct['mt_allow_pings']) ) { + if ( !is_numeric($content_struct['mt_allow_pings']) ) { + switch ( $content_struct['mt_allow_pings'] ) { + case 'closed': + $ping_status = 'closed'; + break; + case 'open': + $ping_status = 'open'; + break; + default: + $ping_status = get_option('default_ping_status'); + break; + } + } else { + switch ( (int) $content_struct["mt_allow_pings"] ) { + case 0: + $ping_status = 'closed'; + break; + case 1: + $ping_status = 'open'; + break; + default: + $ping_status = get_option('default_ping_status'); + break; + } + } + } + + $post_title = isset( $content_struct['title'] ) ? $content_struct['title'] : null; + $post_content = isset( $content_struct['description'] ) ? $content_struct['description'] : null; + + $post_category = array(); + if ( isset( $content_struct['categories'] ) ) { + $catnames = $content_struct['categories']; + if ( is_array($catnames) ) { + foreach ($catnames as $cat) { + $post_category[] = get_cat_ID($cat); + } + } + } + + $post_excerpt = isset( $content_struct['mt_excerpt'] ) ? $content_struct['mt_excerpt'] : null; + $post_more = isset( $content_struct['mt_text_more'] ) ? $content_struct['mt_text_more'] : null; + + $post_status = $publish ? 'publish' : 'draft'; + if ( isset( $content_struct["{$post_type}_status"] ) ) { + switch( $content_struct["{$post_type}_status"] ) { + case 'draft': + case 'pending': + case 'private': + case 'publish': + $post_status = $content_struct["{$post_type}_status"]; + break; + default: + $post_status = $publish ? 'publish' : 'draft'; + break; + } + } + + $tags_input = isset( $content_struct['mt_keywords'] ) ? $content_struct['mt_keywords'] : null; + + if ( ('publish' == $post_status) ) { + if ( ( 'page' == $post_type ) && !current_user_can('publish_pages') ) + return new IXR_Error(401, __('Sorry, you do not have the right to publish this page.')); + else if ( !current_user_can('publish_posts') ) + return new IXR_Error(401, __('Sorry, you do not have the right to publish this post.')); + } + + if ( $post_more ) + $post_content = $post_content . "" . $post_more; + + $to_ping = null; + if ( isset( $content_struct['mt_tb_ping_urls'] ) ) { + $to_ping = $content_struct['mt_tb_ping_urls']; + if ( is_array($to_ping) ) + $to_ping = implode(' ', $to_ping); + } + + // Do some timestamp voodoo + if ( !empty( $content_struct['date_created_gmt'] ) ) + $dateCreated = str_replace( 'Z', '', $content_struct['date_created_gmt']->getIso() ) . 'Z'; // We know this is supposed to be GMT, so we're going to slap that Z on there by force + elseif ( !empty( $content_struct['dateCreated']) ) + $dateCreated = $content_struct['dateCreated']->getIso(); + + if ( !empty( $dateCreated ) ) { + $post_date = get_date_from_gmt(iso8601_to_datetime($dateCreated)); + $post_date_gmt = iso8601_to_datetime($dateCreated, 'GMT'); + } else { + $post_date = $postdata['post_date']; + $post_date_gmt = $postdata['post_date_gmt']; + } + + // We've got all the data -- post it: + $newpost = compact('ID', 'post_content', 'post_title', 'post_category', 'post_status', 'post_excerpt', 'comment_status', 'ping_status', 'post_date', 'post_date_gmt', 'to_ping', 'post_name', 'post_password', 'post_parent', 'menu_order', 'post_author', 'tags_input', 'page_template'); + + $result = wp_update_post($newpost, true); + if ( is_wp_error( $result ) ) + return new IXR_Error(500, $result->get_error_message()); + + if ( !$result ) + return new IXR_Error(500, __('Sorry, your entry could not be edited. Something wrong happened.')); + + // Only posts can be sticky + if ( $post_type == 'post' && isset( $content_struct['sticky'] ) ) { + if ( $content_struct['sticky'] == true ) + stick_post( $post_ID ); + elseif ( $content_struct['sticky'] == false ) + unstick_post( $post_ID ); + } + + if ( isset($content_struct['custom_fields']) ) + $this->set_custom_fields($post_ID, $content_struct['custom_fields']); + + // Handle enclosures + $thisEnclosure = isset($content_struct['enclosure']) ? $content_struct['enclosure'] : null; + $this->add_enclosure_if_new($post_ID, $thisEnclosure); + + $this->attach_uploads( $ID, $post_content ); + + // Handle post formats if assigned, validation is handled + // earlier in this function + if ( isset( $content_struct['wp_post_format'] ) ) + wp_set_post_terms( $post_ID, array( 'post-format-' . $content_struct['wp_post_format'] ), 'post_format' ); + + logIO('O',"(MW) Edited ! ID: $post_ID"); + + return true; + } + + /** + * Retrieve post. + * + * @since 1.5.0 + * + * @param array $args Method parameters. + * @return array + */ + function mw_getPost($args) { + + $this->escape($args); + + $post_ID = (int) $args[0]; + $username = $args[1]; + $password = $args[2]; + + if ( !$user = $this->login($username, $password) ) + return $this->error; + + if ( !current_user_can( 'edit_post', $post_ID ) ) + return new IXR_Error( 401, __( 'Sorry, you cannot edit this post.' ) ); + + do_action('xmlrpc_call', 'metaWeblog.getPost'); + + $postdata = wp_get_single_post($post_ID, ARRAY_A); + + if ($postdata['post_date'] != '') { + $post_date = mysql2date('Ymd\TH:i:s', $postdata['post_date'], false); + $post_date_gmt = mysql2date('Ymd\TH:i:s', $postdata['post_date_gmt'], false); + + // For drafts use the GMT version of the post date + if ( $postdata['post_status'] == 'draft' ) + $post_date_gmt = get_gmt_from_date( mysql2date( 'Y-m-d H:i:s', $postdata['post_date'] ), 'Ymd\TH:i:s' ); + + $categories = array(); + $catids = wp_get_post_categories($post_ID); + foreach($catids as $catid) + $categories[] = get_cat_name($catid); + + $tagnames = array(); + $tags = wp_get_post_tags( $post_ID ); + if ( !empty( $tags ) ) { + foreach ( $tags as $tag ) + $tagnames[] = $tag->name; + $tagnames = implode( ', ', $tagnames ); + } else { + $tagnames = ''; + } + + $post = get_extended($postdata['post_content']); + $link = post_permalink($postdata['ID']); + + // Get the author info. + $author = get_userdata($postdata['post_author']); + + $allow_comments = ('open' == $postdata['comment_status']) ? 1 : 0; + $allow_pings = ('open' == $postdata['ping_status']) ? 1 : 0; + + // Consider future posts as published + if ( $postdata['post_status'] === 'future' ) + $postdata['post_status'] = 'publish'; + + // Get post format + $post_format = get_post_format( $post_ID ); + if ( empty( $post_format ) ) + $post_format = 'standard'; + + $sticky = false; + if ( is_sticky( $post_ID ) ) + $sticky = true; + + $enclosure = array(); + foreach ( (array) get_post_custom($post_ID) as $key => $val) { + if ($key == 'enclosure') { + foreach ( (array) $val as $enc ) { + $encdata = split("\n", $enc); + $enclosure['url'] = trim(htmlspecialchars($encdata[0])); + $enclosure['length'] = (int) trim($encdata[1]); + $enclosure['type'] = trim($encdata[2]); + break 2; + } + } + } + + $resp = array( + 'dateCreated' => new IXR_Date($post_date), + 'userid' => $postdata['post_author'], + 'postid' => $postdata['ID'], + 'description' => $post['main'], + 'title' => $postdata['post_title'], + 'link' => $link, + 'permaLink' => $link, + // commented out because no other tool seems to use this + // 'content' => $entry['post_content'], + 'categories' => $categories, + 'mt_excerpt' => $postdata['post_excerpt'], + 'mt_text_more' => $post['extended'], + 'mt_allow_comments' => $allow_comments, + 'mt_allow_pings' => $allow_pings, + 'mt_keywords' => $tagnames, + 'wp_slug' => $postdata['post_name'], + 'wp_password' => $postdata['post_password'], + 'wp_author_id' => $author->ID, + 'wp_author_display_name' => $author->display_name, + 'date_created_gmt' => new IXR_Date($post_date_gmt), + 'post_status' => $postdata['post_status'], + 'custom_fields' => $this->get_custom_fields($post_ID), + 'wp_post_format' => $post_format, + 'sticky' => $sticky + ); + + if ( !empty($enclosure) ) $resp['enclosure'] = $enclosure; + + return $resp; + } else { + return new IXR_Error(404, __('Sorry, no such post.')); + } + } + + /** + * Retrieve list of recent posts. + * + * @since 1.5.0 + * + * @param array $args Method parameters. + * @return array + */ + function mw_getRecentPosts($args) { + + $this->escape($args); + + $blog_ID = (int) $args[0]; + $username = $args[1]; + $password = $args[2]; + if ( isset( $args[3] ) ) + $query = array( 'numberposts' => absint( $args[3] ) ); + else + $query = array(); + + if ( !$user = $this->login($username, $password) ) + return $this->error; + + do_action('xmlrpc_call', 'metaWeblog.getRecentPosts'); + + $posts_list = wp_get_recent_posts( $query ); + + if ( !$posts_list ) + return array( ); + + foreach ($posts_list as $entry) { + if ( !current_user_can( 'edit_post', $entry['ID'] ) ) + continue; + + $post_date = mysql2date('Ymd\TH:i:s', $entry['post_date'], false); + $post_date_gmt = mysql2date('Ymd\TH:i:s', $entry['post_date_gmt'], false); + + // For drafts use the GMT version of the date + if ( $entry['post_status'] == 'draft' ) + $post_date_gmt = get_gmt_from_date( mysql2date( 'Y-m-d H:i:s', $entry['post_date'] ), 'Ymd\TH:i:s' ); + + $categories = array(); + $catids = wp_get_post_categories($entry['ID']); + foreach( $catids as $catid ) + $categories[] = get_cat_name($catid); + + $tagnames = array(); + $tags = wp_get_post_tags( $entry['ID'] ); + if ( !empty( $tags ) ) { + foreach ( $tags as $tag ) { + $tagnames[] = $tag->name; + } + $tagnames = implode( ', ', $tagnames ); + } else { + $tagnames = ''; + } + + $post = get_extended($entry['post_content']); + $link = post_permalink($entry['ID']); + + // Get the post author info. + $author = get_userdata($entry['post_author']); + + $allow_comments = ('open' == $entry['comment_status']) ? 1 : 0; + $allow_pings = ('open' == $entry['ping_status']) ? 1 : 0; + + // Consider future posts as published + if ( $entry['post_status'] === 'future' ) + $entry['post_status'] = 'publish'; + + // Get post format + $post_format = get_post_format( $entry['ID'] ); + if ( empty( $post_format ) ) + $post_format = 'standard'; + + $struct[] = array( + 'dateCreated' => new IXR_Date($post_date), + 'userid' => $entry['post_author'], + 'postid' => (string) $entry['ID'], + 'description' => $post['main'], + 'title' => $entry['post_title'], + 'link' => $link, + 'permaLink' => $link, + // commented out because no other tool seems to use this + // 'content' => $entry['post_content'], + 'categories' => $categories, + 'mt_excerpt' => $entry['post_excerpt'], + 'mt_text_more' => $post['extended'], + 'mt_allow_comments' => $allow_comments, + 'mt_allow_pings' => $allow_pings, + 'mt_keywords' => $tagnames, + 'wp_slug' => $entry['post_name'], + 'wp_password' => $entry['post_password'], + 'wp_author_id' => $author->ID, + 'wp_author_display_name' => $author->display_name, + 'date_created_gmt' => new IXR_Date($post_date_gmt), + 'post_status' => $entry['post_status'], + 'custom_fields' => $this->get_custom_fields($entry['ID']), + 'wp_post_format' => $post_format + ); + + } + + $recent_posts = array(); + for ( $j=0; $jescape($args); + + $blog_ID = (int) $args[0]; + $username = $args[1]; + $password = $args[2]; + + if ( !$user = $this->login($username, $password) ) + return $this->error; + + if ( !current_user_can( 'edit_posts' ) ) + return new IXR_Error( 401, __( 'Sorry, you must be able to edit posts on this site in order to view categories.' ) ); + + do_action('xmlrpc_call', 'metaWeblog.getCategories'); + + $categories_struct = array(); + + if ( $cats = get_categories(array('get' => 'all')) ) { + foreach ( $cats as $cat ) { + $struct['categoryId'] = $cat->term_id; + $struct['parentId'] = $cat->parent; + $struct['description'] = $cat->name; + $struct['categoryDescription'] = $cat->description; + $struct['categoryName'] = $cat->name; + $struct['htmlUrl'] = esc_html(get_category_link($cat->term_id)); + $struct['rssUrl'] = esc_html(get_category_feed_link($cat->term_id, 'rss2')); + + $categories_struct[] = $struct; + } + } + + return $categories_struct; + } + + /** + * Uploads a file, following your settings. + * + * Adapted from a patch by Johann Richard. + * + * @link http://mycvs.org/archives/2004/06/30/file-upload-to-wordpress-in-ecto/ + * + * @since 1.5.0 + * + * @param array $args Method parameters. + * @return array + */ + function mw_newMediaObject($args) { + global $wpdb; + + $blog_ID = (int) $args[0]; + $username = $wpdb->escape($args[1]); + $password = $wpdb->escape($args[2]); + $data = $args[3]; + + $name = sanitize_file_name( $data['name'] ); + $type = $data['type']; + $bits = $data['bits']; + + logIO('O', '(MW) Received '.strlen($bits).' bytes'); + + if ( !$user = $this->login($username, $password) ) + return $this->error; + + do_action('xmlrpc_call', 'metaWeblog.newMediaObject'); + + if ( !current_user_can('upload_files') ) { + logIO('O', '(MW) User does not have upload_files capability'); + $this->error = new IXR_Error(401, __('You are not allowed to upload files to this site.')); + return $this->error; + } + + if ( $upload_err = apply_filters( 'pre_upload_error', false ) ) + return new IXR_Error(500, $upload_err); + + if ( !empty($data['overwrite']) && ($data['overwrite'] == true) ) { + // Get postmeta info on the object. + $old_file = $wpdb->get_row(" + SELECT ID + FROM {$wpdb->posts} + WHERE post_title = '{$name}' + AND post_type = 'attachment' + "); + + // Delete previous file. + wp_delete_attachment($old_file->ID); + + // Make sure the new name is different by pre-pending the + // previous post id. + $filename = preg_replace('/^wpid\d+-/', '', $name); + $name = "wpid{$old_file->ID}-{$filename}"; + } + + $upload = wp_upload_bits($name, NULL, $bits); + if ( ! empty($upload['error']) ) { + $errorString = sprintf(__('Could not write file %1$s (%2$s)'), $name, $upload['error']); + logIO('O', '(MW) ' . $errorString); + return new IXR_Error(500, $errorString); + } + // Construct the attachment array + // attach to post_id 0 + $post_id = 0; + $attachment = array( + 'post_title' => $name, + 'post_content' => '', + 'post_type' => 'attachment', + 'post_parent' => $post_id, + 'post_mime_type' => $type, + 'guid' => $upload[ 'url' ] + ); + + // Save the data + $id = wp_insert_attachment( $attachment, $upload[ 'file' ], $post_id ); + wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $upload['file'] ) ); + + return apply_filters( 'wp_handle_upload', array( 'file' => $name, 'url' => $upload[ 'url' ], 'type' => $type ), 'upload' ); + } + + /* MovableType API functions + * specs on http://www.movabletype.org/docs/mtmanual_programmatic.html + */ + + /** + * Retrieve the post titles of recent posts. + * + * @since 1.5.0 + * + * @param array $args Method parameters. + * @return array + */ + function mt_getRecentPostTitles($args) { + + $this->escape($args); + + $blog_ID = (int) $args[0]; + $username = $args[1]; + $password = $args[2]; + if ( isset( $args[3] ) ) + $query = array( 'numberposts' => absint( $args[3] ) ); + else + $query = array(); + + if ( !$user = $this->login($username, $password) ) + return $this->error; + + do_action('xmlrpc_call', 'mt.getRecentPostTitles'); + + $posts_list = wp_get_recent_posts( $query ); + + if ( !$posts_list ) { + $this->error = new IXR_Error(500, __('Either there are no posts, or something went wrong.')); + return $this->error; + } + + foreach ($posts_list as $entry) { + if ( !current_user_can( 'edit_post', $entry['ID'] ) ) + continue; + + $post_date = mysql2date('Ymd\TH:i:s', $entry['post_date'], false); + $post_date_gmt = mysql2date('Ymd\TH:i:s', $entry['post_date_gmt'], false); + + // For drafts use the GMT version of the date + if ( $entry['post_status'] == 'draft' ) + $post_date_gmt = get_gmt_from_date( mysql2date( 'Y-m-d H:i:s', $entry['post_date'] ), 'Ymd\TH:i:s' ); + + $struct[] = array( + 'dateCreated' => new IXR_Date($post_date), + 'userid' => $entry['post_author'], + 'postid' => (string) $entry['ID'], + 'title' => $entry['post_title'], + 'post_status' => $entry['post_status'], + 'date_created_gmt' => new IXR_Date($post_date_gmt) + ); + + } + + $recent_posts = array(); + for ( $j=0; $jescape($args); + + $blog_ID = (int) $args[0]; + $username = $args[1]; + $password = $args[2]; + + if ( !$user = $this->login($username, $password) ) + return $this->error; + + if ( !current_user_can( 'edit_posts' ) ) + return new IXR_Error( 401, __( 'Sorry, you must be able to edit posts on this site in order to view categories.' ) ); + + do_action('xmlrpc_call', 'mt.getCategoryList'); + + $categories_struct = array(); + + if ( $cats = get_categories(array('hide_empty' => 0, 'hierarchical' => 0)) ) { + foreach ( $cats as $cat ) { + $struct['categoryId'] = $cat->term_id; + $struct['categoryName'] = $cat->name; + + $categories_struct[] = $struct; + } + } + + return $categories_struct; + } + + /** + * Retrieve post categories. + * + * @since 1.5.0 + * + * @param array $args Method parameters. + * @return array + */ + function mt_getPostCategories($args) { + + $this->escape($args); + + $post_ID = (int) $args[0]; + $username = $args[1]; + $password = $args[2]; + + if ( !$user = $this->login($username, $password) ) + return $this->error; + + if ( !current_user_can( 'edit_post', $post_ID ) ) + return new IXR_Error( 401, __( 'Sorry, you can not edit this post.' ) ); + + do_action('xmlrpc_call', 'mt.getPostCategories'); + + $categories = array(); + $catids = wp_get_post_categories(intval($post_ID)); + // first listed category will be the primary category + $isPrimary = true; + foreach ( $catids as $catid ) { + $categories[] = array( + 'categoryName' => get_cat_name($catid), + 'categoryId' => (string) $catid, + 'isPrimary' => $isPrimary + ); + $isPrimary = false; + } + + return $categories; + } + + /** + * Sets categories for a post. + * + * @since 1.5.0 + * + * @param array $args Method parameters. + * @return bool True on success. + */ + function mt_setPostCategories($args) { + + $this->escape($args); + + $post_ID = (int) $args[0]; + $username = $args[1]; + $password = $args[2]; + $categories = $args[3]; + + if ( !$user = $this->login($username, $password) ) + return $this->error; + + do_action('xmlrpc_call', 'mt.setPostCategories'); + + if ( !current_user_can('edit_post', $post_ID) ) + return new IXR_Error(401, __('Sorry, you cannot edit this post.')); + + foreach ( $categories as $cat ) { + $catids[] = $cat['categoryId']; + } + + wp_set_post_categories($post_ID, $catids); + + return true; + } + + /** + * Retrieve an array of methods supported by this server. + * + * @since 1.5.0 + * + * @param array $args Method parameters. + * @return array + */ + function mt_supportedMethods($args) { + + do_action('xmlrpc_call', 'mt.supportedMethods'); + + $supported_methods = array(); + foreach ( $this->methods as $key => $value ) { + $supported_methods[] = $key; + } + + return $supported_methods; + } + + /** + * Retrieve an empty array because we don't support per-post text filters. + * + * @since 1.5.0 + * + * @param array $args Method parameters. + */ + function mt_supportedTextFilters($args) { + do_action('xmlrpc_call', 'mt.supportedTextFilters'); + return apply_filters('xmlrpc_text_filters', array()); + } + + /** + * Retrieve trackbacks sent to a given post. + * + * @since 1.5.0 + * + * @param array $args Method parameters. + * @return mixed + */ + function mt_getTrackbackPings($args) { + + global $wpdb; + + $post_ID = intval($args); + + do_action('xmlrpc_call', 'mt.getTrackbackPings'); + + $actual_post = wp_get_single_post($post_ID, ARRAY_A); + + if ( !$actual_post ) + return new IXR_Error(404, __('Sorry, no such post.')); + + $comments = $wpdb->get_results( $wpdb->prepare("SELECT comment_author_url, comment_content, comment_author_IP, comment_type FROM $wpdb->comments WHERE comment_post_ID = %d", $post_ID) ); + + if ( !$comments ) + return array(); + + $trackback_pings = array(); + foreach ( $comments as $comment ) { + if ( 'trackback' == $comment->comment_type ) { + $content = $comment->comment_content; + $title = substr($content, 8, (strpos($content, '') - 8)); + $trackback_pings[] = array( + 'pingTitle' => $title, + 'pingURL' => $comment->comment_author_url, + 'pingIP' => $comment->comment_author_IP + ); + } + } + + return $trackback_pings; + } + + /** + * Sets a post's publish status to 'publish'. + * + * @since 1.5.0 + * + * @param array $args Method parameters. + * @return int + */ + function mt_publishPost($args) { + + $this->escape($args); + + $post_ID = (int) $args[0]; + $username = $args[1]; + $password = $args[2]; + + if ( !$user = $this->login($username, $password) ) + return $this->error; + + do_action('xmlrpc_call', 'mt.publishPost'); + + if ( !current_user_can('publish_posts') || !current_user_can('edit_post', $post_ID) ) + return new IXR_Error(401, __('Sorry, you cannot publish this post.')); + + $postdata = wp_get_single_post($post_ID,ARRAY_A); + + $postdata['post_status'] = 'publish'; + + // retain old cats + $cats = wp_get_post_categories($post_ID); + $postdata['post_category'] = $cats; + $this->escape($postdata); + + $result = wp_update_post($postdata); + + return $result; + } + + /* PingBack functions + * specs on www.hixie.ch/specs/pingback/pingback + */ + + /** + * Retrieves a pingback and registers it. + * + * @since 1.5.0 + * + * @param array $args Method parameters. + * @return array + */ + function pingback_ping($args) { + global $wpdb; + + do_action('xmlrpc_call', 'pingback.ping'); + + $this->escape($args); + + $pagelinkedfrom = $args[0]; + $pagelinkedto = $args[1]; + + $title = ''; + + $pagelinkedfrom = str_replace('&', '&', $pagelinkedfrom); + $pagelinkedto = str_replace('&', '&', $pagelinkedto); + $pagelinkedto = str_replace('&', '&', $pagelinkedto); + + // Check if the page linked to is in our site + $pos1 = strpos($pagelinkedto, str_replace(array('http://www.','http://','https://www.','https://'), '', get_option('home'))); + if ( !$pos1 ) + return new IXR_Error(0, __('Is there no link to us?')); + + // let's find which post is linked to + // FIXME: does url_to_postid() cover all these cases already? + // if so, then let's use it and drop the old code. + $urltest = parse_url($pagelinkedto); + if ( $post_ID = url_to_postid($pagelinkedto) ) { + $way = 'url_to_postid()'; + } elseif ( preg_match('#p/[0-9]{1,}#', $urltest['path'], $match) ) { + // the path defines the post_ID (archives/p/XXXX) + $blah = explode('/', $match[0]); + $post_ID = (int) $blah[1]; + $way = 'from the path'; + } elseif ( preg_match('#p=[0-9]{1,}#', $urltest['query'], $match) ) { + // the querystring defines the post_ID (?p=XXXX) + $blah = explode('=', $match[0]); + $post_ID = (int) $blah[1]; + $way = 'from the querystring'; + } elseif ( isset($urltest['fragment']) ) { + // an #anchor is there, it's either... + if ( intval($urltest['fragment']) ) { + // ...an integer #XXXX (simpliest case) + $post_ID = (int) $urltest['fragment']; + $way = 'from the fragment (numeric)'; + } elseif ( preg_match('/post-[0-9]+/',$urltest['fragment']) ) { + // ...a post id in the form 'post-###' + $post_ID = preg_replace('/[^0-9]+/', '', $urltest['fragment']); + $way = 'from the fragment (post-###)'; + } elseif ( is_string($urltest['fragment']) ) { + // ...or a string #title, a little more complicated + $title = preg_replace('/[^a-z0-9]/i', '.', $urltest['fragment']); + $sql = $wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_title RLIKE %s", like_escape( $title ) ); + if (! ($post_ID = $wpdb->get_var($sql)) ) { + // returning unknown error '0' is better than die()ing + return new IXR_Error(0, ''); + } + $way = 'from the fragment (title)'; + } + } else { + // TODO: Attempt to extract a post ID from the given URL + return new IXR_Error(33, __('The specified target URL cannot be used as a target. It either doesn’t exist, or it is not a pingback-enabled resource.')); + } + $post_ID = (int) $post_ID; + + + logIO("O","(PB) URL='$pagelinkedto' ID='$post_ID' Found='$way'"); + + $post = get_post($post_ID); + + if ( !$post ) // Post_ID not found + return new IXR_Error(33, __('The specified target URL cannot be used as a target. It either doesn’t exist, or it is not a pingback-enabled resource.')); + + if ( $post_ID == url_to_postid($pagelinkedfrom) ) + return new IXR_Error(0, __('The source URL and the target URL cannot both point to the same resource.')); + + // Check if pings are on + if ( !pings_open($post) ) + return new IXR_Error(33, __('The specified target URL cannot be used as a target. It either doesn’t exist, or it is not a pingback-enabled resource.')); + + // Let's check that the remote site didn't already pingback this entry + if ( $wpdb->get_results( $wpdb->prepare("SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_author_url = %s", $post_ID, $pagelinkedfrom) ) ) + return new IXR_Error( 48, __( 'The pingback has already been registered.' ) ); + + // very stupid, but gives time to the 'from' server to publish ! + sleep(1); + + // Let's check the remote site + $linea = wp_remote_fopen( $pagelinkedfrom ); + if ( !$linea ) + return new IXR_Error(16, __('The source URL does not exist.')); + + $linea = apply_filters('pre_remote_source', $linea, $pagelinkedto); + + // Work around bug in strip_tags(): + $linea = str_replace(']*>/", "\n\n", $linea ); + + preg_match('|([^<]*?)|is', $linea, $matchtitle); + $title = $matchtitle[1]; + if ( empty( $title ) ) + return new IXR_Error(32, __('We cannot find a title on that page.')); + + $linea = strip_tags( $linea, '' ); // just keep the tag we need + + $p = explode( "\n\n", $linea ); + + $preg_target = preg_quote($pagelinkedto, '|'); + + foreach ( $p as $para ) { + if ( strpos($para, $pagelinkedto) !== false ) { // it exists, but is it a link? + preg_match("|]+?".$preg_target."[^>]*>([^>]+?)|", $para, $context); + + // If the URL isn't in a link context, keep looking + if ( empty($context) ) + continue; + + // We're going to use this fake tag to mark the context in a bit + // the marker is needed in case the link text appears more than once in the paragraph + $excerpt = preg_replace('|\|', '', $para); + + // prevent really long link text + if ( strlen($context[1]) > 100 ) + $context[1] = substr($context[1], 0, 100) . '...'; + + $marker = ''.$context[1].''; // set up our marker + $excerpt= str_replace($context[0], $marker, $excerpt); // swap out the link for our marker + $excerpt = strip_tags($excerpt, ''); // strip all tags but our context marker + $excerpt = trim($excerpt); + $preg_marker = preg_quote($marker, '|'); + $excerpt = preg_replace("|.*?\s(.{0,100}$preg_marker.{0,100})\s.*|s", '$1', $excerpt); + $excerpt = strip_tags($excerpt); // YES, again, to remove the marker wrapper + break; + } + } + + if ( empty($context) ) // Link to target not found + return new IXR_Error(17, __('The source URL does not contain a link to the target URL, and so cannot be used as a source.')); + + $pagelinkedfrom = str_replace('&', '&', $pagelinkedfrom); + + $context = '[...] ' . esc_html( $excerpt ) . ' [...]'; + $pagelinkedfrom = $wpdb->escape( $pagelinkedfrom ); + + $comment_post_ID = (int) $post_ID; + $comment_author = $title; + $comment_author_email = ''; + $this->escape($comment_author); + $comment_author_url = $pagelinkedfrom; + $comment_content = $context; + $this->escape($comment_content); + $comment_type = 'pingback'; + + $commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_url', 'comment_author_email', 'comment_content', 'comment_type'); + + $comment_ID = wp_new_comment($commentdata); + do_action('pingback_post', $comment_ID); + + return sprintf(__('Pingback from %1$s to %2$s registered. Keep the web talking! :-)'), $pagelinkedfrom, $pagelinkedto); + } + + /** + * Retrieve array of URLs that pingbacked the given URL. + * + * Specs on http://www.aquarionics.com/misc/archives/blogite/0198.html + * + * @since 1.5.0 + * + * @param array $args Method parameters. + * @return array + */ + function pingback_extensions_getPingbacks($args) { + + global $wpdb; + + do_action('xmlrpc_call', 'pingback.extensions.getPingbacks'); + + $this->escape($args); + + $url = $args; + + $post_ID = url_to_postid($url); + if ( !$post_ID ) { + // We aren't sure that the resource is available and/or pingback enabled + return new IXR_Error(33, __('The specified target URL cannot be used as a target. It either doesn’t exist, or it is not a pingback-enabled resource.')); + } + + $actual_post = wp_get_single_post($post_ID, ARRAY_A); + + if ( !$actual_post ) { + // No such post = resource not found + return new IXR_Error(32, __('The specified target URL does not exist.')); + } + + $comments = $wpdb->get_results( $wpdb->prepare("SELECT comment_author_url, comment_content, comment_author_IP, comment_type FROM $wpdb->comments WHERE comment_post_ID = %d", $post_ID) ); + + if ( !$comments ) + return array(); + + $pingbacks = array(); + foreach ( $comments as $comment ) { + if ( 'pingback' == $comment->comment_type ) + $pingbacks[] = $comment->comment_author_url; + } + + return $pingbacks; + } +} +?> diff --git a/src/wp-includes/class-wp.php b/src/wp-includes/class-wp.php new file mode 100644 index 0000000..cf671bd --- /dev/null +++ b/src/wp-includes/class-wp.php @@ -0,0 +1,599 @@ +public_query_vars) ) + $this->public_query_vars[] = $qv; + } + + /** + * Set the value of a query variable. + * + * @since 2.3.0 + * + * @param string $key Query variable name. + * @param mixed $value Query variable value. + */ + function set_query_var($key, $value) { + $this->query_vars[$key] = $value; + } + + /** + * Parse request to find correct WordPress query. + * + * Sets up the query variables based on the request. There are also many + * filters and actions that can be used to further manipulate the result. + * + * @since 2.0.0 + * + * @param array|string $extra_query_vars Set the extra query variables. + */ + function parse_request($extra_query_vars = '') { + global $wp_rewrite; + + $this->query_vars = array(); + $post_type_query_vars = array(); + + if ( is_array($extra_query_vars) ) + $this->extra_query_vars = & $extra_query_vars; + else if (! empty($extra_query_vars)) + parse_str($extra_query_vars, $this->extra_query_vars); + + // Process PATH_INFO, REQUEST_URI, and 404 for permalinks. + + // Fetch the rewrite rules. + $rewrite = $wp_rewrite->wp_rewrite_rules(); + + if ( ! empty($rewrite) ) { + // If we match a rewrite rule, this will be cleared. + $error = '404'; + $this->did_permalink = true; + + if ( isset($_SERVER['PATH_INFO']) ) + $pathinfo = $_SERVER['PATH_INFO']; + else + $pathinfo = ''; + $pathinfo_array = explode('?', $pathinfo); + $pathinfo = str_replace("%", "%25", $pathinfo_array[0]); + $req_uri = $_SERVER['REQUEST_URI']; + $req_uri_array = explode('?', $req_uri); + $req_uri = $req_uri_array[0]; + $self = $_SERVER['PHP_SELF']; + $home_path = parse_url(home_url()); + if ( isset($home_path['path']) ) + $home_path = $home_path['path']; + else + $home_path = ''; + $home_path = trim($home_path, '/'); + + // Trim path info from the end and the leading home path from the + // front. For path info requests, this leaves us with the requesting + // filename, if any. For 404 requests, this leaves us with the + // requested permalink. + $req_uri = str_replace($pathinfo, '', $req_uri); + $req_uri = trim($req_uri, '/'); + $req_uri = preg_replace("|^$home_path|", '', $req_uri); + $req_uri = trim($req_uri, '/'); + $pathinfo = trim($pathinfo, '/'); + $pathinfo = preg_replace("|^$home_path|", '', $pathinfo); + $pathinfo = trim($pathinfo, '/'); + $self = trim($self, '/'); + $self = preg_replace("|^$home_path|", '', $self); + $self = trim($self, '/'); + + // The requested permalink is in $pathinfo for path info requests and + // $req_uri for other requests. + if ( ! empty($pathinfo) && !preg_match('|^.*' . $wp_rewrite->index . '$|', $pathinfo) ) { + $request = $pathinfo; + } else { + // If the request uri is the index, blank it out so that we don't try to match it against a rule. + if ( $req_uri == $wp_rewrite->index ) + $req_uri = ''; + $request = $req_uri; + } + + $this->request = $request; + + // Look for matches. + $request_match = $request; + foreach ( (array) $rewrite as $match => $query) { + // Don't try to match against AtomPub calls + if ( $req_uri == 'wp-app.php' ) + break; + + // If the requesting file is the anchor of the match, prepend it + // to the path info. + if ( (! empty($req_uri)) && (strpos($match, $req_uri) === 0) && ($req_uri != $request) ) + $request_match = $req_uri . '/' . $request; + + if ( preg_match("#^$match#", $request_match, $matches) || + preg_match("#^$match#", urldecode($request_match), $matches) ) { + // Got a match. + $this->matched_rule = $match; + + // Trim the query of everything up to the '?'. + $query = preg_replace("!^.+\?!", '', $query); + + // Substitute the substring matches into the query. + $query = addslashes(WP_MatchesMapRegex::apply($query, $matches)); + + $this->matched_query = $query; + + // Parse the query. + parse_str($query, $perma_query_vars); + + // If we're processing a 404 request, clear the error var + // since we found something. + if ( isset($_GET['error']) ) + unset($_GET['error']); + + if ( isset($error) ) + unset($error); + + break; + } + } + + // If req_uri is empty or if it is a request for ourself, unset error. + if ( empty($request) || $req_uri == $self || strpos($_SERVER['PHP_SELF'], 'wp-admin/') !== false ) { + if ( isset($_GET['error']) ) + unset($_GET['error']); + + if ( isset($error) ) + unset($error); + + if ( isset($perma_query_vars) && strpos($_SERVER['PHP_SELF'], 'wp-admin/') !== false ) + unset($perma_query_vars); + + $this->did_permalink = false; + } + } + + $this->public_query_vars = apply_filters('query_vars', $this->public_query_vars); + + foreach ( $GLOBALS['wp_post_types'] as $post_type => $t ) + if ( $t->query_var ) + $post_type_query_vars[$t->query_var] = $post_type; + + foreach ( $this->public_query_vars as $wpvar ) { + if ( isset( $this->extra_query_vars[$wpvar] ) ) + $this->query_vars[$wpvar] = $this->extra_query_vars[$wpvar]; + elseif ( isset( $_POST[$wpvar] ) ) + $this->query_vars[$wpvar] = $_POST[$wpvar]; + elseif ( isset( $_GET[$wpvar] ) ) + $this->query_vars[$wpvar] = $_GET[$wpvar]; + elseif ( isset( $perma_query_vars[$wpvar] ) ) + $this->query_vars[$wpvar] = $perma_query_vars[$wpvar]; + + if ( !empty( $this->query_vars[$wpvar] ) ) { + if ( ! is_array( $this->query_vars[$wpvar] ) ) { + $this->query_vars[$wpvar] = (string) $this->query_vars[$wpvar]; + } else { + foreach ( $this->query_vars[$wpvar] as $vkey => $v ) { + if ( !is_object( $v ) ) { + $this->query_vars[$wpvar][$vkey] = (string) $v; + } + } + } + + if ( isset($post_type_query_vars[$wpvar] ) ) { + $this->query_vars['post_type'] = $post_type_query_vars[$wpvar]; + $this->query_vars['name'] = $this->query_vars[$wpvar]; + } + } + } + + // Convert urldecoded spaces back into + + foreach ( $GLOBALS['wp_taxonomies'] as $taxonomy => $t ) + if ( $t->query_var && isset( $this->query_vars[$t->query_var] ) ) + $this->query_vars[$t->query_var] = str_replace( ' ', '+', $this->query_vars[$t->query_var] ); + + // Limit publicly queried post_types to those that are publicly_queryable + if ( isset( $this->query_vars['post_type']) ) { + $queryable_post_types = get_post_types( array('publicly_queryable' => true) ); + if ( ! is_array( $this->query_vars['post_type'] ) ) { + if ( ! in_array( $this->query_vars['post_type'], $queryable_post_types ) ) + unset( $this->query_vars['post_type'] ); + } else { + $this->query_vars['post_type'] = array_intersect( $this->query_vars['post_type'], $queryable_post_types ); + } + } + + foreach ( (array) $this->private_query_vars as $var) { + if ( isset($this->extra_query_vars[$var]) ) + $this->query_vars[$var] = $this->extra_query_vars[$var]; + } + + if ( isset($error) ) + $this->query_vars['error'] = $error; + + $this->query_vars = apply_filters('request', $this->query_vars); + + do_action_ref_array('parse_request', array(&$this)); + } + + /** + * Send additional HTTP headers for caching, content type, etc. + * + * Sets the X-Pingback header, 404 status (if 404), Content-type. If showing + * a feed, it will also send last-modified, etag, and 304 status if needed. + * + * @since 2.0.0 + */ + function send_headers() { + $headers = array('X-Pingback' => get_bloginfo('pingback_url')); + $status = null; + $exit_required = false; + + if ( is_user_logged_in() ) + $headers = array_merge($headers, wp_get_nocache_headers()); + if ( !empty($this->query_vars['error']) && '404' == $this->query_vars['error'] ) { + $status = 404; + if ( !is_user_logged_in() ) + $headers = array_merge($headers, wp_get_nocache_headers()); + $headers['Content-Type'] = get_option('html_type') . '; charset=' . get_option('blog_charset'); + } else if ( empty($this->query_vars['feed']) ) { + $headers['Content-Type'] = get_option('html_type') . '; charset=' . get_option('blog_charset'); + } else { + // We're showing a feed, so WP is indeed the only thing that last changed + if ( !empty($this->query_vars['withcomments']) + || ( empty($this->query_vars['withoutcomments']) + && ( !empty($this->query_vars['p']) + || !empty($this->query_vars['name']) + || !empty($this->query_vars['page_id']) + || !empty($this->query_vars['pagename']) + || !empty($this->query_vars['attachment']) + || !empty($this->query_vars['attachment_id']) + ) + ) + ) + $wp_last_modified = mysql2date('D, d M Y H:i:s', get_lastcommentmodified('GMT'), 0).' GMT'; + else + $wp_last_modified = mysql2date('D, d M Y H:i:s', get_lastpostmodified('GMT'), 0).' GMT'; + $wp_etag = '"' . md5($wp_last_modified) . '"'; + $headers['Last-Modified'] = $wp_last_modified; + $headers['ETag'] = $wp_etag; + + // Support for Conditional GET + if (isset($_SERVER['HTTP_IF_NONE_MATCH'])) + $client_etag = stripslashes(stripslashes($_SERVER['HTTP_IF_NONE_MATCH'])); + else $client_etag = false; + + $client_last_modified = empty($_SERVER['HTTP_IF_MODIFIED_SINCE']) ? '' : trim($_SERVER['HTTP_IF_MODIFIED_SINCE']); + // If string is empty, return 0. If not, attempt to parse into a timestamp + $client_modified_timestamp = $client_last_modified ? strtotime($client_last_modified) : 0; + + // Make a timestamp for our most recent modification... + $wp_modified_timestamp = strtotime($wp_last_modified); + + if ( ($client_last_modified && $client_etag) ? + (($client_modified_timestamp >= $wp_modified_timestamp) && ($client_etag == $wp_etag)) : + (($client_modified_timestamp >= $wp_modified_timestamp) || ($client_etag == $wp_etag)) ) { + $status = 304; + $exit_required = true; + } + } + + $headers = apply_filters('wp_headers', $headers, $this); + + if ( ! empty( $status ) ) + status_header( $status ); + foreach( (array) $headers as $name => $field_value ) + @header("{$name}: {$field_value}"); + + if ( $exit_required ) + exit(); + + do_action_ref_array('send_headers', array(&$this)); + } + + /** + * Sets the query string property based off of the query variable property. + * + * The 'query_string' filter is deprecated, but still works. Plugins should + * use the 'request' filter instead. + * + * @since 2.0.0 + */ + function build_query_string() { + $this->query_string = ''; + foreach ( (array) array_keys($this->query_vars) as $wpvar) { + if ( '' != $this->query_vars[$wpvar] ) { + $this->query_string .= (strlen($this->query_string) < 1) ? '' : '&'; + if ( !is_scalar($this->query_vars[$wpvar]) ) // Discard non-scalars. + continue; + $this->query_string .= $wpvar . '=' . rawurlencode($this->query_vars[$wpvar]); + } + } + + // query_string filter deprecated. Use request filter instead. + if ( has_filter('query_string') ) { // Don't bother filtering and parsing if no plugins are hooked in. + $this->query_string = apply_filters('query_string', $this->query_string); + parse_str($this->query_string, $this->query_vars); + } + } + + /** + * Set up the WordPress Globals. + * + * The query_vars property will be extracted to the GLOBALS. So care should + * be taken when naming global variables that might interfere with the + * WordPress environment. + * + * @global string $query_string Query string for the loop. + * @global int $more Only set, if single page or post. + * @global int $single If single page or post. Only set, if single page or post. + * + * @since 2.0.0 + */ + function register_globals() { + global $wp_query; + // Extract updated query vars back into global namespace. + foreach ( (array) $wp_query->query_vars as $key => $value) { + $GLOBALS[$key] = $value; + } + + $GLOBALS['query_string'] = $this->query_string; + $GLOBALS['posts'] = & $wp_query->posts; + $GLOBALS['post'] = (isset($wp_query->post)) ? $wp_query->post : null; + $GLOBALS['request'] = $wp_query->request; + + if ( is_single() || is_page() ) { + $GLOBALS['more'] = 1; + $GLOBALS['single'] = 1; + } + } + + /** + * Set up the current user. + * + * @since 2.0.0 + */ + function init() { + wp_get_current_user(); + } + + /** + * Set up the Loop based on the query variables. + * + * @uses WP::$query_vars + * @since 2.0.0 + */ + function query_posts() { + global $wp_the_query; + $this->build_query_string(); + $wp_the_query->query($this->query_vars); + } + + /** + * Set the Headers for 404, if nothing is found for requested URL. + * + * Issue a 404 if a request doesn't match any posts and doesn't match + * any object (e.g. an existing-but-empty category, tag, author) and a 404 was not already + * issued, and if the request was not a search or the homepage. + * + * Otherwise, issue a 200. + * + * @since 2.0.0 + */ + function handle_404() { + global $wp_query; + + if ( !is_admin() && ( 0 == count( $wp_query->posts ) ) && !is_404() && !is_robots() && !is_search() && !is_home() ) { + // Don't 404 for these queries if they matched an object. + if ( ( is_tag() || is_category() || is_tax() || is_author() || is_post_type_archive() ) && $wp_query->get_queried_object() && !is_paged() ) { + if ( !is_404() ) + status_header( 200 ); + return; + } + $wp_query->set_404(); + status_header( 404 ); + nocache_headers(); + } elseif ( !is_404() ) { + status_header( 200 ); + } + } + + /** + * Sets up all of the variables required by the WordPress environment. + * + * The action 'wp' has one parameter that references the WP object. It + * allows for accessing the properties and methods to further manipulate the + * object. + * + * @since 2.0.0 + * + * @param string|array $query_args Passed to {@link parse_request()} + */ + function main($query_args = '') { + $this->init(); + $this->parse_request($query_args); + $this->send_headers(); + $this->query_posts(); + $this->handle_404(); + $this->register_globals(); + do_action_ref_array('wp', array(&$this)); + } + +} + +/** + * Helper class to remove the need to use eval to replace $matches[] in query strings. + * + * @since 2.9.0 + */ +class WP_MatchesMapRegex { + /** + * store for matches + * + * @access private + * @var array + */ + var $_matches; + + /** + * store for mapping result + * + * @access public + * @var string + */ + var $output; + + /** + * subject to perform mapping on (query string containing $matches[] references + * + * @access private + * @var string + */ + var $_subject; + + /** + * regexp pattern to match $matches[] references + * + * @var string + */ + var $_pattern = '(\$matches\[[1-9]+[0-9]*\])'; // magic number + + /** + * constructor + * + * @param string $subject subject if regex + * @param array $matches data to use in map + * @return self + */ + function WP_MatchesMapRegex($subject, $matches) { + $this->_subject = $subject; + $this->_matches = $matches; + $this->output = $this->_map(); + } + + /** + * Substitute substring matches in subject. + * + * static helper function to ease use + * + * @access public + * @param string $subject subject + * @param array $matches data used for subsitution + * @return string + */ + function apply($subject, $matches) { + $oSelf =& new WP_MatchesMapRegex($subject, $matches); + return $oSelf->output; + } + + /** + * do the actual mapping + * + * @access private + * @return string + */ + function _map() { + $callback = array(&$this, 'callback'); + return preg_replace_callback($this->_pattern, $callback, $this->_subject); + } + + /** + * preg_replace_callback hook + * + * @access public + * @param array $matches preg_replace regexp matches + * @return string + */ + function callback($matches) { + $index = intval(substr($matches[0], 9, -1)); + return ( isset( $this->_matches[$index] ) ? urlencode($this->_matches[$index]) : '' ); + } + +} + +?> diff --git a/src/wp-includes/class.wp-dependencies.php b/src/wp-includes/class.wp-dependencies.php new file mode 100644 index 0000000..0e3f51e --- /dev/null +++ b/src/wp-includes/class.wp-dependencies.php @@ -0,0 +1,236 @@ +queue : (array) $handles; + $this->all_deps( $handles ); + + foreach( $this->to_do as $key => $handle ) { + if ( !in_array($handle, $this->done) && isset($this->registered[$handle]) ) { + + if ( ! $this->registered[$handle]->src ) { // Defines a group. + $this->done[] = $handle; + continue; + } + + if ( $this->do_item( $handle, $group ) ) + $this->done[] = $handle; + + unset( $this->to_do[$key] ); + } + } + + return $this->done; + } + + function do_item( $handle ) { + return isset($this->registered[$handle]); + } + + /** + * Determines dependencies + * + * Recursively builds array of items to process taking dependencies into account. Does NOT catch infinite loops. + * + * + * @param mixed $handles Accepts (string) dep name or (array of strings) dep names + * @param bool $recursion Used internally when function calls itself + */ + function all_deps( $handles, $recursion = false, $group = false ) { + if ( !$handles = (array) $handles ) + return false; + + foreach ( $handles as $handle ) { + $handle_parts = explode('?', $handle); + $handle = $handle_parts[0]; + $queued = in_array($handle, $this->to_do, true); + + if ( in_array($handle, $this->done, true) ) // Already done + continue; + + $moved = $this->set_group( $handle, $recursion, $group ); + + if ( $queued && !$moved ) // already queued and in the right group + continue; + + $keep_going = true; + if ( !isset($this->registered[$handle]) ) + $keep_going = false; // Script doesn't exist + elseif ( $this->registered[$handle]->deps && array_diff($this->registered[$handle]->deps, array_keys($this->registered)) ) + $keep_going = false; // Script requires deps which don't exist (not a necessary check. efficiency?) + elseif ( $this->registered[$handle]->deps && !$this->all_deps( $this->registered[$handle]->deps, true, $group ) ) + $keep_going = false; // Script requires deps which don't exist + + if ( !$keep_going ) { // Either script or its deps don't exist. + if ( $recursion ) + return false; // Abort this branch. + else + continue; // We're at the top level. Move on to the next one. + } + + if ( $queued ) // Already grobbed it and its deps + continue; + + if ( isset($handle_parts[1]) ) + $this->args[$handle] = $handle_parts[1]; + + $this->to_do[] = $handle; + } + + return true; + } + + /** + * Adds item + * + * Adds the item only if no item of that name already exists + * + * @param string $handle Script name + * @param string $src Script url + * @param array $deps (optional) Array of script names on which this script depends + * @param string $ver (optional) Script version (used for cache busting) + * @return array Hierarchical array of dependencies + */ + function add( $handle, $src, $deps = array(), $ver = false, $args = null ) { + if ( isset($this->registered[$handle]) ) + return false; + $this->registered[$handle] = new _WP_Dependency( $handle, $src, $deps, $ver, $args ); + return true; + } + + /** + * Adds extra data + * + * Adds data only if script has already been added + * + * @param string $handle Script name + * @param string $data_name Name of object in which to store extra data + * @param array $data Array of extra data + * @return bool success + */ + function add_data( $handle, $data_name, $data ) { + if ( !isset($this->registered[$handle]) ) + return false; + return $this->registered[$handle]->add_data( $data_name, $data ); + } + + function remove( $handles ) { + foreach ( (array) $handles as $handle ) + unset($this->registered[$handle]); + } + + function enqueue( $handles ) { + foreach ( (array) $handles as $handle ) { + $handle = explode('?', $handle); + if ( !in_array($handle[0], $this->queue) && isset($this->registered[$handle[0]]) ) { + $this->queue[] = $handle[0]; + if ( isset($handle[1]) ) + $this->args[$handle[0]] = $handle[1]; + } + } + } + + function dequeue( $handles ) { + foreach ( (array) $handles as $handle ) { + $handle = explode('?', $handle); + $key = array_search($handle[0], $this->queue); + if ( false !== $key ) { + unset($this->queue[$key]); + unset($this->args[$handle[0]]); + } + } + } + + function query( $handle, $list = 'registered' ) { // registered, queue, done, to_do + switch ( $list ) : + case 'registered': + case 'scripts': // back compat + if ( isset($this->registered[$handle]) ) + return $this->registered[$handle]; + break; + case 'to_print': // back compat + case 'printed': // back compat + if ( 'to_print' == $list ) + $list = 'to_do'; + else + $list = 'printed'; + default: + if ( in_array($handle, $this->$list) ) + return true; + break; + endswitch; + return false; + } + + function set_group( $handle, $recursion, $group ) { + $group = (int) $group; + + if ( $recursion ) + $group = min($this->group, $group); + else + $this->group = $group; + + if ( isset($this->groups[$handle]) && $this->groups[$handle] <= $group ) + return false; + + $this->groups[$handle] = $group; + return true; + } + +} + +class _WP_Dependency { + var $handle; + var $src; + var $deps = array(); + var $ver = false; + var $args = null; + + var $extra = array(); + + function __construct() { + @list($this->handle, $this->src, $this->deps, $this->ver, $this->args) = func_get_args(); + if ( !is_array($this->deps) ) + $this->deps = array(); + } + + function add_data( $name, $data ) { + if ( !is_scalar($name) ) + return false; + $this->extra[$name] = $data; + return true; + } +} diff --git a/src/wp-includes/class.wp-scripts.php b/src/wp-includes/class.wp-scripts.php new file mode 100644 index 0000000..681a824 --- /dev/null +++ b/src/wp-includes/class.wp-scripts.php @@ -0,0 +1,205 @@ +do_items( $handles, $group ); + } + + function print_scripts_l10n( $handle, $echo = true ) { + 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]; + + $data = "var $object_name = {\n"; + $eol = ''; + foreach ( $this->registered[$handle]->extra['l10n'][1] as $var => $val ) { + if ( 'l10n_print_after' == $var ) { + $after = $val; + continue; + } + $data .= "$eol\t$var: \"" . esc_js( $val ) . '"'; + $eol = ",\n"; + } + $data .= "\n};\n"; + $data .= isset($after) ? "$after\n" : ''; + + if ( $echo ) { + echo "\n"; + return true; + } else { + return $data; + } + } + + function do_item( $handle, $group = false ) { + if ( !parent::do_item($handle) ) + return false; + + if ( 0 === $group && $this->groups[$handle] > 0 ) { + $this->in_footer[] = $handle; + return false; + } + + if ( false === $group && in_array($handle, $this->in_footer, true) ) + $this->in_footer = array_diff( $this->in_footer, (array) $handle ); + + if ( null === $this->registered[$handle]->ver ) + $ver = ''; + else + $ver = $this->registered[$handle]->ver ? $this->registered[$handle]->ver : $this->default_version; + + if ( isset($this->args[$handle]) ) + $ver = $ver ? $ver . '&' . $this->args[$handle] : $this->args[$handle]; + + $src = $this->registered[$handle]->src; + + if ( $this->do_concat ) { + $srce = apply_filters( 'script_loader_src', $src, $handle ); + if ( $this->in_default_dir($srce) ) { + $this->print_code .= $this->print_scripts_l10n( $handle, false ); + $this->concat .= "$handle,"; + $this->concat_version .= "$handle$ver"; + return true; + } else { + $this->ext_handles .= "$handle,"; + $this->ext_version .= "$handle$ver"; + } + } + + $this->print_scripts_l10n( $handle ); + if ( !preg_match('|^https?://|', $src) && ! ( $this->content_url && 0 === strpos($src, $this->content_url) ) ) { + $src = $this->base_url . $src; + } + + if ( !empty($ver) ) + $src = add_query_arg('ver', $ver, $src); + $src = esc_url(apply_filters( 'script_loader_src', $src, $handle )); + + if ( $this->do_concat ) + $this->print_html .= "\n"; + else + 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 set_group( $handle, $recursion, $group = false ) { + $grp = isset($this->registered[$handle]->extra['group']) ? (int) $this->registered[$handle]->extra['group'] : 0; + if ( false !== $group && $grp > $group ) + $grp = $group; + + return parent::set_group( $handle, $recursion, $grp ); + } + + function all_deps( $handles, $recursion = false, $group = false ) { + $r = parent::all_deps( $handles, $recursion ); + if ( !$recursion ) + $this->to_do = apply_filters( 'print_scripts_array', $this->to_do ); + return $r; + } + + function do_head_items() { + $this->do_items(false, 0); + return $this->done; + } + + function do_footer_items() { + if ( !empty($this->in_footer) ) { + foreach( $this->in_footer as $key => $handle ) { + if ( !in_array($handle, $this->done, true) && isset($this->registered[$handle]) ) { + $this->do_item($handle); + $this->done[] = $handle; + unset( $this->in_footer[$key] ); + } + } + } + return $this->done; + } + + function in_default_dir($src) { + if ( ! $this->default_dirs ) + return true; + + if ( 0 === strpos( $src, '/wp-includes/js/l10n' ) ) + return false; + + foreach ( (array) $this->default_dirs as $test ) { + if ( 0 === strpos($src, $test) ) + return true; + } + return false; + } + + function reset() { + $this->do_concat = false; + $this->print_code = ''; + $this->concat = ''; + $this->concat_version = ''; + $this->print_html = ''; + $this->ext_version = ''; + $this->ext_handles = ''; + } +} diff --git a/src/wp-includes/class.wp-styles.php b/src/wp-includes/class.wp-styles.php new file mode 100644 index 0000000..ecc0bb9 --- /dev/null +++ b/src/wp-includes/class.wp-styles.php @@ -0,0 +1,126 @@ +registered[$handle]->ver ) + $ver = ''; + else + $ver = $this->registered[$handle]->ver ? $this->registered[$handle]->ver : $this->default_version; + + if ( isset($this->args[$handle]) ) + $ver = $ver ? $ver . '&' . $this->args[$handle] : $this->args[$handle]; + + if ( $this->do_concat ) { + if ( $this->in_default_dir($this->registered[$handle]->src) && !isset($this->registered[$handle]->extra['conditional']) && !isset($this->registered[$handle]->extra['alt']) ) { + $this->concat .= "$handle,"; + $this->concat_version .= "$handle$ver"; + return true; + } + } + + if ( isset($this->registered[$handle]->args) ) + $media = esc_attr( $this->registered[$handle]->args ); + else + $media = 'all'; + + $href = $this->_css_href( $this->registered[$handle]->src, $ver, $handle ); + $rel = isset($this->registered[$handle]->extra['alt']) && $this->registered[$handle]->extra['alt'] ? 'alternate stylesheet' : 'stylesheet'; + $title = isset($this->registered[$handle]->extra['title']) ? "title='" . esc_attr( $this->registered[$handle]->extra['title'] ) . "'" : ''; + + $end_cond = $tag = ''; + if ( isset($this->registered[$handle]->extra['conditional']) && $this->registered[$handle]->extra['conditional'] ) { + $tag .= "\n"; + } + + $tag .= apply_filters( 'style_loader_tag', "\n", $handle ); + if ( 'rtl' === $this->text_direction && isset($this->registered[$handle]->extra['rtl']) && $this->registered[$handle]->extra['rtl'] ) { + if ( is_bool( $this->registered[$handle]->extra['rtl'] ) ) { + $suffix = isset( $this->registered[$handle]->extra['suffix'] ) ? $this->registered[$handle]->extra['suffix'] : ''; + $rtl_href = str_replace( "{$suffix}.css", "-rtl{$suffix}.css", $this->_css_href( $this->registered[$handle]->src , $ver, "$handle-rtl" )); + } else { + $rtl_href = $this->_css_href( $this->registered[$handle]->extra['rtl'], $ver, "$handle-rtl" ); + } + + $tag .= apply_filters( 'style_loader_tag', "\n", $handle ); + } + + $tag .= $end_cond; + + if ( $this->do_concat ) + $this->print_html .= $tag; + else + echo $tag; + + // Could do something with $this->registered[$handle]->extra here to print out extra CSS rules +// echo "\n"; + + return true; + } + + function all_deps( $handles, $recursion = false, $group = false ) { + $r = parent::all_deps( $handles, $recursion ); + if ( !$recursion ) + $this->to_do = apply_filters( 'print_styles_array', $this->to_do ); + return $r; + } + + function _css_href( $src, $ver, $handle ) { + if ( !is_bool($src) && !preg_match('|^https?://|', $src) && ! ( $this->content_url && 0 === strpos($src, $this->content_url) ) ) { + $src = $this->base_url . $src; + } + + if ( !empty($ver) ) + $src = add_query_arg('ver', $ver, $src); + $src = apply_filters( 'style_loader_src', $src, $handle ); + return esc_url( $src ); + } + + function in_default_dir($src) { + if ( ! $this->default_dirs ) + return true; + + foreach ( (array) $this->default_dirs as $test ) { + if ( 0 === strpos($src, $test) ) + return true; + } + return false; + } + +} diff --git a/src/wp-includes/comment-template.php b/src/wp-includes/comment-template.php new file mode 100644 index 0000000..ce0f9dd --- /dev/null +++ b/src/wp-includes/comment-template.php @@ -0,0 +1,1590 @@ +comment_author) ) { + if (!empty($comment->user_id)){ + $user=get_userdata($comment->user_id); + $author=$user->user_login; + } else { + $author = __('Anonymous'); + } + } else { + $author = $comment->comment_author; + } + return apply_filters('get_comment_author', $author); +} + +/** + * Displays the author of the current comment. + * + * @since 0.71 + * @uses apply_filters() Calls 'comment_author' on comment author before displaying + * + * @param int $comment_ID The ID of the comment for which to print the author. Optional. + */ +function comment_author( $comment_ID = 0 ) { + $author = apply_filters('comment_author', get_comment_author( $comment_ID ) ); + echo $author; +} + +/** + * Retrieve the email of the author of the current comment. + * + * @since 1.5.0 + * @uses apply_filters() Calls the 'get_comment_author_email' hook on the comment author email + * @uses $comment + * + * @param int $comment_ID The ID of the comment for which to get the author's email. Optional. + * @return string The current comment author's email + */ +function get_comment_author_email( $comment_ID = 0 ) { + $comment = get_comment( $comment_ID ); + return apply_filters('get_comment_author_email', $comment->comment_author_email); +} + +/** + * Display the email of the author of the current global $comment. + * + * Care should be taken to protect the email address and assure that email + * harvesters do not capture your commentors' email address. Most assume that + * their email address will not appear in raw form on the blog. Doing so will + * enable anyone, including those that people don't want to get the email + * address and use it for their own means good and bad. + * + * @since 0.71 + * @uses apply_filters() Calls 'author_email' hook on the author email + * + * @param int $comment_ID The ID of the comment for which to print the author's email. Optional. + */ +function comment_author_email( $comment_ID = 0 ) { + echo apply_filters('author_email', get_comment_author_email( $comment_ID ) ); +} + +/** + * Display the html email link to the author of the current comment. + * + * Care should be taken to protect the email address and assure that email + * harvesters do not capture your commentors' email address. Most assume that + * their email address will not appear in raw form on the blog. Doing so will + * enable anyone, including those that people don't want to get the email + * address and use it for their own means good and bad. + * + * @since 0.71 + * @uses apply_filters() Calls 'comment_email' hook for the display of the comment author's email + * @uses get_comment_author_email_link() For generating the link + * @global object $comment The current Comment row object + * + * @param string $linktext The text to display instead of the comment author's email address + * @param string $before The text or HTML to display before the email link. + * @param string $after The text or HTML to display after the email link. + */ +function comment_author_email_link($linktext='', $before='', $after='') { + if ( $link = get_comment_author_email_link( $linktext, $before, $after ) ) + echo $link; +} + +/** + * Return the html email link to the author of the current comment. + * + * Care should be taken to protect the email address and assure that email + * harvesters do not capture your commentors' email address. Most assume that + * their email address will not appear in raw form on the blog. Doing so will + * enable anyone, including those that people don't want to get the email + * address and use it for their own means good and bad. + * + * @since 2.7 + * @uses apply_filters() Calls 'comment_email' hook for the display of the comment author's email + * @global object $comment The current Comment row object + * + * @param string $linktext The text to display instead of the comment author's email address + * @param string $before The text or HTML to display before the email link. + * @param string $after The text or HTML to display after the email link. + */ +function get_comment_author_email_link($linktext='', $before='', $after='') { + global $comment; + $email = apply_filters('comment_email', $comment->comment_author_email); + if ((!empty($email)) && ($email != '@')) { + $display = ($linktext != '') ? $linktext : $email; + $return = $before; + $return .= "$display"; + $return .= $after; + return $return; + } else { + return ''; + } +} + +/** + * Retrieve the html link to the url of the author of the current comment. + * + * @since 1.5.0 + * @uses apply_filters() Calls 'get_comment_author_link' hook on the complete link HTML or author + * + * @param int $comment_ID The ID of the comment for which to get the author's link. Optional. + * @return string Comment Author name or HTML link for author's URL + */ +function get_comment_author_link( $comment_ID = 0 ) { + /** @todo Only call these functions when they are needed. Include in if... else blocks */ + $url = get_comment_author_url( $comment_ID ); + $author = get_comment_author( $comment_ID ); + + if ( empty( $url ) || 'http://' == $url ) + $return = $author; + else + $return = "$author"; + return apply_filters('get_comment_author_link', $return); +} + +/** + * Display the html link to the url of the author of the current comment. + * + * @since 0.71 + * @see get_comment_author_link() Echoes result + * + * @param int $comment_ID The ID of the comment for which to print the author's link. Optional. + */ +function comment_author_link( $comment_ID = 0 ) { + echo get_comment_author_link( $comment_ID ); +} + +/** + * Retrieve the IP address of the author of the current comment. + * + * @since 1.5.0 + * @uses $comment + * @uses apply_filters() + * + * @param int $comment_ID The ID of the comment for which to get the author's IP address. Optional. + * @return string The comment author's IP address. + */ +function get_comment_author_IP( $comment_ID = 0 ) { + $comment = get_comment( $comment_ID ); + return apply_filters('get_comment_author_IP', $comment->comment_author_IP); +} + +/** + * Display the IP address of the author of the current comment. + * + * @since 0.71 + * @see get_comment_author_IP() Echoes Result + * + * @param int $comment_ID The ID of the comment for which to print the author's IP address. Optional. + */ +function comment_author_IP( $comment_ID = 0 ) { + echo get_comment_author_IP( $comment_ID ); +} + +/** + * Retrieve the url of the author of the current comment. + * + * @since 1.5.0 + * @uses apply_filters() Calls 'get_comment_author_url' hook on the comment author's URL + * + * @param int $comment_ID The ID of the comment for which to get the author's URL. Optional. + * @return string + */ +function get_comment_author_url( $comment_ID = 0 ) { + $comment = get_comment( $comment_ID ); + $url = ('http://' == $comment->comment_author_url) ? '' : $comment->comment_author_url; + $url = esc_url( $url, array('http', 'https') ); + return apply_filters('get_comment_author_url', $url); +} + +/** + * Display the url of the author of the current comment. + * + * @since 0.71 + * @uses apply_filters() + * @uses get_comment_author_url() Retrieves the comment author's URL + * + * @param int $comment_ID The ID of the comment for which to print the author's URL. Optional. + */ +function comment_author_url( $comment_ID = 0 ) { + echo apply_filters('comment_url', get_comment_author_url( $comment_ID )); +} + +/** + * Retrieves the HTML link of the url of the author of the current comment. + * + * $linktext parameter is only used if the URL does not exist for the comment + * author. If the URL does exist then the URL will be used and the $linktext + * will be ignored. + * + * Encapsulate the HTML link between the $before and $after. So it will appear + * in the order of $before, link, and finally $after. + * + * @since 1.5.0 + * @uses apply_filters() Calls the 'get_comment_author_url_link' on the complete HTML before returning. + * + * @param string $linktext The text to display instead of the comment author's email address + * @param string $before The text or HTML to display before the email link. + * @param string $after The text or HTML to display after the email link. + * @return string The HTML link between the $before and $after parameters + */ +function get_comment_author_url_link( $linktext = '', $before = '', $after = '' ) { + $url = get_comment_author_url(); + $display = ($linktext != '') ? $linktext : $url; + $display = str_replace( 'http://www.', '', $display ); + $display = str_replace( 'http://', '', $display ); + if ( '/' == substr($display, -1) ) + $display = substr($display, 0, -1); + $return = "$before$display$after"; + return apply_filters('get_comment_author_url_link', $return); +} + +/** + * Displays the HTML link of the url of the author of the current comment. + * + * @since 0.71 + * @see get_comment_author_url_link() Echoes result + * + * @param string $linktext The text to display instead of the comment author's email address + * @param string $before The text or HTML to display before the email link. + * @param string $after The text or HTML to display after the email link. + */ +function comment_author_url_link( $linktext = '', $before = '', $after = '' ) { + echo get_comment_author_url_link( $linktext, $before, $after ); +} + +/** + * Generates semantic classes for each comment element + * + * @since 2.7.0 + * + * @param string|array $class One or more classes to add to the class list + * @param int $comment_id An optional comment ID + * @param int $post_id An optional post ID + * @param bool $echo Whether comment_class should echo or return + */ +function comment_class( $class = '', $comment_id = null, $post_id = null, $echo = true ) { + // Separates classes with a single space, collates classes for comment DIV + $class = 'class="' . join( ' ', get_comment_class( $class, $comment_id, $post_id ) ) . '"'; + if ( $echo) + echo $class; + else + return $class; +} + +/** + * Returns the classes for the comment div as an array + * + * @since 2.7.0 + * + * @param string|array $class One or more classes to add to the class list + * @param int $comment_id An optional comment ID + * @param int $post_id An optional post ID + * @return array Array of classes + */ +function get_comment_class( $class = '', $comment_id = null, $post_id = null ) { + global $comment_alt, $comment_depth, $comment_thread_alt; + + $comment = get_comment($comment_id); + + $classes = array(); + + // Get the comment type (comment, trackback), + $classes[] = ( empty( $comment->comment_type ) ) ? 'comment' : $comment->comment_type; + + // If the comment author has an id (registered), then print the log in name + if ( $comment->user_id > 0 && $user = get_userdata($comment->user_id) ) { + // For all registered users, 'byuser' + $classes[] = 'byuser'; + $classes[] = 'comment-author-' . sanitize_html_class($user->user_nicename, $comment->user_id); + // For comment authors who are the author of the post + if ( $post = get_post($post_id) ) { + if ( $comment->user_id === $post->post_author ) + $classes[] = 'bypostauthor'; + } + } + + if ( empty($comment_alt) ) + $comment_alt = 0; + if ( empty($comment_depth) ) + $comment_depth = 1; + if ( empty($comment_thread_alt) ) + $comment_thread_alt = 0; + + if ( $comment_alt % 2 ) { + $classes[] = 'odd'; + $classes[] = 'alt'; + } else { + $classes[] = 'even'; + } + + $comment_alt++; + + // Alt for top-level comments + if ( 1 == $comment_depth ) { + if ( $comment_thread_alt % 2 ) { + $classes[] = 'thread-odd'; + $classes[] = 'thread-alt'; + } else { + $classes[] = 'thread-even'; + } + $comment_thread_alt++; + } + + $classes[] = "depth-$comment_depth"; + + if ( !empty($class) ) { + if ( !is_array( $class ) ) + $class = preg_split('#\s+#', $class); + $classes = array_merge($classes, $class); + } + + $classes = array_map('esc_attr', $classes); + + return apply_filters('comment_class', $classes, $class, $comment_id, $post_id); +} + +/** + * Retrieve the comment date of the current comment. + * + * @since 1.5.0 + * @uses apply_filters() Calls 'get_comment_date' hook with the formated date and the $d parameter respectively + * @uses $comment + * + * @param string $d The format of the date (defaults to user's config) + * @param int $comment_ID The ID of the comment for which to get the date. Optional. + * @return string The comment's date + */ +function get_comment_date( $d = '', $comment_ID = 0 ) { + $comment = get_comment( $comment_ID ); + if ( '' == $d ) + $date = mysql2date(get_option('date_format'), $comment->comment_date); + else + $date = mysql2date($d, $comment->comment_date); + return apply_filters('get_comment_date', $date, $d); +} + +/** + * Display the comment date of the current comment. + * + * @since 0.71 + * + * @param string $d The format of the date (defaults to user's config) + * @param int $comment_ID The ID of the comment for which to print the date. Optional. + */ +function comment_date( $d = '', $comment_ID = 0 ) { + echo get_comment_date( $d, $comment_ID ); +} + +/** + * Retrieve the excerpt of the current comment. + * + * Will cut each word and only output the first 20 words with '...' at the end. + * If the word count is less than 20, then no truncating is done and no '...' + * will appear. + * + * @since 1.5.0 + * @uses $comment + * @uses apply_filters() Calls 'get_comment_excerpt' on truncated comment + * + * @param int $comment_ID The ID of the comment for which to get the excerpt. Optional. + * @return string The maybe truncated comment with 20 words or less + */ +function get_comment_excerpt( $comment_ID = 0 ) { + $comment = get_comment( $comment_ID ); + $comment_text = strip_tags($comment->comment_content); + $blah = explode(' ', $comment_text); + if (count($blah) > 20) { + $k = 20; + $use_dotdotdot = 1; + } else { + $k = count($blah); + $use_dotdotdot = 0; + } + $excerpt = ''; + for ($i=0; $i<$k; $i++) { + $excerpt .= $blah[$i] . ' '; + } + $excerpt .= ($use_dotdotdot) ? '...' : ''; + return apply_filters('get_comment_excerpt', $excerpt); +} + +/** + * Display the excerpt of the current comment. + * + * @since 1.2.0 + * @uses apply_filters() Calls 'comment_excerpt' hook before displaying excerpt + * + * @param int $comment_ID The ID of the comment for which to print the excerpt. Optional. + */ +function comment_excerpt( $comment_ID = 0 ) { + echo apply_filters('comment_excerpt', get_comment_excerpt($comment_ID) ); +} + +/** + * Retrieve the comment id of the current comment. + * + * @since 1.5.0 + * @uses $comment + * @uses apply_filters() Calls the 'get_comment_ID' hook for the comment ID + * + * @return int The comment ID + */ +function get_comment_ID() { + global $comment; + return apply_filters('get_comment_ID', $comment->comment_ID); +} + +/** + * Displays the comment id of the current comment. + * + * @since 0.71 + * @see get_comment_ID() Echoes Result + */ +function comment_ID() { + echo get_comment_ID(); +} + +/** + * Retrieve the link to a given comment. + * + * @since 1.5.0 + * @uses $comment + * + * @param object|string|int $comment Comment to retrieve. + * @param array $args Optional args. + * @return string The permalink to the given comment. + */ +function get_comment_link( $comment = null, $args = array() ) { + global $wp_rewrite, $in_comment_loop; + + $comment = get_comment($comment); + + // Backwards compat + if ( !is_array($args) ) { + $page = $args; + $args = array(); + $args['page'] = $page; + } + + $defaults = array( 'type' => 'all', 'page' => '', 'per_page' => '', 'max_depth' => '' ); + $args = wp_parse_args( $args, $defaults ); + + if ( '' === $args['per_page'] && get_option('page_comments') ) + $args['per_page'] = get_option('comments_per_page'); + + if ( empty($args['per_page']) ) { + $args['per_page'] = 0; + $args['page'] = 0; + } + + if ( $args['per_page'] ) { + if ( '' == $args['page'] ) + $args['page'] = ( !empty($in_comment_loop) ) ? get_query_var('cpage') : get_page_of_comment( $comment->comment_ID, $args ); + + if ( $wp_rewrite->using_permalinks() ) + $link = user_trailingslashit( trailingslashit( get_permalink( $comment->comment_post_ID ) ) . 'comment-page-' . $args['page'], 'comment' ); + else + $link = add_query_arg( 'cpage', $args['page'], get_permalink( $comment->comment_post_ID ) ); + } else { + $link = get_permalink( $comment->comment_post_ID ); + } + + return apply_filters( 'get_comment_link', $link . '#comment-' . $comment->comment_ID, $comment, $args ); +} + +/** + * Retrieves the link to the current post comments. + * + * @since 1.5.0 + * + * @param int $post_id Optional post id + * @return string The link to the comments + */ +function get_comments_link($post_id = 0) { + return get_permalink($post_id) . '#comments'; +} + +/** + * Displays the link to the current post comments. + * + * @since 0.71 + * + * @param string $deprecated Not Used + * @param bool $deprecated_2 Not Used + */ +function comments_link( $deprecated = '', $deprecated_2 = '' ) { + if ( !empty( $deprecated ) ) + _deprecated_argument( __FUNCTION__, '0.72' ); + if ( !empty( $deprecated_2 ) ) + _deprecated_argument( __FUNCTION__, '1.3' ); + echo get_comments_link(); +} + +/** + * Retrieve the amount of comments a post has. + * + * @since 1.5.0 + * @uses apply_filters() Calls the 'get_comments_number' hook on the number of comments + * + * @param int $post_id The Post ID + * @return int The number of comments a post has + */ +function get_comments_number( $post_id = 0 ) { + $post_id = absint( $post_id ); + + if ( !$post_id ) + $post_id = get_the_ID(); + + $post = get_post($post_id); + if ( ! isset($post->comment_count) ) + $count = 0; + else + $count = $post->comment_count; + + return apply_filters('get_comments_number', $count, $post_id); +} + +/** + * Display the language string for the number of comments the current post has. + * + * @since 0.71 + * @uses apply_filters() Calls the 'comments_number' hook on the output and number of comments respectively. + * + * @param string $zero Text for no comments + * @param string $one Text for one comment + * @param string $more Text for more than one comment + * @param string $deprecated Not used. + */ +function comments_number( $zero = false, $one = false, $more = false, $deprecated = '' ) { + if ( !empty( $deprecated ) ) + _deprecated_argument( __FUNCTION__, '1.3' ); + + $number = get_comments_number(); + + if ( $number > 1 ) + $output = str_replace('%', number_format_i18n($number), ( false === $more ) ? __('% Comments') : $more); + elseif ( $number == 0 ) + $output = ( false === $zero ) ? __('No Comments') : $zero; + else // must be one + $output = ( false === $one ) ? __('1 Comment') : $one; + + echo apply_filters('comments_number', $output, $number); +} + +/** + * Retrieve the text of the current comment. + * + * @since 1.5.0 + * @uses $comment + * + * @param int $comment_ID The ID of the comment for which to get the text. Optional. + * @return string The comment content + */ +function get_comment_text( $comment_ID = 0 ) { + $comment = get_comment( $comment_ID ); + return apply_filters( 'get_comment_text', $comment->comment_content, $comment ); +} + +/** + * Displays the text of the current comment. + * + * @since 0.71 + * @uses apply_filters() Passes the comment content through the 'comment_text' hook before display + * @uses get_comment_text() Gets the comment content + * + * @param int $comment_ID The ID of the comment for which to print the text. Optional. + */ +function comment_text( $comment_ID = 0 ) { + $comment = get_comment( $comment_ID ); + echo apply_filters( 'comment_text', get_comment_text( $comment_ID ), $comment ); +} + +/** + * Retrieve the comment time of the current comment. + * + * @since 1.5.0 + * @uses $comment + * @uses apply_filter() Calls 'get_comment_time' hook with the formatted time, the $d parameter, and $gmt parameter passed. + * + * @param string $d Optional. The format of the time (defaults to user's config) + * @param bool $gmt Whether to use the GMT date + * @param bool $translate Whether to translate the time (for use in feeds) + * @return string The formatted time + */ +function get_comment_time( $d = '', $gmt = false, $translate = true ) { + global $comment; + $comment_date = $gmt ? $comment->comment_date_gmt : $comment->comment_date; + if ( '' == $d ) + $date = mysql2date(get_option('time_format'), $comment_date, $translate); + else + $date = mysql2date($d, $comment_date, $translate); + return apply_filters('get_comment_time', $date, $d, $gmt, $translate); +} + +/** + * Display the comment time of the current comment. + * + * @since 0.71 + * + * @param string $d Optional. The format of the time (defaults to user's config) + */ +function comment_time( $d = '' ) { + echo get_comment_time($d); +} + +/** + * Retrieve the comment type of the current comment. + * + * @since 1.5.0 + * @uses $comment + * @uses apply_filters() Calls the 'get_comment_type' hook on the comment type + * + * @param int $comment_ID The ID of the comment for which to get the type. Optional. + * @return string The comment type + */ +function get_comment_type( $comment_ID = 0 ) { + $comment = get_comment( $comment_ID ); + if ( '' == $comment->comment_type ) + $comment->comment_type = 'comment'; + + return apply_filters('get_comment_type', $comment->comment_type); +} + +/** + * Display the comment type of the current comment. + * + * @since 0.71 + * + * @param string $commenttxt The string to display for comment type + * @param string $trackbacktxt The string to display for trackback type + * @param string $pingbacktxt The string to display for pingback type + */ +function comment_type($commenttxt = false, $trackbacktxt = false, $pingbacktxt = false) { + if ( false === $commenttxt ) $commenttxt = _x( 'Comment', 'noun' ); + if ( false === $trackbacktxt ) $trackbacktxt = __( 'Trackback' ); + if ( false === $pingbacktxt ) $pingbacktxt = __( 'Pingback' ); + $type = get_comment_type(); + switch( $type ) { + case 'trackback' : + echo $trackbacktxt; + break; + case 'pingback' : + echo $pingbacktxt; + break; + default : + echo $commenttxt; + } +} + +/** + * Retrieve The current post's trackback URL. + * + * There is a check to see if permalink's have been enabled and if so, will + * retrieve the pretty path. If permalinks weren't enabled, the ID of the + * current post is used and appended to the correct page to go to. + * + * @since 1.5.0 + * @uses apply_filters() Calls 'trackback_url' on the resulting trackback URL + * + * @return string The trackback URL after being filtered + */ +function get_trackback_url() { + if ( '' != get_option('permalink_structure') ) { + $tb_url = trailingslashit(get_permalink()) . user_trailingslashit('trackback', 'single_trackback'); + } else { + $tb_url = get_option('siteurl') . '/wp-trackback.php?p=' . get_the_ID(); + } + return apply_filters('trackback_url', $tb_url); +} + +/** + * Displays the current post's trackback URL. + * + * @since 0.71 + * @uses get_trackback_url() Gets the trackback url for the current post + * + * @param bool $deprecated_echo Remove backwards compat in 2.5 + * @return void|string Should only be used to echo the trackback URL, use get_trackback_url() for the result instead. + */ +function trackback_url( $deprecated_echo = true ) { + if ( $deprecated_echo !== true ) + _deprecated_argument( __FUNCTION__, '2.5', __('Use get_trackback_url() instead if you do not want the value echoed.') ); + if ( $deprecated_echo ) + echo get_trackback_url(); + else + return get_trackback_url(); +} + +/** + * Generates and displays the RDF for the trackback information of current post. + * + * Deprecated in 3.0.0, and restored in 3.0.1. + * + * @since 0.71 + * + * @param int $deprecated Not used (Was $timezone = 0) + */ +function trackback_rdf( $deprecated = '' ) { + if ( !empty( $deprecated ) ) + _deprecated_argument( __FUNCTION__, '2.5' ); + + if ( false !== stripos($_SERVER['HTTP_USER_AGENT'], 'W3C_Validator') ) + return; + + echo ' + \n"; + echo ''; +} + +/** + * Whether the current post is open for comments. + * + * @since 1.5.0 + * @uses $post + * + * @param int $post_id An optional post ID to check instead of the current post. + * @return bool True if the comments are open + */ +function comments_open( $post_id=NULL ) { + + $_post = get_post($post_id); + + $open = ( 'open' == $_post->comment_status ); + return apply_filters( 'comments_open', $open, $post_id ); +} + +/** + * Whether the current post is open for pings. + * + * @since 1.5.0 + * @uses $post + * + * @param int $post_id An optional post ID to check instead of the current post. + * @return bool True if pings are accepted + */ +function pings_open( $post_id = NULL ) { + + $_post = get_post($post_id); + + $open = ( 'open' == $_post->ping_status ); + return apply_filters( 'pings_open', $open, $post_id ); +} + +/** + * Displays form token for unfiltered comments. + * + * Will only display nonce token if the current user has permissions for + * unfiltered html. Won't display the token for other users. + * + * The function was backported to 2.0.10 and was added to versions 2.1.3 and + * above. Does not exist in versions prior to 2.0.10 in the 2.0 branch and in + * the 2.1 branch, prior to 2.1.3. Technically added in 2.2.0. + * + * Backported to 2.0.10. + * + * @since 2.1.3 + * @uses $post Gets the ID of the current post for the token + */ +function wp_comment_form_unfiltered_html_nonce() { + global $post; + + $post_id = 0; + if ( !empty($post) ) + $post_id = $post->ID; + + if ( current_user_can('unfiltered_html') ) + wp_nonce_field('unfiltered-html-comment_' . $post_id, '_wp_unfiltered_html_comment', false); +} + +/** + * Loads the comment template specified in $file. + * + * Will not display the comments template if not on single post or page, or if + * the post does not have comments. + * + * Uses the WordPress database object to query for the comments. The comments + * are passed through the 'comments_array' filter hook with the list of comments + * and the post ID respectively. + * + * The $file path is passed through a filter hook called, 'comments_template' + * which includes the TEMPLATEPATH and $file combined. Tries the $filtered path + * first and if it fails it will require the default comment themplate from the + * default theme. If either does not exist, then the WordPress process will be + * halted. It is advised for that reason, that the default theme is not deleted. + * + * @since 1.5.0 + * @global array $comment List of comment objects for the current post + * @uses $wpdb + * @uses $post + * @uses $withcomments Will not try to get the comments if the post has none. + * + * @param string $file Optional, default '/comments.php'. The file to load + * @param bool $separate_comments Optional, whether to separate the comments by comment type. Default is false. + * @return null Returns null if no comments appear + */ +function comments_template( $file = '/comments.php', $separate_comments = false ) { + global $wp_query, $withcomments, $post, $wpdb, $id, $comment, $user_login, $user_ID, $user_identity, $overridden_cpage; + + if ( !(is_single() || is_page() || $withcomments) || empty($post) ) + return; + + if ( empty($file) ) + $file = '/comments.php'; + + $req = get_option('require_name_email'); + + /** + * Comment author information fetched from the comment cookies. + * + * @uses wp_get_current_commenter() + */ + $commenter = wp_get_current_commenter(); + + /** + * The name of the current comment author escaped for use in attributes. + */ + $comment_author = $commenter['comment_author']; // Escaped by sanitize_comment_cookies() + + /** + * The email address of the current comment author escaped for use in attributes. + */ + $comment_author_email = $commenter['comment_author_email']; // Escaped by sanitize_comment_cookies() + + /** + * The url of the current comment author escaped for use in attributes. + */ + $comment_author_url = esc_url($commenter['comment_author_url']); + + /** @todo Use API instead of SELECTs. */ + if ( $user_ID) { + $comments = $wpdb->get_results($wpdb->prepare("SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d AND (comment_approved = '1' OR ( user_id = %d AND comment_approved = '0' ) ) ORDER BY comment_date_gmt", $post->ID, $user_ID)); + } else if ( empty($comment_author) ) { + $comments = get_comments( array('post_id' => $post->ID, 'status' => 'approve', 'order' => 'ASC') ); + } else { + $comments = $wpdb->get_results($wpdb->prepare("SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d AND ( comment_approved = '1' OR ( comment_author = %s AND comment_author_email = %s AND comment_approved = '0' ) ) ORDER BY comment_date_gmt", $post->ID, wp_specialchars_decode($comment_author,ENT_QUOTES), $comment_author_email)); + } + + // keep $comments for legacy's sake + $wp_query->comments = apply_filters( 'comments_array', $comments, $post->ID ); + $comments = &$wp_query->comments; + $wp_query->comment_count = count($wp_query->comments); + update_comment_cache($wp_query->comments); + + if ( $separate_comments ) { + $wp_query->comments_by_type = &separate_comments($comments); + $comments_by_type = &$wp_query->comments_by_type; + } + + $overridden_cpage = FALSE; + if ( '' == get_query_var('cpage') && get_option('page_comments') ) { + set_query_var( 'cpage', 'newest' == get_option('default_comments_page') ? get_comment_pages_count() : 1 ); + $overridden_cpage = TRUE; + } + + if ( !defined('COMMENTS_TEMPLATE') || !COMMENTS_TEMPLATE) + define('COMMENTS_TEMPLATE', true); + + $include = apply_filters('comments_template', STYLESHEETPATH . $file ); + if ( file_exists( $include ) ) + require( $include ); + elseif ( file_exists( TEMPLATEPATH . $file ) ) + require( TEMPLATEPATH . $file ); + else // Backward compat code will be removed in a future release + require( ABSPATH . WPINC . '/theme-compat/comments.php'); +} + +/** + * Displays the JS popup script to show a comment. + * + * If the $file parameter is empty, then the home page is assumed. The defaults + * for the window are 400px by 400px. + * + * For the comment link popup to work, this function has to be called or the + * normal comment link will be assumed. + * + * @since 0.71 + * @global string $wpcommentspopupfile The URL to use for the popup window + * @global int $wpcommentsjavascript Whether to use JavaScript. Set when function is called + * + * @param int $width Optional. The width of the popup window + * @param int $height Optional. The height of the popup window + * @param string $file Optional. Sets the location of the popup window + */ +function comments_popup_script($width=400, $height=400, $file='') { + global $wpcommentspopupfile, $wpcommentsjavascript; + + if (empty ($file)) { + $wpcommentspopupfile = ''; // Use the index. + } else { + $wpcommentspopupfile = $file; + } + + $wpcommentsjavascript = 1; + $javascript = "\n"; + echo $javascript; +} + +/** + * Displays the link to the comments popup window for the current post ID. + * + * Is not meant to be displayed on single posts and pages. Should be used on the + * lists of posts + * + * @since 0.71 + * @uses $wpcommentspopupfile + * @uses $wpcommentsjavascript + * @uses $post + * + * @param string $zero The string to display when no comments + * @param string $one The string to display when only one comment is available + * @param string $more The string to display when there are more than one comment + * @param string $css_class The CSS class to use for comments + * @param string $none The string to display when comments have been turned off + * @return null Returns null on single posts and pages. + */ +function comments_popup_link( $zero = false, $one = false, $more = false, $css_class = '', $none = false ) { + global $wpcommentspopupfile, $wpcommentsjavascript; + + $id = get_the_ID(); + + if ( false === $zero ) $zero = __( 'No Comments' ); + if ( false === $one ) $one = __( '1 Comment' ); + if ( false === $more ) $more = __( '% Comments' ); + if ( false === $none ) $none = __( 'Comments Off' ); + + $number = get_comments_number( $id ); + + if ( 0 == $number && !comments_open() && !pings_open() ) { + echo '' . $none . ''; + return; + } + + if ( post_password_required() ) { + echo __('Enter your password to view comments.'); + return; + } + + echo ' 0 ) ); + + echo apply_filters( 'comments_popup_link_attributes', '' ); + + echo ' title="' . esc_attr( sprintf( __('Comment on %s'), $title ) ) . '">'; + comments_number( $zero, $one, $more ); + echo ''; +} + +/** + * Retrieve HTML content for reply to comment link. + * + * The default arguments that can be override are 'add_below', 'respond_id', + * 'reply_text', 'login_text', and 'depth'. The 'login_text' argument will be + * used, if the user must log in or register first before posting a comment. The + * 'reply_text' will be used, if they can post a reply. The 'add_below' and + * 'respond_id' arguments are for the JavaScript moveAddCommentForm() function + * parameters. + * + * @since 2.7.0 + * + * @param array $args Optional. Override default options. + * @param int $comment Optional. Comment being replied to. + * @param int $post Optional. Post that the comment is going to be displayed on. + * @return string|bool|null Link to show comment form, if successful. False, if comments are closed. + */ +function get_comment_reply_link($args = array(), $comment = null, $post = null) { + global $user_ID; + + $defaults = array('add_below' => 'comment', 'respond_id' => 'respond', 'reply_text' => __('Reply'), + 'login_text' => __('Log in to Reply'), 'depth' => 0, 'before' => '', 'after' => ''); + + $args = wp_parse_args($args, $defaults); + + if ( 0 == $args['depth'] || $args['max_depth'] <= $args['depth'] ) + return; + + extract($args, EXTR_SKIP); + + $comment = get_comment($comment); + if ( empty($post) ) + $post = $comment->comment_post_ID; + $post = get_post($post); + + if ( !comments_open($post->ID) ) + return false; + + $link = ''; + + if ( get_option('comment_registration') && !$user_ID ) + $link = ''; + else + $link = "comment_ID ) ) . "#" . $respond_id . "' onclick='return addComment.moveForm(\"$add_below-$comment->comment_ID\", \"$comment->comment_ID\", \"$respond_id\", \"$post->ID\")'>$reply_text"; + return apply_filters('comment_reply_link', $before . $link . $after, $args, $comment, $post); +} + +/** + * Displays the HTML content for reply to comment link. + * + * @since 2.7.0 + * @see get_comment_reply_link() Echoes result + * + * @param array $args Optional. Override default options. + * @param int $comment Optional. Comment being replied to. + * @param int $post Optional. Post that the comment is going to be displayed on. + * @return string|bool|null Link to show comment form, if successful. False, if comments are closed. + */ +function comment_reply_link($args = array(), $comment = null, $post = null) { + echo get_comment_reply_link($args, $comment, $post); +} + +/** + * Retrieve HTML content for reply to post link. + * + * The default arguments that can be override are 'add_below', 'respond_id', + * 'reply_text', 'login_text', and 'depth'. The 'login_text' argument will be + * used, if the user must log in or register first before posting a comment. The + * 'reply_text' will be used, if they can post a reply. The 'add_below' and + * 'respond_id' arguments are for the JavaScript moveAddCommentForm() function + * parameters. + * + * @since 2.7.0 + * + * @param array $args Optional. Override default options. + * @param int|object $post Optional. Post that the comment is going to be displayed on. Defaults to current post. + * @return string|bool|null Link to show comment form, if successful. False, if comments are closed. + */ +function get_post_reply_link($args = array(), $post = null) { + global $user_ID; + + $defaults = array('add_below' => 'post', 'respond_id' => 'respond', 'reply_text' => __('Leave a Comment'), + 'login_text' => __('Log in to leave a Comment'), 'before' => '', 'after' => ''); + + $args = wp_parse_args($args, $defaults); + extract($args, EXTR_SKIP); + $post = get_post($post); + + if ( !comments_open($post->ID) ) + return false; + + if ( get_option('comment_registration') && !$user_ID ) { + $link = '' . $login_text . ''; + } else { + $link = "$reply_text"; + } + return apply_filters('post_comments_link', $before . $link . $after, $post); +} + +/** + * Displays the HTML content for reply to post link. + * @since 2.7.0 + * @see get_post_reply_link() + * + * @param array $args Optional. Override default options. + * @param int|object $post Optional. Post that the comment is going to be displayed on. + * @return string|bool|null Link to show comment form, if successful. False, if comments are closed. + */ +function post_reply_link($args = array(), $post = null) { + echo get_post_reply_link($args, $post); +} + +/** + * Retrieve HTML content for cancel comment reply link. + * + * @since 2.7.0 + * + * @param string $text Optional. Text to display for cancel reply link. + */ +function get_cancel_comment_reply_link($text = '') { + if ( empty($text) ) + $text = __('Click here to cancel reply.'); + + $style = isset($_GET['replytocom']) ? '' : ' style="display:none;"'; + $link = esc_html( remove_query_arg('replytocom') ) . '#respond'; + return apply_filters('cancel_comment_reply_link', '' . $text . '', $link, $text); +} + +/** + * Display HTML content for cancel comment reply link. + * + * @since 2.7.0 + * + * @param string $text Optional. Text to display for cancel reply link. + */ +function cancel_comment_reply_link($text = '') { + echo get_cancel_comment_reply_link($text); +} + +/** + * Retrieve hidden input HTML for replying to comments. + * + * @since 3.0.0 + * + * @return string Hidden input HTML for replying to comments + */ +function get_comment_id_fields( $id = 0 ) { + if ( empty( $id ) ) + $id = get_the_ID(); + + $replytoid = isset($_GET['replytocom']) ? (int) $_GET['replytocom'] : 0; + $result = "\n"; + $result .= "\n"; + return apply_filters('comment_id_fields', $result, $id, $replytoid); +} + +/** + * Output hidden input HTML for replying to comments. + * + * @since 2.7.0 + * @see get_comment_id_fields() Echoes result + */ +function comment_id_fields( $id = 0 ) { + echo get_comment_id_fields( $id ); +} + +/** + * Display text based on comment reply status. Only affects users with Javascript disabled. + * + * @since 2.7.0 + * + * @param string $noreplytext Optional. Text to display when not replying to a comment. + * @param string $replytext Optional. Text to display when replying to a comment. Accepts "%s" for the author of the comment being replied to. + * @param string $linktoparent Optional. Boolean to control making the author's name a link to their comment. + */ +function comment_form_title( $noreplytext = false, $replytext = false, $linktoparent = TRUE ) { + global $comment; + + if ( false === $noreplytext ) $noreplytext = __( 'Leave a Reply' ); + if ( false === $replytext ) $replytext = __( 'Leave a Reply to %s' ); + + $replytoid = isset($_GET['replytocom']) ? (int) $_GET['replytocom'] : 0; + + if ( 0 == $replytoid ) + echo $noreplytext; + else { + $comment = get_comment($replytoid); + $author = ( $linktoparent ) ? '' . get_comment_author() . '' : get_comment_author(); + printf( $replytext, $author ); + } +} + +/** + * HTML comment list class. + * + * @package WordPress + * @uses Walker + * @since 2.7.0 + */ +class Walker_Comment extends Walker { + /** + * @see Walker::$tree_type + * @since 2.7.0 + * @var string + */ + var $tree_type = 'comment'; + + /** + * @see Walker::$db_fields + * @since 2.7.0 + * @var array + */ + var $db_fields = array ('parent' => 'comment_parent', 'id' => 'comment_ID'); + + /** + * @see Walker::start_lvl() + * @since 2.7.0 + * + * @param string $output Passed by reference. Used to append additional content. + * @param int $depth Depth of comment. + * @param array $args Uses 'style' argument for type of HTML list. + */ + function start_lvl(&$output, $depth, $args) { + $GLOBALS['comment_depth'] = $depth + 1; + + switch ( $args['style'] ) { + case 'div': + break; + case 'ol': + echo "
                \n"; + break; + default: + case 'ul': + echo "
                  \n"; + break; + } + } + + /** + * @see Walker::end_lvl() + * @since 2.7.0 + * + * @param string $output Passed by reference. Used to append additional content. + * @param int $depth Depth of comment. + * @param array $args Will only append content if style argument value is 'ol' or 'ul'. + */ + function end_lvl(&$output, $depth, $args) { + $GLOBALS['comment_depth'] = $depth + 1; + + switch ( $args['style'] ) { + case 'div': + break; + case 'ol': + echo "
              \n"; + break; + default: + case 'ul': + echo "
            \n"; + break; + } + } + + /** + * This function is designed to enhance Walker::display_element() to + * display children of higher nesting levels than selected inline on + * the highest depth level displayed. This prevents them being orphaned + * at the end of the comment list. + * + * Example: max_depth = 2, with 5 levels of nested content. + * 1 + * 1.1 + * 1.1.1 + * 1.1.1.1 + * 1.1.1.1.1 + * 1.1.2 + * 1.1.2.1 + * 2 + * 2.2 + * + */ + function display_element( $element, &$children_elements, $max_depth, $depth=0, $args, &$output ) { + + if ( !$element ) + return; + + $id_field = $this->db_fields['id']; + $id = $element->$id_field; + + parent::display_element( $element, $children_elements, $max_depth, $depth, $args, $output ); + + // If we're at the max depth, and the current element still has children, loop over those and display them at this level + // This is to prevent them being orphaned to the end of the list. + if ( $max_depth <= $depth + 1 && isset( $children_elements[$id]) ) { + foreach ( $children_elements[ $id ] as $child ) + $this->display_element( $child, $children_elements, $max_depth, $depth, $args, $output ); + + unset( $children_elements[ $id ] ); + } + + } + + /** + * @see Walker::start_el() + * @since 2.7.0 + * + * @param string $output Passed by reference. Used to append additional content. + * @param object $comment Comment data object. + * @param int $depth Depth of comment in reference to parents. + * @param array $args + */ + function start_el(&$output, $comment, $depth, $args) { + $depth++; + $GLOBALS['comment_depth'] = $depth; + + if ( !empty($args['callback']) ) { + call_user_func($args['callback'], $comment, $args, $depth); + return; + } + + $GLOBALS['comment'] = $comment; + extract($args, EXTR_SKIP); + + if ( 'div' == $args['style'] ) { + $tag = 'div'; + $add_below = 'comment'; + } else { + $tag = 'li'; + $add_below = 'div-comment'; + } +?> + < id="comment-"> + +
            + +
            + + %s says:'), get_comment_author_link()) ?> +
            +comment_approved == '0') : ?> + +
            + + + + + + +
            + $add_below, 'depth' => $depth, 'max_depth' => $args['max_depth']))) ?> +
            + +
            + +\n"; + else + echo "\n"; + } + +} + +/** + * List comments + * + * Used in the comments.php template to list comments for a particular post + * + * @since 2.7.0 + * @uses Walker_Comment + * + * @param string|array $args Formatting options + * @param array $comments Optional array of comment objects. Defaults to $wp_query->comments + */ +function wp_list_comments($args = array(), $comments = null ) { + global $wp_query, $comment_alt, $comment_depth, $comment_thread_alt, $overridden_cpage, $in_comment_loop; + + $in_comment_loop = true; + + $comment_alt = $comment_thread_alt = 0; + $comment_depth = 1; + + $defaults = array('walker' => null, 'max_depth' => '', 'style' => 'ul', 'callback' => null, 'end-callback' => null, 'type' => 'all', + 'page' => '', 'per_page' => '', 'avatar_size' => 32, 'reverse_top_level' => null, 'reverse_children' => ''); + + $r = wp_parse_args( $args, $defaults ); + + // Figure out what comments we'll be looping through ($_comments) + if ( null !== $comments ) { + $comments = (array) $comments; + if ( empty($comments) ) + return; + if ( 'all' != $r['type'] ) { + $comments_by_type = &separate_comments($comments); + if ( empty($comments_by_type[$r['type']]) ) + return; + $_comments = $comments_by_type[$r['type']]; + } else { + $_comments = $comments; + } + } else { + if ( empty($wp_query->comments) ) + return; + if ( 'all' != $r['type'] ) { + if ( empty($wp_query->comments_by_type) ) + $wp_query->comments_by_type = &separate_comments($wp_query->comments); + if ( empty($wp_query->comments_by_type[$r['type']]) ) + return; + $_comments = $wp_query->comments_by_type[$r['type']]; + } else { + $_comments = $wp_query->comments; + } + } + + if ( '' === $r['per_page'] && get_option('page_comments') ) + $r['per_page'] = get_query_var('comments_per_page'); + + if ( empty($r['per_page']) ) { + $r['per_page'] = 0; + $r['page'] = 0; + } + + if ( '' === $r['max_depth'] ) { + if ( get_option('thread_comments') ) + $r['max_depth'] = get_option('thread_comments_depth'); + else + $r['max_depth'] = -1; + } + + if ( '' === $r['page'] ) { + if ( empty($overridden_cpage) ) { + $r['page'] = get_query_var('cpage'); + } else { + $threaded = ( -1 != $r['max_depth'] ); + $r['page'] = ( 'newest' == get_option('default_comments_page') ) ? get_comment_pages_count($_comments, $r['per_page'], $threaded) : 1; + set_query_var( 'cpage', $r['page'] ); + } + } + // Validation check + $r['page'] = intval($r['page']); + if ( 0 == $r['page'] && 0 != $r['per_page'] ) + $r['page'] = 1; + + if ( null === $r['reverse_top_level'] ) + $r['reverse_top_level'] = ( 'desc' == get_option('comment_order') ); + + extract( $r, EXTR_SKIP ); + + if ( empty($walker) ) + $walker = new Walker_Comment; + + $walker->paged_walk($_comments, $max_depth, $page, $per_page, $r); + $wp_query->max_num_comment_pages = $walker->max_pages; + + $in_comment_loop = false; +} + +/** + * Outputs a complete commenting form for use within a template. + * Most strings and form fields may be controlled through the $args array passed + * into the function, while you may also choose to use the comment_form_default_fields + * filter to modify the array of default fields if you'd just like to add a new + * one or remove a single field. All fields are also individually passed through + * a filter of the form comment_form_field_$name where $name is the key used + * in the array of fields. + * + * @since 3.0.0 + * @param array $args Options for strings, fields etc in the form + * @param mixed $post_id Post ID to generate the form for, uses the current post if null + * @return void + */ +function comment_form( $args = array(), $post_id = null ) { + global $user_identity, $id; + + if ( null === $post_id ) + $post_id = $id; + else + $id = $post_id; + + $commenter = wp_get_current_commenter(); + + $req = get_option( 'require_name_email' ); + $aria_req = ( $req ? " aria-required='true'" : '' ); + $fields = array( + 'author' => '

            ' . ' ' . ( $req ? '*' : '' ) . + '

            ', + 'email' => '', + 'url' => '

            ' . + '

            ', + ); + + $required_text = sprintf( ' ' . __('Required fields are marked %s'), '*' ); + $defaults = array( + 'fields' => apply_filters( 'comment_form_default_fields', $fields ), + 'comment_field' => '

            ', + 'must_log_in' => '', + 'logged_in_as' => '

            ' . sprintf( __( 'Logged in as %2$s. Log out?' ), admin_url( 'profile.php' ), $user_identity, wp_logout_url( apply_filters( 'the_permalink', get_permalink( $post_id ) ) ) ) . '

            ', + 'comment_notes_before' => '

            ' . __( 'Your email address will not be published.' ) . ( $req ? $required_text : '' ) . '

            ', + 'comment_notes_after' => '

            ' . sprintf( __( 'You may use these HTML tags and attributes: %s' ), ' ' . allowed_tags() . '' ) . '

            ', + 'id_form' => 'commentform', + 'id_submit' => 'submit', + 'title_reply' => __( 'Leave a Reply' ), + 'title_reply_to' => __( 'Leave a Reply to %s' ), + 'cancel_reply_link' => __( 'Cancel reply' ), + 'label_submit' => __( 'Post Comment' ), + ); + + $args = wp_parse_args( $args, apply_filters( 'comment_form_defaults', $defaults ) ); + + ?> + + +
            +

            + + + + +
            + + + + + + + $field ) { + echo apply_filters( "comment_form_field_{$name}", $field ) . "\n"; + } + do_action( 'comment_form_after_fields' ); + ?> + + + +

            + + +

            + +
            + +
            + + + + + diff --git a/src/wp-includes/comment.php b/src/wp-includes/comment.php new file mode 100644 index 0000000..8e17000 --- /dev/null +++ b/src/wp-includes/comment.php @@ -0,0 +1,2017 @@ +]*href/i', $comment, $out ); + $num_links = apply_filters( 'comment_max_links_url', $num_links, $url ); // provide for counting of $url as a link + if ( $num_links >= $max_links ) + return false; + } + + $mod_keys = trim(get_option('moderation_keys')); + if ( !empty($mod_keys) ) { + $words = explode("\n", $mod_keys ); + + foreach ( (array) $words as $word) { + $word = trim($word); + + // Skip empty lines + if ( empty($word) ) + continue; + + // Do some escaping magic so that '#' chars in the + // spam words don't break things: + $word = preg_quote($word, '#'); + + $pattern = "#$word#i"; + if ( preg_match($pattern, $author) ) return false; + if ( preg_match($pattern, $email) ) return false; + if ( preg_match($pattern, $url) ) return false; + if ( preg_match($pattern, $comment) ) return false; + if ( preg_match($pattern, $user_ip) ) return false; + if ( preg_match($pattern, $user_agent) ) return false; + } + } + + // Comment whitelisting: + if ( 1 == get_option('comment_whitelist')) { + if ( 'trackback' != $comment_type && 'pingback' != $comment_type && $author != '' && $email != '' ) { + // expected_slashed ($author, $email) + $ok_to_comment = $wpdb->get_var("SELECT comment_approved FROM $wpdb->comments WHERE comment_author = '$author' AND comment_author_email = '$email' and comment_approved = '1' LIMIT 1"); + if ( ( 1 == $ok_to_comment ) && + ( empty($mod_keys) || false === strpos( $email, $mod_keys) ) ) + return true; + else + return false; + } else { + return false; + } + } + return true; +} + +/** + * Retrieve the approved comments for post $post_id. + * + * @since 2.0.0 + * @uses $wpdb + * + * @param int $post_id The ID of the post + * @return array $comments The approved comments + */ +function get_approved_comments($post_id) { + global $wpdb; + return $wpdb->get_results($wpdb->prepare("SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_approved = '1' ORDER BY comment_date", $post_id)); +} + +/** + * Retrieves comment data given a comment ID or comment object. + * + * If an object is passed then the comment data will be cached and then returned + * after being passed through a filter. If the comment is empty, then the global + * comment variable will be used, if it is set. + * + * If the comment is empty, then the global comment variable will be used, if it + * is set. + * + * @since 2.0.0 + * @uses $wpdb + * + * @param object|string|int $comment Comment to retrieve. + * @param string $output Optional. OBJECT or ARRAY_A or ARRAY_N constants. + * @return object|array|null Depends on $output value. + */ +function &get_comment(&$comment, $output = OBJECT) { + global $wpdb; + $null = null; + + if ( empty($comment) ) { + if ( isset($GLOBALS['comment']) ) + $_comment = & $GLOBALS['comment']; + else + $_comment = null; + } elseif ( is_object($comment) ) { + wp_cache_add($comment->comment_ID, $comment, 'comment'); + $_comment = $comment; + } else { + if ( isset($GLOBALS['comment']) && ($GLOBALS['comment']->comment_ID == $comment) ) { + $_comment = & $GLOBALS['comment']; + } elseif ( ! $_comment = wp_cache_get($comment, 'comment') ) { + $_comment = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->comments WHERE comment_ID = %d LIMIT 1", $comment)); + if ( ! $_comment ) + return $null; + wp_cache_add($_comment->comment_ID, $_comment, 'comment'); + } + } + + $_comment = apply_filters('get_comment', $_comment); + + if ( $output == OBJECT ) { + return $_comment; + } elseif ( $output == ARRAY_A ) { + $__comment = get_object_vars($_comment); + return $__comment; + } elseif ( $output == ARRAY_N ) { + $__comment = array_values(get_object_vars($_comment)); + return $__comment; + } else { + return $_comment; + } +} + +/** + * Retrieve a list of comments. + * + * The comment list can be for the blog as a whole or for an individual post. + * + * The list of comment arguments are 'status', 'orderby', 'comment_date_gmt', + * 'order', 'number', 'offset', and 'post_id'. + * + * @since 2.7.0 + * @uses $wpdb + * + * @param mixed $args Optional. Array or string of options to override defaults. + * @return array List of comments. + */ +function get_comments( $args = '' ) { + $query = new WP_Comment_Query; + return $query->query( $args ); +} + +/** + * WordPress Comment Query class. + * + * @since 3.1.0 + */ +class WP_Comment_Query { + + /** + * Execute the query + * + * @since 3.1.0 + * + * @param string|array $query_vars + * @return int|array + */ + function query( $query_vars ) { + global $wpdb; + + $defaults = array( + 'author_email' => '', + 'ID' => '', + 'karma' => '', + 'number' => '', + 'offset' => '', + 'orderby' => '', + 'order' => 'DESC', + 'parent' => '', + 'post_ID' => '', + 'post_id' => 0, + 'post_author' => '', + 'post_name' => '', + 'post_parent' => '', + 'post_status' => '', + 'post_type' => '', + 'status' => '', + 'type' => '', + 'user_id' => '', + 'search' => '', + 'count' => false + ); + + $this->query_vars = wp_parse_args( $query_vars, $defaults ); + do_action_ref_array( 'pre_get_comments', array( &$this ) ); + extract( $this->query_vars, EXTR_SKIP ); + + // $args can be whatever, only use the args defined in defaults to compute the key + $key = md5( serialize( compact(array_keys($defaults)) ) ); + $last_changed = wp_cache_get('last_changed', 'comment'); + if ( !$last_changed ) { + $last_changed = time(); + wp_cache_set('last_changed', $last_changed, 'comment'); + } + $cache_key = "get_comments:$key:$last_changed"; + + if ( $cache = wp_cache_get( $cache_key, 'comment' ) ) { + return $cache; + } + + $post_id = absint($post_id); + + if ( 'hold' == $status ) + $approved = "comment_approved = '0'"; + elseif ( 'approve' == $status ) + $approved = "comment_approved = '1'"; + elseif ( 'spam' == $status ) + $approved = "comment_approved = 'spam'"; + elseif ( 'trash' == $status ) + $approved = "comment_approved = 'trash'"; + else + $approved = "( comment_approved = '0' OR comment_approved = '1' )"; + + $order = ( 'ASC' == strtoupper($order) ) ? 'ASC' : 'DESC'; + + if ( ! empty( $orderby ) ) { + $ordersby = is_array($orderby) ? $orderby : preg_split('/[,\s]/', $orderby); + $ordersby = array_intersect( + $ordersby, + array( + 'comment_agent', + 'comment_approved', + 'comment_author', + 'comment_author_email', + 'comment_author_IP', + 'comment_author_url', + 'comment_content', + 'comment_date', + 'comment_date_gmt', + 'comment_ID', + 'comment_karma', + 'comment_parent', + 'comment_post_ID', + 'comment_type', + 'user_id', + ) + ); + $orderby = empty( $ordersby ) ? 'comment_date_gmt' : implode(', ', $ordersby); + } else { + $orderby = 'comment_date_gmt'; + } + + $number = absint($number); + $offset = absint($offset); + + if ( !empty($number) ) { + if ( $offset ) + $limits = 'LIMIT ' . $offset . ',' . $number; + else + $limits = 'LIMIT ' . $number; + } else { + $limits = ''; + } + + if ( $count ) + $fields = 'COUNT(*)'; + else + $fields = '*'; + + $join = ''; + $where = $approved; + + if ( ! empty($post_id) ) + $where .= $wpdb->prepare( ' AND comment_post_ID = %d', $post_id ); + if ( '' !== $author_email ) + $where .= $wpdb->prepare( ' AND comment_author_email = %s', $author_email ); + if ( '' !== $karma ) + $where .= $wpdb->prepare( ' AND comment_karma = %d', $karma ); + if ( 'comment' == $type ) { + $where .= " AND comment_type = ''"; + } elseif( 'pings' == $type ) { + $where .= ' AND comment_type IN ("pingback", "trackback")'; + } elseif ( ! empty( $type ) ) { + $where .= $wpdb->prepare( ' AND comment_type = %s', $type ); + } + if ( '' !== $parent ) + $where .= $wpdb->prepare( ' AND comment_parent = %d', $parent ); + if ( '' !== $user_id ) + $where .= $wpdb->prepare( ' AND user_id = %d', $user_id ); + if ( '' !== $search ) + $where .= $this->get_search_sql( $search, array( 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_author_IP', 'comment_content' ) ); + + $post_fields = array_filter( compact( array( 'post_author', 'post_name', 'post_parent', 'post_status', 'post_type', ) ) ); + if ( ! empty( $post_fields ) ) { + $join = "JOIN $wpdb->posts ON $wpdb->posts.ID = $wpdb->comments.comment_post_ID"; + foreach( $post_fields as $field_name => $field_value ) + $where .= $wpdb->prepare( " AND {$wpdb->posts}.{$field_name} = %s", $field_value ); + } + + $pieces = array( 'fields', 'join', 'where', 'orderby', 'order', 'limits' ); + $clauses = apply_filters_ref_array( 'comments_clauses', array( compact( $pieces ), &$this ) ); + foreach ( $pieces as $piece ) + $$piece = isset( $clauses[ $piece ] ) ? $clauses[ $piece ] : ''; + + $query = "SELECT $fields FROM $wpdb->comments $join WHERE $where ORDER BY $orderby $order $limits"; + + if ( $count ) + return $wpdb->get_var( $query ); + + $comments = $wpdb->get_results( $query ); + $comments = apply_filters_ref_array( 'the_comments', array( $comments, &$this ) ); + + wp_cache_add( $cache_key, $comments, 'comment' ); + + return $comments; + } + + /* + * Used internally to generate an SQL string for searching across multiple columns + * + * @access protected + * @since 3.1.0 + * + * @param string $string + * @param array $cols + * @return string + */ + function get_search_sql( $string, $cols ) { + $string = esc_sql( like_escape( $string ) ); + + $searches = array(); + foreach ( $cols as $col ) + $searches[] = "$col LIKE '%$string%'"; + + return ' AND (' . implode(' OR ', $searches) . ')'; + } +} + +/** + * Retrieve all of the WordPress supported comment statuses. + * + * Comments have a limited set of valid status values, this provides the comment + * status values and descriptions. + * + * @package WordPress + * @subpackage Post + * @since 2.7.0 + * + * @return array List of comment statuses. + */ +function get_comment_statuses( ) { + $status = array( + 'hold' => __('Unapproved'), + /* translators: comment status */ + 'approve' => _x('Approved', 'adjective'), + /* translators: comment status */ + 'spam' => _x('Spam', 'adjective'), + ); + + return $status; +} + + +/** + * The date the last comment was modified. + * + * @since 1.5.0 + * @uses $wpdb + * @global array $cache_lastcommentmodified + * + * @param string $timezone Which timezone to use in reference to 'gmt', 'blog', + * or 'server' locations. + * @return string Last comment modified date. + */ +function get_lastcommentmodified($timezone = 'server') { + global $cache_lastcommentmodified, $wpdb; + + if ( isset($cache_lastcommentmodified[$timezone]) ) + return $cache_lastcommentmodified[$timezone]; + + $add_seconds_server = date('Z'); + + switch ( strtolower($timezone)) { + case 'gmt': + $lastcommentmodified = $wpdb->get_var("SELECT comment_date_gmt FROM $wpdb->comments WHERE comment_approved = '1' ORDER BY comment_date_gmt DESC LIMIT 1"); + break; + case 'blog': + $lastcommentmodified = $wpdb->get_var("SELECT comment_date FROM $wpdb->comments WHERE comment_approved = '1' ORDER BY comment_date_gmt DESC LIMIT 1"); + break; + case 'server': + $lastcommentmodified = $wpdb->get_var($wpdb->prepare("SELECT DATE_ADD(comment_date_gmt, INTERVAL %s SECOND) FROM $wpdb->comments WHERE comment_approved = '1' ORDER BY comment_date_gmt DESC LIMIT 1", $add_seconds_server)); + break; + } + + $cache_lastcommentmodified[$timezone] = $lastcommentmodified; + + return $lastcommentmodified; +} + +/** + * The amount of comments in a post or total comments. + * + * A lot like {@link wp_count_comments()}, in that they both return comment + * stats (albeit with different types). The {@link wp_count_comments()} actual + * caches, but this function does not. + * + * @since 2.0.0 + * @uses $wpdb + * + * @param int $post_id Optional. Comment amount in post if > 0, else total comments blog wide. + * @return array The amount of spam, approved, awaiting moderation, and total comments. + */ +function get_comment_count( $post_id = 0 ) { + global $wpdb; + + $post_id = (int) $post_id; + + $where = ''; + if ( $post_id > 0 ) { + $where = $wpdb->prepare("WHERE comment_post_ID = %d", $post_id); + } + + $totals = (array) $wpdb->get_results(" + SELECT comment_approved, COUNT( * ) AS total + FROM {$wpdb->comments} + {$where} + GROUP BY comment_approved + ", ARRAY_A); + + $comment_count = array( + "approved" => 0, + "awaiting_moderation" => 0, + "spam" => 0, + "total_comments" => 0 + ); + + foreach ( $totals as $row ) { + switch ( $row['comment_approved'] ) { + case 'spam': + $comment_count['spam'] = $row['total']; + $comment_count["total_comments"] += $row['total']; + break; + case 1: + $comment_count['approved'] = $row['total']; + $comment_count['total_comments'] += $row['total']; + break; + case 0: + $comment_count['awaiting_moderation'] = $row['total']; + $comment_count['total_comments'] += $row['total']; + break; + default: + break; + } + } + + return $comment_count; +} + +// +// Comment meta functions +// + +/** + * Add meta data field to a comment. + * + * @since 2.9.0 + * @uses add_metadata + * @link http://codex.wordpress.org/Function_Reference/add_comment_meta + * + * @param int $comment_id Comment ID. + * @param string $meta_key Metadata name. + * @param mixed $meta_value Metadata value. + * @param bool $unique Optional, default is false. Whether the same key should not be added. + * @return bool False for failure. True for success. + */ +function add_comment_meta($comment_id, $meta_key, $meta_value, $unique = false) { + return add_metadata('comment', $comment_id, $meta_key, $meta_value, $unique); +} + +/** + * Remove metadata matching criteria from a comment. + * + * You can match based on the key, or key and value. Removing based on key and + * value, will keep from removing duplicate metadata with the same key. It also + * allows removing all metadata matching key, if needed. + * + * @since 2.9.0 + * @uses delete_metadata + * @link http://codex.wordpress.org/Function_Reference/delete_comment_meta + * + * @param int $comment_id comment ID + * @param string $meta_key Metadata name. + * @param mixed $meta_value Optional. Metadata value. + * @return bool False for failure. True for success. + */ +function delete_comment_meta($comment_id, $meta_key, $meta_value = '') { + return delete_metadata('comment', $comment_id, $meta_key, $meta_value); +} + +/** + * Retrieve comment meta field for a comment. + * + * @since 2.9.0 + * @uses get_metadata + * @link http://codex.wordpress.org/Function_Reference/get_comment_meta + * + * @param int $comment_id Comment ID. + * @param string $key The meta key to retrieve. + * @param bool $single Whether to return a single value. + * @return mixed Will be an array if $single is false. Will be value of meta data field if $single + * is true. + */ +function get_comment_meta($comment_id, $key, $single = false) { + return get_metadata('comment', $comment_id, $key, $single); +} + +/** + * Update comment meta field based on comment ID. + * + * Use the $prev_value parameter to differentiate between meta fields with the + * same key and comment ID. + * + * If the meta field for the comment does not exist, it will be added. + * + * @since 2.9.0 + * @uses update_metadata + * @link http://codex.wordpress.org/Function_Reference/update_comment_meta + * + * @param int $comment_id Comment ID. + * @param string $meta_key Metadata key. + * @param mixed $meta_value Metadata value. + * @param mixed $prev_value Optional. Previous value to check before removing. + * @return bool False on failure, true if success. + */ +function update_comment_meta($comment_id, $meta_key, $meta_value, $prev_value = '') { + return update_metadata('comment', $comment_id, $meta_key, $meta_value, $prev_value); +} + +/** + * Sanitizes the cookies sent to the user already. + * + * Will only do anything if the cookies have already been created for the user. + * Mostly used after cookies had been sent to use elsewhere. + * + * @since 2.0.4 + */ +function sanitize_comment_cookies() { + if ( isset($_COOKIE['comment_author_'.COOKIEHASH]) ) { + $comment_author = apply_filters('pre_comment_author_name', $_COOKIE['comment_author_'.COOKIEHASH]); + $comment_author = stripslashes($comment_author); + $comment_author = esc_attr($comment_author); + $_COOKIE['comment_author_'.COOKIEHASH] = $comment_author; + } + + if ( isset($_COOKIE['comment_author_email_'.COOKIEHASH]) ) { + $comment_author_email = apply_filters('pre_comment_author_email', $_COOKIE['comment_author_email_'.COOKIEHASH]); + $comment_author_email = stripslashes($comment_author_email); + $comment_author_email = esc_attr($comment_author_email); + $_COOKIE['comment_author_email_'.COOKIEHASH] = $comment_author_email; + } + + if ( isset($_COOKIE['comment_author_url_'.COOKIEHASH]) ) { + $comment_author_url = apply_filters('pre_comment_author_url', $_COOKIE['comment_author_url_'.COOKIEHASH]); + $comment_author_url = stripslashes($comment_author_url); + $_COOKIE['comment_author_url_'.COOKIEHASH] = $comment_author_url; + } +} + +/** + * Validates whether this comment is allowed to be made. + * + * @since 2.0.0 + * @uses $wpdb + * @uses apply_filters() Calls 'pre_comment_approved' hook on the type of comment + * @uses apply_filters() Calls 'comment_duplicate_trigger' hook on commentdata. + * @uses do_action() Calls 'check_comment_flood' hook on $comment_author_IP, $comment_author_email, and $comment_date_gmt + * + * @param array $commentdata Contains information on the comment + * @return mixed Signifies the approval status (0|1|'spam') + */ +function wp_allow_comment($commentdata) { + global $wpdb; + extract($commentdata, EXTR_SKIP); + + // Simple duplicate check + // expected_slashed ($comment_post_ID, $comment_author, $comment_author_email, $comment_content) + $dupe = "SELECT comment_ID FROM $wpdb->comments WHERE comment_post_ID = '$comment_post_ID' AND comment_approved != 'trash' AND ( comment_author = '$comment_author' "; + if ( $comment_author_email ) + $dupe .= "OR comment_author_email = '$comment_author_email' "; + $dupe .= ") AND comment_content = '$comment_content' LIMIT 1"; + if ( $wpdb->get_var($dupe) ) { + do_action( 'comment_duplicate_trigger', $commentdata ); + if ( defined('DOING_AJAX') ) + die( __('Duplicate comment detected; it looks as though you’ve already said that!') ); + + wp_die( __('Duplicate comment detected; it looks as though you’ve already said that!') ); + } + + do_action( 'check_comment_flood', $comment_author_IP, $comment_author_email, $comment_date_gmt ); + + if ( isset($user_id) && $user_id) { + $userdata = get_userdata($user_id); + $user = new WP_User($user_id); + $post_author = $wpdb->get_var($wpdb->prepare("SELECT post_author FROM $wpdb->posts WHERE ID = %d LIMIT 1", $comment_post_ID)); + } + + if ( isset($userdata) && ( $user_id == $post_author || $user->has_cap('moderate_comments') ) ) { + // The author and the admins get respect. + $approved = 1; + } else { + // Everyone else's comments will be checked. + if ( check_comment($comment_author, $comment_author_email, $comment_author_url, $comment_content, $comment_author_IP, $comment_agent, $comment_type) ) + $approved = 1; + else + $approved = 0; + if ( wp_blacklist_check($comment_author, $comment_author_email, $comment_author_url, $comment_content, $comment_author_IP, $comment_agent) ) + $approved = 'spam'; + } + + $approved = apply_filters( 'pre_comment_approved', $approved, $commentdata ); + return $approved; +} + +/** + * Check whether comment flooding is occurring. + * + * Won't run, if current user can manage options, so to not block + * administrators. + * + * @since 2.3.0 + * @uses $wpdb + * @uses apply_filters() Calls 'comment_flood_filter' filter with first + * parameter false, last comment timestamp, new comment timestamp. + * @uses do_action() Calls 'comment_flood_trigger' action with parameters with + * last comment timestamp and new comment timestamp. + * + * @param string $ip Comment IP. + * @param string $email Comment author email address. + * @param string $date MySQL time string. + */ +function check_comment_flood_db( $ip, $email, $date ) { + global $wpdb; + if ( current_user_can( 'manage_options' ) ) + return; // don't throttle admins + $hour_ago = gmdate( 'Y-m-d H:i:s', time() - 3600 ); + if ( $lasttime = $wpdb->get_var( $wpdb->prepare( "SELECT `comment_date_gmt` FROM `$wpdb->comments` WHERE `comment_date_gmt` >= %s AND ( `comment_author_IP` = %s OR `comment_author_email` = %s ) ORDER BY `comment_date_gmt` DESC LIMIT 1", $hour_ago, $ip, $email ) ) ) { + $time_lastcomment = mysql2date('U', $lasttime, false); + $time_newcomment = mysql2date('U', $date, false); + $flood_die = apply_filters('comment_flood_filter', false, $time_lastcomment, $time_newcomment); + if ( $flood_die ) { + do_action('comment_flood_trigger', $time_lastcomment, $time_newcomment); + + if ( defined('DOING_AJAX') ) + die( __('You are posting comments too quickly. Slow down.') ); + + wp_die( __('You are posting comments too quickly. Slow down.'), '', array('response' => 403) ); + } + } +} + +/** + * Separates an array of comments into an array keyed by comment_type. + * + * @since 2.7.0 + * + * @param array $comments Array of comments + * @return array Array of comments keyed by comment_type. + */ +function &separate_comments(&$comments) { + $comments_by_type = array('comment' => array(), 'trackback' => array(), 'pingback' => array(), 'pings' => array()); + $count = count($comments); + for ( $i = 0; $i < $count; $i++ ) { + $type = $comments[$i]->comment_type; + if ( empty($type) ) + $type = 'comment'; + $comments_by_type[$type][] = &$comments[$i]; + if ( 'trackback' == $type || 'pingback' == $type ) + $comments_by_type['pings'][] = &$comments[$i]; + } + + return $comments_by_type; +} + +/** + * Calculate the total number of comment pages. + * + * @since 2.7.0 + * @uses get_query_var() Used to fill in the default for $per_page parameter. + * @uses get_option() Used to fill in defaults for parameters. + * @uses Walker_Comment + * + * @param array $comments Optional array of comment objects. Defaults to $wp_query->comments + * @param int $per_page Optional comments per page. + * @param boolean $threaded Optional control over flat or threaded comments. + * @return int Number of comment pages. + */ +function get_comment_pages_count( $comments = null, $per_page = null, $threaded = null ) { + global $wp_query; + + if ( null === $comments && null === $per_page && null === $threaded && !empty($wp_query->max_num_comment_pages) ) + return $wp_query->max_num_comment_pages; + + if ( !$comments || !is_array($comments) ) + $comments = $wp_query->comments; + + if ( empty($comments) ) + return 0; + + if ( !isset($per_page) ) + $per_page = (int) get_query_var('comments_per_page'); + if ( 0 === $per_page ) + $per_page = (int) get_option('comments_per_page'); + if ( 0 === $per_page ) + return 1; + + if ( !isset($threaded) ) + $threaded = get_option('thread_comments'); + + if ( $threaded ) { + $walker = new Walker_Comment; + $count = ceil( $walker->get_number_of_root_elements( $comments ) / $per_page ); + } else { + $count = ceil( count( $comments ) / $per_page ); + } + + return $count; +} + +/** + * Calculate what page number a comment will appear on for comment paging. + * + * @since 2.7.0 + * @uses get_comment() Gets the full comment of the $comment_ID parameter. + * @uses get_option() Get various settings to control function and defaults. + * @uses get_page_of_comment() Used to loop up to top level comment. + * + * @param int $comment_ID Comment ID. + * @param array $args Optional args. + * @return int|null Comment page number or null on error. + */ +function get_page_of_comment( $comment_ID, $args = array() ) { + global $wpdb; + + if ( !$comment = get_comment( $comment_ID ) ) + return; + + $defaults = array( 'type' => 'all', 'page' => '', 'per_page' => '', 'max_depth' => '' ); + $args = wp_parse_args( $args, $defaults ); + + if ( '' === $args['per_page'] && get_option('page_comments') ) + $args['per_page'] = get_query_var('comments_per_page'); + if ( empty($args['per_page']) ) { + $args['per_page'] = 0; + $args['page'] = 0; + } + if ( $args['per_page'] < 1 ) + return 1; + + if ( '' === $args['max_depth'] ) { + if ( get_option('thread_comments') ) + $args['max_depth'] = get_option('thread_comments_depth'); + else + $args['max_depth'] = -1; + } + + // Find this comment's top level parent if threading is enabled + if ( $args['max_depth'] > 1 && 0 != $comment->comment_parent ) + return get_page_of_comment( $comment->comment_parent, $args ); + + $allowedtypes = array( + 'comment' => '', + 'pingback' => 'pingback', + 'trackback' => 'trackback', + ); + + $comtypewhere = ( 'all' != $args['type'] && isset($allowedtypes[$args['type']]) ) ? " AND comment_type = '" . $allowedtypes[$args['type']] . "'" : ''; + + // Count comments older than this one + $oldercoms = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(comment_ID) FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_parent = 0 AND comment_approved = '1' AND comment_date_gmt < '%s'" . $comtypewhere, $comment->comment_post_ID, $comment->comment_date_gmt ) ); + + // No older comments? Then it's page #1. + if ( 0 == $oldercoms ) + return 1; + + // Divide comments older than this one by comments per page to get this comment's page number + return ceil( ( $oldercoms + 1 ) / $args['per_page'] ); +} + +/** + * Does comment contain blacklisted characters or words. + * + * @since 1.5.0 + * @uses do_action() Calls 'wp_blacklist_check' hook for all parameters. + * + * @param string $author The author of the comment + * @param string $email The email of the comment + * @param string $url The url used in the comment + * @param string $comment The comment content + * @param string $user_ip The comment author IP address + * @param string $user_agent The author's browser user agent + * @return bool True if comment contains blacklisted content, false if comment does not + */ +function wp_blacklist_check($author, $email, $url, $comment, $user_ip, $user_agent) { + do_action('wp_blacklist_check', $author, $email, $url, $comment, $user_ip, $user_agent); + + $mod_keys = trim( get_option('blacklist_keys') ); + if ( '' == $mod_keys ) + return false; // If moderation keys are empty + $words = explode("\n", $mod_keys ); + + foreach ( (array) $words as $word ) { + $word = trim($word); + + // Skip empty lines + if ( empty($word) ) { continue; } + + // Do some escaping magic so that '#' chars in the + // spam words don't break things: + $word = preg_quote($word, '#'); + + $pattern = "#$word#i"; + if ( + preg_match($pattern, $author) + || preg_match($pattern, $email) + || preg_match($pattern, $url) + || preg_match($pattern, $comment) + || preg_match($pattern, $user_ip) + || preg_match($pattern, $user_agent) + ) + return true; + } + return false; +} + +/** + * Retrieve total comments for blog or single post. + * + * The properties of the returned object contain the 'moderated', 'approved', + * and spam comments for either the entire blog or single post. Those properties + * contain the amount of comments that match the status. The 'total_comments' + * property contains the integer of total comments. + * + * The comment stats are cached and then retrieved, if they already exist in the + * cache. + * + * @since 2.5.0 + * + * @param int $post_id Optional. Post ID. + * @return object Comment stats. + */ +function wp_count_comments( $post_id = 0 ) { + global $wpdb; + + $post_id = (int) $post_id; + + $stats = apply_filters('wp_count_comments', array(), $post_id); + if ( !empty($stats) ) + return $stats; + + $count = wp_cache_get("comments-{$post_id}", 'counts'); + + if ( false !== $count ) + return $count; + + $where = ''; + if ( $post_id > 0 ) + $where = $wpdb->prepare( "WHERE comment_post_ID = %d", $post_id ); + + $count = $wpdb->get_results( "SELECT comment_approved, COUNT( * ) AS num_comments FROM {$wpdb->comments} {$where} GROUP BY comment_approved", ARRAY_A ); + + $total = 0; + $approved = array('0' => 'moderated', '1' => 'approved', 'spam' => 'spam', 'trash' => 'trash', 'post-trashed' => 'post-trashed'); + foreach ( (array) $count as $row ) { + // Don't count post-trashed toward totals + if ( 'post-trashed' != $row['comment_approved'] && 'trash' != $row['comment_approved'] ) + $total += $row['num_comments']; + if ( isset( $approved[$row['comment_approved']] ) ) + $stats[$approved[$row['comment_approved']]] = $row['num_comments']; + } + + $stats['total_comments'] = $total; + foreach ( $approved as $key ) { + if ( empty($stats[$key]) ) + $stats[$key] = 0; + } + + $stats = (object) $stats; + wp_cache_set("comments-{$post_id}", $stats, 'counts'); + + return $stats; +} + +/** + * Trashes or deletes a comment. + * + * The comment is moved to trash instead of permanently deleted unless trash is + * disabled, item is already in the trash, or $force_delete is true. + * + * The post comment count will be updated if the comment was approved and has a + * post ID available. + * + * @since 2.0.0 + * @uses $wpdb + * @uses do_action() Calls 'delete_comment' hook on comment ID + * @uses do_action() Calls 'deleted_comment' hook on comment ID after deletion, on success + * @uses do_action() Calls 'wp_set_comment_status' hook on comment ID with 'delete' set for the second parameter + * @uses wp_transition_comment_status() Passes new and old comment status along with $comment object + * + * @param int $comment_id Comment ID + * @param bool $force_delete Whether to bypass trash and force deletion. Default is false. + * @return bool False if delete comment query failure, true on success. + */ +function wp_delete_comment($comment_id, $force_delete = false) { + global $wpdb; + if (!$comment = get_comment($comment_id)) + return false; + + if ( !$force_delete && EMPTY_TRASH_DAYS && !in_array( wp_get_comment_status($comment_id), array( 'trash', 'spam' ) ) ) + return wp_trash_comment($comment_id); + + do_action('delete_comment', $comment_id); + + // Move children up a level. + $children = $wpdb->get_col( $wpdb->prepare("SELECT comment_ID FROM $wpdb->comments WHERE comment_parent = %d", $comment_id) ); + if ( !empty($children) ) { + $wpdb->update($wpdb->comments, array('comment_parent' => $comment->comment_parent), array('comment_parent' => $comment_id)); + clean_comment_cache($children); + } + + // Delete metadata + $meta_ids = $wpdb->get_col( $wpdb->prepare( "SELECT meta_id FROM $wpdb->commentmeta WHERE comment_id = %d ", $comment_id ) ); + if ( !empty($meta_ids) ) { + do_action( 'delete_commentmeta', $meta_ids ); + $in_meta_ids = "'" . implode("', '", $meta_ids) . "'"; + $wpdb->query( "DELETE FROM $wpdb->commentmeta WHERE meta_id IN ($in_meta_ids)" ); + do_action( 'deleted_commentmeta', $meta_ids ); + } + + if ( ! $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->comments WHERE comment_ID = %d LIMIT 1", $comment_id) ) ) + return false; + do_action('deleted_comment', $comment_id); + + $post_id = $comment->comment_post_ID; + if ( $post_id && $comment->comment_approved == 1 ) + wp_update_comment_count($post_id); + + clean_comment_cache($comment_id); + + do_action('wp_set_comment_status', $comment_id, 'delete'); + wp_transition_comment_status('delete', $comment->comment_approved, $comment); + return true; +} + +/** + * Moves a comment to the Trash + * + * If trash is disabled, comment is permanently deleted. + * + * @since 2.9.0 + * @uses do_action() on 'trash_comment' before trashing + * @uses do_action() on 'trashed_comment' after trashing + * @uses wp_delete_comment() if trash is disabled + * + * @param int $comment_id Comment ID. + * @return mixed False on failure + */ +function wp_trash_comment($comment_id) { + if ( !EMPTY_TRASH_DAYS ) + return wp_delete_comment($comment_id, true); + + if ( !$comment = get_comment($comment_id) ) + return false; + + do_action('trash_comment', $comment_id); + + if ( wp_set_comment_status($comment_id, 'trash') ) { + add_comment_meta($comment_id, '_wp_trash_meta_status', $comment->comment_approved); + add_comment_meta($comment_id, '_wp_trash_meta_time', time() ); + do_action('trashed_comment', $comment_id); + return true; + } + + return false; +} + +/** + * Removes a comment from the Trash + * + * @since 2.9.0 + * @uses do_action() on 'untrash_comment' before untrashing + * @uses do_action() on 'untrashed_comment' after untrashing + * + * @param int $comment_id Comment ID. + * @return mixed False on failure + */ +function wp_untrash_comment($comment_id) { + if ( ! (int)$comment_id ) + return false; + + do_action('untrash_comment', $comment_id); + + $status = (string) get_comment_meta($comment_id, '_wp_trash_meta_status', true); + if ( empty($status) ) + $status = '0'; + + if ( wp_set_comment_status($comment_id, $status) ) { + delete_comment_meta($comment_id, '_wp_trash_meta_time'); + delete_comment_meta($comment_id, '_wp_trash_meta_status'); + do_action('untrashed_comment', $comment_id); + return true; + } + + return false; +} + +/** + * Marks a comment as Spam + * + * @since 2.9.0 + * @uses do_action() on 'spam_comment' before spamming + * @uses do_action() on 'spammed_comment' after spamming + * + * @param int $comment_id Comment ID. + * @return mixed False on failure + */ +function wp_spam_comment($comment_id) { + if ( !$comment = get_comment($comment_id) ) + return false; + + do_action('spam_comment', $comment_id); + + if ( wp_set_comment_status($comment_id, 'spam') ) { + add_comment_meta($comment_id, '_wp_trash_meta_status', $comment->comment_approved); + do_action('spammed_comment', $comment_id); + return true; + } + + return false; +} + +/** + * Removes a comment from the Spam + * + * @since 2.9.0 + * @uses do_action() on 'unspam_comment' before unspamming + * @uses do_action() on 'unspammed_comment' after unspamming + * + * @param int $comment_id Comment ID. + * @return mixed False on failure + */ +function wp_unspam_comment($comment_id) { + if ( ! (int)$comment_id ) + return false; + + do_action('unspam_comment', $comment_id); + + $status = (string) get_comment_meta($comment_id, '_wp_trash_meta_status', true); + if ( empty($status) ) + $status = '0'; + + if ( wp_set_comment_status($comment_id, $status) ) { + delete_comment_meta($comment_id, '_wp_trash_meta_status'); + do_action('unspammed_comment', $comment_id); + return true; + } + + return false; +} + +/** + * The status of a comment by ID. + * + * @since 1.0.0 + * + * @param int $comment_id Comment ID + * @return string|bool Status might be 'trash', 'approved', 'unapproved', 'spam'. False on failure. + */ +function wp_get_comment_status($comment_id) { + $comment = get_comment($comment_id); + if ( !$comment ) + return false; + + $approved = $comment->comment_approved; + + if ( $approved == NULL ) + return false; + elseif ( $approved == '1' ) + return 'approved'; + elseif ( $approved == '0' ) + return 'unapproved'; + elseif ( $approved == 'spam' ) + return 'spam'; + elseif ( $approved == 'trash' ) + return 'trash'; + else + return false; +} + +/** + * Call hooks for when a comment status transition occurs. + * + * Calls hooks for comment status transitions. If the new comment status is not the same + * as the previous comment status, then two hooks will be ran, the first is + * 'transition_comment_status' with new status, old status, and comment data. The + * next action called is 'comment_OLDSTATUS_to_NEWSTATUS' the NEWSTATUS is the + * $new_status parameter and the OLDSTATUS is $old_status parameter; it has the + * comment data. + * + * The final action will run whether or not the comment statuses are the same. The + * action is named 'comment_NEWSTATUS_COMMENTTYPE', NEWSTATUS is from the $new_status + * parameter and COMMENTTYPE is comment_type comment data. + * + * @since 2.7.0 + * + * @param string $new_status New comment status. + * @param string $old_status Previous comment status. + * @param object $comment Comment data. + */ +function wp_transition_comment_status($new_status, $old_status, $comment) { + // Translate raw statuses to human readable formats for the hooks + // This is not a complete list of comment status, it's only the ones that need to be renamed + $comment_statuses = array( + 0 => 'unapproved', + 'hold' => 'unapproved', // wp_set_comment_status() uses "hold" + 1 => 'approved', + 'approve' => 'approved', // wp_set_comment_status() uses "approve" + ); + if ( isset($comment_statuses[$new_status]) ) $new_status = $comment_statuses[$new_status]; + if ( isset($comment_statuses[$old_status]) ) $old_status = $comment_statuses[$old_status]; + + // Call the hooks + if ( $new_status != $old_status ) { + do_action('transition_comment_status', $new_status, $old_status, $comment); + do_action("comment_{$old_status}_to_{$new_status}", $comment); + } + do_action("comment_{$new_status}_{$comment->comment_type}", $comment->comment_ID, $comment); +} + +/** + * Get current commenter's name, email, and URL. + * + * Expects cookies content to already be sanitized. User of this function might + * wish to recheck the returned array for validity. + * + * @see sanitize_comment_cookies() Use to sanitize cookies + * + * @since 2.0.4 + * + * @return array Comment author, email, url respectively. + */ +function wp_get_current_commenter() { + // Cookies should already be sanitized. + + $comment_author = ''; + if ( isset($_COOKIE['comment_author_'.COOKIEHASH]) ) + $comment_author = $_COOKIE['comment_author_'.COOKIEHASH]; + + $comment_author_email = ''; + if ( isset($_COOKIE['comment_author_email_'.COOKIEHASH]) ) + $comment_author_email = $_COOKIE['comment_author_email_'.COOKIEHASH]; + + $comment_author_url = ''; + if ( isset($_COOKIE['comment_author_url_'.COOKIEHASH]) ) + $comment_author_url = $_COOKIE['comment_author_url_'.COOKIEHASH]; + + return apply_filters('wp_get_current_commenter', compact('comment_author', 'comment_author_email', 'comment_author_url')); +} + +/** + * Inserts a comment to the database. + * + * The available comment data key names are 'comment_author_IP', 'comment_date', + * 'comment_date_gmt', 'comment_parent', 'comment_approved', and 'user_id'. + * + * @since 2.0.0 + * @uses $wpdb + * + * @param array $commentdata Contains information on the comment. + * @return int The new comment's ID. + */ +function wp_insert_comment($commentdata) { + global $wpdb; + extract(stripslashes_deep($commentdata), EXTR_SKIP); + + if ( ! isset($comment_author_IP) ) + $comment_author_IP = ''; + if ( ! isset($comment_date) ) + $comment_date = current_time('mysql'); + if ( ! isset($comment_date_gmt) ) + $comment_date_gmt = get_gmt_from_date($comment_date); + if ( ! isset($comment_parent) ) + $comment_parent = 0; + if ( ! isset($comment_approved) ) + $comment_approved = 1; + if ( ! isset($comment_karma) ) + $comment_karma = 0; + if ( ! isset($user_id) ) + $user_id = 0; + if ( ! isset($comment_type) ) + $comment_type = ''; + + $data = compact('comment_post_ID', 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_author_IP', 'comment_date', 'comment_date_gmt', 'comment_content', 'comment_karma', 'comment_approved', 'comment_agent', 'comment_type', 'comment_parent', 'user_id'); + $wpdb->insert($wpdb->comments, $data); + + $id = (int) $wpdb->insert_id; + + if ( $comment_approved == 1 ) + wp_update_comment_count($comment_post_ID); + + $comment = get_comment($id); + do_action('wp_insert_comment', $id, $comment); + + return $id; +} + +/** + * Filters and sanitizes comment data. + * + * Sets the comment data 'filtered' field to true when finished. This can be + * checked as to whether the comment should be filtered and to keep from + * filtering the same comment more than once. + * + * @since 2.0.0 + * @uses apply_filters() Calls 'pre_user_id' hook on comment author's user ID + * @uses apply_filters() Calls 'pre_comment_user_agent' hook on comment author's user agent + * @uses apply_filters() Calls 'pre_comment_author_name' hook on comment author's name + * @uses apply_filters() Calls 'pre_comment_content' hook on the comment's content + * @uses apply_filters() Calls 'pre_comment_user_ip' hook on comment author's IP + * @uses apply_filters() Calls 'pre_comment_author_url' hook on comment author's URL + * @uses apply_filters() Calls 'pre_comment_author_email' hook on comment author's email address + * + * @param array $commentdata Contains information on the comment. + * @return array Parsed comment information. + */ +function wp_filter_comment($commentdata) { + if ( isset($commentdata['user_ID']) ) + $commentdata['user_id'] = apply_filters('pre_user_id', $commentdata['user_ID']); + elseif ( isset($commentdata['user_id']) ) + $commentdata['user_id'] = apply_filters('pre_user_id', $commentdata['user_id']); + $commentdata['comment_agent'] = apply_filters('pre_comment_user_agent', ( isset( $commentdata['comment_agent'] ) ? $commentdata['comment_agent'] : '' ) ); + $commentdata['comment_author'] = apply_filters('pre_comment_author_name', $commentdata['comment_author']); + $commentdata['comment_content'] = apply_filters('pre_comment_content', $commentdata['comment_content']); + $commentdata['comment_author_IP'] = apply_filters('pre_comment_user_ip', $commentdata['comment_author_IP']); + $commentdata['comment_author_url'] = apply_filters('pre_comment_author_url', $commentdata['comment_author_url']); + $commentdata['comment_author_email'] = apply_filters('pre_comment_author_email', $commentdata['comment_author_email']); + $commentdata['filtered'] = true; + return $commentdata; +} + +/** + * Whether comment should be blocked because of comment flood. + * + * @since 2.1.0 + * + * @param bool $block Whether plugin has already blocked comment. + * @param int $time_lastcomment Timestamp for last comment. + * @param int $time_newcomment Timestamp for new comment. + * @return bool Whether comment should be blocked. + */ +function wp_throttle_comment_flood($block, $time_lastcomment, $time_newcomment) { + if ( $block ) // a plugin has already blocked... we'll let that decision stand + return $block; + if ( ($time_newcomment - $time_lastcomment) < 15 ) + return true; + return false; +} + +/** + * Adds a new comment to the database. + * + * Filters new comment to ensure that the fields are sanitized and valid before + * inserting comment into database. Calls 'comment_post' action with comment ID + * and whether comment is approved by WordPress. Also has 'preprocess_comment' + * filter for processing the comment data before the function handles it. + * + * We use REMOTE_ADDR here directly. If you are behind a proxy, you should ensure + * that it is properly set, such as in wp-config.php, for your environment. + * See {@link http://core.trac.wordpress.org/ticket/9235} + * + * @since 1.5.0 + * @uses apply_filters() Calls 'preprocess_comment' hook on $commentdata parameter array before processing + * @uses do_action() Calls 'comment_post' hook on $comment_ID returned from adding the comment and if the comment was approved. + * @uses wp_filter_comment() Used to filter comment before adding comment. + * @uses wp_allow_comment() checks to see if comment is approved. + * @uses wp_insert_comment() Does the actual comment insertion to the database. + * + * @param array $commentdata Contains information on the comment. + * @return int The ID of the comment after adding. + */ +function wp_new_comment( $commentdata ) { + $commentdata = apply_filters('preprocess_comment', $commentdata); + + $commentdata['comment_post_ID'] = (int) $commentdata['comment_post_ID']; + if ( isset($commentdata['user_ID']) ) + $commentdata['user_id'] = $commentdata['user_ID'] = (int) $commentdata['user_ID']; + elseif ( isset($commentdata['user_id']) ) + $commentdata['user_id'] = (int) $commentdata['user_id']; + + $commentdata['comment_parent'] = isset($commentdata['comment_parent']) ? absint($commentdata['comment_parent']) : 0; + $parent_status = ( 0 < $commentdata['comment_parent'] ) ? wp_get_comment_status($commentdata['comment_parent']) : ''; + $commentdata['comment_parent'] = ( 'approved' == $parent_status || 'unapproved' == $parent_status ) ? $commentdata['comment_parent'] : 0; + + $commentdata['comment_author_IP'] = preg_replace( '/[^0-9a-fA-F:., ]/', '',$_SERVER['REMOTE_ADDR'] ); + $commentdata['comment_agent'] = substr($_SERVER['HTTP_USER_AGENT'], 0, 254); + + $commentdata['comment_date'] = current_time('mysql'); + $commentdata['comment_date_gmt'] = current_time('mysql', 1); + + $commentdata = wp_filter_comment($commentdata); + + $commentdata['comment_approved'] = wp_allow_comment($commentdata); + + $comment_ID = wp_insert_comment($commentdata); + + do_action('comment_post', $comment_ID, $commentdata['comment_approved']); + + if ( 'spam' !== $commentdata['comment_approved'] ) { // If it's spam save it silently for later crunching + if ( '0' == $commentdata['comment_approved'] ) + wp_notify_moderator($comment_ID); + + $post = &get_post($commentdata['comment_post_ID']); // Don't notify if it's your own comment + + if ( get_option('comments_notify') && $commentdata['comment_approved'] && ( ! isset( $commentdata['user_id'] ) || $post->post_author != $commentdata['user_id'] ) ) + wp_notify_postauthor($comment_ID, isset( $commentdata['comment_type'] ) ? $commentdata['comment_type'] : '' ); + } + + return $comment_ID; +} + +/** + * Sets the status of a comment. + * + * The 'wp_set_comment_status' action is called after the comment is handled and + * will only be called, if the comment status is either 'hold', 'approve', or + * 'spam'. If the comment status is not in the list, then false is returned and + * if the status is 'delete', then the comment is deleted without calling the + * action. + * + * @since 1.0.0 + * @uses wp_transition_comment_status() Passes new and old comment status along with $comment object + * + * @param int $comment_id Comment ID. + * @param string $comment_status New comment status, either 'hold', 'approve', 'spam', or 'delete'. + * @param bool $wp_error Whether to return a WP_Error object if there is a failure. Default is false. + * @return bool False on failure or deletion and true on success. + */ +function wp_set_comment_status($comment_id, $comment_status, $wp_error = false) { + global $wpdb; + + $status = '0'; + switch ( $comment_status ) { + case 'hold': + case '0': + $status = '0'; + break; + case 'approve': + case '1': + $status = '1'; + if ( get_option('comments_notify') ) { + $comment = get_comment($comment_id); + wp_notify_postauthor($comment_id, $comment->comment_type); + } + break; + case 'spam': + $status = 'spam'; + break; + case 'trash': + $status = 'trash'; + break; + default: + return false; + } + + $comment_old = clone get_comment($comment_id); + + if ( !$wpdb->update( $wpdb->comments, array('comment_approved' => $status), array('comment_ID' => $comment_id) ) ) { + if ( $wp_error ) + return new WP_Error('db_update_error', __('Could not update comment status'), $wpdb->last_error); + else + return false; + } + + clean_comment_cache($comment_id); + + $comment = get_comment($comment_id); + + do_action('wp_set_comment_status', $comment_id, $comment_status); + wp_transition_comment_status($comment_status, $comment_old->comment_approved, $comment); + + wp_update_comment_count($comment->comment_post_ID); + + return true; +} + +/** + * Updates an existing comment in the database. + * + * Filters the comment and makes sure certain fields are valid before updating. + * + * @since 2.0.0 + * @uses $wpdb + * @uses wp_transition_comment_status() Passes new and old comment status along with $comment object + * + * @param array $commentarr Contains information on the comment. + * @return int Comment was updated if value is 1, or was not updated if value is 0. + */ +function wp_update_comment($commentarr) { + global $wpdb; + + // First, get all of the original fields + $comment = get_comment($commentarr['comment_ID'], ARRAY_A); + + // Escape data pulled from DB. + $comment = esc_sql($comment); + + $old_status = $comment['comment_approved']; + + // Merge old and new fields with new fields overwriting old ones. + $commentarr = array_merge($comment, $commentarr); + + $commentarr = wp_filter_comment( $commentarr ); + + // Now extract the merged array. + extract(stripslashes_deep($commentarr), EXTR_SKIP); + + $comment_content = apply_filters('comment_save_pre', $comment_content); + + $comment_date_gmt = get_gmt_from_date($comment_date); + + if ( !isset($comment_approved) ) + $comment_approved = 1; + else if ( 'hold' == $comment_approved ) + $comment_approved = 0; + else if ( 'approve' == $comment_approved ) + $comment_approved = 1; + + $data = compact('comment_content', 'comment_author', 'comment_author_email', 'comment_approved', 'comment_karma', 'comment_author_url', 'comment_date', 'comment_date_gmt'); + $rval = $wpdb->update( $wpdb->comments, $data, compact( 'comment_ID' ) ); + + clean_comment_cache($comment_ID); + wp_update_comment_count($comment_post_ID); + do_action('edit_comment', $comment_ID); + $comment = get_comment($comment_ID); + wp_transition_comment_status($comment->comment_approved, $old_status, $comment); + return $rval; +} + +/** + * Whether to defer comment counting. + * + * When setting $defer to true, all post comment counts will not be updated + * until $defer is set to false. When $defer is set to false, then all + * previously deferred updated post comment counts will then be automatically + * updated without having to call wp_update_comment_count() after. + * + * @since 2.5.0 + * @staticvar bool $_defer + * + * @param bool $defer + * @return unknown + */ +function wp_defer_comment_counting($defer=null) { + static $_defer = false; + + if ( is_bool($defer) ) { + $_defer = $defer; + // flush any deferred counts + if ( !$defer ) + wp_update_comment_count( null, true ); + } + + return $_defer; +} + +/** + * Updates the comment count for post(s). + * + * When $do_deferred is false (is by default) and the comments have been set to + * be deferred, the post_id will be added to a queue, which will be updated at a + * later date and only updated once per post ID. + * + * If the comments have not be set up to be deferred, then the post will be + * updated. When $do_deferred is set to true, then all previous deferred post + * IDs will be updated along with the current $post_id. + * + * @since 2.1.0 + * @see wp_update_comment_count_now() For what could cause a false return value + * + * @param int $post_id Post ID + * @param bool $do_deferred Whether to process previously deferred post comment counts + * @return bool True on success, false on failure + */ +function wp_update_comment_count($post_id, $do_deferred=false) { + static $_deferred = array(); + + if ( $do_deferred ) { + $_deferred = array_unique($_deferred); + foreach ( $_deferred as $i => $_post_id ) { + wp_update_comment_count_now($_post_id); + unset( $_deferred[$i] ); /** @todo Move this outside of the foreach and reset $_deferred to an array instead */ + } + } + + if ( wp_defer_comment_counting() ) { + $_deferred[] = $post_id; + return true; + } + elseif ( $post_id ) { + return wp_update_comment_count_now($post_id); + } + +} + +/** + * Updates the comment count for the post. + * + * @since 2.5.0 + * @uses $wpdb + * @uses do_action() Calls 'wp_update_comment_count' hook on $post_id, $new, and $old + * @uses do_action() Calls 'edit_posts' hook on $post_id and $post + * + * @param int $post_id Post ID + * @return bool False on '0' $post_id or if post with ID does not exist. True on success. + */ +function wp_update_comment_count_now($post_id) { + global $wpdb; + $post_id = (int) $post_id; + if ( !$post_id ) + return false; + if ( !$post = get_post($post_id) ) + return false; + + $old = (int) $post->comment_count; + $new = (int) $wpdb->get_var( $wpdb->prepare("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_approved = '1'", $post_id) ); + $wpdb->update( $wpdb->posts, array('comment_count' => $new), array('ID' => $post_id) ); + + if ( 'page' == $post->post_type ) + clean_page_cache( $post_id ); + else + clean_post_cache( $post_id ); + + do_action('wp_update_comment_count', $post_id, $new, $old); + do_action('edit_post', $post_id, $post); + + return true; +} + +// +// Ping and trackback functions. +// + +/** + * Finds a pingback server URI based on the given URL. + * + * Checks the HTML for the rel="pingback" link and x-pingback headers. It does + * a check for the x-pingback headers first and returns that, if available. The + * check for the rel="pingback" has more overhead than just the header. + * + * @since 1.5.0 + * + * @param string $url URL to ping. + * @param int $deprecated Not Used. + * @return bool|string False on failure, string containing URI on success. + */ +function discover_pingback_server_uri( $url, $deprecated = '' ) { + if ( !empty( $deprecated ) ) + _deprecated_argument( __FUNCTION__, '2.7' ); + + $pingback_str_dquote = 'rel="pingback"'; + $pingback_str_squote = 'rel=\'pingback\''; + + /** @todo Should use Filter Extension or custom preg_match instead. */ + $parsed_url = parse_url($url); + + if ( ! isset( $parsed_url['host'] ) ) // Not an URL. This should never happen. + return false; + + //Do not search for a pingback server on our own uploads + $uploads_dir = wp_upload_dir(); + if ( 0 === strpos($url, $uploads_dir['baseurl']) ) + return false; + + $response = wp_remote_head( $url, array( 'timeout' => 2, 'httpversion' => '1.0' ) ); + + if ( is_wp_error( $response ) ) + return false; + + if ( wp_remote_retrieve_header( $response, 'x-pingback' ) ) + return wp_remote_retrieve_header( $response, 'x-pingback' ); + + // Not an (x)html, sgml, or xml page, no use going further. + if ( preg_match('#(image|audio|video|model)/#is', wp_remote_retrieve_header( $response, 'content-type' )) ) + return false; + + // Now do a GET since we're going to look in the html headers (and we're sure its not a binary file) + $response = wp_remote_get( $url, array( 'timeout' => 2, 'httpversion' => '1.0' ) ); + + if ( is_wp_error( $response ) ) + return false; + + $contents = wp_remote_retrieve_body( $response ); + + $pingback_link_offset_dquote = strpos($contents, $pingback_str_dquote); + $pingback_link_offset_squote = strpos($contents, $pingback_str_squote); + if ( $pingback_link_offset_dquote || $pingback_link_offset_squote ) { + $quote = ($pingback_link_offset_dquote) ? '"' : '\''; + $pingback_link_offset = ($quote=='"') ? $pingback_link_offset_dquote : $pingback_link_offset_squote; + $pingback_href_pos = @strpos($contents, 'href=', $pingback_link_offset); + $pingback_href_start = $pingback_href_pos+6; + $pingback_href_end = @strpos($contents, $quote, $pingback_href_start); + $pingback_server_url_len = $pingback_href_end - $pingback_href_start; + $pingback_server_url = substr($contents, $pingback_href_start, $pingback_server_url_len); + + // We may find rel="pingback" but an incomplete pingback URL + if ( $pingback_server_url_len > 0 ) { // We got it! + return $pingback_server_url; + } + } + + return false; +} + +/** + * Perform all pingbacks, enclosures, trackbacks, and send to pingback services. + * + * @since 2.1.0 + * @uses $wpdb + */ +function do_all_pings() { + global $wpdb; + + // Do pingbacks + while ($ping = $wpdb->get_row("SELECT * FROM {$wpdb->posts}, {$wpdb->postmeta} WHERE {$wpdb->posts}.ID = {$wpdb->postmeta}.post_id AND {$wpdb->postmeta}.meta_key = '_pingme' LIMIT 1")) { + $mid = $wpdb->get_var( "SELECT meta_id FROM {$wpdb->postmeta} WHERE post_id = {$ping->ID} AND meta_key = '_pingme' LIMIT 1"); + do_action( 'delete_postmeta', $mid ); + $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->postmeta} WHERE meta_id = %d", $mid ) ); + do_action( 'deleted_postmeta', $mid ); + pingback($ping->post_content, $ping->ID); + } + + // Do Enclosures + while ($enclosure = $wpdb->get_row("SELECT * FROM {$wpdb->posts}, {$wpdb->postmeta} WHERE {$wpdb->posts}.ID = {$wpdb->postmeta}.post_id AND {$wpdb->postmeta}.meta_key = '_encloseme' LIMIT 1")) { + $mid = $wpdb->get_var( $wpdb->prepare("SELECT meta_id FROM {$wpdb->postmeta} WHERE post_id = %d AND meta_key = '_encloseme'", $enclosure->ID) ); + do_action( 'delete_postmeta', $mid ); + $wpdb->query( $wpdb->prepare("DELETE FROM {$wpdb->postmeta} WHERE meta_id = %d", $mid) ); + do_action( 'deleted_postmeta', $mid ); + do_enclose($enclosure->post_content, $enclosure->ID); + } + + // Do Trackbacks + $trackbacks = $wpdb->get_col("SELECT ID FROM $wpdb->posts WHERE to_ping <> '' AND post_status = 'publish'"); + if ( is_array($trackbacks) ) + foreach ( $trackbacks as $trackback ) + do_trackbacks($trackback); + + //Do Update Services/Generic Pings + generic_ping(); +} + +/** + * Perform trackbacks. + * + * @since 1.5.0 + * @uses $wpdb + * + * @param int $post_id Post ID to do trackbacks on. + */ +function do_trackbacks($post_id) { + global $wpdb; + + $post = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->posts WHERE ID = %d", $post_id) ); + $to_ping = get_to_ping($post_id); + $pinged = get_pung($post_id); + if ( empty($to_ping) ) { + $wpdb->update($wpdb->posts, array('to_ping' => ''), array('ID' => $post_id) ); + return; + } + + if ( empty($post->post_excerpt) ) + $excerpt = apply_filters('the_content', $post->post_content); + else + $excerpt = apply_filters('the_excerpt', $post->post_excerpt); + $excerpt = str_replace(']]>', ']]>', $excerpt); + $excerpt = wp_html_excerpt($excerpt, 252) . '...'; + + $post_title = apply_filters('the_title', $post->post_title); + $post_title = strip_tags($post_title); + + if ( $to_ping ) { + foreach ( (array) $to_ping as $tb_ping ) { + $tb_ping = trim($tb_ping); + if ( !in_array($tb_ping, $pinged) ) { + trackback($tb_ping, $post_title, $excerpt, $post_id); + $pinged[] = $tb_ping; + } else { + $wpdb->query( $wpdb->prepare("UPDATE $wpdb->posts SET to_ping = TRIM(REPLACE(to_ping, %s, '')) WHERE ID = %d", $tb_ping, $post_id) ); + } + } + } +} + +/** + * Sends pings to all of the ping site services. + * + * @since 1.2.0 + * + * @param int $post_id Post ID. Not actually used. + * @return int Same as Post ID from parameter + */ +function generic_ping($post_id = 0) { + $services = get_option('ping_sites'); + + $services = explode("\n", $services); + foreach ( (array) $services as $service ) { + $service = trim($service); + if ( '' != $service ) + weblog_ping($service); + } + + return $post_id; +} + +/** + * Pings back the links found in a post. + * + * @since 0.71 + * @uses $wp_version + * @uses IXR_Client + * + * @param string $content Post content to check for links. + * @param int $post_ID Post ID. + */ +function pingback($content, $post_ID) { + global $wp_version; + include_once(ABSPATH . WPINC . '/class-IXR.php'); + include_once(ABSPATH . WPINC . '/class-wp-http-ixr-client.php'); + + // original code by Mort (http://mort.mine.nu:8080) + $post_links = array(); + + $pung = get_pung($post_ID); + + // Variables + $ltrs = '\w'; + $gunk = '/#~:.?+=&%@!\-'; + $punc = '.:?\-'; + $any = $ltrs . $gunk . $punc; + + // Step 1 + // Parsing the post, external links (if any) are stored in the $post_links array + // This regexp comes straight from phpfreaks.com + // http://www.phpfreaks.com/quickcode/Extract_All_URLs_on_a_Page/15.php + preg_match_all("{\b http : [$any] +? (?= [$punc] * [^$any] | $)}x", $content, $post_links_temp); + + // Step 2. + // Walking thru the links array + // first we get rid of links pointing to sites, not to specific files + // Example: + // http://dummy-weblog.org + // http://dummy-weblog.org/ + // http://dummy-weblog.org/post.php + // We don't wanna ping first and second types, even if they have a valid + + foreach ( (array) $post_links_temp[0] as $link_test ) : + if ( !in_array($link_test, $pung) && (url_to_postid($link_test) != $post_ID) // If we haven't pung it already and it isn't a link to itself + && !is_local_attachment($link_test) ) : // Also, let's never ping local attachments. + if ( $test = @parse_url($link_test) ) { + if ( isset($test['query']) ) + $post_links[] = $link_test; + elseif ( isset( $test['path'] ) && ( $test['path'] != '/' ) && ( $test['path'] != '' ) ) + $post_links[] = $link_test; + } + endif; + endforeach; + + do_action_ref_array('pre_ping', array(&$post_links, &$pung)); + + foreach ( (array) $post_links as $pagelinkedto ) { + $pingback_server_url = discover_pingback_server_uri( $pagelinkedto ); + + if ( $pingback_server_url ) { + @ set_time_limit( 60 ); + // Now, the RPC call + $pagelinkedfrom = get_permalink($post_ID); + + // using a timeout of 3 seconds should be enough to cover slow servers + $client = new WP_HTTP_IXR_Client($pingback_server_url); + $client->timeout = 3; + $client->useragent = apply_filters( 'pingback_useragent', $client->useragent . ' -- WordPress/' . $wp_version, $client->useragent, $pingback_server_url, $pagelinkedto, $pagelinkedfrom); + // when set to true, this outputs debug messages by itself + $client->debug = false; + + if ( $client->query('pingback.ping', $pagelinkedfrom, $pagelinkedto) || ( isset($client->error->code) && 48 == $client->error->code ) ) // Already registered + add_ping( $post_ID, $pagelinkedto ); + } + } +} + +/** + * Check whether blog is public before returning sites. + * + * @since 2.1.0 + * + * @param mixed $sites Will return if blog is public, will not return if not public. + * @return mixed Empty string if blog is not public, returns $sites, if site is public. + */ +function privacy_ping_filter($sites) { + if ( '0' != get_option('blog_public') ) + return $sites; + else + return ''; +} + +/** + * Send a Trackback. + * + * Updates database when sending trackback to prevent duplicates. + * + * @since 0.71 + * @uses $wpdb + * + * @param string $trackback_url URL to send trackbacks. + * @param string $title Title of post. + * @param string $excerpt Excerpt of post. + * @param int $ID Post ID. + * @return mixed Database query from update. + */ +function trackback($trackback_url, $title, $excerpt, $ID) { + global $wpdb; + + if ( empty($trackback_url) ) + return; + + $options = array(); + $options['timeout'] = 4; + $options['body'] = array( + 'title' => $title, + 'url' => get_permalink($ID), + 'blog_name' => get_option('blogname'), + 'excerpt' => $excerpt + ); + + $response = wp_remote_post($trackback_url, $options); + + if ( is_wp_error( $response ) ) + return; + + $wpdb->query( $wpdb->prepare("UPDATE $wpdb->posts SET pinged = CONCAT(pinged, '\n', %s) WHERE ID = %d", $trackback_url, $ID) ); + return $wpdb->query( $wpdb->prepare("UPDATE $wpdb->posts SET to_ping = TRIM(REPLACE(to_ping, %s, '')) WHERE ID = %d", $trackback_url, $ID) ); +} + +/** + * Send a pingback. + * + * @since 1.2.0 + * @uses $wp_version + * @uses IXR_Client + * + * @param string $server Host of blog to connect to. + * @param string $path Path to send the ping. + */ +function weblog_ping($server = '', $path = '') { + global $wp_version; + include_once(ABSPATH . WPINC . '/class-IXR.php'); + include_once(ABSPATH . WPINC . '/class-wp-http-ixr-client.php'); + + // using a timeout of 3 seconds should be enough to cover slow servers + $client = new WP_HTTP_IXR_Client($server, ((!strlen(trim($path)) || ('/' == $path)) ? false : $path)); + $client->timeout = 3; + $client->useragent .= ' -- WordPress/'.$wp_version; + + // when set to true, this outputs debug messages by itself + $client->debug = false; + $home = trailingslashit( home_url() ); + if ( !$client->query('weblogUpdates.extendedPing', get_option('blogname'), $home, get_bloginfo('rss2_url') ) ) // then try a normal ping + $client->query('weblogUpdates.ping', get_option('blogname'), $home); +} + +// +// Cache +// + +/** + * Removes comment ID from the comment cache. + * + * @since 2.3.0 + * @package WordPress + * @subpackage Cache + * + * @param int|array $ids Comment ID or array of comment IDs to remove from cache + */ +function clean_comment_cache($ids) { + foreach ( (array) $ids as $id ) + wp_cache_delete($id, 'comment'); + + wp_cache_set('last_changed', time(), 'comment'); +} + +/** + * Updates the comment cache of given comments. + * + * Will add the comments in $comments to the cache. If comment ID already exists + * in the comment cache then it will not be updated. The comment is added to the + * cache using the comment group with the key using the ID of the comments. + * + * @since 2.3.0 + * @package WordPress + * @subpackage Cache + * + * @param array $comments Array of comment row objects + */ +function update_comment_cache($comments) { + foreach ( (array) $comments as $comment ) + wp_cache_add($comment->comment_ID, $comment, 'comment'); +} + +// +// Internal +// + +/** + * Close comments on old posts on the fly, without any extra DB queries. Hooked to the_posts. + * + * @access private + * @since 2.7.0 + * + * @param object $posts Post data object. + * @return object + */ +function _close_comments_for_old_posts( $posts ) { + if ( empty($posts) || !is_singular() || !get_option('close_comments_for_old_posts') ) + return $posts; + + $post_types = apply_filters( 'close_comments_for_post_types', array( 'post' ) ); + if ( ! in_array( $posts[0]->post_type, $post_types ) ) + return $posts; + + $days_old = (int) get_option('close_comments_days_old'); + if ( !$days_old ) + return $posts; + + if ( time() - strtotime( $posts[0]->post_date_gmt ) > ( $days_old * 24 * 60 * 60 ) ) { + $posts[0]->comment_status = 'closed'; + $posts[0]->ping_status = 'closed'; + } + + return $posts; +} + +/** + * Close comments on an old post. Hooked to comments_open and pings_open. + * + * @access private + * @since 2.7.0 + * + * @param bool $open Comments open or closed + * @param int $post_id Post ID + * @return bool $open + */ +function _close_comments_for_old_post( $open, $post_id ) { + if ( ! $open ) + return $open; + + if ( !get_option('close_comments_for_old_posts') ) + return $open; + + $days_old = (int) get_option('close_comments_days_old'); + if ( !$days_old ) + return $open; + + $post = get_post($post_id); + + $post_types = apply_filters( 'close_comments_for_post_types', array( 'post' ) ); + if ( ! in_array( $post->post_type, $post_types ) ) + return $open; + + if ( time() - strtotime( $post->post_date_gmt ) > ( $days_old * 24 * 60 * 60 ) ) + return false; + + return $open; +} + +?> diff --git a/src/wp-includes/compat.php b/src/wp-includes/compat.php new file mode 100644 index 0000000..cb2a559 --- /dev/null +++ b/src/wp-includes/compat.php @@ -0,0 +1,96 @@ + 'H32', 'sha1' => 'H40'); + + if ( !isset($packs[$algo]) ) + return false; + + $pack = $packs[$algo]; + + if (strlen($key) > 64) + $key = pack($pack, $algo($key)); + + $key = str_pad($key, 64, chr(0)); + + $ipad = (substr($key, 0, 64) ^ str_repeat(chr(0x36), 64)); + $opad = (substr($key, 0, 64) ^ str_repeat(chr(0x5C), 64)); + + $hmac = $algo($opad . pack($pack, $algo($ipad . $data))); + + if ( $raw_output ) + return pack( $pack, $hmac ); + return $hmac; +} + +if ( !function_exists('json_encode') ) { + function json_encode( $string ) { + global $wp_json; + + if ( !is_a($wp_json, 'Services_JSON') ) { + require_once( ABSPATH . WPINC . '/class-json.php' ); + $wp_json = new Services_JSON(); + } + + return $wp_json->encodeUnsafe( $string ); + } +} + +if ( !function_exists('json_decode') ) { + function json_decode( $string, $assoc_array = false ) { + global $wp_json; + + if ( !is_a($wp_json, 'Services_JSON') ) { + require_once( ABSPATH . WPINC . '/class-json.php' ); + $wp_json = new Services_JSON(); + } + + $res = $wp_json->decode( $string ); + if ( $assoc_array ) + $res = _json_decode_object_helper( $res ); + return $res; + } + function _json_decode_object_helper($data) { + if ( is_object($data) ) + $data = get_object_vars($data); + return is_array($data) ? array_map(__FUNCTION__, $data) : $data; + } +} diff --git a/src/wp-includes/cron.php b/src/wp-includes/cron.php new file mode 100644 index 0000000..b7d04f2 --- /dev/null +++ b/src/wp-includes/cron.php @@ -0,0 +1,407 @@ + $hook, 'timestamp' => $timestamp, 'schedule' => false, 'args' => $args ); + $event = apply_filters('schedule_event', $event); + + // A plugin disallowed this event + if ( ! $event ) + return false; + + $key = md5(serialize($event->args)); + + $crons[$event->timestamp][$event->hook][$key] = array( 'schedule' => $event->schedule, 'args' => $event->args ); + uksort( $crons, "strnatcasecmp" ); + _set_cron_array( $crons ); +} + +/** + * Schedule a periodic event. + * + * Schedules a hook which will be executed by the WordPress actions core on a + * specific interval, specified by you. The action will trigger when someone + * visits your WordPress site, if the scheduled time has passed. + * + * Valid values for the recurrence are hourly, daily and twicedaily. These can + * be extended using the cron_schedules filter in wp_get_schedules(). + * + * Use wp_next_scheduled() to prevent duplicates + * + * @since 2.1.0 + * + * @param int $timestamp Timestamp for when to run the event. + * @param string $recurrence How often the event should recur. + * @param string $hook Action hook to execute when cron is run. + * @param array $args Optional. Arguments to pass to the hook's callback function. + * @return bool|null False on failure, null when complete with scheduling event. + */ +function wp_schedule_event( $timestamp, $recurrence, $hook, $args = array()) { + $crons = _get_cron_array(); + $schedules = wp_get_schedules(); + + if ( !isset( $schedules[$recurrence] ) ) + return false; + + $event = (object) array( 'hook' => $hook, 'timestamp' => $timestamp, 'schedule' => $recurrence, 'args' => $args, 'interval' => $schedules[$recurrence]['interval'] ); + $event = apply_filters('schedule_event', $event); + + // A plugin disallowed this event + if ( ! $event ) + return false; + + $key = md5(serialize($event->args)); + + $crons[$event->timestamp][$event->hook][$key] = array( 'schedule' => $event->schedule, 'args' => $event->args, 'interval' => $event->interval ); + uksort( $crons, "strnatcasecmp" ); + _set_cron_array( $crons ); +} + +/** + * Reschedule a recurring event. + * + * @since 2.1.0 + * + * @param int $timestamp Timestamp for when to run the event. + * @param string $recurrence How often the event should recur. + * @param string $hook Action hook to execute when cron is run. + * @param array $args Optional. Arguments to pass to the hook's callback function. + * @return bool|null False on failure. Null when event is rescheduled. + */ +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; + + $now = time(); + + if ( $timestamp >= $now ) + $timestamp = $now + $interval; + else + $timestamp = $now + ($interval - (($now - $timestamp) % $interval)); + + wp_schedule_event( $timestamp, $recurrence, $hook, $args ); +} + +/** + * Unschedule a previously scheduled cron job. + * + * The $timestamp and $hook parameters are required, so that the event can be + * identified. + * + * @since 2.1.0 + * + * @param int $timestamp Timestamp for when to run the event. + * @param string $hook Action hook, the execution of which will be unscheduled. + * @param array $args Arguments to pass to the hook's callback function. + * Although not passed to a callback function, these arguments are used + * to uniquely identify the scheduled event, so they should be the same + * as those used when originally scheduling the event. + */ +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 ); +} + +/** + * Unschedule all cron jobs attached to a specific hook. + * + * @since 2.1.0 + * + * @param string $hook Action hook, the execution of which will be unscheduled. + * @param array $args Optional. Arguments that were to be pass to the hook's callback function. + */ +function wp_clear_scheduled_hook( $hook, $args = array() ) { + // Backward compatibility + // Previously this function took the arguments as discrete vars rather than an array like the rest of the API + if ( !is_array($args) ) { + _deprecated_argument( __FUNCTION__, '3.0', __('This argument has changed to an array to match the behavior of the other cron functions.') ); + $args = array_slice( func_get_args(), 1 ); + } + + while ( $timestamp = wp_next_scheduled( $hook, $args ) ) + wp_unschedule_event( $timestamp, $hook, $args ); +} + +/** + * Retrieve the next timestamp for a cron event. + * + * @since 2.1.0 + * + * @param string $hook Action hook to execute when cron is run. + * @param array $args Optional. Arguments to pass to the hook's callback function. + * @return bool|int The UNIX timestamp of the next time the scheduled event will occur. + */ +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; +} + +/** + * Send request to run cron through HTTP request that doesn't halt page loading. + * + * @since 2.1.0 + * + * @return null Cron could not be spawned, because it is not needed to run. + */ +function spawn_cron( $local_time = 0 ) { + + if ( !$local_time ) + $local_time = time(); + + if ( defined('DOING_CRON') || isset($_GET['doing_wp_cron']) ) + return; + + /* + * multiple processes on multiple web servers can run this code concurrently + * try to make this as atomic as possible by setting doing_cron switch + */ + $flag = get_transient('doing_cron'); + + if ( $flag > $local_time + 10*60 ) + $flag = 0; + + // don't run if another process is currently running it or more than once every 60 sec. + if ( $flag + 60 > $local_time ) + return; + + //sanity check + $crons = _get_cron_array(); + if ( !is_array($crons) ) + return; + + $keys = array_keys( $crons ); + if ( isset($keys[0]) && $keys[0] > $local_time ) + return; + + if ( defined('ALTERNATE_WP_CRON') && ALTERNATE_WP_CRON ) { + if ( !empty($_POST) || defined('DOING_AJAX') ) + return; + + set_transient( 'doing_cron', $local_time ); + + ob_start(); + wp_redirect( add_query_arg('doing_wp_cron', '', stripslashes($_SERVER['REQUEST_URI'])) ); + echo ' '; + + // flush any buffers and send the headers + while ( @ob_end_flush() ); + flush(); + + WP_DEBUG ? include_once( ABSPATH . 'wp-cron.php' ) : @include_once( ABSPATH . 'wp-cron.php' ); + return; + } + + set_transient( 'doing_cron', $local_time ); + + $cron_url = get_option( 'siteurl' ) . '/wp-cron.php?doing_wp_cron'; + wp_remote_post( $cron_url, array('timeout' => 0.01, 'blocking' => false, 'sslverify' => apply_filters('https_local_ssl_verify', true)) ); +} + +/** + * Run scheduled callbacks or spawn cron for all scheduled events. + * + * @since 2.1.0 + * + * @return null When doesn't need to run Cron. + */ +function wp_cron() { + + // Prevent infinite loops caused by lack of wp-cron.php + if ( strpos($_SERVER['REQUEST_URI'], '/wp-cron.php') !== false || ( defined('DISABLE_WP_CRON') && DISABLE_WP_CRON ) ) + return; + + if ( false === $crons = _get_cron_array() ) + return; + + $local_time = time(); + $keys = array_keys( $crons ); + if ( isset($keys[0]) && $keys[0] > $local_time ) + return; + + $schedules = wp_get_schedules(); + foreach ( $crons as $timestamp => $cronhooks ) { + if ( $timestamp > $local_time ) break; + foreach ( (array) $cronhooks as $hook => $args ) { + if ( isset($schedules[$hook]['callback']) && !call_user_func( $schedules[$hook]['callback'] ) ) + continue; + spawn_cron( $local_time ); + break 2; + } + } +} + +/** + * Retrieve supported and filtered Cron recurrences. + * + * The supported recurrences are 'hourly' and 'daily'. A plugin may add more by + * hooking into the 'cron_schedules' filter. The filter accepts an array of + * arrays. The outer array has a key that is the name of the schedule or for + * example 'weekly'. The value is an array with two keys, one is 'interval' and + * the other is 'display'. + * + * The 'interval' is a number in seconds of when the cron job should run. So for + * 'hourly', the time is 3600 or 60*60. For weekly, the value would be + * 60*60*24*7 or 604800. The value of 'interval' would then be 604800. + * + * The 'display' is the description. For the 'weekly' key, the 'display' would + * be __('Once Weekly'). + * + * For your plugin, you will be passed an array. you can easily add your + * schedule by doing the following. + * + * // filter parameter variable name is 'array' + * $array['weekly'] = array( + * 'interval' => 604800, + * 'display' => __('Once Weekly') + * ); + * + * + * @since 2.1.0 + * + * @return array + */ +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 ); +} + +/** + * Retrieve Cron schedule for hook with arguments. + * + * @since 2.1.0 + * + * @param string $hook Action hook to execute when cron is run. + * @param array $args Optional. Arguments to pass to the hook's callback function. + * @return string|bool False, if no schedule. Schedule on success. + */ +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 +// + +/** + * Retrieve cron info array option. + * + * @since 2.1.0 + * @access private + * + * @return array CRON info array. + */ +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; +} + +/** + * Updates the CRON option with the new CRON array. + * + * @since 2.1.0 + * @access private + * + * @param array $cron Cron info array from {@link _get_cron_array()}. + */ +function _set_cron_array($cron) { + $cron['version'] = 2; + update_option( 'cron', $cron ); +} + +/** + * Upgrade a Cron info array. + * + * This function upgrades the Cron info array to version 2. + * + * @since 2.1.0 + * @access private + * + * @param array $cron Cron info array from {@link _get_cron_array()}. + * @return array An upgraded Cron info array. + */ +function _upgrade_cron_array($cron) { + if ( isset($cron['version']) && 2 == $cron['version']) + return $cron; + + $new_cron = array(); + + foreach ( (array) $cron as $timestamp => $hooks) { + foreach ( (array) $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; +} diff --git a/src/wp-includes/css/admin-bar-rtl.css b/src/wp-includes/css/admin-bar-rtl.css new file mode 100644 index 0000000..59ad56a --- /dev/null +++ b/src/wp-includes/css/admin-bar-rtl.css @@ -0,0 +1 @@ +#wpadminbar{direction:rtl;font-family:Tahoma,Arial,Helvetica,sans-serif;right:0;left:auto;}#wpadminbar *{font-family:Tahoma,Arial,Helvetica,sans-serif;}#wpadminbar .quicklinks ul{text-align:right;}#wpadminbar .quicklinks ul li{float:right;}#wpadminbar .quicklinks>ul>li>a{border-left:1px solid #686868;border-right:1px solid #808080;}#wpadminbar .quicklinks>ul>li:last-child>a{border-left:none;border-right:1px solid #808080;}#wpadminbar .quicklinks>ul>li:hover>a{border-right-color:#707070;border-left-color:#686868;}#wpadminbar .quicklinks li#wp-admin-bar-my-account-with-avatar a img{margin:-2px -5px 0 23px;}#wpadminbar .quicklinks li#wp-admin-bar-my-account-with-avatar ul{left:auto;right:30px;}#wpadminbar .quicklinks li#wp-admin-bar-my-account-with-avatar ul ul{right:0;left:auto;}#wpadminbar .quicklinks .menupop li:hover>ul,#wpadminbar .quicklinks .menupop li.hover>ul{margin-right:100%;margin-left:0;}#wpadminbar .quicklinks .menupop a>span{background:url(../images/admin-bar-sprite-rtl.png?d=11122010) left -58px no-repeat;padding-right:0;padding-left:.8em;}#wpadminbar .quicklinks .menupop ul li a>span{background:url(../images/admin-bar-sprite-rtl.png?d=11122010) left -29px no-repeat;padding-right:0;padding-left:1.5em;}#wpadminbar .quicklinks a{font-family:Tahoma,Arial,Helvetica,sans-serif;}#wpadminbar .quicklinks .menupop li a img.blavatar{margin-right:0;margin-left:8px;}#wpadminbar .quicklinks li#wp-admin-bar-my-account-with-avatar>a{background:url(../images/admin-bar-sprite-rtl.png?d=11122010) top right no-repeat;}#wpadminbar .quicklinks li#wp-admin-bar-my-account>a,#wpadminbar .quicklinks li#wp-admin-bar-my-account-with-avatar>a{border-right:none;border-left:1px solid #686868;}#wpadminbar #adminbarsearch{float:left;}#wpadminbar #adminbarsearch .adminbar-input{float:right;font-family:Tahoma,Arial,Helvetica,sans-serif;margin-right:0;margin-left:3px;-moz-box-shadow:inset 2px -2px 1px #cdcdcd;-webkit-box-shadow:inset -2px 2px 1px #cdcdcd;box-shadow:inset 2px -2px 1px #cdcdcd;}#wpadminbar #adminbarsearch .adminbar-button{float:right;font-family:Tahoma,Arial,Helvetica,sans-serif;} \ No newline at end of file diff --git a/src/wp-includes/css/admin-bar-rtl.dev.css b/src/wp-includes/css/admin-bar-rtl.dev.css new file mode 100644 index 0000000..26138f5 --- /dev/null +++ b/src/wp-includes/css/admin-bar-rtl.dev.css @@ -0,0 +1,103 @@ +#wpadminbar { + direction: rtl; + font-family: Tahoma, Arial, Helvetica, sans-serif; + right: 0; + left: auto; +} + +#wpadminbar * { + font-family: Tahoma, Arial, Helvetica, sans-serif; +} + +#wpadminbar .quicklinks ul { + text-align: right; +} + +#wpadminbar .quicklinks ul li { + float: right; +} + +#wpadminbar .quicklinks > ul > li > a { + border-left: 1px solid #686868; + border-right: 1px solid #808080; +} + +#wpadminbar .quicklinks > ul > li:last-child > a { + border-left: none; + border-right: 1px solid #808080; +} + +#wpadminbar .quicklinks > ul > li:hover > a { + border-right-color: #707070; + border-left-color: #686868; +} + +#wpadminbar .quicklinks li#wp-admin-bar-my-account-with-avatar a img { + margin: -2px -5px 0 23px; +} + +#wpadminbar .quicklinks li#wp-admin-bar-my-account-with-avatar ul { + left: auto; + right: 30px; +} + +#wpadminbar .quicklinks li#wp-admin-bar-my-account-with-avatar ul ul { + right: 0; + left: auto; +} + +#wpadminbar .quicklinks .menupop li:hover > ul, +#wpadminbar .quicklinks .menupop li.hover > ul { + margin-right: 100%; + margin-left: 0; +} + +#wpadminbar .quicklinks .menupop a > span { + background: url(../images/admin-bar-sprite-rtl.png?d=11122010) left -58px no-repeat; + padding-right: 0; + padding-left: .8em; +} + +#wpadminbar .quicklinks .menupop ul li a > span { + background: url(../images/admin-bar-sprite-rtl.png?d=11122010) left -29px no-repeat; + padding-right: 0; + padding-left: 1.5em; +} + +#wpadminbar .quicklinks a { + font-family: Tahoma, Arial, Helvetica, sans-serif; +} + +#wpadminbar .quicklinks .menupop li a img.blavatar { + margin-right: 0; + margin-left: 8px; +} + +#wpadminbar .quicklinks li#wp-admin-bar-my-account-with-avatar > a { + background: url(../images/admin-bar-sprite-rtl.png?d=11122010) top right no-repeat; +} + +#wpadminbar .quicklinks li#wp-admin-bar-my-account > a, +#wpadminbar .quicklinks li#wp-admin-bar-my-account-with-avatar > a { + border-right: none; + border-left: 1px solid #686868; +} + +#wpadminbar #adminbarsearch { + float: left; +} + +#wpadminbar #adminbarsearch .adminbar-input { + float: right; + font-family: Tahoma, Arial, Helvetica, sans-serif; + margin-right: 0; + margin-left: 3px; + -moz-box-shadow: inset 2px -2px 1px #cdcdcd; + -webkit-box-shadow: inset -2px 2px 1px #cdcdcd; + box-shadow: inset 2px -2px 1px #cdcdcd; +} + +#wpadminbar #adminbarsearch .adminbar-button { + float: right; + font-family: Tahoma, Arial, Helvetica, sans-serif; +} diff --git a/src/wp-includes/css/admin-bar.css b/src/wp-includes/css/admin-bar.css new file mode 100644 index 0000000..d98ef3a --- /dev/null +++ b/src/wp-includes/css/admin-bar.css @@ -0,0 +1 @@ +#wpadminbar *{height:auto;width:auto;margin:0;padding:0;position:static;text-transform:none;letter-spacing:normal;line-height:1;font:normal 13px/28px Arial,Helvetica,sans-serif;color:#ddd;text-shadow:#555 0 -1px 0;}#wpadminbar :before,#wpadminbar :after{content:normal;}#wpadminbar a,#wpadminbar a:hover,#wpadminbar a img,#wpadminbar a img:hover{outline:none;border:none;text-decoration:none;background:none;}#wpadminbar{direction:ltr;background-color:#777;background-image:-moz-linear-gradient(bottom,#666,#7f7f7f);background-image:-webkit-gradient(linear,left bottom,left top,from(#666),to(#7f7f7f));color:#ddd;font:normal 12px/28px Arial,Helvetica,sans-serif;height:28px;position:fixed;top:0;left:0;width:100%;z-index:99999;min-width:960px;}#wpadminbar ul,#wpadminbar ul li{background:none;list-style:none;margin:0;padding:0;position:relative;z-index:99999;}#wpadminbar .quicklinks ul{text-align:left;}#wpadminbar .quicklinks ul li{float:left;}#wpadminbar .quicklinks>ul>li>a{border-right:1px solid #686868;border-left:1px solid #808080;}#wpadminbar .quicklinks>ul>li:last-child>a{border-right:none;}#wpadminbar .quicklinks>ul>li:hover>a{border-left-color:#707070;}#wpadminbar .quicklinks a,#wpadminbar .shortlink-input{height:28px;display:block;padding:0 .85em;margin:0;}#wpadminbar .quicklinks a>span{line-height:28px;}#wpadminbar .quicklinks .menupop ul,#wpadminbar .shortlink-input{-moz-box-shadow:0 4px 8px rgba(0,0,0,0.1);-webkit-box-shadow:0 4px 8px rgba(0,0,0,0.1);box-shadow:0 4px 8px rgba(0,0,0,0.1);background:#fff;background:rgba(255,255,255,0.97);display:none;position:absolute;border:1px solid #dfdfdf;border-top:none;float:none;}#wpadminbar .selected .shortlink-input{display:block;}#wpadminbar .quicklinks .menupop ul li{float:none;}#wpadminbar .quicklinks .menupop ul li a strong{font-weight:bold;}#wpadminbar .quicklinks .menupop ul li a,#wpadminbar .quicklinks .menupop ul li a span,#wpadminbar .quicklinks .menupop ul li a strong,#wpadminbar .shortlink-input{color:#555;text-shadow:none;white-space:nowrap;min-width:140px;}#wpadminbar .shortlink-input{width:200px;}#wpadminbar .quicklinks .menupop ul li:hover>a,#wpadminbar .quicklinks .menupop ul li:hover>a span,#wpadminbar .quicklinks .menupop ul li:hover>a strong{color:#fff;text-shadow:#666 0 -1px 0;}#wpadminbar .quicklinks li:hover>ul,#wpadminbar .quicklinks li.hover>ul{display:block;}#wpadminbar .quicklinks .menupop li:hover>ul,#wpadminbar .quicklinks .menupop li.hover>ul{margin-left:100%;margin-top:-28px;}#wpadminbar .quicklinks li:hover,#wpadminbar .quicklinks .selected{background:#555;background:-moz-linear-gradient(bottom,#555,#3e3e3e);background:-webkit-gradient(linear,left bottom,left top,from(#555),to(#3e3e3e));}#wpadminbar .quicklinks .menupop li:hover{background:#888;background:-moz-linear-gradient(bottom,#888,#9d9d9d);background:-webkit-gradient(linear,left bottom,left top,from(#888),to(#9d9d9d));}#wpadminbar .quicklinks .menupop a>span{display:inline;background:url(../images/admin-bar-sprite.png?d=11122010) right -58px no-repeat;padding-right:.8em;}#wpadminbar .quicklinks .menupop ul li a>span{display:block;background:url(../images/admin-bar-sprite.png?d=11122010) right -29px no-repeat;padding-right:1.5em;}#wpadminbar .quicklinks a span#ab-awaiting-mod,#wpadminbar .quicklinks a span#ab-updates{background:#eee;color:#333;text-shadow:none;display:inline;padding:2px 5px;font-size:10px;font-weight:bold;-moz-border-radius:10px;-khtml-border-radius:10px;-webkit-border-radius:10px;border-radius:10px;}#wpadminbar .quicklinks a:hover span#ab-awaiting-mod,#wpadminbar .quicklinks a:hover span#ab-updates{background:#fff;color:#000;}#wpadminbar .quicklinks li#wp-admin-bar-my-account>a{border-left:none;}#wpadminbar .quicklinks li#wp-admin-bar-my-account-with-avatar>a{border-left:none;background:url(../images/admin-bar-sprite.png?d=11122010) top left no-repeat;}#wpadminbar .quicklinks li#wp-admin-bar-my-account-with-avatar>a img{width:16px;height:16px;display:inline;border:1px solid #999;vertical-align:middle;margin:-2px 23px 0 -5px;padding:0;background:#eee;float:none;}#wpadminbar .quicklinks li#wp-admin-bar-my-account-with-avatar ul{left:30px;}#wpadminbar .quicklinks li#wp-admin-bar-my-account-with-avatar ul ul{left:0;}#wpadminbar .quicklinks .menupop li a img.blavatar{vertical-align:middle;margin:0 8px 0 0;padding:0;}#wpadminbar #adminbarsearch{float:right;height:18px;padding:3px;margin:0;}#wpadminbar #adminbarsearch .adminbar-input{width:140px;height:auto;float:left;font:12px Arial,Helvetica,sans-serif;color:#555;text-shadow:0 1px 0 #fff;border:1px solid #626262;padding:2px 3px;margin:0 3px 0 0;background:#ddd;-moz-box-shadow:inset 2px 2px 1px #cdcdcd;-webkit-box-shadow:inset 2px 2px 1px #cdcdcd;box-shadow:inset 2px 2px 1px #cdcdcd;-webkit-border-radius:0;-khtml-border-radius:0;-moz-border-radius:0;border-radius:0;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;-ms-box-sizing:border-box;box-sizing:border-box;outline:none;}#wpadminbar #adminbarsearch .adminbar-button{font:bold 12px Arial,Helvetica,sans-serif;color:#444;text-shadow:0 1px 0 #eee;cursor:pointer;float:left;background:#aaa;background:-moz-linear-gradient(bottom,#aaa,#cecece);background:-webkit-gradient(linear,left bottom,left top,from(#aaa),to(#cecece));-webkit-border-radius:10px;-khtml-border-radius:10px;-moz-border-radius:10px;border-radius:10px;border:1px solid #626262;padding:2px 13px;margin:0;width:auto;height:auto;}#wpadminbar #adminbarsearch .adminbar-button:active{background:#a0a0a0;background:-moz-linear-gradient(bottom,#a0a0a0,#c1c1c1);background:-webkit-gradient(linear,left bottom,left top,from(#a0a0a0),to(#c1c1c1));-moz-box-shadow:inset 1px 1px 1px #9b9b9b;-webkit-box-shadow:inset 1px 1px 1px #9b9b9b;box-shadow:inset 1px 1px 1px #9b9b9b;}#wpadminbar #adminbarsearch .adminbar-button:hover{color:#000;}#wpadminbar #adminbarsearch .adminbar-button::-moz-focus-inner{border:none;}* html #wpadminbar{overflow:hidden;position:absolute;}* html #wpadminbar .quicklinks ul li a{float:left;}* html #wpadminbar .menupop a span{background-image:none;} \ No newline at end of file diff --git a/src/wp-includes/css/admin-bar.dev.css b/src/wp-includes/css/admin-bar.dev.css new file mode 100644 index 0000000..e94d80e --- /dev/null +++ b/src/wp-includes/css/admin-bar.dev.css @@ -0,0 +1,312 @@ +#wpadminbar * { + height: auto; + width: auto; + margin: 0; + padding: 0; + position: static; + text-transform: none; + letter-spacing: normal; + line-height: 1; + font: normal 13px/28px Arial, Helvetica, sans-serif; + color: #ddd; + text-shadow: #555 0px -1px 0px; +} + +#wpadminbar :before, +#wpadminbar :after { + content: normal; +} + +#wpadminbar a, +#wpadminbar a:hover, +#wpadminbar a img, +#wpadminbar a img:hover { + outline: none; + border: none; + text-decoration: none; + background: none; +} + +#wpadminbar { + direction: ltr; + background-color: #777; + background-image: -moz-linear-gradient(bottom, #666, #7f7f7f); + background-image: -webkit-gradient(linear, left bottom, left top, from(#666), to(#7f7f7f)); + color: #ddd; + font: normal 12px/28px Arial, Helvetica, sans-serif; + height: 28px; + position: fixed; + top: 0; + left: 0; + width: 100%; + z-index: 99999; + min-width: 960px; +} + +#wpadminbar ul, +#wpadminbar ul li { + background: none; + list-style: none; + margin: 0; + padding: 0; + position: relative; + z-index: 99999; +} + +#wpadminbar .quicklinks ul { + text-align: left; +} + +#wpadminbar .quicklinks ul li { + float: left; +} + +#wpadminbar .quicklinks > ul > li > a { + border-right: 1px solid #686868; + border-left: 1px solid #808080; +} + +#wpadminbar .quicklinks > ul > li:last-child > a { + border-right: none; +} + +#wpadminbar .quicklinks > ul > li:hover > a { + border-left-color: #707070; +} + +#wpadminbar .quicklinks a, +#wpadminbar .shortlink-input { + height: 28px; + display: block; + padding: 0 0.85em; + margin: 0; +} + +#wpadminbar .quicklinks a > span { + line-height: 28px; +} + +#wpadminbar .quicklinks .menupop ul, +#wpadminbar .shortlink-input { + -moz-box-shadow: 0 4px 8px rgba(0,0,0,0.1); + -webkit-box-shadow: 0 4px 8px rgba(0,0,0,0.1); + box-shadow: 0 4px 8px rgba(0,0,0,0.1); + background: #fff; + background: rgba(255,255,255,0.97); + display: none; + position: absolute; + border: 1px solid #dfdfdf; + border-top: none; + float: none; +} + +#wpadminbar .selected .shortlink-input { + display: block; +} + +#wpadminbar .quicklinks .menupop ul li { + float: none; +} + +#wpadminbar .quicklinks .menupop ul li a strong { + font-weight: bold; +} + +#wpadminbar .quicklinks .menupop ul li a, +#wpadminbar .quicklinks .menupop ul li a span, +#wpadminbar .quicklinks .menupop ul li a strong, +#wpadminbar .shortlink-input { + color: #555; + text-shadow: none; + white-space: nowrap; + min-width: 140px; +} + +#wpadminbar .shortlink-input { + width: 200px; +} + +#wpadminbar .quicklinks .menupop ul li:hover > a, +#wpadminbar .quicklinks .menupop ul li:hover > a span, +#wpadminbar .quicklinks .menupop ul li:hover > a strong { + color: #fff; + text-shadow: #666 0px -1px 0px; +} + +#wpadminbar .quicklinks li:hover > ul, +#wpadminbar .quicklinks li.hover > ul { + display: block; +} + +#wpadminbar .quicklinks .menupop li:hover > ul, +#wpadminbar .quicklinks .menupop li.hover > ul { + margin-left: 100%; + margin-top: -28px; +} + +#wpadminbar .quicklinks li:hover, +#wpadminbar .quicklinks .selected { + background: #555; + background: -moz-linear-gradient(bottom, #555, #3e3e3e); + background: -webkit-gradient(linear, left bottom, left top, from(#555), to(#3e3e3e)); +} + +#wpadminbar .quicklinks .menupop li:hover { + background: #888; + background: -moz-linear-gradient(bottom, #888, #9d9d9d); + background: -webkit-gradient(linear, left bottom, left top, from(#888), to(#9d9d9d)); +} + +#wpadminbar .quicklinks .menupop a > span { + display: inline; + background: url(../images/admin-bar-sprite.png?d=11122010) right -58px no-repeat; + padding-right: .8em; +} + +#wpadminbar .quicklinks .menupop ul li a > span { + display: block; + background: url(../images/admin-bar-sprite.png?d=11122010) right -29px no-repeat; + padding-right: 1.5em; +} + +#wpadminbar .quicklinks a span#ab-awaiting-mod, +#wpadminbar .quicklinks a span#ab-updates { + background: #eee; + color: #333; + text-shadow: none; + display: inline; + padding: 2px 5px; + font-size: 10px; + font-weight: bold; + -moz-border-radius: 10px; + -khtml-border-radius: 10px; + -webkit-border-radius: 10px; + border-radius: 10px; +} + +#wpadminbar .quicklinks a:hover span#ab-awaiting-mod, +#wpadminbar .quicklinks a:hover span#ab-updates { + background: #fff; + color: #000; +} + +#wpadminbar .quicklinks li#wp-admin-bar-my-account > a { + border-left: none; +} + +#wpadminbar .quicklinks li#wp-admin-bar-my-account-with-avatar > a { + border-left: none; + background: url(../images/admin-bar-sprite.png?d=11122010) top left no-repeat; +} + +#wpadminbar .quicklinks li#wp-admin-bar-my-account-with-avatar > a img { + width: 16px; + height: 16px; + display: inline; + border: 1px solid #999; + vertical-align: middle; + margin: -2px 23px 0 -5px; + padding: 0; + background: #eee; + float: none; +} + +#wpadminbar .quicklinks li#wp-admin-bar-my-account-with-avatar ul { + left: 30px; +} + +#wpadminbar .quicklinks li#wp-admin-bar-my-account-with-avatar ul ul { + left: 0; +} + +#wpadminbar .quicklinks .menupop li a img.blavatar { + vertical-align: middle; + margin: 0 8px 0 0; + padding: 0; +} + +#wpadminbar #adminbarsearch { + float: right; + height: 18px; + padding: 3px; + margin: 0; +} + +#wpadminbar #adminbarsearch .adminbar-input { + width: 140px; + height: auto; + float: left; + font: 12px Arial, Helvetica, sans-serif; + color: #555; + text-shadow: 0 1px 0 #fff; + border: 1px solid #626262; + padding: 2px 3px; + margin: 0 3px 0 0; + background: #ddd; + -moz-box-shadow: inset 2px 2px 1px #cdcdcd; + -webkit-box-shadow: inset 2px 2px 1px #cdcdcd; + box-shadow: inset 2px 2px 1px #cdcdcd; + -webkit-border-radius: 0; + -khtml-border-radius: 0; + -moz-border-radius: 0; + border-radius: 0; + -moz-box-sizing: border-box; + -webkit-box-sizing: border-box; + -ms-box-sizing: border-box; + box-sizing: border-box; + outline: none; +} + +#wpadminbar #adminbarsearch .adminbar-button { + font: bold 12px Arial, Helvetica, sans-serif; + color: #444; + text-shadow: 0px 1px 0px #eee; + cursor: pointer; + float: left; + background: #aaa; + background: -moz-linear-gradient(bottom, #aaa, #cecece); + background: -webkit-gradient(linear, left bottom, left top, from(#aaa), to(#cecece)); + -webkit-border-radius: 10px; + -khtml-border-radius: 10px; + -moz-border-radius: 10px; + border-radius: 10px; + border: 1px solid #626262; + padding: 2px 13px; + margin: 0; + width: auto; + height: auto; +} + +#wpadminbar #adminbarsearch .adminbar-button:active { + background: #a0a0a0; + background:-moz-linear-gradient(bottom, #a0a0a0, #c1c1c1); + background:-webkit-gradient(linear, left bottom, left top, from(#a0a0a0), to(#c1c1c1)); + -moz-box-shadow: inset 1px 1px 1px #9b9b9b; + -webkit-box-shadow: inset 1px 1px 1px #9b9b9b; + box-shadow: inset 1px 1px 1px #9b9b9b; +} + +#wpadminbar #adminbarsearch .adminbar-button:hover { + color: #000; +} + +#wpadminbar #adminbarsearch .adminbar-button::-moz-focus-inner { + border: none; +} + + +/** + * IE 6-targeted rules + */ +* html #wpadminbar { + overflow: hidden; + position: absolute; +} + +* html #wpadminbar .quicklinks ul li a { + float: left; +} + +* html #wpadminbar .menupop a span { + background-image: none; +} diff --git a/src/wp-includes/css/jquery-ui-dialog.css b/src/wp-includes/css/jquery-ui-dialog.css new file mode 100644 index 0000000..fa51cfb --- /dev/null +++ b/src/wp-includes/css/jquery-ui-dialog.css @@ -0,0 +1 @@ +.ui-helper-hidden{display:none;}.ui-helper-hidden-accessible{position:absolute;left:-99999999px;}.ui-helper-reset{margin:0;padding:0;border:0;outline:0;line-height:1.3;text-decoration:none;font-size:100%;list-style:none;}.ui-helper-clearfix:after{content:".";display:block;height:0;clear:both;visibility:hidden;}.ui-helper-clearfix{display:inline-block;}/* required comment for clearfix to work in Opera \*/ * html .ui-helper-clearfix{height:1%;}.ui-helper-clearfix{display:block;}/* end clearfix */ .ui-helper-zfix{width:100%;height:100%;top:0;left:0;position:absolute;opacity:0;filter:Alpha(Opacity=0);}.ui-state-disabled{cursor:default!important;}.ui-icon{display:block;text-indent:-99999px;overflow:hidden;background-repeat:no-repeat;}.ui-widget-overlay{position:absolute;top:0;left:0;width:100%;height:100%;}.ui-resizable{position:relative;}.ui-resizable-handle{position:absolute;font-size:.1px;z-index:99999;display:block;}.ui-resizable-disabled .ui-resizable-handle,.ui-resizable-autohide .ui-resizable-handle{display:none;}.ui-resizable-n{cursor:n-resize;height:7px;width:100%;top:-5px;left:0;}.ui-resizable-s{cursor:s-resize;height:7px;width:100%;bottom:-5px;left:0;}.ui-resizable-e{cursor:e-resize;width:7px;right:-5px;top:0;height:100%;}.ui-resizable-w{cursor:w-resize;width:7px;left:-5px;top:0;height:100%;}.ui-resizable-se{cursor:se-resize;width:12px;height:12px;right:1px;bottom:1px;}.ui-resizable-sw{cursor:sw-resize;width:9px;height:9px;left:-5px;bottom:-5px;}.ui-resizable-nw{cursor:nw-resize;width:9px;height:9px;left:-5px;top:-5px;}.ui-resizable-ne{cursor:ne-resize;width:9px;height:9px;right:-5px;top:-5px;}.wp-dialog{position:absolute;width:300px;overflow:hidden;}.wp-dialog .ui-dialog-titlebar{position:relative;}.wp-dialog .ui-dialog-titlebar-close span{display:block;margin:1px;}.wp-dialog .ui-dialog-content{position:relative;border:0;padding:0;background:none;overflow:auto;zoom:1;}.wp-dialog .ui-dialog-buttonpane{text-align:left;border-width:1px 0 0 0;background-image:none;margin:.5em 0 0 0;padding:.3em 1em .5em .4em;}.wp-dialog .ui-dialog-buttonpane .ui-dialog-buttonset{float:right;}.wp-dialog .ui-dialog-buttonpane button{margin:.5em .4em .5em 0;cursor:pointer;}.wp-dialog .ui-resizable-se{width:14px;height:14px;right:3px;bottom:3px;}.ui-draggable .ui-dialog-titlebar{cursor:move;}.wp-dialog{border:1px solid #999;-moz-box-shadow:0 0 16px rgba(0,0,0,0.3);-webkit-box-shadow:0 0 16px rgba(0,0,0,0.3);box-shadow:0 0 16px rgba(0,0,0,0.3);}.wp-dialog .ui-dialog-title{display:block;text-align:center;padding:1px 0 2px;}.wp-dialog .ui-dialog-titlebar{padding:0 1em;background-color:#444;font-weight:bold;font-size:11px;line-height:18px;color:#e5e5e5;}.wp-dialog{-moz-border-radius-topleft:4px;-webkit-border-top-left-radius:4px;-khtml-border-top-left-radius:4px;border-top-left-radius:4px;-moz-border-radius-topright:4px;-webkit-border-top-right-radius:4px;-khtml-border-top-right-radius:4px;border-top-right-radius:4px;}.wp-dialog .ui-dialog-titlebar{-moz-border-radius-topleft:3px;-webkit-border-top-left-radius:3px;-khtml-border-top-left-radius:3px;border-top-left-radius:3px;-moz-border-radius-topright:3px;-webkit-border-top-right-radius:3px;-khtml-border-top-right-radius:3px;border-top-right-radius:3px;}.wp-dialog .ui-dialog-titlebar-close{position:absolute;width:29px;height:16px;top:2px;right:6px;background:url('../js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/buttons.gif') no-repeat -87px -16px;padding:0;}.wp-dialog .ui-dialog-titlebar-close:hover,.wp-dialog .ui-dialog-titlebar-close:focus{background-position:-87px -32px;}.ui-widget-overlay{background-color:#000;opacity:.6;filter:alpha(opacity=60);} \ No newline at end of file diff --git a/src/wp-includes/css/jquery-ui-dialog.dev.css b/src/wp-includes/css/jquery-ui-dialog.dev.css new file mode 100644 index 0000000..b5a0675 --- /dev/null +++ b/src/wp-includes/css/jquery-ui-dialog.dev.css @@ -0,0 +1,143 @@ +/* + * jQuery UI CSS Framework @VERSION + * + * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Theming/API + */ + +/* Layout helpers +----------------------------------*/ +.ui-helper-hidden { display: none; } +.ui-helper-hidden-accessible { position: absolute; left: -99999999px; } +.ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; } +.ui-helper-clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; } +.ui-helper-clearfix { display: inline-block; } +/* required comment for clearfix to work in Opera \*/ +* html .ui-helper-clearfix { height:1%; } +.ui-helper-clearfix { display:block; } +/* end clearfix */ +.ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); } + + +/* Interaction Cues +----------------------------------*/ +.ui-state-disabled { cursor: default !important; } + + +/* Icons +----------------------------------*/ + +/* states and images */ +.ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; } + + +/* Misc visuals +----------------------------------*/ + +/* Overlays */ +.ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; } + +/* + * jQuery UI Resizable + * + * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Resizable#theming + */ +.ui-resizable { position: relative;} +.ui-resizable-handle { position: absolute;font-size: 0.1px;z-index: 99999; display: block;} +.ui-resizable-disabled .ui-resizable-handle, .ui-resizable-autohide .ui-resizable-handle { display: none; } +.ui-resizable-n { cursor: n-resize; height: 7px; width: 100%; top: -5px; left: 0; } +.ui-resizable-s { cursor: s-resize; height: 7px; width: 100%; bottom: -5px; left: 0; } +.ui-resizable-e { cursor: e-resize; width: 7px; right: -5px; top: 0; height: 100%; } +.ui-resizable-w { cursor: w-resize; width: 7px; left: -5px; top: 0; height: 100%; } +.ui-resizable-se { cursor: se-resize; width: 12px; height: 12px; right: 1px; bottom: 1px; } +.ui-resizable-sw { cursor: sw-resize; width: 9px; height: 9px; left: -5px; bottom: -5px; } +.ui-resizable-nw { cursor: nw-resize; width: 9px; height: 9px; left: -5px; top: -5px; } +.ui-resizable-ne { cursor: ne-resize; width: 9px; height: 9px; right: -5px; top: -5px;} + +/* + * jQuery UI Dialog + * + * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Dialog#theming + */ +.wp-dialog { position: absolute; width: 300px; overflow: hidden; } +.wp-dialog .ui-dialog-titlebar { position: relative; } +.wp-dialog .ui-dialog-titlebar-close span { display: block; margin: 1px; } +.wp-dialog .ui-dialog-content { position: relative; border: 0; padding: 0; background: none; overflow: auto; zoom: 1; } +.wp-dialog .ui-dialog-buttonpane { text-align: left; border-width: 1px 0 0 0; background-image: none; margin: .5em 0 0 0; padding: .3em 1em .5em .4em; } +.wp-dialog .ui-dialog-buttonpane .ui-dialog-buttonset { float: right; } +.wp-dialog .ui-dialog-buttonpane button { margin: .5em .4em .5em 0; cursor: pointer; } +.wp-dialog .ui-resizable-se { width: 14px; height: 14px; right: 3px; bottom: 3px; } +.ui-draggable .ui-dialog-titlebar { cursor: move; } + + + +/* WP jQuery Dialog Theme */ +.wp-dialog { + border: 1px solid #999; + -moz-box-shadow: 0px 0px 16px rgba( 0,0,0,0.3 ); + -webkit-box-shadow: 0px 0px 16px rgba( 0,0,0,0.3 ); + box-shadow: 0px 0px 16px rgba( 0,0,0,0.3 ); +} +.wp-dialog .ui-dialog-title { + display: block; + text-align: center; + padding: 1px 0 2px; +} +.wp-dialog .ui-dialog-titlebar { + padding: 0 1em; + background-color: #444; + font-weight: bold; + font-size: 11px; + line-height: 18px; + color: #e5e5e5; +} +.wp-dialog { + -moz-border-radius-topleft: 4px; + -webkit-border-top-left-radius: 4px; + -khtml-border-top-left-radius: 4px; + border-top-left-radius: 4px; + -moz-border-radius-topright: 4px; + -webkit-border-top-right-radius: 4px; + -khtml-border-top-right-radius: 4px; + border-top-right-radius: 4px; +} +.wp-dialog .ui-dialog-titlebar { + -moz-border-radius-topleft: 3px; + -webkit-border-top-left-radius: 3px; + -khtml-border-top-left-radius: 3px; + border-top-left-radius: 3px; + -moz-border-radius-topright: 3px; + -webkit-border-top-right-radius: 3px; + -khtml-border-top-right-radius: 3px; + border-top-right-radius: 3px; +} + +.wp-dialog .ui-dialog-titlebar-close { + position: absolute; + width: 29px; + height: 16px; + top: 2px; + right: 6px; + background: url('../js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/buttons.gif') no-repeat -87px -16px; + padding: 0; +} +.wp-dialog .ui-dialog-titlebar-close:hover, +.wp-dialog .ui-dialog-titlebar-close:focus { + background-position: -87px -32px; +} +.ui-widget-overlay { + background-color: #000; + opacity: 0.6; + filter: alpha(opacity=60); +} \ No newline at end of file diff --git a/src/wp-includes/default-constants.php b/src/wp-includes/default-constants.php new file mode 100644 index 0000000..0ba447f --- /dev/null +++ b/src/wp-includes/default-constants.php @@ -0,0 +1,301 @@ + diff --git a/src/wp-includes/default-filters.php b/src/wp-includes/default-filters.php new file mode 100644 index 0000000..a5b6150 --- /dev/null +++ b/src/wp-includes/default-filters.php @@ -0,0 +1,287 @@ + diff --git a/src/wp-includes/default-widgets.php b/src/wp-includes/default-widgets.php new file mode 100644 index 0000000..d9b932a --- /dev/null +++ b/src/wp-includes/default-widgets.php @@ -0,0 +1,1158 @@ + 'widget_pages', 'description' => __( 'Your site’s WordPress Pages') ); + parent::__construct('pages', __('Pages'), $widget_ops); + } + + function widget( $args, $instance ) { + extract( $args ); + + $title = apply_filters('widget_title', empty( $instance['title'] ) ? __( 'Pages' ) : $instance['title'], $instance, $this->id_base); + $sortby = empty( $instance['sortby'] ) ? 'menu_order' : $instance['sortby']; + $exclude = empty( $instance['exclude'] ) ? '' : $instance['exclude']; + + if ( $sortby == 'menu_order' ) + $sortby = 'menu_order, post_title'; + + $out = wp_list_pages( apply_filters('widget_pages_args', array('title_li' => '', 'echo' => 0, 'sort_column' => $sortby, 'exclude' => $exclude) ) ); + + if ( !empty( $out ) ) { + echo $before_widget; + if ( $title) + echo $before_title . $title . $after_title; + ?> +
              + +
            + 'post_title', 'title' => '', 'exclude' => '') ); + $title = esc_attr( $instance['title'] ); + $exclude = esc_attr( $instance['exclude'] ); + ?> +

            +

            + + +

            +

            + +
            + +

            + __( "Your blogroll" ) ); + parent::__construct('links', __('Links'), $widget_ops); + } + + function widget( $args, $instance ) { + extract($args, EXTR_SKIP); + + $show_description = isset($instance['description']) ? $instance['description'] : false; + $show_name = isset($instance['name']) ? $instance['name'] : false; + $show_rating = isset($instance['rating']) ? $instance['rating'] : false; + $show_images = isset($instance['images']) ? $instance['images'] : true; + $category = isset($instance['category']) ? $instance['category'] : false; + + if ( is_admin() && !$category ) { + // Display All Links widget as such in the widgets screen + echo $before_widget . $before_title. __('All Links') . $after_title . $after_widget; + return; + } + + $before_widget = preg_replace('/id="[^"]*"/','id="%id"', $before_widget); + wp_list_bookmarks(apply_filters('widget_links_args', array( + 'title_before' => $before_title, 'title_after' => $after_title, + 'category_before' => $before_widget, 'category_after' => $after_widget, + 'show_images' => $show_images, 'show_description' => $show_description, + 'show_name' => $show_name, 'show_rating' => $show_rating, + 'category' => $category, 'class' => 'linkcat widget' + ))); + } + + function update( $new_instance, $old_instance ) { + $new_instance = (array) $new_instance; + $instance = array( 'images' => 0, 'name' => 0, 'description' => 0, 'rating' => 0); + foreach ( $instance as $field => $val ) { + if ( isset($new_instance[$field]) ) + $instance[$field] = 1; + } + $instance['category'] = intval($new_instance['category']); + + return $instance; + } + + function form( $instance ) { + + //Defaults + $instance = wp_parse_args( (array) $instance, array( 'images' => true, 'name' => true, 'description' => false, 'rating' => false, 'category' => false ) ); + $link_cats = get_terms( 'link_category'); +?> +

            + +

            +

            + id="get_field_id('images'); ?>" name="get_field_name('images'); ?>" /> +
            + id="get_field_id('name'); ?>" name="get_field_name('name'); ?>" /> +
            + id="get_field_id('description'); ?>" name="get_field_name('description'); ?>" /> +
            + id="get_field_id('rating'); ?>" name="get_field_name('rating'); ?>" /> + +

            + 'widget_search', 'description' => __( "A search form for your site") ); + parent::__construct('search', __('Search'), $widget_ops); + } + + function widget( $args, $instance ) { + extract($args); + $title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base); + + echo $before_widget; + if ( $title ) + echo $before_title . $title . $after_title; + + // Use current theme search form if it exists + get_search_form(); + + echo $after_widget; + } + + function form( $instance ) { + $instance = wp_parse_args( (array) $instance, array( 'title' => '') ); + $title = $instance['title']; +?> +

            + '')); + $instance['title'] = strip_tags($new_instance['title']); + return $instance; + } + +} + +/** + * Archives widget class + * + * @since 2.8.0 + */ +class WP_Widget_Archives extends WP_Widget { + + function __construct() { + $widget_ops = array('classname' => 'widget_archive', 'description' => __( 'A monthly archive of your site’s posts') ); + parent::__construct('archives', __('Archives'), $widget_ops); + } + + function widget( $args, $instance ) { + extract($args); + $c = $instance['count'] ? '1' : '0'; + $d = $instance['dropdown'] ? '1' : '0'; + $title = apply_filters('widget_title', empty($instance['title']) ? __('Archives') : $instance['title'], $instance, $this->id_base); + + echo $before_widget; + if ( $title ) + echo $before_title . $title . $after_title; + + if ( $d ) { +?> + + +
              + 'monthly', 'show_post_count' => $c))); ?> +
            + '', 'count' => 0, 'dropdown' => '') ); + $instance['title'] = strip_tags($new_instance['title']); + $instance['count'] = $new_instance['count'] ? 1 : 0; + $instance['dropdown'] = $new_instance['dropdown'] ? 1 : 0; + + return $instance; + } + + function form( $instance ) { + $instance = wp_parse_args( (array) $instance, array( 'title' => '', 'count' => 0, 'dropdown' => '') ); + $title = strip_tags($instance['title']); + $count = $instance['count'] ? 'checked="checked"' : ''; + $dropdown = $instance['dropdown'] ? 'checked="checked"' : ''; +?> +

            +

            + id="get_field_id('dropdown'); ?>" name="get_field_name('dropdown'); ?>" /> +
            + id="get_field_id('count'); ?>" name="get_field_name('count'); ?>" /> +

            + 'widget_meta', 'description' => __( "Log in/out, admin, feed and WordPress links") ); + parent::__construct('meta', __('Meta'), $widget_ops); + } + + function widget( $args, $instance ) { + extract($args); + $title = apply_filters('widget_title', empty($instance['title']) ? __('Meta') : $instance['title'], $instance, $this->id_base); + + echo $before_widget; + if ( $title ) + echo $before_title . $title . $after_title; +?> + + '' ) ); + $title = strip_tags($instance['title']); +?> +

            + 'widget_calendar', 'description' => __( 'A calendar of your site’s posts') ); + parent::__construct('calendar', __('Calendar'), $widget_ops); + } + + function widget( $args, $instance ) { + extract($args); + $title = apply_filters('widget_title', empty($instance['title']) ? ' ' : $instance['title'], $instance, $this->id_base); + echo $before_widget; + if ( $title ) + echo $before_title . $title . $after_title; + echo '
            '; + get_calendar(); + echo '
            '; + echo $after_widget; + } + + function update( $new_instance, $old_instance ) { + $instance = $old_instance; + $instance['title'] = strip_tags($new_instance['title']); + + return $instance; + } + + function form( $instance ) { + $instance = wp_parse_args( (array) $instance, array( 'title' => '' ) ); + $title = strip_tags($instance['title']); +?> +

            +

            + 'widget_text', 'description' => __('Arbitrary text or HTML')); + $control_ops = array('width' => 400, 'height' => 350); + parent::__construct('text', __('Text'), $widget_ops, $control_ops); + } + + function widget( $args, $instance ) { + extract($args); + $title = apply_filters( 'widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base); + $text = apply_filters( 'widget_text', $instance['text'], $instance ); + echo $before_widget; + if ( !empty( $title ) ) { echo $before_title . $title . $after_title; } ?> +
            + '', 'text' => '' ) ); + $title = strip_tags($instance['title']); + $text = esc_textarea($instance['text']); +?> +

            +

            + + + +

            /> 

            + 'widget_categories', 'description' => __( "A list or dropdown of categories" ) ); + parent::__construct('categories', __('Categories'), $widget_ops); + } + + function widget( $args, $instance ) { + extract( $args ); + + $title = apply_filters('widget_title', empty( $instance['title'] ) ? __( 'Categories' ) : $instance['title'], $instance, $this->id_base); + $c = $instance['count'] ? '1' : '0'; + $h = $instance['hierarchical'] ? '1' : '0'; + $d = $instance['dropdown'] ? '1' : '0'; + + echo $before_widget; + if ( $title ) + 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(apply_filters('widget_categories_dropdown_args', $cat_args)); +?> + + + + +
              + +
            + '') ); + $title = esc_attr( $instance['title'] ); + $count = isset($instance['count']) ? (bool) $instance['count'] :false; + $hierarchical = isset( $instance['hierarchical'] ) ? (bool) $instance['hierarchical'] : false; + $dropdown = isset( $instance['dropdown'] ) ? (bool) $instance['dropdown'] : false; +?> +

            +

            + +

            /> +
            + + /> +
            + + /> +

            + 'widget_recent_entries', 'description' => __( "The most recent posts on your site") ); + parent::__construct('recent-posts', __('Recent Posts'), $widget_ops); + $this->alt_option_name = 'widget_recent_entries'; + + add_action( 'save_post', array(&$this, 'flush_widget_cache') ); + add_action( 'deleted_post', array(&$this, 'flush_widget_cache') ); + add_action( 'switch_theme', array(&$this, 'flush_widget_cache') ); + } + + function widget($args, $instance) { + $cache = wp_cache_get('widget_recent_posts', 'widget'); + + if ( !is_array($cache) ) + $cache = array(); + + if ( isset($cache[$args['widget_id']]) ) { + echo $cache[$args['widget_id']]; + return; + } + + ob_start(); + extract($args); + + $title = apply_filters('widget_title', empty($instance['title']) ? __('Recent Posts') : $instance['title'], $instance, $this->id_base); + if ( ! $number = absint( $instance['number'] ) ) + $number = 10; + + $r = new WP_Query(array('posts_per_page' => $number, 'no_found_rows' => true, 'post_status' => 'publish', 'ignore_sticky_posts' => true)); + if ($r->have_posts()) : +?> + + +
              + have_posts()) : $r->the_post(); ?> +
            • + +
            + +flush_widget_cache(); + + $alloptions = wp_cache_get( 'alloptions', 'options' ); + if ( isset($alloptions['widget_recent_entries']) ) + delete_option('widget_recent_entries'); + + return $instance; + } + + function flush_widget_cache() { + wp_cache_delete('widget_recent_posts', 'widget'); + } + + function form( $instance ) { + $title = isset($instance['title']) ? esc_attr($instance['title']) : ''; + $number = isset($instance['number']) ? absint($instance['number']) : 5; +?> +

            +

            + +

            +

            + 'widget_recent_comments', 'description' => __( 'The most recent comments' ) ); + parent::__construct('recent-comments', __('Recent Comments'), $widget_ops); + $this->alt_option_name = 'widget_recent_comments'; + + if ( is_active_widget(false, false, $this->id_base) ) + add_action( 'wp_head', array(&$this, 'recent_comments_style') ); + + add_action( 'comment_post', array(&$this, 'flush_widget_cache') ); + add_action( 'transition_comment_status', array(&$this, 'flush_widget_cache') ); + } + + function recent_comments_style() { + if ( ! current_theme_supports( 'widgets' ) // Temp hack #14876 + || ! apply_filters( 'show_recent_comments_widget_style', true, $this->id_base ) ) + return; + ?> + + $number, 'status' => 'approve', 'post_status' => 'publish' ) ); + $output .= $before_widget; + if ( $title ) + $output .= $before_title . $title . $after_title; + + $output .= '
              '; + if ( $comments ) { + foreach ( (array) $comments as $comment) { + $output .= '
            • ' . /* translators: comments widget: 1: comment author, 2: post link */ sprintf(_x('%1$s on %2$s', 'widgets'), get_comment_author_link(), '' . get_the_title($comment->comment_post_ID) . '') . '
            • '; + } + } + $output .= '
            '; + $output .= $after_widget; + + echo $output; + $cache[$args['widget_id']] = $output; + wp_cache_set('widget_recent_comments', $cache, 'widget'); + } + + function update( $new_instance, $old_instance ) { + $instance = $old_instance; + $instance['title'] = strip_tags($new_instance['title']); + $instance['number'] = absint( $new_instance['number'] ); + $this->flush_widget_cache(); + + $alloptions = wp_cache_get( 'alloptions', 'options' ); + if ( isset($alloptions['widget_recent_comments']) ) + delete_option('widget_recent_comments'); + + return $instance; + } + + function form( $instance ) { + $title = isset($instance['title']) ? esc_attr($instance['title']) : ''; + $number = isset($instance['number']) ? absint($instance['number']) : 5; +?> +

            +

            + +

            +

            + __('Entries from any RSS or Atom feed') ); + $control_ops = array( 'width' => 400, 'height' => 200 ); + parent::__construct( 'rss', __('RSS'), $widget_ops, $control_ops ); + } + + function widget($args, $instance) { + + if ( isset($instance['error']) && $instance['error'] ) + return; + + extract($args, EXTR_SKIP); + + $url = $instance['url']; + while ( stristr($url, 'http') != $url ) + $url = substr($url, 1); + + if ( empty($url) ) + return; + + // self-url destruction sequence + if ( in_array( untrailingslashit( $url ), array( site_url(), home_url() ) ) ) + return; + + $rss = fetch_feed($url); + $title = $instance['title']; + $desc = ''; + $link = ''; + + if ( ! is_wp_error($rss) ) { + $desc = esc_attr(strip_tags(@html_entity_decode($rss->get_description(), ENT_QUOTES, get_option('blog_charset')))); + if ( empty($title) ) + $title = esc_html(strip_tags($rss->get_title())); + $link = esc_url(strip_tags($rss->get_permalink())); + while ( stristr($link, 'http') != $link ) + $link = substr($link, 1); + } + + if ( empty($title) ) + $title = empty($desc) ? __('Unknown Feed') : $desc; + + $title = apply_filters('widget_title', $title, $instance, $this->id_base); + $url = esc_url(strip_tags($url)); + $icon = includes_url('images/rss.png'); + if ( $title ) + $title = "RSS $title"; + + echo $before_widget; + if ( $title ) + echo $before_title . $title . $after_title; + wp_widget_rss_output( $rss, $instance ); + echo $after_widget; + + if ( ! is_wp_error($rss) ) + $rss->__destruct(); + unset($rss); + } + + function update($new_instance, $old_instance) { + $testurl = ( isset($new_instance['url']) && ($new_instance['url'] != $old_instance['url']) ); + return wp_widget_rss_process( $new_instance, $testurl ); + } + + function form($instance) { + + if ( empty($instance) ) + $instance = array( 'title' => '', 'url' => '', 'items' => 10, 'error' => false, 'show_summary' => 0, 'show_author' => 0, 'show_date' => 0 ); + $instance['number'] = $this->number; + + wp_widget_rss_form( $instance ); + } +} + +/** + * Display the RSS entries in a list. + * + * @since 2.5.0 + * + * @param string|array|object $rss RSS url. + * @param array $args Widget arguments. + */ +function wp_widget_rss_output( $rss, $args = array() ) { + if ( is_string( $rss ) ) { + $rss = fetch_feed($rss); + } elseif ( is_array($rss) && isset($rss['url']) ) { + $args = $rss; + $rss = fetch_feed($rss['url']); + } elseif ( !is_object($rss) ) { + return; + } + + if ( is_wp_error($rss) ) { + if ( is_admin() || current_user_can('manage_options') ) + echo '

            ' . sprintf( __('RSS Error: %s'), $rss->get_error_message() ) . '

            '; + return; + } + + $default_args = array( 'show_author' => 0, 'show_date' => 0, 'show_summary' => 0 ); + $args = wp_parse_args( $args, $default_args ); + 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 ( !$rss->get_item_quantity() ) { + echo '
            • ' . __( 'An error has occurred; the feed is probably down. Try again later.' ) . '
            '; + $rss->__destruct(); + unset($rss); + return; + } + + echo '
              '; + foreach ( $rss->get_items(0, $items) as $item ) { + $link = $item->get_link(); + while ( stristr($link, 'http') != $link ) + $link = substr($link, 1); + $link = esc_url(strip_tags($link)); + $title = esc_attr(strip_tags($item->get_title())); + if ( empty($title) ) + $title = __('Untitled'); + + $desc = str_replace( array("\n", "\r"), ' ', esc_attr( strip_tags( @html_entity_decode( $item->get_description(), ENT_QUOTES, get_option('blog_charset') ) ) ) ); + $desc = wp_html_excerpt( $desc, 360 ); + + // Append ellipsis. Change existing [...] to […]. + if ( '[...]' == substr( $desc, -5 ) ) + $desc = substr( $desc, 0, -5 ) . '[…]'; + elseif ( '[…]' != substr( $desc, -10 ) ) + $desc .= ' […]'; + + $desc = esc_html( $desc ); + + if ( $show_summary ) { + $summary = "
              $desc
              "; + } else { + $summary = ''; + } + + $date = ''; + if ( $show_date ) { + $date = $item->get_date( 'U' ); + + if ( $date ) { + $date = ' ' . date_i18n( get_option( 'date_format' ), $date ) . ''; + } + } + + $author = ''; + if ( $show_author ) { + $author = $item->get_author(); + if ( is_object($author) ) { + $author = $author->get_name(); + $author = ' ' . esc_html( strip_tags( $author ) ) . ''; + } + } + + if ( $link == '' ) { + echo "
            • $title{$date}{$summary}{$author}
            • "; + } else { + echo "
            • $title{$date}{$summary}{$author}
            • "; + } + } + echo '
            '; + $rss->__destruct(); + unset($rss); +} + + + +/** + * Display RSS widget options form. + * + * The options for what fields are displayed for the RSS form are all booleans + * and are as follows: 'url', 'title', 'items', 'show_summary', 'show_author', + * 'show_date'. + * + * @since 2.5.0 + * + * @param array|string $args Values for input fields. + * @param array $inputs Override default display options. + */ +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 ); + extract( $inputs, EXTR_SKIP); + + $number = esc_attr( $number ); + $title = esc_attr( $title ); + $url = esc_url( $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 ( !empty($error) ) + echo '

            ' . sprintf( __('RSS Error: %s'), $error) . '

            '; + + if ( $inputs['url'] ) : +?> +

            +

            + +

            +

            + +

            +

            + +

            /> +

            + +

            /> +

            + +

            /> +

            + + +get_error_message(); + } else { + $link = esc_url(strip_tags($rss->get_permalink())); + while ( stristr($link, 'http') != $link ) + $link = substr($link, 1); + + $rss->__destruct(); + unset($rss); + } + } + + return compact( 'title', 'url', 'link', 'items', 'error', 'show_summary', 'show_author', 'show_date' ); +} + +/** + * Tag cloud widget class + * + * @since 2.8.0 + */ +class WP_Widget_Tag_Cloud extends WP_Widget { + + function __construct() { + $widget_ops = array( 'description' => __( "Your most used tags in cloud format") ); + parent::__construct('tag_cloud', __('Tag Cloud'), $widget_ops); + } + + function widget( $args, $instance ) { + extract($args); + $current_taxonomy = $this->_get_current_taxonomy($instance); + if ( !empty($instance['title']) ) { + $title = $instance['title']; + } else { + if ( 'post_tag' == $current_taxonomy ) { + $title = __('Tags'); + } else { + $tax = get_taxonomy($current_taxonomy); + $title = $tax->labels->name; + } + } + $title = apply_filters('widget_title', $title, $instance, $this->id_base); + + echo $before_widget; + if ( $title ) + echo $before_title . $title . $after_title; + echo '
            '; + wp_tag_cloud( apply_filters('widget_tag_cloud_args', array('taxonomy' => $current_taxonomy) ) ); + echo "
            \n"; + echo $after_widget; + } + + function update( $new_instance, $old_instance ) { + $instance['title'] = strip_tags(stripslashes($new_instance['title'])); + $instance['taxonomy'] = stripslashes($new_instance['taxonomy']); + return $instance; + } + + function form( $instance ) { + $current_taxonomy = $this->_get_current_taxonomy($instance); +?> +

            +

            +

            +

            __('Use this widget to add one of your custom menus as a widget.') ); + parent::__construct( 'nav_menu', __('Custom Menu'), $widget_ops ); + } + + function widget($args, $instance) { + // Get menu + $nav_menu = wp_get_nav_menu_object( $instance['nav_menu'] ); + + if ( !$nav_menu ) + return; + + $instance['title'] = apply_filters('widget_title', $instance['title'], $instance, $this->id_base); + + echo $args['before_widget']; + + if ( !empty($instance['title']) ) + echo $args['before_title'] . $instance['title'] . $args['after_title']; + + wp_nav_menu( array( 'fallback_cb' => '', 'menu' => $nav_menu ) ); + + echo $args['after_widget']; + } + + function update( $new_instance, $old_instance ) { + $instance['title'] = strip_tags( stripslashes($new_instance['title']) ); + $instance['nav_menu'] = (int) $new_instance['nav_menu']; + return $instance; + } + + function form( $instance ) { + $title = isset( $instance['title'] ) ? $instance['title'] : ''; + $nav_menu = isset( $instance['nav_menu'] ) ? $instance['nav_menu'] : ''; + + // Get menus + $menus = get_terms( 'nav_menu', array( 'hide_empty' => false ) ); + + // If no menus exists, direct the user to go and create some. + if ( !$menus ) { + echo '

            '. sprintf( __('No menus have been created yet. Create some.'), admin_url('nav-menus.php') ) .'

            '; + return; + } + ?> +

            + + +

            +

            + + +

            + $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; +} + +/** + * Sets up the WordPress Loop. + * + * @since 1.0.1 + * @deprecated 1.5 + * @deprecated Use The Loop - {@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); +} + +/** + * Return or Print Category ID. + * + * @since 0.71 + * @deprecated 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.71', '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; +} + +/** + * Print category with optional text before and after. + * + * @since 0.71 + * @deprecated 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.71', '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; + } +} + +/** + * Prints link to the previous post. + * + * @since 1.5 + * @deprecated 2.0 + * @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__, '2.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; +} + +/** + * Prints link to the next post. + * + * @since 0.71 + * @deprecated 2.0 + * @deprecated Use next_post_link() + * @see next_post_link() + * + * @param string $format + * @param string $next + * @param string $title + * @param string $in_same_cat + * @param int $limitnext + * @param string $excluded_categories + */ +function next_post($format='%', $next='next post: ', $title='yes', $in_same_cat='no', $limitnext=1, $excluded_categories='') { + _deprecated_function( __FUNCTION__, '2.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; +} + +/** + * Whether user can create a post. + * + * @since 1.5 + * @deprecated 2.0 + * @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__, '2.0', 'current_user_can()' ); + + $author_data = get_userdata($user_id); + return ($author_data->user_level > 1); +} + +/** + * Whether user can create a post. + * + * @since 1.5 + * @deprecated 2.0 + * @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__, '2.0', 'current_user_can()' ); + + $author_data = get_userdata($user_id); + return ($author_data->user_level >= 1); +} + +/** + * Whether user can edit a post. + * + * @since 1.5 + * @deprecated 2.0 + * @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__, '2.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; + } +} + +/** + * Whether user can delete a post. + * + * @since 1.5 + * @deprecated 2.0 + * @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__, '2.0', 'current_user_can()' ); + + // right now if one can edit, one can delete + return user_can_edit_post($user_id, $post_id, $blog_id); +} + +/** + * Whether user can set new posts' dates. + * + * @since 1.5 + * @deprecated 2.0 + * @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__, '2.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)); +} + +/** + * Whether user can delete a post. + * + * @since 1.5 + * @deprecated 2.0 + * @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 returns true if $user_id can edit $post_id's date + */ +function user_can_edit_post_date($user_id, $post_id, $blog_id = 1) { + _deprecated_function( __FUNCTION__, '2.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)); +} + +/** + * Whether user can delete a post. + * + * @since 1.5 + * @deprecated 2.0 + * @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 returns true if $user_id can edit $post_id's comments + */ +function user_can_edit_post_comments($user_id, $post_id, $blog_id = 1) { + _deprecated_function( __FUNCTION__, '2.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); +} + +/** + * Whether user can delete a post. + * + * @since 1.5 + * @deprecated 2.0 + * @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 returns true if $user_id can delete $post_id's comments + */ +function user_can_delete_post_comments($user_id, $post_id, $blog_id = 1) { + _deprecated_function( __FUNCTION__, '2.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); +} + +/** + * Can user can edit other user. + * + * @since 1.5 + * @deprecated 2.0 + * @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__, '2.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; +} + +/** + * Gets the links associated with category $cat_name. + * + * @since 0.71 + * @deprecated 2.1 + * @deprecated Use get_bookmarks() + * @see get_bookmarks() + * + * @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__, '2.1', 'get_bookmarks()' ); + + $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); +} + +/** + * Gets the links associated with the named category. + * + * @since 1.0.1 + * @deprecated 2.1 + * @deprecated Use wp_list_bookmarks() + * @see wp_list_bookmarks() + * + * @param string $category The category to use. + * @param string $args + * @return bool|null + */ +function wp_get_linksbyname($category, $args = '') { + _deprecated_function(__FUNCTION__, '2.1', 'wp_list_bookmarks()'); + + $defaults = array( + 'after' => '
            ', + 'before' => '', + 'categorize' => 0, + 'category_after' => '', + 'category_before' => '', + 'category_name' => $category, + 'show_description' => 1, + 'title_li' => '', + ); + + $r = wp_parse_args( $args, $defaults ); + + return wp_list_bookmarks($r); +} + +/** + * 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 2.1 + * @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 $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__, '2.1', 'get_bookmarks()' ); + + $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); +} + +/** + * 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 2.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__, '2.1', 'get_bookmarks()' ); + + $links = get_bookmarks( array( 'category' => $category, 'orderby' => $orderby, 'limit' => $limit ) ) ; + + $links_array = array(); + foreach ($links as $link) + $links_array[] = $link; + + return $links_array; +} + +/** + * Gets the links associated with category 'cat_name' and display rating stars/chars. + * + * @since 0.71 + * @deprecated 2.1 + * @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__, '2.1', 'get_bookmarks()' ); + + get_linksbyname($cat_name, $before, $after, $between, $show_images, $orderby, $show_description, true, $limit, $show_updated); +} + +/** + * Gets the links associated with category n and display rating stars/chars. + * + * @since 0.71 + * @deprecated 2.1 + * @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__, '2.1', 'get_bookmarks()' ); + + get_links($category, $before, $after, $between, $show_images, $orderby, $show_description, true, $limit, $show_updated); +} + +/** + * Gets the auto_toggle setting. + * + * @since 0.71 + * @deprecated 2.1 + * @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__, '2.1' ); + return 0; +} + +/** + * @since 0.71 + * @deprecated 2.1 + * @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__, '2.1', '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 2.1 + * @deprecated Use wp_list_categories() + * @see wp_list_categories() + * + * @param string|array $args + * @return unknown + */ +function wp_list_cats($args = '') { + _deprecated_function( __FUNCTION__, '2.1', '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 2.1 + * @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__, '2.1', '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 1.2 + * @deprecated 2.1 + * @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__, '2.1', '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 2.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__, '2.1', 'wp_get_post_categories()' ); + return wp_get_post_categories($post_ID); +} + +/** + * Sets the categories that the post id belongs to. + * + * @since 1.0.1 + * @deprecated 2.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__, '2.1', 'wp_set_post_categories()' ); + return wp_set_post_categories($post_ID, $post_categories); +} + +/** + * @since 0.71 + * @deprecated 2.1 + * @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__, '2.1', 'wp_get_archives()' ); + $args = compact('type', 'limit', 'format', 'before', 'after', 'show_post_count'); + return wp_get_archives($args); +} + +/** + * Returns or Prints link to the author's posts. + * + * @since 1.2 + * @deprecated 2.1 + * @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__, '2.1', 'get_author_posts_url()' ); + + $link = get_author_posts_url($author_id, $author_nicename); + + if ( $echo ) + echo $link; + return $link; +} + +/** + * Print list of pages based on arguments. + * + * @since 0.71 + * @deprecated 2.1 + * @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__, '2.1', 'wp_link_pages()' ); + + $args = compact('before', 'after', 'next_or_number', 'nextpagelink', 'previouspagelink', 'pagelink', 'more_file'); + return wp_link_pages($args); +} + +/** + * Get value based on option. + * + * @since 0.71 + * @deprecated 2.1 + * @deprecated Use get_option() + * @see get_option() + * + * @param string $option + * @return string + */ +function get_settings($option) { + _deprecated_function( __FUNCTION__, '2.1', 'get_option()' ); + + return get_option($option); +} + +/** + * Print the permalink of the current post in the loop. + * + * @since 0.71 + * @deprecated 1.2 + * @deprecated Use the_permalink() + * @see the_permalink() + */ +function permalink_link() { + _deprecated_function( __FUNCTION__, '1.2', 'the_permalink()' ); + the_permalink(); +} + +/** + * Print the permalink to the RSS feed. + * + * @since 0.71 + * @deprecated 2.3 + * @deprecated Use the_permalink_rss() + * @see the_permalink_rss() + * + * @param string $deprecated + */ +function permalink_single_rss($deprecated = '') { + _deprecated_function( __FUNCTION__, '2.3', 'the_permalink_rss()' ); + the_permalink_rss(); +} + +/** + * Gets the links associated with category. + * + * @see get_links() for argument information that can be used in $args + * @since 1.0.1 + * @deprecated 2.1 + * @deprecated Use wp_list_bookmarks() + * @see wp_list_bookmarks() + * + * @param string $args a query string + * @return null|string + */ +function wp_get_links($args = '') { + _deprecated_function( __FUNCTION__, '2.1', 'wp_list_bookmarks()' ); + + if ( strpos( $args, '=' ) === false ) { + $cat_id = $args; + $args = add_query_arg( 'category', $cat_id, $args ); + } + + $defaults = array( + 'after' => '
            ', + 'before' => '', + 'between' => ' ', + 'categorize' => 0, + 'category' => '', + 'echo' => true, + 'limit' => -1, + 'orderby' => 'name', + 'show_description' => true, + 'show_images' => true, + 'show_rating' => false, + 'show_updated' => true, + 'title_li' => '', + ); + + $r = wp_parse_args( $args, $defaults ); + + return wp_list_bookmarks($r); +} + +/** + * Gets the links associated with category by id. + * + * @since 0.71 + * @deprecated 2.1 + * @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__, '2.1', '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(array('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 = esc_url($row->link_url); + $rel = $row->link_rel; + if ( '' != $rel ) + $rel = ' rel="' . $rel . '"'; + + $desc = esc_attr(sanitize_bookmark_field('link_description', $row->link_description, $row->link_id, 'display')); + $name = esc_attr(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; +} + +/** + * 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. + * + * @since 1.0.1 + * @deprecated 2.1 + * @deprecated Use wp_list_bookmarks() + * @see wp_list_bookmarks() + * + * @param string $order Sort link categories by 'name' or 'id' + */ +function get_links_list($order = 'name') { + _deprecated_function( __FUNCTION__, '2.1', '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(array('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"; + } + } +} + +/** + * Show the link to the links popup and the number of links. + * + * @since 0.71 + * @deprecated 2.1 + * @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__, '2.1' ); + + 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 2.1 + * @deprecated Use sanitize_bookmark_field() + * @see sanitize_bookmark_field() + * + * @param object $link + * @return unknown + */ +function get_linkrating($link) { + _deprecated_function( __FUNCTION__, '2.1', 'sanitize_bookmark_field()' ); + return sanitize_bookmark_field('link_rating', $link->link_rating, $link->link_id, 'display'); +} + +/** + * Gets the name of category by id. + * + * @since 0.71 + * @deprecated 2.1 + * @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__, '2.1', '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; +} + +/** + * Print RSS comment feed link. + * + * @since 1.0.1 + * @deprecated 2.5 + * @deprecated Use post_comments_feed_link() + * @see post_comments_feed_link() + * + * @param string $link_text + */ +function comments_rss_link($link_text = 'Comments RSS') { + _deprecated_function( __FUNCTION__, '2.5', 'post_comments_feed_link()' ); + post_comments_feed_link($link_text); +} + +/** + * Print/Return link to category RSS2 feed. + * + * @since 1.2 + * @deprecated 2.5 + * @deprecated Use get_category_feed_link() + * @see get_category_feed_link() + * + * @param bool $echo + * @param int $cat_ID + * @return string|null + */ +function get_category_rss_link($echo = false, $cat_ID = 1) { + _deprecated_function( __FUNCTION__, '2.5', 'get_category_feed_link()' ); + + $link = get_category_feed_link($cat_ID, 'rss2'); + + if ( $echo ) + echo $link; + return $link; +} + +/** + * Print/Return link to author RSS feed. + * + * @since 1.2 + * @deprecated 2.5 + * @deprecated Use get_author_feed_link() + * @see get_author_feed_link() + * + * @param bool $echo + * @param int $author_id + * @return string|null + */ +function get_author_rss_link($echo = false, $author_id = 1) { + _deprecated_function( __FUNCTION__, '2.5', 'get_author_feed_link()' ); + + $link = get_author_feed_link($author_id); + if ( $echo ) + echo $link; + return $link; +} + +/** + * Return link to the post RSS feed. + * + * @since 1.5 + * @deprecated 2.2 + * @deprecated Use get_post_comments_feed_link() + * @see get_post_comments_feed_link() + * + * @return string + */ +function comments_rss() { + _deprecated_function( __FUNCTION__, '2.2', 'get_post_comments_feed_link()' ); + return get_post_comments_feed_link(); +} + +/** + * An alias of wp_create_user(). + * + * @since 2.0 + * @deprecated 2.0 + * @deprecated Use wp_create_user() + * @see 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. + */ +function create_user($username, $password, $email) { + _deprecated_function( __FUNCTION__, '2.0', 'wp_create_user()' ); + return wp_create_user($username, $password, $email); +} + +/** + * Unused function. + * + * @deprecated 2.5 +*/ +function gzip_compression() { + _deprecated_function( __FUNCTION__, '2.5' ); + return false; +} + +/** + * Retrieve an array of comment data about comment $comment_ID. + * + * @since 0.71 + * @deprecated 2.7 + * @deprecated Use get_comment() + * @see get_comment() + * + * @param int $comment_ID The ID of the comment + * @param int $no_cache Whether to use the cache (cast to bool) + * @param bool $include_unapproved Whether to include unapproved comments + * @return array The comment data + */ +function get_commentdata( $comment_ID, $no_cache = 0, $include_unapproved = false ) { + _deprecated_function( __FUNCTION__, '2.7', 'get_comment()' ); + return get_comment($comment_ID, ARRAY_A); +} + +/** + * Retrieve the category name by the category ID. + * + * @since 0.71 + * @deprecated 2.8 + * @deprecated Use get_cat_name() + * @see get_cat_name() + * + * @param int $cat_ID Category ID + * @return string category name + */ +function get_catname( $cat_ID ) { + _deprecated_function( __FUNCTION__, '2.8', 'get_cat_name()' ); + return get_cat_name( $cat_ID ); +} + +/** + * Retrieve category children list separated before and after the term IDs. + * + * @since 1.2.0 + * @deprecated 2.8 + * @deprecated Use get_term_children() + * @see get_term_children() + * + * @param int $id Category ID to retrieve children. + * @param string $before Optional. Prepend before category term ID. + * @param string $after Optional, default is empty string. Append after category term ID. + * @param array $visited Optional. Category Term IDs that have already been added. + * @return string + */ +function get_category_children( $id, $before = '/', $after = '', $visited = array() ) { + _deprecated_function( __FUNCTION__, '2.8', 'get_term_children()' ); + if ( 0 == $id ) + return ''; + + $chain = ''; + /** TODO: consult hierarchy */ + $cat_ids = get_all_category_ids(); + foreach ( (array) $cat_ids as $cat_id ) { + if ( $cat_id == $id ) + continue; + + $category = get_category( $cat_id ); + if ( is_wp_error( $category ) ) + return $category; + if ( $category->parent == $id && !in_array( $category->term_id, $visited ) ) { + $visited[] = $category->term_id; + $chain .= $before.$category->term_id.$after; + $chain .= get_category_children( $category->term_id, $before, $after ); + } + } + return $chain; +} + +/** + * Retrieve the description of the author of the current post. + * + * @since 1.5 + * @deprecated 2.8 + * @deprecated Use get_the_author_meta('description') + * @see get_the_author_meta() + * + * @return string The author's description. + */ +function get_the_author_description() { + _deprecated_function( __FUNCTION__, '2.8', 'get_the_author_meta(\'description\')' ); + return get_the_author_meta('description'); +} + +/** + * Display the description of the author of the current post. + * + * @since 1.0.0 + * @deprecated 2.8 + * @deprecated Use the_author_meta('description') + * @see the_author_meta() + */ +function the_author_description() { + _deprecated_function( __FUNCTION__, '2.8', 'the_author_meta(\'description\')' ); + the_author_meta('description'); +} + +/** + * Retrieve the login name of the author of the current post. + * + * @since 1.5 + * @deprecated 2.8 + * @deprecated Use get_the_author_meta('login') + * @see get_the_author_meta() + * + * @return string The author's login name (username). + */ +function get_the_author_login() { + _deprecated_function( __FUNCTION__, '2.8', 'get_the_author_meta(\'login\')' ); + return get_the_author_meta('login'); +} + +/** + * Display the login name of the author of the current post. + * + * @since 0.71 + * @deprecated 2.8 + * @deprecated Use the_author_meta('login') + * @see the_author_meta() + */ +function the_author_login() { + _deprecated_function( __FUNCTION__, '2.8', 'the_author_meta(\'login\')' ); + the_author_meta('login'); +} + +/** + * Retrieve the first name of the author of the current post. + * + * @since 1.5 + * @deprecated 2.8 + * @deprecated Use get_the_author_meta('first_name') + * @see get_the_author_meta() + * + * @return string The author's first name. + */ +function get_the_author_firstname() { + _deprecated_function( __FUNCTION__, '2.8', 'get_the_author_meta(\'first_name\')' ); + return get_the_author_meta('first_name'); +} + +/** + * Display the first name of the author of the current post. + * + * @since 0.71 + * @deprecated 2.8 + * @deprecated Use the_author_meta('first_name') + * @see the_author_meta() + */ +function the_author_firstname() { + _deprecated_function( __FUNCTION__, '2.8', 'the_author_meta(\'first_name\')' ); + the_author_meta('first_name'); +} + +/** + * Retrieve the last name of the author of the current post. + * + * @since 1.5 + * @deprecated 2.8 + * @deprecated Use get_the_author_meta('last_name') + * @see get_the_author_meta() + * + * @return string The author's last name. + */ +function get_the_author_lastname() { + _deprecated_function( __FUNCTION__, '2.8', 'get_the_author_meta(\'last_name\')' ); + return get_the_author_meta('last_name'); +} + +/** + * Display the last name of the author of the current post. + * + * @since 0.71 + * @deprecated 2.8 + * @deprecated Use the_author_meta('last_name') + * @see the_author_meta() + */ +function the_author_lastname() { + _deprecated_function( __FUNCTION__, '2.8', 'the_author_meta(\'last_name\')' ); + the_author_meta('last_name'); +} + +/** + * Retrieve the nickname of the author of the current post. + * + * @since 1.5 + * @deprecated 2.8 + * @deprecated Use get_the_author_meta('nickname') + * @see get_the_author_meta() + * + * @return string The author's nickname. + */ +function get_the_author_nickname() { + _deprecated_function( __FUNCTION__, '2.8', 'get_the_author_meta(\'nickname\')' ); + return get_the_author_meta('nickname'); +} + +/** + * Display the nickname of the author of the current post. + * + * @since 0.71 + * @deprecated 2.8 + * @deprecated Use the_author_meta('nickname') + * @see the_author_meta() + */ +function the_author_nickname() { + _deprecated_function( __FUNCTION__, '2.8', 'the_author_meta(\'nickname\')' ); + the_author_meta('nickname'); +} + +/** + * Retrieve the email of the author of the current post. + * + * @since 1.5 + * @deprecated 2.8 + * @deprecated Use get_the_author_meta('email') + * @see get_the_author_meta() + * + * @return string The author's username. + */ +function get_the_author_email() { + _deprecated_function( __FUNCTION__, '2.8', 'get_the_author_meta(\'email\')' ); + return get_the_author_meta('email'); +} + +/** + * Display the email of the author of the current post. + * + * @since 0.71 + * @deprecated 2.8 + * @deprecated Use the_author_meta('email') + * @see the_author_meta() + */ +function the_author_email() { + _deprecated_function( __FUNCTION__, '2.8', 'the_author_meta(\'email\')' ); + the_author_meta('email'); +} + +/** + * Retrieve the ICQ number of the author of the current post. + * + * @since 1.5 + * @deprecated 2.8 + * @deprecated Use get_the_author_meta('icq') + * @see get_the_author_meta() + * + * @return string The author's ICQ number. + */ +function get_the_author_icq() { + _deprecated_function( __FUNCTION__, '2.8', 'get_the_author_meta(\'icq\')' ); + return get_the_author_meta('icq'); +} + +/** + * Display the ICQ number of the author of the current post. + * + * @since 0.71 + * @deprecated 2.8 + * @deprecated Use the_author_meta('icq') + * @see the_author_meta() + */ +function the_author_icq() { + _deprecated_function( __FUNCTION__, '2.8', 'the_author_meta(\'icq\')' ); + the_author_meta('icq'); +} + +/** + * Retrieve the Yahoo! IM name of the author of the current post. + * + * @since 1.5 + * @deprecated 2.8 + * @deprecated Use get_the_author_meta('yim') + * @see get_the_author_meta() + * + * @return string The author's Yahoo! IM name. + */ +function get_the_author_yim() { + _deprecated_function( __FUNCTION__, '2.8', 'get_the_author_meta(\'yim\')' ); + return get_the_author_meta('yim'); +} + +/** + * Display the Yahoo! IM name of the author of the current post. + * + * @since 0.71 + * @deprecated 2.8 + * @deprecated Use the_author_meta('yim') + * @see the_author_meta() + */ +function the_author_yim() { + _deprecated_function( __FUNCTION__, '2.8', 'the_author_meta(\'yim\')' ); + the_author_meta('yim'); +} + +/** + * Retrieve the MSN address of the author of the current post. + * + * @since 1.5 + * @deprecated 2.8 + * @deprecated Use get_the_author_meta('msn') + * @see get_the_author_meta() + * + * @return string The author's MSN address. + */ +function get_the_author_msn() { + _deprecated_function( __FUNCTION__, '2.8', 'get_the_author_meta(\'msn\')' ); + return get_the_author_meta('msn'); +} + +/** + * Display the MSN address of the author of the current post. + * + * @since 0.71 + * @deprecated 2.8 + * @deprecated Use the_author_meta('msn') + * @see the_author_meta() + */ +function the_author_msn() { + _deprecated_function( __FUNCTION__, '2.8', 'the_author_meta(\'msn\')' ); + the_author_meta('msn'); +} + +/** + * Retrieve the AIM address of the author of the current post. + * + * @since 1.5 + * @deprecated 2.8 + * @deprecated Use get_the_author_meta('aim') + * @see get_the_author_meta() + * + * @return string The author's AIM address. + */ +function get_the_author_aim() { + _deprecated_function( __FUNCTION__, '2.8', 'get_the_author_meta(\'aim\')' ); + return get_the_author_meta('aim'); +} + +/** + * Display the AIM address of the author of the current post. + * + * @since 0.71 + * @see the_author_meta() + * @deprecated 2.8 + * @deprecated Use the_author_meta('aim') + */ +function the_author_aim() { + _deprecated_function( __FUNCTION__, '2.8', 'the_author_meta(\'aim\')' ); + the_author_meta('aim'); +} + +/** + * Retrieve the specified author's preferred display name. + * + * @since 1.0.0 + * @deprecated 2.8 + * @deprecated Use get_the_author_meta('display_name') + * @see get_the_author_meta() + * + * @param int $auth_id The ID of the author. + * @return string The author's display name. + */ +function get_author_name( $auth_id = false ) { + _deprecated_function( __FUNCTION__, '2.8', 'get_the_author_meta(\'display_name\')' ); + return get_the_author_meta('display_name', $auth_id); +} + +/** + * Retrieve the URL to the home page of the author of the current post. + * + * @since 1.5 + * @deprecated 2.8 + * @deprecated Use get_the_author_meta('url') + * @see get_the_author_meta() + * + * @return string The URL to the author's page. + */ +function get_the_author_url() { + _deprecated_function( __FUNCTION__, '2.8', 'get_the_author_meta(\'url\')' ); + return get_the_author_meta('url'); +} + +/** + * Display the URL to the home page of the author of the current post. + * + * @since 0.71 + * @deprecated 2.8 + * @deprecated Use the_author_meta('url') + * @see the_author_meta() + */ +function the_author_url() { + _deprecated_function( __FUNCTION__, '2.8', 'the_author_meta(\'url\')' ); + the_author_meta('url'); +} + +/** + * Retrieve the ID of the author of the current post. + * + * @since 1.5 + * @deprecated 2.8 + * @deprecated Use get_the_author_meta('ID') + * @see get_the_author_meta() + * + * @return int The author's ID. + */ +function get_the_author_ID() { + _deprecated_function( __FUNCTION__, '2.8', 'get_the_author_meta(\'ID\')' ); + return get_the_author_meta('ID'); +} + +/** + * Display the ID of the author of the current post. + * + * @since 0.71 + * @deprecated 2.8 + * @deprecated Use the_author_meta('ID') + * @see the_author_meta() +*/ +function the_author_ID() { + _deprecated_function( __FUNCTION__, '2.8', 'the_author_meta(\'ID\')' ); + the_author_meta('ID'); +} + +/** + * Display the post content for the feed. + * + * For encoding the html or the $encode_html parameter, there are three possible + * values. '0' will make urls footnotes and use make_url_footnote(). '1' will + * encode special characters and automatically display all of the content. The + * value of '2' will strip all HTML tags from the content. + * + * Also note that you cannot set the amount of words and not set the html + * encoding. If that is the case, then the html encoding will default to 2, + * which will strip all HTML tags. + * + * To restrict the amount of words of the content, you can use the cut + * parameter. If the content is less than the amount, then there won't be any + * dots added to the end. If there is content left over, then dots will be added + * and the rest of the content will be removed. + * + * @package WordPress + * @subpackage Feed + * @since 0.71 + * @uses apply_filters() Calls 'the_content_rss' on the content before processing. + * @see get_the_content() For the $more_link_text, $stripteaser, and $more_file + * parameters. + * + * @deprecated 2.9.0 + * @deprecated Use the_content_feed() + * @see the_content_feed() + * + * @param string $more_link_text Optional. Text to display when more content is available but not displayed. + * @param int|bool $stripteaser Optional. Default is 0. + * @param string $more_file Optional. + * @param int $cut Optional. Amount of words to keep for the content. + * @param int $encode_html Optional. How to encode the content. + */ +function the_content_rss($more_link_text='(more...)', $stripteaser=0, $more_file='', $cut = 0, $encode_html = 0) { + _deprecated_function( __FUNCTION__, '2.9', 'the_content_feed' ); + $content = get_the_content($more_link_text, $stripteaser, $more_file); + $content = apply_filters('the_content_rss', $content); + if ( $cut && !$encode_html ) + $encode_html = 2; + if ( 1== $encode_html ) { + $content = esc_html($content); + $cut = 0; + } elseif ( 0 == $encode_html ) { + $content = make_url_footnote($content); + } elseif ( 2 == $encode_html ) { + $content = strip_tags($content); + } + if ( $cut ) { + $blah = explode(' ', $content); + if ( count($blah) > $cut ) { + $k = $cut; + $use_dotdotdot = 1; + } else { + $k = count($blah); + $use_dotdotdot = 0; + } + + /** @todo Check performance, might be faster to use array slice instead. */ + for ( $i=0; $i<$k; $i++ ) + $excerpt .= $blah[$i].' '; + $excerpt .= ($use_dotdotdot) ? '...' : ''; + $content = $excerpt; + } + $content = str_replace(']]>', ']]>', $content); + echo $content; +} + +/** + * Strip HTML and put links at the bottom of stripped content. + * + * Searches for all of the links, strips them out of the content, and places + * them at the bottom of the content with numbers. + * + * @since 0.71 + * @deprecated 2.9.0 + * + * @param string $content Content to get links + * @return string HTML stripped out of content with links at the bottom. + */ +function make_url_footnote( $content ) { + _deprecated_function( __FUNCTION__, '2.9', '' ); + preg_match_all( '/(.+?)<\/a>/', $content, $matches ); + $links_summary = "\n"; + for ( $i=0; $ipost_type) || !$url = wp_get_attachment_url($_post->ID) ) + return __('Missing Attachment'); + + if ( $permalink ) + $url = get_attachment_link($_post->ID); + + $post_title = esc_attr($_post->post_title); + + $innerHTML = get_attachment_innerHTML($_post->ID, $fullsize, $max_dims); + return "$innerHTML"; +} + +/** + * Retrieve icon URL and Path. + * + * @since 2.1.0 + * @deprecated 2.5.0 + * @deprecated Use wp_get_attachment_image_src() + * @see wp_get_attachment_image_src() + * + * @param int $id Optional. Post ID. + * @param bool $fullsize Optional, default to false. Whether to have full image. + * @return array Icon URL and full path to file, respectively. + */ +function get_attachment_icon_src( $id = 0, $fullsize = false ) { + _deprecated_function( __FUNCTION__, '2.5', 'wp_get_attachment_image_src()' ); + $id = (int) $id; + if ( !$post = & get_post($id) ) + return false; + + $file = get_attached_file( $post->ID ); + + if ( !$fullsize && $src = wp_get_attachment_thumb_url( $post->ID ) ) { + // We have a thumbnail desired, specified and existing + + $src_file = basename($src); + $class = 'attachmentthumb'; + } elseif ( wp_attachment_is_image( $post->ID ) ) { + // We have an image without a thumbnail + + $src = wp_get_attachment_url( $post->ID ); + $src_file = & $file; + $class = 'attachmentimage'; + } elseif ( $src = wp_mime_type_icon( $post->ID ) ) { + // No thumb, no image. We'll look for a mime-related icon instead. + + $icon_dir = apply_filters( 'icon_dir', get_template_directory() . '/images' ); + $src_file = $icon_dir . '/' . basename($src); + } + + if ( !isset($src) || !$src ) + return false; + + return array($src, $src_file); +} + +/** + * Retrieve HTML content of icon attachment image element. + * + * @since 2.0.0 + * @deprecated 2.5.0 + * @deprecated Use wp_get_attachment_image() + * @see wp_get_attachment_image() + * + * @param int $id Optional. Post ID. + * @param bool $fullsize Optional, default to false. Whether to have full size image. + * @param array $max_dims Optional. Dimensions of image. + * @return string HTML content. + */ +function get_attachment_icon( $id = 0, $fullsize = false, $max_dims = false ) { + _deprecated_function( __FUNCTION__, '2.5', 'wp_get_attachment_image()' ); + $id = (int) $id; + if ( !$post = & get_post($id) ) + return false; + + if ( !$src = get_attachment_icon_src( $post->ID, $fullsize ) ) + return false; + + list($src, $src_file) = $src; + + // Do we need to constrain the image? + if ( ($max_dims = apply_filters('attachment_max_dims', $max_dims)) && file_exists($src_file) ) { + + $imagesize = getimagesize($src_file); + + if (($imagesize[0] > $max_dims[0]) || $imagesize[1] > $max_dims[1] ) { + $actual_aspect = $imagesize[0] / $imagesize[1]; + $desired_aspect = $max_dims[0] / $max_dims[1]; + + if ( $actual_aspect >= $desired_aspect ) { + $height = $actual_aspect * $max_dims[0]; + $constraint = "width='{$max_dims[0]}' "; + $post->iconsize = array($max_dims[0], $height); + } else { + $width = $max_dims[1] / $actual_aspect; + $constraint = "height='{$max_dims[1]}' "; + $post->iconsize = array($width, $max_dims[1]); + } + } else { + $post->iconsize = array($imagesize[0], $imagesize[1]); + $constraint = ''; + } + } else { + $constraint = ''; + } + + $post_title = esc_attr($post->post_title); + + $icon = "$post_title"; + + return apply_filters( 'attachment_icon', $icon, $post->ID ); +} + +/** + * Retrieve HTML content of image element. + * + * @since 2.0.0 + * @deprecated 2.5.0 + * @deprecated Use wp_get_attachment_image() + * @see wp_get_attachment_image() + * + * @param int $id Optional. Post ID. + * @param bool $fullsize Optional, default to false. Whether to have full size image. + * @param array $max_dims Optional. Dimensions of image. + * @return string + */ +function get_attachment_innerHTML($id = 0, $fullsize = false, $max_dims = false) { + _deprecated_function( __FUNCTION__, '2.5', 'wp_get_attachment_image()' ); + $id = (int) $id; + if ( !$post = & get_post($id) ) + return false; + + if ( $innerHTML = get_attachment_icon($post->ID, $fullsize, $max_dims)) + return $innerHTML; + + + $innerHTML = esc_attr($post->post_title); + + return apply_filters('attachment_innerHTML', $innerHTML, $post->ID); +} + +/** + * Retrieve bookmark data based on ID. + * + * @since 2.0.0 + * @deprecated 2.1.0 + * @deprecated Use get_bookmark() + * @see get_bookmark() + * + * @param int $bookmark_id ID of link + * @param string $output OBJECT, ARRAY_N, or ARRAY_A + * @return object|array + */ +function get_link($bookmark_id, $output = OBJECT, $filter = 'raw') { + _deprecated_function( __FUNCTION__, '2.1', 'get_bookmark()' ); + return get_bookmark($bookmark_id, $output, $filter); +} + +/** + * Performs esc_url() for database or redirect usage. + * + * @since 2.3.1 + * @deprecated 2.8.0 + * @deprecated Use esc_url_raw() + * @see esc_url_raw() + * + * @param string $url The URL to be cleaned. + * @param array $protocols An array of acceptable protocols. + * @return string The cleaned URL. + */ +function sanitize_url( $url, $protocols = null ) { + _deprecated_function( __FUNCTION__, '2.8', 'esc_url_raw()' ); + return esc_url_raw( $url, $protocols ); +} + +/** + * Checks and cleans a URL. + * + * A number of characters are removed from the URL. If the URL is for displaying + * (the default behaviour) amperstands are also replaced. The 'clean_url' filter + * is applied to the returned cleaned URL. + * + * @since 1.2.0 + * @deprecated 3.0.0 + * @deprecated Use esc_url() + * @see Alias for esc_url() + * + * @param string $url The URL to be cleaned. + * @param array $protocols Optional. An array of acceptable protocols. + * @param string $context Optional. How the URL will be used. Default is 'display'. + * @return string The cleaned $url after the 'clean_url' filter is applied. + */ +function clean_url( $url, $protocols = null, $context = 'display' ) { + if ( $context == 'db' ) + _deprecated_function( 'clean_url( $context = \'db\' )', '3.0', 'esc_url_raw()' ); + else + _deprecated_function( __FUNCTION__, '3.0', 'esc_url()' ); + return esc_url( $url, $protocols, $context ); +} + +/** + * Escape single quotes, specialchar double quotes, and fix line endings. + * + * The filter 'js_escape' is also applied by esc_js() + * + * @since 2.0.4 + * @deprecated 2.8.0 + * @deprecated Use esc_js() + * @see esc_js() + * + * @param string $text The text to be escaped. + * @return string Escaped text. + */ +function js_escape( $text ) { + _deprecated_function( __FUNCTION__, '2.8', 'esc_js()' ); + return esc_js( $text ); +} + +/** + * Escaping for HTML blocks. + * + * @deprecated 2.8.0 + * @deprecated Use esc_html() + * @see esc_html() + */ +function wp_specialchars( $string, $quote_style = ENT_NOQUOTES, $charset = false, $double_encode = false ) { + _deprecated_function( __FUNCTION__, '2.8', 'esc_html()' ); + if ( func_num_args() > 1 ) { // Maintain backwards compat for people passing additional args + $args = func_get_args(); + return call_user_func_array( '_wp_specialchars', $args ); + } else { + return esc_html( $string ); + } +} + + +/** + * Escaping for HTML attributes. + * + * @since 2.0.6 + * @deprecated 2.8.0 + * @deprecated Use esc_attr() + * @see esc_attr() + * + * @param string $text + * @return string + */ +function attribute_escape( $text ) { + _deprecated_function( __FUNCTION__, '2.8', 'esc_attr()' ); + return esc_attr( $text ); +} + +/** + * Register widget for sidebar with backwards compatibility. + * + * Allows $name to be an array that accepts either three elements to grab the + * first element and the third for the name or just uses the first element of + * the array for the name. + * + * Passes to {@link wp_register_sidebar_widget()} after argument list and + * backwards compatibility is complete. + * + * @since 2.2.0 + * @deprecated 2.8.0 + * @deprecated Use wp_register_sidebar_widget() + * @see wp_register_sidebar_widget() + * + * @param string|int $name Widget ID. + * @param callback $output_callback Run when widget is called. + * @param string $classname Classname widget option. + * @param mixed $params,... Widget parameters. + */ +function register_sidebar_widget($name, $output_callback, $classname = '') { + _deprecated_function( __FUNCTION__, '2.8', 'wp_register_sidebar_widget()' ); + // 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); +} + +/** + * Alias of {@link wp_unregister_sidebar_widget()}. + * + * @since 2.2.0 + * @deprecated 2.8.0 + * @deprecated Use wp_unregister_sidebar_widget() + * @see wp_unregister_sidebar_widget() + * + * @param int|string $id Widget ID. + */ +function unregister_sidebar_widget($id) { + _deprecated_function( __FUNCTION__, '2.8', 'wp_unregister_sidebar_widget()' ); + return wp_unregister_sidebar_widget($id); +} + +/** + * Registers widget control callback for customizing options. + * + * Allows $name to be an array that accepts either three elements to grab the + * first element and the third for the name or just uses the first element of + * the array for the name. + * + * Passes to {@link wp_register_widget_control()} after the argument list has + * been compiled. + * + * @since 2.2.0 + * @deprecated 2.8.0 + * @deprecated Use wp_register_widget_control() + * @see wp_register_widget_control() + * + * @param int|string $name Sidebar ID. + * @param callback $control_callback Widget control callback to display and process form. + * @param int $width Widget width. + * @param int $height Widget height. + */ +function register_widget_control($name, $control_callback, $width = '', $height = '') { + _deprecated_function( __FUNCTION__, '2.8', 'wp_register_widget_control()' ); + // 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); +} + +/** + * Alias of {@link wp_unregister_widget_control()}. + * + * @since 2.2.0 + * @deprecated 2.8.0 + * @deprecated Use wp_unregister_widget_control() + * @see wp_unregister_widget_control() + * + * @param int|string $id Widget ID. + */ +function unregister_widget_control($id) { + _deprecated_function( __FUNCTION__, '2.8', 'wp_unregister_widget_control()' ); + return wp_unregister_widget_control($id); +} + +/** + * Remove user meta data. + * + * @since 2.0.0 + * @deprecated 3.0.0 + * @deprecated Use delete_user_meta() + * @see delete_user_meta() + * + * @param int $user_id User ID. + * @param string $meta_key Metadata key. + * @param mixed $meta_value Metadata value. + * @return bool True deletion completed and false if user_id is not a number. + */ +function delete_usermeta( $user_id, $meta_key, $meta_value = '' ) { + _deprecated_function( __FUNCTION__, '3.0', 'delete_user_meta()' ); + global $wpdb; + if ( !is_numeric( $user_id ) ) + return false; + $meta_key = preg_replace('|[^a-z0-9_]|i', '', $meta_key); + + if ( is_array($meta_value) || is_object($meta_value) ) + $meta_value = serialize($meta_value); + $meta_value = trim( $meta_value ); + + $cur = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $meta_key) ); + + if ( $cur && $cur->umeta_id ) + do_action( 'delete_usermeta', $cur->umeta_id, $user_id, $meta_key, $meta_value ); + + if ( ! empty($meta_value) ) + $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s AND meta_value = %s", $user_id, $meta_key, $meta_value) ); + else + $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $meta_key) ); + + clean_user_cache( $user_id ); + wp_cache_delete( $user_id, 'user_meta' ); + + if ( $cur && $cur->umeta_id ) + do_action( 'deleted_usermeta', $cur->umeta_id, $user_id, $meta_key, $meta_value ); + + return true; +} + +/** + * Retrieve user metadata. + * + * If $user_id is not a number, then the function will fail over with a 'false' + * boolean return value. Other returned values depend on whether there is only + * one item to be returned, which be that single item type. If there is more + * than one metadata value, then it will be list of metadata values. + * + * @since 2.0.0 + * @deprecated 3.0.0 + * @deprecated Use get_user_meta() + * @see get_user_meta() + * + * @param int $user_id User ID + * @param string $meta_key Optional. Metadata key. + * @return mixed + */ +function get_usermeta( $user_id, $meta_key = '' ) { + _deprecated_function( __FUNCTION__, '3.0', 'get_user_meta()' ); + global $wpdb; + $user_id = (int) $user_id; + + if ( !$user_id ) + return false; + + if ( !empty($meta_key) ) { + $meta_key = preg_replace('|[^a-z0-9_]|i', '', $meta_key); + $user = wp_cache_get($user_id, 'users'); + // Check the cached user object + if ( false !== $user && isset($user->$meta_key) ) + $metas = array($user->$meta_key); + else + $metas = $wpdb->get_col( $wpdb->prepare("SELECT meta_value FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $meta_key) ); + } else { + $metas = $wpdb->get_col( $wpdb->prepare("SELECT meta_value FROM $wpdb->usermeta WHERE user_id = %d", $user_id) ); + } + + if ( empty($metas) ) { + if ( empty($meta_key) ) + return array(); + else + return ''; + } + + $metas = array_map('maybe_unserialize', $metas); + + if ( count($metas) == 1 ) + return $metas[0]; + else + return $metas; +} + +/** + * Update metadata of user. + * + * There is no need to serialize values, they will be serialized if it is + * needed. The metadata key can only be a string with underscores. All else will + * be removed. + * + * Will remove the metadata, if the meta value is empty. + * + * @since 2.0.0 + * @deprecated 3.0.0 + * @deprecated Use update_user_meta() + * @see update_user_meta() + * + * @param int $user_id User ID + * @param string $meta_key Metadata key. + * @param mixed $meta_value Metadata value. + * @return bool True on successful update, false on failure. + */ +function update_usermeta( $user_id, $meta_key, $meta_value ) { + _deprecated_function( __FUNCTION__, '3.0', 'update_user_meta()' ); + global $wpdb; + if ( !is_numeric( $user_id ) ) + return false; + $meta_key = preg_replace('|[^a-z0-9_]|i', '', $meta_key); + + /** @todo Might need fix because usermeta data is assumed to be already escaped */ + if ( is_string($meta_value) ) + $meta_value = stripslashes($meta_value); + $meta_value = maybe_serialize($meta_value); + + if (empty($meta_value)) { + return delete_usermeta($user_id, $meta_key); + } + + $cur = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $meta_key) ); + + if ( $cur ) + do_action( 'update_usermeta', $cur->umeta_id, $user_id, $meta_key, $meta_value ); + + if ( !$cur ) + $wpdb->insert($wpdb->usermeta, compact('user_id', 'meta_key', 'meta_value') ); + else if ( $cur->meta_value != $meta_value ) + $wpdb->update($wpdb->usermeta, compact('meta_value'), compact('user_id', 'meta_key') ); + else + return false; + + clean_user_cache( $user_id ); + wp_cache_delete( $user_id, 'user_meta' ); + + if ( !$cur ) + do_action( 'added_usermeta', $wpdb->insert_id, $user_id, $meta_key, $meta_value ); + else + do_action( 'updated_usermeta', $cur->umeta_id, $user_id, $meta_key, $meta_value ); + + return true; +} + +/** + * Get users for the blog. + * + * For setups that use the multi-blog feature. Can be used outside of the + * multi-blog feature. + * + * @since 2.2.0 + * @deprecated 3.1.0 + * @uses $wpdb WordPress database object for queries + * @uses $blog_id The Blog id of the blog for those that use more than one blog + * + * @param int $id Blog ID. + * @return array List of users that are part of that Blog ID + */ +function get_users_of_blog( $id = '' ) { + _deprecated_function( __FUNCTION__, '3.1', 'get_users()' ); + + global $wpdb, $blog_id; + if ( empty($id) ) + $id = (int) $blog_id; + $blog_prefix = $wpdb->get_blog_prefix($id); + $users = $wpdb->get_results( "SELECT user_id, user_id AS ID, user_login, display_name, user_email, meta_value FROM $wpdb->users, $wpdb->usermeta WHERE {$wpdb->users}.ID = {$wpdb->usermeta}.user_id AND meta_key = '{$blog_prefix}capabilities' ORDER BY {$wpdb->usermeta}.user_id" ); + return $users; +} + +/** + * Enable/disable automatic general feed link outputting. + * + * @since 2.8.0 + * @deprecated 3.0.0 + * @deprecated Use add_theme_support( 'automatic-feed-links' ) + * + * @param boolean $add Optional, default is true. Add or remove links. Defaults to true. + */ +function automatic_feed_links( $add = true ) { + _deprecated_function( __FUNCTION__, '3.0', "add_theme_support( 'automatic-feed-links' )" ); + + if ( $add ) + add_theme_support( 'automatic-feed-links' ); + else + remove_action( 'wp_head', 'feed_links_extra', 3 ); // Just do this yourself in 3.0+ +} + +/** + * Retrieve user data based on field. + * + * @since 1.5.0 + * @deprecated 3.0.0 + * @deprecated Use get_the_author_meta() + * @see get_the_author_meta() + */ +function get_profile( $field, $user = false ) { + _deprecated_function( __FUNCTION__, '3.0', 'get_the_author_meta()' ); + if ( $user ) { + $user = get_user_by( 'login', $user ); + $user = $user->ID; + } + return get_the_author_meta( $field, $user ); +} + +/** + * Number of posts user has written. + * + * @since 0.71 + * @deprecated 3.0.0 + * @deprecated Use count_user_posts() + * @see count_user_posts() + */ +function get_usernumposts( $userid ) { + _deprecated_function( __FUNCTION__, '3.0', 'count_user_posts()' ); + return count_user_posts( $userid ); +} + +/** + * Callback used to change %uXXXX to &#YYY; syntax + * + * @since 2.8.0 + * @access private + * @deprecated 3.0.0 + * + * @param array $matches Single Match + * @return string An HTML entity + */ +function funky_javascript_callback($matches) { + return "&#".base_convert($matches[1],16,10).";"; +} + +/** + * Fixes javascript bugs in browsers. + * + * Converts unicode characters to HTML numbered entities. + * + * @since 1.5.0 + * @uses $is_macIE + * @uses $is_winIE + * @deprecated 3.0.0 + * + * @param string $text Text to be made safe. + * @return string Fixed text. + */ +function funky_javascript_fix($text) { + _deprecated_function( __FUNCTION__, '3.0' ); + // Fixes for browsers' javascript bugs + global $is_macIE, $is_winIE; + + if ( $is_winIE || $is_macIE ) + $text = preg_replace_callback("/\%u([0-9A-F]{4,4})/", + "funky_javascript_callback", + $text); + + return $text; +} + +/** + * Checks that the taxonomy name exists. + * + * @since 2.3.0 + * @deprecated 3.0.0 + * @deprecated Use taxonomy_exists() + * @see taxonomy_exists() + * + * @param string $taxonomy Name of taxonomy object + * @return bool Whether the taxonomy exists. + */ +function is_taxonomy( $taxonomy ) { + _deprecated_function( __FUNCTION__, '3.0', 'taxonomy_exists()' ); + return taxonomy_exists( $taxonomy ); +} + +/** + * Check if Term exists. + * + * @since 2.3.0 + * @deprecated 3.0.0 + * @deprecated Use term_exists() + * @see term_exists() + * + * @param int|string $term The term to check + * @param string $taxonomy The taxonomy name to use + * @param int $parent ID of parent term under which to confine the exists search. + * @return mixed Get the term id or Term Object, if exists. + */ +function is_term( $term, $taxonomy = '', $parent = 0 ) { + _deprecated_function( __FUNCTION__, '3.0', 'term_exists()' ); + return term_exists( $term, $taxonomy, $parent ); +} + +/** + * Is the current admin page generated by a plugin? + * + * @since 1.5.0 + * @deprecated 3.1 + * @deprecated Use global $plugin_page and/or get_plugin_page_hookname() hooks. + * + * @global $plugin_page + * + * @return bool + */ +function is_plugin_page() { + _deprecated_function( __FUNCTION__, '3.1' ); + + global $plugin_page; + + if ( isset($plugin_page) ) + return true; + + return false; +} + +/** + * 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 + * @deprecated 3.1 + * + * @return bool Always return True + */ +function update_category_cache() { + _deprecated_function( __FUNCTION__, '3.1' ); + + return true; +} + +/** + * Check for PHP timezone support + * + * @since 2.9.0 + * @deprecated 3.2 + * + * @return bool + */ +function wp_timezone_supported() { + _deprecated_function( __FUNCTION__, '3.2' ); + + return true; +} diff --git a/src/wp-includes/feed-atom-comments.php b/src/wp-includes/feed-atom-comments.php new file mode 100644 index 0000000..e4a39d8 --- /dev/null +++ b/src/wp-includes/feed-atom-comments.php @@ -0,0 +1,87 @@ +'; +?> + +> + <?php + if ( is_singular() ) + printf(ent2ncr(__('Comments on %s')), get_the_title_rss()); + elseif ( is_search() ) + printf(ent2ncr(__('Comments for %1$s searching on %2$s')), get_bloginfo_rss( 'name' ), get_search_query() ); + else + printf(ent2ncr(__('Comments for %s')), get_bloginfo_rss( 'name' ) . get_wp_title_rss()); + ?> + + + + + + + + + + + + + + + + + + +comment_post_ID); + get_post_custom($comment_post->ID); +?> + + <?php + if ( !is_singular() ) { + $title = get_the_title($comment_post->ID); + $title = apply_filters('the_title_rss', $title); + printf(ent2ncr(__('Comment on %1$s by %2$s')), $title, get_comment_author_rss()); + } else { + printf(ent2ncr(__('By: %s')), get_comment_author_rss()); + } + ?> + + + + + ' . get_comment_author_url() . ''; ?> + + + + + + + + ]]> + + ]]> +comment_parent == 0 ) : // This comment is top level ?> + +comment_parent); + // The rel attribute below and the id tag above should be GUIDs, but WP doesn't create them for comments (unlike posts). Either way, its more important that they both use the same system +?> + +comment_ID, $comment_post->ID); +?> + + + diff --git a/src/wp-includes/feed-atom.php b/src/wp-includes/feed-atom.php new file mode 100644 index 0000000..db8d66b --- /dev/null +++ b/src/wp-includes/feed-atom.php @@ -0,0 +1,55 @@ +'; ?> + + > + <?php bloginfo_rss('name'); wp_title_rss(); ?> + + + + + + + + + + + + + + + + + + <![CDATA[<?php the_title_rss() ?>]]> + + + + + + ]]> + + ]]> + + + + + + + + + diff --git a/src/wp-includes/feed-rdf.php b/src/wp-includes/feed-rdf.php new file mode 100644 index 0000000..3a0daf1 --- /dev/null +++ b/src/wp-includes/feed-rdf.php @@ -0,0 +1,54 @@ +'; ?> + +> +"> + <?php bloginfo_rss('name'); wp_title_rss(); ?> + + + + + + 2000-01-01T12:00+00:00 + + + + + + + + + + + + <?php the_title_rss() ?> + + post_date_gmt, false); ?> + + + + + + + ]]> + + + + + diff --git a/src/wp-includes/feed-rss.php b/src/wp-includes/feed-rss.php new file mode 100644 index 0000000..b26897d --- /dev/null +++ b/src/wp-includes/feed-rss.php @@ -0,0 +1,31 @@ +'; ?> + + + <?php bloginfo_rss('name'); wp_title_rss(); ?> + + + + http://backend.userland.com/rss092 + + + + + + <?php the_title_rss() ?> + ]]> + + + + + + diff --git a/src/wp-includes/feed-rss2-comments.php b/src/wp-includes/feed-rss2-comments.php new file mode 100644 index 0000000..74715b8 --- /dev/null +++ b/src/wp-includes/feed-rss2-comments.php @@ -0,0 +1,66 @@ +'; +?> + + > + + <?php + if ( is_singular() ) + printf(ent2ncr(__('Comments on: %s')), get_the_title_rss()); + elseif ( is_search() ) + printf(ent2ncr(__('Comments for %s searching on %s')), get_bloginfo_rss( 'name' ), esc_attr($wp_query->query_vars['s'])); + else + printf(ent2ncr(__('Comments for %s')), get_bloginfo_rss( 'name' ) . get_wp_title_rss()); + ?> + + + + + + + +comment_post_ID); + get_post_custom($comment_post->ID); +?> + + <?php + if ( !is_singular() ) { + $title = get_the_title($comment_post->ID); + $title = apply_filters('the_title_rss', $title); + printf(ent2ncr(__('Comment on %1$s by %2$s')), $title, get_comment_author_rss()); + } else { + printf(ent2ncr(__('By: %s')), get_comment_author_rss()); + } + ?> + + + + + + + ]]> + + + ]]> +comment_ID, $comment_post->ID); +?> + + + + diff --git a/src/wp-includes/feed-rss2.php b/src/wp-includes/feed-rss2.php new file mode 100644 index 0000000..5bf67f2 --- /dev/null +++ b/src/wp-includes/feed-rss2.php @@ -0,0 +1,60 @@ +'; ?> + + +> + + + <?php bloginfo_rss('name'); wp_title_rss(); ?> + + + + + + + + + + + <?php the_title_rss() ?> + + + + + + + + + ]]> + + ]]> + post_content ) > 0 ) : ?> + ]]> + + ]]> + + + + + + + + + + diff --git a/src/wp-includes/feed.php b/src/wp-includes/feed.php new file mode 100644 index 0000000..b94e347 --- /dev/null +++ b/src/wp-includes/feed.php @@ -0,0 +1,546 @@ +get_error_message(); + $title = apply_filters('get_wp_title_rss', $title); + return $title; +} + +/** + * Display the blog title for display of the feed title. + * + * @package WordPress + * @subpackage Feed + * @since 2.2.0 + * @uses apply_filters() Calls 'wp_title_rss' on the blog title. + * @see wp_title() $sep parameter usage. + * + * @param string $sep Optional. + */ +function wp_title_rss($sep = '»') { + echo apply_filters('wp_title_rss', get_wp_title_rss($sep)); +} + +/** + * Retrieve the current post title for the feed. + * + * @package WordPress + * @subpackage Feed + * @since 2.0.0 + * @uses apply_filters() Calls 'the_title_rss' on the post title. + * + * @return string Current post title. + */ +function get_the_title_rss() { + $title = get_the_title(); + $title = apply_filters('the_title_rss', $title); + return $title; +} + +/** + * Display the post title in the feed. + * + * @package WordPress + * @subpackage Feed + * @since 0.71 + * @uses get_the_title_rss() Used to retrieve current post title. + */ +function the_title_rss() { + echo get_the_title_rss(); +} + +/** + * Retrieve the post content for feeds. + * + * @package WordPress + * @subpackage Feed + * @since 2.9.0 + * @uses apply_filters() Calls 'the_content_feed' on the content before processing. + * @see get_the_content() + * + * @param string $feed_type The type of feed. rss2 | atom | rss | rdf + */ +function get_the_content_feed($feed_type = null) { + if ( !$feed_type ) + $feed_type = get_default_feed(); + + $content = apply_filters('the_content', get_the_content()); + $content = str_replace(']]>', ']]>', $content); + return apply_filters('the_content_feed', $content, $feed_type); +} + +/** + * Display the post content for feeds. + * + * @package WordPress + * @subpackage Feed + * @since 2.9.0 + * @uses apply_filters() Calls 'the_content_feed' on the content before processing. + * @see get_the_content() + * + * @param string $feed_type The type of feed. rss2 | atom | rss | rdf + */ +function the_content_feed($feed_type = null) { + echo get_the_content_feed($feed_type); +} + +/** + * Display the post excerpt for the feed. + * + * @package WordPress + * @subpackage Feed + * @since 0.71 + * @uses apply_filters() Calls 'the_excerpt_rss' hook on the excerpt. + */ +function the_excerpt_rss() { + $output = get_the_excerpt(); + echo apply_filters('the_excerpt_rss', $output); +} + +/** + * Display the permalink to the post for use in feeds. + * + * @package WordPress + * @subpackage Feed + * @since 2.3.0 + * @uses apply_filters() Call 'the_permalink_rss' on the post permalink + */ +function the_permalink_rss() { + echo esc_url( apply_filters('the_permalink_rss', get_permalink() )); +} + +/** + * Outputs the link to the comments for the current post in an xml safe way + * + * @since 3.0.0 + * @return none + */ +function comments_link_feed() { + echo esc_url( get_comments_link() ); +} + +/** + * Display the feed GUID for the current comment. + * + * @package WordPress + * @subpackage Feed + * @since 2.5.0 + * + * @param int|object $comment_id Optional comment object or id. Defaults to global comment object. + */ +function comment_guid($comment_id = null) { + echo esc_url( get_comment_guid($comment_id) ); +} + +/** + * Retrieve the feed GUID for the current comment. + * + * @package WordPress + * @subpackage Feed + * @since 2.5.0 + * + * @param int|object $comment_id Optional comment object or id. Defaults to global comment object. + * @return bool|string false on failure or guid for comment on success. + */ +function get_comment_guid($comment_id = null) { + $comment = get_comment($comment_id); + + if ( !is_object($comment) ) + return false; + + return get_the_guid($comment->comment_post_ID) . '#comment-' . $comment->comment_ID; +} + +/** + * Display the link to the comments. + * + * @since 1.5.0 + */ +function comment_link() { + echo esc_url( get_comment_link() ); +} + +/** + * Retrieve the current comment author for use in the feeds. + * + * @package WordPress + * @subpackage Feed + * @since 2.0.0 + * @uses apply_filters() Calls 'comment_author_rss' hook on comment author. + * @uses get_comment_author() + * + * @return string Comment Author + */ +function get_comment_author_rss() { + return apply_filters('comment_author_rss', get_comment_author() ); +} + +/** + * Display the current comment author in the feed. + * + * @package WordPress + * @subpackage Feed + * @since 1.0.0 + */ +function comment_author_rss() { + echo get_comment_author_rss(); +} + +/** + * Display the current comment content for use in the feeds. + * + * @package WordPress + * @subpackage Feed + * @since 1.0.0 + * @uses apply_filters() Calls 'comment_text_rss' filter on comment content. + * @uses get_comment_text() + */ +function comment_text_rss() { + $comment_text = get_comment_text(); + $comment_text = apply_filters('comment_text_rss', $comment_text); + echo $comment_text; +} + +/** + * Retrieve all of the post categories, formatted for use in feeds. + * + * All of the categories for the current post in the feed loop, will be + * retrieved and have feed markup added, so that they can easily be added to the + * RSS2, Atom, or RSS1 and RSS0.91 RDF feeds. + * + * @package WordPress + * @subpackage Feed + * @since 2.1.0 + * @uses apply_filters() + * + * @param string $type Optional, default is the type returned by get_default_feed(). + * @return string All of the post categories for displaying in the feed. + */ +function get_the_category_rss($type = null) { + if ( empty($type) ) + $type = get_default_feed(); + $categories = get_the_category(); + $tags = get_the_tags(); + $the_list = ''; + $cat_names = array(); + + $filter = 'rss'; + if ( 'atom' == $type ) + $filter = 'raw'; + + if ( !empty($categories) ) foreach ( (array) $categories as $category ) { + $cat_names[] = sanitize_term_field('name', $category->name, $category->term_id, 'category', $filter); + } + + if ( !empty($tags) ) foreach ( (array) $tags as $tag ) { + $cat_names[] = sanitize_term_field('name', $tag->name, $tag->term_id, 'post_tag', $filter); + } + + $cat_names = array_unique($cat_names); + + foreach ( $cat_names as $cat_name ) { + if ( 'rdf' == $type ) + $the_list .= "\t\t\n"; + elseif ( 'atom' == $type ) + $the_list .= sprintf( '', esc_attr( apply_filters( 'get_bloginfo_rss', get_bloginfo( 'url' ) ) ), esc_attr( $cat_name ) ); + else + $the_list .= "\t\t\n"; + } + + return apply_filters('the_category_rss', $the_list, $type); +} + +/** + * Display the post categories in the feed. + * + * @package WordPress + * @subpackage Feed + * @since 0.71 + * @see get_the_category_rss() For better explanation. + * + * @param string $type Optional, default is the type returned by get_default_feed(). + */ +function the_category_rss($type = null) { + echo get_the_category_rss($type); +} + +/** + * Display the HTML type based on the blog setting. + * + * The two possible values are either 'xhtml' or 'html'. + * + * @package WordPress + * @subpackage Feed + * @since 2.2.0 + */ +function html_type_rss() { + $type = get_bloginfo('html_type'); + if (strpos($type, 'xhtml') !== false) + $type = 'xhtml'; + else + $type = 'html'; + echo $type; +} + +/** + * Display the rss enclosure for the current post. + * + * Uses the global $post to check whether the post requires a password and if + * the user has the password for the post. If not then it will return before + * displaying. + * + * Also uses the function get_post_custom() to get the post's 'enclosure' + * metadata field and parses the value to display the enclosure(s). The + * enclosure(s) consist of enclosure HTML tag(s) with a URI and other + * attributes. + * + * @package WordPress + * @subpackage Template + * @since 1.5.0 + * @uses apply_filters() Calls 'rss_enclosure' hook on rss enclosure. + * @uses get_post_custom() To get the current post enclosure metadata. + */ +function rss_enclosure() { + if ( post_password_required() ) + return; + + foreach ( (array) get_post_custom() as $key => $val) { + if ($key == 'enclosure') { + foreach ( (array) $val as $enc ) { + $enclosure = explode("\n", $enc); + + //only get the the first element eg, audio/mpeg from 'audio/mpeg mpga mp2 mp3' + $t = preg_split('/[ \t]/', trim($enclosure[2]) ); + $type = $t[0]; + + echo apply_filters('rss_enclosure', '' . "\n"); + } + } + } +} + +/** + * Display the atom enclosure for the current post. + * + * Uses the global $post to check whether the post requires a password and if + * the user has the password for the post. If not then it will return before + * displaying. + * + * Also uses the function get_post_custom() to get the post's 'enclosure' + * metadata field and parses the value to display the enclosure(s). The + * enclosure(s) consist of link HTML tag(s) with a URI and other attributes. + * + * @package WordPress + * @subpackage Template + * @since 2.2.0 + * @uses apply_filters() Calls 'atom_enclosure' hook on atom enclosure. + * @uses get_post_custom() To get the current post enclosure metadata. + */ +function atom_enclosure() { + if ( post_password_required() ) + return; + + foreach ( (array) get_post_custom() as $key => $val ) { + if ($key == 'enclosure') { + foreach ( (array) $val as $enc ) { + $enclosure = split("\n", $enc); + echo apply_filters('atom_enclosure', '' . "\n"); + } + } + } +} + +/** + * Determine the type of a string of data with the data formatted. + * + * Tell whether the type is text, html, or xhtml, per RFC 4287 section 3.1. + * + * In the case of WordPress, text is defined as containing no markup, + * xhtml is defined as "well formed", and html as tag soup (i.e., the rest). + * + * Container div tags are added to xhtml values, per section 3.1.1.3. + * + * @link http://www.atomenabled.org/developers/syndication/atom-format-spec.php#rfc.section.3.1 + * + * @package WordPress + * @subpackage Feed + * @since 2.5 + * + * @param string $data Input string + * @return array array(type, value) + */ +function prep_atom_text_construct($data) { + if (strpos($data, '<') === false && strpos($data, '&') === false) { + return array('text', $data); + } + + $parser = xml_parser_create(); + xml_parse($parser, '
            ' . $data . '
            ', true); + $code = xml_get_error_code($parser); + xml_parser_free($parser); + + if (!$code) { + if (strpos($data, '<') === false) { + return array('text', $data); + } else { + $data = "
            $data
            "; + return array('xhtml', $data); + } + } + + if (strpos($data, ']]>') == false) { + return array('html', ""); + } else { + return array('html', htmlspecialchars($data)); + } +} + +/** + * Display the link for the currently displayed feed in a XSS safe way. + * + * Generate a correct link for the atom:self element. + * + * @package WordPress + * @subpackage Feed + * @since 2.5 + */ +function self_link() { + $host = @parse_url(home_url()); + $host = $host['host']; + echo esc_url( + 'http' + . ( (isset($_SERVER['https']) && $_SERVER['https'] == 'on') ? 's' : '' ) . '://' + . $host + . stripslashes($_SERVER['REQUEST_URI']) + ); +} + +/** + * Return the content type for specified feed type. + * + * @package WordPress + * @subpackage Feed + * @since 2.8.0 + */ +function feed_content_type( $type = '' ) { + if ( empty($type) ) + $type = get_default_feed(); + + $types = array( + 'rss' => 'application/rss+xml', + 'rss2' => 'application/rss+xml', + 'rss-http' => 'text/xml', + 'atom' => 'application/atom+xml', + 'rdf' => 'application/rdf+xml' + ); + + $content_type = ( !empty($types[$type]) ) ? $types[$type] : 'application/octet-stream'; + + return apply_filters( 'feed_content_type', $content_type, $type ); +} + +/** + * Build SimplePie object based on RSS or Atom feed from URL. + * + * @since 2.8 + * + * @param string $url URL to retrieve feed + * @return WP_Error|SimplePie WP_Error object on failure or SimplePie object on success + */ +function fetch_feed($url) { + require_once (ABSPATH . WPINC . '/class-feed.php'); + + $feed = new SimplePie(); + $feed->set_feed_url($url); + $feed->set_cache_class('WP_Feed_Cache'); + $feed->set_file_class('WP_SimplePie_File'); + $feed->set_cache_duration(apply_filters('wp_feed_cache_transient_lifetime', 43200, $url)); + do_action_ref_array( 'wp_feed_options', array( &$feed, $url ) ); + $feed->init(); + $feed->handle_content_type(); + + if ( $feed->error() ) + return new WP_Error('simplepie-error', $feed->error()); + + return $feed; +} diff --git a/src/wp-includes/formatting.php b/src/wp-includes/formatting.php new file mode 100644 index 0000000..82a1b9b --- /dev/null +++ b/src/wp-includes/formatting.php @@ -0,0 +1,2926 @@ + + * 'cause today's effort makes it worth tomorrow's "holiday"... + * + * Becomes: + * + * ’cause today’s effort makes it worth tomorrow’s “holiday”… + * + * Code within certain html blocks are skipped. + * + * @since 0.71 + * @uses $wp_cockneyreplace Array of formatted entities for certain common phrases + * + * @param string $text The text to be formatted + * @return string The string replaced with html entities + */ +function wptexturize($text) { + global $wp_cockneyreplace; + static $opening_quote, $closing_quote, $default_no_texturize_tags, $default_no_texturize_shortcodes, $static_characters, $static_replacements, $dynamic_characters, $dynamic_replacements; + + // No need to set up these static variables more than once + if ( empty( $opening_quote ) ) { + /* translators: opening curly quote */ + $opening_quote = _x('“', 'opening curly quote'); + /* translators: closing curly quote */ + $closing_quote = _x('”', 'closing curly quote'); + + $default_no_texturize_tags = array('pre', 'code', 'kbd', 'style', 'script', 'tt'); + $default_no_texturize_shortcodes = array('code'); + + // if a plugin has provided an autocorrect array, use it + if ( isset($wp_cockneyreplace) ) { + $cockney = array_keys($wp_cockneyreplace); + $cockneyreplace = array_values($wp_cockneyreplace); + } else { + $cockney = array("'tain't","'twere","'twas","'tis","'twill","'til","'bout","'nuff","'round","'cause"); + $cockneyreplace = array("’tain’t","’twere","’twas","’tis","’twill","’til","’bout","’nuff","’round","’cause"); + } + + $static_characters = array_merge(array('---', ' -- ', '--', ' - ', 'xn–', '...', '``', '\'\'', ' (tm)'), $cockney); + $static_replacements = array_merge(array('—', ' — ', '–', ' – ', 'xn--', '…', $opening_quote, $closing_quote, ' ™'), $cockneyreplace); + + $dynamic_characters = array('/\'(\d\d(?:’|\')?s)/', '/\'(\d)/', '/(\s|\A|[([{<]|")\'/', '/(\d)"/', '/(\d)\'/', '/(\S)\'([^\'\s])/', '/(\s|\A|[([{<])"(?!\s)/', '/"(\s|\S|\Z)/', '/\'([\s.]|\Z)/', '/\b(\d+)x(\d+)\b/'); + $dynamic_replacements = array('’$1','’$1', '$1‘', '$1″', '$1′', '$1’$2', '$1' . $opening_quote . '$2', $closing_quote . '$1', '’$1', '$1×$2'); + } + + // Transform into regexp sub-expression used in _wptexturize_pushpop_element + // Must do this everytime in case plugins use these filters in a context sensitive manner + $no_texturize_tags = '(' . implode('|', apply_filters('no_texturize_tags', $default_no_texturize_tags) ) . ')'; + $no_texturize_shortcodes = '(' . implode('|', apply_filters('no_texturize_shortcodes', $default_no_texturize_shortcodes) ) . ')'; + + $no_texturize_tags_stack = array(); + $no_texturize_shortcodes_stack = array(); + + $textarr = preg_split('/(<.*>|\[.*\])/Us', $text, -1, PREG_SPLIT_DELIM_CAPTURE); + + foreach ( $textarr as &$curl ) { + if ( empty( $curl ) ) + continue; + + // Only call _wptexturize_pushpop_element if first char is correct tag opening + $first = $curl[0]; + if ( '<' === $first ) { + _wptexturize_pushpop_element($curl, $no_texturize_tags_stack, $no_texturize_tags, '<', '>'); + } elseif ( '[' === $first ) { + _wptexturize_pushpop_element($curl, $no_texturize_shortcodes_stack, $no_texturize_shortcodes, '[', ']'); + } elseif ( empty($no_texturize_shortcodes_stack) && empty($no_texturize_tags_stack) ) { + // This is not a tag, nor is the texturization disabled static strings + $curl = str_replace($static_characters, $static_replacements, $curl); + // regular expressions + $curl = preg_replace($dynamic_characters, $dynamic_replacements, $curl); + } + $curl = preg_replace('/&([^#])(?![a-zA-Z1-4]{1,8};)/', '&$1', $curl); + } + return implode( '', $textarr ); +} + +/** + * Search for disabled element tags. Push element to stack on tag open and pop + * on tag close. Assumes first character of $text is tag opening. + * + * @access private + * @since 2.9.0 + * + * @param string $text Text to check. First character is assumed to be $opening + * @param array $stack Array used as stack of opened tag elements + * @param string $disabled_elements Tags to match against formatted as regexp sub-expression + * @param string $opening Tag opening character, assumed to be 1 character long + * @param string $opening Tag closing character + * @return object + */ +function _wptexturize_pushpop_element($text, &$stack, $disabled_elements, $opening = '<', $closing = '>') { + // Check if it is a closing tag -- otherwise assume opening tag + if (strncmp($opening . '/', $text, 2)) { + // Opening? Check $text+1 against disabled elements + if (preg_match('/^' . $disabled_elements . '\b/', substr($text, 1), $matches)) { + /* + * This disables texturize until we find a closing tag of our type + * (e.g.
            ) even if there was invalid nesting before that
            +			 *
            +			 * Example: in the case 
            sadsadasd"baba"
            + * "baba" won't be texturize + */ + + array_push($stack, $matches[1]); + } + } else { + // Closing? Check $text+2 against disabled elements + $c = preg_quote($closing, '/'); + if (preg_match('/^' . $disabled_elements . $c . '/', substr($text, 2), $matches)) { + $last = array_pop($stack); + + // Make sure it matches the opening tag + if ($last != $matches[1]) + array_push($stack, $last); + } + } +} + +/** + * Accepts matches array from preg_replace_callback in wpautop() or a string. + * + * Ensures that the contents of a <
            >...<
            > HTML block are not + * converted into paragraphs or line-breaks. + * + * @since 1.2.0 + * + * @param array|string $matches The array or string + * @return string The pre block without paragraph/line-break conversion. + */ +function clean_pre($matches) { + if ( is_array($matches) ) + $text = $matches[1] . $matches[2] . "
            "; + else + $text = $matches; + + $text = str_replace('
            ', '', $text); + $text = str_replace('

            ', "\n", $text); + $text = str_replace('

            ', '', $text); + + return $text; +} + +/** + * Replaces double line-breaks with paragraph elements. + * + * A group of regex replaces used to identify text formatted with newlines and + * replace double line-breaks with HTML paragraph tags. The remaining + * line-breaks after conversion become <
            > tags, unless $br is set to '0' + * or 'false'. + * + * @since 0.71 + * + * @param string $pee The text which has to be formatted. + * @param int|bool $br Optional. If set, this will convert all remaining line-breaks after paragraphing. Default true. + * @return string Text which has been converted into correct paragraph tags. + */ +function wpautop($pee, $br = 1) { + + if ( trim($pee) === '' ) + return ''; + $pee = $pee . "\n"; // just to make things a little easier, pad the end + $pee = preg_replace('|
            \s*
            |', "\n\n", $pee); + // Space things out a little + $allblocks = '(?:table|thead|tfoot|caption|col|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|option|form|map|area|blockquote|address|math|style|input|p|h[1-6]|hr|fieldset|legend|section|article|aside|hgroup|header|footer|nav|figure|figcaption|details|menu|summary)'; + $pee = preg_replace('!(<' . $allblocks . '[^>]*>)!', "\n$1", $pee); + $pee = preg_replace('!()!', "$1\n\n", $pee); + $pee = str_replace(array("\r\n", "\r"), "\n", $pee); // cross-platform newlines + if ( strpos($pee, ']*)>\s*|', "", $pee); // no pee inside object/embed + $pee = preg_replace('|\s*\s*|', '', $pee); + } + $pee = preg_replace("/\n\n+/", "\n\n", $pee); // take care of duplicates + // make paragraphs, including one at the end + $pees = preg_split('/\n\s*\n/', $pee, -1, PREG_SPLIT_NO_EMPTY); + $pee = ''; + foreach ( $pees as $tinkle ) + $pee .= '

            ' . trim($tinkle, "\n") . "

            \n"; + $pee = preg_replace('|

            \s*

            |', '', $pee); // under certain strange conditions it could create a P of entirely whitespace + $pee = preg_replace('!

            ([^<]+)!', "

            $1

            ", $pee); + $pee = preg_replace('!

            \s*(]*>)\s*

            !', "$1", $pee); // don't pee all over a tag + $pee = preg_replace("|

            (|", "$1", $pee); // problem with nested lists + $pee = preg_replace('|

            ]*)>|i', "

            ", $pee); + $pee = str_replace('

            ', '

            ', $pee); + $pee = preg_replace('!

            \s*(]*>)!', "$1", $pee); + $pee = preg_replace('!(]*>)\s*

            !', "$1", $pee); + if ($br) { + $pee = preg_replace_callback('/<(script|style).*?<\/\\1>/s', '_autop_newline_preservation_helper', $pee); + $pee = preg_replace('|(?)\s*\n|', "
            \n", $pee); // optionally make line breaks + $pee = str_replace('', "\n", $pee); + } + $pee = preg_replace('!(]*>)\s*
            !', "$1", $pee); + $pee = preg_replace('!
            (\s*]*>)!', '$1', $pee); + if (strpos($pee, ']*>)(.*?)!is', 'clean_pre', $pee ); + $pee = preg_replace( "|\n

            $|", '

            ', $pee ); + + return $pee; +} + +/** + * Newline preservation help function for wpautop + * + * @since 3.1.0 + * @access private + * @param array $matches preg_replace_callback matches array + * @returns string + */ +function _autop_newline_preservation_helper( $matches ) { + return str_replace("\n", "", $matches[0]); +} + +/** + * Don't auto-p wrap shortcodes that stand alone + * + * Ensures that shortcodes are not wrapped in <

            >...<

            >. + * + * @since 2.9.0 + * + * @param string $pee The content. + * @return string The filtered content. + */ +function shortcode_unautop($pee) { + global $shortcode_tags; + + if ( !empty($shortcode_tags) && is_array($shortcode_tags) ) { + $tagnames = array_keys($shortcode_tags); + $tagregexp = join( '|', array_map('preg_quote', $tagnames) ); + $pee = preg_replace('/

            \\s*?(\\[(' . $tagregexp . ')\\b.*?\\/?\\](?:.+?\\[\\/\\2\\])?)\\s*<\\/p>/s', '$1', $pee); + } + + return $pee; +} + +/** + * Checks to see if a string is utf8 encoded. + * + * NOTE: This function checks for 5-Byte sequences, UTF8 + * has Bytes Sequences with a maximum length of 4. + * + * @author bmorel at ssi dot fr (modified) + * @since 1.2.1 + * + * @param string $str The string to be checked + * @return bool True if $str fits a UTF-8 model, false otherwise. + */ +function seems_utf8($str) { + $length = strlen($str); + for ($i=0; $i < $length; $i++) { + $c = ord($str[$i]); + if ($c < 0x80) $n = 0; # 0bbbbbbb + elseif (($c & 0xE0) == 0xC0) $n=1; # 110bbbbb + elseif (($c & 0xF0) == 0xE0) $n=2; # 1110bbbb + elseif (($c & 0xF8) == 0xF0) $n=3; # 11110bbb + elseif (($c & 0xFC) == 0xF8) $n=4; # 111110bb + elseif (($c & 0xFE) == 0xFC) $n=5; # 1111110b + else return false; # Does not match any model + for ($j=0; $j<$n; $j++) { # n bytes matching 10bbbbbb follow ? + if ((++$i == $length) || ((ord($str[$i]) & 0xC0) != 0x80)) + return false; + } + } + return true; +} + +/** + * Converts a number of special characters into their HTML entities. + * + * Specifically deals with: &, <, >, ", and '. + * + * $quote_style can be set to ENT_COMPAT to encode " to + * ", or ENT_QUOTES to do both. Default is ENT_NOQUOTES where no quotes are encoded. + * + * @since 1.2.2 + * + * @param string $string The text which is to be encoded. + * @param mixed $quote_style Optional. Converts double quotes if set to ENT_COMPAT, both single and double if set to ENT_QUOTES or none if set to ENT_NOQUOTES. Also compatible with old values; converting single quotes if set to 'single', double if set to 'double' or both if otherwise set. Default is ENT_NOQUOTES. + * @param string $charset Optional. The character encoding of the string. Default is false. + * @param boolean $double_encode Optional. Whether to encode existing html entities. Default is false. + * @return string The encoded text with HTML entities. + */ +function _wp_specialchars( $string, $quote_style = ENT_NOQUOTES, $charset = false, $double_encode = false ) { + $string = (string) $string; + + if ( 0 === strlen( $string ) ) { + return ''; + } + + // Don't bother if there are no specialchars - saves some processing + if ( !preg_match( '/[&<>"\']/', $string ) ) { + return $string; + } + + // Account for the previous behaviour of the function when the $quote_style is not an accepted value + if ( empty( $quote_style ) ) { + $quote_style = ENT_NOQUOTES; + } elseif ( !in_array( $quote_style, array( 0, 2, 3, 'single', 'double' ), true ) ) { + $quote_style = ENT_QUOTES; + } + + // Store the site charset as a static to avoid multiple calls to wp_load_alloptions() + if ( !$charset ) { + static $_charset; + if ( !isset( $_charset ) ) { + $alloptions = wp_load_alloptions(); + $_charset = isset( $alloptions['blog_charset'] ) ? $alloptions['blog_charset'] : ''; + } + $charset = $_charset; + } + if ( in_array( $charset, array( 'utf8', 'utf-8', 'UTF8' ) ) ) { + $charset = 'UTF-8'; + } + + $_quote_style = $quote_style; + + if ( $quote_style === 'double' ) { + $quote_style = ENT_COMPAT; + $_quote_style = ENT_COMPAT; + } elseif ( $quote_style === 'single' ) { + $quote_style = ENT_NOQUOTES; + } + + // Handle double encoding ourselves + if ( !$double_encode ) { + $string = wp_specialchars_decode( $string, $_quote_style ); + + /* Critical */ + // The previous line decodes &phrase; into &phrase; We must guarantee that &phrase; is valid before proceeding. + $string = wp_kses_normalize_entities($string); + + // Now proceed with custom double-encoding silliness + $string = preg_replace( '/&(#?x?[0-9a-z]+);/i', '|wp_entity|$1|/wp_entity|', $string ); + } + + $string = @htmlspecialchars( $string, $quote_style, $charset ); + + // Handle double encoding ourselves + if ( !$double_encode ) { + $string = str_replace( array( '|wp_entity|', '|/wp_entity|' ), array( '&', ';' ), $string ); + } + + // Backwards compatibility + if ( 'single' === $_quote_style ) { + $string = str_replace( "'", ''', $string ); + } + + return $string; +} + +/** + * Converts a number of HTML entities into their special characters. + * + * Specifically deals with: &, <, >, ", and '. + * + * $quote_style can be set to ENT_COMPAT to decode " entities, + * or ENT_QUOTES to do both " and '. Default is ENT_NOQUOTES where no quotes are decoded. + * + * @since 2.8 + * + * @param string $string The text which is to be decoded. + * @param mixed $quote_style Optional. Converts double quotes if set to ENT_COMPAT, both single and double if set to ENT_QUOTES or none if set to ENT_NOQUOTES. Also compatible with old _wp_specialchars() values; converting single quotes if set to 'single', double if set to 'double' or both if otherwise set. Default is ENT_NOQUOTES. + * @return string The decoded text without HTML entities. + */ +function wp_specialchars_decode( $string, $quote_style = ENT_NOQUOTES ) { + $string = (string) $string; + + if ( 0 === strlen( $string ) ) { + return ''; + } + + // Don't bother if there are no entities - saves a lot of processing + if ( strpos( $string, '&' ) === false ) { + return $string; + } + + // Match the previous behaviour of _wp_specialchars() when the $quote_style is not an accepted value + if ( empty( $quote_style ) ) { + $quote_style = ENT_NOQUOTES; + } elseif ( !in_array( $quote_style, array( 0, 2, 3, 'single', 'double' ), true ) ) { + $quote_style = ENT_QUOTES; + } + + // More complete than get_html_translation_table( HTML_SPECIALCHARS ) + $single = array( ''' => '\'', ''' => '\'' ); + $single_preg = array( '/�*39;/' => ''', '/�*27;/i' => ''' ); + $double = array( '"' => '"', '"' => '"', '"' => '"' ); + $double_preg = array( '/�*34;/' => '"', '/�*22;/i' => '"' ); + $others = array( '<' => '<', '<' => '<', '>' => '>', '>' => '>', '&' => '&', '&' => '&', '&' => '&' ); + $others_preg = array( '/�*60;/' => '<', '/�*62;/' => '>', '/�*38;/' => '&', '/�*26;/i' => '&' ); + + if ( $quote_style === ENT_QUOTES ) { + $translation = array_merge( $single, $double, $others ); + $translation_preg = array_merge( $single_preg, $double_preg, $others_preg ); + } elseif ( $quote_style === ENT_COMPAT || $quote_style === 'double' ) { + $translation = array_merge( $double, $others ); + $translation_preg = array_merge( $double_preg, $others_preg ); + } elseif ( $quote_style === 'single' ) { + $translation = array_merge( $single, $others ); + $translation_preg = array_merge( $single_preg, $others_preg ); + } elseif ( $quote_style === ENT_NOQUOTES ) { + $translation = $others; + $translation_preg = $others_preg; + } + + // Remove zero padding on numeric entities + $string = preg_replace( array_keys( $translation_preg ), array_values( $translation_preg ), $string ); + + // Replace characters according to translation table + return strtr( $string, $translation ); +} + +/** + * Checks for invalid UTF8 in a string. + * + * @since 2.8 + * + * @param string $string The text which is to be checked. + * @param boolean $strip Optional. Whether to attempt to strip out invalid UTF8. Default is false. + * @return string The checked text. + */ +function wp_check_invalid_utf8( $string, $strip = false ) { + $string = (string) $string; + + if ( 0 === strlen( $string ) ) { + return ''; + } + + // Store the site charset as a static to avoid multiple calls to get_option() + static $is_utf8; + if ( !isset( $is_utf8 ) ) { + $is_utf8 = in_array( get_option( 'blog_charset' ), array( 'utf8', 'utf-8', 'UTF8', 'UTF-8' ) ); + } + if ( !$is_utf8 ) { + return $string; + } + + // Check for support for utf8 in the installed PCRE library once and store the result in a static + static $utf8_pcre; + if ( !isset( $utf8_pcre ) ) { + $utf8_pcre = @preg_match( '/^./u', 'a' ); + } + // We can't demand utf8 in the PCRE installation, so just return the string in those cases + if ( !$utf8_pcre ) { + return $string; + } + + // preg_match fails when it encounters invalid UTF8 in $string + if ( 1 === @preg_match( '/^./us', $string ) ) { + return $string; + } + + // Attempt to strip the bad chars if requested (not recommended) + if ( $strip && function_exists( 'iconv' ) ) { + return iconv( 'utf-8', 'utf-8', $string ); + } + + return ''; +} + +/** + * Encode the Unicode values to be used in the URI. + * + * @since 1.5.0 + * + * @param string $utf8_string + * @param int $length Max length of the string + * @return string String with Unicode encoded for URI. + */ +function utf8_uri_encode( $utf8_string, $length = 0 ) { + $unicode = ''; + $values = array(); + $num_octets = 1; + $unicode_length = 0; + + $string_length = strlen( $utf8_string ); + for ($i = 0; $i < $string_length; $i++ ) { + + $value = ord( $utf8_string[ $i ] ); + + if ( $value < 128 ) { + if ( $length && ( $unicode_length >= $length ) ) + break; + $unicode .= chr($value); + $unicode_length++; + } else { + if ( count( $values ) == 0 ) $num_octets = ( $value < 224 ) ? 2 : 3; + + $values[] = $value; + + if ( $length && ( $unicode_length + ($num_octets * 3) ) > $length ) + break; + if ( count( $values ) == $num_octets ) { + if ($num_octets == 3) { + $unicode .= '%' . dechex($values[0]) . '%' . dechex($values[1]) . '%' . dechex($values[2]); + $unicode_length += 9; + } else { + $unicode .= '%' . dechex($values[0]) . '%' . dechex($values[1]); + $unicode_length += 6; + } + + $values = array(); + $num_octets = 1; + } + } + } + + return $unicode; +} + +/** + * Converts all accent characters to ASCII characters. + * + * If there are no accent characters, then the string given is just returned. + * + * @since 1.2.1 + * + * @param string $string Text that might have accent characters + * @return string Filtered string with replaced "nice" characters. + */ +function remove_accents($string) { + if ( !preg_match('/[\x80-\xff]/', $string) ) + return $string; + + if (seems_utf8($string)) { + $chars = array( + // Decompositions for Latin-1 Supplement + chr(195).chr(128) => 'A', chr(195).chr(129) => 'A', + chr(195).chr(130) => 'A', chr(195).chr(131) => 'A', + chr(195).chr(132) => 'A', chr(195).chr(133) => 'A', + chr(195).chr(134) => 'AE',chr(195).chr(135) => 'C', + chr(195).chr(136) => 'E', chr(195).chr(137) => 'E', + chr(195).chr(138) => 'E', chr(195).chr(139) => 'E', + chr(195).chr(140) => 'I', chr(195).chr(141) => 'I', + chr(195).chr(142) => 'I', chr(195).chr(143) => 'I', + chr(195).chr(144) => 'D', chr(195).chr(145) => 'N', + chr(195).chr(146) => 'O', chr(195).chr(147) => 'O', + chr(195).chr(148) => 'O', chr(195).chr(149) => 'O', + chr(195).chr(150) => 'O', chr(195).chr(153) => 'U', + chr(195).chr(154) => 'U', chr(195).chr(155) => 'U', + chr(195).chr(156) => 'U', chr(195).chr(157) => 'Y', + chr(195).chr(158) => 'TH',chr(195).chr(159) => 's', + chr(195).chr(160) => 'a', chr(195).chr(161) => 'a', + chr(195).chr(162) => 'a', chr(195).chr(163) => 'a', + chr(195).chr(164) => 'a', chr(195).chr(165) => 'a', + chr(195).chr(166) => 'ae',chr(195).chr(167) => 'c', + chr(195).chr(168) => 'e', chr(195).chr(169) => 'e', + chr(195).chr(170) => 'e', chr(195).chr(171) => 'e', + chr(195).chr(172) => 'i', chr(195).chr(173) => 'i', + chr(195).chr(174) => 'i', chr(195).chr(175) => 'i', + chr(195).chr(176) => 'd', chr(195).chr(177) => 'n', + chr(195).chr(178) => 'o', chr(195).chr(179) => 'o', + chr(195).chr(180) => 'o', chr(195).chr(181) => 'o', + chr(195).chr(182) => 'o', chr(195).chr(184) => 'o', + chr(195).chr(185) => 'u', chr(195).chr(186) => 'u', + chr(195).chr(187) => 'u', chr(195).chr(188) => 'u', + chr(195).chr(189) => 'y', chr(195).chr(190) => 'th', + chr(195).chr(191) => 'y', + // Decompositions for Latin Extended-A + chr(196).chr(128) => 'A', chr(196).chr(129) => 'a', + chr(196).chr(130) => 'A', chr(196).chr(131) => 'a', + chr(196).chr(132) => 'A', chr(196).chr(133) => 'a', + chr(196).chr(134) => 'C', chr(196).chr(135) => 'c', + chr(196).chr(136) => 'C', chr(196).chr(137) => 'c', + chr(196).chr(138) => 'C', chr(196).chr(139) => 'c', + chr(196).chr(140) => 'C', chr(196).chr(141) => 'c', + chr(196).chr(142) => 'D', chr(196).chr(143) => 'd', + chr(196).chr(144) => 'D', chr(196).chr(145) => 'd', + chr(196).chr(146) => 'E', chr(196).chr(147) => 'e', + chr(196).chr(148) => 'E', chr(196).chr(149) => 'e', + chr(196).chr(150) => 'E', chr(196).chr(151) => 'e', + chr(196).chr(152) => 'E', chr(196).chr(153) => 'e', + chr(196).chr(154) => 'E', chr(196).chr(155) => 'e', + chr(196).chr(156) => 'G', chr(196).chr(157) => 'g', + chr(196).chr(158) => 'G', chr(196).chr(159) => 'g', + chr(196).chr(160) => 'G', chr(196).chr(161) => 'g', + chr(196).chr(162) => 'G', chr(196).chr(163) => 'g', + chr(196).chr(164) => 'H', chr(196).chr(165) => 'h', + chr(196).chr(166) => 'H', chr(196).chr(167) => 'h', + chr(196).chr(168) => 'I', chr(196).chr(169) => 'i', + chr(196).chr(170) => 'I', chr(196).chr(171) => 'i', + chr(196).chr(172) => 'I', chr(196).chr(173) => 'i', + chr(196).chr(174) => 'I', chr(196).chr(175) => 'i', + chr(196).chr(176) => 'I', chr(196).chr(177) => 'i', + chr(196).chr(178) => 'IJ',chr(196).chr(179) => 'ij', + chr(196).chr(180) => 'J', chr(196).chr(181) => 'j', + chr(196).chr(182) => 'K', chr(196).chr(183) => 'k', + chr(196).chr(184) => 'k', chr(196).chr(185) => 'L', + chr(196).chr(186) => 'l', chr(196).chr(187) => 'L', + chr(196).chr(188) => 'l', chr(196).chr(189) => 'L', + chr(196).chr(190) => 'l', chr(196).chr(191) => 'L', + chr(197).chr(128) => 'l', chr(197).chr(129) => 'L', + chr(197).chr(130) => 'l', chr(197).chr(131) => 'N', + chr(197).chr(132) => 'n', chr(197).chr(133) => 'N', + chr(197).chr(134) => 'n', chr(197).chr(135) => 'N', + chr(197).chr(136) => 'n', chr(197).chr(137) => 'N', + chr(197).chr(138) => 'n', chr(197).chr(139) => 'N', + chr(197).chr(140) => 'O', chr(197).chr(141) => 'o', + chr(197).chr(142) => 'O', chr(197).chr(143) => 'o', + chr(197).chr(144) => 'O', chr(197).chr(145) => 'o', + chr(197).chr(146) => 'OE',chr(197).chr(147) => 'oe', + chr(197).chr(148) => 'R',chr(197).chr(149) => 'r', + chr(197).chr(150) => 'R',chr(197).chr(151) => 'r', + chr(197).chr(152) => 'R',chr(197).chr(153) => 'r', + chr(197).chr(154) => 'S',chr(197).chr(155) => 's', + chr(197).chr(156) => 'S',chr(197).chr(157) => 's', + chr(197).chr(158) => 'S',chr(197).chr(159) => 's', + chr(197).chr(160) => 'S', chr(197).chr(161) => 's', + chr(197).chr(162) => 'T', chr(197).chr(163) => 't', + chr(197).chr(164) => 'T', chr(197).chr(165) => 't', + chr(197).chr(166) => 'T', chr(197).chr(167) => 't', + chr(197).chr(168) => 'U', chr(197).chr(169) => 'u', + chr(197).chr(170) => 'U', chr(197).chr(171) => 'u', + chr(197).chr(172) => 'U', chr(197).chr(173) => 'u', + chr(197).chr(174) => 'U', chr(197).chr(175) => 'u', + chr(197).chr(176) => 'U', chr(197).chr(177) => 'u', + chr(197).chr(178) => 'U', chr(197).chr(179) => 'u', + chr(197).chr(180) => 'W', chr(197).chr(181) => 'w', + chr(197).chr(182) => 'Y', chr(197).chr(183) => 'y', + chr(197).chr(184) => 'Y', chr(197).chr(185) => 'Z', + chr(197).chr(186) => 'z', chr(197).chr(187) => 'Z', + chr(197).chr(188) => 'z', chr(197).chr(189) => 'Z', + chr(197).chr(190) => 'z', chr(197).chr(191) => 's', + // Decompositions for Latin Extended-B + chr(200).chr(152) => 'S', chr(200).chr(153) => 's', + chr(200).chr(154) => 'T', chr(200).chr(155) => 't', + // Euro Sign + chr(226).chr(130).chr(172) => 'E', + // GBP (Pound) Sign + chr(194).chr(163) => ''); + + $string = strtr($string, $chars); + } else { + // Assume ISO-8859-1 if not UTF-8 + $chars['in'] = chr(128).chr(131).chr(138).chr(142).chr(154).chr(158) + .chr(159).chr(162).chr(165).chr(181).chr(192).chr(193).chr(194) + .chr(195).chr(196).chr(197).chr(199).chr(200).chr(201).chr(202) + .chr(203).chr(204).chr(205).chr(206).chr(207).chr(209).chr(210) + .chr(211).chr(212).chr(213).chr(214).chr(216).chr(217).chr(218) + .chr(219).chr(220).chr(221).chr(224).chr(225).chr(226).chr(227) + .chr(228).chr(229).chr(231).chr(232).chr(233).chr(234).chr(235) + .chr(236).chr(237).chr(238).chr(239).chr(241).chr(242).chr(243) + .chr(244).chr(245).chr(246).chr(248).chr(249).chr(250).chr(251) + .chr(252).chr(253).chr(255); + + $chars['out'] = "EfSZszYcYuAAAAAACEEEEIIIINOOOOOOUUUUYaaaaaaceeeeiiiinoooooouuuuyy"; + + $string = strtr($string, $chars['in'], $chars['out']); + $double_chars['in'] = array(chr(140), chr(156), chr(198), chr(208), chr(222), chr(223), chr(230), chr(240), chr(254)); + $double_chars['out'] = array('OE', 'oe', 'AE', 'DH', 'TH', 'ss', 'ae', 'dh', 'th'); + $string = str_replace($double_chars['in'], $double_chars['out'], $string); + } + + return $string; +} + +/** + * Sanitizes a filename replacing whitespace with dashes + * + * Removes special characters that are illegal in filenames on certain + * operating systems and special characters requiring special escaping + * to manipulate at the command line. Replaces spaces and consecutive + * dashes with a single dash. Trim period, dash and underscore from beginning + * and end of filename. + * + * @since 2.1.0 + * + * @param string $filename The filename to be sanitized + * @return string The sanitized filename + */ +function sanitize_file_name( $filename ) { + $filename_raw = $filename; + $special_chars = array("?", "[", "]", "/", "\\", "=", "<", ">", ":", ";", ",", "'", "\"", "&", "$", "#", "*", "(", ")", "|", "~", "`", "!", "{", "}", chr(0)); + $special_chars = apply_filters('sanitize_file_name_chars', $special_chars, $filename_raw); + $filename = str_replace($special_chars, '', $filename); + $filename = preg_replace('/[\s-]+/', '-', $filename); + $filename = trim($filename, '.-_'); + + // Split the filename into a base and extension[s] + $parts = explode('.', $filename); + + // Return if only one extension + if ( count($parts) <= 2 ) + return apply_filters('sanitize_file_name', $filename, $filename_raw); + + // Process multiple extensions + $filename = array_shift($parts); + $extension = array_pop($parts); + $mimes = get_allowed_mime_types(); + + // Loop over any intermediate extensions. Munge them with a trailing underscore if they are a 2 - 5 character + // long alpha string not in the extension whitelist. + foreach ( (array) $parts as $part) { + $filename .= '.' . $part; + + if ( preg_match("/^[a-zA-Z]{2,5}\d?$/", $part) ) { + $allowed = false; + foreach ( $mimes as $ext_preg => $mime_match ) { + $ext_preg = '!^(' . $ext_preg . ')$!i'; + if ( preg_match( $ext_preg, $part ) ) { + $allowed = true; + break; + } + } + if ( !$allowed ) + $filename .= '_'; + } + } + $filename .= '.' . $extension; + + return apply_filters('sanitize_file_name', $filename, $filename_raw); +} + +/** + * Sanitize username stripping out unsafe characters. + * + * Removes tags, octets, entities, and if strict is enabled, will only keep + * alphanumeric, _, space, ., -, @. After sanitizing, it passes the username, + * raw username (the username in the parameter), and the value of $strict as + * parameters for the 'sanitize_user' filter. + * + * @since 2.0.0 + * @uses apply_filters() Calls 'sanitize_user' hook on username, raw username, + * and $strict parameter. + * + * @param string $username The username to be sanitized. + * @param bool $strict If set limits $username to specific characters. Default false. + * @return string The sanitized username, after passing through filters. + */ +function sanitize_user( $username, $strict = false ) { + $raw_username = $username; + $username = wp_strip_all_tags( $username ); + $username = remove_accents( $username ); + // Kill octets + $username = preg_replace( '|%([a-fA-F0-9][a-fA-F0-9])|', '', $username ); + $username = preg_replace( '/&.+?;/', '', $username ); // Kill entities + + // If strict, reduce to ASCII for max portability. + if ( $strict ) + $username = preg_replace( '|[^a-z0-9 _.\-@]|i', '', $username ); + + $username = trim( $username ); + // Consolidate contiguous whitespace + $username = preg_replace( '|\s+|', ' ', $username ); + + return apply_filters( 'sanitize_user', $username, $raw_username, $strict ); +} + +/** + * Sanitize a string key. + * + * Keys are used as internal identifiers. Lowercase alphanumeric characters, dashes and underscores are allowed. + * + * @since 3.0.0 + * + * @param string $key String key + * @return string Sanitized key + */ +function sanitize_key( $key ) { + $raw_key = $key; + $key = strtolower( $key ); + $key = preg_replace( '/[^a-z0-9_\-]/', '', $key ); + return apply_filters( 'sanitize_key', $key, $raw_key ); +} + +/** + * Sanitizes title or use fallback title. + * + * Specifically, HTML and PHP tags are stripped. Further actions can be added + * via the plugin API. If $title is empty and $fallback_title is set, the latter + * will be used. + * + * @since 1.0.0 + * + * @param string $title The string to be sanitized. + * @param string $fallback_title Optional. A title to use if $title is empty. + * @param string $context Optional. The operation for which the string is sanitized + * @return string The sanitized string. + */ +function sanitize_title($title, $fallback_title = '', $context = 'save') { + $raw_title = $title; + + if ( 'save' == $context ) + $title = remove_accents($title); + + $title = apply_filters('sanitize_title', $title, $raw_title, $context); + + if ( '' === $title || false === $title ) + $title = $fallback_title; + + return $title; +} + +function sanitize_title_for_query($title) { + return sanitize_title($title, '', 'query'); +} + +/** + * Sanitizes title, replacing whitespace with dashes. + * + * Limits the output to alphanumeric characters, underscore (_) and dash (-). + * Whitespace becomes a dash. + * + * @since 1.2.0 + * + * @param string $title The title to be sanitized. + * @return string The sanitized title. + */ +function sanitize_title_with_dashes($title) { + $title = strip_tags($title); + // Preserve escaped octets. + $title = preg_replace('|%([a-fA-F0-9][a-fA-F0-9])|', '---$1---', $title); + // Remove percent signs that are not part of an octet. + $title = str_replace('%', '', $title); + // Restore octets. + $title = preg_replace('|---([a-fA-F0-9][a-fA-F0-9])---|', '%$1', $title); + + if (seems_utf8($title)) { + if (function_exists('mb_strtolower')) { + $title = mb_strtolower($title, 'UTF-8'); + } + $title = utf8_uri_encode($title, 200); + } + + $title = strtolower($title); + $title = preg_replace('/&.+?;/', '', $title); // kill entities + $title = str_replace('.', '-', $title); + $title = preg_replace('/[^%a-z0-9 _-]/', '', $title); + $title = preg_replace('/\s+/', '-', $title); + $title = preg_replace('|-+|', '-', $title); + $title = trim($title, '-'); + + return $title; +} + +/** + * Ensures a string is a valid SQL order by clause. + * + * Accepts one or more columns, with or without ASC/DESC, and also accepts + * RAND(). + * + * @since 2.5.1 + * + * @param string $orderby Order by string to be checked. + * @return string|false Returns the order by clause if it is a match, false otherwise. + */ +function sanitize_sql_orderby( $orderby ){ + preg_match('/^\s*([a-z0-9_]+(\s+(ASC|DESC))?(\s*,\s*|\s*$))+|^\s*RAND\(\s*\)\s*$/i', $orderby, $obmatches); + if ( !$obmatches ) + return false; + return $orderby; +} + +/** + * Santizes a html classname to ensure it only contains valid characters + * + * Strips the string down to A-Z,a-z,0-9,_,-. If this results in an empty + * string then it will return the alternative value supplied. + * + * @todo Expand to support the full range of CDATA that a class attribute can contain. + * + * @since 2.8.0 + * + * @param string $class The classname to be sanitized + * @param string $fallback Optional. The value to return if the sanitization end's up as an empty string. + * Defaults to an empty string. + * @return string The sanitized value + */ +function sanitize_html_class( $class, $fallback = '' ) { + //Strip out any % encoded octets + $sanitized = preg_replace( '|%[a-fA-F0-9][a-fA-F0-9]|', '', $class ); + + //Limit to A-Z,a-z,0-9,_,- + $sanitized = preg_replace( '/[^A-Za-z0-9_-]/', '', $sanitized ); + + if ( '' == $sanitized ) + $sanitized = $fallback; + + return apply_filters( 'sanitize_html_class', $sanitized, $class, $fallback ); +} + +/** + * Converts a number of characters from a string. + * + * Metadata tags <> and <<category>> are removed, <<br>> and <<hr>> are + * converted into correct XHTML and Unicode characters are converted to the + * valid range. + * + * @since 0.71 + * + * @param string $content String of characters to be converted. + * @param string $deprecated Not used. + * @return string Converted string. + */ +function convert_chars($content, $deprecated = '') { + if ( !empty( $deprecated ) ) + _deprecated_argument( __FUNCTION__, '0.71' ); + + // Translation of invalid Unicode references range to valid range + $wp_htmltranswinuni = array( + '€' => '€', // the Euro sign + '' => '', + '‚' => '‚', // these are Windows CP1252 specific characters + 'ƒ' => 'ƒ', // they would look weird on non-Windows browsers + '„' => '„', + '…' => '…', + '†' => '†', + '‡' => '‡', + 'ˆ' => 'ˆ', + '‰' => '‰', + 'Š' => 'Š', + '‹' => '‹', + 'Œ' => 'Œ', + '' => '', + 'Ž' => 'ž', + '' => '', + '' => '', + '‘' => '‘', + '’' => '’', + '“' => '“', + '”' => '”', + '•' => '•', + '–' => '–', + '—' => '—', + '˜' => '˜', + '™' => '™', + 'š' => 'š', + '›' => '›', + 'œ' => 'œ', + '' => '', + 'ž' => '', + 'Ÿ' => 'Ÿ' + ); + + // Remove metadata tags + $content = preg_replace('/<title>(.+?)<\/title>/','',$content); + $content = preg_replace('/<category>(.+?)<\/category>/','',$content); + + // Converts lone & characters into & (a.k.a. &) + $content = preg_replace('/&([^#])(?![a-z1-4]{1,8};)/i', '&$1', $content); + + // Fix Word pasting + $content = strtr($content, $wp_htmltranswinuni); + + // Just a little XHTML help + $content = str_replace('<br>', '<br />', $content); + $content = str_replace('<hr>', '<hr />', $content); + + return $content; +} + +/** + * Will only balance the tags if forced to and the option is set to balance tags. + * + * The option 'use_balanceTags' is used for whether the tags will be balanced. + * Both the $force parameter and 'use_balanceTags' option will have to be true + * before the tags will be balanced. + * + * @since 0.71 + * + * @param string $text Text to be balanced + * @param bool $force Forces balancing, ignoring the value of the option. Default false. + * @return string Balanced text + */ +function balanceTags( $text, $force = false ) { + if ( !$force && get_option('use_balanceTags') == 0 ) + return $text; + return force_balance_tags( $text ); +} + +/** + * Balances tags of string using a modified stack. + * + * @since 2.0.4 + * + * @author Leonard Lin <leonard@acm.org> + * @license GPL + * @copyright November 4, 2001 + * @version 1.1 + * @todo Make better - change loop condition to $text in 1.2 + * @internal Modified by Scott Reilly (coffee2code) 02 Aug 2004 + * 1.1 Fixed handling of append/stack pop order of end text + * Added Cleaning Hooks + * 1.0 First Version + * + * @param string $text Text to be balanced. + * @return string Balanced text. + */ +function force_balance_tags( $text ) { + $tagstack = array(); + $stacksize = 0; + $tagqueue = ''; + $newtext = ''; + $single_tags = array('br', 'hr', 'img', 'input'); // Known single-entity/self-closing tags + $nestable_tags = array('blockquote', 'div', 'span'); // Tags that can be immediately nested within themselves + + // WP bug fix for comments - in case you REALLY meant to type '< !--' + $text = str_replace('< !--', '< !--', $text); + // WP bug fix for LOVE <3 (and other situations with '<' before a number) + $text = preg_replace('#<([0-9]{1})#', '<$1', $text); + + while ( preg_match("/<(\/?[\w:]*)\s*([^>]*)>/", $text, $regex) ) { + $newtext .= $tagqueue; + + $i = strpos($text, $regex[0]); + $l = strlen($regex[0]); + + // clear the shifter + $tagqueue = ''; + // Pop or Push + if ( isset($regex[1][0]) && '/' == $regex[1][0] ) { // End Tag + $tag = strtolower(substr($regex[1],1)); + // if too many closing tags + if( $stacksize <= 0 ) { + $tag = ''; + // or close to be safe $tag = '/' . $tag; + } + // if stacktop value = tag close value then pop + else if ( $tagstack[$stacksize - 1] == $tag ) { // found closing tag + $tag = '</' . $tag . '>'; // Close Tag + // Pop + array_pop( $tagstack ); + $stacksize--; + } else { // closing tag not at top, search for it + for ( $j = $stacksize-1; $j >= 0; $j-- ) { + if ( $tagstack[$j] == $tag ) { + // add tag to tagqueue + for ( $k = $stacksize-1; $k >= $j; $k--) { + $tagqueue .= '</' . array_pop( $tagstack ) . '>'; + $stacksize--; + } + break; + } + } + $tag = ''; + } + } else { // Begin Tag + $tag = strtolower($regex[1]); + + // Tag Cleaning + + // If self-closing or '', don't do anything. + if ( substr($regex[2],-1) == '/' || $tag == '' ) { + // do nothing + } + // ElseIf it's a known single-entity tag but it doesn't close itself, do so + elseif ( in_array($tag, $single_tags) ) { + $regex[2] .= '/'; + } else { // Push the tag onto the stack + // If the top of the stack is the same as the tag we want to push, close previous tag + if ( $stacksize > 0 && !in_array($tag, $nestable_tags) && $tagstack[$stacksize - 1] == $tag ) { + $tagqueue = '</' . array_pop ($tagstack) . '>'; + $stacksize--; + } + $stacksize = array_push ($tagstack, $tag); + } + + // Attributes + $attributes = $regex[2]; + if( !empty($attributes) ) + $attributes = ' '.$attributes; + + $tag = '<' . $tag . $attributes . '>'; + //If already queuing a close tag, then put this tag on, too + if ( !empty($tagqueue) ) { + $tagqueue .= $tag; + $tag = ''; + } + } + $newtext .= substr($text, 0, $i) . $tag; + $text = substr($text, $i + $l); + } + + // Clear Tag Queue + $newtext .= $tagqueue; + + // Add Remaining text + $newtext .= $text; + + // Empty Stack + while( $x = array_pop($tagstack) ) + $newtext .= '</' . $x . '>'; // Add remaining tags to close + + // WP fix for the bug with HTML comments + $newtext = str_replace("< !--","<!--",$newtext); + $newtext = str_replace("< !--","< !--",$newtext); + + return $newtext; +} + +/** + * Acts on text which is about to be edited. + * + * Unless $richedit is set, it is simply a holder for the 'format_to_edit' + * filter. If $richedit is set true htmlspecialchars(), through esc_textarea(), + * will be run on the content, converting special characters to HTML entities. + * + * @since 0.71 + * + * @param string $content The text about to be edited. + * @param bool $richedit Whether the $content should pass through htmlspecialchars(). Default false. + * @return string The text after the filter (and possibly htmlspecialchars()) has been run. + */ +function format_to_edit( $content, $richedit = false ) { + $content = apply_filters( 'format_to_edit', $content ); + if ( ! $richedit ) + $content = esc_textarea( $content ); + return $content; +} + +/** + * Holder for the 'format_to_post' filter. + * + * @since 0.71 + * + * @param string $content The text to pass through the filter. + * @return string Text returned from the 'format_to_post' filter. + */ +function format_to_post($content) { + $content = apply_filters('format_to_post', $content); + return $content; +} + +/** + * Add leading zeros when necessary. + * + * If you set the threshold to '4' and the number is '10', then you will get + * back '0010'. If you set the number to '4' and the number is '5000', then you + * will get back '5000'. + * + * Uses sprintf to append the amount of zeros based on the $threshold parameter + * and the size of the number. If the number is large enough, then no zeros will + * be appended. + * + * @since 0.71 + * + * @param mixed $number Number to append zeros to if not greater than threshold. + * @param int $threshold Digit places number needs to be to not have zeros added. + * @return string Adds leading zeros to number if needed. + */ +function zeroise($number, $threshold) { + return sprintf('%0'.$threshold.'s', $number); +} + +/** + * Adds backslashes before letters and before a number at the start of a string. + * + * @since 0.71 + * + * @param string $string Value to which backslashes will be added. + * @return string String with backslashes inserted. + */ +function backslashit($string) { + $string = preg_replace('/^([0-9])/', '\\\\\\\\\1', $string); + $string = preg_replace('/([a-z])/i', '\\\\\1', $string); + return $string; +} + +/** + * Appends a trailing slash. + * + * Will remove trailing slash if it exists already before adding a trailing + * slash. This prevents double slashing a string or path. + * + * The primary use of this is for paths and thus should be used for paths. It is + * not restricted to paths and offers no specific path support. + * + * @since 1.2.0 + * @uses untrailingslashit() Unslashes string if it was slashed already. + * + * @param string $string What to add the trailing slash to. + * @return string String with trailing slash added. + */ +function trailingslashit($string) { + return untrailingslashit($string) . '/'; +} + +/** + * Removes trailing slash if it exists. + * + * The primary use of this is for paths and thus should be used for paths. It is + * not restricted to paths and offers no specific path support. + * + * @since 2.2.0 + * + * @param string $string What to remove the trailing slash from. + * @return string String without the trailing slash. + */ +function untrailingslashit($string) { + return rtrim($string, '/'); +} + +/** + * Adds slashes to escape strings. + * + * Slashes will first be removed if magic_quotes_gpc is set, see {@link + * http://www.php.net/magic_quotes} for more details. + * + * @since 0.71 + * + * @param string $gpc The string returned from HTTP request data. + * @return string Returns a string escaped with slashes. + */ +function addslashes_gpc($gpc) { + if ( get_magic_quotes_gpc() ) + $gpc = stripslashes($gpc); + + return esc_sql($gpc); +} + +/** + * Navigates through an array and removes slashes from the values. + * + * If an array is passed, the array_map() function causes a callback to pass the + * value back to the function. The slashes from this value will removed. + * + * @since 2.0.0 + * + * @param array|string $value The array or string to be stripped. + * @return array|string Stripped array (or string in the callback). + */ +function stripslashes_deep($value) { + if ( is_array($value) ) { + $value = array_map('stripslashes_deep', $value); + } elseif ( is_object($value) ) { + $vars = get_object_vars( $value ); + foreach ($vars as $key=>$data) { + $value->{$key} = stripslashes_deep( $data ); + } + } else { + $value = stripslashes($value); + } + + return $value; +} + +/** + * Navigates through an array and encodes the values to be used in a URL. + * + * Uses a callback to pass the value of the array back to the function as a + * string. + * + * @since 2.2.0 + * + * @param array|string $value The array or string to be encoded. + * @return array|string $value The encoded array (or string from the callback). + */ +function urlencode_deep($value) { + $value = is_array($value) ? array_map('urlencode_deep', $value) : urlencode($value); + return $value; +} + +/** + * Converts email addresses characters to HTML entities to block spam bots. + * + * @since 0.71 + * + * @param string $emailaddy Email address. + * @param int $mailto Optional. Range from 0 to 1. Used for encoding. + * @return string Converted email address. + */ +function antispambot($emailaddy, $mailto=0) { + $emailNOSPAMaddy = ''; + srand ((float) microtime() * 1000000); + for ($i = 0; $i < strlen($emailaddy); $i = $i + 1) { + $j = floor(rand(0, 1+$mailto)); + if ($j==0) { + $emailNOSPAMaddy .= '&#'.ord(substr($emailaddy,$i,1)).';'; + } elseif ($j==1) { + $emailNOSPAMaddy .= substr($emailaddy,$i,1); + } elseif ($j==2) { + $emailNOSPAMaddy .= '%'.zeroise(dechex(ord(substr($emailaddy, $i, 1))), 2); + } + } + $emailNOSPAMaddy = str_replace('@','@',$emailNOSPAMaddy); + return $emailNOSPAMaddy; +} + +/** + * Callback to convert URI match to HTML A element. + * + * This function was backported from 2.5.0 to 2.3.2. Regex callback for {@link + * make_clickable()}. + * + * @since 2.3.2 + * @access private + * + * @param array $matches Single Regex Match. + * @return string HTML A element with URI address. + */ +function _make_url_clickable_cb($matches) { + $url = $matches[2]; + $suffix = ''; + + /** Include parentheses in the URL only if paired **/ + while ( substr_count( $url, '(' ) < substr_count( $url, ')' ) ) { + $suffix = strrchr( $url, ')' ) . $suffix; + $url = substr( $url, 0, strrpos( $url, ')' ) ); + } + + $url = esc_url($url); + if ( empty($url) ) + return $matches[0]; + + return $matches[1] . "<a href=\"$url\" rel=\"nofollow\">$url</a>" . $suffix; +} + +/** + * Callback to convert URL match to HTML A element. + * + * This function was backported from 2.5.0 to 2.3.2. Regex callback for {@link + * make_clickable()}. + * + * @since 2.3.2 + * @access private + * + * @param array $matches Single Regex Match. + * @return string HTML A element with URL address. + */ +function _make_web_ftp_clickable_cb($matches) { + $ret = ''; + $dest = $matches[2]; + $dest = 'http://' . $dest; + $dest = esc_url($dest); + if ( empty($dest) ) + return $matches[0]; + + // removed trailing [.,;:)] from URL + if ( in_array( substr($dest, -1), array('.', ',', ';', ':', ')') ) === true ) { + $ret = substr($dest, -1); + $dest = substr($dest, 0, strlen($dest)-1); + } + return $matches[1] . "<a href=\"$dest\" rel=\"nofollow\">$dest</a>$ret"; +} + +/** + * Callback to convert email address match to HTML A element. + * + * This function was backported from 2.5.0 to 2.3.2. Regex callback for {@link + * make_clickable()}. + * + * @since 2.3.2 + * @access private + * + * @param array $matches Single Regex Match. + * @return string HTML A element with email address. + */ +function _make_email_clickable_cb($matches) { + $email = $matches[2] . '@' . $matches[3]; + return $matches[1] . "<a href=\"mailto:$email\">$email</a>"; +} + +/** + * Convert plaintext URI to HTML links. + * + * Converts URI, www and ftp, and email addresses. Finishes by fixing links + * within links. + * + * @since 0.71 + * + * @param string $ret Content to convert URIs. + * @return string Content with converted URIs. + */ +function make_clickable($ret) { + $ret = ' ' . $ret; + // in testing, using arrays here was found to be faster + $save = @ini_set('pcre.recursion_limit', 10000); + $retval = preg_replace_callback('#(?<!=[\'"])(?<=[*\')+.,;:!&$\s>])(\()?([\w]+?://(?:[\w\\x80-\\xff\#%~/?@\[\]-]{1,2000}|[\'*(+.,;:!=&$](?![\b\)]|(\))?([\s]|$))|(?(1)\)(?![\s<.,;:]|$)|\)))+)#is', '_make_url_clickable_cb', $ret); + if (null !== $retval ) + $ret = $retval; + @ini_set('pcre.recursion_limit', $save); + $ret = preg_replace_callback('#([\s>])((www|ftp)\.[\w\\x80-\\xff\#$%&~/.\-;:=,?@\[\]+]+)#is', '_make_web_ftp_clickable_cb', $ret); + $ret = preg_replace_callback('#([\s>])([.0-9a-z_+-]+)@(([0-9a-z-]+\.)+[0-9a-z]{2,})#i', '_make_email_clickable_cb', $ret); + // this one is not in an array because we need it to run last, for cleanup of accidental links within links + $ret = preg_replace("#(<a( [^>]+?>|>))<a [^>]+?>([^>]+?)</a></a>#i", "$1$3</a>", $ret); + $ret = trim($ret); + return $ret; +} + +/** + * Adds rel nofollow string to all HTML A elements in content. + * + * @since 1.5.0 + * + * @param string $text Content that may contain HTML A elements. + * @return string Converted content. + */ +function wp_rel_nofollow( $text ) { + // This is a pre save filter, so text is already escaped. + $text = stripslashes($text); + $text = preg_replace_callback('|<a (.+?)>|i', 'wp_rel_nofollow_callback', $text); + $text = esc_sql($text); + return $text; +} + +/** + * Callback to used to add rel=nofollow string to HTML A element. + * + * Will remove already existing rel="nofollow" and rel='nofollow' from the + * string to prevent from invalidating (X)HTML. + * + * @since 2.3.0 + * + * @param array $matches Single Match + * @return string HTML A Element with rel nofollow. + */ +function wp_rel_nofollow_callback( $matches ) { + $text = $matches[1]; + $text = str_replace(array(' rel="nofollow"', " rel='nofollow'"), '', $text); + return "<a $text rel=\"nofollow\">"; +} + +/** + * Convert one smiley code to the icon graphic file equivalent. + * + * Looks up one smiley code in the $wpsmiliestrans global array and returns an + * <img> string for that smiley. + * + * @global array $wpsmiliestrans + * @since 2.8.0 + * + * @param string $smiley Smiley code to convert to image. + * @return string Image string for smiley. + */ +function translate_smiley($smiley) { + global $wpsmiliestrans; + + if (count($smiley) == 0) { + return ''; + } + + $smiley = trim(reset($smiley)); + $img = $wpsmiliestrans[$smiley]; + $smiley_masked = esc_attr($smiley); + + $srcurl = apply_filters('smilies_src', includes_url("images/smilies/$img"), $img, site_url()); + + return " <img src='$srcurl' alt='$smiley_masked' class='wp-smiley' /> "; +} + +/** + * Convert text equivalent of smilies to images. + * + * Will only convert smilies if the option 'use_smilies' is true and the global + * used in the function isn't empty. + * + * @since 0.71 + * @uses $wp_smiliessearch + * + * @param string $text Content to convert smilies from text. + * @return string Converted content with text smilies replaced with images. + */ +function convert_smilies($text) { + global $wp_smiliessearch; + $output = ''; + if ( get_option('use_smilies') && !empty($wp_smiliessearch) ) { + // HTML loop taken from texturize function, could possible be consolidated + $textarr = preg_split("/(<.*>)/U", $text, -1, PREG_SPLIT_DELIM_CAPTURE); // capture the tags as well as in between + $stop = count($textarr);// loop stuff + for ($i = 0; $i < $stop; $i++) { + $content = $textarr[$i]; + if ((strlen($content) > 0) && ('<' != $content[0])) { // If it's not a tag + $content = preg_replace_callback($wp_smiliessearch, 'translate_smiley', $content); + } + $output .= $content; + } + } else { + // return default text. + $output = $text; + } + return $output; +} + +/** + * Verifies that an email is valid. + * + * Does not grok i18n domains. Not RFC compliant. + * + * @since 0.71 + * + * @param string $email Email address to verify. + * @param boolean $deprecated Deprecated. + * @return string|bool Either false or the valid email address. + */ +function is_email( $email, $deprecated = false ) { + if ( ! empty( $deprecated ) ) + _deprecated_argument( __FUNCTION__, '3.0' ); + + // Test for the minimum length the email can be + if ( strlen( $email ) < 3 ) { + return apply_filters( 'is_email', false, $email, 'email_too_short' ); + } + + // Test for an @ character after the first position + if ( strpos( $email, '@', 1 ) === false ) { + return apply_filters( 'is_email', false, $email, 'email_no_at' ); + } + + // Split out the local and domain parts + list( $local, $domain ) = explode( '@', $email, 2 ); + + // LOCAL PART + // Test for invalid characters + if ( !preg_match( '/^[a-zA-Z0-9!#$%&\'*+\/=?^_`{|}~\.-]+$/', $local ) ) { + return apply_filters( 'is_email', false, $email, 'local_invalid_chars' ); + } + + // DOMAIN PART + // Test for sequences of periods + if ( preg_match( '/\.{2,}/', $domain ) ) { + return apply_filters( 'is_email', false, $email, 'domain_period_sequence' ); + } + + // Test for leading and trailing periods and whitespace + if ( trim( $domain, " \t\n\r\0\x0B." ) !== $domain ) { + return apply_filters( 'is_email', false, $email, 'domain_period_limits' ); + } + + // Split the domain into subs + $subs = explode( '.', $domain ); + + // Assume the domain will have at least two subs + if ( 2 > count( $subs ) ) { + return apply_filters( 'is_email', false, $email, 'domain_no_periods' ); + } + + // Loop through each sub + foreach ( $subs as $sub ) { + // Test for leading and trailing hyphens and whitespace + if ( trim( $sub, " \t\n\r\0\x0B-" ) !== $sub ) { + return apply_filters( 'is_email', false, $email, 'sub_hyphen_limits' ); + } + + // Test for invalid characters + if ( !preg_match('/^[a-z0-9-]+$/i', $sub ) ) { + return apply_filters( 'is_email', false, $email, 'sub_invalid_chars' ); + } + } + + // Congratulations your email made it! + return apply_filters( 'is_email', $email, $email, null ); +} + +/** + * Convert to ASCII from email subjects. + * + * @since 1.2.0 + * @usedby wp_mail() handles charsets in email subjects + * + * @param string $string Subject line + * @return string Converted string to ASCII + */ +function wp_iso_descrambler($string) { + /* this may only work with iso-8859-1, I'm afraid */ + if (!preg_match('#\=\?(.+)\?Q\?(.+)\?\=#i', $string, $matches)) { + return $string; + } else { + $subject = str_replace('_', ' ', $matches[2]); + $subject = preg_replace_callback('#\=([0-9a-f]{2})#i', '_wp_iso_convert', $subject); + return $subject; + } +} + +/** + * Helper function to convert hex encoded chars to ascii + * + * @since 3.1.0 + * @access private + * @param array $match the preg_replace_callback matches array + */ +function _wp_iso_convert( $match ) { + return chr( hexdec( strtolower( $match[1] ) ) ); +} + +/** + * Returns a date in the GMT equivalent. + * + * Requires and returns a date in the Y-m-d H:i:s format. Simply subtracts the + * value of the 'gmt_offset' option. Return format can be overridden using the + * $format parameter. The DateTime and DateTimeZone classes are used to respect + * time zone differences in DST. + * + * @since 1.2.0 + * + * @uses get_option() to retrieve the the value of 'gmt_offset'. + * @param string $string The date to be converted. + * @param string $format The format string for the returned date (default is Y-m-d H:i:s) + * @return string GMT version of the date provided. + */ +function get_gmt_from_date($string, $format = 'Y-m-d H:i:s') { + preg_match('#([0-9]{1,4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})#', $string, $matches); + $tz = get_option('timezone_string'); + if ( $tz ) { + date_default_timezone_set( $tz ); + $datetime = new DateTime( $string ); + $datetime->setTimezone( new DateTimeZone('UTC') ); + $offset = $datetime->getOffset(); + $datetime->modify( '+' . $offset / 3600 . ' hours'); + $string_gmt = gmdate($format, $datetime->format('U')); + + date_default_timezone_set('UTC'); + } else { + $string_time = gmmktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]); + $string_gmt = gmdate($format, $string_time - get_option('gmt_offset') * 3600); + } + return $string_gmt; +} + +/** + * Converts a GMT date into the correct format for the blog. + * + * Requires and returns in the Y-m-d H:i:s format. Simply adds the value of + * gmt_offset.Return format can be overridden using the $format parameter + * + * @since 1.2.0 + * + * @param string $string The date to be converted. + * @param string $format The format string for the returned date (default is Y-m-d H:i:s) + * @return string Formatted date relative to the GMT offset. + */ +function get_date_from_gmt($string, $format = 'Y-m-d H:i:s') { + preg_match('#([0-9]{1,4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})#', $string, $matches); + $string_time = gmmktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]); + $string_localtime = gmdate($format, $string_time + get_option('gmt_offset')*3600); + return $string_localtime; +} + +/** + * Computes an offset in seconds from an iso8601 timezone. + * + * @since 1.5.0 + * + * @param string $timezone Either 'Z' for 0 offset or '±hhmm'. + * @return int|float The offset in seconds. + */ +function iso8601_timezone_to_offset($timezone) { + // $timezone is either 'Z' or '[+|-]hhmm' + if ($timezone == 'Z') { + $offset = 0; + } else { + $sign = (substr($timezone, 0, 1) == '+') ? 1 : -1; + $hours = intval(substr($timezone, 1, 2)); + $minutes = intval(substr($timezone, 3, 4)) / 60; + $offset = $sign * 3600 * ($hours + $minutes); + } + return $offset; +} + +/** + * Converts an iso8601 date to MySQL DateTime format used by post_date[_gmt]. + * + * @since 1.5.0 + * + * @param string $date_string Date and time in ISO 8601 format {@link http://en.wikipedia.org/wiki/ISO_8601}. + * @param string $timezone Optional. If set to GMT returns the time minus gmt_offset. Default is 'user'. + * @return string The date and time in MySQL DateTime format - Y-m-d H:i:s. + */ +function iso8601_to_datetime($date_string, $timezone = 'user') { + $timezone = strtolower($timezone); + + if ($timezone == 'gmt') { + + preg_match('#([0-9]{4})([0-9]{2})([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})(Z|[\+|\-][0-9]{2,4}){0,1}#', $date_string, $date_bits); + + if (!empty($date_bits[7])) { // we have a timezone, so let's compute an offset + $offset = iso8601_timezone_to_offset($date_bits[7]); + } else { // we don't have a timezone, so we assume user local timezone (not server's!) + $offset = 3600 * get_option('gmt_offset'); + } + + $timestamp = gmmktime($date_bits[4], $date_bits[5], $date_bits[6], $date_bits[2], $date_bits[3], $date_bits[1]); + $timestamp -= $offset; + + return gmdate('Y-m-d H:i:s', $timestamp); + + } else if ($timezone == 'user') { + return preg_replace('#([0-9]{4})([0-9]{2})([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})(Z|[\+|\-][0-9]{2,4}){0,1}#', '$1-$2-$3 $4:$5:$6', $date_string); + } +} + +/** + * Adds a element attributes to open links in new windows. + * + * Comment text in popup windows should be filtered through this. Right now it's + * a moderately dumb function, ideally it would detect whether a target or rel + * attribute was already there and adjust its actions accordingly. + * + * @since 0.71 + * + * @param string $text Content to replace links to open in a new window. + * @return string Content that has filtered links. + */ +function popuplinks($text) { + $text = preg_replace('/<a (.+?)>/i', "<a $1 target='_blank' rel='external'>", $text); + return $text; +} + +/** + * Strips out all characters that are not allowable in an email. + * + * @since 1.5.0 + * + * @param string $email Email address to filter. + * @return string Filtered email address. + */ +function sanitize_email( $email ) { + // Test for the minimum length the email can be + if ( strlen( $email ) < 3 ) { + return apply_filters( 'sanitize_email', '', $email, 'email_too_short' ); + } + + // Test for an @ character after the first position + if ( strpos( $email, '@', 1 ) === false ) { + return apply_filters( 'sanitize_email', '', $email, 'email_no_at' ); + } + + // Split out the local and domain parts + list( $local, $domain ) = explode( '@', $email, 2 ); + + // LOCAL PART + // Test for invalid characters + $local = preg_replace( '/[^a-zA-Z0-9!#$%&\'*+\/=?^_`{|}~\.-]/', '', $local ); + if ( '' === $local ) { + return apply_filters( 'sanitize_email', '', $email, 'local_invalid_chars' ); + } + + // DOMAIN PART + // Test for sequences of periods + $domain = preg_replace( '/\.{2,}/', '', $domain ); + if ( '' === $domain ) { + return apply_filters( 'sanitize_email', '', $email, 'domain_period_sequence' ); + } + + // Test for leading and trailing periods and whitespace + $domain = trim( $domain, " \t\n\r\0\x0B." ); + if ( '' === $domain ) { + return apply_filters( 'sanitize_email', '', $email, 'domain_period_limits' ); + } + + // Split the domain into subs + $subs = explode( '.', $domain ); + + // Assume the domain will have at least two subs + if ( 2 > count( $subs ) ) { + return apply_filters( 'sanitize_email', '', $email, 'domain_no_periods' ); + } + + // Create an array that will contain valid subs + $new_subs = array(); + + // Loop through each sub + foreach ( $subs as $sub ) { + // Test for leading and trailing hyphens + $sub = trim( $sub, " \t\n\r\0\x0B-" ); + + // Test for invalid characters + $sub = preg_replace( '/[^a-z0-9-]+/i', '', $sub ); + + // If there's anything left, add it to the valid subs + if ( '' !== $sub ) { + $new_subs[] = $sub; + } + } + + // If there aren't 2 or more valid subs + if ( 2 > count( $new_subs ) ) { + return apply_filters( 'sanitize_email', '', $email, 'domain_no_valid_subs' ); + } + + // Join valid subs into the new domain + $domain = join( '.', $new_subs ); + + // Put the email back together + $email = $local . '@' . $domain; + + // Congratulations your email made it! + return apply_filters( 'sanitize_email', $email, $email, null ); +} + +/** + * Determines the difference between two timestamps. + * + * The difference is returned in a human readable format such as "1 hour", + * "5 mins", "2 days". + * + * @since 1.5.0 + * + * @param int $from Unix timestamp from which the difference begins. + * @param int $to Optional. Unix timestamp to end the time difference. Default becomes time() if not set. + * @return string Human readable time difference. + */ +function human_time_diff( $from, $to = '' ) { + if ( empty($to) ) + $to = time(); + $diff = (int) abs($to - $from); + if ($diff <= 3600) { + $mins = round($diff / 60); + if ($mins <= 1) { + $mins = 1; + } + /* translators: min=minute */ + $since = sprintf(_n('%s min', '%s mins', $mins), $mins); + } else if (($diff <= 86400) && ($diff > 3600)) { + $hours = round($diff / 3600); + if ($hours <= 1) { + $hours = 1; + } + $since = sprintf(_n('%s hour', '%s hours', $hours), $hours); + } elseif ($diff >= 86400) { + $days = round($diff / 86400); + if ($days <= 1) { + $days = 1; + } + $since = sprintf(_n('%s day', '%s days', $days), $days); + } + return $since; +} + +/** + * Generates an excerpt from the content, if needed. + * + * The excerpt word amount will be 55 words and if the amount is greater than + * that, then the string ' [...]' will be appended to the excerpt. If the string + * is less than 55 words, then the content will be returned as is. + * + * The 55 word limit can be modified by plugins/themes using the excerpt_length filter + * The ' [...]' string can be modified by plugins/themes using the excerpt_more filter + * + * @since 1.5.0 + * + * @param string $text The excerpt. If set to empty an excerpt is generated. + * @return string The excerpt. + */ +function wp_trim_excerpt($text) { + $raw_excerpt = $text; + if ( '' == $text ) { + $text = get_the_content(''); + + $text = strip_shortcodes( $text ); + + $text = apply_filters('the_content', $text); + $text = str_replace(']]>', ']]>', $text); + $text = strip_tags($text); + $excerpt_length = apply_filters('excerpt_length', 55); + $excerpt_more = apply_filters('excerpt_more', ' ' . '[...]'); + $words = preg_split("/[\n\r\t ]+/", $text, $excerpt_length + 1, PREG_SPLIT_NO_EMPTY); + if ( count($words) > $excerpt_length ) { + array_pop($words); + $text = implode(' ', $words); + $text = $text . $excerpt_more; + } else { + $text = implode(' ', $words); + } + } + return apply_filters('wp_trim_excerpt', $text, $raw_excerpt); +} + +/** + * Converts named entities into numbered entities. + * + * @since 1.5.1 + * + * @param string $text The text within which entities will be converted. + * @return string Text with converted entities. + */ +function ent2ncr($text) { + $to_ncr = array( + '"' => '"', + '&' => '&', + '⁄' => '/', + '<' => '<', + '>' => '>', + '|' => '|', + ' ' => ' ', + '¡' => '¡', + '¢' => '¢', + '£' => '£', + '¤' => '¤', + '¥' => '¥', + '¦' => '¦', + '&brkbar;' => '¦', + '§' => '§', + '¨' => '¨', + '¨' => '¨', + '©' => '©', + 'ª' => 'ª', + '«' => '«', + '¬' => '¬', + '­' => '­', + '®' => '®', + '¯' => '¯', + '&hibar;' => '¯', + '°' => '°', + '±' => '±', + '²' => '²', + '³' => '³', + '´' => '´', + 'µ' => 'µ', + '¶' => '¶', + '·' => '·', + '¸' => '¸', + '¹' => '¹', + 'º' => 'º', + '»' => '»', + '¼' => '¼', + '½' => '½', + '¾' => '¾', + '¿' => '¿', + 'À' => 'À', + 'Á' => 'Á', + 'Â' => 'Â', + 'Ã' => 'Ã', + 'Ä' => 'Ä', + 'Å' => 'Å', + 'Æ' => 'Æ', + 'Ç' => 'Ç', + 'È' => 'È', + 'É' => 'É', + 'Ê' => 'Ê', + 'Ë' => 'Ë', + 'Ì' => 'Ì', + 'Í' => 'Í', + 'Î' => 'Î', + 'Ï' => 'Ï', + 'Ð' => 'Ð', + 'Ñ' => 'Ñ', + 'Ò' => 'Ò', + 'Ó' => 'Ó', + 'Ô' => 'Ô', + 'Õ' => 'Õ', + 'Ö' => 'Ö', + '×' => '×', + 'Ø' => 'Ø', + 'Ù' => 'Ù', + 'Ú' => 'Ú', + 'Û' => 'Û', + 'Ü' => 'Ü', + 'Ý' => 'Ý', + 'Þ' => 'Þ', + 'ß' => 'ß', + 'à' => 'à', + 'á' => 'á', + 'â' => 'â', + 'ã' => 'ã', + 'ä' => 'ä', + 'å' => 'å', + 'æ' => 'æ', + 'ç' => 'ç', + 'è' => 'è', + 'é' => 'é', + 'ê' => 'ê', + 'ë' => 'ë', + 'ì' => 'ì', + 'í' => 'í', + 'î' => 'î', + 'ï' => 'ï', + 'ð' => 'ð', + 'ñ' => 'ñ', + 'ò' => 'ò', + 'ó' => 'ó', + 'ô' => 'ô', + 'õ' => 'õ', + 'ö' => 'ö', + '÷' => '÷', + 'ø' => 'ø', + 'ù' => 'ù', + 'ú' => 'ú', + 'û' => 'û', + 'ü' => 'ü', + 'ý' => 'ý', + 'þ' => 'þ', + 'ÿ' => 'ÿ', + 'Œ' => 'Œ', + 'œ' => 'œ', + 'Š' => 'Š', + 'š' => 'š', + 'Ÿ' => 'Ÿ', + 'ƒ' => 'ƒ', + 'ˆ' => 'ˆ', + '˜' => '˜', + 'Α' => 'Α', + 'Β' => 'Β', + 'Γ' => 'Γ', + 'Δ' => 'Δ', + 'Ε' => 'Ε', + 'Ζ' => 'Ζ', + 'Η' => 'Η', + 'Θ' => 'Θ', + 'Ι' => 'Ι', + 'Κ' => 'Κ', + 'Λ' => 'Λ', + 'Μ' => 'Μ', + 'Ν' => 'Ν', + 'Ξ' => 'Ξ', + 'Ο' => 'Ο', + 'Π' => 'Π', + 'Ρ' => 'Ρ', + 'Σ' => 'Σ', + 'Τ' => 'Τ', + 'Υ' => 'Υ', + 'Φ' => 'Φ', + 'Χ' => 'Χ', + 'Ψ' => 'Ψ', + 'Ω' => 'Ω', + 'α' => 'α', + 'β' => 'β', + 'γ' => 'γ', + 'δ' => 'δ', + 'ε' => 'ε', + 'ζ' => 'ζ', + 'η' => 'η', + 'θ' => 'θ', + 'ι' => 'ι', + 'κ' => 'κ', + 'λ' => 'λ', + 'μ' => 'μ', + 'ν' => 'ν', + 'ξ' => 'ξ', + 'ο' => 'ο', + 'π' => 'π', + 'ρ' => 'ρ', + 'ς' => 'ς', + 'σ' => 'σ', + 'τ' => 'τ', + 'υ' => 'υ', + 'φ' => 'φ', + 'χ' => 'χ', + 'ψ' => 'ψ', + 'ω' => 'ω', + 'ϑ' => 'ϑ', + 'ϒ' => 'ϒ', + 'ϖ' => 'ϖ', + ' ' => ' ', + ' ' => ' ', + ' ' => ' ', + '‌' => '‌', + '‍' => '‍', + '‎' => '‎', + '‏' => '‏', + '–' => '–', + '—' => '—', + '‘' => '‘', + '’' => '’', + '‚' => '‚', + '“' => '“', + '”' => '”', + '„' => '„', + '†' => '†', + '‡' => '‡', + '•' => '•', + '…' => '…', + '‰' => '‰', + '′' => '′', + '″' => '″', + '‹' => '‹', + '›' => '›', + '‾' => '‾', + '⁄' => '⁄', + '€' => '€', + 'ℑ' => 'ℑ', + '℘' => '℘', + 'ℜ' => 'ℜ', + '™' => '™', + 'ℵ' => 'ℵ', + '↵' => '↵', + '⇐' => '⇐', + '⇑' => '⇑', + '⇒' => '⇒', + '⇓' => '⇓', + '⇔' => '⇔', + '∀' => '∀', + '∂' => '∂', + '∃' => '∃', + '∅' => '∅', + '∇' => '∇', + '∈' => '∈', + '∉' => '∉', + '∋' => '∋', + '∏' => '∏', + '∑' => '∑', + '−' => '−', + '∗' => '∗', + '√' => '√', + '∝' => '∝', + '∞' => '∞', + '∠' => '∠', + '∧' => '∧', + '∨' => '∨', + '∩' => '∩', + '∪' => '∪', + '∫' => '∫', + '∴' => '∴', + '∼' => '∼', + '≅' => '≅', + '≈' => '≈', + '≠' => '≠', + '≡' => '≡', + '≤' => '≤', + '≥' => '≥', + '⊂' => '⊂', + '⊃' => '⊃', + '⊄' => '⊄', + '⊆' => '⊆', + '⊇' => '⊇', + '⊕' => '⊕', + '⊗' => '⊗', + '⊥' => '⊥', + '⋅' => '⋅', + '⌈' => '⌈', + '⌉' => '⌉', + '⌊' => '⌊', + '⌋' => '⌋', + '⟨' => '〈', + '⟩' => '〉', + '←' => '←', + '↑' => '↑', + '→' => '→', + '↓' => '↓', + '↔' => '↔', + '◊' => '◊', + '♠' => '♠', + '♣' => '♣', + '♥' => '♥', + '♦' => '♦' + ); + + return str_replace( array_keys($to_ncr), array_values($to_ncr), $text ); +} + +/** + * Formats text for the rich text editor. + * + * The filter 'richedit_pre' is applied here. If $text is empty the filter will + * be applied to an empty string. + * + * @since 2.0.0 + * + * @param string $text The text to be formatted. + * @return string The formatted text after filter is applied. + */ +function wp_richedit_pre($text) { + // Filtering a blank results in an annoying <br />\n + if ( empty($text) ) return apply_filters('richedit_pre', ''); + + $output = convert_chars($text); + $output = wpautop($output); + $output = htmlspecialchars($output, ENT_NOQUOTES); + + return apply_filters('richedit_pre', $output); +} + +/** + * Formats text for the HTML editor. + * + * Unless $output is empty it will pass through htmlspecialchars before the + * 'htmledit_pre' filter is applied. + * + * @since 2.5.0 + * + * @param string $output The text to be formatted. + * @return string Formatted text after filter applied. + */ +function wp_htmledit_pre($output) { + if ( !empty($output) ) + $output = htmlspecialchars($output, ENT_NOQUOTES); // convert only < > & + + return apply_filters('htmledit_pre', $output); +} + +/** + * Perform a deep string replace operation to ensure the values in $search are no longer present + * + * Repeats the replacement operation until it no longer replaces anything so as to remove "nested" values + * e.g. $subject = '%0%0%0DDD', $search ='%0D', $result ='' rather than the '%0%0DD' that + * str_replace would return + * + * @since 2.8.1 + * @access private + * + * @param string|array $search + * @param string $subject + * @return string The processed string + */ +function _deep_replace( $search, $subject ) { + $found = true; + $subject = (string) $subject; + while ( $found ) { + $found = false; + foreach ( (array) $search as $val ) { + while ( strpos( $subject, $val ) !== false ) { + $found = true; + $subject = str_replace( $val, '', $subject ); + } + } + } + + return $subject; +} + +/** + * Escapes data for use in a MySQL query + * + * This is just a handy shortcut for $wpdb->escape(), for completeness' sake + * + * @since 2.8.0 + * @param string $sql Unescaped SQL data + * @return string The cleaned $sql + */ +function esc_sql( $sql ) { + global $wpdb; + return $wpdb->escape( $sql ); +} + +/** + * Checks and cleans a URL. + * + * A number of characters are removed from the URL. If the URL is for displaying + * (the default behaviour) amperstands are also replaced. The 'clean_url' filter + * is applied to the returned cleaned URL. + * + * @since 2.8.0 + * @uses wp_kses_bad_protocol() To only permit protocols in the URL set + * via $protocols or the common ones set in the function. + * + * @param string $url The URL to be cleaned. + * @param array $protocols Optional. An array of acceptable protocols. + * Defaults to 'http', 'https', 'ftp', 'ftps', 'mailto', 'news', 'irc', 'gopher', 'nntp', 'feed', 'telnet' if not set. + * @param string $_context Private. Use esc_url_raw() for database usage. + * @return string The cleaned $url after the 'clean_url' filter is applied. + */ +function esc_url( $url, $protocols = null, $_context = 'display' ) { + $original_url = $url; + + if ( '' == $url ) + return $url; + $url = preg_replace('|[^a-z0-9-~+_.?#=!&;,/:%@$\|*\'()\\x80-\\xff]|i', '', $url); + $strip = array('%0d', '%0a', '%0D', '%0A'); + $url = _deep_replace($strip, $url); + $url = str_replace(';//', '://', $url); + /* If the URL doesn't appear to contain a scheme, we + * presume it needs http:// appended (unless a relative + * link starting with / or a php file). + */ + if ( strpos($url, ':') === false && + substr( $url, 0, 1 ) != '/' && substr( $url, 0, 1 ) != '#' && !preg_match('/^[a-z0-9-]+?\.php/i', $url) ) + $url = 'http://' . $url; + + // Replace ampersands and single quotes only when displaying. + if ( 'display' == $_context ) { + $url = wp_kses_normalize_entities( $url ); + $url = str_replace( '&', '&', $url ); + $url = str_replace( "'", ''', $url ); + } + + if ( !is_array($protocols) ) + $protocols = array ('http', 'https', 'ftp', 'ftps', 'mailto', 'news', 'irc', 'gopher', 'nntp', 'feed', 'telnet', 'mms', 'rtsp', 'svn'); + if ( wp_kses_bad_protocol( $url, $protocols ) != $url ) + return ''; + + return apply_filters('clean_url', $url, $original_url, $_context); +} + +/** + * Performs esc_url() for database usage. + * + * @since 2.8.0 + * @uses esc_url() + * + * @param string $url The URL to be cleaned. + * @param array $protocols An array of acceptable protocols. + * @return string The cleaned URL. + */ +function esc_url_raw( $url, $protocols = null ) { + return esc_url( $url, $protocols, 'db' ); +} + +/** + * Convert entities, while preserving already-encoded entities. + * + * @link http://www.php.net/htmlentities Borrowed from the PHP Manual user notes. + * + * @since 1.2.2 + * + * @param string $myHTML The text to be converted. + * @return string Converted text. + */ +function htmlentities2($myHTML) { + $translation_table = get_html_translation_table( HTML_ENTITIES, ENT_QUOTES ); + $translation_table[chr(38)] = '&'; + return preg_replace( "/&(?![A-Za-z]{0,4}\w{2,3};|#[0-9]{2,3};)/", "&", strtr($myHTML, $translation_table) ); +} + +/** + * Escape single quotes, htmlspecialchar " < > &, and fix line endings. + * + * Escapes text strings for echoing in JS. It is intended to be used for inline JS + * (in a tag attribute, for example onclick="..."). Note that the strings have to + * be in single quotes. The filter 'js_escape' is also applied here. + * + * @since 2.8.0 + * + * @param string $text The text to be escaped. + * @return string Escaped text. + */ +function esc_js( $text ) { + $safe_text = wp_check_invalid_utf8( $text ); + $safe_text = _wp_specialchars( $safe_text, ENT_COMPAT ); + $safe_text = preg_replace( '/&#(x)?0*(?(1)27|39);?/i', "'", stripslashes( $safe_text ) ); + $safe_text = str_replace( "\r", '', $safe_text ); + $safe_text = str_replace( "\n", '\\n', addslashes( $safe_text ) ); + return apply_filters( 'js_escape', $safe_text, $text ); +} + +/** + * Escaping for HTML blocks. + * + * @since 2.8.0 + * + * @param string $text + * @return string + */ +function esc_html( $text ) { + $safe_text = wp_check_invalid_utf8( $text ); + $safe_text = _wp_specialchars( $safe_text, ENT_QUOTES ); + return apply_filters( 'esc_html', $safe_text, $text ); +} + +/** + * Escaping for HTML attributes. + * + * @since 2.8.0 + * + * @param string $text + * @return string + */ +function esc_attr( $text ) { + $safe_text = wp_check_invalid_utf8( $text ); + $safe_text = _wp_specialchars( $safe_text, ENT_QUOTES ); + return apply_filters( 'attribute_escape', $safe_text, $text ); +} + +/** + * Escaping for textarea values. + * + * @since 3.1 + * + * @param string $text + * @return string + */ +function esc_textarea( $text ) { + $safe_text = htmlspecialchars( $text, ENT_QUOTES ); + return apply_filters( 'esc_textarea', $safe_text, $text ); +} + +/** + * Escape a HTML tag name. + * + * @since 2.5.0 + * + * @param string $tag_name + * @return string + */ +function tag_escape($tag_name) { + $safe_tag = strtolower( preg_replace('/[^a-zA-Z_:]/', '', $tag_name) ); + return apply_filters('tag_escape', $safe_tag, $tag_name); +} + +/** + * Escapes text for SQL LIKE special characters % and _. + * + * @since 2.5.0 + * + * @param string $text The text to be escaped. + * @return string text, safe for inclusion in LIKE query. + */ +function like_escape($text) { + return str_replace(array("%", "_"), array("\\%", "\\_"), $text); +} + +/** + * Convert full URL paths to absolute paths. + * + * Removes the http or https protocols and the domain. Keeps the path '/' at the + * beginning, so it isn't a true relative link, but from the web root base. + * + * @since 2.1.0 + * + * @param string $link Full URL path. + * @return string Absolute path. + */ +function wp_make_link_relative( $link ) { + return preg_replace( '|https?://[^/]+(/.*)|i', '$1', $link ); +} + +/** + * Sanitises various option values based on the nature of the option. + * + * This is basically a switch statement which will pass $value through a number + * of functions depending on the $option. + * + * @since 2.0.5 + * + * @param string $option The name of the option. + * @param string $value The unsanitised value. + * @return string Sanitized value. + */ +function sanitize_option($option, $value) { + + switch ( $option ) { + case 'admin_email': + $value = sanitize_email($value); + if ( !is_email($value) ) { + $value = get_option( $option ); // Resets option to stored value in the case of failed sanitization + if ( function_exists('add_settings_error') ) + add_settings_error('admin_email', 'invalid_admin_email', __('The email address entered did not appear to be a valid email address. Please enter a valid email address.')); + } + break; + case 'new_admin_email': + $value = sanitize_email($value); + if ( !is_email($value) ) { + $value = get_option( $option ); // Resets option to stored value in the case of failed sanitization + if ( function_exists('add_settings_error') ) + add_settings_error('new_admin_email', 'invalid_admin_email', __('The email address entered did not appear to be a valid email address. Please enter a valid email address.')); + } + break; + case 'thumbnail_size_w': + case 'thumbnail_size_h': + case 'medium_size_w': + case 'medium_size_h': + case 'large_size_w': + case 'large_size_h': + case 'embed_size_h': + case 'default_post_edit_rows': + case 'mailserver_port': + case 'comment_max_links': + case 'page_on_front': + case 'page_for_posts': + case 'rss_excerpt_length': + case 'default_category': + case 'default_email_category': + case 'default_link_category': + case 'close_comments_days_old': + case 'comments_per_page': + case 'thread_comments_depth': + case 'users_can_register': + case 'start_of_week': + $value = absint( $value ); + break; + + case 'embed_size_w': + if ( '' !== $value ) + $value = absint( $value ); + break; + + case 'posts_per_page': + case 'posts_per_rss': + $value = (int) $value; + if ( empty($value) ) + $value = 1; + if ( $value < -1 ) + $value = abs($value); + break; + + case 'default_ping_status': + case 'default_comment_status': + // Options that if not there have 0 value but need to be something like "closed" + if ( $value == '0' || $value == '') + $value = 'closed'; + break; + + case 'blogdescription': + case 'blogname': + $value = addslashes($value); + $value = wp_filter_post_kses( $value ); // calls stripslashes then addslashes + $value = stripslashes($value); + $value = esc_html( $value ); + break; + + case 'blog_charset': + $value = preg_replace('/[^a-zA-Z0-9_-]/', '', $value); // strips slashes + break; + + case 'date_format': + case 'time_format': + case 'mailserver_url': + case 'mailserver_login': + case 'mailserver_pass': + case 'ping_sites': + case 'upload_path': + $value = strip_tags($value); + $value = addslashes($value); + $value = wp_filter_kses($value); // calls stripslashes then addslashes + $value = stripslashes($value); + break; + + case 'gmt_offset': + $value = preg_replace('/[^0-9:.-]/', '', $value); // strips slashes + break; + + case 'siteurl': + if ( (bool)preg_match( '#http(s?)://(.+)#i', $value) ) { + $value = esc_url_raw($value); + } else { + $value = get_option( $option ); // Resets option to stored value in the case of failed sanitization + if ( function_exists('add_settings_error') ) + add_settings_error('siteurl', 'invalid_siteurl', __('The WordPress address you entered did not appear to be a valid URL. Please enter a valid URL.')); + } + break; + + case 'home': + if ( (bool)preg_match( '#http(s?)://(.+)#i', $value) ) { + $value = esc_url_raw($value); + } else { + $value = get_option( $option ); // Resets option to stored value in the case of failed sanitization + if ( function_exists('add_settings_error') ) + add_settings_error('home', 'invalid_home', __('The Site address you entered did not appear to be a valid URL. Please enter a valid URL.')); + } + break; + case 'WPLANG': + $allowed = get_available_languages(); + if ( ! in_array( $value, $allowed ) && ! empty( $value ) ) + $value = get_option( $option ); + break; + + case 'timezone_string': + $allowed_zones = timezone_identifiers_list(); + if ( ! in_array( $value, $allowed_zones ) && ! empty( $value ) ) { + $value = get_option( $option ); // Resets option to stored value in the case of failed sanitization + if ( function_exists('add_settings_error') ) + add_settings_error('timezone_string', 'invalid_timezone_string', __('The timezone you have entered is not valid. Please select a valid timezone.') ); + } + break; + + default : + $value = apply_filters("sanitize_option_{$option}", $value, $option); + break; + } + + return $value; +} + +/** + * Parses a string into variables to be stored in an array. + * + * Uses {@link http://www.php.net/parse_str parse_str()} and stripslashes if + * {@link http://www.php.net/magic_quotes magic_quotes_gpc} is on. + * + * @since 2.2.1 + * @uses apply_filters() for the 'wp_parse_str' filter. + * + * @param string $string The string to be parsed. + * @param array $array Variables will be stored in this array. + */ +function wp_parse_str( $string, &$array ) { + parse_str( $string, $array ); + if ( get_magic_quotes_gpc() ) + $array = stripslashes_deep( $array ); + $array = apply_filters( 'wp_parse_str', $array ); +} + +/** + * Convert lone less than signs. + * + * KSES already converts lone greater than signs. + * + * @uses wp_pre_kses_less_than_callback in the callback function. + * @since 2.3.0 + * + * @param string $text Text to be converted. + * @return string Converted text. + */ +function wp_pre_kses_less_than( $text ) { + return preg_replace_callback('%<[^>]*?((?=<)|>|$)%', 'wp_pre_kses_less_than_callback', $text); +} + +/** + * Callback function used by preg_replace. + * + * @uses esc_html to format the $matches text. + * @since 2.3.0 + * + * @param array $matches Populated by matches to preg_replace. + * @return string The text returned after esc_html if needed. + */ +function wp_pre_kses_less_than_callback( $matches ) { + if ( false === strpos($matches[0], '>') ) + return esc_html($matches[0]); + return $matches[0]; +} + +/** + * WordPress implementation of PHP sprintf() with filters. + * + * @since 2.5.0 + * @link http://www.php.net/sprintf + * + * @param string $pattern The string which formatted args are inserted. + * @param mixed $args,... Arguments to be formatted into the $pattern string. + * @return string The formatted string. + */ +function wp_sprintf( $pattern ) { + $args = func_get_args( ); + $len = strlen($pattern); + $start = 0; + $result = ''; + $arg_index = 0; + while ( $len > $start ) { + // Last character: append and break + if ( strlen($pattern) - 1 == $start ) { + $result .= substr($pattern, -1); + break; + } + + // Literal %: append and continue + if ( substr($pattern, $start, 2) == '%%' ) { + $start += 2; + $result .= '%'; + continue; + } + + // Get fragment before next % + $end = strpos($pattern, '%', $start + 1); + if ( false === $end ) + $end = $len; + $fragment = substr($pattern, $start, $end - $start); + + // Fragment has a specifier + if ( $pattern[$start] == '%' ) { + // Find numbered arguments or take the next one in order + if ( preg_match('/^%(\d+)\$/', $fragment, $matches) ) { + $arg = isset($args[$matches[1]]) ? $args[$matches[1]] : ''; + $fragment = str_replace("%{$matches[1]}$", '%', $fragment); + } else { + ++$arg_index; + $arg = isset($args[$arg_index]) ? $args[$arg_index] : ''; + } + + // Apply filters OR sprintf + $_fragment = apply_filters( 'wp_sprintf', $fragment, $arg ); + if ( $_fragment != $fragment ) + $fragment = $_fragment; + else + $fragment = sprintf($fragment, strval($arg) ); + } + + // Append to result and move to next fragment + $result .= $fragment; + $start = $end; + } + return $result; +} + +/** + * Localize list items before the rest of the content. + * + * The '%l' must be at the first characters can then contain the rest of the + * content. The list items will have ', ', ', and', and ' and ' added depending + * on the amount of list items in the $args parameter. + * + * @since 2.5.0 + * + * @param string $pattern Content containing '%l' at the beginning. + * @param array $args List items to prepend to the content and replace '%l'. + * @return string Localized list items and rest of the content. + */ +function wp_sprintf_l($pattern, $args) { + // Not a match + if ( substr($pattern, 0, 2) != '%l' ) + return $pattern; + + // Nothing to work with + if ( empty($args) ) + return ''; + + // Translate and filter the delimiter set (avoid ampersands and entities here) + $l = apply_filters('wp_sprintf_l', array( + /* translators: used between list items, there is a space after the comma */ + 'between' => __(', '), + /* translators: used between list items, there is a space after the and */ + 'between_last_two' => __(', and '), + /* translators: used between only two list items, there is a space after the and */ + 'between_only_two' => __(' and '), + )); + + $args = (array) $args; + $result = array_shift($args); + if ( count($args) == 1 ) + $result .= $l['between_only_two'] . array_shift($args); + // Loop when more than two args + $i = count($args); + while ( $i ) { + $arg = array_shift($args); + $i--; + if ( 0 == $i ) + $result .= $l['between_last_two'] . $arg; + else + $result .= $l['between'] . $arg; + } + return $result . substr($pattern, 2); +} + +/** + * Safely extracts not more than the first $count characters from html string. + * + * UTF-8, tags and entities safe prefix extraction. Entities inside will *NOT* + * be counted as one character. For example & will be counted as 4, < as + * 3, etc. + * + * @since 2.5.0 + * + * @param integer $str String to get the excerpt from. + * @param integer $count Maximum number of characters to take. + * @return string The excerpt. + */ +function wp_html_excerpt( $str, $count ) { + $str = wp_strip_all_tags( $str, true ); + $str = mb_substr( $str, 0, $count ); + // remove part of an entity at the end + $str = preg_replace( '/&[^;\s]{0,6}$/', '', $str ); + return $str; +} + +/** + * Add a Base url to relative links in passed content. + * + * By default it supports the 'src' and 'href' attributes. However this can be + * changed via the 3rd param. + * + * @since 2.7.0 + * + * @param string $content String to search for links in. + * @param string $base The base URL to prefix to links. + * @param array $attrs The attributes which should be processed. + * @return string The processed content. + */ +function links_add_base_url( $content, $base, $attrs = array('src', 'href') ) { + global $_links_add_base; + $_links_add_base = $base; + $attrs = implode('|', (array)$attrs); + return preg_replace_callback( "!($attrs)=(['\"])(.+?)\\2!i", '_links_add_base', $content ); +} + +/** + * Callback to add a base url to relative links in passed content. + * + * @since 2.7.0 + * @access private + * + * @param string $m The matched link. + * @return string The processed link. + */ +function _links_add_base($m) { + global $_links_add_base; + //1 = attribute name 2 = quotation mark 3 = URL + return $m[1] . '=' . $m[2] . + (strpos($m[3], 'http://') === false ? + path_join($_links_add_base, $m[3]) : + $m[3]) + . $m[2]; +} + +/** + * Adds a Target attribute to all links in passed content. + * + * This function by default only applies to <a> tags, however this can be + * modified by the 3rd param. + * + * <b>NOTE:</b> Any current target attributed will be stripped and replaced. + * + * @since 2.7.0 + * + * @param string $content String to search for links in. + * @param string $target The Target to add to the links. + * @param array $tags An array of tags to apply to. + * @return string The processed content. + */ +function links_add_target( $content, $target = '_blank', $tags = array('a') ) { + global $_links_add_target; + $_links_add_target = $target; + $tags = implode('|', (array)$tags); + return preg_replace_callback( "!<($tags)(.+?)>!i", '_links_add_target', $content ); +} + +/** + * Callback to add a target attribute to all links in passed content. + * + * @since 2.7.0 + * @access private + * + * @param string $m The matched link. + * @return string The processed link. + */ +function _links_add_target( $m ) { + global $_links_add_target; + $tag = $m[1]; + $link = preg_replace('|(target=[\'"](.*?)[\'"])|i', '', $m[2]); + return '<' . $tag . $link . ' target="' . esc_attr( $_links_add_target ) . '">'; +} + +// normalize EOL characters and strip duplicate whitespace +function normalize_whitespace( $str ) { + $str = trim($str); + $str = str_replace("\r", "\n", $str); + $str = preg_replace( array( '/\n+/', '/[ \t]+/' ), array( "\n", ' ' ), $str ); + return $str; +} + +/** + * Properly strip all HTML tags including script and style + * + * @since 2.9.0 + * + * @param string $string String containing HTML tags + * @param bool $remove_breaks optional Whether to remove left over line breaks and white space chars + * @return string The processed string. + */ +function wp_strip_all_tags($string, $remove_breaks = false) { + $string = preg_replace( '@<(script|style)[^>]*?>.*?</\\1>@si', '', $string ); + $string = strip_tags($string); + + if ( $remove_breaks ) + $string = preg_replace('/[\r\n\t ]+/', ' ', $string); + + return trim($string); +} + +/** + * Sanitize a string from user input or from the db + * + * check for invalid UTF-8, + * Convert single < characters to entity, + * strip all tags, + * remove line breaks, tabs and extra white space, + * strip octets. + * + * @since 2.9.0 + * + * @param string $str + * @return string + */ +function sanitize_text_field($str) { + $filtered = wp_check_invalid_utf8( $str ); + + if ( strpos($filtered, '<') !== false ) { + $filtered = wp_pre_kses_less_than( $filtered ); + // This will strip extra whitespace for us. + $filtered = wp_strip_all_tags( $filtered, true ); + } else { + $filtered = trim( preg_replace('/[\r\n\t ]+/', ' ', $filtered) ); + } + + $match = array(); + $found = false; + while ( preg_match('/%[a-f0-9]{2}/i', $filtered, $match) ) { + $filtered = str_replace($match[0], '', $filtered); + $found = true; + } + + if ( $found ) { + // Strip out the whitespace that may now exist after removing the octets. + $filtered = trim( preg_replace('/ +/', ' ', $filtered) ); + } + + return apply_filters('sanitize_text_field', $filtered, $str); +} + +/** + * i18n friendly version of basename() + * + * @since 3.1.0 + * + * @param string $path A path. + * @param string $suffix If the filename ends in suffix this will also be cut off. + * @return string + */ +function wp_basename( $path, $suffix = '' ) { + return urldecode( basename( str_replace( '%2F', '/', urlencode( $path ) ), $suffix ) ); +} + +/** + * Forever eliminate "Wordpress" from the planet (or at least the little bit we can influence). + * + * Violating our coding standards for a good function name. + * + * @since 3.0.0 + */ +function capital_P_dangit( $text ) { + // Simple replacement for titles + if ( 'the_title' === current_filter() ) + return str_replace( 'Wordpress', 'WordPress', $text ); + // Still here? Use the more judicious replacement + static $dblq = false; + if ( false === $dblq ) + $dblq = _x('“', 'opening curly quote'); + return str_replace( + array( ' Wordpress', '‘Wordpress', $dblq . 'Wordpress', '>Wordpress', '(Wordpress' ), + array( ' WordPress', '‘WordPress', $dblq . 'WordPress', '>WordPress', '(WordPress' ), + $text ); + +} + +/** + * Sanitize a mime type + * + * @since 3.1.3 + * + * @param string $mime_type Mime type + * @return string Sanitized mime type + */ +function sanitize_mime_type( $mime_type ) { + $sani_mime_type = preg_replace( '/[^-+*.a-zA-Z0-9\/]/', '', $mime_type ); + return apply_filters( 'sanitize_mime_type', $sani_mime_type, $mime_type ); +} + +?> diff --git a/src/wp-includes/functions.php b/src/wp-includes/functions.php new file mode 100644 index 0000000..910bd80 --- /dev/null +++ b/src/wp-includes/functions.php @@ -0,0 +1,4552 @@ +<?php +/** + * Main WordPress API + * + * @package WordPress + */ + +/** + * Converts MySQL DATETIME field to user specified date format. + * + * If $dateformatstring has 'G' value, then gmmktime() function will be used to + * make the time. If $dateformatstring is set to 'U', then mktime() function + * will be used to make the time. + * + * The $translate will only be used, if it is set to true and it is by default + * and if the $wp_locale object has the month and weekday set. + * + * @since 0.71 + * + * @param string $dateformatstring Either 'G', 'U', or php date format. + * @param string $mysqlstring Time from mysql DATETIME field. + * @param bool $translate Optional. Default is true. Will switch format to locale. + * @return string Date formated by $dateformatstring or locale (if available). + */ +function mysql2date( $dateformatstring, $mysqlstring, $translate = true ) { + $m = $mysqlstring; + if ( empty( $m ) ) + return false; + + if ( 'G' == $dateformatstring ) + return strtotime( $m . ' +0000' ); + + $i = strtotime( $m ); + + if ( 'U' == $dateformatstring ) + return $i; + + if ( $translate ) + return date_i18n( $dateformatstring, $i ); + else + return date( $dateformatstring, $i ); +} + +/** + * 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 $gmt is set to either '1' or 'true', then both types will use GMT time. + * if $gmt is false, the output is adjusted with the GMT offset in the WordPress option. + * + * @since 1.0.0 + * + * @param string $type Either 'mysql' or 'timestamp'. + * @param int|bool $gmt Optional. Whether to use GMT timezone. Default is false. + * @return int|string String if $type is 'gmt', int if $type is 'timestamp'. + */ +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 Optional. Unix timestamp. + * @param bool $gmt Optional, default is false. Whether to convert to GMT for time. + * @return string The date, translated if locale specifies it. + */ +function date_i18n( $dateformatstring, $unixtimestamp = false, $gmt = false ) { + global $wp_locale; + $i = $unixtimestamp; + + if ( false === $i ) { + if ( ! $gmt ) + $i = current_time( 'timestamp' ); + else + $i = time(); + // we should not let date() interfere with our + // specially computed timestamp + $gmt = true; + } + + // store original value for language with untypical grammars + // see http://core.trac.wordpress.org/ticket/9396 + $req_format = $dateformatstring; + + $datefunc = $gmt? 'gmdate' : 'date'; + + if ( ( !empty( $wp_locale->month ) ) && ( !empty( $wp_locale->weekday ) ) ) { + $datemonth = $wp_locale->get_month( $datefunc( 'm', $i ) ); + $datemonth_abbrev = $wp_locale->get_month_abbrev( $datemonth ); + $dateweekday = $wp_locale->get_weekday( $datefunc( 'w', $i ) ); + $dateweekday_abbrev = $wp_locale->get_weekday_abbrev( $dateweekday ); + $datemeridiem = $wp_locale->get_meridiem( $datefunc( 'a', $i ) ); + $datemeridiem_capital = $wp_locale->get_meridiem( $datefunc( '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 ); + } + $timezone_formats = array( 'P', 'I', 'O', 'T', 'Z', 'e' ); + $timezone_formats_re = implode( '|', $timezone_formats ); + if ( preg_match( "/$timezone_formats_re/", $dateformatstring ) ) { + $timezone_string = get_option( 'timezone_string' ); + if ( $timezone_string ) { + $timezone_object = timezone_open( $timezone_string ); + $date_object = date_create( null, $timezone_object ); + foreach( $timezone_formats as $timezone_format ) { + if ( false !== strpos( $dateformatstring, $timezone_format ) ) { + $formatted = date_format( $date_object, $timezone_format ); + $dateformatstring = ' '.$dateformatstring; + $dateformatstring = preg_replace( "/([^\\\])$timezone_format/", "\\1" . backslashit( $formatted ), $dateformatstring ); + $dateformatstring = substr( $dateformatstring, 1, strlen( $dateformatstring ) -1 ); + } + } + } + } + $j = @$datefunc( $dateformatstring, $i ); + // allow plugins to redo this entirely for languages with untypical grammars + $j = apply_filters('date_i18n', $j, $req_format, $i, $gmt); + return $j; +} + +/** + * Convert integer number to format based on the locale. + * + * @since 2.3.0 + * + * @param int $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 = 0 ) { + global $wp_locale; + $formatted = number_format( $number, absint( $decimals ), $wp_locale->number_format['decimal_point'], $wp_locale->number_format['thousands_sep'] ); + return apply_filters( 'number_format_i18n', $formatted ); +} + +/** + * 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. Deprecated. + * @return bool|string False on failure. Number string on success. + */ +function size_format( $bytes, $decimals = 0 ) { + $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; +} + +/** + * Get the week start and end from the datetime or date string from mysql. + * + * @since 0.71 + * + * @param string $mysqlstring Date or datetime field type from mysql. + * @param int $start_of_week Optional. Start of the week as an integer. + * @return array Keys are 'start' and 'end'. + */ +function get_weekstartend( $mysqlstring, $start_of_week = '' ) { + $my = substr( $mysqlstring, 0, 4 ); // Mysql string Year + $mm = substr( $mysqlstring, 8, 2 ); // Mysql string Month + $md = substr( $mysqlstring, 5, 2 ); // Mysql string day + $day = mktime( 0, 0, 0, $md, $mm, $my ); // The timestamp for mysqlstring day. + $weekday = date( 'w', $day ); // The day of the week from the timestamp + if ( !is_numeric($start_of_week) ) + $start_of_week = get_option( 'start_of_week' ); + + if ( $weekday < $start_of_week ) + $weekday += 7; + + $start = $day - 86400 * ( $weekday - $start_of_week ); // The most recent week start day on or before $day + $end = $start + 604799; // $start + 7 days - 1 second + return compact( 'start', 'end' ); +} + +/** + * 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 + return @unserialize( $original ); + 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; + $length = strlen( $data ); + if ( $length < 4 ) + return false; + if ( ':' !== $data[1] ) + return false; + $lastc = $data[$length-1]; + if ( ';' !== $lastc && '}' !== $lastc ) + return false; + $token = $data[0]; + switch ( $token ) { + case 's' : + if ( '"' !== $data[$length-2] ) + return false; + case 'a' : + case 'O' : + return (bool) preg_match( "/^{$token}:[0-9]+:/s", $data ); + case 'b' : + case 'i' : + case 'd' : + return (bool) preg_match( "/^{$token}:[0-9.E-]+;\$/", $data ); + } + 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 ); + $length = strlen( $data ); + if ( $length < 4 ) + return false; + elseif ( ':' !== $data[1] ) + return false; + elseif ( ';' !== $data[$length-1] ) + return false; + elseif ( $data[0] !== 's' ) + return false; + elseif ( '"' !== $data[$length-2] ) + return false; + else + return true; +} + +/** + * Retrieve option value based on name of option. + * + * 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. + * + * If the option was serialized then it will be unserialized when it is returned. + * + * @since 1.5.0 + * @package WordPress + * @subpackage Option + * @uses apply_filters() Calls 'pre_option_$option' before checking the option. + * Any value other than false will "short-circuit" the retrieval of the option + * and return the returned value. You should not try to override special options, + * but you will not be prevented from doing so. + * @uses apply_filters() Calls 'option_$option', after checking the option, with + * the option value. + * + * @param string $option Name of option to retrieve. Expected to not be SQL-escaped. + * @return mixed Value set for the option. + */ +function get_option( $option, $default = false ) { + global $wpdb; + + // Allow plugins to short-circuit options. + $pre = apply_filters( 'pre_option_' . $option, false ); + if ( false !== $pre ) + return $pre; + + $option = trim($option); + if ( empty($option) ) + return false; + + if ( defined( 'WP_SETUP_CONFIG' ) ) + return false; + + if ( ! defined( 'WP_INSTALLING' ) ) { + // prevent non-existent options from triggering multiple queries + $notoptions = wp_cache_get( 'notoptions', 'options' ); + if ( isset( $notoptions[$option] ) ) + return $default; + + $alloptions = wp_load_alloptions(); + + if ( isset( $alloptions[$option] ) ) { + $value = $alloptions[$option]; + } else { + $value = wp_cache_get( $option, 'options' ); + + if ( false === $value ) { + $row = $wpdb->get_row( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = %s LIMIT 1", $option ) ); + + // Has to be get_row instead of get_var because of funkiness with 0, false, null values + if ( is_object( $row ) ) { + $value = $row->option_value; + wp_cache_add( $option, $value, 'options' ); + } else { // option does not exist, so we must cache its non-existence + $notoptions[$option] = true; + wp_cache_set( 'notoptions', $notoptions, 'options' ); + return $default; + } + } + } + } else { + $suppress = $wpdb->suppress_errors(); + $row = $wpdb->get_row( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = %s LIMIT 1", $option ) ); + $wpdb->suppress_errors( $suppress ); + if ( is_object( $row ) ) + $value = $row->option_value; + else + return $default; + } + + // If home is not set use siteurl. + if ( 'home' == $option && '' == $value ) + return get_option( 'siteurl' ); + + if ( in_array( $option, array('siteurl', 'home', 'category_base', 'tag_base') ) ) + $value = untrailingslashit( $value ); + + return apply_filters( 'option_' . $option, maybe_unserialize( $value ) ); +} + +/** + * Protect WordPress special option from being modified. + * + * Will die if $option is in protected list. Protected options are 'alloptions' + * and 'notoptions' options. + * + * @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 ) ) + wp_die( sprintf( __( '%s is a protected WP option and may not be modified' ), esc_html( $option ) ) ); +} + +/** + * Print option value after sanitizing for forms. + * + * @uses attr Sanitizes value. + * @since 1.5.0 + * @package WordPress + * @subpackage Option + * + * @param string $option Option name. + */ +function form_option( $option ) { + echo esc_attr( get_option( $option ) ); +} + +/** + * Loads and caches all autoloaded options, if available or all options. + * + * @since 2.2.0 + * @package WordPress + * @subpackage Option + * + * @return array List of all options. + */ +function wp_load_alloptions() { + global $wpdb; + + if ( !defined( 'WP_INSTALLING' ) || !is_multisite() ) + $alloptions = wp_cache_get( 'alloptions', 'options' ); + else + $alloptions = false; + + if ( !$alloptions ) { + $suppress = $wpdb->suppress_errors(); + if ( !$alloptions_db = $wpdb->get_results( "SELECT option_name, option_value FROM $wpdb->options WHERE autoload = 'yes'" ) ) + $alloptions_db = $wpdb->get_results( "SELECT option_name, option_value FROM $wpdb->options" ); + $wpdb->suppress_errors($suppress); + $alloptions = array(); + foreach ( (array) $alloptions_db as $o ) { + $alloptions[$o->option_name] = $o->option_value; + } + if ( !defined( 'WP_INSTALLING' ) || !is_multisite() ) + wp_cache_add( 'alloptions', $alloptions, 'options' ); + } + + return $alloptions; +} + +/** + * Loads and caches certain often requested site options if is_multisite() and a peristent cache is not being used. + * + * @since 3.0.0 + * @package WordPress + * @subpackage Option + * + * @param int $site_id Optional site ID for which to query the options. Defaults to the current site. + */ +function wp_load_core_site_options( $site_id = null ) { + global $wpdb, $_wp_using_ext_object_cache; + + if ( !is_multisite() || $_wp_using_ext_object_cache || defined( 'WP_INSTALLING' ) ) + return; + + if ( empty($site_id) ) + $site_id = $wpdb->siteid; + + $core_options = array('site_name', 'siteurl', 'active_sitewide_plugins', '_site_transient_timeout_theme_roots', '_site_transient_theme_roots', 'site_admins', 'can_compress_scripts', 'global_terms_enabled' ); + + $core_options_in = "'" . implode("', '", $core_options) . "'"; + $options = $wpdb->get_results( $wpdb->prepare("SELECT meta_key, meta_value FROM $wpdb->sitemeta WHERE meta_key IN ($core_options_in) AND site_id = %d", $site_id) ); + + foreach ( $options as $option ) { + $key = $option->meta_key; + $cache_key = "{$site_id}:$key"; + $option->meta_value = maybe_unserialize( $option->meta_value ); + + wp_cache_set( $cache_key, $option->meta_value, 'site-options' ); + } +} + +/** + * Update the value of an option that was already added. + * + * You do not need to serialize values. If the value needs to be serialized, then + * it will be serialized before it is inserted into the database. Remember, + * resources can not be serialized or added as an option. + * + * 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 is autoloaded, then you need to use the add_option(). + * + * @since 1.0.0 + * @package WordPress + * @subpackage Option + * + * @uses apply_filters() Calls 'pre_update_option_$option' hook to allow overwriting the + * option value to be stored. + * @uses do_action() Calls 'update_option' hook before updating the option. + * @uses do_action() Calls 'update_option_$option' and 'updated_option' hooks on success. + * + * @param string $option Option name. Expected to not be SQL-escaped. + * @param mixed $newvalue Option value. Expected to not be SQL-escaped. + * @return bool False if value was not updated and true if value was updated. + */ +function update_option( $option, $newvalue ) { + global $wpdb; + + $option = trim($option); + if ( empty($option) ) + return false; + + wp_protect_special_option( $option ); + + if ( is_object($newvalue) ) + $newvalue = clone $newvalue; + + $newvalue = sanitize_option( $option, $newvalue ); + $oldvalue = get_option( $option ); + $newvalue = apply_filters( 'pre_update_option_' . $option, $newvalue, $oldvalue ); + + // If the new and old values are the same, no need to update. + if ( $newvalue === $oldvalue ) + return false; + + if ( false === $oldvalue ) + return add_option( $option, $newvalue ); + + $notoptions = wp_cache_get( 'notoptions', 'options' ); + if ( is_array( $notoptions ) && isset( $notoptions[$option] ) ) { + unset( $notoptions[$option] ); + wp_cache_set( 'notoptions', $notoptions, 'options' ); + } + + $_newvalue = $newvalue; + $newvalue = maybe_serialize( $newvalue ); + + do_action( 'update_option', $option, $oldvalue, $_newvalue ); + if ( ! defined( 'WP_INSTALLING' ) ) { + $alloptions = wp_load_alloptions(); + if ( isset( $alloptions[$option] ) ) { + $alloptions[$option] = $_newvalue; + wp_cache_set( 'alloptions', $alloptions, 'options' ); + } else { + wp_cache_set( $option, $_newvalue, 'options' ); + } + } + + $result = $wpdb->update( $wpdb->options, array( 'option_value' => $newvalue ), array( 'option_name' => $option ) ); + + if ( $result ) { + do_action( "update_option_{$option}", $oldvalue, $_newvalue ); + do_action( 'updated_option', $option, $oldvalue, $_newvalue ); + return true; + } + return false; +} + +/** + * Add a new option. + * + * You do not need to serialize values. If the value needs to be serialized, then + * it will be serialized before it is inserted into the database. Remember, + * resources can not be serialized or added as an 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. + * + * @package WordPress + * @subpackage Option + * @since 1.0.0 + * + * @uses do_action() Calls 'add_option' hook before adding the option. + * @uses do_action() Calls 'add_option_$option' and 'added_option' hooks on success. + * + * @param string $option Name of option to add. Expected to not be SQL-escaped. + * @param mixed $value Optional. Option value, can be anything. Expected to not be SQL-escaped. + * @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( $option, $value = '', $deprecated = '', $autoload = 'yes' ) { + global $wpdb; + + if ( !empty( $deprecated ) ) + _deprecated_argument( __FUNCTION__, '2.3' ); + + $option = trim($option); + if ( empty($option) ) + return false; + + wp_protect_special_option( $option ); + + if ( is_object($value) ) + $value = clone $value; + + $value = sanitize_option( $option, $value ); + + // Make sure the option doesn't already exist. We can check the 'notoptions' cache before we ask for a db query + $notoptions = wp_cache_get( 'notoptions', 'options' ); + if ( !is_array( $notoptions ) || !isset( $notoptions[$option] ) ) + if ( false !== get_option( $option ) ) + return; + + $_value = $value; + $value = maybe_serialize( $value ); + $autoload = ( 'no' === $autoload ) ? 'no' : 'yes'; + do_action( 'add_option', $option, $_value ); + if ( ! defined( 'WP_INSTALLING' ) ) { + if ( 'yes' == $autoload ) { + $alloptions = wp_load_alloptions(); + $alloptions[$option] = $value; + wp_cache_set( 'alloptions', $alloptions, 'options' ); + } else { + wp_cache_set( $option, $value, 'options' ); + } + } + + // This option exists now + $notoptions = wp_cache_get( 'notoptions', 'options' ); // yes, again... we need it to be fresh + if ( is_array( $notoptions ) && isset( $notoptions[$option] ) ) { + unset( $notoptions[$option] ); + wp_cache_set( 'notoptions', $notoptions, 'options' ); + } + + $result = $wpdb->query( $wpdb->prepare( "INSERT INTO `$wpdb->options` (`option_name`, `option_value`, `autoload`) VALUES (%s, %s, %s) ON DUPLICATE KEY UPDATE `option_name` = VALUES(`option_name`), `option_value` = VALUES(`option_value`), `autoload` = VALUES(`autoload`)", $option, $value, $autoload ) ); + + if ( $result ) { + do_action( "add_option_{$option}", $option, $_value ); + do_action( 'added_option', $option, $_value ); + return true; + } + return false; +} + +/** + * Removes option by name. Prevents removal of protected WordPress options. + * + * @package WordPress + * @subpackage Option + * @since 1.2.0 + * + * @uses do_action() Calls 'delete_option' hook before option is deleted. + * @uses do_action() Calls 'deleted_option' and 'delete_option_$option' hooks on success. + * + * @param string $option Name of option to remove. Expected to not be SQL-escaped. + * @return bool True, if option is successfully deleted. False on failure. + */ +function delete_option( $option ) { + global $wpdb; + + wp_protect_special_option( $option ); + + // Get the ID, if no ID then return + $row = $wpdb->get_row( $wpdb->prepare( "SELECT autoload FROM $wpdb->options WHERE option_name = %s", $option ) ); + if ( is_null( $row ) ) + return false; + do_action( 'delete_option', $option ); + $result = $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->options WHERE option_name = %s", $option) ); + if ( ! defined( 'WP_INSTALLING' ) ) { + if ( 'yes' == $row->autoload ) { + $alloptions = wp_load_alloptions(); + if ( is_array( $alloptions ) && isset( $alloptions[$option] ) ) { + unset( $alloptions[$option] ); + wp_cache_set( 'alloptions', $alloptions, 'options' ); + } + } else { + wp_cache_delete( $option, 'options' ); + } + } + if ( $result ) { + do_action( "delete_option_$option", $option ); + do_action( 'deleted_option', $option ); + return true; + } + return false; +} + +/** + * Delete a transient + * + * @since 2.8.0 + * @package WordPress + * @subpackage Transient + * + * @uses do_action() Calls 'delete_transient_$transient' hook before transient is deleted. + * @uses do_action() Calls 'deleted_transient' hook on success. + * + * @param string $transient Transient name. Expected to not be SQL-escaped. + * @return bool true if successful, false otherwise + */ +function delete_transient( $transient ) { + global $_wp_using_ext_object_cache; + + do_action( 'delete_transient_' . $transient, $transient ); + + if ( $_wp_using_ext_object_cache ) { + $result = wp_cache_delete( $transient, 'transient' ); + } else { + $option_timeout = '_transient_timeout_' . $transient; + $option = '_transient_' . $transient; + $result = delete_option( $option ); + if ( $result ) + delete_option( $option_timeout ); + } + + if ( $result ) + do_action( 'deleted_transient', $transient ); + return $result; +} + +/** + * Get the value of a transient + * + * If the transient does not exist or does not have a value, then the return value + * will be false. + * + * @uses apply_filters() Calls 'pre_transient_$transient' hook before checking the transient. + * Any value other than false will "short-circuit" the retrieval of the transient + * and return the returned value. + * @uses apply_filters() Calls 'transient_$option' hook, after checking the transient, with + * the transient value. + * + * @since 2.8.0 + * @package WordPress + * @subpackage Transient + * + * @param string $transient Transient name. Expected to not be SQL-escaped + * @return mixed Value of transient + */ +function get_transient( $transient ) { + global $_wp_using_ext_object_cache; + + $pre = apply_filters( 'pre_transient_' . $transient, false ); + if ( false !== $pre ) + return $pre; + + if ( $_wp_using_ext_object_cache ) { + $value = wp_cache_get( $transient, 'transient' ); + } else { + $transient_option = '_transient_' . $transient; + if ( ! defined( 'WP_INSTALLING' ) ) { + // If option is not in alloptions, it is not autoloaded and thus has a timeout + $alloptions = wp_load_alloptions(); + if ( !isset( $alloptions[$transient_option] ) ) { + $transient_timeout = '_transient_timeout_' . $transient; + if ( get_option( $transient_timeout ) < time() ) { + delete_option( $transient_option ); + delete_option( $transient_timeout ); + return false; + } + } + } + + $value = get_option( $transient_option ); + } + + return apply_filters( 'transient_' . $transient, $value ); +} + +/** + * Set/update the value of a transient + * + * You do not need to serialize values. If the value needs to be serialized, then + * it will be serialized before it is set. + * + * @since 2.8.0 + * @package WordPress + * @subpackage Transient + * + * @uses apply_filters() Calls 'pre_set_transient_$transient' hook to allow overwriting the + * transient value to be stored. + * @uses do_action() Calls 'set_transient_$transient' and 'setted_transient' hooks on success. + * + * @param string $transient Transient name. Expected to not be SQL-escaped. + * @param mixed $value Transient value. Expected to not be SQL-escaped. + * @param int $expiration Time until expiration in seconds, default 0 + * @return bool False if value was not set and true if value was set. + */ +function set_transient( $transient, $value, $expiration = 0 ) { + global $_wp_using_ext_object_cache; + + $value = apply_filters( 'pre_set_transient_' . $transient, $value ); + + if ( $_wp_using_ext_object_cache ) { + $result = wp_cache_set( $transient, $value, 'transient', $expiration ); + } else { + $transient_timeout = '_transient_timeout_' . $transient; + $transient = '_transient_' . $transient; + if ( false === get_option( $transient ) ) { + $autoload = 'yes'; + if ( $expiration ) { + $autoload = 'no'; + add_option( $transient_timeout, time() + $expiration, '', 'no' ); + } + $result = add_option( $transient, $value, '', $autoload ); + } else { + if ( $expiration ) + update_option( $transient_timeout, time() + $expiration ); + $result = update_option( $transient, $value ); + } + } + if ( $result ) { + do_action( 'set_transient_' . $transient ); + do_action( 'setted_transient', $transient ); + } + return $result; +} + +/** + * Saves and restores user interface settings stored in a cookie. + * + * Checks if the current user-settings cookie is updated and stores it. When no + * cookie exists (different browser used), adds the last saved cookie restoring + * the settings. + * + * @package WordPress + * @subpackage Option + * @since 2.7.0 + */ +function wp_user_settings() { + + if ( ! is_admin() ) + return; + + if ( defined('DOING_AJAX') ) + return; + + if ( ! $user = wp_get_current_user() ) + return; + + $settings = get_user_option( 'user-settings', $user->ID ); + + if ( isset( $_COOKIE['wp-settings-' . $user->ID] ) ) { + $cookie = preg_replace( '/[^A-Za-z0-9=&_]/', '', $_COOKIE['wp-settings-' . $user->ID] ); + + if ( ! empty( $cookie ) && strpos( $cookie, '=' ) ) { + if ( $cookie == $settings ) + return; + + $last_time = (int) get_user_option( 'user-settings-time', $user->ID ); + $saved = isset( $_COOKIE['wp-settings-time-' . $user->ID]) ? preg_replace( '/[^0-9]/', '', $_COOKIE['wp-settings-time-' . $user->ID] ) : 0; + + if ( $saved > $last_time ) { + update_user_option( $user->ID, 'user-settings', $cookie, false ); + update_user_option( $user->ID, 'user-settings-time', time() - 5, false ); + return; + } + } + } + + setcookie( 'wp-settings-' . $user->ID, $settings, time() + 31536000, SITECOOKIEPATH ); + setcookie( 'wp-settings-time-' . $user->ID, time(), time() + 31536000, SITECOOKIEPATH ); + $_COOKIE['wp-settings-' . $user->ID] = $settings; +} + +/** + * Retrieve user interface setting value based on setting name. + * + * @package WordPress + * @subpackage Option + * @since 2.7.0 + * + * @param string $name The name of the setting. + * @param string $default Optional default value to return when $name is not set. + * @return mixed the last saved user setting or the default value/false if it doesn't exist. + */ +function get_user_setting( $name, $default = false ) { + + $all = get_all_user_settings(); + + return isset($all[$name]) ? $all[$name] : $default; +} + +/** + * Add or update user interface setting. + * + * Both $name and $value can contain only ASCII letters, numbers and underscores. + * This function has to be used before any output has started as it calls setcookie(). + * + * @package WordPress + * @subpackage Option + * @since 2.8.0 + * + * @param string $name The name of the setting. + * @param string $value The value for the setting. + * @return bool true if set successfully/false if not. + */ +function set_user_setting( $name, $value ) { + + if ( headers_sent() ) + return false; + + $all = get_all_user_settings(); + $name = preg_replace( '/[^A-Za-z0-9_]+/', '', $name ); + + if ( empty($name) ) + return false; + + $all[$name] = $value; + + return wp_set_all_user_settings($all); +} + +/** + * Delete user interface settings. + * + * Deleting settings would reset them to the defaults. + * This function has to be used before any output has started as it calls setcookie(). + * + * @package WordPress + * @subpackage Option + * @since 2.7.0 + * + * @param mixed $names The name or array of names of the setting to be deleted. + * @return bool true if deleted successfully/false if not. + */ +function delete_user_setting( $names ) { + + if ( headers_sent() ) + return false; + + $all = get_all_user_settings(); + $names = (array) $names; + + foreach ( $names as $name ) { + if ( isset($all[$name]) ) { + unset($all[$name]); + $deleted = true; + } + } + + if ( isset($deleted) ) + return wp_set_all_user_settings($all); + + return false; +} + +/** + * Retrieve all user interface settings. + * + * @package WordPress + * @subpackage Option + * @since 2.7.0 + * + * @return array the last saved user settings or empty array. + */ +function get_all_user_settings() { + global $_updated_user_settings; + + if ( ! $user = wp_get_current_user() ) + return array(); + + if ( isset($_updated_user_settings) && is_array($_updated_user_settings) ) + return $_updated_user_settings; + + $all = array(); + if ( isset($_COOKIE['wp-settings-' . $user->ID]) ) { + $cookie = preg_replace( '/[^A-Za-z0-9=&_]/', '', $_COOKIE['wp-settings-' . $user->ID] ); + + if ( $cookie && strpos($cookie, '=') ) // the '=' cannot be 1st char + parse_str($cookie, $all); + + } else { + $option = get_user_option('user-settings', $user->ID); + if ( $option && is_string($option) ) + parse_str( $option, $all ); + } + + return $all; +} + +/** + * Private. Set all user interface settings. + * + * @package WordPress + * @subpackage Option + * @since 2.8.0 + * + * @param unknown $all + * @return bool + */ +function wp_set_all_user_settings($all) { + global $_updated_user_settings; + + if ( ! $user = wp_get_current_user() ) + return false; + + $_updated_user_settings = $all; + $settings = ''; + foreach ( $all as $k => $v ) { + $v = preg_replace( '/[^A-Za-z0-9_]+/', '', $v ); + $settings .= $k . '=' . $v . '&'; + } + + $settings = rtrim($settings, '&'); + + update_user_option( $user->ID, 'user-settings', $settings, false ); + update_user_option( $user->ID, 'user-settings-time', time(), false ); + + return true; +} + +/** + * Delete the user settings of the current user. + * + * @package WordPress + * @subpackage Option + * @since 2.7.0 + */ +function delete_all_user_settings() { + if ( ! $user = wp_get_current_user() ) + return; + + update_user_option( $user->ID, 'user-settings', '', false ); + setcookie('wp-settings-' . $user->ID, ' ', time() - 31536000, SITECOOKIEPATH); +} + +/** + * Serialize data, if needed. + * + * @since 2.0.5 + * + * @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; +} + +/** + * Retrieve post title from XMLRPC XML. + * + * If the title element is not part of the XML, then the default post title from + * the $post_default_title will be used instead. + * + * @package WordPress + * @subpackage XMLRPC + * @since 0.71 + * + * @global string $post_default_title Default XMLRPC post title. + * + * @param string $content XMLRPC XML Request content + * @return string Post title + */ +function xmlrpc_getposttitle( $content ) { + global $post_default_title; + if ( preg_match( '/<title>(.+?)<\/title>/is', $content, $matchtitle ) ) { + $post_title = $matchtitle[1]; + } else { + $post_title = $post_default_title; + } + return $post_title; +} + +/** + * Retrieve the post category or categories from XMLRPC XML. + * + * If the category element is not found, then the default post category will be + * used. The return type then would be what $post_default_category. If the + * category is found, then it will always be an array. + * + * @package WordPress + * @subpackage XMLRPC + * @since 0.71 + * + * @global string $post_default_category Default XMLRPC post category. + * + * @param string $content XMLRPC XML Request content + * @return string|array List of categories or category name. + */ +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; +} + +/** + * XMLRPC XML content without title and category elements. + * + * @package WordPress + * @subpackage XMLRPC + * @since 0.71 + * + * @param string $content XMLRPC XML Request content + * @return string XMLRPC XML Request content without title and category elements. + */ +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 0.71 + * @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 0.71 + * @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 0.71 + * @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 ); +} + +/** + * Check content for video and audio links to add as enclosures. + * + * Will not add enclosures that have already been added and will + * remove enclosures that are no longer in the post. This is called as + * pingbacks and trackbacks. + * + * @package WordPress + * @since 1.5.0 + * + * @uses $wpdb + * + * @param string $content Post Content + * @param int $post_ID Post ID + */ +function do_enclose( $content, $post_ID ) { + global $wpdb; + + //TODO: Tidy this ghetto code up and make the debug code optional + 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 ( $pung as $link_test ) { + if ( !in_array( $link_test, $post_links_temp[0] ) ) { // link no longer in post + $mid = $wpdb->get_col( $wpdb->prepare("SELECT meta_id FROM $wpdb->postmeta WHERE post_id = %d AND meta_key = 'enclosure' AND meta_value LIKE (%s)", $post_ID, like_escape( $link_test ) . '%') ); + do_action( 'delete_postmeta', $mid ); + $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->postmeta WHERE meta_id IN(%s)", implode( ',', $mid ) ) ); + do_action( 'deleted_postmeta', $mid ); + } + } + + foreach ( (array) $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 ( false === $test ) + continue; + if ( isset( $test['query'] ) ) + $post_links[] = $link_test; + elseif ( isset($test['path']) && ( $test['path'] != '/' ) && ($test['path'] != '' ) ) + $post_links[] = $link_test; + } + } + + foreach ( (array) $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, like_escape( $url ) . '%' ) ) ) { + + if ( $headers = wp_get_http_headers( $url) ) { + $len = (int) $headers['content-length']; + $type = $headers['content-type']; + $allowed_types = array( 'video', 'audio' ); + + // Check to see if we can figure out the mime type from + // the extension + $url_parts = @parse_url( $url ); + if ( false !== $url_parts ) { + $extension = pathinfo( $url_parts['path'], PATHINFO_EXTENSION ); + if ( !empty( $extension ) ) { + foreach ( get_allowed_mime_types( ) as $exts => $mime ) { + if ( preg_match( '!^(' . $exts . ')$!i', $extension ) ) { + $type = $mime; + break; + } + } + } + } + + if ( in_array( substr( $type, 0, strpos( $type, "/" ) ), $allowed_types ) ) { + $meta_value = "$url\n$len\n$type\n"; + $wpdb->insert($wpdb->postmeta, array('post_id' => $post_ID, 'meta_key' => 'enclosure', 'meta_value' => $meta_value) ); + do_action( 'added_postmeta', $wpdb->insert_id, $post_ID, 'enclosure', $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 2.5.0 + * + * @param string $url URL to fetch. + * @param string|bool $file_path Optional. File path to write request to. + * @param int $red (private) The number of Redirects followed, Upon 5 being hit, returns false. + * @return bool|string False on failure and string of headers if HEAD request. + */ +function wp_get_http( $url, $file_path = false, $red = 1 ) { + @set_time_limit( 60 ); + + if ( $red > 5 ) + return false; + + $options = array(); + $options['redirection'] = 5; + + if ( false == $file_path ) + $options['method'] = 'HEAD'; + else + $options['method'] = 'GET'; + + $response = wp_remote_request($url, $options); + + if ( is_wp_error( $response ) ) + return false; + + $headers = wp_remote_retrieve_headers( $response ); + $headers['response'] = wp_remote_retrieve_response_code( $response ); + + // WP_HTTP no longer follows redirects for HEAD requests. + if ( 'HEAD' == $options['method'] && in_array($headers['response'], array(301, 302)) && isset( $headers['location'] ) ) { + return wp_get_http( $headers['location'], $file_path, ++$red ); + } + + if ( false == $file_path ) + return $headers; + + // GET request - write it to the supplied filename + $out_fp = fopen($file_path, 'w'); + if ( !$out_fp ) + return $headers; + + fwrite( $out_fp, wp_remote_retrieve_body( $response ) ); + fclose($out_fp); + clearstatcache(); + + return $headers; +} + +/** + * Retrieve HTTP Headers from URL. + * + * @since 1.5.1 + * + * @param string $url + * @param bool $deprecated Not Used. + * @return bool|string False on failure, headers on success. + */ +function wp_get_http_headers( $url, $deprecated = false ) { + if ( !empty( $deprecated ) ) + _deprecated_argument( __FUNCTION__, '2.7' ); + + $response = wp_remote_head( $url ); + + if ( is_wp_error( $response ) ) + return false; + + return wp_remote_retrieve_headers( $response ); +} + +/** + * Whether today is a new day. + * + * @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 $currentday, $previousday; + if ( $currentday != $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 2.3.0 + * + * @param array $data URL-encode key/value pairs. + * @return string URL encoded string + */ +function build_query( $data ) { + return _http_build_query( $data, null, '&', '', false ); +} + +// from php.net (modified by Mark Jaquith to behave like the native PHP5 function) +function _http_build_query($data, $prefix=null, $sep=null, $key='', $urlencode=true) { + $ret = array(); + + foreach ( (array) $data as $k => $v ) { + if ( $urlencode) + $k = urlencode($k); + if ( is_int($k) && $prefix != null ) + $k = $prefix.$k; + if ( !empty($key) ) + $k = $key . '%5B' . $k . '%5D'; + if ( $v === NULL ) + continue; + elseif ( $v === FALSE ) + $v = '0'; + + if ( is_array($v) || is_object($v) ) + array_push($ret,_http_build_query($v, '', $sep, $k, $urlencode)); + elseif ( $urlencode ) + array_push($ret, $k.'='.urlencode($v)); + else + array_push($ret, $k.'='.$v); + } + + if ( NULL === $sep ) + $sep = ini_get('arg_separator.output'); + + return implode($sep, $ret); +} + +/** + * 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 string New URL query string. + */ +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 ( (array) $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 string New URL query string. + */ +function remove_query_arg( $key, $query=false ) { + if ( is_array( $key ) ) { // removing multiple keys + foreach ( $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. + * + * @since 0.71 + * + * @param array $array Array to used to walk while sanitizing contents. + * @return array Sanitized $array. + */ +function add_magic_quotes( $array ) { + foreach ( (array) $array as $k => $v ) { + if ( is_array( $v ) ) { + $array[$k] = add_magic_quotes( $v ); + } else { + $array[$k] = addslashes( $v ); + } + } + return $array; +} + +/** + * HTTP request for URI to retrieve content. + * + * @since 1.5.1 + * @uses wp_remote_get() + * + * @param string $uri URI/URL of web page to retrieve. + * @return bool|string HTTP content. False on failure. + */ +function wp_remote_fopen( $uri ) { + $parsed_url = @parse_url( $uri ); + + if ( !$parsed_url || !is_array( $parsed_url ) ) + return false; + + $options = array(); + $options['timeout'] = 10; + + $response = wp_remote_get( $uri, $options ); + + if ( is_wp_error( $response ) ) + return false; + + return wp_remote_retrieve_body( $response ); +} + +/** + * Set up the WordPress query. + * + * @since 2.0.0 + * + * @param string $query_vars Default WP_Query arguments. + */ +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', + 102 => 'Processing', + + 200 => 'OK', + 201 => 'Created', + 202 => 'Accepted', + 203 => 'Non-Authoritative Information', + 204 => 'No Content', + 205 => 'Reset Content', + 206 => 'Partial Content', + 207 => 'Multi-Status', + 226 => 'IM Used', + + 300 => 'Multiple Choices', + 301 => 'Moved Permanently', + 302 => 'Found', + 303 => 'See Other', + 304 => 'Not Modified', + 305 => 'Use Proxy', + 306 => 'Reserved', + 307 => 'Temporary Redirect', + + 400 => 'Bad Request', + 401 => 'Unauthorized', + 402 => 'Payment Required', + 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', + 422 => 'Unprocessable Entity', + 423 => 'Locked', + 424 => 'Failed Dependency', + 426 => 'Upgrade Required', + + 500 => 'Internal Server Error', + 501 => 'Not Implemented', + 502 => 'Bad Gateway', + 503 => 'Service Unavailable', + 504 => 'Gateway Timeout', + 505 => 'HTTP Version Not Supported', + 506 => 'Variant Also Negotiates', + 507 => 'Insufficient Storage', + 510 => 'Not Extended' + ); + } + + if ( isset( $wp_header_to_desc[$code] ) ) + return $wp_header_to_desc[$code]; + else + return ''; +} + +/** + * Set HTTP status header. + * + * @since 2.0.0 + * @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 unknown + */ +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 ); + + return @header( $status_header, true, $header ); +} + +/** + * Gets the header information to prevent caching. + * + * The several different headers cover the different ways cache prevention is handled + * by different browsers + * + * @since 2.8.0 + * + * @uses apply_filters() + * @return array The associative array of header names and field values. + */ +function wp_get_nocache_headers() { + $headers = array( + 'Expires' => 'Wed, 11 Jan 1984 05:00:00 GMT', + 'Last-Modified' => gmdate( 'D, d M Y H:i:s' ) . ' GMT', + 'Cache-Control' => 'no-cache, must-revalidate, max-age=0', + 'Pragma' => 'no-cache', + ); + + if ( function_exists('apply_filters') ) { + $headers = (array) apply_filters('nocache_headers', $headers); + } + return $headers; +} + +/** + * 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 + * @uses wp_get_nocache_headers() + */ +function nocache_headers() { + $headers = wp_get_nocache_headers(); + foreach( $headers as $name => $field_value ) + @header("{$name}: {$field_value}"); +} + +/** + * 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' ); +} + +/** + * Loads the feed template from the use of an action hook. + * + * If the feed action does not have a hook, then the function will die with a + * message telling the visitor that the feed is not valid. + * + * It is better to only have one hook for each feed. + * + * @since 2.1.0 + * @uses $wp_query Used to tell if the use a comment feed. + * @uses do_action() Calls 'do_feed_$feed' hook, if a hook exists for the feed. + */ +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.' ), esc_html($feed)); + wp_die( $message, '', array( 'response' => 404 ) ); + } + + 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() { + header( 'Content-Type: text/plain; charset=utf-8' ); + + do_action( 'do_robotstxt' ); + + $output = ''; + $public = get_option( 'blog_public' ); + if ( '0' == $public ) { + $output .= "User-agent: *\n"; + $output .= "Disallow: /\n"; + } else { + $output .= "User-agent: *\n"; + $output .= "Disallow:\n"; + } + + echo apply_filters('robots_txt', $output, $public); +} + +/** + * Test whether blog is already installed. + * + * The cache will be checked first. If you have a cache plugin, which saves the + * cache values, then this will work. If you use the default WordPress cache, + * and the database goes away, then you might have problems. + * + * Checks for the option siteurl for whether WordPress is installed. + * + * @since 2.1.0 + * @uses $wpdb + * + * @return bool Whether blog is already installed. + */ +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(); + if ( ! defined( 'WP_INSTALLING' ) ) { + $alloptions = wp_load_alloptions(); + } + // If siteurl is not set to autoload, check it specifically + if ( !isset( $alloptions['siteurl'] ) ) + $installed = $wpdb->get_var( "SELECT option_value FROM $wpdb->options WHERE option_name = 'siteurl'" ); + else + $installed = $alloptions['siteurl']; + $wpdb->suppress_errors( $suppress ); + + $installed = !empty( $installed ); + wp_cache_set( 'is_blog_installed', $installed ); + + if ( $installed ) + return true; + + $suppress = $wpdb->suppress_errors(); + $tables = $wpdb->get_col('SHOW TABLES'); + $wpdb->suppress_errors( $suppress ); + + $wp_tables = $wpdb->tables(); + // Loop over the WP tables. If none exist, then scratch install is allowed. + // If one or more exist, suggest table repair since we got here because the options + // table could not be accessed. + foreach ( $wp_tables as $table ) { + // If one of the WP tables exist, then we are in an insane state. + if ( in_array( $table, $tables ) ) { + // The existence of custom user tables shouldn't suggest an insane state or prevent a clean install. + if ( defined( 'CUSTOM_USER_TABLE' ) && CUSTOM_USER_TABLE == $table ) + continue; + if ( defined( 'CUSTOM_USER_META_TABLE' ) && CUSTOM_USER_META_TABLE == $table ) + continue; + + // If visiting repair.php, return true and let it take over. + if ( defined('WP_REPAIRING') ) + return true; + // Die with a DB error. + $wpdb->error = sprintf( /*WP_I18N_NO_TABLES*/'Una tabla o más de la base de dato no están disponibles. La base de datos debe ser <a href="%s">reparada</a>.'/*/WP_I18N_NO_TABLES*/, 'maint/repair.php?referrer=is_blog_installed' ); + dead_db(); + } + } + + wp_cache_set( 'is_blog_installed', false ); + + return false; +} + +/** + * Retrieve URL with nonce added to URL query. + * + * @package WordPress + * @subpackage Security + * @since 2.0.4 + * + * @param string $actionurl URL to add nonce action + * @param string $action Optional. Nonce action name + * @return string URL with nonce action added. + */ +function wp_nonce_url( $actionurl, $action = -1 ) { + $actionurl = str_replace( '&', '&', $actionurl ); + return esc_html( add_query_arg( '_wpnonce', wp_create_nonce( $action ), $actionurl ) ); +} + +/** + * Retrieve or display nonce hidden field for forms. + * + * The nonce field is used to validate that the contents of the form came from + * the location on the current site and not somewhere else. The nonce does not + * offer absolute protection, but should protect against most cases. It is very + * important to use nonce field in forms. + * + * The $action and $name are optional, but if you want to have better security, + * it is strongly suggested to set those two parameters. It is easier to just + * call the function without any parameters, because validation of the nonce + * doesn't require any parameters, but since crackers know what the default is + * it won't be difficult for them to find a way around your nonce and cause + * damage. + * + * The input name will be whatever $name value you gave. The input value will be + * the nonce creation value. + * + * @package WordPress + * @subpackage Security + * @since 2.0.4 + * + * @param string $action Optional. Action name. + * @param string $name Optional. Nonce name. + * @param bool $referer Optional, default true. Whether to set the referer field for validation. + * @param bool $echo Optional, default true. Whether to display or return hidden form field. + * @return string Nonce field. + */ +function wp_nonce_field( $action = -1, $name = "_wpnonce", $referer = true , $echo = true ) { + $name = esc_attr( $name ); + $nonce_field = '<input type="hidden" id="' . $name . '" name="' . $name . '" value="' . wp_create_nonce( $action ) . '" />'; + + if ( $referer ) + $nonce_field .= wp_referer_field( false ); + + if ( $echo ) + echo $nonce_field; + + return $nonce_field; +} + +/** + * Retrieve or display referer hidden field for forms. + * + * The referer link is the current Request URI from the server super global. The + * input name is '_wp_http_referer', in case you wanted to check manually. + * + * @package WordPress + * @subpackage Security + * @since 2.0.4 + * + * @param bool $echo Whether to echo or return the referer field. + * @return string Referer field. + */ +function wp_referer_field( $echo = true ) { + $ref = esc_attr( $_SERVER['REQUEST_URI'] ); + $referer_field = '<input type="hidden" name="_wp_http_referer" value="'. $ref . '" />'; + + if ( $echo ) + echo $referer_field; + return $referer_field; +} + +/** + * Retrieve or display original referer hidden field for forms. + * + * The input name is '_wp_original_http_referer' and will be either the same + * value of {@link wp_referer_field()}, if that was posted already or it will + * be the current page, if it doesn't exist. + * + * @package WordPress + * @subpackage Security + * @since 2.0.4 + * + * @param bool $echo Whether to echo the original http referer + * @param string $jump_back_to Optional, default is 'current'. Can be 'previous' or page you want to jump back to. + * @return string Original 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="' . esc_attr( stripslashes( $ref ) ) . '" />'; + if ( $echo ) + echo $orig_referer_field; + return $orig_referer_field; +} + +/** + * Retrieve referer from '_wp_http_referer', HTTP referer, or current page respectively. + * + * @package WordPress + * @subpackage Security + * @since 2.0.4 + * + * @return string|bool False on failure. Referer URL on success. + */ +function wp_get_referer() { + $ref = ''; + 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; +} + +/** + * Retrieve original referer that was posted, if it exists. + * + * @package WordPress + * @subpackage Security + * @since 2.0.4 + * + * @return string|bool False if no original referer or original referer if set. + */ +function wp_get_original_referer() { + if ( !empty( $_REQUEST['_wp_original_http_referer'] ) ) + return $_REQUEST['_wp_original_http_referer']; + return false; +} + +/** + * Recursive directory creation based on full path. + * + * Will attempt to set permissions on folders. + * + * @since 2.0.1 + * + * @param string $target Full path to attempt to create. + * @return bool Whether the path was created. True if path already exists. + */ +function wp_mkdir_p( $target ) { + // from php.net/mkdir user contributed notes + $target = str_replace( '//', '/', $target ); + + // safe mode fails with a trailing slash under certain PHP versions. + $target = rtrim($target, '/'); // Use rtrim() instead of untrailingslashit to avoid formatting.php dependency. + if ( empty($target) ) + $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 ( ( $target != '/' ) && ( wp_mkdir_p( dirname( $target ) ) ) ) + return wp_mkdir_p( $target ); + + return false; +} + +/** + * Test if a give filesystem path is absolute ('/foo/bar', 'c:\windows'). + * + * @since 2.5.0 + * + * @param string $path File path + * @return bool True if path is absolute, false is not absolute. + */ +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'). + * + * If the $path is absolute, then it the full path is returned. + * + * @since 2.5.0 + * + * @param string $base + * @param string $path + * @return string The path with the base or absolute path. + */ +function path_join( $base, $path ) { + if ( path_is_absolute($path) ) + return $path; + + return rtrim($base, '/') . '/' . ltrim($path, '/'); +} + +/** + * Determines a writable directory for temporary files. + * Function's preference is to WP_CONTENT_DIR followed by the return value of <code>sys_get_temp_dir()</code>, before finally defaulting to /tmp/ + * + * In the event that this function does not find a writable location, It may be overridden by the <code>WP_TEMP_DIR</code> constant in your <code>wp-config.php</code> file. + * + * @since 2.5.0 + * + * @return string Writable temporary directory + */ +function get_temp_dir() { + static $temp; + if ( defined('WP_TEMP_DIR') ) + return trailingslashit(WP_TEMP_DIR); + + if ( $temp ) + return trailingslashit($temp); + + $temp = WP_CONTENT_DIR . '/'; + if ( is_dir($temp) && @is_writable($temp) ) + return $temp; + + if ( function_exists('sys_get_temp_dir') ) { + $temp = sys_get_temp_dir(); + if ( @is_writable($temp) ) + return trailingslashit($temp); + } + + $temp = ini_get('upload_tmp_dir'); + if ( is_dir($temp) && @is_writable($temp) ) + return trailingslashit($temp); + + $temp = '/tmp/'; + return $temp; +} + +/** + * Get an array containing the current upload directory's path and url. + * + * Checks the 'upload_path' option, which should be from the web root folder, + * and if it isn't empty it will be used. If it is empty, then the path will be + * 'WP_CONTENT_DIR/uploads'. If the 'UPLOADS' constant is defined, then it will + * override the 'upload_path' option and 'WP_CONTENT_DIR/uploads' path. + * + * The upload URL path is set either by the 'upload_url_path' option or by using + * the 'WP_CONTENT_URL' constant and appending '/uploads' to the path. + * + * If the 'uploads_use_yearmonth_folders' is set to true (checkbox if checked in + * the administration settings panel), then the time will be used. The format + * will be year first and then month. + * + * If the path couldn't be created, then an error will be returned with the key + * 'error' containing the error message. The error suggests that the parent + * directory is not writable by the server. + * + * On success, the returned array will have many indices: + * 'path' - base directory and sub directory or full path to upload directory. + * 'url' - base url and sub directory or absolute URL to upload directory. + * 'subdir' - sub directory if uploads use year/month folders option is on. + * 'basedir' - path without subdir. + * 'baseurl' - URL path without subdir. + * 'error' - set to false. + * + * @since 2.0.0 + * @uses apply_filters() Calls 'upload_dir' on returned array. + * + * @param string $time Optional. Time formatted in 'yyyy/mm'. + * @return array See above for description. + */ +function wp_upload_dir( $time = null ) { + global $switched; + $siteurl = get_option( 'siteurl' ); + $upload_path = get_option( 'upload_path' ); + $upload_path = trim($upload_path); + $main_override = is_multisite() && defined( 'MULTISITE' ) && is_main_site(); + if ( empty($upload_path) ) { + $dir = WP_CONTENT_DIR . '/uploads'; + } else { + $dir = $upload_path; + if ( 'wp-content/uploads' == $upload_path ) { + $dir = WP_CONTENT_DIR . '/uploads'; + } elseif ( 0 !== strpos($dir, ABSPATH) ) { + // $dir is absolute, $upload_path is (maybe) relative to ABSPATH + $dir = path_join( ABSPATH, $dir ); + } + } + + if ( !$url = get_option( 'upload_url_path' ) ) { + if ( empty($upload_path) || ( 'wp-content/uploads' == $upload_path ) || ( $upload_path == $dir ) ) + $url = WP_CONTENT_URL . '/uploads'; + else + $url = trailingslashit( $siteurl ) . $upload_path; + } + + if ( defined('UPLOADS') && !$main_override && ( !isset( $switched ) || $switched === false ) ) { + $dir = ABSPATH . UPLOADS; + $url = trailingslashit( $siteurl ) . UPLOADS; + } + + if ( is_multisite() && !$main_override && ( !isset( $switched ) || $switched === false ) ) { + if ( defined( 'BLOGUPLOADDIR' ) ) + $dir = untrailingslashit(BLOGUPLOADDIR); + $url = str_replace( UPLOADS, 'files', $url ); + } + + $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; + + $uploads = apply_filters( 'upload_dir', array( 'path' => $dir, 'url' => $url, 'subdir' => $subdir, 'basedir' => $bdir, 'baseurl' => $burl, 'error' => false ) ); + + // Make sure we have an uploads dir + if ( ! wp_mkdir_p( $uploads['path'] ) ) { + $message = sprintf( __( 'Unable to create directory %s. Is its parent directory writable by the server?' ), $uploads['path'] ); + return array( 'error' => $message ); + } + + return $uploads; +} + +/** + * Get a filename that is sanitized and unique for the given directory. + * + * If the filename is not unique, then a number will be added to the filename + * before the extension, and will continue adding numbers until the filename is + * unique. + * + * The callback is passed three parameters, the first one is the directory, the + * second is the filename, and the third is the extension. + * + * @since 2.5.0 + * + * @param string $dir + * @param string $filename + * @param mixed $unique_filename_callback Callback. + * @return string New filename, if given wasn't unique. + */ +function wp_unique_filename( $dir, $filename, $unique_filename_callback = null ) { + // sanitize the file name before we begin processing + $filename = sanitize_file_name($filename); + + // separate the filename into a name and extension + $info = pathinfo($filename); + $ext = !empty($info['extension']) ? '.' . $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 callback if supplied. + if ( $unique_filename_callback && is_callable( $unique_filename_callback ) ) { + $filename = call_user_func( $unique_filename_callback, $dir, $name, $ext ); + } else { + $number = ''; + + // change '.ext' to lower case + if ( $ext && strtolower($ext) != $ext ) { + $ext2 = strtolower($ext); + $filename2 = preg_replace( '|' . preg_quote($ext) . '$|', $ext2, $filename ); + + // check for both lower and upper case extension or image sub-sizes may be overwritten + while ( file_exists($dir . "/$filename") || file_exists($dir . "/$filename2") ) { + $new_number = $number + 1; + $filename = str_replace( "$number$ext", "$new_number$ext", $filename ); + $filename2 = str_replace( "$number$ext2", "$new_number$ext2", $filename2 ); + $number = $new_number; + } + return $filename2; + } + + while ( file_exists( $dir . "/$filename" ) ) { + if ( '' == "$number$ext" ) + $filename = $filename . ++$number . $ext; + else + $filename = str_replace( "$number$ext", ++$number . $ext, $filename ); + } + } + + return $filename; +} + +/** + * Create a file in the upload folder with given content. + * + * If there is an error, then the key 'error' will exist with the error message. + * If success, then the key 'file' will have the unique file path, the 'url' key + * will have the link to the new file. and the 'error' key will be set to false. + * + * This function will not move an uploaded file to the upload folder. It will + * create a new file with the content in $bits parameter. If you move the upload + * file, read the content of the uploaded file, and then you can give the + * filename and content to this function, which will add it to the upload + * folder. + * + * The permissions will be set on the new file automatically by this function. + * + * @since 2.0.0 + * + * @param string $name + * @param null $deprecated Never used. Set to null. + * @param mixed $bits File content + * @param string $time Optional. Time formatted in 'yyyy/mm'. + * @return array + */ +function wp_upload_bits( $name, $deprecated, $bits, $time = null ) { + if ( !empty( $deprecated ) ) + _deprecated_argument( __FUNCTION__, '2.0' ); + + 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; + + $upload_bits_error = apply_filters( 'wp_upload_bits', array( 'name' => $name, 'bits' => $bits, 'time' => $time ) ); + if ( !is_array( $upload_bits_error ) ) { + $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 ); + clearstatcache(); + + // Set correct file permissions + $stat = @ stat( dirname( $new_file ) ); + $perms = $stat['mode'] & 0007777; + $perms = $perms & 0000666; + @ chmod( $new_file, $perms ); + clearstatcache(); + + // Compute the URL + $url = $upload['url'] . "/$filename"; + + return array( 'file' => $new_file, 'url' => $url, 'error' => false ); +} + +/** + * Retrieve the file type based on the extension name. + * + * @package WordPress + * @since 2.5.0 + * @uses apply_filters() Calls 'ext2type' hook on default supported types. + * + * @param string $ext The extension to search. + * @return string|null The file type, example: audio, video, document, spreadsheet, etc. Null if not found. + */ +function wp_ext2type( $ext ) { + $ext2type = apply_filters( 'ext2type', array( + 'audio' => array( 'aac', 'ac3', 'aif', 'aiff', 'm3a', 'm4a', 'm4b', 'mka', 'mp1', 'mp2', 'mp3', 'ogg', 'oga', 'ram', 'wav', 'wma' ), + 'video' => array( 'asf', 'avi', 'divx', 'dv', 'flv', 'm4v', 'mkv', 'mov', 'mp4', 'mpeg', 'mpg', 'mpv', 'ogm', 'ogv', 'qt', 'rm', 'vob', 'wmv' ), + 'document' => array( 'doc', 'docx', 'docm', 'dotm', 'odt', 'pages', 'pdf', 'rtf', 'wp', 'wpd' ), + 'spreadsheet' => array( 'numbers', 'ods', 'xls', 'xlsx', 'xlsb', 'xlsm' ), + 'interactive' => array( 'key', 'ppt', 'pptx', 'pptm', 'odp', 'swf' ), + 'text' => array( 'asc', 'csv', 'tsv', 'txt' ), + 'archive' => array( 'bz2', 'cab', 'dmg', 'gz', 'rar', 'sea', 'sit', 'sqx', 'tar', 'tgz', 'zip' ), + 'code' => array( 'css', 'htm', 'html', 'php', 'js' ), + )); + foreach ( $ext2type as $type => $exts ) + if ( in_array( $ext, $exts ) ) + return $type; +} + +/** + * Retrieve the file type from the file name. + * + * You can optionally define the mime array, if needed. + * + * @since 2.0.4 + * + * @param string $filename File name or path. + * @param array $mimes Optional. Key is the file extension with value as the mime type. + * @return array Values with extension first and mime type. + */ +function wp_check_filetype( $filename, $mimes = null ) { + if ( empty($mimes) ) + $mimes = get_allowed_mime_types(); + $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' ); +} + +/** + * Attempt to determine the real file type of a file. + * If unable to, the file name extension will be used to determine type. + * + * If it's determined that the extension does not match the file's real type, + * then the "proper_filename" value will be set with a proper filename and extension. + * + * Currently this function only supports validating images known to getimagesize(). + * + * @since 3.0.0 + * + * @param string $file Full path to the image. + * @param string $filename The filename of the image (may differ from $file due to $file being in a tmp directory) + * @param array $mimes Optional. Key is the file extension with value as the mime type. + * @return array Values for the extension, MIME, and either a corrected filename or false if original $filename is valid + */ +function wp_check_filetype_and_ext( $file, $filename, $mimes = null ) { + + $proper_filename = false; + + // Do basic extension validation and MIME mapping + $wp_filetype = wp_check_filetype( $filename, $mimes ); + extract( $wp_filetype ); + + // We can't do any further validation without a file to work with + if ( ! file_exists( $file ) ) + return compact( 'ext', 'type', 'proper_filename' ); + + // We're able to validate images using GD + if ( $type && 0 === strpos( $type, 'image/' ) && function_exists('getimagesize') ) { + + // Attempt to figure out what type of image it actually is + $imgstats = @getimagesize( $file ); + + // If getimagesize() knows what kind of image it really is and if the real MIME doesn't match the claimed MIME + if ( !empty($imgstats['mime']) && $imgstats['mime'] != $type ) { + // This is a simplified array of MIMEs that getimagesize() can detect and their extensions + // You shouldn't need to use this filter, but it's here just in case + $mime_to_ext = apply_filters( 'getimagesize_mimes_to_exts', array( + 'image/jpeg' => 'jpg', + 'image/png' => 'png', + 'image/gif' => 'gif', + 'image/bmp' => 'bmp', + 'image/tiff' => 'tif', + ) ); + + // Replace whatever is after the last period in the filename with the correct extension + if ( ! empty( $mime_to_ext[ $imgstats['mime'] ] ) ) { + $filename_parts = explode( '.', $filename ); + array_pop( $filename_parts ); + $filename_parts[] = $mime_to_ext[ $imgstats['mime'] ]; + $new_filename = implode( '.', $filename_parts ); + + if ( $new_filename != $filename ) + $proper_filename = $new_filename; // Mark that it changed + + // Redefine the extension / MIME + $wp_filetype = wp_check_filetype( $new_filename, $mimes ); + extract( $wp_filetype ); + } + } + } + + // Let plugins try and validate other types of files + // Should return an array in the style of array( 'ext' => $ext, 'type' => $type, 'proper_filename' => $proper_filename ) + return apply_filters( 'wp_check_filetype_and_ext', compact( 'ext', 'type', 'proper_filename' ), $file, $filename, $mimes ); +} + +/** + * Retrieve list of allowed mime types and file extensions. + * + * @since 2.8.6 + * + * @return array Array of mime types keyed by the file extension regex corresponding to those types. + */ +function get_allowed_mime_types() { + static $mimes = false; + + if ( !$mimes ) { + // Accepted MIME types are set here as PCRE unless provided. + $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', + 'divx' => 'video/divx', + 'flv' => 'video/x-flv', + 'mov|qt' => 'video/quicktime', + 'mpeg|mpg|mpe' => 'video/mpeg', + 'txt|asc|c|cc|h' => 'text/plain', + 'csv' => 'text/csv', + 'tsv' => 'text/tab-separated-values', + 'ics' => 'text/calendar', + 'rtx' => 'text/richtext', + 'css' => 'text/css', + 'htm|html' => 'text/html', + 'mp3|m4a|m4b' => 'audio/mpeg', + 'mp4|m4v' => 'video/mp4', + 'ra|ram' => 'audio/x-realaudio', + 'wav' => 'audio/wav', + 'ogg|oga' => 'audio/ogg', + 'ogv' => 'video/ogg', + 'mid|midi' => 'audio/midi', + 'wma' => 'audio/wma', + 'mka' => 'audio/x-matroska', + 'mkv' => 'video/x-matroska', + 'rtf' => 'application/rtf', + 'js' => 'application/javascript', + 'pdf' => 'application/pdf', + 'doc|docx' => 'application/msword', + 'pot|pps|ppt|pptx|ppam|pptm|sldm|ppsm|potm' => 'application/vnd.ms-powerpoint', + 'wri' => 'application/vnd.ms-write', + 'xla|xls|xlsx|xlt|xlw|xlam|xlsb|xlsm|xltm' => 'application/vnd.ms-excel', + 'mdb' => 'application/vnd.ms-access', + 'mpp' => 'application/vnd.ms-project', + 'docm|dotm' => 'application/vnd.ms-word', + 'pptx|sldx|ppsx|potx' => 'application/vnd.openxmlformats-officedocument.presentationml', + 'xlsx|xltx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml', + 'docx|dotx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml', + 'onetoc|onetoc2|onetmp|onepkg' => 'application/onenote', + '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', + // wordperfect formats + 'wp|wpd' => 'application/wordperfect', + ) ); + } + + return $mimes; +} + +/** + * Retrieve nonce action "Are you sure" message. + * + * The action is split by verb and noun. The action format is as follows: + * verb-action_extra. The verb is before the first dash and has the format of + * letters and no spaces and numbers. The noun is after the dash and before the + * underscore, if an underscore exists. The noun is also only letters. + * + * The filter will be called for any action, which is not defined by WordPress. + * You may use the filter for your plugin to explain nonce actions to the user, + * when they get the "Are you sure?" message. The filter is in the format of + * 'explain_nonce_$verb-$noun' with the $verb replaced by the found verb and the + * $noun replaced by the found noun. The two parameters that are given to the + * hook are the localized "Are you sure you want to do this?" message with the + * extra text (the text after the underscore). + * + * @package WordPress + * @subpackage Security + * @since 2.0.4 + * + * @param string $action Nonce action. + * @return string Are you sure message. + */ +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_cat_name' ); + $trans['update']['category'] = array( __( 'Your attempt to edit this category: “%s” has failed.' ), 'get_cat_name' ); + + $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 update 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_the_author_meta', 'display_name' ); + $trans['update']['profile'] = array( __( 'Your attempt to modify the profile for: “%s” has failed.' ), 'get_the_author_meta', 'display_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' ); + + $trans['log']['out'] = array( sprintf( __( 'You are attempting to log out of %s' ), get_bloginfo( 'sitename' ) ), false ); + + if ( isset( $trans[$verb][$noun] ) ) { + if ( !empty( $trans[$verb][$noun][1] ) ) { + $lookup = $trans[$verb][$noun][1]; + if ( isset($trans[$verb][$noun][2]) ) + $lookup_value = $trans[$verb][$noun][2]; + $object = $matches[4]; + if ( 'use_id' != $lookup ) { + if ( isset( $lookup_value ) ) + $object = call_user_func( $lookup, $lookup_value, $object ); + else + $object = call_user_func( $lookup, $object ); + } + return sprintf( $trans[$verb][$noun][0], esc_html($object) ); + } else { + return $trans[$verb][$noun][0]; + } + } + + return apply_filters( 'explain_nonce_' . $verb . '-' . $noun, __( 'Are you sure you want to do this?' ), isset($matches[4]) ? $matches[4] : '' ); + } else { + return apply_filters( 'explain_nonce_' . $action, __( 'Are you sure you want to do this?' ) ); + } +} + +/** + * Display "Are You Sure" message to confirm the action being taken. + * + * If the action has the nonce explain message, then it will be displayed along + * with the "Are you sure?" message. + * + * @package WordPress + * @subpackage Security + * @since 2.0.4 + * + * @param string $action The nonce action. + */ +function wp_nonce_ays( $action ) { + $title = __( 'WordPress Failure Notice' ); + $html = esc_html( wp_explain_nonce( $action ) ); + if ( 'log-out' == $action ) + $html .= "</p><p>" . sprintf( __( "Do you really want to <a href='%s'>log out</a>?"), wp_logout_url() ); + elseif ( wp_get_referer() ) + $html .= "</p><p><a href='" . esc_url( remove_query_arg( 'updated', wp_get_referer() ) ) . "'>" . __( 'Please try again.' ) . "</a>"; + + wp_die( $html, $title, array('response' => 403) ); +} + + +/** + * Kill WordPress execution and display HTML message with error message. + * + * This function complements the die() PHP function. The difference is that + * HTML will be displayed to the user. It is recommended to use this function + * only, when the execution should not continue any further. It is not + * recommended to call this function very often and try to handle as many errors + * as possible siliently. + * + * @since 2.0.4 + * + * @param string $message Error message. + * @param string $title Error title. + * @param string|array $args Optional arguements to control behaviour. + */ +function wp_die( $message, $title = '', $args = array() ) { + if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) + die('-1'); + + if ( function_exists( 'apply_filters' ) ) { + $function = apply_filters( 'wp_die_handler', '_default_wp_die_handler'); + } else { + $function = '_default_wp_die_handler'; + } + + call_user_func( $function, $message, $title, $args ); +} + +/** + * Kill WordPress execution and display HTML message with error message. + * + * This is the default handler for wp_die if you want a custom one for your + * site then you can overload using the wp_die_handler filter in wp_die + * + * @since 3.0.0 + * @access private + * + * @param string $message Error message. + * @param string $title Error title. + * @param string|array $args Optional arguements to control behaviour. + */ +function _default_wp_die_handler( $message, $title = '', $args = array() ) { + $defaults = array( 'response' => 500 ); + $r = wp_parse_args($args, $defaults); + + $have_gettext = function_exists('__'); + + 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 ( isset( $r['back_link'] ) && $r['back_link'] ) { + $back_text = $have_gettext? __('« Back') : '« Back'; + $message .= "\n<p><a href='javascript:history.back()'>$back_text</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( $r['response'] ); + nocache_headers(); + header( 'Content-Type: text/html; charset=utf-8' ); + } + + if ( empty($title) ) + $title = $have_gettext ? __('WordPress › Error') : 'WordPress › Error'; + + $text_direction = 'ltr'; + if ( isset($r['text_direction']) && 'rtl' == $r['text_direction'] ) + $text_direction = 'rtl'; + elseif ( function_exists( 'is_rtl' ) && is_rtl() ) + $text_direction = 'rtl'; +?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<!-- Ticket #11289, IE bug fix: always pad the error page with enough characters such that it is greater than 512 bytes, even after gzip compression abcdefghijklmnopqrstuvwxyz1234567890aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz11223344556677889900abacbcbdcdcededfefegfgfhghgihihjijikjkjlklkmlmlnmnmononpopoqpqprqrqsrsrtstsubcbcdcdedefefgfabcadefbghicjkldmnoepqrfstugvwxhyz1i234j567k890laabmbccnddeoeffpgghqhiirjjksklltmmnunoovppqwqrrxsstytuuzvvw0wxx1yyz2z113223434455666777889890091abc2def3ghi4jkl5mno6pqr7stu8vwx9yz11aab2bcc3dd4ee5ff6gg7hh8ii9j0jk1kl2lmm3nnoo4p5pq6qrr7ss8tt9uuvv0wwx1x2yyzz13aba4cbcb5dcdc6dedfef8egf9gfh0ghg1ihi2hji3jik4jkj5lkl6kml7mln8mnm9ono --> +<html xmlns="http://www.w3.org/1999/xhtml" <?php if ( function_exists( 'language_attributes' ) && function_exists( 'is_rtl' ) ) language_attributes(); else echo "dir='$text_direction'"; ?>> +<head> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> + <title><?php echo $title ?> + + + + + + + + + + + 500 ); + + $r = wp_parse_args($args, $defaults); + + if ( $wp_xmlrpc_server ) { + $error = new IXR_Error( $r['response'] , $message); + $wp_xmlrpc_server->output( $error->getXml() ); + } + die(); +} + +/** + * Filter to enable special wp_die handler for xmlrpc requests. + * + * @since 3.2.0 + * @access private + */ +function _xmlrpc_wp_die_filter() { + return '_xmlrpc_wp_die_handler'; +} + + +/** + * Retrieve the WordPress home page URL. + * + * If the constant named 'WP_HOME' exists, then it willl be used and returned by + * the function. This can be used to counter the redirection on your local + * development environment. + * + * @access private + * @package WordPress + * @since 2.2.0 + * + * @param string $url URL for the home location + * @return string Homepage location. + */ +function _config_wp_home( $url = '' ) { + if ( defined( 'WP_HOME' ) ) + return WP_HOME; + return $url; +} + +/** + * Retrieve the WordPress site URL. + * + * If the constant named 'WP_SITEURL' is defined, then the value in that + * constant will always be returned. This can be used for debugging a site on + * your localhost while not having to change the database to your URL. + * + * @access private + * @package WordPress + * @since 2.2.0 + * + * @param string $url URL to set the WordPress site location. + * @return string The WordPress Site URL + */ +function _config_wp_siteurl( $url = '' ) { + if ( defined( 'WP_SITEURL' ) ) + return WP_SITEURL; + return $url; +} + +/** + * Set the localized direction for MCE plugin. + * + * Will only set the direction to 'rtl', if the WordPress locale has the text + * direction set to 'rtl'. + * + * Fills in the 'directionality', 'plugins', and 'theme_advanced_button1' array + * keys. These keys are then returned in the $input array. + * + * @access private + * @package WordPress + * @subpackage MCE + * @since 2.1.0 + * + * @param array $input MCE plugin array. + * @return array Direction set for 'rtl', if needed by locale. + */ +function _mce_set_direction( $input ) { + if ( is_rtl() ) { + $input['directionality'] = 'rtl'; + $input['plugins'] .= ',directionality'; + $input['theme_advanced_buttons1'] .= ',ltr'; + } + + return $input; +} + + +/** + * Convert smiley code to the icon graphic file equivalent. + * + * You can turn off smilies, by going to the write setting screen and unchecking + * the box, or by setting 'use_smilies' option to false or removing the option. + * + * Plugins may override the default smiley list by setting the $wpsmiliestrans + * to an array, with the key the code the blogger types in and the value the + * image file. + * + * The $wp_smiliessearch global is for the regular expression and is set each + * time the function is called. + * + * The full list of smilies can be found in the function and won't be listed in + * the description. Probably should create a Codex page for it, so that it is + * available. + * + * @global array $wpsmiliestrans + * @global array $wp_smiliessearch + * @since 2.2.0 + */ +function smilies_init() { + global $wpsmiliestrans, $wp_smiliessearch; + + // 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', + ); + } + + if (count($wpsmiliestrans) == 0) { + return; + } + + /* + * NOTE: we sort the smilies in reverse key order. This is to make sure + * we match the longest possible smilie (:???: vs :?) as the regular + * expression used below is first-match + */ + krsort($wpsmiliestrans); + + $wp_smiliessearch = '/(?:\s|^)'; + + $subchar = ''; + foreach ( (array) $wpsmiliestrans as $smiley => $img ) { + $firstchar = substr($smiley, 0, 1); + $rest = substr($smiley, 1); + + // new subpattern? + if ($firstchar != $subchar) { + if ($subchar != '') { + $wp_smiliessearch .= ')|(?:\s|^)'; + } + $subchar = $firstchar; + $wp_smiliessearch .= preg_quote($firstchar, '/') . '(?:'; + } else { + $wp_smiliessearch .= '|'; + } + $wp_smiliessearch .= preg_quote($rest, '/'); + } + + $wp_smiliessearch .= ')(?:\s|$)/m'; +} + +/** + * 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; +} + +/** + * Clean up an array, comma- or space-separated list of IDs + * + * @since 3.0.0 + * + * @param array|string $list + * @return array Sanitized array of IDs + */ +function wp_parse_id_list( $list ) { + if ( !is_array($list) ) + $list = preg_split('/[\s,]+/', $list); + + return array_unique(array_map('absint', $list)); +} + +/** + * Extract a slice of an array, given a list of keys + * + * @since 3.1.0 + * + * @param array $array The original array + * @param array $keys The list of keys + * @return array The array slice + */ +function wp_array_slice_assoc( $array, $keys ) { + $slice = array(); + foreach ( $keys as $key ) + if ( isset( $array[ $key ] ) ) + $slice[ $key ] = $array[ $key ]; + + return $slice; +} + +/** + * Filters a list of objects, based on a set of key => value arguments + * + * @since 3.0.0 + * + * @param array $list An array of objects to filter + * @param array $args An array of key => value arguments to match against each object + * @param string $operator The logical operation to perform. 'or' means only one element + * from the array needs to match; 'and' means all elements must match. The default is 'and'. + * @param bool|string $field A field from the object to place instead of the entire object + * @return array A list of objects or object fields + */ +function wp_filter_object_list( $list, $args = array(), $operator = 'and', $field = false ) { + if ( ! is_array( $list ) ) + return array(); + + $list = wp_list_filter( $list, $args, $operator ); + + if ( $field ) + $list = wp_list_pluck( $list, $field ); + + return $list; +} + +/** + * Filters a list of objects, based on a set of key => value arguments + * + * @since 3.1.0 + * + * @param array $list An array of objects to filter + * @param array $args An array of key => value arguments to match against each object + * @param string $operator The logical operation to perform: + * 'AND' means all elements from the array must match; + * 'OR' means only one element needs to match; + * 'NOT' means no elements may match. + * The default is 'AND'. + * @return array + */ +function wp_list_filter( $list, $args = array(), $operator = 'AND' ) { + if ( ! is_array( $list ) ) + return array(); + + if ( empty( $args ) ) + return $list; + + $operator = strtoupper( $operator ); + $count = count( $args ); + $filtered = array(); + + foreach ( $list as $key => $obj ) { + $matched = count( array_intersect_assoc( (array) $obj, $args ) ); + if ( ( 'AND' == $operator && $matched == $count ) + || ( 'OR' == $operator && $matched <= $count ) + || ( 'NOT' == $operator && 0 == $matched ) ) { + $filtered[$key] = $obj; + } + } + + return $filtered; +} + +/** + * Pluck a certain field out of each object in a list + * + * @since 3.1.0 + * + * @param array $list A list of objects or arrays + * @param int|string $field A field from the object to place instead of the entire object + * @return array + */ +function wp_list_pluck( $list, $field ) { + foreach ( $list as $key => $value ) { + $value = (array) $value; + $list[ $key ] = $value[ $field ]; + } + + return $list; +} + +/** + * 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 ( ! apply_filters('load_default_widgets', true) ) + return; + require_once( ABSPATH . WPINC . '/default-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' ), 'edit_theme_options', '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() { + $levels = ob_get_level(); + for ($i=0; $i<$levels; $i++) + ob_end_flush(); +} + +/** + * 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. + * + * This function was backported to the the WordPress 2.3.2, but originally was + * added in WordPress 2.5.0. + * + * @since 2.3.2 + * @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 a user error if WP_DEBUG is true. + * + * This function is to be used in every file that is deprecated. + * + * @package WordPress + * @subpackage Debug + * @since 2.5.0 + * @access private + * + * @uses do_action() Calls 'deprecated_file_included' and passes the file name, what to use instead, + * the version in which the file was deprecated, and any message regarding the change. + * @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 deprecated the file + * @param string $replacement Optional. The file that should have been included based on ABSPATH + * @param string $message Optional. A message regarding the change + */ +function _deprecated_file( $file, $version, $replacement = null, $message = '' ) { + + do_action( 'deprecated_file_included', $file, $replacement, $version, $message ); + + // Allow plugin to filter the output error trigger + if ( WP_DEBUG && apply_filters( 'deprecated_file_trigger_error', true ) ) { + $message = empty( $message ) ? '' : ' ' . $message; + if ( ! is_null( $replacement ) ) + trigger_error( sprintf( __('%1$s is deprecated since version %2$s! Use %3$s instead.'), $file, $version, $replacement ) . $message ); + else + trigger_error( sprintf( __('%1$s is deprecated since version %2$s with no alternative available.'), $file, $version ) . $message ); + } +} +/** + * Marks a function argument as deprecated and informs when it has been used. + * + * This function is to be used whenever a deprecated function argument is used. + * Before this function is called, the argument must be checked for whether it was + * used by comparing it to its default value or evaluating whether it is empty. + * For example: + * + * if ( !empty($deprecated) ) + * _deprecated_argument( __FUNCTION__, '3.0' ); + * + * + * There is a hook deprecated_argument_run that will be called that can be used + * to get the backtrace up to what file and function used the deprecated + * argument. + * + * The current behavior is to trigger a user error if WP_DEBUG is true. + * + * @package WordPress + * @subpackage Debug + * @since 3.0.0 + * @access private + * + * @uses do_action() Calls 'deprecated_argument_run' and passes the function name, a message on the change, + * and the version in which the argument was deprecated. + * @uses apply_filters() Calls 'deprecated_argument_trigger_error' and expects boolean value of true to do + * trigger or false to not trigger error. + * + * @param string $function The function that was called + * @param string $version The version of WordPress that deprecated the argument used + * @param string $message Optional. A message regarding the change. + */ +function _deprecated_argument( $function, $version, $message = null ) { + + do_action( 'deprecated_argument_run', $function, $message, $version ); + + // Allow plugin to filter the output error trigger + if ( WP_DEBUG && apply_filters( 'deprecated_argument_trigger_error', true ) ) { + if ( ! is_null( $message ) ) + trigger_error( sprintf( __('%1$s was called with an argument that is deprecated since version %2$s! %3$s'), $function, $version, $message ) ); + else + trigger_error( sprintf( __('%1$s was called with an argument that is deprecated since version %2$s with no alternative available.'), $function, $version ) ); + } +} + +/** + * Marks something as being incorrectly called. + * + * There is a hook doing_it_wrong_run that will be called that can be used + * to get the backtrace up to what file and function called the deprecated + * function. + * + * The current behavior is to trigger a user error if WP_DEBUG is true. + * + * @package WordPress + * @subpackage Debug + * @since 3.1.0 + * @access private + * + * @uses do_action() Calls 'doing_it_wrong_run' and passes the function arguments. + * @uses apply_filters() Calls 'doing_it_wrong_trigger_error' and expects boolean value of true to do + * trigger or false to not trigger error. + * + * @param string $function The function that was called. + * @param string $message A message explaining what has been done incorrectly. + * @param string $version The version of WordPress where the message was added. + */ +function _doing_it_wrong( $function, $message, $version ) { + + do_action( 'doing_it_wrong_run', $function, $message, $version ); + + // Allow plugin to filter the output error trigger + if ( WP_DEBUG && apply_filters( 'doing_it_wrong_trigger_error', true ) ) { + $version = is_null( $version ) ? '' : sprintf( __( '(This message was added in version %s.)' ), $version ); + trigger_error( sprintf( __( '%1$s was called incorrectly. %2$s %3$s' ), $function, $message, $version ) ); + } +} + +/** + * Is the server running earlier than 1.5.0 version of lighttpd + * + * @since 2.5.0 + * + * @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 2.5.0 + * + * @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; +} + +/** + * Check if IIS 7 supports pretty permalinks + * + * @since 2.8.0 + * + * @return bool + */ +function iis7_supports_permalinks() { + global $is_iis7; + + $supports_permalinks = false; + if ( $is_iis7 ) { + /* First we check if the DOMDocument class exists. If it does not exist, + * which is the case for PHP 4.X, then we cannot easily update the xml configuration file, + * hence we just bail out and tell user that pretty permalinks cannot be used. + * This is not a big issue because PHP 4.X is going to be depricated and for IIS it + * is recommended to use PHP 5.X NTS. + * Next we check if the URL Rewrite Module 1.1 is loaded and enabled for the web site. When + * URL Rewrite 1.1 is loaded it always sets a server variable called 'IIS_UrlRewriteModule'. + * Lastly we make sure that PHP is running via FastCGI. This is important because if it runs + * via ISAPI then pretty permalinks will not work. + */ + $supports_permalinks = class_exists('DOMDocument') && isset($_SERVER['IIS_UrlRewriteModule']) && ( php_sapi_name() == 'cgi-fcgi' ); + } + + return apply_filters('iis7_supports_permalinks', $supports_permalinks); +} + +/** + * 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 1.2.0 + * + * @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 (!empty ( $allowed_files ) && (!in_array( $file, $allowed_files ) ) ) + return 3; + + if (':' == substr( $file, 1, 1 )) + return 2; + + return 0; +} + +/** + * Determine if SSL is used. + * + * @since 2.6.0 + * + * @return bool True if SSL, false if not used. + */ +function is_ssl() { + if ( isset($_SERVER['HTTPS']) ) { + if ( 'on' == strtolower($_SERVER['HTTPS']) ) + return true; + if ( '1' == $_SERVER['HTTPS'] ) + return true; + } elseif ( isset($_SERVER['SERVER_PORT']) && ( '443' == $_SERVER['SERVER_PORT'] ) ) { + return true; + } + return false; +} + +/** + * Whether SSL login should be forced. + * + * @since 2.6.0 + * + * @param string|bool $force Optional. + * @return bool True if forced, false if not forced. + */ +function force_ssl_login( $force = null ) { + static $forced = false; + + if ( !is_null( $force ) ) { + $old_forced = $forced; + $forced = $force; + return $old_forced; + } + + return $forced; +} + +/** + * Whether to force SSL used for the Administration Screens. + * + * @since 2.6.0 + * + * @param string|bool $force + * @return bool True if forced, false if not forced. + */ +function force_ssl_admin( $force = null ) { + static $forced = false; + + if ( !is_null( $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.0 + * + * @return string + */ +function wp_guess_url() { + if ( defined('WP_SITEURL') && '' != WP_SITEURL ) { + $url = WP_SITEURL; + } else { + $schema = is_ssl() ? 'https://' : 'http://'; + $url = preg_replace('|/wp-admin/.*|i', '', $schema . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']); + } + return rtrim($url, '/'); +} + +/** + * Suspend cache invalidation. + * + * Turns cache invalidation on and off. Useful during imports where you don't wont to do invalidations + * every time a post is inserted. Callers must be sure that what they are doing won't lead to an inconsistent + * cache when invalidation is suspended. + * + * @since 2.7.0 + * + * @param bool $suspend Whether to suspend or enable cache invalidation + * @return bool The current suspend setting + */ +function wp_suspend_cache_invalidation($suspend = true) { + global $_wp_suspend_cache_invalidation; + + $current_suspend = $_wp_suspend_cache_invalidation; + $_wp_suspend_cache_invalidation = $suspend; + return $current_suspend; +} + +/** + * Retrieve site option value based on name of option. + * + * @see get_option() + * @package WordPress + * @subpackage Option + * @since 2.8.0 + * + * @uses apply_filters() Calls 'pre_site_option_$option' before checking the option. + * Any value other than false will "short-circuit" the retrieval of the option + * and return the returned value. + * @uses apply_filters() Calls 'site_option_$option', after checking the option, with + * the option value. + * + * @param string $option Name of option to retrieve. Expected to not be SQL-escaped. + * @param mixed $default Optional value to return if option doesn't exist. Default false. + * @param bool $use_cache Whether to use cache. Multisite only. Default true. + * @return mixed Value set for the option. + */ +function get_site_option( $option, $default = false, $use_cache = true ) { + global $wpdb; + + // Allow plugins to short-circuit site options. + $pre = apply_filters( 'pre_site_option_' . $option, false ); + if ( false !== $pre ) + return $pre; + + if ( !is_multisite() ) { + $value = get_option($option, $default); + } else { + $cache_key = "{$wpdb->siteid}:$option"; + if ( $use_cache ) + $value = wp_cache_get($cache_key, 'site-options'); + + if ( !isset($value) || (false === $value) ) { + $row = $wpdb->get_row( $wpdb->prepare("SELECT meta_value FROM $wpdb->sitemeta WHERE meta_key = %s AND site_id = %d", $option, $wpdb->siteid ) ); + + // Has to be get_row instead of get_var because of funkiness with 0, false, null values + if ( is_object( $row ) ) + $value = $row->meta_value; + else + $value = $default; + + $value = maybe_unserialize( $value ); + + wp_cache_set( $cache_key, $value, 'site-options' ); + } + } + + return apply_filters( 'site_option_' . $option, $value ); +} + +/** + * Add a new site option. + * + * @see add_option() + * @package WordPress + * @subpackage Option + * @since 2.8.0 + * + * @uses apply_filters() Calls 'pre_add_site_option_$option' hook to allow overwriting the + * option value to be stored. + * @uses do_action() Calls 'add_site_option_$option' and 'add_site_option' hooks on success. + * + * @param string $option Name of option to add. Expected to not be SQL-escaped. + * @param mixed $value Optional. Option value, can be anything. Expected to not be SQL-escaped. + * @return bool False if option was not added and true if option was added. + */ +function add_site_option( $option, $value ) { + global $wpdb; + + $value = apply_filters( 'pre_add_site_option_' . $option, $value ); + + if ( !is_multisite() ) { + $result = add_option( $option, $value ); + } else { + $cache_key = "{$wpdb->siteid}:$option"; + + if ( $wpdb->get_row( $wpdb->prepare( "SELECT meta_value FROM $wpdb->sitemeta WHERE meta_key = %s AND site_id = %d", $option, $wpdb->siteid ) ) ) + return update_site_option( $option, $value ); + + $value = sanitize_option( $option, $value ); + wp_cache_set( $cache_key, $value, 'site-options' ); + + $_value = $value; + $value = maybe_serialize($value); + $result = $wpdb->insert( $wpdb->sitemeta, array('site_id' => $wpdb->siteid, 'meta_key' => $option, 'meta_value' => $value ) ); + $value = $_value; + } + + do_action( "add_site_option_{$option}", $option, $value ); + do_action( "add_site_option", $option, $value ); + + return $result; +} + +/** + * Removes site option by name. + * + * @see delete_option() + * @package WordPress + * @subpackage Option + * @since 2.8.0 + * + * @uses do_action() Calls 'pre_delete_site_option_$option' hook before option is deleted. + * @uses do_action() Calls 'delete_site_option' and 'delete_site_option_$option' + * hooks on success. + * + * @param string $option Name of option to remove. Expected to not be SQL-escaped. + * @return bool True, if succeed. False, if failure. + */ +function delete_site_option( $option ) { + global $wpdb; + + // ms_protect_special_option( $option ); @todo + + do_action( 'pre_delete_site_option_' . $option ); + + if ( !is_multisite() ) { + $result = delete_option( $option ); + } else { + $row = $wpdb->get_row( $wpdb->prepare( "SELECT meta_id FROM {$wpdb->sitemeta} WHERE meta_key = %s AND site_id = %d", $option, $wpdb->siteid ) ); + if ( is_null( $row ) || !$row->meta_id ) + return false; + $cache_key = "{$wpdb->siteid}:$option"; + wp_cache_delete( $cache_key, 'site-options' ); + + $result = $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->sitemeta} WHERE meta_key = %s AND site_id = %d", $option, $wpdb->siteid ) ); + } + + if ( $result ) { + do_action( "delete_site_option_{$option}", $option ); + do_action( "delete_site_option", $option ); + return true; + } + return false; +} + +/** + * Update the value of a site option that was already added. + * + * @see update_option() + * @since 2.8.0 + * @package WordPress + * @subpackage Option + * + * @uses apply_filters() Calls 'pre_update_site_option_$option' hook to allow overwriting the + * option value to be stored. + * @uses do_action() Calls 'update_site_option_$option' and 'update_site_option' hooks on success. + * + * @param string $option Name of option. Expected to not be SQL-escaped. + * @param mixed $value Option value. Expected to not be SQL-escaped. + * @return bool False if value was not updated and true if value was updated. + */ +function update_site_option( $option, $value ) { + global $wpdb; + + $oldvalue = get_site_option( $option ); + $value = apply_filters( 'pre_update_site_option_' . $option, $value, $oldvalue ); + + if ( $value === $oldvalue ) + return false; + + if ( !is_multisite() ) { + $result = update_option( $option, $value ); + } else { + $cache_key = "{$wpdb->siteid}:$option"; + + if ( $value && !$wpdb->get_row( $wpdb->prepare( "SELECT meta_value FROM $wpdb->sitemeta WHERE meta_key = %s AND site_id = %d", $option, $wpdb->siteid ) ) ) + return add_site_option( $option, $value ); + $value = sanitize_option( $option, $value ); + wp_cache_set( $cache_key, $value, 'site-options' ); + + $_value = $value; + $value = maybe_serialize( $value ); + $result = $wpdb->update( $wpdb->sitemeta, array( 'meta_value' => $value ), array( 'site_id' => $wpdb->siteid, 'meta_key' => $option ) ); + $value = $_value; + } + + if ( $result ) { + do_action( "update_site_option_{$option}", $option, $value ); + do_action( "update_site_option", $option, $value ); + return true; + } + return false; +} + +/** + * Delete a site transient + * + * @since 2.9.0 + * @package WordPress + * @subpackage Transient + * + * @uses do_action() Calls 'delete_site_transient_$transient' hook before transient is deleted. + * @uses do_action() Calls 'deleted_site_transient' hook on success. + * + * @param string $transient Transient name. Expected to not be SQL-escaped. + * @return bool True if successful, false otherwise + */ +function delete_site_transient( $transient ) { + global $_wp_using_ext_object_cache; + + do_action( 'delete_site_transient_' . $transient, $transient ); + if ( $_wp_using_ext_object_cache ) { + $result = wp_cache_delete( $transient, 'site-transient' ); + } else { + $option_timeout = '_site_transient_timeout_' . $transient; + $option = '_site_transient_' . $transient; + $result = delete_site_option( $option ); + if ( $result ) + delete_site_option( $option_timeout ); + } + if ( $result ) + do_action( 'deleted_site_transient', $transient ); + return $result; +} + +/** + * Get the value of a site transient + * + * If the transient does not exist or does not have a value, then the return value + * will be false. + * + * @see get_transient() + * @since 2.9.0 + * @package WordPress + * @subpackage Transient + * + * @uses apply_filters() Calls 'pre_site_transient_$transient' hook before checking the transient. + * Any value other than false will "short-circuit" the retrieval of the transient + * and return the returned value. + * @uses apply_filters() Calls 'site_transient_$option' hook, after checking the transient, with + * the transient value. + * + * @param string $transient Transient name. Expected to not be SQL-escaped. + * @return mixed Value of transient + */ +function get_site_transient( $transient ) { + global $_wp_using_ext_object_cache; + + $pre = apply_filters( 'pre_site_transient_' . $transient, false ); + if ( false !== $pre ) + return $pre; + + if ( $_wp_using_ext_object_cache ) { + $value = wp_cache_get( $transient, 'site-transient' ); + } else { + // Core transients that do not have a timeout. Listed here so querying timeouts can be avoided. + $no_timeout = array('update_core', 'update_plugins', 'update_themes'); + $transient_option = '_site_transient_' . $transient; + if ( ! in_array( $transient, $no_timeout ) ) { + $transient_timeout = '_site_transient_timeout_' . $transient; + $timeout = get_site_option( $transient_timeout ); + if ( false !== $timeout && $timeout < time() ) { + delete_site_option( $transient_option ); + delete_site_option( $transient_timeout ); + return false; + } + } + + $value = get_site_option( $transient_option ); + } + + return apply_filters( 'site_transient_' . $transient, $value ); +} + +/** + * Set/update the value of a site transient + * + * You do not need to serialize values, if the value needs to be serialize, then + * it will be serialized before it is set. + * + * @see set_transient() + * @since 2.9.0 + * @package WordPress + * @subpackage Transient + * + * @uses apply_filters() Calls 'pre_set_site_transient_$transient' hook to allow overwriting the + * transient value to be stored. + * @uses do_action() Calls 'set_site_transient_$transient' and 'setted_site_transient' hooks on success. + * + * @param string $transient Transient name. Expected to not be SQL-escaped. + * @param mixed $value Transient value. Expected to not be SQL-escaped. + * @param int $expiration Time until expiration in seconds, default 0 + * @return bool False if value was not set and true if value was set. + */ +function set_site_transient( $transient, $value, $expiration = 0 ) { + global $_wp_using_ext_object_cache; + + $value = apply_filters( 'pre_set_site_transient_' . $transient, $value ); + + if ( $_wp_using_ext_object_cache ) { + $result = wp_cache_set( $transient, $value, 'site-transient', $expiration ); + } else { + $transient_timeout = '_site_transient_timeout_' . $transient; + $transient = '_site_transient_' . $transient; + if ( false === get_site_option( $transient ) ) { + if ( $expiration ) + add_site_option( $transient_timeout, time() + $expiration ); + $result = add_site_option( $transient, $value ); + } else { + if ( $expiration ) + update_site_option( $transient_timeout, time() + $expiration ); + $result = update_site_option( $transient, $value ); + } + } + if ( $result ) { + do_action( 'set_site_transient_' . $transient ); + do_action( 'setted_site_transient', $transient ); + } + return $result; +} + +/** + * is main site + * + * + * @since 3.0.0 + * @package WordPress + * + * @param int $blog_id optional blog id to test (default current blog) + * @return bool True if not multisite or $blog_id is main site + */ +function is_main_site( $blog_id = '' ) { + global $current_site, $current_blog; + + if ( !is_multisite() ) + return true; + + if ( !$blog_id ) + $blog_id = $current_blog->blog_id; + + return $blog_id == $current_site->blog_id; +} + +/** + * Whether global terms are enabled. + * + * + * @since 3.0.0 + * @package WordPress + * + * @return bool True if multisite and global terms enabled + */ +function global_terms_enabled() { + if ( ! is_multisite() ) + return false; + + static $global_terms = null; + if ( is_null( $global_terms ) ) { + $filter = apply_filters( 'global_terms_enabled', null ); + if ( ! is_null( $filter ) ) + $global_terms = (bool) $filter; + else + $global_terms = (bool) get_site_option( 'global_terms_enabled', false ); + } + return $global_terms; +} + +/** + * gmt_offset modification for smart timezone handling + * + * Overrides the gmt_offset option if we have a timezone_string available + * + * @since 2.8.0 + * + * @return float|bool + */ +function wp_timezone_override_offset() { + if ( !$timezone_string = get_option( 'timezone_string' ) ) { + return false; + } + + $timezone_object = timezone_open( $timezone_string ); + $datetime_object = date_create(); + if ( false === $timezone_object || false === $datetime_object ) { + return false; + } + return round( timezone_offset_get( $timezone_object, $datetime_object ) / 3600, 2 ); +} + +/** + * {@internal Missing Short Description}} + * + * @since 2.9.0 + * + * @param unknown_type $a + * @param unknown_type $b + * @return int + */ +function _wp_timezone_choice_usort_callback( $a, $b ) { + // Don't use translated versions of Etc + if ( 'Etc' === $a['continent'] && 'Etc' === $b['continent'] ) { + // Make the order of these more like the old dropdown + if ( 'GMT+' === substr( $a['city'], 0, 4 ) && 'GMT+' === substr( $b['city'], 0, 4 ) ) { + return -1 * ( strnatcasecmp( $a['city'], $b['city'] ) ); + } + if ( 'UTC' === $a['city'] ) { + if ( 'GMT+' === substr( $b['city'], 0, 4 ) ) { + return 1; + } + return -1; + } + if ( 'UTC' === $b['city'] ) { + if ( 'GMT+' === substr( $a['city'], 0, 4 ) ) { + return -1; + } + return 1; + } + return strnatcasecmp( $a['city'], $b['city'] ); + } + if ( $a['t_continent'] == $b['t_continent'] ) { + if ( $a['t_city'] == $b['t_city'] ) { + return strnatcasecmp( $a['t_subcity'], $b['t_subcity'] ); + } + return strnatcasecmp( $a['t_city'], $b['t_city'] ); + } else { + // Force Etc to the bottom of the list + if ( 'Etc' === $a['continent'] ) { + return 1; + } + if ( 'Etc' === $b['continent'] ) { + return -1; + } + return strnatcasecmp( $a['t_continent'], $b['t_continent'] ); + } +} + +/** + * Gives a nicely formatted list of timezone strings // temporary! Not in final + * + * @since 2.9.0 + * + * @param string $selected_zone Selected Zone + * @return string + */ +function wp_timezone_choice( $selected_zone ) { + static $mo_loaded = false; + + $continents = array( 'Africa', 'America', 'Antarctica', 'Arctic', 'Asia', 'Atlantic', 'Australia', 'Europe', 'Indian', 'Pacific'); + + // Load translations for continents and cities + if ( !$mo_loaded ) { + $locale = get_locale(); + $mofile = WP_LANG_DIR . '/continents-cities-' . $locale . '.mo'; + load_textdomain( 'continents-cities', $mofile ); + $mo_loaded = true; + } + + $zonen = array(); + foreach ( timezone_identifiers_list() as $zone ) { + $zone = explode( '/', $zone ); + if ( !in_array( $zone[0], $continents ) ) { + continue; + } + + // This determines what gets set and translated - we don't translate Etc/* strings here, they are done later + $exists = array( + 0 => ( isset( $zone[0] ) && $zone[0] ), + 1 => ( isset( $zone[1] ) && $zone[1] ), + 2 => ( isset( $zone[2] ) && $zone[2] ), + ); + $exists[3] = ( $exists[0] && 'Etc' !== $zone[0] ); + $exists[4] = ( $exists[1] && $exists[3] ); + $exists[5] = ( $exists[2] && $exists[3] ); + + $zonen[] = array( + 'continent' => ( $exists[0] ? $zone[0] : '' ), + 'city' => ( $exists[1] ? $zone[1] : '' ), + 'subcity' => ( $exists[2] ? $zone[2] : '' ), + 't_continent' => ( $exists[3] ? translate( str_replace( '_', ' ', $zone[0] ), 'continents-cities' ) : '' ), + 't_city' => ( $exists[4] ? translate( str_replace( '_', ' ', $zone[1] ), 'continents-cities' ) : '' ), + 't_subcity' => ( $exists[5] ? translate( str_replace( '_', ' ', $zone[2] ), 'continents-cities' ) : '' ) + ); + } + usort( $zonen, '_wp_timezone_choice_usort_callback' ); + + $structure = array(); + + if ( empty( $selected_zone ) ) { + $structure[] = ''; + } + + foreach ( $zonen as $key => $zone ) { + // Build value in an array to join later + $value = array( $zone['continent'] ); + + if ( empty( $zone['city'] ) ) { + // It's at the continent level (generally won't happen) + $display = $zone['t_continent']; + } else { + // It's inside a continent group + + // Continent optgroup + if ( !isset( $zonen[$key - 1] ) || $zonen[$key - 1]['continent'] !== $zone['continent'] ) { + $label = $zone['t_continent']; + $structure[] = ''; + } + + // Add the city to the value + $value[] = $zone['city']; + + $display = $zone['t_city']; + if ( !empty( $zone['subcity'] ) ) { + // Add the subcity to the value + $value[] = $zone['subcity']; + $display .= ' - ' . $zone['t_subcity']; + } + } + + // Build the value + $value = join( '/', $value ); + $selected = ''; + if ( $value === $selected_zone ) { + $selected = 'selected="selected" '; + } + $structure[] = '"; + + // Close continent optgroup + if ( !empty( $zone['city'] ) && ( !isset($zonen[$key + 1]) || (isset( $zonen[$key + 1] ) && $zonen[$key + 1]['continent'] !== $zone['continent']) ) ) { + $structure[] = ''; + } + } + + // Do UTC + $structure[] = ''; + $selected = ''; + if ( 'UTC' === $selected_zone ) + $selected = 'selected="selected" '; + $structure[] = ''; + $structure[] = ''; + + // Do manual UTC offsets + $structure[] = ''; + $offset_range = array (-12, -11.5, -11, -10.5, -10, -9.5, -9, -8.5, -8, -7.5, -7, -6.5, -6, -5.5, -5, -4.5, -4, -3.5, -3, -2.5, -2, -1.5, -1, -0.5, + 0, 0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5, 5.5, 5.75, 6, 6.5, 7, 7.5, 8, 8.5, 8.75, 9, 9.5, 10, 10.5, 11, 11.5, 12, 12.75, 13, 13.75, 14); + foreach ( $offset_range as $offset ) { + if ( 0 <= $offset ) + $offset_name = '+' . $offset; + else + $offset_name = (string) $offset; + + $offset_value = $offset_name; + $offset_name = str_replace(array('.25','.5','.75'), array(':15',':30',':45'), $offset_name); + $offset_name = 'UTC' . $offset_name; + $offset_value = 'UTC' . $offset_value; + $selected = ''; + if ( $offset_value === $selected_zone ) + $selected = 'selected="selected" '; + $structure[] = '"; + + } + $structure[] = ''; + + return join( "\n", $structure ); +} + +/** + * Strip close comment and close php tags from file headers used by WP + * See http://core.trac.wordpress.org/ticket/8497 + * + * @since 2.8.0 + * + * @param string $str + * @return string + */ +function _cleanup_header_comment($str) { + return trim(preg_replace("/\s*(?:\*\/|\?>).*/", '', $str)); +} + +/** + * Permanently deletes posts, pages, attachments, and comments which have been in the trash for EMPTY_TRASH_DAYS. + * + * @since 2.9.0 + */ +function wp_scheduled_delete() { + global $wpdb; + + $delete_timestamp = time() - (60*60*24*EMPTY_TRASH_DAYS); + + $posts_to_delete = $wpdb->get_results($wpdb->prepare("SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_wp_trash_meta_time' AND meta_value < '%d'", $delete_timestamp), ARRAY_A); + + foreach ( (array) $posts_to_delete as $post ) { + $post_id = (int) $post['post_id']; + if ( !$post_id ) + continue; + + $del_post = get_post($post_id); + + if ( !$del_post || 'trash' != $del_post->post_status ) { + delete_post_meta($post_id, '_wp_trash_meta_status'); + delete_post_meta($post_id, '_wp_trash_meta_time'); + } else { + wp_delete_post($post_id); + } + } + + $comments_to_delete = $wpdb->get_results($wpdb->prepare("SELECT comment_id FROM $wpdb->commentmeta WHERE meta_key = '_wp_trash_meta_time' AND meta_value < '%d'", $delete_timestamp), ARRAY_A); + + foreach ( (array) $comments_to_delete as $comment ) { + $comment_id = (int) $comment['comment_id']; + if ( !$comment_id ) + continue; + + $del_comment = get_comment($comment_id); + + if ( !$del_comment || 'trash' != $del_comment->comment_approved ) { + delete_comment_meta($comment_id, '_wp_trash_meta_time'); + delete_comment_meta($comment_id, '_wp_trash_meta_status'); + } else { + wp_delete_comment($comment_id); + } + } +} + +/** + * Retrieve metadata from a file. + * + * Searches for metadata in the first 8kiB of a file, such as a plugin or theme. + * Each piece of metadata must be on its own line. Fields can not span multple + * lines, the value will get cut at the end of the first line. + * + * If the file data is not within that first 8kiB, then the author should correct + * their plugin file and move the data headers to the top. + * + * @see http://codex.wordpress.org/File_Header + * + * @since 2.9.0 + * @param string $file Path to the file + * @param array $default_headers List of headers, in the format array('HeaderKey' => 'Header Name') + * @param string $context If specified adds filter hook "extra_{$context}_headers" + */ +function get_file_data( $file, $default_headers, $context = '' ) { + // We don't need to write to the file, so just open for reading. + $fp = fopen( $file, 'r' ); + + // Pull only the first 8kiB of the file in. + $file_data = fread( $fp, 8192 ); + + // PHP will close file handle, but we are good citizens. + fclose( $fp ); + + if ( $context != '' ) { + $extra_headers = apply_filters( "extra_{$context}_headers", array() ); + + $extra_headers = array_flip( $extra_headers ); + foreach( $extra_headers as $key=>$value ) { + $extra_headers[$key] = $key; + } + $all_headers = array_merge( $extra_headers, (array) $default_headers ); + } else { + $all_headers = $default_headers; + } + + foreach ( $all_headers as $field => $regex ) { + preg_match( '/^[ \t\/*#@]*' . preg_quote( $regex, '/' ) . ':(.*)$/mi', $file_data, ${$field}); + if ( !empty( ${$field} ) ) + ${$field} = _cleanup_header_comment( ${$field}[1] ); + else + ${$field} = ''; + } + + $file_data = compact( array_keys( $all_headers ) ); + + return $file_data; +} + +/** + * Used internally to tidy up the search terms + * + * @access private + * @since 2.9.0 + * + * @param string $t + * @return string + */ +function _search_terms_tidy($t) { + return trim($t, "\"'\n\r "); +} + +/** + * Returns true + * + * Useful for returning true to filters easily + * + * @since 3.0.0 + * @see __return_false() + * @return bool true + */ +function __return_true() { + return true; +} + +/** + * Returns false + * + * Useful for returning false to filters easily + * + * @since 3.0.0 + * @see __return_true() + * @return bool false + */ +function __return_false() { + return false; +} + +/** + * Returns 0 + * + * Useful for returning 0 to filters easily + * + * @since 3.0.0 + * @see __return_zero() + * @return int 0 + */ +function __return_zero() { + return 0; +} + +/** + * Returns an empty array + * + * Useful for returning an empty array to filters easily + * + * @since 3.0.0 + * @see __return_zero() + * @return array Empty array + */ +function __return_empty_array() { + return array(); +} + +/** + * Send a HTTP header to disable content type sniffing in browsers which support it. + * + * @link http://blogs.msdn.com/ie/archive/2008/07/02/ie8-security-part-v-comprehensive-protection.aspx + * @link http://src.chromium.org/viewvc/chrome?view=rev&revision=6985 + * + * @since 3.0.0 + * @return none + */ +function send_nosniff_header() { + @header( 'X-Content-Type-Options: nosniff' ); +} + +/** + * Returns a MySQL expression for selecting the week number based on the start_of_week option. + * + * @internal + * @since 3.0.0 + * @param string $column + * @return string + */ +function _wp_mysql_week( $column ) { + switch ( $start_of_week = (int) get_option( 'start_of_week' ) ) { + default : + case 0 : + return "WEEK( $column, 0 )"; + case 1 : + return "WEEK( $column, 1 )"; + case 2 : + case 3 : + case 4 : + case 5 : + case 6 : + return "WEEK( DATE_SUB( $column, INTERVAL $start_of_week DAY ), 0 )"; + } +} + +/** + * Finds hierarchy loops using a callback function that maps object IDs to parent IDs. + * + * @since 3.1.0 + * @access private + * + * @param callback $callback function that accepts ( ID, $callback_args ) and outputs parent_ID + * @param int $start The ID to start the loop check at + * @param int $start_parent the parent_ID of $start to use instead of calling $callback( $start ). Use null to always use $callback + * @param array $callback_args optional additional arguments to send to $callback + * @return array IDs of all members of loop + */ +function wp_find_hierarchy_loop( $callback, $start, $start_parent, $callback_args = array() ) { + $override = is_null( $start_parent ) ? array() : array( $start => $start_parent ); + + if ( !$arbitrary_loop_member = wp_find_hierarchy_loop_tortoise_hare( $callback, $start, $override, $callback_args ) ) + return array(); + + return wp_find_hierarchy_loop_tortoise_hare( $callback, $arbitrary_loop_member, $override, $callback_args, true ); +} + +/** + * Uses the "The Tortoise and the Hare" algorithm to detect loops. + * + * For every step of the algorithm, the hare takes two steps and the tortoise one. + * If the hare ever laps the tortoise, there must be a loop. + * + * @since 3.1.0 + * @access private + * + * @param callback $callback function that accupts ( ID, callback_arg, ... ) and outputs parent_ID + * @param int $start The ID to start the loop check at + * @param array $override an array of ( ID => parent_ID, ... ) to use instead of $callback + * @param array $callback_args optional additional arguments to send to $callback + * @param bool $_return_loop Return loop members or just detect presence of loop? + * Only set to true if you already know the given $start is part of a loop + * (otherwise the returned array might include branches) + * @return mixed scalar ID of some arbitrary member of the loop, or array of IDs of all members of loop if $_return_loop + */ +function wp_find_hierarchy_loop_tortoise_hare( $callback, $start, $override = array(), $callback_args = array(), $_return_loop = false ) { + $tortoise = $hare = $evanescent_hare = $start; + $return = array(); + + // Set evanescent_hare to one past hare + // Increment hare two steps + while ( + $tortoise + && + ( $evanescent_hare = isset( $override[$hare] ) ? $override[$hare] : call_user_func_array( $callback, array_merge( array( $hare ), $callback_args ) ) ) + && + ( $hare = isset( $override[$evanescent_hare] ) ? $override[$evanescent_hare] : call_user_func_array( $callback, array_merge( array( $evanescent_hare ), $callback_args ) ) ) + ) { + if ( $_return_loop ) + $return[$tortoise] = $return[$evanescent_hare] = $return[$hare] = true; + + // tortoise got lapped - must be a loop + if ( $tortoise == $evanescent_hare || $tortoise == $hare ) + return $_return_loop ? $return : $tortoise; + + // Increment tortoise by one step + $tortoise = isset( $override[$tortoise] ) ? $override[$tortoise] : call_user_func_array( $callback, array_merge( array( $tortoise ), $callback_args ) ); + } + + return false; +} + +/** + * Send a HTTP header to limit rendering of pages to same origin iframes. + * + * @link https://developer.mozilla.org/en/the_x-frame-options_response_header + * + * @since 3.1.3 + * @return none + */ +function send_frame_options_header() { + @header( 'X-Frame-Options: SAMEORIGIN' ); +} + +?> diff --git a/src/wp-includes/functions.wp-scripts.php b/src/wp-includes/functions.wp-scripts.php new file mode 100644 index 0000000..af2055d --- /dev/null +++ b/src/wp-includes/functions.wp-scripts.php @@ -0,0 +1,147 @@ +do_items( $handles ); +} + +/** + * Register new JavaScript file. + * + * @since r16 + * @param string $handle Script name + * @param string $src Script url + * @param array $deps (optional) Array of script names on which this script depends + * @param string|bool $ver (optional) Script version (used for cache busting), set to NULL to disable + * @param bool $in_footer (optional) Whether to enqueue the script before or before + * @return null + */ +function wp_register_script( $handle, $src, $deps = array(), $ver = false, $in_footer = false ) { + global $wp_scripts; + if ( !is_a($wp_scripts, 'WP_Scripts') ) + $wp_scripts = new WP_Scripts(); + + $wp_scripts->add( $handle, $src, $deps, $ver ); + if ( $in_footer ) + $wp_scripts->add_data( $handle, 'group', 1 ); +} + +/** + * Localizes a script. + * + * Localizes only if script has already been added. + * + * @since r16 + * @see WP_Scripts::localize() + */ +function wp_localize_script( $handle, $object_name, $l10n ) { + global $wp_scripts; + if ( !is_a($wp_scripts, 'WP_Scripts') ) + return false; + + return $wp_scripts->localize( $handle, $object_name, $l10n ); +} + +/** + * Remove a registered script. + * + * @since r16 + * @see WP_Scripts::remove() For parameter information. + */ +function wp_deregister_script( $handle ) { + global $wp_scripts; + if ( !is_a($wp_scripts, 'WP_Scripts') ) + $wp_scripts = new WP_Scripts(); + + $wp_scripts->remove( $handle ); +} + +/** + * Enqueues script. + * + * Registers the script if src provided (does NOT overwrite) and enqueues. + * + * @since r16 + * @see wp_register_script() For parameter information. + */ +function wp_enqueue_script( $handle, $src = false, $deps = array(), $ver = false, $in_footer = false ) { + global $wp_scripts; + if ( !is_a($wp_scripts, 'WP_Scripts') ) + $wp_scripts = new WP_Scripts(); + + if ( $src ) { + $_handle = explode('?', $handle); + $wp_scripts->add( $_handle[0], $src, $deps, $ver ); + if ( $in_footer ) + $wp_scripts->add_data( $_handle[0], 'group', 1 ); + } + $wp_scripts->enqueue( $handle ); +} + +/** + * Remove an enqueued script. + * + * @since WP 3.1 + * @see WP_Scripts::dequeue() For parameter information. + */ +function wp_dequeue_script( $handle ) { + global $wp_scripts; + if ( !is_a($wp_scripts, 'WP_Scripts') ) + $wp_scripts = new WP_Scripts(); + + $wp_scripts->dequeue( $handle ); +} + +/** + * Check whether script has been added to WordPress Scripts. + * + * The values for list defaults to 'queue', which is the same as enqueue for + * scripts. + * + * @since WP unknown; BP unknown + * + * @param string $handle Handle used to add script. + * @param string $list Optional, defaults to 'queue'. Others values are 'registered', 'queue', 'done', 'to_do' + * @return bool + */ +function wp_script_is( $handle, $list = 'queue' ) { + global $wp_scripts; + if ( !is_a($wp_scripts, 'WP_Scripts') ) + $wp_scripts = new WP_Scripts(); + + $query = $wp_scripts->query( $handle, $list ); + + if ( is_object( $query ) ) + return true; + + return $query; +} diff --git a/src/wp-includes/functions.wp-styles.php b/src/wp-includes/functions.wp-styles.php new file mode 100644 index 0000000..630a112 --- /dev/null +++ b/src/wp-includes/functions.wp-styles.php @@ -0,0 +1,145 @@ +do_items( $handles ); +} + +/** + * Register CSS style file. + * + * @since r79 + * @see WP_Styles::add() For additional information. + * @global object $wp_styles The WP_Styles object for printing styles. + * @link http://www.w3.org/TR/CSS2/media.html#media-types List of CSS media types. + * + * @param string $handle Name of the stylesheet. + * @param string|bool $src Path to the stylesheet from the root directory of WordPress. Example: '/css/mystyle.css'. + * @param array $deps Array of handles of any stylesheet that this stylesheet depends on. + * (Stylesheets that must be loaded before this stylesheet.) Pass an empty array if there are no dependencies. + * @param string|bool $ver String specifying the stylesheet version number. Set to NULL to disable. + * Used to ensure that the correct version is sent to the client regardless of caching. + * @param string $media The media for which this stylesheet has been defined. + */ +function wp_register_style( $handle, $src, $deps = array(), $ver = false, $media = 'all' ) { + global $wp_styles; + if ( !is_a($wp_styles, 'WP_Styles') ) + $wp_styles = new WP_Styles(); + + $wp_styles->add( $handle, $src, $deps, $ver, $media ); +} + +/** + * Remove a registered CSS file. + * + * @since r79 + * @see WP_Styles::remove() For additional information. + * @global object $wp_styles The WP_Styles object for printing styles. + * + * @param string $handle Name of the stylesheet. + */ +function wp_deregister_style( $handle ) { + global $wp_styles; + if ( !is_a($wp_styles, 'WP_Styles') ) + $wp_styles = new WP_Styles(); + + $wp_styles->remove( $handle ); +} + +/** + * Enqueue a CSS style file. + * + * Registers the style if src provided (does NOT overwrite) and enqueues. + * + * @since r79 + * @see WP_Styles::add(), WP_Styles::enqueue() + * @global object $wp_styles The WP_Styles object for printing styles. + * @link http://www.w3.org/TR/CSS2/media.html#media-types List of CSS media types. + * + * @param string $handle Name of the stylesheet. + * @param string|bool $src Path to the stylesheet from the root directory of WordPress. Example: '/css/mystyle.css'. + * @param array $deps Array of handles (names) of any stylesheet that this stylesheet depends on. + * (Stylesheets that must be loaded before this stylesheet.) Pass an empty array if there are no dependencies. + * @param string|bool $ver String specifying the stylesheet version number, if it has one. This parameter + * is used to ensure that the correct version is sent to the client regardless of caching, and so should be included + * if a version number is available and makes sense for the stylesheet. + * @param string $media The media for which this stylesheet has been defined. + */ +function wp_enqueue_style( $handle, $src = false, $deps = array(), $ver = false, $media = 'all' ) { + global $wp_styles; + if ( !is_a($wp_styles, 'WP_Styles') ) + $wp_styles = new WP_Styles(); + + if ( $src ) { + $_handle = explode('?', $handle); + $wp_styles->add( $_handle[0], $src, $deps, $ver, $media ); + } + $wp_styles->enqueue( $handle ); +} + +/** + * Remove an enqueued style. + * + * @since WP 3.1 + * @see WP_Styles::dequeue() For parameter information. + */ +function wp_dequeue_style( $handle ) { + global $wp_styles; + if ( !is_a($wp_styles, 'WP_Styles') ) + $wp_styles = new WP_Styles(); + + $wp_styles->dequeue( $handle ); +} + +/** + * Check whether style has been added to WordPress Styles. + * + * The values for list defaults to 'queue', which is the same as wp_enqueue_style(). + * + * @since WP unknown; BP unknown + * @global object $wp_styles The WP_Styles object for printing styles. + * + * @param string $handle Name of the stylesheet. + * @param string $list Values are 'registered', 'done', 'queue' and 'to_do'. + * @return bool True on success, false on failure. + */ +function wp_style_is( $handle, $list = 'queue' ) { + global $wp_styles; + if ( !is_a($wp_styles, 'WP_Styles') ) + $wp_styles = new WP_Styles(); + + $query = $wp_styles->query( $handle, $list ); + + if ( is_object( $query ) ) + return true; + + return $query; +} diff --git a/src/wp-includes/general-template.php b/src/wp-includes/general-template.php new file mode 100644 index 0000000..be1af2a --- /dev/null +++ b/src/wp-includes/general-template.php @@ -0,0 +1,2327 @@ + +
            + + +
            + '; + + if ( $echo ) + echo apply_filters('get_search_form', $form); + else + return apply_filters('get_search_form', $form); +} + +/** + * Display the Log In/Out link. + * + * Displays a link, which allows users to navigate to the Log In page to log in + * or log out depending on whether they are currently logged in. + * + * @since 1.5.0 + * @uses apply_filters() Calls 'loginout' hook on HTML link content. + * + * @param string $redirect Optional path to redirect to on login/logout. + * @param boolean $echo Default to echo and not return the link. + */ +function wp_loginout($redirect = '', $echo = true) { + if ( ! is_user_logged_in() ) + $link = '' . __('Log in') . ''; + else + $link = '' . __('Log out') . ''; + + if ( $echo ) + echo apply_filters('loginout', $link); + else + return apply_filters('loginout', $link); +} + +/** + * Returns the Log Out URL. + * + * Returns the URL that allows the user to log out of the site + * + * @since 2.7.0 + * @uses wp_nonce_url() To protect against CSRF + * @uses site_url() To generate the log in URL + * @uses apply_filters() calls 'logout_url' hook on final logout url + * + * @param string $redirect Path to redirect to on logout. + */ +function wp_logout_url($redirect = '') { + $args = array( 'action' => 'logout' ); + if ( !empty($redirect) ) { + $args['redirect_to'] = urlencode( $redirect ); + } + + $logout_url = add_query_arg($args, site_url('wp-login.php', 'login')); + $logout_url = wp_nonce_url( $logout_url, 'log-out' ); + + return apply_filters('logout_url', $logout_url, $redirect); +} + +/** + * Returns the Log In URL. + * + * Returns the URL that allows the user to log in to the site + * + * @since 2.7.0 + * @uses site_url() To generate the log in URL + * @uses apply_filters() calls 'login_url' hook on final login url + * + * @param string $redirect Path to redirect to on login. + * @param bool $force_reauth Whether to force reauthorization, even if a cookie is present. Default is false. + * @return string A log in url + */ +function wp_login_url($redirect = '', $force_reauth = false) { + $login_url = site_url('wp-login.php', 'login'); + + if ( !empty($redirect) ) + $login_url = add_query_arg('redirect_to', urlencode($redirect), $login_url); + + if ( $force_reauth ) + $login_url = add_query_arg('reauth', '1', $login_url); + + return apply_filters('login_url', $login_url, $redirect); +} + +/** + * Provides a simple login form for use anywhere within WordPress. By default, it echoes + * the HTML immediately. Pass array('echo'=>false) to return the string instead. + * + * @since 3.0.0 + * @param array $args Configuration options to modify the form output + * @return Void, or string containing the form + */ +function wp_login_form( $args = array() ) { + $defaults = array( 'echo' => true, + 'redirect' => site_url( $_SERVER['REQUEST_URI'] ), // Default redirect is back to the current page + 'form_id' => 'loginform', + 'label_username' => __( 'Username' ), + 'label_password' => __( 'Password' ), + 'label_remember' => __( 'Remember Me' ), + 'label_log_in' => __( 'Log In' ), + 'id_username' => 'user_login', + 'id_password' => 'user_pass', + 'id_remember' => 'rememberme', + 'id_submit' => 'wp-submit', + 'remember' => true, + 'value_username' => '', + 'value_remember' => false, // Set this to true to default the "Remember me" checkbox to checked + ); + $args = wp_parse_args( $args, apply_filters( 'login_form_defaults', $defaults ) ); + + $form = ' +
            + ' . apply_filters( 'login_form_top', '', $args ) . ' + + + ' . apply_filters( 'login_form_middle', '', $args ) . ' + ' . ( $args['remember'] ? '' : '' ) . ' + + ' . apply_filters( 'login_form_bottom', '', $args ) . ' +
            '; + + if ( $args['echo'] ) + echo $form; + else + return $form; +} + +/** + * Returns the Lost Password URL. + * + * Returns the URL that allows the user to retrieve the lost password + * + * @since 2.8.0 + * @uses site_url() To generate the lost password URL + * @uses apply_filters() calls 'lostpassword_url' hook on the lostpassword url + * + * @param string $redirect Path to redirect to on login. + */ +function wp_lostpassword_url($redirect = '') { + $args = array( 'action' => 'lostpassword' ); + if ( !empty($redirect) ) { + $args['redirect_to'] = $redirect; + } + + $lostpassword_url = add_query_arg($args, site_url('wp-login.php', 'login')); + return apply_filters('lostpassword_url', $lostpassword_url, $redirect); +} + +/** + * Display the Registration or Admin link. + * + * Display a link which allows the user to navigate to the registration page if + * not logged in and registration is enabled or to the dashboard if logged in. + * + * @since 1.5.0 + * @uses apply_filters() Calls 'register' hook on register / admin link content. + * + * @param string $before Text to output before the link (defaults to
          • ). + * @param string $after Text to output after the link (defaults to
          • ). + * @param boolean $echo Default to echo and not return the link. + */ +function wp_register( $before = '
          • ', $after = '
          • ', $echo = true ) { + + if ( ! is_user_logged_in() ) { + if ( get_option('users_can_register') ) + $link = $before . '' . __('Register') . '' . $after; + else + $link = ''; + } else { + $link = $before . '' . __('Site Admin') . '' . $after; + } + + if ( $echo ) + echo apply_filters('register', $link); + else + return apply_filters('register', $link); +} + +/** + * Theme container function for the 'wp_meta' action. + * + * The 'wp_meta' action can have several purposes, depending on how you use it, + * but one purpose might have been to allow for theme switching. + * + * @since 1.5.0 + * @link http://trac.wordpress.org/ticket/1458 Explanation of 'wp_meta' action. + * @uses do_action() Calls 'wp_meta' hook. + */ +function wp_meta() { + do_action('wp_meta'); +} + +/** + * Display information about the blog. + * + * @see get_bloginfo() For possible values for the parameter. + * @since 0.71 + * + * @param string $show What to display. + */ +function bloginfo( $show='' ) { + echo get_bloginfo( $show, 'display' ); +} + +/** + * Retrieve information about the blog. + * + * Some show parameter values are deprecated and will be removed in future + * versions. These options will trigger the _deprecated_argument() function. + * The deprecated blog info options are listed in the function contents. + * + * The possible values for the 'show' parameter are listed below. + *
              + *
            1. url - Blog URI to homepage.
            2. + *
            3. wpurl - Blog URI path to WordPress.
            4. + *
            5. description - Secondary title
            6. + *
            + * + * The feed URL options can be retrieved from 'rdf_url' (RSS 0.91), + * 'rss_url' (RSS 1.0), 'rss2_url' (RSS 2.0), or 'atom_url' (Atom feed). The + * comment feeds can be retrieved from the 'comments_atom_url' (Atom comment + * feed) or 'comments_rss2_url' (RSS 2.0 comment feed). + * + * @since 0.71 + * + * @param string $show Blog info to retrieve. + * @param string $filter How to filter what is retrieved. + * @return string Mostly string values, might be empty. + */ +function get_bloginfo( $show = '', $filter = 'raw' ) { + + switch( $show ) { + case 'home' : // DEPRECATED + case 'siteurl' : // DEPRECATED + _deprecated_argument( __FUNCTION__, '2.2', sprintf( __('The %s option is deprecated for the family of bloginfo() functions.' ), $show ) . ' ' . sprintf( __( 'Use the %s option instead.' ), 'url' ) ); + case 'url' : + $output = home_url(); + break; + case 'wpurl' : + $output = site_url(); + break; + case 'description': + $output = get_option('blogdescription'); + break; + case 'rdf_url': + $output = get_feed_link('rdf'); + break; + case 'rss_url': + $output = get_feed_link('rss'); + break; + case 'rss2_url': + $output = get_feed_link('rss2'); + break; + case 'atom_url': + $output = get_feed_link('atom'); + break; + case 'comments_atom_url': + $output = get_feed_link('comments_atom'); + break; + case 'comments_rss2_url': + $output = get_feed_link('comments_rss2'); + break; + case 'pingback_url': + $output = get_option('siteurl') .'/xmlrpc.php'; + break; + case 'stylesheet_url': + $output = get_stylesheet_uri(); + break; + case 'stylesheet_directory': + $output = get_stylesheet_directory_uri(); + break; + case 'template_directory': + case 'template_url': + $output = get_template_directory_uri(); + break; + case 'admin_email': + $output = get_option('admin_email'); + break; + case 'charset': + $output = get_option('blog_charset'); + if ('' == $output) $output = 'UTF-8'; + break; + case 'html_type' : + $output = get_option('html_type'); + break; + case 'version': + global $wp_version; + $output = $wp_version; + break; + case 'language': + $output = get_locale(); + $output = str_replace('_', '-', $output); + break; + case 'text_direction': + //_deprecated_argument( __FUNCTION__, '2.2', sprintf( __('The %s option is deprecated for the family of bloginfo() functions.' ), $show ) . ' ' . sprintf( __( 'Use the %s function instead.' ), 'is_rtl()' ) ); + if ( function_exists( 'is_rtl' ) ) { + $output = is_rtl() ? 'rtl' : 'ltr'; + } else { + $output = 'ltr'; + } + break; + case 'name': + default: + $output = get_option('blogname'); + break; + } + + $url = true; + if (strpos($show, 'url') === false && + strpos($show, 'directory') === false && + strpos($show, 'home') === false) + $url = false; + + if ( 'display' == $filter ) { + if ( $url ) + $output = apply_filters('bloginfo_url', $output, $show); + else + $output = apply_filters('bloginfo', $output, $show); + } + + return $output; +} + +/** + * Retrieve the current blog id + * + * @since 3.1.0 + * + * @return int Blog id + */ +function get_current_blog_id() { + global $blog_id; + return absint($blog_id); +} + +/** + * Display or retrieve page title for all areas of blog. + * + * By default, the page title will display the separator before the page title, + * so that the blog title will be before the page title. This is not good for + * title display, since the blog title shows up on most tabs and not what is + * important, which is the page that the user is looking at. + * + * There are also SEO benefits to having the blog title after or to the 'right' + * or the page title. However, it is mostly common sense to have the blog title + * to the right with most browsers supporting tabs. You can achieve this by + * using the seplocation parameter and setting the value to 'right'. This change + * was introduced around 2.5.0, in case backwards compatibility of themes is + * important. + * + * @since 1.0.0 + * + * @param string $sep Optional, default is '»'. How to separate the various items within the page title. + * @param bool $display Optional, default is true. Whether to display or retrieve title. + * @param string $seplocation Optional. Direction to display title, 'right'. + * @return string|null String on retrieve, null when displaying. + */ +function wp_title($sep = '»', $display = true, $seplocation = '') { + global $wpdb, $wp_locale; + + $m = get_query_var('m'); + $year = get_query_var('year'); + $monthnum = get_query_var('monthnum'); + $day = get_query_var('day'); + $search = get_query_var('s'); + $title = ''; + + $t_sep = '%WP_TITILE_SEP%'; // Temporary separator, for accurate flipping, if necessary + + // If there is a post + if ( is_single() || ( is_home() && !is_front_page() ) || ( is_page() && !is_front_page() ) ) { + $title = single_post_title( '', false ); + } + + // If there's a category or tag + if ( is_category() || is_tag() ) { + $title = single_term_title( '', false ); + } + + // If there's a taxonomy + if ( is_tax() ) { + $term = get_queried_object(); + $tax = get_taxonomy( $term->taxonomy ); + $title = single_term_title( $tax->labels->name . $t_sep, false ); + } + + // If there's an author + if ( is_author() ) { + $author = get_queried_object(); + $title = $author->display_name; + } + + // If there's a post type archive + if ( is_post_type_archive() ) + $title = post_type_archive_title( '', false ); + + // If there's a month + if ( is_archive() && !empty($m) ) { + $my_year = substr($m, 0, 4); + $my_month = $wp_locale->get_month(substr($m, 4, 2)); + $my_day = intval(substr($m, 6, 2)); + $title = $my_year . ( $my_month ? $t_sep . $my_month : '' ) . ( $my_day ? $t_sep . $my_day : '' ); + } + + // If there's a year + if ( is_archive() && !empty($year) ) { + $title = $year; + if ( !empty($monthnum) ) + $title .= $t_sep . $wp_locale->get_month($monthnum); + if ( !empty($day) ) + $title .= $t_sep . zeroise($day, 2); + } + + // If it's a search + if ( is_search() ) { + /* translators: 1: separator, 2: search phrase */ + $title = sprintf(__('Search Results %1$s %2$s'), $t_sep, strip_tags($search)); + } + + // If it's a 404 page + if ( is_404() ) { + $title = __('Page not found'); + } + + $prefix = ''; + if ( !empty($title) ) + $prefix = " $sep "; + + // Determines position of the separator and direction of the breadcrumb + if ( 'right' == $seplocation ) { // sep on right, so reverse the order + $title_array = explode( $t_sep, $title ); + $title_array = array_reverse( $title_array ); + $title = implode( " $sep ", $title_array ) . $prefix; + } else { + $title_array = explode( $t_sep, $title ); + $title = $prefix . implode( " $sep ", $title_array ); + } + + $title = apply_filters('wp_title', $title, $sep, $seplocation); + + // Send it out + if ( $display ) + echo $title; + else + return $title; + +} + +/** + * Display or retrieve page title for post. + * + * This is optimized for single.php template file for displaying the post title. + * + * It does not support placing the separator after the title, but by leaving the + * prefix parameter empty, you can set the title separator manually. The prefix + * does not automatically place a space between the prefix, so if there should + * be a space, the parameter value will need to have it at the end. + * + * @since 0.71 + * + * @param string $prefix Optional. What to display before the title. + * @param bool $display Optional, default is true. Whether to display or retrieve title. + * @return string|null Title when retrieving, null when displaying or failure. + */ +function single_post_title($prefix = '', $display = true) { + $_post = get_queried_object(); + + if ( !isset($_post->post_title) ) + return; + + $title = apply_filters('single_post_title', $_post->post_title, $_post); + if ( $display ) + echo $prefix . $title; + else + return $title; +} + +/** + * Display or retrieve title for a post type archive. + * + * This is optimized for archive.php and archive-{$post_type}.php template files + * for displaying the title of the post type. + * + * @since 3.1.0 + * + * @param string $prefix Optional. What to display before the title. + * @param bool $display Optional, default is true. Whether to display or retrieve title. + * @return string|null Title when retrieving, null when displaying or failure. + */ +function post_type_archive_title( $prefix = '', $display = true ) { + if ( ! is_post_type_archive() ) + return; + + $post_type_obj = get_queried_object(); + $title = apply_filters('post_type_archive_title', $post_type_obj->labels->name ); + + if ( $display ) + echo $prefix . $title; + else + return $title; +} + +/** + * Display or retrieve page title for category archive. + * + * This is useful for category template file or files, because it is optimized + * for category page title and with less overhead than {@link wp_title()}. + * + * It does not support placing the separator after the title, but by leaving the + * prefix parameter empty, you can set the title separator manually. The prefix + * does not automatically place a space between the prefix, so if there should + * be a space, the parameter value will need to have it at the end. + * + * @since 0.71 + * + * @param string $prefix Optional. What to display before the title. + * @param bool $display Optional, default is true. Whether to display or retrieve title. + * @return string|null Title when retrieving, null when displaying or failure. + */ +function single_cat_title( $prefix = '', $display = true ) { + return single_term_title( $prefix, $display ); +} + +/** + * Display or retrieve page title for tag post archive. + * + * Useful for tag template files for displaying the tag page title. It has less + * overhead than {@link wp_title()}, because of its limited implementation. + * + * It does not support placing the separator after the title, but by leaving the + * prefix parameter empty, you can set the title separator manually. The prefix + * does not automatically place a space between the prefix, so if there should + * be a space, the parameter value will need to have it at the end. + * + * @since 2.3.0 + * + * @param string $prefix Optional. What to display before the title. + * @param bool $display Optional, default is true. Whether to display or retrieve title. + * @return string|null Title when retrieving, null when displaying or failure. + */ +function single_tag_title( $prefix = '', $display = true ) { + return single_term_title( $prefix, $display ); +} + +/** + * Display or retrieve page title for taxonomy term archive. + * + * Useful for taxonomy term template files for displaying the taxonomy term page title. + * It has less overhead than {@link wp_title()}, because of its limited implementation. + * + * It does not support placing the separator after the title, but by leaving the + * prefix parameter empty, you can set the title separator manually. The prefix + * does not automatically place a space between the prefix, so if there should + * be a space, the parameter value will need to have it at the end. + * + * @since 3.1.0 + * + * @param string $prefix Optional. What to display before the title. + * @param bool $display Optional, default is true. Whether to display or retrieve title. + * @return string|null Title when retrieving, null when displaying or failure. + */ +function single_term_title( $prefix = '', $display = true ) { + $term = get_queried_object(); + + if ( !$term ) + return; + + if ( is_category() ) + $term_name = apply_filters( 'single_cat_title', $term->name ); + elseif ( is_tag() ) + $term_name = apply_filters( 'single_tag_title', $term->name ); + elseif ( is_tax() ) + $term_name = apply_filters( 'single_term_title', $term->name ); + else + return; + + if ( empty( $term_name ) ) + return; + + if ( $display ) + echo $prefix . $term_name; + else + return $term_name; +} + +/** + * Display or retrieve page title for post archive based on date. + * + * Useful for when the template only needs to display the month and year, if + * either are available. Optimized for just this purpose, so if it is all that + * is needed, should be better than {@link wp_title()}. + * + * It does not support placing the separator after the title, but by leaving the + * prefix parameter empty, you can set the title separator manually. The prefix + * does not automatically place a space between the prefix, so if there should + * be a space, the parameter value will need to have it at the end. + * + * @since 0.71 + * + * @param string $prefix Optional. What to display before the title. + * @param bool $display Optional, default is true. Whether to display or retrieve title. + * @return string|null Title when retrieving, null when displaying or failure. + */ +function single_month_title($prefix = '', $display = true ) { + global $wp_locale; + + $m = get_query_var('m'); + $year = get_query_var('year'); + $monthnum = get_query_var('monthnum'); + + if ( !empty($monthnum) && !empty($year) ) { + $my_year = $year; + $my_month = $wp_locale->get_month($monthnum); + } elseif ( !empty($m) ) { + $my_year = substr($m, 0, 4); + $my_month = $wp_locale->get_month(substr($m, 4, 2)); + } + + if ( empty($my_month) ) + return false; + + $result = $prefix . $my_month . $prefix . $my_year; + + if ( !$display ) + return $result; + echo $result; +} + +/** + * Retrieve archive link content based on predefined or custom code. + * + * The format can be one of four styles. The 'link' for head element, 'option' + * for use in the select element, 'html' for use in list (either ol or ul HTML + * elements). Custom content is also supported using the before and after + * parameters. + * + * The 'link' format uses the link HTML element with the archives + * relationship. The before and after parameters are not used. The text + * parameter is used to describe the link. + * + * The 'option' format uses the option HTML element for use in select element. + * The value is the url parameter and the before and after parameters are used + * between the text description. + * + * The 'html' format, which is the default, uses the li HTML element for use in + * the list HTML elements. The before parameter is before the link and the after + * parameter is after the closing link. + * + * The custom format uses the before parameter before the link ('a' HTML + * element) and the after parameter after the closing link tag. If the above + * three values for the format are not used, then custom format is assumed. + * + * @since 1.0.0 + * + * @param string $url URL to archive. + * @param string $text Archive text description. + * @param string $format Optional, default is 'html'. Can be 'link', 'option', 'html', or custom. + * @param string $before Optional. + * @param string $after Optional. + * @return string HTML link content for archive. + */ +function get_archives_link($url, $text, $format = 'html', $before = '', $after = '') { + $text = wptexturize($text); + $title_text = esc_attr($text); + $url = esc_url($url); + + if ('link' == $format) + $link_html = "\t\n"; + elseif ('option' == $format) + $link_html = "\t\n"; + elseif ('html' == $format) + $link_html = "\t
          • $before$text$after
          • \n"; + else // custom + $link_html = "\t$before$text$after\n"; + + $link_html = apply_filters( 'get_archives_link', $link_html ); + + return $link_html; +} + +/** + * Display archive links based on type and format. + * + * The 'type' argument offers a few choices and by default will display monthly + * archive links. The other options for values are 'daily', 'weekly', 'monthly', + * 'yearly', 'postbypost' or 'alpha'. Both 'postbypost' and 'alpha' display the + * same archive link list, the difference between the two is that 'alpha' + * will order by post title and 'postbypost' will order by post date. + * + * The date archives will logically display dates with links to the archive post + * page. The 'postbypost' and 'alpha' values for 'type' argument will display + * the post titles. + * + * The 'limit' argument will only display a limited amount of links, specified + * by the 'limit' integer value. By default, there is no limit. The + * 'show_post_count' argument will show how many posts are within the archive. + * By default, the 'show_post_count' argument is set to false. + * + * For the 'format', 'before', and 'after' arguments, see {@link + * get_archives_link()}. The values of these arguments have to do with that + * function. + * + * @since 1.2.0 + * + * @param string|array $args Optional. Override defaults. + */ +function wp_get_archives($args = '') { + global $wpdb, $wp_locale; + + $defaults = array( + 'type' => 'monthly', 'limit' => '', + 'format' => 'html', 'before' => '', + 'after' => '', 'show_post_count' => false, + 'echo' => 1 + ); + + $r = wp_parse_args( $args, $defaults ); + extract( $r, EXTR_SKIP ); + + if ( '' == $type ) + $type = 'monthly'; + + if ( '' != $limit ) { + $limit = absint($limit); + $limit = ' LIMIT '.$limit; + } + + // this is what will separate dates on weekly archive links + $archive_week_separator = '–'; + + // over-ride general date format ? 0 = no: use the date format set in Options, 1 = yes: over-ride + $archive_date_format_over_ride = 0; + + // options for daily archive (only if you over-ride the general date format) + $archive_day_date_format = 'Y/m/d'; + + // options for weekly archive (only if you over-ride the general date format) + $archive_week_start_date_format = 'Y/m/d'; + $archive_week_end_date_format = 'Y/m/d'; + + if ( !$archive_date_format_over_ride ) { + $archive_day_date_format = get_option('date_format'); + $archive_week_start_date_format = get_option('date_format'); + $archive_week_end_date_format = get_option('date_format'); + } + + //filters + $where = apply_filters( 'getarchives_where', "WHERE post_type = 'post' AND post_status = 'publish'", $r ); + $join = apply_filters( 'getarchives_join', '', $r ); + + $output = ''; + + if ( 'monthly' == $type ) { + $query = "SELECT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, count(ID) as posts FROM $wpdb->posts $join $where GROUP BY YEAR(post_date), MONTH(post_date) ORDER BY post_date DESC $limit"; + $key = md5($query); + $cache = wp_cache_get( 'wp_get_archives' , 'general'); + if ( !isset( $cache[ $key ] ) ) { + $arcresults = $wpdb->get_results($query); + $cache[ $key ] = $arcresults; + wp_cache_set( 'wp_get_archives', $cache, 'general' ); + } else { + $arcresults = $cache[ $key ]; + } + if ( $arcresults ) { + $afterafter = $after; + foreach ( (array) $arcresults as $arcresult ) { + $url = get_month_link( $arcresult->year, $arcresult->month ); + /* translators: 1: month name, 2: 4-digit year */ + $text = sprintf(__('%1$s %2$d'), $wp_locale->get_month($arcresult->month), $arcresult->year); + if ( $show_post_count ) + $after = ' ('.$arcresult->posts.')' . $afterafter; + $output .= get_archives_link($url, $text, $format, $before, $after); + } + } + } elseif ('yearly' == $type) { + $query = "SELECT YEAR(post_date) AS `year`, count(ID) as posts FROM $wpdb->posts $join $where GROUP BY YEAR(post_date) ORDER BY post_date DESC $limit"; + $key = md5($query); + $cache = wp_cache_get( 'wp_get_archives' , 'general'); + if ( !isset( $cache[ $key ] ) ) { + $arcresults = $wpdb->get_results($query); + $cache[ $key ] = $arcresults; + wp_cache_set( 'wp_get_archives', $cache, 'general' ); + } else { + $arcresults = $cache[ $key ]; + } + if ($arcresults) { + $afterafter = $after; + foreach ( (array) $arcresults as $arcresult) { + $url = get_year_link($arcresult->year); + $text = sprintf('%d', $arcresult->year); + if ($show_post_count) + $after = ' ('.$arcresult->posts.')' . $afterafter; + $output .= get_archives_link($url, $text, $format, $before, $after); + } + } + } elseif ( 'daily' == $type ) { + $query = "SELECT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, DAYOFMONTH(post_date) AS `dayofmonth`, count(ID) as posts FROM $wpdb->posts $join $where GROUP BY YEAR(post_date), MONTH(post_date), DAYOFMONTH(post_date) ORDER BY post_date DESC $limit"; + $key = md5($query); + $cache = wp_cache_get( 'wp_get_archives' , 'general'); + if ( !isset( $cache[ $key ] ) ) { + $arcresults = $wpdb->get_results($query); + $cache[ $key ] = $arcresults; + wp_cache_set( 'wp_get_archives', $cache, 'general' ); + } else { + $arcresults = $cache[ $key ]; + } + if ( $arcresults ) { + $afterafter = $after; + foreach ( (array) $arcresults as $arcresult ) { + $url = get_day_link($arcresult->year, $arcresult->month, $arcresult->dayofmonth); + $date = sprintf('%1$d-%2$02d-%3$02d 00:00:00', $arcresult->year, $arcresult->month, $arcresult->dayofmonth); + $text = mysql2date($archive_day_date_format, $date); + if ($show_post_count) + $after = ' ('.$arcresult->posts.')'.$afterafter; + $output .= get_archives_link($url, $text, $format, $before, $after); + } + } + } elseif ( 'weekly' == $type ) { + $week = _wp_mysql_week( '`post_date`' ); + $query = "SELECT DISTINCT $week AS `week`, YEAR( `post_date` ) AS `yr`, DATE_FORMAT( `post_date`, '%Y-%m-%d' ) AS `yyyymmdd`, count( `ID` ) AS `posts` FROM `$wpdb->posts` $join $where GROUP BY $week, YEAR( `post_date` ) ORDER BY `post_date` DESC $limit"; + $key = md5($query); + $cache = wp_cache_get( 'wp_get_archives' , 'general'); + if ( !isset( $cache[ $key ] ) ) { + $arcresults = $wpdb->get_results($query); + $cache[ $key ] = $arcresults; + wp_cache_set( 'wp_get_archives', $cache, 'general' ); + } else { + $arcresults = $cache[ $key ]; + } + $arc_w_last = ''; + $afterafter = $after; + if ( $arcresults ) { + foreach ( (array) $arcresults as $arcresult ) { + if ( $arcresult->week != $arc_w_last ) { + $arc_year = $arcresult->yr; + $arc_w_last = $arcresult->week; + $arc_week = get_weekstartend($arcresult->yyyymmdd, get_option('start_of_week')); + $arc_week_start = date_i18n($archive_week_start_date_format, $arc_week['start']); + $arc_week_end = date_i18n($archive_week_end_date_format, $arc_week['end']); + $url = sprintf('%1$s/%2$s%3$sm%4$s%5$s%6$sw%7$s%8$d', home_url(), '', '?', '=', $arc_year, '&', '=', $arcresult->week); + $text = $arc_week_start . $archive_week_separator . $arc_week_end; + if ($show_post_count) + $after = ' ('.$arcresult->posts.')'.$afterafter; + $output .= get_archives_link($url, $text, $format, $before, $after); + } + } + } + } elseif ( ( 'postbypost' == $type ) || ('alpha' == $type) ) { + $orderby = ('alpha' == $type) ? 'post_title ASC ' : 'post_date DESC '; + $query = "SELECT * FROM $wpdb->posts $join $where ORDER BY $orderby $limit"; + $key = md5($query); + $cache = wp_cache_get( 'wp_get_archives' , 'general'); + if ( !isset( $cache[ $key ] ) ) { + $arcresults = $wpdb->get_results($query); + $cache[ $key ] = $arcresults; + wp_cache_set( 'wp_get_archives', $cache, 'general' ); + } else { + $arcresults = $cache[ $key ]; + } + if ( $arcresults ) { + foreach ( (array) $arcresults as $arcresult ) { + if ( $arcresult->post_date != '0000-00-00 00:00:00' ) { + $url = get_permalink($arcresult); + $arc_title = $arcresult->post_title; + if ( $arc_title ) + $text = strip_tags(apply_filters('the_title', $arc_title)); + else + $text = $arcresult->ID; + $output .= get_archives_link($url, $text, $format, $before, $after); + } + } + } + } + if ( $echo ) + echo $output; + else + return $output; +} + +/** + * Get number of days since the start of the week. + * + * @since 1.5.0 + * @usedby get_calendar() + * + * @param int $num Number of day. + * @return int Days since the start of the week. + */ +function calendar_week_mod($num) { + $base = 7; + return ($num - $base*floor($num/$base)); +} + +/** + * Display calendar with days that have posts as links. + * + * The calendar is cached, which will be retrieved, if it exists. If there are + * no posts for the month, then it will not be displayed. + * + * @since 1.0.0 + * + * @param bool $initial Optional, default is true. Use initial calendar names. + * @param bool $echo Optional, default is true. Set to false for return. + */ +function get_calendar($initial = true, $echo = true) { + global $wpdb, $m, $monthnum, $year, $wp_locale, $posts; + + $cache = array(); + $key = md5( $m . $monthnum . $year ); + if ( $cache = wp_cache_get( 'get_calendar', 'calendar' ) ) { + if ( is_array($cache) && isset( $cache[ $key ] ) ) { + if ( $echo ) { + echo apply_filters( 'get_calendar', $cache[$key] ); + return; + } else { + return apply_filters( 'get_calendar', $cache[$key] ); + } + } + } + + if ( !is_array($cache) ) + $cache = array(); + + // Quick check. If we have no posts at all, abort! + if ( !$posts ) { + $gotsome = $wpdb->get_var("SELECT 1 as test FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish' LIMIT 1"); + if ( !$gotsome ) { + $cache[ $key ] = ''; + wp_cache_set( 'get_calendar', $cache, 'calendar' ); + return; + } + } + + if ( isset($_GET['w']) ) + $w = ''.intval($_GET['w']); + + // week_begins = 0 stands for Sunday + $week_begins = intval(get_option('start_of_week')); + + // Let's figure out when we are + if ( !empty($monthnum) && !empty($year) ) { + $thismonth = ''.zeroise(intval($monthnum), 2); + $thisyear = ''.intval($year); + } elseif ( !empty($w) ) { + // We need to get the month from MySQL + $thisyear = ''.intval(substr($m, 0, 4)); + $d = (($w - 1) * 7) + 6; //it seems MySQL's weeks disagree with PHP's + $thismonth = $wpdb->get_var("SELECT DATE_FORMAT((DATE_ADD('{$thisyear}0101', INTERVAL $d DAY) ), '%m')"); + } elseif ( !empty($m) ) { + $thisyear = ''.intval(substr($m, 0, 4)); + if ( strlen($m) < 6 ) + $thismonth = '01'; + else + $thismonth = ''.zeroise(intval(substr($m, 4, 2)), 2); + } else { + $thisyear = gmdate('Y', current_time('timestamp')); + $thismonth = gmdate('m', current_time('timestamp')); + } + + $unixmonth = mktime(0, 0 , 0, $thismonth, 1, $thisyear); + $last_day = date('t', $unixmonth); + + // Get the next and previous month and year with at least one post + $previous = $wpdb->get_row("SELECT MONTH(post_date) AS month, YEAR(post_date) AS year + FROM $wpdb->posts + WHERE post_date < '$thisyear-$thismonth-01' + AND post_type = 'post' AND post_status = 'publish' + ORDER BY post_date DESC + LIMIT 1"); + $next = $wpdb->get_row("SELECT MONTH(post_date) AS month, YEAR(post_date) AS year + FROM $wpdb->posts + WHERE post_date > '$thisyear-$thismonth-{$last_day} 23:59:59' + AND post_type = 'post' AND post_status = 'publish' + ORDER BY post_date ASC + LIMIT 1"); + + /* translators: Calendar caption: 1: month name, 2: 4-digit year */ + $calendar_caption = _x('%1$s %2$s', 'calendar caption'); + $calendar_output = ' + + + '; + + $myweek = array(); + + for ( $wdcount=0; $wdcount<=6; $wdcount++ ) { + $myweek[] = $wp_locale->get_weekday(($wdcount+$week_begins)%7); + } + + foreach ( $myweek as $wd ) { + $day_name = (true == $initial) ? $wp_locale->get_weekday_initial($wd) : $wp_locale->get_weekday_abbrev($wd); + $wd = esc_attr($wd); + $calendar_output .= "\n\t\t"; + } + + $calendar_output .= ' + + + + + '; + + if ( $previous ) { + $calendar_output .= "\n\t\t".''; + } else { + $calendar_output .= "\n\t\t".''; + } + + $calendar_output .= "\n\t\t".''; + + if ( $next ) { + $calendar_output .= "\n\t\t".''; + } else { + $calendar_output .= "\n\t\t".''; + } + + $calendar_output .= ' + + + + + '; + + // Get days with posts + $dayswithposts = $wpdb->get_results("SELECT DISTINCT DAYOFMONTH(post_date) + FROM $wpdb->posts WHERE post_date >= '{$thisyear}-{$thismonth}-01 00:00:00' + AND post_type = 'post' AND post_status = 'publish' + AND post_date <= '{$thisyear}-{$thismonth}-{$last_day} 23:59:59'", ARRAY_N); + if ( $dayswithposts ) { + foreach ( (array) $dayswithposts as $daywith ) { + $daywithpost[] = $daywith[0]; + } + } else { + $daywithpost = array(); + } + + if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false || stripos($_SERVER['HTTP_USER_AGENT'], 'camino') !== false || stripos($_SERVER['HTTP_USER_AGENT'], 'safari') !== false) + $ak_title_separator = "\n"; + else + $ak_title_separator = ', '; + + $ak_titles_for_day = array(); + $ak_post_titles = $wpdb->get_results("SELECT ID, post_title, DAYOFMONTH(post_date) as dom " + ."FROM $wpdb->posts " + ."WHERE post_date >= '{$thisyear}-{$thismonth}-01 00:00:00' " + ."AND post_date <= '{$thisyear}-{$thismonth}-{$last_day} 23:59:59' " + ."AND post_type = 'post' AND post_status = 'publish'" + ); + if ( $ak_post_titles ) { + foreach ( (array) $ak_post_titles as $ak_post_title ) { + + $post_title = esc_attr( apply_filters( 'the_title', $ak_post_title->post_title, $ak_post_title->ID ) ); + + if ( empty($ak_titles_for_day['day_'.$ak_post_title->dom]) ) + $ak_titles_for_day['day_'.$ak_post_title->dom] = ''; + if ( empty($ak_titles_for_day["$ak_post_title->dom"]) ) // first one + $ak_titles_for_day["$ak_post_title->dom"] = $post_title; + else + $ak_titles_for_day["$ak_post_title->dom"] .= $ak_title_separator . $post_title; + } + } + + + // See how much we should pad in the beginning + $pad = calendar_week_mod(date('w', $unixmonth)-$week_begins); + if ( 0 != $pad ) + $calendar_output .= "\n\t\t".''; + + $daysinmonth = intval(date('t', $unixmonth)); + for ( $day = 1; $day <= $daysinmonth; ++$day ) { + if ( isset($newrow) && $newrow ) + $calendar_output .= "\n\t\n\t\n\t\t"; + $newrow = false; + + if ( $day == gmdate('j', current_time('timestamp')) && $thismonth == gmdate('m', current_time('timestamp')) && $thisyear == gmdate('Y', current_time('timestamp')) ) + $calendar_output .= ''; + + if ( 6 == calendar_week_mod(date('w', mktime(0, 0 , 0, $thismonth, $day, $thisyear))-$week_begins) ) + $newrow = true; + } + + $pad = 7 - calendar_week_mod(date('w', mktime(0, 0 , 0, $thismonth, $day, $thisyear))-$week_begins); + if ( $pad != 0 && $pad != 7 ) + $calendar_output .= "\n\t\t".''; + + $calendar_output .= "\n\t\n\t\n\t
            ' . sprintf($calendar_caption, $wp_locale->get_month($thismonth), date('Y', $unixmonth)) . '
            $day_name
            « ' . $wp_locale->get_month_abbrev($wp_locale->get_month($previous->month)) . '  ' . $wp_locale->get_month_abbrev($wp_locale->get_month($next->month)) . ' » 
             
            '; + else + $calendar_output .= ''; + + if ( in_array($day, $daywithpost) ) // any posts today? + $calendar_output .= '$day"; + else + $calendar_output .= $day; + $calendar_output .= ' 
            "; + + $cache[ $key ] = $calendar_output; + wp_cache_set( 'get_calendar', $cache, 'calendar' ); + + if ( $echo ) + echo apply_filters( 'get_calendar', $calendar_output ); + else + return apply_filters( 'get_calendar', $calendar_output ); + +} + +/** + * Purge the cached results of get_calendar. + * + * @see get_calendar + * @since 2.1.0 + */ +function delete_get_calendar_cache() { + wp_cache_delete( 'get_calendar', 'calendar' ); +} +add_action( 'save_post', 'delete_get_calendar_cache' ); +add_action( 'delete_post', 'delete_get_calendar_cache' ); +add_action( 'update_option_start_of_week', 'delete_get_calendar_cache' ); +add_action( 'update_option_gmt_offset', 'delete_get_calendar_cache' ); + +/** + * Display all of the allowed tags in HTML format with attributes. + * + * This is useful for displaying in the comment area, which elements and + * attributes are supported. As well as any plugins which want to display it. + * + * @since 1.0.1 + * @uses $allowedtags + * + * @return string HTML allowed tags entity encoded. + */ +function allowed_tags() { + global $allowedtags; + $allowed = ''; + foreach ( (array) $allowedtags as $tag => $attributes ) { + $allowed .= '<'.$tag; + if ( 0 < count($attributes) ) { + foreach ( $attributes as $attribute => $limits ) { + $allowed .= ' '.$attribute.'=""'; + } + } + $allowed .= '> '; + } + return htmlentities($allowed); +} + +/***** Date/Time tags *****/ + +/** + * Outputs the date in iso8601 format for xml files. + * + * @since 1.0.0 + */ +function the_date_xml() { + global $post; + echo mysql2date('Y-m-d', $post->post_date, false); +} + +/** + * Display or Retrieve the date the current $post was written (once per date) + * + * Will only output the date if the current post's date is different from the + * previous one output. + * + * i.e. Only one date listing will show per day worth of posts shown in the loop, even if the + * function is called several times for each post. + * + * HTML output can be filtered with 'the_date'. + * Date string output can be filtered with 'get_the_date'. + * + * @since 0.71 + * @uses get_the_date() + * @param string $d Optional. PHP date format defaults to the date_format option if not specified. + * @param string $before Optional. Output before the date. + * @param string $after Optional. Output after the date. + * @param bool $echo Optional, default is display. Whether to echo the date or return it. + * @return string|null Null if displaying, string if retrieving. + */ +function the_date( $d = '', $before = '', $after = '', $echo = true ) { + global $currentday, $previousday; + $the_date = ''; + if ( $currentday != $previousday ) { + $the_date .= $before; + $the_date .= get_the_date( $d ); + $the_date .= $after; + $previousday = $currentday; + + $the_date = apply_filters('the_date', $the_date, $d, $before, $after); + + if ( $echo ) + echo $the_date; + else + return $the_date; + } + + return null; +} + +/** + * Retrieve the date the current $post was written. + * + * Unlike the_date() this function will always return the date. + * Modify output with 'get_the_date' filter. + * + * @since 3.0.0 + * + * @param string $d Optional. PHP date format defaults to the date_format option if not specified. + * @return string|null Null if displaying, string if retrieving. + */ +function get_the_date( $d = '' ) { + global $post; + $the_date = ''; + + if ( '' == $d ) + $the_date .= mysql2date(get_option('date_format'), $post->post_date); + else + $the_date .= mysql2date($d, $post->post_date); + + return apply_filters('get_the_date', $the_date, $d); +} + +/** + * Display the date on which the post was last modified. + * + * @since 2.1.0 + * + * @param string $d Optional. PHP date format defaults to the date_format option if not specified. + * @param string $before Optional. Output before the date. + * @param string $after Optional. Output after the date. + * @param bool $echo Optional, default is display. Whether to echo the date or return it. + * @return string|null Null if displaying, string if retrieving. + */ +function the_modified_date($d = '', $before='', $after='', $echo = true) { + + $the_modified_date = $before . get_the_modified_date($d) . $after; + $the_modified_date = apply_filters('the_modified_date', $the_modified_date, $d, $before, $after); + + if ( $echo ) + echo $the_modified_date; + else + return $the_modified_date; + +} + +/** + * Retrieve the date on which the post was last modified. + * + * @since 2.1.0 + * + * @param string $d Optional. PHP date format. Defaults to the "date_format" option + * @return string + */ +function get_the_modified_date($d = '') { + if ( '' == $d ) + $the_time = get_post_modified_time(get_option('date_format'), null, null, true); + else + $the_time = get_post_modified_time($d, null, null, true); + return apply_filters('get_the_modified_date', $the_time, $d); +} + +/** + * Display the time at which the post was written. + * + * @since 0.71 + * + * @param string $d Either 'G', 'U', or php date format. + */ +function the_time( $d = '' ) { + echo apply_filters('the_time', get_the_time( $d ), $d); +} + +/** + * Retrieve the time at which the post was written. + * + * @since 1.5.0 + * + * @param string $d Optional Either 'G', 'U', or php date format defaults to the value specified in the time_format option. + * @param int|object $post Optional post ID or object. Default is global $post object. + * @return string + */ +function get_the_time( $d = '', $post = null ) { + $post = get_post($post); + + if ( '' == $d ) + $the_time = get_post_time(get_option('time_format'), false, $post, true); + else + $the_time = get_post_time($d, false, $post, true); + return apply_filters('get_the_time', $the_time, $d, $post); +} + +/** + * Retrieve the time at which the post was written. + * + * @since 2.0.0 + * + * @param string $d Optional Either 'G', 'U', or php date format. + * @param bool $gmt Optional, default is false. Whether to return the gmt time. + * @param int|object $post Optional post ID or object. Default is global $post object. + * @param bool $translate Whether to translate the time string + * @return string + */ +function get_post_time( $d = 'U', $gmt = false, $post = null, $translate = false ) { // returns timestamp + $post = get_post($post); + + if ( $gmt ) + $time = $post->post_date_gmt; + else + $time = $post->post_date; + + $time = mysql2date($d, $time, $translate); + return apply_filters('get_post_time', $time, $d, $gmt); +} + +/** + * Display the time at which the post was last modified. + * + * @since 2.0.0 + * + * @param string $d Optional Either 'G', 'U', or php date format defaults to the value specified in the time_format option. + */ +function the_modified_time($d = '') { + echo apply_filters('the_modified_time', get_the_modified_time($d), $d); +} + +/** + * Retrieve the time at which the post was last modified. + * + * @since 2.0.0 + * + * @param string $d Optional Either 'G', 'U', or php date format defaults to the value specified in the time_format option. + * @return string + */ +function get_the_modified_time($d = '') { + if ( '' == $d ) + $the_time = get_post_modified_time(get_option('time_format'), null, null, true); + else + $the_time = get_post_modified_time($d, null, null, true); + return apply_filters('get_the_modified_time', $the_time, $d); +} + +/** + * Retrieve the time at which the post was last modified. + * + * @since 2.0.0 + * + * @param string $d Optional, default is 'U'. Either 'G', 'U', or php date format. + * @param bool $gmt Optional, default is false. Whether to return the gmt time. + * @param int|object $post Optional, default is global post object. A post_id or post object + * @param bool $translate Optional, default is false. Whether to translate the result + * @return string Returns timestamp + */ +function get_post_modified_time( $d = 'U', $gmt = false, $post = null, $translate = false ) { + $post = get_post($post); + + if ( $gmt ) + $time = $post->post_modified_gmt; + else + $time = $post->post_modified; + $time = mysql2date($d, $time, $translate); + + return apply_filters('get_post_modified_time', $time, $d, $gmt); +} + +/** + * Display the weekday on which the post was written. + * + * @since 0.71 + * @uses $wp_locale + * @uses $post + */ +function the_weekday() { + global $wp_locale, $post; + $the_weekday = $wp_locale->get_weekday(mysql2date('w', $post->post_date, false)); + $the_weekday = apply_filters('the_weekday', $the_weekday); + echo $the_weekday; +} + +/** + * Display the weekday on which the post was written. + * + * Will only output the weekday if the current post's weekday is different from + * the previous one output. + * + * @since 0.71 + * + * @param string $before Optional Output before the date. + * @param string $after Optional Output after the date. + */ +function the_weekday_date($before='',$after='') { + global $wp_locale, $post, $day, $previousweekday; + $the_weekday_date = ''; + if ( $currentday != $previousweekday ) { + $the_weekday_date .= $before; + $the_weekday_date .= $wp_locale->get_weekday(mysql2date('w', $post->post_date, false)); + $the_weekday_date .= $after; + $previousweekday = $currentday; + } + $the_weekday_date = apply_filters('the_weekday_date', $the_weekday_date, $before, $after); + echo $the_weekday_date; +} + +/** + * Fire the wp_head action + * + * @since 1.2.0 + * @uses do_action() Calls 'wp_head' hook. + */ +function wp_head() { + do_action('wp_head'); +} + +/** + * Fire the wp_footer action + * + * @since 1.5.1 + * @uses do_action() Calls 'wp_footer' hook. + */ +function wp_footer() { + do_action('wp_footer'); +} + +/** + * Display the links to the general feeds. + * + * @since 2.8.0 + * + * @param array $args Optional arguments. + */ +function feed_links( $args = array() ) { + if ( !current_theme_supports('automatic-feed-links') ) + return; + + $defaults = array( + /* translators: Separator between blog name and feed type in feed links */ + 'separator' => _x('»', 'feed link'), + /* translators: 1: blog title, 2: separator (raquo) */ + 'feedtitle' => __('%1$s %2$s Feed'), + /* translators: %s: blog title, 2: separator (raquo) */ + 'comstitle' => __('%1$s %2$s Comments Feed'), + ); + + $args = wp_parse_args( $args, $defaults ); + + echo '\n"; + echo '\n"; +} + +/** + * Display the links to the extra feeds such as category feeds. + * + * @since 2.8.0 + * + * @param array $args Optional arguments. + */ +function feed_links_extra( $args = array() ) { + $defaults = array( + /* translators: Separator between blog name and feed type in feed links */ + 'separator' => _x('»', 'feed link'), + /* translators: 1: blog name, 2: separator(raquo), 3: post title */ + 'singletitle' => __('%1$s %2$s %3$s Comments Feed'), + /* translators: 1: blog name, 2: separator(raquo), 3: category name */ + 'cattitle' => __('%1$s %2$s %3$s Category Feed'), + /* translators: 1: blog name, 2: separator(raquo), 3: tag name */ + 'tagtitle' => __('%1$s %2$s %3$s Tag Feed'), + /* translators: 1: blog name, 2: separator(raquo), 3: author name */ + 'authortitle' => __('%1$s %2$s Posts by %3$s Feed'), + /* translators: 1: blog name, 2: separator(raquo), 3: search phrase */ + 'searchtitle' => __('%1$s %2$s Search Results for “%3$s” Feed'), + ); + + $args = wp_parse_args( $args, $defaults ); + + if ( is_single() || is_page() ) { + $post = &get_post( $id = 0 ); + + if ( comments_open() || pings_open() || $post->comment_count > 0 ) { + $title = esc_attr(sprintf( $args['singletitle'], get_bloginfo('name'), $args['separator'], esc_html( get_the_title() ) )); + $href = get_post_comments_feed_link( $post->ID ); + } + } elseif ( is_category() ) { + $term = get_queried_object(); + + $title = esc_attr(sprintf( $args['cattitle'], get_bloginfo('name'), $args['separator'], $term->name )); + $href = get_category_feed_link( $term->term_id ); + } elseif ( is_tag() ) { + $term = get_queried_object(); + + $title = esc_attr(sprintf( $args['tagtitle'], get_bloginfo('name'), $args['separator'], $term->name )); + $href = get_tag_feed_link( $term->term_id ); + } elseif ( is_author() ) { + $author_id = intval( get_query_var('author') ); + + $title = esc_attr(sprintf( $args['authortitle'], get_bloginfo('name'), $args['separator'], get_the_author_meta( 'display_name', $author_id ) )); + $href = get_author_feed_link( $author_id ); + } elseif ( is_search() ) { + $title = esc_attr(sprintf( $args['searchtitle'], get_bloginfo('name'), $args['separator'], get_search_query( false ) )); + $href = get_search_feed_link(); + } + + if ( isset($title) && isset($href) ) + echo '' . "\n"; +} + +/** + * Display the link to the Really Simple Discovery service endpoint. + * + * @link http://archipelago.phrasewise.com/rsd + * @since 2.0.0 + */ +function rsd_link() { + echo '\n"; +} + +/** + * Display the link to the Windows Live Writer manifest file. + * + * @link http://msdn.microsoft.com/en-us/library/bb463265.aspx + * @since 2.3.1 + */ +function wlwmanifest_link() { + echo ' ' . "\n"; +} + +/** + * Display a noindex meta tag if required by the blog configuration. + * + * If a blog is marked as not being public then the noindex meta tag will be + * output to tell web robots not to index the page content. + * + * @since 2.1.0 + */ +function noindex() { + // If the blog is not public, tell robots to go away. + if ( '0' == get_option('blog_public') ) + echo "\n"; +} + +/** + * Determine if TinyMCE is available. + * + * Checks to see if the user has deleted the tinymce files to slim down there WordPress install. + * + * @since 2.1.0 + * + * @return bool Whether TinyMCE exists. + */ +function rich_edit_exists() { + global $wp_rich_edit_exists; + if ( !isset($wp_rich_edit_exists) ) + $wp_rich_edit_exists = file_exists(ABSPATH . WPINC . '/js/tinymce/tiny_mce.js'); + return $wp_rich_edit_exists; +} + +/** + * Whether the user should have a WYSIWIG editor. + * + * Checks that the user requires a WYSIWIG editor and that the editor is + * supported in the users browser. + * + * @since 2.0.0 + * + * @return bool + */ +function user_can_richedit() { + global $wp_rich_edit, $pagenow, $is_iphone; + + if ( !isset( $wp_rich_edit) ) { + if ( get_user_option( 'rich_editing' ) == 'true' && + !$is_iphone && // this includes all Safari mobile browsers + ( ( preg_match( '!AppleWebKit/(\d+)!', $_SERVER['HTTP_USER_AGENT'], $match ) && intval($match[1]) >= 420 ) || + !preg_match( '!opera[ /][2-8]|konqueror|safari!i', $_SERVER['HTTP_USER_AGENT'] ) ) + && 'comment.php' != $pagenow ) { + $wp_rich_edit = true; + } else { + $wp_rich_edit = false; + } + } + + return apply_filters('user_can_richedit', $wp_rich_edit); +} + +/** + * Find out which editor should be displayed by default. + * + * Works out which of the two editors to display as the current editor for a + * user. + * + * @since 2.5.0 + * + * @return string Either 'tinymce', or 'html', or 'test' + */ +function wp_default_editor() { + $r = user_can_richedit() ? 'tinymce' : 'html'; // defaults + if ( $user = wp_get_current_user() ) { // look for cookie + $ed = get_user_setting('editor', 'tinymce'); + $r = ( in_array($ed, array('tinymce', 'html', 'test') ) ) ? $ed : $r; + } + return apply_filters( 'wp_default_editor', $r ); // filter +} + +/** + * Display visual editor forms: TinyMCE, or HTML, or both. + * + * The amount of rows the text area will have for the content has to be between + * 3 and 100 or will default at 12. There is only one option used for all users, + * named 'default_post_edit_rows'. + * + * If the user can not use the rich editor (TinyMCE), then the switch button + * will not be displayed. + * + * @since 2.1.0 + * + * @param string $content Textarea content. + * @param string $id Optional, default is 'content'. HTML ID attribute value. + * @param string $prev_id Optional, default is 'title'. HTML ID name for switching back and forth between visual editors. + * @param bool $media_buttons Optional, default is true. Whether to display media buttons. + * @param int $tab_index Optional, default is 2. Tabindex for textarea element. + */ +function the_editor($content, $id = 'content', $prev_id = 'title', $media_buttons = true, $tab_index = 2, $extended = true) { + $rows = get_option('default_post_edit_rows'); + if (($rows < 3) || ($rows > 100)) + $rows = 12; + + if ( !current_user_can( 'upload_files' ) ) + $media_buttons = false; + + $richedit = user_can_richedit(); + $class = ''; + + if ( $richedit || $media_buttons ) { ?> +
            + +
            + + + + + + + +
            + +
            + +
            + +
            + +
            + +\n"); + $the_editor_content = apply_filters('the_editor_content', $content); + + printf($the_editor, $the_editor_content); + +?> + + '%_%', // http://example.com/all_posts.php%_% : %_% is replaced by format (below) + 'format' => '?page=%#%', // ?page=%#% : %#% is replaced by the page number + 'total' => 1, + 'current' => 0, + 'show_all' => false, + 'prev_next' => true, + 'prev_text' => __('« Previous'), + 'next_text' => __('Next »'), + 'end_size' => 1, + 'mid_size' => 2, + 'type' => 'plain', + 'add_args' => false, // array of query args to add + 'add_fragment' => '' + ); + + $args = wp_parse_args( $args, $defaults ); + extract($args, EXTR_SKIP); + + // Who knows what else people pass in $args + $total = (int) $total; + if ( $total < 2 ) + return; + $current = (int) $current; + $end_size = 0 < (int) $end_size ? (int) $end_size : 1; // Out of bounds? Make it the default. + $mid_size = 0 <= (int) $mid_size ? (int) $mid_size : 2; + $add_args = is_array($add_args) ? $add_args : false; + $r = ''; + $page_links = array(); + $n = 0; + $dots = false; + + if ( $prev_next && $current && 1 < $current ) : + $link = str_replace('%_%', 2 == $current ? '' : $format, $base); + $link = str_replace('%#%', $current - 1, $link); + if ( $add_args ) + $link = add_query_arg( $add_args, $link ); + $link .= $add_fragment; + $page_links[] = ''; + endif; + for ( $n = 1; $n <= $total; $n++ ) : + $n_display = number_format_i18n($n); + if ( $n == $current ) : + $page_links[] = "$n_display"; + $dots = true; + else : + if ( $show_all || ( $n <= $end_size || ( $current && $n >= $current - $mid_size && $n <= $current + $mid_size ) || $n > $total - $end_size ) ) : + $link = str_replace('%_%', 1 == $n ? '' : $format, $base); + $link = str_replace('%#%', $n, $link); + if ( $add_args ) + $link = add_query_arg( $add_args, $link ); + $link .= $add_fragment; + $page_links[] = "$n_display"; + $dots = true; + elseif ( $dots && !$show_all ) : + $page_links[] = '...'; + $dots = false; + endif; + endif; + endfor; + if ( $prev_next && $current && ( $current < $total || -1 == $total ) ) : + $link = str_replace('%_%', $format, $base); + $link = str_replace('%#%', $current + 1, $link); + if ( $add_args ) + $link = add_query_arg( $add_args, $link ); + $link .= $add_fragment; + $page_links[] = ''; + endif; + switch ( $type ) : + case 'array' : + return $page_links; + break; + case 'list' : + $r .= "
              \n\t
            • "; + $r .= join("
            • \n\t
            • ", $page_links); + $r .= "
            • \n
            \n"; + break; + default : + $r = join("\n", $page_links); + break; + endswitch; + return $r; +} + +/** + * Registers an admin colour scheme css file. + * + * Allows a plugin to register a new admin colour scheme. For example: + * + * wp_admin_css_color('classic', __('Classic'), admin_url("css/colors-classic.css"), + * array('#07273E', '#14568A', '#D54E21', '#2683AE')); + * + * + * @since 2.5.0 + * + * @param string $key The unique key for this theme. + * @param string $name The name of the theme. + * @param string $url The url of the css file containing the colour scheme. + * @param array $colors Optional An array of CSS color definitions which are used to give the user a feel for the theme. + */ +function wp_admin_css_color($key, $name, $url, $colors = array()) { + global $_wp_admin_css_colors; + + if ( !isset($_wp_admin_css_colors) ) + $_wp_admin_css_colors = array(); + + $_wp_admin_css_colors[$key] = (object) array('name' => $name, 'url' => $url, 'colors' => $colors); +} + +/** + * Registers the default Admin color schemes + * + * @since 3.0.0 + */ +function register_admin_color_schemes() { + wp_admin_css_color( 'classic', __( 'Blue' ), admin_url( 'css/colors-classic.css' ), + array( '#5589aa', '#cfdfe9', '#d1e5ee', '#eff8ff' ) ); + wp_admin_css_color( 'fresh', __( 'Gray' ), admin_url( 'css/colors-fresh.css' ), + array( '#7c7976', '#c6c6c6', '#e0e0e0', '#f1f1f1' ) ); +} + +/** + * Display the URL of a WordPress admin CSS file. + * + * @see WP_Styles::_css_href and its style_loader_src filter. + * + * @since 2.3.0 + * + * @param string $file file relative to wp-admin/ without its ".css" extension. + */ +function wp_admin_css_uri( $file = 'wp-admin' ) { + if ( defined('WP_INSTALLING') ) { + $_file = "./$file.css"; + } else { + $_file = admin_url("$file.css"); + } + $_file = add_query_arg( 'version', get_bloginfo( 'version' ), $_file ); + + return apply_filters( 'wp_admin_css_uri', $_file, $file ); +} + +/** + * Enqueues or directly prints a stylesheet link to the specified CSS file. + * + * "Intelligently" decides to enqueue or to print the CSS file. If the + * 'wp_print_styles' action has *not* yet been called, the CSS file will be + * enqueued. If the wp_print_styles action *has* been called, the CSS link will + * be printed. Printing may be forced by passing TRUE as the $force_echo + * (second) parameter. + * + * For backward compatibility with WordPress 2.3 calling method: If the $file + * (first) parameter does not correspond to a registered CSS file, we assume + * $file is a file relative to wp-admin/ without its ".css" extension. A + * stylesheet link to that generated URL is printed. + * + * @package WordPress + * @since 2.3.0 + * @uses $wp_styles WordPress Styles Object + * + * @param string $file Optional. Style handle name or file name (without ".css" extension) relative + * to wp-admin/. Defaults to 'wp-admin'. + * @param bool $force_echo Optional. Force the stylesheet link to be printed rather than enqueued. + */ +function wp_admin_css( $file = 'wp-admin', $force_echo = false ) { + global $wp_styles; + if ( !is_a($wp_styles, 'WP_Styles') ) + $wp_styles = new WP_Styles(); + + // For backward compatibility + $handle = 0 === strpos( $file, 'css/' ) ? substr( $file, 4 ) : $file; + + if ( $wp_styles->query( $handle ) ) { + if ( $force_echo || did_action( 'wp_print_styles' ) ) // we already printed the style queue. Print this one immediately + wp_print_styles( $handle ); + else // Add to style queue + wp_enqueue_style( $handle ); + return; + } + + echo apply_filters( 'wp_admin_css', "\n", $file ); + if ( is_rtl() ) + echo apply_filters( 'wp_admin_css', "\n", "$file-rtl" ); +} + +/** + * Enqueues the default ThickBox js and css. + * + * If any of the settings need to be changed, this can be done with another js + * file similar to media-upload.js and theme-preview.js. That file should + * require array('thickbox') to ensure it is loaded after. + * + * @since 2.5.0 + */ +function add_thickbox() { + wp_enqueue_script( 'thickbox' ); + wp_enqueue_style( 'thickbox' ); + + if ( is_network_admin() ) + add_action( 'admin_head', '_thickbox_path_admin_subfolder' ); +} + +/** + * Display the XHTML generator that is generated on the wp_head hook. + * + * @since 2.5.0 + */ +function wp_generator() { + the_generator( apply_filters( 'wp_generator_type', 'xhtml' ) ); +} + +/** + * Display the generator XML or Comment for RSS, ATOM, etc. + * + * Returns the correct generator type for the requested output format. Allows + * for a plugin to filter generators overall the the_generator filter. + * + * @since 2.5.0 + * @uses apply_filters() Calls 'the_generator' hook. + * + * @param string $type The type of generator to output - (html|xhtml|atom|rss2|rdf|comment|export). + */ +function the_generator( $type ) { + echo apply_filters('the_generator', get_the_generator($type), $type) . "\n"; +} + +/** + * Creates the generator XML or Comment for RSS, ATOM, etc. + * + * Returns the correct generator type for the requested output format. Allows + * for a plugin to filter generators on an individual basis using the + * 'get_the_generator_{$type}' filter. + * + * @since 2.5.0 + * @uses apply_filters() Calls 'get_the_generator_$type' hook. + * + * @param string $type The type of generator to return - (html|xhtml|atom|rss2|rdf|comment|export). + * @return string The HTML content for the generator. + */ +function get_the_generator( $type = '' ) { + if ( empty( $type ) ) { + + $current_filter = current_filter(); + if ( empty( $current_filter ) ) + return; + + switch ( $current_filter ) { + case 'rss2_head' : + case 'commentsrss2_head' : + $type = 'rss2'; + break; + case 'rss_head' : + case 'opml_head' : + $type = 'comment'; + break; + case 'rdf_header' : + $type = 'rdf'; + break; + case 'atom_head' : + case 'comments_atom_head' : + case 'app_head' : + $type = 'atom'; + break; + } + } + + switch ( $type ) { + case 'html': + $gen = ''; + break; + case 'xhtml': + $gen = ''; + break; + case 'atom': + $gen = 'WordPress'; + break; + case 'rss2': + $gen = 'http://wordpress.org/?v=' . get_bloginfo_rss( 'version' ) . ''; + break; + case 'rdf': + $gen = ''; + break; + case 'comment': + $gen = ''; + break; + case 'export': + $gen = ''; + break; + } + return apply_filters( "get_the_generator_{$type}", $gen, $type ); +} + +/** + * Outputs the html checked attribute. + * + * Compares the first two arguments and if identical marks as checked + * + * @since 1.0.0 + * + * @param mixed $checked One of the values to compare + * @param mixed $current (true) The other value to compare if not just true + * @param bool $echo Whether to echo or just return the string + * @return string html attribute or empty string + */ +function checked( $checked, $current = true, $echo = true ) { + return __checked_selected_helper( $checked, $current, $echo, 'checked' ); +} + +/** + * Outputs the html selected attribute. + * + * Compares the first two arguments and if identical marks as selected + * + * @since 1.0.0 + * + * @param mixed $selected One of the values to compare + * @param mixed $current (true) The other value to compare if not just true + * @param bool $echo Whether to echo or just return the string + * @return string html attribute or empty string + */ +function selected( $selected, $current = true, $echo = true ) { + return __checked_selected_helper( $selected, $current, $echo, 'selected' ); +} + +/** + * Outputs the html disabled attribute. + * + * Compares the first two arguments and if identical marks as disabled + * + * @since 3.0.0 + * + * @param mixed $disabled One of the values to compare + * @param mixed $current (true) The other value to compare if not just true + * @param bool $echo Whether to echo or just return the string + * @return string html attribute or empty string + */ +function disabled( $disabled, $current = true, $echo = true ) { + return __checked_selected_helper( $disabled, $current, $echo, 'disabled' ); +} + +/** + * Private helper function for checked, selected, and disabled. + * + * Compares the first two arguments and if identical marks as $type + * + * @since 2.8.0 + * @access private + * + * @param any $helper One of the values to compare + * @param any $current (true) The other value to compare if not just true + * @param bool $echo Whether to echo or just return the string + * @param string $type The type of checked|selected|disabled we are doing + * @return string html attribute or empty string + */ +function __checked_selected_helper( $helper, $current, $echo, $type ) { + if ( (string) $helper === (string) $current ) + $result = " $type='$type'"; + else + $result = ''; + + if ( $echo ) + echo $result; + + return $result; +} + +?> diff --git a/src/wp-includes/http.php b/src/wp-includes/http.php new file mode 100644 index 0000000..a909e00 --- /dev/null +++ b/src/wp-includes/http.php @@ -0,0 +1,224 @@ + + * $res = array( 'headers' => array(), 'response' => array('code' => int, 'message' => string) ); + * + * + * All of the headers in $res['headers'] are with the name as the key and the + * value as the value. So to get the User-Agent, you would do the following. + * + * + * $user_agent = $res['headers']['user-agent']; + * + * + * The body is the raw response content and can be retrieved from $res['body']. + * + * This function is called first to make the request and there are other API + * functions to abstract out the above convoluted setup. + * + * @since 2.7.0 + * + * @param string $url Site URL to retrieve. + * @param array $args Optional. Override the defaults. + * @return WP_Error|array The response or WP_Error on failure. + */ +function wp_remote_request($url, $args = array()) { + $objFetchSite = _wp_http_get_object(); + return $objFetchSite->request($url, $args); +} + +/** + * Retrieve the raw response from the HTTP request using the GET method. + * + * @see wp_remote_request() For more information on the response array format. + * + * @since 2.7.0 + * + * @param string $url Site URL to retrieve. + * @param array $args Optional. Override the defaults. + * @return WP_Error|array The response or WP_Error on failure. + */ +function wp_remote_get($url, $args = array()) { + $objFetchSite = _wp_http_get_object(); + return $objFetchSite->get($url, $args); +} + +/** + * Retrieve the raw response from the HTTP request using the POST method. + * + * @see wp_remote_request() For more information on the response array format. + * + * @since 2.7.0 + * + * @param string $url Site URL to retrieve. + * @param array $args Optional. Override the defaults. + * @return WP_Error|array The response or WP_Error on failure. + */ +function wp_remote_post($url, $args = array()) { + $objFetchSite = _wp_http_get_object(); + return $objFetchSite->post($url, $args); +} + +/** + * Retrieve the raw response from the HTTP request using the HEAD method. + * + * @see wp_remote_request() For more information on the response array format. + * + * @since 2.7.0 + * + * @param string $url Site URL to retrieve. + * @param array $args Optional. Override the defaults. + * @return WP_Error|array The response or WP_Error on failure. + */ +function wp_remote_head($url, $args = array()) { + $objFetchSite = _wp_http_get_object(); + return $objFetchSite->head($url, $args); +} + +/** + * Retrieve only the headers from the raw response. + * + * @since 2.7.0 + * + * @param array $response HTTP response. + * @return array The headers of the response. Empty array if incorrect parameter given. + */ +function wp_remote_retrieve_headers(&$response) { + if ( is_wp_error($response) || ! isset($response['headers']) || ! is_array($response['headers'])) + return array(); + + return $response['headers']; +} + +/** + * Retrieve a single header by name from the raw response. + * + * @since 2.7.0 + * + * @param array $response + * @param string $header Header name to retrieve value from. + * @return string The header value. Empty string on if incorrect parameter given, or if the header doesnt exist. + */ +function wp_remote_retrieve_header(&$response, $header) { + if ( is_wp_error($response) || ! isset($response['headers']) || ! is_array($response['headers'])) + return ''; + + if ( array_key_exists($header, $response['headers']) ) + return $response['headers'][$header]; + + return ''; +} + +/** + * Retrieve only the response code from the raw response. + * + * Will return an empty array if incorrect parameter value is given. + * + * @since 2.7.0 + * + * @param array $response HTTP response. + * @return string the response code. Empty string on incorrect parameter given. + */ +function wp_remote_retrieve_response_code(&$response) { + if ( is_wp_error($response) || ! isset($response['response']) || ! is_array($response['response'])) + return ''; + + return $response['response']['code']; +} + +/** + * Retrieve only the response message from the raw response. + * + * Will return an empty array if incorrect parameter value is given. + * + * @since 2.7.0 + * + * @param array $response HTTP response. + * @return string The response message. Empty string on incorrect parameter given. + */ +function wp_remote_retrieve_response_message(&$response) { + if ( is_wp_error($response) || ! isset($response['response']) || ! is_array($response['response'])) + return ''; + + return $response['response']['message']; +} + +/** + * Retrieve only the body from the raw response. + * + * @since 2.7.0 + * + * @param array $response HTTP response. + * @return string The body of the response. Empty string if no body or incorrect parameter given. + */ +function wp_remote_retrieve_body(&$response) { + if ( is_wp_error($response) || ! isset($response['body']) ) + return ''; + + return $response['body']; +} + +/** + * Determines if there is an HTTP Transport that can process this request. + * + * @since 3.2.0 + * + * @param array $capabilities Array of capabilities to test or a wp_remote_request() $args array. + * @param string $url Optional. If given, will check if the URL requires SSL and adds that requirement to the capabilities array. + * + * @return bool + */ +function wp_http_supports( $capabilities = array(), $url = null ) { + $objFetchSite = _wp_http_get_object(); + + $capabilities = wp_parse_args( $capabilities ); + + $count = count( $capabilities ); + + // If we have a numeric $capabilities array, spoof a wp_remote_request() associative $args array + if ( $count && count( array_filter( array_keys( $capabilities ), 'is_numeric' ) ) == $count ) { + $capabilities = array_combine( array_values( $capabilities ), array_fill( 0, $count, true ) ); + } + + if ( $url && !isset( $capabilities['ssl'] ) ) { + $scheme = parse_url( $url, PHP_URL_SCHEME ); + if ( 'https' == $scheme || 'ssl' == $scheme ) { + $capabilities['ssl'] = true; + } + } + + return (bool) $objFetchSite->_get_first_available_transport( $capabilities ); +} diff --git a/src/wp-includes/images/admin-bar-sprite-rtl.png b/src/wp-includes/images/admin-bar-sprite-rtl.png new file mode 100644 index 0000000..f49aae7 Binary files /dev/null and b/src/wp-includes/images/admin-bar-sprite-rtl.png differ diff --git a/src/wp-includes/images/admin-bar-sprite.png b/src/wp-includes/images/admin-bar-sprite.png new file mode 100644 index 0000000..8eb1c08 Binary files /dev/null and b/src/wp-includes/images/admin-bar-sprite.png differ diff --git a/src/wp-includes/images/blank.gif b/src/wp-includes/images/blank.gif new file mode 100644 index 0000000..e565824 Binary files /dev/null and b/src/wp-includes/images/blank.gif differ diff --git a/src/wp-includes/images/crystal/archive.png b/src/wp-includes/images/crystal/archive.png new file mode 100644 index 0000000..670648a Binary files /dev/null and b/src/wp-includes/images/crystal/archive.png differ diff --git a/src/wp-includes/images/crystal/audio.png b/src/wp-includes/images/crystal/audio.png new file mode 100644 index 0000000..5a3d4d3 Binary files /dev/null and b/src/wp-includes/images/crystal/audio.png differ diff --git a/src/wp-includes/images/crystal/code.png b/src/wp-includes/images/crystal/code.png new file mode 100644 index 0000000..b67c600 Binary files /dev/null and b/src/wp-includes/images/crystal/code.png differ diff --git a/src/wp-includes/images/crystal/default.png b/src/wp-includes/images/crystal/default.png new file mode 100644 index 0000000..b1bbbc7 Binary files /dev/null and b/src/wp-includes/images/crystal/default.png differ diff --git a/src/wp-includes/images/crystal/document.png b/src/wp-includes/images/crystal/document.png new file mode 100644 index 0000000..3295ccd Binary files /dev/null and b/src/wp-includes/images/crystal/document.png differ diff --git a/src/wp-includes/images/crystal/interactive.png b/src/wp-includes/images/crystal/interactive.png new file mode 100644 index 0000000..fd6de7d Binary files /dev/null and b/src/wp-includes/images/crystal/interactive.png differ diff --git a/src/wp-includes/images/crystal/license.txt b/src/wp-includes/images/crystal/license.txt new file mode 100644 index 0000000..cdabd2f --- /dev/null +++ b/src/wp-includes/images/crystal/license.txt @@ -0,0 +1,9 @@ +Crystal Project Icons +by Everaldo Coelho +http://everaldo.com + +Released under LGPL + +Modified February 2008 +for WordPress +http://wordpress.org \ No newline at end of file diff --git a/src/wp-includes/images/crystal/spreadsheet.png b/src/wp-includes/images/crystal/spreadsheet.png new file mode 100644 index 0000000..f2c4d30 Binary files /dev/null and b/src/wp-includes/images/crystal/spreadsheet.png differ diff --git a/src/wp-includes/images/crystal/text.png b/src/wp-includes/images/crystal/text.png new file mode 100644 index 0000000..feaed5b Binary files /dev/null and b/src/wp-includes/images/crystal/text.png differ diff --git a/src/wp-includes/images/crystal/video.png b/src/wp-includes/images/crystal/video.png new file mode 100644 index 0000000..e1b879d Binary files /dev/null and b/src/wp-includes/images/crystal/video.png differ diff --git a/src/wp-includes/images/rss.png b/src/wp-includes/images/rss.png new file mode 100644 index 0000000..6e7b676 Binary files /dev/null and b/src/wp-includes/images/rss.png differ diff --git a/src/wp-includes/images/smilies/icon_arrow.gif b/src/wp-includes/images/smilies/icon_arrow.gif new file mode 100644 index 0000000..2880055 Binary files /dev/null and b/src/wp-includes/images/smilies/icon_arrow.gif differ diff --git a/src/wp-includes/images/smilies/icon_biggrin.gif b/src/wp-includes/images/smilies/icon_biggrin.gif new file mode 100644 index 0000000..d352772 Binary files /dev/null and b/src/wp-includes/images/smilies/icon_biggrin.gif differ diff --git a/src/wp-includes/images/smilies/icon_confused.gif b/src/wp-includes/images/smilies/icon_confused.gif new file mode 100644 index 0000000..0c49e06 Binary files /dev/null and b/src/wp-includes/images/smilies/icon_confused.gif differ diff --git a/src/wp-includes/images/smilies/icon_cool.gif b/src/wp-includes/images/smilies/icon_cool.gif new file mode 100644 index 0000000..cead030 Binary files /dev/null and b/src/wp-includes/images/smilies/icon_cool.gif differ diff --git a/src/wp-includes/images/smilies/icon_cry.gif b/src/wp-includes/images/smilies/icon_cry.gif new file mode 100644 index 0000000..7d54b1f Binary files /dev/null and b/src/wp-includes/images/smilies/icon_cry.gif differ diff --git a/src/wp-includes/images/smilies/icon_eek.gif b/src/wp-includes/images/smilies/icon_eek.gif new file mode 100644 index 0000000..5d39781 Binary files /dev/null and b/src/wp-includes/images/smilies/icon_eek.gif differ diff --git a/src/wp-includes/images/smilies/icon_evil.gif b/src/wp-includes/images/smilies/icon_evil.gif new file mode 100644 index 0000000..ab1aa8e Binary files /dev/null and b/src/wp-includes/images/smilies/icon_evil.gif differ diff --git a/src/wp-includes/images/smilies/icon_exclaim.gif b/src/wp-includes/images/smilies/icon_exclaim.gif new file mode 100644 index 0000000..6e50e2e Binary files /dev/null and b/src/wp-includes/images/smilies/icon_exclaim.gif differ diff --git a/src/wp-includes/images/smilies/icon_idea.gif b/src/wp-includes/images/smilies/icon_idea.gif new file mode 100644 index 0000000..a40ae0d Binary files /dev/null and b/src/wp-includes/images/smilies/icon_idea.gif differ diff --git a/src/wp-includes/images/smilies/icon_lol.gif b/src/wp-includes/images/smilies/icon_lol.gif new file mode 100644 index 0000000..374ba15 Binary files /dev/null and b/src/wp-includes/images/smilies/icon_lol.gif differ diff --git a/src/wp-includes/images/smilies/icon_mad.gif b/src/wp-includes/images/smilies/icon_mad.gif new file mode 100644 index 0000000..1f6c3c2 Binary files /dev/null and b/src/wp-includes/images/smilies/icon_mad.gif differ diff --git a/src/wp-includes/images/smilies/icon_mrgreen.gif b/src/wp-includes/images/smilies/icon_mrgreen.gif new file mode 100644 index 0000000..b54cd0f Binary files /dev/null and b/src/wp-includes/images/smilies/icon_mrgreen.gif differ diff --git a/src/wp-includes/images/smilies/icon_neutral.gif b/src/wp-includes/images/smilies/icon_neutral.gif new file mode 100644 index 0000000..4f31156 Binary files /dev/null and b/src/wp-includes/images/smilies/icon_neutral.gif differ diff --git a/src/wp-includes/images/smilies/icon_question.gif b/src/wp-includes/images/smilies/icon_question.gif new file mode 100644 index 0000000..9d07226 Binary files /dev/null and b/src/wp-includes/images/smilies/icon_question.gif differ diff --git a/src/wp-includes/images/smilies/icon_razz.gif b/src/wp-includes/images/smilies/icon_razz.gif new file mode 100644 index 0000000..29da2a2 Binary files /dev/null and b/src/wp-includes/images/smilies/icon_razz.gif differ diff --git a/src/wp-includes/images/smilies/icon_redface.gif b/src/wp-includes/images/smilies/icon_redface.gif new file mode 100644 index 0000000..ad76283 Binary files /dev/null and b/src/wp-includes/images/smilies/icon_redface.gif differ diff --git a/src/wp-includes/images/smilies/icon_rolleyes.gif b/src/wp-includes/images/smilies/icon_rolleyes.gif new file mode 100644 index 0000000..d7f5f2f Binary files /dev/null and b/src/wp-includes/images/smilies/icon_rolleyes.gif differ diff --git a/src/wp-includes/images/smilies/icon_sad.gif b/src/wp-includes/images/smilies/icon_sad.gif new file mode 100644 index 0000000..d2ac78c Binary files /dev/null and b/src/wp-includes/images/smilies/icon_sad.gif differ diff --git a/src/wp-includes/images/smilies/icon_smile.gif b/src/wp-includes/images/smilies/icon_smile.gif new file mode 100644 index 0000000..7b1f6d3 Binary files /dev/null and b/src/wp-includes/images/smilies/icon_smile.gif differ diff --git a/src/wp-includes/images/smilies/icon_surprised.gif b/src/wp-includes/images/smilies/icon_surprised.gif new file mode 100644 index 0000000..cb21424 Binary files /dev/null and b/src/wp-includes/images/smilies/icon_surprised.gif differ diff --git a/src/wp-includes/images/smilies/icon_twisted.gif b/src/wp-includes/images/smilies/icon_twisted.gif new file mode 100644 index 0000000..502fe24 Binary files /dev/null and b/src/wp-includes/images/smilies/icon_twisted.gif differ diff --git a/src/wp-includes/images/smilies/icon_wink.gif b/src/wp-includes/images/smilies/icon_wink.gif new file mode 100644 index 0000000..d148288 Binary files /dev/null and b/src/wp-includes/images/smilies/icon_wink.gif differ diff --git a/src/wp-includes/images/upload.png b/src/wp-includes/images/upload.png new file mode 100644 index 0000000..8ca02d7 Binary files /dev/null and b/src/wp-includes/images/upload.png differ diff --git a/src/wp-includes/images/wlw/wp-comments.png b/src/wp-includes/images/wlw/wp-comments.png new file mode 100644 index 0000000..981b1af Binary files /dev/null and b/src/wp-includes/images/wlw/wp-comments.png differ diff --git a/src/wp-includes/images/wlw/wp-icon.png b/src/wp-includes/images/wlw/wp-icon.png new file mode 100644 index 0000000..cd94ee3 Binary files /dev/null and b/src/wp-includes/images/wlw/wp-icon.png differ diff --git a/src/wp-includes/images/wlw/wp-watermark.png b/src/wp-includes/images/wlw/wp-watermark.png new file mode 100644 index 0000000..c312a72 Binary files /dev/null and b/src/wp-includes/images/wlw/wp-watermark.png differ diff --git a/src/wp-includes/images/wpmini-blue.png b/src/wp-includes/images/wpmini-blue.png new file mode 100644 index 0000000..13f3fa6 Binary files /dev/null and b/src/wp-includes/images/wpmini-blue.png differ diff --git a/src/wp-includes/js/admin-bar.dev.js b/src/wp-includes/js/admin-bar.dev.js new file mode 100644 index 0000000..cf13ca7 --- /dev/null +++ b/src/wp-includes/js/admin-bar.dev.js @@ -0,0 +1,140 @@ +(function(d, w) { + var addEvent = function( obj, type, fn ) { + if (obj.addEventListener) + obj.addEventListener(type, fn, false); + else if (obj.attachEvent) + obj.attachEvent('on' + type, function() { return fn.call(obj, window.event);}); + }, + + aB, hc = new RegExp('\\bhover\\b', 'g'), q = [], + rselected = new RegExp('\\bselected\\b', 'g'), + + /** + * Get the timeout ID of the given element + */ + getTOID = function(el) { + var i = q.length; + while( i-- ) + if ( q[i] && el == q[i][1] ) + return q[i][0]; + return false; + }, + + addHoverClass = function(t) { + var i, id, inA, hovering, ul, li, + ancestors = [], + ancestorLength = 0; + + while ( t && t != aB && t != d ) { + if( 'LI' == t.nodeName.toUpperCase() ) { + ancestors[ ancestors.length ] = t; + id = getTOID(t); + if ( id ) + clearTimeout( id ); + t.className = t.className ? ( t.className.replace(hc, '') + ' hover' ) : 'hover'; + hovering = t; + } + t = t.parentNode; + } + + // Remove any selected classes. + if ( hovering && hovering.parentNode ) { + ul = hovering.parentNode; + if ( ul && 'UL' == ul.nodeName.toUpperCase() ) { + i = ul.childNodes.length; + while ( i-- ) { + li = ul.childNodes[i]; + if ( li != hovering ) + li.className = li.className ? li.className.replace( rselected, '' ) : ''; + } + } + } + + /* remove the hover class for any objects not in the immediate element's ancestry */ + i = q.length; + while ( i-- ) { + inA = false; + ancestorLength = ancestors.length; + while( ancestorLength-- ) { + if ( ancestors[ ancestorLength ] == q[i][1] ) + inA = true; + } + + if ( ! inA ) + q[i][1].className = q[i][1].className ? q[i][1].className.replace(hc, '') : ''; + } + }, + + removeHoverClass = function(t) { + while ( t && t != aB && t != d ) { + if( 'LI' == t.nodeName.toUpperCase() ) { + (function(t) { + var to = setTimeout(function() { + t.className = t.className ? t.className.replace(hc, '') : ''; + }, 500); + q[q.length] = [to, t]; + })(t); + } + t = t.parentNode; + } + }, + + clickShortlink = function(e) { + var i, l, node, + t = e.target || e.srcElement; + + // Make t the shortlink menu item, or return. + while ( true ) { + // Check if we've gone past the shortlink node, + // or if the user is clicking on the input. + if ( ! t || t == d || t == aB ) + return; + // Check if we've found the shortlink node. + if ( t.id && t.id == 'wp-admin-bar-get-shortlink' ) + break; + t = t.parentNode; + } + + // IE doesn't support preventDefault, and does support returnValue + if ( e.preventDefault ) + e.preventDefault(); + e.returnValue = false; + + if ( -1 == t.className.indexOf('selected') ) + t.className += ' selected'; + + for ( i = 0, l = t.childNodes.length; i < l; i++ ) { + node = t.childNodes[i]; + if ( node.className && -1 != node.className.indexOf('shortlink-input') ) { + node.focus(); + node.select(); + node.onblur = function() { + t.className = t.className ? t.className.replace( rselected, '' ) : ''; + }; + break; + } + } + return false; + }; + + addEvent(w, 'load', function() { + aB = d.getElementById('wpadminbar'); + + if ( d.body && aB ) { + d.body.appendChild( aB ); + + addEvent(aB, 'mouseover', function(e) { + addHoverClass( e.target || e.srcElement ); + }); + + addEvent(aB, 'mouseout', function(e) { + removeHoverClass( e.target || e.srcElement ); + }); + + addEvent(aB, 'click', clickShortlink ); + } + + if ( w.location.hash ) + w.scrollBy(0,-32); + }); +})(document, window); diff --git a/src/wp-includes/js/admin-bar.js b/src/wp-includes/js/admin-bar.js new file mode 100644 index 0000000..ea90a69 --- /dev/null +++ b/src/wp-includes/js/admin-bar.js @@ -0,0 +1 @@ +(function(i,k){var c=function(n,m,d){if(n.addEventListener){n.addEventListener(m,d,false)}else{if(n.attachEvent){n.attachEvent("on"+m,function(){return d.call(n,window.event)})}}},e,f=new RegExp("\\bhover\\b","g"),a=[],j=new RegExp("\\bselected\\b","g"),g=function(m){var d=a.length;while(d--){if(a[d]&&m==a[d][1]){return a[d][0]}}return false},h=function(s){var n,d,q,m,p,r,u=[],o=0;while(s&&s!=e&&s!=i){if("LI"==s.nodeName.toUpperCase()){u[u.length]=s;d=g(s);if(d){clearTimeout(d)}s.className=s.className?(s.className.replace(f,"")+" hover"):"hover";m=s}s=s.parentNode}if(m&&m.parentNode){p=m.parentNode;if(p&&"UL"==p.nodeName.toUpperCase()){n=p.childNodes.length;while(n--){r=p.childNodes[n];if(r!=m){r.className=r.className?r.className.replace(j,""):""}}}}n=a.length;while(n--){q=false;o=u.length;while(o--){if(u[o]==a[n][1]){q=true}}if(!q){a[n][1].className=a[n][1].className?a[n][1].className.replace(f,""):""}}},l=function(d){while(d&&d!=e&&d!=i){if("LI"==d.nodeName.toUpperCase()){(function(m){var n=setTimeout(function(){m.className=m.className?m.className.replace(f,""):""},500);a[a.length]=[n,m]})(d)}d=d.parentNode}},b=function(p){var n,d,o,m=p.target||p.srcElement;while(true){if(!m||m==i||m==e){return}if(m.id&&m.id=="wp-admin-bar-get-shortlink"){break}m=m.parentNode}if(p.preventDefault){p.preventDefault()}p.returnValue=false;if(-1==m.className.indexOf("selected")){m.className+=" selected"}for(n=0,d=m.childNodes.length;n 0) ) { autosave(); } + if ( tinyMCE.activeEditor && ! tinyMCE.activeEditor.isHidden() && dotabkey ) { + e.preventDefault(); + dotabkey = false; + tinyMCE.activeEditor.focus(); + return false; + } + } + }); + } + + // autosave new posts after a title is typed but not if Publish or Save Draft is clicked + if ( '1' == $('#auto_draft').val() ) { + $('#title').blur( function() { + if ( !this.value || $('#auto_draft').val() != '1' ) + return; + delayed_autosave(); + }); + } +}); + +function autosave_parse_response(response) { + var res = wpAjax.parseAjaxResponse(response, 'autosave'), message = '', postID, sup; + + if ( res && res.responses && res.responses.length ) { + message = res.responses[0].data; // The saved message or error. + // someone else is editing: disable autosave, set errors + if ( res.responses[0].supplemental ) { + sup = res.responses[0].supplemental; + if ( 'disable' == sup['disable_autosave'] ) { + autosave = function() {}; + res = { errors: true }; + } + + if ( sup['alert'] ) { + jQuery('#autosave-alert').remove(); + jQuery('#titlediv').after('

            ' + sup['alert'] + '

            '); + } + + jQuery.each(sup, function(selector, value) { + if ( selector.match(/^replace-/) ) { + jQuery('#'+selector.replace('replace-', '')).val(value); + } + }); + } + + // if no errors: add slug UI + if ( !res.errors ) { + postID = parseInt( res.responses[0].id, 10 ); + if ( !isNaN(postID) && postID > 0 ) { + autosave_update_slug(postID); + } + } + } + if ( message ) { // update autosave message + jQuery('.autosave-message').html(message); + } else if ( autosaveOldMessage && res ) { + jQuery('.autosave-message').html( autosaveOldMessage ); + } + return res; +} + +// called when autosaving pre-existing post +function autosave_saved(response) { + blockSave = false; + autosave_parse_response(response); // parse the ajax response + autosave_enable_buttons(); // re-enable disabled form buttons +} + +// called when autosaving new post +function autosave_saved_new(response) { + blockSave = false; + var res = autosave_parse_response(response), postID; + if ( res && res.responses.length && !res.errors ) { + // An ID is sent only for real auto-saves, not for autosave=0 "keepalive" saves + postID = parseInt( res.responses[0].id, 10 ); + if ( !isNaN(postID) && postID > 0 ) { + notSaved = false; + jQuery('#auto_draft').val('0'); // No longer an auto-draft + } + autosave_enable_buttons(); + if ( autosaveDelayPreview ) { + autosaveDelayPreview = false; + doPreview(); + } + } else { + autosave_enable_buttons(); // re-enable disabled form buttons + } +} + +function autosave_update_slug(post_id) { + // create slug area only if not already there + if ( 'undefined' != makeSlugeditClickable && jQuery.isFunction(makeSlugeditClickable) && !jQuery('#edit-slug-box > *').size() ) { + jQuery.post( ajaxurl, { + action: 'sample-permalink', + post_id: post_id, + new_title: fullscreen && fullscreen.settings.visible ? jQuery('#wp-fullscreen-title').val() : jQuery('#title').val(), + samplepermalinknonce: jQuery('#samplepermalinknonce').val() + }, + function(data) { + if ( data !== '-1' ) { + jQuery('#edit-slug-box').html(data); + makeSlugeditClickable(); + } + } + ); + } +} + +function autosave_loading() { + jQuery('.autosave-message').html(autosaveL10n.savingText); +} + +function autosave_enable_buttons() { + // delay that a bit to avoid some rare collisions while the DOM is being updated. + setTimeout(function(){ + jQuery(':button, :submit', '#submitpost').removeAttr('disabled'); + jQuery('.ajax-loading').css('visibility', 'hidden'); + }, 500); +} + +function autosave_disable_buttons() { + jQuery(':button, :submit', '#submitpost').prop('disabled', true); + // Re-enable 5 sec later. Just gives autosave a head start to avoid collisions. + setTimeout(autosave_enable_buttons, 5000); +} + +function delayed_autosave() { + setTimeout(function(){ + if ( blockSave ) + return; + autosave(); + }, 200); +} + +autosave = function() { + // (bool) is rich editor enabled and active + blockSave = true; + var rich = (typeof tinyMCE != "undefined") && tinyMCE.activeEditor && !tinyMCE.activeEditor.isHidden(), + post_data, doAutoSave, ed, origStatus, successCallback; + + autosave_disable_buttons(); + + post_data = { + action: "autosave", + post_ID: jQuery("#post_ID").val() || 0, + autosavenonce: jQuery('#autosavenonce').val(), + post_type: jQuery('#post_type').val() || "", + autosave: 1 + }; + + jQuery('.tags-input').each( function() { + post_data[this.name] = this.value; + } ); + + // We always send the ajax request in order to keep the post lock fresh. + // This (bool) tells whether or not to write the post to the DB during the ajax request. + doAutoSave = true; + + // No autosave while thickbox is open (media buttons) + if ( jQuery("#TB_window").css('display') == 'block' ) + doAutoSave = false; + + /* Gotta do this up here so we can check the length when tinyMCE is in use */ + if ( rich && doAutoSave ) { + ed = tinyMCE.activeEditor; + // Don't run while the TinyMCE spellcheck is on. It resets all found words. + if ( ed.plugins.spellchecker && ed.plugins.spellchecker.active ) { + doAutoSave = false; + } else { + if ( 'mce_fullscreen' == ed.id || 'wp_mce_fullscreen' == ed.id ) + tinyMCE.get('content').setContent(ed.getContent({format : 'raw'}), {format : 'raw'}); + tinyMCE.triggerSave(); + } + } + + if ( fullscreen && fullscreen.settings.visible ) { + post_data["post_title"] = jQuery('#wp-fullscreen-title').val(); + post_data["content"] = jQuery("#wp_mce_fullscreen").val(); + } else { + post_data["post_title"] = jQuery("#title").val() + post_data["content"] = jQuery("#content").val(); + } + + if ( jQuery('#post_name').val() ) + post_data["post_name"] = jQuery('#post_name').val(); + + // Nothing to save or no change. + if ( ( post_data["post_title"].length == 0 && post_data["content"].length == 0 ) || post_data["post_title"] + post_data["content"] == autosaveLast ) { + doAutoSave = false; + } + + origStatus = jQuery('#original_post_status').val(); + + goodcats = ([]); + jQuery("[name='post_category[]']:checked").each( function(i) { + goodcats.push(this.value); + } ); + post_data["catslist"] = goodcats.join(","); + + if ( jQuery("#comment_status").prop("checked") ) + post_data["comment_status"] = 'open'; + if ( jQuery("#ping_status").prop("checked") ) + post_data["ping_status"] = 'open'; + if ( jQuery("#excerpt").size() ) + post_data["excerpt"] = jQuery("#excerpt").val(); + if ( jQuery("#post_author").size() ) + post_data["post_author"] = jQuery("#post_author").val(); + if ( jQuery("#parent_id").val() ) + post_data["parent_id"] = jQuery("#parent_id").val(); + post_data["user_ID"] = jQuery("#user-id").val(); + if ( jQuery('#auto_draft').val() == '1' ) + post_data["auto_draft"] = '1'; + + if ( doAutoSave ) { + autosaveLast = post_data["post_title"] + post_data["content"]; + jQuery(document).triggerHandler('wpcountwords', [ post_data["content"] ]); + } else { + post_data['autosave'] = 0; + } + + if ( post_data["auto_draft"] == '1' ) { + successCallback = autosave_saved_new; // new post + } else { + successCallback = autosave_saved; // pre-existing post + } + + autosaveOldMessage = jQuery('#autosave').html(); + jQuery.ajax({ + data: post_data, + beforeSend: doAutoSave ? autosave_loading : null, + type: "POST", + url: ajaxurl, + success: successCallback + }); +} diff --git a/src/wp-includes/js/autosave.js b/src/wp-includes/js/autosave.js new file mode 100644 index 0000000..ee06aaf --- /dev/null +++ b/src/wp-includes/js/autosave.js @@ -0,0 +1 @@ +var autosave,autosaveLast="",autosavePeriodical,autosaveOldMessage="",autosaveDelayPreview=false,notSaved=true,blockSave=false,fullscreen;jQuery(document).ready(function(b){var a=true;autosaveLast=b("#post #title").val()+b("#post #content").val();autosavePeriodical=b.schedule({time:autosaveL10n.autosaveInterval*1000,func:function(){autosave()},repeat:true,protect:true});b("#post").submit(function(){b.cancel(autosavePeriodical)});b('input[type="submit"], a.submitdelete',"#submitpost").click(function(){blockSave=true;window.onbeforeunload=null;b(":button, :submit","#submitpost").each(function(){var c=b(this);if(c.hasClass("button-primary")){c.addClass("button-primary-disabled")}else{c.addClass("button-disabled")}});if(b(this).attr("id")=="publish"){b("#ajax-loading").css("visibility","visible")}else{b("#draft-ajax-loading").css("visibility","visible")}});window.onbeforeunload=function(){var c=typeof(tinyMCE)!="undefined"?tinyMCE.activeEditor:false,e,d;if(c&&!c.isHidden()){if(c.isDirty()){return autosaveL10n.saveAlert}}else{if(fullscreen&&fullscreen.settings.visible){e=b("#wp-fullscreen-title").val();d=b("#wp_mce_fullscreen").val()}else{e=b("#post #title").val();d=b("#post #content").val()}if((e||d)&&e+d!=autosaveLast){return autosaveL10n.saveAlert}}};b("#post-preview").click(function(){if(b("#auto_draft").val()=="1"&¬Saved){autosaveDelayPreview=true;autosave();return false}doPreview();return false});doPreview=function(){b("input#wp-preview").val("dopreview");b("form#post").attr("target","wp-preview").submit().attr("target","");b("input#wp-preview").val("")};if(typeof tinyMCE!="undefined"){b("#title")[b.browser.opera?"keypress":"keydown"](function(c){if(c.which==9&&!c.shiftKey&&!c.controlKey&&!c.altKey){if((b("#auto_draft").val()=="1")&&(b("#title").val().length>0)){autosave()}if(tinyMCE.activeEditor&&!tinyMCE.activeEditor.isHidden()&&a){c.preventDefault();a=false;tinyMCE.activeEditor.focus();return false}}})}if("1"==b("#auto_draft").val()){b("#title").blur(function(){if(!this.value||b("#auto_draft").val()!="1"){return}delayed_autosave()})}});function autosave_parse_response(c){var d=wpAjax.parseAjaxResponse(c,"autosave"),e="",a,b;if(d&&d.responses&&d.responses.length){e=d.responses[0].data;if(d.responses[0].supplemental){b=d.responses[0].supplemental;if("disable"==b.disable_autosave){autosave=function(){};d={errors:true}}if(b.alert){jQuery("#autosave-alert").remove();jQuery("#titlediv").after('

            '+b.alert+"

            ")}jQuery.each(b,function(f,g){if(f.match(/^replace-/)){jQuery("#"+f.replace("replace-","")).val(g)}})}if(!d.errors){a=parseInt(d.responses[0].id,10);if(!isNaN(a)&&a>0){autosave_update_slug(a)}}}if(e){jQuery(".autosave-message").html(e)}else{if(autosaveOldMessage&&d){jQuery(".autosave-message").html(autosaveOldMessage)}}return d}function autosave_saved(a){blockSave=false;autosave_parse_response(a);autosave_enable_buttons()}function autosave_saved_new(b){blockSave=false;var c=autosave_parse_response(b),a;if(c&&c.responses.length&&!c.errors){a=parseInt(c.responses[0].id,10);if(!isNaN(a)&&a>0){notSaved=false;jQuery("#auto_draft").val("0")}autosave_enable_buttons();if(autosaveDelayPreview){autosaveDelayPreview=false;doPreview()}}else{autosave_enable_buttons()}}function autosave_update_slug(a){if("undefined"!=makeSlugeditClickable&&jQuery.isFunction(makeSlugeditClickable)&&!jQuery("#edit-slug-box > *").size()){jQuery.post(ajaxurl,{action:"sample-permalink",post_id:a,new_title:fullscreen&&fullscreen.settings.visible?jQuery("#wp-fullscreen-title").val():jQuery("#title").val(),samplepermalinknonce:jQuery("#samplepermalinknonce").val()},function(b){if(b!=="-1"){jQuery("#edit-slug-box").html(b);makeSlugeditClickable()}})}}function autosave_loading(){jQuery(".autosave-message").html(autosaveL10n.savingText)}function autosave_enable_buttons(){setTimeout(function(){jQuery(":button, :submit","#submitpost").removeAttr("disabled");jQuery(".ajax-loading").css("visibility","hidden")},500)}function autosave_disable_buttons(){jQuery(":button, :submit","#submitpost").prop("disabled",true);setTimeout(autosave_enable_buttons,5000)}function delayed_autosave(){setTimeout(function(){if(blockSave){return}autosave()},200)}autosave=function(){blockSave=true;var c=(typeof tinyMCE!="undefined")&&tinyMCE.activeEditor&&!tinyMCE.activeEditor.isHidden(),d,f,b,e,a;autosave_disable_buttons();d={action:"autosave",post_ID:jQuery("#post_ID").val()||0,autosavenonce:jQuery("#autosavenonce").val(),post_type:jQuery("#post_type").val()||"",autosave:1};jQuery(".tags-input").each(function(){d[this.name]=this.value});f=true;if(jQuery("#TB_window").css("display")=="block"){f=false}if(c&&f){b=tinyMCE.activeEditor;if(b.plugins.spellchecker&&b.plugins.spellchecker.active){f=false}else{if("mce_fullscreen"==b.id||"wp_mce_fullscreen"==b.id){tinyMCE.get("content").setContent(b.getContent({format:"raw"}),{format:"raw"})}tinyMCE.triggerSave()}}if(fullscreen&&fullscreen.settings.visible){d.post_title=jQuery("#wp-fullscreen-title").val();d.content=jQuery("#wp_mce_fullscreen").val()}else{d.post_title=jQuery("#title").val();d.content=jQuery("#content").val()}if(jQuery("#post_name").val()){d.post_name=jQuery("#post_name").val()}if((d.post_title.length==0&&d.content.length==0)||d.post_title+d.content==autosaveLast){f=false}e=jQuery("#original_post_status").val();goodcats=([]);jQuery("[name='post_category[]']:checked").each(function(g){goodcats.push(this.value)});d.catslist=goodcats.join(",");if(jQuery("#comment_status").prop("checked")){d.comment_status="open"}if(jQuery("#ping_status").prop("checked")){d.ping_status="open"}if(jQuery("#excerpt").size()){d.excerpt=jQuery("#excerpt").val()}if(jQuery("#post_author").size()){d.post_author=jQuery("#post_author").val()}if(jQuery("#parent_id").val()){d.parent_id=jQuery("#parent_id").val()}d.user_ID=jQuery("#user-id").val();if(jQuery("#auto_draft").val()=="1"){d.auto_draft="1"}if(f){autosaveLast=d.post_title+d.content;jQuery(document).triggerHandler("wpcountwords",[d.content])}else{d.autosave=0}if(d.auto_draft=="1"){a=autosave_saved_new}else{a=autosave_saved}autosaveOldMessage=jQuery("#autosave").html();jQuery.ajax({data:d,beforeSend:f?autosave_loading:null,type:"POST",url:ajaxurl,success:a})}; \ No newline at end of file diff --git a/src/wp-includes/js/colorpicker.dev.js b/src/wp-includes/js/colorpicker.dev.js new file mode 100644 index 0000000..1fc32cf --- /dev/null +++ b/src/wp-includes/js/colorpicker.dev.js @@ -0,0 +1,707 @@ +// =================================================================== +// Author: Matt Kruse +// WWW: http://www.mattkruse.com/ +// +// NOTICE: You may use this code for any purpose, commercial or +// private, without any further permission from the author. You may +// remove this notice from your final code if you wish, however it is +// appreciated by the author if at least my web site address is kept. +// +// You may *NOT* re-distribute this code in any way except through its +// use. That means, you can include it in your product, or your web +// site, or any other form where the code is actually being used. You +// may not put the plain javascript up on your site for download or +// include it in your javascript libraries for download. +// If you wish to share this code with others, please just point them +// to the URL instead. +// Please DO NOT link directly to my .js files from your site. Copy +// the files to your server and use them there. Thank you. +// =================================================================== + + +/* SOURCE FILE: AnchorPosition.js */ + +/* +AnchorPosition.js +Author: Matt Kruse +Last modified: 10/11/02 + +DESCRIPTION: These functions find the position of an tag in a document, +so other elements can be positioned relative to it. + +COMPATABILITY: Netscape 4.x,6.x,Mozilla, IE 5.x,6.x on Windows. Some small +positioning errors - usually with Window positioning - occur on the +Macintosh platform. + +FUNCTIONS: +getAnchorPosition(anchorname) + Returns an Object() having .x and .y properties of the pixel coordinates + of the upper-left corner of the anchor. Position is relative to the PAGE. + +getAnchorWindowPosition(anchorname) + Returns an Object() having .x and .y properties of the pixel coordinates + of the upper-left corner of the anchor, relative to the WHOLE SCREEN. + +NOTES: + +1) For popping up separate browser windows, use getAnchorWindowPosition. + Otherwise, use getAnchorPosition + +2) Your anchor tag MUST contain both NAME and ID attributes which are the + same. For example: + + +3) There must be at least a space between for IE5.5 to see the + anchor tag correctly. Do not do with no space. +*/ + +// getAnchorPosition(anchorname) +// This function returns an object having .x and .y properties which are the coordinates +// of the named anchor, relative to the page. +function getAnchorPosition(anchorname) { + // This function will return an Object with x and y properties + var useWindow=false; + var coordinates=new Object(); + var x=0,y=0; + // Browser capability sniffing + var use_gebi=false, use_css=false, use_layers=false; + if (document.getElementById) { use_gebi=true; } + else if (document.all) { use_css=true; } + else if (document.layers) { use_layers=true; } + // Logic to find position + if (use_gebi && document.all) { + x=AnchorPosition_getPageOffsetLeft(document.all[anchorname]); + y=AnchorPosition_getPageOffsetTop(document.all[anchorname]); + } + else if (use_gebi) { + var o=document.getElementById(anchorname); + x=AnchorPosition_getPageOffsetLeft(o); + y=AnchorPosition_getPageOffsetTop(o); + } + else if (use_css) { + x=AnchorPosition_getPageOffsetLeft(document.all[anchorname]); + y=AnchorPosition_getPageOffsetTop(document.all[anchorname]); + } + else if (use_layers) { + var found=0; + for (var i=0; i tags may cause errors. + +USAGE: +// Create an object for a WINDOW popup +var win = new PopupWindow(); + +// Create an object for a DIV window using the DIV named 'mydiv' +var win = new PopupWindow('mydiv'); + +// Set the window to automatically hide itself when the user clicks +// anywhere else on the page except the popup +win.autoHide(); + +// Show the window relative to the anchor name passed in +win.showPopup(anchorname); + +// Hide the popup +win.hidePopup(); + +// Set the size of the popup window (only applies to WINDOW popups +win.setSize(width,height); + +// Populate the contents of the popup window that will be shown. If you +// change the contents while it is displayed, you will need to refresh() +win.populate(string); + +// set the URL of the window, rather than populating its contents +// manually +win.setUrl("http://www.site.com/"); + +// Refresh the contents of the popup +win.refresh(); + +// Specify how many pixels to the right of the anchor the popup will appear +win.offsetX = 50; + +// Specify how many pixels below the anchor the popup will appear +win.offsetY = 100; + +NOTES: +1) Requires the functions in AnchorPosition.js + +2) Your anchor tag MUST contain both NAME and ID attributes which are the + same. For example: + + +3) There must be at least a space between for IE5.5 to see the + anchor tag correctly. Do not do with no space. + +4) When a PopupWindow object is created, a handler for 'onmouseup' is + attached to any event handler you may have already defined. Do NOT define + an event handler for 'onmouseup' after you define a PopupWindow object or + the autoHide() will not work correctly. +*/ + +// Set the position of the popup window based on the anchor +function PopupWindow_getXYPosition(anchorname) { + var coordinates; + if (this.type == "WINDOW") { + coordinates = getAnchorWindowPosition(anchorname); + } + else { + coordinates = getAnchorPosition(anchorname); + } + this.x = coordinates.x; + this.y = coordinates.y; + } +// Set width/height of DIV/popup window +function PopupWindow_setSize(width,height) { + this.width = width; + this.height = height; + } +// Fill the window with contents +function PopupWindow_populate(contents) { + this.contents = contents; + this.populated = false; + } +// Set the URL to go to +function PopupWindow_setUrl(url) { + this.url = url; + } +// Set the window popup properties +function PopupWindow_setWindowProperties(props) { + this.windowProperties = props; + } +// Refresh the displayed contents of the popup +function PopupWindow_refresh() { + if (this.divName != null) { + // refresh the DIV object + if (this.use_gebi) { + document.getElementById(this.divName).innerHTML = this.contents; + } + else if (this.use_css) { + document.all[this.divName].innerHTML = this.contents; + } + else if (this.use_layers) { + var d = document.layers[this.divName]; + d.document.open(); + d.document.writeln(this.contents); + d.document.close(); + } + } + else { + if (this.popupWindow != null && !this.popupWindow.closed) { + if (this.url!="") { + this.popupWindow.location.href=this.url; + } + else { + this.popupWindow.document.open(); + this.popupWindow.document.writeln(this.contents); + this.popupWindow.document.close(); + } + this.popupWindow.focus(); + } + } + } +// Position and show the popup, relative to an anchor object +function PopupWindow_showPopup(anchorname) { + this.getXYPosition(anchorname); + this.x += this.offsetX; + this.y += this.offsetY; + if (!this.populated && (this.contents != "")) { + this.populated = true; + this.refresh(); + } + if (this.divName != null) { + // Show the DIV object + if (this.use_gebi) { + document.getElementById(this.divName).style.left = this.x + "px"; + document.getElementById(this.divName).style.top = this.y; + document.getElementById(this.divName).style.visibility = "visible"; + } + else if (this.use_css) { + document.all[this.divName].style.left = this.x; + document.all[this.divName].style.top = this.y; + document.all[this.divName].style.visibility = "visible"; + } + else if (this.use_layers) { + document.layers[this.divName].left = this.x; + document.layers[this.divName].top = this.y; + document.layers[this.divName].visibility = "visible"; + } + } + else { + if (this.popupWindow == null || this.popupWindow.closed) { + // If the popup window will go off-screen, move it so it doesn't + if (this.x<0) { this.x=0; } + if (this.y<0) { this.y=0; } + if (screen && screen.availHeight) { + if ((this.y + this.height) > screen.availHeight) { + this.y = screen.availHeight - this.height; + } + } + if (screen && screen.availWidth) { + if ((this.x + this.width) > screen.availWidth) { + this.x = screen.availWidth - this.width; + } + } + var avoidAboutBlank = window.opera || ( document.layers && !navigator.mimeTypes['*'] ) || navigator.vendor == 'KDE' || ( document.childNodes && !document.all && !navigator.taintEnabled ); + this.popupWindow = window.open(avoidAboutBlank?"":"about:blank","window_"+anchorname,this.windowProperties+",width="+this.width+",height="+this.height+",screenX="+this.x+",left="+this.x+",screenY="+this.y+",top="+this.y+""); + } + this.refresh(); + } + } +// Hide the popup +function PopupWindow_hidePopup() { + if (this.divName != null) { + if (this.use_gebi) { + document.getElementById(this.divName).style.visibility = "hidden"; + } + else if (this.use_css) { + document.all[this.divName].style.visibility = "hidden"; + } + else if (this.use_layers) { + document.layers[this.divName].visibility = "hidden"; + } + } + else { + if (this.popupWindow && !this.popupWindow.closed) { + this.popupWindow.close(); + this.popupWindow = null; + } + } + } +// Pass an event and return whether or not it was the popup DIV that was clicked +function PopupWindow_isClicked(e) { + if (this.divName != null) { + if (this.use_layers) { + var clickX = e.pageX; + var clickY = e.pageY; + var t = document.layers[this.divName]; + if ((clickX > t.left) && (clickX < t.left+t.clip.width) && (clickY > t.top) && (clickY < t.top+t.clip.height)) { + return true; + } + else { return false; } + } + else if (document.all) { // Need to hard-code this to trap IE for error-handling + var t = window.event.srcElement; + while (t.parentElement != null) { + if (t.id==this.divName) { + return true; + } + t = t.parentElement; + } + return false; + } + else if (this.use_gebi && e) { + var t = e.originalTarget; + while (t.parentNode != null) { + if (t.id==this.divName) { + return true; + } + t = t.parentNode; + } + return false; + } + return false; + } + return false; + } + +// Check an onMouseDown event to see if we should hide +function PopupWindow_hideIfNotClicked(e) { + if (this.autoHideEnabled && !this.isClicked(e)) { + this.hidePopup(); + } + } +// Call this to make the DIV disable automatically when mouse is clicked outside it +function PopupWindow_autoHide() { + this.autoHideEnabled = true; + } +// This global function checks all PopupWindow objects onmouseup to see if they should be hidden +function PopupWindow_hidePopupWindows(e) { + for (var i=0; i0) { + this.type="DIV"; + this.divName = arguments[0]; + } + else { + this.type="WINDOW"; + } + this.use_gebi = false; + this.use_css = false; + this.use_layers = false; + if (document.getElementById) { this.use_gebi = true; } + else if (document.all) { this.use_css = true; } + else if (document.layers) { this.use_layers = true; } + else { this.type = "WINDOW"; } + this.offsetX = 0; + this.offsetY = 0; + // Method mappings + this.getXYPosition = PopupWindow_getXYPosition; + this.populate = PopupWindow_populate; + this.setUrl = PopupWindow_setUrl; + this.setWindowProperties = PopupWindow_setWindowProperties; + this.refresh = PopupWindow_refresh; + this.showPopup = PopupWindow_showPopup; + this.hidePopup = PopupWindow_hidePopup; + this.setSize = PopupWindow_setSize; + this.isClicked = PopupWindow_isClicked; + this.autoHide = PopupWindow_autoHide; + this.hideIfNotClicked = PopupWindow_hideIfNotClicked; + } + +/* SOURCE FILE: ColorPicker2.js */ + +/* +Last modified: 02/24/2003 + +DESCRIPTION: This widget is used to select a color, in hexadecimal #RRGGBB +form. It uses a color "swatch" to display the standard 216-color web-safe +palette. The user can then click on a color to select it. + +COMPATABILITY: See notes in AnchorPosition.js and PopupWindow.js. +Only the latest DHTML-capable browsers will show the color and hex values +at the bottom as your mouse goes over them. + +USAGE: +// Create a new ColorPicker object using DHTML popup +var cp = new ColorPicker(); + +// Create a new ColorPicker object using Window Popup +var cp = new ColorPicker('window'); + +// Add a link in your page to trigger the popup. For example: +Pick + +// Or use the built-in "select" function to do the dirty work for you: +Pick + +// If using DHTML popup, write out the required DIV tag near the bottom +// of your page. + + +// Write the 'pickColor' function that will be called when the user clicks +// a color and do something with the value. This is only required if you +// want to do something other than simply populate a form field, which is +// what the 'select' function will give you. +function pickColor(color) { + field.value = color; + } + +NOTES: +1) Requires the functions in AnchorPosition.js and PopupWindow.js + +2) Your anchor tag MUST contain both NAME and ID attributes which are the + same. For example: + + +3) There must be at least a space between for IE5.5 to see the + anchor tag correctly. Do not do with no space. + +4) When a ColorPicker object is created, a handler for 'onmouseup' is + attached to any event handler you may have already defined. Do NOT define + an event handler for 'onmouseup' after you define a ColorPicker object or + the color picker will not hide itself correctly. +*/ +ColorPicker_targetInput = null; +function ColorPicker_writeDiv() { + document.writeln(""); + } + +function ColorPicker_show(anchorname) { + this.showPopup(anchorname); + } + +function ColorPicker_pickColor(color,obj) { + obj.hidePopup(); + pickColor(color); + } + +// A Default "pickColor" function to accept the color passed back from popup. +// User can over-ride this with their own function. +function pickColor(color) { + if (ColorPicker_targetInput==null) { + alert("Target Input is null, which means you either didn't use the 'select' function or you have no defined your own 'pickColor' function to handle the picked color!"); + return; + } + ColorPicker_targetInput.value = color; + } + +// This function is the easiest way to popup the window, select a color, and +// have the value populate a form field, which is what most people want to do. +function ColorPicker_select(inputobj,linkname) { + if (inputobj.type!="text" && inputobj.type!="hidden" && inputobj.type!="textarea") { + alert("colorpicker.select: Input object passed is not a valid form input object"); + window.ColorPicker_targetInput=null; + return; + } + window.ColorPicker_targetInput = inputobj; + this.show(linkname); + } + +// This function runs when you move your mouse over a color block, if you have a newer browser +function ColorPicker_highlightColor(c) { + var thedoc = (arguments.length>1)?arguments[1]:window.document; + var d = thedoc.getElementById("colorPickerSelectedColor"); + d.style.backgroundColor = c; + d = thedoc.getElementById("colorPickerSelectedColorValue"); + d.innerHTML = c; + } + +function ColorPicker() { + var windowMode = false; + // Create a new PopupWindow object + if (arguments.length==0) { + var divname = "colorPickerDiv"; + } + else if (arguments[0] == "window") { + var divname = ''; + windowMode = true; + } + else { + var divname = arguments[0]; + } + + if (divname != "") { + var cp = new PopupWindow(divname); + } + else { + var cp = new PopupWindow(); + cp.setSize(225,250); + } + + // Object variables + cp.currentValue = "#FFFFFF"; + + // Method Mappings + cp.writeDiv = ColorPicker_writeDiv; + cp.highlightColor = ColorPicker_highlightColor; + cp.show = ColorPicker_show; + cp.select = ColorPicker_select; + + // Code to populate color picker window + var colors = new Array( "#4180B6","#69AEE7","#000000","#000033","#000066","#000099","#0000CC","#0000FF","#330000","#330033","#330066","#330099", + "#3300CC","#3300FF","#660000","#660033","#660066","#660099","#6600CC","#6600FF","#990000","#990033","#990066","#990099", + "#9900CC","#9900FF","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#FF0000","#FF0033","#FF0066","#FF0099", + "#FF00CC","#FF00FF","#7FFFFF","#7FFFFF","#7FF7F7","#7FEFEF","#7FE7E7","#7FDFDF","#7FD7D7","#7FCFCF","#7FC7C7","#7FBFBF", + "#7FB7B7","#7FAFAF","#7FA7A7","#7F9F9F","#7F9797","#7F8F8F","#7F8787","#7F7F7F","#7F7777","#7F6F6F","#7F6767","#7F5F5F", + "#7F5757","#7F4F4F","#7F4747","#7F3F3F","#7F3737","#7F2F2F","#7F2727","#7F1F1F","#7F1717","#7F0F0F","#7F0707","#7F0000", + + "#4180B6","#69AEE7","#003300","#003333","#003366","#003399","#0033CC","#0033FF","#333300","#333333","#333366","#333399", + "#3333CC","#3333FF","#663300","#663333","#663366","#663399","#6633CC","#6633FF","#993300","#993333","#993366","#993399", + "#9933CC","#9933FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#FF3300","#FF3333","#FF3366","#FF3399", + "#FF33CC","#FF33FF","#FF7FFF","#FF7FFF","#F77FF7","#EF7FEF","#E77FE7","#DF7FDF","#D77FD7","#CF7FCF","#C77FC7","#BF7FBF", + "#B77FB7","#AF7FAF","#A77FA7","#9F7F9F","#977F97","#8F7F8F","#877F87","#7F7F7F","#777F77","#6F7F6F","#677F67","#5F7F5F", + "#577F57","#4F7F4F","#477F47","#3F7F3F","#377F37","#2F7F2F","#277F27","#1F7F1F","#177F17","#0F7F0F","#077F07","#007F00", + + "#4180B6","#69AEE7","#006600","#006633","#006666","#006699","#0066CC","#0066FF","#336600","#336633","#336666","#336699", + "#3366CC","#3366FF","#666600","#666633","#666666","#666699","#6666CC","#6666FF","#996600","#996633","#996666","#996699", + "#9966CC","#9966FF","#CC6600","#CC6633","#CC6666","#CC6699","#CC66CC","#CC66FF","#FF6600","#FF6633","#FF6666","#FF6699", + "#FF66CC","#FF66FF","#FFFF7F","#FFFF7F","#F7F77F","#EFEF7F","#E7E77F","#DFDF7F","#D7D77F","#CFCF7F","#C7C77F","#BFBF7F", + "#B7B77F","#AFAF7F","#A7A77F","#9F9F7F","#97977F","#8F8F7F","#87877F","#7F7F7F","#77777F","#6F6F7F","#67677F","#5F5F7F", + "#57577F","#4F4F7F","#47477F","#3F3F7F","#37377F","#2F2F7F","#27277F","#1F1F7F","#17177F","#0F0F7F","#07077F","#00007F", + + "#4180B6","#69AEE7","#009900","#009933","#009966","#009999","#0099CC","#0099FF","#339900","#339933","#339966","#339999", + "#3399CC","#3399FF","#669900","#669933","#669966","#669999","#6699CC","#6699FF","#999900","#999933","#999966","#999999", + "#9999CC","#9999FF","#CC9900","#CC9933","#CC9966","#CC9999","#CC99CC","#CC99FF","#FF9900","#FF9933","#FF9966","#FF9999", + "#FF99CC","#FF99FF","#3FFFFF","#3FFFFF","#3FF7F7","#3FEFEF","#3FE7E7","#3FDFDF","#3FD7D7","#3FCFCF","#3FC7C7","#3FBFBF", + "#3FB7B7","#3FAFAF","#3FA7A7","#3F9F9F","#3F9797","#3F8F8F","#3F8787","#3F7F7F","#3F7777","#3F6F6F","#3F6767","#3F5F5F", + "#3F5757","#3F4F4F","#3F4747","#3F3F3F","#3F3737","#3F2F2F","#3F2727","#3F1F1F","#3F1717","#3F0F0F","#3F0707","#3F0000", + + "#4180B6","#69AEE7","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#33CC00","#33CC33","#33CC66","#33CC99", + "#33CCCC","#33CCFF","#66CC00","#66CC33","#66CC66","#66CC99","#66CCCC","#66CCFF","#99CC00","#99CC33","#99CC66","#99CC99", + "#99CCCC","#99CCFF","#CCCC00","#CCCC33","#CCCC66","#CCCC99","#CCCCCC","#CCCCFF","#FFCC00","#FFCC33","#FFCC66","#FFCC99", + "#FFCCCC","#FFCCFF","#FF3FFF","#FF3FFF","#F73FF7","#EF3FEF","#E73FE7","#DF3FDF","#D73FD7","#CF3FCF","#C73FC7","#BF3FBF", + "#B73FB7","#AF3FAF","#A73FA7","#9F3F9F","#973F97","#8F3F8F","#873F87","#7F3F7F","#773F77","#6F3F6F","#673F67","#5F3F5F", + "#573F57","#4F3F4F","#473F47","#3F3F3F","#373F37","#2F3F2F","#273F27","#1F3F1F","#173F17","#0F3F0F","#073F07","#003F00", + + "#4180B6","#69AEE7","#00FF00","#00FF33","#00FF66","#00FF99","#00FFCC","#00FFFF","#33FF00","#33FF33","#33FF66","#33FF99", + "#33FFCC","#33FFFF","#66FF00","#66FF33","#66FF66","#66FF99","#66FFCC","#66FFFF","#99FF00","#99FF33","#99FF66","#99FF99", + "#99FFCC","#99FFFF","#CCFF00","#CCFF33","#CCFF66","#CCFF99","#CCFFCC","#CCFFFF","#FFFF00","#FFFF33","#FFFF66","#FFFF99", + "#FFFFCC","#FFFFFF","#FFFF3F","#FFFF3F","#F7F73F","#EFEF3F","#E7E73F","#DFDF3F","#D7D73F","#CFCF3F","#C7C73F","#BFBF3F", + "#B7B73F","#AFAF3F","#A7A73F","#9F9F3F","#97973F","#8F8F3F","#87873F","#7F7F3F","#77773F","#6F6F3F","#67673F","#5F5F3F", + "#57573F","#4F4F3F","#47473F","#3F3F3F","#37373F","#2F2F3F","#27273F","#1F1F3F","#17173F","#0F0F3F","#07073F","#00003F", + + "#4180B6","#69AEE7","#FFFFFF","#FFEEEE","#FFDDDD","#FFCCCC","#FFBBBB","#FFAAAA","#FF9999","#FF8888","#FF7777","#FF6666", + "#FF5555","#FF4444","#FF3333","#FF2222","#FF1111","#FF0000","#FF0000","#FF0000","#FF0000","#EE0000","#DD0000","#CC0000", + "#BB0000","#AA0000","#990000","#880000","#770000","#660000","#550000","#440000","#330000","#220000","#110000","#000000", + "#000000","#000000","#000000","#001111","#002222","#003333","#004444","#005555","#006666","#007777","#008888","#009999", + "#00AAAA","#00BBBB","#00CCCC","#00DDDD","#00EEEE","#00FFFF","#00FFFF","#00FFFF","#00FFFF","#11FFFF","#22FFFF","#33FFFF", + "#44FFFF","#55FFFF","#66FFFF","#77FFFF","#88FFFF","#99FFFF","#AAFFFF","#BBFFFF","#CCFFFF","#DDFFFF","#EEFFFF","#FFFFFF", + + "#4180B6","#69AEE7","#FFFFFF","#EEFFEE","#DDFFDD","#CCFFCC","#BBFFBB","#AAFFAA","#99FF99","#88FF88","#77FF77","#66FF66", + "#55FF55","#44FF44","#33FF33","#22FF22","#11FF11","#00FF00","#00FF00","#00FF00","#00FF00","#00EE00","#00DD00","#00CC00", + "#00BB00","#00AA00","#009900","#008800","#007700","#006600","#005500","#004400","#003300","#002200","#001100","#000000", + "#000000","#000000","#000000","#110011","#220022","#330033","#440044","#550055","#660066","#770077","#880088","#990099", + "#AA00AA","#BB00BB","#CC00CC","#DD00DD","#EE00EE","#FF00FF","#FF00FF","#FF00FF","#FF00FF","#FF11FF","#FF22FF","#FF33FF", + "#FF44FF","#FF55FF","#FF66FF","#FF77FF","#FF88FF","#FF99FF","#FFAAFF","#FFBBFF","#FFCCFF","#FFDDFF","#FFEEFF","#FFFFFF", + + "#4180B6","#69AEE7","#FFFFFF","#EEEEFF","#DDDDFF","#CCCCFF","#BBBBFF","#AAAAFF","#9999FF","#8888FF","#7777FF","#6666FF", + "#5555FF","#4444FF","#3333FF","#2222FF","#1111FF","#0000FF","#0000FF","#0000FF","#0000FF","#0000EE","#0000DD","#0000CC", + "#0000BB","#0000AA","#000099","#000088","#000077","#000066","#000055","#000044","#000033","#000022","#000011","#000000", + "#000000","#000000","#000000","#111100","#222200","#333300","#444400","#555500","#666600","#777700","#888800","#999900", + "#AAAA00","#BBBB00","#CCCC00","#DDDD00","#EEEE00","#FFFF00","#FFFF00","#FFFF00","#FFFF00","#FFFF11","#FFFF22","#FFFF33", + "#FFFF44","#FFFF55","#FFFF66","#FFFF77","#FFFF88","#FFFF99","#FFFFAA","#FFFFBB","#FFFFCC","#FFFFDD","#FFFFEE","#FFFFFF", + + "#4180B6","#69AEE7","#FFFFFF","#FFFFFF","#FBFBFB","#F7F7F7","#F3F3F3","#EFEFEF","#EBEBEB","#E7E7E7","#E3E3E3","#DFDFDF", + "#DBDBDB","#D7D7D7","#D3D3D3","#CFCFCF","#CBCBCB","#C7C7C7","#C3C3C3","#BFBFBF","#BBBBBB","#B7B7B7","#B3B3B3","#AFAFAF", + "#ABABAB","#A7A7A7","#A3A3A3","#9F9F9F","#9B9B9B","#979797","#939393","#8F8F8F","#8B8B8B","#878787","#838383","#7F7F7F", + "#7B7B7B","#777777","#737373","#6F6F6F","#6B6B6B","#676767","#636363","#5F5F5F","#5B5B5B","#575757","#535353","#4F4F4F", + "#4B4B4B","#474747","#434343","#3F3F3F","#3B3B3B","#373737","#333333","#2F2F2F","#2B2B2B","#272727","#232323","#1F1F1F", + "#1B1B1B","#171717","#131313","#0F0F0F","#0B0B0B","#070707","#030303","#000000","#000000","#000000","#000000","#000000"); + var total = colors.length; + var width = 72; + var cp_contents = ""; + var windowRef = (windowMode)?"window.opener.":""; + if (windowMode) { + cp_contents += "Select Color"; + cp_contents += ""; + } + cp_contents += ""; + var use_highlight = (document.getElementById || document.all)?true:false; + for (var i=0; i '; + if ( ((i+1)>=total) || (((i+1) % width) == 0)) { + cp_contents += ""; + } + } + // If the browser supports dynamically changing TD cells, add the fancy stuff + if (document.getElementById) { + var width1 = Math.floor(width/2); + var width2 = width = width1; + cp_contents += ""; + } + cp_contents += "
             #FFFFFF
            "; + if (windowMode) { + cp_contents += "
            "; + } + // end populate code + + // Write the contents to the popup object + cp.populate(cp_contents+"\n"); + // Move the table down a bit so you can see it + cp.offsetY = 25; + cp.autoHide(); + return cp; + } diff --git a/src/wp-includes/js/colorpicker.js b/src/wp-includes/js/colorpicker.js new file mode 100644 index 0000000..acd88a3 --- /dev/null +++ b/src/wp-includes/js/colorpicker.js @@ -0,0 +1 @@ +function getAnchorPosition(b){var e=false;var k=new Object();var j=0,g=0;var d=false,f=false,h=false;if(document.getElementById){d=true}else{if(document.all){f=true}else{if(document.layers){h=true}}}if(d&&document.all){j=AnchorPosition_getPageOffsetLeft(document.all[b]);g=AnchorPosition_getPageOffsetTop(document.all[b])}else{if(d){var a=document.getElementById(b);j=AnchorPosition_getPageOffsetLeft(a);g=AnchorPosition_getPageOffsetTop(a)}else{if(f){j=AnchorPosition_getPageOffsetLeft(document.all[b]);g=AnchorPosition_getPageOffsetTop(document.all[b])}else{if(h){var l=0;for(var c=0;cscreen.availHeight){this.y=screen.availHeight-this.height}}if(screen&&screen.availWidth){if((this.x+this.width)>screen.availWidth){this.x=screen.availWidth-this.width}}var b=window.opera||(document.layers&&!navigator.mimeTypes["*"])||navigator.vendor=="KDE"||(document.childNodes&&!document.all&&!navigator.taintEnabled);this.popupWindow=window.open(b?"":"about:blank","window_"+a,this.windowProperties+",width="+this.width+",height="+this.height+",screenX="+this.x+",left="+this.x+",screenY="+this.y+",top="+this.y+"")}this.refresh()}}function PopupWindow_hidePopup(){if(this.divName!=null){if(this.use_gebi){document.getElementById(this.divName).style.visibility="hidden"}else{if(this.use_css){document.all[this.divName].style.visibility="hidden"}else{if(this.use_layers){document.layers[this.divName].visibility="hidden"}}}}else{if(this.popupWindow&&!this.popupWindow.closed){this.popupWindow.close();this.popupWindow=null}}}function PopupWindow_isClicked(c){if(this.divName!=null){if(this.use_layers){var d=c.pageX;var b=c.pageY;var a=document.layers[this.divName];if((d>a.left)&&(da.top)&&(b0){this.type="DIV";this.divName=arguments[0]}else{this.type="WINDOW"}this.use_gebi=false;this.use_css=false;this.use_layers=false;if(document.getElementById){this.use_gebi=true}else{if(document.all){this.use_css=true}else{if(document.layers){this.use_layers=true}else{this.type="WINDOW"}}}this.offsetX=0;this.offsetY=0;this.getXYPosition=PopupWindow_getXYPosition;this.populate=PopupWindow_populate;this.setUrl=PopupWindow_setUrl;this.setWindowProperties=PopupWindow_setWindowProperties;this.refresh=PopupWindow_refresh;this.showPopup=PopupWindow_showPopup;this.hidePopup=PopupWindow_hidePopup;this.setSize=PopupWindow_setSize;this.isClicked=PopupWindow_isClicked;this.autoHide=PopupWindow_autoHide;this.hideIfNotClicked=PopupWindow_hideIfNotClicked}ColorPicker_targetInput=null;function ColorPicker_writeDiv(){document.writeln('')}function ColorPicker_show(a){this.showPopup(a)}function ColorPicker_pickColor(a,b){b.hidePopup();pickColor(a)}function pickColor(a){if(ColorPicker_targetInput==null){alert("Target Input is null, which means you either didn't use the 'select' function or you have no defined your own 'pickColor' function to handle the picked color!");return}ColorPicker_targetInput.value=a}function ColorPicker_select(b,a){if(b.type!="text"&&b.type!="hidden"&&b.type!="textarea"){alert("colorpicker.select: Input object passed is not a valid form input object");window.ColorPicker_targetInput=null;return}window.ColorPicker_targetInput=b;this.show(a)}function ColorPicker_highlightColor(e){var a=(arguments.length>1)?arguments[1]:window.document;var b=a.getElementById("colorPickerSelectedColor");b.style.backgroundColor=e;b=a.getElementById("colorPickerSelectedColorValue");b.innerHTML=e}function ColorPicker(){var g=false;if(arguments.length==0){var e="colorPickerDiv"}else{if(arguments[0]=="window"){var e="";g=true}else{var e=arguments[0]}}if(e!=""){var m=new PopupWindow(e)}else{var m=new PopupWindow();m.setSize(225,250)}m.currentValue="#FFFFFF";m.writeDiv=ColorPicker_writeDiv;m.highlightColor=ColorPicker_highlightColor;m.show=ColorPicker_show;m.select=ColorPicker_select;var a=new Array("#4180B6","#69AEE7","#000000","#000033","#000066","#000099","#0000CC","#0000FF","#330000","#330033","#330066","#330099","#3300CC","#3300FF","#660000","#660033","#660066","#660099","#6600CC","#6600FF","#990000","#990033","#990066","#990099","#9900CC","#9900FF","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#7FFFFF","#7FFFFF","#7FF7F7","#7FEFEF","#7FE7E7","#7FDFDF","#7FD7D7","#7FCFCF","#7FC7C7","#7FBFBF","#7FB7B7","#7FAFAF","#7FA7A7","#7F9F9F","#7F9797","#7F8F8F","#7F8787","#7F7F7F","#7F7777","#7F6F6F","#7F6767","#7F5F5F","#7F5757","#7F4F4F","#7F4747","#7F3F3F","#7F3737","#7F2F2F","#7F2727","#7F1F1F","#7F1717","#7F0F0F","#7F0707","#7F0000","#4180B6","#69AEE7","#003300","#003333","#003366","#003399","#0033CC","#0033FF","#333300","#333333","#333366","#333399","#3333CC","#3333FF","#663300","#663333","#663366","#663399","#6633CC","#6633FF","#993300","#993333","#993366","#993399","#9933CC","#9933FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF7FFF","#FF7FFF","#F77FF7","#EF7FEF","#E77FE7","#DF7FDF","#D77FD7","#CF7FCF","#C77FC7","#BF7FBF","#B77FB7","#AF7FAF","#A77FA7","#9F7F9F","#977F97","#8F7F8F","#877F87","#7F7F7F","#777F77","#6F7F6F","#677F67","#5F7F5F","#577F57","#4F7F4F","#477F47","#3F7F3F","#377F37","#2F7F2F","#277F27","#1F7F1F","#177F17","#0F7F0F","#077F07","#007F00","#4180B6","#69AEE7","#006600","#006633","#006666","#006699","#0066CC","#0066FF","#336600","#336633","#336666","#336699","#3366CC","#3366FF","#666600","#666633","#666666","#666699","#6666CC","#6666FF","#996600","#996633","#996666","#996699","#9966CC","#9966FF","#CC6600","#CC6633","#CC6666","#CC6699","#CC66CC","#CC66FF","#FF6600","#FF6633","#FF6666","#FF6699","#FF66CC","#FF66FF","#FFFF7F","#FFFF7F","#F7F77F","#EFEF7F","#E7E77F","#DFDF7F","#D7D77F","#CFCF7F","#C7C77F","#BFBF7F","#B7B77F","#AFAF7F","#A7A77F","#9F9F7F","#97977F","#8F8F7F","#87877F","#7F7F7F","#77777F","#6F6F7F","#67677F","#5F5F7F","#57577F","#4F4F7F","#47477F","#3F3F7F","#37377F","#2F2F7F","#27277F","#1F1F7F","#17177F","#0F0F7F","#07077F","#00007F","#4180B6","#69AEE7","#009900","#009933","#009966","#009999","#0099CC","#0099FF","#339900","#339933","#339966","#339999","#3399CC","#3399FF","#669900","#669933","#669966","#669999","#6699CC","#6699FF","#999900","#999933","#999966","#999999","#9999CC","#9999FF","#CC9900","#CC9933","#CC9966","#CC9999","#CC99CC","#CC99FF","#FF9900","#FF9933","#FF9966","#FF9999","#FF99CC","#FF99FF","#3FFFFF","#3FFFFF","#3FF7F7","#3FEFEF","#3FE7E7","#3FDFDF","#3FD7D7","#3FCFCF","#3FC7C7","#3FBFBF","#3FB7B7","#3FAFAF","#3FA7A7","#3F9F9F","#3F9797","#3F8F8F","#3F8787","#3F7F7F","#3F7777","#3F6F6F","#3F6767","#3F5F5F","#3F5757","#3F4F4F","#3F4747","#3F3F3F","#3F3737","#3F2F2F","#3F2727","#3F1F1F","#3F1717","#3F0F0F","#3F0707","#3F0000","#4180B6","#69AEE7","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#66CC00","#66CC33","#66CC66","#66CC99","#66CCCC","#66CCFF","#99CC00","#99CC33","#99CC66","#99CC99","#99CCCC","#99CCFF","#CCCC00","#CCCC33","#CCCC66","#CCCC99","#CCCCCC","#CCCCFF","#FFCC00","#FFCC33","#FFCC66","#FFCC99","#FFCCCC","#FFCCFF","#FF3FFF","#FF3FFF","#F73FF7","#EF3FEF","#E73FE7","#DF3FDF","#D73FD7","#CF3FCF","#C73FC7","#BF3FBF","#B73FB7","#AF3FAF","#A73FA7","#9F3F9F","#973F97","#8F3F8F","#873F87","#7F3F7F","#773F77","#6F3F6F","#673F67","#5F3F5F","#573F57","#4F3F4F","#473F47","#3F3F3F","#373F37","#2F3F2F","#273F27","#1F3F1F","#173F17","#0F3F0F","#073F07","#003F00","#4180B6","#69AEE7","#00FF00","#00FF33","#00FF66","#00FF99","#00FFCC","#00FFFF","#33FF00","#33FF33","#33FF66","#33FF99","#33FFCC","#33FFFF","#66FF00","#66FF33","#66FF66","#66FF99","#66FFCC","#66FFFF","#99FF00","#99FF33","#99FF66","#99FF99","#99FFCC","#99FFFF","#CCFF00","#CCFF33","#CCFF66","#CCFF99","#CCFFCC","#CCFFFF","#FFFF00","#FFFF33","#FFFF66","#FFFF99","#FFFFCC","#FFFFFF","#FFFF3F","#FFFF3F","#F7F73F","#EFEF3F","#E7E73F","#DFDF3F","#D7D73F","#CFCF3F","#C7C73F","#BFBF3F","#B7B73F","#AFAF3F","#A7A73F","#9F9F3F","#97973F","#8F8F3F","#87873F","#7F7F3F","#77773F","#6F6F3F","#67673F","#5F5F3F","#57573F","#4F4F3F","#47473F","#3F3F3F","#37373F","#2F2F3F","#27273F","#1F1F3F","#17173F","#0F0F3F","#07073F","#00003F","#4180B6","#69AEE7","#FFFFFF","#FFEEEE","#FFDDDD","#FFCCCC","#FFBBBB","#FFAAAA","#FF9999","#FF8888","#FF7777","#FF6666","#FF5555","#FF4444","#FF3333","#FF2222","#FF1111","#FF0000","#FF0000","#FF0000","#FF0000","#EE0000","#DD0000","#CC0000","#BB0000","#AA0000","#990000","#880000","#770000","#660000","#550000","#440000","#330000","#220000","#110000","#000000","#000000","#000000","#000000","#001111","#002222","#003333","#004444","#005555","#006666","#007777","#008888","#009999","#00AAAA","#00BBBB","#00CCCC","#00DDDD","#00EEEE","#00FFFF","#00FFFF","#00FFFF","#00FFFF","#11FFFF","#22FFFF","#33FFFF","#44FFFF","#55FFFF","#66FFFF","#77FFFF","#88FFFF","#99FFFF","#AAFFFF","#BBFFFF","#CCFFFF","#DDFFFF","#EEFFFF","#FFFFFF","#4180B6","#69AEE7","#FFFFFF","#EEFFEE","#DDFFDD","#CCFFCC","#BBFFBB","#AAFFAA","#99FF99","#88FF88","#77FF77","#66FF66","#55FF55","#44FF44","#33FF33","#22FF22","#11FF11","#00FF00","#00FF00","#00FF00","#00FF00","#00EE00","#00DD00","#00CC00","#00BB00","#00AA00","#009900","#008800","#007700","#006600","#005500","#004400","#003300","#002200","#001100","#000000","#000000","#000000","#000000","#110011","#220022","#330033","#440044","#550055","#660066","#770077","#880088","#990099","#AA00AA","#BB00BB","#CC00CC","#DD00DD","#EE00EE","#FF00FF","#FF00FF","#FF00FF","#FF00FF","#FF11FF","#FF22FF","#FF33FF","#FF44FF","#FF55FF","#FF66FF","#FF77FF","#FF88FF","#FF99FF","#FFAAFF","#FFBBFF","#FFCCFF","#FFDDFF","#FFEEFF","#FFFFFF","#4180B6","#69AEE7","#FFFFFF","#EEEEFF","#DDDDFF","#CCCCFF","#BBBBFF","#AAAAFF","#9999FF","#8888FF","#7777FF","#6666FF","#5555FF","#4444FF","#3333FF","#2222FF","#1111FF","#0000FF","#0000FF","#0000FF","#0000FF","#0000EE","#0000DD","#0000CC","#0000BB","#0000AA","#000099","#000088","#000077","#000066","#000055","#000044","#000033","#000022","#000011","#000000","#000000","#000000","#000000","#111100","#222200","#333300","#444400","#555500","#666600","#777700","#888800","#999900","#AAAA00","#BBBB00","#CCCC00","#DDDD00","#EEEE00","#FFFF00","#FFFF00","#FFFF00","#FFFF00","#FFFF11","#FFFF22","#FFFF33","#FFFF44","#FFFF55","#FFFF66","#FFFF77","#FFFF88","#FFFF99","#FFFFAA","#FFFFBB","#FFFFCC","#FFFFDD","#FFFFEE","#FFFFFF","#4180B6","#69AEE7","#FFFFFF","#FFFFFF","#FBFBFB","#F7F7F7","#F3F3F3","#EFEFEF","#EBEBEB","#E7E7E7","#E3E3E3","#DFDFDF","#DBDBDB","#D7D7D7","#D3D3D3","#CFCFCF","#CBCBCB","#C7C7C7","#C3C3C3","#BFBFBF","#BBBBBB","#B7B7B7","#B3B3B3","#AFAFAF","#ABABAB","#A7A7A7","#A3A3A3","#9F9F9F","#9B9B9B","#979797","#939393","#8F8F8F","#8B8B8B","#878787","#838383","#7F7F7F","#7B7B7B","#777777","#737373","#6F6F6F","#6B6B6B","#676767","#636363","#5F5F5F","#5B5B5B","#575757","#535353","#4F4F4F","#4B4B4B","#474747","#434343","#3F3F3F","#3B3B3B","#373737","#333333","#2F2F2F","#2B2B2B","#272727","#232323","#1F1F1F","#1B1B1B","#171717","#131313","#0F0F0F","#0B0B0B","#070707","#030303","#000000","#000000","#000000","#000000","#000000");var n=a.length;var c=72;var k="";var j=(g)?"window.opener.":"";if(g){k+="Select Color";k+=""}k+="";var l=(document.getElementById||document.all)?true:false;for(var h=0;h"}if(l){var f='onMouseOver="'+j+"ColorPicker_highlightColor('"+a[h]+"',window.document)\""}else{f=""}k+='";if(((h+1)>=n)||(((h+1)%c)==0)){k+=""}}if(document.getElementById){var d=Math.floor(c/2);var b=c=d;k+=""}k+="
             
             #FFFFFF
            ";if(g){k+="
            "}m.populate(k+"\n");m.offsetY=25;m.autoHide();return m}; \ No newline at end of file diff --git a/src/wp-includes/js/comment-reply.dev.js b/src/wp-includes/js/comment-reply.dev.js new file mode 100644 index 0000000..2015425 --- /dev/null +++ b/src/wp-includes/js/comment-reply.dev.js @@ -0,0 +1,48 @@ + +addComment = { + moveForm : function(commId, parentId, respondId, postId) { + var t = this, div, comm = t.I(commId), respond = t.I(respondId), cancel = t.I('cancel-comment-reply-link'), parent = t.I('comment_parent'), post = t.I('comment_post_ID'); + + if ( ! comm || ! respond || ! cancel || ! parent ) + return; + + t.respondId = respondId; + postId = postId || false; + + if ( ! t.I('wp-temp-form-div') ) { + div = document.createElement('div'); + div.id = 'wp-temp-form-div'; + div.style.display = 'none'; + respond.parentNode.insertBefore(div, respond); + } + + comm.parentNode.insertBefore(respond, comm.nextSibling); + if ( post && postId ) + post.value = postId; + parent.value = parentId; + cancel.style.display = ''; + + cancel.onclick = function() { + var t = addComment, temp = t.I('wp-temp-form-div'), respond = t.I(t.respondId); + + if ( ! temp || ! respond ) + return; + + t.I('comment_parent').value = '0'; + temp.parentNode.insertBefore(respond, temp); + temp.parentNode.removeChild(temp); + this.style.display = 'none'; + this.onclick = null; + return false; + } + + try { t.I('comment').focus(); } + catch(e) {} + + return false; + }, + + I : function(e) { + return document.getElementById(e); + } +} diff --git a/src/wp-includes/js/comment-reply.js b/src/wp-includes/js/comment-reply.js new file mode 100644 index 0000000..524f2ed --- /dev/null +++ b/src/wp-includes/js/comment-reply.js @@ -0,0 +1 @@ +addComment={moveForm:function(d,f,i,c){var m=this,a,h=m.I(d),b=m.I(i),l=m.I("cancel-comment-reply-link"),j=m.I("comment_parent"),k=m.I("comment_post_ID");if(!h||!b||!l||!j){return}m.respondId=i;c=c||false;if(!m.I("wp-temp-form-div")){a=document.createElement("div");a.id="wp-temp-form-div";a.style.display="none";b.parentNode.insertBefore(a,b)}h.parentNode.insertBefore(b,h.nextSibling);if(k&&c){k.value=c}j.value=f;l.style.display="";l.onclick=function(){var n=addComment,e=n.I("wp-temp-form-div"),o=n.I(n.respondId);if(!e||!o){return}n.I("comment_parent").value="0";e.parentNode.insertBefore(o,e);e.parentNode.removeChild(e);this.style.display="none";this.onclick=null;return false};try{m.I("comment").focus()}catch(g){}return false},I:function(a){return document.getElementById(a)}}; \ No newline at end of file diff --git a/src/wp-includes/js/crop/cropper.css b/src/wp-includes/js/crop/cropper.css new file mode 100644 index 0000000..973f178 --- /dev/null +++ b/src/wp-includes/js/crop/cropper.css @@ -0,0 +1,165 @@ +.imgCrop_wrap { + /* width: 500px; @done_in_js */ + /* height: 375px; @done_in_js */ + position: relative; + cursor: crosshair; +} + +/* an extra classname is applied for Opera < 9.0 to fix it's lack of opacity support */ +.imgCrop_wrap.opera8 .imgCrop_overlay, +.imgCrop_wrap.opera8 .imgCrop_clickArea { + background-color: transparent; +} + +/* fix for IE displaying all boxes at line-height by default, although they are still 1 pixel high until we combine them with the pointless span */ +.imgCrop_wrap, +.imgCrop_wrap * { + font-size: 0; +} + +.imgCrop_overlay { + background-color: #000; + opacity: 0.5; + filter:alpha(opacity=50); + position: absolute; + width: 100%; + height: 100%; +} + +.imgCrop_selArea { + position: absolute; + /* @done_in_js + top: 20px; + left: 20px; + width: 200px; + height: 200px; + background: transparent url(castle.jpg) no-repeat -210px -110px; + */ + cursor: move; + z-index: 2; +} + +/* clickArea is all a fix for IE 5.5 & 6 to allow the user to click on the given area */ +.imgCrop_clickArea { + width: 100%; + height: 100%; + background-color: #FFF; + opacity: 0.01; + filter:alpha(opacity=01); +} + +.imgCrop_marqueeHoriz { + position: absolute; + width: 100%; + height: 1px; + background: transparent url(marqueeHoriz.gif) repeat-x 0 0; + z-index: 3; +} + +.imgCrop_marqueeVert { + position: absolute; + height: 100%; + width: 1px; + background: transparent url(marqueeVert.gif) repeat-y 0 0; + z-index: 3; +} + +.imgCrop_marqueeNorth { top: 0; left: 0; } +.imgCrop_marqueeEast { top: 0; right: 0; } +.imgCrop_marqueeSouth { bottom: 0px; left: 0; } +.imgCrop_marqueeWest { top: 0; left: 0; } + + +.imgCrop_handle { + position: absolute; + border: 1px solid #333; + width: 6px; + height: 6px; + background: #FFF; + opacity: 0.5; + filter:alpha(opacity=50); + z-index: 4; +} + +/* fix IE 5 box model */ +* html .imgCrop_handle { + width: 8px; + height: 8px; + wid\th: 6px; + hei\ght: 6px; +} + +.imgCrop_handleN { + top: -3px; + left: 0; + /* margin-left: 49%; @done_in_js */ + cursor: n-resize; +} + +.imgCrop_handleNE { + top: -3px; + right: -3px; + cursor: ne-resize; +} + +.imgCrop_handleE { + top: 0; + right: -3px; + /* margin-top: 49%; @done_in_js */ + cursor: e-resize; +} + +.imgCrop_handleSE { + right: -3px; + bottom: -3px; + cursor: se-resize; +} + +.imgCrop_handleS { + right: 0; + bottom: -3px; + /* margin-right: 49%; @done_in_js */ + cursor: s-resize; +} + +.imgCrop_handleSW { + left: -3px; + bottom: -3px; + cursor: sw-resize; +} + +.imgCrop_handleW { + top: 0; + left: -3px; + /* margin-top: 49%; @done_in_js */ + cursor: e-resize; +} + +.imgCrop_handleNW { + top: -3px; + left: -3px; + cursor: nw-resize; +} + +/** + * Create an area to click & drag around on as the default browser behaviour is to let you drag the image + */ +.imgCrop_dragArea { + width: 100%; + height: 100%; + z-index: 200; + position: absolute; + top: 0; + left: 0; +} + +.imgCrop_previewWrap { + /* width: 200px; @done_in_js */ + /* height: 200px; @done_in_js */ + overflow: hidden; + position: relative; +} + +.imgCrop_previewWrap img { + position: absolute; +} \ No newline at end of file diff --git a/src/wp-includes/js/crop/cropper.js b/src/wp-includes/js/crop/cropper.js new file mode 100644 index 0000000..d0cb8e4 --- /dev/null +++ b/src/wp-includes/js/crop/cropper.js @@ -0,0 +1,516 @@ +/** + * Copyright (c) 2006, David Spurr (http://www.defusion.org.uk/) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + * * Neither the name of the David Spurr nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * http://www.opensource.org/licenses/bsd-license.php + * + * See scriptaculous.js for full scriptaculous licence + */ + +var CropDraggable=Class.create(); +Object.extend(Object.extend(CropDraggable.prototype,Draggable.prototype),{initialize:function(_1){ +this.options=Object.extend({drawMethod:function(){ +}},arguments[1]||{}); +this.element=$(_1); +this.handle=this.element; +this.delta=this.currentDelta(); +this.dragging=false; +this.eventMouseDown=this.initDrag.bindAsEventListener(this); +Event.observe(this.handle,"mousedown",this.eventMouseDown); +Draggables.register(this); +},draw:function(_2){ +var _3=Position.cumulativeOffset(this.element); +var d=this.currentDelta(); +_3[0]-=d[0]; +_3[1]-=d[1]; +var p=[0,1].map(function(i){ +return (_2[i]-_3[i]-this.offset[i]); +}.bind(this)); +this.options.drawMethod(p); +}}); +var Cropper={}; +Cropper.Img=Class.create(); +Cropper.Img.prototype={initialize:function(_7,_8){ +this.options=Object.extend({ratioDim:{x:0,y:0},minWidth:0,minHeight:0,displayOnInit:false,onEndCrop:Prototype.emptyFunction,captureKeys:true},_8||{}); +if(this.options.minWidth>0&&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; +} +}}); diff --git a/src/wp-includes/js/crop/marqueeHoriz.gif b/src/wp-includes/js/crop/marqueeHoriz.gif new file mode 100644 index 0000000..25317e5 Binary files /dev/null and b/src/wp-includes/js/crop/marqueeHoriz.gif differ diff --git a/src/wp-includes/js/crop/marqueeVert.gif b/src/wp-includes/js/crop/marqueeVert.gif new file mode 100644 index 0000000..354070b Binary files /dev/null and b/src/wp-includes/js/crop/marqueeVert.gif differ diff --git a/src/wp-includes/js/hoverIntent.dev.js b/src/wp-includes/js/hoverIntent.dev.js new file mode 100644 index 0000000..5cbf978 --- /dev/null +++ b/src/wp-includes/js/hoverIntent.dev.js @@ -0,0 +1,128 @@ +/** +* hoverIntent is similar to jQuery's built-in "hover" function except that +* instead of firing the onMouseOver event immediately, hoverIntent checks +* to see if the user's mouse has slowed down (beneath the sensitivity +* threshold) before firing the onMouseOver event. +* +* hoverIntent r5 // 2007.03.27 // jQuery 1.1.2+ +* +* +* hoverIntent is currently available for use in all personal or commercial +* projects under both MIT and GPL licenses. This means that you can choose +* the license that best suits your project, and use it accordingly. +* +* // basic usage (just like .hover) receives onMouseOver and onMouseOut functions +* $("ul li").hoverIntent( showNav , hideNav ); +* +* // advanced usage receives configuration object only +* $("ul li").hoverIntent({ +* sensitivity: 7, // number = sensitivity threshold (must be 1 or higher) +* interval: 100, // number = milliseconds of polling interval +* over: showNav, // function = onMouseOver callback (required) +* timeout: 0, // number = milliseconds delay before onMouseOut function call +* out: hideNav // function = onMouseOut callback (required) +* }); +* +* @param f onMouseOver function || An object with configuration options +* @param g onMouseOut function || Nothing (use configuration options object) +* @author Brian Cherne +*/ +(function($) { + $.fn.hoverIntent = function(f,g) { + // default configuration options + var cfg = { + sensitivity: 7, + interval: 100, + timeout: 0 + }; + // override configuration options with user supplied object + cfg = $.extend(cfg, g ? { over: f, out: g } : f ); + + // instantiate variables + // cX, cY = current X and Y position of mouse, updated by mousemove event + // pX, pY = previous X and Y position of mouse, set by mouseover and polling interval + var cX, cY, pX, pY; + + // A private function for getting mouse position + var track = function(ev) { + cX = ev.pageX; + cY = ev.pageY; + }; + + // A private function for comparing current and previous mouse position + var compare = function(ev,ob) { + ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t); + // compare mouse positions to see if they've crossed the threshold + if ( ( Math.abs(pX-cX) + Math.abs(pY-cY) ) < cfg.sensitivity ) { + $(ob).unbind("mousemove",track); + // set hoverIntent state to true (so mouseOut can be called) + ob.hoverIntent_s = 1; + return cfg.over.apply(ob,[ev]); + } else { + // set previous coordinates for next time + pX = cX; pY = cY; + // use self-calling timeout, guarantees intervals are spaced out properly (avoids JavaScript timer bugs) + ob.hoverIntent_t = setTimeout( function(){compare(ev, ob);} , cfg.interval ); + } + }; + + // A private function for delaying the mouseOut function + var delay = function(ev,ob) { + ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t); + ob.hoverIntent_s = 0; + return cfg.out.apply(ob,[ev]); + }; + + // workaround for Mozilla bug: not firing mouseout/mouseleave on absolute positioned elements over textareas and input type="text" + var handleHover = function(e) { + var t = this; + + // next two lines copied from jQuery.hover, ignore children onMouseOver/onMouseOut + var p = (e.type == "mouseover" ? e.fromElement : e.toElement) || e.relatedTarget; + while ( p && p != this ) { try { p = p.parentNode; } catch(e) { p = this; } } + if ( p == this ) { + if ( $.browser.mozilla ) { + if ( e.type == "mouseout" ) { + t.mtout = setTimeout( function(){doHover(e,t);}, 30 ); + } else { + if (t.mtout) { t.mtout = clearTimeout(t.mtout); } + } + } + return; + } else { + if (t.mtout) { t.mtout = clearTimeout(t.mtout); } + doHover(e,t); + } + }; + + // A private function for handling mouse 'hovering' + var doHover = function(e,ob) { + + // copy objects to be passed into t (required for event object to be passed in IE) + var ev = jQuery.extend({},e); + + // cancel hoverIntent timer if it exists + if (ob.hoverIntent_t) { ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t); } + + // else e.type == "onmouseover" + if (e.type == "mouseover") { + // set "previous" X and Y position based on initial entry point + pX = ev.pageX; pY = ev.pageY; + // update "current" X and Y position based on mousemove + $(ob).bind("mousemove",track); + // start polling interval (self-calling timeout) to compare mouse coordinates over time + if (ob.hoverIntent_s != 1) { ob.hoverIntent_t = setTimeout( function(){compare(ev,ob);} , cfg.interval );} + + // else e.type == "onmouseout" + } else { + // unbind expensive mousemove event + $(ob).unbind("mousemove",track); + // if hoverIntent state is true, then call the mouseOut function after the specified delay + if (ob.hoverIntent_s == 1) { ob.hoverIntent_t = setTimeout( function(){delay(ev,ob);} , cfg.timeout );} + } + }; + + // bind the function to the two event listeners + return this.mouseover(handleHover).mouseout(handleHover); + }; +})(jQuery); \ No newline at end of file diff --git a/src/wp-includes/js/hoverIntent.js b/src/wp-includes/js/hoverIntent.js new file mode 100644 index 0000000..bed4129 --- /dev/null +++ b/src/wp-includes/js/hoverIntent.js @@ -0,0 +1 @@ +(function(a){a.fn.hoverIntent=function(l,j){var m={sensitivity:7,interval:100,timeout:0};m=a.extend(m,j?{over:l,out:j}:l);var o,n,h,d;var e=function(f){o=f.pageX;n=f.pageY};var c=function(g,f){f.hoverIntent_t=clearTimeout(f.hoverIntent_t);if((Math.abs(h-o)+Math.abs(d-n))'); +} + +$.imgAreaSelect = function (img, options) { + var + + $img = $(img), + + imgLoaded, + + $box = div(), + $area = div(), + $border = div().add(div()).add(div()).add(div()), + $outer = div().add(div()).add(div()).add(div()), + $handles = $([]), + + $areaOpera, + + left, top, + + imgOfs = { left: 0, top: 0 }, + + imgWidth, imgHeight, + + $parent, + + parOfs = { left: 0, top: 0 }, + + zIndex = 0, + + position = 'absolute', + + startX, startY, + + scaleX, scaleY, + + resizeMargin = 10, + + resize, + + minWidth, minHeight, maxWidth, maxHeight, + + aspectRatio, + + shown, + + x1, y1, x2, y2, + + selection = { x1: 0, y1: 0, x2: 0, y2: 0, width: 0, height: 0 }, + + docElem = document.documentElement, + + $p, d, i, o, w, h, adjusted; + + function viewX(x) { + return x + imgOfs.left - parOfs.left; + } + + function viewY(y) { + return y + imgOfs.top - parOfs.top; + } + + function selX(x) { + return x - imgOfs.left + parOfs.left; + } + + function selY(y) { + return y - imgOfs.top + parOfs.top; + } + + function evX(event) { + return event.pageX - parOfs.left; + } + + function evY(event) { + return event.pageY - parOfs.top; + } + + function getSelection(noScale) { + var sx = noScale || scaleX, sy = noScale || scaleY; + + return { x1: round(selection.x1 * sx), + y1: round(selection.y1 * sy), + x2: round(selection.x2 * sx), + y2: round(selection.y2 * sy), + width: round(selection.x2 * sx) - round(selection.x1 * sx), + height: round(selection.y2 * sy) - round(selection.y1 * sy) }; + } + + function setSelection(x1, y1, x2, y2, noScale) { + var sx = noScale || scaleX, sy = noScale || scaleY; + + selection = { + x1: round(x1 / sx || 0), + y1: round(y1 / sy || 0), + x2: round(x2 / sx || 0), + y2: round(y2 / sy || 0) + }; + + selection.width = selection.x2 - selection.x1; + selection.height = selection.y2 - selection.y1; + } + + function adjust() { + if (!$img.width()) + return; + + imgOfs = { left: round($img.offset().left), top: round($img.offset().top) }; + + imgWidth = $img.innerWidth(); + imgHeight = $img.innerHeight(); + + imgOfs.top += ($img.outerHeight() - imgHeight) >> 1; + imgOfs.left += ($img.outerWidth() - imgWidth) >> 1; + + minWidth = options.minWidth || 0; + minHeight = options.minHeight || 0; + maxWidth = min(options.maxWidth || 1<<24, imgWidth); + maxHeight = min(options.maxHeight || 1<<24, imgHeight); + + if ($().jquery == '1.3.2' && position == 'fixed' && + !docElem['getBoundingClientRect']) + { + imgOfs.top += max(document.body.scrollTop, docElem.scrollTop); + imgOfs.left += max(document.body.scrollLeft, docElem.scrollLeft); + } + + parOfs = $.inArray($parent.css('position'), ['absolute', 'relative']) + 1 ? + { left: round($parent.offset().left) - $parent.scrollLeft(), + top: round($parent.offset().top) - $parent.scrollTop() } : + position == 'fixed' ? + { left: $(document).scrollLeft(), top: $(document).scrollTop() } : + { left: 0, top: 0 }; + + left = viewX(0); + top = viewY(0); + + if (selection.x2 > imgWidth || selection.y2 > imgHeight) + doResize(); + } + + function update(resetKeyPress) { + if (!shown) return; + + $box.css({ left: viewX(selection.x1), top: viewY(selection.y1) }) + .add($area).width(w = selection.width).height(h = selection.height); + + $area.add($border).add($handles).css({ left: 0, top: 0 }); + + $border + .width(max(w - $border.outerWidth() + $border.innerWidth(), 0)) + .height(max(h - $border.outerHeight() + $border.innerHeight(), 0)); + + $($outer[0]).css({ left: left, top: top, + width: selection.x1, height: imgHeight }); + $($outer[1]).css({ left: left + selection.x1, top: top, + width: w, height: selection.y1 }); + $($outer[2]).css({ left: left + selection.x2, top: top, + width: imgWidth - selection.x2, height: imgHeight }); + $($outer[3]).css({ left: left + selection.x1, top: top + selection.y2, + width: w, height: imgHeight - selection.y2 }); + + w -= $handles.outerWidth(); + h -= $handles.outerHeight(); + + switch ($handles.length) { + case 8: + $($handles[4]).css({ left: w >> 1 }); + $($handles[5]).css({ left: w, top: h >> 1 }); + $($handles[6]).css({ left: w >> 1, top: h }); + $($handles[7]).css({ top: h >> 1 }); + case 4: + $handles.slice(1,3).css({ left: w }); + $handles.slice(2,4).css({ top: h }); + } + + if (resetKeyPress !== false) { + if ($.imgAreaSelect.keyPress != docKeyPress) + $(document).unbind($.imgAreaSelect.keyPress, + $.imgAreaSelect.onKeyPress); + + if (options.keys) + $(document)[$.imgAreaSelect.keyPress]( + $.imgAreaSelect.onKeyPress = docKeyPress); + } + + if ($.browser.msie && $border.outerWidth() - $border.innerWidth() == 2) { + $border.css('margin', 0); + setTimeout(function () { $border.css('margin', 'auto'); }, 0); + } + } + + function doUpdate(resetKeyPress) { + adjust(); + update(resetKeyPress); + x1 = viewX(selection.x1); y1 = viewY(selection.y1); + x2 = viewX(selection.x2); y2 = viewY(selection.y2); + } + + function hide($elem, fn) { + options.fadeSpeed ? $elem.fadeOut(options.fadeSpeed, fn) : $elem.hide(); + + } + + function areaMouseMove(event) { + var x = selX(evX(event)) - selection.x1, + y = selY(evY(event)) - selection.y1; + + if (!adjusted) { + adjust(); + adjusted = true; + + $box.one('mouseout', function () { adjusted = false; }); + } + + resize = ''; + + if (options.resizable) { + if (y <= options.resizeMargin) + resize = 'n'; + else if (y >= selection.height - options.resizeMargin) + resize = 's'; + if (x <= options.resizeMargin) + resize += 'w'; + else if (x >= selection.width - options.resizeMargin) + resize += 'e'; + } + + $box.css('cursor', resize ? resize + '-resize' : + options.movable ? 'move' : ''); + if ($areaOpera) + $areaOpera.toggle(); + } + + function docMouseUp(event) { + $('body').css('cursor', ''); + if (options.autoHide || selection.width * selection.height == 0) + hide($box.add($outer), function () { $(this).hide(); }); + + $(document).unbind('mousemove', selectingMouseMove); + $box.mousemove(areaMouseMove); + + options.onSelectEnd(img, getSelection()); + } + + function areaMouseDown(event) { + if (event.which != 1) return false; + + adjust(); + + if (resize) { + $('body').css('cursor', resize + '-resize'); + + x1 = viewX(selection[/w/.test(resize) ? 'x2' : 'x1']); + y1 = viewY(selection[/n/.test(resize) ? 'y2' : 'y1']); + + $(document).mousemove(selectingMouseMove) + .one('mouseup', docMouseUp); + $box.unbind('mousemove', areaMouseMove); + } + else if (options.movable) { + startX = left + selection.x1 - evX(event); + startY = top + selection.y1 - evY(event); + + $box.unbind('mousemove', areaMouseMove); + + $(document).mousemove(movingMouseMove) + .one('mouseup', function () { + options.onSelectEnd(img, getSelection()); + + $(document).unbind('mousemove', movingMouseMove); + $box.mousemove(areaMouseMove); + }); + } + else + $img.mousedown(event); + + return false; + } + + function fixAspectRatio(xFirst) { + if (aspectRatio) + if (xFirst) { + x2 = max(left, min(left + imgWidth, + x1 + abs(y2 - y1) * aspectRatio * (x2 > x1 || -1))); + + y2 = round(max(top, min(top + imgHeight, + y1 + abs(x2 - x1) / aspectRatio * (y2 > y1 || -1)))); + x2 = round(x2); + } + else { + y2 = max(top, min(top + imgHeight, + y1 + abs(x2 - x1) / aspectRatio * (y2 > y1 || -1))); + x2 = round(max(left, min(left + imgWidth, + x1 + abs(y2 - y1) * aspectRatio * (x2 > x1 || -1)))); + y2 = round(y2); + } + } + + function doResize() { + x1 = min(x1, left + imgWidth); + y1 = min(y1, top + imgHeight); + + if (abs(x2 - x1) < minWidth) { + x2 = x1 - minWidth * (x2 < x1 || -1); + + if (x2 < left) + x1 = left + minWidth; + else if (x2 > left + imgWidth) + x1 = left + imgWidth - minWidth; + } + + if (abs(y2 - y1) < minHeight) { + y2 = y1 - minHeight * (y2 < y1 || -1); + + if (y2 < top) + y1 = top + minHeight; + else if (y2 > top + imgHeight) + y1 = top + imgHeight - minHeight; + } + + x2 = max(left, min(x2, left + imgWidth)); + y2 = max(top, min(y2, top + imgHeight)); + + fixAspectRatio(abs(x2 - x1) < abs(y2 - y1) * aspectRatio); + + if (abs(x2 - x1) > maxWidth) { + x2 = x1 - maxWidth * (x2 < x1 || -1); + fixAspectRatio(); + } + + if (abs(y2 - y1) > maxHeight) { + y2 = y1 - maxHeight * (y2 < y1 || -1); + fixAspectRatio(true); + } + + selection = { x1: selX(min(x1, x2)), x2: selX(max(x1, x2)), + y1: selY(min(y1, y2)), y2: selY(max(y1, y2)), + width: abs(x2 - x1), height: abs(y2 - y1) }; + + update(); + + options.onSelectChange(img, getSelection()); + } + + function selectingMouseMove(event) { + x2 = resize == '' || /w|e/.test(resize) || aspectRatio ? evX(event) : viewX(selection.x2); + y2 = resize == '' || /n|s/.test(resize) || aspectRatio ? evY(event) : viewY(selection.y2); + + doResize(); + + return false; + + } + + function doMove(newX1, newY1) { + x2 = (x1 = newX1) + selection.width; + y2 = (y1 = newY1) + selection.height; + + $.extend(selection, { x1: selX(x1), y1: selY(y1), x2: selX(x2), + y2: selY(y2) }); + + update(); + + options.onSelectChange(img, getSelection()); + } + + function movingMouseMove(event) { + x1 = max(left, min(startX + evX(event), left + imgWidth - selection.width)); + y1 = max(top, min(startY + evY(event), top + imgHeight - selection.height)); + + doMove(x1, y1); + + event.preventDefault(); + + return false; + } + + function startSelection() { + $(document).unbind('mousemove', startSelection); + adjust(); + + x2 = x1; + y2 = y1; + + doResize(); + + resize = ''; + + if ($outer.is(':not(:visible)')) + $box.add($outer).hide().fadeIn(options.fadeSpeed||0); + + shown = true; + + $(document).unbind('mouseup', cancelSelection) + .mousemove(selectingMouseMove).one('mouseup', docMouseUp); + $box.unbind('mousemove', areaMouseMove); + + options.onSelectStart(img, getSelection()); + } + + function cancelSelection() { + $(document).unbind('mousemove', startSelection) + .unbind('mouseup', cancelSelection); + hide($box.add($outer)); + + setSelection(selX(x1), selY(y1), selX(x1), selY(y1)); + + options.onSelectChange(img, getSelection()); + options.onSelectEnd(img, getSelection()); + } + + function imgMouseDown(event) { + if (event.which != 1 || $outer.is(':animated')) return false; + + adjust(); + startX = x1 = evX(event); + startY = y1 = evY(event); + + $(document).mousemove(startSelection).mouseup(cancelSelection); + + return false; + } + + function windowResize() { + doUpdate(false); + } + + function imgLoad() { + imgLoaded = true; + + setOptions(options = $.extend({ + classPrefix: 'imgareaselect', + movable: true, + parent: 'body', + resizable: true, + resizeMargin: 10, + onInit: function () {}, + onSelectStart: function () {}, + onSelectChange: function () {}, + onSelectEnd: function () {} + }, options)); + + $box.add($outer).css({ visibility: '' }); + + if (options.show) { + shown = true; + adjust(); + update(); + $box.add($outer).hide().fadeIn(options.fadeSpeed||0); + } + + setTimeout(function () { options.onInit(img, getSelection()); }, 0); + } + + var docKeyPress = function(event) { + var k = options.keys, d, t, key = event.keyCode; + + d = !isNaN(k.alt) && (event.altKey || event.originalEvent.altKey) ? k.alt : + !isNaN(k.ctrl) && event.ctrlKey ? k.ctrl : + !isNaN(k.shift) && event.shiftKey ? k.shift : + !isNaN(k.arrows) ? k.arrows : 10; + + if (k.arrows == 'resize' || (k.shift == 'resize' && event.shiftKey) || + (k.ctrl == 'resize' && event.ctrlKey) || + (k.alt == 'resize' && (event.altKey || event.originalEvent.altKey))) + { + switch (key) { + case 37: + d = -d; + case 39: + t = max(x1, x2); + x1 = min(x1, x2); + x2 = max(t + d, x1); + fixAspectRatio(); + break; + case 38: + d = -d; + case 40: + t = max(y1, y2); + y1 = min(y1, y2); + y2 = max(t + d, y1); + fixAspectRatio(true); + break; + default: + return; + } + + doResize(); + } + else { + x1 = min(x1, x2); + y1 = min(y1, y2); + + switch (key) { + case 37: + doMove(max(x1 - d, left), y1); + break; + case 38: + doMove(x1, max(y1 - d, top)); + break; + case 39: + doMove(x1 + min(d, imgWidth - selX(x2)), y1); + break; + case 40: + doMove(x1, y1 + min(d, imgHeight - selY(y2))); + break; + default: + return; + } + } + + return false; + }; + + function styleOptions($elem, props) { + for (option in props) + if (options[option] !== undefined) + $elem.css(props[option], options[option]); + } + + function setOptions(newOptions) { + if (newOptions.parent) + ($parent = $(newOptions.parent)).append($box.add($outer)); + + $.extend(options, newOptions); + + adjust(); + + if (newOptions.handles != null) { + $handles.remove(); + $handles = $([]); + + i = newOptions.handles ? newOptions.handles == 'corners' ? 4 : 8 : 0; + + while (i--) + $handles = $handles.add(div()); + + $handles.addClass(options.classPrefix + '-handle').css({ + position: 'absolute', + fontSize: 0, + zIndex: zIndex + 1 || 1 + }); + + if (!parseInt($handles.css('width')) >= 0) + $handles.width(5).height(5); + + if (o = options.borderWidth) + $handles.css({ borderWidth: o, borderStyle: 'solid' }); + + styleOptions($handles, { borderColor1: 'border-color', + borderColor2: 'background-color', + borderOpacity: 'opacity' }); + } + + scaleX = options.imageWidth / imgWidth || 1; + scaleY = options.imageHeight / imgHeight || 1; + + if (newOptions.x1 != null) { + setSelection(newOptions.x1, newOptions.y1, newOptions.x2, + newOptions.y2); + newOptions.show = !newOptions.hide; + } + + if (newOptions.keys) + options.keys = $.extend({ shift: 1, ctrl: 'resize' }, + newOptions.keys); + + $outer.addClass(options.classPrefix + '-outer'); + $area.addClass(options.classPrefix + '-selection'); + for (i = 0; i++ < 4;) + $($border[i-1]).addClass(options.classPrefix + '-border' + i); + + styleOptions($area, { selectionColor: 'background-color', + selectionOpacity: 'opacity' }); + styleOptions($border, { borderOpacity: 'opacity', + borderWidth: 'border-width' }); + styleOptions($outer, { outerColor: 'background-color', + outerOpacity: 'opacity' }); + if (o = options.borderColor1) + $($border[0]).css({ borderStyle: 'solid', borderColor: o }); + if (o = options.borderColor2) + $($border[1]).css({ borderStyle: 'dashed', borderColor: o }); + + $box.append($area.add($border).add($areaOpera).add($handles)); + + if ($.browser.msie) { + if (o = $outer.css('filter').match(/opacity=([0-9]+)/)) + $outer.css('opacity', o[1]/100); + if (o = $border.css('filter').match(/opacity=([0-9]+)/)) + $border.css('opacity', o[1]/100); + } + + if (newOptions.hide) + hide($box.add($outer)); + else if (newOptions.show && imgLoaded) { + shown = true; + $box.add($outer).fadeIn(options.fadeSpeed||0); + doUpdate(); + } + + aspectRatio = (d = (options.aspectRatio || '').split(/:/))[0] / d[1]; + + $img.add($outer).unbind('mousedown', imgMouseDown); + + if (options.disable || options.enable === false) { + $box.unbind('mousemove', areaMouseMove).unbind('mousedown', areaMouseDown); + $(window).unbind('resize', windowResize); + } + else { + if (options.enable || options.disable === false) { + if (options.resizable || options.movable) + $box.mousemove(areaMouseMove).mousedown(areaMouseDown); + + $(window).resize(windowResize); + } + + if (!options.persistent) + $img.add($outer).mousedown(imgMouseDown); + } + + options.enable = options.disable = undefined; + } + + this.remove = function () { + setOptions({ disable: true }); + $box.add($outer).remove(); + }; + + this.getOptions = function () { return options; }; + + this.setOptions = setOptions; + + this.getSelection = getSelection; + + this.setSelection = setSelection; + + this.update = doUpdate; + + $p = $img; + + while ($p.length) { + zIndex = max(zIndex, + !isNaN($p.css('z-index')) ? $p.css('z-index') : zIndex); + if ($p.css('position') == 'fixed') + position = 'fixed'; + + $p = $p.parent(':not(body)'); + } + + zIndex = options.zIndex || zIndex; + + if ($.browser.msie) + $img.attr('unselectable', 'on'); + + $.imgAreaSelect.keyPress = $.browser.msie || + $.browser.safari ? 'keydown' : 'keypress'; + + if ($.browser.opera) + $areaOpera = div().css({ width: '100%', height: '100%', + position: 'absolute', zIndex: zIndex + 2 || 2 }); + + $box.add($outer).css({ visibility: 'hidden', position: position, + overflow: 'hidden', zIndex: zIndex || '0' }); + $box.css({ zIndex: zIndex + 2 || 2 }); + $area.add($border).css({ position: 'absolute', fontSize: 0 }); + + img.complete || img.readyState == 'complete' || !$img.is('img') ? + imgLoad() : $img.one('load', imgLoad); + + if ($.browser.msie && $.browser.version >= 9) + img.src = img.src; +}; + +$.fn.imgAreaSelect = function (options) { + options = options || {}; + + this.each(function () { + if ($(this).data('imgAreaSelect')) { + if (options.remove) { + $(this).data('imgAreaSelect').remove(); + $(this).removeData('imgAreaSelect'); + } + else + $(this).data('imgAreaSelect').setOptions(options); + } + else if (!options.remove) { + if (options.enable === undefined && options.disable === undefined) + options.enable = true; + + $(this).data('imgAreaSelect', new $.imgAreaSelect(this, options)); + } + }); + + if (options.instance) + return $(this).data('imgAreaSelect'); + + return this; +}; + +})(jQuery); diff --git a/src/wp-includes/js/imgareaselect/jquery.imgareaselect.js b/src/wp-includes/js/imgareaselect/jquery.imgareaselect.js new file mode 100644 index 0000000..a29d667 --- /dev/null +++ b/src/wp-includes/js/imgareaselect/jquery.imgareaselect.js @@ -0,0 +1 @@ +(function(e){var b=Math.abs,a=Math.max,d=Math.min,c=Math.round;function f(){return e("
            ")}e.imgAreaSelect=function(Q,ad){var M=e(Q),u,B=f(),E=f(),ap=f().add(f()).add(f()).add(f()),v=f().add(f()).add(f()).add(f()),ax=e([]),aj,T,ao,ay={left:0,top:0},S,aA,p,V={left:0,top:0},g=0,ak="absolute",an,am,ab,aa,az=10,t,q,al,k,x,aE,ah,D,n,C,l,aC={x1:0,y1:0,x2:0,y2:0,width:0,height:0},F=document.documentElement,Z,R,O,N,K,P,I;function Y(h){return h+ay.left-V.left}function X(h){return h+ay.top-V.top}function au(h){return h-ay.left+V.left}function at(h){return h-ay.top+V.top}function A(h){return h.pageX-V.left}function z(h){return h.pageY-V.top}function ar(h){var o=h||ab,i=h||aa;return{x1:c(aC.x1*o),y1:c(aC.y1*i),x2:c(aC.x2*o),y2:c(aC.y2*i),width:c(aC.x2*o)-c(aC.x1*o),height:c(aC.y2*i)-c(aC.y1*i)}}function aq(i,w,h,o,aF){var aH=aF||ab,aG=aF||aa;aC={x1:c(i/aH||0),y1:c(w/aG||0),x2:c(h/aH||0),y2:c(o/aG||0)};aC.width=aC.x2-aC.x1;aC.height=aC.y2-aC.y1}function m(){if(!M.width()){return}ay={left:c(M.offset().left),top:c(M.offset().top)};S=M.innerWidth();aA=M.innerHeight();ay.top+=(M.outerHeight()-aA)>>1;ay.left+=(M.outerWidth()-S)>>1;q=ad.minWidth||0;al=ad.minHeight||0;k=d(ad.maxWidth||1<<24,S);x=d(ad.maxHeight||1<<24,aA);if(e().jquery=="1.3.2"&&ak=="fixed"&&!F.getBoundingClientRect){ay.top+=a(document.body.scrollTop,F.scrollTop);ay.left+=a(document.body.scrollLeft,F.scrollLeft)}V=e.inArray(p.css("position"),["absolute","relative"])+1?{left:c(p.offset().left)-p.scrollLeft(),top:c(p.offset().top)-p.scrollTop()}:ak=="fixed"?{left:e(document).scrollLeft(),top:e(document).scrollTop()}:{left:0,top:0};T=Y(0);ao=X(0);if(aC.x2>S||aC.y2>aA){aB()}}function J(h){if(!ah){return}B.css({left:Y(aC.x1),top:X(aC.y1)}).add(E).width(K=aC.width).height(P=aC.height);E.add(ap).add(ax).css({left:0,top:0});ap.width(a(K-ap.outerWidth()+ap.innerWidth(),0)).height(a(P-ap.outerHeight()+ap.innerHeight(),0));e(v[0]).css({left:T,top:ao,width:aC.x1,height:aA});e(v[1]).css({left:T+aC.x1,top:ao,width:K,height:aC.y1});e(v[2]).css({left:T+aC.x2,top:ao,width:S-aC.x2,height:aA});e(v[3]).css({left:T+aC.x1,top:ao+aC.y2,width:K,height:aA-aC.y2});K-=ax.outerWidth();P-=ax.outerHeight();switch(ax.length){case 8:e(ax[4]).css({left:K>>1});e(ax[5]).css({left:K,top:P>>1});e(ax[6]).css({left:K>>1,top:P});e(ax[7]).css({top:P>>1});case 4:ax.slice(1,3).css({left:K});ax.slice(2,4).css({top:P})}if(h!==false){if(e.imgAreaSelect.keyPress!=av){e(document).unbind(e.imgAreaSelect.keyPress,e.imgAreaSelect.onKeyPress)}if(ad.keys){e(document)[e.imgAreaSelect.keyPress](e.imgAreaSelect.onKeyPress=av)}}if(e.browser.msie&&ap.outerWidth()-ap.innerWidth()==2){ap.css("margin",0);setTimeout(function(){ap.css("margin","auto")},0)}}function y(h){m();J(h);D=Y(aC.x1);n=X(aC.y1);C=Y(aC.x2);l=X(aC.y2)}function ag(h,i){ad.fadeSpeed?h.fadeOut(ad.fadeSpeed,i):h.hide()}function H(i){var h=au(A(i))-aC.x1,o=at(z(i))-aC.y1;if(!I){m();I=true;B.one("mouseout",function(){I=false})}t="";if(ad.resizable){if(o<=ad.resizeMargin){t="n"}else{if(o>=aC.height-ad.resizeMargin){t="s"}}if(h<=ad.resizeMargin){t+="w"}else{if(h>=aC.width-ad.resizeMargin){t+="e"}}}B.css("cursor",t?t+"-resize":ad.movable?"move":"");if(aj){aj.toggle()}}function j(h){e("body").css("cursor","");if(ad.autoHide||aC.width*aC.height==0){ag(B.add(v),function(){e(this).hide()})}e(document).unbind("mousemove",ae);B.mousemove(H);ad.onSelectEnd(Q,ar())}function aw(h){if(h.which!=1){return false}m();if(t){e("body").css("cursor",t+"-resize");D=Y(aC[/w/.test(t)?"x2":"x1"]);n=X(aC[/n/.test(t)?"y2":"y1"]);e(document).mousemove(ae).one("mouseup",j);B.unbind("mousemove",H)}else{if(ad.movable){an=T+aC.x1-A(h);am=ao+aC.y1-z(h);B.unbind("mousemove",H);e(document).mousemove(ac).one("mouseup",function(){ad.onSelectEnd(Q,ar());e(document).unbind("mousemove",ac);B.mousemove(H)})}else{M.mousedown(h)}}return false}function L(h){if(aE){if(h){C=a(T,d(T+S,D+b(l-n)*aE*(C>D||-1)));l=c(a(ao,d(ao+aA,n+b(C-D)/aE*(l>n||-1))));C=c(C)}else{l=a(ao,d(ao+aA,n+b(C-D)/aE*(l>n||-1)));C=c(a(T,d(T+S,D+b(l-n)*aE*(C>D||-1))));l=c(l)}}}function aB(){D=d(D,T+S);n=d(n,ao+aA);if(b(C-D)T+S){D=T+S-q}}}if(b(l-n)ao+aA){n=ao+aA-al}}}C=a(T,d(C,T+S));l=a(ao,d(l,ao+aA));L(b(C-D)k){C=D-k*(Cx){l=n-x*(l=0){ax.width(5).height(5)}if(N=ad.borderWidth){ax.css({borderWidth:N,borderStyle:"solid"})}G(ax,{borderColor1:"border-color",borderColor2:"background-color",borderOpacity:"opacity"})}ab=ad.imageWidth/S||1;aa=ad.imageHeight/aA||1;if(h.x1!=null){aq(h.x1,h.y1,h.x2,h.y2);h.show=!h.hide}if(h.keys){ad.keys=e.extend({shift:1,ctrl:"resize"},h.keys)}v.addClass(ad.classPrefix+"-outer");E.addClass(ad.classPrefix+"-selection");for(O=0;O++<4;){e(ap[O-1]).addClass(ad.classPrefix+"-border"+O)}G(E,{selectionColor:"background-color",selectionOpacity:"opacity"});G(ap,{borderOpacity:"opacity",borderWidth:"border-width"});G(v,{outerColor:"background-color",outerOpacity:"opacity"});if(N=ad.borderColor1){e(ap[0]).css({borderStyle:"solid",borderColor:N})}if(N=ad.borderColor2){e(ap[1]).css({borderStyle:"dashed",borderColor:N})}B.append(E.add(ap).add(aj).add(ax));if(e.browser.msie){if(N=v.css("filter").match(/opacity=([0-9]+)/)){v.css("opacity",N[1]/100)}if(N=ap.css("filter").match(/opacity=([0-9]+)/)){ap.css("opacity",N[1]/100)}}if(h.hide){ag(B.add(v))}else{if(h.show&&u){ah=true;B.add(v).fadeIn(ad.fadeSpeed||0);y()}}aE=(R=(ad.aspectRatio||"").split(/:/))[0]/R[1];M.add(v).unbind("mousedown",aD);if(ad.disable||ad.enable===false){B.unbind("mousemove",H).unbind("mousedown",aw);e(window).unbind("resize",ai)}else{if(ad.enable||ad.disable===false){if(ad.resizable||ad.movable){B.mousemove(H).mousedown(aw)}e(window).resize(ai)}if(!ad.persistent){M.add(v).mousedown(aD)}}ad.enable=ad.disable=undefined}this.remove=function(){af({disable:true});B.add(v).remove()};this.getOptions=function(){return ad};this.setOptions=af;this.getSelection=ar;this.setSelection=aq;this.update=y;Z=M;while(Z.length){g=a(g,!isNaN(Z.css("z-index"))?Z.css("z-index"):g);if(Z.css("position")=="fixed"){ak="fixed"}Z=Z.parent(":not(body)")}g=ad.zIndex||g;if(e.browser.msie){M.attr("unselectable","on")}e.imgAreaSelect.keyPress=e.browser.msie||e.browser.safari?"keydown":"keypress";if(e.browser.opera){aj=f().css({width:"100%",height:"100%",position:"absolute",zIndex:g+2||2})}B.add(v).css({visibility:"hidden",position:ak,overflow:"hidden",zIndex:g||"0"});B.css({zIndex:g+2||2});E.add(ap).css({position:"absolute",fontSize:0});Q.complete||Q.readyState=="complete"||!M.is("img")?s():M.one("load",s);if(e.browser.msie&&e.browser.version>=9){Q.src=Q.src}};e.fn.imgAreaSelect=function(g){g=g||{};this.each(function(){if(e(this).data("imgAreaSelect")){if(g.remove){e(this).data("imgAreaSelect").remove();e(this).removeData("imgAreaSelect")}else{e(this).data("imgAreaSelect").setOptions(g)}}else{if(!g.remove){if(g.enable===undefined&&g.disable===undefined){g.enable=true}e(this).data("imgAreaSelect",new e.imgAreaSelect(this,g))}}});if(g.instance){return e(this).data("imgAreaSelect")}return this}})(jQuery); \ No newline at end of file diff --git a/src/wp-includes/js/jcrop/Jcrop.gif b/src/wp-includes/js/jcrop/Jcrop.gif new file mode 100644 index 0000000..72ea7cc Binary files /dev/null and b/src/wp-includes/js/jcrop/Jcrop.gif differ diff --git a/src/wp-includes/js/jcrop/jquery.Jcrop.css b/src/wp-includes/js/jcrop/jquery.Jcrop.css new file mode 100644 index 0000000..24925dc --- /dev/null +++ b/src/wp-includes/js/jcrop/jquery.Jcrop.css @@ -0,0 +1,35 @@ +/* Fixes issue here http://code.google.com/p/jcrop/issues/detail?id=1 */ +.jcrop-holder { text-align: left; } + +.jcrop-vline, .jcrop-hline +{ + font-size: 0; + position: absolute; + background: white url('Jcrop.gif') top left repeat; +} +.jcrop-vline { height: 100%; width: 1px !important; } +.jcrop-hline { width: 100%; height: 1px !important; } +.jcrop-handle { + font-size: 1px; + width: 7px !important; + height: 7px !important; + border: 1px #eee solid; + background-color: #333; + *width: 9px; + *height: 9px; +} + +.jcrop-tracker { width: 100%; height: 100%; } + +.custom .jcrop-vline, +.custom .jcrop-hline +{ + background: yellow; +} +.custom .jcrop-handle +{ + border-color: black; + background-color: #C7BB00; + -moz-border-radius: 3px; + -webkit-border-radius: 3px; +} diff --git a/src/wp-includes/js/jcrop/jquery.Jcrop.dev.js b/src/wp-includes/js/jcrop/jquery.Jcrop.dev.js new file mode 100644 index 0000000..ad261f9 --- /dev/null +++ b/src/wp-includes/js/jcrop/jquery.Jcrop.dev.js @@ -0,0 +1,1197 @@ +/** + * jquery.Jcrop.js v0.9.8 + * jQuery Image Cropping Plugin + * @author Kelly Hallman + * Copyright (c) 2008-2009 Kelly Hallman - released under MIT License {{{ + * + * 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. + + * }}} + */ + +(function($) { + +$.Jcrop = function(obj,opt) +{ + // Initialization {{{ + + // Sanitize some options {{{ + var obj = obj, opt = opt; + + if (typeof(obj) !== 'object') obj = $(obj)[0]; + if (typeof(opt) !== 'object') opt = { }; + + // Some on-the-fly fixes for MSIE...sigh + if (!('trackDocument' in opt)) + { + opt.trackDocument = $.browser.msie ? false : true; + if ($.browser.msie && $.browser.version.split('.')[0] == '8') + opt.trackDocument = true; + } + + if (!('keySupport' in opt)) + opt.keySupport = $.browser.msie ? false : true; + + // }}} + // Extend the default options {{{ + var defaults = { + + // Basic Settings + trackDocument: false, + baseClass: 'jcrop', + addClass: null, + + // Styling Options + bgColor: 'black', + bgOpacity: .6, + borderOpacity: .4, + handleOpacity: .5, + + handlePad: 5, + handleSize: 9, + handleOffset: 5, + edgeMargin: 14, + + aspectRatio: 0, + keySupport: true, + cornerHandles: true, + sideHandles: true, + drawBorders: true, + dragEdges: true, + + boxWidth: 0, + boxHeight: 0, + + boundary: 8, + animationDelay: 20, + swingSpeed: 3, + + allowSelect: true, + allowMove: true, + allowResize: true, + + minSelect: [ 0, 0 ], + maxSize: [ 0, 0 ], + minSize: [ 0, 0 ], + + // Callbacks / Event Handlers + onChange: function() { }, + onSelect: function() { } + + }; + var options = defaults; + setOptions(opt); + + // }}} + // Initialize some jQuery objects {{{ + + var $origimg = $(obj); + var $img = $origimg.clone().removeAttr('id').css({ position: 'absolute' }); + + $img.width($origimg.width()); + $img.height($origimg.height()); + $origimg.after($img).hide(); + + presize($img,options.boxWidth,options.boxHeight); + + var boundx = $img.width(), + boundy = $img.height(), + + $div = $('
            ') + .width(boundx).height(boundy) + .addClass(cssClass('holder')) + .css({ + position: 'relative', + backgroundColor: options.bgColor + }).insertAfter($origimg).append($img); + ; + + if (options.addClass) $div.addClass(options.addClass); + //$img.wrap($div); + + var $img2 = $('')/*{{{*/ + .attr('src',$img.attr('src')) + .css('position','absolute') + .width(boundx).height(boundy) + ;/*}}}*/ + var $img_holder = $('
            ')/*{{{*/ + .width(pct(100)).height(pct(100)) + .css({ + zIndex: 310, + position: 'absolute', + overflow: 'hidden' + }) + .append($img2) + ;/*}}}*/ + var $hdl_holder = $('
            ')/*{{{*/ + .width(pct(100)).height(pct(100)) + .css('zIndex',320); + /*}}}*/ + var $sel = $('
            ')/*{{{*/ + .css({ + position: 'absolute', + zIndex: 300 + }) + .insertBefore($img) + .append($img_holder,$hdl_holder) + ;/*}}}*/ + + var bound = options.boundary; + var $trk = newTracker().width(boundx+(bound*2)).height(boundy+(bound*2)) + .css({ position: 'absolute', top: px(-bound), left: px(-bound), zIndex: 290 }) + .mousedown(newSelection); + + /* }}} */ + // Set more variables {{{ + + var xlimit, ylimit, xmin, ymin; + var xscale, yscale, enabled = true; + var docOffset = getPos($img), + // Internal states + btndown, lastcurs, dimmed, animating, + shift_down; + + // }}} + + + // }}} + // Internal Modules {{{ + + var Coords = function()/*{{{*/ + { + var x1 = 0, y1 = 0, x2 = 0, y2 = 0, ox, oy; + + function setPressed(pos)/*{{{*/ + { + var pos = rebound(pos); + x2 = x1 = pos[0]; + y2 = y1 = pos[1]; + }; + /*}}}*/ + function setCurrent(pos)/*{{{*/ + { + var pos = rebound(pos); + ox = pos[0] - x2; + oy = pos[1] - y2; + x2 = pos[0]; + y2 = pos[1]; + }; + /*}}}*/ + function getOffset()/*{{{*/ + { + return [ ox, oy ]; + }; + /*}}}*/ + function moveOffset(offset)/*{{{*/ + { + var ox = offset[0], oy = offset[1]; + + if (0 > x1 + ox) ox -= ox + x1; + if (0 > y1 + oy) oy -= oy + y1; + + if (boundy < y2 + oy) oy += boundy - (y2 + oy); + if (boundx < x2 + ox) ox += boundx - (x2 + ox); + + x1 += ox; + x2 += ox; + y1 += oy; + y2 += oy; + }; + /*}}}*/ + function getCorner(ord)/*{{{*/ + { + var c = getFixed(); + switch(ord) + { + case 'ne': return [ c.x2, c.y ]; + case 'nw': return [ c.x, c.y ]; + case 'se': return [ c.x2, c.y2 ]; + case 'sw': return [ c.x, c.y2 ]; + } + }; + /*}}}*/ + function getFixed()/*{{{*/ + { + if (!options.aspectRatio) return getRect(); + // This function could use some optimization I think... + var aspect = options.aspectRatio, + min_x = options.minSize[0]/xscale, + min_y = options.minSize[1]/yscale, + max_x = options.maxSize[0]/xscale, + max_y = options.maxSize[1]/yscale, + rw = x2 - x1, + rh = y2 - y1, + rwa = Math.abs(rw), + rha = Math.abs(rh), + real_ratio = rwa / rha, + xx, yy + ; + if (max_x == 0) { max_x = boundx * 10 } + if (max_y == 0) { max_y = boundy * 10 } + if (real_ratio < aspect) + { + yy = y2; + w = rha * aspect; + xx = rw < 0 ? x1 - w : w + x1; + + if (xx < 0) + { + xx = 0; + h = Math.abs((xx - x1) / aspect); + yy = rh < 0 ? y1 - h: h + y1; + } + else if (xx > boundx) + { + xx = boundx; + h = Math.abs((xx - x1) / aspect); + yy = rh < 0 ? y1 - h : h + y1; + } + } + else + { + xx = x2; + h = rwa / aspect; + yy = rh < 0 ? y1 - h : y1 + h; + if (yy < 0) + { + yy = 0; + w = Math.abs((yy - y1) * aspect); + xx = rw < 0 ? x1 - w : w + x1; + } + else if (yy > boundy) + { + yy = boundy; + w = Math.abs(yy - y1) * aspect; + xx = rw < 0 ? x1 - w : w + x1; + } + } + + // Magic %-) + if(xx > x1) { // right side + if(xx - x1 < min_x) { + xx = x1 + min_x; + } else if (xx - x1 > max_x) { + xx = x1 + max_x; + } + if(yy > y1) { + yy = y1 + (xx - x1)/aspect; + } else { + yy = y1 - (xx - x1)/aspect; + } + } else if (xx < x1) { // left side + if(x1 - xx < min_x) { + xx = x1 - min_x + } else if (x1 - xx > max_x) { + xx = x1 - max_x; + } + if(yy > y1) { + yy = y1 + (x1 - xx)/aspect; + } else { + yy = y1 - (x1 - xx)/aspect; + } + } + + if(xx < 0) { + x1 -= xx; + xx = 0; + } else if (xx > boundx) { + x1 -= xx - boundx; + xx = boundx; + } + + if(yy < 0) { + y1 -= yy; + yy = 0; + } else if (yy > boundy) { + y1 -= yy - boundy; + yy = boundy; + } + + return last = makeObj(flipCoords(x1,y1,xx,yy)); + }; + /*}}}*/ + function rebound(p)/*{{{*/ + { + if (p[0] < 0) p[0] = 0; + if (p[1] < 0) p[1] = 0; + + if (p[0] > boundx) p[0] = boundx; + if (p[1] > boundy) p[1] = boundy; + + return [ p[0], p[1] ]; + }; + /*}}}*/ + function flipCoords(x1,y1,x2,y2)/*{{{*/ + { + var xa = x1, xb = x2, ya = y1, yb = y2; + if (x2 < x1) + { + xa = x2; + xb = x1; + } + if (y2 < y1) + { + ya = y2; + yb = y1; + } + return [ Math.round(xa), Math.round(ya), Math.round(xb), Math.round(yb) ]; + }; + /*}}}*/ + function getRect()/*{{{*/ + { + var xsize = x2 - x1; + var ysize = y2 - y1; + + if (xlimit && (Math.abs(xsize) > xlimit)) + x2 = (xsize > 0) ? (x1 + xlimit) : (x1 - xlimit); + if (ylimit && (Math.abs(ysize) > ylimit)) + y2 = (ysize > 0) ? (y1 + ylimit) : (y1 - ylimit); + + if (ymin && (Math.abs(ysize) < ymin)) + y2 = (ysize > 0) ? (y1 + ymin) : (y1 - ymin); + if (xmin && (Math.abs(xsize) < xmin)) + x2 = (xsize > 0) ? (x1 + xmin) : (x1 - xmin); + + if (x1 < 0) { x2 -= x1; x1 -= x1; } + if (y1 < 0) { y2 -= y1; y1 -= y1; } + if (x2 < 0) { x1 -= x2; x2 -= x2; } + if (y2 < 0) { y1 -= y2; y2 -= y2; } + if (x2 > boundx) { var delta = x2 - boundx; x1 -= delta; x2 -= delta; } + if (y2 > boundy) { var delta = y2 - boundy; y1 -= delta; y2 -= delta; } + if (x1 > boundx) { var delta = x1 - boundy; y2 -= delta; y1 -= delta; } + if (y1 > boundy) { var delta = y1 - boundy; y2 -= delta; y1 -= delta; } + + return makeObj(flipCoords(x1,y1,x2,y2)); + }; + /*}}}*/ + function makeObj(a)/*{{{*/ + { + return { x: a[0], y: a[1], x2: a[2], y2: a[3], + w: a[2] - a[0], h: a[3] - a[1] }; + }; + /*}}}*/ + + return { + flipCoords: flipCoords, + setPressed: setPressed, + setCurrent: setCurrent, + getOffset: getOffset, + moveOffset: moveOffset, + getCorner: getCorner, + getFixed: getFixed + }; + }(); + + /*}}}*/ + var Selection = function()/*{{{*/ + { + var start, end, dragmode, awake, hdep = 370; + var borders = { }; + var handle = { }; + var seehandles = false; + var hhs = options.handleOffset; + + /* Insert draggable elements {{{*/ + + // Insert border divs for outline + if (options.drawBorders) { + borders = { + top: insertBorder('hline') + .css('top',$.browser.msie?px(-1):px(0)), + bottom: insertBorder('hline'), + left: insertBorder('vline'), + right: insertBorder('vline') + }; + } + + // Insert handles on edges + if (options.dragEdges) { + handle.t = insertDragbar('n'); + handle.b = insertDragbar('s'); + handle.r = insertDragbar('e'); + handle.l = insertDragbar('w'); + } + + // Insert side handles + options.sideHandles && + createHandles(['n','s','e','w']); + + // Insert corner handles + options.cornerHandles && + createHandles(['sw','nw','ne','se']); + + /*}}}*/ + // Private Methods + function insertBorder(type)/*{{{*/ + { + var jq = $('
            ') + .css({position: 'absolute', opacity: options.borderOpacity }) + .addClass(cssClass(type)); + $img_holder.append(jq); + return jq; + }; + /*}}}*/ + function dragDiv(ord,zi)/*{{{*/ + { + var jq = $('
            ') + .mousedown(createDragger(ord)) + .css({ + cursor: ord+'-resize', + position: 'absolute', + zIndex: zi + }) + ; + $hdl_holder.append(jq); + return jq; + }; + /*}}}*/ + function insertHandle(ord)/*{{{*/ + { + return dragDiv(ord,hdep++) + .css({ top: px(-hhs+1), left: px(-hhs+1), opacity: options.handleOpacity }) + .addClass(cssClass('handle')); + }; + /*}}}*/ + function insertDragbar(ord)/*{{{*/ + { + var s = options.handleSize, + o = hhs, + h = s, w = s, + t = o, l = o; + + switch(ord) + { + case 'n': case 's': w = pct(100); break; + case 'e': case 'w': h = pct(100); break; + } + + return dragDiv(ord,hdep++).width(w).height(h) + .css({ top: px(-t+1), left: px(-l+1)}); + }; + /*}}}*/ + function createHandles(li)/*{{{*/ + { + for(i in li) handle[li[i]] = insertHandle(li[i]); + }; + /*}}}*/ + function moveHandles(c)/*{{{*/ + { + var midvert = Math.round((c.h / 2) - hhs), + midhoriz = Math.round((c.w / 2) - hhs), + north = west = -hhs+1, + east = c.w - hhs, + south = c.h - hhs, + x, y; + + 'e' in handle && + handle.e.css({ top: px(midvert), left: px(east) }) && + handle.w.css({ top: px(midvert) }) && + handle.s.css({ top: px(south), left: px(midhoriz) }) && + handle.n.css({ left: px(midhoriz) }); + + 'ne' in handle && + handle.ne.css({ left: px(east) }) && + handle.se.css({ top: px(south), left: px(east) }) && + handle.sw.css({ top: px(south) }); + + 'b' in handle && + handle.b.css({ top: px(south) }) && + handle.r.css({ left: px(east) }); + }; + /*}}}*/ + function moveto(x,y)/*{{{*/ + { + $img2.css({ top: px(-y), left: px(-x) }); + $sel.css({ top: px(y), left: px(x) }); + }; + /*}}}*/ + function resize(w,h)/*{{{*/ + { + $sel.width(w).height(h); + }; + /*}}}*/ + function refresh()/*{{{*/ + { + var c = Coords.getFixed(); + + Coords.setPressed([c.x,c.y]); + Coords.setCurrent([c.x2,c.y2]); + + updateVisible(); + }; + /*}}}*/ + + // Internal Methods + function updateVisible()/*{{{*/ + { if (awake) return update(); }; + /*}}}*/ + function update()/*{{{*/ + { + var c = Coords.getFixed(); + + resize(c.w,c.h); + moveto(c.x,c.y); + + options.drawBorders && + borders['right'].css({ left: px(c.w-1) }) && + borders['bottom'].css({ top: px(c.h-1) }); + + seehandles && moveHandles(c); + awake || show(); + + options.onChange(unscale(c)); + }; + /*}}}*/ + function show()/*{{{*/ + { + $sel.show(); + $img.css('opacity',options.bgOpacity); + awake = true; + }; + /*}}}*/ + function release()/*{{{*/ + { + disableHandles(); + $sel.hide(); + $img.css('opacity',1); + awake = false; + }; + /*}}}*/ + function showHandles()//{{{ + { + if (seehandles) + { + moveHandles(Coords.getFixed()); + $hdl_holder.show(); + } + }; + //}}} + function enableHandles()/*{{{*/ + { + seehandles = true; + if (options.allowResize) + { + moveHandles(Coords.getFixed()); + $hdl_holder.show(); + return true; + } + }; + /*}}}*/ + function disableHandles()/*{{{*/ + { + seehandles = false; + $hdl_holder.hide(); + }; + /*}}}*/ + function animMode(v)/*{{{*/ + { + (animating = v) ? disableHandles(): enableHandles(); + }; + /*}}}*/ + function done()/*{{{*/ + { + animMode(false); + refresh(); + }; + /*}}}*/ + + var $track = newTracker().mousedown(createDragger('move')) + .css({ cursor: 'move', position: 'absolute', zIndex: 360 }) + + $img_holder.append($track); + disableHandles(); + + return { + updateVisible: updateVisible, + update: update, + release: release, + refresh: refresh, + setCursor: function (cursor) { $track.css('cursor',cursor); }, + enableHandles: enableHandles, + enableOnly: function() { seehandles = true; }, + showHandles: showHandles, + disableHandles: disableHandles, + animMode: animMode, + done: done + }; + }(); + /*}}}*/ + var Tracker = function()/*{{{*/ + { + var onMove = function() { }, + onDone = function() { }, + trackDoc = options.trackDocument; + + if (!trackDoc) + { + $trk + .mousemove(trackMove) + .mouseup(trackUp) + .mouseout(trackUp) + ; + } + + function toFront()/*{{{*/ + { + $trk.css({zIndex:450}); + if (trackDoc) + { + $(document) + .mousemove(trackMove) + .mouseup(trackUp) + ; + } + } + /*}}}*/ + function toBack()/*{{{*/ + { + $trk.css({zIndex:290}); + if (trackDoc) + { + $(document) + .unbind('mousemove',trackMove) + .unbind('mouseup',trackUp) + ; + } + } + /*}}}*/ + function trackMove(e)/*{{{*/ + { + onMove(mouseAbs(e)); + }; + /*}}}*/ + function trackUp(e)/*{{{*/ + { + e.preventDefault(); + e.stopPropagation(); + + if (btndown) + { + btndown = false; + + onDone(mouseAbs(e)); + options.onSelect(unscale(Coords.getFixed())); + toBack(); + onMove = function() { }; + onDone = function() { }; + } + + return false; + }; + /*}}}*/ + + function activateHandlers(move,done)/* {{{ */ + { + btndown = true; + onMove = move; + onDone = done; + toFront(); + return false; + }; + /* }}} */ + + function setCursor(t) { $trk.css('cursor',t); }; + + $img.before($trk); + return { + activateHandlers: activateHandlers, + setCursor: setCursor + }; + }(); + /*}}}*/ + var KeyManager = function()/*{{{*/ + { + var $keymgr = $('') + .css({ position: 'absolute', left: '-30px' }) + .keypress(parseKey) + .blur(onBlur), + + $keywrap = $('
            ') + .css({ + position: 'absolute', + overflow: 'hidden' + }) + .append($keymgr) + ; + + function watchKeys()/*{{{*/ + { + if (options.keySupport) + { + $keymgr.show(); + $keymgr.focus(); + } + }; + /*}}}*/ + function onBlur(e)/*{{{*/ + { + $keymgr.hide(); + }; + /*}}}*/ + function doNudge(e,x,y)/*{{{*/ + { + if (options.allowMove) { + Coords.moveOffset([x,y]); + Selection.updateVisible(); + }; + e.preventDefault(); + e.stopPropagation(); + }; + /*}}}*/ + function parseKey(e)/*{{{*/ + { + if (e.ctrlKey) return true; + shift_down = e.shiftKey ? true : false; + var nudge = shift_down ? 10 : 1; + switch(e.keyCode) + { + case 37: doNudge(e,-nudge,0); break; + case 39: doNudge(e,nudge,0); break; + case 38: doNudge(e,0,-nudge); break; + case 40: doNudge(e,0,nudge); break; + + case 27: Selection.release(); break; + + case 9: return true; + } + + return nothing(e); + }; + /*}}}*/ + + if (options.keySupport) $keywrap.insertBefore($img); + return { + watchKeys: watchKeys + }; + }(); + /*}}}*/ + + // }}} + // Internal Methods {{{ + + function px(n) { return '' + parseInt(n) + 'px'; }; + function pct(n) { return '' + parseInt(n) + '%'; }; + function cssClass(cl) { return options.baseClass + '-' + cl; }; + function getPos(obj)/*{{{*/ + { + // Updated in v0.9.4 to use built-in dimensions plugin + var pos = $(obj).offset(); + return [ pos.left, pos.top ]; + }; + /*}}}*/ + function mouseAbs(e)/*{{{*/ + { + return [ (e.pageX - docOffset[0]), (e.pageY - docOffset[1]) ]; + }; + /*}}}*/ + function myCursor(type)/*{{{*/ + { + if (type != lastcurs) + { + Tracker.setCursor(type); + //Handles.xsetCursor(type); + lastcurs = type; + } + }; + /*}}}*/ + function startDragMode(mode,pos)/*{{{*/ + { + docOffset = getPos($img); + Tracker.setCursor(mode=='move'?mode:mode+'-resize'); + + if (mode == 'move') + return Tracker.activateHandlers(createMover(pos), doneSelect); + + var fc = Coords.getFixed(); + var opp = oppLockCorner(mode); + var opc = Coords.getCorner(oppLockCorner(opp)); + + Coords.setPressed(Coords.getCorner(opp)); + Coords.setCurrent(opc); + + Tracker.activateHandlers(dragmodeHandler(mode,fc),doneSelect); + }; + /*}}}*/ + function dragmodeHandler(mode,f)/*{{{*/ + { + return function(pos) { + if (!options.aspectRatio) switch(mode) + { + case 'e': pos[1] = f.y2; break; + case 'w': pos[1] = f.y2; break; + case 'n': pos[0] = f.x2; break; + case 's': pos[0] = f.x2; break; + } + else switch(mode) + { + case 'e': pos[1] = f.y+1; break; + case 'w': pos[1] = f.y+1; break; + case 'n': pos[0] = f.x+1; break; + case 's': pos[0] = f.x+1; break; + } + Coords.setCurrent(pos); + Selection.update(); + }; + }; + /*}}}*/ + function createMover(pos)/*{{{*/ + { + var lloc = pos; + KeyManager.watchKeys(); + + return function(pos) + { + Coords.moveOffset([pos[0] - lloc[0], pos[1] - lloc[1]]); + lloc = pos; + + Selection.update(); + }; + }; + /*}}}*/ + function oppLockCorner(ord)/*{{{*/ + { + switch(ord) + { + case 'n': return 'sw'; + case 's': return 'nw'; + case 'e': return 'nw'; + case 'w': return 'ne'; + case 'ne': return 'sw'; + case 'nw': return 'se'; + case 'se': return 'nw'; + case 'sw': return 'ne'; + }; + }; + /*}}}*/ + function createDragger(ord)/*{{{*/ + { + return function(e) { + if (options.disabled) return false; + if ((ord == 'move') && !options.allowMove) return false; + btndown = true; + startDragMode(ord,mouseAbs(e)); + e.stopPropagation(); + e.preventDefault(); + return false; + }; + }; + /*}}}*/ + function presize($obj,w,h)/*{{{*/ + { + var nw = $obj.width(), nh = $obj.height(); + if ((nw > w) && w > 0) + { + nw = w; + nh = (w/$obj.width()) * $obj.height(); + } + if ((nh > h) && h > 0) + { + nh = h; + nw = (h/$obj.height()) * $obj.width(); + } + xscale = $obj.width() / nw; + yscale = $obj.height() / nh; + $obj.width(nw).height(nh); + }; + /*}}}*/ + function unscale(c)/*{{{*/ + { + return { + x: parseInt(c.x * xscale), y: parseInt(c.y * yscale), + x2: parseInt(c.x2 * xscale), y2: parseInt(c.y2 * yscale), + w: parseInt(c.w * xscale), h: parseInt(c.h * yscale) + }; + }; + /*}}}*/ + function doneSelect(pos)/*{{{*/ + { + var c = Coords.getFixed(); + if (c.w > options.minSelect[0] && c.h > options.minSelect[1]) + { + Selection.enableHandles(); + Selection.done(); + } + else + { + Selection.release(); + } + Tracker.setCursor( options.allowSelect?'crosshair':'default' ); + }; + /*}}}*/ + function newSelection(e)/*{{{*/ + { + if (options.disabled) return false; + if (!options.allowSelect) return false; + btndown = true; + docOffset = getPos($img); + Selection.disableHandles(); + myCursor('crosshair'); + var pos = mouseAbs(e); + Coords.setPressed(pos); + Tracker.activateHandlers(selectDrag,doneSelect); + KeyManager.watchKeys(); + Selection.update(); + + e.stopPropagation(); + e.preventDefault(); + return false; + }; + /*}}}*/ + function selectDrag(pos)/*{{{*/ + { + Coords.setCurrent(pos); + Selection.update(); + }; + /*}}}*/ + function newTracker() + { + var trk = $('
            ').addClass(cssClass('tracker')); + $.browser.msie && trk.css({ opacity: 0, backgroundColor: 'white' }); + return trk; + }; + + // }}} + // API methods {{{ + + function animateTo(a)/*{{{*/ + { + var x1 = a[0] / xscale, + y1 = a[1] / yscale, + x2 = a[2] / xscale, + y2 = a[3] / yscale; + + if (animating) return; + + var animto = Coords.flipCoords(x1,y1,x2,y2); + var c = Coords.getFixed(); + var animat = initcr = [ c.x, c.y, c.x2, c.y2 ]; + var interv = options.animationDelay; + + var x = animat[0]; + var y = animat[1]; + var x2 = animat[2]; + var y2 = animat[3]; + var ix1 = animto[0] - initcr[0]; + var iy1 = animto[1] - initcr[1]; + var ix2 = animto[2] - initcr[2]; + var iy2 = animto[3] - initcr[3]; + var pcent = 0; + var velocity = options.swingSpeed; + + Selection.animMode(true); + + var animator = function() + { + return function() + { + pcent += (100 - pcent) / velocity; + + animat[0] = x + ((pcent / 100) * ix1); + animat[1] = y + ((pcent / 100) * iy1); + animat[2] = x2 + ((pcent / 100) * ix2); + animat[3] = y2 + ((pcent / 100) * iy2); + + if (pcent < 100) animateStart(); + else Selection.done(); + + if (pcent >= 99.8) pcent = 100; + + setSelectRaw(animat); + }; + }(); + + function animateStart() + { window.setTimeout(animator,interv); }; + + animateStart(); + }; + /*}}}*/ + function setSelect(rect)//{{{ + { + setSelectRaw([rect[0]/xscale,rect[1]/yscale,rect[2]/xscale,rect[3]/yscale]); + }; + //}}} + function setSelectRaw(l) /*{{{*/ + { + Coords.setPressed([l[0],l[1]]); + Coords.setCurrent([l[2],l[3]]); + Selection.update(); + }; + /*}}}*/ + function setOptions(opt)/*{{{*/ + { + if (typeof(opt) != 'object') opt = { }; + options = $.extend(options,opt); + + if (typeof(options.onChange)!=='function') + options.onChange = function() { }; + + if (typeof(options.onSelect)!=='function') + options.onSelect = function() { }; + + }; + /*}}}*/ + function tellSelect()/*{{{*/ + { + return unscale(Coords.getFixed()); + }; + /*}}}*/ + function tellScaled()/*{{{*/ + { + return Coords.getFixed(); + }; + /*}}}*/ + function setOptionsNew(opt)/*{{{*/ + { + setOptions(opt); + interfaceUpdate(); + }; + /*}}}*/ + function disableCrop()//{{{ + { + options.disabled = true; + Selection.disableHandles(); + Selection.setCursor('default'); + Tracker.setCursor('default'); + }; + //}}} + function enableCrop()//{{{ + { + options.disabled = false; + interfaceUpdate(); + }; + //}}} + function cancelCrop()//{{{ + { + Selection.done(); + Tracker.activateHandlers(null,null); + }; + //}}} + function destroy()//{{{ + { + $div.remove(); + $origimg.show(); + }; + //}}} + + function interfaceUpdate(alt)//{{{ + // This method tweaks the interface based on options object. + // Called when options are changed and at end of initialization. + { + options.allowResize ? + alt?Selection.enableOnly():Selection.enableHandles(): + Selection.disableHandles(); + + Tracker.setCursor( options.allowSelect? 'crosshair': 'default' ); + Selection.setCursor( options.allowMove? 'move': 'default' ); + + $div.css('backgroundColor',options.bgColor); + + if ('setSelect' in options) { + setSelect(opt.setSelect); + Selection.done(); + delete(options.setSelect); + } + + if ('trueSize' in options) { + xscale = options.trueSize[0] / boundx; + yscale = options.trueSize[1] / boundy; + } + + xlimit = options.maxSize[0] || 0; + ylimit = options.maxSize[1] || 0; + xmin = options.minSize[0] || 0; + ymin = options.minSize[1] || 0; + + if ('outerImage' in options) + { + $img.attr('src',options.outerImage); + delete(options.outerImage); + } + + Selection.refresh(); + }; + //}}} + + // }}} + + $hdl_holder.hide(); + interfaceUpdate(true); + + var api = { + animateTo: animateTo, + setSelect: setSelect, + setOptions: setOptionsNew, + tellSelect: tellSelect, + tellScaled: tellScaled, + + disable: disableCrop, + enable: enableCrop, + cancel: cancelCrop, + + focus: KeyManager.watchKeys, + + getBounds: function() { return [ boundx * xscale, boundy * yscale ]; }, + getWidgetSize: function() { return [ boundx, boundy ]; }, + + release: Selection.release, + destroy: destroy + + }; + + $origimg.data('Jcrop',api); + return api; +}; + +$.fn.Jcrop = function(options)/*{{{*/ +{ + function attachWhenDone(from)/*{{{*/ + { + var loadsrc = options.useImg || from.src; + var img = new Image(); + img.onload = function() { $.Jcrop(from,options); }; + img.src = loadsrc; + }; + /*}}}*/ + if (typeof(options) !== 'object') options = { }; + + // Iterate over each object, attach Jcrop + this.each(function() + { + // If we've already attached to this object + if ($(this).data('Jcrop')) + { + // The API can be requested this way (undocumented) + if (options == 'api') return $(this).data('Jcrop'); + // Otherwise, we just reset the options... + else $(this).data('Jcrop').setOptions(options); + } + // If we haven't been attached, preload and attach + else attachWhenDone(this); + }); + + // Return "this" so we're chainable a la jQuery plugin-style! + return this; +}; +/*}}}*/ + +})(jQuery); diff --git a/src/wp-includes/js/jcrop/jquery.Jcrop.js b/src/wp-includes/js/jcrop/jquery.Jcrop.js new file mode 100644 index 0000000..70b5505 --- /dev/null +++ b/src/wp-includes/js/jcrop/jquery.Jcrop.js @@ -0,0 +1 @@ +(function(a){a.Jcrop=function(d,A){var d=d,A=A;if(typeof(d)!=="object"){d=a(d)[0]}if(typeof(A)!=="object"){A={}}if(!("trackDocument" in A)){A.trackDocument=a.browser.msie?false:true;if(a.browser.msie&&a.browser.version.split(".")[0]=="8"){A.trackDocument=true}}if(!("keySupport" in A)){A.keySupport=a.browser.msie?false:true}var U={trackDocument:false,baseClass:"jcrop",addClass:null,bgColor:"black",bgOpacity:0.6,borderOpacity:0.4,handleOpacity:0.5,handlePad:5,handleSize:9,handleOffset:5,edgeMargin:14,aspectRatio:0,keySupport:true,cornerHandles:true,sideHandles:true,drawBorders:true,dragEdges:true,boxWidth:0,boxHeight:0,boundary:8,animationDelay:20,swingSpeed:3,allowSelect:true,allowMove:true,allowResize:true,minSelect:[0,0],maxSize:[0,0],minSize:[0,0],onChange:function(){},onSelect:function(){}};var H=U;z(A);var W=a(d);var al=W.clone().removeAttr("id").css({position:"absolute"});al.width(W.width());al.height(W.height());W.after(al).hide();T(al,H.boxWidth,H.boxHeight);var Q=al.width(),O=al.height(),Z=a("
            ").width(Q).height(O).addClass(C("holder")).css({position:"relative",backgroundColor:H.bgColor}).insertAfter(W).append(al);if(H.addClass){Z.addClass(H.addClass)}var I=a("").attr("src",al.attr("src")).css("position","absolute").width(Q).height(O);var k=a("
            ").width(K(100)).height(K(100)).css({zIndex:310,position:"absolute",overflow:"hidden"}).append(I);var L=a("
            ").width(K(100)).height(K(100)).css("zIndex",320);var y=a("
            ").css({position:"absolute",zIndex:300}).insertBefore(al).append(k,L);var t=H.boundary;var b=ae().width(Q+(t*2)).height(O+(t*2)).css({position:"absolute",top:l(-t),left:l(-t),zIndex:290}).mousedown(ac);var x,ah,p,S;var M,e,n=true;var ad=D(al),r,an,am,B,ab;var aa=function(){var aq=0,aC=0,ap=0,aB=0,au,ar;function aw(aF){var aF=at(aF);ap=aq=aF[0];aB=aC=aF[1]}function av(aF){var aF=at(aF);au=aF[0]-ap;ar=aF[1]-aB;ap=aF[0];aB=aF[1]}function aE(){return[au,ar]}function ao(aH){var aG=aH[0],aF=aH[1];if(0>aq+aG){aG-=aG+aq}if(0>aC+aF){aF-=aF+aC}if(OQ){aF=Q;h=Math.abs((aF-aq)/aH);aM=aP<0?aC-h:h+aC}}}else{aF=ap;h=aJ/aH;aM=aP<0?aC-h:aC+h;if(aM<0){aM=0;w=Math.abs((aM-aC)*aH);aF=aI<0?aq-w:w+aq}else{if(aM>O){aM=O;w=Math.abs(aM-aC)*aH;aF=aI<0?aq-w:w+aq}}}if(aF>aq){if(aF-aqaG){aF=aq+aG}}if(aM>aC){aM=aC+(aF-aq)/aH}else{aM=aC-(aF-aq)/aH}}else{if(aFaG){aF=aq-aG}}if(aM>aC){aM=aC+(aq-aF)/aH}else{aM=aC-(aq-aF)/aH}}}if(aF<0){aq-=aF;aF=0}else{if(aF>Q){aq-=aF-Q;aF=Q}}if(aM<0){aC-=aM;aM=0}else{if(aM>O){aC-=aM-O;aM=O}}return last=az(ay(aq,aC,aF,aM))}function at(aF){if(aF[0]<0){aF[0]=0}if(aF[1]<0){aF[1]=0}if(aF[0]>Q){aF[0]=Q}if(aF[1]>O){aF[1]=O}return[aF[0],aF[1]]}function ay(aI,aK,aH,aJ){var aM=aI,aL=aH,aG=aK,aF=aJ;if(aHx)){ap=(aG>0)?(aq+x):(aq-x)}if(ah&&(Math.abs(aF)>ah)){aB=(aF>0)?(aC+ah):(aC-ah)}if(S&&(Math.abs(aF)0)?(aC+S):(aC-S)}if(p&&(Math.abs(aG)0)?(aq+p):(aq-p)}if(aq<0){ap-=aq;aq-=aq}if(aC<0){aB-=aC;aC-=aC}if(ap<0){aq-=ap;ap-=ap}if(aB<0){aC-=aB;aB-=aB}if(ap>Q){var aH=ap-Q;aq-=aH;ap-=aH}if(aB>O){var aH=aB-O;aC-=aH;aB-=aH}if(aq>Q){var aH=aq-O;aB-=aH;aC-=aH}if(aC>O){var aH=aC-O;aB-=aH;aC-=aH}return az(ay(aq,aC,ap,aB))}function az(aF){return{x:aF[0],y:aF[1],x2:aF[2],y2:aF[3],w:aF[2]-aF[0],h:aF[3]-aF[1]}}return{flipCoords:ay,setPressed:aw,setCurrent:av,getOffset:aE,moveOffset:ao,getCorner:ax,getFixed:aD}}();var X=function(){var aw,ar,aC,aB,aK=370;var av={};var aO={};var aq=false;var aA=H.handleOffset;if(H.drawBorders){av={top:ax("hline").css("top",a.browser.msie?l(-1):l(0)),bottom:ax("hline"),left:ax("vline"),right:ax("vline")}}if(H.dragEdges){aO.t=aJ("n");aO.b=aJ("s");aO.r=aJ("e");aO.l=aJ("w")}H.sideHandles&&aF(["n","s","e","w"]);H.cornerHandles&&aF(["sw","nw","ne","se"]);function ax(aR){var aS=a("
            ").css({position:"absolute",opacity:H.borderOpacity}).addClass(C(aR));k.append(aS);return aS}function ap(aR,aS){var aT=a("
            ").mousedown(c(aR)).css({cursor:aR+"-resize",position:"absolute",zIndex:aS});L.append(aT);return aT}function aD(aR){return ap(aR,aK++).css({top:l(-aA+1),left:l(-aA+1),opacity:H.handleOpacity}).addClass(C("handle"))}function aJ(aT){var aW=H.handleSize,aX=aA,aV=aW,aS=aW,aU=aX,aR=aX;switch(aT){case"n":case"s":aS=K(100);break;case"e":case"w":aV=K(100);break}return ap(aT,aK++).width(aS).height(aV).css({top:l(-aU+1),left:l(-aR+1)})}function aF(aR){for(i in aR){aO[aR[i]]=aD(aR[i])}}function aH(aY){var aT=Math.round((aY.h/2)-aA),aS=Math.round((aY.w/2)-aA),aW=west=-aA+1,aV=aY.w-aA,aU=aY.h-aA,aR,aX;"e" in aO&&aO.e.css({top:l(aT),left:l(aV)})&&aO.w.css({top:l(aT)})&&aO.s.css({top:l(aU),left:l(aS)})&&aO.n.css({left:l(aS)});"ne" in aO&&aO.ne.css({left:l(aV)})&&aO.se.css({top:l(aU),left:l(aV)})&&aO.sw.css({top:l(aU)});"b" in aO&&aO.b.css({top:l(aU)})&&aO.r.css({left:l(aV)})}function az(aR,aS){I.css({top:l(-aS),left:l(-aR)});y.css({top:l(aS),left:l(aR)})}function aQ(aR,aS){y.width(aR).height(aS)}function at(){var aR=aa.getFixed();aa.setPressed([aR.x,aR.y]);aa.setCurrent([aR.x2,aR.y2]);aN()}function aN(){if(aB){return ay()}}function ay(){var aR=aa.getFixed();aQ(aR.w,aR.h);az(aR.x,aR.y);H.drawBorders&&av.right.css({left:l(aR.w-1)})&&av.bottom.css({top:l(aR.h-1)});aq&&aH(aR);aB||aP();H.onChange(Y(aR))}function aP(){y.show();al.css("opacity",H.bgOpacity);aB=true}function aL(){aM();y.hide();al.css("opacity",1);aB=false}function ao(){if(aq){aH(aa.getFixed());L.show()}}function aG(){aq=true;if(H.allowResize){aH(aa.getFixed());L.show();return true}}function aM(){aq=false;L.hide()}function aI(aR){(B=aR)?aM():aG()}function aE(){aI(false);at()}var au=ae().mousedown(c("move")).css({cursor:"move",position:"absolute",zIndex:360});k.append(au);aM();return{updateVisible:aN,update:ay,release:aL,refresh:at,setCursor:function(aR){au.css("cursor",aR)},enableHandles:aG,enableOnly:function(){aq=true},showHandles:ao,disableHandles:aM,animMode:aI,done:aE}}();var P=function(){var ap=function(){},ar=function(){},aq=H.trackDocument;if(!aq){b.mousemove(ao).mouseup(at).mouseout(at)}function ax(){b.css({zIndex:450});if(aq){a(document).mousemove(ao).mouseup(at)}}function aw(){b.css({zIndex:290});if(aq){a(document).unbind("mousemove",ao).unbind("mouseup",at)}}function ao(ay){ap(F(ay))}function at(ay){ay.preventDefault();ay.stopPropagation();if(r){r=false;ar(F(ay));H.onSelect(Y(aa.getFixed()));aw();ap=function(){};ar=function(){}}return false}function au(az,ay){r=true;ap=az;ar=ay;ax();return false}function av(ay){b.css("cursor",ay)}al.before(b);return{activateHandlers:au,setCursor:av}}();var ak=function(){var ar=a('').css({position:"absolute",left:"-30px"}).keypress(ao).blur(at),au=a("
            ").css({position:"absolute",overflow:"hidden"}).append(ar);function ap(){if(H.keySupport){ar.show();ar.focus()}}function at(av){ar.hide()}function aq(aw,av,ax){if(H.allowMove){aa.moveOffset([av,ax]);X.updateVisible()}aw.preventDefault();aw.stopPropagation()}function ao(aw){if(aw.ctrlKey){return true}ab=aw.shiftKey?true:false;var av=ab?10:1;switch(aw.keyCode){case 37:aq(aw,-av,0);break;case 39:aq(aw,av,0);break;case 38:aq(aw,0,-av);break;case 40:aq(aw,0,av);break;case 27:X.release();break;case 9:return true}return nothing(aw)}if(H.keySupport){au.insertBefore(al)}return{watchKeys:ap}}();function l(ao){return""+parseInt(ao)+"px"}function K(ao){return""+parseInt(ao)+"%"}function C(ao){return H.baseClass+"-"+ao}function D(ao){var ap=a(ao).offset();return[ap.left,ap.top]}function F(ao){return[(ao.pageX-ad[0]),(ao.pageY-ad[1])]}function E(ao){if(ao!=an){P.setCursor(ao);an=ao}}function f(aq,at){ad=D(al);P.setCursor(aq=="move"?aq:aq+"-resize");if(aq=="move"){return P.activateHandlers(R(at),o)}var ao=aa.getFixed();var ap=q(aq);var ar=aa.getCorner(q(ap));aa.setPressed(aa.getCorner(ap));aa.setCurrent(ar);P.activateHandlers(G(aq,ao),o)}function G(ap,ao){return function(aq){if(!H.aspectRatio){switch(ap){case"e":aq[1]=ao.y2;break;case"w":aq[1]=ao.y2;break;case"n":aq[0]=ao.x2;break;case"s":aq[0]=ao.x2;break}}else{switch(ap){case"e":aq[1]=ao.y+1;break;case"w":aq[1]=ao.y+1;break;case"n":aq[0]=ao.x+1;break;case"s":aq[0]=ao.x+1;break}}aa.setCurrent(aq);X.update()}}function R(ap){var ao=ap;ak.watchKeys();return function(aq){aa.moveOffset([aq[0]-ao[0],aq[1]-ao[1]]);ao=aq;X.update()}}function q(ao){switch(ao){case"n":return"sw";case"s":return"nw";case"e":return"nw";case"w":return"ne";case"ne":return"sw";case"nw":return"se";case"se":return"nw";case"sw":return"ne"}}function c(ao){return function(ap){if(H.disabled){return false}if((ao=="move")&&!H.allowMove){return false}r=true;f(ao,F(ap));ap.stopPropagation();ap.preventDefault();return false}}function T(at,ap,ar){var ao=at.width(),aq=at.height();if((ao>ap)&&ap>0){ao=ap;aq=(ap/at.width())*at.height()}if((aq>ar)&&ar>0){aq=ar;ao=(ar/at.height())*at.width()}M=at.width()/ao;e=at.height()/aq;at.width(ao).height(aq)}function Y(ao){return{x:parseInt(ao.x*M),y:parseInt(ao.y*e),x2:parseInt(ao.x2*M),y2:parseInt(ao.y2*e),w:parseInt(ao.w*M),h:parseInt(ao.h*e)}}function o(ap){var ao=aa.getFixed();if(ao.w>H.minSelect[0]&&ao.h>H.minSelect[1]){X.enableHandles();X.done()}else{X.release()}P.setCursor(H.allowSelect?"crosshair":"default")}function ac(ao){if(H.disabled){return false}if(!H.allowSelect){return false}r=true;ad=D(al);X.disableHandles();E("crosshair");var ap=F(ao);aa.setPressed(ap);P.activateHandlers(aj,o);ak.watchKeys();X.update();ao.stopPropagation();ao.preventDefault();return false}function aj(ao){aa.setCurrent(ao);X.update()}function ae(){var ao=a("
            ").addClass(C("tracker"));a.browser.msie&&ao.css({opacity:0,backgroundColor:"white"});return ao}function s(aG){var aB=aG[0]/M,ap=aG[1]/e,aA=aG[2]/M,ao=aG[3]/e;if(B){return}var az=aa.flipCoords(aB,ap,aA,ao);var aE=aa.getFixed();var ar=initcr=[aE.x,aE.y,aE.x2,aE.y2];var aq=H.animationDelay;var ax=ar[0];var aw=ar[1];var aA=ar[2];var ao=ar[3];var aD=az[0]-initcr[0];var au=az[1]-initcr[1];var aC=az[2]-initcr[2];var at=az[3]-initcr[3];var ay=0;var av=H.swingSpeed;X.animMode(true);var aF=function(){return function(){ay+=(100-ay)/av;ar[0]=ax+((ay/100)*aD);ar[1]=aw+((ay/100)*au);ar[2]=aA+((ay/100)*aC);ar[3]=ao+((ay/100)*at);if(ay<100){aH()}else{X.done()}if(ay>=99.8){ay=100}ai(ar)}}();function aH(){window.setTimeout(aF,aq)}aH()}function J(ao){ai([ao[0]/M,ao[1]/e,ao[2]/M,ao[3]/e])}function ai(ao){aa.setPressed([ao[0],ao[1]]);aa.setCurrent([ao[2],ao[3]]);X.update()}function z(ao){if(typeof(ao)!="object"){ao={}}H=a.extend(H,ao);if(typeof(H.onChange)!=="function"){H.onChange=function(){}}if(typeof(H.onSelect)!=="function"){H.onSelect=function(){}}}function j(){return Y(aa.getFixed())}function ag(){return aa.getFixed()}function u(ao){z(ao);N()}function v(){H.disabled=true;X.disableHandles();X.setCursor("default");P.setCursor("default")}function V(){H.disabled=false;N()}function m(){X.done();P.activateHandlers(null,null)}function af(){Z.remove();W.show()}function N(ao){H.allowResize?ao?X.enableOnly():X.enableHandles():X.disableHandles();P.setCursor(H.allowSelect?"crosshair":"default");X.setCursor(H.allowMove?"move":"default");Z.css("backgroundColor",H.bgColor);if("setSelect" in H){J(A.setSelect);X.done();delete (H.setSelect)}if("trueSize" in H){M=H.trueSize[0]/Q;e=H.trueSize[1]/O}x=H.maxSize[0]||0;ah=H.maxSize[1]||0;p=H.minSize[0]||0;S=H.minSize[1]||0;if("outerImage" in H){al.attr("src",H.outerImage);delete (H.outerImage)}X.refresh()}L.hide();N(true);var g={animateTo:s,setSelect:J,setOptions:u,tellSelect:j,tellScaled:ag,disable:v,enable:V,cancel:m,focus:ak.watchKeys,getBounds:function(){return[Q*M,O*e]},getWidgetSize:function(){return[Q,O]},release:X.release,destroy:af};W.data("Jcrop",g);return g};a.fn.Jcrop=function(c){function b(f){var e=c.useImg||f.src;var d=new Image();d.onload=function(){a.Jcrop(f,c)};d.src=e}if(typeof(c)!=="object"){c={}}this.each(function(){if(a(this).data("Jcrop")){if(c=="api"){return a(this).data("Jcrop")}else{a(this).data("Jcrop").setOptions(c)}}else{b(this)}});return this}})(jQuery); \ No newline at end of file diff --git a/src/wp-includes/js/jquery/jquery.color.dev.js b/src/wp-includes/js/jquery/jquery.color.dev.js new file mode 100644 index 0000000..1dffbd5 --- /dev/null +++ b/src/wp-includes/js/jquery/jquery.color.dev.js @@ -0,0 +1,128 @@ +/* + * jQuery Color Animations + * Copyright 2007 John Resig + * Released under the MIT and GPL licenses. + */ + +(function(jQuery){ + + // We override the animation for all of these color styles + jQuery.each(['backgroundColor', 'borderBottomColor', 'borderLeftColor', 'borderRightColor', 'borderTopColor', 'color', 'outlineColor'], function(i,attr){ + jQuery.fx.step[attr] = function(fx){ + if ( fx.state == 0 ) { + fx.start = getColor( fx.elem, attr ); + fx.end = getRGB( fx.end ); + } + + fx.elem.style[attr] = "rgb(" + [ + Math.max(Math.min( parseInt((fx.pos * (fx.end[0] - fx.start[0])) + fx.start[0]), 255), 0), + Math.max(Math.min( parseInt((fx.pos * (fx.end[1] - fx.start[1])) + fx.start[1]), 255), 0), + Math.max(Math.min( parseInt((fx.pos * (fx.end[2] - fx.start[2])) + fx.start[2]), 255), 0) + ].join(",") + ")"; + } + }); + + // Color Conversion functions from highlightFade + // By Blair Mitchelmore + // http://jquery.offput.ca/highlightFade/ + + // Parse strings looking for color tuples [255,255,255] + function getRGB(color) { + var result; + + // Check if we're already dealing with an array of colors + if ( color && color.constructor == Array && color.length == 3 ) + return color; + + // Look for rgb(num,num,num) + if (result = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(color)) + return [parseInt(result[1]), parseInt(result[2]), parseInt(result[3])]; + + // Look for rgb(num%,num%,num%) + if (result = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(color)) + return [parseFloat(result[1])*2.55, parseFloat(result[2])*2.55, parseFloat(result[3])*2.55]; + + // Look for #a0b1c2 + if (result = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(color)) + return [parseInt(result[1],16), parseInt(result[2],16), parseInt(result[3],16)]; + + // Look for #fff + if (result = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(color)) + return [parseInt(result[1]+result[1],16), parseInt(result[2]+result[2],16), parseInt(result[3]+result[3],16)]; + + // Look for rgba(0, 0, 0, 0) == transparent in Safari 3 + if (result = /rgba\(0, 0, 0, 0\)/.exec(color)) + return colors['transparent'] + + // Otherwise, we're most likely dealing with a named color + return colors[jQuery.trim(color).toLowerCase()]; + } + + function getColor(elem, attr) { + var color; + + do { + color = jQuery.curCSS(elem, attr); + + // Keep going until we find an element that has color, or we hit the body + if ( color != '' && color != 'transparent' || jQuery.nodeName(elem, "body") ) + break; + + attr = "backgroundColor"; + } while ( elem = elem.parentNode ); + + return getRGB(color); + }; + + // Some named colors to work with + // From Interface by Stefan Petre + // http://interface.eyecon.ro/ + + var colors = { + aqua:[0,255,255], + azure:[240,255,255], + beige:[245,245,220], + black:[0,0,0], + blue:[0,0,255], + brown:[165,42,42], + cyan:[0,255,255], + darkblue:[0,0,139], + darkcyan:[0,139,139], + darkgrey:[169,169,169], + darkgreen:[0,100,0], + darkkhaki:[189,183,107], + darkmagenta:[139,0,139], + darkolivegreen:[85,107,47], + darkorange:[255,140,0], + darkorchid:[153,50,204], + darkred:[139,0,0], + darksalmon:[233,150,122], + darkviolet:[148,0,211], + fuchsia:[255,0,255], + gold:[255,215,0], + green:[0,128,0], + indigo:[75,0,130], + khaki:[240,230,140], + lightblue:[173,216,230], + lightcyan:[224,255,255], + lightgreen:[144,238,144], + lightgrey:[211,211,211], + lightpink:[255,182,193], + lightyellow:[255,255,224], + lime:[0,255,0], + magenta:[255,0,255], + maroon:[128,0,0], + navy:[0,0,128], + olive:[128,128,0], + orange:[255,165,0], + pink:[255,192,203], + purple:[128,0,128], + violet:[128,0,128], + red:[255,0,0], + silver:[192,192,192], + white:[255,255,255], + yellow:[255,255,0], + transparent: [255,255,255] + }; + +})(jQuery); diff --git a/src/wp-includes/js/jquery/jquery.color.js b/src/wp-includes/js/jquery/jquery.color.js new file mode 100644 index 0000000..03c13f6 --- /dev/null +++ b/src/wp-includes/js/jquery/jquery.color.js @@ -0,0 +1 @@ +(function(d){d.each(["backgroundColor","borderBottomColor","borderLeftColor","borderRightColor","borderTopColor","color","outlineColor"],function(f,e){d.fx.step[e]=function(g){if(g.state==0){g.start=c(g.elem,e);g.end=b(g.end)}g.elem.style[e]="rgb("+[Math.max(Math.min(parseInt((g.pos*(g.end[0]-g.start[0]))+g.start[0]),255),0),Math.max(Math.min(parseInt((g.pos*(g.end[1]-g.start[1]))+g.start[1]),255),0),Math.max(Math.min(parseInt((g.pos*(g.end[2]-g.start[2]))+g.start[2]),255),0)].join(",")+")"}});function b(f){var e;if(f&&f.constructor==Array&&f.length==3){return f}if(e=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(f)){return[parseInt(e[1]),parseInt(e[2]),parseInt(e[3])]}if(e=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(f)){return[parseFloat(e[1])*2.55,parseFloat(e[2])*2.55,parseFloat(e[3])*2.55]}if(e=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(f)){return[parseInt(e[1],16),parseInt(e[2],16),parseInt(e[3],16)]}if(e=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(f)){return[parseInt(e[1]+e[1],16),parseInt(e[2]+e[2],16),parseInt(e[3]+e[3],16)]}if(e=/rgba\(0, 0, 0, 0\)/.exec(f)){return a.transparent}return a[d.trim(f).toLowerCase()]}function c(g,e){var f;do{f=d.curCSS(g,e);if(f!=""&&f!="transparent"||d.nodeName(g,"body")){break}e="backgroundColor"}while(g=g.parentNode);return b(f)}var a={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0,0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0],transparent:[255,255,255]}})(jQuery); \ No newline at end of file diff --git a/src/wp-includes/js/jquery/jquery.form.dev.js b/src/wp-includes/js/jquery/jquery.form.dev.js new file mode 100644 index 0000000..0065807 --- /dev/null +++ b/src/wp-includes/js/jquery/jquery.form.dev.js @@ -0,0 +1,826 @@ +/*! + * jQuery Form Plugin + * version: 2.73 (03-MAY-2011) + * @requires jQuery v1.3.2 or later + * + * Examples and documentation at: http://malsup.com/jquery/form/ + * Dual licensed under the MIT and GPL licenses: + * http://www.opensource.org/licenses/mit-license.php + * http://www.gnu.org/licenses/gpl.html + */ +;(function($) { + +/* + Usage Note: + ----------- + Do not use both ajaxSubmit and ajaxForm on the same form. These + functions are intended to be exclusive. Use ajaxSubmit if you want + to bind your own submit handler to the form. For example, + + $(document).ready(function() { + $('#myForm').bind('submit', function(e) { + e.preventDefault(); // <-- important + $(this).ajaxSubmit({ + target: '#output' + }); + }); + }); + + Use ajaxForm when you want the plugin to manage all the event binding + for you. For example, + + $(document).ready(function() { + $('#myForm').ajaxForm({ + target: '#output' + }); + }); + + When using ajaxForm, the ajaxSubmit function will be invoked for you + at the appropriate time. +*/ + +/** + * ajaxSubmit() provides a mechanism for immediately submitting + * an HTML form using AJAX. + */ +$.fn.ajaxSubmit = function(options) { + // fast fail if nothing selected (http://dev.jquery.com/ticket/2752) + if (!this.length) { + log('ajaxSubmit: skipping submit process - no element selected'); + return this; + } + + if (typeof options == 'function') { + options = { success: options }; + } + + var action = this.attr('action'); + var url = (typeof action === 'string') ? $.trim(action) : ''; + if (url) { + // clean url (don't include hash vaue) + url = (url.match(/^([^#]+)/)||[])[1]; + } + url = url || window.location.href || ''; + + options = $.extend(true, { + url: url, + success: $.ajaxSettings.success, + type: this[0].getAttribute('method') || 'GET', // IE7 massage (see issue 57) + iframeSrc: /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank' + }, options); + + // hook for manipulating the form data before it is extracted; + // convenient for use with rich editors like tinyMCE or FCKEditor + var veto = {}; + this.trigger('form-pre-serialize', [this, options, veto]); + if (veto.veto) { + log('ajaxSubmit: submit vetoed via form-pre-serialize trigger'); + return this; + } + + // provide opportunity to alter form data before it is serialized + if (options.beforeSerialize && options.beforeSerialize(this, options) === false) { + log('ajaxSubmit: submit aborted via beforeSerialize callback'); + return this; + } + + var n,v,a = this.formToArray(options.semantic); + if (options.data) { + options.extraData = options.data; + for (n in options.data) { + if(options.data[n] instanceof Array) { + for (var k in options.data[n]) { + a.push( { name: n, value: options.data[n][k] } ); + } + } + else { + v = options.data[n]; + v = $.isFunction(v) ? v() : v; // if value is fn, invoke it + a.push( { name: n, value: v } ); + } + } + } + + // give pre-submit callback an opportunity to abort the submit + if (options.beforeSubmit && options.beforeSubmit(a, this, options) === false) { + log('ajaxSubmit: submit aborted via beforeSubmit callback'); + return this; + } + + // fire vetoable 'validate' event + this.trigger('form-submit-validate', [a, this, options, veto]); + if (veto.veto) { + log('ajaxSubmit: submit vetoed via form-submit-validate trigger'); + return this; + } + + var q = $.param(a); + + if (options.type.toUpperCase() == 'GET') { + options.url += (options.url.indexOf('?') >= 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) { + var fn = options.replaceTarget ? 'replaceWith' : 'html'; + $(options.target)[fn](data).each(oldSuccess, arguments); + }); + } + else if (options.success) { + callbacks.push(options.success); + } + + options.success = function(data, status, xhr) { // jQuery 1.4+ passes xhr as 3rd arg + var context = options.context || options; // jQuery 1.4+ supports scope context + for (var i=0, max=callbacks.length; i < max; i++) { + callbacks[i].apply(context, [data, status, xhr || $form, $form]); + } + }; + + // are there files to upload? + var fileInputs = $('input:file', this).length > 0; + var mp = 'multipart/form-data'; + var multipart = ($form.attr('enctype') == mp || $form.attr('encoding') == mp); + + // options.iframe allows user to force iframe mode + // 06-NOV-09: now defaulting to iframe mode if file input is detected + if (options.iframe !== false && (fileInputs || options.iframe || multipart)) { + // hack to fix Safari hang (thanks to Tim Molendijk for this) + // see: http://groups.google.com/group/jquery-dev/browse_thread/thread/36395b7ab510dd5d + if (options.closeKeepAlive) { + $.get(options.closeKeepAlive, fileUpload); + } + else { + fileUpload(); + } + } + else { + $.ajax(options); + } + + // fire 'notify' event + this.trigger('form-submit-notify', [this, options]); + return this; + + + // private function for handling file uploads (hat tip to YAHOO!) + function fileUpload() { + var form = $form[0]; + + if ($(':input[name=submit],:input[id=submit]', form).length) { + // if there is an input with a name or id of 'submit' then we won't be + // able to invoke the submit fn on the form (at least not x-browser) + alert('Error: Form elements must not have name or id of "submit".'); + return; + } + + var s = $.extend(true, {}, $.ajaxSettings, options); + s.context = s.context || s; + var id = 'jqFormIO' + (new Date().getTime()), fn = '_'+id; + 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(); + Event.stop(event); + return; + case Event.KEY_DOWN: + this.markNext(); + this.render(); + 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.unescapeHTML(); + }, + 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)); + } +}); \ No newline at end of file diff --git a/src/wp-includes/js/scriptaculous/dragdrop.js b/src/wp-includes/js/scriptaculous/dragdrop.js new file mode 100644 index 0000000..15c6dbc --- /dev/null +++ b/src/wp-includes/js/scriptaculous/dragdrop.js @@ -0,0 +1,974 @@ +// script.aculo.us dragdrop.js v1.8.3, Thu Oct 08 11:23:33 +0200 2009 + +// Copyright (c) 2005-2009 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/ + +if(Object.isUndefined(Effect)) + throw("dragdrop.js requires including script.aculo.us' effects.js library"); + +var Droppables = { + drops: [], + + remove: function(element) { + this.drops = this.drops.reject(function(d) { return d.element==$(element) }); + }, + + add: function(element) { + element = $(element); + var options = Object.extend({ + greedy: true, + hoverclass: null, + tree: false + }, arguments[1] || { }); + + // cache containers + if(options.containment) { + options._containers = []; + var containment = options.containment; + if(Object.isArray(containment)) { + containment.each( function(c) { options._containers.push($(c)) }); + } else { + options._containers.push($(containment)); + } + } + + if(options.accept) options.accept = [options.accept].flatten(); + + Element.makePositioned(element); // fix IE + options.element = element; + + this.drops.push(options); + }, + + findDeepestChild: function(drops) { + deepest = drops[0]; + + for (i = 1; i < drops.length; ++i) + if (Element.isParent(drops[i].element, deepest.element)) + deepest = drops[i]; + + return deepest; + }, + + isContained: function(element, drop) { + var containmentNode; + if(drop.tree) { + containmentNode = element.treeNode; + } else { + containmentNode = element.parentNode; + } + return drop._containers.detect(function(c) { return containmentNode == c }); + }, + + isAffected: function(point, element, drop) { + return ( + (drop.element!=element) && + ((!drop._containers) || + this.isContained(element, drop)) && + ((!drop.accept) || + (Element.classNames(element).detect( + function(v) { return drop.accept.include(v) } ) )) && + Position.within(drop.element, point[0], point[1]) ); + }, + + deactivate: function(drop) { + if(drop.hoverclass) + Element.removeClassName(drop.element, drop.hoverclass); + this.last_active = null; + }, + + activate: function(drop) { + if(drop.hoverclass) + Element.addClassName(drop.element, drop.hoverclass); + this.last_active = drop; + }, + + show: function(point, element) { + if(!this.drops.length) return; + var drop, affected = []; + + this.drops.each( function(drop) { + if(Droppables.isAffected(point, element, drop)) + affected.push(drop); + }); + + if(affected.length>0) + drop = Droppables.findDeepestChild(affected); + + if(this.last_active && this.last_active != drop) this.deactivate(this.last_active); + if (drop) { + Position.within(drop.element, point[0], point[1]); + if(drop.onHover) + drop.onHover(element, drop.element, Position.overlap(drop.overlap, drop.element)); + + if (drop != this.last_active) Droppables.activate(drop); + } + }, + + fire: function(event, element) { + if(!this.last_active) return; + Position.prepare(); + + if (this.isAffected([Event.pointerX(event), Event.pointerY(event)], element, this.last_active)) + if (this.last_active.onDrop) { + this.last_active.onDrop(element, this.last_active.element, event); + return true; + } + }, + + reset: function() { + if(this.last_active) + this.deactivate(this.last_active); + } +}; + +var Draggables = { + drags: [], + observers: [], + + register: function(draggable) { + if(this.drags.length == 0) { + this.eventMouseUp = this.endDrag.bindAsEventListener(this); + this.eventMouseMove = this.updateDrag.bindAsEventListener(this); + this.eventKeypress = this.keyPress.bindAsEventListener(this); + + Event.observe(document, "mouseup", this.eventMouseUp); + Event.observe(document, "mousemove", this.eventMouseMove); + Event.observe(document, "keypress", this.eventKeypress); + } + this.drags.push(draggable); + }, + + unregister: function(draggable) { + this.drags = this.drags.reject(function(d) { return d==draggable }); + if(this.drags.length == 0) { + Event.stopObserving(document, "mouseup", this.eventMouseUp); + Event.stopObserving(document, "mousemove", this.eventMouseMove); + Event.stopObserving(document, "keypress", this.eventKeypress); + } + }, + + activate: function(draggable) { + if(draggable.options.delay) { + this._timeout = setTimeout(function() { + Draggables._timeout = null; + window.focus(); + Draggables.activeDraggable = draggable; + }.bind(this), draggable.options.delay); + } else { + window.focus(); // allows keypress events if window isn't currently focused, fails for Safari + this.activeDraggable = draggable; + } + }, + + deactivate: function() { + this.activeDraggable = null; + }, + + updateDrag: function(event) { + if(!this.activeDraggable) return; + var pointer = [Event.pointerX(event), Event.pointerY(event)]; + // Mozilla-based browsers fire successive mousemove events with + // the same coordinates, prevent needless redrawing (moz bug?) + if(this._lastPointer && (this._lastPointer.inspect() == pointer.inspect())) return; + this._lastPointer = pointer; + + this.activeDraggable.updateDrag(event, pointer); + }, + + endDrag: function(event) { + if(this._timeout) { + clearTimeout(this._timeout); + this._timeout = null; + } + if(!this.activeDraggable) return; + this._lastPointer = null; + this.activeDraggable.endDrag(event); + this.activeDraggable = null; + }, + + keyPress: function(event) { + if(this.activeDraggable) + this.activeDraggable.keyPress(event); + }, + + addObserver: function(observer) { + this.observers.push(observer); + this._cacheObserverCallbacks(); + }, + + removeObserver: function(element) { // element instead of observer fixes mem leaks + this.observers = this.observers.reject( function(o) { return o.element==element }); + this._cacheObserverCallbacks(); + }, + + notify: function(eventName, draggable, event) { // 'onStart', 'onEnd', 'onDrag' + if(this[eventName+'Count'] > 0) + this.observers.each( function(o) { + if(o[eventName]) o[eventName](eventName, draggable, event); + }); + if(draggable.options[eventName]) draggable.options[eventName](draggable, event); + }, + + _cacheObserverCallbacks: function() { + ['onStart','onEnd','onDrag'].each( function(eventName) { + Draggables[eventName+'Count'] = Draggables.observers.select( + function(o) { return o[eventName]; } + ).length; + }); + } +}; + +/*--------------------------------------------------------------------------*/ + +var Draggable = Class.create({ + initialize: function(element) { + var defaults = { + handle: false, + reverteffect: function(element, top_offset, left_offset) { + var dur = Math.sqrt(Math.abs(top_offset^2)+Math.abs(left_offset^2))*0.02; + new Effect.Move(element, { x: -left_offset, y: -top_offset, duration: dur, + queue: {scope:'_draggable', position:'end'} + }); + }, + endeffect: function(element) { + var toOpacity = Object.isNumber(element._opacity) ? element._opacity : 1.0; + new Effect.Opacity(element, {duration:0.2, from:0.7, to:toOpacity, + queue: {scope:'_draggable', position:'end'}, + afterFinish: function(){ + Draggable._dragging[element] = false + } + }); + }, + zindex: 1000, + revert: false, + quiet: false, + scroll: false, + scrollSensitivity: 20, + scrollSpeed: 15, + snap: false, // false, or xy or [x,y] or function(x,y){ return [x,y] } + delay: 0 + }; + + if(!arguments[1] || Object.isUndefined(arguments[1].endeffect)) + Object.extend(defaults, { + starteffect: function(element) { + element._opacity = Element.getOpacity(element); + Draggable._dragging[element] = true; + new Effect.Opacity(element, {duration:0.2, from:element._opacity, to:0.7}); + } + }); + + var options = Object.extend(defaults, arguments[1] || { }); + + this.element = $(element); + + if(options.handle && Object.isString(options.handle)) + this.handle = this.element.down('.'+options.handle, 0); + + if(!this.handle) this.handle = $(options.handle); + if(!this.handle) this.handle = this.element; + + if(options.scroll && !options.scroll.scrollTo && !options.scroll.outerHTML) { + options.scroll = $(options.scroll); + this._isScrollChild = Element.childOf(this.element, options.scroll); + } + + Element.makePositioned(this.element); // fix IE + + this.options = options; + this.dragging = false; + + this.eventMouseDown = this.initDrag.bindAsEventListener(this); + Event.observe(this.handle, "mousedown", this.eventMouseDown); + + Draggables.register(this); + }, + + destroy: function() { + Event.stopObserving(this.handle, "mousedown", this.eventMouseDown); + Draggables.unregister(this); + }, + + currentDelta: function() { + return([ + parseInt(Element.getStyle(this.element,'left') || '0'), + parseInt(Element.getStyle(this.element,'top') || '0')]); + }, + + initDrag: function(event) { + if(!Object.isUndefined(Draggable._dragging[this.element]) && + Draggable._dragging[this.element]) return; + if(Event.isLeftClick(event)) { + // abort on form elements, fixes a Firefox issue + var src = Event.element(event); + if((tag_name = src.tagName.toUpperCase()) && ( + tag_name=='INPUT' || + tag_name=='SELECT' || + tag_name=='OPTION' || + tag_name=='BUTTON' || + tag_name=='TEXTAREA')) return; + + var pointer = [Event.pointerX(event), Event.pointerY(event)]; + var pos = this.element.cumulativeOffset(); + this.offset = [0,1].map( function(i) { return (pointer[i] - pos[i]) }); + + Draggables.activate(this); + Event.stop(event); + } + }, + + startDrag: function(event) { + this.dragging = true; + if(!this.delta) + this.delta = this.currentDelta(); + + if(this.options.zindex) { + this.originalZ = parseInt(Element.getStyle(this.element,'z-index') || 0); + this.element.style.zIndex = this.options.zindex; + } + + if(this.options.ghosting) { + this._clone = this.element.cloneNode(true); + this._originallyAbsolute = (this.element.getStyle('position') == 'absolute'); + if (!this._originallyAbsolute) + Position.absolutize(this.element); + this.element.parentNode.insertBefore(this._clone, this.element); + } + + if(this.options.scroll) { + if (this.options.scroll == window) { + var where = this._getWindowScroll(this.options.scroll); + this.originalScrollLeft = where.left; + this.originalScrollTop = where.top; + } else { + this.originalScrollLeft = this.options.scroll.scrollLeft; + this.originalScrollTop = this.options.scroll.scrollTop; + } + } + + Draggables.notify('onStart', this, event); + + if(this.options.starteffect) this.options.starteffect(this.element); + }, + + updateDrag: function(event, pointer) { + if(!this.dragging) this.startDrag(event); + + if(!this.options.quiet){ + Position.prepare(); + Droppables.show(pointer, this.element); + } + + Draggables.notify('onDrag', this, event); + + this.draw(pointer); + if(this.options.change) this.options.change(this); + + if(this.options.scroll) { + this.stopScrolling(); + + var p; + if (this.options.scroll == window) { + with(this._getWindowScroll(this.options.scroll)) { p = [ left, top, left+width, top+height ]; } + } else { + p = Position.page(this.options.scroll); + p[0] += this.options.scroll.scrollLeft + Position.deltaX; + p[1] += this.options.scroll.scrollTop + Position.deltaY; + p.push(p[0]+this.options.scroll.offsetWidth); + p.push(p[1]+this.options.scroll.offsetHeight); + } + var speed = [0,0]; + if(pointer[0] < (p[0]+this.options.scrollSensitivity)) speed[0] = pointer[0]-(p[0]+this.options.scrollSensitivity); + if(pointer[1] < (p[1]+this.options.scrollSensitivity)) speed[1] = pointer[1]-(p[1]+this.options.scrollSensitivity); + if(pointer[0] > (p[2]-this.options.scrollSensitivity)) speed[0] = pointer[0]-(p[2]-this.options.scrollSensitivity); + if(pointer[1] > (p[3]-this.options.scrollSensitivity)) speed[1] = pointer[1]-(p[3]-this.options.scrollSensitivity); + this.startScrolling(speed); + } + + // fix AppleWebKit rendering + if(Prototype.Browser.WebKit) window.scrollBy(0,0); + + Event.stop(event); + }, + + finishDrag: function(event, success) { + this.dragging = false; + + if(this.options.quiet){ + Position.prepare(); + var pointer = [Event.pointerX(event), Event.pointerY(event)]; + Droppables.show(pointer, this.element); + } + + if(this.options.ghosting) { + if (!this._originallyAbsolute) + Position.relativize(this.element); + delete this._originallyAbsolute; + Element.remove(this._clone); + this._clone = null; + } + + var dropped = false; + if(success) { + dropped = Droppables.fire(event, this.element); + if (!dropped) dropped = false; + } + if(dropped && this.options.onDropped) this.options.onDropped(this.element); + Draggables.notify('onEnd', this, event); + + var revert = this.options.revert; + if(revert && Object.isFunction(revert)) revert = revert(this.element); + + var d = this.currentDelta(); + if(revert && this.options.reverteffect) { + if (dropped == 0 || revert != 'failure') + this.options.reverteffect(this.element, + d[1]-this.delta[1], d[0]-this.delta[0]); + } else { + this.delta = d; + } + + if(this.options.zindex) + this.element.style.zIndex = this.originalZ; + + if(this.options.endeffect) + this.options.endeffect(this.element); + + Draggables.deactivate(this); + Droppables.reset(); + }, + + keyPress: function(event) { + if(event.keyCode!=Event.KEY_ESC) return; + this.finishDrag(event, false); + Event.stop(event); + }, + + endDrag: function(event) { + if(!this.dragging) return; + this.stopScrolling(); + this.finishDrag(event, true); + Event.stop(event); + }, + + draw: function(point) { + var pos = this.element.cumulativeOffset(); + if(this.options.ghosting) { + var r = Position.realOffset(this.element); + pos[0] += r[0] - Position.deltaX; pos[1] += r[1] - Position.deltaY; + } + + var d = this.currentDelta(); + pos[0] -= d[0]; pos[1] -= d[1]; + + if(this.options.scroll && (this.options.scroll != window && this._isScrollChild)) { + pos[0] -= this.options.scroll.scrollLeft-this.originalScrollLeft; + pos[1] -= this.options.scroll.scrollTop-this.originalScrollTop; + } + + var p = [0,1].map(function(i){ + return (point[i]-pos[i]-this.offset[i]) + }.bind(this)); + + if(this.options.snap) { + if(Object.isFunction(this.options.snap)) { + p = this.options.snap(p[0],p[1],this); + } else { + if(Object.isArray(this.options.snap)) { + p = p.map( function(v, i) { + return (v/this.options.snap[i]).round()*this.options.snap[i] }.bind(this)); + } else { + p = p.map( function(v) { + return (v/this.options.snap).round()*this.options.snap }.bind(this)); + } + }} + + var style = this.element.style; + if((!this.options.constraint) || (this.options.constraint=='horizontal')) + style.left = p[0] + "px"; + if((!this.options.constraint) || (this.options.constraint=='vertical')) + style.top = p[1] + "px"; + + if(style.visibility=="hidden") style.visibility = ""; // fix gecko rendering + }, + + stopScrolling: function() { + if(this.scrollInterval) { + clearInterval(this.scrollInterval); + this.scrollInterval = null; + Draggables._lastScrollPointer = null; + } + }, + + startScrolling: function(speed) { + if(!(speed[0] || speed[1])) return; + this.scrollSpeed = [speed[0]*this.options.scrollSpeed,speed[1]*this.options.scrollSpeed]; + this.lastScrolled = new Date(); + this.scrollInterval = setInterval(this.scroll.bind(this), 10); + }, + + scroll: function() { + var current = new Date(); + var delta = current - this.lastScrolled; + this.lastScrolled = current; + if(this.options.scroll == window) { + with (this._getWindowScroll(this.options.scroll)) { + if (this.scrollSpeed[0] || this.scrollSpeed[1]) { + var d = delta / 1000; + this.options.scroll.scrollTo( left + d*this.scrollSpeed[0], top + d*this.scrollSpeed[1] ); + } + } + } else { + this.options.scroll.scrollLeft += this.scrollSpeed[0] * delta / 1000; + this.options.scroll.scrollTop += this.scrollSpeed[1] * delta / 1000; + } + + Position.prepare(); + Droppables.show(Draggables._lastPointer, this.element); + Draggables.notify('onDrag', this); + if (this._isScrollChild) { + Draggables._lastScrollPointer = Draggables._lastScrollPointer || $A(Draggables._lastPointer); + Draggables._lastScrollPointer[0] += this.scrollSpeed[0] * delta / 1000; + Draggables._lastScrollPointer[1] += this.scrollSpeed[1] * delta / 1000; + if (Draggables._lastScrollPointer[0] < 0) + Draggables._lastScrollPointer[0] = 0; + if (Draggables._lastScrollPointer[1] < 0) + Draggables._lastScrollPointer[1] = 0; + this.draw(Draggables._lastScrollPointer); + } + + if(this.options.change) this.options.change(this); + }, + + _getWindowScroll: function(w) { + var T, L, W, H; + with (w.document) { + if (w.document.documentElement && documentElement.scrollTop) { + T = documentElement.scrollTop; + L = documentElement.scrollLeft; + } else if (w.document.body) { + T = body.scrollTop; + L = body.scrollLeft; + } + if (w.innerWidth) { + W = w.innerWidth; + H = w.innerHeight; + } else if (w.document.documentElement && documentElement.clientWidth) { + W = documentElement.clientWidth; + H = documentElement.clientHeight; + } else { + W = body.offsetWidth; + H = body.offsetHeight; + } + } + return { top: T, left: L, width: W, height: H }; + } +}); + +Draggable._dragging = { }; + +/*--------------------------------------------------------------------------*/ + +var SortableObserver = Class.create({ + initialize: function(element, observer) { + this.element = $(element); + this.observer = observer; + this.lastValue = Sortable.serialize(this.element); + }, + + onStart: function() { + this.lastValue = Sortable.serialize(this.element); + }, + + onEnd: function() { + Sortable.unmark(); + if(this.lastValue != Sortable.serialize(this.element)) + this.observer(this.element) + } +}); + +var Sortable = { + SERIALIZE_RULE: /^[^_\-](?:[A-Za-z0-9\-\_]*)[_](.*)$/, + + sortables: { }, + + _findRootElement: function(element) { + while (element.tagName.toUpperCase() != "BODY") { + if(element.id && Sortable.sortables[element.id]) return element; + element = element.parentNode; + } + }, + + options: function(element) { + element = Sortable._findRootElement($(element)); + if(!element) return; + return Sortable.sortables[element.id]; + }, + + destroy: function(element){ + element = $(element); + var s = Sortable.sortables[element.id]; + + if(s) { + Draggables.removeObserver(s.element); + s.droppables.each(function(d){ Droppables.remove(d) }); + s.draggables.invoke('destroy'); + + delete Sortable.sortables[s.element.id]; + } + }, + + create: function(element) { + element = $(element); + var options = Object.extend({ + element: element, + tag: 'li', // assumes li children, override with tag: 'tagname' + dropOnEmpty: false, + tree: false, + treeTag: 'ul', + overlap: 'vertical', // one of 'vertical', 'horizontal' + constraint: 'vertical', // one of 'vertical', 'horizontal', false + containment: element, // also takes array of elements (or id's); or false + handle: false, // or a CSS class + only: false, + delay: 0, + hoverclass: null, + ghosting: false, + quiet: false, + scroll: false, + scrollSensitivity: 20, + scrollSpeed: 15, + format: this.SERIALIZE_RULE, + + // these take arrays of elements or ids and can be + // used for better initialization performance + elements: false, + handles: false, + + onChange: Prototype.emptyFunction, + onUpdate: Prototype.emptyFunction + }, arguments[1] || { }); + + // clear any old sortable with same element + this.destroy(element); + + // build options for the draggables + var options_for_draggable = { + revert: true, + quiet: options.quiet, + scroll: options.scroll, + scrollSpeed: options.scrollSpeed, + scrollSensitivity: options.scrollSensitivity, + delay: options.delay, + ghosting: options.ghosting, + constraint: options.constraint, + handle: options.handle }; + + if(options.starteffect) + options_for_draggable.starteffect = options.starteffect; + + if(options.reverteffect) + options_for_draggable.reverteffect = options.reverteffect; + else + if(options.ghosting) options_for_draggable.reverteffect = function(element) { + element.style.top = 0; + element.style.left = 0; + }; + + if(options.endeffect) + options_for_draggable.endeffect = options.endeffect; + + if(options.zindex) + options_for_draggable.zindex = options.zindex; + + // build options for the droppables + var options_for_droppable = { + overlap: options.overlap, + containment: options.containment, + tree: options.tree, + hoverclass: options.hoverclass, + onHover: Sortable.onHover + }; + + var options_for_tree = { + onHover: Sortable.onEmptyHover, + overlap: options.overlap, + containment: options.containment, + hoverclass: options.hoverclass + }; + + // fix for gecko engine + Element.cleanWhitespace(element); + + options.draggables = []; + options.droppables = []; + + // drop on empty handling + if(options.dropOnEmpty || options.tree) { + Droppables.add(element, options_for_tree); + options.droppables.push(element); + } + + (options.elements || this.findElements(element, options) || []).each( function(e,i) { + var handle = options.handles ? $(options.handles[i]) : + (options.handle ? $(e).select('.' + options.handle)[0] : e); + options.draggables.push( + new Draggable(e, Object.extend(options_for_draggable, { handle: handle }))); + Droppables.add(e, options_for_droppable); + if(options.tree) e.treeNode = element; + options.droppables.push(e); + }); + + if(options.tree) { + (Sortable.findTreeElements(element, options) || []).each( function(e) { + Droppables.add(e, options_for_tree); + e.treeNode = element; + options.droppables.push(e); + }); + } + + // keep reference + this.sortables[element.identify()] = options; + + // for onupdate + Draggables.addObserver(new SortableObserver(element, options.onUpdate)); + + }, + + // return all suitable-for-sortable elements in a guaranteed order + findElements: function(element, options) { + return Element.findChildren( + element, options.only, options.tree ? true : false, options.tag); + }, + + findTreeElements: function(element, options) { + return Element.findChildren( + element, options.only, options.tree ? true : false, options.treeTag); + }, + + onHover: function(element, dropon, overlap) { + if(Element.isParent(dropon, element)) return; + + if(overlap > .33 && overlap < .66 && Sortable.options(dropon).tree) { + return; + } else if(overlap>0.5) { + Sortable.mark(dropon, 'before'); + if(dropon.previousSibling != element) { + var oldParentNode = element.parentNode; + element.style.visibility = "hidden"; // fix gecko rendering + dropon.parentNode.insertBefore(element, dropon); + if(dropon.parentNode!=oldParentNode) + Sortable.options(oldParentNode).onChange(element); + Sortable.options(dropon.parentNode).onChange(element); + } + } else { + Sortable.mark(dropon, 'after'); + var nextElement = dropon.nextSibling || null; + if(nextElement != element) { + var oldParentNode = element.parentNode; + element.style.visibility = "hidden"; // fix gecko rendering + dropon.parentNode.insertBefore(element, nextElement); + if(dropon.parentNode!=oldParentNode) + Sortable.options(oldParentNode).onChange(element); + Sortable.options(dropon.parentNode).onChange(element); + } + } + }, + + onEmptyHover: function(element, dropon, overlap) { + var oldParentNode = element.parentNode; + var droponOptions = Sortable.options(dropon); + + if(!Element.isParent(dropon, element)) { + var index; + + var children = Sortable.findElements(dropon, {tag: droponOptions.tag, only: droponOptions.only}); + var child = null; + + if(children) { + var offset = Element.offsetSize(dropon, droponOptions.overlap) * (1.0 - overlap); + + for (index = 0; index < children.length; index += 1) { + if (offset - Element.offsetSize (children[index], droponOptions.overlap) >= 0) { + offset -= Element.offsetSize (children[index], droponOptions.overlap); + } else if (offset - (Element.offsetSize (children[index], droponOptions.overlap) / 2) >= 0) { + child = index + 1 < children.length ? children[index + 1] : null; + break; + } else { + child = children[index]; + break; + } + } + } + + dropon.insertBefore(element, child); + + Sortable.options(oldParentNode).onChange(element); + droponOptions.onChange(element); + } + }, + + unmark: function() { + if(Sortable._marker) Sortable._marker.hide(); + }, + + mark: function(dropon, position) { + // mark on ghosting only + var sortable = Sortable.options(dropon.parentNode); + if(sortable && !sortable.ghosting) return; + + if(!Sortable._marker) { + Sortable._marker = + ($('dropmarker') || Element.extend(document.createElement('DIV'))). + hide().addClassName('dropmarker').setStyle({position:'absolute'}); + document.getElementsByTagName("body").item(0).appendChild(Sortable._marker); + } + var offsets = dropon.cumulativeOffset(); + Sortable._marker.setStyle({left: offsets[0]+'px', top: offsets[1] + 'px'}); + + if(position=='after') + if(sortable.overlap == 'horizontal') + Sortable._marker.setStyle({left: (offsets[0]+dropon.clientWidth) + 'px'}); + else + Sortable._marker.setStyle({top: (offsets[1]+dropon.clientHeight) + 'px'}); + + Sortable._marker.show(); + }, + + _tree: function(element, options, parent) { + var children = Sortable.findElements(element, options) || []; + + for (var i = 0; i < children.length; ++i) { + var match = children[i].id.match(options.format); + + if (!match) continue; + + var child = { + id: encodeURIComponent(match ? match[1] : null), + element: element, + parent: parent, + children: [], + position: parent.children.length, + container: $(children[i]).down(options.treeTag) + }; + + /* Get the element containing the children and recurse over it */ + if (child.container) + this._tree(child.container, options, child); + + parent.children.push (child); + } + + return parent; + }, + + tree: function(element) { + element = $(element); + var sortableOptions = this.options(element); + var options = Object.extend({ + tag: sortableOptions.tag, + treeTag: sortableOptions.treeTag, + only: sortableOptions.only, + name: element.id, + format: sortableOptions.format + }, arguments[1] || { }); + + var root = { + id: null, + parent: null, + children: [], + container: element, + position: 0 + }; + + return Sortable._tree(element, options, root); + }, + + /* Construct a [i] index for a particular node */ + _constructIndex: function(node) { + var index = ''; + do { + if (node.id) index = '[' + node.position + ']' + index; + } while ((node = node.parent) != null); + return index; + }, + + sequence: function(element) { + element = $(element); + var options = Object.extend(this.options(element), arguments[1] || { }); + + return $(this.findElements(element, options) || []).map( function(item) { + return item.id.match(options.format) ? item.id.match(options.format)[1] : ''; + }); + }, + + setSequence: function(element, new_sequence) { + element = $(element); + var options = Object.extend(this.options(element), arguments[2] || { }); + + var nodeMap = { }; + this.findElements(element, options).each( function(n) { + if (n.id.match(options.format)) + nodeMap[n.id.match(options.format)[1]] = [n, n.parentNode]; + n.parentNode.removeChild(n); + }); + + new_sequence.each(function(ident) { + var n = nodeMap[ident]; + if (n) { + n[1].appendChild(n[0]); + delete nodeMap[ident]; + } + }); + }, + + serialize: function(element) { + element = $(element); + var options = Object.extend(Sortable.options(element), arguments[1] || { }); + var name = encodeURIComponent( + (arguments[1] && arguments[1].name) ? arguments[1].name : element.id); + + if (options.tree) { + return Sortable.tree(element, arguments[1]).children.map( function (item) { + return [name + Sortable._constructIndex(item) + "[id]=" + + encodeURIComponent(item.id)].concat(item.children.map(arguments.callee)); + }).flatten().join('&'); + } else { + return Sortable.sequence(element, arguments[1]).map( function(item) { + return name + "[]=" + encodeURIComponent(item); + }).join('&'); + } + } +}; + +// Returns true if child is contained within element +Element.isParent = function(child, element) { + if (!child.parentNode || child == element) return false; + if (child.parentNode == element) return true; + return Element.isParent(child.parentNode, element); +}; + +Element.findChildren = function(element, only, recursive, tagName) { + if(!element.hasChildNodes()) return null; + tagName = tagName.toUpperCase(); + if(only) only = [only].flatten(); + var elements = []; + $A(element.childNodes).each( function(e) { + if(e.tagName && e.tagName.toUpperCase()==tagName && + (!only || (Element.classNames(e).detect(function(v) { return only.include(v) })))) + elements.push(e); + if(recursive) { + var grandchildren = Element.findChildren(e, only, recursive, tagName); + if(grandchildren) elements.push(grandchildren); + } + }); + + return (elements.length>0 ? elements.flatten() : []); +}; + +Element.offsetSize = function (element, type) { + return element['offset' + ((type=='vertical' || type=='height') ? 'Height' : 'Width')]; +}; \ No newline at end of file diff --git a/src/wp-includes/js/scriptaculous/effects.js b/src/wp-includes/js/scriptaculous/effects.js new file mode 100644 index 0000000..066ee59 --- /dev/null +++ b/src/wp-includes/js/scriptaculous/effects.js @@ -0,0 +1,1123 @@ +// script.aculo.us effects.js v1.8.3, Thu Oct 08 11:23:33 +0200 2009 + +// Copyright (c) 2005-2009 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) +// Contributors: +// Justin Palmer (http://encytemedia.com/) +// Mark Pilgrim (http://diveintomark.org/) +// Martin Bialasinki +// +// 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/ + +// converts rgb() and #xxx to #xxxxxx format, +// returns self (or first argument) if not convertable +String.prototype.parseColor = function() { + var color = '#'; + if (this.slice(0,4) == 'rgb(') { + var cols = this.slice(4,this.length-1).split(','); + var i=0; do { color += parseInt(cols[i]).toColorPart() } while (++i<3); + } else { + if (this.slice(0,1) == '#') { + if (this.length==4) for(var i=1;i<4;i++) color += (this.charAt(i) + this.charAt(i)).toLowerCase(); + if (this.length==7) color = this.toLowerCase(); + } + } + return (color.length==7 ? color : (arguments[0] || this)); +}; + +/*--------------------------------------------------------------------------*/ + +Element.collectTextNodes = function(element) { + return $A($(element).childNodes).collect( function(node) { + return (node.nodeType==3 ? node.nodeValue : + (node.hasChildNodes() ? Element.collectTextNodes(node) : '')); + }).flatten().join(''); +}; + +Element.collectTextNodesIgnoreClass = function(element, className) { + return $A($(element).childNodes).collect( function(node) { + return (node.nodeType==3 ? node.nodeValue : + ((node.hasChildNodes() && !Element.hasClassName(node,className)) ? + Element.collectTextNodesIgnoreClass(node, className) : '')); + }).flatten().join(''); +}; + +Element.setContentZoom = function(element, percent) { + element = $(element); + element.setStyle({fontSize: (percent/100) + 'em'}); + if (Prototype.Browser.WebKit) window.scrollBy(0,0); + return element; +}; + +Element.getInlineOpacity = function(element){ + return $(element).style.opacity || ''; +}; + +Element.forceRerendering = function(element) { + try { + element = $(element); + var n = document.createTextNode(' '); + element.appendChild(n); + element.removeChild(n); + } catch(e) { } +}; + +/*--------------------------------------------------------------------------*/ + +var Effect = { + _elementDoesNotExistError: { + name: 'ElementDoesNotExistError', + message: 'The specified DOM element does not exist, but is required for this effect to operate' + }, + Transitions: { + linear: Prototype.K, + sinoidal: function(pos) { + return (-Math.cos(pos*Math.PI)/2) + .5; + }, + reverse: function(pos) { + return 1-pos; + }, + flicker: function(pos) { + var pos = ((-Math.cos(pos*Math.PI)/4) + .75) + Math.random()/4; + return pos > 1 ? 1 : pos; + }, + wobble: function(pos) { + return (-Math.cos(pos*Math.PI*(9*pos))/2) + .5; + }, + pulse: function(pos, pulses) { + return (-Math.cos((pos*((pulses||5)-.5)*2)*Math.PI)/2) + .5; + }, + spring: function(pos) { + return 1 - (Math.cos(pos * 4.5 * Math.PI) * Math.exp(-pos * 6)); + }, + none: function(pos) { + return 0; + }, + full: function(pos) { + return 1; + } + }, + DefaultOptions: { + duration: 1.0, // seconds + fps: 100, // 100= assume 66fps max. + sync: false, // true for combining + from: 0.0, + to: 1.0, + delay: 0.0, + queue: 'parallel' + }, + tagifyText: function(element) { + var tagifyStyle = 'position:relative'; + if (Prototype.Browser.IE) tagifyStyle += ';zoom:1'; + + element = $(element); + $A(element.childNodes).each( function(child) { + if (child.nodeType==3) { + child.nodeValue.toArray().each( function(character) { + element.insertBefore( + new Element('span', {style: tagifyStyle}).update( + character == ' ' ? String.fromCharCode(160) : character), + child); + }); + Element.remove(child); + } + }); + }, + multiple: function(element, effect) { + var elements; + if (((typeof element == 'object') || + Object.isFunction(element)) && + (element.length)) + elements = element; + else + elements = $(element).childNodes; + + var options = Object.extend({ + speed: 0.1, + delay: 0.0 + }, arguments[2] || { }); + var masterDelay = options.delay; + + $A(elements).each( function(element, index) { + new effect(element, Object.extend(options, { delay: index * options.speed + masterDelay })); + }); + }, + PAIRS: { + 'slide': ['SlideDown','SlideUp'], + 'blind': ['BlindDown','BlindUp'], + 'appear': ['Appear','Fade'] + }, + toggle: function(element, effect, options) { + element = $(element); + effect = (effect || 'appear').toLowerCase(); + + return Effect[ Effect.PAIRS[ effect ][ element.visible() ? 1 : 0 ] ](element, Object.extend({ + queue: { position:'end', scope:(element.id || 'global'), limit: 1 } + }, options || {})); + } +}; + +Effect.DefaultOptions.transition = Effect.Transitions.sinoidal; + +/* ------------- core effects ------------- */ + +Effect.ScopedQueue = Class.create(Enumerable, { + initialize: function() { + this.effects = []; + this.interval = null; + }, + _each: function(iterator) { + this.effects._each(iterator); + }, + add: function(effect) { + var timestamp = new Date().getTime(); + + var position = Object.isString(effect.options.queue) ? + effect.options.queue : effect.options.queue.position; + + switch(position) { + case 'front': + // move unstarted effects after this effect + this.effects.findAll(function(e){ return e.state=='idle' }).each( function(e) { + e.startOn += effect.finishOn; + e.finishOn += effect.finishOn; + }); + break; + case 'with-last': + timestamp = this.effects.pluck('startOn').max() || timestamp; + break; + case 'end': + // start effect after last queued effect has finished + timestamp = this.effects.pluck('finishOn').max() || timestamp; + break; + } + + effect.startOn += timestamp; + effect.finishOn += timestamp; + + if (!effect.options.queue.limit || (this.effects.length < effect.options.queue.limit)) + this.effects.push(effect); + + if (!this.interval) + this.interval = setInterval(this.loop.bind(this), 15); + }, + remove: function(effect) { + this.effects = this.effects.reject(function(e) { return e==effect }); + if (this.effects.length == 0) { + clearInterval(this.interval); + this.interval = null; + } + }, + loop: function() { + var timePos = new Date().getTime(); + for(var i=0, len=this.effects.length;i= this.startOn) { + if (timePos >= this.finishOn) { + this.render(1.0); + this.cancel(); + this.event('beforeFinish'); + if (this.finish) this.finish(); + this.event('afterFinish'); + return; + } + var pos = (timePos - this.startOn) / this.totalTime, + frame = (pos * this.totalFrames).round(); + if (frame > this.currentFrame) { + this.render(pos); + this.currentFrame = frame; + } + } + }, + cancel: function() { + if (!this.options.sync) + Effect.Queues.get(Object.isString(this.options.queue) ? + 'global' : this.options.queue.scope).remove(this); + this.state = 'finished'; + }, + event: function(eventName) { + if (this.options[eventName + 'Internal']) this.options[eventName + 'Internal'](this); + if (this.options[eventName]) this.options[eventName](this); + }, + inspect: function() { + var data = $H(); + for(property in this) + if (!Object.isFunction(this[property])) data.set(property, this[property]); + return '#'; + } +}); + +Effect.Parallel = Class.create(Effect.Base, { + initialize: function(effects) { + this.effects = effects || []; + this.start(arguments[1]); + }, + update: function(position) { + this.effects.invoke('render', position); + }, + finish: function(position) { + this.effects.each( function(effect) { + effect.render(1.0); + effect.cancel(); + effect.event('beforeFinish'); + if (effect.finish) effect.finish(position); + effect.event('afterFinish'); + }); + } +}); + +Effect.Tween = Class.create(Effect.Base, { + initialize: function(object, from, to) { + object = Object.isString(object) ? $(object) : object; + var args = $A(arguments), method = args.last(), + options = args.length == 5 ? args[3] : null; + this.method = Object.isFunction(method) ? method.bind(object) : + Object.isFunction(object[method]) ? object[method].bind(object) : + function(value) { object[method] = value }; + this.start(Object.extend({ from: from, to: to }, options || { })); + }, + update: function(position) { + this.method(position); + } +}); + +Effect.Event = Class.create(Effect.Base, { + initialize: function() { + this.start(Object.extend({ duration: 0 }, arguments[0] || { })); + }, + update: Prototype.emptyFunction +}); + +Effect.Opacity = Class.create(Effect.Base, { + initialize: function(element) { + this.element = $(element); + if (!this.element) throw(Effect._elementDoesNotExistError); + // make this work on IE on elements without 'layout' + if (Prototype.Browser.IE && (!this.element.currentStyle.hasLayout)) + this.element.setStyle({zoom: 1}); + var options = Object.extend({ + from: this.element.getOpacity() || 0.0, + to: 1.0 + }, arguments[1] || { }); + this.start(options); + }, + update: function(position) { + this.element.setOpacity(position); + } +}); + +Effect.Move = Class.create(Effect.Base, { + initialize: function(element) { + this.element = $(element); + if (!this.element) throw(Effect._elementDoesNotExistError); + var options = Object.extend({ + x: 0, + y: 0, + mode: 'relative' + }, arguments[1] || { }); + this.start(options); + }, + setup: function() { + this.element.makePositioned(); + this.originalLeft = parseFloat(this.element.getStyle('left') || '0'); + this.originalTop = parseFloat(this.element.getStyle('top') || '0'); + if (this.options.mode == 'absolute') { + this.options.x = this.options.x - this.originalLeft; + this.options.y = this.options.y - this.originalTop; + } + }, + update: function(position) { + this.element.setStyle({ + left: (this.options.x * position + this.originalLeft).round() + 'px', + top: (this.options.y * position + this.originalTop).round() + 'px' + }); + } +}); + +// for backwards compatibility +Effect.MoveBy = function(element, toTop, toLeft) { + return new Effect.Move(element, + Object.extend({ x: toLeft, y: toTop }, arguments[3] || { })); +}; + +Effect.Scale = Class.create(Effect.Base, { + initialize: function(element, percent) { + this.element = $(element); + if (!this.element) throw(Effect._elementDoesNotExistError); + var options = Object.extend({ + scaleX: true, + scaleY: true, + scaleContent: true, + scaleFromCenter: false, + scaleMode: 'box', // 'box' or 'contents' or { } with provided values + scaleFrom: 100.0, + scaleTo: percent + }, arguments[2] || { }); + this.start(options); + }, + setup: function() { + this.restoreAfterFinish = this.options.restoreAfterFinish || false; + this.elementPositioning = this.element.getStyle('position'); + + this.originalStyle = { }; + ['top','left','width','height','fontSize'].each( function(k) { + this.originalStyle[k] = this.element.style[k]; + }.bind(this)); + + this.originalTop = this.element.offsetTop; + this.originalLeft = this.element.offsetLeft; + + var fontSize = this.element.getStyle('font-size') || '100%'; + ['em','px','%','pt'].each( function(fontSizeType) { + if (fontSize.indexOf(fontSizeType)>0) { + this.fontSize = parseFloat(fontSize); + this.fontSizeType = fontSizeType; + } + }.bind(this)); + + this.factor = (this.options.scaleTo - this.options.scaleFrom)/100; + + this.dims = null; + if (this.options.scaleMode=='box') + this.dims = [this.element.offsetHeight, this.element.offsetWidth]; + if (/^content/.test(this.options.scaleMode)) + this.dims = [this.element.scrollHeight, this.element.scrollWidth]; + if (!this.dims) + this.dims = [this.options.scaleMode.originalHeight, + this.options.scaleMode.originalWidth]; + }, + update: function(position) { + var currentScale = (this.options.scaleFrom/100.0) + (this.factor * position); + if (this.options.scaleContent && this.fontSize) + this.element.setStyle({fontSize: this.fontSize * currentScale + this.fontSizeType }); + this.setDimensions(this.dims[0] * currentScale, this.dims[1] * currentScale); + }, + finish: function(position) { + if (this.restoreAfterFinish) this.element.setStyle(this.originalStyle); + }, + setDimensions: function(height, width) { + var d = { }; + if (this.options.scaleX) d.width = width.round() + 'px'; + if (this.options.scaleY) d.height = height.round() + 'px'; + if (this.options.scaleFromCenter) { + var topd = (height - this.dims[0])/2; + var leftd = (width - this.dims[1])/2; + if (this.elementPositioning == 'absolute') { + if (this.options.scaleY) d.top = this.originalTop-topd + 'px'; + if (this.options.scaleX) d.left = this.originalLeft-leftd + 'px'; + } else { + if (this.options.scaleY) d.top = -topd + 'px'; + if (this.options.scaleX) d.left = -leftd + 'px'; + } + } + this.element.setStyle(d); + } +}); + +Effect.Highlight = Class.create(Effect.Base, { + initialize: function(element) { + this.element = $(element); + if (!this.element) throw(Effect._elementDoesNotExistError); + var options = Object.extend({ startcolor: '#ffff99' }, arguments[1] || { }); + this.start(options); + }, + setup: function() { + // Prevent executing on elements not in the layout flow + if (this.element.getStyle('display')=='none') { this.cancel(); return; } + // Disable background image during the effect + this.oldStyle = { }; + if (!this.options.keepBackgroundImage) { + this.oldStyle.backgroundImage = this.element.getStyle('background-image'); + this.element.setStyle({backgroundImage: 'none'}); + } + if (!this.options.endcolor) + this.options.endcolor = this.element.getStyle('background-color').parseColor('#ffffff'); + if (!this.options.restorecolor) + this.options.restorecolor = this.element.getStyle('background-color'); + // init color calculations + this._base = $R(0,2).map(function(i){ return parseInt(this.options.startcolor.slice(i*2+1,i*2+3),16) }.bind(this)); + this._delta = $R(0,2).map(function(i){ return parseInt(this.options.endcolor.slice(i*2+1,i*2+3),16)-this._base[i] }.bind(this)); + }, + update: function(position) { + this.element.setStyle({backgroundColor: $R(0,2).inject('#',function(m,v,i){ + return m+((this._base[i]+(this._delta[i]*position)).round().toColorPart()); }.bind(this)) }); + }, + finish: function() { + this.element.setStyle(Object.extend(this.oldStyle, { + backgroundColor: this.options.restorecolor + })); + } +}); + +Effect.ScrollTo = function(element) { + var options = arguments[1] || { }, + scrollOffsets = document.viewport.getScrollOffsets(), + elementOffsets = $(element).cumulativeOffset(); + + if (options.offset) elementOffsets[1] += options.offset; + + return new Effect.Tween(null, + scrollOffsets.top, + elementOffsets[1], + options, + function(p){ scrollTo(scrollOffsets.left, p.round()); } + ); +}; + +/* ------------- combination effects ------------- */ + +Effect.Fade = function(element) { + element = $(element); + var oldOpacity = element.getInlineOpacity(); + var options = Object.extend({ + from: element.getOpacity() || 1.0, + to: 0.0, + afterFinishInternal: function(effect) { + if (effect.options.to!=0) return; + effect.element.hide().setStyle({opacity: oldOpacity}); + } + }, arguments[1] || { }); + return new Effect.Opacity(element,options); +}; + +Effect.Appear = function(element) { + element = $(element); + var options = Object.extend({ + from: (element.getStyle('display') == 'none' ? 0.0 : element.getOpacity() || 0.0), + to: 1.0, + // force Safari to render floated elements properly + afterFinishInternal: function(effect) { + effect.element.forceRerendering(); + }, + beforeSetup: function(effect) { + effect.element.setOpacity(effect.options.from).show(); + }}, arguments[1] || { }); + return new Effect.Opacity(element,options); +}; + +Effect.Puff = function(element) { + element = $(element); + var oldStyle = { + opacity: element.getInlineOpacity(), + position: element.getStyle('position'), + top: element.style.top, + left: element.style.left, + width: element.style.width, + height: element.style.height + }; + return new Effect.Parallel( + [ new Effect.Scale(element, 200, + { sync: true, scaleFromCenter: true, scaleContent: true, restoreAfterFinish: true }), + new Effect.Opacity(element, { sync: true, to: 0.0 } ) ], + Object.extend({ duration: 1.0, + beforeSetupInternal: function(effect) { + Position.absolutize(effect.effects[0].element); + }, + afterFinishInternal: function(effect) { + effect.effects[0].element.hide().setStyle(oldStyle); } + }, arguments[1] || { }) + ); +}; + +Effect.BlindUp = function(element) { + element = $(element); + element.makeClipping(); + return new Effect.Scale(element, 0, + Object.extend({ scaleContent: false, + scaleX: false, + restoreAfterFinish: true, + afterFinishInternal: function(effect) { + effect.element.hide().undoClipping(); + } + }, arguments[1] || { }) + ); +}; + +Effect.BlindDown = function(element) { + element = $(element); + var elementDimensions = element.getDimensions(); + return new Effect.Scale(element, 100, Object.extend({ + scaleContent: false, + scaleX: false, + scaleFrom: 0, + scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width}, + restoreAfterFinish: true, + afterSetup: function(effect) { + effect.element.makeClipping().setStyle({height: '0px'}).show(); + }, + afterFinishInternal: function(effect) { + effect.element.undoClipping(); + } + }, arguments[1] || { })); +}; + +Effect.SwitchOff = function(element) { + element = $(element); + var oldOpacity = element.getInlineOpacity(); + return new Effect.Appear(element, Object.extend({ + duration: 0.4, + from: 0, + transition: Effect.Transitions.flicker, + afterFinishInternal: function(effect) { + new Effect.Scale(effect.element, 1, { + duration: 0.3, scaleFromCenter: true, + scaleX: false, scaleContent: false, restoreAfterFinish: true, + beforeSetup: function(effect) { + effect.element.makePositioned().makeClipping(); + }, + afterFinishInternal: function(effect) { + effect.element.hide().undoClipping().undoPositioned().setStyle({opacity: oldOpacity}); + } + }); + } + }, arguments[1] || { })); +}; + +Effect.DropOut = function(element) { + element = $(element); + var oldStyle = { + top: element.getStyle('top'), + left: element.getStyle('left'), + opacity: element.getInlineOpacity() }; + return new Effect.Parallel( + [ new Effect.Move(element, {x: 0, y: 100, sync: true }), + new Effect.Opacity(element, { sync: true, to: 0.0 }) ], + Object.extend( + { duration: 0.5, + beforeSetup: function(effect) { + effect.effects[0].element.makePositioned(); + }, + afterFinishInternal: function(effect) { + effect.effects[0].element.hide().undoPositioned().setStyle(oldStyle); + } + }, arguments[1] || { })); +}; + +Effect.Shake = function(element) { + element = $(element); + var options = Object.extend({ + distance: 20, + duration: 0.5 + }, arguments[1] || {}); + var distance = parseFloat(options.distance); + var split = parseFloat(options.duration) / 10.0; + var oldStyle = { + top: element.getStyle('top'), + left: element.getStyle('left') }; + return new Effect.Move(element, + { x: distance, y: 0, duration: split, afterFinishInternal: function(effect) { + new Effect.Move(effect.element, + { x: -distance*2, y: 0, duration: split*2, afterFinishInternal: function(effect) { + new Effect.Move(effect.element, + { x: distance*2, y: 0, duration: split*2, afterFinishInternal: function(effect) { + new Effect.Move(effect.element, + { x: -distance*2, y: 0, duration: split*2, afterFinishInternal: function(effect) { + new Effect.Move(effect.element, + { x: distance*2, y: 0, duration: split*2, afterFinishInternal: function(effect) { + new Effect.Move(effect.element, + { x: -distance, y: 0, duration: split, afterFinishInternal: function(effect) { + effect.element.undoPositioned().setStyle(oldStyle); + }}); }}); }}); }}); }}); }}); +}; + +Effect.SlideDown = function(element) { + element = $(element).cleanWhitespace(); + // SlideDown need to have the content of the element wrapped in a container element with fixed height! + var oldInnerBottom = element.down().getStyle('bottom'); + var elementDimensions = element.getDimensions(); + return new Effect.Scale(element, 100, Object.extend({ + scaleContent: false, + scaleX: false, + scaleFrom: window.opera ? 0 : 1, + scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width}, + restoreAfterFinish: true, + afterSetup: function(effect) { + effect.element.makePositioned(); + effect.element.down().makePositioned(); + if (window.opera) effect.element.setStyle({top: ''}); + effect.element.makeClipping().setStyle({height: '0px'}).show(); + }, + afterUpdateInternal: function(effect) { + effect.element.down().setStyle({bottom: + (effect.dims[0] - effect.element.clientHeight) + 'px' }); + }, + afterFinishInternal: function(effect) { + effect.element.undoClipping().undoPositioned(); + effect.element.down().undoPositioned().setStyle({bottom: oldInnerBottom}); } + }, arguments[1] || { }) + ); +}; + +Effect.SlideUp = function(element) { + element = $(element).cleanWhitespace(); + var oldInnerBottom = element.down().getStyle('bottom'); + var elementDimensions = element.getDimensions(); + return new Effect.Scale(element, window.opera ? 0 : 1, + Object.extend({ scaleContent: false, + scaleX: false, + scaleMode: 'box', + scaleFrom: 100, + scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width}, + restoreAfterFinish: true, + afterSetup: function(effect) { + effect.element.makePositioned(); + effect.element.down().makePositioned(); + if (window.opera) effect.element.setStyle({top: ''}); + effect.element.makeClipping().show(); + }, + afterUpdateInternal: function(effect) { + effect.element.down().setStyle({bottom: + (effect.dims[0] - effect.element.clientHeight) + 'px' }); + }, + afterFinishInternal: function(effect) { + effect.element.hide().undoClipping().undoPositioned(); + effect.element.down().undoPositioned().setStyle({bottom: oldInnerBottom}); + } + }, arguments[1] || { }) + ); +}; + +// Bug in opera makes the TD containing this element expand for a instance after finish +Effect.Squish = function(element) { + return new Effect.Scale(element, window.opera ? 1 : 0, { + restoreAfterFinish: true, + beforeSetup: function(effect) { + effect.element.makeClipping(); + }, + afterFinishInternal: function(effect) { + effect.element.hide().undoClipping(); + } + }); +}; + +Effect.Grow = function(element) { + element = $(element); + var options = Object.extend({ + direction: 'center', + moveTransition: Effect.Transitions.sinoidal, + scaleTransition: Effect.Transitions.sinoidal, + opacityTransition: Effect.Transitions.full + }, arguments[1] || { }); + var oldStyle = { + top: element.style.top, + left: element.style.left, + height: element.style.height, + width: element.style.width, + opacity: element.getInlineOpacity() }; + + var dims = element.getDimensions(); + var initialMoveX, initialMoveY; + var moveX, moveY; + + switch (options.direction) { + case 'top-left': + initialMoveX = initialMoveY = moveX = moveY = 0; + break; + case 'top-right': + initialMoveX = dims.width; + initialMoveY = moveY = 0; + moveX = -dims.width; + break; + case 'bottom-left': + initialMoveX = moveX = 0; + initialMoveY = dims.height; + moveY = -dims.height; + break; + case 'bottom-right': + initialMoveX = dims.width; + initialMoveY = dims.height; + moveX = -dims.width; + moveY = -dims.height; + break; + case 'center': + initialMoveX = dims.width / 2; + initialMoveY = dims.height / 2; + moveX = -dims.width / 2; + moveY = -dims.height / 2; + break; + } + + return new Effect.Move(element, { + x: initialMoveX, + y: initialMoveY, + duration: 0.01, + beforeSetup: function(effect) { + effect.element.hide().makeClipping().makePositioned(); + }, + afterFinishInternal: function(effect) { + new Effect.Parallel( + [ new Effect.Opacity(effect.element, { sync: true, to: 1.0, from: 0.0, transition: options.opacityTransition }), + new Effect.Move(effect.element, { x: moveX, y: moveY, sync: true, transition: options.moveTransition }), + new Effect.Scale(effect.element, 100, { + scaleMode: { originalHeight: dims.height, originalWidth: dims.width }, + sync: true, scaleFrom: window.opera ? 1 : 0, transition: options.scaleTransition, restoreAfterFinish: true}) + ], Object.extend({ + beforeSetup: function(effect) { + effect.effects[0].element.setStyle({height: '0px'}).show(); + }, + afterFinishInternal: function(effect) { + effect.effects[0].element.undoClipping().undoPositioned().setStyle(oldStyle); + } + }, options) + ); + } + }); +}; + +Effect.Shrink = function(element) { + element = $(element); + var options = Object.extend({ + direction: 'center', + moveTransition: Effect.Transitions.sinoidal, + scaleTransition: Effect.Transitions.sinoidal, + opacityTransition: Effect.Transitions.none + }, arguments[1] || { }); + var oldStyle = { + top: element.style.top, + left: element.style.left, + height: element.style.height, + width: element.style.width, + opacity: element.getInlineOpacity() }; + + var dims = element.getDimensions(); + var moveX, moveY; + + switch (options.direction) { + case 'top-left': + moveX = moveY = 0; + break; + case 'top-right': + moveX = dims.width; + moveY = 0; + break; + case 'bottom-left': + moveX = 0; + moveY = dims.height; + break; + case 'bottom-right': + moveX = dims.width; + moveY = dims.height; + break; + case 'center': + moveX = dims.width / 2; + moveY = dims.height / 2; + break; + } + + return new Effect.Parallel( + [ new Effect.Opacity(element, { sync: true, to: 0.0, from: 1.0, transition: options.opacityTransition }), + new Effect.Scale(element, window.opera ? 1 : 0, { sync: true, transition: options.scaleTransition, restoreAfterFinish: true}), + new Effect.Move(element, { x: moveX, y: moveY, sync: true, transition: options.moveTransition }) + ], Object.extend({ + beforeStartInternal: function(effect) { + effect.effects[0].element.makePositioned().makeClipping(); + }, + afterFinishInternal: function(effect) { + effect.effects[0].element.hide().undoClipping().undoPositioned().setStyle(oldStyle); } + }, options) + ); +}; + +Effect.Pulsate = function(element) { + element = $(element); + var options = arguments[1] || { }, + oldOpacity = element.getInlineOpacity(), + transition = options.transition || Effect.Transitions.linear, + reverser = function(pos){ + return 1 - transition((-Math.cos((pos*(options.pulses||5)*2)*Math.PI)/2) + .5); + }; + + return new Effect.Opacity(element, + Object.extend(Object.extend({ duration: 2.0, from: 0, + afterFinishInternal: function(effect) { effect.element.setStyle({opacity: oldOpacity}); } + }, options), {transition: reverser})); +}; + +Effect.Fold = function(element) { + element = $(element); + var oldStyle = { + top: element.style.top, + left: element.style.left, + width: element.style.width, + height: element.style.height }; + element.makeClipping(); + return new Effect.Scale(element, 5, Object.extend({ + scaleContent: false, + scaleX: false, + afterFinishInternal: function(effect) { + new Effect.Scale(element, 1, { + scaleContent: false, + scaleY: false, + afterFinishInternal: function(effect) { + effect.element.hide().undoClipping().setStyle(oldStyle); + } }); + }}, arguments[1] || { })); +}; + +Effect.Morph = Class.create(Effect.Base, { + initialize: function(element) { + this.element = $(element); + if (!this.element) throw(Effect._elementDoesNotExistError); + var options = Object.extend({ + style: { } + }, arguments[1] || { }); + + if (!Object.isString(options.style)) this.style = $H(options.style); + else { + if (options.style.include(':')) + this.style = options.style.parseStyle(); + else { + this.element.addClassName(options.style); + this.style = $H(this.element.getStyles()); + this.element.removeClassName(options.style); + var css = this.element.getStyles(); + this.style = this.style.reject(function(style) { + return style.value == css[style.key]; + }); + options.afterFinishInternal = function(effect) { + effect.element.addClassName(effect.options.style); + effect.transforms.each(function(transform) { + effect.element.style[transform.style] = ''; + }); + }; + } + } + this.start(options); + }, + + setup: function(){ + function parseColor(color){ + if (!color || ['rgba(0, 0, 0, 0)','transparent'].include(color)) color = '#ffffff'; + color = color.parseColor(); + return $R(0,2).map(function(i){ + return parseInt( color.slice(i*2+1,i*2+3), 16 ); + }); + } + this.transforms = this.style.map(function(pair){ + var property = pair[0], value = pair[1], unit = null; + + if (value.parseColor('#zzzzzz') != '#zzzzzz') { + value = value.parseColor(); + unit = 'color'; + } else if (property == 'opacity') { + value = parseFloat(value); + if (Prototype.Browser.IE && (!this.element.currentStyle.hasLayout)) + this.element.setStyle({zoom: 1}); + } else if (Element.CSS_LENGTH.test(value)) { + var components = value.match(/^([\+\-]?[0-9\.]+)(.*)$/); + value = parseFloat(components[1]); + unit = (components.length == 3) ? components[2] : null; + } + + var originalValue = this.element.getStyle(property); + return { + style: property.camelize(), + originalValue: unit=='color' ? parseColor(originalValue) : parseFloat(originalValue || 0), + targetValue: unit=='color' ? parseColor(value) : value, + unit: unit + }; + }.bind(this)).reject(function(transform){ + return ( + (transform.originalValue == transform.targetValue) || + ( + transform.unit != 'color' && + (isNaN(transform.originalValue) || isNaN(transform.targetValue)) + ) + ); + }); + }, + update: function(position) { + var style = { }, transform, i = this.transforms.length; + while(i--) + style[(transform = this.transforms[i]).style] = + transform.unit=='color' ? '#'+ + (Math.round(transform.originalValue[0]+ + (transform.targetValue[0]-transform.originalValue[0])*position)).toColorPart() + + (Math.round(transform.originalValue[1]+ + (transform.targetValue[1]-transform.originalValue[1])*position)).toColorPart() + + (Math.round(transform.originalValue[2]+ + (transform.targetValue[2]-transform.originalValue[2])*position)).toColorPart() : + (transform.originalValue + + (transform.targetValue - transform.originalValue) * position).toFixed(3) + + (transform.unit === null ? '' : transform.unit); + this.element.setStyle(style, true); + } +}); + +Effect.Transform = Class.create({ + initialize: function(tracks){ + this.tracks = []; + this.options = arguments[1] || { }; + this.addTracks(tracks); + }, + addTracks: function(tracks){ + tracks.each(function(track){ + track = $H(track); + var data = track.values().first(); + this.tracks.push($H({ + ids: track.keys().first(), + effect: Effect.Morph, + options: { style: data } + })); + }.bind(this)); + return this; + }, + play: function(){ + return new Effect.Parallel( + this.tracks.map(function(track){ + var ids = track.get('ids'), effect = track.get('effect'), options = track.get('options'); + var elements = [$(ids) || $$(ids)].flatten(); + return elements.map(function(e){ return new effect(e, Object.extend({ sync:true }, options)) }); + }).flatten(), + this.options + ); + } +}); + +Element.CSS_PROPERTIES = $w( + 'backgroundColor backgroundPosition borderBottomColor borderBottomStyle ' + + 'borderBottomWidth borderLeftColor borderLeftStyle borderLeftWidth ' + + 'borderRightColor borderRightStyle borderRightWidth borderSpacing ' + + 'borderTopColor borderTopStyle borderTopWidth bottom clip color ' + + 'fontSize fontWeight height left letterSpacing lineHeight ' + + 'marginBottom marginLeft marginRight marginTop markerOffset maxHeight '+ + 'maxWidth minHeight minWidth opacity outlineColor outlineOffset ' + + 'outlineWidth paddingBottom paddingLeft paddingRight paddingTop ' + + 'right textIndent top width wordSpacing zIndex'); + +Element.CSS_LENGTH = /^(([\+\-]?[0-9\.]+)(em|ex|px|in|cm|mm|pt|pc|\%))|0$/; + +String.__parseStyleElement = document.createElement('div'); +String.prototype.parseStyle = function(){ + var style, styleRules = $H(); + if (Prototype.Browser.WebKit) + style = new Element('div',{style:this}).style; + else { + String.__parseStyleElement.innerHTML = '
            '; + style = String.__parseStyleElement.childNodes[0].style; + } + + Element.CSS_PROPERTIES.each(function(property){ + if (style[property]) styleRules.set(property, style[property]); + }); + + if (Prototype.Browser.IE && this.include('opacity')) + styleRules.set('opacity', this.match(/opacity:\s*((?:0|1)?(?:\.\d*)?)/)[1]); + + return styleRules; +}; + +if (document.defaultView && document.defaultView.getComputedStyle) { + Element.getStyles = function(element) { + var css = document.defaultView.getComputedStyle($(element), null); + return Element.CSS_PROPERTIES.inject({ }, function(styles, property) { + styles[property] = css[property]; + return styles; + }); + }; +} else { + Element.getStyles = function(element) { + element = $(element); + var css = element.currentStyle, styles; + styles = Element.CSS_PROPERTIES.inject({ }, function(results, property) { + results[property] = css[property]; + return results; + }); + if (!styles.opacity) styles.opacity = element.getOpacity(); + return styles; + }; +} + +Effect.Methods = { + morph: function(element, style) { + element = $(element); + new Effect.Morph(element, Object.extend({ style: style }, arguments[2] || { })); + return element; + }, + visualEffect: function(element, effect, options) { + element = $(element); + var s = effect.dasherize().camelize(), klass = s.charAt(0).toUpperCase() + s.substring(1); + new Effect[klass](element, options); + return element; + }, + highlight: function(element, options) { + element = $(element); + new Effect.Highlight(element, options); + return element; + } +}; + +$w('fade appear grow shrink fold blindUp blindDown slideUp slideDown '+ + 'pulsate shake puff squish switchOff dropOut').each( + function(effect) { + Effect.Methods[effect] = function(element, options){ + element = $(element); + Effect[effect.charAt(0).toUpperCase() + effect.substring(1)](element, options); + return element; + }; + } +); + +$w('getInlineOpacity forceRerendering setContentZoom collectTextNodes collectTextNodesIgnoreClass getStyles').each( + function(f) { Effect.Methods[f] = Element[f]; } +); + +Element.addMethods(Effect.Methods); \ No newline at end of file diff --git a/src/wp-includes/js/scriptaculous/scriptaculous.js b/src/wp-includes/js/scriptaculous/scriptaculous.js new file mode 100644 index 0000000..6bf437a --- /dev/null +++ b/src/wp-includes/js/scriptaculous/scriptaculous.js @@ -0,0 +1,68 @@ +// script.aculo.us scriptaculous.js v1.8.3, Thu Oct 08 11:23:33 +0200 2009 + +// Copyright (c) 2005-2009 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.3', + require: function(libraryName) { + try{ + // inserting via DOM fails in Safari 2.0, so brute force approach + document.write(' + + Notes: + You must provide set minimum_flash_version setting to "8" if you are using SWFUpload for Flash Player 8. + The swfuploadLoadFailed event is only fired if the minimum version of Flash Player is not met. Other issues such as missing SWF files, browser bugs + or corrupt Flash Player installations will not trigger this event. + The swfuploadPreLoad event is fired as soon as the minimum version of Flash Player is found. It does not wait for SWFUpload to load and can + be used to prepare the SWFUploadUI and hide alternate content. + swfobject's onDomReady event is cross-browser safe but will default to the window.onload event when DOMReady is not supported by the browser. + Early DOM Loading is supported in major modern browsers but cannot be guaranteed for every browser ever made. +*/ + + +// SWFObject v2.1 must be loaded + +var SWFUpload; +if (typeof(SWFUpload) === "function") { + SWFUpload.onload = function () {}; + + swfobject.addDomLoadEvent(function () { + if (typeof(SWFUpload.onload) === "function") { + setTimeout(function(){SWFUpload.onload.call(window);}, 200); + } + }); + + SWFUpload.prototype.initSettings = (function (oldInitSettings) { + return function () { + if (typeof(oldInitSettings) === "function") { + oldInitSettings.call(this); + } + + this.ensureDefault = function (settingName, defaultValue) { + this.settings[settingName] = (this.settings[settingName] == undefined) ? defaultValue : this.settings[settingName]; + }; + + this.ensureDefault("minimum_flash_version", "9.0.28"); + this.ensureDefault("swfupload_pre_load_handler", null); + this.ensureDefault("swfupload_load_failed_handler", null); + + delete this.ensureDefault; + + }; + })(SWFUpload.prototype.initSettings); + + + SWFUpload.prototype.loadFlash = function (oldLoadFlash) { + return function () { + var hasFlash = swfobject.hasFlashPlayerVersion(this.settings.minimum_flash_version); + + if (hasFlash) { + this.queueEvent("swfupload_pre_load_handler"); + if (typeof(oldLoadFlash) === "function") { + oldLoadFlash.call(this); + } + } else { + this.queueEvent("swfupload_load_failed_handler"); + } + }; + + }(SWFUpload.prototype.loadFlash); + + SWFUpload.prototype.displayDebugInfo = function (oldDisplayDebugInfo) { + return function () { + if (typeof(oldDisplayDebugInfo) === "function") { + oldDisplayDebugInfo.call(this); + } + + this.debug( + [ + "SWFUpload.SWFObject Plugin settings:", "\n", + "\t", "minimum_flash_version: ", this.settings.minimum_flash_version, "\n", + "\t", "swfupload_pre_load_handler assigned: ", (typeof(this.settings.swfupload_pre_load_handler) === "function").toString(), "\n", + "\t", "swfupload_load_failed_handler assigned: ", (typeof(this.settings.swfupload_load_failed_handler) === "function").toString(), "\n", + ].join("") + ); + }; + }(SWFUpload.prototype.displayDebugInfo); +} diff --git a/src/wp-includes/js/swfupload/swfupload-all.js b/src/wp-includes/js/swfupload/swfupload-all.js new file mode 100644 index 0000000..f18a138 --- /dev/null +++ b/src/wp-includes/js/swfupload/swfupload-all.js @@ -0,0 +1,8 @@ +// swfupload +var SWFUpload;if(SWFUpload==undefined){SWFUpload=function(a){this.initSWFUpload(a)}}SWFUpload.prototype.initSWFUpload=function(b){try{this.customSettings={};this.settings=b;this.eventQueue=[];this.movieName="SWFUpload_"+SWFUpload.movieCount++;this.movieElement=null;SWFUpload.instances[this.movieName]=this;this.initSettings();this.loadFlash()}catch(a){delete SWFUpload.instances[this.movieName];throw a}};SWFUpload.instances={};SWFUpload.movieCount=0;SWFUpload.version="2.2.0 2009-03-25";SWFUpload.QUEUE_ERROR={QUEUE_LIMIT_EXCEEDED:-100,FILE_EXCEEDS_SIZE_LIMIT:-110,ZERO_BYTE_FILE:-120,INVALID_FILETYPE:-130};SWFUpload.UPLOAD_ERROR={HTTP_ERROR:-200,MISSING_UPLOAD_URL:-210,IO_ERROR:-220,SECURITY_ERROR:-230,UPLOAD_LIMIT_EXCEEDED:-240,UPLOAD_FAILED:-250,SPECIFIED_FILE_ID_NOT_FOUND:-260,FILE_VALIDATION_FAILED:-270,FILE_CANCELLED:-280,UPLOAD_STOPPED:-290};SWFUpload.FILE_STATUS={QUEUED:-1,IN_PROGRESS:-2,ERROR:-3,COMPLETE:-4,CANCELLED:-5};SWFUpload.BUTTON_ACTION={SELECT_FILE:-100,SELECT_FILES:-110,START_UPLOAD:-120};SWFUpload.CURSOR={ARROW:-1,HAND:-2};SWFUpload.WINDOW_MODE={WINDOW:"window",TRANSPARENT:"transparent",OPAQUE:"opaque"};SWFUpload.completeURL=function(a){if(typeof(a)!=="string"||a.match(/^https?:\/\//i)||a.match(/^\//)){return a}var c,b;c=window.location.protocol+"//"+window.location.hostname+(window.location.port?":"+window.location.port:"");b=window.location.pathname.lastIndexOf("/");if(b<=0){path="/"}else{path=window.location.pathname.substr(0,b)+"/"}return path+a};SWFUpload.prototype.initSettings=function(){this.ensureDefault=function(b,a){this.settings[b]=(this.settings[b]==undefined)?a:this.settings[b]};this.ensureDefault("upload_url","");this.ensureDefault("preserve_relative_urls",false);this.ensureDefault("file_post_name","Filedata");this.ensureDefault("post_params",{});this.ensureDefault("use_query_string",false);this.ensureDefault("requeue_on_error",false);this.ensureDefault("http_success",[]);this.ensureDefault("assume_success_timeout",0);this.ensureDefault("file_types","*.*");this.ensureDefault("file_types_description","All Files");this.ensureDefault("file_size_limit",0);this.ensureDefault("file_upload_limit",0);this.ensureDefault("file_queue_limit",0);this.ensureDefault("flash_url","swfupload.swf");this.ensureDefault("prevent_swf_caching",true);this.ensureDefault("button_image_url","");this.ensureDefault("button_width",1);this.ensureDefault("button_height",1);this.ensureDefault("button_text","");this.ensureDefault("button_text_style","color: #000000; font-size: 16pt;");this.ensureDefault("button_text_top_padding",0);this.ensureDefault("button_text_left_padding",0);this.ensureDefault("button_action",SWFUpload.BUTTON_ACTION.SELECT_FILES);this.ensureDefault("button_disabled",false);this.ensureDefault("button_placeholder_id","");this.ensureDefault("button_placeholder",null);this.ensureDefault("button_cursor",SWFUpload.CURSOR.ARROW);this.ensureDefault("button_window_mode",SWFUpload.WINDOW_MODE.WINDOW);this.ensureDefault("debug",false);this.settings.debug_enabled=this.settings.debug;this.settings.return_upload_start_handler=this.returnUploadStart;this.ensureDefault("swfupload_loaded_handler",null);this.ensureDefault("file_dialog_start_handler",null);this.ensureDefault("file_queued_handler",null);this.ensureDefault("file_queue_error_handler",null);this.ensureDefault("file_dialog_complete_handler",null);this.ensureDefault("upload_start_handler",null);this.ensureDefault("upload_progress_handler",null);this.ensureDefault("upload_error_handler",null);this.ensureDefault("upload_success_handler",null);this.ensureDefault("upload_complete_handler",null);this.ensureDefault("debug_handler",this.debugMessage);this.ensureDefault("custom_settings",{});this.customSettings=this.settings.custom_settings;if(!!this.settings.prevent_swf_caching){this.settings.flash_url=this.settings.flash_url+(this.settings.flash_url.indexOf("?")<0?"?":"&")+"preventswfcaching="+new Date().getTime()}if(!this.settings.preserve_relative_urls){this.settings.upload_url=SWFUpload.completeURL(this.settings.upload_url);this.settings.button_image_url=SWFUpload.completeURL(this.settings.button_image_url)}delete this.ensureDefault};SWFUpload.prototype.loadFlash=function(){var a,b;if(document.getElementById(this.movieName)!==null){throw"ID "+this.movieName+" is already in use. The Flash Object could not be added"}a=document.getElementById(this.settings.button_placeholder_id)||this.settings.button_placeholder;if(a==undefined){throw"Could not find the placeholder element: "+this.settings.button_placeholder_id}b=document.createElement("div");b.innerHTML=this.getFlashHTML();a.parentNode.replaceChild(b.firstChild,a);if(window[this.movieName]==undefined){window[this.movieName]=this.getMovieElement()}};SWFUpload.prototype.getFlashHTML=function(){return['','','','','','','',""].join("")};SWFUpload.prototype.getFlashVars=function(){var b=this.buildParamString(),a=this.settings.http_success.join(",");return["movieName=",encodeURIComponent(this.movieName),"&uploadURL=",encodeURIComponent(this.settings.upload_url),"&useQueryString=",encodeURIComponent(this.settings.use_query_string),"&requeueOnError=",encodeURIComponent(this.settings.requeue_on_error),"&httpSuccess=",encodeURIComponent(a),"&assumeSuccessTimeout=",encodeURIComponent(this.settings.assume_success_timeout),"&params=",encodeURIComponent(b),"&filePostName=",encodeURIComponent(this.settings.file_post_name),"&fileTypes=",encodeURIComponent(this.settings.file_types),"&fileTypesDescription=",encodeURIComponent(this.settings.file_types_description),"&fileSizeLimit=",encodeURIComponent(this.settings.file_size_limit),"&fileUploadLimit=",encodeURIComponent(this.settings.file_upload_limit),"&fileQueueLimit=",encodeURIComponent(this.settings.file_queue_limit),"&debugEnabled=",encodeURIComponent(this.settings.debug_enabled),"&buttonImageURL=",encodeURIComponent(this.settings.button_image_url),"&buttonWidth=",encodeURIComponent(this.settings.button_width),"&buttonHeight=",encodeURIComponent(this.settings.button_height),"&buttonText=",encodeURIComponent(this.settings.button_text),"&buttonTextTopPadding=",encodeURIComponent(this.settings.button_text_top_padding),"&buttonTextLeftPadding=",encodeURIComponent(this.settings.button_text_left_padding),"&buttonTextStyle=",encodeURIComponent(this.settings.button_text_style),"&buttonAction=",encodeURIComponent(this.settings.button_action),"&buttonDisabled=",encodeURIComponent(this.settings.button_disabled),"&buttonCursor=",encodeURIComponent(this.settings.button_cursor)].join("")};SWFUpload.prototype.getMovieElement=function(){if(this.movieElement==undefined){this.movieElement=document.getElementById(this.movieName)}if(this.movieElement===null){throw"Could not find Flash element"}return this.movieElement};SWFUpload.prototype.buildParamString=function(){var c=this.settings.post_params,b=[],a;if(typeof(c)==="object"){for(a in c){if(c.hasOwnProperty(a)){b.push(encodeURIComponent(a.toString())+"="+encodeURIComponent(c[a].toString()))}}}return b.join("&")};SWFUpload.prototype.destroy=function(){try{this.cancelUpload(null,false);var a=null,c;a=this.getMovieElement();if(a&&typeof(a.CallFunction)==="unknown"){for(c in a){try{if(typeof(a[c])==="function"){a[c]=null}}catch(e){}}try{a.parentNode.removeChild(a)}catch(b){}}window[this.movieName]=null;SWFUpload.instances[this.movieName]=null;delete SWFUpload.instances[this.movieName];this.movieElement=null;this.settings=null;this.customSettings=null;this.eventQueue=null;this.movieName=null;return true}catch(d){return false}};SWFUpload.prototype.addSetting=function(b,c,a){if(c==undefined){return(this.settings[b]=a)}else{return(this.settings[b]=c)}};SWFUpload.prototype.getSetting=function(a){if(this.settings[a]!=undefined){return this.settings[a]}return""};SWFUpload.prototype.callFlash=function(functionName,argumentArray){argumentArray=argumentArray||[];var movieElement=this.getMovieElement(),returnValue,returnString;try{returnString=movieElement.CallFunction(''+__flash__argumentsToXML(argumentArray,0)+"");returnValue=eval(returnString)}catch(ex){throw"Call to "+functionName+" failed"}if(returnValue!=undefined&&typeof returnValue.post==="object"){returnValue=this.unescapeFilePostParams(returnValue)}return returnValue};SWFUpload.prototype.selectFile=function(){this.callFlash("SelectFile")};SWFUpload.prototype.selectFiles=function(){this.callFlash("SelectFiles")};SWFUpload.prototype.startUpload=function(a){this.callFlash("StartUpload",[a])};SWFUpload.prototype.cancelUpload=function(a,b){if(b!==false){b=true}this.callFlash("CancelUpload",[a,b])};SWFUpload.prototype.stopUpload=function(){this.callFlash("StopUpload")};SWFUpload.prototype.getStats=function(){return this.callFlash("GetStats")};SWFUpload.prototype.setStats=function(a){this.callFlash("SetStats",[a])};SWFUpload.prototype.getFile=function(a){if(typeof(a)==="number"){return this.callFlash("GetFileByIndex",[a])}else{return this.callFlash("GetFile",[a])}};SWFUpload.prototype.addFileParam=function(a,b,c){return this.callFlash("AddFileParam",[a,b,c])};SWFUpload.prototype.removeFileParam=function(a,b){this.callFlash("RemoveFileParam",[a,b])};SWFUpload.prototype.setUploadURL=function(a){this.settings.upload_url=a.toString();this.callFlash("SetUploadURL",[a])};SWFUpload.prototype.setPostParams=function(a){this.settings.post_params=a;this.callFlash("SetPostParams",[a])};SWFUpload.prototype.addPostParam=function(a,b){this.settings.post_params[a]=b;this.callFlash("SetPostParams",[this.settings.post_params])};SWFUpload.prototype.removePostParam=function(a){delete this.settings.post_params[a];this.callFlash("SetPostParams",[this.settings.post_params])};SWFUpload.prototype.setFileTypes=function(a,b){this.settings.file_types=a;this.settings.file_types_description=b;this.callFlash("SetFileTypes",[a,b])};SWFUpload.prototype.setFileSizeLimit=function(a){this.settings.file_size_limit=a;this.callFlash("SetFileSizeLimit",[a])};SWFUpload.prototype.setFileUploadLimit=function(a){this.settings.file_upload_limit=a;this.callFlash("SetFileUploadLimit",[a])};SWFUpload.prototype.setFileQueueLimit=function(a){this.settings.file_queue_limit=a;this.callFlash("SetFileQueueLimit",[a])};SWFUpload.prototype.setFilePostName=function(a){this.settings.file_post_name=a;this.callFlash("SetFilePostName",[a])};SWFUpload.prototype.setUseQueryString=function(a){this.settings.use_query_string=a;this.callFlash("SetUseQueryString",[a])};SWFUpload.prototype.setRequeueOnError=function(a){this.settings.requeue_on_error=a;this.callFlash("SetRequeueOnError",[a])};SWFUpload.prototype.setHTTPSuccess=function(a){if(typeof a==="string"){a=a.replace(" ","").split(",")}this.settings.http_success=a;this.callFlash("SetHTTPSuccess",[a])};SWFUpload.prototype.setAssumeSuccessTimeout=function(a){this.settings.assume_success_timeout=a;this.callFlash("SetAssumeSuccessTimeout",[a])};SWFUpload.prototype.setDebugEnabled=function(a){this.settings.debug_enabled=a;this.callFlash("SetDebugEnabled",[a])};SWFUpload.prototype.setButtonImageURL=function(a){if(a==undefined){a=""}this.settings.button_image_url=a;this.callFlash("SetButtonImageURL",[a])};SWFUpload.prototype.setButtonDimensions=function(c,a){this.settings.button_width=c;this.settings.button_height=a;var b=this.getMovieElement();if(b!=undefined){b.style.width=c+"px";b.style.height=a+"px"}this.callFlash("SetButtonDimensions",[c,a])};SWFUpload.prototype.setButtonText=function(a){this.settings.button_text=a;this.callFlash("SetButtonText",[a])};SWFUpload.prototype.setButtonTextPadding=function(b,a){this.settings.button_text_top_padding=a;this.settings.button_text_left_padding=b;this.callFlash("SetButtonTextPadding",[b,a])};SWFUpload.prototype.setButtonTextStyle=function(a){this.settings.button_text_style=a;this.callFlash("SetButtonTextStyle",[a])};SWFUpload.prototype.setButtonDisabled=function(a){this.settings.button_disabled=a;this.callFlash("SetButtonDisabled",[a])};SWFUpload.prototype.setButtonAction=function(a){this.settings.button_action=a;this.callFlash("SetButtonAction",[a])};SWFUpload.prototype.setButtonCursor=function(a){this.settings.button_cursor=a;this.callFlash("SetButtonCursor",[a])};SWFUpload.prototype.queueEvent=function(b,c){if(c==undefined){c=[]}else{if(!(c instanceof Array)){c=[c]}}var a=this;if(typeof this.settings[b]==="function"){this.eventQueue.push(function(){this.settings[b].apply(this,c)});setTimeout(function(){a.executeNextEvent()},0)}else{if(this.settings[b]!==null){throw"Event handler "+b+" is unknown or is not a function"}}};SWFUpload.prototype.executeNextEvent=function(){var a=this.eventQueue?this.eventQueue.shift():null;if(typeof(a)==="function"){a.apply(this)}};SWFUpload.prototype.unescapeFilePostParams=function(c){var e=/[$]([0-9a-f]{4})/i,f={},d,a,b;if(c!=undefined){for(a in c.post){if(c.post.hasOwnProperty(a)){d=a;while((b=e.exec(d))!==null){d=d.replace(b[0],String.fromCharCode(parseInt("0x"+b[1],16)))}f[d]=c.post[a]}}c.post=f}return c};SWFUpload.prototype.testExternalInterface=function(){try{return this.callFlash("TestExternalInterface")}catch(a){return false}};SWFUpload.prototype.flashReady=function(){var a=this.getMovieElement();if(!a){this.debug("Flash called back ready but the flash movie can't be found.");return}this.cleanUp(a);this.queueEvent("swfupload_loaded_handler")};SWFUpload.prototype.cleanUp=function(a){var c;try{if(this.movieElement&&typeof(a.CallFunction)==="unknown"){this.debug("Removing Flash functions hooks (this should only run in IE and should prevent memory leaks)");for(c in a){try{if(typeof(a[c])==="function"){a[c]=null}}catch(b){}}}}catch(d){}window.__flash__removeCallback=function(e,f){try{if(e){e[f]=null}}catch(g){}}};SWFUpload.prototype.fileDialogStart=function(){this.queueEvent("file_dialog_start_handler")};SWFUpload.prototype.fileQueued=function(a){a=this.unescapeFilePostParams(a);this.queueEvent("file_queued_handler",a)};SWFUpload.prototype.fileQueueError=function(a,c,b){a=this.unescapeFilePostParams(a);this.queueEvent("file_queue_error_handler",[a,c,b])};SWFUpload.prototype.fileDialogComplete=function(b,c,a){this.queueEvent("file_dialog_complete_handler",[b,c,a])};SWFUpload.prototype.uploadStart=function(a){a=this.unescapeFilePostParams(a);this.queueEvent("return_upload_start_handler",a)};SWFUpload.prototype.returnUploadStart=function(a){var b;if(typeof this.settings.upload_start_handler==="function"){a=this.unescapeFilePostParams(a);b=this.settings.upload_start_handler.call(this,a)}else{if(this.settings.upload_start_handler!=undefined){throw"upload_start_handler must be a function"}}if(b===undefined){b=true}b=!!b;this.callFlash("ReturnUploadStart",[b])};SWFUpload.prototype.uploadProgress=function(a,c,b){a=this.unescapeFilePostParams(a);this.queueEvent("upload_progress_handler",[a,c,b])};SWFUpload.prototype.uploadError=function(a,c,b){a=this.unescapeFilePostParams(a);this.queueEvent("upload_error_handler",[a,c,b])};SWFUpload.prototype.uploadSuccess=function(b,a,c){b=this.unescapeFilePostParams(b);this.queueEvent("upload_success_handler",[b,a,c])};SWFUpload.prototype.uploadComplete=function(a){a=this.unescapeFilePostParams(a);this.queueEvent("upload_complete_handler",a)};SWFUpload.prototype.debug=function(a){this.queueEvent("debug_handler",a)}; +// swfupload.queue +var SWFUpload;if(typeof(SWFUpload)==="function"){SWFUpload.queue={};SWFUpload.prototype.initSettings=(function(a){return function(){if(typeof(a)==="function"){a.call(this)}this.queueSettings={};this.queueSettings.queue_cancelled_flag=false;this.queueSettings.queue_upload_count=0;this.queueSettings.user_upload_complete_handler=this.settings.upload_complete_handler;this.queueSettings.user_upload_start_handler=this.settings.upload_start_handler;this.settings.upload_complete_handler=SWFUpload.queue.uploadCompleteHandler;this.settings.upload_start_handler=SWFUpload.queue.uploadStartHandler;this.settings.queue_complete_handler=this.settings.queue_complete_handler||null}})(SWFUpload.prototype.initSettings);SWFUpload.prototype.startUpload=function(a){this.queueSettings.queue_cancelled_flag=false;this.callFlash("StartUpload",[a])};SWFUpload.prototype.cancelQueue=function(){this.queueSettings.queue_cancelled_flag=true;this.stopUpload();var a=this.getStats();while(a.files_queued>0){this.cancelUpload();a=this.getStats()}};SWFUpload.queue.uploadStartHandler=function(a){var b;if(typeof(this.queueSettings.user_upload_start_handler)==="function"){b=this.queueSettings.user_upload_start_handler.call(this,a)}b=(b===false)?false:true;this.queueSettings.queue_cancelled_flag=!b;return b};SWFUpload.queue.uploadCompleteHandler=function(b){var c=this.queueSettings.user_upload_complete_handler,d,a;if(b.filestatus===SWFUpload.FILE_STATUS.COMPLETE){this.queueSettings.queue_upload_count++}if(typeof(c)==="function"){d=(c.call(this,b)===false)?false:true}else{if(b.filestatus===SWFUpload.FILE_STATUS.QUEUED){d=false}else{d=true}}if(d){a=this.getStats();if(a.files_queued>0&&this.queueSettings.queue_cancelled_flag===false){this.startUpload()}else{if(this.queueSettings.queue_cancelled_flag===false){this.queueEvent("queue_complete_handler",[this.queueSettings.queue_upload_count]);this.queueSettings.queue_upload_count=0}else{this.queueSettings.queue_cancelled_flag=false;this.queueSettings.queue_upload_count=0}}}}}; +// swfobject +var swfobject=function(){var b="undefined",Q="object",n="Shockwave Flash",p="ShockwaveFlash.ShockwaveFlash",P="application/x-shockwave-flash",m="SWFObjectExprInst",j=window,K=document,T=navigator,o=[],N=[],i=[],d=[],J,Z=null,M=null,l=null,e=false,A=false;var h=function(){var v=typeof K.getElementById!=b&&typeof K.getElementsByTagName!=b&&typeof K.createElement!=b,AC=[0,0,0],x=null;if(typeof T.plugins!=b&&typeof T.plugins[n]==Q){x=T.plugins[n].description;if(x&&!(typeof T.mimeTypes!=b&&T.mimeTypes[P]&&!T.mimeTypes[P].enabledPlugin)){x=x.replace(/^.*\s+(\S+\s+\S+$)/,"$1");AC[0]=parseInt(x.replace(/^(.*)\..*$/,"$1"),10);AC[1]=parseInt(x.replace(/^.*\.(.*)\s.*$/,"$1"),10);AC[2]=/r/.test(x)?parseInt(x.replace(/^.*r(.*)$/,"$1"),10):0}}else{if(typeof j.ActiveXObject!=b){var y=null,AB=false;try{y=new ActiveXObject(p+".7")}catch(t){try{y=new ActiveXObject(p+".6");AC=[6,0,21];y.AllowScriptAccess="always"}catch(t){if(AC[0]==6){AB=true}}if(!AB){try{y=new ActiveXObject(p)}catch(t){}}}if(!AB&&y){try{x=y.GetVariable("$version");if(x){x=x.split(" ")[1].split(",");AC=[parseInt(x[0],10),parseInt(x[1],10),parseInt(x[2],10)]}}catch(t){}}}}var AD=T.userAgent.toLowerCase(),r=T.platform.toLowerCase(),AA=/webkit/.test(AD)?parseFloat(AD.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,q=false,z=r?/win/.test(r):/win/.test(AD),w=r?/mac/.test(r):/mac/.test(AD);/*@cc_on q=true;@if(@_win32)z=true;@elif(@_mac)w=true;@end@*/return{w3cdom:v,pv:AC,webkit:AA,ie:q,win:z,mac:w}}();var L=function(){if(!h.w3cdom){return }f(H);if(h.ie&&h.win){try{K.write(" + + + +
            + +
            + + + + + diff --git a/src/wp-includes/js/tinymce/plugins/inlinepopups/editor_plugin.js b/src/wp-includes/js/tinymce/plugins/inlinepopups/editor_plugin.js new file mode 100644 index 0000000..ef64817 --- /dev/null +++ b/src/wp-includes/js/tinymce/plugins/inlinepopups/editor_plugin.js @@ -0,0 +1 @@ +(function(){var d=tinymce.DOM,b=tinymce.dom.Element,a=tinymce.dom.Event,e=tinymce.each,c=tinymce.is;tinymce.create("tinymce.plugins.InlinePopups",{init:function(f,g){f.onBeforeRenderUI.add(function(){f.windowManager=new tinymce.InlineWindowManager(f);d.loadCSS(g+"/skins/"+(f.settings.inlinepopups_skin||"clearlooks2")+"/window.css")})},getInfo:function(){return{longname:"InlinePopups",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/inlinepopups",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.create("tinymce.InlineWindowManager:tinymce.WindowManager",{InlineWindowManager:function(f){var g=this;g.parent(f);g.zIndex=300000;g.count=0;g.windows={}},open:function(s,j){var z=this,i,k="",r=z.editor,g=0,v=0,h,m,o,q,l,x,y,n;s=s||{};j=j||{};if(!s.inline){return z.parent(s,j)}n=z._frontWindow();if(n&&d.get(n.id+"_ifr")){n.focussedElement=d.get(n.id+"_ifr").contentWindow.document.activeElement}if(!s.type){z.bookmark=r.selection.getBookmark(1)}i=d.uniqueId();h=d.getViewPort();s.width=parseInt(s.width||320);s.height=parseInt(s.height||240)+(tinymce.isIE?8:0);s.min_width=parseInt(s.min_width||150);s.min_height=parseInt(s.min_height||100);s.max_width=parseInt(s.max_width||2000);s.max_height=parseInt(s.max_height||2000);s.left=s.left||Math.round(Math.max(h.x,h.x+(h.w/2)-(s.width/2)));s.top=s.top||Math.round(Math.max(h.y,h.y+(h.h/2)-(s.height/2)));s.movable=s.resizable=true;j.mce_width=s.width;j.mce_height=s.height;j.mce_inline=true;j.mce_window_id=i;j.mce_auto_focus=s.auto_focus;z.features=s;z.params=j;z.onOpen.dispatch(z,s,j);if(s.type){k+=" mceModal";if(s.type){k+=" mce"+s.type.substring(0,1).toUpperCase()+s.type.substring(1)}s.resizable=false}if(s.statusbar){k+=" mceStatusbar"}if(s.resizable){k+=" mceResizable"}if(s.minimizable){k+=" mceMinimizable"}if(s.maximizable){k+=" mceMaximizable"}if(s.movable){k+=" mceMovable"}z._addAll(d.doc.body,["div",{id:i,role:"dialog","aria-labelledby":s.type?i+"_content":i+"_title","class":(r.settings.inlinepopups_skin||"clearlooks2")+(tinymce.isIE&&window.getSelection?" ie9":""),style:"width:100px;height:100px"},["div",{id:i+"_wrapper","class":"mceWrapper"+k},["div",{id:i+"_top","class":"mceTop"},["div",{"class":"mceLeft"}],["div",{"class":"mceCenter"}],["div",{"class":"mceRight"}],["span",{id:i+"_title"},s.title||""]],["div",{id:i+"_middle","class":"mceMiddle"},["div",{id:i+"_left","class":"mceLeft",tabindex:"0"}],["span",{id:i+"_content"}],["div",{id:i+"_right","class":"mceRight",tabindex:"0"}]],["div",{id:i+"_bottom","class":"mceBottom"},["div",{"class":"mceLeft"}],["div",{"class":"mceCenter"}],["div",{"class":"mceRight"}],["span",{id:i+"_status"},"Content"]],["a",{"class":"mceMove",tabindex:"-1",href:"javascript:;"}],["a",{"class":"mceMin",tabindex:"-1",href:"javascript:;",onmousedown:"return false;"}],["a",{"class":"mceMax",tabindex:"-1",href:"javascript:;",onmousedown:"return false;"}],["a",{"class":"mceMed",tabindex:"-1",href:"javascript:;",onmousedown:"return false;"}],["a",{"class":"mceClose",tabindex:"-1",href:"javascript:;",onmousedown:"return false;"}],["a",{id:i+"_resize_n","class":"mceResize mceResizeN",tabindex:"-1",href:"javascript:;"}],["a",{id:i+"_resize_s","class":"mceResize mceResizeS",tabindex:"-1",href:"javascript:;"}],["a",{id:i+"_resize_w","class":"mceResize mceResizeW",tabindex:"-1",href:"javascript:;"}],["a",{id:i+"_resize_e","class":"mceResize mceResizeE",tabindex:"-1",href:"javascript:;"}],["a",{id:i+"_resize_nw","class":"mceResize mceResizeNW",tabindex:"-1",href:"javascript:;"}],["a",{id:i+"_resize_ne","class":"mceResize mceResizeNE",tabindex:"-1",href:"javascript:;"}],["a",{id:i+"_resize_sw","class":"mceResize mceResizeSW",tabindex:"-1",href:"javascript:;"}],["a",{id:i+"_resize_se","class":"mceResize mceResizeSE",tabindex:"-1",href:"javascript:;"}]]]);d.setStyles(i,{top:-10000,left:-10000});if(tinymce.isGecko){d.setStyle(i,"overflow","auto")}if(!s.type){g+=d.get(i+"_left").clientWidth;g+=d.get(i+"_right").clientWidth;v+=d.get(i+"_top").clientHeight;v+=d.get(i+"_bottom").clientHeight}d.setStyles(i,{top:s.top,left:s.left,width:s.width+g,height:s.height+v});y=s.url||s.file;if(y){if(tinymce.relaxedDomain){y+=(y.indexOf("?")==-1?"?":"&")+"mce_rdomain="+tinymce.relaxedDomain}y=tinymce._addVer(y)}if(!s.type){d.add(i+"_content","iframe",{id:i+"_ifr",src:'javascript:""',frameBorder:0,style:"border:0;width:10px;height:10px"});d.setStyles(i+"_ifr",{width:s.width,height:s.height});d.setAttrib(i+"_ifr","src",y)}else{d.add(i+"_wrapper","a",{id:i+"_ok","class":"mceButton mceOk",href:"javascript:;",onmousedown:"return false;"},"Ok");if(s.type=="confirm"){d.add(i+"_wrapper","a",{"class":"mceButton mceCancel",href:"javascript:;",onmousedown:"return false;"},"Cancel")}d.add(i+"_middle","div",{"class":"mceIcon"});d.setHTML(i+"_content",s.content.replace("\n","
            "));a.add(i,"keyup",function(f){var p=27;if(f.keyCode===p){s.button_func(false);return a.cancel(f)}});a.add(i,"keydown",function(f){var t,p=9;if(f.keyCode===p){t=d.select("a.mceCancel",i+"_wrapper")[0];if(t&&t!==f.target){t.focus()}else{d.get(i+"_ok").focus()}return a.cancel(f)}})}o=a.add(i,"mousedown",function(t){var u=t.target,f,p;f=z.windows[i];z.focus(i);if(u.nodeName=="A"||u.nodeName=="a"){if(u.className=="mceMax"){f.oldPos=f.element.getXY();f.oldSize=f.element.getSize();p=d.getViewPort();p.w-=2;p.h-=2;f.element.moveTo(p.x,p.y);f.element.resizeTo(p.w,p.h);d.setStyles(i+"_ifr",{width:p.w-f.deltaWidth,height:p.h-f.deltaHeight});d.addClass(i+"_wrapper","mceMaximized")}else{if(u.className=="mceMed"){f.element.moveTo(f.oldPos.x,f.oldPos.y);f.element.resizeTo(f.oldSize.w,f.oldSize.h);f.iframeElement.resizeTo(f.oldSize.w-f.deltaWidth,f.oldSize.h-f.deltaHeight);d.removeClass(i+"_wrapper","mceMaximized")}else{if(u.className=="mceMove"){return z._startDrag(i,t,u.className)}else{if(d.hasClass(u,"mceResize")){return z._startDrag(i,t,u.className.substring(13))}}}}}});q=a.add(i,"click",function(f){var p=f.target;z.focus(i);if(p.nodeName=="A"||p.nodeName=="a"){switch(p.className){case"mceClose":z.close(null,i);return a.cancel(f);case"mceButton mceOk":case"mceButton mceCancel":s.button_func(p.className=="mceButton mceOk");return a.cancel(f)}}});a.add([i+"_left",i+"_right"],"focus",function(p){var t=d.get(i+"_ifr");if(t){var f=t.contentWindow.document.body;var u=d.select(":input:enabled,*[tabindex=0]",f);if(p.target.id===(i+"_left")){u[u.length-1].focus()}else{u[0].focus()}}else{d.get(i+"_ok").focus()}});x=z.windows[i]={id:i,mousedown_func:o,click_func:q,element:new b(i,{blocker:1,container:r.getContainer()}),iframeElement:new b(i+"_ifr"),features:s,deltaWidth:g,deltaHeight:v};x.iframeElement.on("focus",function(){z.focus(i)});if(z.count==0&&z.editor.getParam("dialog_type","modal")=="modal"){d.add(d.doc.body,"div",{id:"mceModalBlocker","class":(z.editor.settings.inlinepopups_skin||"clearlooks2")+"_modalBlocker",style:{zIndex:z.zIndex-1}});d.show("mceModalBlocker");d.setAttrib(d.doc.body,"aria-hidden","true")}else{d.setStyle("mceModalBlocker","z-index",z.zIndex-1)}if(tinymce.isIE6||/Firefox\/2\./.test(navigator.userAgent)||(tinymce.isIE&&!d.boxModel)){d.setStyles("mceModalBlocker",{position:"absolute",left:h.x,top:h.y,width:h.w-2,height:h.h-2})}d.setAttrib(i,"aria-hidden","false");z.focus(i);z._fixIELayout(i,1);if(d.get(i+"_ok")){d.get(i+"_ok").focus()}z.count++;return x},focus:function(h){var g=this,f;if(f=g.windows[h]){f.zIndex=this.zIndex++;f.element.setStyle("zIndex",f.zIndex);f.element.update();h=h+"_wrapper";d.removeClass(g.lastId,"mceFocus");d.addClass(h,"mceFocus");g.lastId=h;if(f.focussedElement){f.focussedElement.focus()}else{if(d.get(h+"_ok")){d.get(f.id+"_ok").focus()}else{if(d.get(f.id+"_ifr")){d.get(f.id+"_ifr").focus()}}}}},_addAll:function(k,h){var g,l,f=this,j=tinymce.DOM;if(c(h,"string")){k.appendChild(j.doc.createTextNode(h))}else{if(h.length){k=k.appendChild(j.create(h[0],h[1]));for(g=2;gf){g=h;f=h.zIndex}});return g},setTitle:function(f,g){var h;f=this._findId(f);if(h=d.get(f+"_title")){h.innerHTML=d.encode(g)}},alert:function(g,f,j){var i=this,h;h=i.open({title:i,type:"alert",button_func:function(k){if(f){f.call(k||i,k)}i.close(null,h.id)},content:d.encode(i.editor.getLang(g,g)),inline:1,width:400,height:130})},confirm:function(g,f,j){var i=this,h;h=i.open({title:i,type:"confirm",button_func:function(k){if(f){f.call(k||i,k)}i.close(null,h.id)},content:d.encode(i.editor.getLang(g,g)),inline:1,width:400,height:130})},_findId:function(f){var g=this;if(typeof(f)=="string"){return f}e(g.windows,function(h){var i=d.get(h.id+"_ifr");if(i&&f==i.contentWindow){f=h.id;return false}});return f},_fixIELayout:function(i,h){var f,g;if(!tinymce.isIE6){return}e(["n","s","w","e","nw","ne","sw","se"],function(j){var k=d.get(i+"_resize_"+j);d.setStyles(k,{width:h?k.clientWidth:"",height:h?k.clientHeight:"",cursor:d.getStyle(k,"cursor",1)});d.setStyle(i+"_bottom","bottom","-1px");k=0});if(f=this.windows[i]){f.element.hide();f.element.show();e(d.select("div,a",i),function(k,j){if(k.currentStyle.backgroundImage!="none"){g=new Image();g.src=k.currentStyle.backgroundImage.replace(/url\(\"(.+)\"\)/,"$1")}});d.get(i).style.filter=""}}});tinymce.PluginManager.add("inlinepopups",tinymce.plugins.InlinePopups)})(); \ No newline at end of file diff --git a/src/wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/alert.gif b/src/wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/alert.gif new file mode 100644 index 0000000..94abd08 Binary files /dev/null and b/src/wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/alert.gif differ diff --git a/src/wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/button.gif b/src/wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/button.gif new file mode 100644 index 0000000..e671094 Binary files /dev/null and b/src/wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/button.gif differ diff --git a/src/wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/buttons.gif b/src/wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/buttons.gif new file mode 100644 index 0000000..b408ae1 Binary files /dev/null and b/src/wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/buttons.gif differ diff --git a/src/wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/confirm.gif b/src/wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/confirm.gif new file mode 100644 index 0000000..497307a Binary files /dev/null and b/src/wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/confirm.gif differ diff --git a/src/wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/corners.gif b/src/wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/corners.gif new file mode 100644 index 0000000..c894b2e Binary files /dev/null and b/src/wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/corners.gif differ diff --git a/src/wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/drag.gif b/src/wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/drag.gif new file mode 100644 index 0000000..bf0a03e Binary files /dev/null and b/src/wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/drag.gif differ diff --git a/src/wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/horizontal.gif b/src/wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/horizontal.gif new file mode 100644 index 0000000..c2a2ad4 Binary files /dev/null and b/src/wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/horizontal.gif differ diff --git a/src/wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/vertical.gif b/src/wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/vertical.gif new file mode 100644 index 0000000..43a735f Binary files /dev/null and b/src/wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/vertical.gif differ diff --git a/src/wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/window.css b/src/wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/window.css new file mode 100644 index 0000000..1001789 --- /dev/null +++ b/src/wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/window.css @@ -0,0 +1,136 @@ +/* Clearlooks 2 */ + +/* Reset */ +.clearlooks2, .clearlooks2 div, .clearlooks2 span, .clearlooks2 a {vertical-align:baseline; text-align:left; position:absolute; border:0; padding:0; margin:0; background:transparent; font-family:Arial,Verdana; font-size:11px; color:#000; text-decoration:none; font-weight:normal; width:auto; height:auto; overflow:hidden; display:block} + +/* General */ +.clearlooks2 {position:absolute; direction:ltr} +.clearlooks2 .mceWrapper {position:static} +.mceEventBlocker {position:fixed; left:0; top:0; background:url(img/horizontal.gif) no-repeat 0 -75px; width:100%; height:100%} +.clearlooks2 .mcePlaceHolder {border:1px solid #000; background:#888; top:0; left:0; opacity:0.5; -ms-filter:'alpha(opacity=50)'; filter:alpha(opacity=50)} +.clearlooks2_modalBlocker {position:fixed; left:0; top:0; width:100%; height:100%; background:#FFF; opacity:0.6; -ms-filter:'alpha(opacity=60)'; filter:alpha(opacity=60); display:none} + +/* Top */ +.clearlooks2 .mceTop, +.clearlooks2 .mceTop div { + top:0; + width:100%; + height:23px +} +.clearlooks2 .mceTop .mceLeft { + width:55%; + background-image: none; + border-style: solid none none solid; + border-width: 1px; +} +.clearlooks2 .mceTop .mceCenter { +} +.clearlooks2 .mceTop .mceRight { + right:0; + width:55%; + height:23px; + background-image: none; + border-style: solid solid none none; + border-width: 1px; +} +.clearlooks2 .mceTop span { + width:100%; + font: 12px/20px bold "Lucida Grande","Lucida Sans Unicode",Tahoma,Verdana,sans-serif; + text-align:center; + vertical-align:middle; + line-height:23px; + font-weight:bold; +} +.clearlooks2 .mceFocus .mceTop .mceLeft { + background-image: none; + border-style: solid none none solid; + border-width: 1px; +} +.clearlooks2 .mceFocus .mceTop .mceCenter { +} +.clearlooks2 .mceFocus .mceTop .mceRight { + background-image: none; + border-style: solid solid none none; + border-width: 1px; +} +.clearlooks2 .mceFocus .mceTop span { +color:#FFF +} + +/* Middle */ +.clearlooks2 .mceMiddle, .clearlooks2 .mceMiddle div {top:0} +.clearlooks2 .mceMiddle {width:100%; height:100%; clip:rect(23px auto auto auto)} +.clearlooks2 .mceMiddle .mceLeft {left:0; width:5px; height:100%; background:#E4F2FD;border-left:1px solid #c6d9e9} +.clearlooks2 .mceMiddle span {top:23px; left:5px; width:100%; height:100%; background:#FFF} +.clearlooks2 .mceMiddle .mceRight {right:0; width:5px; height:100%; background:#E4F2FD;border-right:1px solid #c6d9e9} + +/* Bottom */ +.clearlooks2 .mceBottom, .clearlooks2 .mceBottom div {height:6px} +.clearlooks2 .mceBottom {left:0; bottom:0; width:100%;background:#E4F2FD;border-bottom:1px solid #c6d9e9} +.clearlooks2 .mceBottom div {top:0} +.clearlooks2 .mceBottom .mceLeft {left:0; width:5px; background:#E4F2FD ;border-left:1px solid #c6d9e9} +.clearlooks2 .mceBottom .mceCenter {left:5px; width:100%} +.clearlooks2 .mceBottom .mceRight {right:0; width:6px; background:#E4F2FD url(img/drag.gif) no-repeat;border-right:1px solid #c6d9e9} +.clearlooks2 .mceBottom span {display:none} +.clearlooks2 .mceStatusbar .mceBottom, .clearlooks2 .mceStatusbar .mceBottom div {height:23px} +.clearlooks2 .mceStatusbar .mceBottom .mceLeft {background:url(img/corners.gif) -29px 0} +.clearlooks2 .mceStatusbar .mceBottom .mceCenter {background:url(img/horizontal.gif) 0 -52px} +.clearlooks2 .mceStatusbar .mceBottom .mceRight {background:url(img/corners.gif) -24px 0} +.clearlooks2 .mceStatusbar .mceBottom span {display:block; left:7px; font-family:Arial, Verdana; font-size:11px; line-height:23px} + +/* Actions */ +.clearlooks2 a {width:29px; height:16px; top:3px} +.clearlooks2 .mceClose {right:6px; background:url(img/buttons.gif) -87px 0} +.clearlooks2 .mceMin {display:none; right:68px; background:url(img/buttons.gif) 0 0} +.clearlooks2 .mceMed {display:none; right:37px; background:url(img/buttons.gif) -29px 0} +.clearlooks2 .mceMax {display:none; right:37px; background:url(img/buttons.gif) -58px 0} +.clearlooks2 .mceMove {display:none;width:100%;cursor:move;background:url(img/corners.gif) no-repeat -100px -100px} +.clearlooks2 .mceMovable .mceMove {display:block} +.clearlooks2 .mceFocus .mceClose {right:6px; background:url(img/buttons.gif) -87px -16px} +.clearlooks2 .mceFocus .mceMin {right:68px; background:url(img/buttons.gif) 0 -16px} +.clearlooks2 .mceFocus .mceMed {right:37px; background:url(img/buttons.gif) -29px -16px} +.clearlooks2 .mceFocus .mceMax {right:37px; background:url(img/buttons.gif) -58px -16px} +.clearlooks2 .mceFocus .mceClose:hover {right:6px; background:url(img/buttons.gif) -87px -32px} +.clearlooks2 .mceFocus .mceClose:hover {right:6px; background:url(img/buttons.gif) -87px -32px} +.clearlooks2 .mceFocus .mceMin:hover {right:68px; background:url(img/buttons.gif) 0 -32px} +.clearlooks2 .mceFocus .mceMed:hover {right:37px; background:url(img/buttons.gif) -29px -32px} +.clearlooks2 .mceFocus .mceMax:hover {right:37px; background:url(img/buttons.gif) -58px -32px} + +/* Resize */ +.clearlooks2 .mceResize {top:auto; left:auto; display:none; width:5px; height:5px; background:url(img/horizontal.gif) no-repeat 0 -75px} +.clearlooks2 .mceResizable .mceResize {display:block} +.clearlooks2 .mceResizable .mceMin, .clearlooks2 .mceMax {display:none} +.clearlooks2 .mceMinimizable .mceMin {display:block} +.clearlooks2 .mceMaximizable .mceMax {display:block} +.clearlooks2 .mceMaximized .mceMed {display:block} +.clearlooks2 .mceMaximized .mceMax {display:none} +.clearlooks2 a.mceResizeN {top:0; left:0; width:100%; cursor:n-resize} +.clearlooks2 a.mceResizeNW {top:0; left:0; cursor:nw-resize} +.clearlooks2 a.mceResizeNE {top:0; right:0; cursor:ne-resize} +.clearlooks2 a.mceResizeW {top:0; left:0; height:100%; cursor:w-resize} +.clearlooks2 a.mceResizeE {top:0; right:0; height:100%; cursor:e-resize} +.clearlooks2 a.mceResizeS {bottom:0; left:0; width:100%; cursor:s-resize} +.clearlooks2 a.mceResizeSW {bottom:0; left:0; cursor:sw-resize} +.clearlooks2 a.mceResizeSE {bottom:0; right:0; cursor:se-resize} + +/* Alert/Confirm */ +.clearlooks2 .mceButton {font-weight:bold; bottom:10px; width:80px; height:30px; background:url(img/button.gif); line-height:30px; vertical-align:middle; text-align:center; outline:0} +.clearlooks2 .mceMiddle .mceIcon {left:15px; top:35px; width:32px; height:32px} +.clearlooks2 .mceAlert .mceMiddle span, .clearlooks2 .mceConfirm .mceMiddle span {background:transparent;left:60px; top:35px; width:320px; height:50px; font-weight:bold; overflow:auto; white-space:normal} +.clearlooks2 a:hover {font-weight:bold;} +.clearlooks2 .mceAlert .mceMiddle, .clearlooks2 .mceConfirm .mceMiddle {background:#F9F9F9} +.clearlooks2 .mceAlert .mceOk {left:50%; top:auto; margin-left: -40px} +.clearlooks2 .mceAlert .mceIcon {background:url(img/alert.gif)} +.clearlooks2 .mceConfirm .mceOk {left:50%; top:auto; margin-left: -90px} +.clearlooks2 .mceConfirm .mceCancel {left:50%; top:auto} +.clearlooks2 .mceConfirm .mceIcon {background:url(img/confirm.gif)} + +/* IE9 fixes */ +.clearlooks2.ie9 .mceTop .mceCenter {clip:auto;} +.clearlooks2.ie9 .mceMiddle {clip:auto;} +.clearlooks2.ie9 .mceMiddle .mceLeft, .clearlooks2.ie9 .mceMiddle .mceRight {top: 23px;} +.clearlooks2.ie9 .mceAlert .mceMiddle span, .clearlooks2.ie9 .mceConfirm .mceMiddle span {top:13px;} +.clearlooks2.ie9 .mceModal .mceMiddle {top:23px} +.clearlooks2.ie9 .mceModal .mceMiddle .mceLeft, .clearlooks2.ie9 .mceModal .mceMiddle .mceRight {top: 0} +.clearlooks2.ie9 .mceMiddle .mceIcon {top:13px} +.clearlooks2.ie9 .mceTop .mceCenter {top:0; right:auto; left:6px; width:calc(100%-12px)} diff --git a/src/wp-includes/js/tinymce/plugins/inlinepopups/template.htm b/src/wp-includes/js/tinymce/plugins/inlinepopups/template.htm new file mode 100644 index 0000000..b376842 --- /dev/null +++ b/src/wp-includes/js/tinymce/plugins/inlinepopups/template.htm @@ -0,0 +1,387 @@ + + + +Template for dialogs + + + + +
            +
            +
            +
            +
            +
            +
            + Blured +
            + +
            +
            + Content +
            +
            + +
            +
            +
            +
            + Statusbar text. +
            + + + + + + + + + + + + + + +
            +
            + +
            +
            +
            +
            +
            +
            + Focused +
            + +
            +
            + Content +
            +
            + +
            +
            +
            +
            + Statusbar text. +
            + + + + + + + + + + + + + + +
            +
            + +
            +
            +
            +
            +
            +
            + Statusbar +
            + +
            +
            + Content +
            +
            + +
            +
            +
            +
            + Statusbar text. +
            + + + + + + + + + + + + + + +
            +
            + +
            +
            +
            +
            +
            +
            + Statusbar, Resizable +
            + +
            +
            + Content +
            +
            + +
            +
            +
            +
            + Statusbar text. +
            + + + + + + + + + + + + + + +
            +
            + +
            +
            +
            +
            +
            +
            + Resizable, Maximizable +
            + +
            +
            + Content +
            +
            + +
            +
            +
            +
            + Statusbar text. +
            + + + + + + + + + + + + + + +
            +
            + +
            +
            +
            +
            +
            +
            + Blurred, Maximizable, Statusbar, Resizable +
            + +
            +
            + Content +
            +
            + +
            +
            +
            +
            + Statusbar text. +
            + + + + + + + + + + + + + + +
            +
            + +
            +
            +
            +
            +
            +
            + Maximized, Maximizable, Minimizable +
            + +
            +
            + Content +
            +
            + +
            +
            +
            +
            + Statusbar text. +
            + + + + + + + + + + + + + + +
            +
            + +
            +
            +
            +
            +
            +
            + Blured +
            + +
            +
            + Content +
            +
            + +
            +
            +
            +
            + Statusbar text. +
            + + + + + + + + + + + + + + +
            +
            + +
            +
            +
            +
            +
            +
            + Alert +
            + +
            +
            + + This is a very long error message. This is a very long error message. + This is a very long error message. This is a very long error message. + This is a very long error message. This is a very long error message. + This is a very long error message. This is a very long error message. + This is a very long error message. This is a very long error message. + This is a very long error message. This is a very long error message. + +
            +
            +
            + +
            +
            +
            +
            +
            + + + Ok + +
            +
            + +
            +
            +
            +
            +
            +
            + Confirm +
            + +
            +
            + + This is a very long error message. This is a very long error message. + This is a very long error message. This is a very long error message. + This is a very long error message. This is a very long error message. + This is a very long error message. This is a very long error message. + This is a very long error message. This is a very long error message. + This is a very long error message. This is a very long error message. + +
            +
            +
            + +
            +
            +
            +
            +
            + + + Ok + Cancel + +
            +
            +
            + + + diff --git a/src/wp-includes/js/tinymce/plugins/media/css/media.css b/src/wp-includes/js/tinymce/plugins/media/css/media.css new file mode 100644 index 0000000..fd04898 --- /dev/null +++ b/src/wp-includes/js/tinymce/plugins/media/css/media.css @@ -0,0 +1,17 @@ +#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, #html5_altsource1, #html5_altsource2, #html5_poster { width: 240px } +#width, #height { width: 40px } +#src, #media_type { width: 250px } +#class { width: 120px } +#prev { margin: 0; border: 1px solid black; width: 380px; height: 260px; overflow: auto } +.panel_wrapper div.current { height: 420px; 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 } +iframe {border: 1px solid gray} diff --git a/src/wp-includes/js/tinymce/plugins/media/editor_plugin.js b/src/wp-includes/js/tinymce/plugins/media/editor_plugin.js new file mode 100644 index 0000000..6621907 --- /dev/null +++ b/src/wp-includes/js/tinymce/plugins/media/editor_plugin.js @@ -0,0 +1 @@ +(function(){var d=tinymce.explode("id,name,width,height,style,align,class,hspace,vspace,bgcolor,type"),h=tinymce.makeMap(d.join(",")),b=tinymce.html.Node,f,a,g=tinymce.util.JSON,e;f=[["Flash","d27cdb6e-ae6d-11cf-96b8-444553540000","application/x-shockwave-flash","http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"],["ShockWave","166b1bca-3f9c-11cf-8075-444553540000","application/x-director","http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0"],["WindowsMedia","6bf52a52-394a-11d3-b153-00c04f79faa6,22d6f312-b0f6-11d0-94ab-0080c74c7e95,05589fa1-c356-11ce-bf01-00aa0055595a","application/x-mplayer2","http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701"],["QuickTime","02bf25d5-8c17-4b23-bc80-d3488abddc6b","video/quicktime","http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0"],["RealMedia","cfcdaa03-8be4-11cf-b84b-0020afbbccfa","audio/x-pn-realaudio-plugin","http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"],["Java","8ad9c840-044e-11d1-b3e9-00805f499d93","application/x-java-applet","http://java.sun.com/products/plugin/autodl/jinstall-1_5_0-windows-i586.cab#Version=1,5,0,0"],["Silverlight","dfeaf541-f3e1-4c24-acac-99c30715084a","application/x-silverlight-2"],["Iframe"],["Video"]];function c(m){var l,j,k;if(m&&!m.splice){j=[];for(k=0;true;k++){if(m[k]){j[k]=m[k]}else{break}}return j}return m}tinymce.create("tinymce.plugins.MediaPlugin",{init:function(n,j){var r=this,l={},m,p,q,k;function o(i){return i&&i.nodeName==="IMG"&&n.dom.hasClass(i,"mceItemMedia")}r.editor=n;r.url=j;a="";for(m=0;m0){L+=(L?"&":"")+M+"="+escape(N)}});if(L.length){D.params.flashvars=L}I=o.getParam("flash_video_player_params",{allowfullscreen:true,allowscriptaccess:true});tinymce.each(I,function(N,M){D.params[M]=""+N})}}D=g.parse(x.attr("data-mce-json"));p=this.getType(x.attr("class"));z=x.attr("data-mce-style");if(!z){z=x.attr("style");if(z){z=o.dom.serializeStyle(o.dom.parseStyle(z,"img"))}}if(p.name==="Iframe"){v=new b("iframe",1);tinymce.each(d,function(i){var G=x.attr(i);if(i=="class"&&G){G=G.replace(/mceItem.+ ?/g,"")}if(G&&G.length>0){v.attr(i,G)}});for(F in D.params){v.attr(F,D.params[F])}v.attr({style:z,src:D.params.src});x.replace(v);return}if(this.editor.settings.media_use_script){v=new b("script",1).attr("type","text/javascript");w=new b("#text",3);w.value="write"+p.name+"("+g.serialize(tinymce.extend(D.params,{width:x.attr("width"),height:x.attr("height")}))+");";v.append(w);x.replace(v);return}if(p.name==="Video"&&D.video.sources[0]){A=new b("video",1).attr(tinymce.extend({id:x.attr("id"),width:x.attr("width"),height:x.attr("height"),style:z},D.video.attrs));if(D.video.attrs){l=D.video.attrs.poster}k=D.video.sources=c(D.video.sources);for(y=0;y'; + + h += ''); + + function get(id) { + return document.getElementById(id); + } + + function getVal(id) { + var elm = get(id); + + if (elm.nodeName == "SELECT") + return elm.options[elm.selectedIndex].value; + + if (elm.type == "checkbox") + return elm.checked; + + return elm.value; + } + + function setVal(id, value) { + if (typeof(value) != 'undefined') { + var elm = get(id); + + if (elm.nodeName == "SELECT") + selectByValue(document.forms[0], id, value); + else if (elm.type == "checkbox") { + if (typeof(value) == 'string') + elm.checked = value.toLowerCase() === 'true' ? true : false; + else + elm.checked = !!value; + } else + elm.value = value; + } + } + + window.Media = { + init : function() { + var html, editor; + + this.editor = editor = tinyMCEPopup.editor; + + // Setup file browsers and color pickers + get('filebrowsercontainer').innerHTML = getBrowserHTML('filebrowser','src','media','media'); + get('qtsrcfilebrowsercontainer').innerHTML = getBrowserHTML('qtsrcfilebrowser','quicktime_qtsrc','media','media'); + get('bgcolor_pickcontainer').innerHTML = getColorPickerHTML('bgcolor_pick','bgcolor'); + get('video_altsource1_filebrowser').innerHTML = getBrowserHTML('filebrowser_altsource1','video_altsource1','media','media'); + get('video_altsource2_filebrowser').innerHTML = getBrowserHTML('filebrowser_altsource2','video_altsource2','media','media'); + get('video_poster_filebrowser').innerHTML = getBrowserHTML('filebrowser_poster','video_poster','media','image'); + + html = this.getMediaListHTML('medialist', 'src', 'media', 'media'); + if (html == "") + get("linklistrow").style.display = 'none'; + else + get("linklistcontainer").innerHTML = html; + + if (isVisible('filebrowser')) + get('src').style.width = '230px'; + + if (isVisible('filebrowser_altsource1')) + get('video_altsource1').style.width = '220px'; + + if (isVisible('filebrowser_altsource2')) + get('video_altsource2').style.width = '220px'; + + if (isVisible('filebrowser_poster')) + get('video_poster').style.width = '220px'; + + this.data = tinyMCEPopup.getWindowArg('data'); + this.dataToForm(); + this.preview(); + }, + + insert : function() { + var editor = tinyMCEPopup.editor; + + this.formToData(); + editor.execCommand('mceRepaint'); + tinyMCEPopup.restoreSelection(); + editor.selection.setNode(editor.plugins.media.dataToImg(this.data)); + tinyMCEPopup.close(); + }, + + preview : function() { + get('prev').innerHTML = this.editor.plugins.media.dataToHtml(this.data, true); + }, + + moveStates : function(to_form, field) { + var data = this.data, editor = this.editor, data = this.data, + mediaPlugin = editor.plugins.media, ext, src, typeInfo, defaultStates, src; + + defaultStates = { + // QuickTime + quicktime_autoplay : true, + quicktime_controller : true, + + // Flash + flash_play : true, + flash_loop : true, + flash_menu : true, + + // WindowsMedia + windowsmedia_autostart : true, + windowsmedia_enablecontextmenu : true, + windowsmedia_invokeurls : true, + + // RealMedia + realmedia_autogotourl : true, + realmedia_imagestatus : true + }; + + function parseQueryParams(str) { + var out = {}; + + if (str) { + tinymce.each(str.split('&'), function(item) { + var parts = item.split('='); + + out[unescape(parts[0])] = unescape(parts[1]); + }); + } + + return out; + }; + + function setOptions(type, names) { + var i, name, formItemName, value, list; + + if (type == data.type || type == 'global') { + names = tinymce.explode(names); + for (i = 0; i < names.length; i++) { + name = names[i]; + formItemName = type == 'global' ? name : type + '_' + name; + + if (type == 'global') + list = data; + else if (type == 'video') { + list = data.video.attrs; + + if (!list && !to_form) + data.video.attrs = list = {}; + } else + list = data.params; + + if (list) { + if (to_form) { + setVal(formItemName, list[name]); + } else { + delete list[name]; + + value = getVal(formItemName); + if (type == 'video' && value === true) + value = name; + + if (defaultStates[formItemName]) { + if (value !== defaultStates[formItemName]) { + value = "" + value; + list[name] = value; + } + } else if (value) { + value = "" + value; + list[name] = value; + } + } + } + } + } + } + + if (!to_form) { + data.type = get('media_type').options[get('media_type').selectedIndex].value; + data.width = getVal('width'); + data.height = getVal('height'); + + // Switch type based on extension + src = getVal('src'); + if (field == 'src') { + ext = src.replace(/^.*\.([^.]+)$/, '$1'); + if (typeInfo = mediaPlugin.getType(ext)) + data.type = typeInfo.name.toLowerCase(); + + setVal('media_type', data.type); + } + + if (data.type == "video") { + if (!data.video.sources) + data.video.sources = []; + + data.video.sources[0] = {src: getVal('src')}; + } + } + + // Hide all fieldsets and show the one active + get('video_options').style.display = 'none'; + get('flash_options').style.display = 'none'; + get('quicktime_options').style.display = 'none'; + get('shockwave_options').style.display = 'none'; + get('windowsmedia_options').style.display = 'none'; + get('realmedia_options').style.display = 'none'; + + if (get(data.type + '_options')) + get(data.type + '_options').style.display = 'block'; + + setVal('media_type', data.type); + + setOptions('flash', 'play,loop,menu,swliveconnect,quality,scale,salign,wmode,base,flashvars'); + setOptions('quicktime', 'loop,autoplay,cache,controller,correction,enablejavascript,kioskmode,autohref,playeveryframe,targetcache,scale,starttime,endtime,target,qtsrcchokespeed,volume,qtsrc'); + setOptions('shockwave', 'sound,progress,autostart,swliveconnect,swvolume,swstretchstyle,swstretchhalign,swstretchvalign'); + setOptions('windowsmedia', 'autostart,enabled,enablecontextmenu,fullscreen,invokeurls,mute,stretchtofit,windowlessvideo,balance,baseurl,captioningid,currentmarker,currentposition,defaultframe,playcount,rate,uimode,volume'); + setOptions('realmedia', 'autostart,loop,autogotourl,center,imagestatus,maintainaspect,nojava,prefetch,shuffle,console,controls,numloop,scriptcallbacks'); + setOptions('video', 'poster,autoplay,loop,preload,controls'); + setOptions('global', 'id,name,vspace,hspace,bgcolor,align,width,height'); + + if (to_form) { + if (data.type == 'video') { + if (data.video.sources[0]) + setVal('src', data.video.sources[0].src); + + src = data.video.sources[1]; + if (src) + setVal('video_altsource1', src.src); + + src = data.video.sources[2]; + if (src) + setVal('video_altsource2', src.src); + } else { + // Check flash vars + if (data.type == 'flash') { + tinymce.each(editor.getParam('flash_video_player_flashvars', {url : '$url', poster : '$poster'}), function(value, name) { + if (value == '$url') + data.params.src = parseQueryParams(data.params.flashvars)[name] || data.params.src; + }); + } + + setVal('src', data.params.src); + } + } else { + src = getVal("src"); + + // YouTube + if (src.match(/youtube.com(.+)v=([^&]+)/)) { + data.width = 425; + data.height = 350; + data.params.frameborder = '0'; + data.type = 'iframe'; + src = 'http://www.youtube.com/embed/' + src.match(/v=([^&]+)/)[1]; + setVal('src', src); + setVal('media_type', data.type); + } + + // Google video + if (src.match(/video.google.com(.+)docid=([^&]+)/)) { + data.width = 425; + data.height = 326; + data.type = 'flash'; + src = 'http://video.google.com/googleplayer.swf?docId=' + src.match(/docid=([^&]+)/)[1] + '&hl=en'; + setVal('src', src); + setVal('media_type', data.type); + } + + if (data.type == 'video') { + if (!data.video.sources) + data.video.sources = []; + + data.video.sources[0] = {src : src}; + + src = getVal("video_altsource1"); + if (src) + data.video.sources[1] = {src : src}; + + src = getVal("video_altsource2"); + if (src) + data.video.sources[2] = {src : src}; + } else + data.params.src = src; + + // Set default size + setVal('width', data.width || 320); + setVal('height', data.height || 240); + } + }, + + dataToForm : function() { + this.moveStates(true); + }, + + formToData : function(field) { + if (field == "width" || field == "height") + this.changeSize(field); + + if (field == 'source') { + this.moveStates(false, field); + setVal('source', this.editor.plugins.media.dataToHtml(this.data)); + this.panel = 'source'; + } else { + if (this.panel == 'source') { + this.data = this.editor.plugins.media.htmlToData(getVal('source')); + this.dataToForm(); + this.panel = ''; + } + + this.moveStates(false, field); + this.preview(); + } + }, + + beforeResize : function() { + this.width = parseInt(getVal('width') || "320", 10); + this.height = parseInt(getVal('height') || "240", 10); + }, + + changeSize : function(type) { + var width, height, scale, size; + + if (get('constrain').checked) { + width = parseInt(getVal('width') || "320", 10); + height = parseInt(getVal('height') || "240", 10); + + if (type == 'width') { + this.height = Math.round((width / this.width) * height); + setVal('height', this.height); + } else { + this.width = Math.round((height / this.height) * width); + setVal('width', this.width); + } + } + }, + + getMediaListHTML : function() { + if (typeof(tinyMCEMediaList) != "undefined" && tinyMCEMediaList.length > 0) { + var html = ""; + + html += ''; + + return html; + } + + return ""; + } + }; + + tinyMCEPopup.requireLangPack(); + tinyMCEPopup.onInit.add(function() { + Media.init(); + }); +})(); \ No newline at end of file diff --git a/src/wp-includes/js/tinymce/plugins/media/media.htm b/src/wp-includes/js/tinymce/plugins/media/media.htm new file mode 100644 index 0000000..edc2b0f --- /dev/null +++ b/src/wp-includes/js/tinymce/plugins/media/media.htm @@ -0,0 +1,812 @@ + + + + {#media_dlg.title} + + + + + + + + + +
            + + +
            +
            +
            + {#media_dlg.general} + + + + + + + + + + + + + + + + + + +
            + +
            + + + + + +
             
            +
            + + + + + + +
            x   
            +
            +
            + +
            + {#media_dlg.preview} + +
            +
            + +
            +
            + {#media_dlg.advanced} + + + + + + + + + + + + + + + + + + + + + + + +
            + + + + + + + +
             
            +
            +
            + +
            + {#media_dlg.html5_video_options} + + + + + + + + + + + + + + + + +
            + + + + + +
             
            +
            + + + + + +
             
            +
            + + + + + +
             
            +
            + + + + + + + + + + + +
            + + + + + +
            +
            + + + + + +
            +
            + + + + + +
            +
            + + + + + +
            +
            +
            + +
            + {#media_dlg.flash_options} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
            + + + +
            + + + +
            + + + + + +
            +
            + + + + + +
            +
            + + + + + +
            +
            + + + + + +
            +
            + + + + + + + + + + + +
            +
            + +
            + {#media_dlg.qt_options} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
            + + + + + +
            +
            + + + + + +
            +
            + + + + + +
            +
            + + + + + +
            +
            + + + + + +
            +
            + + + + + +
            +
            + + + + + +
            +
            + + + + + +
            +
            + + + + + +
            +
            + + + + + +
            +
            +  
            + + + + + +
             
            +
            +
            + +
            + {#media_dlg.wmp_options} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
            + + + + + +
            +
            + + + + + +
            +
            + + + + + +
            +
            + + + + + +
            +
            + + + + + +
            +
            + + + + + +
            +
            + + + + + +
            +
            + + + + + +
            +
            +
            + +
            + {#media_dlg.rmp_options} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
            + + + + + +
            +
            + + + + + +
            +
            + + + + + +
            +
            + + + + + +
            +
            + + + + + +
            +
            + + + + + +
            +
            + + + + + +
            +
            + + + + + +
            +
            + + + + + +
            +
            +   +
            +
            + +
            + {#media_dlg.shockwave_options} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
            + +
            + + + +
            + + + + + +
            +
            + + + + + +
            +
            + + + + + +
            +
            + + + + + +
            +
            +
            +
            + +
            +
            + {#media_dlg.source} + +
            +
            +
            + +
            + + +
            +
            + + diff --git a/src/wp-includes/js/tinymce/plugins/media/moxieplayer.swf b/src/wp-includes/js/tinymce/plugins/media/moxieplayer.swf new file mode 100644 index 0000000..2a04035 Binary files /dev/null and b/src/wp-includes/js/tinymce/plugins/media/moxieplayer.swf differ diff --git a/src/wp-includes/js/tinymce/plugins/paste/blank.htm b/src/wp-includes/js/tinymce/plugins/paste/blank.htm new file mode 100644 index 0000000..4382a11 --- /dev/null +++ b/src/wp-includes/js/tinymce/plugins/paste/blank.htm @@ -0,0 +1,21 @@ + + +blank_page + + + + + + + + diff --git a/src/wp-includes/js/tinymce/plugins/paste/editor_plugin.js b/src/wp-includes/js/tinymce/plugins/paste/editor_plugin.js new file mode 100644 index 0000000..6c65069 --- /dev/null +++ b/src/wp-includes/js/tinymce/plugins/paste/editor_plugin.js @@ -0,0 +1 @@ +(function(){var c=tinymce.each,a={paste_auto_cleanup_on_paste:true,paste_enable_default_filters:true,paste_block_drop:false,paste_retain_style_properties:"none",paste_strip_class_attributes:"mso",paste_remove_spans:false,paste_remove_styles:false,paste_remove_styles_if_webkit:true,paste_convert_middot_lists:true,paste_convert_headers_to_strong:false,paste_dialog_width:"450",paste_dialog_height:"400",paste_text_use_dialog:false,paste_text_sticky:false,paste_text_sticky_default:false,paste_text_notifyalways:false,paste_text_linebreaktype:"p",paste_text_replacements:[[/\u2026/g,"..."],[/[\x93\x94\u201c\u201d]/g,'"'],[/[\x60\x91\x92\u2018\u2019]/g,"'"]]};function b(d,e){return d.getParam(e,a[e])}tinymce.create("tinymce.plugins.PastePlugin",{init:function(d,e){var f=this;f.editor=d;f.url=e;f.onPreProcess=new tinymce.util.Dispatcher(f);f.onPostProcess=new tinymce.util.Dispatcher(f);f.onPreProcess.add(f._preProcess);f.onPostProcess.add(f._postProcess);f.onPreProcess.add(function(i,j){d.execCallback("paste_preprocess",i,j)});f.onPostProcess.add(function(i,j){d.execCallback("paste_postprocess",i,j)});d.onKeyDown.addToTop(function(i,j){if(((tinymce.isMac?j.metaKey:j.ctrlKey)&&j.keyCode==86)||(j.shiftKey&&j.keyCode==45)){return false}});d.pasteAsPlainText=b(d,"paste_text_sticky_default");function h(m,k){var l=d.dom,i,j;f.onPreProcess.dispatch(f,m);m.node=l.create("div",0,m.content);if(tinymce.isGecko){i=d.selection.getRng(true);if(i.startContainer==i.endContainer&&i.startContainer.nodeType==3){j=l.select("p,h1,h2,h3,h4,h5,h6,pre",m.node);if(j.length==1&&m.content.indexOf("__MCE_ITEM__")===-1){l.remove(j.reverse(),true)}}}f.onPostProcess.dispatch(f,m);m.content=d.serializer.serialize(m.node,{getInner:1});if((!k)&&(d.pasteAsPlainText)){f._insertPlainText(d,l,m.content);if(!b(d,"paste_text_sticky")){d.pasteAsPlainText=false;d.controlManager.setActive("pastetext",false)}}else{f._insert(m.content)}}d.addCommand("mceInsertClipboardContent",function(i,j){h(j,true)});if(!b(d,"paste_text_use_dialog")){d.addCommand("mcePasteText",function(j,i){var k=tinymce.util.Cookie;d.pasteAsPlainText=!d.pasteAsPlainText;d.controlManager.setActive("pastetext",d.pasteAsPlainText);if((d.pasteAsPlainText)&&(!k.get("tinymcePasteText"))){if(b(d,"paste_text_sticky")){d.windowManager.alert(d.translate("paste.plaintext_mode_sticky"))}else{d.windowManager.alert(d.translate("paste.plaintext_mode_sticky"))}if(!b(d,"paste_text_notifyalways")){k.set("tinymcePasteText","1",new Date(new Date().getFullYear()+1,12,31))}}})}d.addButton("pastetext",{title:"paste.paste_text_desc",cmd:"mcePasteText"});d.addButton("selectall",{title:"paste.selectall_desc",cmd:"selectall"});function g(s){var l,p,j,t,k=d.selection,o=d.dom,q=d.getBody(),i,r;if(s.clipboardData||o.doc.dataTransfer){r=(s.clipboardData||o.doc.dataTransfer).getData("Text");if(d.pasteAsPlainText){s.preventDefault();h({content:r.replace(/\r?\n/g,"
            ")});return}}if(o.get("_mcePaste")){return}l=o.add(q,"div",{id:"_mcePaste","class":"mcePaste","data-mce-bogus":"1"},"\uFEFF\uFEFF");if(q!=d.getDoc().body){i=o.getPos(d.selection.getStart(),q).y}else{i=q.scrollTop+o.getViewPort().y}o.setStyles(l,{position:"absolute",left:-10000,top:i,width:1,height:1,overflow:"hidden"});if(tinymce.isIE){t=k.getRng();j=o.doc.body.createTextRange();j.moveToElementText(l);j.execCommand("Paste");o.remove(l);if(l.innerHTML==="\uFEFF\uFEFF"){d.execCommand("mcePasteWord");s.preventDefault();return}k.setRng(t);k.setContent("");setTimeout(function(){h({content:l.innerHTML})},0);return tinymce.dom.Event.cancel(s)}else{function m(n){n.preventDefault()}o.bind(d.getDoc(),"mousedown",m);o.bind(d.getDoc(),"keydown",m);p=d.selection.getRng();l=l.firstChild;j=d.getDoc().createRange();j.setStart(l,0);j.setEnd(l,2);k.setRng(j);window.setTimeout(function(){var u="",n;if(!o.select("div.mcePaste > div.mcePaste").length){n=o.select("div.mcePaste");c(n,function(w){var v=w.firstChild;if(v&&v.nodeName=="DIV"&&v.style.marginTop&&v.style.backgroundColor){o.remove(v,1)}c(o.select("span.Apple-style-span",w),function(x){o.remove(x,1)});c(o.select("br[data-mce-bogus]",w),function(x){o.remove(x)});if(w.parentNode.className!="mcePaste"){u+=w.innerHTML}})}else{u="
            "+o.encode(r).replace(/\r?\n/g,"
            ")+"
            "}c(o.select("div.mcePaste"),function(v){o.remove(v)});if(p){k.setRng(p)}h({content:u});o.unbind(d.getDoc(),"mousedown",m);o.unbind(d.getDoc(),"keydown",m)},0)}}if(b(d,"paste_auto_cleanup_on_paste")){if(tinymce.isOpera||/Firefox\/2/.test(navigator.userAgent)){d.onKeyDown.addToTop(function(i,j){if(((tinymce.isMac?j.metaKey:j.ctrlKey)&&j.keyCode==86)||(j.shiftKey&&j.keyCode==45)){g(j)}})}else{d.onPaste.addToTop(function(i,j){return g(j)})}}d.onInit.add(function(){d.controlManager.setActive("pastetext",d.pasteAsPlainText);if(b(d,"paste_block_drop")){d.dom.bind(d.getBody(),["dragend","dragover","draggesture","dragdrop","drop","drag"],function(i){i.preventDefault();i.stopPropagation();return false})}});f._legacySupport()},getInfo:function(){return{longname:"Paste text/word",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/paste",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_preProcess:function(g,e){var k=this.editor,j=e.content,p=tinymce.grep,n=tinymce.explode,f=tinymce.trim,l,i;function d(h){c(h,function(o){if(o.constructor==RegExp){j=j.replace(o,"")}else{j=j.replace(o[0],o[1])}})}if(k.settings.paste_enable_default_filters==false){return}if(tinymce.isIE&&document.documentMode>=9){d([[/(?:
             [\s\r\n]+|
            )*(<\/?(h[1-6r]|p|div|address|pre|form|table|tbody|thead|tfoot|th|tr|td|li|ol|ul|caption|blockquote|center|dl|dt|dd|dir|fieldset)[^>]*>)(?:
             [\s\r\n]+|
            )*/g,"$1"]])}if(/class="?Mso|style="[^"]*\bmso-|w:WordDocument/i.test(j)||e.wordContent){e.wordContent=true;d([/^\s*( )+/gi,/( |]*>)+\s*$/gi]);if(b(k,"paste_convert_headers_to_strong")){j=j.replace(/

            ]*class="?MsoHeading"?[^>]*>(.*?)<\/p>/gi,"

            $1

            ")}if(b(k,"paste_convert_middot_lists")){d([[//gi,"$&__MCE_ITEM__"],[/(]+(?:mso-list:|:\s*symbol)[^>]+>)/gi,"$1__MCE_ITEM__"],[/(]+(?:MsoListParagraph)[^>]+>)/gi,"$1__MCE_ITEM__"]])}d([//gi,/<(!|script[^>]*>.*?<\/script(?=[>\s])|\/?(\?xml(:\w+)?|img|meta|link|style|\w:\w+)(?=[\s\/>]))[^>]*>/gi,[/<(\/?)s>/gi,"<$1strike>"],[/ /gi,"\u00a0"]]);do{l=j.length;j=j.replace(/(<[a-z][^>]*\s)(?:id|name|language|type|on\w+|\w+:\w+)=(?:"[^"]*"|\w+)\s?/gi,"$1")}while(l!=j.length);if(b(k,"paste_retain_style_properties").replace(/^none$/i,"").length==0){j=j.replace(/<\/?span[^>]*>/gi,"")}else{d([[/([\s\u00a0]*)<\/span>/gi,function(o,h){return(h.length>0)?h.replace(/./," ").slice(Math.floor(h.length/2)).split("").join("\u00a0"):""}],[/(<[a-z][^>]*)\sstyle="([^"]*)"/gi,function(t,h,r){var u=[],o=0,q=n(f(r).replace(/"/gi,"'"),";");c(q,function(s){var w,y,z=n(s,":");function x(A){return A+((A!=="0")&&(/\d$/.test(A)))?"px":""}if(z.length==2){w=z[0].toLowerCase();y=z[1].toLowerCase();switch(w){case"mso-padding-alt":case"mso-padding-top-alt":case"mso-padding-right-alt":case"mso-padding-bottom-alt":case"mso-padding-left-alt":case"mso-margin-alt":case"mso-margin-top-alt":case"mso-margin-right-alt":case"mso-margin-bottom-alt":case"mso-margin-left-alt":case"mso-table-layout-alt":case"mso-height":case"mso-width":case"mso-vertical-align-alt":u[o++]=w.replace(/^mso-|-alt$/g,"")+":"+x(y);return;case"horiz-align":u[o++]="text-align:"+y;return;case"vert-align":u[o++]="vertical-align:"+y;return;case"font-color":case"mso-foreground":u[o++]="color:"+y;return;case"mso-background":case"mso-highlight":u[o++]="background:"+y;return;case"mso-default-height":u[o++]="min-height:"+x(y);return;case"mso-default-width":u[o++]="min-width:"+x(y);return;case"mso-padding-between-alt":u[o++]="border-collapse:separate;border-spacing:"+x(y);return;case"text-line-through":if((y=="single")||(y=="double")){u[o++]="text-decoration:line-through"}return;case"mso-zero-height":if(y=="yes"){u[o++]="display:none"}return}if(/^(mso|column|font-emph|lang|layout|line-break|list-image|nav|panose|punct|row|ruby|sep|size|src|tab-|table-border|text-(?!align|decor|indent|trans)|top-bar|version|vnd|word-break)/.test(w)){return}u[o++]=w+":"+z[1]}});if(o>0){return h+' style="'+u.join(";")+'"'}else{return h}}]])}}if(b(k,"paste_convert_headers_to_strong")){d([[/]*>/gi,"

            "],[/<\/h[1-6][^>]*>/gi,"

            "]])}d([[/Version:[\d.]+\nStartHTML:\d+\nEndHTML:\d+\nStartFragment:\d+\nEndFragment:\d+/gi,""]]);i=b(k,"paste_strip_class_attributes");if(i!=="none"){function m(q,o){if(i==="all"){return""}var h=p(n(o.replace(/^(["'])(.*)\1$/,"$2")," "),function(r){return(/^(?!mso)/i.test(r))});return h.length?' class="'+h.join(" ")+'"':""}j=j.replace(/ class="([^"]+)"/gi,m);j=j.replace(/ class=([\-\w]+)/gi,m)}if(b(k,"paste_remove_spans")){j=j.replace(/<\/?span[^>]*>/gi,"")}e.content=j},_postProcess:function(g,i){var f=this,e=f.editor,h=e.dom,d;if(e.settings.paste_enable_default_filters==false){return}if(i.wordContent){c(h.select("a",i.node),function(j){if(!j.href||j.href.indexOf("#_Toc")!=-1){h.remove(j,1)}});if(b(e,"paste_convert_middot_lists")){f._convertLists(g,i)}d=b(e,"paste_retain_style_properties");if((tinymce.is(d,"string"))&&(d!=="all")&&(d!=="*")){d=tinymce.explode(d.replace(/^none$/i,""));c(h.select("*",i.node),function(m){var n={},k=0,l,o,j;if(d){for(l=0;l0){h.setStyles(m,n)}else{if(m.nodeName=="SPAN"&&!m.className){h.remove(m,true)}}})}}if(b(e,"paste_remove_styles")||(b(e,"paste_remove_styles_if_webkit")&&tinymce.isWebKit)){c(h.select("*[style]",i.node),function(j){j.removeAttribute("style");j.removeAttribute("data-mce-style")})}else{if(tinymce.isWebKit){c(h.select("*",i.node),function(j){j.removeAttribute("data-mce-style")})}}},_convertLists:function(g,e){var i=g.editor.dom,h,l,d=-1,f,m=[],k,j;c(i.select("p",e.node),function(t){var q,u="",s,r,n,o;for(q=t.firstChild;q&&q.nodeType==3;q=q.nextSibling){u+=q.nodeValue}u=t.innerHTML.replace(/<\/?\w+[^>]*>/gi,"").replace(/ /g,"\u00a0");if(/^(__MCE_ITEM__)+[\u2022\u00b7\u00a7\u00d8o\u25CF]\s*\u00a0*/.test(u)){s="ul"}if(/^__MCE_ITEM__\s*\w+\.\s*\u00a0+/.test(u)){s="ol"}if(s){f=parseFloat(t.style.marginLeft||0);if(f>d){m.push(f)}if(!h||s!=k){h=i.create(s);i.insertAfter(h,t)}else{if(f>d){h=l.appendChild(i.create(s))}else{if(f]*>/gi,"");if(s=="ul"&&/^__MCE_ITEM__[\u2022\u00b7\u00a7\u00d8o\u25CF]/.test(p)){i.remove(v)}else{if(/^__MCE_ITEM__[\s\S]*\w+\.( |\u00a0)*\s*/.test(p)){i.remove(v)}}});r=t.innerHTML;if(s=="ul"){r=t.innerHTML.replace(/__MCE_ITEM__/g,"").replace(/^[\u2022\u00b7\u00a7\u00d8o\u25CF]\s*( |\u00a0)+\s*/,"")}else{r=t.innerHTML.replace(/__MCE_ITEM__/g,"").replace(/^\s*\w+\.( |\u00a0)+\s*/,"")}l=h.appendChild(i.create("li",0,r));i.remove(t);d=f;k=s}else{h=d=0}});j=e.node.innerHTML;if(j.indexOf("__MCE_ITEM__")!=-1){e.node.innerHTML=j.replace(/__MCE_ITEM__/g,"")}},_insert:function(f,d){var e=this.editor,g=e.selection.getRng();if(!e.selection.isCollapsed()&&g.startContainer!=g.endContainer){e.getDoc().execCommand("Delete",false,null)}e.execCommand("mceInsertContent",false,f,{skip_undo:d})},_insertPlainText:function(j,x,v){var t,u,l,k,r,e,p,f,n=j.getWin(),z=j.getDoc(),s=j.selection,m=tinymce.is,y=tinymce.inArray,g=b(j,"paste_text_linebreaktype"),o=b(j,"paste_text_replacements");function q(d){c(d,function(h){if(h.constructor==RegExp){v=v.replace(h,"")}else{v=v.replace(h[0],h[1])}})}if((typeof(v)==="string")&&(v.length>0)){if(/<(?:p|br|h[1-6]|ul|ol|dl|table|t[rdh]|div|blockquote|fieldset|pre|address|center)[^>]*>/i.test(v)){q([/[\n\r]+/g])}else{q([/\r+/g])}q([[/<\/(?:p|h[1-6]|ul|ol|dl|table|div|blockquote|fieldset|pre|address|center)>/gi,"\n\n"],[/]*>|<\/tr>/gi,"\n"],[/<\/t[dh]>\s*]*>/gi,"\t"],/<[a-z!\/?][^>]*>/gi,[/ /gi," "],[/(?:(?!\n)\s)*(\n+)(?:(?!\n)\s)*/gi,"$1"],[/\n{3,}/g,"\n\n"],/^\s+|\s+$/g]);v=x.decode(tinymce.html.Entities.encodeRaw(v));if(!s.isCollapsed()){z.execCommand("Delete",false,null)}if(m(o,"array")||(m(o,"array"))){q(o)}else{if(m(o,"string")){q(new RegExp(o,"gi"))}}if(g=="none"){q([[/\n+/g," "]])}else{if(g=="br"){q([[/\n/g,"
            "]])}else{q([/^\s+|\s+$/g,[/\n\n/g,"

            "],[/\n/g,"
            "]])}}if((l=v.indexOf("

            "))!=-1){k=v.lastIndexOf("

            ");r=s.getNode();e=[];do{if(r.nodeType==1){if(r.nodeName=="TD"||r.nodeName=="BODY"){break}e[e.length]=r}}while(r=r.parentNode);if(e.length>0){p=v.substring(0,l);f="";for(t=0,u=e.length;t";f+="<"+e[e.length-t-1].nodeName.toLowerCase()+">"}if(l==k){v=p+f+v.substring(l+7)}else{v=p+v.substring(l+4,k+4)+f+v.substring(k+7)}}}j.execCommand("mceInsertRawHTML",false,v+' ');window.setTimeout(function(){var d=x.get("_plain_text_marker"),A,h,w,i;s.select(d,false);z.execCommand("Delete",false,null);d=null;A=s.getStart();h=x.getViewPort(n);w=x.getPos(A).y;i=A.clientHeight;if((wh.y+h.h)){z.body.scrollTop=w 1) { + h = ''; + tinymce.each(lines, function(row) { + h += '

            ' + row + '

            '; + }); + } + } + + tinyMCEPopup.editor.execCommand('mceInsertClipboardContent', false, {content : h}); + tinyMCEPopup.close(); + }, + + resize : function() { + var vp = tinyMCEPopup.dom.getViewPort(window), el; + + el = document.getElementById('content'); + + el.style.width = (vp.w - 20) + 'px'; + el.style.height = (vp.h - 90) + 'px'; + } +}; + +tinyMCEPopup.onInit.add(PasteTextDialog.init, PasteTextDialog); diff --git a/src/wp-includes/js/tinymce/plugins/paste/js/pasteword.js b/src/wp-includes/js/tinymce/plugins/paste/js/pasteword.js new file mode 100644 index 0000000..959bf39 --- /dev/null +++ b/src/wp-includes/js/tinymce/plugins/paste/js/pasteword.js @@ -0,0 +1,51 @@ +tinyMCEPopup.requireLangPack(); + +var PasteWordDialog = { + init : function() { + var ed = tinyMCEPopup.editor, el = document.getElementById('iframecontainer'), ifr, doc, css, cssHTML = ''; + + // Create iframe + el.innerHTML = ''; + ifr = document.getElementById('iframe'); + doc = ifr.contentWindow.document; + + // Force absolute CSS urls + css = [ed.baseURI.toAbsolute("themes/" + ed.settings.theme + "/skins/" + ed.settings.skin + "/content.css")]; + css = css.concat(tinymce.explode(ed.settings.content_css) || []); + tinymce.each(css, function(u) { + cssHTML += ''; + }); + + // Write content into iframe + doc.open(); + doc.write('' + cssHTML + ''); + doc.close(); + + doc.designMode = 'on'; + this.resize(); + + window.setTimeout(function() { + ifr.contentWindow.focus(); + }, 10); + }, + + insert : function() { + var h = document.getElementById('iframe').contentWindow.document.body.innerHTML; + + tinyMCEPopup.editor.execCommand('mceInsertClipboardContent', false, {content : h, wordContent : true}); + tinyMCEPopup.close(); + }, + + resize : function() { + var vp = tinyMCEPopup.dom.getViewPort(window), el; + + el = document.getElementById('iframe'); + + if (el) { + el.style.width = (vp.w - 20) + 'px'; + el.style.height = (vp.h - 90) + 'px'; + } + } +}; + +tinyMCEPopup.onInit.add(PasteWordDialog.init, PasteWordDialog); diff --git a/src/wp-includes/js/tinymce/plugins/paste/pastetext.htm b/src/wp-includes/js/tinymce/plugins/paste/pastetext.htm new file mode 100644 index 0000000..85c6d54 --- /dev/null +++ b/src/wp-includes/js/tinymce/plugins/paste/pastetext.htm @@ -0,0 +1,32 @@ + + + {#paste.paste_text_desc} + + + + +
            +
            {#paste.paste_text_desc}
            + +
            + +
            + +
            + +
            {#paste_dlg.text_title}
            + + + +
            +
            + +
            + +
            + +
            +
            +
            + + \ No newline at end of file diff --git a/src/wp-includes/js/tinymce/plugins/paste/pasteword.htm b/src/wp-includes/js/tinymce/plugins/paste/pasteword.htm new file mode 100644 index 0000000..88413c4 --- /dev/null +++ b/src/wp-includes/js/tinymce/plugins/paste/pasteword.htm @@ -0,0 +1,26 @@ + + + {#paste.paste_word_desc} + + + + +
            +
            {#paste.paste_word_desc}
            + +
            {#paste_dlg.word_title}
            + +
            + +
            +
            + +
            + +
            + +
            +
            +
            + + diff --git a/src/wp-includes/js/tinymce/plugins/spellchecker/changelog.txt b/src/wp-includes/js/tinymce/plugins/spellchecker/changelog.txt new file mode 100644 index 0000000..22f6b72 --- /dev/null +++ b/src/wp-includes/js/tinymce/plugins/spellchecker/changelog.txt @@ -0,0 +1,28 @@ +Version 2.0.5 (2011-03-24) + Merged with the latest TinyMCE spellchecker version. +Version 2.0.4 (2010-12-20) + Fixed issue with the JSON class not having the correct number of parameters to ord calls. +Version 2.0.3 (2010-04-19) + Added standalone support. Will use native spellchecker for supported browsers. + Added @package phpdoc comments. Patch contributed by Jacob Santos. + Fixed some PHP missing function issue. +Version 2.0.2 (2008-04-30) + Added new EnchantSpell engine class contributed by Michel Weimerskirch. + Added new general.remote_rpc_url option, enables you to proxy requests to another server. + Fixed security hole in PSpellShell.php file if PSpellShell engine was used. +Version 2.0.1 (2008-03-07) + Fixed bug where spellchecker was auto focusing the editor in IE. +Version 2.0 (2008-01-30) + Fixed bug where the suggestions menu was placed at an incorrect location. +Version 2.0rc1 (2008-01-14) + Moved package from beta to release candidate. +Version 2.0b3 (2007-12-xx) + Fixed bug where the suggestions menu could appear at the wrong location. +Version 2.0b2 (2007-11-29) + Fixed bug where the spellchecker was removing the word when it was ignored. +Version 2.0b1 (2007-11-21) + Moved spellchecker from alpha to beta status. +Version 2.0a2 (2007-11-13) + Updated plugin so it works correctly with the TinyMCE 3.0a3 version. +Version 2.0a1 (2007-11-01) + Rewritten version for TinyMCE 3.0 this new version uses JSON RPC. diff --git a/src/wp-includes/js/tinymce/plugins/spellchecker/classes/EnchantSpell.php b/src/wp-includes/js/tinymce/plugins/spellchecker/classes/EnchantSpell.php new file mode 100644 index 0000000..7e2bd97 --- /dev/null +++ b/src/wp-includes/js/tinymce/plugins/spellchecker/classes/EnchantSpell.php @@ -0,0 +1,67 @@ += 1.4.1 + * @param Array $words Array of words to check. + * @return Array of misspelled words. + */ + function &checkWords($lang, $words) { + $r = enchant_broker_init(); + + if (enchant_broker_dict_exists($r,$lang)) { + $d = enchant_broker_request_dict($r, $lang); + + $returnData = array(); + foreach($words as $key => $value) { + $correct = enchant_dict_check($d, $value); + if(!$correct) { + $returnData[] = trim($value); + } + } + + return $returnData; + enchant_broker_free_dict($d); + } else { + + } + enchant_broker_free($r); + } + + /** + * Returns suggestions for a specific word. + * + * @param String $lang Selected language code (like en_US or de_DE). Shortcodes like "en" and "de" work with enchant >= 1.4.1 + * @param String $word Specific word to get suggestions for. + * @return Array of suggestions for the specified word. + */ + function &getSuggestions($lang, $word) { + $r = enchant_broker_init(); + $suggs = array(); + + if (enchant_broker_dict_exists($r,$lang)) { + $d = enchant_broker_request_dict($r, $lang); + $suggs = enchant_dict_suggest($d, $word); + + enchant_broker_free_dict($d); + } else { + + } + enchant_broker_free($r); + + return $suggs; + } +} + +?> diff --git a/src/wp-includes/js/tinymce/plugins/spellchecker/classes/GoogleSpell.php b/src/wp-includes/js/tinymce/plugins/spellchecker/classes/GoogleSpell.php new file mode 100644 index 0000000..38daa06 --- /dev/null +++ b/src/wp-includes/js/tinymce/plugins/spellchecker/classes/GoogleSpell.php @@ -0,0 +1,159 @@ +_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); + } +} + +?> diff --git a/src/wp-includes/js/tinymce/plugins/spellchecker/classes/PSpell.php b/src/wp-includes/js/tinymce/plugins/spellchecker/classes/PSpell.php new file mode 100644 index 0000000..3c6424d --- /dev/null +++ b/src/wp-includes/js/tinymce/plugins/spellchecker/classes/PSpell.php @@ -0,0 +1,82 @@ +_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; + } +} + +?> diff --git a/src/wp-includes/js/tinymce/plugins/spellchecker/classes/PSpellShell.php b/src/wp-includes/js/tinymce/plugins/spellchecker/classes/PSpellShell.php new file mode 100644 index 0000000..c4b5220 --- /dev/null +++ b/src/wp-includes/js/tinymce/plugins/spellchecker/classes/PSpellShell.php @@ -0,0 +1,113 @@ +_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=". escapeshellarg($lang) . " --encoding=utf-8 -H < " . $this->_tmpfile . " 2>&1"; + + return "cat ". $this->_tmpfile ." | " . $this->_config['PSpellShell.aspell'] . " -a --encoding=utf-8 -H --lang=". escapeshellarg($lang); + } +} + +?> diff --git a/src/wp-includes/js/tinymce/plugins/spellchecker/classes/SpellChecker.php b/src/wp-includes/js/tinymce/plugins/spellchecker/classes/SpellChecker.php new file mode 100644 index 0000000..5d9205f --- /dev/null +++ b/src/wp-includes/js/tinymce/plugins/spellchecker/classes/SpellChecker.php @@ -0,0 +1,62 @@ +_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"}}'); + } +} + +?> diff --git a/src/wp-includes/js/tinymce/plugins/spellchecker/classes/utils/JSON.php b/src/wp-includes/js/tinymce/plugins/spellchecker/classes/utils/JSON.php new file mode 100644 index 0000000..1f2b92c --- /dev/null +++ b/src/wp-includes/js/tinymce/plugins/spellchecker/classes/utils/JSON.php @@ -0,0 +1,595 @@ +_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 . '}'; + } +} + +?> diff --git a/src/wp-includes/js/tinymce/plugins/spellchecker/classes/utils/Logger.php b/src/wp-includes/js/tinymce/plugins/spellchecker/classes/utils/Logger.php new file mode 100644 index 0000000..a1fb4cd --- /dev/null +++ b/src/wp-includes/js/tinymce/plugins/spellchecker/classes/utils/Logger.php @@ -0,0 +1,268 @@ +_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); + } +} + +?> \ No newline at end of file diff --git a/src/wp-includes/js/tinymce/plugins/spellchecker/config.php b/src/wp-includes/js/tinymce/plugins/spellchecker/config.php new file mode 100644 index 0000000..795495a --- /dev/null +++ b/src/wp-includes/js/tinymce/plugins/spellchecker/config.php @@ -0,0 +1,27 @@ + diff --git a/src/wp-includes/js/tinymce/plugins/spellchecker/css/content.css b/src/wp-includes/js/tinymce/plugins/spellchecker/css/content.css new file mode 100644 index 0000000..656ce1e --- /dev/null +++ b/src/wp-includes/js/tinymce/plugins/spellchecker/css/content.css @@ -0,0 +1 @@ +.mceItemHiddenSpellWord {background:url(../img/wline.gif) repeat-x bottom left; cursor:default;} diff --git a/src/wp-includes/js/tinymce/plugins/spellchecker/editor_plugin.js b/src/wp-includes/js/tinymce/plugins/spellchecker/editor_plugin.js new file mode 100644 index 0000000..e59c2c1 --- /dev/null +++ b/src/wp-includes/js/tinymce/plugins/spellchecker/editor_plugin.js @@ -0,0 +1 @@ +(function(){var a=tinymce.util.JSONRequest,c=tinymce.each,b=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(e,f){var g=this,d;g.url=f;g.editor=e;g.rpcUrl=e.getParam("spellchecker_rpc_url",this.url+'/rpc.php');if(g.rpcUrl=="{backend}"){if(tinymce.isIE){return}g.hasSupport=true;e.onContextMenu.addToTop(function(h,i){if(g.active){return false}})}e.addCommand("mceSpellCheck",function(){if(g.rpcUrl=="{backend}"){g.editor.getBody().spellcheck=g.active=!g.active;return}if(!g.active){e.setProgressState(1);g._sendRPC("checkWords",[g.selectedLang,g._getWords()],function(h){if(h.length>0){g.active=1;g._markWords(h);e.setProgressState(0);e.nodeChanged()}else{e.setProgressState(0);if(e.getParam("spellchecker_report_no_misspellings",true)){e.windowManager.alert("spellchecker.no_mpell")}}})}else{g._done()}});if(e.settings.content_css!==false){e.contentCSS.push(f+"/css/content.css")}e.onClick.add(g._showMenu,g);e.onContextMenu.add(g._showMenu,g);e.onBeforeGetContent.add(function(){if(g.active){g._removeWords()}});e.onNodeChange.add(function(i,h){h.setActive("spellchecker",g.active)});e.onSetContent.add(function(){g._done()});e.onBeforeGetContent.add(function(){g._done()});e.onBeforeExecCommand.add(function(h,i){if(i=="mceFullScreen"){g._done()}});g.languages={};c(e.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(i,h){if(h.indexOf("+")===0){h=h.substring(1);g.selectedLang=i}g.languages[h]=i})},createControl:function(h,d){var f=this,g,e=f.editor;if(h=="spellchecker"){if(f.rpcUrl=="{backend}"){if(f.hasSupport){g=d.createButton(h,{title:"spellchecker.desc",cmd:"mceSpellCheck",scope:f})}return g}g=d.createSplitButton(h,{title:"spellchecker.desc",cmd:"mceSpellCheck",scope:f});g.onRenderMenu.add(function(j,i){i.add({title:"spellchecker.langs","class":"mceMenuItemTitle"}).setDisabled(1);c(f.languages,function(n,m){var p={icon:1},l;p.onclick=function(){if(n==f.selectedLang){return}l.setSelected(1);f.selectedItem.setSelected(0);f.selectedItem=l;f.selectedLang=n};p.title=m;l=i.add(p);l.setSelected(n==f.selectedLang);if(n==f.selectedLang){f.selectedItem=l}})});return g}},_walk:function(i,g){var h=this.editor.getDoc(),e;if(h.createTreeWalker){e=h.createTreeWalker(i,NodeFilter.SHOW_TEXT,null,false);while((i=e.nextNode())!=null){g.call(this,i)}}else{tinymce.walk(i,g,"childNodes")}},_getSeparators:function(){var e="",d,f=this.editor.getParam("spellchecker_word_separator_chars",'\\s!"#$%&()*+,-./:;<=>?@[]^_{|}\u201d\u201c');for(d=0;d$2");while((r=o.indexOf(""))!=-1){m=o.substring(0,r);if(m.length){q=document.createTextNode(f.decode(m));p.appendChild(q)}o=o.substring(r+10);r=o.indexOf("");m=o.substring(0,r);o=o.substring(r+11);p.appendChild(f.create("span",{"class":"mceItemHiddenSpellWord"},m))}if(o.length){q=document.createTextNode(f.decode(o));p.appendChild(q)}}else{p.innerHTML=o.replace(e,'$1$2')}f.replace(p,s)}});h.moveToBookmark(i)},_showMenu:function(h,j){var i=this,h=i.editor,d=i._menu,l,k=h.dom,g=k.getViewPort(h.getWin()),f=j.target;j=0;if(!d){d=h.controlManager.createDropMenu("spellcheckermenu",{"class":"mceNoIcons"});i._menu=d}if(k.hasClass(f,"mceItemHiddenSpellWord")){d.removeAll();d.add({title:"spellchecker.wait","class":"mceMenuItemTitle"}).setDisabled(1);i._sendRPC("getSuggestions",[i.selectedLang,k.decode(f.innerHTML)],function(m){var e;d.removeAll();if(m.length>0){d.add({title:"spellchecker.sug","class":"mceMenuItemTitle"}).setDisabled(1);c(m,function(n){d.add({title:n,onclick:function(){k.replace(h.getDoc().createTextNode(n),f);i._checkDone()}})});d.addSeparator()}else{d.add({title:"spellchecker.no_sug","class":"mceMenuItemTitle"}).setDisabled(1)}e=i.editor.getParam("spellchecker_enable_ignore_rpc","");d.add({title:"spellchecker.ignore_word",onclick:function(){var n=f.innerHTML;k.remove(f,1);i._checkDone();if(e){h.setProgressState(1);i._sendRPC("ignoreWord",[i.selectedLang,n],function(o){h.setProgressState(0)})}}});d.add({title:"spellchecker.ignore_words",onclick:function(){var n=f.innerHTML;i._removeWords(k.decode(n));i._checkDone();if(e){h.setProgressState(1);i._sendRPC("ignoreWords",[i.selectedLang,n],function(o){h.setProgressState(0)})}}});if(i.editor.getParam("spellchecker_enable_learn_rpc")){d.add({title:"spellchecker.learn_word",onclick:function(){var n=f.innerHTML;k.remove(f,1);i._checkDone();h.setProgressState(1);i._sendRPC("learnWord",[i.selectedLang,n],function(o){h.setProgressState(0)})}})}d.update()});l=k.getPos(h.getContentAreaContainer());d.settings.offset_x=l.x;d.settings.offset_y=l.y;h.selection.select(f);l=k.getPos(f);d.showMenu(l.x,l.y+f.offsetHeight-g.y);return tinymce.dom.Event.cancel(j)}else{d.hideMenu()}},_checkDone:function(){var e=this,d=e.editor,g=d.dom,f;c(g.select("span"),function(h){if(h&&g.hasClass(h,"mceItemHiddenSpellWord")){f=true;return false}});if(!f){e._done()}},_done:function(){var d=this,e=d.active;if(d.active){d.active=0;d._removeWords();if(d._menu){d._menu.hideMenu()}if(e){d.editor.nodeChanged()}}},_sendRPC:function(e,g,d){var f=this;a.sendRPC({url:f.rpcUrl,method:e,params:g,success:d,error:function(i,h){f.editor.setProgressState(0);f.editor.windowManager.alert(i.errstr||("Error response: "+h.responseText))}})}});tinymce.PluginManager.add("spellchecker",tinymce.plugins.SpellcheckerPlugin)})(); \ No newline at end of file diff --git a/src/wp-includes/js/tinymce/plugins/spellchecker/img/wline.gif b/src/wp-includes/js/tinymce/plugins/spellchecker/img/wline.gif new file mode 100644 index 0000000..7d0a4db Binary files /dev/null and b/src/wp-includes/js/tinymce/plugins/spellchecker/img/wline.gif differ diff --git a/src/wp-includes/js/tinymce/plugins/spellchecker/includes/general.php b/src/wp-includes/js/tinymce/plugins/spellchecker/includes/general.php new file mode 100644 index 0000000..ffea3a0 --- /dev/null +++ b/src/wp-includes/js/tinymce/plugins/spellchecker/includes/general.php @@ -0,0 +1,98 @@ + $value) + $newarray[$name] = $value; + + return $newarray; + } + + return $_REQUEST[$name]; +} + +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)); +} + +?> \ No newline at end of file diff --git a/src/wp-includes/js/tinymce/plugins/spellchecker/rpc.php b/src/wp-includes/js/tinymce/plugins/spellchecker/rpc.php new file mode 100644 index 0000000..6a56734 --- /dev/null +++ b/src/wp-includes/js/tinymce/plugins/spellchecker/rpc.php @@ -0,0 +1,112 @@ +decode($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); + +?> diff --git a/src/wp-includes/js/tinymce/plugins/tabfocus/editor_plugin.js b/src/wp-includes/js/tinymce/plugins/tabfocus/editor_plugin.js new file mode 100644 index 0000000..d18689d --- /dev/null +++ b/src/wp-includes/js/tinymce/plugins/tabfocus/editor_plugin.js @@ -0,0 +1 @@ +(function(){var c=tinymce.DOM,a=tinymce.dom.Event,d=tinymce.each,b=tinymce.explode;tinymce.create("tinymce.plugins.TabFocusPlugin",{init:function(f,g){function e(i,j){if(j.keyCode===9){return a.cancel(j)}}function h(l,p){var j,m,o,n,k;function q(r){n=c.select(":input:enabled,*[tabindex]");function i(s){return s.type!="hidden"&&s.tabIndex!="-1"&&!(n[m].style.display=="none")&&!(n[m].style.visibility=="hidden")}d(n,function(t,s){if(t.id==l.id){j=s;return false}});if(r>0){for(m=j+1;m=0;m--){if(i(n[m])){return n[m]}}}return null}if(p.keyCode===9){k=b(l.getParam("tab_focus",l.getParam("tabfocus_elements",":prev,:next")));if(k.length==1){k[1]=k[0];k[0]=":prev"}if(p.shiftKey){if(k[0]==":prev"){n=q(-1)}else{n=c.get(k[0])}}else{if(k[1]==":next"){n=q(1)}else{n=c.get(k[1])}}if(n){if(n.id&&(l=tinymce.get(n.id||n.name))){l.focus()}else{window.setTimeout(function(){if(!tinymce.isWebKit){window.focus()}n.focus()},10)}return a.cancel(p)}}}f.onKeyUp.add(e);if(tinymce.isGecko){f.onKeyPress.add(h);f.onKeyDown.add(e)}else{f.onKeyDown.add(h)}},getInfo:function(){return{longname:"Tabfocus",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/tabfocus",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("tabfocus",tinymce.plugins.TabFocusPlugin)})(); \ No newline at end of file diff --git a/src/wp-includes/js/tinymce/plugins/wordpress/css/content.css b/src/wp-includes/js/tinymce/plugins/wordpress/css/content.css new file mode 100644 index 0000000..8cf986c --- /dev/null +++ b/src/wp-includes/js/tinymce/plugins/wordpress/css/content.css @@ -0,0 +1,29 @@ + +.mceWPnextpage, .mceWPmore { + border: 0; + border-top: 1px dotted #cccccc; + display: block; + width: 95%; + height: 12px; + margin: 15px auto 0; +} +.mceWPmore { + background: transparent url(../img/more_bug.gif) no-repeat right top; +} +.mceWPnextpage { + background: transparent url(../img/page_bug.gif) no-repeat right top; +} + +img.wpGallery { + border: 1px dashed #888; + background: #f2f8ff url("../../wpgallery/img/gallery.png") no-repeat scroll center center; + width: 99%; + height: 250px; +} + +img.wp-oembed { + border: 1px dashed #888; + background: #f7f5f2 url("../img/embedded.png") no-repeat scroll center center; + width: 300px; + height: 250px; +} diff --git a/src/wp-includes/js/tinymce/plugins/wordpress/editor_plugin.dev.js b/src/wp-includes/js/tinymce/plugins/wordpress/editor_plugin.dev.js new file mode 100644 index 0000000..6c0083c --- /dev/null +++ b/src/wp-includes/js/tinymce/plugins/wordpress/editor_plugin.dev.js @@ -0,0 +1,423 @@ +/** + * WordPress plugin. + */ + +(function() { + var DOM = tinymce.DOM; + + tinymce.create('tinymce.plugins.WordPress', { + mceTout : 0, + + init : function(ed, url) { + var t = this, tbId = ed.getParam('wordpress_adv_toolbar', 'toolbar2'), last = 0, moreHTML, nextpageHTML; + moreHTML = ''; + nextpageHTML = ''; + + if ( getUserSetting('hidetb', '0') == '1' ) + ed.settings.wordpress_adv_hidden = 0; + + // Hides the specified toolbar and resizes the iframe + ed.onPostRender.add(function() { + var adv_toolbar = ed.controlManager.get(tbId); + if ( ed.getParam('wordpress_adv_hidden', 1) && adv_toolbar ) { + DOM.hide(adv_toolbar.id); + t._resizeIframe(ed, tbId, 28); + } + }); + + // Register commands + ed.addCommand('WP_More', function() { + ed.execCommand('mceInsertContent', 0, moreHTML); + }); + + ed.addCommand('WP_Page', function() { + ed.execCommand('mceInsertContent', 0, nextpageHTML); + }); + + ed.addCommand('WP_Help', function() { + ed.windowManager.open({ + url : tinymce.baseURL + '/wp-mce-help.php', + width : 450, + height : 420, + inline : 1 + }); + }); + + ed.addCommand('WP_Adv', function() { + var cm = ed.controlManager, id = cm.get(tbId).id; + + if ( 'undefined' == id ) + return; + + if ( DOM.isHidden(id) ) { + cm.setActive('wp_adv', 1); + DOM.show(id); + t._resizeIframe(ed, tbId, -28); + ed.settings.wordpress_adv_hidden = 0; + setUserSetting('hidetb', '1'); + } else { + cm.setActive('wp_adv', 0); + DOM.hide(id); + t._resizeIframe(ed, tbId, 28); + ed.settings.wordpress_adv_hidden = 1; + setUserSetting('hidetb', '0'); + } + }); + + // Register buttons + ed.addButton('wp_more', { + title : 'wordpress.wp_more_desc', + cmd : 'WP_More' + }); + + ed.addButton('wp_page', { + title : 'wordpress.wp_page_desc', + image : url + '/img/page.gif', + cmd : 'WP_Page' + }); + + ed.addButton('wp_help', { + title : 'wordpress.wp_help_desc', + cmd : 'WP_Help' + }); + + ed.addButton('wp_adv', { + title : 'wordpress.wp_adv_desc', + cmd : 'WP_Adv' + }); + + // Add Media buttons + ed.addButton('add_media', { + title : 'wordpress.add_media', + image : url + '/img/media.gif', + onclick : function() { + tb_show('', tinymce.DOM.get('add_media').href); + tinymce.DOM.setStyle( ['TB_overlay','TB_window','TB_load'], 'z-index', '999999' ); + } + }); + + ed.addButton('add_image', { + title : 'wordpress.add_image', + image : url + '/img/image.gif', + onclick : function() { + tb_show('', tinymce.DOM.get('add_image').href); + tinymce.DOM.setStyle( ['TB_overlay','TB_window','TB_load'], 'z-index', '999999' ); + } + }); + + ed.addButton('add_video', { + title : 'wordpress.add_video', + image : url + '/img/video.gif', + onclick : function() { + tb_show('', tinymce.DOM.get('add_video').href); + tinymce.DOM.setStyle( ['TB_overlay','TB_window','TB_load'], 'z-index', '999999' ); + } + }); + + ed.addButton('add_audio', { + title : 'wordpress.add_audio', + image : url + '/img/audio.gif', + onclick : function() { + tb_show('', tinymce.DOM.get('add_audio').href); + tinymce.DOM.setStyle( ['TB_overlay','TB_window','TB_load'], 'z-index', '999999' ); + } + }); + + // Add Media buttons to fullscreen and handle align buttons for image captions + ed.onBeforeExecCommand.add(function(ed, cmd, ui, val, o) { + var DOM = tinymce.DOM, n, DL, DIV, cls, a, align; + if ( 'mceFullScreen' == cmd ) { + if ( 'mce_fullscreen' != ed.id && DOM.get('add_audio') && DOM.get('add_video') && DOM.get('add_image') && DOM.get('add_media') ) + ed.settings.theme_advanced_buttons1 += ',|,add_image,add_video,add_audio,add_media'; + } + + if ( 'JustifyLeft' == cmd || 'JustifyRight' == cmd || 'JustifyCenter' == cmd ) { + n = ed.selection.getNode(); + + if ( n.nodeName == 'IMG' ) { + align = cmd.substr(7).toLowerCase(); + a = 'align' + align; + DL = ed.dom.getParent(n, 'dl.wp-caption'); + DIV = ed.dom.getParent(n, 'div.mceTemp'); + + if ( DL && DIV ) { + cls = ed.dom.hasClass(DL, a) ? 'alignnone' : a; + DL.className = DL.className.replace(/align[^ '"]+\s?/g, ''); + ed.dom.addClass(DL, cls); + + if (cls == 'aligncenter') + ed.dom.addClass(DIV, 'mceIEcenter'); + else + ed.dom.removeClass(DIV, 'mceIEcenter'); + + o.terminate = true; + ed.execCommand('mceRepaint'); + } else { + if ( ed.dom.hasClass(n, a) ) + ed.dom.addClass(n, 'alignnone'); + else + ed.dom.removeClass(n, 'alignnone'); + } + } + } + }); + + ed.onInit.add(function(ed) { + // make sure these run last + ed.onNodeChange.add( function(ed, cm, e) { + var DL; + + if ( e.nodeName == 'IMG' ) { + DL = ed.dom.getParent(e, 'dl.wp-caption'); + } else if ( e.nodeName == 'DIV' && ed.dom.hasClass(e, 'mceTemp') ) { + DL = e.firstChild; + + if ( ! ed.dom.hasClass(DL, 'wp-caption') ) + DL = false; + } + + if ( DL ) { + if ( ed.dom.hasClass(DL, 'alignleft') ) + cm.setActive('justifyleft', 1); + else if ( ed.dom.hasClass(DL, 'alignright') ) + cm.setActive('justifyright', 1); + else if ( ed.dom.hasClass(DL, 'aligncenter') ) + cm.setActive('justifycenter', 1); + } + }); + + if ( ed.id != 'wp_mce_fullscreen' ) + ed.dom.addClass(ed.getBody(), 'wp-editor'); + + // remove invalid parent paragraphs when pasting HTML and/or switching to the HTML editor and back + ed.onBeforeSetContent.add(function(ed, o) { + if ( o.content ) { + o.content = o.content.replace(/

            \s*<(p|div|ul|ol|dl|table|blockquote|h[1-6]|fieldset|pre|address)( [^>]*)?>/gi, '<$1$2>'); + o.content = o.content.replace(/<\/(p|div|ul|ol|dl|table|blockquote|h[1-6]|fieldset|pre|address)>\s*<\/p>/gi, ''); + } + }); + }); + + // Word count + if ( 'undefined' != typeof(jQuery) ) { + ed.onKeyUp.add(function(ed, e) { + var k = e.keyCode || e.charCode; + + if ( k == last ) + return; + + if ( 13 == k || 8 == last || 46 == last ) + jQuery(document).triggerHandler('wpcountwords', [ ed.getContent({format : 'raw'}) ]); + + last = k; + }); + }; + + // keep empty paragraphs :( + ed.onSaveContent.addToTop(function(ed, o) { + o.content = o.content.replace(/

            (
            |\u00a0|\uFEFF)?<\/p>/g, '

             

            '); + }); + + ed.onSaveContent.add(function(ed, o) { + if ( typeof(switchEditors) == 'object' ) { + if ( ed.isHidden() ) + o.content = o.element.value; + else + o.content = switchEditors.pre_wpautop(o.content); + } + }); + + /* disable for now + ed.onBeforeSetContent.add(function(ed, o) { + o.content = t._setEmbed(o.content); + }); + + ed.onPostProcess.add(function(ed, o) { + if ( o.get ) + o.content = t._getEmbed(o.content); + }); + */ + + // Add listeners to handle more break + t._handleMoreBreak(ed, url); + + // Add custom shortcuts + ed.addShortcut('alt+shift+c', ed.getLang('justifycenter_desc'), 'JustifyCenter'); + ed.addShortcut('alt+shift+r', ed.getLang('justifyright_desc'), 'JustifyRight'); + ed.addShortcut('alt+shift+l', ed.getLang('justifyleft_desc'), 'JustifyLeft'); + ed.addShortcut('alt+shift+j', ed.getLang('justifyfull_desc'), 'JustifyFull'); + ed.addShortcut('alt+shift+q', ed.getLang('blockquote_desc'), 'mceBlockQuote'); + ed.addShortcut('alt+shift+u', ed.getLang('bullist_desc'), 'InsertUnorderedList'); + ed.addShortcut('alt+shift+o', ed.getLang('numlist_desc'), 'InsertOrderedList'); + ed.addShortcut('alt+shift+d', ed.getLang('striketrough_desc'), 'Strikethrough'); + ed.addShortcut('alt+shift+n', ed.getLang('spellchecker.desc'), 'mceSpellCheck'); + ed.addShortcut('alt+shift+a', ed.getLang('link_desc'), 'mceLink'); + ed.addShortcut('alt+shift+s', ed.getLang('unlink_desc'), 'unlink'); + ed.addShortcut('alt+shift+m', ed.getLang('image_desc'), 'mceImage'); + ed.addShortcut('alt+shift+g', ed.getLang('fullscreen.desc'), 'mceFullScreen'); + ed.addShortcut('alt+shift+z', ed.getLang('wp_adv_desc'), 'WP_Adv'); + ed.addShortcut('alt+shift+h', ed.getLang('help_desc'), 'WP_Help'); + ed.addShortcut('alt+shift+t', ed.getLang('wp_more_desc'), 'WP_More'); + ed.addShortcut('alt+shift+p', ed.getLang('wp_page_desc'), 'WP_Page'); + ed.addShortcut('ctrl+s', ed.getLang('save_desc'), function(){if('function'==typeof autosave)autosave();}); + + if ( tinymce.isWebKit ) { + ed.addShortcut('alt+shift+b', ed.getLang('bold_desc'), 'Bold'); + ed.addShortcut('alt+shift+i', ed.getLang('italic_desc'), 'Italic'); + } + + ed.onInit.add(function(ed) { + tinymce.dom.Event.add(ed.getWin(), 'scroll', function(e) { + ed.plugins.wordpress._hideButtons(); + }); + tinymce.dom.Event.add(ed.getBody(), 'dragstart', function(e) { + ed.plugins.wordpress._hideButtons(); + }); + }); + + ed.onBeforeExecCommand.add(function(ed, cmd, ui, val) { + ed.plugins.wordpress._hideButtons(); + }); + + ed.onSaveContent.add(function(ed, o) { + ed.plugins.wordpress._hideButtons(); + }); + + ed.onMouseDown.add(function(ed, e) { + if ( e.target.nodeName != 'IMG' ) + ed.plugins.wordpress._hideButtons(); + }); + }, + + getInfo : function() { + return { + longname : 'WordPress Plugin', + author : 'WordPress', // add Moxiecode? + authorurl : 'http://wordpress.org', + infourl : 'http://wordpress.org', + version : '3.0' + }; + }, + + // Internal functions + _setEmbed : function(c) { + return c.replace(/\[embed\]([\s\S]+?)\[\/embed\][\s\u00a0]*/g, function(a,b){ + return ''+b+''; + }); + }, + + _getEmbed : function(c) { + return c.replace(/]+>/g, function(a) { + if ( a.indexOf('class="wp-oembed') != -1 ) { + var u = a.match(/alt="([^\"]+)"/); + if ( u[1] ) + a = '[embed]' + u[1] + '[/embed]'; + } + return a; + }); + }, + + _showButtons : function(n, id) { + var ed = tinyMCE.activeEditor, p1, p2, vp, DOM = tinymce.DOM, X, Y; + + vp = ed.dom.getViewPort(ed.getWin()); + p1 = DOM.getPos(ed.getContentAreaContainer()); + p2 = ed.dom.getPos(n); + + X = Math.max(p2.x - vp.x, 0) + p1.x; + Y = Math.max(p2.y - vp.y, 0) + p1.y; + + DOM.setStyles(id, { + 'top' : Y+5+'px', + 'left' : X+5+'px', + 'display' : 'block' + }); + + if ( this.mceTout ) + clearTimeout(this.mceTout); + + this.mceTout = setTimeout( function(){ed.plugins.wordpress._hideButtons();}, 5000 ); + }, + + _hideButtons : function() { + if ( !this.mceTout ) + return; + + if ( document.getElementById('wp_editbtns') ) + tinymce.DOM.hide('wp_editbtns'); + + if ( document.getElementById('wp_gallerybtns') ) + tinymce.DOM.hide('wp_gallerybtns'); + + clearTimeout(this.mceTout); + this.mceTout = 0; + }, + + // Resizes the iframe by a relative height value + _resizeIframe : function(ed, tb_id, dy) { + var ifr = ed.getContentAreaContainer().firstChild; + + DOM.setStyle(ifr, 'height', ifr.clientHeight + dy); // Resize iframe + ed.theme.deltaHeight += dy; // For resize cookie + }, + + _handleMoreBreak : function(ed, url) { + var moreHTML, nextpageHTML; + + moreHTML = '$1'; + nextpageHTML = ''; + + // Load plugin specific CSS into editor + ed.onInit.add(function() { + ed.dom.loadCSS(url + '/css/content.css'); + }); + + // Display morebreak instead if img in element path + ed.onPostRender.add(function() { + if (ed.theme.onResolveName) { + ed.theme.onResolveName.add(function(th, o) { + if (o.node.nodeName == 'IMG') { + if ( ed.dom.hasClass(o.node, 'mceWPmore') ) + o.name = 'wpmore'; + if ( ed.dom.hasClass(o.node, 'mceWPnextpage') ) + o.name = 'wppage'; + } + + }); + } + }); + + // Replace morebreak with images + ed.onBeforeSetContent.add(function(ed, o) { + if ( o.content ) { + o.content = o.content.replace(//g, moreHTML); + o.content = o.content.replace(//g, nextpageHTML); + } + }); + + // Replace images with morebreak + ed.onPostProcess.add(function(ed, o) { + if (o.get) + o.content = o.content.replace(/]+>/g, function(im) { + if (im.indexOf('class="mceWPmore') !== -1) { + var m, moretext = (m = im.match(/alt="(.*?)"/)) ? m[1] : ''; + im = ''; + } + if (im.indexOf('class="mceWPnextpage') !== -1) + im = ''; + + return im; + }); + }); + + // Set active buttons if user selected pagebreak or more break + ed.onNodeChange.add(function(ed, cm, n) { + cm.setActive('wp_page', n.nodeName === 'IMG' && ed.dom.hasClass(n, 'mceWPnextpage')); + cm.setActive('wp_more', n.nodeName === 'IMG' && ed.dom.hasClass(n, 'mceWPmore')); + }); + } + }); + + // Register plugin + tinymce.PluginManager.add('wordpress', tinymce.plugins.WordPress); +})(); diff --git a/src/wp-includes/js/tinymce/plugins/wordpress/editor_plugin.js b/src/wp-includes/js/tinymce/plugins/wordpress/editor_plugin.js new file mode 100644 index 0000000..115661a --- /dev/null +++ b/src/wp-includes/js/tinymce/plugins/wordpress/editor_plugin.js @@ -0,0 +1 @@ +(function(){var a=tinymce.DOM;tinymce.create("tinymce.plugins.WordPress",{mceTout:0,init:function(c,d){var e=this,h=c.getParam("wordpress_adv_toolbar","toolbar2"),g=0,f,b;f='';b='';if(getUserSetting("hidetb","0")=="1"){c.settings.wordpress_adv_hidden=0}c.onPostRender.add(function(){var i=c.controlManager.get(h);if(c.getParam("wordpress_adv_hidden",1)&&i){a.hide(i.id);e._resizeIframe(c,h,28)}});c.addCommand("WP_More",function(){c.execCommand("mceInsertContent",0,f)});c.addCommand("WP_Page",function(){c.execCommand("mceInsertContent",0,b)});c.addCommand("WP_Help",function(){c.windowManager.open({url:tinymce.baseURL+"/wp-mce-help.php",width:450,height:420,inline:1})});c.addCommand("WP_Adv",function(){var i=c.controlManager,j=i.get(h).id;if("undefined"==j){return}if(a.isHidden(j)){i.setActive("wp_adv",1);a.show(j);e._resizeIframe(c,h,-28);c.settings.wordpress_adv_hidden=0;setUserSetting("hidetb","1")}else{i.setActive("wp_adv",0);a.hide(j);e._resizeIframe(c,h,28);c.settings.wordpress_adv_hidden=1;setUserSetting("hidetb","0")}});c.addButton("wp_more",{title:"wordpress.wp_more_desc",cmd:"WP_More"});c.addButton("wp_page",{title:"wordpress.wp_page_desc",image:d+"/img/page.gif",cmd:"WP_Page"});c.addButton("wp_help",{title:"wordpress.wp_help_desc",cmd:"WP_Help"});c.addButton("wp_adv",{title:"wordpress.wp_adv_desc",cmd:"WP_Adv"});c.addButton("add_media",{title:"wordpress.add_media",image:d+"/img/media.gif",onclick:function(){tb_show("",tinymce.DOM.get("add_media").href);tinymce.DOM.setStyle(["TB_overlay","TB_window","TB_load"],"z-index","999999")}});c.addButton("add_image",{title:"wordpress.add_image",image:d+"/img/image.gif",onclick:function(){tb_show("",tinymce.DOM.get("add_image").href);tinymce.DOM.setStyle(["TB_overlay","TB_window","TB_load"],"z-index","999999")}});c.addButton("add_video",{title:"wordpress.add_video",image:d+"/img/video.gif",onclick:function(){tb_show("",tinymce.DOM.get("add_video").href);tinymce.DOM.setStyle(["TB_overlay","TB_window","TB_load"],"z-index","999999")}});c.addButton("add_audio",{title:"wordpress.add_audio",image:d+"/img/audio.gif",onclick:function(){tb_show("",tinymce.DOM.get("add_audio").href);tinymce.DOM.setStyle(["TB_overlay","TB_window","TB_load"],"z-index","999999")}});c.onBeforeExecCommand.add(function(p,m,s,l,j){var v=tinymce.DOM,k,i,r,u,t,q;if("mceFullScreen"==m){if("mce_fullscreen"!=p.id&&v.get("add_audio")&&v.get("add_video")&&v.get("add_image")&&v.get("add_media")){p.settings.theme_advanced_buttons1+=",|,add_image,add_video,add_audio,add_media"}}if("JustifyLeft"==m||"JustifyRight"==m||"JustifyCenter"==m){k=p.selection.getNode();if(k.nodeName=="IMG"){q=m.substr(7).toLowerCase();t="align"+q;i=p.dom.getParent(k,"dl.wp-caption");r=p.dom.getParent(k,"div.mceTemp");if(i&&r){u=p.dom.hasClass(i,t)?"alignnone":t;i.className=i.className.replace(/align[^ '"]+\s?/g,"");p.dom.addClass(i,u);if(u=="aligncenter"){p.dom.addClass(r,"mceIEcenter")}else{p.dom.removeClass(r,"mceIEcenter")}j.terminate=true;p.execCommand("mceRepaint")}else{if(p.dom.hasClass(k,t)){p.dom.addClass(k,"alignnone")}else{p.dom.removeClass(k,"alignnone")}}}}});c.onInit.add(function(i){i.onNodeChange.add(function(k,j,m){var l;if(m.nodeName=="IMG"){l=k.dom.getParent(m,"dl.wp-caption")}else{if(m.nodeName=="DIV"&&k.dom.hasClass(m,"mceTemp")){l=m.firstChild;if(!k.dom.hasClass(l,"wp-caption")){l=false}}}if(l){if(k.dom.hasClass(l,"alignleft")){j.setActive("justifyleft",1)}else{if(k.dom.hasClass(l,"alignright")){j.setActive("justifyright",1)}else{if(k.dom.hasClass(l,"aligncenter")){j.setActive("justifycenter",1)}}}}});if(i.id!="wp_mce_fullscreen"){i.dom.addClass(i.getBody(),"wp-editor")}i.onBeforeSetContent.add(function(j,k){if(k.content){k.content=k.content.replace(/

            \s*<(p|div|ul|ol|dl|table|blockquote|h[1-6]|fieldset|pre|address)( [^>]*)?>/gi,"<$1$2>");k.content=k.content.replace(/<\/(p|div|ul|ol|dl|table|blockquote|h[1-6]|fieldset|pre|address)>\s*<\/p>/gi,"")}})});if("undefined"!=typeof(jQuery)){c.onKeyUp.add(function(j,l){var i=l.keyCode||l.charCode;if(i==g){return}if(13==i||8==g||46==g){jQuery(document).triggerHandler("wpcountwords",[j.getContent({format:"raw"})])}g=i})}c.onSaveContent.addToTop(function(i,j){j.content=j.content.replace(/

            (
            |\u00a0|\uFEFF)?<\/p>/g,"

             

            ")});c.onSaveContent.add(function(i,j){if(typeof(switchEditors)=="object"){if(i.isHidden()){j.content=j.element.value}else{j.content=switchEditors.pre_wpautop(j.content)}}});e._handleMoreBreak(c,d);c.addShortcut("alt+shift+c",c.getLang("justifycenter_desc"),"JustifyCenter");c.addShortcut("alt+shift+r",c.getLang("justifyright_desc"),"JustifyRight");c.addShortcut("alt+shift+l",c.getLang("justifyleft_desc"),"JustifyLeft");c.addShortcut("alt+shift+j",c.getLang("justifyfull_desc"),"JustifyFull");c.addShortcut("alt+shift+q",c.getLang("blockquote_desc"),"mceBlockQuote");c.addShortcut("alt+shift+u",c.getLang("bullist_desc"),"InsertUnorderedList");c.addShortcut("alt+shift+o",c.getLang("numlist_desc"),"InsertOrderedList");c.addShortcut("alt+shift+d",c.getLang("striketrough_desc"),"Strikethrough");c.addShortcut("alt+shift+n",c.getLang("spellchecker.desc"),"mceSpellCheck");c.addShortcut("alt+shift+a",c.getLang("link_desc"),"mceLink");c.addShortcut("alt+shift+s",c.getLang("unlink_desc"),"unlink");c.addShortcut("alt+shift+m",c.getLang("image_desc"),"mceImage");c.addShortcut("alt+shift+g",c.getLang("fullscreen.desc"),"mceFullScreen");c.addShortcut("alt+shift+z",c.getLang("wp_adv_desc"),"WP_Adv");c.addShortcut("alt+shift+h",c.getLang("help_desc"),"WP_Help");c.addShortcut("alt+shift+t",c.getLang("wp_more_desc"),"WP_More");c.addShortcut("alt+shift+p",c.getLang("wp_page_desc"),"WP_Page");c.addShortcut("ctrl+s",c.getLang("save_desc"),function(){if("function"==typeof autosave){autosave()}});if(tinymce.isWebKit){c.addShortcut("alt+shift+b",c.getLang("bold_desc"),"Bold");c.addShortcut("alt+shift+i",c.getLang("italic_desc"),"Italic")}c.onInit.add(function(i){tinymce.dom.Event.add(i.getWin(),"scroll",function(j){i.plugins.wordpress._hideButtons()});tinymce.dom.Event.add(i.getBody(),"dragstart",function(j){i.plugins.wordpress._hideButtons()})});c.onBeforeExecCommand.add(function(i,k,j,l){i.plugins.wordpress._hideButtons()});c.onSaveContent.add(function(i,j){i.plugins.wordpress._hideButtons()});c.onMouseDown.add(function(i,j){if(j.target.nodeName!="IMG"){i.plugins.wordpress._hideButtons()}})},getInfo:function(){return{longname:"WordPress Plugin",author:"WordPress",authorurl:"http://wordpress.org",infourl:"http://wordpress.org",version:"3.0"}},_setEmbed:function(b){return b.replace(/\[embed\]([\s\S]+?)\[\/embed\][\s\u00a0]*/g,function(d,c){return''+c+''})},_getEmbed:function(b){return b.replace(/]+>/g,function(c){if(c.indexOf('class="wp-oembed')!=-1){var d=c.match(/alt="([^\"]+)"/);if(d[1]){c="[embed]"+d[1]+"[/embed]"}}return c})},_showButtons:function(f,d){var g=tinyMCE.activeEditor,i,h,b,j=tinymce.DOM,e,c;b=g.dom.getViewPort(g.getWin());i=j.getPos(g.getContentAreaContainer());h=g.dom.getPos(f);e=Math.max(h.x-b.x,0)+i.x;c=Math.max(h.y-b.y,0)+i.y;j.setStyles(d,{top:c+5+"px",left:e+5+"px",display:"block"});if(this.mceTout){clearTimeout(this.mceTout)}this.mceTout=setTimeout(function(){g.plugins.wordpress._hideButtons()},5000)},_hideButtons:function(){if(!this.mceTout){return}if(document.getElementById("wp_editbtns")){tinymce.DOM.hide("wp_editbtns")}if(document.getElementById("wp_gallerybtns")){tinymce.DOM.hide("wp_gallerybtns")}clearTimeout(this.mceTout);this.mceTout=0},_resizeIframe:function(c,e,b){var d=c.getContentAreaContainer().firstChild;a.setStyle(d,"height",d.clientHeight+b);c.theme.deltaHeight+=b},_handleMoreBreak:function(c,d){var e,b;e='$1';b='';c.onInit.add(function(){c.dom.loadCSS(d+"/css/content.css")});c.onPostRender.add(function(){if(c.theme.onResolveName){c.theme.onResolveName.add(function(f,g){if(g.node.nodeName=="IMG"){if(c.dom.hasClass(g.node,"mceWPmore")){g.name="wpmore"}if(c.dom.hasClass(g.node,"mceWPnextpage")){g.name="wppage"}}})}});c.onBeforeSetContent.add(function(f,g){if(g.content){g.content=g.content.replace(//g,e);g.content=g.content.replace(//g,b)}});c.onPostProcess.add(function(f,g){if(g.get){g.content=g.content.replace(/]+>/g,function(i){if(i.indexOf('class="mceWPmore')!==-1){var h,j=(h=i.match(/alt="(.*?)"/))?h[1]:"";i=""}if(i.indexOf('class="mceWPnextpage')!==-1){i=""}return i})}});c.onNodeChange.add(function(g,f,h){f.setActive("wp_page",h.nodeName==="IMG"&&g.dom.hasClass(h,"mceWPnextpage"));f.setActive("wp_more",h.nodeName==="IMG"&&g.dom.hasClass(h,"mceWPmore"))})}});tinymce.PluginManager.add("wordpress",tinymce.plugins.WordPress)})(); \ No newline at end of file diff --git a/src/wp-includes/js/tinymce/plugins/wordpress/img/audio.gif b/src/wp-includes/js/tinymce/plugins/wordpress/img/audio.gif new file mode 100644 index 0000000..f8ad223 Binary files /dev/null and b/src/wp-includes/js/tinymce/plugins/wordpress/img/audio.gif differ diff --git a/src/wp-includes/js/tinymce/plugins/wordpress/img/embedded.png b/src/wp-includes/js/tinymce/plugins/wordpress/img/embedded.png new file mode 100644 index 0000000..173401b Binary files /dev/null and b/src/wp-includes/js/tinymce/plugins/wordpress/img/embedded.png differ diff --git a/src/wp-includes/js/tinymce/plugins/wordpress/img/image.gif b/src/wp-includes/js/tinymce/plugins/wordpress/img/image.gif new file mode 100644 index 0000000..6736e6b Binary files /dev/null and b/src/wp-includes/js/tinymce/plugins/wordpress/img/image.gif differ diff --git a/src/wp-includes/js/tinymce/plugins/wordpress/img/media.gif b/src/wp-includes/js/tinymce/plugins/wordpress/img/media.gif new file mode 100644 index 0000000..786e4f5 Binary files /dev/null and b/src/wp-includes/js/tinymce/plugins/wordpress/img/media.gif differ diff --git a/src/wp-includes/js/tinymce/plugins/wordpress/img/more_bug.gif b/src/wp-includes/js/tinymce/plugins/wordpress/img/more_bug.gif new file mode 100644 index 0000000..4589cb4 Binary files /dev/null and b/src/wp-includes/js/tinymce/plugins/wordpress/img/more_bug.gif differ diff --git a/src/wp-includes/js/tinymce/plugins/wordpress/img/page.gif b/src/wp-includes/js/tinymce/plugins/wordpress/img/page.gif new file mode 100644 index 0000000..1cea78a Binary files /dev/null and b/src/wp-includes/js/tinymce/plugins/wordpress/img/page.gif differ diff --git a/src/wp-includes/js/tinymce/plugins/wordpress/img/page_bug.gif b/src/wp-includes/js/tinymce/plugins/wordpress/img/page_bug.gif new file mode 100644 index 0000000..9ea3565 Binary files /dev/null and b/src/wp-includes/js/tinymce/plugins/wordpress/img/page_bug.gif differ diff --git a/src/wp-includes/js/tinymce/plugins/wordpress/img/trans.gif b/src/wp-includes/js/tinymce/plugins/wordpress/img/trans.gif new file mode 100644 index 0000000..3884865 Binary files /dev/null and b/src/wp-includes/js/tinymce/plugins/wordpress/img/trans.gif differ diff --git a/src/wp-includes/js/tinymce/plugins/wordpress/img/video.gif b/src/wp-includes/js/tinymce/plugins/wordpress/img/video.gif new file mode 100644 index 0000000..b8e0975 Binary files /dev/null and b/src/wp-includes/js/tinymce/plugins/wordpress/img/video.gif differ diff --git a/src/wp-includes/js/tinymce/plugins/wpdialogs/editor_plugin.dev.js b/src/wp-includes/js/tinymce/plugins/wpdialogs/editor_plugin.dev.js new file mode 100644 index 0000000..4be9c3f --- /dev/null +++ b/src/wp-includes/js/tinymce/plugins/wpdialogs/editor_plugin.dev.js @@ -0,0 +1,80 @@ +/** + * editor_plugin_src.js + * + * Copyright 2009, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://tinymce.moxiecode.com/license + * Contributing: http://tinymce.moxiecode.com/contributing + */ + +(function() { + tinymce.create('tinymce.plugins.WPDialogs', { + init : function(ed, url) { + tinymce.create('tinymce.WPWindowManager:tinymce.InlineWindowManager', { + WPWindowManager : function(ed) { + this.parent(ed); + }, + + open : function(f, p) { + var t = this, element; + + if ( ! f.wpDialog ) + return this.parent( f, p ); + else if ( ! f.id ) + return; + + element = jQuery('#' + f.id); + if ( ! element.length ) + return; + + t.features = f; + t.params = p; + t.onOpen.dispatch(t, f, p); + t.element = t.windows[ f.id ] = element; + + // Store selection + t.bookmark = t.editor.selection.getBookmark(1); + + // Create the dialog if necessary + if ( ! element.data('wpdialog') ) { + element.wpdialog({ + title: f.title, + width: f.width, + height: f.height, + modal: true, + dialogClass: 'wp-dialog', + zIndex: 300000 + }); + } + + element.wpdialog('open'); + }, + close : function() { + if ( ! this.features.wpDialog ) + return this.parent.apply( this, arguments ); + + this.element.wpdialog('close'); + } + }); + + // Replace window manager + ed.onBeforeRenderUI.add(function() { + ed.windowManager = new tinymce.WPWindowManager(ed); + }); + }, + + getInfo : function() { + return { + longname : 'WPDialogs', + author : 'WordPress', + authorurl : 'http://wordpress.org', + infourl : 'http://wordpress.org', + version : '0.1' + }; + } + }); + + // Register plugin + tinymce.PluginManager.add('wpdialogs', tinymce.plugins.WPDialogs); +})(); diff --git a/src/wp-includes/js/tinymce/plugins/wpdialogs/editor_plugin.js b/src/wp-includes/js/tinymce/plugins/wpdialogs/editor_plugin.js new file mode 100644 index 0000000..1ba21e3 --- /dev/null +++ b/src/wp-includes/js/tinymce/plugins/wpdialogs/editor_plugin.js @@ -0,0 +1 @@ +(function(){tinymce.create("tinymce.plugins.WPDialogs",{init:function(a,b){tinymce.create("tinymce.WPWindowManager:tinymce.InlineWindowManager",{WPWindowManager:function(c){this.parent(c)},open:function(e,g){var d=this,c;if(!e.wpDialog){return this.parent(e,g)}else{if(!e.id){return}}c=jQuery("#"+e.id);if(!c.length){return}d.features=e;d.params=g;d.onOpen.dispatch(d,e,g);d.element=d.windows[e.id]=c;d.bookmark=d.editor.selection.getBookmark(1);if(!c.data("wpdialog")){c.wpdialog({title:e.title,width:e.width,height:e.height,modal:true,dialogClass:"wp-dialog",zIndex:300000})}c.wpdialog("open")},close:function(){if(!this.features.wpDialog){return this.parent.apply(this,arguments)}this.element.wpdialog("close")}});a.onBeforeRenderUI.add(function(){a.windowManager=new tinymce.WPWindowManager(a)})},getInfo:function(){return{longname:"WPDialogs",author:"WordPress",authorurl:"http://wordpress.org",infourl:"http://wordpress.org",version:"0.1"}}});tinymce.PluginManager.add("wpdialogs",tinymce.plugins.WPDialogs)})(); \ No newline at end of file diff --git a/src/wp-includes/js/tinymce/plugins/wpdialogs/js/popup.dev.js b/src/wp-includes/js/tinymce/plugins/wpdialogs/js/popup.dev.js new file mode 100644 index 0000000..3f79a25 --- /dev/null +++ b/src/wp-includes/js/tinymce/plugins/wpdialogs/js/popup.dev.js @@ -0,0 +1,432 @@ +/** + * popup.js + * + * An altered version of tinyMCEPopup to work in the same window as tinymce. + * + * ------------------------------------------------------------------ + * + * Copyright 2009, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://tinymce.moxiecode.com/license + * Contributing: http://tinymce.moxiecode.com/contributing + */ + +// Some global instances + +/** + * TinyMCE popup/dialog helper class. This gives you easy access to the + * parent editor instance and a bunch of other things. It's higly recommended + * that you load this script into your dialogs. + * + * @static + * @class tinyMCEPopup + */ +var tinyMCEPopup = { + /** + * Initializes the popup this will be called automatically. + * + * @method init + */ + init : function() { + var t = this, w, ti; + + // Find window & API + w = t.getWin(); + tinymce = w.tinymce; + tinyMCE = w.tinyMCE; + t.editor = tinymce.EditorManager.activeEditor; + t.params = t.editor.windowManager.params; + t.features = t.editor.windowManager.features; + t.dom = tinymce.dom; + + // Setup on init listeners + t.listeners = []; + t.onInit = { + add : function(f, s) { + t.listeners.push({func : f, scope : s}); + } + }; + + t.isWindow = false; + t.id = t.features.id; + t.editor.windowManager.onOpen.dispatch(t.editor.windowManager, window); + }, + + /** + * Returns the reference to the parent window that opened the dialog. + * + * @method getWin + * @return {Window} Reference to the parent window that opened the dialog. + */ + getWin : function() { + return window; + }, + + /** + * Returns a window argument/parameter by name. + * + * @method getWindowArg + * @param {String} n Name of the window argument to retrive. + * @param {String} dv Optional default value to return. + * @return {String} Argument value or default value if it wasn't found. + */ + getWindowArg : function(n, dv) { + var v = this.params[n]; + + return tinymce.is(v) ? v : dv; + }, + + /** + * Returns a editor parameter/config option value. + * + * @method getParam + * @param {String} n Name of the editor config option to retrive. + * @param {String} dv Optional default value to return. + * @return {String} Parameter value or default value if it wasn't found. + */ + getParam : function(n, dv) { + return this.editor.getParam(n, dv); + }, + + /** + * Returns a language item by key. + * + * @method getLang + * @param {String} n Language item like mydialog.something. + * @param {String} dv Optional default value to return. + * @return {String} Language value for the item like "my string" or the default value if it wasn't found. + */ + getLang : function(n, dv) { + return this.editor.getLang(n, dv); + }, + + /** + * Executed a command on editor that opened the dialog/popup. + * + * @method execCommand + * @param {String} cmd Command to execute. + * @param {Boolean} ui Optional boolean value if the UI for the command should be presented or not. + * @param {Object} val Optional value to pass with the comman like an URL. + * @param {Object} a Optional arguments object. + */ + execCommand : function(cmd, ui, val, a) { + a = a || {}; + a.skip_focus = 1; + + this.restoreSelection(); + return this.editor.execCommand(cmd, ui, val, a); + }, + + /** + * Resizes the dialog to the inner size of the window. This is needed since various browsers + * have different border sizes on windows. + * + * @method resizeToInnerSize + */ + resizeToInnerSize : function() { + var t = this; + + // Detach it to workaround a Chrome specific bug + // https://sourceforge.net/tracker/?func=detail&atid=635682&aid=2926339&group_id=103281 + setTimeout(function() { + var vp = t.dom.getViewPort(window); + + t.editor.windowManager.resizeBy( + t.getWindowArg('mce_width') - vp.w, + t.getWindowArg('mce_height') - vp.h, + t.id || window + ); + }, 0); + }, + + /** + * Will executed the specified string when the page has been loaded. This function + * was added for compatibility with the 2.x branch. + * + * @method executeOnLoad + * @param {String} s String to evalutate on init. + */ + executeOnLoad : function(s) { + this.onInit.add(function() { + eval(s); + }); + }, + + /** + * Stores the current editor selection for later restoration. This can be useful since some browsers + * looses it's selection if a control element is selected/focused inside the dialogs. + * + * @method storeSelection + */ + storeSelection : function() { + this.editor.windowManager.bookmark = tinyMCEPopup.editor.selection.getBookmark(1); + }, + + /** + * Restores any stored selection. This can be useful since some browsers + * looses it's selection if a control element is selected/focused inside the dialogs. + * + * @method restoreSelection + */ + restoreSelection : function() { + var t = tinyMCEPopup; + + if (!t.isWindow && tinymce.isIE) + t.editor.selection.moveToBookmark(t.editor.windowManager.bookmark); + }, + + /** + * Loads a specific dialog language pack. If you pass in plugin_url as a arugment + * when you open the window it will load the /langs/_dlg.js lang pack file. + * + * @method requireLangPack + */ + requireLangPack : function() { + var t = this, u = t.getWindowArg('plugin_url') || t.getWindowArg('theme_url'); + + if (u && t.editor.settings.language && t.features.translate_i18n !== false) { + u += '/langs/' + t.editor.settings.language + '_dlg.js'; + + if (!tinymce.ScriptLoader.isDone(u)) { + document.write(''); + tinymce.ScriptLoader.markDone(u); + } + } + }, + + /** + * Executes a color picker on the specified element id. When the user + * then selects a color it will be set as the value of the specified element. + * + * @method pickColor + * @param {DOMEvent} e DOM event object. + * @param {string} element_id Element id to be filled with the color value from the picker. + */ + 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 + } + } + }); + }, + + /** + * Opens a filebrowser/imagebrowser this will set the output value from + * the browser as a value on the specified element. + * + * @method openBrowser + * @param {string} element_id Id of the element to set value in. + * @param {string} type Type of browser to open image/file/flash. + * @param {string} option Option name to get the file_broswer_callback function name from. + */ + openBrowser : function(element_id, type, option) { + tinyMCEPopup.restoreSelection(); + this.editor.execCallback('file_browser_callback', element_id, document.getElementById(element_id).value, type, window); + }, + + /** + * Creates a confirm dialog. Please don't use the blocking behavior of this + * native version use the callback method instead then it can be extended. + * + * @method confirm + * @param {String} t Title for the new confirm dialog. + * @param {function} cb Callback function to be executed after the user has selected ok or cancel. + * @param {Object} s Optional scope to execute the callback in. + */ + confirm : function(t, cb, s) { + this.editor.windowManager.confirm(t, cb, s, window); + }, + + /** + * Creates a alert dialog. Please don't use the blocking behavior of this + * native version use the callback method instead then it can be extended. + * + * @method alert + * @param {String} t Title for the new alert dialog. + * @param {function} cb Callback function to be executed after the user has selected ok. + * @param {Object} s Optional scope to execute the callback in. + */ + alert : function(tx, cb, s) { + this.editor.windowManager.alert(tx, cb, s, window); + }, + + /** + * Closes the current window. + * + * @method close + */ + close : function() { + var t = this; + + // To avoid domain relaxing issue in Opera + function close() { + t.editor.windowManager.close(window); + t.editor = null; + }; + + 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 = tinyMCEPopup, ti = document.title, bm, h, nv; + + if (t.domLoaded) + return; + + t.domLoaded = 1; + + tinyMCEPopup.init(); + + // Translate page + if (t.features.translate_i18n !== false) { + 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',''); + + if ((nv = t.editor.translate(h)) && nv != h) + document.body.innerHTML = nv; + + if ((nv = t.editor.translate(ti)) && nv != ti) + document.title = ti = nv; + } + + 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); + + // Add base target element for it since it would fail with modal dialogs + t.dom.add(t.dom.select('head')[0], 'base', {target : '_self'}); + } + + t.restoreSelection(); + + // 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() { + // Use IE method + if (document.attachEvent) { + document.attachEvent("onreadystatechange", function() { + if (document.readyState === "complete") { + document.detachEvent("onreadystatechange", arguments.callee); + tinyMCEPopup._onDOMLoaded(); + } + }); + + if (document.documentElement.doScroll && window == window.top) { + (function() { + if (tinyMCEPopup.domLoaded) + return; + + try { + // If IE is used, use the trick by Diego Perini + // http://javascript.nwbox.com/IEContentLoaded/ + document.documentElement.doScroll("left"); + } catch (ex) { + setTimeout(arguments.callee, 0); + return; + } + + tinyMCEPopup._onDOMLoaded(); + })(); + } + + document.attachEvent('onload', tinyMCEPopup._onDOMLoaded); + } else if (document.addEventListener) { + window.addEventListener('DOMContentLoaded', tinyMCEPopup._onDOMLoaded, false); + window.addEventListener('load', tinyMCEPopup._onDOMLoaded, false); + } + } +}; diff --git a/src/wp-includes/js/tinymce/plugins/wpdialogs/js/popup.js b/src/wp-includes/js/tinymce/plugins/wpdialogs/js/popup.js new file mode 100644 index 0000000..abacbd3 --- /dev/null +++ b/src/wp-includes/js/tinymce/plugins/wpdialogs/js/popup.js @@ -0,0 +1 @@ +var tinyMCEPopup={init:function(){var b=this,a,c;a=b.getWin();tinymce=a.tinymce;tinyMCE=a.tinyMCE;b.editor=tinymce.EditorManager.activeEditor;b.params=b.editor.windowManager.params;b.features=b.editor.windowManager.features;b.dom=tinymce.dom;b.listeners=[];b.onInit={add:function(e,d){b.listeners.push({func:e,scope:d})}};b.isWindow=false;b.id=b.features.id;b.editor.windowManager.onOpen.dispatch(b.editor.windowManager,window)},getWin:function(){return window},getWindowArg:function(c,b){var a=this.params[c];return tinymce.is(a)?a:b},getParam:function(b,a){return this.editor.getParam(b,a)},getLang:function(b,a){return this.editor.getLang(b,a)},execCommand:function(d,c,e,b){b=b||{};b.skip_focus=1;this.restoreSelection();return this.editor.execCommand(d,c,e,b)},resizeToInnerSize:function(){var a=this;setTimeout(function(){var b=a.dom.getViewPort(window);a.editor.windowManager.resizeBy(a.getWindowArg("mce_width")-b.w,a.getWindowArg("mce_height")-b.h,a.id||window)},0)},executeOnLoad:function(s){this.onInit.add(function(){eval(s)})},storeSelection:function(){this.editor.windowManager.bookmark=tinyMCEPopup.editor.selection.getBookmark(1)},restoreSelection:function(){var a=tinyMCEPopup;if(!a.isWindow&&tinymce.isIE){a.editor.selection.moveToBookmark(a.editor.windowManager.bookmark)}},requireLangPack:function(){var b=this,a=b.getWindowArg("plugin_url")||b.getWindowArg("theme_url");if(a&&b.editor.settings.language&&b.features.translate_i18n!==false){a+="/langs/"+b.editor.settings.language+"_dlg.js";if(!tinymce.ScriptLoader.isDone(a)){document.write(' + + + + + + + + + + + +
            +
            +
            +
            {#wpeditimage.size}
            +
            +
            {#wpeditimage.s130}
            +
            {#wpeditimage.s120}
            +
            {#wpeditimage.s110}
            +
            {#wpeditimage.s100}
            +
            {#wpeditimage.s90}
            +
            {#wpeditimage.s80}
            +
            {#wpeditimage.s70}
            +
            {#wpeditimage.s60}
            +
            +
            +
            + + + Lorem ipsum dolor sit amet consectetuer velit pretium euismod ipsum enim. Mi cursus at a mollis senectus id arcu gravida quis urna. Sed et felis id tempus Morbi mauris tincidunt enim In mauris. Pede eu risus velit libero natoque enim lorem adipiscing ipsum consequat. In malesuada et sociis tincidunt tempus pellentesque cursus convallis ipsum Suspendisse. Risus In ac quis ut Nunc convallis laoreet ante Suspendisse Nam. Amet amet urna condimentum Vestibulum sem at Curabitur lorem et cursus. Sodales tortor fermentum leo dui habitant Nunc Sed Vestibulum. + Ut lorem In penatibus libero id ipsum sagittis nec elit Sed. Condimentum eget Vivamus vel consectetuer lorem molestie turpis amet tellus id. Condimentum vel ridiculus Fusce sed pede Nam nunc sodales eros tempor. Sit lacus magna dictumst Curabitur fringilla auctor id vitae wisi facilisi. Fermentum eget turpis felis velit leo Nunc Proin orci molestie Praesent. Curabitur tellus scelerisque suscipit ut sem amet cursus mi Morbi eu. Donec libero Vestibulum augue et mollis accumsan ornare condimentum In enim. Leo eget ac consectetuer quis condimentum malesuada. + Condimentum commodo et Lorem fringilla malesuada libero volutpat sem tellus enim. Tincidunt sed at Aenean nec nonummy porttitor Nam Sed Nulla ut. Auctor leo In aliquet Curabitur eros et velit Quisque justo morbi. Et vel mauris sit nulla semper vitae et quis at dui. Id at elit laoreet justo eu mauris Quisque et interdum pharetra. Nullam accumsan interdum Maecenas condimentum quis quis Fusce a sollicitudin Sed. Non Quisque Vivamus congue porttitor non semper ipsum porttitor quis vel. Donec eros lacus volutpat et tincidunt sem convallis id venenatis sit. Consectetuer odio. + Semper faucibus Morbi nulla convallis orci Aliquam Sed porttitor et Pellentesque. Venenatis laoreet lorem id a a Morbi augue turpis id semper. Arcu volutpat ac mauris Vestibulum fringilla Aenean condimentum nibh sed id. Sagittis eu lacus orci urna tellus tellus pretium Curabitur dui nunc. Et nibh eu eu nibh adipiscing at lorem Vestibulum adipiscing augue. Magna convallis Phasellus dolor malesuada Curabitur ornare adipiscing tellus Aliquam tempus. Id Aliquam Integer augue Nulla consectetuer ac Donec Curabitur tincidunt et. Id vel Nunc amet lacus dui magna ridiculus penatibus laoreet Duis. Enim sagittis nibh quis Nulla nec laoreet vel Maecenas mattis vel. + +
            + +
            + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
            + + + + + + + + + + + + + +
            + + + +
            + + + +
            + + + +
            + + +
            + + + +

            {#wpeditimage.link_help}

            +
            + + + +
            + + + + +
            +
            +
            + + + diff --git a/src/wp-includes/js/tinymce/plugins/wpeditimage/editor_plugin.dev.js b/src/wp-includes/js/tinymce/plugins/wpeditimage/editor_plugin.dev.js new file mode 100644 index 0000000..ff3cb47 --- /dev/null +++ b/src/wp-includes/js/tinymce/plugins/wpeditimage/editor_plugin.dev.js @@ -0,0 +1,219 @@ + +(function() { + tinymce.create('tinymce.plugins.wpEditImage', { + + init : function(ed, url) { + var t = this; + + t.url = url; + t._createButtons(); + + // Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('...'); + ed.addCommand('WP_EditImage', function() { + var el = ed.selection.getNode(), vp = tinymce.DOM.getViewPort(), H = vp.h, W = ( 720 < vp.w ) ? 720 : vp.w, cls = ed.dom.getAttrib(el, 'class'); + + if ( cls.indexOf('mceItem') != -1 || cls.indexOf('wpGallery') != -1 || el.nodeName != 'IMG' ) + return; + + tb_show('', url + '/editimage.html?ver=321&TB_iframe=true'); + tinymce.DOM.setStyles('TB_window', { + 'width':( W - 50 )+'px', + 'height':( H - 45 )+'px', + 'margin-left':'-'+parseInt((( W - 50 ) / 2),10) + 'px' + }); + + if ( ! tinymce.isIE6 ) { + tinymce.DOM.setStyles('TB_window', { + 'top':'20px', + 'marginTop':'0' + }); + } + + tinymce.DOM.setStyles('TB_iframeContent', { + 'width':( W - 50 )+'px', + 'height':( H - 75 )+'px' + }); + tinymce.DOM.setStyle( ['TB_overlay','TB_window','TB_load'], 'z-index', '999999' ); + }); + + ed.onInit.add(function(ed) { + tinymce.dom.Event.add(ed.getBody(), 'dragstart', function(e) { + if ( !tinymce.isGecko && e.target.nodeName == 'IMG' && ed.dom.getParent(e.target, 'dl.wp-caption') ) + return tinymce.dom.Event.cancel(e); + }); + }); + + // resize the caption
            when the image is soft-resized by the user (only possible in Firefox and IE) + ed.onMouseUp.add(function(ed, e) { + if ( tinymce.isWebKit || tinymce.isOpera ) + return; + + if ( ed.dom.getParent(e.target, 'div.mceTemp') || ed.dom.is(e.target, 'div.mceTemp') ) { + window.setTimeout(function(){ + var ed = tinyMCE.activeEditor, n = ed.selection.getNode(), DL, width; + + if ( 'IMG' == n.nodeName ) { + DL = ed.dom.getParent(n, 'dl.wp-caption'); + width = ed.dom.getAttrib(n, 'width') || n.width; + width = parseInt(width, 10); + + if ( DL && width != ( parseInt(ed.dom.getStyle(DL, 'width'), 10) - 10 ) ) { + ed.dom.setStyle(DL, 'width', 10 + width); + ed.execCommand('mceRepaint'); + } + } + }, 100); + } + }); + + // show editimage buttons + ed.onMouseDown.add(function(ed, e) { + var p; + + if ( e.target.nodeName == 'IMG' && ed.dom.getAttrib(e.target, 'class').indexOf('mceItem') == -1 ) { + ed.plugins.wordpress._showButtons(e.target, 'wp_editbtns'); + if ( tinymce.isGecko && (p = ed.dom.getParent(e.target, 'dl.wp-caption')) && ed.dom.hasClass(p.parentNode, 'mceTemp') ) + ed.selection.select(p.parentNode); + } + }); + + // when pressing Return inside a caption move the cursor to a new parapraph under it + ed.onKeyPress.add(function(ed, e) { + var n, DL, DIV, P; + + if ( e.keyCode == 13 ) { + n = ed.selection.getNode(); + DL = ed.dom.getParent(n, 'dl.wp-caption'); + DIV = ed.dom.getParent(DL, 'div.mceTemp'); + + if ( DL && DIV ) { + P = ed.dom.create('p', {}, ' '); + ed.dom.insertAfter( P, DIV ); + + if ( P.firstChild ) + ed.selection.select(P.firstChild); + else + ed.selection.select(P); + + tinymce.dom.Event.cancel(e); + return false; + } + } + }); + + ed.onBeforeSetContent.add(function(ed, o) { + o.content = t._do_shcode(o.content); + }); + + ed.onPostProcess.add(function(ed, o) { + if (o.get) + o.content = t._get_shcode(o.content); + }); + }, + + _do_shcode : function(co) { + return co.replace(/(?:

            )?\[(?:wp_)?caption([^\]]+)\]([\s\S]+?)\[\/(?:wp_)?caption\](?:<\/p>)?[\s\u00a0]*/g, function(a,b,c){ + var id, cls, w, cap, div_cls; + + b = b.replace(/\\'|\\'|\\'/g, ''').replace(/\\"|\\"/g, '"'); + c = c.replace(/\\'|\\'/g, ''').replace(/\\"/g, '"'); + id = b.match(/id=['"]([^'"]+)/i); + cls = b.match(/align=['"]([^'"]+)/i); + w = b.match(/width=['"]([0-9]+)/); + cap = b.match(/caption=['"]([^'"]+)/i); + + id = ( id && id[1] ) ? id[1] : ''; + cls = ( cls && cls[1] ) ? cls[1] : 'alignnone'; + w = ( w && w[1] ) ? w[1] : ''; + cap = ( cap && cap[1] ) ? cap[1] : ''; + if ( ! w || ! cap ) return c; + + div_cls = (cls == 'aligncenter') ? 'mceTemp mceIEcenter' : 'mceTemp'; + + return '

            '+c+'
            '+cap+'
            '; + }); + }, + + _get_shcode : function(co) { + return co.replace(/
            \s*]+)>\s*]+>([\s\S]+?)<\/dt>\s*]+>(.+?)<\/dd>\s*<\/dl>\s*<\/div>\s*/gi, function(a,b,c,cap){ + var id, cls, w; + + id = b.match(/id=['"]([^'"]+)/i); + cls = b.match(/class=['"]([^'"]+)/i); + w = c.match(/width=['"]([0-9]+)/); + + id = ( id && id[1] ) ? id[1] : ''; + cls = ( cls && cls[1] ) ? cls[1] : 'alignnone'; + w = ( w && w[1] ) ? w[1] : ''; + + if ( ! w || ! cap ) return c; + cls = cls.match(/align[^ '"]+/) || 'alignnone'; + cap = cap.replace(/<\S[^<>]*>/gi, '').replace(/'/g, ''').replace(/"/g, '"'); + + return '[caption id="'+id+'" align="'+cls+'" width="'+w+'" caption="'+cap+'"]'+c+'[/caption]'; + }); + }, + + _createButtons : function() { + var t = this, ed = tinyMCE.activeEditor, DOM = tinymce.DOM, editButton, dellButton; + + DOM.remove('wp_editbtns'); + + DOM.add(document.body, 'div', { + id : 'wp_editbtns', + style : 'display:none;' + }); + + editButton = DOM.add('wp_editbtns', 'img', { + src : t.url+'/img/image.png', + id : 'wp_editimgbtn', + width : '24', + height : '24', + title : ed.getLang('wpeditimage.edit_img') + }); + + tinymce.dom.Event.add(editButton, 'mousedown', function(e) { + var ed = tinyMCE.activeEditor; + ed.windowManager.bookmark = ed.selection.getBookmark('simple'); + ed.execCommand("WP_EditImage"); + }); + + dellButton = DOM.add('wp_editbtns', 'img', { + src : t.url+'/img/delete.png', + id : 'wp_delimgbtn', + width : '24', + height : '24', + title : ed.getLang('wpeditimage.del_img') + }); + + tinymce.dom.Event.add(dellButton, 'mousedown', function(e) { + var ed = tinyMCE.activeEditor, el = ed.selection.getNode(), p; + + if ( el.nodeName == 'IMG' && ed.dom.getAttrib(el, 'class').indexOf('mceItem') == -1 ) { + if ( (p = ed.dom.getParent(el, 'div')) && ed.dom.hasClass(p, 'mceTemp') ) + ed.dom.remove(p); + else if ( (p = ed.dom.getParent(el, 'A')) && p.childNodes.length == 1 ) + ed.dom.remove(p); + else + ed.dom.remove(el); + + ed.execCommand('mceRepaint'); + return false; + } + }); + }, + + getInfo : function() { + return { + longname : 'Edit Image', + author : 'WordPress', + authorurl : 'http://wordpress.org', + infourl : '', + version : "1.0" + }; + } + }); + + tinymce.PluginManager.add('wpeditimage', tinymce.plugins.wpEditImage); +})(); diff --git a/src/wp-includes/js/tinymce/plugins/wpeditimage/editor_plugin.js b/src/wp-includes/js/tinymce/plugins/wpeditimage/editor_plugin.js new file mode 100644 index 0000000..ece134b --- /dev/null +++ b/src/wp-includes/js/tinymce/plugins/wpeditimage/editor_plugin.js @@ -0,0 +1 @@ +(function(){tinymce.create("tinymce.plugins.wpEditImage",{init:function(a,b){var c=this;c.url=b;c._createButtons();a.addCommand("WP_EditImage",function(){var h=a.selection.getNode(),f=tinymce.DOM.getViewPort(),g=f.h,d=(720)?\[(?:wp_)?caption([^\]]+)\]([\s\S]+?)\[\/(?:wp_)?caption\](?:<\/p>)?[\s\u00a0]*/g,function(g,d,k){var j,f,e,h,i;d=d.replace(/\\'|\\'|\\'/g,"'").replace(/\\"|\\"/g,""");k=k.replace(/\\'|\\'/g,"'").replace(/\\"/g,""");j=d.match(/id=['"]([^'"]+)/i);f=d.match(/align=['"]([^'"]+)/i);e=d.match(/width=['"]([0-9]+)/);h=d.match(/caption=['"]([^'"]+)/i);j=(j&&j[1])?j[1]:"";f=(f&&f[1])?f[1]:"alignnone";e=(e&&e[1])?e[1]:"";h=(h&&h[1])?h[1]:"";if(!e||!h){return k}i=(f=="aligncenter")?"mceTemp mceIEcenter":"mceTemp";return'
            '+k+'
            '+h+"
            "})},_get_shcode:function(a){return a.replace(/
            \s*]+)>\s*]+>([\s\S]+?)<\/dt>\s*]+>(.+?)<\/dd>\s*<\/dl>\s*<\/div>\s*/gi,function(g,d,j,h){var i,f,e;i=d.match(/id=['"]([^'"]+)/i);f=d.match(/class=['"]([^'"]+)/i);e=j.match(/width=['"]([0-9]+)/);i=(i&&i[1])?i[1]:"";f=(f&&f[1])?f[1]:"alignnone";e=(e&&e[1])?e[1]:"";if(!e||!h){return j}f=f.match(/align[^ '"]+/)||"alignnone";h=h.replace(/<\S[^<>]*>/gi,"").replace(/'/g,"'").replace(/"/g,""");return'[caption id="'+i+'" align="'+f+'" width="'+e+'" caption="'+h+'"]'+j+"[/caption]"})},_createButtons:function(){var b=this,a=tinyMCE.activeEditor,d=tinymce.DOM,e,c;d.remove("wp_editbtns");d.add(document.body,"div",{id:"wp_editbtns",style:"display:none;"});e=d.add("wp_editbtns","img",{src:b.url+"/img/image.png",id:"wp_editimgbtn",width:"24",height:"24",title:a.getLang("wpeditimage.edit_img")});tinymce.dom.Event.add(e,"mousedown",function(g){var f=tinyMCE.activeEditor;f.windowManager.bookmark=f.selection.getBookmark("simple");f.execCommand("WP_EditImage")});c=d.add("wp_editbtns","img",{src:b.url+"/img/delete.png",id:"wp_delimgbtn",width:"24",height:"24",title:a.getLang("wpeditimage.del_img")});tinymce.dom.Event.add(c,"mousedown",function(i){var f=tinyMCE.activeEditor,g=f.selection.getNode(),h;if(g.nodeName=="IMG"&&f.dom.getAttrib(g,"class").indexOf("mceItem")==-1){if((h=f.dom.getParent(g,"div"))&&f.dom.hasClass(h,"mceTemp")){f.dom.remove(h)}else{if((h=f.dom.getParent(g,"A"))&&h.childNodes.length==1){f.dom.remove(h)}else{f.dom.remove(g)}}f.execCommand("mceRepaint");return false}})},getInfo:function(){return{longname:"Edit Image",author:"WordPress",authorurl:"http://wordpress.org",infourl:"",version:"1.0"}}});tinymce.PluginManager.add("wpeditimage",tinymce.plugins.wpEditImage)})(); \ No newline at end of file diff --git a/src/wp-includes/js/tinymce/plugins/wpeditimage/img/delete.png b/src/wp-includes/js/tinymce/plugins/wpeditimage/img/delete.png new file mode 100644 index 0000000..d64d8a6 Binary files /dev/null and b/src/wp-includes/js/tinymce/plugins/wpeditimage/img/delete.png differ diff --git a/src/wp-includes/js/tinymce/plugins/wpeditimage/img/image.png b/src/wp-includes/js/tinymce/plugins/wpeditimage/img/image.png new file mode 100644 index 0000000..f3d4b44 Binary files /dev/null and b/src/wp-includes/js/tinymce/plugins/wpeditimage/img/image.png differ diff --git a/src/wp-includes/js/tinymce/plugins/wpeditimage/js/editimage.dev.js b/src/wp-includes/js/tinymce/plugins/wpeditimage/js/editimage.dev.js new file mode 100644 index 0000000..1acf9f0 --- /dev/null +++ b/src/wp-includes/js/tinymce/plugins/wpeditimage/js/editimage.dev.js @@ -0,0 +1,613 @@ + +var tinymce = null, tinyMCEPopup, tinyMCE, wpImage; + +tinyMCEPopup = { + init: function() { + var t = this, w, li, q, i, it; + + li = ('' + document.location.search).replace(/^\?/, '').split('&'); + q = {}; + for ( i = 0; i < li.length; i++ ) { + it = li[i].split('='); + q[unescape(it[0])] = unescape(it[1]); + } + + if (q.mce_rdomain) + document.domain = q.mce_rdomain; + + // Find window & API + w = t.getWin(); + tinymce = w.tinymce; + tinyMCE = w.tinyMCE; + t.editor = tinymce.EditorManager.activeEditor; + t.params = t.editor.windowManager.params; + + // Setup local DOM + t.dom = t.editor.windowManager.createInstance('tinymce.dom.DOMUtils', document); + t.editor.windowManager.onOpen.dispatch(t.editor.windowManager, window); + }, + + getWin : function() { + return window.dialogArguments || opener || parent || top; + }, + + getParam : function(n, dv) { + return this.editor.getParam(n, dv); + }, + + close : function() { + var t = this, win = t.getWin(); + + // To avoid domain relaxing issue in Opera + function close() { + win.tb_remove(); + tinymce = tinyMCE = t.editor = t.dom = t.dom.doc = null; // Cleanup + }; + + if (tinymce.isOpera) + win.setTimeout(close, 0); + else + close(); + }, + + execCommand : function(cmd, ui, val, a) { + a = a || {}; + a.skip_focus = 1; + + this.restoreSelection(); + return this.editor.execCommand(cmd, ui, val, a); + }, + + storeSelection : function() { + this.editor.windowManager.bookmark = tinyMCEPopup.editor.selection.getBookmark('simple'); + }, + + restoreSelection : function() { + var t = tinyMCEPopup; + + if (tinymce.isIE) + t.editor.selection.moveToBookmark(t.editor.windowManager.bookmark); + } +} +tinyMCEPopup.init(); + +wpImage = { + preInit : function() { + // import colors stylesheet from parent + var win = tinyMCEPopup.getWin(), styles = win.document.styleSheets, url, i; + + for ( i = 0; i < styles.length; i++ ) { + url = styles.item(i).href; + if ( url && url.indexOf('colors') != -1 ) + document.write( '' ); + } + }, + + I : function(e) { + return document.getElementById(e); + }, + + current : '', + link : '', + link_rel : '', + target_value : '', + current_size_sel : 's100', + width : '', + height : '', + align : '', + img_alt : '', + + setTabs : function(tab) { + var t = this; + + if ( 'current' == tab.className ) return false; + t.I('div_advanced').style.display = ( 'tab_advanced' == tab.id ) ? 'block' : 'none'; + t.I('div_basic').style.display = ( 'tab_basic' == tab.id ) ? 'block' : 'none'; + t.I('tab_basic').className = t.I('tab_advanced').className = ''; + tab.className = 'current'; + return false; + }, + + img_seturl : function(u) { + var t = this, rel = t.I('link_rel').value; + + if ( 'current' == u ) { + t.I('link_href').value = t.current; + t.I('link_rel').value = t.link_rel; + } else { + t.I('link_href').value = t.link; + if ( rel ) { + rel = rel.replace( /attachment|wp-att-[0-9]+/gi, '' ); + t.I('link_rel').value = tinymce.trim(rel); + } + } + }, + + imgAlignCls : function(v) { + var t = this, cls = t.I('img_classes').value; + + t.I('img_demo').className = t.align = v; + + cls = cls.replace( /align[^ "']+/gi, '' ); + cls += (' ' + v); + cls = cls.replace( /\s+/g, ' ' ).replace( /^\s/, '' ); + + if ( 'aligncenter' == v ) { + t.I('hspace').value = ''; + t.updateStyle('hspace'); + } + + t.I('img_classes').value = cls; + }, + + showSize : function(el) { + var t = this, demo = t.I('img_demo'), w = t.width, h = t.height, id = el.id || 's100', size; + + size = parseInt(id.substring(1)) / 200; + demo.width = Math.round(w * size); + demo.height = Math.round(h * size); + + t.showSizeClear(); + el.style.borderColor = '#A3A3A3'; + el.style.backgroundColor = '#E5E5E5'; + }, + + showSizeSet : function() { + var t = this, s130, s120, s110; + + if ( (t.width * 1.3) > parseInt(t.preloadImg.width) ) { + s130 = t.I('s130'), s120 = t.I('s120'), s110 = t.I('s110'); + + s130.onclick = s120.onclick = s110.onclick = null; + s130.onmouseover = s120.onmouseover = s110.onmouseover = null; + s130.style.color = s120.style.color = s110.style.color = '#aaa'; + } + }, + + showSizeRem : function() { + var t = this, demo = t.I('img_demo'), f = document.forms[0]; + + demo.width = Math.round(f.width.value * 0.5); + demo.height = Math.round(f.height.value * 0.5); + t.showSizeClear(); + t.I(t.current_size_sel).style.borderColor = '#A3A3A3'; + t.I(t.current_size_sel).style.backgroundColor = '#E5E5E5'; + + return false; + }, + + showSizeClear : function() { + var divs = this.I('img_size').getElementsByTagName('div'), i; + + for ( i = 0; i < divs.length; i++ ) { + divs[i].style.borderColor = '#f1f1f1'; + divs[i].style.backgroundColor = '#f1f1f1'; + } + }, + + imgEditSize : function(el) { + var t = this, f = document.forms[0], W, H, w, h, id; + + if ( ! t.preloadImg || ! t.preloadImg.width || ! t.preloadImg.height ) + return; + + W = parseInt(t.preloadImg.width), H = parseInt(t.preloadImg.height), w = t.width || W, h = t.height || H, id = el.id || 's100'; + + size = parseInt(id.substring(1)) / 100; + + w = Math.round(w * size); + h = Math.round(h * size); + + f.width.value = Math.min(W, w); + f.height.value = Math.min(H, h); + + t.current_size_sel = id; + t.demoSetSize(); + }, + + demoSetSize : function(img) { + var demo = this.I('img_demo'), f = document.forms[0]; + + demo.width = f.width.value ? Math.round(f.width.value * 0.5) : ''; + demo.height = f.height.value ? Math.round(f.height.value * 0.5) : ''; + }, + + demoSetStyle : function() { + var f = document.forms[0], demo = this.I('img_demo'), dom = tinyMCEPopup.editor.dom; + + if (demo) { + dom.setAttrib(demo, 'style', f.img_style.value); + dom.setStyle(demo, 'width', ''); + dom.setStyle(demo, 'height', ''); + } + }, + + origSize : function() { + var t = this, f = document.forms[0], el = t.I('s100'); + + f.width.value = t.width = t.preloadImg.width; + f.height.value = t.height = t.preloadImg.height; + t.showSizeSet(); + t.demoSetSize(); + t.showSize(el); + }, + + init : function() { + var ed = tinyMCEPopup.editor, h; + + h = document.body.innerHTML; + document.body.innerHTML = ed.translate(h); + window.setTimeout( function(){wpImage.setup();}, 500 ); + }, + + setup : function() { + var t = this, c, el, link, fname, f = document.forms[0], ed = tinyMCEPopup.editor, + d = t.I('img_demo'), dom = tinyMCEPopup.dom, DL, caption = '', dlc, pa; + + document.dir = tinyMCEPopup.editor.getParam('directionality',''); + + if ( tinyMCEPopup.editor.getParam('wpeditimage_disable_captions', false) ) + t.I('cap_field').style.display = 'none'; + + tinyMCEPopup.restoreSelection(); + el = ed.selection.getNode(); + if (el.nodeName != 'IMG') + return; + + f.img_src.value = d.src = link = ed.dom.getAttrib(el, 'src'); + ed.dom.setStyle(el, 'float', ''); + t.getImageData(); + c = ed.dom.getAttrib(el, 'class'); + + if ( DL = dom.getParent(el, 'dl') ) { + dlc = ed.dom.getAttrib(DL, 'class'); + dlc = dlc.match(/align[^ "']+/i); + if ( dlc && ! dom.hasClass(el, dlc) ) { + c += ' '+dlc; + tinymce.trim(c); + } + + tinymce.each(DL.childNodes, function(e) { + if ( e.nodeName == 'DD' && dom.hasClass(e, 'wp-caption-dd') ) { + caption = e.innerHTML; + return; + } + }); + } + + f.img_cap.value = caption; + f.img_title.value = ed.dom.getAttrib(el, 'title'); + f.img_alt.value = ed.dom.getAttrib(el, 'alt'); + f.border.value = ed.dom.getAttrib(el, 'border'); + f.vspace.value = ed.dom.getAttrib(el, 'vspace'); + f.hspace.value = ed.dom.getAttrib(el, 'hspace'); + f.align.value = ed.dom.getAttrib(el, 'align'); + f.width.value = t.width = ed.dom.getAttrib(el, 'width'); + f.height.value = t.height = ed.dom.getAttrib(el, 'height'); + f.img_classes.value = c; + f.img_style.value = ed.dom.getAttrib(el, 'style'); + + // Move attribs to styles + if ( dom.getAttrib(el, 'hspace') ) + t.updateStyle('hspace'); + + if ( dom.getAttrib(el, 'border') ) + t.updateStyle('border'); + + if ( dom.getAttrib(el, 'vspace') ) + t.updateStyle('vspace'); + + if ( pa = ed.dom.getParent(el, 'A') ) { + f.link_href.value = t.current = ed.dom.getAttrib(pa, 'href'); + f.link_title.value = ed.dom.getAttrib(pa, 'title'); + f.link_rel.value = t.link_rel = ed.dom.getAttrib(pa, 'rel'); + f.link_style.value = ed.dom.getAttrib(pa, 'style'); + t.target_value = ed.dom.getAttrib(pa, 'target'); + f.link_classes.value = ed.dom.getAttrib(pa, 'class'); + } + + f.link_target.checked = ( t.target_value && t.target_value == '_blank' ) ? 'checked' : ''; + + fname = link.substring( link.lastIndexOf('/') ); + fname = fname.replace(/-[0-9]{2,4}x[0-9]{2,4}/, '' ); + t.link = link.substring( 0, link.lastIndexOf('/') ) + fname; + + if ( c.indexOf('alignleft') != -1 ) { + t.I('alignleft').checked = "checked"; + d.className = t.align = "alignleft"; + } else if ( c.indexOf('aligncenter') != -1 ) { + t.I('aligncenter').checked = "checked"; + d.className = t.align = "aligncenter"; + } else if ( c.indexOf('alignright') != -1 ) { + t.I('alignright').checked = "checked"; + d.className = t.align = "alignright"; + } else if ( c.indexOf('alignnone') != -1 ) { + t.I('alignnone').checked = "checked"; + d.className = t.align = "alignnone"; + } + + if ( t.width && t.preloadImg.width ) t.showSizeSet(); + document.body.style.display = ''; + }, + + remove : function() { + var ed = tinyMCEPopup.editor, p, el; + + tinyMCEPopup.restoreSelection(); + el = ed.selection.getNode(); + if (el.nodeName != 'IMG') return; + + if ( (p = ed.dom.getParent(el, 'div')) && ed.dom.hasClass(p, 'mceTemp') ) + ed.dom.remove(p); + else if ( (p = ed.dom.getParent(el, 'A')) && p.childNodes.length == 1 ) + ed.dom.remove(p); + else ed.dom.remove(el); + + ed.execCommand('mceRepaint'); + tinyMCEPopup.close(); + return; + }, + + update : function() { + var t = this, f = document.forms[0], ed = tinyMCEPopup.editor, el, b, fixSafari = null, + DL, P, A, DIV, do_caption = null, img_class = f.img_classes.value, html, + id, cap_id = '', cap, DT, DD, cap_width, div_cls, lnk = '', pa, aa; + + tinyMCEPopup.restoreSelection(); + el = ed.selection.getNode(); + + if (el.nodeName != 'IMG') return; + if (f.img_src.value === '') { + t.remove(); + return; + } + + if ( f.img_cap.value != '' && f.width.value != '' ) { + do_caption = 1; + img_class = img_class.replace( /align[^ "']+\s?/gi, '' ); + } + + A = ed.dom.getParent(el, 'a'); + P = ed.dom.getParent(el, 'p'); + DL = ed.dom.getParent(el, 'dl'); + DIV = ed.dom.getParent(el, 'div'); + + tinyMCEPopup.execCommand("mceBeginUndoLevel"); + + ed.dom.setAttribs(el, { + src : f.img_src.value, + title : f.img_title.value, + alt : f.img_alt.value, + width : f.width.value, + height : f.height.value, + style : f.img_style.value, + 'class' : img_class + }); + + if ( f.link_href.value ) { + // Create new anchor elements + if ( A == null ) { + if ( ! f.link_href.value.match(/https?:\/\//i) ) + f.link_href.value = tinyMCEPopup.editor.documentBaseURI.toAbsolute(f.link_href.value); + + if ( tinymce.isWebKit && ed.dom.hasClass(el, 'aligncenter') ) { + ed.dom.removeClass(el, 'aligncenter'); + fixSafari = 1; + } + + tinyMCEPopup.execCommand("CreateLink", false, "#mce_temp_url#", {skip_undo : 1}); + if ( fixSafari ) ed.dom.addClass(el, 'aligncenter'); + + tinymce.each(ed.dom.select("a"), function(n) { + if (ed.dom.getAttrib(n, 'href') == '#mce_temp_url#') { + + ed.dom.setAttribs(n, { + href : f.link_href.value, + title : f.link_title.value, + rel : f.link_rel.value, + target : (f.link_target.checked == true) ? '_blank' : '', + 'class' : f.link_classes.value, + style : f.link_style.value + }); + } + }); + } else { + ed.dom.setAttribs(A, { + href : f.link_href.value, + title : f.link_title.value, + rel : f.link_rel.value, + target : (f.link_target.checked == true) ? '_blank' : '', + 'class' : f.link_classes.value, + style : f.link_style.value + }); + } + } + + if ( do_caption ) { + cap_width = 10 + parseInt(f.width.value); + div_cls = (t.align == 'aligncenter') ? 'mceTemp mceIEcenter' : 'mceTemp'; + + if ( DL ) { + ed.dom.setAttribs(DL, { + 'class' : 'wp-caption '+t.align, + style : 'width: '+cap_width+'px;' + }); + + if ( DIV ) + ed.dom.setAttrib(DIV, 'class', div_cls); + + if ( (DT = ed.dom.getParent(el, 'dt')) && (DD = DT.nextSibling) && ed.dom.hasClass(DD, 'wp-caption-dd') ) + ed.dom.setHTML(DD, f.img_cap.value); + + } else { + if ( (id = f.img_classes.value.match( /wp-image-([0-9]{1,6})/ )) && id[1] ) + cap_id = 'attachment_'+id[1]; + + if ( f.link_href.value && (lnk = ed.dom.getParent(el, 'a')) ) { + if ( lnk.childNodes.length == 1 ) + html = ed.dom.getOuterHTML(lnk); + else { + html = ed.dom.getOuterHTML(lnk); + html = html.match(/]+>/i); + html = html+ed.dom.getOuterHTML(el)+''; + } + } else html = ed.dom.getOuterHTML(el); + + html = '
            '+html+'
            '+f.img_cap.value+'
            '; + + cap = ed.dom.create('div', {'class': div_cls}, html); + + if ( P ) { + P.parentNode.insertBefore(cap, P); + if ( P.childNodes.length == 1 ) + ed.dom.remove(P); + else if ( lnk && lnk.childNodes.length == 1 ) + ed.dom.remove(lnk); + else ed.dom.remove(el); + } else if ( pa = ed.dom.getParent(el, 'TD,TH,LI') ) { + pa.appendChild(cap); + if ( lnk && lnk.childNodes.length == 1 ) + ed.dom.remove(lnk); + else ed.dom.remove(el); + } + } + + } else { + if ( DL && DIV ) { + if ( f.link_href.value && (aa = ed.dom.getParent(el, 'a')) ) html = ed.dom.getOuterHTML(aa); + else html = ed.dom.getOuterHTML(el); + + P = ed.dom.create('p', {}, html); + DIV.parentNode.insertBefore(P, DIV); + ed.dom.remove(DIV); + } + } + + if ( f.img_classes.value.indexOf('aligncenter') != -1 ) { + if ( P && ( ! P.style || P.style.textAlign != 'center' ) ) + ed.dom.setStyle(P, 'textAlign', 'center'); + } else { + if ( P && P.style && P.style.textAlign == 'center' ) + ed.dom.setStyle(P, 'textAlign', ''); + } + + if ( ! f.link_href.value && A ) { + b = ed.selection.getBookmark(); + ed.dom.remove(A, 1); + ed.selection.moveToBookmark(b); + } + + tinyMCEPopup.execCommand("mceEndUndoLevel"); + ed.execCommand('mceRepaint'); + tinyMCEPopup.close(); + }, + + updateStyle : function(ty) { + var dom = tinyMCEPopup.dom, v, f = document.forms[0], img = dom.create('img', {style : f.img_style.value}); + + if (tinyMCEPopup.editor.settings.inline_styles) { + // Handle align + if (ty == 'align') { + dom.setStyle(img, 'float', ''); + dom.setStyle(img, 'vertical-align', ''); + + v = f.align.value; + if (v) { + if (v == 'left' || v == 'right') + dom.setStyle(img, 'float', v); + else + img.style.verticalAlign = v; + } + } + + // Handle border + if (ty == 'border') { + dom.setStyle(img, 'border', ''); + + v = f.border.value; + if (v || v == '0') { + if (v == '0') + img.style.border = '0'; + else + img.style.border = v + 'px solid black'; + } + } + + // Handle hspace + if (ty == 'hspace') { + dom.setStyle(img, 'marginLeft', ''); + dom.setStyle(img, 'marginRight', ''); + + v = f.hspace.value; + if (v) { + img.style.marginLeft = v + 'px'; + img.style.marginRight = v + 'px'; + } + } + + // Handle vspace + if (ty == 'vspace') { + dom.setStyle(img, 'marginTop', ''); + dom.setStyle(img, 'marginBottom', ''); + + v = f.vspace.value; + if (v) { + img.style.marginTop = v + 'px'; + img.style.marginBottom = v + 'px'; + } + } + + // Merge + f.img_style.value = dom.serializeStyle(dom.parseStyle(img.style.cssText)); + this.demoSetStyle(); + } + }, + + checkVal : function(f) { + + if ( f.value == '' ) { + // if ( f.id == 'width' ) f.value = this.width || this.preloadImg.width; + // if ( f.id == 'height' ) f.value = this.height || this.preloadImg.height; + if ( f.id == 'img_src' ) f.value = this.I('img_demo').src || this.preloadImg.src; + } + }, + + resetImageData : function() { + var f = document.forms[0]; + + f.width.value = f.height.value = ''; + }, + + updateImageData : function() { + var f = document.forms[0], t = wpImage, w = f.width.value, h = f.height.value; + + if ( !w && h ) + w = f.width.value = t.width = Math.round( t.preloadImg.width / (t.preloadImg.height / h) ); + else if ( w && !h ) + h = f.height.value = t.height = Math.round( t.preloadImg.height / (t.preloadImg.width / w) ); + + if ( !w ) + f.width.value = t.width = t.preloadImg.width; + + if ( !h ) + f.height.value = t.height = t.preloadImg.height; + + t.showSizeSet(); + t.demoSetSize(); + if ( f.img_style.value ) + t.demoSetStyle(); + }, + + getImageData : function() { + var t = wpImage, f = document.forms[0]; + + t.preloadImg = new Image(); + t.preloadImg.onload = t.updateImageData; + t.preloadImg.onerror = t.resetImageData; + t.preloadImg.src = tinyMCEPopup.editor.documentBaseURI.toAbsolute(f.img_src.value); + } +}; + +window.onload = function(){wpImage.init();} +wpImage.preInit(); diff --git a/src/wp-includes/js/tinymce/plugins/wpeditimage/js/editimage.js b/src/wp-includes/js/tinymce/plugins/wpeditimage/js/editimage.js new file mode 100644 index 0000000..0a801bd --- /dev/null +++ b/src/wp-includes/js/tinymce/plugins/wpeditimage/js/editimage.js @@ -0,0 +1 @@ +var tinymce=null,tinyMCEPopup,tinyMCE,wpImage;tinyMCEPopup={init:function(){var d=this,b,a,f,c,e;a=(""+document.location.search).replace(/^\?/,"").split("&");f={};for(c=0;c')}}},I:function(a){return document.getElementById(a)},current:"",link:"",link_rel:"",target_value:"",current_size_sel:"s100",width:"",height:"",align:"",img_alt:"",setTabs:function(b){var a=this;if("current"==b.className){return false}a.I("div_advanced").style.display=("tab_advanced"==b.id)?"block":"none";a.I("div_basic").style.display=("tab_basic"==b.id)?"block":"none";a.I("tab_basic").className=a.I("tab_advanced").className="";b.className="current";return false},img_seturl:function(b){var c=this,a=c.I("link_rel").value;if("current"==b){c.I("link_href").value=c.current;c.I("link_rel").value=c.link_rel}else{c.I("link_href").value=c.link;if(a){a=a.replace(/attachment|wp-att-[0-9]+/gi,"");c.I("link_rel").value=tinymce.trim(a)}}},imgAlignCls:function(b){var c=this,a=c.I("img_classes").value;c.I("img_demo").className=c.align=b;a=a.replace(/align[^ "']+/gi,"");a+=(" "+b);a=a.replace(/\s+/g," ").replace(/^\s/,"");if("aligncenter"==b){c.I("hspace").value="";c.updateStyle("hspace")}c.I("img_classes").value=a},showSize:function(e){var c=this,f=c.I("img_demo"),a=c.width,d=c.height,g=e.id||"s100",b;b=parseInt(g.substring(1))/200;f.width=Math.round(a*b);f.height=Math.round(d*b);c.showSizeClear();e.style.borderColor="#A3A3A3";e.style.backgroundColor="#E5E5E5"},showSizeSet:function(){var b=this,d,c,a;if((b.width*1.3)>parseInt(b.preloadImg.width)){d=b.I("s130"),c=b.I("s120"),a=b.I("s110");d.onclick=c.onclick=a.onclick=null;d.onmouseover=c.onmouseover=a.onmouseover=null;d.style.color=c.style.color=a.style.color="#aaa"}},showSizeRem:function(){var a=this,c=a.I("img_demo"),b=document.forms[0];c.width=Math.round(b.width.value*0.5);c.height=Math.round(b.height.value*0.5);a.showSizeClear();a.I(a.current_size_sel).style.borderColor="#A3A3A3";a.I(a.current_size_sel).style.backgroundColor="#E5E5E5";return false},showSizeClear:function(){var b=this.I("img_size").getElementsByTagName("div"),a;for(a=0;a]+>/i);l=l+g.dom.getOuterHTML(e)+""}}else{l=g.dom.getOuterHTML(e)}l='
            '+l+'
            '+v.img_cap.value+"
            ";j=g.dom.create("div",{"class":z},l);if(h){h.parentNode.insertBefore(j,h);if(h.childNodes.length==1){g.dom.remove(h)}else{if(w&&w.childNodes.length==1){g.dom.remove(w)}else{g.dom.remove(e)}}}else{if(c=g.dom.getParent(e,"TD,TH,LI")){c.appendChild(j);if(w&&w.childNodes.length==1){g.dom.remove(w)}else{g.dom.remove(e)}}}}}else{if(n&&r){if(v.link_href.value&&(y=g.dom.getParent(e,"a"))){l=g.dom.getOuterHTML(y)}else{l=g.dom.getOuterHTML(e)}h=g.dom.create("p",{},l);r.parentNode.insertBefore(h,r);g.dom.remove(r)}}if(v.img_classes.value.indexOf("aligncenter")!=-1){if(h&&(!h.style||h.style.textAlign!="center")){g.dom.setStyle(h,"textAlign","center")}}else{if(h&&h.style&&h.style.textAlign=="center"){g.dom.setStyle(h,"textAlign","")}}if(!v.link_href.value&&p){x=g.selection.getBookmark();g.dom.remove(p,1);g.selection.moveToBookmark(x)}tinyMCEPopup.execCommand("mceEndUndoLevel");g.execCommand("mceRepaint");tinyMCEPopup.close()},updateStyle:function(a){var e=tinyMCEPopup.dom,c,d=document.forms[0],b=e.create("img",{style:d.img_style.value});if(tinyMCEPopup.editor.settings.inline_styles){if(a=="align"){e.setStyle(b,"float","");e.setStyle(b,"vertical-align","");c=d.align.value;if(c){if(c=="left"||c=="right"){e.setStyle(b,"float",c)}else{b.style.verticalAlign=c}}}if(a=="border"){e.setStyle(b,"border","");c=d.border.value;if(c||c=="0"){if(c=="0"){b.style.border="0"}else{b.style.border=c+"px solid black"}}}if(a=="hspace"){e.setStyle(b,"marginLeft","");e.setStyle(b,"marginRight","");c=d.hspace.value;if(c){b.style.marginLeft=c+"px";b.style.marginRight=c+"px"}}if(a=="vspace"){e.setStyle(b,"marginTop","");e.setStyle(b,"marginBottom","");c=d.vspace.value;if(c){b.style.marginTop=c+"px";b.style.marginBottom=c+"px"}}d.img_style.value=e.serializeStyle(e.parseStyle(b.style.cssText));this.demoSetStyle()}},checkVal:function(a){if(a.value==""){if(a.id=="img_src"){a.value=this.I("img_demo").src||this.preloadImg.src}}},resetImageData:function(){var a=document.forms[0];a.width.value=a.height.value=""},updateImageData:function(){var d=document.forms[0],b=wpImage,a=d.width.value,c=d.height.value;if(!a&&c){a=d.width.value=b.width=Math.round(b.preloadImg.width/(b.preloadImg.height/c))}else{if(a&&!c){c=d.height.value=b.height=Math.round(b.preloadImg.height/(b.preloadImg.width/a))}}if(!a){d.width.value=b.width=b.preloadImg.width}if(!c){d.height.value=b.height=b.preloadImg.height}b.showSizeSet();b.demoSetSize();if(d.img_style.value){b.demoSetStyle()}},getImageData:function(){var a=wpImage,b=document.forms[0];a.preloadImg=new Image();a.preloadImg.onload=a.updateImageData;a.preloadImg.onerror=a.resetImageData;a.preloadImg.src=tinyMCEPopup.editor.documentBaseURI.toAbsolute(b.img_src.value)}};window.onload=function(){wpImage.init()};wpImage.preInit(); \ No newline at end of file diff --git a/src/wp-includes/js/tinymce/plugins/wpfullscreen/css/wp-fullscreen.css b/src/wp-includes/js/tinymce/plugins/wpfullscreen/css/wp-fullscreen.css new file mode 100644 index 0000000..a60af77 --- /dev/null +++ b/src/wp-includes/js/tinymce/plugins/wpfullscreen/css/wp-fullscreen.css @@ -0,0 +1,11 @@ +/* +Distraction Free Writing mode TinyMCE Styles +*/ + +html, body { + background: transparent; + width: auto !important; + max-width: none !important; + margin: 0; + padding: 0; +} diff --git a/src/wp-includes/js/tinymce/plugins/wpfullscreen/editor_plugin.dev.js b/src/wp-includes/js/tinymce/plugins/wpfullscreen/editor_plugin.dev.js new file mode 100644 index 0000000..29b56ca --- /dev/null +++ b/src/wp-includes/js/tinymce/plugins/wpfullscreen/editor_plugin.dev.js @@ -0,0 +1,178 @@ +/** + * WP Fullscreen TinyMCE plugin + * + * Contains code from Moxiecode Systems AB released under LGPL License http://tinymce.moxiecode.com/license + */ + +(function() { + tinymce.create('tinymce.plugins.wpFullscreenPlugin', { + + init : function(ed, url) { + var t = this, oldHeight = 0, s = {}, DOM = tinymce.DOM, resized = false; + + // Register commands + ed.addCommand('wpFullScreenClose', function() { + // this removes the editor, content has to be saved first with tinyMCE.execCommand('wpFullScreenSave'); + if ( ed.getParam('wp_fullscreen_is_enabled') ) { + DOM.win.setTimeout(function() { + tinyMCE.remove(ed); + DOM.remove('wp_mce_fullscreen_parent'); + tinyMCE.settings = tinyMCE.oldSettings; // Restore old settings + }, 10); + } + }); + + ed.addCommand('wpFullScreenSave', function() { + var ed = tinyMCE.get('wp_mce_fullscreen'), edd; + + ed.focus(); + edd = tinyMCE.get( ed.getParam('wp_fullscreen_editor_id') ); + + edd.setContent( ed.getContent({format : 'raw'}), {format : 'raw'} ); + }); + + ed.addCommand('wpFullScreenInit', function() { + var d = ed.getDoc(), b = d.body, fsed; + + // Only init the editor if necessary. + if ( ed.id == 'wp_mce_fullscreen' ) + return; + + tinyMCE.oldSettings = tinyMCE.settings; // Store old settings + + tinymce.each(ed.settings, function(v, n) { + s[n] = v; + }); + + s.id = 'wp_mce_fullscreen'; + s.wp_fullscreen_is_enabled = true; + s.wp_fullscreen_editor_id = ed.id; + s.theme_advanced_resizing = false; + s.theme_advanced_statusbar_location = 'none'; + s.content_css = s.content_css ? s.content_css + ',' + s.wp_fullscreen_content_css : s.wp_fullscreen_content_css; + s.height = tinymce.isIE ? b.scrollHeight : b.offsetHeight; + + tinymce.each(ed.getParam('wp_fullscreen_settings'), function(v, k) { + s[k] = v; + }); + + fsed = new tinymce.Editor('wp_mce_fullscreen', s); + fsed.onInit.add(function(edd) { + var DOM = tinymce.DOM, buttons = DOM.select('a.mceButton', DOM.get('wp-fullscreen-buttons')); + + if ( !ed.isHidden() ) + edd.setContent( ed.getContent() ); + else + edd.setContent( switchEditors.wpautop( edd.getElement().value ) ); + + setTimeout(function(){ // add last + edd.onNodeChange.add(function(ed, cm, e){ + tinymce.each(buttons, function(c) { + var btn, cls; + + if ( btn = DOM.get( 'wp_mce_fullscreen_' + c.id.substr(6) ) ) { + cls = btn.className; + + if ( cls ) + c.className = cls; + } + }); + }); + }, 1000); + + edd.dom.addClass(edd.getBody(), 'wp-fullscreen-editor'); + edd.focus(); + }); + + fsed.render(); + + if ( 'undefined' != fullscreen ) { + fsed.dom.bind( fsed.dom.doc, 'mousemove', function(e){ + fullscreen.bounder( 'showToolbar', 'hideToolbar', 2000, e ); + }); + } + }); + + // Register buttons + if ( 'undefined' != fullscreen ) { + ed.addButton('fullscreen', { + title : 'fullscreen.desc', + onclick : function(){ fullscreen.on(); } + }); + } + + // END fullscreen +//---------------------------------------------------------------- + // START autoresize + + if ( ed.getParam('fullscreen_is_enabled') || !ed.getParam('wp_fullscreen_is_enabled') ) + return; + + /** + * This method gets executed each time the editor needs to resize. + */ + function resize() { + if ( resized ) + return; + + var d = ed.getDoc(), DOM = tinymce.DOM, resizeHeight, myHeight; + + // Get height differently depending on the browser used + if ( tinymce.isIE ) + myHeight = d.body.scrollHeight; + else + myHeight = d.documentElement.offsetHeight; + + // Don't make it smaller than 300px + resizeHeight = (myHeight > 300) ? myHeight : 300; + + // Resize content element + if ( oldHeight != resizeHeight ) { + oldHeight = resizeHeight; + resized = true; + setTimeout(function(){ resized = false; }, 100); + + DOM.setStyle(DOM.get(ed.id + '_ifr'), 'height', resizeHeight + 'px'); + } + }; + + // Add appropriate listeners for resizing content area + ed.onInit.add(function(ed, l) { + ed.onChange.add(resize); + ed.onSetContent.add(resize); + ed.onPaste.add(resize); + ed.onKeyUp.add(resize); + ed.onPostRender.add(resize); + + ed.getBody().style.overflowY = "hidden"; + }); + + if (ed.getParam('autoresize_on_init', true)) { + ed.onLoadContent.add(function(ed, l) { + // Because the content area resizes when its content CSS loads, + // and we can't easily add a listener to its onload event, + // we'll just trigger a resize after a short loading period + setTimeout(function() { + resize(); + }, 1200); + }); + } + + // Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('mceExample'); + ed.addCommand('wpAutoResize', resize); + }, + + getInfo : function() { + return { + longname : 'WP Fullscreen', + author : 'WordPress', + authorurl : 'http://wordpress.org', + infourl : '', + version : '1.0' + }; + } + }); + + // Register plugin + tinymce.PluginManager.add('wpfullscreen', tinymce.plugins.wpFullscreenPlugin); +})(); diff --git a/src/wp-includes/js/tinymce/plugins/wpfullscreen/editor_plugin.js b/src/wp-includes/js/tinymce/plugins/wpfullscreen/editor_plugin.js new file mode 100644 index 0000000..ed27150 --- /dev/null +++ b/src/wp-includes/js/tinymce/plugins/wpfullscreen/editor_plugin.js @@ -0,0 +1 @@ +(function(){tinymce.create("tinymce.plugins.wpFullscreenPlugin",{init:function(b,d){var e=this,h=0,f={},g=tinymce.DOM,a=false;b.addCommand("wpFullScreenClose",function(){if(b.getParam("wp_fullscreen_is_enabled")){g.win.setTimeout(function(){tinyMCE.remove(b);g.remove("wp_mce_fullscreen_parent");tinyMCE.settings=tinyMCE.oldSettings},10)}});b.addCommand("wpFullScreenSave",function(){var i=tinyMCE.get("wp_mce_fullscreen"),j;i.focus();j=tinyMCE.get(i.getParam("wp_fullscreen_editor_id"));j.setContent(i.getContent({format:"raw"}),{format:"raw"})});b.addCommand("wpFullScreenInit",function(){var k=b.getDoc(),i=k.body,j;if(b.id=="wp_mce_fullscreen"){return}tinyMCE.oldSettings=tinyMCE.settings;tinymce.each(b.settings,function(l,m){f[m]=l});f.id="wp_mce_fullscreen";f.wp_fullscreen_is_enabled=true;f.wp_fullscreen_editor_id=b.id;f.theme_advanced_resizing=false;f.theme_advanced_statusbar_location="none";f.content_css=f.content_css?f.content_css+","+f.wp_fullscreen_content_css:f.wp_fullscreen_content_css;f.height=tinymce.isIE?i.scrollHeight:i.offsetHeight;tinymce.each(b.getParam("wp_fullscreen_settings"),function(m,l){f[l]=m});j=new tinymce.Editor("wp_mce_fullscreen",f);j.onInit.add(function(l){var n=tinymce.DOM,m=n.select("a.mceButton",n.get("wp-fullscreen-buttons"));if(!b.isHidden()){l.setContent(b.getContent())}else{l.setContent(switchEditors.wpautop(l.getElement().value))}setTimeout(function(){l.onNodeChange.add(function(p,o,q){tinymce.each(m,function(t){var s,r;if(s=n.get("wp_mce_fullscreen_"+t.id.substr(6))){r=s.className;if(r){t.className=r}}})})},1000);l.dom.addClass(l.getBody(),"wp-fullscreen-editor");l.focus()});j.render();if("undefined"!=fullscreen){j.dom.bind(j.dom.doc,"mousemove",function(l){fullscreen.bounder("showToolbar","hideToolbar",2000,l)})}});if("undefined"!=fullscreen){b.addButton("fullscreen",{title:"fullscreen.desc",onclick:function(){fullscreen.on()}})}if(b.getParam("fullscreen_is_enabled")||!b.getParam("wp_fullscreen_is_enabled")){return}function c(){if(a){return}var k=b.getDoc(),j=tinymce.DOM,l,i;if(tinymce.isIE){i=k.body.scrollHeight}else{i=k.documentElement.offsetHeight}l=(i>300)?i:300;if(h!=l){h=l;a=true;setTimeout(function(){a=false},100);j.setStyle(j.get(b.id+"_ifr"),"height",l+"px")}}b.onInit.add(function(j,i){j.onChange.add(c);j.onSetContent.add(c);j.onPaste.add(c);j.onKeyUp.add(c);j.onPostRender.add(c);j.getBody().style.overflowY="hidden"});if(b.getParam("autoresize_on_init",true)){b.onLoadContent.add(function(j,i){setTimeout(function(){c()},1200)})}b.addCommand("wpAutoResize",c)},getInfo:function(){return{longname:"WP Fullscreen",author:"WordPress",authorurl:"http://wordpress.org",infourl:"",version:"1.0"}}});tinymce.PluginManager.add("wpfullscreen",tinymce.plugins.wpFullscreenPlugin)})(); \ No newline at end of file diff --git a/src/wp-includes/js/tinymce/plugins/wpgallery/editor_plugin.dev.js b/src/wp-includes/js/tinymce/plugins/wpgallery/editor_plugin.dev.js new file mode 100644 index 0000000..6f57184 --- /dev/null +++ b/src/wp-includes/js/tinymce/plugins/wpgallery/editor_plugin.dev.js @@ -0,0 +1,119 @@ + +(function() { + tinymce.create('tinymce.plugins.wpGallery', { + + init : function(ed, url) { + var t = this; + + t.url = url; + t._createButtons(); + + // Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('...'); + ed.addCommand('WP_Gallery', function() { + var el = ed.selection.getNode(), post_id, vp = tinymce.DOM.getViewPort(), + H = vp.h - 80, W = ( 640 < vp.w ) ? 640 : vp.w; + + if ( el.nodeName != 'IMG' ) return; + if ( ed.dom.getAttrib(el, 'class').indexOf('wpGallery') == -1 ) return; + + post_id = tinymce.DOM.get('post_ID').value; + tb_show('', tinymce.documentBaseURL + '/media-upload.php?post_id='+post_id+'&tab=gallery&TB_iframe=true&width='+W+'&height='+H); + + tinymce.DOM.setStyle( ['TB_overlay','TB_window','TB_load'], 'z-index', '999999' ); + }); + + ed.onMouseDown.add(function(ed, e) { + if ( e.target.nodeName == 'IMG' && ed.dom.hasClass(e.target, 'wpGallery') ) + ed.plugins.wordpress._showButtons(e.target, 'wp_gallerybtns'); + }); + + ed.onBeforeSetContent.add(function(ed, o) { + o.content = t._do_gallery(o.content); + }); + + ed.onPostProcess.add(function(ed, o) { + if (o.get) + o.content = t._get_gallery(o.content); + }); + }, + + _do_gallery : function(co) { + return co.replace(/\[gallery([^\]]*)\]/g, function(a,b){ + return ''; + }); + }, + + _get_gallery : function(co) { + + function getAttr(s, n) { + n = new RegExp(n + '=\"([^\"]+)\"', 'g').exec(s); + return n ? tinymce.DOM.decode(n[1]) : ''; + }; + + return co.replace(/(?:]*>)*(]+>)(?:<\/p>)*/g, function(a,im) { + var cls = getAttr(im, 'class'); + + if ( cls.indexOf('wpGallery') != -1 ) + return '

            ['+tinymce.trim(getAttr(im, 'title'))+']

            '; + + return a; + }); + }, + + _createButtons : function() { + var t = this, ed = tinyMCE.activeEditor, DOM = tinymce.DOM, editButton, dellButton; + + DOM.remove('wp_gallerybtns'); + + DOM.add(document.body, 'div', { + id : 'wp_gallerybtns', + style : 'display:none;' + }); + + editButton = DOM.add('wp_gallerybtns', 'img', { + src : t.url+'/img/edit.png', + id : 'wp_editgallery', + width : '24', + height : '24', + title : ed.getLang('wordpress.editgallery') + }); + + tinymce.dom.Event.add(editButton, 'mousedown', function(e) { + var ed = tinyMCE.activeEditor; + ed.windowManager.bookmark = ed.selection.getBookmark('simple'); + ed.execCommand("WP_Gallery"); + }); + + dellButton = DOM.add('wp_gallerybtns', 'img', { + src : t.url+'/img/delete.png', + id : 'wp_delgallery', + width : '24', + height : '24', + title : ed.getLang('wordpress.delgallery') + }); + + tinymce.dom.Event.add(dellButton, 'mousedown', function(e) { + var ed = tinyMCE.activeEditor, el = ed.selection.getNode(); + + if ( el.nodeName == 'IMG' && ed.dom.hasClass(el, 'wpGallery') ) { + ed.dom.remove(el); + + ed.execCommand('mceRepaint'); + return false; + } + }); + }, + + getInfo : function() { + return { + longname : 'Gallery Settings', + author : 'WordPress', + authorurl : 'http://wordpress.org', + infourl : '', + version : "1.0" + }; + } + }); + + tinymce.PluginManager.add('wpgallery', tinymce.plugins.wpGallery); +})(); diff --git a/src/wp-includes/js/tinymce/plugins/wpgallery/editor_plugin.js b/src/wp-includes/js/tinymce/plugins/wpgallery/editor_plugin.js new file mode 100644 index 0000000..0c2824a --- /dev/null +++ b/src/wp-includes/js/tinymce/plugins/wpgallery/editor_plugin.js @@ -0,0 +1 @@ +(function(){tinymce.create("tinymce.plugins.wpGallery",{init:function(a,b){var c=this;c.url=b;c._createButtons();a.addCommand("WP_Gallery",function(){var h=a.selection.getNode(),f,e=tinymce.DOM.getViewPort(),g=e.h-80,d=(640'})},_get_gallery:function(b){function a(c,d){d=new RegExp(d+'="([^"]+)"',"g").exec(c);return d?tinymce.DOM.decode(d[1]):""}return b.replace(/(?:]*>)*(]+>)(?:<\/p>)*/g,function(e,d){var c=a(d,"class");if(c.indexOf("wpGallery")!=-1){return"

            ["+tinymce.trim(a(d,"title"))+"]

            "}return e})},_createButtons:function(){var b=this,a=tinyMCE.activeEditor,d=tinymce.DOM,e,c;d.remove("wp_gallerybtns");d.add(document.body,"div",{id:"wp_gallerybtns",style:"display:none;"});e=d.add("wp_gallerybtns","img",{src:b.url+"/img/edit.png",id:"wp_editgallery",width:"24",height:"24",title:a.getLang("wordpress.editgallery")});tinymce.dom.Event.add(e,"mousedown",function(g){var f=tinyMCE.activeEditor;f.windowManager.bookmark=f.selection.getBookmark("simple");f.execCommand("WP_Gallery")});c=d.add("wp_gallerybtns","img",{src:b.url+"/img/delete.png",id:"wp_delgallery",width:"24",height:"24",title:a.getLang("wordpress.delgallery")});tinymce.dom.Event.add(c,"mousedown",function(h){var f=tinyMCE.activeEditor,g=f.selection.getNode();if(g.nodeName=="IMG"&&f.dom.hasClass(g,"wpGallery")){f.dom.remove(g);f.execCommand("mceRepaint");return false}})},getInfo:function(){return{longname:"Gallery Settings",author:"WordPress",authorurl:"http://wordpress.org",infourl:"",version:"1.0"}}});tinymce.PluginManager.add("wpgallery",tinymce.plugins.wpGallery)})(); \ No newline at end of file diff --git a/src/wp-includes/js/tinymce/plugins/wpgallery/img/delete.png b/src/wp-includes/js/tinymce/plugins/wpgallery/img/delete.png new file mode 100644 index 0000000..d64d8a6 Binary files /dev/null and b/src/wp-includes/js/tinymce/plugins/wpgallery/img/delete.png differ diff --git a/src/wp-includes/js/tinymce/plugins/wpgallery/img/edit.png b/src/wp-includes/js/tinymce/plugins/wpgallery/img/edit.png new file mode 100644 index 0000000..41def51 Binary files /dev/null and b/src/wp-includes/js/tinymce/plugins/wpgallery/img/edit.png differ diff --git a/src/wp-includes/js/tinymce/plugins/wpgallery/img/gallery.png b/src/wp-includes/js/tinymce/plugins/wpgallery/img/gallery.png new file mode 100644 index 0000000..803ad63 Binary files /dev/null and b/src/wp-includes/js/tinymce/plugins/wpgallery/img/gallery.png differ diff --git a/src/wp-includes/js/tinymce/plugins/wpgallery/img/t.gif b/src/wp-includes/js/tinymce/plugins/wpgallery/img/t.gif new file mode 100644 index 0000000..3884865 Binary files /dev/null and b/src/wp-includes/js/tinymce/plugins/wpgallery/img/t.gif differ diff --git a/src/wp-includes/js/tinymce/plugins/wplink/css/wplink-rtl.css b/src/wp-includes/js/tinymce/plugins/wplink/css/wplink-rtl.css new file mode 100644 index 0000000..6d0d4c3 --- /dev/null +++ b/src/wp-includes/js/tinymce/plugins/wplink/css/wplink-rtl.css @@ -0,0 +1 @@ +#wp-link #internal-toggle{padding-right:18px;padding-left:0;}#wp-link label span{text-align:left;padding-left:5px;padding-right:0;}#wp-link .link-search-wrapper span{float:right;}#wp-link .link-search-wrapper input[type="text"]{float:right;}#wp-link .link-search-wrapper img.waiting{margin:8px 4px 0 1px;float:right;}#wp-link .link-target{margin:0 87px 0 0;}#wp-link .item-info{left:5px;right:auto;top:4px;bottom:0;}#wp-link #search-panel{float:right;}#wp-link-cancel{float:right;}#wp-link-update{float:left;}#wp-link .toggle-arrow{background-position:bottom right;}#wp-link .toggle-arrow-active{background-position:center right;} \ No newline at end of file diff --git a/src/wp-includes/js/tinymce/plugins/wplink/css/wplink-rtl.dev.css b/src/wp-includes/js/tinymce/plugins/wplink/css/wplink-rtl.dev.css new file mode 100644 index 0000000..d64f198 --- /dev/null +++ b/src/wp-includes/js/tinymce/plugins/wplink/css/wplink-rtl.dev.css @@ -0,0 +1,54 @@ +#wp-link #internal-toggle { + padding-right: 18px; + padding-left: 0; +} + +#wp-link label span { + text-align: left; + padding-left: 5px; + padding-right: 0; +} + +#wp-link .link-search-wrapper span { + float: right; +} + +#wp-link .link-search-wrapper input[type="text"] { + float: right; +} + +#wp-link .link-search-wrapper img.waiting { + margin: 8px 4px 0 1px; + float: right; +} + +#wp-link .link-target { + margin: 0 87px 0 0; +} + +#wp-link .item-info { + left: 5px; + right: auto; + top: 4px; + bottom: 0; +} + +#wp-link #search-panel { + float: right; +} + +#wp-link-cancel { + float: right; +} + +#wp-link-update { + float: left; +} + +#wp-link .toggle-arrow { + background-position: bottom right; +} + +#wp-link .toggle-arrow-active { + background-position: center right; +} \ No newline at end of file diff --git a/src/wp-includes/js/tinymce/plugins/wplink/css/wplink.css b/src/wp-includes/js/tinymce/plugins/wplink/css/wplink.css new file mode 100644 index 0000000..a1560b3 --- /dev/null +++ b/src/wp-includes/js/tinymce/plugins/wplink/css/wplink.css @@ -0,0 +1 @@ +#wp-link{line-height:1.4em;font-size:12px;}#wp-link ol,#wp-link ul{list-style:none;margin:0;padding:0;}#wp-link input[type="text"]{-webkit-box-sizing:border-box;}#wp-link input[type="text"],#wp-link textarea{border-width:1px;border-style:solid;-moz-border-radius:4px;-khtml-border-radius:4px;-webkit-border-radius:4px;border-radius:4px;font-size:12px;margin:1px;padding:3px;}#wp-link #link-options{padding:10px 0 14px;border-bottom:1px solid #dfdfdf;margin:0 6px 14px;}#wp-link p.howto{margin:3px;}#wp-link #internal-toggle{display:inline-block;cursor:pointer;padding-left:18px;}#wp-link .toggle-arrow{background:transparent url('../img/toggle-arrow.png') top left no-repeat;height:23px;line-height:23px;}#wp-link .toggle-arrow-active{background-position:center left;}#wp-link label input[type="text"]{width:360px;margin-top:5px;}#wp-link label span{display:inline-block;width:80px;text-align:right;padding-right:5px;}#wp-link .link-search-wrapper{margin:5px 6px 9px;display:block;overflow:hidden;}#wp-link .link-search-wrapper span{float:left;margin-top:6px;}#wp-link .link-search-wrapper input[type="text"]{float:left;width:220px;}#wp-link .link-search-wrapper img.waiting{margin:8px 1px 0 4px;float:left;display:none;}#wp-link .link-target{width:auto;padding:3px 0 0;margin:0 0 0 87px;font-size:11px;}#wp-link .query-results{border:1px #dfdfdf solid;margin:0 5px 5px;background:#fff;height:185px;overflow:auto;position:relative;}#wp-link li,#wp-link .query-notice{clear:both;margin-bottom:0;border-bottom:1px solid #f1f1f1;color:#333;padding:4px 6px;cursor:pointer;position:relative;}#wp-link li:hover{background:#eaf2fa;color:#151515;}#wp-link li.unselectable{border-bottom:1px solid #dfdfdf;}#wp-link li.unselectable:hover{background:#fff;cursor:auto;color:#333;}#wp-link li.selected{background:#ddd;color:#333;}#wp-link li.selected .item-title{font-weight:bold;}#wp-link .item-title{display:inline-block;width:80%;}#wp-link .item-info{text-transform:uppercase;color:#666;font-size:11px;position:absolute;right:5px;top:4px;bottom:0;}#wp-link #search-results{display:none;}#wp-link #search-panel{float:left;width:100%;}#wp-link .river-waiting{display:none;padding:10px 0;}#wp-link .river-waiting img.waiting{margin:0 auto;display:block;}#wp-link .submitbox{padding:5px 10px;font-size:11px;overflow:auto;height:29px;}#wp-link-cancel{line-height:25px;float:left;}#wp-link-update{line-height:23px;float:right;} \ No newline at end of file diff --git a/src/wp-includes/js/tinymce/plugins/wplink/css/wplink.dev.css b/src/wp-includes/js/tinymce/plugins/wplink/css/wplink.dev.css new file mode 100644 index 0000000..16db9e5 --- /dev/null +++ b/src/wp-includes/js/tinymce/plugins/wplink/css/wplink.dev.css @@ -0,0 +1,163 @@ +#wp-link { + line-height: 1.4em; + font-size: 12px; +} + +#wp-link ol, +#wp-link ul { + list-style: none; + margin: 0; + padding: 0; +} + +#wp-link input[type="text"] { + -webkit-box-sizing: border-box; +} + +#wp-link input[type="text"], +#wp-link textarea { + border-width: 1px; + border-style: solid; + -moz-border-radius: 4px; + -khtml-border-radius: 4px; + -webkit-border-radius: 4px; + border-radius: 4px; + font-size: 12px; + margin: 1px; + padding: 3px; +} + +#wp-link #link-options { + padding: 10px 0 14px; + border-bottom: 1px solid #dfdfdf; + margin: 0 6px 14px; +} +#wp-link p.howto { + margin: 3px; +} +#wp-link #internal-toggle { + display: inline-block; + cursor: pointer; + padding-left: 18px; +} +#wp-link .toggle-arrow { + background: transparent url( '../img/toggle-arrow.png' ) top left no-repeat; + height: 23px; + line-height: 23px; +} +#wp-link .toggle-arrow-active { + background-position: center left; +} +#wp-link label input[type="text"] { + width: 360px; + margin-top: 5px; +} +#wp-link label span { + display: inline-block; + width: 80px; + text-align: right; + padding-right: 5px; +} +#wp-link .link-search-wrapper { + margin: 5px 6px 9px; + display: block; + overflow: hidden; +} +#wp-link .link-search-wrapper span { + float: left; + margin-top: 6px; +} +#wp-link .link-search-wrapper input[type="text"] { + float: left; + width: 220px; +} +#wp-link .link-search-wrapper img.waiting { + margin: 8px 1px 0 4px; + float: left; + display: none; +} +#wp-link .link-target { + width: auto; + padding: 3px 0 0; + margin: 0 0 0 87px; + font-size: 11px; +} +#wp-link .query-results { + border: 1px #dfdfdf solid; + margin: 0 5px 5px; + background: #fff; + height: 185px; + overflow: auto; + position: relative; +} +#wp-link li, +#wp-link .query-notice { + clear: both; + margin-bottom: 0; + border-bottom: 1px solid #f1f1f1; + color: #333; + padding: 4px 6px; + cursor: pointer; + position: relative; +} +#wp-link li:hover { + background: #eaf2fa; + color: #151515; +} +#wp-link li.unselectable { + border-bottom: 1px solid #dfdfdf; +} +#wp-link li.unselectable:hover { + background: #fff; + cursor: auto; + color: #333; +} +#wp-link li.selected { + background: #ddd; + color: #333; +} +#wp-link li.selected .item-title { + font-weight: bold; +} +#wp-link .item-title { + display: inline-block; + width: 80%; +} +#wp-link .item-info { + text-transform: uppercase; + color: #666; + font-size: 11px; + position: absolute; + right: 5px; + top: 4px; + bottom: 0; +} +#wp-link #search-results { + display: none; +} +#wp-link #search-panel { + float: left; + width: 100%; +} +#wp-link .river-waiting { + display: none; + padding: 10px 0; +} +#wp-link .river-waiting img.waiting { + margin: 0 auto; + display: block; +} +#wp-link .submitbox { + padding: 5px 10px; + font-size: 11px; + overflow: auto; + height: 29px; +} +#wp-link-cancel { + line-height: 25px; + float: left; +} +#wp-link-update { + line-height: 23px; + float: right; +} \ No newline at end of file diff --git a/src/wp-includes/js/tinymce/plugins/wplink/editor_plugin.dev.js b/src/wp-includes/js/tinymce/plugins/wplink/editor_plugin.dev.js new file mode 100644 index 0000000..ff1c4eb --- /dev/null +++ b/src/wp-includes/js/tinymce/plugins/wplink/editor_plugin.dev.js @@ -0,0 +1,60 @@ +(function() { + tinymce.create('tinymce.plugins.wpLink', { + /** + * Initializes the plugin, this will be executed after the plugin has been created. + * This call is done before the editor instance has finished it's initialization so use the onInit event + * of the editor instance to intercept that event. + * + * @param {tinymce.Editor} ed Editor instance that the plugin is initialized in. + * @param {string} url Absolute URL to where the plugin is located. + */ + init : function(ed, url) { + var disabled = true; + + // Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('mceExample'); + ed.addCommand('WP_Link', function() { + if ( disabled ) + return; + ed.windowManager.open({ + id : 'wp-link', + width : 480, + height : "auto", + wpDialog : true, + title : ed.getLang('advlink.link_desc') + }, { + plugin_url : url // Plugin absolute URL + }); + }); + + // Register example button + ed.addButton('link', { + title : ed.getLang('advanced.link_desc'), + cmd : 'WP_Link' + }); + + ed.addShortcut('alt+shift+a', ed.getLang('advanced.link_desc'), 'WP_Link'); + + ed.onNodeChange.add(function(ed, cm, n, co) { + disabled = co && n.nodeName != 'A'; + }); + }, + /** + * Returns information about the plugin as a name/value array. + * The current keys are longname, author, authorurl, infourl and version. + * + * @return {Object} Name/value array containing information about the plugin. + */ + getInfo : function() { + return { + longname : 'WordPress Link Dialog', + author : 'WordPress', + authorurl : 'http://wordpress.org', + infourl : '', + version : "1.0" + }; + } + }); + + // Register plugin + tinymce.PluginManager.add('wplink', tinymce.plugins.wpLink); +})(); \ No newline at end of file diff --git a/src/wp-includes/js/tinymce/plugins/wplink/editor_plugin.js b/src/wp-includes/js/tinymce/plugins/wplink/editor_plugin.js new file mode 100644 index 0000000..49b94ae --- /dev/null +++ b/src/wp-includes/js/tinymce/plugins/wplink/editor_plugin.js @@ -0,0 +1 @@ +(function(){tinymce.create("tinymce.plugins.wpLink",{init:function(a,b){var c=true;a.addCommand("WP_Link",function(){if(c){return}a.windowManager.open({id:"wp-link",width:480,height:"auto",wpDialog:true,title:a.getLang("advlink.link_desc")},{plugin_url:b})});a.addButton("link",{title:a.getLang("advanced.link_desc"),cmd:"WP_Link"});a.addShortcut("alt+shift+a",a.getLang("advanced.link_desc"),"WP_Link");a.onNodeChange.add(function(e,d,g,f){c=f&&g.nodeName!="A"})},getInfo:function(){return{longname:"WordPress Link Dialog",author:"WordPress",authorurl:"http://wordpress.org",infourl:"",version:"1.0"}}});tinymce.PluginManager.add("wplink",tinymce.plugins.wpLink)})(); \ No newline at end of file diff --git a/src/wp-includes/js/tinymce/plugins/wplink/img/toggle-arrow.png b/src/wp-includes/js/tinymce/plugins/wplink/img/toggle-arrow.png new file mode 100644 index 0000000..5d4a6d3 Binary files /dev/null and b/src/wp-includes/js/tinymce/plugins/wplink/img/toggle-arrow.png differ diff --git a/src/wp-includes/js/tinymce/plugins/wplink/js/wplink.dev.js b/src/wp-includes/js/tinymce/plugins/wplink/js/wplink.dev.js new file mode 100644 index 0000000..87c0bab --- /dev/null +++ b/src/wp-includes/js/tinymce/plugins/wplink/js/wplink.dev.js @@ -0,0 +1,585 @@ +var wpLink; + +(function($){ + var inputs = {}, rivers = {}, ed, River, Query; + + wpLink = { + timeToTriggerRiver: 150, + minRiverAJAXDuration: 200, + riverBottomThreshold: 5, + keySensitivity: 100, + lastSearch: '', + textarea: function() { return edCanvas; }, + + init : function() { + inputs.dialog = $('#wp-link'); + inputs.submit = $('#wp-link-submit'); + // URL + inputs.url = $('#url-field'); + // Secondary options + inputs.title = $('#link-title-field'); + // Advanced Options + inputs.openInNewTab = $('#link-target-checkbox'); + inputs.search = $('#search-field'); + // Build Rivers + rivers.search = new River( $('#search-results') ); + rivers.recent = new River( $('#most-recent-results') ); + rivers.elements = $('.query-results', inputs.dialog); + + // Bind event handlers + inputs.dialog.keydown( wpLink.keydown ); + inputs.dialog.keyup( wpLink.keyup ); + inputs.submit.click( function(e){ + wpLink.update(); + e.preventDefault(); + }); + $('#wp-link-cancel').click( wpLink.close ); + $('#internal-toggle').click( wpLink.toggleInternalLinking ); + + rivers.elements.bind('river-select', wpLink.updateFields ); + + inputs.search.keyup( wpLink.searchInternalLinks ); + + inputs.dialog.bind('wpdialogrefresh', wpLink.refresh); + inputs.dialog.bind('wpdialogbeforeopen', wpLink.beforeOpen); + inputs.dialog.bind('wpdialogclose', wpLink.onClose); + }, + + beforeOpen : function() { + wpLink.range = null; + + if ( ! wpLink.isMCE() && document.selection ) { + wpLink.textarea().focus(); + wpLink.range = document.selection.createRange(); + } + }, + + open : function() { + // Initialize the dialog if necessary (html mode). + if ( ! inputs.dialog.data('wpdialog') ) { + inputs.dialog.wpdialog({ + title: wpLinkL10n.title, + width: 480, + height: 'auto', + modal: true, + dialogClass: 'wp-dialog', + zIndex: 300000 + }); + } + + inputs.dialog.wpdialog('open'); + }, + + isMCE : function() { + return tinyMCEPopup && ( ed = tinyMCEPopup.editor ) && ! ed.isHidden(); + }, + + refresh : function() { + // Refresh rivers (clear links, check visibility) + rivers.search.refresh(); + rivers.recent.refresh(); + + if ( wpLink.isMCE() ) + wpLink.mceRefresh(); + else + wpLink.setDefaultValues(); + + // Focus the URL field and highlight its contents. + // If this is moved above the selection changes, + // IE will show a flashing cursor over the dialog. + inputs.url.focus()[0].select(); + // Load the most recent results if this is the first time opening the panel. + if ( ! rivers.recent.ul.children().length ) + rivers.recent.ajax(); + }, + + mceRefresh : function() { + var e; + ed = tinyMCEPopup.editor; + + tinyMCEPopup.restoreSelection(); + + // If link exists, select proper values. + if ( e = ed.dom.getParent(ed.selection.getNode(), 'A') ) { + // Set URL and description. + inputs.url.val( e.href ); + inputs.title.val( ed.dom.getAttrib(e, 'title') ); + // Set open in new tab. + if ( "_blank" == ed.dom.getAttrib(e, 'target') ) + inputs.openInNewTab.prop('checked', true); + // Update save prompt. + inputs.submit.val( wpLinkL10n.update ); + + // If there's no link, set the default values. + } else { + wpLink.setDefaultValues(); + } + + tinyMCEPopup.storeSelection(); + }, + + close : function() { + if ( wpLink.isMCE() ) + tinyMCEPopup.close(); + else + inputs.dialog.wpdialog('close'); + }, + + onClose: function() { + if ( ! wpLink.isMCE() ) { + wpLink.textarea().focus(); + if ( wpLink.range ) { + wpLink.range.moveToBookmark( wpLink.range.getBookmark() ); + wpLink.range.select(); + } + } + }, + + getAttrs : function() { + return { + href : inputs.url.val(), + title : inputs.title.val(), + target : inputs.openInNewTab.prop('checked') ? '_blank' : '' + }; + }, + + update : function() { + if ( wpLink.isMCE() ) + wpLink.mceUpdate(); + else + wpLink.htmlUpdate(); + }, + + htmlUpdate : function() { + var attrs, html, start, end, cursor, + textarea = wpLink.textarea(); + + if ( ! textarea ) + return; + + attrs = wpLink.getAttrs(); + + // If there's no href, return. + if ( ! attrs.href || attrs.href == 'http://' ) + return; + + // Build HTML + html = ''; + cursor = start + html.length; + + // If no next is selected, place the cursor inside the closing tag. + if ( start == end ) + cursor -= ''.length; + + textarea.value = textarea.value.substring( 0, start ) + + html + + textarea.value.substring( end, textarea.value.length ); + + // Update cursor position + textarea.selectionStart = textarea.selectionEnd = cursor; + + // IE + // Note: If no text is selected, IE will not place the cursor + // inside the closing tag. + } else if ( document.selection && wpLink.range ) { + textarea.focus(); + wpLink.range.text = html + wpLink.range.text + ''; + wpLink.range.moveToBookmark( wpLink.range.getBookmark() ); + wpLink.range.select(); + + wpLink.range = null; + } + + wpLink.close(); + textarea.focus(); + }, + + mceUpdate : function() { + var ed = tinyMCEPopup.editor, + attrs = wpLink.getAttrs(), + e, b; + + tinyMCEPopup.restoreSelection(); + e = ed.dom.getParent(ed.selection.getNode(), 'A'); + + // If the values are empty, unlink and return + if ( ! attrs.href || attrs.href == 'http://' ) { + if ( e ) { + tinyMCEPopup.execCommand("mceBeginUndoLevel"); + b = ed.selection.getBookmark(); + ed.dom.remove(e, 1); + ed.selection.moveToBookmark(b); + tinyMCEPopup.execCommand("mceEndUndoLevel"); + wpLink.close(); + } + return; + } + + tinyMCEPopup.execCommand("mceBeginUndoLevel"); + + if (e == null) { + ed.getDoc().execCommand("unlink", false, null); + tinyMCEPopup.execCommand("CreateLink", false, "#mce_temp_url#", {skip_undo : 1}); + + tinymce.each(ed.dom.select("a"), function(n) { + if (ed.dom.getAttrib(n, 'href') == '#mce_temp_url#') { + e = n; + ed.dom.setAttribs(e, attrs); + } + }); + + // Sometimes WebKit lets a user create a link where + // they shouldn't be able to. In this case, CreateLink + // injects "#mce_temp_url#" into their content. Fix it. + if ( $(e).text() == '#mce_temp_url#' ) { + ed.dom.remove(e); + e = null; + } + } else { + ed.dom.setAttribs(e, attrs); + } + + // Don't move caret if selection was image + if ( e && (e.childNodes.length != 1 || e.firstChild.nodeName != 'IMG') ) { + ed.focus(); + ed.selection.select(e); + ed.selection.collapse(0); + tinyMCEPopup.storeSelection(); + } + + tinyMCEPopup.execCommand("mceEndUndoLevel"); + wpLink.close(); + }, + + updateFields : function( e, li, originalEvent ) { + inputs.url.val( li.children('.item-permalink').val() ); + inputs.title.val( li.hasClass('no-title') ? '' : li.children('.item-title').text() ); + if ( originalEvent && originalEvent.type == "click" ) + inputs.url.focus(); + }, + setDefaultValues : function() { + // Set URL and description to defaults. + // Leave the new tab setting as-is. + inputs.url.val('http://'); + inputs.title.val(''); + + // Update save prompt. + inputs.submit.val( wpLinkL10n.save ); + }, + + searchInternalLinks : function() { + var t = $(this), waiting, + search = t.val(); + + if ( search.length > 2 ) { + rivers.recent.hide(); + rivers.search.show(); + + // Don't search if the keypress didn't change the title. + if ( wpLink.lastSearch == search ) + return; + + wpLink.lastSearch = search; + waiting = t.siblings('img.waiting').show(); + + rivers.search.change( search ); + rivers.search.ajax( function(){ waiting.hide(); }); + } else { + rivers.search.hide(); + rivers.recent.show(); + } + }, + + next : function() { + rivers.search.next(); + rivers.recent.next(); + }, + prev : function() { + rivers.search.prev(); + rivers.recent.prev(); + }, + + keydown : function( event ) { + var fn, key = $.ui.keyCode; + + switch( event.which ) { + case key.UP: + fn = 'prev'; + case key.DOWN: + fn = fn || 'next'; + clearInterval( wpLink.keyInterval ); + wpLink[ fn ](); + wpLink.keyInterval = setInterval( wpLink[ fn ], wpLink.keySensitivity ); + break; + default: + return; + } + event.preventDefault(); + }, + keyup: function( event ) { + var key = $.ui.keyCode; + + switch( event.which ) { + case key.ESCAPE: + event.stopImmediatePropagation(); + if ( ! $(document).triggerHandler( 'wp_CloseOnEscape', [{ event: event, what: 'wplink', cb: wpLink.close }] ) ) + wpLink.close(); + + return false; + break; + case key.UP: + case key.DOWN: + clearInterval( wpLink.keyInterval ); + break; + default: + return; + } + event.preventDefault(); + }, + + delayedCallback : function( func, delay ) { + var timeoutTriggered, funcTriggered, funcArgs, funcContext; + + if ( ! delay ) + return func; + + setTimeout( function() { + if ( funcTriggered ) + return func.apply( funcContext, funcArgs ); + // Otherwise, wait. + timeoutTriggered = true; + }, delay); + + return function() { + if ( timeoutTriggered ) + return func.apply( this, arguments ); + // Otherwise, wait. + funcArgs = arguments; + funcContext = this; + funcTriggered = true; + }; + }, + + toggleInternalLinking : function( event ) { + var panel = $('#search-panel'), + widget = inputs.dialog.wpdialog('widget'), + // We're about to toggle visibility; it's currently the opposite + visible = !panel.is(':visible'), + win = $(window); + + $(this).toggleClass('toggle-arrow-active', visible); + + inputs.dialog.height('auto'); + panel.slideToggle( 300, function() { + setUserSetting('wplink', visible ? '1' : '0'); + inputs[ visible ? 'search' : 'url' ].focus(); + + // Move the box if the box is now expanded, was opened in a collapsed state, + // and if it needs to be moved. (Judged by bottom not being positive or + // bottom being smaller than top.) + var scroll = win.scrollTop(), + top = widget.offset().top, + bottom = top + widget.outerHeight(), + diff = bottom - win.height(); + + if ( diff > scroll ) { + widget.animate({'top': diff < top ? top - diff : scroll }, 200); + } + }); + event.preventDefault(); + } + } + + River = function( element, search ) { + var self = this; + this.element = element; + this.ul = element.children('ul'); + this.waiting = element.find('.river-waiting'); + + this.change( search ); + this.refresh(); + + element.scroll( function(){ self.maybeLoad(); }); + element.delegate('li', 'click', function(e){ self.select( $(this), e ); }); + }; + + $.extend( River.prototype, { + refresh: function() { + this.deselect(); + this.visible = this.element.is(':visible'); + }, + show: function() { + if ( ! this.visible ) { + this.deselect(); + this.element.show(); + this.visible = true; + } + }, + hide: function() { + this.element.hide(); + this.visible = false; + }, + // Selects a list item and triggers the river-select event. + select: function( li, event ) { + var liHeight, elHeight, liTop, elTop; + + if ( li.hasClass('unselectable') || li == this.selected ) + return; + + this.deselect(); + this.selected = li.addClass('selected'); + // Make sure the element is visible + liHeight = li.outerHeight(); + elHeight = this.element.height(); + liTop = li.position().top; + elTop = this.element.scrollTop(); + + if ( liTop < 0 ) // Make first visible element + this.element.scrollTop( elTop + liTop ); + else if ( liTop + liHeight > elHeight ) // Make last visible element + this.element.scrollTop( elTop + liTop - elHeight + liHeight ); + + // Trigger the river-select event + this.element.trigger('river-select', [ li, event, this ]); + }, + deselect: function() { + if ( this.selected ) + this.selected.removeClass('selected'); + this.selected = false; + }, + prev: function() { + if ( ! this.visible ) + return; + + var to; + if ( this.selected ) { + to = this.selected.prev('li'); + if ( to.length ) + this.select( to ); + } + }, + next: function() { + if ( ! this.visible ) + return; + + var to = this.selected ? this.selected.next('li') : $('li:not(.unselectable):first', this.element); + if ( to.length ) + this.select( to ); + }, + ajax: function( callback ) { + var self = this, + delay = this.query.page == 1 ? 0 : wpLink.minRiverAJAXDuration, + response = wpLink.delayedCallback( function( results, params ) { + self.process( results, params ); + if ( callback ) + callback( results, params ); + }, delay ); + + this.query.ajax( response ); + }, + change: function( search ) { + if ( this.query && this._search == search ) + return; + + this._search = search; + this.query = new Query( search ); + this.element.scrollTop(0); + }, + process: function( results, params ) { + var list = '', alt = true, classes = '', + firstPage = params.page == 1; + + if ( !results ) { + if ( firstPage ) { + list += '
          • ' + + wpLinkL10n.noMatchesFound + + '
          • '; + } + } else { + $.each( results, function() { + classes = alt ? 'alternate' : ''; + classes += this['title'] ? '' : ' no-title'; + list += classes ? '
          • ' : '
          • '; + list += ''; + list += ''; + list += this['title'] ? this['title'] : wpLinkL10n.noTitle; + list += '' + this['info'] + '
          • '; + alt = ! alt; + }); + } + + this.ul[ firstPage ? 'html' : 'append' ]( list ); + }, + maybeLoad: function() { + var self = this, + el = this.element, + bottom = el.scrollTop() + el.height(); + + if ( ! this.query.ready() || bottom < this.ul.height() - wpLink.riverBottomThreshold ) + return; + + setTimeout(function() { + var newTop = el.scrollTop(), + newBottom = newTop + el.height(); + + if ( ! self.query.ready() || newBottom < self.ul.height() - wpLink.riverBottomThreshold ) + return; + + self.waiting.show(); + el.scrollTop( newTop + self.waiting.outerHeight() ); + + self.ajax( function() { self.waiting.hide(); }); + }, wpLink.timeToTriggerRiver ); + } + }); + + Query = function( search ) { + this.page = 1; + this.allLoaded = false; + this.querying = false; + this.search = search; + }; + + $.extend( Query.prototype, { + ready: function() { + return !( this.querying || this.allLoaded ); + }, + ajax: function( callback ) { + var self = this, + query = { + action : 'wp-link-ajax', + page : this.page, + '_ajax_linking_nonce' : $('#_ajax_linking_nonce').val() + }; + + if ( this.search ) + query.search = this.search; + + this.querying = true; + + $.post( ajaxurl, query, function(r) { + self.page++; + self.querying = false; + self.allLoaded = !r; + callback( r, query ); + }, "json" ); + } + }); + + $(document).ready( wpLink.init ); +})(jQuery); diff --git a/src/wp-includes/js/tinymce/plugins/wplink/js/wplink.js b/src/wp-includes/js/tinymce/plugins/wplink/js/wplink.js new file mode 100644 index 0000000..29b0c6c --- /dev/null +++ b/src/wp-includes/js/tinymce/plugins/wplink/js/wplink.js @@ -0,0 +1 @@ +var wpLink;(function(f){var b={},e={},d,a,c;wpLink={timeToTriggerRiver:150,minRiverAJAXDuration:200,riverBottomThreshold:5,keySensitivity:100,lastSearch:"",textarea:function(){return edCanvas},init:function(){b.dialog=f("#wp-link");b.submit=f("#wp-link-submit");b.url=f("#url-field");b.title=f("#link-title-field");b.openInNewTab=f("#link-target-checkbox");b.search=f("#search-field");e.search=new a(f("#search-results"));e.recent=new a(f("#most-recent-results"));e.elements=f(".query-results",b.dialog);b.dialog.keydown(wpLink.keydown);b.dialog.keyup(wpLink.keyup);b.submit.click(function(g){wpLink.update();g.preventDefault()});f("#wp-link-cancel").click(wpLink.close);f("#internal-toggle").click(wpLink.toggleInternalLinking);e.elements.bind("river-select",wpLink.updateFields);b.search.keyup(wpLink.searchInternalLinks);b.dialog.bind("wpdialogrefresh",wpLink.refresh);b.dialog.bind("wpdialogbeforeopen",wpLink.beforeOpen);b.dialog.bind("wpdialogclose",wpLink.onClose)},beforeOpen:function(){wpLink.range=null;if(!wpLink.isMCE()&&document.selection){wpLink.textarea().focus();wpLink.range=document.selection.createRange()}},open:function(){if(!b.dialog.data("wpdialog")){b.dialog.wpdialog({title:wpLinkL10n.title,width:480,height:"auto",modal:true,dialogClass:"wp-dialog",zIndex:300000})}b.dialog.wpdialog("open")},isMCE:function(){return tinyMCEPopup&&(d=tinyMCEPopup.editor)&&!d.isHidden()},refresh:function(){e.search.refresh();e.recent.refresh();if(wpLink.isMCE()){wpLink.mceRefresh()}else{wpLink.setDefaultValues()}b.url.focus()[0].select();if(!e.recent.ul.children().length){e.recent.ajax()}},mceRefresh:function(){var g;d=tinyMCEPopup.editor;tinyMCEPopup.restoreSelection();if(g=d.dom.getParent(d.selection.getNode(),"A")){b.url.val(g.href);b.title.val(d.dom.getAttrib(g,"title"));if("_blank"==d.dom.getAttrib(g,"target")){b.openInNewTab.prop("checked",true)}b.submit.val(wpLinkL10n.update)}else{wpLink.setDefaultValues()}tinyMCEPopup.storeSelection()},close:function(){if(wpLink.isMCE()){tinyMCEPopup.close()}else{b.dialog.wpdialog("close")}},onClose:function(){if(!wpLink.isMCE()){wpLink.textarea().focus();if(wpLink.range){wpLink.range.moveToBookmark(wpLink.range.getBookmark());wpLink.range.select()}}},getAttrs:function(){return{href:b.url.val(),title:b.title.val(),target:b.openInNewTab.prop("checked")?"_blank":""}},update:function(){if(wpLink.isMCE()){wpLink.mceUpdate()}else{wpLink.htmlUpdate()}},htmlUpdate:function(){var i,j,l,h,k,g=wpLink.textarea();if(!g){return}i=wpLink.getAttrs();if(!i.href||i.href=="http://"){return}j='";k=l+j.length;if(l==h){k-="".length}g.value=g.value.substring(0,l)+j+g.value.substring(h,g.value.length);g.selectionStart=g.selectionEnd=k}else{if(document.selection&&wpLink.range){g.focus();wpLink.range.text=j+wpLink.range.text+"";wpLink.range.moveToBookmark(wpLink.range.getBookmark());wpLink.range.select();wpLink.range=null}}wpLink.close();g.focus()},mceUpdate:function(){var h=tinyMCEPopup.editor,i=wpLink.getAttrs(),j,g;tinyMCEPopup.restoreSelection();j=h.dom.getParent(h.selection.getNode(),"A");if(!i.href||i.href=="http://"){if(j){tinyMCEPopup.execCommand("mceBeginUndoLevel");g=h.selection.getBookmark();h.dom.remove(j,1);h.selection.moveToBookmark(g);tinyMCEPopup.execCommand("mceEndUndoLevel");wpLink.close()}return}tinyMCEPopup.execCommand("mceBeginUndoLevel");if(j==null){h.getDoc().execCommand("unlink",false,null);tinyMCEPopup.execCommand("CreateLink",false,"#mce_temp_url#",{skip_undo:1});tinymce.each(h.dom.select("a"),function(k){if(h.dom.getAttrib(k,"href")=="#mce_temp_url#"){j=k;h.dom.setAttribs(j,i)}});if(f(j).text()=="#mce_temp_url#"){h.dom.remove(j);j=null}}else{h.dom.setAttribs(j,i)}if(j&&(j.childNodes.length!=1||j.firstChild.nodeName!="IMG")){h.focus();h.selection.select(j);h.selection.collapse(0);tinyMCEPopup.storeSelection()}tinyMCEPopup.execCommand("mceEndUndoLevel");wpLink.close()},updateFields:function(i,h,g){b.url.val(h.children(".item-permalink").val());b.title.val(h.hasClass("no-title")?"":h.children(".item-title").text());if(g&&g.type=="click"){b.url.focus()}},setDefaultValues:function(){b.url.val("http://");b.title.val("");b.submit.val(wpLinkL10n.save)},searchInternalLinks:function(){var h=f(this),i,g=h.val();if(g.length>2){e.recent.hide();e.search.show();if(wpLink.lastSearch==g){return}wpLink.lastSearch=g;i=h.siblings("img.waiting").show();e.search.change(g);e.search.ajax(function(){i.hide()})}else{e.search.hide();e.recent.show()}},next:function(){e.search.next();e.recent.next()},prev:function(){e.search.prev();e.recent.prev()},keydown:function(i){var h,g=f.ui.keyCode;switch(i.which){case g.UP:h="prev";case g.DOWN:h=h||"next";clearInterval(wpLink.keyInterval);wpLink[h]();wpLink.keyInterval=setInterval(wpLink[h],wpLink.keySensitivity);break;default:return}i.preventDefault()},keyup:function(h){var g=f.ui.keyCode;switch(h.which){case g.ESCAPE:h.stopImmediatePropagation();if(!f(document).triggerHandler("wp_CloseOnEscape",[{event:h,what:"wplink",cb:wpLink.close}])){wpLink.close()}return false;break;case g.UP:case g.DOWN:clearInterval(wpLink.keyInterval);break;default:return}h.preventDefault()},delayedCallback:function(i,g){var l,k,j,h;if(!g){return i}setTimeout(function(){if(k){return i.apply(h,j)}l=true},g);return function(){if(l){return i.apply(this,arguments)}j=arguments;h=this;k=true}},toggleInternalLinking:function(h){var g=f("#search-panel"),i=b.dialog.wpdialog("widget"),k=!g.is(":visible"),j=f(window);f(this).toggleClass("toggle-arrow-active",k);b.dialog.height("auto");g.slideToggle(300,function(){setUserSetting("wplink",k?"1":"0");b[k?"search":"url"].focus();var l=j.scrollTop(),o=i.offset().top,m=o+i.outerHeight(),n=m-j.height();if(n>l){i.animate({top:ni){this.element.scrollTop(g+l-i+j)}}this.element.trigger("river-select",[h,k,this])},deselect:function(){if(this.selected){this.selected.removeClass("selected")}this.selected=false},prev:function(){if(!this.visible){return}var g;if(this.selected){g=this.selected.prev("li");if(g.length){this.select(g)}}},next:function(){if(!this.visible){return}var g=this.selected?this.selected.next("li"):f("li:not(.unselectable):first",this.element);if(g.length){this.select(g)}},ajax:function(j){var h=this,i=this.query.page==1?0:wpLink.minRiverAJAXDuration,g=wpLink.delayedCallback(function(k,l){h.process(k,l);if(j){j(k,l)}},i);this.query.ajax(g)},change:function(g){if(this.query&&this._search==g){return}this._search=g;this.query=new c(g);this.element.scrollTop(0)},process:function(h,l){var i="",j=true,g="",k=l.page==1;if(!h){if(k){i+='
          • '+wpLinkL10n.noMatchesFound+"
          • "}}else{f.each(h,function(){g=j?"alternate":"";g+=this["title"]?"":" no-title";i+=g?'
          • ':"
          • ";i+='';i+='';i+=this["title"]?this["title"]:wpLinkL10n.noTitle;i+=''+this["info"]+"
          • ";j=!j})}this.ul[k?"html":"append"](i)},maybeLoad:function(){var h=this,i=this.element,g=i.scrollTop()+i.height();if(!this.query.ready()||g + + + {#advanced_dlg.about_title} + + + + + + + +
            +
            +

            {#advanced_dlg.about_title}

            +

            Version: ()

            +

            TinyMCE is a platform independent web based Javascript HTML WYSIWYG editor control released as Open Source under LGPL + by Moxiecode Systems AB. It has the ability to convert HTML TEXTAREA fields or other HTML elements to editor instances.

            +

            Copyright © 2003-2008, Moxiecode Systems AB, All rights reserved.

            +

            For more information about this software visit the TinyMCE website.

            + +
            + Got Moxie? +
            +
            + +
            +
            +

            {#advanced_dlg.about_loaded}

            + +
            +
            + +

             

            +
            +
            + +
            +
            +
            +
            + +
            + +
            + + diff --git a/src/wp-includes/js/tinymce/themes/advanced/anchor.htm b/src/wp-includes/js/tinymce/themes/advanced/anchor.htm new file mode 100644 index 0000000..7f2b942 --- /dev/null +++ b/src/wp-includes/js/tinymce/themes/advanced/anchor.htm @@ -0,0 +1,31 @@ + + + + {#advanced_dlg.anchor_title} + + + + +
            + + + + + + + + +
            {#advanced_dlg.anchor_title}
            + +
            +
            + +
            + +
            + +
            +
            +
            + + diff --git a/src/wp-includes/js/tinymce/themes/advanced/charmap.htm b/src/wp-includes/js/tinymce/themes/advanced/charmap.htm new file mode 100644 index 0000000..9b7a3ac --- /dev/null +++ b/src/wp-includes/js/tinymce/themes/advanced/charmap.htm @@ -0,0 +1,51 @@ + + + + {#advanced_dlg.charmap_title} + + + + + + + + + + + + + + + +
            + + + + + + + + + +
             
             
            +
            + + + + + + + + + + + + + + + + +
             
             
             
            +
            + + diff --git a/src/wp-includes/js/tinymce/themes/advanced/color_picker.htm b/src/wp-includes/js/tinymce/themes/advanced/color_picker.htm new file mode 100644 index 0000000..b26e5cc --- /dev/null +++ b/src/wp-includes/js/tinymce/themes/advanced/color_picker.htm @@ -0,0 +1,76 @@ + + + + {#advanced_dlg.colorpicker_title} + + + + + + +
            + + +
            +
            +
            + {#advanced_dlg.colorpicker_picker_title} +
            + + +
            + +
            + +
            +
            +
            +
            + +
            +
            + {#advanced_dlg.colorpicker_palette_title} +
            + +
            + +
            +
            +
            + +
            +
            + {#advanced_dlg.colorpicker_named_title} +
            + +
            + +
            + +
            + {#advanced_dlg.colorpicker_name} +
            +
            +
            +
            + +
            +
            + +
            + +
            + +
            + +
            +
            +
            + + diff --git a/src/wp-includes/js/tinymce/themes/advanced/editor_template.js b/src/wp-includes/js/tinymce/themes/advanced/editor_template.js new file mode 100644 index 0000000..ba8dd4c --- /dev/null +++ b/src/wp-includes/js/tinymce/themes/advanced/editor_template.js @@ -0,0 +1 @@ +(function(e){var d=e.DOM,b=e.dom.Event,h=e.extend,f=e.each,a=e.util.Cookie,g,c=e.explode;e.ThemeManager.requireLangPack("advanced");e.create("tinymce.themes.AdvancedTheme",{sizes:[8,10,12,14,18,24,36],controls:{bold:["bold_desc","Bold"],italic:["italic_desc","Italic"],underline:["underline_desc","Underline"],strikethrough:["striketrough_desc","Strikethrough"],justifyleft:["justifyleft_desc","JustifyLeft"],justifycenter:["justifycenter_desc","JustifyCenter"],justifyright:["justifyright_desc","JustifyRight"],justifyfull:["justifyfull_desc","JustifyFull"],bullist:["bullist_desc","InsertUnorderedList"],numlist:["numlist_desc","InsertOrderedList"],outdent:["outdent_desc","Outdent"],indent:["indent_desc","Indent"],cut:["cut_desc","Cut"],copy:["copy_desc","Copy"],paste:["paste_desc","Paste"],undo:["undo_desc","Undo"],redo:["redo_desc","Redo"],link:["link_desc","mceLink"],unlink:["unlink_desc","unlink"],image:["image_desc","mceImage"],cleanup:["cleanup_desc","mceCleanup"],help:["help_desc","mceHelp"],code:["code_desc","mceCodeEditor"],hr:["hr_desc","InsertHorizontalRule"],removeformat:["removeformat_desc","RemoveFormat"],sub:["sub_desc","subscript"],sup:["sup_desc","superscript"],forecolor:["forecolor_desc","ForeColor"],forecolorpicker:["forecolor_desc","mceForeColor"],backcolor:["backcolor_desc","HiliteColor"],backcolorpicker:["backcolor_desc","mceBackColor"],charmap:["charmap_desc","mceCharMap"],visualaid:["visualaid_desc","mceToggleVisualAid"],anchor:["anchor_desc","mceInsertAnchor"],newdocument:["newdocument_desc","mceNewDocument"],blockquote:["blockquote_desc","mceBlockQuote"]},stateControls:["bold","italic","underline","strikethrough","bullist","numlist","justifyleft","justifycenter","justifyright","justifyfull","sub","sup","blockquote"],init:function(j,k){var l=this,m,i,n;l.editor=j;l.url=k;l.onResolveName=new e.util.Dispatcher(this);j.forcedHighContrastMode=j.settings.detect_highcontrast&&l._isHighContrast();j.settings.skin=j.forcedHighContrastMode?"highcontrast":j.settings.skin;l.settings=m=h({theme_advanced_path:true,theme_advanced_toolbar_location:"bottom",theme_advanced_buttons1:"bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect",theme_advanced_buttons2:"bullist,numlist,|,outdent,indent,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code",theme_advanced_buttons3:"hr,removeformat,visualaid,|,sub,sup,|,charmap",theme_advanced_blockformats:"p,address,pre,h1,h2,h3,h4,h5,h6",theme_advanced_toolbar_align:"center",theme_advanced_fonts:"Andale Mono=andale mono,times;Arial=arial,helvetica,sans-serif;Arial Black=arial black,avant garde;Book Antiqua=book antiqua,palatino;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier;Georgia=georgia,palatino;Helvetica=helvetica;Impact=impact,chicago;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco;Times New Roman=times new roman,times;Trebuchet MS=trebuchet ms,geneva;Verdana=verdana,geneva;Webdings=webdings;Wingdings=wingdings,zapf dingbats",theme_advanced_more_colors:1,theme_advanced_row_height:23,theme_advanced_resize_horizontal:1,theme_advanced_resizing_use_cookie:1,theme_advanced_font_sizes:"1,2,3,4,5,6,7",theme_advanced_font_selector:"span",theme_advanced_show_current_color:0,readonly:j.settings.readonly},j.settings);if(!m.font_size_style_values){m.font_size_style_values="8pt,10pt,12pt,14pt,18pt,24pt,36pt"}if(e.is(m.theme_advanced_font_sizes,"string")){m.font_size_style_values=e.explode(m.font_size_style_values);m.font_size_classes=e.explode(m.font_size_classes||"");n={};j.settings.theme_advanced_font_sizes=m.theme_advanced_font_sizes;f(j.getParam("theme_advanced_font_sizes","","hash"),function(q,p){var o;if(p==q&&q>=1&&q<=7){p=q+" ("+l.sizes[q-1]+"pt)";o=m.font_size_classes[q-1];q=m.font_size_style_values[q-1]||(l.sizes[q-1]+"pt")}if(/^\s*\./.test(q)){o=q.replace(/\./g,"")}n[p]=o?{"class":o}:{fontSize:q}});m.theme_advanced_font_sizes=n}if((i=m.theme_advanced_path_location)&&i!="none"){m.theme_advanced_statusbar_location=m.theme_advanced_path_location}if(m.theme_advanced_statusbar_location=="none"){m.theme_advanced_statusbar_location=0}if(j.settings.content_css!==false){j.contentCSS.push(j.baseURI.toAbsolute(k+"/skins/"+j.settings.skin+"/content.css"))}j.onInit.add(function(){if(!j.settings.readonly){j.onNodeChange.add(l._nodeChanged,l);j.onKeyUp.add(l._updateUndoStatus,l);j.onMouseUp.add(l._updateUndoStatus,l);j.dom.bind(j.dom.getRoot(),"dragend",function(){l._updateUndoStatus(j)})}});j.onSetProgressState.add(function(q,o,r){var s,t=q.id,p;if(o){l.progressTimer=setTimeout(function(){s=q.getContainer();s=s.insertBefore(d.create("DIV",{style:"position:relative"}),s.firstChild);p=d.get(q.id+"_tbl");d.add(s,"div",{id:t+"_blocker","class":"mceBlocker",style:{width:p.clientWidth+2,height:p.clientHeight+2}});d.add(s,"div",{id:t+"_progress","class":"mceProgress",style:{left:p.clientWidth/2,top:p.clientHeight/2}})},r||0)}else{d.remove(t+"_blocker");d.remove(t+"_progress");clearTimeout(l.progressTimer)}});d.loadCSS(m.editor_css?j.documentBaseURI.toAbsolute(m.editor_css):k+"/skins/"+j.settings.skin+"/ui.css");if(m.skin_variant){d.loadCSS(k+"/skins/"+j.settings.skin+"/ui_"+m.skin_variant+".css")}},_isHighContrast:function(){var i,j=d.add(d.getRoot(),"div",{style:"background-color: rgb(171,239,86);"});i=(d.getStyle(j,"background-color",true)+"").toLowerCase().replace(/ /g,"");d.remove(j);return i!="rgb(171,239,86)"&&i!="#abef56"},createControl:function(l,i){var j,k;if(k=i.createControl(l)){return k}switch(l){case"styleselect":return this._createStyleSelect();case"formatselect":return this._createBlockFormats();case"fontselect":return this._createFontSelect();case"fontsizeselect":return this._createFontSizeSelect();case"forecolor":return this._createForeColorMenu();case"backcolor":return this._createBackColorMenu()}if((j=this.controls[l])){return i.createButton(l,{title:"advanced."+j[0],cmd:j[1],ui:j[2],value:j[3]})}},execCommand:function(k,j,l){var i=this["_"+k];if(i){i.call(this,j,l);return true}return false},_importClasses:function(k){var i=this.editor,j=i.controlManager.get("styleselect");if(j.getLength()==0){f(i.dom.getClasses(),function(n,l){var m="style_"+l;i.formatter.register(m,{inline:"span",attributes:{"class":n["class"]},selector:"*"});j.add(n["class"],m)})}},_createStyleSelect:function(m){var k=this,i=k.editor,j=i.controlManager,l;l=j.createListBox("styleselect",{title:"advanced.style_select",onselect:function(o){var p,n=[];f(l.items,function(q){n.push(q.value)});i.focus();i.undoManager.add();p=i.formatter.matchAll(n);if(!o||p[0]==o){if(p[0]){i.formatter.remove(p[0])}}else{i.formatter.apply(o)}i.undoManager.add();i.nodeChanged();return false}});i.onInit.add(function(){var o=0,n=i.getParam("style_formats");if(n){f(n,function(p){var q,r=0;f(p,function(){r++});if(r>1){q=p.name=p.name||"style_"+(o++);i.formatter.register(q,p);l.add(p.title,q)}else{l.add(p.title)}})}else{f(i.getParam("theme_advanced_styles","","hash"),function(r,q){var p;if(r){p="style_"+(o++);i.formatter.register(p,{inline:"span",classes:r,selector:"*"});l.add(k.editor.translate(q),p)}})}});if(l.getLength()==0){l.onPostRender.add(function(o,p){if(!l.NativeListBox){b.add(p.id+"_text","focus",k._importClasses,k);b.add(p.id+"_text","mousedown",k._importClasses,k);b.add(p.id+"_open","focus",k._importClasses,k);b.add(p.id+"_open","mousedown",k._importClasses,k)}else{b.add(p.id,"focus",k._importClasses,k)}})}return l},_createFontSelect:function(){var k,j=this,i=j.editor;k=i.controlManager.createListBox("fontselect",{title:"advanced.fontdefault",onselect:function(l){var m=k.items[k.selectedIndex];if(!l&&m){i.execCommand("FontName",false,m.value);return}i.execCommand("FontName",false,l);k.select(function(n){return l==n});if(m&&m.value==l){k.select(null)}return false}});if(k){f(i.getParam("theme_advanced_fonts",j.settings.theme_advanced_fonts,"hash"),function(m,l){k.add(i.translate(l),m,{style:m.indexOf("dings")==-1?"font-family:"+m:""})})}return k},_createFontSizeSelect:function(){var m=this,k=m.editor,n,l=0,j=[];n=k.controlManager.createListBox("fontsizeselect",{title:"advanced.font_size",onselect:function(i){var o=n.items[n.selectedIndex];if(!i&&o){o=o.value;if(o["class"]){k.formatter.toggle("fontsize_class",{value:o["class"]});k.undoManager.add();k.nodeChanged()}else{k.execCommand("FontSize",false,o.fontSize)}return}if(i["class"]){k.focus();k.undoManager.add();k.formatter.toggle("fontsize_class",{value:i["class"]});k.undoManager.add();k.nodeChanged()}else{k.execCommand("FontSize",false,i.fontSize)}n.select(function(p){return i==p});if(o&&(o.value.fontSize==i.fontSize||o.value["class"]==i["class"])){n.select(null)}return false}});if(n){f(m.settings.theme_advanced_font_sizes,function(o,i){var p=o.fontSize;if(p>=1&&p<=7){p=m.sizes[parseInt(p)-1]+"pt"}n.add(i,o,{style:"font-size:"+p,"class":"mceFontSize"+(l++)+(" "+(o["class"]||""))})})}return n},_createBlockFormats:function(){var k,i={p:"advanced.paragraph",address:"advanced.address",pre:"advanced.pre",h1:"advanced.h1",h2:"advanced.h2",h3:"advanced.h3",h4:"advanced.h4",h5:"advanced.h5",h6:"advanced.h6",div:"advanced.div",blockquote:"advanced.blockquote",code:"advanced.code",dt:"advanced.dt",dd:"advanced.dd",samp:"advanced.samp"},j=this;k=j.editor.controlManager.createListBox("formatselect",{title:"advanced.block",onselect:function(l){j.editor.execCommand("FormatBlock",false,l);return false}});if(k){f(j.editor.getParam("theme_advanced_blockformats",j.settings.theme_advanced_blockformats,"hash"),function(m,l){k.add(j.editor.translate(l!=m?l:i[m]),m,{"class":"mce_formatPreview mce_"+m})})}return k},_createForeColorMenu:function(){var m,j=this,k=j.settings,l={},i;if(k.theme_advanced_more_colors){l.more_colors_func=function(){j._mceColorPicker(0,{color:m.value,func:function(n){m.setColor(n)}})}}if(i=k.theme_advanced_text_colors){l.colors=i}if(k.theme_advanced_default_foreground_color){l.default_color=k.theme_advanced_default_foreground_color}l.title="advanced.forecolor_desc";l.cmd="ForeColor";l.scope=this;m=j.editor.controlManager.createColorSplitButton("forecolor",l);return m},_createBackColorMenu:function(){var m,j=this,k=j.settings,l={},i;if(k.theme_advanced_more_colors){l.more_colors_func=function(){j._mceColorPicker(0,{color:m.value,func:function(n){m.setColor(n)}})}}if(i=k.theme_advanced_background_colors){l.colors=i}if(k.theme_advanced_default_background_color){l.default_color=k.theme_advanced_default_background_color}l.title="advanced.backcolor_desc";l.cmd="HiliteColor";l.scope=this;m=j.editor.controlManager.createColorSplitButton("backcolor",l);return m},renderUI:function(k){var m,l,q,v=this,r=v.editor,w=v.settings,u,j,i;if(r.settings){r.settings.aria_label=w.aria_label+r.getLang("advanced.help_shortcut")}m=j=d.create("span",{role:"application","aria-labelledby":r.id+"_voice",id:r.id+"_parent","class":"mceEditor "+r.settings.skin+"Skin"+(w.skin_variant?" "+r.settings.skin+"Skin"+v._ufirst(w.skin_variant):"")});d.add(m,"span",{"class":"mceVoiceLabel",style:"display:none;",id:r.id+"_voice"},w.aria_label);if(!d.boxModel){m=d.add(m,"div",{"class":"mceOldBoxModel"})}m=u=d.add(m,"table",{role:"presentation",id:r.id+"_tbl","class":"mceLayout",cellSpacing:0,cellPadding:0});m=q=d.add(m,"tbody");switch((w.theme_advanced_layout_manager||"").toLowerCase()){case"rowlayout":l=v._rowLayout(w,q,k);break;case"customlayout":l=r.execCallback("theme_advanced_custom_layout",w,q,k,j);break;default:l=v._simpleLayout(w,q,k,j)}m=k.targetNode;i=u.rows;d.addClass(i[0],"mceFirst");d.addClass(i[i.length-1],"mceLast");f(d.select("tr",q),function(o){d.addClass(o.firstChild,"mceFirst");d.addClass(o.childNodes[o.childNodes.length-1],"mceLast")});if(d.get(w.theme_advanced_toolbar_container)){d.get(w.theme_advanced_toolbar_container).appendChild(j)}else{d.insertAfter(j,m)}b.add(r.id+"_path_row","click",function(n){n=n.target;if(n.nodeName=="A"){v._sel(n.className.replace(/^.*mcePath_([0-9]+).*$/,"$1"));return b.cancel(n)}});if(!r.getParam("accessibility_focus")){b.add(d.add(j,"a",{href:"#"},""),"focus",function(){tinyMCE.get(r.id).focus()})}if(w.theme_advanced_toolbar_location=="external"){k.deltaHeight=0}v.deltaHeight=k.deltaHeight;k.targetNode=null;r.onKeyDown.add(function(p,n){var s=121,o=122;if(n.altKey){if(n.keyCode===s){v.toolbarGroup.focus();return b.cancel(n)}else{if(n.keyCode===o){d.get(p.id+"_path_row").focus();return b.cancel(n)}}}});r.addShortcut("alt+0","","mceShortcuts",v);return{iframeContainer:l,editorContainer:r.id+"_parent",sizeContainer:u,deltaHeight:k.deltaHeight}},getInfo:function(){return{longname:"Advanced theme",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",version:e.majorVersion+"."+e.minorVersion}},resizeBy:function(i,j){var k=d.get(this.editor.id+"_ifr");this.resizeTo(k.clientWidth+i,k.clientHeight+j)},resizeTo:function(i,m,k){var j=this.editor,l=this.settings,n=d.get(j.id+"_tbl"),o=d.get(j.id+"_ifr");i=Math.max(l.theme_advanced_resizing_min_width||100,i);m=Math.max(l.theme_advanced_resizing_min_height||100,m);i=Math.min(l.theme_advanced_resizing_max_width||65535,i);m=Math.min(l.theme_advanced_resizing_max_height||65535,m);d.setStyle(n,"height","");d.setStyle(o,"height",m);if(l.theme_advanced_resize_horizontal){d.setStyle(n,"width","");d.setStyle(o,"width",i);if(i"));d.setHTML(l,q.join(""))},_addStatusBar:function(m,j){var k,v=this,p=v.editor,w=v.settings,i,q,u,l;k=d.add(m,"tr");k=l=d.add(k,"td",{"class":"mceStatusbar"});k=d.add(k,"div",{id:p.id+"_path_row",role:"group","aria-labelledby":p.id+"_path_voice"});if(w.theme_advanced_path){d.add(k,"span",{id:p.id+"_path_voice"},p.translate("advanced.path"));d.add(k,"span",{},": ")}else{d.add(k,"span",{}," ")}if(w.theme_advanced_resizing){d.add(l,"a",{id:p.id+"_resize",href:"javascript:;",onclick:"return false;","class":"mceResize"});if(w.theme_advanced_resizing_use_cookie){p.onPostRender.add(function(){var n=a.getHash("TinyMCE_"+p.id+"_size"),r=d.get(p.id+"_tbl");if(!n){return}v.resizeTo(n.cw,n.ch)})}p.onPostRender.add(function(){b.add(p.id+"_resize","click",function(n){n.preventDefault()});b.add(p.id+"_resize","mousedown",function(D){var t,r,s,o,C,z,A,F,n,E,x;function y(G){G.preventDefault();n=A+(G.screenX-C);E=F+(G.screenY-z);v.resizeTo(n,E)}function B(G){b.remove(d.doc,"mousemove",t);b.remove(p.getDoc(),"mousemove",r);b.remove(d.doc,"mouseup",s);b.remove(p.getDoc(),"mouseup",o);n=A+(G.screenX-C);E=F+(G.screenY-z);v.resizeTo(n,E,true)}D.preventDefault();C=D.screenX;z=D.screenY;x=d.get(v.editor.id+"_ifr");A=n=x.clientWidth;F=E=x.clientHeight;t=b.add(d.doc,"mousemove",y);r=b.add(p.getDoc(),"mousemove",y);s=b.add(d.doc,"mouseup",B);o=b.add(p.getDoc(),"mouseup",B)})})}j.deltaHeight-=21;k=m=null},_updateUndoStatus:function(j){var i=j.controlManager;i.setDisabled("undo",!j.undoManager.hasUndo()&&!j.typing);i.setDisabled("redo",!j.undoManager.hasRedo())},_nodeChanged:function(m,r,D,q,E){var y=this,C,F=0,x,G,z=y.settings,w,k,u,B,l,j,i;e.each(y.stateControls,function(n){r.setActive(n,m.queryCommandState(y.controls[n][1]))});function o(p){var s,n=E.parents,t=p;if(typeof(p)=="string"){t=function(v){return v.nodeName==p}}for(s=0;s0){y.statusKeyboardNavigation=new e.ui.KeyboardNavigation({root:m.id+"_path_row",items:d.select("a",C),excludeFromTabOrder:true,onCancel:function(){m.focus()}},d)}}},_sel:function(i){this.editor.execCommand("mceSelectNodeDepth",false,i)},_mceInsertAnchor:function(k,j){var i=this.editor;i.windowManager.open({url:this.url+"/anchor.htm",width:320+parseInt(i.getLang("advanced.anchor_delta_width",0)),height:90+parseInt(i.getLang("advanced.anchor_delta_height",0)),inline:true},{theme_url:this.url})},_mceCharMap:function(){var i=this.editor;i.windowManager.open({url:this.url+"/charmap.htm",width:550+parseInt(i.getLang("advanced.charmap_delta_width",0)),height:250+parseInt(i.getLang("advanced.charmap_delta_height",0)),inline:true},{theme_url:this.url})},_mceHelp:function(){var i=this.editor;i.windowManager.open({url:this.url+"/about.htm",width:480,height:380,inline:true},{theme_url:this.url})},_mceShortcuts:function(){var i=this.editor;i.windowManager.open({url:this.url+"/shortcuts.htm",width:480,height:380,inline:true},{theme_url:this.url})},_mceColorPicker:function(k,j){var i=this.editor;j=j||{};i.windowManager.open({url:this.url+"/color_picker.htm",width:375+parseInt(i.getLang("advanced.colorpicker_delta_width",0)),height:250+parseInt(i.getLang("advanced.colorpicker_delta_height",0)),close_previous:false,inline:true},{input_color:j.color,func:j.func,theme_url:this.url})},_mceCodeEditor:function(j,k){var i=this.editor;i.windowManager.open({url:this.url+"/source_editor.htm",width:parseInt(i.getParam("theme_advanced_source_editor_width",720)),height:parseInt(i.getParam("theme_advanced_source_editor_height",580)),inline:true,resizable:true,maximizable:true},{theme_url:this.url})},_mceImage:function(j,k){var i=this.editor;if(i.dom.getAttrib(i.selection.getNode(),"class").indexOf("mceItem")!=-1){return}i.windowManager.open({url:this.url+"/image.htm",width:355+parseInt(i.getLang("advanced.image_delta_width",0)),height:275+parseInt(i.getLang("advanced.image_delta_height",0)),inline:true},{theme_url:this.url})},_mceLink:function(j,k){var i=this.editor;i.windowManager.open({url:this.url+"/link.htm",width:310+parseInt(i.getLang("advanced.link_delta_width",0)),height:200+parseInt(i.getLang("advanced.link_delta_height",0)),inline:true},{theme_url:this.url})},_mceNewDocument:function(){var i=this.editor;i.windowManager.confirm("advanced.newdocument",function(j){if(j){i.execCommand("mceSetContent",false,"")}})},_mceForeColor:function(){var i=this;this._mceColorPicker(0,{color:i.fgColor,func:function(j){i.fgColor=j;i.editor.execCommand("ForeColor",false,j)}})},_mceBackColor:function(){var i=this;this._mceColorPicker(0,{color:i.bgColor,func:function(j){i.bgColor=j;i.editor.execCommand("HiliteColor",false,j)}})},_ufirst:function(i){return i.substring(0,1).toUpperCase()+i.substring(1)}});e.ThemeManager.add("advanced",e.themes.AdvancedTheme)}(tinymce)); \ No newline at end of file diff --git a/src/wp-includes/js/tinymce/themes/advanced/image.htm b/src/wp-includes/js/tinymce/themes/advanced/image.htm new file mode 100644 index 0000000..8427381 --- /dev/null +++ b/src/wp-includes/js/tinymce/themes/advanced/image.htm @@ -0,0 +1,89 @@ + + + + {#advanced_dlg.image_title} + + + + + + +
            + + +
            +
            + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
            + + + + +
             
            + x +
            +
            +
            + +
            +
            + +
            + +
            + +
            +
            +
            + + diff --git a/src/wp-includes/js/tinymce/themes/advanced/img/colorpicker.jpg b/src/wp-includes/js/tinymce/themes/advanced/img/colorpicker.jpg new file mode 100644 index 0000000..b4c542d Binary files /dev/null and b/src/wp-includes/js/tinymce/themes/advanced/img/colorpicker.jpg differ diff --git a/src/wp-includes/js/tinymce/themes/advanced/img/flash.gif b/src/wp-includes/js/tinymce/themes/advanced/img/flash.gif new file mode 100644 index 0000000..cb192e6 Binary files /dev/null and b/src/wp-includes/js/tinymce/themes/advanced/img/flash.gif differ diff --git a/src/wp-includes/js/tinymce/themes/advanced/img/gotmoxie.png b/src/wp-includes/js/tinymce/themes/advanced/img/gotmoxie.png new file mode 100644 index 0000000..8a396e0 Binary files /dev/null and b/src/wp-includes/js/tinymce/themes/advanced/img/gotmoxie.png differ diff --git a/src/wp-includes/js/tinymce/themes/advanced/img/icons.gif b/src/wp-includes/js/tinymce/themes/advanced/img/icons.gif new file mode 100644 index 0000000..e46de53 Binary files /dev/null and b/src/wp-includes/js/tinymce/themes/advanced/img/icons.gif differ diff --git a/src/wp-includes/js/tinymce/themes/advanced/img/iframe.gif b/src/wp-includes/js/tinymce/themes/advanced/img/iframe.gif new file mode 100644 index 0000000..410c7ad Binary files /dev/null and b/src/wp-includes/js/tinymce/themes/advanced/img/iframe.gif differ diff --git a/src/wp-includes/js/tinymce/themes/advanced/img/pagebreak.gif b/src/wp-includes/js/tinymce/themes/advanced/img/pagebreak.gif new file mode 100644 index 0000000..acdf408 Binary files /dev/null and b/src/wp-includes/js/tinymce/themes/advanced/img/pagebreak.gif differ diff --git a/src/wp-includes/js/tinymce/themes/advanced/img/quicktime.gif b/src/wp-includes/js/tinymce/themes/advanced/img/quicktime.gif new file mode 100644 index 0000000..3b04991 Binary files /dev/null and b/src/wp-includes/js/tinymce/themes/advanced/img/quicktime.gif differ diff --git a/src/wp-includes/js/tinymce/themes/advanced/img/realmedia.gif b/src/wp-includes/js/tinymce/themes/advanced/img/realmedia.gif new file mode 100644 index 0000000..fdfe0b9 Binary files /dev/null and b/src/wp-includes/js/tinymce/themes/advanced/img/realmedia.gif differ diff --git a/src/wp-includes/js/tinymce/themes/advanced/img/shockwave.gif b/src/wp-includes/js/tinymce/themes/advanced/img/shockwave.gif new file mode 100644 index 0000000..5f235df Binary files /dev/null and b/src/wp-includes/js/tinymce/themes/advanced/img/shockwave.gif differ diff --git a/src/wp-includes/js/tinymce/themes/advanced/img/trans.gif b/src/wp-includes/js/tinymce/themes/advanced/img/trans.gif new file mode 100644 index 0000000..3884865 Binary files /dev/null and b/src/wp-includes/js/tinymce/themes/advanced/img/trans.gif differ diff --git a/src/wp-includes/js/tinymce/themes/advanced/img/video.gif b/src/wp-includes/js/tinymce/themes/advanced/img/video.gif new file mode 100644 index 0000000..3570104 Binary files /dev/null and b/src/wp-includes/js/tinymce/themes/advanced/img/video.gif differ diff --git a/src/wp-includes/js/tinymce/themes/advanced/img/windowsmedia.gif b/src/wp-includes/js/tinymce/themes/advanced/img/windowsmedia.gif new file mode 100644 index 0000000..ab50f2d Binary files /dev/null and b/src/wp-includes/js/tinymce/themes/advanced/img/windowsmedia.gif differ diff --git a/src/wp-includes/js/tinymce/themes/advanced/img/wpicons.png b/src/wp-includes/js/tinymce/themes/advanced/img/wpicons.png new file mode 100644 index 0000000..17c2eee Binary files /dev/null and b/src/wp-includes/js/tinymce/themes/advanced/img/wpicons.png differ diff --git a/src/wp-includes/js/tinymce/themes/advanced/js/about.js b/src/wp-includes/js/tinymce/themes/advanced/js/about.js new file mode 100644 index 0000000..daf4909 --- /dev/null +++ b/src/wp-includes/js/tinymce/themes/advanced/js/about.js @@ -0,0 +1,73 @@ +tinyMCEPopup.requireLangPack(); + +function init() { + var ed, tcont; + + tinyMCEPopup.resizeToInnerSize(); + ed = tinyMCEPopup.editor; + + // Give FF some time + window.setTimeout(insertHelpIFrame, 10); + + tcont = document.getElementById('plugintablecontainer'); + document.getElementById('plugins_tab').style.display = 'none'; + + var html = ""; + html += ''; + html += ''; + html += ''; + html += ''; + html += ''; + html += ''; + html += ''; + html += ''; + html += ''; + + tinymce.each(ed.plugins, function(p, n) { + var info; + + if (!p.getInfo) + return; + + html += ''; + + info = p.getInfo(); + + if (info.infourl != null && info.infourl != '') + html += ''; + else + html += ''; + + if (info.authorurl != null && info.authorurl != '') + html += ''; + else + html += ''; + + html += ''; + html += ''; + + document.getElementById('plugins_tab').style.display = ''; + + }); + + html += ''; + html += '
            ' + ed.getLang('advanced_dlg.about_plugin') + '' + ed.getLang('advanced_dlg.about_author') + '' + ed.getLang('advanced_dlg.about_version') + '
            ' + info.longname + '' + info.longname + '' + info.author + '' + info.author + '' + info.version + '
            '; + + tcont.innerHTML = html; + + tinyMCEPopup.dom.get('version').innerHTML = tinymce.majorVersion + "." + tinymce.minorVersion; + tinyMCEPopup.dom.get('date').innerHTML = tinymce.releaseDate; +} + +function insertHelpIFrame() { + var html; + + if (tinyMCEPopup.getParam('docs_url')) { + html = ''; + document.getElementById('iframecontainer').innerHTML = html; + document.getElementById('help_tab').style.display = 'block'; + document.getElementById('help_tab').setAttribute("aria-hidden", "false"); + } +} + +tinyMCEPopup.onInit.add(init); diff --git a/src/wp-includes/js/tinymce/themes/advanced/js/anchor.js b/src/wp-includes/js/tinymce/themes/advanced/js/anchor.js new file mode 100644 index 0000000..7b55635 --- /dev/null +++ b/src/wp-includes/js/tinymce/themes/advanced/js/anchor.js @@ -0,0 +1,42 @@ +tinyMCEPopup.requireLangPack(); + +var AnchorDialog = { + init : function(ed) { + var action, elm, f = document.forms[0]; + + this.editor = ed; + elm = ed.dom.getParent(ed.selection.getNode(), 'A'); + v = ed.dom.getAttrib(elm, 'name'); + + if (v) { + this.action = 'update'; + f.anchorName.value = v; + } + + f.insert.value = ed.getLang(elm ? 'update' : 'insert'); + }, + + update : function() { + var ed = this.editor, elm, name = document.forms[0].anchorName.value; + + if (!name || !/^[a-z][a-z0-9\-\_:\.]*$/i.test(name)) { + tinyMCEPopup.alert('advanced_dlg.anchor_invalid'); + return; + } + + tinyMCEPopup.restoreSelection(); + + if (this.action != 'update') + ed.selection.collapse(1); + + elm = ed.dom.getParent(ed.selection.getNode(), 'A'); + if (elm) + elm.name = name; + else + ed.execCommand('mceInsertContent', 0, ed.dom.createHTML('a', {name : name, 'class' : 'mceItemAnchor'}, '')); + + tinyMCEPopup.close(); + } +}; + +tinyMCEPopup.onInit.add(AnchorDialog.init, AnchorDialog); diff --git a/src/wp-includes/js/tinymce/themes/advanced/js/charmap.js b/src/wp-includes/js/tinymce/themes/advanced/js/charmap.js new file mode 100644 index 0000000..78bc080 --- /dev/null +++ b/src/wp-includes/js/tinymce/themes/advanced/js/charmap.js @@ -0,0 +1,355 @@ +/** + * charmap.js + * + * Copyright 2009, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://tinymce.moxiecode.com/license + * Contributing: http://tinymce.moxiecode.com/contributing + */ + +tinyMCEPopup.requireLangPack(); + +var charmap = [ + [' ', ' ', true, 'no-break space'], + ['&', '&', true, 'ampersand'], + ['"', '"', true, 'quotation mark'], +// finance + ['¢', '¢', true, 'cent sign'], + ['€', '€', true, 'euro sign'], + ['£', '£', true, 'pound sign'], + ['¥', '¥', true, 'yen sign'], +// signs + ['©', '©', true, 'copyright sign'], + ['®', '®', true, 'registered sign'], + ['™', '™', true, 'trade mark sign'], + ['‰', '‰', true, 'per mille sign'], + ['µ', 'µ', true, 'micro sign'], + ['·', '·', true, 'middle dot'], + ['•', '•', true, 'bullet'], + ['…', '…', true, 'three dot leader'], + ['′', '′', true, 'minutes / feet'], + ['″', '″', true, 'seconds / inches'], + ['§', '§', true, 'section sign'], + ['¶', '¶', true, 'paragraph sign'], + ['ß', 'ß', true, 'sharp s / ess-zed'], +// quotations + ['‹', '‹', true, 'single left-pointing angle quotation mark'], + ['›', '›', true, 'single right-pointing angle quotation mark'], + ['«', '«', true, 'left pointing guillemet'], + ['»', '»', true, 'right pointing guillemet'], + ['‘', '‘', true, 'left single quotation mark'], + ['’', '’', true, 'right single quotation mark'], + ['“', '“', true, 'left double quotation mark'], + ['”', '”', true, 'right double quotation mark'], + ['‚', '‚', true, 'single low-9 quotation mark'], + ['„', '„', true, 'double low-9 quotation mark'], + ['<', '<', true, 'less-than sign'], + ['>', '>', true, 'greater-than sign'], + ['≤', '≤', true, 'less-than or equal to'], + ['≥', '≥', true, 'greater-than or equal to'], + ['–', '–', true, 'en dash'], + ['—', '—', true, 'em dash'], + ['¯', '¯', true, 'macron'], + ['‾', '‾', true, 'overline'], + ['¤', '¤', true, 'currency sign'], + ['¦', '¦', true, 'broken bar'], + ['¨', '¨', true, 'diaeresis'], + ['¡', '¡', true, 'inverted exclamation mark'], + ['¿', '¿', true, 'turned question mark'], + ['ˆ', 'ˆ', true, 'circumflex accent'], + ['˜', '˜', true, 'small tilde'], + ['°', '°', true, 'degree sign'], + ['−', '−', true, 'minus sign'], + ['±', '±', true, 'plus-minus sign'], + ['÷', '÷', true, 'division sign'], + ['⁄', '⁄', true, 'fraction slash'], + ['×', '×', true, 'multiplication sign'], + ['¹', '¹', true, 'superscript one'], + ['²', '²', true, 'superscript two'], + ['³', '³', true, 'superscript three'], + ['¼', '¼', true, 'fraction one quarter'], + ['½', '½', true, 'fraction one half'], + ['¾', '¾', true, 'fraction three quarters'], +// math / logical + ['ƒ', 'ƒ', true, 'function / florin'], + ['∫', '∫', true, 'integral'], + ['∑', '∑', true, 'n-ary sumation'], + ['∞', '∞', true, 'infinity'], + ['√', '√', true, 'square root'], + ['∼', '∼', false,'similar to'], + ['≅', '≅', false,'approximately equal to'], + ['≈', '≈', true, 'almost equal to'], + ['≠', '≠', true, 'not equal to'], + ['≡', '≡', true, 'identical to'], + ['∈', '∈', false,'element of'], + ['∉', '∉', false,'not an element of'], + ['∋', '∋', false,'contains as member'], + ['∏', '∏', true, 'n-ary product'], + ['∧', '∧', false,'logical and'], + ['∨', '∨', false,'logical or'], + ['¬', '¬', true, 'not sign'], + ['∩', '∩', true, 'intersection'], + ['∪', '∪', false,'union'], + ['∂', '∂', true, 'partial differential'], + ['∀', '∀', false,'for all'], + ['∃', '∃', false,'there exists'], + ['∅', '∅', false,'diameter'], + ['∇', '∇', false,'backward difference'], + ['∗', '∗', false,'asterisk operator'], + ['∝', '∝', false,'proportional to'], + ['∠', '∠', false,'angle'], +// undefined + ['´', '´', true, 'acute accent'], + ['¸', '¸', true, 'cedilla'], + ['ª', 'ª', true, 'feminine ordinal indicator'], + ['º', 'º', true, 'masculine ordinal indicator'], + ['†', '†', true, 'dagger'], + ['‡', '‡', true, 'double dagger'], +// alphabetical special chars + ['À', 'À', true, 'A - grave'], + ['Á', 'Á', true, 'A - acute'], + ['Â', 'Â', true, 'A - circumflex'], + ['Ã', 'Ã', true, 'A - tilde'], + ['Ä', 'Ä', true, 'A - diaeresis'], + ['Å', 'Å', true, 'A - ring above'], + ['Æ', 'Æ', true, 'ligature AE'], + ['Ç', 'Ç', true, 'C - cedilla'], + ['È', 'È', true, 'E - grave'], + ['É', 'É', true, 'E - acute'], + ['Ê', 'Ê', true, 'E - circumflex'], + ['Ë', 'Ë', true, 'E - diaeresis'], + ['Ì', 'Ì', true, 'I - grave'], + ['Í', 'Í', true, 'I - acute'], + ['Î', 'Î', true, 'I - circumflex'], + ['Ï', 'Ï', true, 'I - diaeresis'], + ['Ð', 'Ð', true, 'ETH'], + ['Ñ', 'Ñ', true, 'N - tilde'], + ['Ò', 'Ò', true, 'O - grave'], + ['Ó', 'Ó', true, 'O - acute'], + ['Ô', 'Ô', true, 'O - circumflex'], + ['Õ', 'Õ', true, 'O - tilde'], + ['Ö', 'Ö', true, 'O - diaeresis'], + ['Ø', 'Ø', true, 'O - slash'], + ['Œ', 'Œ', true, 'ligature OE'], + ['Š', 'Š', true, 'S - caron'], + ['Ù', 'Ù', true, 'U - grave'], + ['Ú', 'Ú', true, 'U - acute'], + ['Û', 'Û', true, 'U - circumflex'], + ['Ü', 'Ü', true, 'U - diaeresis'], + ['Ý', 'Ý', true, 'Y - acute'], + ['Ÿ', 'Ÿ', true, 'Y - diaeresis'], + ['Þ', 'Þ', true, 'THORN'], + ['à', 'à', true, 'a - grave'], + ['á', 'á', true, 'a - acute'], + ['â', 'â', true, 'a - circumflex'], + ['ã', 'ã', true, 'a - tilde'], + ['ä', 'ä', true, 'a - diaeresis'], + ['å', 'å', true, 'a - ring above'], + ['æ', 'æ', true, 'ligature ae'], + ['ç', 'ç', true, 'c - cedilla'], + ['è', 'è', true, 'e - grave'], + ['é', 'é', true, 'e - acute'], + ['ê', 'ê', true, 'e - circumflex'], + ['ë', 'ë', true, 'e - diaeresis'], + ['ì', 'ì', true, 'i - grave'], + ['í', 'í', true, 'i - acute'], + ['î', 'î', true, 'i - circumflex'], + ['ï', 'ï', true, 'i - diaeresis'], + ['ð', 'ð', true, 'eth'], + ['ñ', 'ñ', true, 'n - tilde'], + ['ò', 'ò', true, 'o - grave'], + ['ó', 'ó', true, 'o - acute'], + ['ô', 'ô', true, 'o - circumflex'], + ['õ', 'õ', true, 'o - tilde'], + ['ö', 'ö', true, 'o - diaeresis'], + ['ø', 'ø', true, 'o slash'], + ['œ', 'œ', true, 'ligature oe'], + ['š', 'š', true, 's - caron'], + ['ù', 'ù', true, 'u - grave'], + ['ú', 'ú', true, 'u - acute'], + ['û', 'û', true, 'u - circumflex'], + ['ü', 'ü', true, 'u - diaeresis'], + ['ý', 'ý', true, 'y - acute'], + ['þ', 'þ', true, 'thorn'], + ['ÿ', 'ÿ', true, 'y - diaeresis'], + ['Α', 'Α', true, 'Alpha'], + ['Β', 'Β', true, 'Beta'], + ['Γ', 'Γ', true, 'Gamma'], + ['Δ', 'Δ', true, 'Delta'], + ['Ε', 'Ε', true, 'Epsilon'], + ['Ζ', 'Ζ', true, 'Zeta'], + ['Η', 'Η', true, 'Eta'], + ['Θ', 'Θ', true, 'Theta'], + ['Ι', 'Ι', true, 'Iota'], + ['Κ', 'Κ', true, 'Kappa'], + ['Λ', 'Λ', true, 'Lambda'], + ['Μ', 'Μ', true, 'Mu'], + ['Ν', 'Ν', true, 'Nu'], + ['Ξ', 'Ξ', true, 'Xi'], + ['Ο', 'Ο', true, 'Omicron'], + ['Π', 'Π', true, 'Pi'], + ['Ρ', 'Ρ', true, 'Rho'], + ['Σ', 'Σ', true, 'Sigma'], + ['Τ', 'Τ', true, 'Tau'], + ['Υ', 'Υ', true, 'Upsilon'], + ['Φ', 'Φ', true, 'Phi'], + ['Χ', 'Χ', true, 'Chi'], + ['Ψ', 'Ψ', true, 'Psi'], + ['Ω', 'Ω', true, 'Omega'], + ['α', 'α', true, 'alpha'], + ['β', 'β', true, 'beta'], + ['γ', 'γ', true, 'gamma'], + ['δ', 'δ', true, 'delta'], + ['ε', 'ε', true, 'epsilon'], + ['ζ', 'ζ', true, 'zeta'], + ['η', 'η', true, 'eta'], + ['θ', 'θ', true, 'theta'], + ['ι', 'ι', true, 'iota'], + ['κ', 'κ', true, 'kappa'], + ['λ', 'λ', true, 'lambda'], + ['μ', 'μ', true, 'mu'], + ['ν', 'ν', true, 'nu'], + ['ξ', 'ξ', true, 'xi'], + ['ο', 'ο', true, 'omicron'], + ['π', 'π', true, 'pi'], + ['ρ', 'ρ', true, 'rho'], + ['ς', 'ς', true, 'final sigma'], + ['σ', 'σ', true, 'sigma'], + ['τ', 'τ', true, 'tau'], + ['υ', 'υ', true, 'upsilon'], + ['φ', 'φ', true, 'phi'], + ['χ', 'χ', true, 'chi'], + ['ψ', 'ψ', true, 'psi'], + ['ω', 'ω', true, 'omega'], +// symbols + ['ℵ', 'ℵ', false,'alef symbol'], + ['ϖ', 'ϖ', false,'pi symbol'], + ['ℜ', 'ℜ', false,'real part symbol'], + ['ϑ','ϑ', false,'theta symbol'], + ['ϒ', 'ϒ', false,'upsilon - hook symbol'], + ['℘', '℘', false,'Weierstrass p'], + ['ℑ', 'ℑ', false,'imaginary part'], +// arrows + ['←', '←', true, 'leftwards arrow'], + ['↑', '↑', true, 'upwards arrow'], + ['→', '→', true, 'rightwards arrow'], + ['↓', '↓', true, 'downwards arrow'], + ['↔', '↔', true, 'left right arrow'], + ['↵', '↵', false,'carriage return'], + ['⇐', '⇐', false,'leftwards double arrow'], + ['⇑', '⇑', false,'upwards double arrow'], + ['⇒', '⇒', false,'rightwards double arrow'], + ['⇓', '⇓', false,'downwards double arrow'], + ['⇔', '⇔', false,'left right double arrow'], + ['∴', '∴', false,'therefore'], + ['⊂', '⊂', false,'subset of'], + ['⊃', '⊃', false,'superset of'], + ['⊄', '⊄', false,'not a subset of'], + ['⊆', '⊆', false,'subset of or equal to'], + ['⊇', '⊇', false,'superset of or equal to'], + ['⊕', '⊕', false,'circled plus'], + ['⊗', '⊗', false,'circled times'], + ['⊥', '⊥', false,'perpendicular'], + ['⋅', '⋅', false,'dot operator'], + ['⌈', '⌈', false,'left ceiling'], + ['⌉', '⌉', false,'right ceiling'], + ['⌊', '⌊', false,'left floor'], + ['⌋', '⌋', false,'right floor'], + ['⟨', '〈', false,'left-pointing angle bracket'], + ['⟩', '〉', false,'right-pointing angle bracket'], + ['◊', '◊', true, 'lozenge'], + ['♠', '♠', true, 'black spade suit'], + ['♣', '♣', true, 'black club suit'], + ['♥', '♥', true, 'black heart suit'], + ['♦', '♦', true, 'black diamond suit'], + [' ', ' ', false,'en space'], + [' ', ' ', false,'em space'], + [' ', ' ', false,'thin space'], + ['‌', '‌', false,'zero width non-joiner'], + ['‍', '‍', false,'zero width joiner'], + ['‎', '‎', false,'left-to-right mark'], + ['‏', '‏', false,'right-to-left mark'], + ['­', '­', false,'soft hyphen'] +]; + +tinyMCEPopup.onInit.add(function() { + tinyMCEPopup.dom.setHTML('charmapView', renderCharMapHTML()); + addKeyboardNavigation(); +}); + +function addKeyboardNavigation(){ + var tableElm, cells, settings; + + cells = tinyMCEPopup.dom.select(".charmaplink", "charmapgroup"); + + settings ={ + root: "charmapgroup", + items: cells + }; + + tinyMCEPopup.editor.windowManager.createInstance('tinymce.ui.KeyboardNavigation', settings, tinyMCEPopup.dom); +} + +function renderCharMapHTML() { + var charsPerRow = 20, tdWidth=20, tdHeight=20, i; + var html = '
            '+ + ''; + var cols=-1; + + for (i=0; i' + + '' + + charmap[i][1] + + ''; + if ((cols+1) % charsPerRow == 0) + html += ''; + } + } + + if (cols % charsPerRow > 0) { + var padd = charsPerRow - (cols % charsPerRow); + for (var i=0; i '; + } + + html += '
            '; + html = html.replace(/<\/tr>/g, ''); + + return html; +} + +function insertChar(chr) { + tinyMCEPopup.execCommand('mceInsertContent', false, '&#' + chr + ';'); + + // Refocus in window + if (tinyMCEPopup.isWindow) + window.focus(); + + tinyMCEPopup.editor.focus(); + tinyMCEPopup.close(); +} + +function previewChar(codeA, codeB, codeN) { + var elmA = document.getElementById('codeA'); + var elmB = document.getElementById('codeB'); + var elmV = document.getElementById('codeV'); + var elmN = document.getElementById('codeN'); + + if (codeA=='#160;') { + elmV.innerHTML = '__'; + } else { + elmV.innerHTML = '&' + codeA; + } + + elmB.innerHTML = '&' + codeA; + elmA.innerHTML = '&' + codeB; + elmN.innerHTML = codeN; +} diff --git a/src/wp-includes/js/tinymce/themes/advanced/js/color_picker.js b/src/wp-includes/js/tinymce/themes/advanced/js/color_picker.js new file mode 100644 index 0000000..cdf8c4c --- /dev/null +++ b/src/wp-includes/js/tinymce/themes/advanced/js/color_picker.js @@ -0,0 +1,329 @@ +tinyMCEPopup.requireLangPack(); + +var detail = 50, strhex = "0123456789ABCDEF", i, isMouseDown = false, isMouseOver = false; + +var colors = [ + "#000000","#000033","#000066","#000099","#0000cc","#0000ff","#330000","#330033", + "#330066","#330099","#3300cc","#3300ff","#660000","#660033","#660066","#660099", + "#6600cc","#6600ff","#990000","#990033","#990066","#990099","#9900cc","#9900ff", + "#cc0000","#cc0033","#cc0066","#cc0099","#cc00cc","#cc00ff","#ff0000","#ff0033", + "#ff0066","#ff0099","#ff00cc","#ff00ff","#003300","#003333","#003366","#003399", + "#0033cc","#0033ff","#333300","#333333","#333366","#333399","#3333cc","#3333ff", + "#663300","#663333","#663366","#663399","#6633cc","#6633ff","#993300","#993333", + "#993366","#993399","#9933cc","#9933ff","#cc3300","#cc3333","#cc3366","#cc3399", + "#cc33cc","#cc33ff","#ff3300","#ff3333","#ff3366","#ff3399","#ff33cc","#ff33ff", + "#006600","#006633","#006666","#006699","#0066cc","#0066ff","#336600","#336633", + "#336666","#336699","#3366cc","#3366ff","#666600","#666633","#666666","#666699", + "#6666cc","#6666ff","#996600","#996633","#996666","#996699","#9966cc","#9966ff", + "#cc6600","#cc6633","#cc6666","#cc6699","#cc66cc","#cc66ff","#ff6600","#ff6633", + "#ff6666","#ff6699","#ff66cc","#ff66ff","#009900","#009933","#009966","#009999", + "#0099cc","#0099ff","#339900","#339933","#339966","#339999","#3399cc","#3399ff", + "#669900","#669933","#669966","#669999","#6699cc","#6699ff","#999900","#999933", + "#999966","#999999","#9999cc","#9999ff","#cc9900","#cc9933","#cc9966","#cc9999", + "#cc99cc","#cc99ff","#ff9900","#ff9933","#ff9966","#ff9999","#ff99cc","#ff99ff", + "#00cc00","#00cc33","#00cc66","#00cc99","#00cccc","#00ccff","#33cc00","#33cc33", + "#33cc66","#33cc99","#33cccc","#33ccff","#66cc00","#66cc33","#66cc66","#66cc99", + "#66cccc","#66ccff","#99cc00","#99cc33","#99cc66","#99cc99","#99cccc","#99ccff", + "#cccc00","#cccc33","#cccc66","#cccc99","#cccccc","#ccccff","#ffcc00","#ffcc33", + "#ffcc66","#ffcc99","#ffcccc","#ffccff","#00ff00","#00ff33","#00ff66","#00ff99", + "#00ffcc","#00ffff","#33ff00","#33ff33","#33ff66","#33ff99","#33ffcc","#33ffff", + "#66ff00","#66ff33","#66ff66","#66ff99","#66ffcc","#66ffff","#99ff00","#99ff33", + "#99ff66","#99ff99","#99ffcc","#99ffff","#ccff00","#ccff33","#ccff66","#ccff99", + "#ccffcc","#ccffff","#ffff00","#ffff33","#ffff66","#ffff99","#ffffcc","#ffffff" +]; + +var named = { + '#F0F8FF':'Alice Blue','#FAEBD7':'Antique White','#00FFFF':'Aqua','#7FFFD4':'Aquamarine','#F0FFFF':'Azure','#F5F5DC':'Beige', + '#FFE4C4':'Bisque','#000000':'Black','#FFEBCD':'Blanched Almond','#0000FF':'Blue','#8A2BE2':'Blue Violet','#A52A2A':'Brown', + '#DEB887':'Burly Wood','#5F9EA0':'Cadet Blue','#7FFF00':'Chartreuse','#D2691E':'Chocolate','#FF7F50':'Coral','#6495ED':'Cornflower Blue', + '#FFF8DC':'Cornsilk','#DC143C':'Crimson','#00FFFF':'Cyan','#00008B':'Dark Blue','#008B8B':'Dark Cyan','#B8860B':'Dark Golden Rod', + '#A9A9A9':'Dark Gray','#A9A9A9':'Dark Grey','#006400':'Dark Green','#BDB76B':'Dark Khaki','#8B008B':'Dark Magenta','#556B2F':'Dark Olive Green', + '#FF8C00':'Darkorange','#9932CC':'Dark Orchid','#8B0000':'Dark Red','#E9967A':'Dark Salmon','#8FBC8F':'Dark Sea Green','#483D8B':'Dark Slate Blue', + '#2F4F4F':'Dark Slate Gray','#2F4F4F':'Dark Slate Grey','#00CED1':'Dark Turquoise','#9400D3':'Dark Violet','#FF1493':'Deep Pink','#00BFFF':'Deep Sky Blue', + '#696969':'Dim Gray','#696969':'Dim Grey','#1E90FF':'Dodger Blue','#B22222':'Fire Brick','#FFFAF0':'Floral White','#228B22':'Forest Green', + '#FF00FF':'Fuchsia','#DCDCDC':'Gainsboro','#F8F8FF':'Ghost White','#FFD700':'Gold','#DAA520':'Golden Rod','#808080':'Gray','#808080':'Grey', + '#008000':'Green','#ADFF2F':'Green Yellow','#F0FFF0':'Honey Dew','#FF69B4':'Hot Pink','#CD5C5C':'Indian Red','#4B0082':'Indigo','#FFFFF0':'Ivory', + '#F0E68C':'Khaki','#E6E6FA':'Lavender','#FFF0F5':'Lavender Blush','#7CFC00':'Lawn Green','#FFFACD':'Lemon Chiffon','#ADD8E6':'Light Blue', + '#F08080':'Light Coral','#E0FFFF':'Light Cyan','#FAFAD2':'Light Golden Rod Yellow','#D3D3D3':'Light Gray','#D3D3D3':'Light Grey','#90EE90':'Light Green', + '#FFB6C1':'Light Pink','#FFA07A':'Light Salmon','#20B2AA':'Light Sea Green','#87CEFA':'Light Sky Blue','#778899':'Light Slate Gray','#778899':'Light Slate Grey', + '#B0C4DE':'Light Steel Blue','#FFFFE0':'Light Yellow','#00FF00':'Lime','#32CD32':'Lime Green','#FAF0E6':'Linen','#FF00FF':'Magenta','#800000':'Maroon', + '#66CDAA':'Medium Aqua Marine','#0000CD':'Medium Blue','#BA55D3':'Medium Orchid','#9370D8':'Medium Purple','#3CB371':'Medium Sea Green','#7B68EE':'Medium Slate Blue', + '#00FA9A':'Medium Spring Green','#48D1CC':'Medium Turquoise','#C71585':'Medium Violet Red','#191970':'Midnight Blue','#F5FFFA':'Mint Cream','#FFE4E1':'Misty Rose','#FFE4B5':'Moccasin', + '#FFDEAD':'Navajo White','#000080':'Navy','#FDF5E6':'Old Lace','#808000':'Olive','#6B8E23':'Olive Drab','#FFA500':'Orange','#FF4500':'Orange Red','#DA70D6':'Orchid', + '#EEE8AA':'Pale Golden Rod','#98FB98':'Pale Green','#AFEEEE':'Pale Turquoise','#D87093':'Pale Violet Red','#FFEFD5':'Papaya Whip','#FFDAB9':'Peach Puff', + '#CD853F':'Peru','#FFC0CB':'Pink','#DDA0DD':'Plum','#B0E0E6':'Powder Blue','#800080':'Purple','#FF0000':'Red','#BC8F8F':'Rosy Brown','#4169E1':'Royal Blue', + '#8B4513':'Saddle Brown','#FA8072':'Salmon','#F4A460':'Sandy Brown','#2E8B57':'Sea Green','#FFF5EE':'Sea Shell','#A0522D':'Sienna','#C0C0C0':'Silver', + '#87CEEB':'Sky Blue','#6A5ACD':'Slate Blue','#708090':'Slate Gray','#708090':'Slate Grey','#FFFAFA':'Snow','#00FF7F':'Spring Green', + '#4682B4':'Steel Blue','#D2B48C':'Tan','#008080':'Teal','#D8BFD8':'Thistle','#FF6347':'Tomato','#40E0D0':'Turquoise','#EE82EE':'Violet', + '#F5DEB3':'Wheat','#FFFFFF':'White','#F5F5F5':'White Smoke','#FFFF00':'Yellow','#9ACD32':'Yellow Green' +}; + +var namedLookup = {}; + +function init() { + var inputColor = convertRGBToHex(tinyMCEPopup.getWindowArg('input_color')), key, value; + + tinyMCEPopup.resizeToInnerSize(); + + generatePicker(); + generateWebColors(); + generateNamedColors(); + + if (inputColor) { + changeFinalColor(inputColor); + + col = convertHexToRGB(inputColor); + + if (col) + updateLight(col.r, col.g, col.b); + } + + for (key in named) { + value = named[key]; + namedLookup[value.replace(/\s+/, '').toLowerCase()] = key.replace(/#/, '').toLowerCase(); + } +} + +function toHexColor(color) { + var matches, red, green, blue, toInt = parseInt; + + function hex(value) { + value = parseInt(value).toString(16); + + return value.length > 1 ? value : '0' + value; // Padd with leading zero + }; + + color = color.replace(/[\s#]+/g, '').toLowerCase(); + color = namedLookup[color] || color; + matches = /^rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)|([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})|([a-f0-9])([a-f0-9])([a-f0-9])$/.exec(color); + + if (matches) { + if (matches[1]) { + red = toInt(matches[1]); + green = toInt(matches[2]); + blue = toInt(matches[3]); + } else if (matches[4]) { + red = toInt(matches[4], 16); + green = toInt(matches[5], 16); + blue = toInt(matches[6], 16); + } else if (matches[7]) { + red = toInt(matches[7] + matches[7], 16); + green = toInt(matches[8] + matches[8], 16); + blue = toInt(matches[9] + matches[9], 16); + } + + return '#' + hex(red) + hex(green) + hex(blue); + } + + return ''; +} + +function insertAction() { + var color = document.getElementById("color").value, f = tinyMCEPopup.getWindowArg('func'); + + tinyMCEPopup.restoreSelection(); + + if (f) + f(toHexColor(color)); + + tinyMCEPopup.close(); +} + +function showColor(color, name) { + if (name) + document.getElementById("colorname").innerHTML = name; + + document.getElementById("preview").style.backgroundColor = color; + document.getElementById("color").value = color.toUpperCase(); +} + +function convertRGBToHex(col) { + var re = new RegExp("rgb\\s*\\(\\s*([0-9]+).*,\\s*([0-9]+).*,\\s*([0-9]+).*\\)", "gi"); + + if (!col) + return col; + + var rgb = col.replace(re, "$1,$2,$3").split(','); + if (rgb.length == 3) { + r = parseInt(rgb[0]).toString(16); + g = parseInt(rgb[1]).toString(16); + b = parseInt(rgb[2]).toString(16); + + r = r.length == 1 ? '0' + r : r; + g = g.length == 1 ? '0' + g : g; + b = b.length == 1 ? '0' + b : b; + + return "#" + r + g + b; + } + + return col; +} + +function convertHexToRGB(col) { + if (col.indexOf('#') != -1) { + col = col.replace(new RegExp('[^0-9A-F]', 'gi'), ''); + + r = parseInt(col.substring(0, 2), 16); + g = parseInt(col.substring(2, 4), 16); + b = parseInt(col.substring(4, 6), 16); + + return {r : r, g : g, b : b}; + } + + return null; +} + +function generatePicker() { + var el = document.getElementById('light'), h = '', i; + + for (i = 0; i < detail; i++){ + h += '
            '; + } + + el.innerHTML = h; +} + +function generateWebColors() { + var el = document.getElementById('webcolors'), h = '', i; + + if (el.className == 'generated') + return; + + // TODO: VoiceOver doesn't seem to support legend as a label referenced by labelledby. + h += '
            ' + + ''; + + for (i=0; i' + + ''; + if (tinyMCEPopup.editor.forcedHighContrastMode) { + h += ''; + } + h += ''; + h += ''; + if ((i+1) % 18 == 0) + h += ''; + } + + h += '
            '; + + el.innerHTML = h; + el.className = 'generated'; + + paintCanvas(el); + enableKeyboardNavigation(el.firstChild); +} + +function paintCanvas(el) { + tinyMCEPopup.getWin().tinymce.each(tinyMCEPopup.dom.select('canvas.mceColorSwatch', el), function(canvas) { + var context; + if (canvas.getContext && (context = canvas.getContext("2d"))) { + context.fillStyle = canvas.getAttribute('data-color'); + context.fillRect(0, 0, 10, 10); + } + }); +} +function generateNamedColors() { + var el = document.getElementById('namedcolors'), h = '', n, v, i = 0; + + if (el.className == 'generated') + return; + + for (n in named) { + v = named[n]; + h += ''; + if (tinyMCEPopup.editor.forcedHighContrastMode) { + h += ''; + } + h += ''; + h += ''; + i++; + } + + el.innerHTML = h; + el.className = 'generated'; + + paintCanvas(el); + enableKeyboardNavigation(el); +} + +function enableKeyboardNavigation(el) { + tinyMCEPopup.editor.windowManager.createInstance('tinymce.ui.KeyboardNavigation', { + root: el, + items: tinyMCEPopup.dom.select('a', el) + }, tinyMCEPopup.dom); +} + +function dechex(n) { + return strhex.charAt(Math.floor(n / 16)) + strhex.charAt(n % 16); +} + +function computeColor(e) { + var x, y, partWidth, partDetail, imHeight, r, g, b, coef, i, finalCoef, finalR, finalG, finalB; + + x = e.offsetX ? e.offsetX : (e.target ? e.clientX - e.target.x : 0); + y = e.offsetY ? e.offsetY : (e.target ? e.clientY - e.target.y : 0); + + partWidth = document.getElementById('colors').width / 6; + partDetail = detail / 2; + imHeight = document.getElementById('colors').height; + + r = (x >= 0)*(x < partWidth)*255 + (x >= partWidth)*(x < 2*partWidth)*(2*255 - x * 255 / partWidth) + (x >= 4*partWidth)*(x < 5*partWidth)*(-4*255 + x * 255 / partWidth) + (x >= 5*partWidth)*(x < 6*partWidth)*255; + g = (x >= 0)*(x < partWidth)*(x * 255 / partWidth) + (x >= partWidth)*(x < 3*partWidth)*255 + (x >= 3*partWidth)*(x < 4*partWidth)*(4*255 - x * 255 / partWidth); + b = (x >= 2*partWidth)*(x < 3*partWidth)*(-2*255 + x * 255 / partWidth) + (x >= 3*partWidth)*(x < 5*partWidth)*255 + (x >= 5*partWidth)*(x < 6*partWidth)*(6*255 - x * 255 / partWidth); + + coef = (imHeight - y) / imHeight; + r = 128 + (r - 128) * coef; + g = 128 + (g - 128) * coef; + b = 128 + (b - 128) * coef; + + changeFinalColor('#' + dechex(r) + dechex(g) + dechex(b)); + updateLight(r, g, b); +} + +function updateLight(r, g, b) { + var i, partDetail = detail / 2, finalCoef, finalR, finalG, finalB, color; + + for (i=0; i=0) && (i'); + }, + + init : function() { + var f = document.forms[0], ed = tinyMCEPopup.editor; + + // Setup browse button + document.getElementById('srcbrowsercontainer').innerHTML = getBrowserHTML('srcbrowser','src','image','theme_advanced_image'); + if (isVisible('srcbrowser')) + document.getElementById('src').style.width = '180px'; + + e = ed.selection.getNode(); + + this.fillFileList('image_list', 'tinyMCEImageList'); + + if (e.nodeName == 'IMG') { + f.src.value = ed.dom.getAttrib(e, 'src'); + f.alt.value = ed.dom.getAttrib(e, 'alt'); + f.border.value = this.getAttrib(e, 'border'); + f.vspace.value = this.getAttrib(e, 'vspace'); + f.hspace.value = this.getAttrib(e, 'hspace'); + f.width.value = ed.dom.getAttrib(e, 'width'); + f.height.value = ed.dom.getAttrib(e, 'height'); + f.insert.value = ed.getLang('update'); + this.styleVal = ed.dom.getAttrib(e, 'style'); + selectByValue(f, 'image_list', f.src.value); + selectByValue(f, 'align', this.getAttrib(e, 'align')); + this.updateStyle(); + } + }, + + fillFileList : function(id, l) { + var dom = tinyMCEPopup.dom, lst = dom.get(id), v, cl; + + l = window[l]; + + if (l && l.length > 0) { + lst.options[lst.options.length] = new Option('', ''); + + tinymce.each(l, function(o) { + lst.options[lst.options.length] = new Option(o[0], o[1]); + }); + } else + dom.remove(dom.getParent(id, 'tr')); + }, + + update : function() { + var f = document.forms[0], nl = f.elements, ed = tinyMCEPopup.editor, args = {}, el; + + tinyMCEPopup.restoreSelection(); + + if (f.src.value === '') { + if (ed.selection.getNode().nodeName == 'IMG') { + ed.dom.remove(ed.selection.getNode()); + ed.execCommand('mceRepaint'); + } + + tinyMCEPopup.close(); + return; + } + + if (!ed.settings.inline_styles) { + args = tinymce.extend(args, { + vspace : nl.vspace.value, + hspace : nl.hspace.value, + border : nl.border.value, + align : getSelectValue(f, 'align') + }); + } else + args.style = this.styleVal; + + tinymce.extend(args, { + src : f.src.value.replace(/ /g, '%20'), + alt : f.alt.value, + width : f.width.value, + height : f.height.value, + 'class' : f.class_name.value + }); + + el = ed.selection.getNode(); + + if (el && el.nodeName == 'IMG') { + ed.dom.setAttribs(el, args); + tinyMCEPopup.editor.execCommand('mceRepaint'); + tinyMCEPopup.editor.focus(); + } else { + ed.execCommand('mceInsertContent', false, '', {skip_undo : 1}); + ed.dom.setAttribs('__mce_tmp', args); + ed.dom.setAttrib('__mce_tmp', 'id', ''); + ed.undoManager.add(); + } + + tinyMCEPopup.close(); + }, + + updateStyle : function() { + var dom = tinyMCEPopup.dom, st, v, cls, oldcls, rep, f = document.forms[0]; + + if (tinyMCEPopup.editor.settings.inline_styles) { + st = tinyMCEPopup.dom.parseStyle(this.styleVal); + + // Handle align + v = getSelectValue(f, 'align'); + cls = f.class_name.value || ''; + cls = cls ? cls.replace(/alignright\s*|alignleft\s*|aligncenter\s*/g, '') : ''; + cls = cls ? cls.replace(/^\s*(.+?)\s*$/, '$1') : ''; + if (v) { + if (v == 'left' || v == 'right') { + st['float'] = v; + delete st['vertical-align']; + oldcls = cls ? ' '+cls : ''; + f.class_name.value = 'align' + v + oldcls; + } else { + st['vertical-align'] = v; + delete st['float']; + f.class_name.value = cls; + } + } else { + delete st['float']; + delete st['vertical-align']; + f.class_name.value = cls; + } + + // Handle border + v = f.border.value; + if (v || v == '0') { + if (v == '0') + st['border'] = '0'; + else + st['border'] = v + 'px solid black'; + } else + delete st['border']; + + // Handle hspace + v = f.hspace.value; + if (v) { + delete st['margin']; + st['margin-left'] = v + 'px'; + st['margin-right'] = v + 'px'; + } else { + delete st['margin-left']; + delete st['margin-right']; + } + + // Handle vspace + v = f.vspace.value; + if (v) { + delete st['margin']; + st['margin-top'] = v + 'px'; + st['margin-bottom'] = v + 'px'; + } else { + delete st['margin-top']; + delete st['margin-bottom']; + } + + // Merge + st = tinyMCEPopup.dom.parseStyle(dom.serializeStyle(st), 'img'); + this.styleVal = dom.serializeStyle(st, 'img'); + } + }, + + getAttrib : function(e, at) { + var ed = tinyMCEPopup.editor, dom = ed.dom, v, v2; + + if (ed.settings.inline_styles) { + switch (at) { + case 'align': + if (v = dom.getStyle(e, 'float')) + return v; + + if (v = dom.getStyle(e, 'vertical-align')) + return v; + + break; + + case 'hspace': + v = dom.getStyle(e, 'margin-left') + v2 = dom.getStyle(e, 'margin-right'); + if (v && v == v2) + return parseInt(v.replace(/[^0-9]/g, '')); + + break; + + case 'vspace': + v = dom.getStyle(e, 'margin-top') + v2 = dom.getStyle(e, 'margin-bottom'); + if (v && v == v2) + return parseInt(v.replace(/[^0-9]/g, '')); + + break; + + case 'border': + v = 0; + + tinymce.each(['top', 'right', 'bottom', 'left'], function(sv) { + sv = dom.getStyle(e, 'border-' + sv + '-width'); + + // False or not the same as prev + if (!sv || (sv != v && v !== 0)) { + v = 0; + return false; + } + + if (sv) + v = sv; + }); + + if (v) + return parseInt(v.replace(/[^0-9]/g, '')); + + break; + } + } + + if (v = dom.getAttrib(e, at)) + return v; + + return ''; + }, + + resetImageData : function() { + var f = document.forms[0]; + + f.width.value = f.height.value = ""; + }, + + updateImageData : function() { + var f = document.forms[0], t = ImageDialog; + + if (f.width.value == "") + f.width.value = t.preloadImg.width; + + if (f.height.value == "") + f.height.value = t.preloadImg.height; + }, + + getImageData : function() { + var f = document.forms[0]; + + this.preloadImg = new Image(); + this.preloadImg.onload = this.updateImageData; + this.preloadImg.onerror = this.resetImageData; + this.preloadImg.src = tinyMCEPopup.editor.documentBaseURI.toAbsolute(f.src.value); + } +}; + +ImageDialog.preInit(); +tinyMCEPopup.onInit.add(ImageDialog.init, ImageDialog); diff --git a/src/wp-includes/js/tinymce/themes/advanced/js/link.js b/src/wp-includes/js/tinymce/themes/advanced/js/link.js new file mode 100644 index 0000000..e67d868 --- /dev/null +++ b/src/wp-includes/js/tinymce/themes/advanced/js/link.js @@ -0,0 +1,153 @@ +tinyMCEPopup.requireLangPack(); + +var LinkDialog = { + preInit : function() { + var url; + + if (url = tinyMCEPopup.getParam("external_link_list_url")) + document.write(''); + }, + + init : function() { + var f = document.forms[0], ed = tinyMCEPopup.editor; + + // Setup browse button + document.getElementById('hrefbrowsercontainer').innerHTML = getBrowserHTML('hrefbrowser', 'href', 'file', 'theme_advanced_link'); + if (isVisible('hrefbrowser')) + document.getElementById('href').style.width = '180px'; + + this.fillClassList('class_list'); + this.fillFileList('link_list', 'tinyMCELinkList'); + this.fillTargetList('target_list'); + + if (e = ed.dom.getParent(ed.selection.getNode(), 'A')) { + f.href.value = ed.dom.getAttrib(e, 'href'); + f.linktitle.value = ed.dom.getAttrib(e, 'title'); + f.insert.value = ed.getLang('update'); + selectByValue(f, 'link_list', f.href.value); + selectByValue(f, 'target_list', ed.dom.getAttrib(e, 'target')); + selectByValue(f, 'class_list', ed.dom.getAttrib(e, 'class')); + } + }, + + update : function() { + var f = document.forms[0], ed = tinyMCEPopup.editor, e, b, href = f.href.value.replace(/ /g, '%20'); + + tinyMCEPopup.restoreSelection(); + e = ed.dom.getParent(ed.selection.getNode(), 'A'); + + // Remove element if there is no href + if (!f.href.value) { + if (e) { + b = ed.selection.getBookmark(); + ed.dom.remove(e, 1); + ed.selection.moveToBookmark(b); + tinyMCEPopup.execCommand("mceEndUndoLevel"); + tinyMCEPopup.close(); + return; + } + } + + // Create new anchor elements + if (e == null) { + ed.getDoc().execCommand("unlink", false, null); + tinyMCEPopup.execCommand("mceInsertLink", false, "#mce_temp_url#", {skip_undo : 1}); + + tinymce.each(ed.dom.select("a"), function(n) { + if (ed.dom.getAttrib(n, 'href') == '#mce_temp_url#') { + e = n; + + ed.dom.setAttribs(e, { + href : href, + title : f.linktitle.value, + target : f.target_list ? getSelectValue(f, "target_list") : null, + 'class' : f.class_list ? getSelectValue(f, "class_list") : null + }); + } + }); + } else { + ed.dom.setAttribs(e, { + href : href, + title : f.linktitle.value, + target : f.target_list ? getSelectValue(f, "target_list") : null, + 'class' : f.class_list ? getSelectValue(f, "class_list") : null + }); + } + + // Don't move caret if selection was image + if (e.childNodes.length != 1 || e.firstChild.nodeName != 'IMG') { + ed.focus(); + ed.selection.select(e); + ed.selection.collapse(0); + tinyMCEPopup.storeSelection(); + } + + tinyMCEPopup.execCommand("mceEndUndoLevel"); + tinyMCEPopup.close(); + }, + + checkPrefix : function(n) { + if (n.value && Validator.isEmail(n) && !/^\s*mailto:/i.test(n.value) && confirm(tinyMCEPopup.getLang('advanced_dlg.link_is_email'))) + n.value = 'mailto:' + n.value; + + if (/^\s*www\./i.test(n.value) && confirm(tinyMCEPopup.getLang('advanced_dlg.link_is_external'))) + n.value = 'http://' + n.value; + }, + + fillFileList : function(id, l) { + var dom = tinyMCEPopup.dom, lst = dom.get(id), v, cl; + + l = window[l]; + + if (l && l.length > 0) { + lst.options[lst.options.length] = new Option('', ''); + + tinymce.each(l, function(o) { + lst.options[lst.options.length] = new Option(o[0], o[1]); + }); + } else + dom.remove(dom.getParent(id, 'tr')); + }, + + fillClassList : function(id) { + var dom = tinyMCEPopup.dom, lst = dom.get(id), v, cl; + + if (v = tinyMCEPopup.getParam('theme_advanced_styles')) { + cl = []; + + tinymce.each(v.split(';'), function(v) { + var p = v.split('='); + + cl.push({'title' : p[0], 'class' : p[1]}); + }); + } else + cl = tinyMCEPopup.editor.dom.getClasses(); + + if (cl.length > 0) { + lst.options[lst.options.length] = new Option(tinyMCEPopup.getLang('not_set'), ''); + + tinymce.each(cl, function(o) { + lst.options[lst.options.length] = new Option(o.title || o['class'], o['class']); + }); + } else + dom.remove(dom.getParent(id, 'tr')); + }, + + fillTargetList : function(id) { + var dom = tinyMCEPopup.dom, lst = dom.get(id), v; + + lst.options[lst.options.length] = new Option(tinyMCEPopup.getLang('not_set'), ''); + lst.options[lst.options.length] = new Option(tinyMCEPopup.getLang('advanced_dlg.link_target_same'), '_self'); + lst.options[lst.options.length] = new Option(tinyMCEPopup.getLang('advanced_dlg.link_target_blank'), '_blank'); + + if (v = tinyMCEPopup.getParam('theme_advanced_link_targets')) { + tinymce.each(v.split(','), function(v) { + v = v.split('='); + lst.options[lst.options.length] = new Option(v[0], v[1]); + }); + } + } +}; + +LinkDialog.preInit(); +tinyMCEPopup.onInit.add(LinkDialog.init, LinkDialog); diff --git a/src/wp-includes/js/tinymce/themes/advanced/js/source_editor.js b/src/wp-includes/js/tinymce/themes/advanced/js/source_editor.js new file mode 100644 index 0000000..9cf6b1a --- /dev/null +++ b/src/wp-includes/js/tinymce/themes/advanced/js/source_editor.js @@ -0,0 +1,56 @@ +tinyMCEPopup.requireLangPack(); +tinyMCEPopup.onInit.add(onLoadInit); + +function saveContent() { + tinyMCEPopup.editor.setContent(document.getElementById('htmlSource').value, {source_view : true}); + tinyMCEPopup.close(); +} + +function onLoadInit() { + tinyMCEPopup.resizeToInnerSize(); + + // Remove Gecko spellchecking + if (tinymce.isGecko) + document.body.spellcheck = tinyMCEPopup.editor.getParam("gecko_spellcheck"); + + document.getElementById('htmlSource').value = tinyMCEPopup.editor.getContent({source_view : true}); + + if (tinyMCEPopup.editor.getParam("theme_advanced_source_editor_wrap", true)) { + setWrap('soft'); + document.getElementById('wraped').checked = true; + } + + resizeInputs(); +} + +function setWrap(val) { + var v, n, s = document.getElementById('htmlSource'); + + s.wrap = val; + + if (!tinymce.isIE) { + v = s.value; + n = s.cloneNode(false); + n.setAttribute("wrap", val); + s.parentNode.replaceChild(n, s); + n.value = v; + } +} + +function toggleWordWrap(elm) { + if (elm.checked) + setWrap('soft'); + else + setWrap('off'); +} + +function resizeInputs() { + var vp = tinyMCEPopup.dom.getViewPort(window), el; + + el = document.getElementById('htmlSource'); + + if (el) { + el.style.width = (vp.w - 20) + 'px'; + el.style.height = (vp.h - 65) + 'px'; + } +} diff --git a/src/wp-includes/js/tinymce/themes/advanced/link.htm b/src/wp-includes/js/tinymce/themes/advanced/link.htm new file mode 100644 index 0000000..7c34b6d --- /dev/null +++ b/src/wp-includes/js/tinymce/themes/advanced/link.htm @@ -0,0 +1,62 @@ + + + + {#advanced_dlg.link_title} + + + + + + + +
            + + +
            +
            + + + + + + + + + + + + + + + + + + + + + +
            + + + + +
             
            +
            +
            + +
            +
            + +
            + +
            + +
            +
            +
            + + diff --git a/src/wp-includes/js/tinymce/themes/advanced/shortcuts.htm b/src/wp-includes/js/tinymce/themes/advanced/shortcuts.htm new file mode 100644 index 0000000..16a1502 --- /dev/null +++ b/src/wp-includes/js/tinymce/themes/advanced/shortcuts.htm @@ -0,0 +1,47 @@ + + + + {#advanced_dlg.accessibility_help} + + + + +

            {#advanced_dlg.accessibility_usage_title}

            +

            Toolbars

            +

            Press ALT-F10 to move focus to the toolbars. Navigate through the buttons using the arrow keys. + Press enter to activate a button and return focus to the editor. + Press escape to return focus to the editor without performing any actions.

            + +

            Status Bar

            +

            To access the editor status bar, press ALT-F11. Use the left and right arrow keys to navigate between elements in the path. + Press enter or space to select an element. Press escape to return focus to the editor without changing the selection.

            + +

            Context Menu

            +

            Press shift-F10 to activate the context menu. Use the up and down arrow keys to move between menu items. To open sub-menus press the right arrow key. + To close submenus press the left arrow key. Press escape to close the context menu.

            + +

            Keyboard Shortcuts

            + + + + + + + + + + + + + + + + + + + + + +
            KeystrokeFunction
            Control-BBold
            Control-IItalic
            Control-ZUndo
            Control-YRedo
            + + diff --git a/src/wp-includes/js/tinymce/themes/advanced/skins/default/content.css b/src/wp-includes/js/tinymce/themes/advanced/skins/default/content.css new file mode 100644 index 0000000..842d52d --- /dev/null +++ b/src/wp-includes/js/tinymce/themes/advanced/skins/default/content.css @@ -0,0 +1,47 @@ +body, td, pre {color:#000; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px; margin:8px;} +body {background:#FFF;} +body.mceForceColors {background:#FFF; color:#000;} +body.mceBrowserDefaults {background:transparent; color:inherit; font-size:inherit; font-family:inherit;} +h1 {font-size: 2em} +h2 {font-size: 1.5em} +h3 {font-size: 1.17em} +h4 {font-size: 1em} +h5 {font-size: .83em} +h6 {font-size: .75em} +.mceItemTable, .mceItemTable td, .mceItemTable th, .mceItemTable caption, .mceItemVisualAid {border: 1px dashed #BBB;} +a.mceItemAnchor {display:inline-block; width:11px !important; height:11px !important; background:url(img/items.gif) no-repeat 0 0;} +span.mceItemNbsp {background: #DDD} +td.mceSelected, th.mceSelected {background-color:#3399ff !important} +img {border:0;} +table {cursor:default} +table td, table th {cursor:text} +ins {border-bottom:1px solid green; text-decoration: none; color:green} +del {color:red; text-decoration:line-through} +cite {border-bottom:1px dashed blue} +acronym {border-bottom:1px dotted #CCC; cursor:help} +abbr {border-bottom:1px dashed #CCC; cursor:help} + +/* IE */ +* html body { +scrollbar-3dlight-color:#F0F0EE; +scrollbar-arrow-color:#676662; +scrollbar-base-color:#F0F0EE; +scrollbar-darkshadow-color:#DDD; +scrollbar-face-color:#E0E0DD; +scrollbar-highlight-color:#F0F0EE; +scrollbar-shadow-color:#F0F0EE; +scrollbar-track-color:#F5F5F5; +} + +img:-moz-broken {-moz-force-broken-image-icon:1; width:24px; height:24px} +font[face=mceinline] {font-family:inherit !important} + +.mceItemMedia {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)} +.mceItemVideo {background-image:url(../../img/video.gif)} +.mceItemIframe {background-image:url(../../img/iframe.gif)} +.mcePageBreak {display:block;border:0;width:100%;height:12px;border-top:1px dotted #ccc;margin-top:15px;background:#fff url(../../img/pagebreak.gif) no-repeat center top;} diff --git a/src/wp-includes/js/tinymce/themes/advanced/skins/default/dialog.css b/src/wp-includes/js/tinymce/themes/advanced/skins/default/dialog.css new file mode 100644 index 0000000..1f5598c --- /dev/null +++ b/src/wp-includes/js/tinymce/themes/advanced/skins/default/dialog.css @@ -0,0 +1,117 @@ +/* Generic */ +body { +font-family:Verdana, Arial, Helvetica, sans-serif; font-size:11px; +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; +background:#F0F0EE; +padding:0; +margin:8px 8px 0 8px; +} + +html {background:#F0F0EE;} +td {font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px;} +textarea {resize:none;outline:none;} +a:link, a:visited {color:black;} +a:hover {color:#2B6FB6;} +.nowrap {white-space: nowrap} + +/* Forms */ +fieldset {margin:0; padding:4px; border:1px solid #919B9C; font-family:Verdana, Arial; font-size:10px;} +legend {color:#2B6FB6; font-weight:bold;} +label.msg {display:none;} +label.invalid {color:#EE0000; display:inline;} +input.invalid {border:1px solid #EE0000;} +input {background:#FFF; border:1px solid #CCC;} +input, select, textarea {font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px;} +input, select, textarea {border:1px solid #808080;} +input.radio {border:1px none #000000; background:transparent; vertical-align:middle;} +input.checkbox {border:1px none #000000; background:transparent; vertical-align:middle;} +.input_noborder {border:0;} + +/* Buttons */ +#insert, #cancel, input.button, .updateButton { +border:0; margin:0; padding:0; +font-weight:bold; +width:94px; height:26px; +background:url(img/buttons.png) 0 -26px; +cursor:pointer; +padding-bottom:2px; +float:left; +} + +#insert {background:url(img/buttons.png) 0 -52px} +#cancel {background:url(img/buttons.png) 0 0; float:right} + +/* Browse */ +a.pickcolor, a.browse {text-decoration:none} +a.browse span {display:block; width:20px; height:18px; background:url(../../img/icons.gif) -860px 0; border:1px solid #FFF; margin-left:1px;} +.mceOldBoxModel a.browse span {width:22px; height:20px;} +a.browse:hover span {border:1px solid #0A246A; background-color:#B2BBD0;} +a.browse span.disabled {border:1px solid white; opacity:0.3; -ms-filter:'alpha(opacity=30)'; filter:alpha(opacity=30)} +a.browse:hover span.disabled {border:1px solid white; background-color:transparent;} +a.pickcolor span {display:block; width:20px; height:16px; background:url(../../img/icons.gif) -840px 0; margin-left:2px;} +.mceOldBoxModel a.pickcolor span {width:21px; height:17px;} +a.pickcolor:hover span {background-color:#B2BBD0;} +a.pickcolor:hover span.disabled {} + +/* Charmap */ +table.charmap {border:1px solid #AAA; text-align:center} +td.charmap, #charmap a {width:18px; height:18px; color:#000; border:1px solid #AAA; text-align:center; font-size:12px; vertical-align:middle; line-height: 18px;} +#charmap a {display:block; color:#000; text-decoration:none; border:0} +#charmap a:hover {background:#CCC;color:#2B6FB6} +#charmap #codeN {font-size:10px; font-family:Arial,Helvetica,sans-serif; text-align:center} +#charmap #codeV {font-size:40px; height:80px; border:1px solid #AAA; text-align:center} + +/* Source */ +.wordWrapCode {vertical-align:middle; border:1px none #000000; background:transparent;} +.mceActionPanel {margin-top:5px;} + +/* Tabs classes */ +.tabs {width:100%; height:18px; line-height:normal; background:url(img/tabs.gif) repeat-x 0 -72px;} +.tabs ul {margin:0; padding:0; list-style:none;} +.tabs li {float:left; background:url(img/tabs.gif) no-repeat 0 0; margin:0 2px 0 0; padding:0 0 0 10px; line-height:17px; height:18px; display:block;} +.tabs li.current {background:url(img/tabs.gif) no-repeat 0 -18px; margin-right:2px;} +.tabs span {float:left; display:block; background:url(img/tabs.gif) no-repeat right -36px; padding:0px 10px 0 0;} +.tabs .current span {background:url(img/tabs.gif) no-repeat right -54px;} +.tabs a {text-decoration:none; font-family:Verdana, Arial; font-size:10px;} +.tabs a:link, .tabs a:visited, .tabs a:hover {color:black;} + +/* Panels */ +.panel_wrapper div.panel {display:none;} +.panel_wrapper div.current {display:block; width:100%; height:300px; overflow:visible;} +.panel_wrapper {border:1px solid #919B9C; border-top:0px; padding:10px; padding-top:5px; clear:both; background:white;} + +/* Columns */ +.column {float:left;} +.properties {width:100%;} +.properties .column1 {} +.properties .column2 {text-align:left;} + +/* Titles */ +h1, h2, h3, h4 {color:#2B6FB6; margin:0; padding:0; padding-top:5px;} +h3 {font-size:14px;} +.title {font-size:12px; font-weight:bold; color:#2B6FB6;} + +/* Dialog specific */ +#link .panel_wrapper, #link div.current {height:125px;} +#image .panel_wrapper, #image div.current {height:200px;} +#plugintable thead {font-weight:bold; background:#DDD;} +#plugintable, #about #plugintable td {border:1px solid #919B9C;} +#plugintable {width:96%; margin-top:10px;} +#pluginscontainer {height:290px; overflow:auto;} +#colorpicker #preview {float:right; width:50px; height:14px;line-height:1px; border:1px solid black; margin-left:5px;} +#colorpicker #colors {float:left; border:1px solid gray; cursor:crosshair;} +#colorpicker #light {border:1px solid gray; margin-left:5px; float:left;width:15px; height:150px; cursor:crosshair;} +#colorpicker #light div {overflow:hidden;} +#colorpicker #previewblock {float:right; padding-left:10px; height:20px;} +#colorpicker .panel_wrapper div.current {height:175px;} +#colorpicker #namedcolors {width:150px;} +#colorpicker #namedcolors a {display:block; float:left; width:10px; height:10px; margin:1px 1px 0 0; overflow:hidden;} +#colorpicker #colornamecontainer {margin-top:5px;} +#colorpicker #picker_panel fieldset {margin:auto;width:325px;} diff --git a/src/wp-includes/js/tinymce/themes/advanced/skins/default/img/buttons.png b/src/wp-includes/js/tinymce/themes/advanced/skins/default/img/buttons.png new file mode 100644 index 0000000..7dd5841 Binary files /dev/null and b/src/wp-includes/js/tinymce/themes/advanced/skins/default/img/buttons.png differ diff --git a/src/wp-includes/js/tinymce/themes/advanced/skins/default/img/items.gif b/src/wp-includes/js/tinymce/themes/advanced/skins/default/img/items.gif new file mode 100644 index 0000000..2eafd79 Binary files /dev/null and b/src/wp-includes/js/tinymce/themes/advanced/skins/default/img/items.gif differ diff --git a/src/wp-includes/js/tinymce/themes/advanced/skins/default/img/menu_arrow.gif b/src/wp-includes/js/tinymce/themes/advanced/skins/default/img/menu_arrow.gif new file mode 100644 index 0000000..85e31df Binary files /dev/null and b/src/wp-includes/js/tinymce/themes/advanced/skins/default/img/menu_arrow.gif differ diff --git a/src/wp-includes/js/tinymce/themes/advanced/skins/default/img/menu_check.gif b/src/wp-includes/js/tinymce/themes/advanced/skins/default/img/menu_check.gif new file mode 100644 index 0000000..adfdddc Binary files /dev/null and b/src/wp-includes/js/tinymce/themes/advanced/skins/default/img/menu_check.gif differ diff --git a/src/wp-includes/js/tinymce/themes/advanced/skins/default/img/progress.gif b/src/wp-includes/js/tinymce/themes/advanced/skins/default/img/progress.gif new file mode 100644 index 0000000..5bb90fd Binary files /dev/null and b/src/wp-includes/js/tinymce/themes/advanced/skins/default/img/progress.gif differ diff --git a/src/wp-includes/js/tinymce/themes/advanced/skins/default/img/tabs.gif b/src/wp-includes/js/tinymce/themes/advanced/skins/default/img/tabs.gif new file mode 100644 index 0000000..ce4be63 Binary files /dev/null and b/src/wp-includes/js/tinymce/themes/advanced/skins/default/img/tabs.gif differ diff --git a/src/wp-includes/js/tinymce/themes/advanced/skins/default/ui.css b/src/wp-includes/js/tinymce/themes/advanced/skins/default/ui.css new file mode 100644 index 0000000..e14d36f --- /dev/null +++ b/src/wp-includes/js/tinymce/themes/advanced/skins/default/ui.css @@ -0,0 +1,213 @@ +/* Reset */ +.defaultSkin table, .defaultSkin tbody, .defaultSkin a, .defaultSkin img, .defaultSkin tr, .defaultSkin div, .defaultSkin td, .defaultSkin iframe, .defaultSkin span, .defaultSkin *, .defaultSkin .mceText {border:0; margin:0; padding:0; background:transparent; white-space:nowrap; text-decoration:none; font-weight:normal; cursor:default; color:#000; vertical-align:baseline; width:auto; border-collapse:separate; text-align:left} +.defaultSkin a:hover, .defaultSkin a:link, .defaultSkin a:visited, .defaultSkin a:active {text-decoration:none; font-weight:normal; cursor:default; color:#000} +.defaultSkin table td {vertical-align:middle} + +/* Containers */ +.defaultSkin table {direction:ltr;background:transparent} +.defaultSkin iframe {display:block;} +.defaultSkin .mceToolbar {height:26px} +.defaultSkin .mceLeft {text-align:left} +.defaultSkin .mceRight {text-align:right} + +/* External */ +.defaultSkin .mceExternalToolbar {position:absolute; border:1px solid #CCC; border-bottom:0; display:none;} +.defaultSkin .mceExternalToolbar td.mceToolbar {padding-right:13px;} +.defaultSkin .mceExternalClose {position:absolute; top:3px; right:3px; width:7px; height:7px; background:url(../../img/icons.gif) -820px 0} + +/* Layout */ +.defaultSkin table.mceLayout {border:0; border-left:1px solid #CCC; border-right:1px solid #CCC} +.defaultSkin table.mceLayout tr.mceFirst td {border-top:1px solid #CCC} +.defaultSkin table.mceLayout tr.mceLast td {border-bottom:1px solid #CCC} +.defaultSkin table.mceToolbar, .defaultSkin tr.mceFirst .mceToolbar tr td, .defaultSkin tr.mceLast .mceToolbar tr td {border:0; margin:0; padding:0;} +.defaultSkin td.mceToolbar {background:#F0F0EE; padding-top:1px; vertical-align:top} +.defaultSkin .mceIframeContainer {border-top:1px solid #CCC; border-bottom:1px solid #CCC} +.defaultSkin .mceStatusbar {background:#F0F0EE; font-family:'MS Sans Serif',sans-serif,Verdana,Arial; font-size:9pt; line-height:16px; overflow:visible; color:#000; display:block; height:20px} +.defaultSkin .mceStatusbar div {float:left; margin:2px} +.defaultSkin .mceStatusbar a.mceResize {display:block; float:right; background:url(../../img/icons.gif) -800px 0; width:20px; height:20px; cursor:se-resize; outline:0} +.defaultSkin .mceStatusbar a:hover {text-decoration:underline} +.defaultSkin table.mceToolbar {margin-left:3px} +.defaultSkin span.mceIcon, .defaultSkin img.mceIcon {display:block; width:20px; height:20px} +.defaultSkin .mceIcon {background:url(../../img/icons.gif) no-repeat 20px 20px} +.defaultSkin td.mceCenter {text-align:center;} +.defaultSkin td.mceCenter table {margin:0 auto; text-align:left;} +.defaultSkin td.mceRight table {margin:0 0 0 auto;} + +/* Button */ +.defaultSkin .mceButton {display:block; border:1px solid #F0F0EE; width:20px; height:20px; margin-right:1px} +.defaultSkin a.mceButtonEnabled:hover {border:1px solid #0A246A; background-color:#B2BBD0} +.defaultSkin a.mceButtonActive, .defaultSkin a.mceButtonSelected {border:1px solid #0A246A; background-color:#C2CBE0} +.defaultSkin .mceButtonDisabled .mceIcon {opacity:0.3; -ms-filter:'alpha(opacity=30)'; filter:alpha(opacity=30)} +.defaultSkin .mceButtonLabeled {width:auto} +.defaultSkin .mceButtonLabeled span.mceIcon {float:left} +.defaultSkin span.mceButtonLabel {display:block; font-size:10px; padding:4px 6px 0 22px; font-family:Tahoma,Verdana,Arial,Helvetica} +.defaultSkin .mceButtonDisabled .mceButtonLabel {color:#888} + +/* Separator */ +.defaultSkin .mceSeparator {display:block; background:url(../../img/icons.gif) -180px 0; width:2px; height:20px; margin:2px 2px 0 4px} + +/* ListBox */ +.defaultSkin .mceListBox, .defaultSkin .mceListBox a {display:block} +.defaultSkin .mceListBox .mceText {padding-left:4px; width:70px; text-align:left; border:1px solid #CCC; border-right:0; background:#FFF; font-family:Tahoma,Verdana,Arial,Helvetica; font-size:11px; height:20px; line-height:20px; overflow:hidden} +.defaultSkin .mceListBox .mceOpen {width:9px; height:20px; background:url(../../img/icons.gif) -741px 0; margin-right:2px; border:1px solid #CCC;} +.defaultSkin table.mceListBoxEnabled:hover .mceText, .defaultSkin .mceListBoxHover .mceText, .defaultSkin .mceListBoxSelected .mceText {border:1px solid #A2ABC0; border-right:0; background:#FFF} +.defaultSkin table.mceListBoxEnabled:hover .mceOpen, .defaultSkin .mceListBoxHover .mceOpen, .defaultSkin .mceListBoxSelected .mceOpen {background-color:#FFF; border:1px solid #A2ABC0} +.defaultSkin .mceListBoxDisabled a.mceText {color:gray; background-color:transparent;} +.defaultSkin .mceListBoxMenu {overflow:auto; overflow-x:hidden} +.defaultSkin .mceOldBoxModel .mceListBox .mceText {height:22px} +.defaultSkin .mceOldBoxModel .mceListBox .mceOpen {width:11px; height:22px;} +.defaultSkin select.mceNativeListBox {font-family:'MS Sans Serif',sans-serif,Verdana,Arial; font-size:7pt; background:#F0F0EE; border:1px solid gray; margin-right:2px;} + +/* SplitButton */ +.defaultSkin .mceSplitButton {width:32px; height:20px; direction:ltr} +.defaultSkin .mceSplitButton a, .defaultSkin .mceSplitButton span {height:20px; display:block} +.defaultSkin .mceSplitButton a.mceAction {width:20px; border:1px solid #F0F0EE; border-right:0;} +.defaultSkin .mceSplitButton span.mceAction {width:20px; background-image:url(../../img/icons.gif);} +.defaultSkin .mceSplitButton a.mceOpen {width:9px; background:url(../../img/icons.gif) -741px 0; border:1px solid #F0F0EE;} +.defaultSkin .mceSplitButton span.mceOpen {display:none} +.defaultSkin table.mceSplitButtonEnabled:hover a.mceAction, .defaultSkin .mceSplitButtonHover a.mceAction, .defaultSkin .mceSplitButtonSelected a.mceAction {border:1px solid #0A246A; border-right:0; background-color:#B2BBD0} +.defaultSkin table.mceSplitButtonEnabled:hover a.mceOpen, .defaultSkin .mceSplitButtonHover a.mceOpen, .defaultSkin .mceSplitButtonSelected a.mceOpen {background-color:#B2BBD0; border:1px solid #0A246A;} +.defaultSkin .mceSplitButtonDisabled .mceAction, .defaultSkin .mceSplitButtonDisabled a.mceOpen {opacity:0.3; -ms-filter:'alpha(opacity=30)'; filter:alpha(opacity=30)} +.defaultSkin .mceSplitButtonActive a.mceAction {border:1px solid #0A246A; background-color:#C2CBE0} +.defaultSkin .mceSplitButtonActive a.mceOpen {border-left:0;} + +/* ColorSplitButton */ +.defaultSkin div.mceColorSplitMenu table {background:#FFF; border:1px solid gray} +.defaultSkin .mceColorSplitMenu td {padding:2px} +.defaultSkin .mceColorSplitMenu a {display:block; width:9px; height:9px; overflow:hidden; border:1px solid #808080} +.defaultSkin .mceColorSplitMenu td.mceMoreColors {padding:1px 3px 1px 1px} +.defaultSkin .mceColorSplitMenu a.mceMoreColors {width:100%; height:auto; text-align:center; font-family:Tahoma,Verdana,Arial,Helvetica; font-size:11px; line-height:20px; border:1px solid #FFF} +.defaultSkin .mceColorSplitMenu a.mceMoreColors:hover {border:1px solid #0A246A; background-color:#B6BDD2} +.defaultSkin a.mceMoreColors:hover {border:1px solid #0A246A} +.defaultSkin .mceColorPreview {margin-left:2px; width:16px; height:4px; overflow:hidden; background:#9a9b9a} +.defaultSkin .mce_forecolor span.mceAction, .defaultSkin .mce_backcolor span.mceAction {overflow:hidden; height:16px} + +/* Menu */ +.defaultSkin .mceMenu {position:absolute; left:0; top:0; z-index:1000; border:1px solid #D4D0C8} +.defaultSkin .mceNoIcons span.mceIcon {width:0;} +.defaultSkin .mceNoIcons a .mceText {padding-left:10px} +.defaultSkin .mceMenu table {background:#FFF} +.defaultSkin .mceMenu a, .defaultSkin .mceMenu span, .defaultSkin .mceMenu {display:block} +.defaultSkin .mceMenu td {height:20px} +.defaultSkin .mceMenu a {position:relative;padding:3px 0 4px 0} +.defaultSkin .mceMenu .mceText {position:relative; display:block; font-family:Tahoma,Verdana,Arial,Helvetica; color:#000; cursor:default; margin:0; padding:0 25px 0 25px; display:block} +.defaultSkin .mceMenu span.mceText, .defaultSkin .mceMenu .mcePreview {font-size:11px} +.defaultSkin .mceMenu pre.mceText {font-family:Monospace} +.defaultSkin .mceMenu .mceIcon {position:absolute; top:0; left:0; width:22px;} +.defaultSkin .mceMenu .mceMenuItemEnabled a:hover, .defaultSkin .mceMenu .mceMenuItemActive {background-color:#dbecf3} +.defaultSkin td.mceMenuItemSeparator {background:#DDD; height:1px} +.defaultSkin .mceMenuItemTitle a {border:0; background:#EEE; border-bottom:1px solid #DDD} +.defaultSkin .mceMenuItemTitle span.mceText {color:#000; font-weight:bold; padding-left:4px} +.defaultSkin .mceMenuItemDisabled .mceText {color:#888} +.defaultSkin .mceMenuItemSelected .mceIcon {background:url(img/menu_check.gif)} +.defaultSkin .mceNoIcons .mceMenuItemSelected a {background:url(img/menu_arrow.gif) no-repeat -6px center} +.defaultSkin .mceMenu span.mceMenuLine {display:none} +.defaultSkin .mceMenuItemSub a {background:url(img/menu_arrow.gif) no-repeat top right;} + +/* Progress,Resize */ +.defaultSkin .mceBlocker {position:absolute; left:0; top:0; z-index:1000; opacity:0.5; -ms-filter:'alpha(opacity=50)'; filter:alpha(opacity=50); background:#FFF} +.defaultSkin .mceProgress {position:absolute; left:0; top:0; z-index:1001; background:url(img/progress.gif) no-repeat; width:32px; height:32px; margin:-16px 0 0 -16px} + +/* Formats */ +.defaultSkin .mce_formatPreview a {font-size:10px} +.defaultSkin .mce_p span.mceText {} +.defaultSkin .mce_address span.mceText {font-style:italic} +.defaultSkin .mce_pre span.mceText {font-family:monospace} +.defaultSkin .mce_h1 span.mceText {font-weight:bolder; font-size: 2em} +.defaultSkin .mce_h2 span.mceText {font-weight:bolder; font-size: 1.5em} +.defaultSkin .mce_h3 span.mceText {font-weight:bolder; font-size: 1.17em} +.defaultSkin .mce_h4 span.mceText {font-weight:bolder; font-size: 1em} +.defaultSkin .mce_h5 span.mceText {font-weight:bolder; font-size: .83em} +.defaultSkin .mce_h6 span.mceText {font-weight:bolder; font-size: .75em} + +/* Theme */ +.defaultSkin span.mce_bold {background-position:0 0} +.defaultSkin span.mce_italic {background-position:-60px 0} +.defaultSkin span.mce_underline {background-position:-140px 0} +.defaultSkin span.mce_strikethrough {background-position:-120px 0} +.defaultSkin span.mce_undo {background-position:-160px 0} +.defaultSkin span.mce_redo {background-position:-100px 0} +.defaultSkin span.mce_cleanup {background-position:-40px 0} +.defaultSkin span.mce_bullist {background-position:-20px 0} +.defaultSkin span.mce_numlist {background-position:-80px 0} +.defaultSkin span.mce_justifyleft {background-position:-460px 0} +.defaultSkin span.mce_justifyright {background-position:-480px 0} +.defaultSkin span.mce_justifycenter {background-position:-420px 0} +.defaultSkin span.mce_justifyfull {background-position:-440px 0} +.defaultSkin span.mce_anchor {background-position:-200px 0} +.defaultSkin span.mce_indent {background-position:-400px 0} +.defaultSkin span.mce_outdent {background-position:-540px 0} +.defaultSkin span.mce_link {background-position:-500px 0} +.defaultSkin span.mce_unlink {background-position:-640px 0} +.defaultSkin span.mce_sub {background-position:-600px 0} +.defaultSkin span.mce_sup {background-position:-620px 0} +.defaultSkin span.mce_removeformat {background-position:-580px 0} +.defaultSkin span.mce_newdocument {background-position:-520px 0} +.defaultSkin span.mce_image {background-position:-380px 0} +.defaultSkin span.mce_help {background-position:-340px 0} +.defaultSkin span.mce_code {background-position:-260px 0} +.defaultSkin span.mce_hr {background-position:-360px 0} +.defaultSkin span.mce_visualaid {background-position:-660px 0} +.defaultSkin span.mce_charmap {background-position:-240px 0} +.defaultSkin span.mce_paste {background-position:-560px 0} +.defaultSkin span.mce_copy {background-position:-700px 0} +.defaultSkin span.mce_cut {background-position:-680px 0} +.defaultSkin span.mce_blockquote {background-position:-220px 0} +.defaultSkin .mce_forecolor span.mceAction {background-position:-720px 0} +.defaultSkin .mce_backcolor span.mceAction {background-position:-760px 0} +.defaultSkin span.mce_forecolorpicker {background-position:-720px 0} +.defaultSkin span.mce_backcolorpicker {background-position:-760px 0} + +/* Plugins */ +.defaultSkin span.mce_advhr {background-position:-0px -20px} +.defaultSkin span.mce_ltr {background-position:-20px -20px} +.defaultSkin span.mce_rtl {background-position:-40px -20px} +.defaultSkin span.mce_emotions {background-position:-60px -20px} +.defaultSkin span.mce_fullpage {background-position:-80px -20px} +.defaultSkin span.mce_fullscreen {background-position:-100px -20px} +.defaultSkin span.mce_iespell {background-position:-120px -20px} +.defaultSkin span.mce_insertdate {background-position:-140px -20px} +.defaultSkin span.mce_inserttime {background-position:-160px -20px} +.defaultSkin span.mce_absolute {background-position:-180px -20px} +.defaultSkin span.mce_backward {background-position:-200px -20px} +.defaultSkin span.mce_forward {background-position:-220px -20px} +.defaultSkin span.mce_insert_layer {background-position:-240px -20px} +.defaultSkin span.mce_insertlayer {background-position:-260px -20px} +.defaultSkin span.mce_movebackward {background-position:-280px -20px} +.defaultSkin span.mce_moveforward {background-position:-300px -20px} +.defaultSkin span.mce_media {background-position:-320px -20px} +.defaultSkin span.mce_nonbreaking {background-position:-340px -20px} +.defaultSkin span.mce_pastetext {background-position:-360px -20px} +.defaultSkin span.mce_pasteword {background-position:-380px -20px} +.defaultSkin span.mce_selectall {background-position:-400px -20px} +.defaultSkin span.mce_preview {background-position:-420px -20px} +.defaultSkin span.mce_print {background-position:-440px -20px} +.defaultSkin span.mce_cancel {background-position:-460px -20px} +.defaultSkin span.mce_save {background-position:-480px -20px} +.defaultSkin span.mce_replace {background-position:-500px -20px} +.defaultSkin span.mce_search {background-position:-520px -20px} +.defaultSkin span.mce_styleprops {background-position:-560px -20px} +.defaultSkin span.mce_table {background-position:-580px -20px} +.defaultSkin span.mce_cell_props {background-position:-600px -20px} +.defaultSkin span.mce_delete_table {background-position:-620px -20px} +.defaultSkin span.mce_delete_col {background-position:-640px -20px} +.defaultSkin span.mce_delete_row {background-position:-660px -20px} +.defaultSkin span.mce_col_after {background-position:-680px -20px} +.defaultSkin span.mce_col_before {background-position:-700px -20px} +.defaultSkin span.mce_row_after {background-position:-720px -20px} +.defaultSkin span.mce_row_before {background-position:-740px -20px} +.defaultSkin span.mce_merge_cells {background-position:-760px -20px} +.defaultSkin span.mce_table_props {background-position:-980px -20px} +.defaultSkin span.mce_row_props {background-position:-780px -20px} +.defaultSkin span.mce_split_cells {background-position:-800px -20px} +.defaultSkin span.mce_template {background-position:-820px -20px} +.defaultSkin span.mce_visualchars {background-position:-840px -20px} +.defaultSkin span.mce_abbr {background-position:-860px -20px} +.defaultSkin span.mce_acronym {background-position:-880px -20px} +.defaultSkin span.mce_attribs {background-position:-900px -20px} +.defaultSkin span.mce_cite {background-position:-920px -20px} +.defaultSkin span.mce_del {background-position:-940px -20px} +.defaultSkin span.mce_ins {background-position:-960px -20px} +.defaultSkin span.mce_pagebreak {background-position:0 -40px} +.defaultSkin span.mce_restoredraft {background-position:-20px -40px} +.defaultSkin span.mce_spellchecker {background-position:-540px -20px} diff --git a/src/wp-includes/js/tinymce/themes/advanced/skins/highcontrast/content.css b/src/wp-includes/js/tinymce/themes/advanced/skins/highcontrast/content.css new file mode 100644 index 0000000..75cfaf1 --- /dev/null +++ b/src/wp-includes/js/tinymce/themes/advanced/skins/highcontrast/content.css @@ -0,0 +1,23 @@ +body, td, pre { margin:8px;} +body.mceForceColors {background:#FFF; color:#000;} +h1 {font-size: 2em} +h2 {font-size: 1.5em} +h3 {font-size: 1.17em} +h4 {font-size: 1em} +h5 {font-size: .83em} +h6 {font-size: .75em} +.mceItemTable, .mceItemTable td, .mceItemTable th, .mceItemTable caption, .mceItemVisualAid {border: 1px dashed #BBB;} +a.mceItemAnchor {display:inline-block; width:11px !important; height:11px !important; background:url(../default/img/items.gif) no-repeat 0 0;} +span.mceItemNbsp {background: #DDD} +td.mceSelected, th.mceSelected {background-color:#3399ff !important} +img {border:0;} +table {cursor:default} +table td, table th {cursor:text} +ins {border-bottom:1px solid green; text-decoration: none; color:green} +del {color:red; text-decoration:line-through} +cite {border-bottom:1px dashed blue} +acronym {border-bottom:1px dotted #CCC; cursor:help} +abbr {border-bottom:1px dashed #CCC; cursor:help} + +img:-moz-broken {-moz-force-broken-image-icon:1; width:24px; height:24px} +font[face=mceinline] {font-family:inherit !important} diff --git a/src/wp-includes/js/tinymce/themes/advanced/skins/highcontrast/dialog.css b/src/wp-includes/js/tinymce/themes/advanced/skins/highcontrast/dialog.css new file mode 100644 index 0000000..dafcd28 --- /dev/null +++ b/src/wp-includes/js/tinymce/themes/advanced/skins/highcontrast/dialog.css @@ -0,0 +1,105 @@ +/* Generic */ +body { +font-family:Verdana, Arial, Helvetica, sans-serif; font-size:11px; +background:#F0F0EE; +color: black; +padding:0; +margin:8px 8px 0 8px; +} + +html {background:#F0F0EE; color:#000;} +td {font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px;} +textarea {resize:none;outline:none;} +a:link, a:visited {color:black;background-color:transparent;} +a:hover {color:#2B6FB6;background-color:transparent;} +.nowrap {white-space: nowrap} + +/* Forms */ +fieldset {margin:0; padding:4px; border:1px solid #919B9C; font-family:Verdana, Arial; font-size:10px;} +legend {color:#2B6FB6; font-weight:bold;} +label.msg {display:none;} +label.invalid {color:#EE0000; display:inline;background-color:transparent;} +input.invalid {border:1px solid #EE0000;background-color:transparent;} +input {background:#FFF; border:1px solid #CCC;color:black;} +input, select, textarea {font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px;} +input, select, textarea {border:1px solid #808080;} +input.radio {border:1px none #000000; background:transparent; vertical-align:middle;} +input.checkbox {border:1px none #000000; background:transparent; vertical-align:middle;} +.input_noborder {border:0;} + +/* Buttons */ +#insert, #cancel, input.button, .updateButton { +font-weight:bold; +width:94px; height:23px; +cursor:pointer; +padding-bottom:2px; +float:left; +} + +#cancel {float:right} + +/* Browse */ +a.pickcolor, a.browse {text-decoration:none} +a.browse span {display:block; width:20px; height:18px; background:url(../../img/icons.gif) -860px 0; border:1px solid #FFF; margin-left:1px;} +.mceOldBoxModel a.browse span {width:22px; height:20px;} +a.browse:hover span {border:1px solid #0A246A; background-color:#B2BBD0;} +a.browse span.disabled {border:1px solid white; opacity:0.3; -ms-filter:'alpha(opacity=30)'; filter:alpha(opacity=30)} +a.browse:hover span.disabled {border:1px solid white; background-color:transparent;} +a.pickcolor span {display:block; width:20px; height:16px; background:url(../../img/icons.gif) -840px 0; margin-left:2px;} +.mceOldBoxModel a.pickcolor span {width:21px; height:17px;} +a.pickcolor:hover span {background-color:#B2BBD0;} +a.pickcolor:hover span.disabled {} + +/* Charmap */ +table.charmap {border:1px solid #AAA; text-align:center} +td.charmap, #charmap a {width:18px; height:18px; color:#000; border:1px solid #AAA; text-align:center; font-size:12px; vertical-align:middle; line-height: 18px;} +#charmap a {display:block; color:#000; text-decoration:none; border:0} +#charmap a:hover {background:#CCC;color:#2B6FB6} +#charmap #codeN {font-size:10px; font-family:Arial,Helvetica,sans-serif; text-align:center} +#charmap #codeV {font-size:40px; height:80px; border:1px solid #AAA; text-align:center} + +/* Source */ +.wordWrapCode {vertical-align:middle; border:1px none #000000; background:transparent;} +.mceActionPanel {margin-top:5px;} + +/* Tabs classes */ +.tabs {width:100%; height:18px; line-height:normal;} +.tabs ul {margin:0; padding:0; list-style:none;} +.tabs li {float:left; border: 1px solid black; border-bottom:0; margin:0 2px 0 0; padding:0 0 0 10px; line-height:17px; height:18px; display:block; cursor:pointer;} +.tabs li.current {font-weight: bold; margin-right:2px;} +.tabs span {float:left; display:block; padding:0px 10px 0 0;} +.tabs a {text-decoration:none; font-family:Verdana, Arial; font-size:10px;} +.tabs a:link, .tabs a:visited, .tabs a:hover {color:black;} + +/* Panels */ +.panel_wrapper div.panel {display:none;} +.panel_wrapper div.current {display:block; width:100%; height:300px; overflow:visible;} +.panel_wrapper {border:1px solid #919B9C; padding:10px; padding-top:5px; clear:both; background:white;} + +/* Columns */ +.column {float:left;} +.properties {width:100%;} +.properties .column1 {} +.properties .column2 {text-align:left;} + +/* Titles */ +h1, h2, h3, h4 {color:#2B6FB6; margin:0; padding:0; padding-top:5px;} +h3 {font-size:14px;} +.title {font-size:12px; font-weight:bold; color:#2B6FB6;} + +/* Dialog specific */ +#link .panel_wrapper, #link div.current {height:125px;} +#image .panel_wrapper, #image div.current {height:200px;} +#plugintable thead {font-weight:bold; background:#DDD;} +#plugintable, #about #plugintable td {border:1px solid #919B9C;} +#plugintable {width:96%; margin-top:10px;} +#pluginscontainer {height:290px; overflow:auto;} +#colorpicker #preview {float:right; width:50px; height:14px;line-height:1px; border:1px solid black; margin-left:5px;} +#colorpicker #colors {float:left; border:1px solid gray; cursor:crosshair;} +#colorpicker #light {border:1px solid gray; margin-left:5px; float:left;width:15px; height:150px; cursor:crosshair;} +#colorpicker #light div {overflow:hidden;} +#colorpicker #previewblock {float:right; padding-left:10px; height:20px;} +#colorpicker .panel_wrapper div.current {height:175px;} +#colorpicker #namedcolors {width:150px;} +#colorpicker #namedcolors a {display:block; float:left; width:10px; height:10px; margin:1px 1px 0 0; overflow:hidden;} +#colorpicker #colornamecontainer {margin-top:5px;} diff --git a/src/wp-includes/js/tinymce/themes/advanced/skins/highcontrast/ui.css b/src/wp-includes/js/tinymce/themes/advanced/skins/highcontrast/ui.css new file mode 100644 index 0000000..a550c8f --- /dev/null +++ b/src/wp-includes/js/tinymce/themes/advanced/skins/highcontrast/ui.css @@ -0,0 +1,101 @@ +/* Reset */ +.highcontrastSkin table, .highcontrastSkin tbody, .highcontrastSkin a, .highcontrastSkin img, .highcontrastSkin tr, .highcontrastSkin div, .highcontrastSkin td, .highcontrastSkin iframe, .highcontrastSkin span, .highcontrastSkin *, .highcontrastSkin .mceText {border:0; margin:0; padding:0; vertical-align:baseline; border-collapse:separate;} +.highcontrastSkin a:hover, .highcontrastSkin a:link, .highcontrastSkin a:visited, .highcontrastSkin a:active {text-decoration:none; font-weight:normal; cursor:default;} +.highcontrastSkin table td {vertical-align:middle} + +.highcontrastSkin .mceIconOnly {display: block !important;} + +/* External */ +.highcontrastSkin .mceExternalToolbar {position:absolute; border:1px solid; border-bottom:0; display:none; background-color: white;} +.highcontrastSkin .mceExternalToolbar td.mceToolbar {padding-right:13px;} +.highcontrastSkin .mceExternalClose {position:absolute; top:3px; right:3px; width:7px; height:7px;} + +/* Layout */ +.highcontrastSkin table.mceLayout {border: 1px solid;} +.highcontrastSkin .mceIframeContainer {border-top:1px solid; border-bottom:1px solid} +.highcontrastSkin .mceStatusbar a:hover {text-decoration:underline} +.highcontrastSkin .mceStatusbar {display:block; line-height:1.5em; overflow:visible;} +.highcontrastSkin .mceStatusbar div {float:left} +.highcontrastSkin .mceStatusbar a.mceResize {display:block; float:right; width:20px; height:20px; cursor:se-resize; outline:0} + +.highcontrastSkin .mceToolbar td { display: inline-block; float: left;} +.highcontrastSkin .mceToolbar tr { display: block;} +.highcontrastSkin .mceToolbar table { display: block; } + +/* Button */ + +.highcontrastSkin .mceButton { display:block; margin: 2px; padding: 5px 10px;border: 1px solid; border-radius: 3px; -moz-border-radius: 3px; -webkit-border-radius: 3px; -ms-border-radius: 3px; height: 2em;} +.highcontrastSkin .mceButton .mceVoiceLabel { height: 100%; vertical-align: center; line-height: 2em} +.highcontrastSkin .mceButtonDisabled .mceVoiceLabel { opacity:0.6; -ms-filter:'alpha(opacity=60)'; filter:alpha(opacity=60);} +.highcontrastSkin .mceButtonActive, .highcontrastSkin .mceButton:focus, .highcontrastSkin .mceButton:active { border: 5px solid; padding: 1px 6px;-webkit-focus-ring-color:none;outline:none;} + +/* Separator */ +.highcontrastSkin .mceSeparator {display:block; width:16px; height:26px;} + +/* ListBox */ +.highcontrastSkin .mceListBox { display: block; margin:2px;-webkit-focus-ring-color:none;outline:none;} +.highcontrastSkin .mceListBox .mceText {padding: 5px 6px; line-height: 2em; width: 15ex; overflow: hidden;} +.highcontrastSkin .mceListBoxDisabled .mceText { opacity:0.6; -ms-filter:'alpha(opacity=60)'; filter:alpha(opacity=60);} +.highcontrastSkin .mceListBox a.mceText { padding: 5px 10px; display: block; height: 2em; line-height: 2em; border: 1px solid; border-right: 0; border-radius: 3px 0px 0px 3px; -moz-border-radius: 3px 0px 0px 3px; -webkit-border-radius: 3px 0px 0px 3px; -ms-border-radius: 3px 0px 0px 3px;} +.highcontrastSkin .mceListBox a.mceOpen { padding: 5px 4px; display: block; height: 2em; line-height: 2em; border: 1px solid; border-left: 0; border-radius: 0px 3px 3px 0px; -moz-border-radius: 0px 3px 3px 0px; -webkit-border-radius: 0px 3px 3px 0px; -ms-border-radius: 0px 3px 3px 0px;} +.highcontrastSkin .mceListBox:focus a.mceText, .highcontrastSkin .mceListBox:active a.mceText { border-width: 5px; padding: 1px 10px 1px 6px;} +.highcontrastSkin .mceListBox:focus a.mceOpen, .highcontrastSkin .mceListBox:active a.mceOpen { border-width: 5px; padding: 1px 0px 1px 4px;} + +.highcontrastSkin .mceListBoxMenu {overflow-y:auto} + +/* SplitButton */ +.highcontrastSkin .mceSplitButtonDisabled .mceAction {opacity:0.3; -ms-filter:'alpha(opacity=30)'; filter:alpha(opacity=30)} + +.highcontrastSkin .mceSplitButton { border-collapse: collapse; margin: 2px; height: 2em; line-height: 2em;-webkit-focus-ring-color:none;outline:none;} +.highcontrastSkin .mceSplitButton td { display: table-cell; float: none; margin: 0; padding: 0; height: 2em;} +.highcontrastSkin .mceSplitButton tr { display: table-row; } +.highcontrastSkin table.mceSplitButton { display: table; } +.highcontrastSkin .mceSplitButton a.mceAction { padding: 5px 10px; display: block; height: 2em; line-height: 2em; overflow: hidden; border: 1px solid; border-right: 0; border-radius: 3px 0px 0px 3px; -moz-border-radius: 3px 0px 0px 3px; -webkit-border-radius: 3px 0px 0px 3px; -ms-border-radius: 3px 0px 0px 3px;} +.highcontrastSkin .mceSplitButton a.mceOpen { padding: 5px 4px; display: block; height: 2em; line-height: 2em; border: 1px solid; border-radius: 0px 3px 3px 0px; -moz-border-radius: 0px 3px 3px 0px; -webkit-border-radius: 0px 3px 3px 0px; -ms-border-radius: 0px 3px 3px 0px;} +.highcontrastSkin .mceSplitButton .mceVoiceLabel { height: 2em; vertical-align: center; line-height: 2em; } +.highcontrastSkin .mceSplitButton:focus a.mceAction, .highcontrastSkin .mceSplitButton:active a.mceAction { border-width: 5px; border-right-width: 1px; padding: 1px 10px 1px 6px;-webkit-focus-ring-color:none;outline:none;} +.highcontrastSkin .mceSplitButton:focus a.mceOpen, .highcontrastSkin .mceSplitButton:active a.mceOpen { border-width: 5px; border-left-width: 1px; padding: 1px 0px 1px 4px;-webkit-focus-ring-color:none;outline:none;} + +/* Menu */ +.highcontrastSkin .mceNoIcons span.mceIcon {width:0;} +.highcontrastSkin .mceMenu {position:absolute; left:0; top:0; z-index:1000; border:1px solid; } +.highcontrastSkin .mceMenu table {background:white; color: black} +.highcontrastSkin .mceNoIcons a .mceText {padding-left:10px} +.highcontrastSkin .mceMenu a, .highcontrastSkin .mceMenu span, .highcontrastSkin .mceMenu {display:block;background:white; color: black} +.highcontrastSkin .mceMenu td {height:2em} +.highcontrastSkin .mceMenu a {position:relative;padding:3px 0 4px 0; display: block;} +.highcontrastSkin .mceMenu .mceText {position:relative; display:block; cursor:default; margin:0; padding:0 25px 0 25px;} +.highcontrastSkin .mceMenu pre.mceText {font-family:Monospace} +.highcontrastSkin .mceMenu .mceIcon {position:absolute; top:0; left:0; width:26px;} +.highcontrastSkin td.mceMenuItemSeparator {border-top:1px solid; height:1px} +.highcontrastSkin .mceMenuItemTitle a {border:0; border-bottom:1px solid} +.highcontrastSkin .mceMenuItemTitle span.mceText {font-weight:bold; padding-left:4px} +.highcontrastSkin .mceNoIcons .mceMenuItemSelected span.mceText:before {content: "\2713\A0";} +.highcontrastSkin .mceMenu span.mceMenuLine {display:none} +.highcontrastSkin .mceMenuItemSub a .mceText:after {content: "\A0\25B8"} + +/* ColorSplitButton */ +.highcontrastSkin div.mceColorSplitMenu table {background:#FFF; border:1px solid; color: #000} +.highcontrastSkin .mceColorSplitMenu td {padding:2px} +.highcontrastSkin .mceColorSplitMenu a {display:block; width:16px; height:16px; overflow:hidden; color:#000; margin: 0; padding: 0;} +.highcontrastSkin .mceColorSplitMenu td.mceMoreColors {padding:1px 3px 1px 1px} +.highcontrastSkin .mceColorSplitMenu a.mceMoreColors {width:100%; height:auto; text-align:center; font-family:Tahoma,Verdana,Arial,Helvetica; font-size:11px; line-height:20px; border:1px solid #FFF} +.highcontrastSkin .mceColorSplitMenu a.mceMoreColors:hover {border:1px solid; background-color:#B6BDD2} +.highcontrastSkin a.mceMoreColors:hover {border:1px solid #0A246A; color: #000;} +.highcontrastSkin .mceColorPreview {display:none;} +.highcontrastSkin .mce_forecolor span.mceAction, .highcontrastSkin .mce_backcolor span.mceAction {height:17px;overflow:hidden} + +/* Progress,Resize */ +.highcontrastSkin .mceBlocker {position:absolute; left:0; top:0; z-index:1000; opacity:0.5; -ms-filter:'alpha(opacity=30)'; filter:alpha(opacity=50); background:#FFF} +.highcontrastSkin .mceProgress {position:absolute; left:0; top:0; z-index:1001; background:url(../default/img/progress.gif) no-repeat; width:32px; height:32px; margin:-16px 0 0 -16px} + +/* Formats */ +.highcontrastSkin .mce_p span.mceText {} +.highcontrastSkin .mce_address span.mceText {font-style:italic} +.highcontrastSkin .mce_pre span.mceText {font-family:monospace} +.highcontrastSkin .mce_h1 span.mceText {font-weight:bolder; font-size: 2em} +.highcontrastSkin .mce_h2 span.mceText {font-weight:bolder; font-size: 1.5em} +.highcontrastSkin .mce_h3 span.mceText {font-weight:bolder; font-size: 1.17em} +.highcontrastSkin .mce_h4 span.mceText {font-weight:bolder; font-size: 1em} +.highcontrastSkin .mce_h5 span.mceText {font-weight:bolder; font-size: .83em} +.highcontrastSkin .mce_h6 span.mceText {font-weight:bolder; font-size: .75em} diff --git a/src/wp-includes/js/tinymce/themes/advanced/skins/o2k7/content.css b/src/wp-includes/js/tinymce/themes/advanced/skins/o2k7/content.css new file mode 100644 index 0000000..8569401 --- /dev/null +++ b/src/wp-includes/js/tinymce/themes/advanced/skins/o2k7/content.css @@ -0,0 +1,46 @@ +body, td, pre {color:#000; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px; margin:8px;} +body {background:#FFF;} +body.mceForceColors {background:#FFF; color:#000;} +h1 {font-size: 2em} +h2 {font-size: 1.5em} +h3 {font-size: 1.17em} +h4 {font-size: 1em} +h5 {font-size: .83em} +h6 {font-size: .75em} +.mceItemTable, .mceItemTable td, .mceItemTable th, .mceItemTable caption, .mceItemVisualAid {border: 1px dashed #BBB;} +a.mceItemAnchor {display:inline-block; width:11px !important; height:11px !important; background:url(../default/img/items.gif) no-repeat 0 0;} +span.mceItemNbsp {background: #DDD} +td.mceSelected, th.mceSelected {background-color:#3399ff !important} +img {border:0;} +table {cursor:default} +table td, table th {cursor:text} +ins {border-bottom:1px solid green; text-decoration: none; color:green} +del {color:red; text-decoration:line-through} +cite {border-bottom:1px dashed blue} +acronym {border-bottom:1px dotted #CCC; cursor:help} +abbr {border-bottom:1px dashed #CCC; cursor:help} + +/* IE */ +* html body { +scrollbar-3dlight-color:#F0F0EE; +scrollbar-arrow-color:#676662; +scrollbar-base-color:#F0F0EE; +scrollbar-darkshadow-color:#DDD; +scrollbar-face-color:#E0E0DD; +scrollbar-highlight-color:#F0F0EE; +scrollbar-shadow-color:#F0F0EE; +scrollbar-track-color:#F5F5F5; +} + +img:-moz-broken {-moz-force-broken-image-icon:1; width:24px; height:24px} +font[face=mceinline] {font-family:inherit !important} + +.mceItemMedia {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)} +.mceItemVideo {background-image:url(../../img/video.gif)} +.mceItemIframe {background-image:url(../../img/iframe.gif)} +.mcePageBreak {display:block;border:0;width:100%;height:12px;border-top:1px dotted #ccc;margin-top:15px;background:#fff url(../../img/pagebreak.gif) no-repeat center top;} diff --git a/src/wp-includes/js/tinymce/themes/advanced/skins/o2k7/dialog.css b/src/wp-includes/js/tinymce/themes/advanced/skins/o2k7/dialog.css new file mode 100644 index 0000000..c97d38e --- /dev/null +++ b/src/wp-includes/js/tinymce/themes/advanced/skins/o2k7/dialog.css @@ -0,0 +1,117 @@ +/* Generic */ +body { +font-family:Verdana, Arial, Helvetica, sans-serif; font-size:11px; +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; +background:#F0F0EE; +padding:0; +margin:8px 8px 0 8px; +} + +html {background:#F0F0EE;} +td {font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px;} +textarea {resize:none;outline:none;} +a:link, a:visited {color:black;} +a:hover {color:#2B6FB6;} +.nowrap {white-space: nowrap} + +/* Forms */ +fieldset {margin:0; padding:4px; border:1px solid #919B9C; font-family:Verdana, Arial; font-size:10px;} +legend {color:#2B6FB6; font-weight:bold;} +label.msg {display:none;} +label.invalid {color:#EE0000; display:inline;} +input.invalid {border:1px solid #EE0000;} +input {background:#FFF; border:1px solid #CCC;} +input, select, textarea {font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px;} +input, select, textarea {border:1px solid #808080;} +input.radio {border:1px none #000000; background:transparent; vertical-align:middle;} +input.checkbox {border:1px none #000000; background:transparent; vertical-align:middle;} +.input_noborder {border:0;} + +/* Buttons */ +#insert, #cancel, input.button, .updateButton { +border:0; margin:0; padding:0; +font-weight:bold; +width:94px; height:26px; +background:url(../default/img/buttons.png) 0 -26px; +cursor:pointer; +padding-bottom:2px; +float:left; +} + +#insert {background:url(../default/img/buttons.png) 0 -52px} +#cancel {background:url(../default/img/buttons.png) 0 0; float:right} + +/* Browse */ +a.pickcolor, a.browse {text-decoration:none} +a.browse span {display:block; width:20px; height:18px; background:url(../../img/icons.gif) -860px 0; border:1px solid #FFF; margin-left:1px;} +.mceOldBoxModel a.browse span {width:22px; height:20px;} +a.browse:hover span {border:1px solid #0A246A; background-color:#B2BBD0;} +a.browse span.disabled {border:1px solid white; opacity:0.3; -ms-filter:'alpha(opacity=30)'; filter:alpha(opacity=30)} +a.browse:hover span.disabled {border:1px solid white; background-color:transparent;} +a.pickcolor span {display:block; width:20px; height:16px; background:url(../../img/icons.gif) -840px 0; margin-left:2px;} +.mceOldBoxModel a.pickcolor span {width:21px; height:17px;} +a.pickcolor:hover span {background-color:#B2BBD0;} +a.pickcolor:hover span.disabled {} + +/* Charmap */ +table.charmap {border:1px solid #AAA; text-align:center} +td.charmap, #charmap a {width:18px; height:18px; color:#000; border:1px solid #AAA; text-align:center; font-size:12px; vertical-align:middle; line-height: 18px;} +#charmap a {display:block; color:#000; text-decoration:none; border:0} +#charmap a:hover {background:#CCC;color:#2B6FB6} +#charmap #codeN {font-size:10px; font-family:Arial,Helvetica,sans-serif; text-align:center} +#charmap #codeV {font-size:40px; height:80px; border:1px solid #AAA; text-align:center} + +/* Source */ +.wordWrapCode {vertical-align:middle; border:1px none #000000; background:transparent;} +.mceActionPanel {margin-top:5px;} + +/* Tabs classes */ +.tabs {width:100%; height:18px; line-height:normal; background:url(../default/img/tabs.gif) repeat-x 0 -72px;} +.tabs ul {margin:0; padding:0; list-style:none;} +.tabs li {float:left; background:url(../default/img/tabs.gif) no-repeat 0 0; margin:0 2px 0 0; padding:0 0 0 10px; line-height:17px; height:18px; display:block;} +.tabs li.current {background:url(../default/img/tabs.gif) no-repeat 0 -18px; margin-right:2px;} +.tabs span {float:left; display:block; background:url(../default/img/tabs.gif) no-repeat right -36px; padding:0px 10px 0 0;} +.tabs .current span {background:url(../default/img/tabs.gif) no-repeat right -54px;} +.tabs a {text-decoration:none; font-family:Verdana, Arial; font-size:10px;} +.tabs a:link, .tabs a:visited, .tabs a:hover {color:black;} + +/* Panels */ +.panel_wrapper div.panel {display:none;} +.panel_wrapper div.current {display:block; width:100%; height:300px; overflow:visible;} +.panel_wrapper {border:1px solid #919B9C; border-top:0px; padding:10px; padding-top:5px; clear:both; background:white;} + +/* Columns */ +.column {float:left;} +.properties {width:100%;} +.properties .column1 {} +.properties .column2 {text-align:left;} + +/* Titles */ +h1, h2, h3, h4 {color:#2B6FB6; margin:0; padding:0; padding-top:5px;} +h3 {font-size:14px;} +.title {font-size:12px; font-weight:bold; color:#2B6FB6;} + +/* Dialog specific */ +#link .panel_wrapper, #link div.current {height:125px;} +#image .panel_wrapper, #image div.current {height:200px;} +#plugintable thead {font-weight:bold; background:#DDD;} +#plugintable, #about #plugintable td {border:1px solid #919B9C;} +#plugintable {width:96%; margin-top:10px;} +#pluginscontainer {height:290px; overflow:auto;} +#colorpicker #preview {float:right; width:50px; height:14px;line-height:1px; border:1px solid black; margin-left:5px;} +#colorpicker #colors {float:left; border:1px solid gray; cursor:crosshair;} +#colorpicker #light {border:1px solid gray; margin-left:5px; float:left;width:15px; height:150px; cursor:crosshair;} +#colorpicker #light div {overflow:hidden;} +#colorpicker #previewblock {float:right; padding-left:10px; height:20px;} +#colorpicker .panel_wrapper div.current {height:175px;} +#colorpicker #namedcolors {width:150px;} +#colorpicker #namedcolors a {display:block; float:left; width:10px; height:10px; margin:1px 1px 0 0; overflow:hidden;} +#colorpicker #colornamecontainer {margin-top:5px;} +#colorpicker #picker_panel fieldset {margin:auto;width:325px;} diff --git a/src/wp-includes/js/tinymce/themes/advanced/skins/o2k7/img/button_bg.png b/src/wp-includes/js/tinymce/themes/advanced/skins/o2k7/img/button_bg.png new file mode 100644 index 0000000..12cfb41 Binary files /dev/null and b/src/wp-includes/js/tinymce/themes/advanced/skins/o2k7/img/button_bg.png differ diff --git a/src/wp-includes/js/tinymce/themes/advanced/skins/o2k7/img/button_bg_black.png b/src/wp-includes/js/tinymce/themes/advanced/skins/o2k7/img/button_bg_black.png new file mode 100644 index 0000000..8996c74 Binary files /dev/null and b/src/wp-includes/js/tinymce/themes/advanced/skins/o2k7/img/button_bg_black.png differ diff --git a/src/wp-includes/js/tinymce/themes/advanced/skins/o2k7/img/button_bg_silver.png b/src/wp-includes/js/tinymce/themes/advanced/skins/o2k7/img/button_bg_silver.png new file mode 100644 index 0000000..bd5d255 Binary files /dev/null and b/src/wp-includes/js/tinymce/themes/advanced/skins/o2k7/img/button_bg_silver.png differ diff --git a/src/wp-includes/js/tinymce/themes/advanced/skins/o2k7/ui.css b/src/wp-includes/js/tinymce/themes/advanced/skins/o2k7/ui.css new file mode 100644 index 0000000..91edeca --- /dev/null +++ b/src/wp-includes/js/tinymce/themes/advanced/skins/o2k7/ui.css @@ -0,0 +1,216 @@ +/* Reset */ +.o2k7Skin table, .o2k7Skin tbody, .o2k7Skin a, .o2k7Skin img, .o2k7Skin tr, .o2k7Skin div, .o2k7Skin td, .o2k7Skin iframe, .o2k7Skin span, .o2k7Skin *, .o2k7Skin .mceText {border:0; margin:0; padding:0; background:transparent; white-space:nowrap; text-decoration:none; font-weight:normal; cursor:default; color:#000; vertical-align:baseline; width:auto; border-collapse:separate; text-align:left} +.o2k7Skin a:hover, .o2k7Skin a:link, .o2k7Skin a:visited, .o2k7Skin a:active {text-decoration:none; font-weight:normal; cursor:default; color:#000} +.o2k7Skin table td {vertical-align:middle} + +/* Containers */ +.o2k7Skin table {background:transparent} +.o2k7Skin iframe {display:block;} +.o2k7Skin .mceToolbar {height:26px} + +/* External */ +.o2k7Skin .mceExternalToolbar {position:absolute; border:1px solid #ABC6DD; border-bottom:0; display:none} +.o2k7Skin .mceExternalToolbar td.mceToolbar {padding-right:13px;} +.o2k7Skin .mceExternalClose {position:absolute; top:3px; right:3px; width:7px; height:7px; background:url(../../img/icons.gif) -820px 0} + +/* Layout */ +.o2k7Skin table.mceLayout {border:0; border-left:1px solid #ABC6DD; border-right:1px solid #ABC6DD} +.o2k7Skin table.mceLayout tr.mceFirst td {border-top:1px solid #ABC6DD} +.o2k7Skin table.mceLayout tr.mceLast td {border-bottom:1px solid #ABC6DD} +.o2k7Skin table.mceToolbar, .o2k7Skin tr.mceFirst .mceToolbar tr td, .o2k7Skin tr.mceLast .mceToolbar tr td {border:0; margin:0; padding:0} +.o2k7Skin .mceIframeContainer {border-top:1px solid #ABC6DD; border-bottom:1px solid #ABC6DD} +.o2k7Skin td.mceToolbar{background:#E5EFFD} +.o2k7Skin .mceStatusbar {background:#E5EFFD; display:block; font-family:'MS Sans Serif',sans-serif,Verdana,Arial; font-size:9pt; line-height:16px; overflow:visible; color:#000; height:20px} +.o2k7Skin .mceStatusbar div {float:left; padding:2px} +.o2k7Skin .mceStatusbar a.mceResize {display:block; float:right; background:url(../../img/icons.gif) -800px 0; width:20px; height:20px; cursor:se-resize; outline:0} +.o2k7Skin .mceStatusbar a:hover {text-decoration:underline} +.o2k7Skin table.mceToolbar {margin-left:3px} +.o2k7Skin .mceToolbar .mceToolbarStart span {display:block; background:url(img/button_bg.png) -22px 0; width:1px; height:22px; margin-left:3px;} +.o2k7Skin .mceToolbar td.mceFirst span {margin:0} +.o2k7Skin .mceToolbar .mceToolbarEnd span {display:block; background:url(img/button_bg.png) -22px 0; width:1px; height:22px} +.o2k7Skin .mceToolbar .mceToolbarEndListBox span, .o2k7Skin .mceToolbar .mceToolbarStartListBox span {display:none} +.o2k7Skin span.mceIcon, .o2k7Skin img.mceIcon {display:block; width:20px; height:20px} +.o2k7Skin .mceIcon {background:url(../../img/icons.gif) no-repeat 20px 20px} +.o2k7Skin td.mceCenter {text-align:center;} +.o2k7Skin td.mceCenter table {margin:0 auto; text-align:left;} +.o2k7Skin td.mceRight table {margin:0 0 0 auto;} + +/* Button */ +.o2k7Skin .mceButton {display:block; background:url(img/button_bg.png); width:22px; height:22px} +.o2k7Skin a.mceButton span, .o2k7Skin a.mceButton img {margin-left:1px} +.o2k7Skin .mceOldBoxModel a.mceButton span, .o2k7Skin .mceOldBoxModel a.mceButton img {margin:0 0 0 1px} +.o2k7Skin a.mceButtonEnabled:hover {background-color:#B2BBD0; background-position:0 -22px} +.o2k7Skin a.mceButtonActive, .o2k7Skin a.mceButtonSelected {background-position:0 -44px} +.o2k7Skin .mceButtonDisabled .mceIcon {opacity:0.3; -ms-filter:'alpha(opacity=30)'; filter:alpha(opacity=30)} +.o2k7Skin .mceButtonLabeled {width:auto} +.o2k7Skin .mceButtonLabeled span.mceIcon {float:left} +.o2k7Skin span.mceButtonLabel {display:block; font-size:10px; padding:4px 6px 0 22px; font-family:Tahoma,Verdana,Arial,Helvetica} +.o2k7Skin .mceButtonDisabled .mceButtonLabel {color:#888} + +/* Separator */ +.o2k7Skin .mceSeparator {display:block; background:url(img/button_bg.png) -22px 0; width:5px; height:22px} + +/* ListBox */ +.o2k7Skin .mceListBox {margin-left:3px} +.o2k7Skin .mceListBox, .o2k7Skin .mceListBox a {display:block} +.o2k7Skin .mceListBox .mceText {padding-left:4px; text-align:left; width:70px; border:1px solid #b3c7e1; border-right:0; background:#eaf2fb; font-family:Tahoma,Verdana,Arial,Helvetica; font-size:11px; height:20px; line-height:20px; overflow:hidden} +.o2k7Skin .mceListBox .mceOpen {width:14px; height:22px; background:url(img/button_bg.png) -66px 0} +.o2k7Skin table.mceListBoxEnabled:hover .mceText, .o2k7Skin .mceListBoxHover .mceText, .o2k7Skin .mceListBoxSelected .mceText {background:#FFF} +.o2k7Skin table.mceListBoxEnabled:hover .mceOpen, .o2k7Skin .mceListBoxHover .mceOpen, .o2k7Skin .mceListBoxSelected .mceOpen {background-position:-66px -22px} +.o2k7Skin .mceListBoxDisabled .mceText {color:gray} +.o2k7Skin .mceListBoxMenu {overflow:auto; overflow-x:hidden} +.o2k7Skin .mceOldBoxModel .mceListBox .mceText {height:22px} +.o2k7Skin select.mceListBox {font-family:Tahoma,Verdana,Arial,Helvetica; font-size:12px; border:1px solid #b3c7e1; background:#FFF;} + +/* SplitButton */ +.o2k7Skin .mceSplitButton, .o2k7Skin .mceSplitButton a, .o2k7Skin .mceSplitButton span {display:block; height:22px; direction:ltr} +.o2k7Skin .mceSplitButton {background:url(img/button_bg.png)} +.o2k7Skin .mceSplitButton a.mceAction {width:22px} +.o2k7Skin .mceSplitButton span.mceAction {width:22px; background-image:url(../../img/icons.gif)} +.o2k7Skin .mceSplitButton a.mceOpen {width:10px; background:url(img/button_bg.png) -44px 0} +.o2k7Skin .mceSplitButton span.mceOpen {display:none} +.o2k7Skin table.mceSplitButtonEnabled:hover a.mceAction, .o2k7Skin .mceSplitButtonHover a.mceAction, .o2k7Skin .mceSplitButtonSelected {background:url(img/button_bg.png) 0 -22px} +.o2k7Skin table.mceSplitButtonEnabled:hover a.mceOpen, .o2k7Skin .mceSplitButtonHover a.mceOpen, .o2k7Skin .mceSplitButtonSelected a.mceOpen {background-position:-44px -44px} +.o2k7Skin .mceSplitButtonDisabled .mceAction {opacity:0.3; -ms-filter:'alpha(opacity=30)'; filter:alpha(opacity=30)} +.o2k7Skin .mceSplitButtonActive {background-position:0 -44px} + +/* ColorSplitButton */ +.o2k7Skin div.mceColorSplitMenu table {background:#FFF; border:1px solid gray} +.o2k7Skin .mceColorSplitMenu td {padding:2px} +.o2k7Skin .mceColorSplitMenu a {display:block; width:9px; height:9px; overflow:hidden; border:1px solid #808080} +.o2k7Skin .mceColorSplitMenu td.mceMoreColors {padding:1px 3px 1px 1px} +.o2k7Skin .mceColorSplitMenu a.mceMoreColors {width:100%; height:auto; text-align:center; font-family:Tahoma,Verdana,Arial,Helvetica; font-size:11px; line-height:20px; border:1px solid #FFF} +.o2k7Skin .mceColorSplitMenu a.mceMoreColors:hover {border:1px solid #0A246A; background-color:#B6BDD2} +.o2k7Skin a.mceMoreColors:hover {border:1px solid #0A246A} +.o2k7Skin .mceColorPreview {margin-left:2px; width:16px; height:4px; overflow:hidden; background:#9a9b9a;overflow:hidden} +.o2k7Skin .mce_forecolor span.mceAction, .o2k7Skin .mce_backcolor span.mceAction {height:15px;overflow:hidden} + +/* Menu */ +.o2k7Skin .mceMenu {position:absolute; left:0; top:0; z-index:1000; border:1px solid #ABC6DD} +.o2k7Skin .mceNoIcons span.mceIcon {width:0;} +.o2k7Skin .mceNoIcons a .mceText {padding-left:10px} +.o2k7Skin .mceMenu table {background:#FFF} +.o2k7Skin .mceMenu a, .o2k7Skin .mceMenu span, .o2k7Skin .mceMenu {display:block} +.o2k7Skin .mceMenu td {height:20px} +.o2k7Skin .mceMenu a {position:relative;padding:3px 0 4px 0} +.o2k7Skin .mceMenu .mceText {position:relative; display:block; font-family:Tahoma,Verdana,Arial,Helvetica; color:#000; cursor:default; margin:0; padding:0 25px 0 25px; display:block} +.o2k7Skin .mceMenu span.mceText, .o2k7Skin .mceMenu .mcePreview {font-size:11px} +.o2k7Skin .mceMenu pre.mceText {font-family:Monospace} +.o2k7Skin .mceMenu .mceIcon {position:absolute; top:0; left:0; width:22px;} +.o2k7Skin .mceMenu .mceMenuItemEnabled a:hover, .o2k7Skin .mceMenu .mceMenuItemActive {background-color:#dbecf3} +.o2k7Skin td.mceMenuItemSeparator {background:#DDD; height:1px} +.o2k7Skin .mceMenuItemTitle a {border:0; background:#E5EFFD; border-bottom:1px solid #ABC6DD} +.o2k7Skin .mceMenuItemTitle span.mceText {color:#000; font-weight:bold; padding-left:4px} +.o2k7Skin .mceMenuItemDisabled .mceText {color:#888} +.o2k7Skin .mceMenuItemSelected .mceIcon {background:url(../default/img/menu_check.gif)} +.o2k7Skin .mceNoIcons .mceMenuItemSelected a {background:url(../default/img/menu_arrow.gif) no-repeat -6px center} +.o2k7Skin .mceMenu span.mceMenuLine {display:none} +.o2k7Skin .mceMenuItemSub a {background:url(../default/img/menu_arrow.gif) no-repeat top right;} + +/* Progress,Resize */ +.o2k7Skin .mceBlocker {position:absolute; left:0; top:0; z-index:1000; opacity:0.5; -ms-filter:'alpha(opacity=30)'; filter:alpha(opacity=50); background:#FFF} +.o2k7Skin .mceProgress {position:absolute; left:0; top:0; z-index:1001; background:url(../default/img/progress.gif) no-repeat; width:32px; height:32px; margin:-16px 0 0 -16px} + +/* Formats */ +.o2k7Skin .mce_formatPreview a {font-size:10px} +.o2k7Skin .mce_p span.mceText {} +.o2k7Skin .mce_address span.mceText {font-style:italic} +.o2k7Skin .mce_pre span.mceText {font-family:monospace} +.o2k7Skin .mce_h1 span.mceText {font-weight:bolder; font-size: 2em} +.o2k7Skin .mce_h2 span.mceText {font-weight:bolder; font-size: 1.5em} +.o2k7Skin .mce_h3 span.mceText {font-weight:bolder; font-size: 1.17em} +.o2k7Skin .mce_h4 span.mceText {font-weight:bolder; font-size: 1em} +.o2k7Skin .mce_h5 span.mceText {font-weight:bolder; font-size: .83em} +.o2k7Skin .mce_h6 span.mceText {font-weight:bolder; font-size: .75em} + +/* Theme */ +.o2k7Skin span.mce_bold {background-position:0 0} +.o2k7Skin span.mce_italic {background-position:-60px 0} +.o2k7Skin span.mce_underline {background-position:-140px 0} +.o2k7Skin span.mce_strikethrough {background-position:-120px 0} +.o2k7Skin span.mce_undo {background-position:-160px 0} +.o2k7Skin span.mce_redo {background-position:-100px 0} +.o2k7Skin span.mce_cleanup {background-position:-40px 0} +.o2k7Skin span.mce_bullist {background-position:-20px 0} +.o2k7Skin span.mce_numlist {background-position:-80px 0} +.o2k7Skin span.mce_justifyleft {background-position:-460px 0} +.o2k7Skin span.mce_justifyright {background-position:-480px 0} +.o2k7Skin span.mce_justifycenter {background-position:-420px 0} +.o2k7Skin span.mce_justifyfull {background-position:-440px 0} +.o2k7Skin span.mce_anchor {background-position:-200px 0} +.o2k7Skin span.mce_indent {background-position:-400px 0} +.o2k7Skin span.mce_outdent {background-position:-540px 0} +.o2k7Skin span.mce_link {background-position:-500px 0} +.o2k7Skin span.mce_unlink {background-position:-640px 0} +.o2k7Skin span.mce_sub {background-position:-600px 0} +.o2k7Skin span.mce_sup {background-position:-620px 0} +.o2k7Skin span.mce_removeformat {background-position:-580px 0} +.o2k7Skin span.mce_newdocument {background-position:-520px 0} +.o2k7Skin span.mce_image {background-position:-380px 0} +.o2k7Skin span.mce_help {background-position:-340px 0} +.o2k7Skin span.mce_code {background-position:-260px 0} +.o2k7Skin span.mce_hr {background-position:-360px 0} +.o2k7Skin span.mce_visualaid {background-position:-660px 0} +.o2k7Skin span.mce_charmap {background-position:-240px 0} +.o2k7Skin span.mce_paste {background-position:-560px 0} +.o2k7Skin span.mce_copy {background-position:-700px 0} +.o2k7Skin span.mce_cut {background-position:-680px 0} +.o2k7Skin span.mce_blockquote {background-position:-220px 0} +.o2k7Skin .mce_forecolor span.mceAction {background-position:-720px 0} +.o2k7Skin .mce_backcolor span.mceAction {background-position:-760px 0} +.o2k7Skin span.mce_forecolorpicker {background-position:-720px 0} +.o2k7Skin span.mce_backcolorpicker {background-position:-760px 0} + +/* Plugins */ +.o2k7Skin span.mce_advhr {background-position:-0px -20px} +.o2k7Skin span.mce_ltr {background-position:-20px -20px} +.o2k7Skin span.mce_rtl {background-position:-40px -20px} +.o2k7Skin span.mce_emotions {background-position:-60px -20px} +.o2k7Skin span.mce_fullpage {background-position:-80px -20px} +.o2k7Skin span.mce_fullscreen {background-position:-100px -20px} +.o2k7Skin span.mce_iespell {background-position:-120px -20px} +.o2k7Skin span.mce_insertdate {background-position:-140px -20px} +.o2k7Skin span.mce_inserttime {background-position:-160px -20px} +.o2k7Skin span.mce_absolute {background-position:-180px -20px} +.o2k7Skin span.mce_backward {background-position:-200px -20px} +.o2k7Skin span.mce_forward {background-position:-220px -20px} +.o2k7Skin span.mce_insert_layer {background-position:-240px -20px} +.o2k7Skin span.mce_insertlayer {background-position:-260px -20px} +.o2k7Skin span.mce_movebackward {background-position:-280px -20px} +.o2k7Skin span.mce_moveforward {background-position:-300px -20px} +.o2k7Skin span.mce_media {background-position:-320px -20px} +.o2k7Skin span.mce_nonbreaking {background-position:-340px -20px} +.o2k7Skin span.mce_pastetext {background-position:-360px -20px} +.o2k7Skin span.mce_pasteword {background-position:-380px -20px} +.o2k7Skin span.mce_selectall {background-position:-400px -20px} +.o2k7Skin span.mce_preview {background-position:-420px -20px} +.o2k7Skin span.mce_print {background-position:-440px -20px} +.o2k7Skin span.mce_cancel {background-position:-460px -20px} +.o2k7Skin span.mce_save {background-position:-480px -20px} +.o2k7Skin span.mce_replace {background-position:-500px -20px} +.o2k7Skin span.mce_search {background-position:-520px -20px} +.o2k7Skin span.mce_styleprops {background-position:-560px -20px} +.o2k7Skin span.mce_table {background-position:-580px -20px} +.o2k7Skin span.mce_cell_props {background-position:-600px -20px} +.o2k7Skin span.mce_delete_table {background-position:-620px -20px} +.o2k7Skin span.mce_delete_col {background-position:-640px -20px} +.o2k7Skin span.mce_delete_row {background-position:-660px -20px} +.o2k7Skin span.mce_col_after {background-position:-680px -20px} +.o2k7Skin span.mce_col_before {background-position:-700px -20px} +.o2k7Skin span.mce_row_after {background-position:-720px -20px} +.o2k7Skin span.mce_row_before {background-position:-740px -20px} +.o2k7Skin span.mce_merge_cells {background-position:-760px -20px} +.o2k7Skin span.mce_table_props {background-position:-980px -20px} +.o2k7Skin span.mce_row_props {background-position:-780px -20px} +.o2k7Skin span.mce_split_cells {background-position:-800px -20px} +.o2k7Skin span.mce_template {background-position:-820px -20px} +.o2k7Skin span.mce_visualchars {background-position:-840px -20px} +.o2k7Skin span.mce_abbr {background-position:-860px -20px} +.o2k7Skin span.mce_acronym {background-position:-880px -20px} +.o2k7Skin span.mce_attribs {background-position:-900px -20px} +.o2k7Skin span.mce_cite {background-position:-920px -20px} +.o2k7Skin span.mce_del {background-position:-940px -20px} +.o2k7Skin span.mce_ins {background-position:-960px -20px} +.o2k7Skin span.mce_pagebreak {background-position:0 -40px} +.o2k7Skin span.mce_restoredraft {background-position:-20px -40px} +.o2k7Skin span.mce_spellchecker {background-position:-540px -20px} diff --git a/src/wp-includes/js/tinymce/themes/advanced/skins/o2k7/ui_black.css b/src/wp-includes/js/tinymce/themes/advanced/skins/o2k7/ui_black.css new file mode 100644 index 0000000..85812cd --- /dev/null +++ b/src/wp-includes/js/tinymce/themes/advanced/skins/o2k7/ui_black.css @@ -0,0 +1,8 @@ +/* Black */ +.o2k7SkinBlack .mceToolbar .mceToolbarStart span, .o2k7SkinBlack .mceToolbar .mceToolbarEnd span, .o2k7SkinBlack .mceButton, .o2k7SkinBlack .mceSplitButton, .o2k7SkinBlack .mceSeparator, .o2k7SkinBlack .mceSplitButton a.mceOpen, .o2k7SkinBlack .mceListBox a.mceOpen {background-image:url(img/button_bg_black.png)} +.o2k7SkinBlack td.mceToolbar, .o2k7SkinBlack td.mceStatusbar, .o2k7SkinBlack .mceMenuItemTitle a, .o2k7SkinBlack .mceMenuItemTitle span.mceText, .o2k7SkinBlack .mceStatusbar div, .o2k7SkinBlack .mceStatusbar span, .o2k7SkinBlack .mceStatusbar a {background:#535353; color:#FFF} +.o2k7SkinBlack table.mceListBoxEnabled .mceText, o2k7SkinBlack .mceListBox .mceText {background:#FFF; border:1px solid #CBCFD4; border-bottom-color:#989FA9; border-right:0} +.o2k7SkinBlack table.mceListBoxEnabled:hover .mceText, .o2k7SkinBlack .mceListBoxHover .mceText, .o2k7SkinBlack .mceListBoxSelected .mceText {background:#FFF; border:1px solid #FFBD69; border-right:0} +.o2k7SkinBlack .mceExternalToolbar, .o2k7SkinBlack .mceListBox .mceText, .o2k7SkinBlack div.mceMenu, .o2k7SkinBlack table.mceLayout, .o2k7SkinBlack .mceMenuItemTitle a, .o2k7SkinBlack table.mceLayout tr.mceFirst td, .o2k7SkinBlack table.mceLayout, .o2k7SkinBlack .mceMenuItemTitle a, .o2k7SkinBlack table.mceLayout tr.mceLast td, .o2k7SkinBlack .mceIframeContainer {border-color: #535353;} +.o2k7SkinBlack table.mceSplitButtonEnabled:hover a.mceAction, .o2k7SkinBlack .mceSplitButtonHover a.mceAction, .o2k7SkinBlack .mceSplitButtonSelected {background-image:url(img/button_bg_black.png)} +.o2k7SkinBlack .mceMenu .mceMenuItemEnabled a:hover, .o2k7SkinBlack .mceMenu .mceMenuItemActive {background-color:#FFE7A1} \ No newline at end of file diff --git a/src/wp-includes/js/tinymce/themes/advanced/skins/o2k7/ui_silver.css b/src/wp-includes/js/tinymce/themes/advanced/skins/o2k7/ui_silver.css new file mode 100644 index 0000000..d64c361 --- /dev/null +++ b/src/wp-includes/js/tinymce/themes/advanced/skins/o2k7/ui_silver.css @@ -0,0 +1,5 @@ +/* Silver */ +.o2k7SkinSilver .mceToolbar .mceToolbarStart span, .o2k7SkinSilver .mceButton, .o2k7SkinSilver .mceSplitButton, .o2k7SkinSilver .mceSeparator, .o2k7SkinSilver .mceSplitButton a.mceOpen, .o2k7SkinSilver .mceListBox a.mceOpen {background-image:url(img/button_bg_silver.png)} +.o2k7SkinSilver td.mceToolbar, .o2k7SkinSilver td.mceStatusbar, .o2k7SkinSilver .mceMenuItemTitle a {background:#eee} +.o2k7SkinSilver .mceListBox .mceText {background:#FFF} +.o2k7SkinSilver .mceExternalToolbar, .o2k7SkinSilver .mceListBox .mceText, .o2k7SkinSilver div.mceMenu, .o2k7SkinSilver table.mceLayout, .o2k7SkinSilver .mceMenuItemTitle a, .o2k7SkinSilver table.mceLayout tr.mceFirst td, .o2k7SkinSilver table.mceLayout, .o2k7SkinSilver .mceMenuItemTitle a, .o2k7SkinSilver table.mceLayout tr.mceLast td, .o2k7SkinSilver .mceIframeContainer {border-color: #bbb} diff --git a/src/wp-includes/js/tinymce/themes/advanced/skins/wp_theme/content.css b/src/wp-includes/js/tinymce/themes/advanced/skins/wp_theme/content.css new file mode 100644 index 0000000..0b7ec9f --- /dev/null +++ b/src/wp-includes/js/tinymce/themes/advanced/skins/wp_theme/content.css @@ -0,0 +1,96 @@ +body { + font: 13px/19px Georgia, "Times New Roman", "Bitstream Charter", Times, serif; + margin: 0.6em; + color: #000; +} +body.mceForceColors {background:#FFF; color:#000;} +body.mceBrowserDefaults {background:transparent; color:inherit; font-size:inherit; font-family:inherit;} +td {color:#000; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px; margin:8px;} +h1 {font-size: 2em} +h2 {font-size: 1.5em} +h3 {font-size: 1.17em} +h4 {font-size: 1em} +h5 {font-size: .83em} +h6 {font-size: .75em} +.mceItemTable, .mceItemTable td, .mceItemTable th, .mceItemTable caption, .mceItemVisualAid {border: 1px dashed #BBB;} +a.mceItemAnchor {display:inline-block; width:11px !important; height:11px !important; background:url(img/items.gif) no-repeat 0 0;} +span.mceItemNbsp {background: #DDD} +td.mceSelected, th.mceSelected {background-color:#3399ff !important} +img {border:0;} +table {cursor:default} +table td, table th {cursor:text} +ins {border-bottom:1px solid green; text-decoration: none; color:green} +del {color:red; text-decoration:line-through} +cite {border-bottom:1px dashed blue} +acronym {border-bottom:1px dotted #CCC; cursor:help} +abbr {border-bottom:1px dashed #CCC; cursor:help} + +img:-moz-broken {-moz-force-broken-image-icon:1; width:24px; height:24px} +font[face=mceinline] {font-family:inherit !important} + +.mceItemMedia {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)} +.mceItemVideo {background-image:url(../../img/video.gif)} +.mceItemIframe {background-image:url(../../img/iframe.gif)} +.mcePageBreak {display:block;border:0;width:100%;height:12px;border-top:1px dotted #ccc;margin-top:15px;background:#fff url(../../img/pagebreak.gif) no-repeat center top;} + +/* WordPress styles */ + +.aligncenter, +dl.aligncenter { + display: block; + margin-left: auto; + margin-right: auto; +} + +.alignleft { + float: left; +} + +.alignright { + float: right; +} + +.wp-caption { + border: 1px solid #ddd; + text-align: center; + background-color: #f3f3f3; + padding-top: 4px; + margin: 10px; + -moz-border-radius: 3px; + -khtml-border-radius: 3px; + -webkit-border-radius: 3px; + border-radius: 3px; +} + +.mceIEcenter { + text-align: center; +} + +.wp-caption img { + margin: 0; + padding: 0; + border: 0 none; +} + +.wp-caption-dd { + font-size: 11px; + line-height: 17px; + padding: 0 4px 5px; + margin: 0; +} + +pre { + font: 12px/18px Consolas, Monaco, monospace; +} + +td { + color: #000; + font-size: 11px; + margin: 8px; +} + diff --git a/src/wp-includes/js/tinymce/themes/advanced/skins/wp_theme/dialog.css b/src/wp-includes/js/tinymce/themes/advanced/skins/wp_theme/dialog.css new file mode 100644 index 0000000..7fe6b8d --- /dev/null +++ b/src/wp-includes/js/tinymce/themes/advanced/skins/wp_theme/dialog.css @@ -0,0 +1,117 @@ +/* Generic */ +body { +font-family:Verdana, Arial, Helvetica, sans-serif; font-size:11px; +background:#f1f1f1; +padding:0; +margin:8px 8px 0 8px; +} + +html {background:#f1f1f1;} +td {font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px;} +textarea {resize:none;outline:none;} +a:link, a:visited {color:black;} +a:hover {color:#2B6FB6;} +.nowrap {white-space: nowrap} + +/* Forms */ +fieldset {margin:0; padding:4px; border:1px solid #dfdfdf; font-family:Verdana, Arial; font-size:10px;} +legend {color:#2B6FB6; font-weight:bold;} +label.msg {display:none;} +label.invalid {color:#EE0000; display:inline;} +input.invalid {border:1px solid #EE0000;} +input {background:#FFF; border:1px solid #dfdfdf;} +input, select, textarea {font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px;} +input, select, textarea {border:1px solid #dfdfdf;} +input.radio {border:1px none #000000; background:transparent; vertical-align:middle;} +input.checkbox {border:1px none #000000; background:transparent; vertical-align:middle;} +.input_noborder {border:0;} + +/* Buttons */ +#insert, #cancel, #apply, .mceActionPanel .button, input.mceButton, .updateButton { + border: 1px solid #bbb; + margin:0; + padding:0 0 1px; + font-weight:bold; + font-size: 11px; + width:94px; + height:24px; + background:url(img/fade-butt.png) 0 0; + color:#000; + cursor:pointer; + -moz-border-radius: 3px; + -khtml-border-radius: 3px; + -webkit-border-radius: 3px; + border-radius: 3px; +} +#insert:hover, #cancel:hover, input.mceButton:hover, .updateButton:hover, +#insert:focus, #cancel:focus, input.mceButton:focus, .updateButton:focus { + border: 1px solid #555; +} + +/* Browse */ +a.browse span {display:block; width:20px; height:18px; background:url(../../img/icons.gif) -860px 0; border:1px solid #FFF; margin-left:1px;} +.mceOldBoxModel a.browse span {width:22px; height:20px;} +a.browse:hover span {border:1px solid #0A246A; background-color:#B2BBD0;} +a.browse span.disabled {border:1px solid white; -moz-opacity:0.3; opacity:0.3; filter:progid:DXImageTransform.Microsoft.Alpha(opacity=30);} +a.browse:hover span.disabled {border:1px solid white; background-color:transparent;} +a.pickcolor span {display:block; width:20px; height:16px; background:url(../../img/icons.gif) -840px 0; margin-left:2px;} +.mceOldBoxModel a.pickcolor span {width:21px; height:17px;} +a.pickcolor:hover span {background-color:#B2BBD0;} +a.pickcolor, a.browse {text-decoration:none} + +/* Charmap */ +table.charmap {border:1px solid #AAA; text-align:center} +td.charmap, #charmap a {width:18px; height:18px; color:#000; border:1px solid #AAA; text-align:center; font-size:12px; vertical-align:middle; line-height: 18px;} +#charmap a {display:block; color:#000; text-decoration:none; border:0} +#charmap a:hover {background:#CCC;color:#2B6FB6} +#charmap #codeN {font-size:10px; font-family:Arial,Helvetica,sans-serif; text-align:center} +#charmap #codeV {font-size:40px; height:80px; border:1px solid #AAA; text-align:center} +#charmap #charmapView {background-color:#fff;} + +/* Source */ +.wordWrapCode {vertical-align:middle; border:1px none #000000; background:transparent;} +.mceActionPanel {margin-top:5px;} + +/* Tabs classes */ +.tabs {width:100%; height:18px; line-height:normal; background:url(img/tabs.gif) repeat-x 0 -72px;} +.tabs ul {margin:0; padding:0; list-style:none;} +.tabs li {float:left; background:url(img/tabs.gif) no-repeat 0 0; margin:0 2px 0 0; padding:0 0 0 10px; line-height:17px; height:18px; display:block;} +.tabs li.current {background:url(img/tabs.gif) no-repeat 0 -18px; margin-right:2px;} +.tabs span {float:left; display:block; background:url(img/tabs.gif) no-repeat right -36px; padding:0px 10px 0 0;} +.tabs .current span {background:url(img/tabs.gif) no-repeat right -54px;} +.tabs a {text-decoration:none; font-family:Verdana, Arial; font-size:10px;} +.tabs a:link, .tabs a:visited, .tabs a:hover {color:black;} + +/* Panels */ +.panel_wrapper div.panel {display:none;} +.panel_wrapper div.current {display:block; width:100%; height:300px; overflow:visible;} +.panel_wrapper {border:1px solid #919B9C; border-top:0px; padding:10px; padding-top:5px; clear:both; background:white;} + +/* Columns */ +.column {float:left;} +.properties {width:100%;} +.properties .column1 {} +.properties .column2 {text-align:left;} + +/* Titles */ +h1, h2, h3, h4 {color:#2B6FB6; margin:0; padding:0; padding-top:5px;} +h3 {font-size:14px;} +.title {font-size:12px; font-weight:bold; color:#2B6FB6;} + +/* Dialog specific */ +#link .panel_wrapper, #link div.current {height:125px;} +#image .panel_wrapper, #image div.current {height:200px;} +#plugintable thead {font-weight:bold; background:#DDD;} +#plugintable, #about #plugintable td {border:1px solid #919B9C;} +#plugintable {width:96%; margin-top:10px;} +#pluginscontainer {height:290px; overflow:auto;} +#colorpicker #preview {float:right; width:50px; height:14px;line-height:1px; border:1px solid black; margin-left:5px;} +#colorpicker #colors {float:left; border:1px solid gray; cursor:crosshair;} +#colorpicker #light {border:1px solid gray; margin-left:5px; float:left;width:15px; height:150px; cursor:crosshair;} +#colorpicker #light div {overflow:hidden;} +#colorpicker #previewblock {float:right; padding-left:10px; height:20px;} +#colorpicker .panel_wrapper div.current {height:175px;} +#colorpicker #namedcolors {width:150px;} +#colorpicker #namedcolors a {display:block; float:left; width:10px; height:10px; margin:1px 1px 0 0; overflow:hidden;} +#colorpicker #colornamecontainer {margin-top:5px;} +#colorpicker #picker_panel fieldset {margin:auto;width:325px;} \ No newline at end of file diff --git a/src/wp-includes/js/tinymce/themes/advanced/skins/wp_theme/img/butt2.png b/src/wp-includes/js/tinymce/themes/advanced/skins/wp_theme/img/butt2.png new file mode 100644 index 0000000..adb83cd Binary files /dev/null and b/src/wp-includes/js/tinymce/themes/advanced/skins/wp_theme/img/butt2.png differ diff --git a/src/wp-includes/js/tinymce/themes/advanced/skins/wp_theme/img/button_bg.png b/src/wp-includes/js/tinymce/themes/advanced/skins/wp_theme/img/button_bg.png new file mode 100644 index 0000000..12cfb41 Binary files /dev/null and b/src/wp-includes/js/tinymce/themes/advanced/skins/wp_theme/img/button_bg.png differ diff --git a/src/wp-includes/js/tinymce/themes/advanced/skins/wp_theme/img/down_arrow.gif b/src/wp-includes/js/tinymce/themes/advanced/skins/wp_theme/img/down_arrow.gif new file mode 100644 index 0000000..687b241 Binary files /dev/null and b/src/wp-includes/js/tinymce/themes/advanced/skins/wp_theme/img/down_arrow.gif differ diff --git a/src/wp-includes/js/tinymce/themes/advanced/skins/wp_theme/img/fade-butt.png b/src/wp-includes/js/tinymce/themes/advanced/skins/wp_theme/img/fade-butt.png new file mode 100644 index 0000000..42f08b7 Binary files /dev/null and b/src/wp-includes/js/tinymce/themes/advanced/skins/wp_theme/img/fade-butt.png differ diff --git a/src/wp-includes/js/tinymce/themes/advanced/skins/wp_theme/img/separator.gif b/src/wp-includes/js/tinymce/themes/advanced/skins/wp_theme/img/separator.gif new file mode 100644 index 0000000..4f39b80 Binary files /dev/null and b/src/wp-includes/js/tinymce/themes/advanced/skins/wp_theme/img/separator.gif differ diff --git a/src/wp-includes/js/tinymce/themes/advanced/skins/wp_theme/img/tabs.gif b/src/wp-includes/js/tinymce/themes/advanced/skins/wp_theme/img/tabs.gif new file mode 100644 index 0000000..ce4be63 Binary files /dev/null and b/src/wp-includes/js/tinymce/themes/advanced/skins/wp_theme/img/tabs.gif differ diff --git a/src/wp-includes/js/tinymce/themes/advanced/skins/wp_theme/ui.css b/src/wp-includes/js/tinymce/themes/advanced/skins/wp_theme/ui.css new file mode 100644 index 0000000..584980f --- /dev/null +++ b/src/wp-includes/js/tinymce/themes/advanced/skins/wp_theme/ui.css @@ -0,0 +1,560 @@ +/* Reset */ +.wp_themeSkin table, .wp_themeSkin tbody, .wp_themeSkin a, .wp_themeSkin img, .wp_themeSkin tr, .wp_themeSkin div, .wp_themeSkin td, .wp_themeSkin iframe, .wp_themeSkin span, .wp_themeSkin *, .wp_themeSkin .mceText { +border:0; margin:0; padding:0; white-space:nowrap; text-decoration:none; font-weight:normal; cursor:default; vertical-align:baseline; width:auto; border-collapse:separate; +} +.wp_themeSkin a:hover, .wp_themeSkin a:link, .wp_themeSkin a:visited, .wp_themeSkin a:active {text-decoration:none; font-weight:normal; cursor:default;} +.wp_themeSkin table td {vertical-align:middle} + +/* Containers */ +.wp_themeSkin table {} +.wp_themeSkin iframe {display:block;} +.wp_themeSkin .mceToolbar {padding: 2px;} + +/* External */ +.wp_themeSkin .mceExternalToolbar {position:absolute; border-bottom:0; display:none} +.wp_themeSkin .mceExternalToolbar td.mceToolbar {padding-right:13px;} +.wp_themeSkin .mceExternalClose {position:absolute; top:3px; right:3px; width:7px; height:7px; background:url(../../img/icons.gif) -820px 0} + +/* Layout */ +.wp_themeSkin table.mceToolbar, .wp_themeSkin tr.mceFirst .mceToolbar tr td, .wp_themeSkin tr.mceLast .mceToolbar tr td {border:0; margin:0; padding:0} +.wp_themeSkin table.mceLayout {border:0;} +.wp_themeSkin .mceIframeContainer {} +.wp_themeSkin .mceStatusbar { + display: block; + font-family: Arial, "Bitstream Vera Sans", Helvetica, Verdana, sans-serif; + font-size: 12px; + line-height: 16px; + padding-left: 5px; + overflow: visible; + height: 20px; + border-top-width: 1px; + border-top-style: solid; +} +.wp_themeSkin .mceStatusbar div {float:left; padding:2px;} +.wp_themeSkin .mceStatusbar a.mceResize { + display: block; + float: right; + background: url(../../img/icons.gif) -800px 0; + width: 20px; + height: 20px; + cursor: se-resize +} +.wp_themeSkin .mceStatusbar a:hover {text-decoration:underline} +.wp_themeSkin table.mceToolbar {margin: 0 2px 2px;} +.wp_themeSkin #content_toolbar1 {margin-top: 2px;} +.wp_themeSkin .mceToolbar .mceToolbarEndListBox span {display:none} +.wp_themeSkin span.mceIcon, .wp_themeSkin img.mceIcon {display:block; width:20px; height:20px} +.wp_themeSkin .mceIcon {background:url(../../img/icons.gif) no-repeat 20px 20px} + +/* Button */ +.wp_themeSkin .mceButton { + display:block; + width: 20px; + height: 20px; + cursor: default; + padding: 1px 2px; + margin: 1px; + -moz-border-radius: 2px; + -webkit-border-radius: 2px; + -khtml-border-radius: 2px; + border-radius: 2px; + -webkit-box-shadow: 0 1px 0 rgba(0, 0, 0, 0.15), inset 0 0 2px 1px #fff; + -moz-box-shadow: 0 1px 0 rgba(0, 0, 0, 0.15), inset 0 0 2px 1px #fff; + box-shadow: 0 1px 0 rgba(0, 0, 0, 0.15), inset 0 0 2px 1px #fff; +} + +.wp_themeSkin a.mceButtonEnabled:hover { + background-image: inherit 0 -10px; +} + +.wp_themeSkin .mceOldBoxModel a.mceButton span, .wp_themeSkin .mceOldBoxModel a.mceButton img {margin:0 0 0 1px} + +.wp_themeSkin a.mceButton:active, +.wp_themeSkin a.mceButtonActive, +.wp_themeSkin a.mceButtonActive:hover, +.wp_themeSkin a.mceButtonSelected { + -webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, 0.15), inset 0 0 2px 1px #fff; + -moz-box-shadow: 0 1px 0 rgba(0, 0, 0, 0.15), inset 0 0 2px 1px #fff; + box-shadow: 0 1px 0 rgba(0, 0, 0, 0.15), inset 0 0 2px 1px #fff; +} +.wp_themeSkin .mceButtonDisabled .mceIcon {opacity:0.4; filter:alpha(opacity=40);} + +/* Separator */ +.wp_themeSkin .mceSeparator { + height: 24px; + width: 1px; + display: block; + background: transparent; + overflow: hidden; + margin: 0 2px; +} + +/* ListBox */ +.wp_themeSkin .mceListBox, .wp_themeSkin .mceListBox a {display:block} +.wp_themeSkin .mceListBox .mceText { + padding: 1px 2px 1px 5px; + text-align:left; + text-decoration: none; + width:70px; + -moz-border-bottom-left-radius: 2px; + -webkit-border-bottom-left-radius: 2px; + -khtml-border-bottom-left-radius: 2px; + border-bottom-left-radius: 2px; + -moz-border-top-left-radius: 2px; + -webkit-border-top-left-radius: 2px; + -khtml-border-top-left-radius: 2px; + border-top-left-radius: 2px; + -webkit-box-shadow: 0 1px 0 rgba(0, 0, 0, 0.15), inset 0 0 2px 1px #fff; + -moz-box-shadow: 0 1px 0 rgba(0, 0, 0, 0.15), inset 0 0 2px 1px #fff; + box-shadow: 0 1px 0 rgba(0, 0, 0, 0.15), inset 0 0 2px 1px #fff; + font-family: Arial, "Bitstream Vera Sans", Helvetica, Verdana, sans-serif; + font-size: 12px; + height: 20px; + line-height: 20px; + overflow: hidden; +} +.wp_themeSkin .mceListBox { + margin: 1px; + direction: ltr; +} +.wp_themeSkin .mceListBox .mceOpen { + width: 14px; + height: 20px; + border-collapse: separate; + padding: 1px; + -moz-border-bottom-left-radius: 0; + -webkit-border-bottom-left-radius: 0; + -khtml-border-bottom-left-radius: 0; + border-bottom-left-radius: 0; + -moz-border-top-left-radius: 0; + -webkit-border-top-left-radius: 0; + -khtml-border-top-left-radius: 0; + border-top-left-radius: 0; + -webkit-box-shadow: 0 1px 0 rgba(0, 0, 0, 0.15), inset 0 0 2px 1px #fff; + -moz-box-shadow: 0 1px 0 rgba(0, 0, 0, 0.15), inset 0 0 2px 1px #fff; + box-shadow: 0 1px 0 rgba(0, 0, 0, 0.15), inset 0 0 2px 1px #fff; +} +.wp_themeSkin .mceListBox .mceOpen span { + display: block; + width:14px; + height:20px; + background-image: url(img/down_arrow.gif); + background-position: 2px 1px; + background-repeat: no-repeat; +} +.wp_themeSkin table.mceListBoxEnabled:hover .mceText, +.wp_themeSkin .mceListBoxHover .mceText, +.wp_themeSkin .mceListBoxSelected .mceText, +.wp_themeSkin table.mceListBoxEnabled:hover .mceOpen, +.wp_themeSkin .mceListBoxHover .mceOpen, +.wp_themeSkin .mceListBoxSelected .mceOpen { + background-image: none; +} +.wp_themeSkin .mceListBoxDisabled .mceText {color:gray} +.wp_themeSkin .mceListBoxMenu {overflow:auto; overflow-x:hidden} +.wp_themeSkin .mceOldBoxModel .mceListBox .mceText {height:22px} +.wp_themeSkin select.mceListBox { + font-family: Arial, "Bitstream Vera Sans", Helvetica, Verdana, sans-serif; + font-size:12px; +} + +/* SplitButton */ +.wp_themeSkin .mceSplitButton a, .wp_themeSkin .mceSplitButton span {display:block; height:20px} +.wp_themeSkin .mceSplitButton { + display:block; + margin: 1px; + direction: ltr; +} +.wp_themeSkin table.mceSplitButton td { + padding: 2px; + -moz-border-bottom-left-radius: 0; + -webkit-border-bottom-left-radius: 0; + -khtml-border-bottom-left-radius: 0; + border-bottom-left-radius: 0; + -moz-border-top-left-radius: 0; + -webkit-border-top-left-radius: 0; + -khtml-border-top-left-radius: 0; + border-top-left-radius: 0; +} + +.wp_themeSkin table.mceSplitButton td a { + -webkit-box-shadow: 0 1px 0 rgba(0, 0, 0, 0.15), inset 0 0 2px 1px #fff; + -moz-box-shadow: 0 1px 0 rgba(0, 0, 0, 0.15), inset 0 0 2px 1px #fff; + box-shadow: 0 1px 0 rgba(0, 0, 0, 0.15), inset 0 0 2px 1px #fff; +} + +.wp_themeSkin table.mceSplitButton:hover td { + background-image: inherit 0 -10px; +} + +.wp_themeSkin .mceSplitButton a.mceAction { + height:20px; + width:20px; + padding: 1px 2px; +} +.wp_themeSkin .mceSplitButton span.mceAction { + background-image: url(../../img/icons.gif); + background-repeat: no-repeat; + background-color: transparent; + width:20px; +} +.wp_themeSkin .mceSplitButton a.mceOpen { + width:10px; + height:20px; + background-image: url(img/down_arrow.gif); + background-position: 1px 2px; + background-repeat: no-repeat; + padding: 1px; + border-left: 0 none !important; +} +.wp_themeSkin .mceSplitButton span.mceOpen {display:none} +.wp_themeSkin .mceSplitButtonDisabled .mceAction { + opacity:0.3; filter:alpha(opacity=30); +} +.wp_themeSkin .mceListBox a.mceText, .wp_themeSkin .mceSplitButton a.mceAction { + -moz-border-radius-bottomleft: 3px; + -webkit-border-bottom-left-radius: 3px; + -khtml-border-bottom-left-radius: 3px; + border-bottom-left-radius: 3px; + -moz-border-radius-topleft: 3px; + -webkit-border-top-left-radius: 3px; + -khtml-border-top-left-radius: 3px; + border-top-left-radius: 3px; +} +.wp_themeSkin .mceSplitButton a.mceOpen, .wp_themeSkin .mceListBox a.mceOpen { + -moz-border-radius-bottomright: 3px; + -webkit-border-bottom-right-radius: 3px; + -khtml-border-bottom-right-radius: 3px; + border-bottom-right-radius: 3px; + -moz-border-radius-topright: 3px; + -webkit-border-top-right-radius: 3px; + -khtml-border-top-right-radius: 3px; + border-top-right-radius: 3px; +} + +.wp_themeSkin span.mce_undo, +.wp_themeSkin span.mce_redo, +.wp_themeSkin span.mce_bullist, +.wp_themeSkin span.mce_numlist, +.wp_themeSkin span.mce_blockquote, +.wp_themeSkin span.mce_charmap, +.wp_themeSkin span.mce_bold, +.wp_themeSkin span.mce_italic, +.wp_themeSkin span.mce_underline, +.wp_themeSkin span.mce_justifyleft, +.wp_themeSkin span.mce_justifyright, +.wp_themeSkin span.mce_justifycenter, +.wp_themeSkin span.mce_justifyfull, +.wp_themeSkin span.mce_indent, +.wp_themeSkin span.mce_outdent, +.wp_themeSkin span.mce_link, +.wp_themeSkin span.mce_unlink, +.wp_themeSkin span.mce_help, +.wp_themeSkin span.mce_removeformat, +.wp_themeSkin span.mce_fullscreen, +.wp_themeSkin span.mce_media, +.wp_themeSkin span.mce_pastetext, +.wp_themeSkin span.mce_pasteword, +.wp_themeSkin span.mce_wp_help, +.wp_themeSkin span.mce_wp_adv, +.wp_themeSkin span.mce_wp_more, +.wp_themeSkin span.mce_strikethrough, +.wp_themeSkin span.mce_spellchecker, +.wp_themeSkin span.mce_forecolor, +.wp_themeSkin .mce_forecolorpicker, +.wp_themeSkin .mceSplitButton .mce_spellchecker span.mce_spellchecker, +.wp_themeSkin .mceSplitButton .mce_forecolor span.mce_forecolor, +.wp_themeSkin .mceSplitButton span.mce_numlist, +.wp_themeSkin .mceSplitButton span.mce_bullist { + background-image: url(../../img/wpicons.png); +} + +/* ColorSplitButton */ +.wp_themeSkin div.mceColorSplitMenu table {} +.wp_themeSkin .mceColorSplitMenu td {padding:2px} +.wp_themeSkin .mceColorSplitMenu a {display:block; width:9px; height:9px; overflow:hidden;} +.wp_themeSkin .mceColorSplitMenu td.mceMoreColors {padding:1px 3px 1px 1px} +.wp_themeSkin .mceColorSplitMenu a.mceMoreColors {width:100%; height:auto; text-align:center; font-family:Tahoma,Verdana,Arial,Helvetica; font-size:11px; line-height:20px;} +.wp_themeSkin .mceColorSplitMenu a.mceMoreColors:hover {} +.wp_themeSkin a.mceMoreColors:hover {} +.wp_themeSkin .mceColorPreview {margin: -5px 0 0 2px; width:16px; height:4px; overflow:hidden} + +/* Menu */ +.wp_themeSkin .mceMenu {position:absolute; left:0; top:0; z-index:1000;} +.wp_themeSkin .mceNoIcons span.mceIcon {width:0;} +.wp_themeSkin .mceNoIcons a .mceText {padding-left:10px} +.wp_themeSkin .mceMenu table {} +.wp_themeSkin .mceMenu a, .wp_themeSkin .mceMenu span, .wp_themeSkin .mceMenu {display:block} +.wp_themeSkin .mceMenu td {height:20px;overflow:hidden;} +.wp_themeSkin .mceMenu a { + position:relative; + padding:3px 0 4px 0; + text-decoration: none !important; +} +.wp_themeSkin .mceMenu .mceText { + position:relative; + display:block; + font-family:Tahoma,Verdana,Arial,Helvetica; + cursor:default; + margin:0; + padding:0 25px; +} +.wp_themeSkin .mceMenu span.mceText, .wp_themeSkin .mceMenu .mcePreview { + font-size: 12px; +} +.wp_themeSkin .mceMenu pre.mceText {font-family:Monospace} +.wp_themeSkin .mceMenu .mceIcon {position:absolute; top:0; left:0; width:22px;} +.wp_themeSkin .mceMenu .mceMenuItemEnabled a:hover, +.wp_themeSkin .mceMenu .mceMenuItemActive {} +.wp_themeSkin td.mceMenuItemSeparator {height:1px} +.wp_themeSkin .mceMenuItemTitle a { + border-top: 0; + border-right: 0; + border-left: 0; + border-bottom-style: solid; + border-bottom-width: 1px; + text-decoration: none !important; +} +.wp_themeSkin .mceMenuItemTitle span.mceText {font-weight:bold; padding-left:4px} +.wp_themeSkin .mceMenuItemDisabled .mceText {} +.wp_themeSkin .mceMenuItemSelected .mceIcon {background:url(../default/img/menu_check.gif)} +.wp_themeSkin .mceNoIcons .mceMenuItemSelected a {background:url(../default/img/menu_arrow.gif) no-repeat -6px center} +.wp_themeSkin .mceMenu span.mceMenuLine {display:none} +.wp_themeSkin .mceMenuItemSub a {background:url(../default/img/menu_arrow.gif) no-repeat top right;} + +/* Progress,Resize */ +.wp_themeSkin .mceBlocker {position:absolute; left:0; top:0; z-index:1000; opacity:0.5; filter:alpha(opacity=50); background:#FFF} +.wp_themeSkin .mceProgress {position:absolute; left:0; top:0; z-index:1001; background:url(../default/img/progress.gif) no-repeat; width:32px; height:32px; margin:-16px 0 0 -16px} +.wp_themeSkin .mcePlaceHolder {border:1px dotted gray} + +/* Formats */ +.wp_themeSkin .mce_p span.mceText {} +.wp_themeSkin .mce_address span.mceText {font-style:italic} +.wp_themeSkin .mce_pre span.mceText {font-family:monospace} +.wp_themeSkin .mce_h1 span.mceText {font-weight:bolder; font-size: 17px} +.wp_themeSkin .mce_h2 span.mceText {font-weight:bolder; font-size: 16px} +.wp_themeSkin .mce_h3 span.mceText {font-weight:bolder; font-size: 15px} +.wp_themeSkin .mce_h4 span.mceText {font-weight:bolder; font-size: 14px} +.wp_themeSkin .mce_h5 span.mceText {font-weight:bolder; font-size: 13px} +.wp_themeSkin .mce_h6 span.mceText {font-weight:bolder; font-size: 12px} + +/* Theme */ +.wp_themeSkin span.mce_undo {background-position: -500px -20px} +.wp_themeSkin .mceButtonEnabled:hover span.mce_undo, +.wp_themeSkin .mceButtonActive span.mce_undo {background-position:-500px 0} + +.wp_themeSkin span.mce_redo {background-position:-480px -20px} +.wp_themeSkin .mceButtonEnabled:hover span.mce_redo, +.wp_themeSkin .mceButtonActive span.mce_redo {background-position:-480px 0} + +.wp_themeSkin span.mce_bullist {background-position:-40px -20px} +.wp_themeSkin .mceButtonEnabled:hover span.mce_bullist, +.wp_themeSkin .mceButtonActive span.mce_bullist, +.wp_themeSkin .mceSplitButton:hover span.mce_bullist {background-position:-40px 0} + +.wp_themeSkin span.mce_numlist {background-position:-61px -20px} +.wp_themeSkin .mceButtonEnabled:hover span.mce_numlist, +.wp_themeSkin .mceButtonActive span.mce_numlist, +.wp_themeSkin .mceSplitButton:hover span.mce_numlist {background-position:-61px 0} + +.wp_themeSkin span.mce_blockquote {background-position:-80px -20px} +.wp_themeSkin .mceButtonEnabled:hover span.mce_blockquote, +.wp_themeSkin .mceButtonActive span.mce_blockquote {background-position:-80px 0} + +.wp_themeSkin span.mce_charmap {background-position:-420px -20px} +.wp_themeSkin .mceButtonEnabled:hover span.mce_charmap, +.wp_themeSkin .mceButtonActive span.mce_charmap {background-position:-420px 0} + +.wp_themeSkin span.mce_bold {background-position:-1px -20px} +.wp_themeSkin .mceButtonEnabled:hover span.mce_bold, +.wp_themeSkin .mceButtonActive span.mce_bold {background-position:-1px 0} + +.wp_themeSkin span.mce_italic {background-position:-21px -20px} +.wp_themeSkin .mceButtonEnabled:hover span.mce_italic, +.wp_themeSkin .mceButtonActive span.mce_italic {background-position:-21px 0} + +.wp_themeSkin span.mce_underline {background-position:-280px -19px} +.wp_themeSkin .mceButtonEnabled:hover span.mce_underline, +.wp_themeSkin .mceButtonActive span.mce_underline {background-position:-280px 1px} + +.wp_themeSkin span.mce_justifyleft {background-position:-100px -19px} +.wp_themeSkin .mceButtonEnabled:hover span.mce_justifyleft, +.wp_themeSkin .mceButtonActive span.mce_justifyleft {background-position:-100px 1px} + +.wp_themeSkin span.mce_justifyright {background-position:-141px -19px} +.wp_themeSkin .mceButtonEnabled:hover span.mce_justifyright, +.wp_themeSkin .mceButtonActive span.mce_justifyright {background-position:-141px 1px} + +.wp_themeSkin span.mce_justifycenter {background-position:-120px -19px} +.wp_themeSkin .mceButtonEnabled:hover span.mce_justifycenter, +.wp_themeSkin .mceButtonActive span.mce_justifycenter {background-position:-120px 1px} + +.wp_themeSkin span.mce_justifyfull {background-position:-300px -19px} +.wp_themeSkin .mceButtonEnabled:hover span.mce_justifyfull, +.wp_themeSkin .mceButtonActive span.mce_justifyfull {background-position:-300px 1px} + +.wp_themeSkin span.mce_indent {background-position:-461px -19px} +.wp_themeSkin .mceButtonEnabled:hover span.mce_indent, +.wp_themeSkin .mceButtonActive span.mce_indent {background-position:-461px 1px} + +.wp_themeSkin span.mce_outdent {background-position:-440px -19px} +.wp_themeSkin .mceButtonEnabled:hover span.mce_outdent, +.wp_themeSkin .mceButtonActive span.mce_outdent {background-position:-440px 1px} + +.wp_themeSkin span.mce_link {background-position:-161px -20px} +.wp_themeSkin .mceButtonEnabled:hover span.mce_link, +.wp_themeSkin .mceButtonActive span.mce_link {background-position:-161px 0} + +.wp_themeSkin span.mce_unlink {background-position:-180px -20px} +.wp_themeSkin .mceButtonEnabled:hover span.mce_unlink, +.wp_themeSkin .mceButtonActive span.mce_unlink {background-position:-180px 0} + +.wp_themeSkin span.mce_help {background-position:-521px -20px} +.wp_themeSkin .mceButtonEnabled:hover span.mce_help, +.wp_themeSkin .mceButtonActive span.mce_help {background-position:-521px 0} + +.wp_themeSkin span.mce_removeformat {background-position:-381px -20px} +.wp_themeSkin .mceButtonEnabled:hover span.mce_removeformat, +.wp_themeSkin .mceButtonActive span.mce_removeformat {background-position:-381px 0} + +.wp_themeSkin span.mce_strikethrough {background-position:-540px -18px;} +.wp_themeSkin .mceButtonEnabled:hover span.mce_strikethrough, +.wp_themeSkin .mceButtonActive span.mce_strikethrough {background-position:-540px 0} + +.wp_themeSkin .mceSplitButton .mce_forecolor span.mce_forecolor {background-position:-321px -22px} +.wp_themeSkin .mceSplitButtonEnabled:hover span.mce_forecolor, +.wp_themeSkin .mceSplitButtonActive span.mce_forecolor {background-position:-321px -2px} + +.wp_themeSkin .mce_forecolorpicker {background-position:-320px -20px} + +/* Plugins in WP */ +.wp_themeSkin span.mce_fullscreen {background-position:-240px -20px} +.wp_themeSkin .mceButtonEnabled:hover span.mce_fullscreen, +.wp_themeSkin .mceButtonActive span.mce_fullscreen {background-position:-240px 0} + +.wp_themeSkin span.mce_media {background-position:-401px -20px} +.wp_themeSkin .mceButtonEnabled:hover span.mce_media, +.wp_themeSkin .mceButtonActive span.mce_media {background-position:-401px 0} + +.wp_themeSkin span.mce_pastetext {background-position:-340px -20px} +.wp_themeSkin .mceButtonEnabled:hover span.mce_pastetext, +.wp_themeSkin .mceButtonActive span.mce_pastetext {background-position:-340px 0} + +.wp_themeSkin span.mce_pasteword {background-position:-360px -20px} +.wp_themeSkin .mceButtonEnabled:hover span.mce_pasteword, +.wp_themeSkin .mceButtonActive span.mce_pasteword {background-position:-360px 0} + +.wp_themeSkin span.mce_spellchecker {background-position:-220px -19px} +.wp_themeSkin .mceButtonEnabled:hover span.mce_spellchecker, +.wp_themeSkin .mceSplitButtonEnabled:hover span.mce_spellchecker, +.wp_themeSkin .mceButtonActive span.mce_spellchecker, +.wp_themeSkin .mceSplitButtonActive span.mce_spellchecker {background-position:-220px 1px} + +.wp_themeSkin span.mce_wp_help {background-position:-521px -20px} +.wp_themeSkin .mceButtonEnabled:hover span.mce_wp_help, +.wp_themeSkin .mceButtonActive span.mce_wp_help {background-position:-521px 0} + +.wp_themeSkin span.mce_wp_adv {background-position:-260px -20px} +.wp_themeSkin .mceButtonEnabled:hover span.mce_wp_adv, +.wp_themeSkin .mceButtonActive span.mce_wp_adv {background-position:-260px 0} + +.wp_themeSkin span.mce_wp_more {background-position:-201px -20px} +.wp_themeSkin .mceButtonEnabled:hover span.mce_wp_more, +.wp_themeSkin .mceButtonActive span.mce_wp_more {background-position:-201px 0} + +/* Default icons */ +.wp_themeSkin span.mce_cleanup {background-position:-380px -20px} +.wp_themeSkin span.mce_anchor {background-position:-200px 0} +.wp_themeSkin span.mce_sub {background-position:-600px 0} +.wp_themeSkin span.mce_sup {background-position:-620px 0} +.wp_themeSkin span.mce_newdocument {background-position:-520px 0} +.wp_themeSkin span.mce_image {background-position:-380px 0} +.wp_themeSkin span.mce_code {background-position:-260px 0} +.wp_themeSkin span.mce_hr {background-position:-360px 0} +.wp_themeSkin span.mce_visualaid {background-position:-660px 0} +.wp_themeSkin span.mce_paste {background-position:-560px 0} +.wp_themeSkin span.mce_copy {background-position:-700px 0} +.wp_themeSkin span.mce_cut {background-position:-680px 0} +.wp_themeSkin .mce_backcolor span.mceAction {background-position:-760px 0} +.wp_themeSkin .mce_backcolorpicker {background-position:-760px 0} + + +/* Plugins */ +.wp_themeSkin span.mce_advhr {background-position:-0px -20px} +.wp_themeSkin span.mce_ltr {background-position:-20px -20px} +.wp_themeSkin span.mce_rtl {background-position:-40px -20px} +.wp_themeSkin span.mce_emotions {background-position:-60px -20px} +.wp_themeSkin span.mce_fullpage {background-position:-80px -20px} +.wp_themeSkin span.mce_iespell {background-position:-120px -20px} +.wp_themeSkin span.mce_insertdate {background-position:-140px -20px} +.wp_themeSkin span.mce_inserttime {background-position:-160px -20px} +.wp_themeSkin span.mce_absolute {background-position:-180px -20px} +.wp_themeSkin span.mce_backward {background-position:-200px -20px} +.wp_themeSkin span.mce_forward {background-position:-220px -20px} +.wp_themeSkin span.mce_insert_layer {background-position:-240px -20px} +.wp_themeSkin span.mce_insertlayer {background-position:-260px -20px} +.wp_themeSkin span.mce_movebackward {background-position:-280px -20px} +.wp_themeSkin span.mce_moveforward {background-position:-300px -20px} +.wp_themeSkin span.mce_nonbreaking {background-position:-340px -20px} +.wp_themeSkin span.mce_selectall {background-position:-400px -20px} +.wp_themeSkin span.mce_preview {background-position:-420px -20px} +.wp_themeSkin span.mce_print {background-position:-440px -20px} +.wp_themeSkin span.mce_cancel {background-position:-460px -20px} +.wp_themeSkin span.mce_save {background-position:-480px -20px} +.wp_themeSkin span.mce_replace {background-position:-500px -20px} +.wp_themeSkin span.mce_search {background-position:-520px -20px} +.wp_themeSkin span.mce_styleprops {background-position:-560px -20px} +.wp_themeSkin span.mce_table {background-position:-580px -20px} +.wp_themeSkin span.mce_cell_props {background-position:-600px -20px} +.wp_themeSkin span.mce_delete_table {background-position:-620px -20px} +.wp_themeSkin span.mce_delete_col {background-position:-640px -20px} +.wp_themeSkin span.mce_delete_row {background-position:-660px -20px} +.wp_themeSkin span.mce_col_after {background-position:-680px -20px} +.wp_themeSkin span.mce_col_before {background-position:-700px -20px} +.wp_themeSkin span.mce_row_after {background-position:-720px -20px} +.wp_themeSkin span.mce_row_before {background-position:-740px -20px} +.wp_themeSkin span.mce_merge_cells {background-position:-760px -20px} +.wp_themeSkin span.mce_table_props {background-position:-980px -20px} +.wp_themeSkin span.mce_row_props {background-position:-780px -20px} +.wp_themeSkin span.mce_split_cells {background-position:-800px -20px} +.wp_themeSkin span.mce_template {background-position:-820px -20px} +.wp_themeSkin span.mce_visualchars {background-position:-840px -20px} +.wp_themeSkin span.mce_abbr {background-position:-860px -20px} +.wp_themeSkin span.mce_acronym {background-position:-880px -20px} +.wp_themeSkin span.mce_attribs {background-position:-900px -20px} +.wp_themeSkin span.mce_cite {background-position:-920px -20px} +.wp_themeSkin span.mce_del {background-position:-940px -20px} +.wp_themeSkin span.mce_ins {background-position:-960px -20px} +.wp_themeSkin span.mce_pagebreak {background-position:0 -40px} + + +/* border */ +.wp_themeSkin .mceExternalToolbar, +.wp_themeSkin .mceButton, +.wp_themeSkin a.mceButtonEnabled:hover, +.wp_themeSkin a.mceButtonActive, +.wp_themeSkin a.mceButtonSelected, +.wp_themeSkin .mceListBox .mceText, +.wp_themeSkin .mceListBox .mceOpen, +.wp_themeSkin table.mceListBoxEnabled:hover .mceText, +.wp_themeSkin .mceListBoxHover .mceText, +.wp_themeSkin .mceListBoxSelected .mceText, +.wp_themeSkin table.mceListBoxEnabled:hover .mceOpen, +.wp_themeSkin .mceListBoxHover .mceOpen, +.wp_themeSkin .mceListBoxSelected .mceOpen, +.wp_themeSkin select.mceListBox, +.wp_themeSkin .mceSplitButton a.mceAction, +.wp_themeSkin .mceSplitButton a.mceOpen, +.wp_themeSkin .mceSplitButton a.mceOpen:hover, +.wp_themeSkin .mceSplitButtonSelected a.mceOpen, +.wp_themeSkin table.mceSplitButtonEnabled:hover a.mceAction, +.wp_themeSkin .mceSplitButton a.mceAction:hover, +.wp_themeSkin div.mceColorSplitMenu table, +.wp_themeSkin .mceColorSplitMenu a, +.wp_themeSkin .mceColorSplitMenu a.mceMoreColors, +.wp_themeSkin .mceColorSplitMenu a.mceMoreColors:hover, +.wp_themeSkin a.mceMoreColors:hover, +.wp_themeSkin .mceMenu { + border-style: solid; + border-width: 1px; +} diff --git a/src/wp-includes/js/tinymce/themes/advanced/source_editor.htm b/src/wp-includes/js/tinymce/themes/advanced/source_editor.htm new file mode 100644 index 0000000..d4e8ccd --- /dev/null +++ b/src/wp-includes/js/tinymce/themes/advanced/source_editor.htm @@ -0,0 +1,30 @@ + + + {#advanced_dlg.code_title} + + + + +
            +
            + +
            + +
            + +
            + + + +
            +
            + +
            + +
            + +
            +
            +
            + + diff --git a/src/wp-includes/js/tinymce/tiny_mce.js b/src/wp-includes/js/tinymce/tiny_mce.js new file mode 100644 index 0000000..d3871e2 --- /dev/null +++ b/src/wp-includes/js/tinymce/tiny_mce.js @@ -0,0 +1 @@ +(function(d){var a=/^\s*|\s*$/g,e,c="B".replace(/A(.)|B/,"$1")==="$1";var b={majorVersion:"3",minorVersion:"4.2",releaseDate:"2011-04-07",_init:function(){var s=this,q=document,o=navigator,g=o.userAgent,m,f,l,k,j,r;s.isOpera=d.opera&&opera.buildNumber;s.isWebKit=/WebKit/.test(g);s.isIE=!s.isWebKit&&!s.isOpera&&(/MSIE/gi).test(g)&&(/Explorer/gi).test(o.appName);s.isIE6=s.isIE&&/MSIE [56]/.test(g);s.isGecko=!s.isWebKit&&/Gecko/.test(g);s.isMac=g.indexOf("Mac")!=-1;s.isAir=/adobeair/i.test(g);s.isIDevice=/(iPad|iPhone)/.test(g);if(d.tinyMCEPreInit){s.suffix=tinyMCEPreInit.suffix;s.baseURL=tinyMCEPreInit.base;s.query=tinyMCEPreInit.query;return}s.suffix="";f=q.getElementsByTagName("base");for(m=0;m=c.length){for(e=0,b=g.length;e=c.length||g[e]!=c[e]){f=e+1;break}}}if(g.length=g.length||g[e]!=c[e]){f=e+1;break}}}if(f==1){return h}for(e=0,b=g.length-(f-1);e=0;c--){if(f[c].length==0||f[c]=="."){continue}if(f[c]==".."){b++;continue}if(b>0){b--;continue}h.push(f[c])}c=e.length-b;if(c<=0){g=h.reverse().join("/")}else{g=e.slice(0,c).join("/")+"/"+h.reverse().join("/")}if(g.indexOf("/")!==0){g="/"+g}if(d&&g.lastIndexOf("/")!==g.length-1){g+=d}return g},getURI:function(d){var c,b=this;if(!b.source||d){c="";if(!d){if(b.protocol){c+=b.protocol+"://"}if(b.userInfo){c+=b.userInfo+"@"}if(b.host){c+=b.host}if(b.port){c+=":"+b.port}}if(b.path){c+=b.path}if(b.query){c+="?"+b.query}if(b.anchor){c+="#"+b.anchor}b.source=c}return b.source}})})();(function(){var a=tinymce.each;tinymce.create("static tinymce.util.Cookie",{getHash:function(d){var b=this.get(d),c;if(b){a(b.split("&"),function(e){e=e.split("=");c=c||{};c[unescape(e[0])]=unescape(e[1])})}return c},setHash:function(j,b,g,f,i,c){var h="";a(b,function(e,d){h+=(!h?"":"&")+escape(d)+"="+escape(e)});this.set(j,h,g,f,i,c)},get:function(i){var h=document.cookie,g,f=i+"=",d;if(!h){return}d=h.indexOf("; "+f);if(d==-1){d=h.indexOf(f);if(d!=0){return null}}else{d+=2}g=h.indexOf(";",d);if(g==-1){g=h.length}return unescape(h.substring(d+f.length,g))},set:function(i,b,g,f,h,c){document.cookie=i+"="+escape(b)+((g)?"; expires="+g.toGMTString():"")+((f)?"; path="+escape(f):"")+((h)?"; domain="+h:"")+((c)?"; secure":"")},remove:function(e,b){var c=new Date();c.setTime(c.getTime()-1000);this.set(e,"",c,b,c)}})})();(function(){function serialize(o,quote){var i,v,t;quote=quote||'"';if(o==null){return"null"}t=typeof o;if(t=="string"){v="\bb\tt\nn\ff\rr\"\"''\\\\";return quote+o.replace(/([\u0080-\uFFFF\x00-\x1f\"\'\\])/g,function(a,b){if(quote==='"'&&a==="'"){return a}i=v.indexOf(b);if(i+1){return"\\"+v.charAt(i+1)}a=b.charCodeAt().toString(16);return"\\u"+"0000".substring(a.length)+a})+quote}if(t=="object"){if(o.hasOwnProperty&&o instanceof Array){for(i=0,v="[";i0?",":"")+serialize(o[i],quote)}return v+"]"}v="{";for(i in o){v+=typeof o[i]!="function"?(v.length>1?","+quote:quote)+i+quote+":"+serialize(o[i],quote):""}return v+"}"}return""+o}tinymce.util.JSON={serialize:serialize,parse:function(s){try{return eval("("+s+")")}catch(ex){}}}})();tinymce.create("static tinymce.util.XHR",{send:function(g){var a,e,b=window,h=0;g.scope=g.scope||this;g.success_scope=g.success_scope||g.scope;g.error_scope=g.error_scope||g.scope;g.async=g.async===false?false:true;g.data=g.data||"";function d(i){a=0;try{a=new ActiveXObject(i)}catch(c){}return a}a=b.XMLHttpRequest?new XMLHttpRequest():d("Microsoft.XMLHTTP")||d("Msxml2.XMLHTTP");if(a){if(a.overrideMimeType){a.overrideMimeType(g.content_type)}a.open(g.type||(g.data?"POST":"GET"),g.url,g.async);if(g.content_type){a.setRequestHeader("Content-Type",g.content_type)}a.setRequestHeader("X-Requested-With","XMLHttpRequest");a.send(g.data);function f(){if(!g.async||a.readyState==4||h++>10000){if(g.success&&h<10000&&a.status==200){g.success.call(g.success_scope,""+a.responseText,a,g)}else{if(g.error){g.error.call(g.error_scope,h>10000?"TIMED_OUT":"GENERAL",a,g)}}a=null}else{b.setTimeout(f,10)}}if(!g.async){return f()}e=b.setTimeout(f,10)}}});(function(){var c=tinymce.extend,b=tinymce.util.JSON,a=tinymce.util.XHR;tinymce.create("tinymce.util.JSONRequest",{JSONRequest:function(d){this.settings=c({},d);this.count=0},send:function(f){var e=f.error,d=f.success;f=c(this.settings,f);f.success=function(h,g){h=b.parse(h);if(typeof(h)=="undefined"){h={error:"JSON Parse error."}}if(h.error){e.call(f.error_scope||f.scope,h.error,g)}else{d.call(f.success_scope||f.scope,h.result)}};f.error=function(h,g){if(e){e.call(f.error_scope||f.scope,h,g)}};f.data=b.serialize({id:f.id||"c"+(this.count++),method:f.method,params:f.params});f.content_type="application/json";a.send(f)},"static":{sendRPC:function(d){return new tinymce.util.JSONRequest().send(d)}}})}());(function(j){var a,g,d,k=/[&\"\u007E-\uD7FF]|[\uD800-\uDBFF][\uDC00-\uDFFF]/g,b=/[<>&\u007E-\uD7FF]|[\uD800-\uDBFF][\uDC00-\uDFFF]/g,f=/[<>&\"\']/g,c=/&(#)?([\w]+);/g,i={128:"\u20AC",130:"\u201A",131:"\u0192",132:"\u201E",133:"\u2026",134:"\u2020",135:"\u2021",136:"\u02C6",137:"\u2030",138:"\u0160",139:"\u2039",140:"\u0152",142:"\u017D",145:"\u2018",146:"\u2019",147:"\u201C",148:"\u201D",149:"\u2022",150:"\u2013",151:"\u2014",152:"\u02DC",153:"\u2122",154:"\u0161",155:"\u203A",156:"\u0153",158:"\u017E",159:"\u0178"};g={'"':""","'":"'","<":"<",">":">","&":"&"};d={"<":"<",">":">","&":"&",""":'"',"'":"'"};function h(l){var m;m=document.createElement("div");m.innerHTML=l;return m.textContent||m.innerText||l}function e(m,p){var n,o,l,q={};if(m){m=m.split(",");p=p||10;for(n=0;n1){return"&#"+(((n.charCodeAt(0)-55296)*1024)+(n.charCodeAt(1)-56320)+65536)+";"}return g[n]||"&#"+n.charCodeAt(0)+";"})},encodeNamed:function(n,l,m){m=m||a;return n.replace(l?k:b,function(o){return g[o]||m[o]||o})},getEncodeFunc:function(l,o){var p=j.html.Entities;o=e(o)||a;function m(r,q){return r.replace(q?k:b,function(s){return g[s]||o[s]||"&#"+s.charCodeAt(0)+";"||s})}function n(r,q){return p.encodeNamed(r,q,o)}l=j.makeMap(l.replace(/\+/g,","));if(l.named&&l.numeric){return m}if(l.named){if(o){return n}return p.encodeNamed}if(l.numeric){return p.encodeNumeric}return p.encodeRaw},decode:function(l){return l.replace(c,function(n,m,o){if(m){o=parseInt(o,10);if(o>65535){o-=65536;return String.fromCharCode(55296+(o>>10),56320+(o&1023))}else{return i[o]||String.fromCharCode(o)}}return d[n]||a[n]||h(n)})}}})(tinymce);tinymce.html.Styles=function(d,f){var k=/rgb\s*\(\s*([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\s*\)/gi,h=/(?:url(?:(?:\(\s*\"([^\"]+)\"\s*\))|(?:\(\s*\'([^\']+)\'\s*\))|(?:\(\s*([^)\s]+)\s*\))))|(?:\'([^\']+)\')|(?:\"([^\"]+)\")/gi,b=/\s*([^:]+):\s*([^;]+);?/g,l=/\s+$/,m=/rgb/,e,g,a={},j;d=d||{};j="\\\" \\' \\; \\: ; : _".split(" ");for(g=0;g1?r:"0"+r}return"#"+o(q)+o(p)+o(i)}return{toHex:function(i){return i.replace(k,c)},parse:function(r){var y={},p,n,v,q,u=d.url_converter,x=d.url_converter_scope||this;function o(C,F){var E,B,A,D;E=y[C+"-top"+F];if(!E){return}B=y[C+"-right"+F];if(E!=B){return}A=y[C+"-bottom"+F];if(B!=A){return}D=y[C+"-left"+F];if(A!=D){return}y[C+F]=D;delete y[C+"-top"+F];delete y[C+"-right"+F];delete y[C+"-bottom"+F];delete y[C+"-left"+F]}function t(B){var C=y[B],A;if(!C||C.indexOf(" ")<0){return}C=C.split(" ");A=C.length;while(A--){if(C[A]!==C[0]){return false}}y[B]=C[0];return true}function z(C,B,A,D){if(!t(B)){return}if(!t(A)){return}if(!t(D)){return}y[C]=y[B]+" "+y[A]+" "+y[D];delete y[B];delete y[A];delete y[D]}function s(A){q=true;return a[A]}function i(B,A){if(q){B=B.replace(/_[0-9]/g,function(C){return a[C]})}if(!A){B=B.replace(/\\([\'\";:])/g,"$1")}return B}if(r){r=r.replace(/\\[\"\';:_]/g,s).replace(/\"[^\"]+\"|\'[^\']+\'/g,function(A){return A.replace(/[;:]/g,s)});while(p=b.exec(r)){n=p[1].replace(l,"").toLowerCase();v=p[2].replace(l,"");if(n&&v.length>0){if(n==="font-weight"&&v==="700"){v="bold"}else{if(n==="color"||n==="background-color"){v=v.toLowerCase()}}v=v.replace(k,c);v=v.replace(h,function(B,A,E,D,F,C){F=F||C;if(F){F=i(F);return"'"+F.replace(/\'/g,"\\'")+"'"}A=i(A||E||D);if(u){A=u.call(x,A,"style")}return"url('"+A.replace(/\'/g,"\\'")+"')"});y[n]=q?i(v,true):v}b.lastIndex=p.index+p[0].length}o("border","");o("border","-width");o("border","-color");o("border","-style");o("padding","");o("margin","");z("border","border-width","border-style","border-color");if(y.border==="medium none"){delete y.border}}return y},serialize:function(p,r){var o="",n,q;function i(t){var x,u,s,t,v;x=f.styles[t];if(x){for(u=0,s=x.length;u0){o+=(o.length>0?" ":"")+t+": "+v+";"}}}}if(r&&f&&f.styles){i("*");i(n)}else{for(n in p){q=p[n];if(q!==e&&q.length>0){o+=(o.length>0?" ":"")+n+": "+q+";"}}}return o}}};(function(l){var g={},i,k,f,d,b,e,c=l.makeMap,j=l.each;function h(n,m){return n.split(m||",")}function a(q,p){var n,o={};function m(r){return r.replace(/[A-Z]+/g,function(s){return m(q[s])})}for(n in q){if(q.hasOwnProperty(n)){q[n]=m(q[n])}}m(p).replace(/#/g,"#text").replace(/(\w+)\[([^\]]+)\]\[([^\]]*)\]/g,function(u,s,r,t){r=h(r,"|");o[s]={attributes:c(r),attributesOrder:r,children:c(t,"|",{"#comment":{}})}});return o}k="h1,h2,h3,h4,h5,h6,hr,p,div,address,pre,form,table,tbody,thead,tfoot,th,tr,td,li,ol,ul,caption,blockquote,center,dl,dt,dd,dir,fieldset,noscript,menu,isindex,samp,header,footer,article,section,hgroup";k=c(k,",",c(k.toUpperCase()));g=a({Z:"H|K|N|O|P",Y:"X|form|R|Q",ZG:"E|span|width|align|char|charoff|valign",X:"p|T|div|U|W|isindex|fieldset|table",ZF:"E|align|char|charoff|valign",W:"pre|hr|blockquote|address|center|noframes",ZE:"abbr|axis|headers|scope|rowspan|colspan|align|char|charoff|valign|nowrap|bgcolor|width|height",ZD:"[E][S]",U:"ul|ol|dl|menu|dir",ZC:"p|Y|div|U|W|table|br|span|bdo|object|applet|img|map|K|N|Q",T:"h1|h2|h3|h4|h5|h6",ZB:"X|S|Q",S:"R|P",ZA:"a|G|J|M|O|P",R:"a|H|K|N|O",Q:"noscript|P",P:"ins|del|script",O:"input|select|textarea|label|button",N:"M|L",M:"em|strong|dfn|code|q|samp|kbd|var|cite|abbr|acronym",L:"sub|sup",K:"J|I",J:"tt|i|b|u|s|strike",I:"big|small|font|basefont",H:"G|F",G:"br|span|bdo",F:"object|applet|img|map|iframe",E:"A|B|C",D:"accesskey|tabindex|onfocus|onblur",C:"onclick|ondblclick|onmousedown|onmouseup|onmouseover|onmousemove|onmouseout|onkeypress|onkeydown|onkeyup",B:"lang|xml:lang|dir",A:"id|class|style|title"},"script[id|charset|type|language|src|defer|xml:space][]style[B|id|type|media|title|xml:space][]object[E|declare|classid|codebase|data|type|codetype|archive|standby|width|height|usemap|name|tabindex|align|border|hspace|vspace][#|param|Y]param[id|name|value|valuetype|type][]p[E|align][#|S]a[E|D|charset|type|name|href|hreflang|rel|rev|shape|coords|target][#|Z]br[A|clear][]span[E][#|S]bdo[A|C|B][#|S]applet[A|codebase|archive|code|object|alt|name|width|height|align|hspace|vspace][#|param|Y]h1[E|align][#|S]img[E|src|alt|name|longdesc|width|height|usemap|ismap|align|border|hspace|vspace][]map[B|C|A|name][X|form|Q|area]h2[E|align][#|S]iframe[A|longdesc|name|src|frameborder|marginwidth|marginheight|scrolling|align|width|height][#|Y]h3[E|align][#|S]tt[E][#|S]i[E][#|S]b[E][#|S]u[E][#|S]s[E][#|S]strike[E][#|S]big[E][#|S]small[E][#|S]font[A|B|size|color|face][#|S]basefont[id|size|color|face][]em[E][#|S]strong[E][#|S]dfn[E][#|S]code[E][#|S]q[E|cite][#|S]samp[E][#|S]kbd[E][#|S]var[E][#|S]cite[E][#|S]abbr[E][#|S]acronym[E][#|S]sub[E][#|S]sup[E][#|S]input[E|D|type|name|value|checked|disabled|readonly|size|maxlength|src|alt|usemap|onselect|onchange|accept|align][]select[E|name|size|multiple|disabled|tabindex|onfocus|onblur|onchange][optgroup|option]optgroup[E|disabled|label][option]option[E|selected|disabled|label|value][]textarea[E|D|name|rows|cols|disabled|readonly|onselect|onchange][]label[E|for|accesskey|onfocus|onblur][#|S]button[E|D|name|value|type|disabled][#|p|T|div|U|W|table|G|object|applet|img|map|K|N|Q]h4[E|align][#|S]ins[E|cite|datetime][#|Y]h5[E|align][#|S]del[E|cite|datetime][#|Y]h6[E|align][#|S]div[E|align][#|Y]ul[E|type|compact][li]li[E|type|value][#|Y]ol[E|type|compact|start][li]dl[E|compact][dt|dd]dt[E][#|S]dd[E][#|Y]menu[E|compact][li]dir[E|compact][li]pre[E|width|xml:space][#|ZA]hr[E|align|noshade|size|width][]blockquote[E|cite][#|Y]address[E][#|S|p]center[E][#|Y]noframes[E][#|Y]isindex[A|B|prompt][]fieldset[E][#|legend|Y]legend[E|accesskey|align][#|S]table[E|summary|width|border|frame|rules|cellspacing|cellpadding|align|bgcolor][caption|col|colgroup|thead|tfoot|tbody|tr]caption[E|align][#|S]col[ZG][]colgroup[ZG][col]thead[ZF][tr]tr[ZF|bgcolor][th|td]th[E|ZE][#|Y]form[E|action|method|name|enctype|onsubmit|onreset|accept|accept-charset|target][#|X|R|Q]noscript[E][#|Y]td[E|ZE][#|Y]tfoot[ZF][tr]tbody[ZF][tr]area[E|D|shape|coords|href|nohref|alt|target][]base[id|href|target][]body[E|onload|onunload|background|bgcolor|text|link|vlink|alink][#|Y]");i=c("checked,compact,declare,defer,disabled,ismap,multiple,nohref,noresize,noshade,nowrap,readonly,selected,preload,autoplay,loop,controls");f=c("area,base,basefont,br,col,frame,hr,img,input,isindex,link,meta,param,embed,source");d=l.extend(c("td,th,iframe,video,object"),f);b=c("pre,script,style");e=c("colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr");l.html.Schema=function(p){var x=this,m={},n={},u=[],o;p=p||{};if(p.verify_html===false){p.valid_elements="*[*]"}if(p.valid_styles){o={};j(p.valid_styles,function(z,y){o[y]=l.explode(z)})}function v(y){return new RegExp("^"+y.replace(/([?+*])/g,".$1")+"$")}function r(F){var E,A,T,P,U,z,C,O,R,K,S,W,I,D,Q,y,M,B,V,X,J,N,H=/^([#+-])?([^\[\/]+)(?:\/([^\[]+))?(?:\[([^\]]+)\])?$/,L=/^([!\-])?(\w+::\w+|[^=:<]+)?(?:([=:<])(.*))?$/,G=/[*?+]/;if(F){F=h(F);if(m["@"]){M=m["@"].attributes;B=m["@"].attributesOrder}for(E=0,A=F.length;E=0){for(P=l.length-1;P>=Q;P--){O=l[P];if(O.valid){A.end(O.name)}}l.length=Q}}D=new RegExp("<(?:(?:!--([\\w\\W]*?)-->)|(?:!\\[CDATA\\[([\\w\\W]*?)\\]\\]>)|(?:!DOCTYPE([\\w\\W]*?)>)|(?:\\?([^\\s\\/<>]+) ?([\\w\\W]*?)[?/]>)|(?:\\/([^>]+)>)|(?:([^\\s\\/<>]+)\\s*((?:[^\"'>]+(?:(?:\"[^\"]*\")|(?:'[^']*')|[^>]*))*)>))","g");h=/([\w:\-]+)(?:\s*=\s*(?:(?:\"((?:\\.|[^\"])*)\")|(?:\'((?:\\.|[^\'])*)\')|([^>\s]+)))?/g;g={script:/<\/script[^>]*>/gi,style:/<\/style[^>]*>/gi,noscript:/<\/noscript[^>]*>/gi};F=e.getShortEndedElements();z=e.getSelfClosingElements();k=e.getBoolAttrs();x=c.validate;y=c.fix_self_closing;while(f=D.exec(q)){if(m0&&l[l.length-1].name===G){C(G)}if(!x||(I=e.getElementRule(G))){r=true;if(x){J=I.attributes;n=I.attributePatterns}if(o=f[8]){B=[];B.map={};o.replace(h,function(P,O,T,S,R){var U,Q;O=O.toLowerCase();T=O in k?O:v(T||S||R||"");if(x&&O.indexOf("data-")!==0){U=J[O];if(!U&&n){Q=n.length;while(Q--){U=n[Q];if(U.pattern.test(O)){break}}if(Q===-1){U=null}}if(!U){return}if(U.validValues&&!(T in U.validValues)){return}}B.map[O]=T;B.push({name:O,value:T})})}else{B=[];B.map={}}if(x){H=I.attributesRequired;M=I.attributesDefault;L=I.attributesForced;if(L){K=L.length;while(K--){E=L[K];N=E.name;u=E.value;if(u==="{$uid}"){u="mce_"+s++}B.map[N]=u;B.push({name:N,value:u})}}if(M){K=M.length;while(K--){E=M[K];N=E.name;if(!(N in B.map)){u=E.value;if(u==="{$uid}"){u="mce_"+s++}B.map[N]=u;B.push({name:N,value:u})}}}if(H){K=H.length;while(K--){if(H[K] in B.map){break}}if(K===-1){r=false}}if(B.map["data-mce-bogus"]){r=false}}if(r){A.start(G,B,p)}}else{r=false}if(j=g[G]){j.lastIndex=m=f.index+f[0].length;if(f=j.exec(q)){if(r){t=q.substr(m,f.index-m)}m=f.index+f[0].length}else{t=q.substr(m);m=q.length}if(r&&t.length>0){A.text(t,true)}if(r){A.end(G)}D.lastIndex=m;continue}if(!p){if(!o||o.indexOf("/")!=o.length-1){l.push({name:G,valid:r})}else{if(r){A.end(G)}}}}else{if(G=f[1]){A.comment(G)}else{if(G=f[2]){A.cdata(G)}else{if(G=f[3]){A.doctype(G)}else{if(G=f[4]){A.pi(G,f[5])}}}}}}m=f.index+f[0].length}if(m=0;K--){G=l[K];if(G.valid){A.end(G.name)}}}}})(tinymce);(function(d){var c=/^[ \t\r\n]*$/,e={"#text":3,"#comment":8,"#cdata":4,"#pi":7,"#doctype":10,"#document-fragment":11};function a(k,l,j){var i,h,f=j?"lastChild":"firstChild",g=j?"prev":"next";if(k[f]){return k[f]}if(k!==l){i=k[g];if(i){return i}for(h=k.parent;h&&h!==l;h=h.parent){i=h[g];if(i){return i}}}}function b(f,g){this.name=f;this.type=g;if(g===1){this.attributes=[];this.attributes.map={}}}d.extend(b.prototype,{replace:function(g){var f=this;if(g.parent){g.remove()}f.insert(g,f);f.remove();return f},attr:function(h,l){var f=this,g,j,k;if(typeof h!=="string"){for(j in h){f.attr(j,h[j])}return f}if(g=f.attributes){if(l!==k){if(l===null){if(h in g.map){delete g.map[h];j=g.length;while(j--){if(g[j].name===h){g=g.splice(j,1);return f}}}return f}if(h in g.map){j=g.length;while(j--){if(g[j].name===h){g[j].value=l;break}}}else{g.push({name:h,value:l})}g.map[h]=l;return f}else{return g.map[h]}}},clone:function(){var g=this,n=new b(g.name,g.type),h,f,m,j,k;if(m=g.attributes){k=[];k.map={};for(h=0,f=m.length;h1){v.reverse();z=n=f.filterNode(v[0].clone());for(t=0;t0){L.value=l;L=L.prev}else{J=L.prev;L.remove();L=J}}}n=new b.html.SaxParser({validate:x,fix_self_closing:!x,cdata:function(l){z.append(G("#cdata",4)).value=l},text:function(K,l){var J;if(!r[z.name]){K=K.replace(k," ");if(z.lastChild&&o[z.lastChild.name]){K=K.replace(C,"")}}if(K.length!==0){J=G("#text",3);J.raw=!!l;z.append(J).value=K}},comment:function(l){z.append(G("#comment",8)).value=l},pi:function(l,J){z.append(G(l,7)).value=J;E(z)},doctype:function(J){var l;l=z.append(G("#doctype",10));l.value=J;E(z)},start:function(l,R,K){var P,M,L,J,N,S,Q,O;L=x?h.getElementRule(l):{};if(L){P=G(L.outputName||l,1);P.attributes=R;P.shortEnded=K;z.append(P);O=p[z.name];if(O&&p[P.name]&&!O[P.name]){H.push(P)}M=d.length;while(M--){N=d[M].name;if(N in R.map){D=c[N];if(D){D.push(P)}else{c[N]=[P]}}}if(o[l]){E(P)}if(!K){z=P}}},end:function(l){var N,K,M,J,L;K=x?h.getElementRule(l):{};if(K){if(o[l]){if(!r[z.name]){for(N=z.firstChild;N&&N.type===3;){M=N.value.replace(C,"");if(M.length>0){N.value=M;N=N.next}else{J=N.next;N.remove();N=J}}for(N=z.lastChild;N&&N.type===3;){M=N.value.replace(s,"");if(M.length>0){N.value=M;N=N.prev}else{J=N.prev;N.remove();N=J}}}N=z.prev;if(N&&N.type===3){M=N.value.replace(C,"");if(M.length>0){N.value=M}else{N.remove()}}}if(K.removeEmpty||K.paddEmpty){if(z.isEmpty(t)){if(K.paddEmpty){z.empty().append(new a("#text","3")).value="\u00a0"}else{if(!z.attributes.map.name){L=z.parent;z.empty().remove();z=L;return}}}}z=z.parent}}},h);F=z=new a(g.root_name,11);n.parse(u);if(x){j(H)}for(I in i){D=e[I];y=i[I];v=y.length;while(v--){if(!y[v].parent){y.splice(v,1)}}for(B=0,A=D.length;B0){o=c[c.length-1];if(o.length>0&&o!=="\n"){c.push("\n")}}c.push("<",m);if(k){for(n=0,j=k.length;n0){o=c[c.length-1];if(o.length>0&&o!=="\n"){c.push("\n")}}},end:function(h){var i;c.push("");if(a&&d[h]&&c.length>0){i=c[c.length-1];if(i.length>0&&i!=="\n"){c.push("\n")}}},text:function(i,h){if(i.length>0){c[c.length]=h?i:f(i)}},cdata:function(h){c.push("")},comment:function(h){c.push("")},pi:function(h,i){if(i){c.push("")}else{c.push("")}if(a){c.push("\n")}},doctype:function(h){c.push("",a?"\n":"")},reset:function(){c.length=0},getContent:function(){return c.join("").replace(/\n$/,"")}}};(function(a){a.html.Serializer=function(c,d){var b=this,e=new a.html.Writer(c);c=c||{};c.validate="validate" in c?c.validate:true;b.schema=d=d||new a.html.Schema();b.writer=e;b.serialize=function(h){var g,i;i=c.validate;g={3:function(k,j){e.text(k.value,k.raw)},8:function(j){e.comment(j.value)},7:function(j){e.pi(j.name,j.value)},10:function(j){e.doctype(j.value)},4:function(j){e.cdata(j.value)},11:function(j){if((j=j.firstChild)){do{f(j)}while(j=j.next)}}};e.reset();function f(k){var t=g[k.type],j,o,s,r,p,u,n,m,q;if(!t){j=k.name;o=k.shortEnded;s=k.attributes;if(i&&s&&s.length>1){u=[];u.map={};q=d.getElementRule(k.name);for(n=0,m=q.attributesOrder.length;n=8;k.boxModel=!h.isIE||n.compatMode=="CSS1Compat"||k.stdMode;k.hasOuterHTML="outerHTML" in n.createElement("a");k.settings=l=h.extend({keep_values:false,hex_colors:1},l);k.schema=l.schema;k.styles=new h.html.Styles({url_converter:l.url_converter,url_converter_scope:l.url_converter_scope},l.schema);if(h.isIE6){try{n.execCommand("BackgroundImageCache",false,true)}catch(m){k.cssFlicker=true}}if(b){("abbr article aside audio canvas details figcaption figure footer header hgroup mark menu meter nav output progress section summary time video").replace(/\w+/g,function(o){n.createElement(o)})}h.addUnload(k.destroy,k)},getRoot:function(){var j=this,k=j.settings;return(k&&j.get(k.root_element))||j.doc.body},getViewPort:function(k){var l,j;k=!k?this.win:k;l=k.document;j=this.boxModel?l.documentElement:l.body;return{x:k.pageXOffset||j.scrollLeft,y:k.pageYOffset||j.scrollTop,w:k.innerWidth||j.clientWidth,h:k.innerHeight||j.clientHeight}},getRect:function(m){var l,j=this,k;m=j.get(m);l=j.getPos(m);k=j.getSize(m);return{x:l.x,y:l.y,w:k.w,h:k.h}},getSize:function(m){var k=this,j,l;m=k.get(m);j=k.getStyle(m,"width");l=k.getStyle(m,"height");if(j.indexOf("px")===-1){j=0}if(l.indexOf("px")===-1){l=0}return{w:parseInt(j)||m.offsetWidth||m.clientWidth,h:parseInt(l)||m.offsetHeight||m.clientHeight}},getParent:function(l,k,j){return this.getParents(l,k,j,false)},getParents:function(u,p,l,s){var k=this,j,m=k.settings,q=[];u=k.get(u);s=s===undefined;if(m.strict_root){l=l||k.getRoot()}if(e(p,"string")){j=p;if(p==="*"){p=function(o){return o.nodeType==1}}else{p=function(o){return k.is(o,j)}}}while(u){if(u==l||!u.nodeType||u.nodeType===9){break}if(!p||p(u)){if(s){q.push(u)}else{return u}}u=u.parentNode}return s?q:null},get:function(j){var k;if(j&&this.doc&&typeof(j)=="string"){k=j;j=this.doc.getElementById(j);if(j&&j.id!==k){return this.doc.getElementsByName(k)[1]}}return j},getNext:function(k,j){return this._findSib(k,j,"nextSibling")},getPrev:function(k,j){return this._findSib(k,j,"previousSibling")},select:function(l,k){var j=this;return h.dom.Sizzle(l,j.get(k)||j.get(j.settings.root_element)||j.doc,[])},is:function(l,j){var k;if(l.length===undefined){if(j==="*"){return l.nodeType==1}if(a.test(j)){j=j.toLowerCase().split(/,/);l=l.nodeName.toLowerCase();for(k=j.length-1;k>=0;k--){if(j[k]==l){return true}}return false}}return h.dom.Sizzle.matches(j,l.nodeType?[l]:l).length>0},add:function(m,q,j,l,o){var k=this;return this.run(m,function(s){var r,n;r=e(q,"string")?k.doc.createElement(q):q;k.setAttribs(r,j);if(l){if(l.nodeType){r.appendChild(l)}else{k.setHTML(r,l)}}return !o?s.appendChild(r):r})},create:function(l,j,k){return this.add(this.doc.createElement(l),l,j,k,1)},createHTML:function(r,j,p){var q="",m=this,l;q+="<"+r;for(l in j){if(j.hasOwnProperty(l)){q+=" "+l+'="'+m.encode(j[l])+'"'}}if(typeof(p)!="undefined"){return q+">"+p+""}return q+" />"},remove:function(j,k){return this.run(j,function(m){var n,l=m.parentNode;if(!l){return null}if(k){while(n=m.firstChild){if(!h.isIE||n.nodeType!==3||n.nodeValue){l.insertBefore(n,m)}else{m.removeChild(n)}}}return l.removeChild(m)})},setStyle:function(m,j,k){var l=this;return l.run(m,function(p){var o,n;o=p.style;j=j.replace(/-(\D)/g,function(r,q){return q.toUpperCase()});if(l.pixelStyles.test(j)&&(h.is(k,"number")||/^[\-0-9\.]+$/.test(k))){k+="px"}switch(j){case"opacity":if(b){o.filter=k===""?"":"alpha(opacity="+(k*100)+")";if(!m.currentStyle||!m.currentStyle.hasLayout){o.display="inline-block"}}o[j]=o["-moz-opacity"]=o["-khtml-opacity"]=k||"";break;case"float":b?o.styleFloat=k:o.cssFloat=k;break;default:o[j]=k||""}if(l.settings.update_styles){l.setAttrib(p,"data-mce-style")}})},getStyle:function(m,j,l){m=this.get(m);if(!m){return}if(this.doc.defaultView&&l){j=j.replace(/[A-Z]/g,function(n){return"-"+n});try{return this.doc.defaultView.getComputedStyle(m,null).getPropertyValue(j)}catch(k){return null}}j=j.replace(/-(\D)/g,function(o,n){return n.toUpperCase()});if(j=="float"){j=b?"styleFloat":"cssFloat"}if(m.currentStyle&&l){return m.currentStyle[j]}return m.style?m.style[j]:undefined},setStyles:function(m,n){var k=this,l=k.settings,j;j=l.update_styles;l.update_styles=0;f(n,function(o,p){k.setStyle(m,p,o)});l.update_styles=j;if(l.update_styles){k.setAttrib(m,l.cssText)}},removeAllAttribs:function(j){return this.run(j,function(m){var l,k=m.attributes;for(l=k.length-1;l>=0;l--){m.removeAttributeNode(k.item(l))}})},setAttrib:function(l,m,j){var k=this;if(!l||!m){return}if(k.settings.strict){m=m.toLowerCase()}return this.run(l,function(o){var n=k.settings;switch(m){case"style":if(!e(j,"string")){f(j,function(p,q){k.setStyle(o,q,p)});return}if(n.keep_values){if(j&&!k._isRes(j)){o.setAttribute("data-mce-style",j,2)}else{o.removeAttribute("data-mce-style",2)}}o.style.cssText=j;break;case"class":o.className=j||"";break;case"src":case"href":if(n.keep_values){if(n.url_converter){j=n.url_converter.call(n.url_converter_scope||k,j,m,o)}k.setAttrib(o,"data-mce-"+m,j,2)}break;case"shape":o.setAttribute("data-mce-style",j);break}if(e(j)&&j!==null&&j.length!==0){o.setAttribute(m,""+j,2)}else{o.removeAttribute(m,2)}})},setAttribs:function(k,l){var j=this;return this.run(k,function(m){f(l,function(o,p){j.setAttrib(m,p,o)})})},getAttrib:function(m,o,l){var j,k=this;m=k.get(m);if(!m||m.nodeType!==1){return false}if(!e(l)){l=""}if(/^(src|href|style|coords|shape)$/.test(o)){j=m.getAttribute("data-mce-"+o);if(j){return j}}if(b&&k.props[o]){j=m[k.props[o]];j=j&&j.nodeValue?j.nodeValue:j}if(!j){j=m.getAttribute(o,2)}if(/^(checked|compact|declare|defer|disabled|ismap|multiple|nohref|noshade|nowrap|readonly|selected)$/.test(o)){if(m[k.props[o]]===true&&j===""){return o}return j?o:""}if(m.nodeName==="FORM"&&m.getAttributeNode(o)){return m.getAttributeNode(o).nodeValue}if(o==="style"){j=j||m.style.cssText;if(j){j=k.serializeStyle(k.parseStyle(j),m.nodeName);if(k.settings.keep_values&&!k._isRes(j)){m.setAttribute("data-mce-style",j)}}}if(d&&o==="class"&&j){j=j.replace(/(apple|webkit)\-[a-z\-]+/gi,"")}if(b){switch(o){case"rowspan":case"colspan":if(j===1){j=""}break;case"size":if(j==="+0"||j===20||j===0){j=""}break;case"width":case"height":case"vspace":case"checked":case"disabled":case"readonly":if(j===0){j=""}break;case"hspace":if(j===-1){j=""}break;case"maxlength":case"tabindex":if(j===32768||j===2147483647||j==="32768"){j=""}break;case"multiple":case"compact":case"noshade":case"nowrap":if(j===65535){return o}return l;case"shape":j=j.toLowerCase();break;default:if(o.indexOf("on")===0&&j){j=h._replace(/^function\s+\w+\(\)\s+\{\s+(.*)\s+\}$/,"$1",""+j)}}}return(j!==undefined&&j!==null&&j!=="")?""+j:l},getPos:function(s,m){var k=this,j=0,q=0,o,p=k.doc,l;s=k.get(s);m=m||p.body;if(s){if(b&&!k.stdMode){s=s.getBoundingClientRect();o=k.boxModel?p.documentElement:p.body;j=k.getStyle(k.select("html")[0],"borderWidth");j=(j=="medium"||k.boxModel&&!k.isIE6)&&2||j;return{x:s.left+o.scrollLeft-j,y:s.top+o.scrollTop-j}}l=s;while(l&&l!=m&&l.nodeType){j+=l.offsetLeft||0;q+=l.offsetTop||0;l=l.offsetParent}l=s.parentNode;while(l&&l!=m&&l.nodeType){j-=l.scrollLeft||0;q-=l.scrollTop||0;l=l.parentNode}}return{x:j,y:q}},parseStyle:function(j){return this.styles.parse(j)},serializeStyle:function(k,j){return this.styles.serialize(k,j)},loadCSS:function(j){var l=this,m=l.doc,k;if(!j){j=""}k=l.select("head")[0];f(j.split(","),function(n){var o;if(l.files[n]){return}l.files[n]=true;o=l.create("link",{rel:"stylesheet",href:h._addVer(n)});if(b&&m.documentMode&&m.recalc){o.onload=function(){if(m.recalc){m.recalc()}o.onload=null}}k.appendChild(o)})},addClass:function(j,k){return this.run(j,function(l){var m;if(!k){return 0}if(this.hasClass(l,k)){return l.className}m=this.removeClass(l,k);return l.className=(m!=""?(m+" "):"")+k})},removeClass:function(l,m){var j=this,k;return j.run(l,function(o){var n;if(j.hasClass(o,m)){if(!k){k=new RegExp("(^|\\s+)"+m+"(\\s+|$)","g")}n=o.className.replace(k," ");n=h.trim(n!=" "?n:"");o.className=n;if(!n){o.removeAttribute("class");o.removeAttribute("className")}return n}return o.className})},hasClass:function(k,j){k=this.get(k);if(!k||!j){return false}return(" "+k.className+" ").indexOf(" "+j+" ")!==-1},show:function(j){return this.setStyle(j,"display","block")},hide:function(j){return this.setStyle(j,"display","none")},isHidden:function(j){j=this.get(j);return !j||j.style.display=="none"||this.getStyle(j,"display")=="none"},uniqueId:function(j){return(!j?"mce_":j)+(this.counter++)},setHTML:function(l,k){var j=this;return j.run(l,function(n){if(b){while(n.firstChild){n.removeChild(n.firstChild)}try{n.innerHTML="
            "+k;n.removeChild(n.firstChild)}catch(m){n=j.create("div");n.innerHTML="
            "+k;f(n.childNodes,function(p,o){if(o){n.appendChild(p)}})}}else{n.innerHTML=k}return k})},getOuterHTML:function(l){var k,j=this;l=j.get(l);if(!l){return null}if(l.nodeType===1&&j.hasOuterHTML){return l.outerHTML}k=(l.ownerDocument||j.doc).createElement("body");k.appendChild(l.cloneNode(true));return k.innerHTML},setOuterHTML:function(m,k,n){var j=this;function l(p,o,r){var s,q;q=r.createElement("body");q.innerHTML=o;s=q.lastChild;while(s){j.insertAfter(s.cloneNode(true),p);s=s.previousSibling}j.remove(p)}return this.run(m,function(p){p=j.get(p);if(p.nodeType==1){n=n||p.ownerDocument||j.doc;if(b){try{if(b&&p.nodeType==1){p.outerHTML=k}else{l(p,k,n)}}catch(o){l(p,k,n)}}else{l(p,k,n)}}})},decode:c.decode,encode:c.encodeAllRaw,insertAfter:function(j,k){k=this.get(k);return this.run(j,function(m){var l,n;l=k.parentNode;n=k.nextSibling;if(n){l.insertBefore(m,n)}else{l.appendChild(m)}return m})},isBlock:function(k){var j=k.nodeType;if(j){return !!(j===1&&g[k.nodeName])}return !!g[k]},replace:function(p,m,j){var l=this;if(e(m,"array")){p=p.cloneNode(true)}return l.run(m,function(k){if(j){f(h.grep(k.childNodes),function(n){p.appendChild(n)})}return k.parentNode.replaceChild(p,k)})},rename:function(m,j){var l=this,k;if(m.nodeName!=j.toUpperCase()){k=l.create(j);f(l.getAttribs(m),function(n){l.setAttrib(k,n.nodeName,l.getAttrib(m,n.nodeName))});l.replace(k,m,1)}return k||m},findCommonAncestor:function(l,j){var m=l,k;while(m){k=j;while(k&&m!=k){k=k.parentNode}if(m==k){break}m=m.parentNode}if(!m&&l.ownerDocument){return l.ownerDocument.documentElement}return m},toHex:function(j){var l=/^\s*rgb\s*?\(\s*?([0-9]+)\s*?,\s*?([0-9]+)\s*?,\s*?([0-9]+)\s*?\)\s*$/i.exec(j);function k(m){m=parseInt(m).toString(16);return m.length>1?m:"0"+m}if(l){j="#"+k(l[1])+k(l[2])+k(l[3]);return j}return j},getClasses:function(){var n=this,j=[],m,o={},p=n.settings.class_filter,l;if(n.classes){return n.classes}function q(r){f(r.imports,function(s){q(s)});f(r.cssRules||r.rules,function(s){switch(s.type||1){case 1:if(s.selectorText){f(s.selectorText.split(","),function(t){t=t.replace(/^\s*|\s*$|^\s\./g,"");if(/\.mce/.test(t)||!/\.[\w\-]+$/.test(t)){return}l=t;t=h._replace(/.*\.([a-z0-9_\-]+).*/i,"$1",t);if(p&&!(t=p(t,l))){return}if(!o[t]){j.push({"class":t});o[t]=1}})}break;case 3:q(s.styleSheet);break}})}try{f(n.doc.styleSheets,q)}catch(k){}if(j.length>0){n.classes=j}return j},run:function(m,l,k){var j=this,n;if(j.doc&&typeof(m)==="string"){m=j.get(m)}if(!m){return false}k=k||this;if(!m.nodeType&&(m.length||m.length===0)){n=[];f(m,function(p,o){if(p){if(typeof(p)=="string"){p=j.doc.getElementById(p)}n.push(l.call(k,p,o))}});return n}return l.call(k,m)},getAttribs:function(k){var j;k=this.get(k);if(!k){return[]}if(b){j=[];if(k.nodeName=="OBJECT"){return k.attributes}if(k.nodeName==="OPTION"&&this.getAttrib(k,"selected")){j.push({specified:1,nodeName:"selected"})}k.cloneNode(false).outerHTML.replace(/<\/?[\w:\-]+ ?|=[\"][^\"]+\"|=\'[^\']+\'|=[\w\-]+|>/gi,"").replace(/[\w:\-]+/gi,function(l){j.push({specified:1,nodeName:l})});return j}return k.attributes},isEmpty:function(o,p){var k=this,m,j,n,q,l;o=o.firstChild;if(o){q=new h.dom.TreeWalker(o);p=p||k.schema?k.schema.getNonEmptyElements():null;do{n=o.nodeType;if(n===1){if(o.getAttribute("data-mce-bogus")){continue}if(p&&p[o.nodeName.toLowerCase()]){return false}j=k.getAttribs(o);m=o.attributes.length;while(m--){l=o.attributes[m].nodeName;if(l==="name"||l.indexOf("data-")===0){return false}}}if((n===3&&!i.test(o.nodeValue))){return false}}while(o=q.next())}return true},destroy:function(k){var j=this;if(j.events){j.events.destroy()}j.win=j.doc=j.root=j.events=null;if(!k){h.removeUnload(j.destroy)}},createRng:function(){var j=this.doc;return j.createRange?j.createRange():new h.dom.Range(this)},nodeIndex:function(o,p){var j=0,m,n,l,k;if(o){for(m=o.nodeType,o=o.previousSibling,n=o;o;o=o.previousSibling){l=o.nodeType;if(p&&l==3){k=false;try{k=o.nodeValue.length}catch(q){}if(l==m||!k){continue}}j++;m=l}}return j},split:function(n,m,q){var s=this,j=s.createRng(),o,l,p;function k(v){var t,r=v.childNodes,u=v.nodeType;if(u==1&&v.getAttribute("data-mce-type")=="bookmark"){return}for(t=r.length-1;t>=0;t--){k(r[t])}if(u!=9){if(u==3&&v.nodeValue.length>0){if(!s.isBlock(v.parentNode)||h.trim(v.nodeValue).length>0){return}}else{if(u==1){r=v.childNodes;if(r.length==1&&r[0]&&r[0].nodeType==1&&r[0].getAttribute("data-mce-type")=="bookmark"){v.parentNode.insertBefore(r[0],v)}if(r.length||/^(br|hr|input|img)$/i.test(v.nodeName)){return}}}s.remove(v)}return v}if(n&&m){j.setStart(n.parentNode,s.nodeIndex(n));j.setEnd(m.parentNode,s.nodeIndex(m));o=j.extractContents();j=s.createRng();j.setStart(m.parentNode,s.nodeIndex(m)+1);j.setEnd(n.parentNode,s.nodeIndex(n)+1);l=j.extractContents();p=n.parentNode;p.insertBefore(k(o),n);if(q){p.replaceChild(q,m)}else{p.insertBefore(m,n)}p.insertBefore(k(l),n);s.remove(n);return q||m}},bind:function(n,j,m,l){var k=this;if(!k.events){k.events=new h.dom.EventUtils()}return k.events.add(n,j,m,l||this)},unbind:function(m,j,l){var k=this;if(!k.events){k.events=new h.dom.EventUtils()}return k.events.remove(m,j,l)},_findSib:function(m,j,k){var l=this,n=j;if(m){if(e(n,"string")){n=function(o){return l.is(o,j)}}for(m=m[k];m;m=m[k]){if(n(m)){return m}}}return null},_isRes:function(j){return/^(top|left|bottom|right|width|height)/i.test(j)||/;\s*(top|left|bottom|right|width|height)/i.test(j)}});h.DOM=new h.dom.DOMUtils(document,{process_html:0})})(tinymce);(function(a){function b(c){var N=this,e=c.doc,S=0,E=1,j=2,D=true,R=false,U="startOffset",h="startContainer",P="endContainer",z="endOffset",k=tinymce.extend,n=c.nodeIndex;k(N,{startContainer:e,startOffset:0,endContainer:e,endOffset:0,collapsed:D,commonAncestorContainer:e,START_TO_START:0,START_TO_END:1,END_TO_END:2,END_TO_START:3,setStart:q,setEnd:s,setStartBefore:g,setStartAfter:I,setEndBefore:J,setEndAfter:u,collapse:A,selectNode:x,selectNodeContents:F,compareBoundaryPoints:v,deleteContents:p,extractContents:H,cloneContents:d,insertNode:C,surroundContents:M,cloneRange:K});function q(V,t){B(D,V,t)}function s(V,t){B(R,V,t)}function g(t){q(t.parentNode,n(t))}function I(t){q(t.parentNode,n(t)+1)}function J(t){s(t.parentNode,n(t))}function u(t){s(t.parentNode,n(t)+1)}function A(t){if(t){N[P]=N[h];N[z]=N[U]}else{N[h]=N[P];N[U]=N[z]}N.collapsed=D}function x(t){g(t);u(t)}function F(t){q(t,0);s(t,t.nodeType===1?t.childNodes.length:t.nodeValue.length)}function v(Y,t){var ab=N[h],W=N[U],aa=N[P],V=N[z],Z=t.startContainer,ad=t.startOffset,X=t.endContainer,ac=t.endOffset;if(Y===0){return G(ab,W,Z,ad)}if(Y===1){return G(aa,V,Z,ad)}if(Y===2){return G(aa,V,X,ac)}if(Y===3){return G(ab,W,X,ac)}}function p(){m(j)}function H(){return m(S)}function d(){return m(E)}function C(Y){var V=this[h],t=this[U],X,W;if((V.nodeType===3||V.nodeType===4)&&V.nodeValue){if(!t){V.parentNode.insertBefore(Y,V)}else{if(t>=V.nodeValue.length){c.insertAfter(Y,V)}else{X=V.splitText(t);V.parentNode.insertBefore(Y,X)}}}else{if(V.childNodes.length>0){W=V.childNodes[t]}if(W){V.insertBefore(Y,W)}else{V.appendChild(Y)}}}function M(V){var t=N.extractContents();N.insertNode(V);V.appendChild(t);N.selectNode(V)}function K(){return k(new b(c),{startContainer:N[h],startOffset:N[U],endContainer:N[P],endOffset:N[z],collapsed:N.collapsed,commonAncestorContainer:N.commonAncestorContainer})}function O(t,V){var W;if(t.nodeType==3){return t}if(V<0){return t}W=t.firstChild;while(W&&V>0){--V;W=W.nextSibling}if(W){return W}return t}function l(){return(N[h]==N[P]&&N[U]==N[z])}function G(X,Z,V,Y){var aa,W,t,ab,ad,ac;if(X==V){if(Z==Y){return 0}if(Z0){N.collapse(V)}}else{N.collapse(V)}N.collapsed=l();N.commonAncestorContainer=c.findCommonAncestor(N[h],N[P])}function m(ab){var aa,X=0,ad=0,V,Z,W,Y,t,ac;if(N[h]==N[P]){return f(ab)}for(aa=N[P],V=aa.parentNode;V;aa=V,V=V.parentNode){if(V==N[h]){return r(aa,ab)}++X}for(aa=N[h],V=aa.parentNode;V;aa=V,V=V.parentNode){if(V==N[P]){return T(aa,ab)}++ad}Z=ad-X;W=N[h];while(Z>0){W=W.parentNode;Z--}Y=N[P];while(Z<0){Y=Y.parentNode;Z++}for(t=W.parentNode,ac=Y.parentNode;t!=ac;t=t.parentNode,ac=ac.parentNode){W=t;Y=ac}return o(W,Y,ab)}function f(Z){var ab,Y,X,aa,t,W,V;if(Z!=j){ab=e.createDocumentFragment()}if(N[U]==N[z]){return ab}if(N[h].nodeType==3){Y=N[h].nodeValue;X=Y.substring(N[U],N[z]);if(Z!=E){N[h].deleteData(N[U],N[z]-N[U]);N.collapse(D)}if(Z==j){return}ab.appendChild(e.createTextNode(X));return ab}aa=O(N[h],N[U]);t=N[z]-N[U];while(t>0){W=aa.nextSibling;V=y(aa,Z);if(ab){ab.appendChild(V)}--t;aa=W}if(Z!=E){N.collapse(D)}return ab}function r(ab,Y){var aa,Z,V,t,X,W;if(Y!=j){aa=e.createDocumentFragment()}Z=i(ab,Y);if(aa){aa.appendChild(Z)}V=n(ab);t=V-N[U];if(t<=0){if(Y!=E){N.setEndBefore(ab);N.collapse(R)}return aa}Z=ab.previousSibling;while(t>0){X=Z.previousSibling;W=y(Z,Y);if(aa){aa.insertBefore(W,aa.firstChild)}--t;Z=X}if(Y!=E){N.setEndBefore(ab);N.collapse(R)}return aa}function T(Z,Y){var ab,V,aa,t,X,W;if(Y!=j){ab=e.createDocumentFragment()}aa=Q(Z,Y);if(ab){ab.appendChild(aa)}V=n(Z);++V;t=N[z]-V;aa=Z.nextSibling;while(t>0){X=aa.nextSibling;W=y(aa,Y);if(ab){ab.appendChild(W)}--t;aa=X}if(Y!=E){N.setStartAfter(Z);N.collapse(D)}return ab}function o(Z,t,ac){var W,ae,Y,aa,ab,V,ad,X;if(ac!=j){ae=e.createDocumentFragment()}W=Q(Z,ac);if(ae){ae.appendChild(W)}Y=Z.parentNode;aa=n(Z);ab=n(t);++aa;V=ab-aa;ad=Z.nextSibling;while(V>0){X=ad.nextSibling;W=y(ad,ac);if(ae){ae.appendChild(W)}ad=X;--V}W=i(t,ac);if(ae){ae.appendChild(W)}if(ac!=E){N.setStartAfter(Z);N.collapse(D)}return ae}function i(aa,ab){var W=O(N[P],N[z]-1),ac,Z,Y,t,V,X=W!=N[P];if(W==aa){return L(W,X,R,ab)}ac=W.parentNode;Z=L(ac,R,R,ab);while(ac){while(W){Y=W.previousSibling;t=L(W,X,R,ab);if(ab!=j){Z.insertBefore(t,Z.firstChild)}X=D;W=Y}if(ac==aa){return Z}W=ac.previousSibling;ac=ac.parentNode;V=L(ac,R,R,ab);if(ab!=j){V.appendChild(Z)}Z=V}}function Q(aa,ab){var X=O(N[h],N[U]),Y=X!=N[h],ac,Z,W,t,V;if(X==aa){return L(X,Y,D,ab)}ac=X.parentNode;Z=L(ac,R,D,ab);while(ac){while(X){W=X.nextSibling;t=L(X,Y,D,ab);if(ab!=j){Z.appendChild(t)}Y=D;X=W}if(ac==aa){return Z}X=ac.nextSibling;ac=ac.parentNode;V=L(ac,R,D,ab);if(ab!=j){V.appendChild(Z)}Z=V}}function L(t,Y,ab,ac){var X,W,Z,V,aa;if(Y){return y(t,ac)}if(t.nodeType==3){X=t.nodeValue;if(ab){V=N[U];W=X.substring(V);Z=X.substring(0,V)}else{V=N[z];W=X.substring(0,V);Z=X.substring(V)}if(ac!=E){t.nodeValue=Z}if(ac==j){return}aa=t.cloneNode(R);aa.nodeValue=W;return aa}if(ac==j){return}return t.cloneNode(R)}function y(V,t){if(t!=j){return t==E?V.cloneNode(D):V}V.parentNode.removeChild(V)}}a.Range=b})(tinymce.dom);(function(){function a(g){var i=this,j="\uFEFF",e,h,d=g.dom,c=true,f=false;function b(){var n=g.getRng(),k=d.createRng(),m,o;m=n.item?n.item(0):n.parentElement();if(m.ownerDocument!=d.doc){return k}o=g.isCollapsed();if(n.item||!m.hasChildNodes()){if(o){k.setStart(m,0);k.setEnd(m,0)}else{k.setStart(m.parentNode,d.nodeIndex(m));k.setEnd(k.startContainer,k.startOffset+1)}return k}function l(s){var u,q,t,p,A=0,x,y,z,r,v;r=n.duplicate();r.collapse(s);u=d.create("a");z=r.parentElement();if(!z.hasChildNodes()){k[s?"setStart":"setEnd"](z,0);return}z.appendChild(u);r.moveToElementText(u);v=n.compareEndPoints(s?"StartToStart":"EndToEnd",r);if(v>0){k[s?"setStartAfter":"setEndAfter"](z);d.remove(u);return}p=tinymce.grep(z.childNodes);x=p.length-1;while(A<=x){y=Math.floor((A+x)/2);z.insertBefore(u,p[y]);r.moveToElementText(u);v=n.compareEndPoints(s?"StartToStart":"EndToEnd",r);if(v>0){A=y+1}else{if(v<0){x=y-1}else{found=true;break}}}q=v>0||y==0?u.nextSibling:u.previousSibling;if(q.nodeType==1){d.remove(u);t=d.nodeIndex(q);q=q.parentNode;if(!s||y>0){t++}}else{if(v>0||y==0){r.setEndPoint(s?"StartToStart":"EndToEnd",n);t=r.text.length}else{r.setEndPoint(s?"StartToStart":"EndToEnd",n);t=q.nodeValue.length-r.text.length}d.remove(u)}k[s?"setStart":"setEnd"](q,t)}l(true);if(!o){l()}return k}this.addRange=function(k){var p,n,m,r,u,s,t=g.dom.doc,o=t.body;function l(B){var x,A,v,z,y;v=d.create("a");x=B?m:u;A=B?r:s;z=p.duplicate();if(x==t||x==t.documentElement){x=o;A=0}if(x.nodeType==3){x.parentNode.insertBefore(v,x);z.moveToElementText(v);z.moveStart("character",A);d.remove(v);p.setEndPoint(B?"StartToStart":"EndToEnd",z)}else{y=x.childNodes;if(y.length){if(A>=y.length){d.insertAfter(v,y[y.length-1])}else{x.insertBefore(v,y[A])}z.moveToElementText(v)}else{v=t.createTextNode(j);x.appendChild(v);z.moveToElementText(v.parentNode);z.collapse(c)}p.setEndPoint(B?"StartToStart":"EndToEnd",z);d.remove(v)}}this.destroy();m=k.startContainer;r=k.startOffset;u=k.endContainer;s=k.endOffset;p=o.createTextRange();if(m==u&&m.nodeType==1&&r==s-1){if(r==s-1){try{n=o.createControlRange();n.addElement(m.childNodes[r]);n.select();return}catch(q){}}}l(true);l();p.select()};this.getRangeAt=function(){if(!e||!tinymce.dom.RangeUtils.compareRanges(h,g.getRng())){e=b();h=g.getRng()}try{e.startContainer.nextSibling}catch(k){e=b();h=null}return e};this.destroy=function(){h=e=null}}tinymce.dom.TridentSelection=a})();(function(){var p=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,j=0,d=Object.prototype.toString,o=false,i=true;[0,0].sort(function(){i=false;return 0});var b=function(v,e,z,A){z=z||[];e=e||document;var C=e;if(e.nodeType!==1&&e.nodeType!==9){return[]}if(!v||typeof v!=="string"){return z}var x=[],s,E,H,r,u=true,t=b.isXML(e),B=v,D,G,F,y;do{p.exec("");s=p.exec(B);if(s){B=s[3];x.push(s[1]);if(s[2]){r=s[3];break}}}while(s);if(x.length>1&&k.exec(v)){if(x.length===2&&f.relative[x[0]]){E=h(x[0]+x[1],e)}else{E=f.relative[x[0]]?[e]:b(x.shift(),e);while(x.length){v=x.shift();if(f.relative[v]){v+=x.shift()}E=h(v,E)}}}else{if(!A&&x.length>1&&e.nodeType===9&&!t&&f.match.ID.test(x[0])&&!f.match.ID.test(x[x.length-1])){D=b.find(x.shift(),e,t);e=D.expr?b.filter(D.expr,D.set)[0]:D.set[0]}if(e){D=A?{expr:x.pop(),set:a(A)}:b.find(x.pop(),x.length===1&&(x[0]==="~"||x[0]==="+")&&e.parentNode?e.parentNode:e,t);E=D.expr?b.filter(D.expr,D.set):D.set;if(x.length>0){H=a(E)}else{u=false}while(x.length){G=x.pop();F=G;if(!f.relative[G]){G=""}else{F=x.pop()}if(F==null){F=e}f.relative[G](H,F,t)}}else{H=x=[]}}if(!H){H=E}if(!H){b.error(G||v)}if(d.call(H)==="[object Array]"){if(!u){z.push.apply(z,H)}else{if(e&&e.nodeType===1){for(y=0;H[y]!=null;y++){if(H[y]&&(H[y]===true||H[y].nodeType===1&&b.contains(e,H[y]))){z.push(E[y])}}}else{for(y=0;H[y]!=null;y++){if(H[y]&&H[y].nodeType===1){z.push(E[y])}}}}}else{a(H,z)}if(r){b(r,C,z,A);b.uniqueSort(z)}return z};b.uniqueSort=function(r){if(c){o=i;r.sort(c);if(o){for(var e=1;e":function(x,r){var u=typeof r==="string",v,s=0,e=x.length;if(u&&!/\W/.test(r)){r=r.toLowerCase();for(;s=0)){if(!s){e.push(v)}}else{if(s){r[u]=false}}}}return false},ID:function(e){return e[1].replace(/\\/g,"")},TAG:function(r,e){return r[1].toLowerCase()},CHILD:function(e){if(e[1]==="nth"){var r=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(e[2]==="even"&&"2n"||e[2]==="odd"&&"2n+1"||!/\D/.test(e[2])&&"0n+"+e[2]||e[2]);e[2]=(r[1]+(r[2]||1))-0;e[3]=r[3]-0}e[0]=j++;return e},ATTR:function(u,r,s,e,v,x){var t=u[1].replace(/\\/g,"");if(!x&&f.attrMap[t]){u[1]=f.attrMap[t]}if(u[2]==="~="){u[4]=" "+u[4]+" "}return u},PSEUDO:function(u,r,s,e,v){if(u[1]==="not"){if((p.exec(u[3])||"").length>1||/^\w/.test(u[3])){u[3]=b(u[3],null,null,r)}else{var t=b.filter(u[3],r,s,true^v);if(!s){e.push.apply(e,t)}return false}}else{if(f.match.POS.test(u[0])||f.match.CHILD.test(u[0])){return true}}return u},POS:function(e){e.unshift(true);return e}},filters:{enabled:function(e){return e.disabled===false&&e.type!=="hidden"},disabled:function(e){return e.disabled===true},checked:function(e){return e.checked===true},selected:function(e){e.parentNode.selectedIndex;return e.selected===true},parent:function(e){return !!e.firstChild},empty:function(e){return !e.firstChild},has:function(s,r,e){return !!b(e[3],s).length},header:function(e){return(/h\d/i).test(e.nodeName)},text:function(e){return"text"===e.type},radio:function(e){return"radio"===e.type},checkbox:function(e){return"checkbox"===e.type},file:function(e){return"file"===e.type},password:function(e){return"password"===e.type},submit:function(e){return"submit"===e.type},image:function(e){return"image"===e.type},reset:function(e){return"reset"===e.type},button:function(e){return"button"===e.type||e.nodeName.toLowerCase()==="button"},input:function(e){return(/input|select|textarea|button/i).test(e.nodeName)}},setFilters:{first:function(r,e){return e===0},last:function(s,r,e,t){return r===t.length-1},even:function(r,e){return e%2===0},odd:function(r,e){return e%2===1},lt:function(s,r,e){return re[3]-0},nth:function(s,r,e){return e[3]-0===r},eq:function(s,r,e){return e[3]-0===r}},filter:{PSEUDO:function(s,y,x,z){var e=y[1],r=f.filters[e];if(r){return r(s,x,y,z)}else{if(e==="contains"){return(s.textContent||s.innerText||b.getText([s])||"").indexOf(y[3])>=0}else{if(e==="not"){var t=y[3];for(var v=0,u=t.length;v=0)}}},ID:function(r,e){return r.nodeType===1&&r.getAttribute("id")===e},TAG:function(r,e){return(e==="*"&&r.nodeType===1)||r.nodeName.toLowerCase()===e},CLASS:function(r,e){return(" "+(r.className||r.getAttribute("class"))+" ").indexOf(e)>-1},ATTR:function(v,t){var s=t[1],e=f.attrHandle[s]?f.attrHandle[s](v):v[s]!=null?v[s]:v.getAttribute(s),x=e+"",u=t[2],r=t[4];return e==null?u==="!=":u==="="?x===r:u==="*="?x.indexOf(r)>=0:u==="~="?(" "+x+" ").indexOf(r)>=0:!r?x&&e!==false:u==="!="?x!==r:u==="^="?x.indexOf(r)===0:u==="$="?x.substr(x.length-r.length)===r:u==="|="?x===r||x.substr(0,r.length+1)===r+"-":false},POS:function(u,r,s,v){var e=r[2],t=f.setFilters[e];if(t){return t(u,s,r,v)}}}};var k=f.match.POS,g=function(r,e){return"\\"+(e-0+1)};for(var m in f.match){f.match[m]=new RegExp(f.match[m].source+(/(?![^\[]*\])(?![^\(]*\))/.source));f.leftMatch[m]=new RegExp(/(^(?:.|\r|\n)*?)/.source+f.match[m].source.replace(/\\(\d+)/g,g))}var a=function(r,e){r=Array.prototype.slice.call(r,0);if(e){e.push.apply(e,r);return e}return r};try{Array.prototype.slice.call(document.documentElement.childNodes,0)[0].nodeType}catch(l){a=function(u,t){var r=t||[],s=0;if(d.call(u)==="[object Array]"){Array.prototype.push.apply(r,u)}else{if(typeof u.length==="number"){for(var e=u.length;s";var e=document.documentElement;e.insertBefore(r,e.firstChild);if(document.getElementById(s)){f.find.ID=function(u,v,x){if(typeof v.getElementById!=="undefined"&&!x){var t=v.getElementById(u[1]);return t?t.id===u[1]||typeof t.getAttributeNode!=="undefined"&&t.getAttributeNode("id").nodeValue===u[1]?[t]:undefined:[]}};f.filter.ID=function(v,t){var u=typeof v.getAttributeNode!=="undefined"&&v.getAttributeNode("id");return v.nodeType===1&&u&&u.nodeValue===t}}e.removeChild(r);e=r=null})();(function(){var e=document.createElement("div");e.appendChild(document.createComment(""));if(e.getElementsByTagName("*").length>0){f.find.TAG=function(r,v){var u=v.getElementsByTagName(r[1]);if(r[1]==="*"){var t=[];for(var s=0;u[s];s++){if(u[s].nodeType===1){t.push(u[s])}}u=t}return u}}e.innerHTML="";if(e.firstChild&&typeof e.firstChild.getAttribute!=="undefined"&&e.firstChild.getAttribute("href")!=="#"){f.attrHandle.href=function(r){return r.getAttribute("href",2)}}e=null})();if(document.querySelectorAll){(function(){var e=b,s=document.createElement("div");s.innerHTML="

            ";if(s.querySelectorAll&&s.querySelectorAll(".TEST").length===0){return}b=function(x,v,t,u){v=v||document;if(!u&&v.nodeType===9&&!b.isXML(v)){try{return a(v.querySelectorAll(x),t)}catch(y){}}return e(x,v,t,u)};for(var r in e){b[r]=e[r]}s=null})()}(function(){var e=document.createElement("div");e.innerHTML="
            ";if(!e.getElementsByClassName||e.getElementsByClassName("e").length===0){return}e.lastChild.className="e";if(e.getElementsByClassName("e").length===1){return}f.order.splice(1,0,"CLASS");f.find.CLASS=function(r,s,t){if(typeof s.getElementsByClassName!=="undefined"&&!t){return s.getElementsByClassName(r[1])}};e=null})();function n(r,x,v,A,y,z){for(var t=0,s=A.length;t0){u=e;break}}}e=e[r]}A[t]=u}}}b.contains=document.compareDocumentPosition?function(r,e){return !!(r.compareDocumentPosition(e)&16)}:function(r,e){return r!==e&&(r.contains?r.contains(e):true)};b.isXML=function(e){var r=(e?e.ownerDocument||e:0).documentElement;return r?r.nodeName!=="HTML":false};var h=function(e,y){var t=[],u="",v,s=y.nodeType?[y]:y;while((v=f.match.PSEUDO.exec(e))){u+=v[0];e=e.replace(f.match.PSEUDO,"")}e=f.relative[e]?e+"*":e;for(var x=0,r=s.length;x=0;h--){k=g[h];if(k.obj===l){j._remove(k.obj,k.name,k.cfunc);k.obj=k.cfunc=null;g.splice(h,1)}}}},cancel:function(g){if(!g){return false}this.stop(g);return this.prevent(g)},stop:function(g){if(g.stopPropagation){g.stopPropagation()}else{g.cancelBubble=true}return false},prevent:function(g){if(g.preventDefault){g.preventDefault()}else{g.returnValue=false}return false},destroy:function(){var g=this;f(g.events,function(j,h){g._remove(j.obj,j.name,j.cfunc);j.obj=j.cfunc=null});g.events=[];g=null},_add:function(h,i,g){if(h.attachEvent){h.attachEvent("on"+i,g)}else{if(h.addEventListener){h.addEventListener(i,g,false)}else{h["on"+i]=g}}},_remove:function(i,j,h){if(i){try{if(i.detachEvent){i.detachEvent("on"+j,h)}else{if(i.removeEventListener){i.removeEventListener(j,h,false)}else{i["on"+j]=null}}}catch(g){}}},_pageInit:function(h){var g=this;if(g.domLoaded){return}g.domLoaded=true;f(g.inits,function(i){i()});g.inits=[]},_wait:function(i){var g=this,h=i.document;if(i.tinyMCE_GZ&&tinyMCE_GZ.loaded){g.domLoaded=1;return}if(h.attachEvent){h.attachEvent("onreadystatechange",function(){if(h.readyState==="complete"){h.detachEvent("onreadystatechange",arguments.callee);g._pageInit(i)}});if(h.documentElement.doScroll&&i==i.top){(function(){if(g.domLoaded){return}try{h.documentElement.doScroll("left")}catch(j){setTimeout(arguments.callee,0);return}g._pageInit(i)})()}}else{if(h.addEventListener){g._add(i,"DOMContentLoaded",function(){g._pageInit(i)})}}g._add(i,"load",function(){g._pageInit(i)})},_stoppers:{preventDefault:function(){this.returnValue=false},stopPropagation:function(){this.cancelBubble=true}}});a=d.dom.Event=new d.dom.EventUtils();a._wait(window);d.addUnload(function(){a.destroy()})})(tinymce);(function(a){a.dom.Element=function(f,d){var b=this,e,c;b.settings=d=d||{};b.id=f;b.dom=e=d.dom||a.DOM;if(!a.isIE){c=e.get(b.id)}a.each(("getPos,getRect,getParent,add,setStyle,getStyle,setStyles,setAttrib,setAttribs,getAttrib,addClass,removeClass,hasClass,getOuterHTML,setOuterHTML,remove,show,hide,isHidden,setHTML,get").split(/,/),function(g){b[g]=function(){var h=[f],j;for(j=0;j_';if(f.startContainer==l&&f.endContainer==l){l.body.innerHTML=k}else{f.deleteContents();if(l.body.childNodes.length==0){l.body.innerHTML=k}else{if(f.createContextualFragment){f.insertNode(f.createContextualFragment(k))}else{m=l.createDocumentFragment();g=l.createElement("div");m.appendChild(g);g.outerHTML=k;f.insertNode(m)}}}i=h.dom.get("__caret");f=l.createRange();f.setStartBefore(i);f.setEndBefore(i);h.setRng(f);h.dom.remove("__caret");h.setRng(f)}else{if(f.item){l.execCommand("Delete",false,null);f=h.getRng()}f.pasteHTML(k)}if(!j.no_events){h.onSetContent.dispatch(h,j)}},getStart:function(){var g=this.getRng(),h,f,j,i;if(g.duplicate||g.item){if(g.item){return g.item(0)}j=g.duplicate();j.collapse(1);h=j.parentElement();f=i=g.parentElement();while(i=i.parentNode){if(i==h){h=f;break}}return h}else{h=g.startContainer;if(h.nodeType==1&&h.hasChildNodes()){h=h.childNodes[Math.min(h.childNodes.length-1,g.startOffset)]}if(h&&h.nodeType==3){return h.parentNode}return h}},getEnd:function(){var g=this,h=g.getRng(),i,f;if(h.duplicate||h.item){if(h.item){return h.item(0)}h=h.duplicate();h.collapse(0);i=h.parentElement();if(i&&i.nodeName=="BODY"){return i.lastChild||i}return i}else{i=h.endContainer;f=h.endOffset;if(i.nodeType==1&&i.hasChildNodes()){i=i.childNodes[f>0?f-1:f]}if(i&&i.nodeType==3){return i.parentNode}return i}},getBookmark:function(r,s){var v=this,m=v.dom,g,j,i,n,h,o,p,l="\uFEFF",u;function f(x,y){var t=0;d(m.select(x),function(A,z){if(A==y){t=z}});return t}if(r==2){function k(){var x=v.getRng(true),t=m.getRoot(),y={};function z(C,H){var B=C[H?"startContainer":"endContainer"],G=C[H?"startOffset":"endOffset"],A=[],D,F,E=0;if(B.nodeType==3){if(s){for(D=B.previousSibling;D&&D.nodeType==3;D=D.previousSibling){G+=D.nodeValue.length}}A.push(G)}else{F=B.childNodes;if(G>=F.length&&F.length){E=1;G=Math.max(0,F.length-1)}A.push(v.dom.nodeIndex(F[G],s)+E)}for(;B&&B!=t;B=B.parentNode){A.push(v.dom.nodeIndex(B,s))}return A}y.start=z(x,true);if(!v.isCollapsed()){y.end=z(x)}return y}return k()}if(r){return{rng:v.getRng()}}g=v.getRng();i=m.uniqueId();n=tinyMCE.activeEditor.selection.isCollapsed();u="overflow:hidden;line-height:0px";if(g.duplicate||g.item){if(!g.item){j=g.duplicate();try{g.collapse();g.pasteHTML(''+l+"");if(!n){j.collapse(false);g.moveToElementText(j.parentElement());if(g.compareEndPoints("StartToEnd",j)==0){j.move("character",-1)}j.pasteHTML(''+l+"")}}catch(q){return null}}else{o=g.item(0);h=o.nodeName;return{name:h,index:f(h,o)}}}else{o=v.getNode();h=o.nodeName;if(h=="IMG"){return{name:h,index:f(h,o)}}j=g.cloneRange();if(!n){j.collapse(false);j.insertNode(m.create("span",{"data-mce-type":"bookmark",id:i+"_end",style:u},l))}g.collapse(true);g.insertNode(m.create("span",{"data-mce-type":"bookmark",id:i+"_start",style:u},l))}v.moveToBookmark({id:i,keep:1});return{id:i}},moveToBookmark:function(n){var r=this,l=r.dom,i,h,f,q,j,s,o,p;if(r.tridentSel){r.tridentSel.destroy()}if(n){if(n.start){f=l.createRng();q=l.getRoot();function g(z){var t=n[z?"start":"end"],v,x,y,u;if(t){y=t[0];for(x=q,v=t.length-1;v>=1;v--){u=x.childNodes;if(t[v]>u.length-1){return}x=u[t[v]]}if(x.nodeType===3){y=Math.min(t[0],x.nodeValue.length)}if(x.nodeType===1){y=Math.min(t[0],x.childNodes.length)}if(z){f.setStart(x,y)}else{f.setEnd(x,y)}}return true}if(g(true)&&g()){r.setRng(f)}}else{if(n.id){function k(A){var u=l.get(n.id+"_"+A),z,t,x,y,v=n.keep;if(u){z=u.parentNode;if(A=="start"){if(!v){t=l.nodeIndex(u)}else{z=u.firstChild;t=1}j=s=z;o=p=t}else{if(!v){t=l.nodeIndex(u)}else{z=u.firstChild;t=1}s=z;p=t}if(!v){y=u.previousSibling;x=u.nextSibling;d(c.grep(u.childNodes),function(B){if(B.nodeType==3){B.nodeValue=B.nodeValue.replace(/\uFEFF/g,"")}});while(u=l.get(n.id+"_"+A)){l.remove(u,1)}if(y&&x&&y.nodeType==x.nodeType&&y.nodeType==3&&!c.isOpera){t=y.nodeValue.length;y.appendData(x.nodeValue);l.remove(x);if(A=="start"){j=s=y;o=p=t}else{s=y;p=t}}}}}function m(t){if(l.isBlock(t)&&!t.innerHTML){t.innerHTML=!a?'
            ':" "}return t}k("start");k("end");if(j){f=l.createRng();f.setStart(m(j),o);f.setEnd(m(s),p);r.setRng(f)}}else{if(n.name){r.select(l.select(n.name)[n.index])}else{if(n.rng){r.setRng(n.rng)}}}}}},select:function(k,j){var i=this,l=i.dom,g=l.createRng(),f;if(k){f=l.nodeIndex(k);g.setStart(k.parentNode,f);g.setEnd(k.parentNode,f+1);if(j){function h(m,o){var n=new c.dom.TreeWalker(m,m);do{if(m.nodeType==3&&c.trim(m.nodeValue).length!=0){if(o){g.setStart(m,0)}else{g.setEnd(m,m.nodeValue.length)}return}if(m.nodeName=="BR"){if(o){g.setStartBefore(m)}else{g.setEndBefore(m)}return}}while(m=(o?n.next():n.prev()))}h(k,1);h(k)}i.setRng(g)}return k},isCollapsed:function(){var f=this,h=f.getRng(),g=f.getSel();if(!h||h.item){return false}if(h.compareEndPoints){return h.compareEndPoints("StartToEnd",h)===0}return !g||h.collapsed},collapse:function(f){var h=this,g=h.getRng(),i;if(g.item){i=g.item(0);g=h.win.document.body.createTextRange();g.moveToElementText(i)}g.collapse(!!f);h.setRng(g)},getSel:function(){var g=this,f=this.win;return f.getSelection?f.getSelection():f.document.selection},getRng:function(l){var g=this,h,i,k,j=g.win.document;if(l&&g.tridentSel){return g.tridentSel.getRangeAt(0)}try{if(h=g.getSel()){i=h.rangeCount>0?h.getRangeAt(0):(h.createRange?h.createRange():j.createRange())}}catch(f){}if(c.isIE&&i&&i.setStart&&j.selection.createRange().item){k=j.selection.createRange().item(0);i=j.createRange();i.setStartBefore(k);i.setEndAfter(k)}if(!i){i=j.createRange?j.createRange():j.body.createTextRange()}if(g.selectedRange&&g.explicitRange){if(i.compareBoundaryPoints(i.START_TO_START,g.selectedRange)===0&&i.compareBoundaryPoints(i.END_TO_END,g.selectedRange)===0){i=g.explicitRange}else{g.selectedRange=null;g.explicitRange=null}}return i},setRng:function(i){var h,g=this;if(!g.tridentSel){h=g.getSel();if(h){g.explicitRange=i;try{h.removeAllRanges()}catch(f){}h.addRange(i);g.selectedRange=h.getRangeAt(0)}}else{if(i.cloneRange){g.tridentSel.addRange(i);return}try{i.select()}catch(f){}}},setNode:function(g){var f=this;f.setContent(f.dom.getOuterHTML(g));return g},getNode:function(){var h=this,g=h.getRng(),i=h.getSel(),l,k=g.startContainer,f=g.endContainer;if(!g){return h.dom.getRoot()}if(g.setStart){l=g.commonAncestorContainer;if(!g.collapsed){if(g.startContainer==g.endContainer){if(g.endOffset-g.startOffset<2){if(g.startContainer.hasChildNodes()){l=g.startContainer.childNodes[g.startOffset]}}}if(k.nodeType===3&&f.nodeType===3){function j(p,m){var o=p;while(p&&p.nodeType===3&&p.length===0){p=m?p.nextSibling:p.previousSibling}return p||o}if(k.length===g.startOffset){k=j(k.nextSibling,true)}else{k=k.parentNode}if(g.endOffset===0){f=j(f.previousSibling,false)}else{f=f.parentNode}if(k&&k===f){return k}}}if(l&&l.nodeType==3){return l.parentNode}return l}return g.item?g.item(0):g.parentElement()},getSelectedBlocks:function(g,f){var i=this,j=i.dom,m,h,l,k=[];m=j.getParent(g||i.getStart(),j.isBlock);h=j.getParent(f||i.getEnd(),j.isBlock);if(m){k.push(m)}if(m&&h&&m!=h){l=m;while((l=l.nextSibling)&&l!=h){if(j.isBlock(l)){k.push(l)}}}if(h&&m!=h){k.push(h)}return k},destroy:function(g){var f=this;f.win=null;if(f.tridentSel){f.tridentSel.destroy()}if(!g){c.removeUnload(f.destroy)}},_fixIESelection:function(){var g=this.dom,m=g.doc,h=m.body,j,n,f;m.documentElement.unselectable=true;function i(o,r){var p=h.createTextRange();try{p.moveToPoint(o,r)}catch(q){p=null}return p}function l(p){var o;if(p.button){o=i(p.x,p.y);if(o){if(o.compareEndPoints("StartToStart",n)>0){o.setEndPoint("StartToStart",n)}else{o.setEndPoint("EndToEnd",n)}o.select()}}else{k()}}function k(){var o=m.selection.createRange();if(n&&!o.item&&o.compareEndPoints("StartToEnd",o)===0){n.select()}g.unbind(m,"mouseup",k);g.unbind(m,"mousemove",l);n=j=0}g.bind(m,["mousedown","contextmenu"],function(o){if(o.target.nodeName==="HTML"){if(j){k()}f=m.documentElement;if(f.scrollHeight>f.clientHeight){return}j=1;n=i(o.x,o.y);if(n){g.bind(m,"mouseup",k);g.bind(m,"mousemove",l);g.win.focus();n.select()}}})}})})(tinymce);(function(a){a.dom.Serializer=function(e,i,f){var h,b,d=a.isIE,g=a.each,c;if(!e.apply_source_formatting){e.indent=false}e.remove_trailing_brs=true;i=i||a.DOM;f=f||new a.html.Schema(e);e.entity_encoding=e.entity_encoding||"named";h=new a.util.Dispatcher(self);b=new a.util.Dispatcher(self);c=new a.html.DomParser(e,f);c.addAttributeFilter("src,href,style",function(k,j){var o=k.length,l,q,n="data-mce-"+j,p=e.url_converter,r=e.url_converter_scope,m;while(o--){l=k[o];q=l.attributes.map[n];if(q!==m){l.attr(j,q.length>0?q:null);l.attr(n,null)}else{q=l.attributes.map[j];if(j==="style"){q=i.serializeStyle(i.parseStyle(q),l.name)}else{if(p){q=p.call(r,q,j,l.name)}}l.attr(j,q.length>0?q:null)}}});c.addAttributeFilter("class",function(j,k){var l=j.length,m,n;while(l--){m=j[l];n=m.attr("class").replace(/\s*mce(Item\w+|Selected)\s*/g,"");m.attr("class",n.length>0?n:null)}});c.addAttributeFilter("data-mce-type",function(j,l,k){var m=j.length,n;while(m--){n=j[m];if(n.attributes.map["data-mce-type"]==="bookmark"&&!k.cleanup){n.remove()}}});c.addNodeFilter("script,style",function(k,l){var m=k.length,n,o;function j(p){return p.replace(/()/g,"\n").replace(/^[\r\n]*|[\r\n]*$/g,"").replace(/^\s*(\/\/\s*|\]\]>|-->|\]\]-->)\s*$/g,"")}while(m--){n=k[m];o=n.firstChild?n.firstChild.value:"";if(l==="script"){n.attr("type",(n.attr("type")||"text/javascript").replace(/^mce\-/,""));if(o.length>0){n.firstChild.value="// "}}else{if(o.length>0){n.firstChild.value=""}}}});c.addNodeFilter("#comment",function(j,k){var l=j.length,m;while(l--){m=j[l];if(m.value.indexOf("[CDATA[")===0){m.name="#cdata";m.type=4;m.value=m.value.replace(/^\[CDATA\[|\]\]$/g,"")}else{if(m.value.indexOf("mce:protected ")===0){m.name="#text";m.type=3;m.raw=true;m.value=unescape(m.value).substr(14)}}}});c.addNodeFilter("xml:namespace,input",function(j,k){var l=j.length,m;while(l--){m=j[l];if(m.type===7){m.remove()}else{if(m.type===1){if(k==="input"&&!("type" in m.attributes.map)){m.attr("type","text")}}}}});if(e.fix_list_elements){c.addNodeFilter("ul,ol",function(k,l){var m=k.length,n,j;while(m--){n=k[m];j=n.parent;if(j.name==="ul"||j.name==="ol"){if(n.prev&&n.prev.name==="li"){n.prev.append(n)}}}})}c.addAttributeFilter("data-mce-src,data-mce-href,data-mce-style",function(j,k){var l=j.length;while(l--){j[l].attr(k,null)}});return{schema:f,addNodeFilter:c.addNodeFilter,addAttributeFilter:c.addAttributeFilter,onPreProcess:h,onPostProcess:b,serialize:function(o,m){var l,p,k,j,n;if(d&&i.select("script,style,select").length>0){n=o.innerHTML;o=o.cloneNode(false);i.setHTML(o,n)}else{o=o.cloneNode(true)}l=o.ownerDocument.implementation;if(l.createHTMLDocument){p=l.createHTMLDocument("");g(o.nodeName=="BODY"?o.childNodes:[o],function(q){p.body.appendChild(p.importNode(q,true))});if(o.nodeName!="BODY"){o=p.body.firstChild}else{o=p.body}k=i.doc;i.doc=p}m=m||{};m.format=m.format||"html";if(!m.no_events){m.node=o;h.dispatch(self,m)}j=new a.html.Serializer(e,f);m.content=j.serialize(c.parse(m.getInner?o.innerHTML:a.trim(i.getOuterHTML(o),m),m));if(!m.cleanup){m.content=m.content.replace(/\uFEFF/g,"")}if(!m.no_events){b.dispatch(self,m)}if(k){i.doc=k}m.node=null;return m.content},addRules:function(j){f.addValidElements(j)},setRules:function(j){f.setValidElements(j)}}}})(tinymce);(function(a){a.dom.ScriptLoader=function(h){var c=0,k=1,i=2,l={},j=[],f={},d=[],g=0,e;function b(m,v){var x=this,q=a.DOM,s,o,r,n;function p(){q.remove(n);if(s){s.onreadystatechange=s.onload=s=null}v()}function u(){if(typeof(console)!=="undefined"&&console.log){console.log("Failed to load: "+m)}}n=q.uniqueId();if(a.isIE6){o=new a.util.URI(m);r=location;if(o.host==r.hostname&&o.port==r.port&&(o.protocol+":")==r.protocol&&o.protocol.toLowerCase()!="file"){a.util.XHR.send({url:a._addVer(o.getURI()),success:function(y){var t=q.create("script",{type:"text/javascript"});t.text=y;document.getElementsByTagName("head")[0].appendChild(t);q.remove(t);p()},error:u});return}}s=q.create("script",{id:n,type:"text/javascript",src:a._addVer(m)});if(!a.isIE){s.onload=p}s.onerror=u;if(!a.isOpera){s.onreadystatechange=function(){var t=s.readyState;if(t=="complete"||t=="loaded"){p()}}}(document.getElementsByTagName("head")[0]||document.body).appendChild(s)}this.isDone=function(m){return l[m]==i};this.markDone=function(m){l[m]=i};this.add=this.load=function(m,q,n){var o,p=l[m];if(p==e){j.push(m);l[m]=c}if(q){if(!f[m]){f[m]=[]}f[m].push({func:q,scope:n||this})}};this.loadQueue=function(n,m){this.loadScripts(j,n,m)};this.loadScripts=function(m,q,p){var o;function n(r){a.each(f[r],function(s){s.func.call(s.scope)});f[r]=e}d.push({func:q,scope:p||this});o=function(){var r=a.grep(m);m.length=0;a.each(r,function(s){if(l[s]==i){n(s);return}if(l[s]!=k){l[s]=k;g++;b(s,function(){l[s]=i;g--;n(s);o()})}});if(!g){a.each(d,function(s){s.func.call(s.scope)});d.length=0}};o()}};a.ScriptLoader=new a.dom.ScriptLoader()})(tinymce);tinymce.dom.TreeWalker=function(a,c){var b=a;function d(i,f,e,j){var h,g;if(i){if(!j&&i[f]){return i[f]}if(i!=c){h=i[e];if(h){return h}for(g=i.parentNode;g&&g!=c;g=g.parentNode){h=g[e];if(h){return h}}}}}this.current=function(){return b};this.next=function(e){return(b=d(b,"firstChild","nextSibling",e))};this.prev=function(e){return(b=d(b,"lastChild","previousSibling",e))}};(function(a){a.dom.RangeUtils=function(c){var b="\uFEFF";this.walk=function(d,r){var h=d.startContainer,k=d.startOffset,s=d.endContainer,l=d.endOffset,i,f,n,g,q,p,e;e=c.select("td.mceSelected,th.mceSelected");if(e.length>0){a.each(e,function(t){r([t])});return}function o(v,u,t){var x=[];for(;v&&v!=t;v=v[u]){x.push(v)}return x}function m(u,t){do{if(u.parentNode==t){return u}u=u.parentNode}while(u)}function j(v,u,x){var t=x?"nextSibling":"previousSibling";for(g=v,q=g.parentNode;g&&g!=u;g=q){q=g.parentNode;p=o(g==v?g:g[t],t);if(p.length){if(!x){p.reverse()}r(p)}}}if(h.nodeType==1&&h.hasChildNodes()){h=h.childNodes[k]}if(s.nodeType==1&&s.hasChildNodes()){s=s.childNodes[Math.min(l-1,s.childNodes.length-1)]}i=c.findCommonAncestor(h,s);if(h==s){return r([h])}for(g=h;g;g=g.parentNode){if(g==s){return j(h,i,true)}if(g==i){break}}for(g=s;g;g=g.parentNode){if(g==h){return j(s,i)}if(g==i){break}}f=m(h,i)||h;n=m(s,i)||s;j(h,f,true);p=o(f==h?f:f.nextSibling,"nextSibling",n==s?n.nextSibling:n);if(p.length){r(p)}j(s,n)}};a.dom.RangeUtils.compareRanges=function(c,b){if(c&&b){if(c.item||c.duplicate){if(c.item&&b.item&&c.item(0)===b.item(0)){return true}if(c.isEqual&&b.isEqual&&b.isEqual(c)){return true}}else{return c.startContainer==b.startContainer&&c.startOffset==b.startOffset}}return false}})(tinymce);(function(b){var a=b.dom.Event,c=b.each;b.create("tinymce.ui.KeyboardNavigation",{KeyboardNavigation:function(e,f){var p=this,m=e.root,l=e.items,n=e.enableUpDown,i=e.enableLeftRight||!e.enableUpDown,k=e.excludeFromTabOrder,j,h,o,d,g;f=f||b.DOM;j=function(q){g=q.target.id};h=function(q){f.setAttrib(q.target.id,"tabindex","-1")};d=function(q){var r=f.get(g);f.setAttrib(r,"tabindex","0");r.focus()};p.focus=function(){f.get(g).focus()};p.destroy=function(){c(l,function(q){f.unbind(f.get(q.id),"focus",j);f.unbind(f.get(q.id),"blur",h)});f.unbind(f.get(m),"focus",d);f.unbind(f.get(m),"keydown",o);l=f=m=p.focus=j=h=o=d=null;p.destroy=function(){}};p.moveFocus=function(u,r){var q=-1,t=p.controls,s;if(!g){return}c(l,function(x,v){if(x.id===g){q=v;return false}});q+=u;if(q<0){q=l.length-1}else{if(q>=l.length){q=0}}s=l[q];f.setAttrib(g,"tabindex","-1");f.setAttrib(s.id,"tabindex","0");f.get(s.id).focus();if(e.actOnFocus){e.onAction(s.id)}if(r){a.cancel(r)}};o=function(y){var u=37,t=39,x=38,z=40,q=27,s=14,r=13,v=32;switch(y.keyCode){case u:if(i){p.moveFocus(-1)}break;case t:if(i){p.moveFocus(1)}break;case x:if(n){p.moveFocus(-1)}break;case z:if(n){p.moveFocus(1)}break;case q:if(e.onCancel){e.onCancel();a.cancel(y)}break;case s:case r:case v:if(e.onAction){e.onAction(g);a.cancel(y)}break}};c(l,function(s,q){var r;if(!s.id){s.id=f.uniqueId("_mce_item_")}if(k){f.bind(s.id,"blur",h);r="-1"}else{r=(q===0?"0":"-1")}f.setAttrib(s.id,"tabindex",r);f.bind(f.get(s.id),"focus",j)});if(l[0]){g=l[0].id}f.setAttrib(m,"tabindex","-1");f.bind(f.get(m),"focus",d);f.bind(f.get(m),"keydown",o)}})})(tinymce);(function(c){var b=c.DOM,a=c.is;c.create("tinymce.ui.Control",{Control:function(f,e,d){this.id=f;this.settings=e=e||{};this.rendered=false;this.onRender=new c.util.Dispatcher(this);this.classPrefix="";this.scope=e.scope||this;this.disabled=0;this.active=0;this.editor=d},setAriaProperty:function(f,e){var d=b.get(this.id+"_aria")||b.get(this.id);if(d){b.setAttrib(d,"aria-"+f,!!e)}},focus:function(){b.get(this.id).focus()},setDisabled:function(d){if(d!=this.disabled){this.setAriaProperty("disabled",d);this.setState("Disabled",d);this.setState("Enabled",!d);this.disabled=d}},isDisabled:function(){return this.disabled},setActive:function(d){if(d!=this.active){this.setState("Active",d);this.active=d;this.setAriaProperty("pressed",d)}},isActive:function(){return this.active},setState:function(f,d){var e=b.get(this.id);f=this.classPrefix+f;if(d){b.addClass(e,f)}else{b.removeClass(e,f)}},isRendered:function(){return this.rendered},renderHTML:function(){},renderTo:function(d){b.setHTML(d,this.renderHTML())},postRender:function(){var e=this,d;if(a(e.disabled)){d=e.disabled;e.disabled=-1;e.setDisabled(d)}if(a(e.active)){d=e.active;e.active=-1;e.setActive(d)}},remove:function(){b.remove(this.id);this.destroy()},destroy:function(){c.dom.Event.clear(this.id)}})})(tinymce);tinymce.create("tinymce.ui.Container:tinymce.ui.Control",{Container:function(c,b,a){this.parent(c,b,a);this.controls=[];this.lookup={}},add:function(a){this.lookup[a.id]=a;this.controls.push(a);return a},get:function(a){return this.lookup[a]}});tinymce.create("tinymce.ui.Separator:tinymce.ui.Control",{Separator:function(b,a){this.parent(b,a);this.classPrefix="mceSeparator";this.setDisabled(true)},renderHTML:function(){return tinymce.DOM.createHTML("span",{"class":this.classPrefix,role:"separator","aria-orientation":"vertical",tabindex:"-1"})}});(function(d){var c=d.is,b=d.DOM,e=d.each,a=d.walk;d.create("tinymce.ui.MenuItem:tinymce.ui.Control",{MenuItem:function(g,f){this.parent(g,f);this.classPrefix="mceMenuItem"},setSelected:function(f){this.setState("Selected",f);this.setAriaProperty("checked",!!f);this.selected=f},isSelected:function(){return this.selected},postRender:function(){var f=this;f.parent();if(c(f.selected)){f.setSelected(f.selected)}}})})(tinymce);(function(d){var c=d.is,b=d.DOM,e=d.each,a=d.walk;d.create("tinymce.ui.Menu:tinymce.ui.MenuItem",{Menu:function(h,g){var f=this;f.parent(h,g);f.items={};f.collapsed=false;f.menuCount=0;f.onAddItem=new d.util.Dispatcher(this)},expand:function(g){var f=this;if(g){a(f,function(h){if(h.expand){h.expand()}},"items",f)}f.collapsed=false},collapse:function(g){var f=this;if(g){a(f,function(h){if(h.collapse){h.collapse()}},"items",f)}f.collapsed=true},isCollapsed:function(){return this.collapsed},add:function(f){if(!f.settings){f=new d.ui.MenuItem(f.id||b.uniqueId(),f)}this.onAddItem.dispatch(this,f);return this.items[f.id]=f},addSeparator:function(){return this.add({separator:true})},addMenu:function(f){if(!f.collapse){f=this.createMenu(f)}this.menuCount++;return this.add(f)},hasMenus:function(){return this.menuCount!==0},remove:function(f){delete this.items[f.id]},removeAll:function(){var f=this;a(f,function(g){if(g.removeAll){g.removeAll()}else{g.remove()}g.destroy()},"items",f);f.items={}},createMenu:function(g){var f=new d.ui.Menu(g.id||b.uniqueId(),g);f.onAddItem.add(this.onAddItem.dispatch,this.onAddItem);return f}})})(tinymce);(function(e){var d=e.is,c=e.DOM,f=e.each,a=e.dom.Event,b=e.dom.Element;e.create("tinymce.ui.DropMenu:tinymce.ui.Menu",{DropMenu:function(h,g){g=g||{};g.container=g.container||c.doc.body;g.offset_x=g.offset_x||0;g.offset_y=g.offset_y||0;g.vp_offset_x=g.vp_offset_x||0;g.vp_offset_y=g.vp_offset_y||0;if(d(g.icons)&&!g.icons){g["class"]+=" mceNoIcons"}this.parent(h,g);this.onShowMenu=new e.util.Dispatcher(this);this.onHideMenu=new e.util.Dispatcher(this);this.classPrefix="mceMenu"},createMenu:function(j){var h=this,i=h.settings,g;j.container=j.container||i.container;j.parent=h;j.constrain=j.constrain||i.constrain;j["class"]=j["class"]||i["class"];j.vp_offset_x=j.vp_offset_x||i.vp_offset_x;j.vp_offset_y=j.vp_offset_y||i.vp_offset_y;j.keyboard_focus=i.keyboard_focus;g=new e.ui.DropMenu(j.id||c.uniqueId(),j);g.onAddItem.add(h.onAddItem.dispatch,h.onAddItem);return g},focus:function(){var g=this;if(g.keyboardNav){g.keyboardNav.focus()}},update:function(){var i=this,j=i.settings,g=c.get("menu_"+i.id+"_tbl"),l=c.get("menu_"+i.id+"_co"),h,k;h=j.max_width?Math.min(g.clientWidth,j.max_width):g.clientWidth;k=j.max_height?Math.min(g.clientHeight,j.max_height):g.clientHeight;if(!c.boxModel){i.element.setStyles({width:h+2,height:k+2})}else{i.element.setStyles({width:h,height:k})}if(j.max_width){c.setStyle(l,"width",h)}if(j.max_height){c.setStyle(l,"height",k);if(g.clientHeightv){p=r?r-u:Math.max(0,(v-A.vp_offset_x)-u)}if((n+A.vp_offset_y+l)>q){n=Math.max(0,(q-A.vp_offset_y)-l)}}c.setStyles(o,{left:p,top:n});z.element.update();z.isMenuVisible=1;z.mouseClickFunc=a.add(o,"click",function(s){var h;s=s.target;if(s&&(s=c.getParent(s,"tr"))&&!c.hasClass(s,m+"ItemSub")){h=z.items[s.id];if(h.isDisabled()){return}k=z;while(k){if(k.hideMenu){k.hideMenu()}k=k.settings.parent}if(h.settings.onclick){h.settings.onclick(s)}return a.cancel(s)}});if(z.hasMenus()){z.mouseOverFunc=a.add(o,"mouseover",function(x){var h,t,s;x=x.target;if(x&&(x=c.getParent(x,"tr"))){h=z.items[x.id];if(z.lastMenu){z.lastMenu.collapse(1)}if(h.isDisabled()){return}if(x&&c.hasClass(x,m+"ItemSub")){t=c.getRect(x);h.showMenu((t.x+t.w-i),t.y-i,t.x);z.lastMenu=h;c.addClass(c.get(h.id).firstChild,m+"ItemActive")}}})}a.add(o,"keydown",z._keyHandler,z);z.onShowMenu.dispatch(z);if(A.keyboard_focus){z._setupKeyboardNav()}},hideMenu:function(j){var g=this,i=c.get("menu_"+g.id),h;if(!g.isMenuVisible){return}if(g.keyboardNav){g.keyboardNav.destroy()}a.remove(i,"mouseover",g.mouseOverFunc);a.remove(i,"click",g.mouseClickFunc);a.remove(i,"keydown",g._keyHandler);c.hide(i);g.isMenuVisible=0;if(!j){g.collapse(1)}if(g.element){g.element.hide()}if(h=c.get(g.id)){c.removeClass(h.firstChild,g.classPrefix+"ItemActive")}g.onHideMenu.dispatch(g)},add:function(i){var g=this,h;i=g.parent(i);if(g.isRendered&&(h=c.get("menu_"+g.id))){g._add(c.select("tbody",h)[0],i)}return i},collapse:function(g){this.parent(g);this.hideMenu(1)},remove:function(g){c.remove(g.id);this.destroy();return this.parent(g)},destroy:function(){var g=this,h=c.get("menu_"+g.id);if(g.keyboardNav){g.keyboardNav.destroy()}a.remove(h,"mouseover",g.mouseOverFunc);a.remove(c.select("a",h),"focus",g.mouseOverFunc);a.remove(h,"click",g.mouseClickFunc);a.remove(h,"keydown",g._keyHandler);if(g.element){g.element.remove()}c.remove(h)},renderNode:function(){var i=this,j=i.settings,l,h,k,g;g=c.create("div",{role:"listbox",id:"menu_"+i.id,"class":j["class"],style:"position:absolute;left:0;top:0;z-index:200000;outline:0"});if(i.settings.parent){c.setAttrib(g,"aria-parent","menu_"+i.settings.parent.id)}k=c.add(g,"div",{role:"presentation",id:"menu_"+i.id+"_co","class":i.classPrefix+(j["class"]?" "+j["class"]:"")});i.element=new b("menu_"+i.id,{blocker:1,container:j.container});if(j.menu_line){c.add(k,"span",{"class":i.classPrefix+"Line"})}l=c.add(k,"table",{role:"presentation",id:"menu_"+i.id+"_tbl",border:0,cellPadding:0,cellSpacing:0});h=c.add(l,"tbody");f(i.items,function(m){i._add(h,m)});i.rendered=true;return g},_setupKeyboardNav:function(){var i,h,g=this;i=c.select("#menu_"+g.id)[0];h=c.select("a[role=option]","menu_"+g.id);h.splice(0,0,i);g.keyboardNav=new e.ui.KeyboardNavigation({root:"menu_"+g.id,items:h,onCancel:function(){g.hideMenu()},enableUpDown:true});i.focus()},_keyHandler:function(g){var h=this,i;switch(g.keyCode){case 37:if(h.settings.parent){h.hideMenu();h.settings.parent.focus();a.cancel(g)}break;case 39:if(h.mouseOverFunc){h.mouseOverFunc(g)}break}},_add:function(j,h){var i,q=h.settings,p,l,k,m=this.classPrefix,g;if(q.separator){l=c.add(j,"tr",{id:h.id,"class":m+"ItemSeparator"});c.add(l,"td",{"class":m+"ItemSeparator"});if(i=l.previousSibling){c.addClass(i,"mceLast")}return}i=l=c.add(j,"tr",{id:h.id,"class":m+"Item "+m+"ItemEnabled"});i=k=c.add(i,q.titleItem?"th":"td");i=p=c.add(i,"a",{id:h.id+"_aria",role:q.titleItem?"presentation":"option",href:"javascript:;",onclick:"return false;",onmousedown:"return false;"});if(q.parent){c.setAttrib(p,"aria-haspopup","true");c.setAttrib(p,"aria-owns","menu_"+h.id)}c.addClass(k,q["class"]);g=c.add(i,"span",{"class":"mceIcon"+(q.icon?" mce_"+q.icon:"")});if(q.icon_src){c.add(g,"img",{src:q.icon_src})}i=c.add(i,q.element||"span",{"class":"mceText",title:h.settings.title},h.settings.title);if(h.settings.style){c.setAttrib(i,"style",h.settings.style)}if(j.childNodes.length==1){c.addClass(l,"mceFirst")}if((i=l.previousSibling)&&c.hasClass(i,m+"ItemSeparator")){c.addClass(l,"mceFirst")}if(h.collapse){c.addClass(l,m+"ItemSub")}if(i=l.previousSibling){c.removeClass(i,"mceLast")}c.addClass(l,"mceLast")}})})(tinymce);(function(b){var a=b.DOM;b.create("tinymce.ui.Button:tinymce.ui.Control",{Button:function(e,d,c){this.parent(e,d,c);this.classPrefix="mceButton"},renderHTML:function(){var f=this.classPrefix,e=this.settings,d,c;c=a.encode(e.label||"");d='';if(e.image){d+=''+a.encode(e.title)+''+c}else{d+=''+(c?''+c+"":"")}d+='";d+="";return d},postRender:function(){var c=this,d=c.settings;b.dom.Event.add(c.id,"click",function(f){if(!c.isDisabled()){return d.onclick.call(d.scope,f)}})}})})(tinymce);(function(d){var c=d.DOM,b=d.dom.Event,e=d.each,a=d.util.Dispatcher;d.create("tinymce.ui.ListBox:tinymce.ui.Control",{ListBox:function(i,h,f){var g=this;g.parent(i,h,f);g.items=[];g.onChange=new a(g);g.onPostRender=new a(g);g.onAdd=new a(g);g.onRenderMenu=new d.util.Dispatcher(this);g.classPrefix="mceListBox"},select:function(h){var g=this,j,i;if(h==undefined){return g.selectByIndex(-1)}if(h&&h.call){i=h}else{i=function(f){return f==h}}if(h!=g.selectedValue){e(g.items,function(k,f){if(i(k.value)){j=1;g.selectByIndex(f);return false}});if(!j){g.selectByIndex(-1)}}},selectByIndex:function(f){var g=this,h,i;if(f!=g.selectedIndex){h=c.get(g.id+"_text");i=g.items[f];if(i){g.selectedValue=i.value;g.selectedIndex=f;c.setHTML(h,c.encode(i.title));c.removeClass(h,"mceTitle");c.setAttrib(g.id,"aria-valuenow",i.title)}else{c.setHTML(h,c.encode(g.settings.title));c.addClass(h,"mceTitle");g.selectedValue=g.selectedIndex=null;c.setAttrib(g.id,"aria-valuenow",g.settings.title)}h=0}},add:function(i,f,h){var g=this;h=h||{};h=d.extend(h,{title:i,value:f});g.items.push(h);g.onAdd.dispatch(g,h)},getLength:function(){return this.items.length},renderHTML:function(){var i="",f=this,g=f.settings,j=f.classPrefix;i='';i+="";i+="";i+="";return i},showMenu:function(){var g=this,j,i,h=c.get(this.id),f;if(g.isDisabled()||g.items.length==0){return}if(g.menu&&g.menu.isMenuVisible){return g.hideMenu()}if(!g.isMenuRendered){g.renderMenu();g.isMenuRendered=true}j=c.getPos(this.settings.menu_container);i=c.getPos(h);f=g.menu;f.settings.offset_x=i.x;f.settings.offset_y=i.y;f.settings.keyboard_focus=!d.isOpera;if(g.oldID){f.items[g.oldID].setSelected(0)}e(g.items,function(k){if(k.value===g.selectedValue){f.items[k.id].setSelected(1);g.oldID=k.id}});f.showMenu(0,h.clientHeight);b.add(c.doc,"mousedown",g.hideMenu,g);c.addClass(g.id,g.classPrefix+"Selected")},hideMenu:function(g){var f=this;if(f.menu&&f.menu.isMenuVisible){c.removeClass(f.id,f.classPrefix+"Selected");if(g&&g.type=="mousedown"&&(g.target.id==f.id+"_text"||g.target.id==f.id+"_open")){return}if(!g||!c.getParent(g.target,".mceMenu")){c.removeClass(f.id,f.classPrefix+"Selected");b.remove(c.doc,"mousedown",f.hideMenu,f);f.menu.hideMenu()}}},renderMenu:function(){var g=this,f;f=g.settings.control_manager.createDropMenu(g.id+"_menu",{menu_line:1,"class":g.classPrefix+"Menu mceNoIcons",max_width:150,max_height:150});f.onHideMenu.add(function(){g.hideMenu();g.focus()});f.add({title:g.settings.title,"class":"mceMenuItemTitle",onclick:function(){if(g.settings.onselect("")!==false){g.select("")}}});e(g.items,function(h){if(h.value===undefined){f.add({title:h.title,"class":"mceMenuItemTitle",onclick:function(){if(g.settings.onselect("")!==false){g.select("")}}})}else{h.id=c.uniqueId();h.onclick=function(){if(g.settings.onselect(h.value)!==false){g.select(h.value)}};f.add(h)}});g.onRenderMenu.dispatch(g,f);g.menu=f},postRender:function(){var f=this,g=f.classPrefix;b.add(f.id,"click",f.showMenu,f);b.add(f.id,"keydown",function(h){if(h.keyCode==32){f.showMenu(h);b.cancel(h)}});b.add(f.id,"focus",function(){if(!f._focused){f.keyDownHandler=b.add(f.id,"keydown",function(h){if(h.keyCode==40){f.showMenu();b.cancel(h)}});f.keyPressHandler=b.add(f.id,"keypress",function(i){var h;if(i.keyCode==13){h=f.selectedValue;f.selectedValue=null;b.cancel(i);f.settings.onselect(h)}})}f._focused=1});b.add(f.id,"blur",function(){b.remove(f.id,"keydown",f.keyDownHandler);b.remove(f.id,"keypress",f.keyPressHandler);f._focused=0});if(d.isIE6||!c.boxModel){b.add(f.id,"mouseover",function(){if(!c.hasClass(f.id,g+"Disabled")){c.addClass(f.id,g+"Hover")}});b.add(f.id,"mouseout",function(){if(!c.hasClass(f.id,g+"Disabled")){c.removeClass(f.id,g+"Hover")}})}f.onPostRender.dispatch(f,c.get(f.id))},destroy:function(){this.parent();b.clear(this.id+"_text");b.clear(this.id+"_open")}})})(tinymce);(function(d){var c=d.DOM,b=d.dom.Event,e=d.each,a=d.util.Dispatcher;d.create("tinymce.ui.NativeListBox:tinymce.ui.ListBox",{NativeListBox:function(g,f){this.parent(g,f);this.classPrefix="mceNativeListBox"},setDisabled:function(f){c.get(this.id).disabled=f;this.setAriaProperty("disabled",f)},isDisabled:function(){return c.get(this.id).disabled},select:function(h){var g=this,j,i;if(h==undefined){return g.selectByIndex(-1)}if(h&&h.call){i=h}else{i=function(f){return f==h}}if(h!=g.selectedValue){e(g.items,function(k,f){if(i(k.value)){j=1;g.selectByIndex(f);return false}});if(!j){g.selectByIndex(-1)}}},selectByIndex:function(f){c.get(this.id).selectedIndex=f+1;this.selectedValue=this.items[f]?this.items[f].value:null},add:function(j,g,f){var i,h=this;f=f||{};f.value=g;if(h.isRendered()){c.add(c.get(this.id),"option",f,j)}i={title:j,value:g,attribs:f};h.items.push(i);h.onAdd.dispatch(h,i)},getLength:function(){return this.items.length},renderHTML:function(){var g,f=this;g=c.createHTML("option",{value:""},"-- "+f.settings.title+" --");e(f.items,function(h){g+=c.createHTML("option",{value:h.value},h.title)});g=c.createHTML("select",{id:f.id,"class":"mceNativeListBox","aria-labelledby":f.id+"_aria"},g);g+=c.createHTML("span",{id:f.id+"_aria",style:"display: none"},f.settings.title);return g},postRender:function(){var g=this,h,i=true;g.rendered=true;function f(k){var j=g.items[k.target.selectedIndex-1];if(j&&(j=j.value)){g.onChange.dispatch(g,j);if(g.settings.onselect){g.settings.onselect(j)}}}b.add(g.id,"change",f);b.add(g.id,"keydown",function(k){var j;b.remove(g.id,"change",h);i=false;j=b.add(g.id,"blur",function(){if(i){return}i=true;b.add(g.id,"change",f);b.remove(g.id,"blur",j)});if(k.keyCode==13||k.keyCode==32){f(k);return b.cancel(k)}});g.onPostRender.dispatch(g,c.get(g.id))}})})(tinymce);(function(c){var b=c.DOM,a=c.dom.Event,d=c.each;c.create("tinymce.ui.MenuButton:tinymce.ui.Button",{MenuButton:function(g,f,e){this.parent(g,f,e);this.onRenderMenu=new c.util.Dispatcher(this);f.menu_container=f.menu_container||b.doc.body},showMenu:function(){var g=this,j,i,h=b.get(g.id),f;if(g.isDisabled()){return}if(!g.isMenuRendered){g.renderMenu();g.isMenuRendered=true}if(g.isMenuVisible){return g.hideMenu()}j=b.getPos(g.settings.menu_container);i=b.getPos(h);f=g.menu;f.settings.offset_x=i.x;f.settings.offset_y=i.y;f.settings.vp_offset_x=i.x;f.settings.vp_offset_y=i.y;f.settings.keyboard_focus=g._focused;f.showMenu(0,h.clientHeight);a.add(b.doc,"mousedown",g.hideMenu,g);g.setState("Selected",1);g.isMenuVisible=1},renderMenu:function(){var f=this,e;e=f.settings.control_manager.createDropMenu(f.id+"_menu",{menu_line:1,"class":this.classPrefix+"Menu",icons:f.settings.icons});e.onHideMenu.add(function(){f.hideMenu();f.focus()});f.onRenderMenu.dispatch(f,e);f.menu=e},hideMenu:function(g){var f=this;if(g&&g.type=="mousedown"&&b.getParent(g.target,function(h){return h.id===f.id||h.id===f.id+"_open"})){return}if(!g||!b.getParent(g.target,".mceMenu")){f.setState("Selected",0);a.remove(b.doc,"mousedown",f.hideMenu,f);if(f.menu){f.menu.hideMenu()}}f.isMenuVisible=0},postRender:function(){var e=this,f=e.settings;a.add(e.id,"click",function(){if(!e.isDisabled()){if(f.onclick){f.onclick(e.value)}e.showMenu()}})}})})(tinymce);(function(c){var b=c.DOM,a=c.dom.Event,d=c.each;c.create("tinymce.ui.SplitButton:tinymce.ui.MenuButton",{SplitButton:function(g,f,e){this.parent(g,f,e);this.classPrefix="mceSplitButton"},renderHTML:function(){var i,f=this,g=f.settings,e;i="";if(g.image){e=b.createHTML("img ",{src:g.image,role:"presentation","class":"mceAction "+g["class"]})}else{e=b.createHTML("span",{"class":"mceAction "+g["class"]},"")}e+=b.createHTML("span",{"class":"mceVoiceLabel mceIconOnly",id:f.id+"_voice",style:"display:none;"},g.title);i+=""+b.createHTML("a",{role:"button",id:f.id+"_action",tabindex:"-1",href:"javascript:;","class":"mceAction "+g["class"],onclick:"return false;",onmousedown:"return false;",title:g.title},e)+"";e=b.createHTML("span",{"class":"mceOpen "+g["class"]},'');i+=""+b.createHTML("a",{role:"button",id:f.id+"_open",tabindex:"-1",href:"javascript:;","class":"mceOpen "+g["class"],onclick:"return false;",onmousedown:"return false;",title:g.title},e)+"";i+="";i=b.createHTML("table",{id:f.id,role:"presentation",tabindex:"0","class":"mceSplitButton mceSplitButtonEnabled "+g["class"],cellpadding:"0",cellspacing:"0",title:g.title},i);return b.createHTML("span",{role:"button","aria-labelledby":f.id+"_voice","aria-haspopup":"true"},i)},postRender:function(){var e=this,g=e.settings,f;if(g.onclick){f=function(h){if(!e.isDisabled()){g.onclick(e.value);a.cancel(h)}};a.add(e.id+"_action","click",f);a.add(e.id,["click","keydown"],function(h){var k=32,m=14,i=13,j=38,l=40;if((h.keyCode===32||h.keyCode===13||h.keyCode===14)&&!h.altKey&&!h.ctrlKey&&!h.metaKey){f();a.cancel(h)}else{if(h.type==="click"||h.keyCode===l){e.showMenu();a.cancel(h)}}})}a.add(e.id+"_open","click",function(h){e.showMenu();a.cancel(h)});a.add([e.id,e.id+"_open"],"focus",function(){e._focused=1});a.add([e.id,e.id+"_open"],"blur",function(){e._focused=0});if(c.isIE6||!b.boxModel){a.add(e.id,"mouseover",function(){if(!b.hasClass(e.id,"mceSplitButtonDisabled")){b.addClass(e.id,"mceSplitButtonHover")}});a.add(e.id,"mouseout",function(){if(!b.hasClass(e.id,"mceSplitButtonDisabled")){b.removeClass(e.id,"mceSplitButtonHover")}})}},destroy:function(){this.parent();a.clear(this.id+"_action");a.clear(this.id+"_open");a.clear(this.id)}})})(tinymce);(function(d){var c=d.DOM,a=d.dom.Event,b=d.is,e=d.each;d.create("tinymce.ui.ColorSplitButton:tinymce.ui.SplitButton",{ColorSplitButton:function(i,h,f){var g=this;g.parent(i,h,f);g.settings=h=d.extend({colors:"000000,993300,333300,003300,003366,000080,333399,333333,800000,FF6600,808000,008000,008080,0000FF,666699,808080,FF0000,FF9900,99CC00,339966,33CCCC,3366FF,800080,999999,FF00FF,FFCC00,FFFF00,00FF00,00FFFF,00CCFF,993366,C0C0C0,FF99CC,FFCC99,FFFF99,CCFFCC,CCFFFF,99CCFF,CC99FF,FFFFFF",grid_width:8,default_color:"#888888"},g.settings);g.onShowMenu=new d.util.Dispatcher(g);g.onHideMenu=new d.util.Dispatcher(g);g.value=h.default_color},showMenu:function(){var f=this,g,j,i,h;if(f.isDisabled()){return}if(!f.isMenuRendered){f.renderMenu();f.isMenuRendered=true}if(f.isMenuVisible){return f.hideMenu()}i=c.get(f.id);c.show(f.id+"_menu");c.addClass(i,"mceSplitButtonSelected");h=c.getPos(i);c.setStyles(f.id+"_menu",{left:h.x,top:h.y+i.clientHeight,zIndex:200000});i=0;a.add(c.doc,"mousedown",f.hideMenu,f);f.onShowMenu.dispatch(f);if(f._focused){f._keyHandler=a.add(f.id+"_menu","keydown",function(k){if(k.keyCode==27){f.hideMenu()}});c.select("a",f.id+"_menu")[0].focus()}f.isMenuVisible=1},hideMenu:function(g){var f=this;if(f.isMenuVisible){if(g&&g.type=="mousedown"&&c.getParent(g.target,function(h){return h.id===f.id+"_open"})){return}if(!g||!c.getParent(g.target,".mceSplitButtonMenu")){c.removeClass(f.id,"mceSplitButtonSelected");a.remove(c.doc,"mousedown",f.hideMenu,f);a.remove(f.id+"_menu","keydown",f._keyHandler);c.hide(f.id+"_menu")}f.isMenuVisible=0}},renderMenu:function(){var p=this,h,k=0,q=p.settings,g,j,l,o,f;o=c.add(q.menu_container,"div",{role:"listbox",id:p.id+"_menu","class":q.menu_class+" "+q["class"],style:"position:absolute;left:0;top:-1000px;"});h=c.add(o,"div",{"class":q["class"]+" mceSplitButtonMenu"});c.add(h,"span",{"class":"mceMenuLine"});g=c.add(h,"table",{role:"presentation","class":"mceColorSplitMenu"});j=c.add(g,"tbody");k=0;e(b(q.colors,"array")?q.colors:q.colors.split(","),function(i){i=i.replace(/^#/,"");if(!k--){l=c.add(j,"tr");k=q.grid_width-1}g=c.add(l,"td");g=c.add(g,"a",{role:"option",href:"javascript:;",style:{backgroundColor:"#"+i},title:p.editor.getLang("colors."+i,i),"data-mce-color":"#"+i});if(p.editor.forcedHighContrastMode){g=c.add(g,"canvas",{width:16,height:16,"aria-hidden":"true"});if(g.getContext&&(f=g.getContext("2d"))){f.fillStyle="#"+i;f.fillRect(0,0,16,16)}else{c.remove(g)}}});if(q.more_colors_func){g=c.add(j,"tr");g=c.add(g,"td",{colspan:q.grid_width,"class":"mceMoreColors"});g=c.add(g,"a",{role:"option",id:p.id+"_more",href:"javascript:;",onclick:"return false;","class":"mceMoreColors"},q.more_colors_title);a.add(g,"click",function(i){q.more_colors_func.call(q.more_colors_scope||this);return a.cancel(i)})}c.addClass(h,"mceColorSplitMenu");new d.ui.KeyboardNavigation({root:p.id+"_menu",items:c.select("a",p.id+"_menu"),onCancel:function(){p.hideMenu();p.focus()}});a.add(p.id+"_menu","mousedown",function(i){return a.cancel(i)});a.add(p.id+"_menu","click",function(i){var m;i=c.getParent(i.target,"a",j);if(i&&i.nodeName.toLowerCase()=="a"&&(m=i.getAttribute("data-mce-color"))){p.setColor(m)}return a.cancel(i)});return o},setColor:function(f){this.displayColor(f);this.hideMenu();this.settings.onselect(f)},displayColor:function(g){var f=this;c.setStyle(f.id+"_preview","backgroundColor",g);f.value=g},postRender:function(){var f=this,g=f.id;f.parent();c.add(g+"_action","div",{id:g+"_preview","class":"mceColorPreview"});c.setStyle(f.id+"_preview","backgroundColor",f.value)},destroy:function(){this.parent();a.clear(this.id+"_menu");a.clear(this.id+"_more");c.remove(this.id+"_menu")}})})(tinymce);(function(b){var d=b.DOM,c=b.each,a=b.dom.Event;b.create("tinymce.ui.ToolbarGroup:tinymce.ui.Container",{renderHTML:function(){var f=this,i=[],e=f.controls,j=b.each,g=f.settings;i.push('
            ');i.push("");i.push('");j(e,function(h){i.push(h.renderHTML())});i.push("");i.push("
            ");return i.join("")},focus:function(){this.keyNav.focus()},postRender:function(){var f=this,e=[];c(f.controls,function(g){c(g.controls,function(h){if(h.id){e.push(h)}})});f.keyNav=new b.ui.KeyboardNavigation({root:f.id,items:e,onCancel:function(){f.editor.focus()},excludeFromTabOrder:!f.settings.tab_focus_toolbar})},destroy:function(){var e=this;e.parent();e.keyNav.destroy();a.clear(e.id)}})})(tinymce);(function(a){var c=a.DOM,b=a.each;a.create("tinymce.ui.Toolbar:tinymce.ui.Container",{renderHTML:function(){var m=this,f="",j,k,n=m.settings,e,d,g,l;l=m.controls;for(e=0;e"))}if(d&&k.ListBox){if(d.Button||d.SplitButton){f+=c.createHTML("td",{"class":"mceToolbarEnd"},c.createHTML("span",null,""))}}if(c.stdMode){f+=''+k.renderHTML()+""}else{f+=""+k.renderHTML()+""}if(g&&k.ListBox){if(g.Button||g.SplitButton){f+=c.createHTML("td",{"class":"mceToolbarStart"},c.createHTML("span",null,""))}}}j="mceToolbarEnd";if(k.Button){j+=" mceToolbarEndButton"}else{if(k.SplitButton){j+=" mceToolbarEndSplitButton"}else{if(k.ListBox){j+=" mceToolbarEndListBox"}}}f+=c.createHTML("td",{"class":j},c.createHTML("span",null,""));return c.createHTML("table",{id:m.id,"class":"mceToolbar"+(n["class"]?" "+n["class"]:""),cellpadding:"0",cellspacing:"0",align:m.settings.align||"",role:"presentation",tabindex:"-1"},""+f+"")}})})(tinymce);(function(b){var a=b.util.Dispatcher,c=b.each;b.create("tinymce.AddOnManager",{AddOnManager:function(){var d=this;d.items=[];d.urls={};d.lookup={};d.onAdd=new a(d)},get:function(d){return this.lookup[d]},requireLangPack:function(e){var d=b.settings;if(d&&d.language&&d.language_load!==false){b.ScriptLoader.add(this.urls[e]+"/langs/"+d.language+".js")}},add:function(e,d){this.items.push(d);this.lookup[e]=d;this.onAdd.dispatch(this,e,d);return d},load:function(h,e,d,g){var f=this;if(f.urls[h]){return}if(e.indexOf("/")!=0&&e.indexOf("://")==-1){e=b.baseURL+"/"+e}f.urls[h]=e.substring(0,e.lastIndexOf("/"));if(!f.lookup[h]){b.ScriptLoader.add(e,d,g)}}});b.PluginManager=new b.AddOnManager();b.ThemeManager=new b.AddOnManager()}(tinymce));(function(j){var g=j.each,d=j.extend,k=j.DOM,i=j.dom.Event,f=j.ThemeManager,b=j.PluginManager,e=j.explode,h=j.util.Dispatcher,a,c=0;j.documentBaseURL=window.location.href.replace(/[\?#].*$/,"").replace(/[\/\\][^\/]+$/,"");if(!/[\/\\]$/.test(j.documentBaseURL)){j.documentBaseURL+="/"}j.baseURL=new j.util.URI(j.documentBaseURL).toAbsolute(j.baseURL);j.baseURI=new j.util.URI(j.baseURL);j.onBeforeUnload=new h(j);i.add(window,"beforeunload",function(l){j.onBeforeUnload.dispatch(j,l)});j.onAddEditor=new h(j);j.onRemoveEditor=new h(j);j.EditorManager=d(j,{editors:[],i18n:{},activeEditor:null,init:function(q){var n=this,p,l=j.ScriptLoader,u,o=[],m;function r(x,y,t){var v=x[y];if(!v){return}if(j.is(v,"string")){t=v.replace(/\.\w+$/,"");t=t?j.resolve(t):0;v=j.resolve(v)}return v.apply(t||this,Array.prototype.slice.call(arguments,2))}q=d({theme:"simple",language:"en"},q);n.settings=q;i.add(document,"init",function(){var s,v;r(q,"onpageload");switch(q.mode){case"exact":s=q.elements||"";if(s.length>0){g(e(s),function(x){if(k.get(x)){m=new j.Editor(x,q);o.push(m);m.render(1)}else{g(document.forms,function(y){g(y.elements,function(z){if(z.name===x){x="mce_editor_"+c++;k.setAttrib(z,"id",x);m=new j.Editor(x,q);o.push(m);m.render(1)}})})}})}break;case"textareas":case"specific_textareas":function t(y,x){return x.constructor===RegExp?x.test(y.className):k.hasClass(y,x)}g(k.select("textarea"),function(x){if(q.editor_deselector&&t(x,q.editor_deselector)){return}if(!q.editor_selector||t(x,q.editor_selector)){u=k.get(x.name);if(!x.id&&!u){x.id=x.name}if(!x.id||n.get(x.id)){x.id=k.uniqueId()}m=new j.Editor(x.id,q);o.push(m);m.render(1)}});break}if(q.oninit){s=v=0;g(o,function(x){v++;if(!x.initialized){x.onInit.add(function(){s++;if(s==v){r(q,"oninit")}})}else{s++}if(s==v){r(q,"oninit")}})}})},get:function(l){if(l===a){return this.editors}return this.editors[l]},getInstanceById:function(l){return this.get(l)},add:function(m){var l=this,n=l.editors;n[m.id]=m;n.push(m);l._setActive(m);l.onAddEditor.dispatch(l,m);return m},remove:function(n){var m=this,l,o=m.editors;if(!o[n.id]){return null}delete o[n.id];for(l=0;l':"",visual_table_class:"mceItemTable",visual:1,font_size_style_values:"xx-small,x-small,small,medium,large,x-large,xx-large",apply_source_formatting:1,directionality:"ltr",forced_root_block:"p",hidden_input:1,padd_empty_editor:1,render_ui:1,init_theme:1,force_p_newlines:1,indentation:"30px",keep_styles:1,fix_table_elements:1,inline_styles:1,convert_fonts_to_spans:true,indent:"simple",indent_before:"p,h1,h2,h3,h4,h5,h6,blockquote,div,title,style,pre,script,td,ul,li,area,table,thead,tfoot,tbody,tr",indent_after:"p,h1,h2,h3,h4,h5,h6,blockquote,div,title,style,pre,script,td,ul,li,area,table,thead,tfoot,tbody,tr",validate:true,entity_encoding:"named",url_converter:p.convertURL,url_converter_scope:p,ie7_compat:true},q);p.documentBaseURI=new m.util.URI(q.document_base_url||m.documentBaseURL,{base_uri:tinyMCE.baseURI});p.baseURI=m.baseURI;p.contentCSS=[];p.execCallback("setup",p)},render:function(r){var u=this,v=u.settings,x=u.id,p=m.ScriptLoader;if(!j.domLoaded){j.add(document,"init",function(){u.render()});return}tinyMCE.settings=v;if(!u.getElement()){return}if(m.isIDevice){return}if(!/TEXTAREA|INPUT/i.test(u.getElement().nodeName)&&v.hidden_input&&n.getParent(x,"form")){n.insertAfter(n.create("input",{type:"hidden",name:x}),x)}if(m.WindowManager){u.windowManager=new m.WindowManager(u)}if(v.encoding=="xml"){u.onGetContent.add(function(s,t){if(t.save){t.content=n.encode(t.content)}})}if(v.add_form_submit_trigger){u.onSubmit.addToTop(function(){if(u.initialized){u.save();u.isNotDirty=1}})}if(v.add_unload_trigger){u._beforeUnload=tinyMCE.onBeforeUnload.add(function(){if(u.initialized&&!u.destroyed&&!u.isHidden()){u.save({format:"raw",no_events:true})}})}m.addUnload(u.destroy,u);if(v.submit_patch){u.onBeforeRenderUI.add(function(){var s=u.getElement().form;if(!s){return}if(s._mceOldSubmit){return}if(!s.submit.nodeType&&!s.submit.length){u.formElement=s;s._mceOldSubmit=s.submit;s.submit=function(){m.triggerSave();u.isNotDirty=1;return u.formElement._mceOldSubmit(u.formElement)}}s=null})}function q(){if(v.language&&v.language_load!==false){p.add(m.baseURL+"/langs/"+v.language+".js")}if(v.theme&&v.theme.charAt(0)!="-"&&!h.urls[v.theme]){h.load(v.theme,"themes/"+v.theme+"/editor_template"+m.suffix+".js")}i(g(v.plugins),function(s){if(s&&s.charAt(0)!="-"&&!c.urls[s]){if(s=="safari"){return}c.load(s,"plugins/"+s+"/editor_plugin"+m.suffix+".js")}});p.loadQueue(function(){if(!u.removed){u.init()}})}q()},init:function(){var r,F=this,G=F.settings,C,z,B=F.getElement(),q,p,D,x,A,E,y;m.add(F);G.aria_label=G.aria_label||n.getAttrib(B,"aria-label",F.getLang("aria.rich_text_area"));if(G.theme){G.theme=G.theme.replace(/-/,"");q=h.get(G.theme);F.theme=new q();if(F.theme.init&&G.init_theme){F.theme.init(F,h.urls[G.theme]||m.documentBaseURL.replace(/\/$/,""))}}i(g(G.plugins.replace(/\-/g,"")),function(H){var I=c.get(H),t=c.urls[H]||m.documentBaseURL.replace(/\/$/,""),s;if(I){s=new I(F,t);F.plugins[H]=s;if(s.init){s.init(F,t)}}});if(G.popup_css!==false){if(G.popup_css){G.popup_css=F.documentBaseURI.toAbsolute(G.popup_css)}else{G.popup_css=F.baseURI.toAbsolute("themes/"+G.theme+"/skins/"+G.skin+"/dialog.css")}}if(G.popup_css_add){G.popup_css+=","+F.documentBaseURI.toAbsolute(G.popup_css_add)}F.controlManager=new m.ControlManager(F);if(G.custom_undo_redo){F.onBeforeExecCommand.add(function(t,H,u,I,s){if(H!="Undo"&&H!="Redo"&&H!="mceRepaint"&&(!s||!s.skip_undo)){F.undoManager.beforeChange()}});F.onExecCommand.add(function(t,H,u,I,s){if(H!="Undo"&&H!="Redo"&&H!="mceRepaint"&&(!s||!s.skip_undo)){F.undoManager.add()}})}F.onExecCommand.add(function(s,t){if(!/^(FontName|FontSize)$/.test(t)){F.nodeChanged()}});if(a){function v(s,t){if(!t||!t.initial){F.execCommand("mceRepaint")}}F.onUndo.add(v);F.onRedo.add(v);F.onSetContent.add(v)}F.onBeforeRenderUI.dispatch(F,F.controlManager);if(G.render_ui){C=G.width||B.style.width||B.offsetWidth;z=G.height||B.style.height||B.offsetHeight;F.orgDisplay=B.style.display;E=/^[0-9\.]+(|px)$/i;if(E.test(""+C)){C=Math.max(parseInt(C)+(q.deltaWidth||0),100)}if(E.test(""+z)){z=Math.max(parseInt(z)+(q.deltaHeight||0),100)}q=F.theme.renderUI({targetNode:B,width:C,height:z,deltaWidth:G.delta_width,deltaHeight:G.delta_height});F.editorContainer=q.editorContainer}if(document.domain&&location.hostname!=document.domain){m.relaxedDomain=document.domain}n.setStyles(q.sizeContainer||q.editorContainer,{width:C,height:z});if(G.content_css){m.each(g(G.content_css),function(s){F.contentCSS.push(F.documentBaseURI.toAbsolute(s))})}z=(q.iframeHeight||z)+(typeof(z)=="number"?(q.deltaHeight||0):"");if(z<100){z=100}F.iframeHTML=G.doctype+'';if(G.document_base_url!=m.documentBaseURL){F.iframeHTML+=''}if(G.ie7_compat){F.iframeHTML+=''}else{F.iframeHTML+=''}F.iframeHTML+='';if(!a||!/Firefox\/2/.test(navigator.userAgent)){for(y=0;y'}F.contentCSS=[]}x=G.body_id||"tinymce";if(x.indexOf("=")!=-1){x=F.getParam("body_id","","hash");x=x[F.id]||x}A=G.body_class||"";if(A.indexOf("=")!=-1){A=F.getParam("body_class","","hash");A=A[F.id]||""}F.iframeHTML+='';if(m.relaxedDomain&&(b||(m.isOpera&&parseFloat(opera.version())<11))){D='javascript:(function(){document.open();document.domain="'+document.domain+'";var ed = window.parent.tinyMCE.get("'+F.id+'");document.write(ed.iframeHTML);document.close();ed.setupIframe();})()'}r=n.add(q.iframeContainer,"iframe",{id:F.id+"_ifr",src:D||'javascript:""',frameBorder:"0",title:G.aria_label,style:{width:"100%",height:z}});F.contentAreaContainer=q.iframeContainer;n.get(q.editorContainer).style.display=F.orgDisplay;n.get(F.id).style.display="none";n.setAttrib(F.id,"aria-hidden",true);if(!m.relaxedDomain||!D){F.setupIframe()}B=r=q=null},setupIframe:function(){var r=this,x=r.settings,y=n.get(r.id),z=r.getDoc(),v,p;if(!b||!m.relaxedDomain){z.open();z.write(r.iframeHTML);z.close();if(m.relaxedDomain){z.domain=m.relaxedDomain}}if(!b){try{if(!x.readonly){z.designMode="On"}}catch(q){}}if(b){p=r.getBody();n.hide(p);if(!x.readonly){p.contentEditable=true}n.show(p)}r.schema=new m.html.Schema(x);r.dom=new m.dom.DOMUtils(r.getDoc(),{keep_values:true,url_converter:r.convertURL,url_converter_scope:r,hex_colors:x.force_hex_style_colors,class_filter:x.class_filter,update_styles:1,fix_ie_paragraphs:1,schema:r.schema});r.parser=new m.html.DomParser(x,r.schema);r.parser.addAttributeFilter("name",function(s,t){var B=s.length,D,A,C,E;while(B--){E=s[B];if(E.name==="a"&&E.firstChild){C=E.parent;D=E.lastChild;do{A=D.prev;C.insert(D,E);D=A}while(D)}}});r.parser.addAttributeFilter("src,href,style",function(s,t){var A=s.length,B,D=r.dom,C;while(A--){B=s[A];C=B.attr(t);if(t==="style"){B.attr("data-mce-style",D.serializeStyle(D.parseStyle(C),B.name))}else{B.attr("data-mce-"+t,r.convertURL(C,t,B.name))}}});r.parser.addNodeFilter("script",function(s,t){var A=s.length;while(A--){s[A].attr("type","mce-text/javascript")}});r.parser.addNodeFilter("#cdata",function(s,t){var A=s.length,B;while(A--){B=s[A];B.type=8;B.name="#comment";B.value="[CDATA["+B.value+"]]"}});r.parser.addNodeFilter("p,h1,h2,h3,h4,h5,h6,div",function(t,A){var B=t.length,C,s=r.schema.getNonEmptyElements();while(B--){C=t[B];if(C.isEmpty(s)){C.empty().append(new m.html.Node("br",1)).shortEnded=true}}});r.serializer=new m.dom.Serializer(x,r.dom,r.schema);r.selection=new m.dom.Selection(r.dom,r.getWin(),r.serializer);r.formatter=new m.Formatter(this);r.formatter.register({alignleft:[{selector:"p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li",styles:{textAlign:"left"}},{selector:"img,table",collapsed:false,styles:{"float":"left"}}],aligncenter:[{selector:"p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li",styles:{textAlign:"center"}},{selector:"img",collapsed:false,styles:{display:"block",marginLeft:"auto",marginRight:"auto"}},{selector:"table",collapsed:false,styles:{marginLeft:"auto",marginRight:"auto"}}],alignright:[{selector:"p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li",styles:{textAlign:"right"}},{selector:"img,table",collapsed:false,styles:{"float":"right"}}],alignfull:[{selector:"p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li",styles:{textAlign:"justify"}}],bold:[{inline:"strong",remove:"all"},{inline:"span",styles:{fontWeight:"bold"}},{inline:"b",remove:"all"}],italic:[{inline:"em",remove:"all"},{inline:"span",styles:{fontStyle:"italic"}},{inline:"i",remove:"all"}],underline:[{inline:"span",styles:{textDecoration:"underline"},exact:true},{inline:"u",remove:"all"}],strikethrough:[{inline:"span",styles:{textDecoration:"line-through"},exact:true},{inline:"strike",remove:"all"}],forecolor:{inline:"span",styles:{color:"%value"},wrap_links:false},hilitecolor:{inline:"span",styles:{backgroundColor:"%value"},wrap_links:false},fontname:{inline:"span",styles:{fontFamily:"%value"}},fontsize:{inline:"span",styles:{fontSize:"%value"}},fontsize_class:{inline:"span",attributes:{"class":"%value"}},blockquote:{block:"blockquote",wrapper:1,remove:"all"},subscript:{inline:"sub"},superscript:{inline:"sup"},removeformat:[{selector:"b,strong,em,i,font,u,strike",remove:"all",split:true,expand:false,block_expand:true,deep:true},{selector:"span",attributes:["style","class"],remove:"empty",split:true,expand:false,deep:true},{selector:"*",attributes:["style","class"],split:false,expand:false,deep:true}]});i("p h1 h2 h3 h4 h5 h6 div address pre div code dt dd samp".split(/\s/),function(s){r.formatter.register(s,{block:s,remove:"all"})});r.formatter.register(r.settings.formats);r.undoManager=new m.UndoManager(r);r.undoManager.onAdd.add(function(t,s){if(t.hasUndo()){return r.onChange.dispatch(r,s,t)}});r.undoManager.onUndo.add(function(t,s){return r.onUndo.dispatch(r,s,t)});r.undoManager.onRedo.add(function(t,s){return r.onRedo.dispatch(r,s,t)});r.forceBlocks=new m.ForceBlocks(r,{forced_root_block:x.forced_root_block});r.editorCommands=new m.EditorCommands(r);r.serializer.onPreProcess.add(function(s,t){return r.onPreProcess.dispatch(r,t,s)});r.serializer.onPostProcess.add(function(s,t){return r.onPostProcess.dispatch(r,t,s)});r.onPreInit.dispatch(r);if(!x.gecko_spellcheck){r.getBody().spellcheck=0}if(!x.readonly){r._addEvents()}r.controlManager.onPostRender.dispatch(r,r.controlManager);r.onPostRender.dispatch(r);if(x.directionality){r.getBody().dir=x.directionality}if(x.nowrap){r.getBody().style.whiteSpace="nowrap"}if(x.handle_node_change_callback){r.onNodeChange.add(function(t,s,A){r.execCallback("handle_node_change_callback",r.id,A,-1,-1,true,r.selection.isCollapsed())})}if(x.save_callback){r.onSaveContent.add(function(s,A){var t=r.execCallback("save_callback",r.id,A.content,r.getBody());if(t){A.content=t}})}if(x.onchange_callback){r.onChange.add(function(t,s){r.execCallback("onchange_callback",r,s)})}if(x.protect){r.onBeforeSetContent.add(function(s,t){if(x.protect){i(x.protect,function(A){t.content=t.content.replace(A,function(B){return""})})}})}if(x.convert_newlines_to_brs){r.onBeforeSetContent.add(function(s,t){if(t.initial){t.content=t.content.replace(/\r?\n/g,"
            ")}})}if(x.preformatted){r.onPostProcess.add(function(s,t){t.content=t.content.replace(/^\s*/,"");t.content=t.content.replace(/<\/pre>\s*$/,"");if(t.set){t.content='
            '+t.content+"
            "}})}if(x.verify_css_classes){r.serializer.attribValueFilter=function(C,A){var B,t;if(C=="class"){if(!r.classesRE){t=r.dom.getClasses();if(t.length>0){B="";i(t,function(s){B+=(B?"|":"")+s["class"]});r.classesRE=new RegExp("("+B+")","gi")}}return !r.classesRE||/(\bmceItem\w+\b|\bmceTemp\w+\b)/g.test(A)||r.classesRE.test(A)?A:""}return A}}if(x.cleanup_callback){r.onBeforeSetContent.add(function(s,t){t.content=r.execCallback("cleanup_callback","insert_to_editor",t.content,t)});r.onPreProcess.add(function(s,t){if(t.set){r.execCallback("cleanup_callback","insert_to_editor_dom",t.node,t)}if(t.get){r.execCallback("cleanup_callback","get_from_editor_dom",t.node,t)}});r.onPostProcess.add(function(s,t){if(t.set){t.content=r.execCallback("cleanup_callback","insert_to_editor",t.content,t)}if(t.get){t.content=r.execCallback("cleanup_callback","get_from_editor",t.content,t)}})}if(x.save_callback){r.onGetContent.add(function(s,t){if(t.save){t.content=r.execCallback("save_callback",r.id,t.content,r.getBody())}})}if(x.handle_event_callback){r.onEvent.add(function(s,t,A){if(r.execCallback("handle_event_callback",t,s,A)===false){j.cancel(t)}})}r.onSetContent.add(function(){r.addVisual(r.getBody())});if(x.padd_empty_editor){r.onPostProcess.add(function(s,t){t.content=t.content.replace(/^(]*>( | |\s|\u00a0|)<\/p>[\r\n]*|
            [\r\n]*)$/,"")})}if(a){function u(s,t){i(s.dom.select("a"),function(B){var A=B.parentNode;if(s.dom.isBlock(A)&&A.lastChild===B){s.dom.add(A,"br",{"data-mce-bogus":1})}})}r.onExecCommand.add(function(s,t){if(t==="CreateLink"){u(s)}});r.onSetContent.add(r.selection.onSetContent.add(u));if(!x.readonly){try{z.designMode="Off";z.designMode="On"}catch(q){}}}setTimeout(function(){if(r.removed){return}r.load({initial:true,format:"html"});r.startContent=r.getContent({format:"raw"});r.undoManager.add();r.initialized=true;r.onInit.dispatch(r);r.execCallback("setupcontent_callback",r.id,r.getBody(),r.getDoc());r.execCallback("init_instance_callback",r);r.focus(true);r.nodeChanged({initial:1});i(r.contentCSS,function(s){r.dom.loadCSS(s)});if(x.auto_focus){setTimeout(function(){var s=m.get(x.auto_focus);s.selection.select(s.getBody(),1);s.selection.collapse(1);s.getWin().focus()},100)}},1);y=null},focus:function(s){var x,q=this,v=q.settings.content_editable,r,p,u=q.getDoc();if(!s){r=q.selection.getRng();if(r.item){p=r.item(0)}if(!v){q.getWin().focus()}if(p&&p.ownerDocument==u){r=u.body.createControlRange();r.addElement(p);r.select()}}if(m.activeEditor!=q){if((x=m.activeEditor)!=null){x.onDeactivate.dispatch(x,q)}q.onActivate.dispatch(q,x)}m._setActive(q)},execCallback:function(u){var p=this,r=p.settings[u],q;if(!r){return}if(p.callbackLookup&&(q=p.callbackLookup[u])){r=q.func;q=q.scope}if(d(r,"string")){q=r.replace(/\.\w+$/,"");q=q?m.resolve(q):0;r=m.resolve(r);p.callbackLookup=p.callbackLookup||{};p.callbackLookup[u]={func:r,scope:q}}return r.apply(q||p,Array.prototype.slice.call(arguments,1))},translate:function(p){var r=this.settings.language||"en",q=m.i18n;if(!p){return""}return q[r+"."+p]||p.replace(/{\#([^}]+)\}/g,function(t,s){return q[r+"."+s]||"{#"+s+"}"})},getLang:function(q,p){return m.i18n[(this.settings.language||"en")+"."+q]||(d(p)?p:"{#"+q+"}")},getParam:function(u,r,p){var s=m.trim,q=d(this.settings[u])?this.settings[u]:r,t;if(p==="hash"){t={};if(d(q,"string")){i(q.indexOf("=")>0?q.split(/[;,](?![^=;,]*(?:[;,]|$))/):q.split(","),function(x){x=x.split("=");if(x.length>1){t[s(x[0])]=s(x[1])}else{t[s(x[0])]=s(x)}})}else{t=q}return t}return q},nodeChanged:function(r){var p=this,q=p.selection,u=q.getStart()||p.getBody();if(p.initialized){r=r||{};u=b&&u.ownerDocument!=p.getDoc()?p.getBody():u;r.parents=[];p.dom.getParent(u,function(s){if(s.nodeName=="BODY"){return true}r.parents.push(s)});p.onNodeChange.dispatch(p,r?r.controlManager||p.controlManager:p.controlManager,u,q.isCollapsed(),r)}},addButton:function(r,q){var p=this;p.buttons=p.buttons||{};p.buttons[r]=q},addCommand:function(p,r,q){this.execCommands[p]={func:r,scope:q||this}},addQueryStateHandler:function(p,r,q){this.queryStateCommands[p]={func:r,scope:q||this}},addQueryValueHandler:function(p,r,q){this.queryValueCommands[p]={func:r,scope:q||this}},addShortcut:function(r,u,p,s){var q=this,v;if(!q.settings.custom_shortcuts){return false}q.shortcuts=q.shortcuts||{};if(d(p,"string")){v=p;p=function(){q.execCommand(v,false,null)}}if(d(p,"object")){v=p;p=function(){q.execCommand(v[0],v[1],v[2])}}i(g(r),function(t){var x={func:p,scope:s||this,desc:u,alt:false,ctrl:false,shift:false};i(g(t,"+"),function(y){switch(y){case"alt":case"ctrl":case"shift":x[y]=true;break;default:x.charCode=y.charCodeAt(0);x.keyCode=y.toUpperCase().charCodeAt(0)}});q.shortcuts[(x.ctrl?"ctrl":"")+","+(x.alt?"alt":"")+","+(x.shift?"shift":"")+","+x.keyCode]=x});return true},execCommand:function(x,v,z,p){var r=this,u=0,y,q;if(!/^(mceAddUndoLevel|mceEndUndoLevel|mceBeginUndoLevel|mceRepaint|SelectAll)$/.test(x)&&(!p||!p.skip_focus)){r.focus()}y={};r.onBeforeExecCommand.dispatch(r,x,v,z,y);if(y.terminate){return false}if(r.execCallback("execcommand_callback",r.id,r.selection.getNode(),x,v,z)){r.onExecCommand.dispatch(r,x,v,z,p);return true}if(y=r.execCommands[x]){q=y.func.call(y.scope,v,z);if(q!==true){r.onExecCommand.dispatch(r,x,v,z,p);return q}}i(r.plugins,function(s){if(s.execCommand&&s.execCommand(x,v,z)){r.onExecCommand.dispatch(r,x,v,z,p);u=1;return false}});if(u){return true}if(r.theme&&r.theme.execCommand&&r.theme.execCommand(x,v,z)){r.onExecCommand.dispatch(r,x,v,z,p);return true}if(r.editorCommands.execCommand(x,v,z)){r.onExecCommand.dispatch(r,x,v,z,p);return true}r.getDoc().execCommand(x,v,z);r.onExecCommand.dispatch(r,x,v,z,p)},queryCommandState:function(u){var q=this,v,r;if(q._isHidden()){return}if(v=q.queryStateCommands[u]){r=v.func.call(v.scope);if(r!==true){return r}}v=q.editorCommands.queryCommandState(u);if(v!==-1){return v}try{return this.getDoc().queryCommandState(u)}catch(p){}},queryCommandValue:function(v){var q=this,u,r;if(q._isHidden()){return}if(u=q.queryValueCommands[v]){r=u.func.call(u.scope);if(r!==true){return r}}u=q.editorCommands.queryCommandValue(v);if(d(u)){return u}try{return this.getDoc().queryCommandValue(v)}catch(p){}},show:function(){var p=this;n.show(p.getContainer());n.hide(p.id);p.load()},hide:function(){var p=this,q=p.getDoc();if(b&&q){q.execCommand("SelectAll")}p.save();n.hide(p.getContainer());n.setStyle(p.id,"display",p.orgDisplay)},isHidden:function(){return !n.isHidden(this.id)},setProgressState:function(p,q,r){this.onSetProgressState.dispatch(this,p,q,r);return p},load:function(s){var p=this,r=p.getElement(),q;if(r){s=s||{};s.load=true;q=p.setContent(d(r.value)?r.value:r.innerHTML,s);s.element=r;if(!s.no_events){p.onLoadContent.dispatch(p,s)}s.element=r=null;return q}},save:function(u){var p=this,s=p.getElement(),q,r;if(!s||!p.initialized){return}u=u||{};u.save=true;if(!u.no_events){p.undoManager.typing=false;p.undoManager.add()}u.element=s;q=u.content=p.getContent(u);if(!u.no_events){p.onSaveContent.dispatch(p,u)}q=u.content;if(!/TEXTAREA|INPUT/i.test(s.nodeName)){s.innerHTML=q;if(r=n.getParent(p.id,"form")){i(r.elements,function(t){if(t.name==p.id){t.value=q;return false}})}}else{s.value=q}u.element=s=null;return q},setContent:function(t,s){var r=this,q,p=r.getBody();s=s||{};s.format=s.format||"html";s.set=true;s.content=t;if(!s.no_events){r.onBeforeSetContent.dispatch(r,s)}t=s.content;if(!m.isIE&&(t.length===0||/^\s+$/.test(t))){p.innerHTML='
            ';return}if(s.format!=="raw"){t=new m.html.Serializer({},r.schema).serialize(r.parser.parse(t))}s.content=m.trim(t);r.dom.setHTML(p,s.content);if(!s.no_events){r.onSetContent.dispatch(r,s)}return s.content},getContent:function(q){var p=this,r;q=q||{};q.format=q.format||"html";q.get=true;if(!q.no_events){p.onBeforeGetContent.dispatch(p,q)}if(q.format=="raw"){r=p.getBody().innerHTML}else{r=p.serializer.serialize(p.getBody(),q)}q.content=m.trim(r);if(!q.no_events){p.onGetContent.dispatch(p,q)}return q.content},isDirty:function(){var p=this;return m.trim(p.startContent)!=m.trim(p.getContent({format:"raw",no_events:1}))&&!p.isNotDirty},getContainer:function(){var p=this;if(!p.container){p.container=n.get(p.editorContainer||p.id+"_parent")}return p.container},getContentAreaContainer:function(){return this.contentAreaContainer},getElement:function(){return n.get(this.settings.content_element||this.id)},getWin:function(){var p=this,q;if(!p.contentWindow){q=n.get(p.id+"_ifr");if(q){p.contentWindow=q.contentWindow}}return p.contentWindow},getDoc:function(){var q=this,p;if(!q.contentDocument){p=q.getWin();if(p){q.contentDocument=p.document}}return q.contentDocument},getBody:function(){return this.bodyElement||this.getDoc().body},convertURL:function(p,x,v){var q=this,r=q.settings;if(r.urlconverter_callback){return q.execCallback("urlconverter_callback",p,v,true,x)}if(!r.convert_urls||(v&&v.nodeName=="LINK")||p.indexOf("file:")===0){return p}if(r.relative_urls){return q.documentBaseURI.toRelative(p)}p=q.documentBaseURI.toAbsolute(p,r.remove_script_host);return p},addVisual:function(r){var p=this,q=p.settings;r=r||p.getBody();if(!d(p.hasVisual)){p.hasVisual=q.visual}i(p.dom.select("table,a",r),function(t){var s;switch(t.nodeName){case"TABLE":s=p.dom.getAttrib(t,"border");if(!s||s=="0"){if(p.hasVisual){p.dom.addClass(t,q.visual_table_class)}else{p.dom.removeClass(t,q.visual_table_class)}}return;case"A":s=p.dom.getAttrib(t,"name");if(s){if(p.hasVisual){p.dom.addClass(t,"mceItemAnchor")}else{p.dom.removeClass(t,"mceItemAnchor")}}return}});p.onVisualAid.dispatch(p,r,p.hasVisual)},remove:function(){var p=this,q=p.getContainer();p.removed=1;p.hide();p.execCallback("remove_instance_callback",p);p.onRemove.dispatch(p);p.onExecCommand.listeners=[];m.remove(p);n.remove(q)},destroy:function(q){var p=this;if(p.destroyed){return}if(!q){m.removeUnload(p.destroy);tinyMCE.onBeforeUnload.remove(p._beforeUnload);if(p.theme&&p.theme.destroy){p.theme.destroy()}p.controlManager.destroy();p.selection.destroy();p.dom.destroy();if(!p.settings.content_editable){j.clear(p.getWin());j.clear(p.getDoc())}j.clear(p.getBody());j.clear(p.formElement)}if(p.formElement){p.formElement.submit=p.formElement._mceOldSubmit;p.formElement._mceOldSubmit=null}p.contentAreaContainer=p.formElement=p.container=p.settings.content_element=p.bodyElement=p.contentDocument=p.contentWindow=null;if(p.selection){p.selection=p.selection.win=p.selection.dom=p.selection.dom.doc=null}p.destroyed=1},_addEvents:function(){var B=this,r,C=B.settings,q=B.dom,x={mouseup:"onMouseUp",mousedown:"onMouseDown",click:"onClick",keyup:"onKeyUp",keydown:"onKeyDown",keypress:"onKeyPress",submit:"onSubmit",reset:"onReset",contextmenu:"onContextMenu",dblclick:"onDblClick",paste:"onPaste"};function p(t,D){var s=t.type;if(B.removed){return}if(B.onEvent.dispatch(B,t,D)!==false){B[x[t.fakeType||t.type]].dispatch(B,t,D)}}i(x,function(t,s){switch(s){case"contextmenu":q.bind(B.getDoc(),s,p);break;case"paste":q.bind(B.getBody(),s,function(D){p(D)});break;case"submit":case"reset":q.bind(B.getElement().form||n.getParent(B.id,"form"),s,p);break;default:q.bind(C.content_editable?B.getBody():B.getDoc(),s,p)}});q.bind(C.content_editable?B.getBody():(a?B.getDoc():B.getWin()),"focus",function(s){B.focus(true)});if(m.isGecko){q.bind(B.getDoc(),"DOMNodeInserted",function(t){var s;t=t.target;if(t.nodeType===1&&t.nodeName==="IMG"&&(s=t.getAttribute("data-mce-src"))){t.src=B.documentBaseURI.toAbsolute(s)}})}if(a){function u(){var E=this,G=E.getDoc(),F=E.settings;if(a&&!F.readonly){if(E._isHidden()){try{if(!F.content_editable){G.designMode="On"}}catch(D){}}try{G.execCommand("styleWithCSS",0,false)}catch(D){if(!E._isHidden()){try{G.execCommand("useCSS",0,true)}catch(D){}}}if(!F.table_inline_editing){try{G.execCommand("enableInlineTableEditing",false,false)}catch(D){}}if(!F.object_resizing){try{G.execCommand("enableObjectResizing",false,false)}catch(D){}}}}B.onBeforeExecCommand.add(u);B.onMouseDown.add(u)}if(m.isWebKit){B.onClick.add(function(s,t){t=t.target;if(t.nodeName=="IMG"||(t.nodeName=="A"&&q.hasClass(t,"mceItemAnchor"))){B.selection.getSel().setBaseAndExtent(t,0,t,1);B.nodeChanged()}})}B.onMouseUp.add(B.nodeChanged);B.onKeyUp.add(function(s,t){var D=t.keyCode;if((D>=33&&D<=36)||(D>=37&&D<=40)||D==13||D==45||D==46||D==8||(m.isMac&&(D==91||D==93))||t.ctrlKey){B.nodeChanged()}});B.onReset.add(function(){B.setContent(B.startContent,{format:"raw"})});if(C.custom_shortcuts){if(C.custom_undo_redo_keyboard_shortcuts){B.addShortcut("ctrl+z",B.getLang("undo_desc"),"Undo");B.addShortcut("ctrl+y",B.getLang("redo_desc"),"Redo")}B.addShortcut("ctrl+b",B.getLang("bold_desc"),"Bold");B.addShortcut("ctrl+i",B.getLang("italic_desc"),"Italic");B.addShortcut("ctrl+u",B.getLang("underline_desc"),"Underline");for(r=1;r<=6;r++){B.addShortcut("ctrl+"+r,"",["FormatBlock",false,"h"+r])}B.addShortcut("ctrl+7","",["FormatBlock",false,"

            "]);B.addShortcut("ctrl+8","",["FormatBlock",false,"

            "]);B.addShortcut("ctrl+9","",["FormatBlock",false,"
            "]);function v(t){var s=null;if(!t.altKey&&!t.ctrlKey&&!t.metaKey){return s}i(B.shortcuts,function(D){if(m.isMac&&D.ctrl!=t.metaKey){return}else{if(!m.isMac&&D.ctrl!=t.ctrlKey){return}}if(D.alt!=t.altKey){return}if(D.shift!=t.shiftKey){return}if(t.keyCode==D.keyCode||(t.charCode&&t.charCode==D.charCode)){s=D;return false}});return s}B.onKeyUp.add(function(s,t){var D=v(t);if(D){return j.cancel(t)}});B.onKeyPress.add(function(s,t){var D=v(t);if(D){return j.cancel(t)}});B.onKeyDown.add(function(s,t){var D=v(t);if(D){D.func.call(D.scope);return j.cancel(t)}})}if(m.isIE){q.bind(B.getDoc(),"controlselect",function(D){var t=B.resizeInfo,s;D=D.target;if(D.nodeName!=="IMG"){return}if(t){q.unbind(t.node,t.ev,t.cb)}if(!q.hasClass(D,"mceItemNoResize")){ev="resizeend";s=q.bind(D,ev,function(F){var E;F=F.target;if(E=q.getStyle(F,"width")){q.setAttrib(F,"width",E.replace(/[^0-9%]+/g,""));q.setStyle(F,"width","")}if(E=q.getStyle(F,"height")){q.setAttrib(F,"height",E.replace(/[^0-9%]+/g,""));q.setStyle(F,"height","")}})}else{ev="resizestart";s=q.bind(D,"resizestart",j.cancel,j)}t=B.resizeInfo={node:D,ev:ev,cb:s}});B.onKeyDown.add(function(s,D){var t;switch(D.keyCode){case 8:t=B.getDoc().selection;if(t.createRange&&t.createRange().item){s.dom.remove(t.createRange().item(0));return j.cancel(D)}}})}if(m.isOpera){B.onClick.add(function(s,t){j.prevent(t)})}if(C.custom_undo_redo){function y(){B.undoManager.typing=false;B.undoManager.add()}q.bind(B.getDoc(),"focusout",function(s){if(!B.removed&&B.undoManager.typing){y()}});B.dom.bind(B.dom.getRoot(),"dragend",function(s){y()});B.onKeyUp.add(function(t,F){var s,E,D;if(b&&F.keyCode==8){s=B.selection.getRng();if(s.parentElement){E=s.parentElement();D=B.selection.getBookmark();E.innerHTML=E.innerHTML;B.selection.moveToBookmark(D)}}if((F.keyCode>=33&&F.keyCode<=36)||(F.keyCode>=37&&F.keyCode<=40)||F.keyCode==13||F.keyCode==45||F.ctrlKey){y()}});B.onKeyDown.add(function(t,H){var s,F,E,G=H.keyCode;if(b&&G==46){s=B.selection.getRng();if(s.parentElement){F=s.parentElement();if(!B.undoManager.typing){B.undoManager.beforeChange();B.undoManager.typing=true;B.undoManager.add()}if(H.ctrlKey){s.moveEnd("word",1);s.select()}B.selection.getSel().clear();if(s.parentElement()==F){E=B.selection.getBookmark();try{F.innerHTML=F.innerHTML}catch(D){}B.selection.moveToBookmark(E)}H.preventDefault();return}}if((G>=33&&G<=36)||(G>=37&&G<=40)||G==13||G==45){if(m.isIE&&G==13){B.undoManager.beforeChange()}if(B.undoManager.typing){y()}return}if((G<16||G>20)&&G!=224&&G!=91&&!B.undoManager.typing){B.undoManager.beforeChange();B.undoManager.add();B.undoManager.typing=true}});B.onMouseDown.add(function(){if(B.undoManager.typing){y()}})}if(m.isGecko){function A(){var s=B.dom.getAttribs(B.selection.getStart().cloneNode(false));return function(){var t=B.selection.getStart();B.dom.removeAllAttribs(t);i(s,function(D){t.setAttributeNode(D.cloneNode(true))})}}function z(){var t=B.selection;return !t.isCollapsed()&&t.getStart()!=t.getEnd()}B.onKeyPress.add(function(s,D){var t;if((D.keyCode==8||D.keyCode==46)&&z()){t=A();B.getDoc().execCommand("delete",false,null);t();return j.cancel(D)}});B.dom.bind(B.getDoc(),"cut",function(t){var s;if(z()){s=A();B.onKeyUp.addToTop(j.cancel,j);setTimeout(function(){s();B.onKeyUp.remove(j.cancel,j)},0)}})}},_isHidden:function(){var p;if(!a){return 0}p=this.selection.getSel();return(!p||!p.rangeCount||p.rangeCount==0)}})})(tinymce);(function(c){var d=c.each,e,a=true,b=false;c.EditorCommands=function(n){var l=n.dom,p=n.selection,j={state:{},exec:{},value:{}},k=n.settings,o;function q(y,x,v){var u;y=y.toLowerCase();if(u=j.exec[y]){u(y,x,v);return a}return b}function m(v){var u;v=v.toLowerCase();if(u=j.state[v]){return u(v)}return -1}function h(v){var u;v=v.toLowerCase();if(u=j.value[v]){return u(v)}return b}function t(u,v){v=v||"exec";d(u,function(y,x){d(x.toLowerCase().split(","),function(z){j[v][z]=y})})}c.extend(this,{execCommand:q,queryCommandState:m,queryCommandValue:h,addCommands:t});function f(x,v,u){if(v===e){v=b}if(u===e){u=null}return n.getDoc().execCommand(x,v,u)}function s(u){return n.formatter.match(u)}function r(u,v){n.formatter.toggle(u,v?{value:v}:e)}function i(u){o=p.getBookmark(u)}function g(){p.moveToBookmark(o)}t({"mceResetDesignMode,mceBeginUndoLevel":function(){},"mceEndUndoLevel,mceAddUndoLevel":function(){n.undoManager.add()},"Cut,Copy,Paste":function(y){var x=n.getDoc(),u;try{f(y)}catch(v){u=a}if(u||!x.queryCommandSupported(y)){if(c.isGecko){n.windowManager.confirm(n.getLang("clipboard_msg"),function(z){if(z){open("http://www.mozilla.org/editor/midasdemo/securityprefs.html","_blank")}})}else{n.windowManager.alert(n.getLang("clipboard_no_support"))}}},unlink:function(u){if(p.isCollapsed()){p.select(p.getNode())}f(u);p.collapse(b)},"JustifyLeft,JustifyCenter,JustifyRight,JustifyFull":function(u){var v=u.substring(7);d("left,center,right,full".split(","),function(x){if(v!=x){n.formatter.remove("align"+x)}});r("align"+v);q("mceRepaint")},"InsertUnorderedList,InsertOrderedList":function(x){var u,v;f(x);u=l.getParent(p.getNode(),"ol,ul");if(u){v=u.parentNode;if(/^(H[1-6]|P|ADDRESS|PRE)$/.test(v.nodeName)){i();l.split(v,u);g()}}},"Bold,Italic,Underline,Strikethrough,Superscript,Subscript":function(u){r(u)},"ForeColor,HiliteColor,FontName":function(x,v,u){r(x,u)},FontSize:function(y,x,v){var u,z;if(v>=1&&v<=7){z=c.explode(k.font_size_style_values);u=c.explode(k.font_size_classes);if(u){v=u[v-1]||v}else{v=z[v-1]||v}}r(y,v)},RemoveFormat:function(u){n.formatter.remove(u)},mceBlockQuote:function(u){r("blockquote")},FormatBlock:function(x,v,u){return r(u||"p")},mceCleanup:function(){var u=p.getBookmark();n.setContent(n.getContent({cleanup:a}),{cleanup:a});p.moveToBookmark(u)},mceRemoveNode:function(y,x,v){var u=v||p.getNode();if(u!=n.getBody()){i();n.dom.remove(u,a);g()}},mceSelectNodeDepth:function(y,x,v){var u=0;l.getParent(p.getNode(),function(z){if(z.nodeType==1&&u++==v){p.select(z);return b}},n.getBody())},mceSelectNode:function(x,v,u){p.select(u)},mceInsertContent:function(z,D,E){var C,u,x,F,y,u,A,G,B;function v(I,J,H){var K=new c.dom.TreeWalker(H?I.nextSibling:I.previousSibling,J);while((I=K.current())){if((I.nodeType==3&&c.trim(I.nodeValue).length)||I.nodeName=="BR"||I.nodeName=="IMG"){return I}if(H){K.next()}else{K.prev()}}}B={content:E,format:"html"};p.onBeforeSetContent.dispatch(p,B);E=B.content;if(E.indexOf("{$caret}")==-1){E+="{$caret}"}p.setContent('\uFEFF',{no_events:false});l.setOuterHTML("__mce",E.replace(/\{\$caret\}/,'\uFEFF'));C=l.select("#__mce")[0];x=l.getRoot();if(C.previousSibling&&l.isBlock(C.previousSibling)||C.parentNode==x){y=v(C,x);if(y){if(y.nodeName=="BR"){y.parentNode.insertBefore(C,y)}else{l.insertAfter(C,y)}}}while(C){if(C===x){l.setOuterHTML(F,new c.html.Serializer({},n.schema).serialize(n.parser.parse(l.getOuterHTML(F))));break}F=C;C=C.parentNode}C=l.select("#__mce")[0];if(C){y=v(C,x)||v(C,x,true);l.remove(C);if(y){u=l.createRng();if(y.nodeType==3){u.setStart(y,y.length);u.setEnd(y,y.length)}else{if(y.nodeName=="BR"){u.setStartBefore(y);u.setEndBefore(y)}else{u.setStartAfter(y);u.setEndAfter(y)}}p.setRng(u);if(!c.isIE){y=l.create("span",null,"\u00a0");u.insertNode(y);A=l.getRect(y);G=l.getViewPort(n.getWin());if((A.y>G.y+G.h||A.yG.x+G.w||A.x")},mceToggleVisualAid:function(){n.hasVisual=!n.hasVisual;n.addVisual()},mceReplaceContent:function(x,v,u){n.execCommand("mceInsertContent",false,u.replace(/\{\$selection\}/g,p.getContent({format:"text"})))},mceInsertLink:function(A,z,y){var x=l.getParent(p.getNode(),"a"),v,u;if(c.is(y,"string")){y={href:y}}y.href=y.href.replace(" ","%20");if(!x){if(c.isWebKit){v=l.getParent(p.getNode(),"img");if(v){u=v.style.cssFloat;v.style.cssFloat=null}}f("CreateLink",b,"javascript:mctmp(0);");if(u){v.style.cssFloat=u}d(l.select("a[href='javascript:mctmp(0);']"),function(B){l.setAttribs(B,y)})}else{if(y.href){l.setAttribs(x,y)}else{n.dom.remove(x,a)}}},selectAll:function(){var v=l.getRoot(),u=l.createRng();u.setStart(v,0);u.setEnd(v,v.childNodes.length);n.selection.setRng(u)}});t({"JustifyLeft,JustifyCenter,JustifyRight,JustifyFull":function(u){return s("align"+u.substring(7))},"Bold,Italic,Underline,Strikethrough,Superscript,Subscript":function(u){return s(u)},mceBlockQuote:function(){return s("blockquote")},Outdent:function(){var u;if(k.inline_styles){if((u=l.getParent(p.getStart(),l.isBlock))&&parseInt(u.style.paddingLeft)>0){return a}if((u=l.getParent(p.getEnd(),l.isBlock))&&parseInt(u.style.paddingLeft)>0){return a}}return m("InsertUnorderedList")||m("InsertOrderedList")||(!k.inline_styles&&!!l.getParent(p.getNode(),"BLOCKQUOTE"))},"InsertUnorderedList,InsertOrderedList":function(u){return l.getParent(p.getNode(),u=="insertunorderedlist"?"UL":"OL")}},"state");t({"FontSize,FontName":function(x){var v=0,u;if(u=l.getParent(p.getNode(),"span")){if(x=="fontsize"){v=u.style.fontSize}else{v=u.style.fontFamily.replace(/, /g,",").replace(/[\'\"]/g,"").toLowerCase()}}return v}},"value");if(k.custom_undo_redo){t({Undo:function(){n.undoManager.undo()},Redo:function(){n.undoManager.redo()}})}}})(tinymce);(function(b){var a=b.util.Dispatcher;b.UndoManager=function(e){var c,d=0,g=[];function f(){return b.trim(e.getContent({format:"raw",no_events:1}))}return c={typing:false,onAdd:new a(c),onUndo:new a(c),onRedo:new a(c),beforeChange:function(){if(g[d]){g[d].beforeBookmark=e.selection.getBookmark(2,true)}},add:function(l){var h,j=e.settings,k;l=l||{};l.content=f();k=g[d];if(k&&k.content==l.content){return null}if(j.custom_undo_redo_levels){if(g.length>j.custom_undo_redo_levels){for(h=0;h0){j=g[--d];e.setContent(j.content,{format:"raw"});e.selection.moveToBookmark(j.beforeBookmark);c.onUndo.dispatch(c,j)}return j},redo:function(){var h;if(d0||this.typing},hasRedo:function(){return d');q.replace(p,m);o.select(p,1)}return g}return d}l.create("tinymce.ForceBlocks",{ForceBlocks:function(m){var n=this,o=m.settings,p;n.editor=m;n.dom=m.dom;p=(o.forced_root_block||"p").toLowerCase();o.element=p.toUpperCase();m.onPreInit.add(n.setup,n);if(o.forced_root_block){m.onInit.add(n.forceRoots,n);m.onSetContent.add(n.forceRoots,n);m.onBeforeGetContent.add(n.forceRoots,n);m.onExecCommand.add(function(q,r){if(r=="mceInsertContent"){n.forceRoots();q.nodeChanged()}})}},setup:function(){var n=this,m=n.editor,p=m.settings,r=m.dom,o=m.selection;if(p.forced_root_block){m.onBeforeExecCommand.add(n.forceRoots,n);m.onKeyUp.add(n.forceRoots,n);m.onPreProcess.add(n.forceRoots,n)}if(p.force_br_newlines){if(c){m.onKeyPress.add(function(s,t){var u;if(t.keyCode==13&&o.getNode().nodeName!="LI"){o.setContent('
            ',{format:"raw"});u=r.get("__");u.removeAttribute("id");o.select(u);o.collapse();return j.cancel(t)}})}}if(p.force_p_newlines){if(!c){m.onKeyPress.add(function(s,t){if(t.keyCode==13&&!t.shiftKey&&!n.insertPara(t)){j.cancel(t)}})}else{l.addUnload(function(){n._previousFormats=0});m.onKeyPress.add(function(s,t){n._previousFormats=0;if(t.keyCode==13&&!t.shiftKey&&s.selection.isCollapsed()&&p.keep_styles){n._previousFormats=k(s.selection.getStart())}});m.onKeyUp.add(function(t,v){if(v.keyCode==13&&!v.shiftKey){var u=t.selection.getStart(),s=n._previousFormats;if(!u.hasChildNodes()&&s){u=r.getParent(u,r.isBlock);if(u&&u.nodeName!="LI"){u.innerHTML="";if(n._previousFormats){u.appendChild(s.wrapper);s.inner.innerHTML="\uFEFF"}else{u.innerHTML="\uFEFF"}o.select(u,1);o.collapse(true);t.getDoc().execCommand("Delete",false,null);n._previousFormats=0}}}})}if(a){m.onKeyDown.add(function(s,t){if((t.keyCode==8||t.keyCode==46)&&!t.shiftKey){n.backspaceDelete(t,t.keyCode==8)}})}}if(l.isWebKit){function q(t){var s=o.getRng(),u,y=r.create("div",null," "),x,v=r.getViewPort(t.getWin()).h;s.insertNode(u=r.create("br"));s.setStartAfter(u);s.setEndAfter(u);o.setRng(s);if(o.getSel().focusNode==u.previousSibling){o.select(r.insertAfter(r.doc.createTextNode("\u00a0"),u));o.collapse(d)}r.insertAfter(y,u);x=r.getPos(y).y;r.remove(y);if(x>v){t.getWin().scrollTo(0,x)}}m.onKeyPress.add(function(s,t){if(t.keyCode==13&&(t.shiftKey||(p.force_br_newlines&&!r.getParent(o.getNode(),"h1,h2,h3,h4,h5,h6,ol,ul")))){q(s);j.cancel(t)}})}if(c){if(p.element!="P"){m.onKeyPress.add(function(s,t){n.lastElm=o.getNode().nodeName});m.onKeyUp.add(function(t,u){var x,v=o.getNode(),s=t.getBody();if(s.childNodes.length===1&&v.nodeName=="P"){v=r.rename(v,p.element);o.select(v);o.collapse();t.nodeChanged()}else{if(u.keyCode==13&&!u.shiftKey&&n.lastElm!="P"){x=r.getParent(v,"p");if(x){r.rename(x,p.element);t.nodeChanged()}}}})}}},find:function(u,p,q){var o=this.editor,m=o.getDoc().createTreeWalker(u,4,null,g),r=-1;while(u=m.nextNode()){r++;if(p==0&&u==q){return r}if(p==1&&r==q){return u}}return -1},forceRoots:function(v,H){var y=this,v=y.editor,L=v.getBody(),I=v.getDoc(),O=v.selection,z=O.getSel(),A=O.getRng(),M=-2,u,F,m,o,J=-16777215;var K,p,N,E,B,q=L.childNodes,D,C,x;for(D=q.length-1;D>=0;D--){K=q[D];if(K.nodeType===1&&K.getAttribute("data-mce-type")){p=null;continue}if(K.nodeType===3||(!y.dom.isBlock(K)&&K.nodeType!==8&&!/^(script|mce:script|style|mce:style)$/i.test(K.nodeName))){if(!p){if(K.nodeType!=3||/[^\s]/g.test(K.nodeValue)){if(M==-2&&A){if(!c||A.setStart){if(A.startContainer.nodeType==1&&(C=A.startContainer.childNodes[A.startOffset])&&C.nodeType==1){x=C.getAttribute("id");C.setAttribute("id","__mce")}else{if(v.dom.getParent(A.startContainer,function(n){return n===L})){F=A.startOffset;m=A.endOffset;M=y.find(L,0,A.startContainer);u=y.find(L,0,A.endContainer)}}}else{if(A.item){o=I.body.createTextRange();o.moveToElementText(A.item(0));A=o}o=I.body.createTextRange();o.moveToElementText(L);o.collapse(1);N=o.move("character",J)*-1;o=A.duplicate();o.collapse(1);E=o.move("character",J)*-1;o=A.duplicate();o.collapse(0);B=(o.move("character",J)*-1)-E;M=E-N;u=B}}p=v.dom.create(v.settings.forced_root_block);K.parentNode.replaceChild(p,K);p.appendChild(K)}}else{if(p.hasChildNodes()){p.insertBefore(K,p.firstChild)}else{p.appendChild(K)}}}else{p=null}}if(M!=-2){if(!c||A.setStart){p=L.getElementsByTagName(v.settings.element)[0];A=I.createRange();if(M!=-1){A.setStart(y.find(L,1,M),F)}else{A.setStart(p,0)}if(u!=-1){A.setEnd(y.find(L,1,u),m)}else{A.setEnd(p,0)}if(z){z.removeAllRanges();z.addRange(A)}}else{try{A=z.createRange();A.moveToElementText(L);A.collapse(1);A.moveStart("character",M);A.moveEnd("character",u);A.select()}catch(G){}}}else{if((!c||A.setStart)&&(C=v.dom.get("__mce"))){if(x){C.setAttribute("id",x)}else{C.removeAttribute("id")}A=I.createRange();A.setStartBefore(C);A.setEndBefore(C);O.setRng(A)}}},getParentBlock:function(o){var m=this.dom;return m.getParent(o,m.isBlock)},insertPara:function(R){var F=this,v=F.editor,N=v.dom,S=v.getDoc(),W=v.settings,G=v.selection.getSel(),H=G.getRangeAt(0),V=S.body;var K,L,I,P,O,q,o,u,z,m,D,U,p,x,J,M=N.getViewPort(v.getWin()),C,E,B;v.undoManager.beforeChange();K=S.createRange();K.setStart(G.anchorNode,G.anchorOffset);K.collapse(d);L=S.createRange();L.setStart(G.focusNode,G.focusOffset);L.collapse(d);I=K.compareBoundaryPoints(K.START_TO_END,L)<0;P=I?G.anchorNode:G.focusNode;O=I?G.anchorOffset:G.focusOffset;q=I?G.focusNode:G.anchorNode;o=I?G.focusOffset:G.anchorOffset;if(P===q&&/^(TD|TH)$/.test(P.nodeName)){if(P.firstChild.nodeName=="BR"){N.remove(P.firstChild)}if(P.childNodes.length==0){v.dom.add(P,W.element,null,"
            ");U=v.dom.add(P,W.element,null,"
            ")}else{J=P.innerHTML;P.innerHTML="";v.dom.add(P,W.element,null,J);U=v.dom.add(P,W.element,null,"
            ")}H=S.createRange();H.selectNodeContents(U);H.collapse(1);v.selection.setRng(H);return g}if(P==V&&q==V&&V.firstChild&&v.dom.isBlock(V.firstChild)){P=q=P.firstChild;O=o=0;K=S.createRange();K.setStart(P,0);L=S.createRange();L.setStart(q,0)}P=P.nodeName=="HTML"?S.body:P;P=P.nodeName=="BODY"?P.firstChild:P;q=q.nodeName=="HTML"?S.body:q;q=q.nodeName=="BODY"?q.firstChild:q;u=F.getParentBlock(P);z=F.getParentBlock(q);m=u?u.nodeName:W.element;if(J=F.dom.getParent(u,"li,pre")){if(J.nodeName=="LI"){return e(v.selection,F.dom,J)}return d}if(u&&(u.nodeName=="CAPTION"||/absolute|relative|fixed/gi.test(N.getStyle(u,"position",1)))){m=W.element;u=null}if(z&&(z.nodeName=="CAPTION"||/absolute|relative|fixed/gi.test(N.getStyle(u,"position",1)))){m=W.element;z=null}if(/(TD|TABLE|TH|CAPTION)/.test(m)||(u&&m=="DIV"&&/left|right/gi.test(N.getStyle(u,"float",1)))){m=W.element;u=z=null}D=(u&&u.nodeName==m)?u.cloneNode(0):v.dom.create(m);U=(z&&z.nodeName==m)?z.cloneNode(0):v.dom.create(m);U.removeAttribute("id");if(/^(H[1-6])$/.test(m)&&f(H,u)){U=v.dom.create(W.element)}J=p=P;do{if(J==V||J.nodeType==9||F.dom.isBlock(J)||/(TD|TABLE|TH|CAPTION)/.test(J.nodeName)){break}p=J}while((J=J.previousSibling?J.previousSibling:J.parentNode));J=x=q;do{if(J==V||J.nodeType==9||F.dom.isBlock(J)||/(TD|TABLE|TH|CAPTION)/.test(J.nodeName)){break}x=J}while((J=J.nextSibling?J.nextSibling:J.parentNode));if(p.nodeName==m){K.setStart(p,0)}else{K.setStartBefore(p)}K.setEnd(P,O);D.appendChild(K.cloneContents()||S.createTextNode(""));try{L.setEndAfter(x)}catch(Q){}L.setStart(q,o);U.appendChild(L.cloneContents()||S.createTextNode(""));H=S.createRange();if(!p.previousSibling&&p.parentNode.nodeName==m){H.setStartBefore(p.parentNode)}else{if(K.startContainer.nodeName==m&&K.startOffset==0){H.setStartBefore(K.startContainer)}else{H.setStart(K.startContainer,K.startOffset)}}if(!x.nextSibling&&x.parentNode.nodeName==m){H.setEndAfter(x.parentNode)}else{H.setEnd(L.endContainer,L.endOffset)}H.deleteContents();if(b){v.getWin().scrollTo(0,M.y)}if(D.firstChild&&D.firstChild.nodeName==m){D.innerHTML=D.firstChild.innerHTML}if(U.firstChild&&U.firstChild.nodeName==m){U.innerHTML=U.firstChild.innerHTML}if(N.isEmpty(D)){D.innerHTML="
            "}function T(y,s){var r=[],Y,X,t;y.innerHTML="";if(W.keep_styles){X=s;do{if(/^(SPAN|STRONG|B|EM|I|FONT|STRIKE|U)$/.test(X.nodeName)){Y=X.cloneNode(g);N.setAttrib(Y,"id","");r.push(Y)}}while(X=X.parentNode)}if(r.length>0){for(t=r.length-1,Y=y;t>=0;t--){Y=Y.appendChild(r[t])}r[0].innerHTML=b?"\u00a0":"
            ";return r[0]}else{y.innerHTML=b?"\u00a0":"
            "}}if(N.isEmpty(U)){B=T(U,q)}if(b&&parseFloat(opera.version())<9.5){H.insertNode(D);H.insertNode(U)}else{H.insertNode(U);H.insertNode(D)}U.normalize();D.normalize();function A(r){return S.createTreeWalker(r,NodeFilter.SHOW_TEXT,null,g).nextNode()||r}H=S.createRange();H.selectNodeContents(a?A(B||U):B||U);H.collapse(1);G.removeAllRanges();G.addRange(H);C=v.dom.getPos(U).y;if(CM.y+M.h){v.getWin().scrollTo(0,C1||!F(ap))&&an===0){c.remove(ap,1);return}if(ag.inline||ag.wrapper){if(!ag.exact&&an===1){ap=ao(ap)}O(ab,function(ar){O(c.select(ar.inline,ap),function(au){var at;if(ar.wrap_links===false){at=au.parentNode;do{if(at.nodeName==="A"){return}}while(at=at.parentNode)}U(ar,af,au,ar.exact?au:null)})});if(x(ap.parentNode,Y,af)){c.remove(ap,1);ap=0;return B}if(ag.merge_with_parents){c.getParent(ap.parentNode,function(ar){if(x(ar,Y,af)){c.remove(ap,1);ap=0;return B}})}if(ap){ap=u(C(ap),ap);ap=u(ap,C(ap,B))}}})}if(ag){if(aa){X=c.createRng();X.setStartBefore(aa);X.setEndAfter(aa);ah(o(X,ab))}else{if(!ac||!ag.inline||c.select("td.mceSelected,th.mceSelected").length){var ai=V.selection.getNode();ae=q.getBookmark();ah(o(q.getRng(B),ab));if(ag.styles&&(ag.styles.color||ag.styles.textDecoration)){a.walk(ai,I,"childNodes");I(ai)}q.moveToBookmark(ae);q.setRng(Z(q.getRng(B)));V.nodeChanged()}else{Q("apply",Y,af)}}}}function A(Y,ah,ab){var ac=R(Y),aj=ac[0],ag,af,X;function aa(am){var al=am.startContainer,ar=am.startOffset,aq,ap,an,ao;if(al.nodeType==3&&ar>=al.nodeValue.length-1){al=al.parentNode;ar=s(al)+1}if(al.nodeType==1){an=al.childNodes;al=an[Math.min(ar,an.length-1)];aq=new t(al);if(ar>an.length-1){aq.next()}for(ap=aq.current();ap;ap=aq.next()){if(ap.nodeType==3&&!f(ap)){ao=c.create("a",null,E);ap.parentNode.insertBefore(ao,ap);am.setStart(ap,0);q.setRng(am);c.remove(ao);return}}}}function Z(ao){var an,am,al;an=a.grep(ao.childNodes);for(am=0,al=ac.length;am=0;Z--){if(P.apply[Z].name==Y){return true}}for(Z=P.remove.length-1;Z>=0;Z--){if(P.remove[Z].name==Y){return false}}return W(q.getNode())}aa=q.getNode();if(W(aa)){return B}X=q.getStart();if(X!=aa){if(W(X)){return B}}return S}function v(ad,ac){var aa,ab=[],Z={},Y,X,W;if(q.isCollapsed()){for(X=0;X=0;Y--){W=ad[X];if(P.remove[Y].name==W){Z[W]=true;break}}}for(Y=P.apply.length-1;Y>=0;Y--){for(X=0;X=0;X--){W=ac[X].selector;if(!W){return B}for(ab=Y.length-1;ab>=0;ab--){if(c.is(Y[ab],W)){return B}}}}return S}a.extend(this,{get:R,register:k,apply:T,remove:A,toggle:D,match:j,matchAll:v,matchNode:x,canApply:y});function h(W,X){if(g(W,X.inline)){return B}if(g(W,X.block)){return B}if(X.selector){return c.is(W,X.selector)}}function g(X,W){X=X||"";W=W||"";X=""+(X.nodeName||X);W=""+(W.nodeName||W);return X.toLowerCase()==W.toLowerCase()}function L(X,W){var Y=c.getStyle(X,W);if(W=="color"||W=="backgroundColor"){Y=c.toHex(Y)}if(W=="fontWeight"&&Y==700){Y="bold"}return""+Y}function r(W,X){if(typeof(W)!="string"){W=W(X)}else{if(X){W=W.replace(/%(\w+)/g,function(Z,Y){return X[Y]||Z})}}return W}function f(W){return W&&W.nodeType===3&&/^([\s\r\n]+|)$/.test(W.nodeValue)}function N(Y,X,W){var Z=c.create(X,W);Y.parentNode.insertBefore(Z,Y);Z.appendChild(Y);return Z}function o(W,ag,Z){var Y=W.startContainer,ad=W.startOffset,aj=W.endContainer,ae=W.endOffset,ai,af,ac;function ah(am,an,ak,al){var ao,ap;al=al||c.getRoot();for(;;){ao=am.parentNode;if(ao==al||(!ag[0].block_expand&&F(ao))){return am}for(ai=ao[an];ai&&ai!=am;ai=ai[ak]){if(ai.nodeType==1&&!H(ai)){return am}if(ai.nodeType==3&&!f(ai)){return am}}am=am.parentNode}return am}function ab(ak,al){if(al===p){al=ak.nodeType===3?ak.length:ak.childNodes.length}while(ak&&ak.hasChildNodes()){ak=ak.childNodes[al];if(ak){al=ak.nodeType===3?ak.length:ak.childNodes.length}}return{node:ak,offset:al}}if(Y.nodeType==1&&Y.hasChildNodes()){af=Y.childNodes.length-1;Y=Y.childNodes[ad>af?af:ad];if(Y.nodeType==3){ad=0}}if(aj.nodeType==1&&aj.hasChildNodes()){af=aj.childNodes.length-1;aj=aj.childNodes[ae>af?af:ae-1];if(aj.nodeType==3){ae=aj.nodeValue.length}}if(H(Y.parentNode)){Y=Y.parentNode}if(H(Y)){Y=Y.nextSibling||Y}if(H(aj.parentNode)){ae=c.nodeIndex(aj);aj=aj.parentNode}if(H(aj)&&aj.previousSibling){aj=aj.previousSibling;ae=aj.length}if(ag[0].inline){ac=ab(aj,ae);if(ac.node){while(ac.node&&ac.offset===0&&ac.node.previousSibling){ac=ab(ac.node.previousSibling)}if(ac.node&&ac.offset>0&&ac.node.nodeType===3&&ac.node.nodeValue.charAt(ac.offset-1)===" "){if(ac.offset>1){aj=ac.node;aj.splitText(ac.offset-1)}else{if(ac.node.previousSibling){aj=ac.node.previousSibling}}}}}if(ag[0].inline||ag[0].block_expand){Y=ah(Y,"firstChild","nextSibling");aj=ah(aj,"lastChild","previousSibling")}if(ag[0].selector&&ag[0].expand!==S&&!ag[0].inline){function aa(al,ak){var am,an,ap,ao;if(al.nodeType==3&&al.nodeValue.length==0&&al[ak]){al=al[ak]}am=m(al);for(an=0;anY?Y:Z]}return W}function Q(ab,X,aa){var Y,W=P[ab],ac=P[ab=="apply"?"remove":"apply"];function ad(){return P.apply.length||P.remove.length}function Z(){P.apply=[];P.remove=[]}function ae(af){O(P.apply.reverse(),function(ag){T(ag.name,ag.vars,af);if(ag.name==="forecolor"&&ag.vars.value){I(af.parentNode)}});O(P.remove.reverse(),function(ag){A(ag.name,ag.vars,af)});c.remove(af,1);Z()}for(Y=W.length-1;Y>=0;Y--){if(W[Y].name==X){return}}W.push({name:X,vars:aa});for(Y=ac.length-1;Y>=0;Y--){if(ac[Y].name==X){ac.splice(Y,1)}}if(ad()){V.getDoc().execCommand("FontName",false,"mceinline");P.lastRng=q.getRng();O(c.select("font,span"),function(ag){var af;if(b(ag)){af=q.getBookmark();ae(ag);q.moveToBookmark(af);V.nodeChanged()}});if(!P.isListening&&ad()){P.isListening=true;O("onKeyDown,onKeyUp,onKeyPress,onMouseUp".split(","),function(af){V[af].addToTop(function(ag,ah){if(ad()&&!a.dom.RangeUtils.compareRanges(P.lastRng,q.getRng())){O(c.select("font,span"),function(aj){var ak,ai;if(b(aj)){ak=aj.firstChild;if(ak){ae(aj);ai=c.createRng();ai.setStart(ak,ak.nodeValue.length);ai.setEnd(ak,ak.nodeValue.length);q.setRng(ai);ag.nodeChanged()}else{c.remove(aj)}}});if(ah.type=="keyup"||ah.type=="mouseup"){Z()}}})})}}}}})(tinymce);tinymce.onAddEditor.add(function(e,a){var d,h,g,c=a.settings;if(c.inline_styles){h=e.explode(c.font_size_style_values);function b(j,i){e.each(i,function(l,k){if(l){g.setStyle(j,k,l)}});g.rename(j,"span")}d={font:function(j,i){b(i,{backgroundColor:i.style.backgroundColor,color:i.color,fontFamily:i.face,fontSize:h[parseInt(i.size)-1]})},u:function(j,i){b(i,{textDecoration:"underline"})},strike:function(j,i){b(i,{textDecoration:"line-through"})}};function f(i,j){g=i.dom;if(c.convert_fonts_to_spans){e.each(g.select("font,u,strike",j.node),function(k){d[k.nodeName.toLowerCase()](a.dom,k)})}}a.onPreProcess.add(f);a.onSetContent.add(f);a.onInit.add(function(){a.selection.onSetContent.add(f)})}}); diff --git a/src/wp-includes/js/tinymce/tiny_mce_popup.js b/src/wp-includes/js/tinymce/tiny_mce_popup.js new file mode 100644 index 0000000..f859d24 --- /dev/null +++ b/src/wp-includes/js/tinymce/tiny_mce_popup.js @@ -0,0 +1,5 @@ + +// Uncomment and change this document.domain value if you are loading the script cross subdomains +// document.domain = 'moxiecode.com'; + +var tinymce=null,tinyMCEPopup,tinyMCE;tinyMCEPopup={init:function(){var b=this,a,c;a=b.getWin();tinymce=a.tinymce;tinyMCE=a.tinyMCE;b.editor=tinymce.EditorManager.activeEditor;b.params=b.editor.windowManager.params;b.features=b.editor.windowManager.features;b.dom=b.editor.windowManager.createInstance("tinymce.dom.DOMUtils",document);if(b.features.popup_css!==false){b.dom.loadCSS(b.features.popup_css||b.editor.settings.popup_css)}b.listeners=[];b.onInit={add:function(e,d){b.listeners.push({func:e,scope:d})}};b.isWindow=!b.getWindowArg("mce_inline");b.id=b.getWindowArg("mce_window_id");b.editor.windowManager.onOpen.dispatch(b.editor.windowManager,window)},getWin:function(){return(!window.frameElement&&window.dialogArguments)||opener||parent||top},getWindowArg:function(c,b){var a=this.params[c];return tinymce.is(a)?a:b},getParam:function(b,a){return this.editor.getParam(b,a)},getLang:function(b,a){return this.editor.getLang(b,a)},execCommand:function(d,c,e,b){b=b||{};b.skip_focus=1;this.restoreSelection();return this.editor.execCommand(d,c,e,b)},resizeToInnerSize:function(){var a=this;setTimeout(function(){var b=a.dom.getViewPort(window);a.editor.windowManager.resizeBy(a.getWindowArg("mce_width")-b.w,a.getWindowArg("mce_height")-b.h,a.id||window)},10)},executeOnLoad:function(s){this.onInit.add(function(){eval(s)})},storeSelection:function(){this.editor.windowManager.bookmark=tinyMCEPopup.editor.selection.getBookmark(1)},restoreSelection:function(){var a=tinyMCEPopup;if(!a.isWindow&&tinymce.isIE){a.editor.selection.moveToBookmark(a.editor.windowManager.bookmark)}},requireLangPack:function(){var b=this,a=b.getWindowArg("plugin_url")||b.getWindowArg("theme_url");if(a&&b.editor.settings.language&&b.features.translate_i18n!==false&&b.editor.settings.language_load!==false){a+="/langs/"+b.editor.settings.language+"_dlg.js";if(!tinymce.ScriptLoader.isDone(a)){document.write(' + + + + + + + + + +
              +
            • +
            • +
            • +
            • +
            + +
            + +
            +

            +

            Rich editing, also called WYSIWYG for What You See Is What You Get, means your text is formatted as you type. The rich editor creates HTML code behind the scenes while you concentrate on writing. Font styles, links and images all appear approximately as they will on the internet.') ?>

            +

            +

            +

            +
            + + + + + + +
            + +
            +
            + +
            +
            + + + diff --git a/src/wp-includes/js/tinymce/wp-tinymce.js.gz b/src/wp-includes/js/tinymce/wp-tinymce.js.gz new file mode 100644 index 0000000..3441ea6 Binary files /dev/null and b/src/wp-includes/js/tinymce/wp-tinymce.js.gz differ diff --git a/src/wp-includes/js/tinymce/wp-tinymce.php b/src/wp-includes/js/tinymce/wp-tinymce.php new file mode 100644 index 0000000..449f0e2 --- /dev/null +++ b/src/wp-includes/js/tinymce/wp-tinymce.php @@ -0,0 +1,37 @@ +' + anError.message + '

            '; + response.errors.push( anError ); + parsed.errors = true; + } ).size() ) { response.errors = false; } + parsed.responses.push( response ); + } ); + if ( err.length ) { re.html( '
            ' + err + '
            ' ); } + return parsed; + } + if ( isNaN(x) ) { return !re.html('

            ' + x + '

            '); } + x = parseInt(x,10); + if ( -1 == x ) { return !re.html('

            ' + wpAjax.noPerm + '

            '); } + else if ( 0 === x ) { return !re.html('

            ' + wpAjax.broken + '

            '); } + return true; + }, + invalidateForm: function ( selector ) { + return jQuery( selector ).addClass( 'form-invalid' ).find('input:visible').change( function() { jQuery(this).closest('.form-invalid').removeClass( 'form-invalid' ); } ); + }, + validateForm: function( selector ) { + selector = jQuery( selector ); + return !wpAjax.invalidateForm( selector.find('.form-required').filter( function() { return jQuery('input:visible', this).val() == ''; } ) ).size(); + } +}, wpAjax || { noPerm: 'You do not have permission to do that.', broken: 'An unidentified error has occurred.' } ); + +// Basic form validation +jQuery(document).ready( function($){ + $('form.validate').submit( function() { return wpAjax.validateForm( $(this) ); } ); +}); diff --git a/src/wp-includes/js/wp-ajax-response.js b/src/wp-includes/js/wp-ajax-response.js new file mode 100644 index 0000000..bdfa53a --- /dev/null +++ b/src/wp-includes/js/wp-ajax-response.js @@ -0,0 +1 @@ +var wpAjax=jQuery.extend({unserialize:function(c){var d={},e,a,b,f;if(!c){return d}e=c.split("?");if(e[1]){c=e[1]}a=c.split("&");for(b in a){if(jQuery.isFunction(a.hasOwnProperty)&&!a.hasOwnProperty(b)){continue}f=a[b].split("=");d[f[0]]=f[1]}return d},parseAjaxResponse:function(a,f,g){var b={},c=jQuery("#"+f).html(""),d="";if(a&&typeof a=="object"&&a.getElementsByTagName("wp_ajax")){b.responses=[];b.errors=false;jQuery("response",a).each(function(){var h=jQuery(this),i=jQuery(this.firstChild),e;e={action:h.attr("action"),what:i.get(0).nodeName,id:i.attr("id"),oldId:i.attr("old_id"),position:i.attr("position")};e.data=jQuery("response_data",i).text();e.supplemental={};if(!jQuery("supplemental",i).children().each(function(){e.supplemental[this.nodeName]=jQuery(this).text()}).size()){e.supplemental=false}e.errors=[];if(!jQuery("wp_error",i).each(function(){var j=jQuery(this).attr("code"),m,l,k;m={code:j,message:this.firstChild.nodeValue,data:false};l=jQuery('wp_error_data[code="'+j+'"]',a);if(l){m.data=l.get()}k=jQuery("form-field",l).text();if(k){j=k}if(g){wpAjax.invalidateForm(jQuery("#"+g+' :input[name="'+j+'"]').parents(".form-field:first"))}d+="

            "+m.message+"

            ";e.errors.push(m);b.errors=true}).size()){e.errors=false}b.responses.push(e)});if(d.length){c.html('
            '+d+"
            ")}return b}if(isNaN(a)){return !c.html('

            '+a+"

            ")}a=parseInt(a,10);if(-1==a){return !c.html('

            '+wpAjax.noPerm+"

            ")}else{if(0===a){return !c.html('

            '+wpAjax.broken+"

            ")}}return true},invalidateForm:function(a){return jQuery(a).addClass("form-invalid").find("input:visible").change(function(){jQuery(this).closest(".form-invalid").removeClass("form-invalid")})},validateForm:function(a){a=jQuery(a);return !wpAjax.invalidateForm(a.find(".form-required").filter(function(){return jQuery("input:visible",this).val()==""})).size()}},wpAjax||{noPerm:"You do not have permission to do that.",broken:"An unidentified error has occurred."});jQuery(document).ready(function(a){a("form.validate").submit(function(){return wpAjax.validateForm(a(this))})}); \ No newline at end of file diff --git a/src/wp-includes/js/wp-list-revisions.dev.js b/src/wp-includes/js/wp-list-revisions.dev.js new file mode 100644 index 0000000..9c702c6 --- /dev/null +++ b/src/wp-includes/js/wp-list-revisions.dev.js @@ -0,0 +1,24 @@ +(function(w) { + var init = function() { + var pr = document.getElementById('post-revisions'), + inputs = pr ? pr.getElementsByTagName('input') : []; + pr.onclick = function() { + var i, checkCount = 0, side; + for ( i = 0; i < inputs.length; i++ ) { + checkCount += inputs[i].checked ? 1 : 0; + side = inputs[i].getAttribute('name'); + if ( ! inputs[i].checked && + ( 'left' == side && 1 > checkCount || 'right' == side && 1 < checkCount && ( ! inputs[i-1] || ! inputs[i-1].checked ) ) && + ! ( inputs[i+1] && inputs[i+1].checked && 'right' == inputs[i+1].getAttribute('name') ) ) + inputs[i].style.visibility = 'hidden'; + else if ( 'left' == side || 'right' == side ) + inputs[i].style.visibility = 'visible'; + } + } + pr.onclick(); + } + if ( w && w.addEventListener ) + w.addEventListener('load', init, false); + else if ( w && w.attachEvent ) + w.attachEvent('onload', init); +})(window); diff --git a/src/wp-includes/js/wp-list-revisions.js b/src/wp-includes/js/wp-list-revisions.js new file mode 100644 index 0000000..417572d --- /dev/null +++ b/src/wp-includes/js/wp-list-revisions.js @@ -0,0 +1 @@ +(function(a){var b=function(){var d=document.getElementById("post-revisions"),c=d?d.getElementsByTagName("input"):[];d.onclick=function(){var g,f=0,e;for(g=0;gf||"right"==e&&1
            + * + * 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 ); + $timeend = $mtime[1] + $mtime[0]; + $timetotal = $timeend - $timestart; + $r = ( function_exists( 'number_format_i18n' ) ) ? number_format_i18n( $timetotal, $precision ) : number_format( $timetotal, $precision ); + if ( $display ) + echo $r; + return $r; +} + +/** + * Sets PHP error handling and handles WordPress debug mode. + * + * Uses three constants: WP_DEBUG, WP_DEBUG_DISPLAY, and WP_DEBUG_LOG. All three can be + * defined in wp-config.php. Example: define( 'WP_DEBUG', true ); + * + * WP_DEBUG_DISPLAY and WP_DEBUG_LOG perform no function unless WP_DEBUG is true. + * WP_DEBUG defaults to false. + * + * When WP_DEBUG is true, all PHP notices are reported. WordPress will also display + * notices, including one when a deprecated WordPress function, function argument, + * or file is used. Deprecated code may be removed from a later version. + * + * It is strongly recommended that plugin and theme developers use WP_DEBUG in their + * development environments. + * + * When WP_DEBUG_DISPLAY is true, WordPress will force errors to be displayed. + * WP_DEBUG_DISPLAY defaults to true. Defining it as false prevents WordPress from + * changing the global configuration setting. (Defining WP_DEBUG_DISPLAY as false + * will never force errors to be hidden.) + * + * When WP_DEBUG_LOG is true, errors will be logged to wp-content/debug.log. + * WP_DEBUG_LOG defaults to false. + * + * @access private + * @since 3.0.0 + */ +function wp_debug_mode() { + if ( WP_DEBUG ) { + // E_DEPRECATED is a core PHP constant in PHP 5.3. Don't define this yourself. + // The two statements are equivalent, just one is for 5.3+ and for less than 5.3. + if ( defined( 'E_DEPRECATED' ) ) + error_reporting( E_ALL & ~E_DEPRECATED & ~E_STRICT ); + else + error_reporting( E_ALL ); + + if ( WP_DEBUG_DISPLAY ) + ini_set( 'display_errors', 1 ); + + if ( WP_DEBUG_LOG ) { + ini_set( 'log_errors', 1 ); + ini_set( 'error_log', WP_CONTENT_DIR . '/debug.log' ); + } + } else { + error_reporting( E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING | E_RECOVERABLE_ERROR ); + } +} + +/** + * Sets the location of the language directory. + * + * To set directory manually, define WP_LANG_DIR in wp-config.php. + * + * If the language directory exists within WP_CONTENT_DIR that is used + * Otherwise if the language directory exists within WPINC, that's used + * Finally, If neither of the preceeding directories is found, + * WP_CONTENT_DIR/languages is used. + * + * The WP_LANG_DIR constant was introduced in 2.1.0. + * + * @access private + * @since 3.0.0 + */ +function wp_set_lang_dir() { + if ( !defined( 'WP_LANG_DIR' ) ) { + if ( file_exists( WP_CONTENT_DIR . '/languages' ) && @is_dir( WP_CONTENT_DIR . '/languages' ) || !@is_dir(ABSPATH . WPINC . '/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' ); + } + } + } +} + +/** + * 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 globalize $wpdb to ensure that it is + * defined globally by the inline code in wp-db.php. + * + * @since 2.5.0 + * @global $wpdb WordPress Database Object + */ +function require_wp_db() { + global $wpdb; + + require_once( ABSPATH . WPINC . '/wp-db.php' ); + if ( file_exists( WP_CONTENT_DIR . '/db.php' ) ) + require_once( WP_CONTENT_DIR . '/db.php' ); + + if ( isset( $wpdb ) ) + return; + + $wpdb = new wpdb( DB_USER, DB_PASSWORD, DB_NAME, DB_HOST ); +} + +/** + * Sets the database table prefix and the format specifiers for database table columns. + * + * Columns not listed here default to %s. + * + * @see wpdb::$field_types Since 2.8.0 + * @see wpdb::prepare() + * @see wpdb::insert() + * @see wpdb::update() + * @see wpdb::set_prefix() + * + * @access private + * @since 3.0.0 + */ +function wp_set_wpdb_vars() { + global $wpdb, $table_prefix; + if ( !empty( $wpdb->error ) ) + dead_db(); + + $wpdb->field_types = array( 'post_author' => '%d', 'post_parent' => '%d', 'menu_order' => '%d', 'term_id' => '%d', 'term_group' => '%d', 'term_taxonomy_id' => '%d', + 'parent' => '%d', 'count' => '%d','object_id' => '%d', 'term_order' => '%d', 'ID' => '%d', 'commment_ID' => '%d', 'comment_post_ID' => '%d', 'comment_parent' => '%d', + 'user_id' => '%d', 'link_id' => '%d', 'link_owner' => '%d', 'link_rating' => '%d', 'option_id' => '%d', 'blog_id' => '%d', 'meta_id' => '%d', 'post_id' => '%d', + 'user_status' => '%d', 'umeta_id' => '%d', 'comment_karma' => '%d', 'comment_count' => '%d', + // multisite: + 'active' => '%d', 'cat_id' => '%d', 'deleted' => '%d', 'lang_id' => '%d', 'mature' => '%d', 'public' => '%d', 'site_id' => '%d', 'spam' => '%d', + ); + + $prefix = $wpdb->set_prefix( $table_prefix ); + + if ( is_wp_error( $prefix ) ) + wp_die( /*WP_I18N_BAD_PREFIX*/'ERROR: $table_prefix en wp-config.php sólo puede contener números, letras y guiones bajos.'/*/WP_I18N_BAD_PREFIX*/ ); +} + +/** + * Starts the WordPress object cache. + * + * If an object-cache.php file exists in the wp-content directory, + * it uses that drop-in as an external object cache. + * + * @access private + * @since 3.0.0 + */ +function wp_start_object_cache() { + global $_wp_using_ext_object_cache; + + $first_init = false; + if ( ! function_exists( 'wp_cache_init' ) ) { + if ( file_exists( WP_CONTENT_DIR . '/object-cache.php' ) ) { + require_once ( WP_CONTENT_DIR . '/object-cache.php' ); + $_wp_using_ext_object_cache = true; + } else { + require_once ( ABSPATH . WPINC . '/cache.php' ); + $_wp_using_ext_object_cache = false; + } + $first_init = true; + } else if ( !$_wp_using_ext_object_cache && file_exists( WP_CONTENT_DIR . '/object-cache.php' ) ) { + // Sometimes advanced-cache.php can load object-cache.php before it is loaded here. + // This breaks the function_exists check above and can result in $_wp_using_ext_object_cache + // being set incorrectly. Double check if an external cache exists. + $_wp_using_ext_object_cache = true; + } + + // If cache supports reset, reset instead of init if already initialized. + // Reset signals to the cache that global IDs have changed and it may need to update keys + // and cleanup caches. + if ( !$first_init && function_exists('wp_cache_reset') ) + wp_cache_reset(); + else + wp_cache_init(); + + if ( function_exists( 'wp_cache_add_global_groups' ) ) { + wp_cache_add_global_groups( array( 'users', 'userlogins', 'usermeta', 'user_meta', 'site-transient', 'site-options', 'site-lookup', 'blog-lookup', 'blog-details', 'rss', 'global-posts' ) ); + wp_cache_add_non_persistent_groups( array( 'comment', 'counts', 'plugins' ) ); + } +} + +/** + * Redirects to the installer if WordPress is not installed. + * + * Dies with an error message when multisite is enabled. + * + * @access private + * @since 3.0.0 + */ +function wp_not_installed() { + if ( is_multisite() ) { + if ( ! is_blog_installed() && ! defined( 'WP_INSTALLING' ) ) + wp_die( __( 'The site you have requested is not installed properly. Please contact the system administrator.' ) ); + } elseif ( ! is_blog_installed() && false === strpos( $_SERVER['PHP_SELF'], 'install.php' ) && !defined( 'WP_INSTALLING' ) ) { + + $link = wp_guess_url() . '/wp-admin/install.php'; + + require( ABSPATH . WPINC . '/kses.php' ); + require( ABSPATH . WPINC . '/pluggable.php' ); + require( ABSPATH . WPINC . '/formatting.php' ); + wp_redirect( $link ); + die(); + } +} + +/** + * Returns array of must-use plugin files to be included in global scope. + * + * The default directory is wp-content/mu-plugins. To change the default directory + * manually, define WPMU_PLUGIN_DIR and WPMU_PLUGIN_URL + * in wp-config.php. + * + * @access private + * @since 3.0.0 + * @return array Files to include + */ +function wp_get_mu_plugins() { + $mu_plugins = array(); + if ( !is_dir( WPMU_PLUGIN_DIR ) ) + return $mu_plugins; + if ( ! $dh = opendir( WPMU_PLUGIN_DIR ) ) + return $mu_plugins; + while ( ( $plugin = readdir( $dh ) ) !== false ) { + if ( substr( $plugin, -4 ) == '.php' ) + $mu_plugins[] = WPMU_PLUGIN_DIR . '/' . $plugin; + } + closedir( $dh ); + sort( $mu_plugins ); + + return $mu_plugins; +} + +/** + * Returns array of plugin files to be included in global scope. + * + * The default directory is wp-content/plugins. To change the default directory + * manually, define WP_PLUGIN_DIR and WP_PLUGIN_URL + * in wp-config.php. + * + * @access private + * @since 3.0.0 + * @return array Files to include + */ +function wp_get_active_and_valid_plugins() { + $plugins = array(); + $active_plugins = (array) get_option( 'active_plugins', array() ); + + // Check for hacks file if the option is enabled + if ( get_option( 'hack_file' ) && file_exists( ABSPATH . 'my-hacks.php' ) ) { + _deprecated_file( 'my-hacks.php', '1.5' ); + array_unshift( $plugins, ABSPATH . 'my-hacks.php' ); + } + + if ( empty( $active_plugins ) || defined( 'WP_INSTALLING' ) ) + return $plugins; + + $network_plugins = is_multisite() ? wp_get_active_network_plugins() : false; + + foreach ( $active_plugins as $plugin ) { + if ( ! validate_file( $plugin ) // $plugin must validate as file + && '.php' == substr( $plugin, -4 ) // $plugin must end with '.php' + && file_exists( WP_PLUGIN_DIR . '/' . $plugin ) // $plugin must exist + // not already included as a network plugin + && ( ! $network_plugins || ! in_array( WP_PLUGIN_DIR . '/' . $plugin, $network_plugins ) ) + ) + $plugins[] = WP_PLUGIN_DIR . '/' . $plugin; + } + return $plugins; +} + +/** + * Sets internal encoding using mb_internal_encoding(). + * + * 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. + * + * @access private + * @since 3.0.0 + */ +function wp_set_internal_encoding() { + if ( function_exists( 'mb_internal_encoding' ) ) { + if ( !@mb_internal_encoding( get_option( 'blog_charset' ) ) ) + mb_internal_encoding( 'UTF-8' ); + } +} + +/** + * Add magic quotes to $_GET, $_POST, $_COOKIE, and $_SERVER. + * + * Also forces $_REQUEST to be $_GET + $_POST. If $_SERVER, $_COOKIE, + * or $_ENV are needed, use those superglobals directly. + * + * @access private + * @since 3.0.0 + */ +function wp_magic_quotes() { + // 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 ); + + // Force REQUEST to be GET + POST. + $_REQUEST = array_merge( $_GET, $_POST ); +} + +/** + * Runs just before PHP shuts down execution. + * + * @access private + * @since 1.2.0 + */ +function shutdown_action_hook() { + do_action( 'shutdown' ); + wp_cache_close(); +} + +/** + * Copy an object. + * + * @since 2.7.0 + * @deprecated 3.2 + * + * @param object $object The object to clone + * @return object The cloned object + */ + +function wp_clone( $object ) { + // Use parens for clone to accommodate PHP 4. See #17880 + return clone( $object ); +} + +/** + * Whether the current request is for a network or blog admin page + * + * Does not inform on whether the user is an admin! Use capability checks to + * tell if the user should be accessing a section or not. + * + * @since 1.5.1 + * + * @return bool True if inside WordPress administration pages. + */ +function is_admin() { + if ( defined( 'WP_ADMIN' ) ) + return WP_ADMIN; + return false; +} + +/** + * Whether the current request is for a blog admin screen /wp-admin/ + * + * Does not inform on whether the user is a blog admin! Use capability checks to + * tell if the user should be accessing a section or not. + * + * @since 3.1.0 + * + * @return bool True if inside WordPress network administration pages. + */ +function is_blog_admin() { + if ( defined( 'WP_BLOG_ADMIN' ) ) + return WP_BLOG_ADMIN; + return false; +} + +/** + * Whether the current request is for a network admin screen /wp-admin/network/ + * + * Does not inform on whether the user is a network admin! Use capability checks to + * tell if the user should be accessing a section or not. + * + * @since 3.1.0 + * + * @return bool True if inside WordPress network administration pages. + */ +function is_network_admin() { + if ( defined( 'WP_NETWORK_ADMIN' ) ) + return WP_NETWORK_ADMIN; + return false; +} + +/** + * Whether the current request is for a user admin screen /wp-admin/user/ + * + * Does not inform on whether the user is an admin! Use capability checks to + * tell if the user should be accessing a section or not. + * + * @since 3.1.0 + * + * @return bool True if inside WordPress user administration pages. + */ +function is_user_admin() { + if ( defined( 'WP_USER_ADMIN' ) ) + return WP_USER_ADMIN; + return false; +} + +/** + * Whether Multisite support is enabled + * + * @since 3.0.0 + * + * @return bool True if multisite is enabled, false otherwise. + */ +function is_multisite() { + if ( defined( 'MULTISITE' ) ) + return MULTISITE; + + if ( defined( 'SUBDOMAIN_INSTALL' ) || defined( 'VHOST' ) || defined( 'SUNRISE' ) ) + return true; + + return false; +} + +?> diff --git a/src/wp-includes/locale.php b/src/wp-includes/locale.php new file mode 100644 index 0000000..dc3ede6 --- /dev/null +++ b/src/wp-includes/locale.php @@ -0,0 +1,351 @@ +weekday[0] = /* translators: weekday */ __('Sunday'); + $this->weekday[1] = /* translators: weekday */ __('Monday'); + $this->weekday[2] = /* translators: weekday */ __('Tuesday'); + $this->weekday[3] = /* translators: weekday */ __('Wednesday'); + $this->weekday[4] = /* translators: weekday */ __('Thursday'); + $this->weekday[5] = /* translators: weekday */ __('Friday'); + $this->weekday[6] = /* translators: weekday */ __('Saturday'); + + // The first letter of each day. The _%day%_initial suffix is a hack to make + // sure the day initials are unique. + $this->weekday_initial[__('Sunday')] = /* translators: one-letter abbreviation of the weekday */ __('S_Sunday_initial'); + $this->weekday_initial[__('Monday')] = /* translators: one-letter abbreviation of the weekday */ __('M_Monday_initial'); + $this->weekday_initial[__('Tuesday')] = /* translators: one-letter abbreviation of the weekday */ __('T_Tuesday_initial'); + $this->weekday_initial[__('Wednesday')] = /* translators: one-letter abbreviation of the weekday */ __('W_Wednesday_initial'); + $this->weekday_initial[__('Thursday')] = /* translators: one-letter abbreviation of the weekday */ __('T_Thursday_initial'); + $this->weekday_initial[__('Friday')] = /* translators: one-letter abbreviation of the weekday */ __('F_Friday_initial'); + $this->weekday_initial[__('Saturday')] = /* translators: one-letter abbreviation of the weekday */ __('S_Saturday_initial'); + + foreach ($this->weekday_initial as $weekday_ => $weekday_initial_) { + $this->weekday_initial[$weekday_] = preg_replace('/_.+_initial$/', '', $weekday_initial_); + } + + // Abbreviations for each day. + $this->weekday_abbrev[__('Sunday')] = /* translators: three-letter abbreviation of the weekday */ __('Sun'); + $this->weekday_abbrev[__('Monday')] = /* translators: three-letter abbreviation of the weekday */ __('Mon'); + $this->weekday_abbrev[__('Tuesday')] = /* translators: three-letter abbreviation of the weekday */ __('Tue'); + $this->weekday_abbrev[__('Wednesday')] = /* translators: three-letter abbreviation of the weekday */ __('Wed'); + $this->weekday_abbrev[__('Thursday')] = /* translators: three-letter abbreviation of the weekday */ __('Thu'); + $this->weekday_abbrev[__('Friday')] = /* translators: three-letter abbreviation of the weekday */ __('Fri'); + $this->weekday_abbrev[__('Saturday')] = /* translators: three-letter abbreviation of the weekday */ __('Sat'); + + // The Months + $this->month['01'] = /* translators: month name */ __('January'); + $this->month['02'] = /* translators: month name */ __('February'); + $this->month['03'] = /* translators: month name */ __('March'); + $this->month['04'] = /* translators: month name */ __('April'); + $this->month['05'] = /* translators: month name */ __('May'); + $this->month['06'] = /* translators: month name */ __('June'); + $this->month['07'] = /* translators: month name */ __('July'); + $this->month['08'] = /* translators: month name */ __('August'); + $this->month['09'] = /* translators: month name */ __('September'); + $this->month['10'] = /* translators: month name */ __('October'); + $this->month['11'] = /* translators: month name */ __('November'); + $this->month['12'] = /* translators: month name */ __('December'); + + // Abbreviations for each month. Uses the same hack as above to get around the + // 'May' duplication. + $this->month_abbrev[__('January')] = /* translators: three-letter abbreviation of the month */ __('Jan_January_abbreviation'); + $this->month_abbrev[__('February')] = /* translators: three-letter abbreviation of the month */ __('Feb_February_abbreviation'); + $this->month_abbrev[__('March')] = /* translators: three-letter abbreviation of the month */ __('Mar_March_abbreviation'); + $this->month_abbrev[__('April')] = /* translators: three-letter abbreviation of the month */ __('Apr_April_abbreviation'); + $this->month_abbrev[__('May')] = /* translators: three-letter abbreviation of the month */ __('May_May_abbreviation'); + $this->month_abbrev[__('June')] = /* translators: three-letter abbreviation of the month */ __('Jun_June_abbreviation'); + $this->month_abbrev[__('July')] = /* translators: three-letter abbreviation of the month */ __('Jul_July_abbreviation'); + $this->month_abbrev[__('August')] = /* translators: three-letter abbreviation of the month */ __('Aug_August_abbreviation'); + $this->month_abbrev[__('September')] = /* translators: three-letter abbreviation of the month */ __('Sep_September_abbreviation'); + $this->month_abbrev[__('October')] = /* translators: three-letter abbreviation of the month */ __('Oct_October_abbreviation'); + $this->month_abbrev[__('November')] = /* translators: three-letter abbreviation of the month */ __('Nov_November_abbreviation'); + $this->month_abbrev[__('December')] = /* translators: three-letter abbreviation of the month */ __('Dec_December_abbreviation'); + + foreach ($this->month_abbrev as $month_ => $month_abbrev_) { + $this->month_abbrev[$month_] = preg_replace('/_.+_abbreviation$/', '', $month_abbrev_); + } + + // The Meridiems + $this->meridiem['am'] = __('am'); + $this->meridiem['pm'] = __('pm'); + $this->meridiem['AM'] = __('AM'); + $this->meridiem['PM'] = __('PM'); + + // Numbers formatting + // See http://php.net/number_format + + /* translators: $thousands_sep argument for http://php.net/number_format, default is , */ + $trans = __('number_format_thousands_sep'); + $this->number_format['thousands_sep'] = ('number_format_thousands_sep' == $trans) ? ',' : $trans; + + /* translators: $dec_point argument for http://php.net/number_format, default is . */ + $trans = __('number_format_decimal_point'); + $this->number_format['decimal_point'] = ('number_format_decimal_point' == $trans) ? '.' : $trans; + + // Import global locale vars set during inclusion of $locale.php. + foreach ( (array) $this->locale_vars as $var ) { + if ( isset($GLOBALS[$var]) ) + $this->$var = $GLOBALS[$var]; + } + + } + + /** + * Retrieve the full translated weekday word. + * + * Week starts on translated Sunday and can be fetched + * by using 0 (zero). So the week starts with 0 (zero) + * and ends on Saturday with is fetched by using 6 (six). + * + * @since 2.1.0 + * @access public + * + * @param int $weekday_number 0 for Sunday through 6 Saturday + * @return string Full translated weekday + */ + function get_weekday($weekday_number) { + return $this->weekday[$weekday_number]; + } + + /** + * Retrieve the translated weekday initial. + * + * The weekday initial is retrieved by the translated + * full weekday word. When translating the weekday initial + * pay attention to make sure that the starting letter does + * not conflict. + * + * @since 2.1.0 + * @access public + * + * @param string $weekday_name + * @return string + */ + function get_weekday_initial($weekday_name) { + return $this->weekday_initial[$weekday_name]; + } + + /** + * Retrieve the translated weekday abbreviation. + * + * The weekday abbreviation is retrieved by the translated + * full weekday word. + * + * @since 2.1.0 + * @access public + * + * @param string $weekday_name Full translated weekday word + * @return string Translated weekday abbreviation + */ + function get_weekday_abbrev($weekday_name) { + return $this->weekday_abbrev[$weekday_name]; + } + + /** + * Retrieve the full translated month by month number. + * + * The $month_number parameter has to be a string + * because it must have the '0' in front of any number + * that is less than 10. Starts from '01' and ends at + * '12'. + * + * You can use an integer instead and it will add the + * '0' before the numbers less than 10 for you. + * + * @since 2.1.0 + * @access public + * + * @param string|int $month_number '01' through '12' + * @return string Translated full month name + */ + function get_month($month_number) { + return $this->month[zeroise($month_number, 2)]; + } + + /** + * Retrieve translated version of month abbreviation string. + * + * The $month_name parameter is expected to be the translated or + * translatable version of the month. + * + * @since 2.1.0 + * @access public + * + * @param string $month_name Translated month to get abbreviated version + * @return string Translated abbreviated month + */ + function get_month_abbrev($month_name) { + return $this->month_abbrev[$month_name]; + } + + /** + * Retrieve translated version of meridiem string. + * + * The $meridiem parameter is expected to not be translated. + * + * @since 2.1.0 + * @access public + * + * @param string $meridiem Either 'am', 'pm', 'AM', or 'PM'. Not translated version. + * @return string Translated version + */ + function get_meridiem($meridiem) { + return $this->meridiem[$meridiem]; + } + + /** + * Global variables are deprecated. For backwards compatibility only. + * + * @deprecated For backwards compatibility only. + * @access private + * + * @since 2.1.0 + */ + function register_globals() { + $GLOBALS['weekday'] = $this->weekday; + $GLOBALS['weekday_initial'] = $this->weekday_initial; + $GLOBALS['weekday_abbrev'] = $this->weekday_abbrev; + $GLOBALS['month'] = $this->month; + $GLOBALS['month_abbrev'] = $this->month_abbrev; + } + + /** + * Constructor which calls helper methods to set up object variables + * + * @uses WP_Locale::init() + * @uses WP_Locale::register_globals() + * @since 2.1.0 + * + * @return WP_Locale + */ + function __construct() { + $this->init(); + $this->register_globals(); + } + /** + * Checks if current locale is RTL. + * + * @since 3.0.0 + * @return bool Whether locale is RTL. + */ + function is_rtl() { + return 'rtl' == $this->text_direction; + } +} + +/** + * Checks if current locale is RTL. + * + * @since 3.0.0 + * @return bool Whether locale is RTL. + */ +function is_rtl() { + global $wp_locale; + return $wp_locale->is_rtl(); +} + +?> diff --git a/src/wp-includes/media.php b/src/wp-includes/media.php new file mode 100644 index 0000000..f4e60d0 --- /dev/null +++ b/src/wp-includes/media.php @@ -0,0 +1,1441 @@ + 0 ) + $max_width = min( intval($content_width), $max_width ); + } elseif ( isset( $_wp_additional_image_sizes ) && count( $_wp_additional_image_sizes ) && in_array( $size, array_keys( $_wp_additional_image_sizes ) ) ) { + $max_width = intval( $_wp_additional_image_sizes[$size]['width'] ); + $max_height = intval( $_wp_additional_image_sizes[$size]['height'] ); + if ( intval($content_width) > 0 && is_admin() ) // Only in admin. Assume that theme authors know what they're doing. + $max_width = min( intval($content_width), $max_width ); + } + // $size == 'full' has no constraint + else { + $max_width = $width; + $max_height = $height; + } + + list( $max_width, $max_height ) = apply_filters( 'editor_max_image_size', array( $max_width, $max_height ), $size ); + + return wp_constrain_dimensions( $width, $height, $max_width, $max_height ); +} + +/** + * Retrieve width and height attributes using given width and height values. + * + * Both attributes are required in the sense that both parameters must have a + * value, but are optional in that if you set them to false or null, then they + * will not be added to the returned string. + * + * You can set the value using a string, but it will only take numeric values. + * If you wish to put 'px' after the numbers, then it will be stripped out of + * the return. + * + * @since 2.5.0 + * + * @param int|string $width Optional. Width attribute value. + * @param int|string $height Optional. Height attribute value. + * @return string HTML attributes for width and, or height. + */ +function image_hwstring($width, $height) { + $out = ''; + if ($width) + $out .= 'width="'.intval($width).'" '; + if ($height) + $out .= 'height="'.intval($height).'" '; + return $out; +} + +/** + * Scale an image to fit a particular size (such as 'thumb' or 'medium'). + * + * Array with image url, width, height, and whether is intermediate size, in + * that order is returned on success is returned. $is_intermediate is true if + * $url is a resized image, false if it is the original. + * + * The URL might be the original image, or it might be a resized version. This + * function won't create a new resized copy, it will just return an already + * resized one if it exists. + * + * A plugin may use the 'image_downsize' filter to hook into and offer image + * resizing services for images. The hook must return an array with the same + * elements that are returned in the function. The first element being the URL + * to the new image that was resized. + * + * @since 2.5.0 + * @uses apply_filters() Calls 'image_downsize' on $id and $size to provide + * resize services. + * + * @param int $id Attachment ID for image. + * @param array|string $size Optional, default is 'medium'. Size of image, either array or string. + * @return bool|array False on failure, array on success. + */ +function image_downsize($id, $size = 'medium') { + + if ( !wp_attachment_is_image($id) ) + return false; + + $img_url = wp_get_attachment_url($id); + $meta = wp_get_attachment_metadata($id); + $width = $height = 0; + $is_intermediate = false; + $img_url_basename = wp_basename($img_url); + + // plugins can use this to provide resize services + if ( $out = apply_filters('image_downsize', false, $id, $size) ) + return $out; + + // try for a new style intermediate size + if ( $intermediate = image_get_intermediate_size($id, $size) ) { + $img_url = str_replace($img_url_basename, $intermediate['file'], $img_url); + $width = $intermediate['width']; + $height = $intermediate['height']; + $is_intermediate = true; + } + elseif ( $size == 'thumbnail' ) { + // fall back to the old thumbnail + if ( ($thumb_file = wp_get_attachment_thumb_file($id)) && $info = getimagesize($thumb_file) ) { + $img_url = str_replace($img_url_basename, wp_basename($thumb_file), $img_url); + $width = $info[0]; + $height = $info[1]; + $is_intermediate = true; + } + } + if ( !$width && !$height && isset($meta['width'], $meta['height']) ) { + // any other type: use the real image + $width = $meta['width']; + $height = $meta['height']; + } + + if ( $img_url) { + // we have the actual image size, but might need to further constrain it if content_width is narrower + list( $width, $height ) = image_constrain_size_for_editor( $width, $height, $size ); + + return array( $img_url, $width, $height, $is_intermediate ); + } + return false; + +} + +/** + * Registers a new image size + */ +function add_image_size( $name, $width = 0, $height = 0, $crop = false ) { + global $_wp_additional_image_sizes; + $_wp_additional_image_sizes[$name] = array( 'width' => absint( $width ), 'height' => absint( $height ), 'crop' => (bool) $crop ); +} + +/** + * Registers an image size for the post thumbnail + */ +function set_post_thumbnail_size( $width = 0, $height = 0, $crop = false ) { + add_image_size( 'post-thumbnail', $width, $height, $crop ); +} + +/** + * An tag for an image attachment, scaling it down if requested. + * + * The filter 'get_image_tag_class' allows for changing the class name for the + * image without having to use regular expressions on the HTML content. The + * parameters are: what WordPress will use for the class, the Attachment ID, + * image align value, and the size the image should be. + * + * The second filter 'get_image_tag' has the HTML content, which can then be + * further manipulated by a plugin to change all attribute values and even HTML + * content. + * + * @since 2.5.0 + * + * @uses apply_filters() The 'get_image_tag_class' filter is the IMG element + * class attribute. + * @uses apply_filters() The 'get_image_tag' filter is the full IMG element with + * all attributes. + * + * @param int $id Attachment ID. + * @param string $alt Image Description for the alt attribute. + * @param string $title Image Description for the title attribute. + * @param string $align Part of the class name for aligning the image. + * @param string $size Optional. Default is 'medium'. + * @return string HTML IMG element for given image attachment + */ +function get_image_tag($id, $alt, $title, $align, $size='medium') { + + list( $img_src, $width, $height ) = image_downsize($id, $size); + $hwstring = image_hwstring($width, $height); + + $class = 'align' . esc_attr($align) .' size-' . esc_attr($size) . ' wp-image-' . $id; + $class = apply_filters('get_image_tag_class', $class, $id, $align, $size); + + $html = '' . esc_attr($alt) . ''; + + $html = apply_filters( 'get_image_tag', $html, $id, $alt, $title, $align, $size ); + + return $html; +} + +/** + * Load an image from a string, if PHP supports it. + * + * @since 2.1.0 + * + * @param string $file Filename of the image to load. + * @return resource The resulting image resource on success, Error string on failure. + */ +function wp_load_image( $file ) { + if ( is_numeric( $file ) ) + $file = get_attached_file( $file ); + + if ( ! file_exists( $file ) ) + return sprintf(__('File “%s” doesn’t exist?'), $file); + + if ( ! function_exists('imagecreatefromstring') ) + return __('The GD image library is not installed.'); + + // Set artificially high because GD uses uncompressed images in memory + @ini_set( 'memory_limit', apply_filters( 'image_memory_limit', WP_MAX_MEMORY_LIMIT ) ); + $image = imagecreatefromstring( file_get_contents( $file ) ); + + if ( !is_resource( $image ) ) + return sprintf(__('File “%s” is not an image.'), $file); + + return $image; +} + +/** + * Calculates the new dimentions for a downsampled image. + * + * If either width or height are empty, no constraint is applied on + * that dimension. + * + * @since 2.5.0 + * + * @param int $current_width Current width of the image. + * @param int $current_height Current height of the image. + * @param int $max_width Optional. Maximum wanted width. + * @param int $max_height Optional. Maximum wanted height. + * @return array First item is the width, the second item is the height. + */ +function wp_constrain_dimensions( $current_width, $current_height, $max_width=0, $max_height=0 ) { + if ( !$max_width and !$max_height ) + return array( $current_width, $current_height ); + + $width_ratio = $height_ratio = 1.0; + $did_width = $did_height = false; + + if ( $max_width > 0 && $current_width > 0 && $current_width > $max_width ) { + $width_ratio = $max_width / $current_width; + $did_width = true; + } + + if ( $max_height > 0 && $current_height > 0 && $current_height > $max_height ) { + $height_ratio = $max_height / $current_height; + $did_height = true; + } + + // Calculate the larger/smaller ratios + $smaller_ratio = min( $width_ratio, $height_ratio ); + $larger_ratio = max( $width_ratio, $height_ratio ); + + if ( intval( $current_width * $larger_ratio ) > $max_width || intval( $current_height * $larger_ratio ) > $max_height ) + // The larger ratio is too big. It would result in an overflow. + $ratio = $smaller_ratio; + else + // The larger ratio fits, and is likely to be a more "snug" fit. + $ratio = $larger_ratio; + + $w = intval( $current_width * $ratio ); + $h = intval( $current_height * $ratio ); + + // Sometimes, due to rounding, we'll end up with a result like this: 465x700 in a 177x177 box is 117x176... a pixel short + // We also have issues with recursive calls resulting in an ever-changing result. Contraining to the result of a constraint should yield the original result. + // Thus we look for dimensions that are one pixel shy of the max value and bump them up + if ( $did_width && $w == $max_width - 1 ) + $w = $max_width; // Round it up + if ( $did_height && $h == $max_height - 1 ) + $h = $max_height; // Round it up + + return array( $w, $h ); +} + +/** + * Retrieve calculated resized dimensions for use in imagecopyresampled(). + * + * Calculate dimensions and coordinates for a resized image that fits within a + * specified width and height. If $crop is true, the largest matching central + * portion of the image will be cropped out and resized to the required size. + * + * @since 2.5.0 + * + * @param int $orig_w Original width. + * @param int $orig_h Original height. + * @param int $dest_w New width. + * @param int $dest_h New height. + * @param bool $crop Optional, default is false. Whether to crop image or resize. + * @return bool|array False, on failure. Returned array matches parameters for imagecopyresampled() PHP function. + */ +function image_resize_dimensions($orig_w, $orig_h, $dest_w, $dest_h, $crop = false) { + + if ($orig_w <= 0 || $orig_h <= 0) + return false; + // at least one of dest_w or dest_h must be specific + if ($dest_w <= 0 && $dest_h <= 0) + return false; + + if ( $crop ) { + // crop the largest possible portion of the original image that we can size to $dest_w x $dest_h + $aspect_ratio = $orig_w / $orig_h; + $new_w = min($dest_w, $orig_w); + $new_h = min($dest_h, $orig_h); + + if ( !$new_w ) { + $new_w = intval($new_h * $aspect_ratio); + } + + if ( !$new_h ) { + $new_h = intval($new_w / $aspect_ratio); + } + + $size_ratio = max($new_w / $orig_w, $new_h / $orig_h); + + $crop_w = round($new_w / $size_ratio); + $crop_h = round($new_h / $size_ratio); + + $s_x = floor( ($orig_w - $crop_w) / 2 ); + $s_y = floor( ($orig_h - $crop_h) / 2 ); + } else { + // don't crop, just resize using $dest_w x $dest_h as a maximum bounding box + $crop_w = $orig_w; + $crop_h = $orig_h; + + $s_x = 0; + $s_y = 0; + + list( $new_w, $new_h ) = wp_constrain_dimensions( $orig_w, $orig_h, $dest_w, $dest_h ); + } + + // if the resulting image would be the same size or larger we don't want to resize it + if ( $new_w >= $orig_w && $new_h >= $orig_h ) + return false; + + // the return array matches the parameters to imagecopyresampled() + // int dst_x, int dst_y, int src_x, int src_y, int dst_w, int dst_h, int src_w, int src_h + return array( 0, 0, (int) $s_x, (int) $s_y, (int) $new_w, (int) $new_h, (int) $crop_w, (int) $crop_h ); + +} + +/** + * Scale down an image to fit a particular size and save a new copy of the image. + * + * The PNG transparency will be preserved using the function, as well as the + * image type. If the file going in is PNG, then the resized image is going to + * be PNG. The only supported image types are PNG, GIF, and JPEG. + * + * Some functionality requires API to exist, so some PHP version may lose out + * support. This is not the fault of WordPress (where functionality is + * downgraded, not actual defects), but of your PHP version. + * + * @since 2.5.0 + * + * @param string $file Image file path. + * @param int $max_w Maximum width to resize to. + * @param int $max_h Maximum height to resize to. + * @param bool $crop Optional. Whether to crop image or resize. + * @param string $suffix Optional. File Suffix. + * @param string $dest_path Optional. New image file path. + * @param int $jpeg_quality Optional, default is 90. Image quality percentage. + * @return mixed WP_Error on failure. String with new destination path. + */ +function image_resize( $file, $max_w, $max_h, $crop = false, $suffix = null, $dest_path = null, $jpeg_quality = 90 ) { + + $image = wp_load_image( $file ); + if ( !is_resource( $image ) ) + return new WP_Error( 'error_loading_image', $image, $file ); + + $size = @getimagesize( $file ); + if ( !$size ) + return new WP_Error('invalid_image', __('Could not read image size'), $file); + list($orig_w, $orig_h, $orig_type) = $size; + + $dims = image_resize_dimensions($orig_w, $orig_h, $max_w, $max_h, $crop); + if ( !$dims ) + return new WP_Error( 'error_getting_dimensions', __('Could not calculate resized image dimensions') ); + list($dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h) = $dims; + + $newimage = wp_imagecreatetruecolor( $dst_w, $dst_h ); + + imagecopyresampled( $newimage, $image, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h); + + // convert from full colors to index colors, like original PNG. + if ( IMAGETYPE_PNG == $orig_type && function_exists('imageistruecolor') && !imageistruecolor( $image ) ) + imagetruecolortopalette( $newimage, false, imagecolorstotal( $image ) ); + + // we don't need the original in memory anymore + imagedestroy( $image ); + + // $suffix will be appended to the destination filename, just before the extension + if ( !$suffix ) + $suffix = "{$dst_w}x{$dst_h}"; + + $info = pathinfo($file); + $dir = $info['dirname']; + $ext = $info['extension']; + $name = wp_basename($file, ".$ext"); + + if ( !is_null($dest_path) and $_dest_path = realpath($dest_path) ) + $dir = $_dest_path; + $destfilename = "{$dir}/{$name}-{$suffix}.{$ext}"; + + if ( IMAGETYPE_GIF == $orig_type ) { + if ( !imagegif( $newimage, $destfilename ) ) + return new WP_Error('resize_path_invalid', __( 'Resize path invalid' )); + } elseif ( IMAGETYPE_PNG == $orig_type ) { + if ( !imagepng( $newimage, $destfilename ) ) + return new WP_Error('resize_path_invalid', __( 'Resize path invalid' )); + } else { + // all other formats are converted to jpg + $destfilename = "{$dir}/{$name}-{$suffix}.jpg"; + if ( !imagejpeg( $newimage, $destfilename, apply_filters( 'jpeg_quality', $jpeg_quality, 'image_resize' ) ) ) + return new WP_Error('resize_path_invalid', __( 'Resize path invalid' )); + } + + imagedestroy( $newimage ); + + // Set correct file permissions + $stat = stat( dirname( $destfilename )); + $perms = $stat['mode'] & 0000666; //same permissions as parent folder, strip off the executable bits + @ chmod( $destfilename, $perms ); + + return $destfilename; +} + +/** + * Resize an image to make a thumbnail or intermediate size. + * + * The returned array has the file size, the image width, and image height. The + * filter 'image_make_intermediate_size' can be used to hook in and change the + * values of the returned array. The only parameter is the resized file path. + * + * @since 2.5.0 + * + * @param string $file File path. + * @param int $width Image width. + * @param int $height Image height. + * @param bool $crop Optional, default is false. Whether to crop image to specified height and width or resize. + * @return bool|array False, if no image was created. Metadata array on success. + */ +function image_make_intermediate_size($file, $width, $height, $crop=false) { + if ( $width || $height ) { + $resized_file = image_resize($file, $width, $height, $crop); + if ( !is_wp_error($resized_file) && $resized_file && $info = getimagesize($resized_file) ) { + $resized_file = apply_filters('image_make_intermediate_size', $resized_file); + return array( + 'file' => wp_basename( $resized_file ), + 'width' => $info[0], + 'height' => $info[1], + ); + } + } + return false; +} + +/** + * Retrieve the image's intermediate size (resized) path, width, and height. + * + * The $size parameter can be an array with the width and height respectively. + * If the size matches the 'sizes' metadata array for width and height, then it + * will be used. If there is no direct match, then the nearest image size larger + * than the specified size will be used. If nothing is found, then the function + * will break out and return false. + * + * The metadata 'sizes' is used for compatible sizes that can be used for the + * parameter $size value. + * + * The url path will be given, when the $size parameter is a string. + * + * If you are passing an array for the $size, you should consider using + * add_image_size() so that a cropped version is generated. It's much more + * efficient than having to find the closest-sized image and then having the + * browser scale down the image. + * + * @since 2.5.0 + * @see add_image_size() + * + * @param int $post_id Attachment ID for image. + * @param array|string $size Optional, default is 'thumbnail'. Size of image, either array or string. + * @return bool|array False on failure or array of file path, width, and height on success. + */ +function image_get_intermediate_size($post_id, $size='thumbnail') { + if ( !is_array( $imagedata = wp_get_attachment_metadata( $post_id ) ) ) + return false; + + // get the best one for a specified set of dimensions + if ( is_array($size) && !empty($imagedata['sizes']) ) { + foreach ( $imagedata['sizes'] as $_size => $data ) { + // already cropped to width or height; so use this size + if ( ( $data['width'] == $size[0] && $data['height'] <= $size[1] ) || ( $data['height'] == $size[1] && $data['width'] <= $size[0] ) ) { + $file = $data['file']; + list($width, $height) = image_constrain_size_for_editor( $data['width'], $data['height'], $size ); + return compact( 'file', 'width', 'height' ); + } + // add to lookup table: area => size + $areas[$data['width'] * $data['height']] = $_size; + } + if ( !$size || !empty($areas) ) { + // find for the smallest image not smaller than the desired size + ksort($areas); + foreach ( $areas as $_size ) { + $data = $imagedata['sizes'][$_size]; + if ( $data['width'] >= $size[0] || $data['height'] >= $size[1] ) { + // Skip images with unexpectedly divergent aspect ratios (crops) + // First, we calculate what size the original image would be if constrained to a box the size of the current image in the loop + $maybe_cropped = image_resize_dimensions($imagedata['width'], $imagedata['height'], $data['width'], $data['height'], false ); + // If the size doesn't match within one pixel, then it is of a different aspect ratio, so we skip it, unless it's the thumbnail size + if ( 'thumbnail' != $_size && ( !$maybe_cropped || ( $maybe_cropped[4] != $data['width'] && $maybe_cropped[4] + 1 != $data['width'] ) || ( $maybe_cropped[5] != $data['height'] && $maybe_cropped[5] + 1 != $data['height'] ) ) ) + continue; + // If we're still here, then we're going to use this size + $file = $data['file']; + list($width, $height) = image_constrain_size_for_editor( $data['width'], $data['height'], $size ); + return compact( 'file', 'width', 'height' ); + } + } + } + } + + if ( is_array($size) || empty($size) || empty($imagedata['sizes'][$size]) ) + return false; + + $data = $imagedata['sizes'][$size]; + // include the full filesystem path of the intermediate file + if ( empty($data['path']) && !empty($data['file']) ) { + $file_url = wp_get_attachment_url($post_id); + $data['path'] = path_join( dirname($imagedata['file']), $data['file'] ); + $data['url'] = path_join( dirname($file_url), $data['file'] ); + } + return $data; +} + +/** + * Get the available image sizes + * @since 3.0.0 + * @return array Returns a filtered array of image size strings + */ +function get_intermediate_image_sizes() { + global $_wp_additional_image_sizes; + $image_sizes = array('thumbnail', 'medium', 'large'); // Standard sizes + if ( isset( $_wp_additional_image_sizes ) && count( $_wp_additional_image_sizes ) ) + $image_sizes = array_merge( $image_sizes, array_keys( $_wp_additional_image_sizes ) ); + + return apply_filters( 'intermediate_image_sizes', $image_sizes ); +} + +/** + * Retrieve an image to represent an attachment. + * + * A mime icon for files, thumbnail or intermediate size for images. + * + * @since 2.5.0 + * + * @param int $attachment_id Image attachment ID. + * @param string $size Optional, default is 'thumbnail'. + * @param bool $icon Optional, default is false. Whether it is an icon. + * @return bool|array Returns an array (url, width, height), or false, if no image is available. + */ +function wp_get_attachment_image_src($attachment_id, $size='thumbnail', $icon = false) { + + // get a thumbnail or intermediate image if there is one + if ( $image = image_downsize($attachment_id, $size) ) + return $image; + + $src = false; + + if ( $icon && $src = wp_mime_type_icon($attachment_id) ) { + $icon_dir = apply_filters( 'icon_dir', ABSPATH . WPINC . '/images/crystal' ); + $src_file = $icon_dir . '/' . wp_basename($src); + @list($width, $height) = getimagesize($src_file); + } + if ( $src && $width && $height ) + return array( $src, $width, $height ); + return false; +} + +/** + * Get an HTML img element representing an image attachment + * + * While $size will accept an array, it is better to register a size with + * add_image_size() so that a cropped version is generated. It's much more + * efficient than having to find the closest-sized image and then having the + * browser scale down the image. + * + * @see add_image_size() + * @uses apply_filters() Calls 'wp_get_attachment_image_attributes' hook on attributes array + * @uses wp_get_attachment_image_src() Gets attachment file URL and dimensions + * @since 2.5.0 + * + * @param int $attachment_id Image attachment ID. + * @param string $size Optional, default is 'thumbnail'. + * @param bool $icon Optional, default is false. Whether it is an icon. + * @return string HTML img element or empty string on failure. + */ +function wp_get_attachment_image($attachment_id, $size = 'thumbnail', $icon = false, $attr = '') { + + $html = ''; + $image = wp_get_attachment_image_src($attachment_id, $size, $icon); + if ( $image ) { + list($src, $width, $height) = $image; + $hwstring = image_hwstring($width, $height); + if ( is_array($size) ) + $size = join('x', $size); + $attachment =& get_post($attachment_id); + $default_attr = array( + 'src' => $src, + 'class' => "attachment-$size", + 'alt' => trim(strip_tags( get_post_meta($attachment_id, '_wp_attachment_image_alt', true) )), // Use Alt field first + 'title' => trim(strip_tags( $attachment->post_title )), + ); + if ( empty($default_attr['alt']) ) + $default_attr['alt'] = trim(strip_tags( $attachment->post_excerpt )); // If not, Use the Caption + if ( empty($default_attr['alt']) ) + $default_attr['alt'] = trim(strip_tags( $attachment->post_title )); // Finally, use the title + + $attr = wp_parse_args($attr, $default_attr); + $attr = apply_filters( 'wp_get_attachment_image_attributes', $attr, $attachment ); + $attr = array_map( 'esc_attr', $attr ); + $html = rtrim(" $value ) { + $html .= " $name=" . '"' . $value . '"'; + } + $html .= ' />'; + } + + return $html; +} + +/** + * Adds a 'wp-post-image' class to post thumbnail thumbnails + * Uses the begin_fetch_post_thumbnail_html and end_fetch_post_thumbnail_html action hooks to + * dynamically add/remove itself so as to only filter post thumbnail thumbnails + * + * @since 2.9.0 + * @param array $attr Attributes including src, class, alt, title + * @return array + */ +function _wp_post_thumbnail_class_filter( $attr ) { + $attr['class'] .= ' wp-post-image'; + return $attr; +} + +/** + * Adds _wp_post_thumbnail_class_filter to the wp_get_attachment_image_attributes filter + * + * @since 2.9.0 + */ +function _wp_post_thumbnail_class_filter_add( $attr ) { + add_filter( 'wp_get_attachment_image_attributes', '_wp_post_thumbnail_class_filter' ); +} + +/** + * Removes _wp_post_thumbnail_class_filter from the wp_get_attachment_image_attributes filter + * + * @since 2.9.0 + */ +function _wp_post_thumbnail_class_filter_remove( $attr ) { + remove_filter( 'wp_get_attachment_image_attributes', '_wp_post_thumbnail_class_filter' ); +} + +add_shortcode('wp_caption', 'img_caption_shortcode'); +add_shortcode('caption', 'img_caption_shortcode'); + +/** + * The Caption shortcode. + * + * Allows a plugin to replace the content that would otherwise be returned. The + * filter is 'img_caption_shortcode' and passes an empty string, the attr + * parameter and the content parameter values. + * + * The supported attributes for the shortcode are 'id', 'align', 'width', and + * 'caption'. + * + * @since 2.6.0 + * + * @param array $attr Attributes attributed to the shortcode. + * @param string $content Optional. Shortcode content. + * @return string + */ +function img_caption_shortcode($attr, $content = null) { + + // Allow plugins/themes to override the default caption template. + $output = apply_filters('img_caption_shortcode', '', $attr, $content); + if ( $output != '' ) + return $output; + + extract(shortcode_atts(array( + 'id' => '', + 'align' => 'alignnone', + 'width' => '', + 'caption' => '' + ), $attr)); + + if ( 1 > (int) $width || empty($caption) ) + return $content; + + if ( $id ) $id = 'id="' . esc_attr($id) . '" '; + + return '
            ' + . do_shortcode( $content ) . '

            ' . $caption . '

            '; +} + +add_shortcode('gallery', 'gallery_shortcode'); + +/** + * The Gallery shortcode. + * + * This implements the functionality of the Gallery Shortcode for displaying + * WordPress images on a post. + * + * @since 2.5.0 + * + * @param array $attr Attributes attributed to the shortcode. + * @return string HTML content to display gallery. + */ +function gallery_shortcode($attr) { + global $post, $wp_locale; + + static $instance = 0; + $instance++; + + // Allow plugins/themes to override the default gallery template. + $output = apply_filters('post_gallery', '', $attr); + if ( $output != '' ) + return $output; + + // We're trusting author input, so let's at least make sure it looks like a valid orderby statement + if ( isset( $attr['orderby'] ) ) { + $attr['orderby'] = sanitize_sql_orderby( $attr['orderby'] ); + if ( !$attr['orderby'] ) + unset( $attr['orderby'] ); + } + + extract(shortcode_atts(array( + 'order' => 'ASC', + 'orderby' => 'menu_order ID', + 'id' => $post->ID, + 'itemtag' => 'dl', + 'icontag' => 'dt', + 'captiontag' => 'dd', + 'columns' => 3, + 'size' => 'thumbnail', + 'include' => '', + 'exclude' => '' + ), $attr)); + + $id = intval($id); + if ( 'RAND' == $order ) + $orderby = 'none'; + + if ( !empty($include) ) { + $include = preg_replace( '/[^0-9,]+/', '', $include ); + $_attachments = get_posts( array('include' => $include, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby) ); + + $attachments = array(); + foreach ( $_attachments as $key => $val ) { + $attachments[$val->ID] = $_attachments[$key]; + } + } elseif ( !empty($exclude) ) { + $exclude = preg_replace( '/[^0-9,]+/', '', $exclude ); + $attachments = get_children( array('post_parent' => $id, 'exclude' => $exclude, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby) ); + } else { + $attachments = get_children( array('post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby) ); + } + + if ( empty($attachments) ) + return ''; + + if ( is_feed() ) { + $output = "\n"; + foreach ( $attachments as $att_id => $attachment ) + $output .= wp_get_attachment_link($att_id, $size, true) . "\n"; + return $output; + } + + $itemtag = tag_escape($itemtag); + $captiontag = tag_escape($captiontag); + $columns = intval($columns); + $itemwidth = $columns > 0 ? floor(100/$columns) : 100; + $float = is_rtl() ? 'right' : 'left'; + + $selector = "gallery-{$instance}"; + + $gallery_style = $gallery_div = ''; + if ( apply_filters( 'use_default_gallery_style', true ) ) + $gallery_style = " + + "; + $size_class = sanitize_html_class( $size ); + $gallery_div = "\n"; + + return $output; +} + +/** + * Display previous image link that has the same post parent. + * + * @since 2.5.0 + * @param string $size Optional, default is 'thumbnail'. Size of image, either array or string. 0 or 'none' will default to post_title or $text; + * @param string $text Optional, default is false. If included, link will reflect $text variable. + * @return string HTML content. + */ +function previous_image_link($size = 'thumbnail', $text = false) { + adjacent_image_link(true, $size, $text); +} + +/** + * Display next image link that has the same post parent. + * + * @since 2.5.0 + * @param string $size Optional, default is 'thumbnail'. Size of image, either array or string. 0 or 'none' will default to post_title or $text; + * @param string $text Optional, default is false. If included, link will reflect $text variable. + * @return string HTML content. + */ +function next_image_link($size = 'thumbnail', $text = false) { + adjacent_image_link(false, $size, $text); +} + +/** + * Display next or previous image link that has the same post parent. + * + * Retrieves the current attachment object from the $post global. + * + * @since 2.5.0 + * + * @param bool $prev Optional. Default is true to display previous link, true for next. + */ +function adjacent_image_link($prev = true, $size = 'thumbnail', $text = false) { + global $post; + $post = get_post($post); + $attachments = array_values(get_children( array('post_parent' => $post->post_parent, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => 'menu_order ID') )); + + foreach ( $attachments as $k => $attachment ) + if ( $attachment->ID == $post->ID ) + break; + + $k = $prev ? $k - 1 : $k + 1; + + if ( isset($attachments[$k]) ) + echo wp_get_attachment_link($attachments[$k]->ID, $size, true, false, $text); +} + +/** + * Retrieve taxonomies attached to the attachment. + * + * @since 2.5.0 + * + * @param int|array|object $attachment Attachment ID, Attachment data array, or Attachment data object. + * @return array Empty array on failure. List of taxonomies on success. + */ +function get_attachment_taxonomies($attachment) { + if ( is_int( $attachment ) ) + $attachment = get_post($attachment); + else if ( is_array($attachment) ) + $attachment = (object) $attachment; + + if ( ! is_object($attachment) ) + return array(); + + $filename = basename($attachment->guid); + + $objects = array('attachment'); + + if ( false !== strpos($filename, '.') ) + $objects[] = 'attachment:' . substr($filename, strrpos($filename, '.') + 1); + if ( !empty($attachment->post_mime_type) ) { + $objects[] = 'attachment:' . $attachment->post_mime_type; + if ( false !== strpos($attachment->post_mime_type, '/') ) + foreach ( explode('/', $attachment->post_mime_type) as $token ) + if ( !empty($token) ) + $objects[] = "attachment:$token"; + } + + $taxonomies = array(); + foreach ( $objects as $object ) + if ( $taxes = get_object_taxonomies($object) ) + $taxonomies = array_merge($taxonomies, $taxes); + + return array_unique($taxonomies); +} + +/** + * Check if the installed version of GD supports particular image type + * + * @since 2.9.0 + * + * @param string $mime_type + * @return bool + */ +function gd_edit_image_support($mime_type) { + if ( function_exists('imagetypes') ) { + switch( $mime_type ) { + case 'image/jpeg': + return (imagetypes() & IMG_JPG) != 0; + case 'image/png': + return (imagetypes() & IMG_PNG) != 0; + case 'image/gif': + return (imagetypes() & IMG_GIF) != 0; + } + } else { + switch( $mime_type ) { + case 'image/jpeg': + return function_exists('imagecreatefromjpeg'); + case 'image/png': + return function_exists('imagecreatefrompng'); + case 'image/gif': + return function_exists('imagecreatefromgif'); + } + } + return false; +} + +/** + * Create new GD image resource with transparency support + * + * @since 2.9.0 + * + * @param int $width Image width + * @param int $height Image height + * @return image resource + */ +function wp_imagecreatetruecolor($width, $height) { + $img = imagecreatetruecolor($width, $height); + if ( is_resource($img) && function_exists('imagealphablending') && function_exists('imagesavealpha') ) { + imagealphablending($img, false); + imagesavealpha($img, true); + } + return $img; +} + +/** + * API for easily embedding rich media such as videos and images into content. + * + * @package WordPress + * @subpackage Embed + * @since 2.9.0 + */ +class WP_Embed { + var $handlers = array(); + var $post_ID; + var $usecache = true; + var $linkifunknown = true; + + /** + * Constructor + */ + function __construct() { + // Hack to get the [embed] shortcode to run before wpautop() + add_filter( 'the_content', array(&$this, 'run_shortcode'), 8 ); + + // Shortcode placeholder for strip_shortcodes() + add_shortcode( 'embed', '__return_false' ); + + // Attempts to embed all URLs in a post + if ( get_option('embed_autourls') ) + add_filter( 'the_content', array(&$this, 'autoembed'), 8 ); + + // After a post is saved, invalidate the oEmbed cache + add_action( 'save_post', array(&$this, 'delete_oembed_caches') ); + + // After a post is saved, cache oEmbed items via AJAX + add_action( 'edit_form_advanced', array(&$this, 'maybe_run_ajax_cache') ); + } + + /** + * Process the [embed] shortcode. + * + * Since the [embed] shortcode needs to be run earlier than other shortcodes, + * this function removes all existing shortcodes, registers the [embed] shortcode, + * calls {@link do_shortcode()}, and then re-registers the old shortcodes. + * + * @uses $shortcode_tags + * @uses remove_all_shortcodes() + * @uses add_shortcode() + * @uses do_shortcode() + * + * @param string $content Content to parse + * @return string Content with shortcode parsed + */ + function run_shortcode( $content ) { + global $shortcode_tags; + + // Back up current registered shortcodes and clear them all out + $orig_shortcode_tags = $shortcode_tags; + remove_all_shortcodes(); + + add_shortcode( 'embed', array(&$this, 'shortcode') ); + + // Do the shortcode (only the [embed] one is registered) + $content = do_shortcode( $content ); + + // Put the original shortcodes back + $shortcode_tags = $orig_shortcode_tags; + + return $content; + } + + /** + * If a post/page was saved, then output Javascript to make + * an AJAX request that will call WP_Embed::cache_oembed(). + */ + function maybe_run_ajax_cache() { + global $post_ID; + + if ( empty($post_ID) || empty($_GET['message']) || 1 != $_GET['message'] ) + return; + +?> + +handlers[$priority][$id] = array( + 'regex' => $regex, + 'callback' => $callback, + ); + } + + /** + * Unregister a previously registered embed handler. Do not use this function directly, use {@link wp_embed_unregister_handler()} instead. + * + * @param string $id The handler ID that should be removed. + * @param int $priority Optional. The priority of the handler to be removed (default: 10). + */ + function unregister_handler( $id, $priority = 10 ) { + if ( isset($this->handlers[$priority][$id]) ) + unset($this->handlers[$priority][$id]); + } + + /** + * The {@link do_shortcode()} callback function. + * + * Attempts to convert a URL into embed HTML. Starts by checking the URL against the regex of the registered embed handlers. + * If none of the regex matches and it's enabled, then the URL will be given to the {@link WP_oEmbed} class. + * + * @uses wp_oembed_get() + * @uses wp_parse_args() + * @uses wp_embed_defaults() + * @uses WP_Embed::maybe_make_link() + * @uses get_option() + * @uses current_user_can() + * @uses wp_cache_get() + * @uses wp_cache_set() + * @uses get_post_meta() + * @uses update_post_meta() + * + * @param array $attr Shortcode attributes. + * @param string $url The URL attempting to be embeded. + * @return string The embed HTML on success, otherwise the original URL. + */ + function shortcode( $attr, $url = '' ) { + global $post; + + if ( empty($url) ) + return ''; + + $rawattr = $attr; + $attr = wp_parse_args( $attr, wp_embed_defaults() ); + + // kses converts & into & and we need to undo this + // See http://core.trac.wordpress.org/ticket/11311 + $url = str_replace( '&', '&', $url ); + + // Look for known internal handlers + ksort( $this->handlers ); + foreach ( $this->handlers as $priority => $handlers ) { + foreach ( $handlers as $id => $handler ) { + if ( preg_match( $handler['regex'], $url, $matches ) && is_callable( $handler['callback'] ) ) { + if ( false !== $return = call_user_func( $handler['callback'], $matches, $attr, $url, $rawattr ) ) + return apply_filters( 'embed_handler_html', $return, $url, $attr ); + } + } + } + + $post_ID = ( !empty($post->ID) ) ? $post->ID : null; + if ( !empty($this->post_ID) ) // Potentially set by WP_Embed::cache_oembed() + $post_ID = $this->post_ID; + + // Unknown URL format. Let oEmbed have a go. + if ( $post_ID ) { + + // Check for a cached result (stored in the post meta) + $cachekey = '_oembed_' . md5( $url . serialize( $attr ) ); + if ( $this->usecache ) { + $cache = get_post_meta( $post_ID, $cachekey, true ); + + // Failures are cached + if ( '{{unknown}}' === $cache ) + return $this->maybe_make_link( $url ); + + if ( !empty($cache) ) + return apply_filters( 'embed_oembed_html', $cache, $url, $attr, $post_ID ); + } + + // Use oEmbed to get the HTML + $attr['discover'] = ( apply_filters('embed_oembed_discover', false) && author_can( $post_ID, 'unfiltered_html' ) ); + $html = wp_oembed_get( $url, $attr ); + + // Cache the result + $cache = ( $html ) ? $html : '{{unknown}}'; + update_post_meta( $post_ID, $cachekey, $cache ); + + // If there was a result, return it + if ( $html ) + return apply_filters( 'embed_oembed_html', $html, $url, $attr, $post_ID ); + } + + // Still unknown + return $this->maybe_make_link( $url ); + } + + /** + * Delete all oEmbed caches. + * + * @param int $post_ID Post ID to delete the caches for. + */ + function delete_oembed_caches( $post_ID ) { + $post_metas = get_post_custom_keys( $post_ID ); + if ( empty($post_metas) ) + return; + + foreach( $post_metas as $post_meta_key ) { + if ( '_oembed_' == substr( $post_meta_key, 0, 8 ) ) + delete_post_meta( $post_ID, $post_meta_key ); + } + } + + /** + * Triggers a caching of all oEmbed results. + * + * @param int $post_ID Post ID to do the caching for. + */ + function cache_oembed( $post_ID ) { + $post = get_post( $post_ID ); + + if ( empty($post->ID) || !in_array( $post->post_type, apply_filters( 'embed_cache_oembed_types', array( 'post', 'page' ) ) ) ) + return; + + // Trigger a caching + if ( !empty($post->post_content) ) { + $this->post_ID = $post->ID; + $this->usecache = false; + + $content = $this->run_shortcode( $post->post_content ); + if ( get_option('embed_autourls') ) + $this->autoembed( $content ); + + $this->usecache = true; + } + } + + /** + * Passes any unlinked URLs that are on their own line to {@link WP_Embed::shortcode()} for potential embedding. + * + * @uses WP_Embed::autoembed_callback() + * + * @param string $content The content to be searched. + * @return string Potentially modified $content. + */ + function autoembed( $content ) { + return preg_replace_callback( '|^\s*(https?://[^\s"]+)\s*$|im', array(&$this, 'autoembed_callback'), $content ); + } + + /** + * Callback function for {@link WP_Embed::autoembed()}. + * + * @uses WP_Embed::shortcode() + * + * @param array $match A regex match array. + * @return string The embed HTML on success, otherwise the original URL. + */ + function autoembed_callback( $match ) { + $oldval = $this->linkifunknown; + $this->linkifunknown = false; + $return = $this->shortcode( array(), $match[1] ); + $this->linkifunknown = $oldval; + + return "\n$return\n"; + } + + /** + * Conditionally makes a hyperlink based on an internal class variable. + * + * @param string $url URL to potentially be linked. + * @return string Linked URL or the original URL. + */ + function maybe_make_link( $url ) { + $output = ( $this->linkifunknown ) ? '' . esc_html($url) . '' : $url; + return apply_filters( 'embed_maybe_make_link', $output, $url ); + } +} +$wp_embed = new WP_Embed(); + +/** + * Register an embed handler. This function should probably only be used for sites that do not support oEmbed. + * + * @since 2.9.0 + * @see WP_Embed::register_handler() + */ +function wp_embed_register_handler( $id, $regex, $callback, $priority = 10 ) { + global $wp_embed; + $wp_embed->register_handler( $id, $regex, $callback, $priority ); +} + +/** + * Unregister a previously registered embed handler. + * + * @since 2.9.0 + * @see WP_Embed::unregister_handler() + */ +function wp_embed_unregister_handler( $id, $priority = 10 ) { + global $wp_embed; + $wp_embed->unregister_handler( $id, $priority ); +} + +/** + * Create default array of embed parameters. + * + * @since 2.9.0 + * + * @return array Default embed parameters. + */ +function wp_embed_defaults() { + if ( !empty($GLOBALS['content_width']) ) + $theme_width = (int) $GLOBALS['content_width']; + + $width = get_option('embed_size_w'); + + if ( empty($width) && !empty($theme_width) ) + $width = $theme_width; + + if ( empty($width) ) + $width = 500; + + $height = get_option('embed_size_h'); + + if ( empty($height) ) + $height = 700; + + return apply_filters( 'embed_defaults', array( + 'width' => $width, + 'height' => $height, + ) ); +} + +/** + * Based on a supplied width/height example, return the biggest possible dimensions based on the max width/height. + * + * @since 2.9.0 + * @uses wp_constrain_dimensions() This function passes the widths and the heights. + * + * @param int $example_width The width of an example embed. + * @param int $example_height The height of an example embed. + * @param int $max_width The maximum allowed width. + * @param int $max_height The maximum allowed height. + * @return array The maximum possible width and height based on the example ratio. + */ +function wp_expand_dimensions( $example_width, $example_height, $max_width, $max_height ) { + $example_width = (int) $example_width; + $example_height = (int) $example_height; + $max_width = (int) $max_width; + $max_height = (int) $max_height; + + return wp_constrain_dimensions( $example_width * 1000000, $example_height * 1000000, $max_width, $max_height ); +} + +/** + * Attempts to fetch the embed HTML for a provided URL using oEmbed. + * + * @since 2.9.0 + * @see WP_oEmbed + * + * @uses _wp_oembed_get_object() + * @uses WP_oEmbed::get_html() + * + * @param string $url The URL that should be embeded. + * @param array $args Addtional arguments and parameters. + * @return string The original URL on failure or the embed HTML on success. + */ +function wp_oembed_get( $url, $args = '' ) { + require_once( ABSPATH . WPINC . '/class-oembed.php' ); + $oembed = _wp_oembed_get_object(); + return $oembed->get_html( $url, $args ); +} + +/** + * Adds a URL format and oEmbed provider URL pair. + * + * @since 2.9.0 + * @see WP_oEmbed + * + * @uses _wp_oembed_get_object() + * + * @param string $format The format of URL that this provider can handle. You can use asterisks as wildcards. + * @param string $provider The URL to the oEmbed provider. + * @param boolean $regex Whether the $format parameter is in a regex format. + */ +function wp_oembed_add_provider( $format, $provider, $regex = false ) { + require_once( ABSPATH . WPINC . '/class-oembed.php' ); + $oembed = _wp_oembed_get_object(); + $oembed->providers[$format] = array( $provider, $regex ); +} + +/** + * Determines if default embed handlers should be loaded. + * + * Checks to make sure that the embeds library hasn't already been loaded. If + * it hasn't, then it will load the embeds library. + * + * @since 2.9.0 + */ +function wp_maybe_load_embeds() { + if ( ! apply_filters( 'load_default_embeds', true ) ) + return; + wp_embed_register_handler( 'googlevideo', '#http://video\.google\.([A-Za-z.]{2,5})/videoplay\?docid=([\d-]+)(.*?)#i', 'wp_embed_handler_googlevideo' ); +} + +/** + * The Google Video embed handler callback. Google Video does not support oEmbed. + * + * @see WP_Embed::register_handler() + * @see WP_Embed::shortcode() + * + * @param array $matches The regex matches from the provided regex when calling {@link wp_embed_register_handler()}. + * @param array $attr Embed attributes. + * @param string $url The original URL that was matched by the regex. + * @param array $rawattr The original unmodified attributes. + * @return string The embed HTML. + */ +function wp_embed_handler_googlevideo( $matches, $attr, $url, $rawattr ) { + // If the user supplied a fixed width AND height, use it + if ( !empty($rawattr['width']) && !empty($rawattr['height']) ) { + $width = (int) $rawattr['width']; + $height = (int) $rawattr['height']; + } else { + list( $width, $height ) = wp_expand_dimensions( 425, 344, $attr['width'], $attr['height'] ); + } + + return apply_filters( 'embed_googlevideo', '', $matches, $attr, $url, $rawattr ); +} + +?> \ No newline at end of file diff --git a/src/wp-includes/meta.php b/src/wp-includes/meta.php new file mode 100644 index 0000000..b24ae08 --- /dev/null +++ b/src/wp-includes/meta.php @@ -0,0 +1,610 @@ +get_var( $wpdb->prepare( + "SELECT COUNT(*) FROM $table WHERE meta_key = %s AND $column = %d", + $meta_key, $object_id ) ) ) + return false; + + $_meta_value = $meta_value; + $meta_value = maybe_serialize( $meta_value ); + + do_action( "add_{$meta_type}_meta", $object_id, $meta_key, $_meta_value ); + + $wpdb->insert( $table, array( + $column => $object_id, + 'meta_key' => $meta_key, + 'meta_value' => $meta_value + ) ); + + wp_cache_delete($object_id, $meta_type . '_meta'); + // users cache stores usermeta that must be cleared. + if ( 'user' == $meta_type ) + clean_user_cache($object_id); + + do_action( "added_{$meta_type}_meta", $wpdb->insert_id, $object_id, $meta_key, $_meta_value ); + + return true; +} + +/** + * Update metadata for the specified object. If no value already exists for the specified object + * ID and metadata key, the metadata will be added. + * + * @since 2.9.0 + * @uses $wpdb WordPress database object for queries. + * @uses do_action() Calls 'update_{$meta_type}_meta' before updating metadata with meta_id of + * metadata entry to update, object ID, meta key, and meta value + * @uses do_action() Calls 'updated_{$meta_type}_meta' after updating metadata with meta_id of + * updated metadata entry, object ID, meta key, and meta value + * + * @param string $meta_type Type of object metadata is for (e.g., comment, post, or user) + * @param int $object_id ID of the object metadata is for + * @param string $meta_key Metadata key + * @param string $meta_value Metadata value + * @param string $prev_value Optional. If specified, only update existing metadata entries with + * the specified value. Otherwise, update all entries. + * @return bool True on successful update, false on failure. + */ +function update_metadata($meta_type, $object_id, $meta_key, $meta_value, $prev_value = '') { + if ( !$meta_type || !$meta_key ) + return false; + + if ( !$object_id = absint($object_id) ) + return false; + + if ( ! $table = _get_meta_table($meta_type) ) + return false; + + global $wpdb; + + $column = esc_sql($meta_type . '_id'); + $id_column = 'user' == $meta_type ? 'umeta_id' : 'meta_id'; + + // expected_slashed ($meta_key) + $meta_key = stripslashes($meta_key); + $meta_value = stripslashes_deep($meta_value); + $meta_value = sanitize_meta( $meta_key, $meta_value, $meta_type ); + + $check = apply_filters( "update_{$meta_type}_metadata", null, $object_id, $meta_key, $meta_value, $prev_value ); + if ( null !== $check ) + return (bool) $check; + + if ( ! $meta_id = $wpdb->get_var( $wpdb->prepare( "SELECT $id_column FROM $table WHERE meta_key = %s AND $column = %d", $meta_key, $object_id ) ) ) + return add_metadata($meta_type, $object_id, $meta_key, $meta_value); + + // Compare existing value to new value if no prev value given and the key exists only once. + if ( empty($prev_value) ) { + $old_value = get_metadata($meta_type, $object_id, $meta_key); + if ( count($old_value) == 1 ) { + if ( $old_value[0] === $meta_value ) + return false; + } + } + + $_meta_value = $meta_value; + $meta_value = maybe_serialize( $meta_value ); + + $data = compact( 'meta_value' ); + $where = array( $column => $object_id, 'meta_key' => $meta_key ); + + if ( !empty( $prev_value ) ) { + $prev_value = maybe_serialize($prev_value); + $where['meta_value'] = $prev_value; + } + + do_action( "update_{$meta_type}_meta", $meta_id, $object_id, $meta_key, $_meta_value ); + + $wpdb->update( $table, $data, $where ); + wp_cache_delete($object_id, $meta_type . '_meta'); + // users cache stores usermeta that must be cleared. + if ( 'user' == $meta_type ) + clean_user_cache($object_id); + + do_action( "updated_{$meta_type}_meta", $meta_id, $object_id, $meta_key, $_meta_value ); + + return true; +} + +/** + * Delete metadata for the specified object. + * + * @since 2.9.0 + * @uses $wpdb WordPress database object for queries. + * @uses do_action() Calls 'deleted_{$meta_type}_meta' after deleting with meta_id of + * deleted metadata entries, object ID, meta key, and meta value + * + * @param string $meta_type Type of object metadata is for (e.g., comment, post, or user) + * @param int $object_id ID of the object metadata is for + * @param string $meta_key Metadata key + * @param string $meta_value Optional. Metadata value. If specified, only delete metadata entries + * with this value. Otherwise, delete all entries with the specified meta_key. + * @param bool $delete_all Optional, default is false. If true, delete matching metadata entries + * for all objects, ignoring the specified object_id. Otherwise, only delete matching + * metadata entries for the specified object_id. + * @return bool True on successful delete, false on failure. + */ +function delete_metadata($meta_type, $object_id, $meta_key, $meta_value = '', $delete_all = false) { + if ( !$meta_type || !$meta_key ) + return false; + + if ( (!$object_id = absint($object_id)) && !$delete_all ) + return false; + + if ( ! $table = _get_meta_table($meta_type) ) + return false; + + global $wpdb; + + $type_column = esc_sql($meta_type . '_id'); + $id_column = 'user' == $meta_type ? 'umeta_id' : 'meta_id'; + // expected_slashed ($meta_key) + $meta_key = stripslashes($meta_key); + $meta_value = stripslashes_deep($meta_value); + + $check = apply_filters( "delete_{$meta_type}_metadata", null, $object_id, $meta_key, $meta_value, $delete_all ); + if ( null !== $check ) + return (bool) $check; + + $_meta_value = $meta_value; + $meta_value = maybe_serialize( $meta_value ); + + $query = $wpdb->prepare( "SELECT $id_column FROM $table WHERE meta_key = %s", $meta_key ); + + if ( !$delete_all ) + $query .= $wpdb->prepare(" AND $type_column = %d", $object_id ); + + if ( $meta_value ) + $query .= $wpdb->prepare(" AND meta_value = %s", $meta_value ); + + $meta_ids = $wpdb->get_col( $query ); + if ( !count( $meta_ids ) ) + return false; + + do_action( "delete_{$meta_type}_meta", $meta_ids, $object_id, $meta_key, $_meta_value ); + + $query = "DELETE FROM $table WHERE $id_column IN( " . implode( ',', $meta_ids ) . " )"; + + $count = $wpdb->query($query); + + if ( !$count ) + return false; + + wp_cache_delete($object_id, $meta_type . '_meta'); + // users cache stores usermeta that must be cleared. + if ( 'user' == $meta_type ) + clean_user_cache($object_id); + + do_action( "deleted_{$meta_type}_meta", $meta_ids, $object_id, $meta_key, $_meta_value ); + + return true; +} + +/** + * Retrieve metadata for the specified object. + * + * @since 2.9.0 + * + * @param string $meta_type Type of object metadata is for (e.g., comment, post, or user) + * @param int $object_id ID of the object metadata is for + * @param string $meta_key Optional. Metadata key. If not specified, retrieve all metadata for + * the specified object. + * @param bool $single Optional, default is false. If true, return only the first value of the + * specified meta_key. This parameter has no effect if meta_key is not specified. + * @return string|array Single metadata value, or array of values + */ +function get_metadata($meta_type, $object_id, $meta_key = '', $single = false) { + if ( !$meta_type ) + return false; + + if ( !$object_id = absint($object_id) ) + return false; + + $check = apply_filters( "get_{$meta_type}_metadata", null, $object_id, $meta_key, $single ); + if ( null !== $check ) { + if ( $single && is_array( $check ) ) + return $check[0]; + else + return $check; + } + + $meta_cache = wp_cache_get($object_id, $meta_type . '_meta'); + + if ( !$meta_cache ) { + $meta_cache = update_meta_cache( $meta_type, array( $object_id ) ); + $meta_cache = $meta_cache[$object_id]; + } + + if ( !$meta_key ) + return $meta_cache; + + if ( isset($meta_cache[$meta_key]) ) { + if ( $single ) + return maybe_unserialize( $meta_cache[$meta_key][0] ); + else + return array_map('maybe_unserialize', $meta_cache[$meta_key]); + } + + if ($single) + return ''; + else + return array(); +} + +/** + * Update the metadata cache for the specified objects. + * + * @since 2.9.0 + * @uses $wpdb WordPress database object for queries. + * + * @param string $meta_type Type of object metadata is for (e.g., comment, post, or user) + * @param int|array $object_ids array or comma delimited list of object IDs to update cache for + * @return mixed Metadata cache for the specified objects, or false on failure. + */ +function update_meta_cache($meta_type, $object_ids) { + if ( empty( $meta_type ) || empty( $object_ids ) ) + return false; + + if ( ! $table = _get_meta_table($meta_type) ) + return false; + + $column = esc_sql($meta_type . '_id'); + + global $wpdb; + + if ( !is_array($object_ids) ) { + $object_ids = preg_replace('|[^0-9,]|', '', $object_ids); + $object_ids = explode(',', $object_ids); + } + + $object_ids = array_map('intval', $object_ids); + + $cache_key = $meta_type . '_meta'; + $ids = array(); + $cache = array(); + foreach ( $object_ids as $id ) { + $cached_object = wp_cache_get( $id, $cache_key ); + if ( false === $cached_object ) + $ids[] = $id; + else + $cache[$id] = $cached_object; + } + + if ( empty( $ids ) ) + return $cache; + + // Get meta info + $id_list = join(',', $ids); + $meta_list = $wpdb->get_results( $wpdb->prepare("SELECT $column, meta_key, meta_value FROM $table WHERE $column IN ($id_list)", + $meta_type), ARRAY_A ); + + if ( !empty($meta_list) ) { + foreach ( $meta_list as $metarow) { + $mpid = intval($metarow[$column]); + $mkey = $metarow['meta_key']; + $mval = $metarow['meta_value']; + + // Force subkeys to be array type: + if ( !isset($cache[$mpid]) || !is_array($cache[$mpid]) ) + $cache[$mpid] = array(); + if ( !isset($cache[$mpid][$mkey]) || !is_array($cache[$mpid][$mkey]) ) + $cache[$mpid][$mkey] = array(); + + // Add a value to the current pid/key: + $cache[$mpid][$mkey][] = $mval; + } + } + + foreach ( $ids as $id ) { + if ( ! isset($cache[$id]) ) + $cache[$id] = array(); + wp_cache_add( $id, $cache[$id], $cache_key ); + } + + return $cache; +} + +/** + * Given a meta query, generates SQL clauses to be appended to a main query + * + * @since 3.2.0 + * + * @see WP_Meta_Query + * + * @param array (optional) $meta_query A meta query + * @param string $type Type of meta + * @param string $primary_table + * @param string $primary_id_column + * @param object $context (optional) The main query object + * @return array( 'join' => $join_sql, 'where' => $where_sql ) + */ +function get_meta_sql( $meta_query = false, $type, $primary_table, $primary_id_column, $context = null ) { + $meta_query_obj = new WP_Meta_Query( $meta_query ); + return $meta_query_obj->get_sql( $type, $primary_table, $primary_id_column, $context ); +} + +/** + * Container class for a multiple metadata query + * + * @since 3.2.0 + */ +class WP_Meta_Query { + /** + * List of metadata queries. A single query is an associative array: + * - 'key' string The meta key + * - 'value' string|array The meta value + * - 'compare' (optional) string How to compare the key to the value. + * Possible values: '=', '!=', '>', '>=', '<', '<=', 'LIKE', 'NOT LIKE', 'IN', 'NOT IN', 'BETWEEN', 'NOT BETWEEN'. + * Default: '=' + * - 'type' string (optional) The type of the value. + * Possible values: 'NUMERIC', 'BINARY', 'CHAR', 'DATE', 'DATETIME', 'DECIMAL', 'SIGNED', 'TIME', 'UNSIGNED'. + * Default: 'CHAR' + * + * @since 3.2.0 + * @access public + * @var array + */ + public $queries = array(); + + /** + * The relation between the queries. Can be one of 'AND' or 'OR'. + * + * @since 3.2.0 + * @access public + * @var string + */ + public $relation; + + /** + * Constructor + * + * @param array (optional) $meta_query A meta query + */ + function __construct( $meta_query = false ) { + if ( !$meta_query ) + return; + + if ( isset( $meta_query['relation'] ) && strtoupper( $meta_query['relation'] ) == 'OR' ) { + $this->relation = 'OR'; + } else { + $this->relation = 'AND'; + } + + $this->queries = array(); + + foreach ( $meta_query as $key => $query ) { + if ( ! is_array( $query ) ) + continue; + + $this->queries[] = $query; + } + } + + /** + * Constructs a meta query based on 'meta_*' query vars + * + * @since 3.2.0 + * @access public + * + * @param array $qv The query variables + */ + function parse_query_vars( $qv ) { + $meta_query = array(); + + // Simple query needs to be first for orderby=meta_value to work correctly + foreach ( array( 'key', 'compare', 'type' ) as $key ) { + if ( !empty( $qv[ "meta_$key" ] ) ) + $meta_query[0][ $key ] = $qv[ "meta_$key" ]; + } + + // WP_Query sets 'meta_value' = '' by default + if ( isset( $qv[ 'meta_value' ] ) && '' !== $qv[ 'meta_value' ] ) + $meta_query[0]['value'] = $qv[ 'meta_value' ]; + + if ( !empty( $qv['meta_query'] ) && is_array( $qv['meta_query'] ) ) { + $meta_query = array_merge( $meta_query, $qv['meta_query'] ); + } + + $this->__construct( $meta_query ); + } + + /** + * Generates SQL clauses to be appended to a main query. + * + * @since 3.2.0 + * @access public + * + * @param string $type Type of meta + * @param string $primary_table + * @param string $primary_id_column + * @param object $context (optional) The main query object + * @return array( 'join' => $join_sql, 'where' => $where_sql ) + */ + function get_sql( $type, $primary_table, $primary_id_column, $context = null ) { + global $wpdb; + + if ( ! $meta_table = _get_meta_table( $type ) ) + return false; + + $meta_id_column = esc_sql( $type . '_id' ); + + $join = array(); + $where = array(); + + foreach ( $this->queries as $k => $q ) { + $meta_key = isset( $q['key'] ) ? trim( $q['key'] ) : ''; + $meta_compare = isset( $q['compare'] ) ? strtoupper( $q['compare'] ) : '='; + $meta_type = isset( $q['type'] ) ? strtoupper( $q['type'] ) : 'CHAR'; + + if ( ! in_array( $meta_compare, array( '=', '!=', '>', '>=', '<', '<=', 'LIKE', 'NOT LIKE', 'IN', 'NOT IN', 'BETWEEN', 'NOT BETWEEN' ) ) ) + $meta_compare = '='; + + if ( 'NUMERIC' == $meta_type ) + $meta_type = 'SIGNED'; + elseif ( ! in_array( $meta_type, array( 'BINARY', 'CHAR', 'DATE', 'DATETIME', 'DECIMAL', 'SIGNED', 'TIME', 'UNSIGNED' ) ) ) + $meta_type = 'CHAR'; + + $i = count( $join ); + $alias = $i ? 'mt' . $i : $meta_table; + + // Set JOIN + $join[$i] = "INNER JOIN $meta_table"; + $join[$i] .= $i ? " AS $alias" : ''; + $join[$i] .= " ON ($primary_table.$primary_id_column = $alias.$meta_id_column)"; + + $where[$k] = ''; + if ( !empty( $meta_key ) ) + $where[$k] = $wpdb->prepare( "$alias.meta_key = %s", $meta_key ); + + if ( !isset( $q['value'] ) ) { + if ( empty( $where[$k] ) ) + unset( $join[$i] ); + continue; + } + + $meta_value = $q['value']; + + if ( in_array( $meta_compare, array( 'IN', 'NOT IN', 'BETWEEN', 'NOT BETWEEN' ) ) ) { + if ( ! is_array( $meta_value ) ) + $meta_value = preg_split( '/[,\s]+/', $meta_value ); + + if ( empty( $meta_value ) ) { + unset( $join[$i] ); + continue; + } + } else { + $meta_value = trim( $meta_value ); + } + + if ( 'IN' == substr( $meta_compare, -2) ) { + $meta_compare_string = '(' . substr( str_repeat( ',%s', count( $meta_value ) ), 1 ) . ')'; + } elseif ( 'BETWEEN' == substr( $meta_compare, -7) ) { + $meta_value = array_slice( $meta_value, 0, 2 ); + $meta_compare_string = '%s AND %s'; + } elseif ( 'LIKE' == substr( $meta_compare, -4 ) ) { + $meta_value = '%' . like_escape( $meta_value ) . '%'; + $meta_compare_string = '%s'; + } else { + $meta_compare_string = '%s'; + } + + if ( ! empty( $where[$k] ) ) + $where[$k] .= ' AND '; + + $where[$k] = ' (' . $where[$k] . $wpdb->prepare( "CAST($alias.meta_value AS {$meta_type}) {$meta_compare} {$meta_compare_string})", $meta_value ); + } + + $where = array_filter( $where ); + + if ( empty( $where ) ) + $where = ''; + else + $where = ' AND (' . implode( "\n{$this->relation} ", $where ) . ' )'; + + $join = implode( "\n", $join ); + if ( ! empty( $join ) ) + $join = ' ' . $join; + + return apply_filters_ref_array( 'get_meta_sql', array( compact( 'join', 'where' ), $this->queries, $type, $primary_table, $primary_id_column, $context ) ); + } +} + +/** + * Retrieve the name of the metadata table for the specified object type. + * + * @since 2.9.0 + * @uses $wpdb WordPress database object for queries. + * + * @param string $type Type of object to get metadata table for (e.g., comment, post, or user) + * @return mixed Metadata table name, or false if no metadata table exists + */ +function _get_meta_table($type) { + global $wpdb; + + $table_name = $type . 'meta'; + + if ( empty($wpdb->$table_name) ) + return false; + + return $wpdb->$table_name; +} + +/** + * Determine whether a meta key is protected + * + * @since 3.1.3 + * + * @param string $meta_key Meta key + * @return bool True if the key is protected, false otherwise. + */ +function is_protected_meta( $meta_key, $meta_type = null ) { + $protected = ( '_' == $meta_key[0] ); + + return apply_filters( 'is_protected_meta', $protected, $meta_key, $meta_type ); +} + +/** + * Sanitize meta value + * + * @since 3.1.3 + * + * @param string $meta_key Meta key + * @param mixed $meta_value Meta value to sanitize + * @param string $meta_type Type of meta + * @return mixed Sanitized $meta_value + */ +function sanitize_meta( $meta_key, $meta_value, $meta_type = null ) { + return apply_filters( 'sanitize_meta', $meta_value, $meta_key, $meta_type ); +} + +?> diff --git a/src/wp-includes/ms-blogs.php b/src/wp-includes/ms-blogs.php new file mode 100644 index 0000000..1c483e1 --- /dev/null +++ b/src/wp-includes/ms-blogs.php @@ -0,0 +1,681 @@ +update( $wpdb->blogs, array('last_updated' => current_time('mysql', true)), array('blog_id' => $wpdb->blogid) ); + refresh_blog_details( $wpdb->blogid ); + + do_action( 'wpmu_blog_updated', $wpdb->blogid ); +} + +/** + * Get a full blog URL, given a blog id. + * + * @since MU + * + * @param int $blog_id Blog ID + * @return string + */ +function get_blogaddress_by_id( $blog_id ) { + $bloginfo = get_blog_details( (int) $blog_id, false ); // only get bare details! + return esc_url( 'http://' . $bloginfo->domain . $bloginfo->path ); +} + +/** + * Get a full blog URL, given a blog name. + * + * @since MU + * + * @param string $blogname The (subdomain or directory) name + * @return string + */ +function get_blogaddress_by_name( $blogname ) { + global $current_site; + + if ( is_subdomain_install() ) { + if ( $blogname == 'main' ) + $blogname = 'www'; + $url = rtrim( network_home_url(), '/' ); + if ( !empty( $blogname ) ) + $url = preg_replace( '|^([^\.]+://)|', '$1' . $blogname . '.', $url ); + } else { + $url = network_home_url( $blogname ); + } + return esc_url( $url . '/' ); +} + +/** + * Get a full blog URL, given a domain and a path. + * + * @since MU + * + * @param string $domain + * @param string $path + * @return string + */ +function get_blogaddress_by_domain( $domain, $path ) { + if ( is_subdomain_install() ) { + $url = "http://" . $domain.$path; + } else { + if ( $domain != $_SERVER['HTTP_HOST'] ) { + $blogname = substr( $domain, 0, strpos( $domain, '.' ) ); + $url = 'http://' . substr( $domain, strpos( $domain, '.' ) + 1 ) . $path; + // we're not installing the main blog + if ( $blogname != 'www.' ) + $url .= $blogname . '/'; + } else { // main blog + $url = 'http://' . $domain . $path; + } + } + return esc_url( $url ); +} + +/** + * Given a blog's (subdomain or directory) name, retrieve it's id. + * + * @since MU + * + * @param string $name + * @return int A blog id + */ +function get_id_from_blogname( $name ) { + global $wpdb, $current_site; + $blog_id = wp_cache_get( 'get_id_from_blogname_' . $name, 'blog-details' ); + if ( $blog_id ) + return $blog_id; + + if ( is_subdomain_install() ) { + $domain = $name . '.' . $current_site->domain; + $path = $current_site->path; + } else { + $domain = $current_site->domain; + $path = $current_site->path . $name . '/'; + } + $blog_id = $wpdb->get_var( $wpdb->prepare("SELECT blog_id FROM {$wpdb->blogs} WHERE domain = %s AND path = %s", $domain, $path) ); + wp_cache_set( 'get_id_from_blogname_' . $name, $blog_id, 'blog-details' ); + return $blog_id; +} + +/** + * Retrieve the details for a blog from the blogs table and blog options. + * + * @since MU + * + * @param int|string|array $fields A blog ID, a blog name, or an array of fields to query against. + * @param bool $get_all Whether to retrieve all details or only the details in the blogs table. Default is true. + * @return object Blog details. + */ +function get_blog_details( $fields, $get_all = true ) { + global $wpdb; + + if ( is_array($fields ) ) { + if ( isset($fields['blog_id']) ) { + $blog_id = $fields['blog_id']; + } elseif ( isset($fields['domain']) && isset($fields['path']) ) { + $key = md5( $fields['domain'] . $fields['path'] ); + $blog = wp_cache_get($key, 'blog-lookup'); + if ( false !== $blog ) + return $blog; + if ( substr( $fields['domain'], 0, 4 ) == 'www.' ) { + $nowww = substr( $fields['domain'], 4 ); + $blog = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->blogs WHERE domain IN (%s,%s) AND path = %s ORDER BY CHAR_LENGTH(domain) DESC", $nowww, $fields['domain'], $fields['path'] ) ); + } else { + $blog = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->blogs WHERE domain = %s AND path = %s", $fields['domain'], $fields['path'] ) ); + } + if ( $blog ) { + wp_cache_set($blog->blog_id . 'short', $blog, 'blog-details'); + $blog_id = $blog->blog_id; + } else { + return false; + } + } elseif ( isset($fields['domain']) && is_subdomain_install() ) { + $key = md5( $fields['domain'] ); + $blog = wp_cache_get($key, 'blog-lookup'); + if ( false !== $blog ) + return $blog; + if ( substr( $fields['domain'], 0, 4 ) == 'www.' ) { + $nowww = substr( $fields['domain'], 4 ); + $blog = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->blogs WHERE domain IN (%s,%s) ORDER BY CHAR_LENGTH(domain) DESC", $nowww, $fields['domain'] ) ); + } else { + $blog = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->blogs WHERE domain = %s", $fields['domain'] ) ); + } + if ( $blog ) { + wp_cache_set($blog->blog_id . 'short', $blog, 'blog-details'); + $blog_id = $blog->blog_id; + } else { + return false; + } + } else { + return false; + } + } else { + if ( !is_numeric( $fields ) ) + $blog_id = get_id_from_blogname( $fields ); + else + $blog_id = $fields; + } + + $blog_id = (int) $blog_id; + + $all = $get_all == true ? '' : 'short'; + $details = wp_cache_get( $blog_id . $all, 'blog-details' ); + + if ( $details ) { + if ( ! is_object( $details ) ) { + if ( $details == -1 ) { + return false; + } else { + // Clear old pre-serialized objects. Cache clients do better with that. + wp_cache_delete( $blog_id . $all, 'blog-details' ); + unset($details); + } + } else { + return $details; + } + } + + // Try the other cache. + if ( $get_all ) { + $details = wp_cache_get( $blog_id . 'short', 'blog-details' ); + } else { + $details = wp_cache_get( $blog_id, 'blog-details' ); + // If short was requested and full cache is set, we can return. + if ( $details ) { + if ( ! is_object( $details ) ) { + if ( $details == -1 ) { + return false; + } else { + // Clear old pre-serialized objects. Cache clients do better with that. + wp_cache_delete( $blog_id, 'blog-details' ); + unset($details); + } + } else { + return $details; + } + } + } + + if ( empty($details) ) { + $details = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->blogs WHERE blog_id = %d /* get_blog_details */", $blog_id ) ); + if ( ! $details ) { + // Set the full cache. + wp_cache_set( $blog_id, -1, 'blog-details' ); + return false; + } + } + + if ( ! $get_all ) { + wp_cache_set( $blog_id . $all, $details, 'blog-details' ); + return $details; + } + + $details->blogname = get_blog_option( $blog_id, 'blogname' ); + $details->siteurl = get_blog_option( $blog_id, 'siteurl' ); + $details->post_count = get_blog_option( $blog_id, 'post_count' ); + + $details = apply_filters( 'blog_details', $details ); + + wp_cache_set( $blog_id . $all, $details, 'blog-details' ); + + $key = md5( $details->domain . $details->path ); + wp_cache_set( $key, $details, 'blog-lookup' ); + + return $details; +} + +/** + * Clear the blog details cache. + * + * @since MU + * + * @param int $blog_id Blog ID + */ +function refresh_blog_details( $blog_id ) { + $blog_id = (int) $blog_id; + $details = get_blog_details( $blog_id, false ); + + wp_cache_delete( $blog_id , 'blog-details' ); + wp_cache_delete( $blog_id . 'short' , 'blog-details' ); + wp_cache_delete( md5( $details->domain . $details->path ) , 'blog-lookup' ); + wp_cache_delete( 'current_blog_' . $details->domain, 'site-options' ); + wp_cache_delete( 'current_blog_' . $details->domain . $details->path, 'site-options' ); +} + +/** + * Update the details for a blog. Updates the blogs table for a given blog id. + * + * @since MU + * + * @param int $blog_id Blog ID + * @param array $details Array of details keyed by blogs table field names. + * @return bool True if update succeeds, false otherwise. + */ +function update_blog_details( $blog_id, $details = array() ) { + global $wpdb; + + if ( empty($details) ) + return false; + + if ( is_object($details) ) + $details = get_object_vars($details); + + $current_details = get_blog_details($blog_id, false); + if ( empty($current_details) ) + return false; + + $current_details = get_object_vars($current_details); + + $details = array_merge($current_details, $details); + $details['last_updated'] = current_time('mysql', true); + + $update_details = array(); + $fields = array( 'site_id', 'domain', 'path', 'registered', 'last_updated', 'public', 'archived', 'mature', 'spam', 'deleted', 'lang_id'); + foreach ( array_intersect( array_keys( $details ), $fields ) as $field ) + $update_details[$field] = $details[$field]; + + $wpdb->update( $wpdb->blogs, $update_details, array('blog_id' => $blog_id) ); + + // If spam status changed, issue actions. + if ( $details[ 'spam' ] != $current_details[ 'spam' ] ) { + if ( $details[ 'spam' ] == 1 ) + do_action( "make_spam_blog", $blog_id ); + else + do_action( "make_ham_blog", $blog_id ); + } + + if ( isset($details[ 'public' ]) ) + update_blog_option( $blog_id, 'blog_public', $details[ 'public' ] ); + + refresh_blog_details($blog_id); + + return true; +} + +/** + * Retrieve option value based on setting name and blog_id. + * + * 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. + * + * There is a filter called 'blog_option_$option' with the $option being + * replaced with the option name. The filter takes two parameters. $value and + * $blog_id. It returns $value. + * The 'option_$option' filter in get_option() is not called. + * + * @since MU + * @uses apply_filters() Calls 'blog_option_$optionname' with the option name value. + * + * @param int $blog_id is the id of the blog. + * @param string $setting Name of option to retrieve. Should already be SQL-escaped. + * @param string $default (optional) Default value returned if option not found. + * @return mixed Value set for the option. + */ +function get_blog_option( $blog_id, $setting, $default = false ) { + global $wpdb; + + $key = $blog_id . '-' . $setting . '-blog_option'; + $value = wp_cache_get( $key, 'site-options' ); + if ( $value == null ) { + if ( $blog_id == $wpdb->blogid ) { + $value = get_option( $setting, $default ); + $notoptions = wp_cache_get( 'notoptions', 'options' ); + if ( isset( $notoptions[$setting] ) ) { + wp_cache_set( $key, 'noop', 'site-options' ); + $value = $default; + } elseif ( $value == false ) { + wp_cache_set( $key, 'falsevalue', 'site-options' ); + } else { + wp_cache_set( $key, $value, 'site-options' ); + } + return apply_filters( 'blog_option_' . $setting, $value, $blog_id ); + } else { + $blog_prefix = $wpdb->get_blog_prefix( $blog_id ); + $row = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$blog_prefix}options WHERE option_name = %s", $setting ) ); + if ( is_object( $row ) ) { // Has to be get_row instead of get_var because of funkiness with 0, false, null values + $value = $row->option_value; + if ( $value == false ) + wp_cache_set( $key, 'falsevalue', 'site-options' ); + else + wp_cache_set( $key, $value, 'site-options' ); + } else { // option does not exist, so we must cache its non-existence + wp_cache_set( $key, 'noop', 'site-options' ); + $value = $default; + } + } + } elseif ( $value == 'noop' ) { + $value = $default; + } elseif ( $value == 'falsevalue' ) { + $value = false; + } + // If home is not set use siteurl. + if ( 'home' == $setting && '' == $value ) + return get_blog_option( $blog_id, 'siteurl' ); + + if ( 'siteurl' == $setting || 'home' == $setting || 'category_base' == $setting ) + $value = untrailingslashit( $value ); + + return apply_filters( 'blog_option_' . $setting, maybe_unserialize( $value ), $blog_id ); +} + +/** + * Add an option for a particular blog. + * + * @since MU + * + * @param int $id The blog id + * @param string $key The option key + * @param mixed $value The option value + */ +function add_blog_option( $id, $key, $value ) { + $id = (int) $id; + + switch_to_blog($id); + add_option( $key, $value ); + restore_current_blog(); + wp_cache_set( $id . '-' . $key . '-blog_option', $value, 'site-options' ); +} + +/** + * Delete an option for a particular blog. + * + * @since MU + * + * @param int $id The blog id + * @param string $key The option key + */ +function delete_blog_option( $id, $key ) { + $id = (int) $id; + + switch_to_blog($id); + delete_option( $key ); + restore_current_blog(); + wp_cache_set( $id . '-' . $key . '-blog_option', '', 'site-options' ); +} + +/** + * Update an option for a particular blog. + * + * @since MU + * + * @param int $id The blog id + * @param string $key The option key + * @param mixed $value The option value + */ +function update_blog_option( $id, $key, $value, $deprecated = null ) { + $id = (int) $id; + + if ( null !== $deprecated ) + _deprecated_argument( __FUNCTION__, '3.1' ); + + switch_to_blog($id); + update_option( $key, $value ); + restore_current_blog(); + + refresh_blog_details( $id ); + + wp_cache_set( $id . '-' . $key . '-blog_option', $value, 'site-options'); +} + +/** + * Switch the current blog. + * + * This function is useful if you need to pull posts, or other information, + * from other blogs. You can switch back afterwards using restore_current_blog(). + * + * Things that aren't switched: + * - autoloaded options. See #14992 + * - plugins. See #14941 + * + * @see restore_current_blog() + * @since MU + * + * @param int $new_blog The id of the blog you want to switch to. Default: current blog + * @param bool $validate Whether to check if $new_blog exists before proceeding + * @return bool True on success, False if the validation failed + */ +function switch_to_blog( $new_blog, $validate = false ) { + global $wpdb, $table_prefix, $blog_id, $switched, $switched_stack, $wp_roles, $wp_object_cache; + + if ( empty($new_blog) ) + $new_blog = $blog_id; + + if ( $validate && ! get_blog_details( $new_blog ) ) + return false; + + if ( empty($switched_stack) ) + $switched_stack = array(); + + $switched_stack[] = $blog_id; + + /* If we're switching to the same blog id that we're on, + * set the right vars, do the associated actions, but skip + * the extra unnecessary work */ + if ( $blog_id == $new_blog ) { + do_action( 'switch_blog', $blog_id, $blog_id ); + $switched = true; + return true; + } + + $wpdb->set_blog_id($new_blog); + $table_prefix = $wpdb->prefix; + $prev_blog_id = $blog_id; + $blog_id = $new_blog; + + if ( is_object( $wp_roles ) ) { + $wpdb->suppress_errors(); + if ( method_exists( $wp_roles ,'_init' ) ) + $wp_roles->_init(); + elseif ( method_exists( $wp_roles, '__construct' ) ) + $wp_roles->__construct(); + $wpdb->suppress_errors( false ); + } + + if ( did_action('init') ) { + $current_user = wp_get_current_user(); + if ( is_object( $current_user ) ) + $current_user->for_blog( $blog_id ); + } + + if ( is_object( $wp_object_cache ) && isset( $wp_object_cache->global_groups ) ) + $global_groups = $wp_object_cache->global_groups; + else + $global_groups = false; + + wp_cache_init(); + if ( function_exists('wp_cache_add_global_groups') ) { + if ( is_array( $global_groups ) ) + wp_cache_add_global_groups( $global_groups ); + else + wp_cache_add_global_groups( array( 'users', 'userlogins', 'usermeta', 'user_meta', 'site-transient', 'site-options', 'site-lookup', 'blog-lookup', 'blog-details', 'rss', 'global-posts' ) ); + wp_cache_add_non_persistent_groups(array( 'comment', 'counts', 'plugins' )); + } + + do_action('switch_blog', $blog_id, $prev_blog_id); + $switched = true; + return true; +} + +/** + * Restore the current blog, after calling switch_to_blog() + * + * @see switch_to_blog() + * @since MU + * + * @return bool True on success, False if we're already on the current blog + */ +function restore_current_blog() { + global $table_prefix, $wpdb, $blog_id, $switched, $switched_stack, $wp_roles, $wp_object_cache; + + if ( !$switched ) + return false; + + if ( !is_array( $switched_stack ) ) + return false; + + $blog = array_pop( $switched_stack ); + if ( $blog_id == $blog ) { + do_action( 'switch_blog', $blog, $blog ); + /* If we still have items in the switched stack, consider ourselves still 'switched' */ + $switched = ( is_array( $switched_stack ) && count( $switched_stack ) > 0 ); + return true; + } + + $wpdb->set_blog_id($blog); + $prev_blog_id = $blog_id; + $blog_id = $blog; + $table_prefix = $wpdb->prefix; + + if ( is_object( $wp_roles ) ) { + $wpdb->suppress_errors(); + if ( method_exists( $wp_roles ,'_init' ) ) + $wp_roles->_init(); + elseif ( method_exists( $wp_roles, '__construct' ) ) + $wp_roles->__construct(); + $wpdb->suppress_errors( false ); + } + + if ( did_action('init') ) { + $current_user = wp_get_current_user(); + if ( is_object( $current_user ) ) + $current_user->for_blog( $blog_id ); + } + + if ( is_object( $wp_object_cache ) && isset( $wp_object_cache->global_groups ) ) + $global_groups = $wp_object_cache->global_groups; + else + $global_groups = false; + + wp_cache_init(); + if ( function_exists('wp_cache_add_global_groups') ) { + if ( is_array( $global_groups ) ) + wp_cache_add_global_groups( $global_groups ); + else + wp_cache_add_global_groups( array( 'users', 'userlogins', 'usermeta', 'user_meta', 'site-transient', 'site-options', 'site-lookup', 'blog-lookup', 'blog-details', 'rss', 'global-posts' ) ); + wp_cache_add_non_persistent_groups(array( 'comment', 'counts', 'plugins' )); + } + + do_action('switch_blog', $blog_id, $prev_blog_id); + + /* If we still have items in the switched stack, consider ourselves still 'switched' */ + $switched = ( is_array( $switched_stack ) && count( $switched_stack ) > 0 ); + return true; +} + +/** + * Check if a particular blog is archived. + * + * @since MU + * + * @param int $id The blog id + * @return string Whether the blog is archived or not + */ +function is_archived( $id ) { + return get_blog_status($id, 'archived'); +} + +/** + * Update the 'archived' status of a particular blog. + * + * @since MU + * + * @param int $id The blog id + * @param string $archived The new status + * @return string $archived + */ +function update_archived( $id, $archived ) { + update_blog_status($id, 'archived', $archived); + return $archived; +} + +/** + * Update a blog details field. + * + * @since MU + * + * @param int $blog_id BLog ID + * @param string $pref A field name + * @param string $value Value for $pref + * @return string $value + */ +function update_blog_status( $blog_id, $pref, $value, $deprecated = null ) { + global $wpdb; + + if ( null !== $deprecated ) + _deprecated_argument( __FUNCTION__, '3.1' ); + + if ( !in_array( $pref, array( 'site_id', 'domain', 'path', 'registered', 'last_updated', 'public', 'archived', 'mature', 'spam', 'deleted', 'lang_id') ) ) + return $value; + + $wpdb->update( $wpdb->blogs, array($pref => $value, 'last_updated' => current_time('mysql', true)), array('blog_id' => $blog_id) ); + + refresh_blog_details($blog_id); + + if ( 'spam' == $pref ) + ( $value == 1 ) ? do_action( 'make_spam_blog', $blog_id ) : do_action( 'make_ham_blog', $blog_id ); + elseif ( 'mature' == $pref ) + ( $value == 1 ) ? do_action( 'mature_blog', $blog_id ) : do_action( 'unmature_blog', $blog_id ); + elseif ( 'archived' == $pref ) + ( $value == 1 ) ? do_action( 'archive_blog', $blog_id ) : do_action( 'unarchive_blog', $blog_id ); + elseif ( 'archived' == $pref ) + ( $value == 1 ) ? do_action( 'archive_blog', $blog_id ) : do_action( 'unarchive_blog', $blog_id ); + + return $value; +} + +/** + * Get a blog details field. + * + * @since MU + * + * @param int $id The blog id + * @param string $pref A field name + * @return bool $value + */ +function get_blog_status( $id, $pref ) { + global $wpdb; + + $details = get_blog_details( $id, false ); + if ( $details ) + return $details->$pref; + + return $wpdb->get_var( $wpdb->prepare("SELECT %s FROM {$wpdb->blogs} WHERE blog_id = %d", $pref, $id) ); +} + +/** + * Get a list of most recently updated blogs. + * + * @since MU + * + * @param mixed $deprecated Not used + * @param int $start The offset + * @param int $quantity The maximum number of blogs to retrieve. Default is 40. + * @return array The list of blogs + */ +function get_last_updated( $deprecated = '', $start = 0, $quantity = 40 ) { + global $wpdb; + + if ( ! empty( $deprecated ) ) + _deprecated_argument( __FUNCTION__, 'MU' ); // never used + + return $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' AND last_updated != '0000-00-00 00:00:00' ORDER BY last_updated DESC limit %d, %d", $wpdb->siteid, $start, $quantity ) , ARRAY_A ); +} + +?> diff --git a/src/wp-includes/ms-default-constants.php b/src/wp-includes/ms-default-constants.php new file mode 100644 index 0000000..12dc661 --- /dev/null +++ b/src/wp-includes/ms-default-constants.php @@ -0,0 +1,140 @@ +blogid}/files/" ); + if ( 'wp-content/blogs.dir' == UPLOADBLOGSDIR ) + define( 'BLOGUPLOADDIR', WP_CONTENT_DIR . "/blogs.dir/{$wpdb->blogid}/files/" ); + } +} + +/** + * Defines Multisite cookie constants. + * + * @since 3.0.0 + */ +function ms_cookie_constants( ) { + global $current_site; + + /** + * @since 1.2.0 + */ + if ( !defined( 'COOKIEPATH' ) ) + define( 'COOKIEPATH', $current_site->path ); + + /** + * @since 1.5.0 + */ + if ( !defined( 'SITECOOKIEPATH' ) ) + define( 'SITECOOKIEPATH', $current_site->path ); + + /** + * @since 2.6.0 + */ + if ( !defined( 'ADMIN_COOKIE_PATH' ) ) { + if( !is_subdomain_install() ) { + define( 'ADMIN_COOKIE_PATH', SITECOOKIEPATH ); + } else { + define( 'ADMIN_COOKIE_PATH', SITECOOKIEPATH . 'wp-admin' ); + } + } + + /** + * @since 2.0.0 + */ + if ( !defined('COOKIE_DOMAIN') && is_subdomain_install() ) { + if ( !empty( $current_site->cookie_domain ) ) + define('COOKIE_DOMAIN', '.' . $current_site->cookie_domain); + else + define('COOKIE_DOMAIN', '.' . $current_site->domain); + } +} + +/** + * Defines Multisite file constants. + * + * @since 3.0.0 + */ +function ms_file_constants( ) { + /** + * Optional support for X-Sendfile header + * @since 3.0.0 + */ + if ( !defined( 'WPMU_SENDFILE' ) ) + define( 'WPMU_SENDFILE', false ); + + /** + * Optional support for X-Accel-Redirect header + * @since 3.0.0 + */ + if ( !defined( 'WPMU_ACCEL_REDIRECT' ) ) + define( 'WPMU_ACCEL_REDIRECT', false ); +} + +/** + * Defines Multisite subdomain constants and handles warnings and notices. + * + * VHOST is deprecated in favor of SUBDOMAIN_INSTALL, which is a bool. + * + * On first call, the constants are checked and defined. On second call, + * we will have translations loaded and can trigger warnings easily. + * + * @since 3.0.0 + */ +function ms_subdomain_constants() { + static $error = null; + static $error_warn = false; + + if ( false === $error ) + return; + + if ( $error ) { + $vhost_deprecated = __( 'The constant VHOST is deprecated. Use the boolean constant SUBDOMAIN_INSTALL in wp-config.php to enable a subdomain configuration. Use is_subdomain_install() to check whether a subdomain configuration is enabled.' ); + if ( $error_warn ) { + trigger_error( __( 'Conflicting values for the constants VHOST and SUBDOMAIN_INSTALL. The value of SUBDOMAIN_INSTALL will be assumed to be your subdomain configuration setting.' ) . ' ' . $vhost_deprecated, E_USER_WARNING ); + } else { + _deprecated_argument( 'define()', '3.0', $vhost_deprecated ); + } + return; + } + + if ( defined( 'SUBDOMAIN_INSTALL' ) && defined( 'VHOST' ) ) { + if ( SUBDOMAIN_INSTALL == ( 'yes' == VHOST ) ) { + $error = true; + } else { + $error = $error_warn = true; + } + } elseif ( defined( 'SUBDOMAIN_INSTALL' ) ) { + define( 'VHOST', SUBDOMAIN_INSTALL ? 'yes' : 'no' ); + } elseif ( defined( 'VHOST' ) ) { + $error = true; + define( 'SUBDOMAIN_INSTALL', 'yes' == VHOST ); + } else { + define( 'SUBDOMAIN_INSTALL', false ); + define( 'VHOST', 'no' ); + } +} +add_action( 'init', 'ms_subdomain_constants' ); + +?> diff --git a/src/wp-includes/ms-default-filters.php b/src/wp-includes/ms-default-filters.php new file mode 100644 index 0000000..e533252 --- /dev/null +++ b/src/wp-includes/ms-default-filters.php @@ -0,0 +1,66 @@ + diff --git a/src/wp-includes/ms-deprecated.php b/src/wp-includes/ms-deprecated.php new file mode 100644 index 0000000..a7f7eb2 --- /dev/null +++ b/src/wp-includes/ms-deprecated.php @@ -0,0 +1,203 @@ +ID ) ) + return false; + $user_id = $user->ID; + } + + return is_super_admin( $user_id ); +} + +if ( !function_exists( 'graceful_fail' ) ) : +/** + * @since MU + * @deprecated 3.0.0 + * @deprecated Use wp_die() + * @see wp_die() + */ +function graceful_fail( $message ) { + _deprecated_function( __FUNCTION__, '3.0', 'wp_die()' ); + $message = apply_filters( 'graceful_fail', $message ); + $message_template = apply_filters( 'graceful_fail_template', +' + + +Error! + + + +

            %s

            + +' ); + die( sprintf( $message_template, $message ) ); +} +endif; + +/** + * @since MU + * @deprecated 3.0.0 + * @deprecated Use get_user_by() + * @see get_user_by() + */ +function get_user_details( $username ) { + _deprecated_function( __FUNCTION__, '3.0', 'get_user_by()' ); + return get_user_by('login', $username); +} + +/** + * @since MU + * @deprecated 3.0.0 + * @deprecated Use clean_post_cache() + * @see clean_post_cache() + */ +function clear_global_post_cache( $post_id ) { + _deprecated_function( __FUNCTION__, '3.0', 'clean_post_cache()' ); +} + +/** + * @since MU + * @deprecated 3.0.0 + * @deprecated Use is_main_site() + * @see is_main_site() + */ +function is_main_blog() { + _deprecated_function( __FUNCTION__, '3.0', 'is_main_site()' ); + return is_main_site(); +} + +/** + * @since MU + * @deprecated 3.0.0 + * @deprecated Use is_email() + * @see is_email() + */ +function validate_email( $email, $check_domain = true) { + _deprecated_function( __FUNCTION__, '3.0', 'is_email()' ); + return is_email( $email, $check_domain ); +} + +/** + * @since MU + * @deprecated 3.0.0 + * @deprecated No alternative available. For performance reasons this function is not recommended. + */ +function get_blog_list( $start = 0, $num = 10, $deprecated = '' ) { + _deprecated_function( __FUNCTION__, '3.0' ); + + global $wpdb; + $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->get_blog_prefix( $details['blog_id'] ). "posts WHERE post_status='publish' AND post_type='post'" ); + } + unset( $blogs ); + $blogs = $blog_list; + + if ( false == is_array( $blogs ) ) + return array(); + + if ( $num == 'all' ) + return array_slice( $blogs, $start, count( $blogs ) ); + else + return array_slice( $blogs, $start, $num ); +} + +/** + * @since MU + * @deprecated 3.0.0 + * @deprecated No alternative available. For performance reasons this function is not recommended. + */ +function get_most_active_blogs( $num = 10, $display = true ) { + _deprecated_function( __FUNCTION__, '3.0' ); + + $blogs = get_blog_list( 0, 'all', false ); // $blog_id -> $details + if ( is_array( $blogs ) ) { + reset( $blogs ); + foreach ( (array) $blogs as $key => $details ) { + $most_active[ $details['blog_id'] ] = $details['postcount']; + $blog_list[ $details['blog_id'] ] = $details; // array_slice() removes keys!! + } + arsort( $most_active ); + reset( $most_active ); + foreach ( (array) $most_active as $key => $details ) + $t[ $key ] = $blog_list[ $key ]; + + unset( $most_active ); + $most_active = $t; + } + + if ( $display == true ) { + if ( is_array( $most_active ) ) { + reset( $most_active ); + foreach ( (array) $most_active as $key => $details ) { + $url = esc_url('http://' . $details['domain'] . $details['path']); + echo '
          • ' . $details['postcount'] . " $url
          • "; + } + } + } + return array_slice( $most_active, 0, $num ); +} +?> diff --git a/src/wp-includes/ms-files.php b/src/wp-includes/ms-files.php new file mode 100644 index 0000000..2d68f11 --- /dev/null +++ b/src/wp-includes/ms-files.php @@ -0,0 +1,83 @@ +archived == '1' || $current_blog->spam == '1' || $current_blog->deleted == '1' ) { + status_header( 404 ); + die( '404 — File not found.' ); +} + +$file = BLOGUPLOADDIR . str_replace( '..', '', $_GET[ 'file' ] ); +if ( !is_file( $file ) ) { + status_header( 404 ); + die( '404 — File not found.' ); +} + +$mime = wp_check_filetype( $file ); +if( false === $mime[ 'type' ] && function_exists( 'mime_content_type' ) ) + $mime[ 'type' ] = mime_content_type( $file ); + +if( $mime[ 'type' ] ) + $mimetype = $mime[ 'type' ]; +else + $mimetype = 'image/' . substr( $file, strrpos( $file, '.' ) + 1 ); + +header( 'Content-Type: ' . $mimetype ); // always send this +if ( false === strpos( $_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS' ) ) + header( 'Content-Length: ' . filesize( $file ) ); + +// Optional support for X-Sendfile and X-Accel-Redirect +if ( WPMU_ACCEL_REDIRECT ) { + header( 'X-Accel-Redirect: ' . str_replace( WP_CONTENT_DIR, '', $file ) ); + exit; +} elseif ( WPMU_SENDFILE ) { + header( 'X-Sendfile: ' . $file ); + exit; +} + +$last_modified = gmdate( 'D, d M Y H:i:s', filemtime( $file ) ); +$etag = '"' . md5( $last_modified ) . '"'; +header( "Last-Modified: $last_modified GMT" ); +header( 'ETag: ' . $etag ); +header( 'Expires: ' . gmdate( 'D, d M Y H:i:s', time() + 100000000 ) . ' GMT' ); + +// Support for Conditional GET +$client_etag = isset( $_SERVER['HTTP_IF_NONE_MATCH'] ) ? stripslashes( $_SERVER['HTTP_IF_NONE_MATCH'] ) : false; + +if( ! isset( $_SERVER['HTTP_IF_MODIFIED_SINCE'] ) ) + $_SERVER['HTTP_IF_MODIFIED_SINCE'] = false; + +$client_last_modified = trim( $_SERVER['HTTP_IF_MODIFIED_SINCE'] ); +// If string is empty, return 0. If not, attempt to parse into a timestamp +$client_modified_timestamp = $client_last_modified ? strtotime( $client_last_modified ) : 0; + +// Make a timestamp for our most recent modification... +$modified_timestamp = strtotime($last_modified); + +if ( ( $client_last_modified && $client_etag ) + ? ( ( $client_modified_timestamp >= $modified_timestamp) && ( $client_etag == $etag ) ) + : ( ( $client_modified_timestamp >= $modified_timestamp) || ( $client_etag == $etag ) ) + ) { + status_header( 304 ); + exit; +} + +// If we made it this far, just serve the file +readfile( $file ); +?> diff --git a/src/wp-includes/ms-functions.php b/src/wp-includes/ms-functions.php new file mode 100644 index 0000000..6c1f80a --- /dev/null +++ b/src/wp-includes/ms-functions.php @@ -0,0 +1,2074 @@ +siteid; + else + $site_id = $wpdb->get_var( $wpdb->prepare( "SELECT id FROM $wpdb->site WHERE domain = %s AND path = %s", $sitedomain, $path ) ); + + if ( $site_id ) + return $wpdb->get_results( $wpdb->prepare( "SELECT u.ID, u.user_login, u.user_pass FROM $wpdb->users AS u, $wpdb->sitemeta AS sm WHERE sm.meta_key = 'admin_user_id' AND u.ID = sm.meta_value AND sm.site_id = %d", $site_id ), ARRAY_A ); + + return false; +} + +/** + * Get one of a user's active blogs + * + * Returns the user's primary blog, if she has one and + * it is active. If it's inactive, function returns another + * active blog of the user. If none are found, the user + * is added as a Subscriber to the Dashboard Blog and that blog + * is returned. + * + * @since MU 1.0 + * @uses get_blogs_of_user() + * @uses add_user_to_blog() + * @uses get_blog_details() + * + * @param int $user_id The unique ID of the user + * @return object The blog object + */ +function get_active_blog_for_user( $user_id ) { + global $wpdb; + $blogs = get_blogs_of_user( $user_id ); + if ( empty( $blogs ) ) + return null; + + if ( !is_multisite() ) + return $blogs[$wpdb->blogid]; + + $primary_blog = get_user_meta( $user_id, 'primary_blog', true ); + $first_blog = current($blogs); + if ( false !== $primary_blog ) { + if ( ! isset( $blogs[ $primary_blog ] ) ) { + update_user_meta( $user_id, 'primary_blog', $first_blog->userblog_id ); + $primary = $first_blog; + } else { + $primary = get_blog_details( $primary_blog ); + } + } else { + //TODO Review this call to add_user_to_blog too - to get here the user must have a role on this blog? + add_user_to_blog( $first_blog->userblog_id, $user_id, 'subscriber' ); + update_user_meta( $user_id, 'primary_blog', $first_blog->userblog_id ); + $primary = $first_blog; + } + + if ( ( ! is_object( $primary ) ) || ( is_object( $primary ) && $primary->archived == 1 || $primary->spam == 1 || $primary->deleted == 1 ) ) { + $blogs = get_blogs_of_user( $user_id, true ); // if a user's primary blog is shut down, check their other blogs. + $ret = false; + if ( is_array( $blogs ) && count( $blogs ) > 0 ) { + foreach ( (array) $blogs as $blog_id => $blog ) { + if ( $blog->site_id != $wpdb->siteid ) + continue; + $details = get_blog_details( $blog_id ); + if ( is_object( $details ) && $details->archived == 0 && $details->spam == 0 && $details->deleted == 0 ) { + $ret = $blog; + if ( get_user_meta( $user_id , 'primary_blog', true ) != $blog_id ) + update_user_meta( $user_id, 'primary_blog', $blog_id ); + if ( !get_user_meta($user_id , 'source_domain', true) ) + update_user_meta( $user_id, 'source_domain', $blog->domain ); + break; + } + } + } else { + return null; + } + return $ret; + } else { + return $primary; + } +} + +/** + * Find out whether a user is a member of a given blog. + * + * @since MU 1.1 + * @uses get_blogs_of_user() + * + * @param int $user_id The unique ID of the user + * @param int $blog Optional. If no blog_id is provided, current site is used + * @return bool + */ +function is_user_member_of_blog( $user_id, $blog_id = 0 ) { + $user_id = (int) $user_id; + $blog_id = (int) $blog_id; + + if ( $blog_id == 0 ) { + global $wpdb; + $blog_id = $wpdb->blogid; + } + + $blogs = get_blogs_of_user( $user_id ); + if ( is_array( $blogs ) ) + return array_key_exists( $blog_id, $blogs ); + else + return false; +} + +/** + * The number of active users in your installation. + * + * The count is cached and updated twice daily. This is not a live count. + * + * @since MU 2.7 + * + * @return int + */ +function get_user_count() { + return get_site_option( 'user_count' ); +} + +/** + * The number of active sites on your installation. + * + * The count is cached and updated twice daily. This is not a live count. + * + * @since MU 1.0 + * + * @param int $id Optional. A site_id. + * @return int + */ +function get_blog_count( $id = 0 ) { + return get_site_option( 'blog_count' ); +} + +/** + * Get a blog post from any site on the network. + * + * @since MU 1.0 + * + * @param int $blog_id ID of the blog. + * @param int $post_id ID of the post you're looking for. + * @return object The post. + */ +function get_blog_post( $blog_id, $post_id ) { + global $wpdb; + + $key = $blog_id . '-' . $post_id; + $post = wp_cache_get( $key, 'global-posts' ); + if ( $post == false ) { + $post = $wpdb->get_row( $wpdb->prepare( 'SELECT * FROM ' . $wpdb->get_blog_prefix( $blog_id ) . 'posts WHERE ID = %d', $post_id ) ); + wp_cache_add( $key, $post, 'global-posts' ); + } + + return $post; +} + +/** + * Add a user to a blog. + * + * Use the 'add_user_to_blog' action to fire an event when + * users are added to a blog. + * + * @since MU 1.0 + * + * @param int $blog_id ID of the blog you're adding the user to. + * @param int $user_id ID of the user you're adding. + * @param string $role The role you want the user to have + * @return bool + */ +function add_user_to_blog( $blog_id, $user_id, $role ) { + switch_to_blog($blog_id); + + $user = new WP_User($user_id); + + if ( empty( $user->ID ) ) { + restore_current_blog(); + return new WP_Error('user_does_not_exist', __('That user does not exist.')); + } + + if ( !get_user_meta($user_id, 'primary_blog', true) ) { + update_user_meta($user_id, 'primary_blog', $blog_id); + $details = get_blog_details($blog_id); + update_user_meta($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; +} + +/** + * Remove a user from a blog. + * + * Use the 'remove_user_from_blog' action to fire an event when + * users are removed from a blog. + * + * Accepts an optional $reassign parameter, if you want to + * reassign the user's blog posts to another user upon removal. + * + * @since MU 1.0 + * + * @param int $user_id ID of the user you're removing. + * @param int $blog_id ID of the blog you're removing the user from. + * @param string $reassign Optional. A user to whom to reassign posts. + * @return bool + */ +function remove_user_from_blog($user_id, $blog_id = '', $reassign = '') { + global $wpdb; + 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_user_meta($user_id, 'primary_blog', true); + 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_user_meta($user_id, 'primary_blog', $new_id); + update_user_meta($user_id, 'source_domain', $new_domain); + } + + // wp_revoke_user($user_id); + $user = new WP_User($user_id); + if ( empty( $user->ID ) ) { + restore_current_blog(); + return new WP_Error('user_does_not_exist', __('That user does not exist.')); + } + + $user->remove_all_caps(); + + $blogs = get_blogs_of_user($user_id); + if ( count($blogs) == 0 ) { + update_user_meta($user_id, 'primary_blog', ''); + update_user_meta($user_id, 'source_domain', ''); + } + + if ( $reassign != '' ) { + $reassign = (int) $reassign; + $wpdb->query( $wpdb->prepare("UPDATE $wpdb->posts SET post_author = %d WHERE post_author = %d", $reassign, $user_id) ); + $wpdb->query( $wpdb->prepare("UPDATE $wpdb->links SET link_owner = %d WHERE link_owner = %d", $reassign, $user_id) ); + } + + restore_current_blog(); +} + +/** + * Create an empty blog. + * + * @since MU 1.0 + * @uses install_blog() + * + * @param string $domain The new blog's domain. + * @param string $path The new blog's path. + * @param string $string The new blog's title. + * @param int $site Optional. Defaults to 1. + * @return int The ID of the newly created 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: Site URL already taken.' ); + + // Need to back up 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 site entry.' ); + + switch_to_blog($blog_id); + install_blog($blog_id); + restore_current_blog(); + + return $blog_id; +} + +/** + * Get the permalink for a post on another blog. + * + * @since MU 1.0 + * + * @param int $_blog_id ID of the source blog. + * @param int $post_id ID of the desired post. + * @return string The post's permalink + */ +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', 360 ); + } + return $link; +} + +/** + * Get a blog's numeric ID from its URL. + * + * On a subdirectory installation like example.com/blog1/, + * $domain will be the root 'example.com' and $path the + * subdirectory '/blog1/'. With subdomains like blog1.example.com, + * $domain is 'blog1.example.com' and $path is '/'. + * + * @since MU 2.6.5 + * + * @param string $domain + * @param string $path Optional. Not required for subdomain installations. + * @return int + */ +function get_blog_id_from_url( $domain, $path = '/' ) { + global $wpdb; + + $domain = strtolower( $wpdb->escape( $domain ) ); + $path = strtolower( $wpdb->escape( $path ) ); + $id = wp_cache_get( md5( $domain . $path ), 'blog-id-cache' ); + + if ( $id == -1 ) { // blog does not exist + return 0; + } elseif ( $id ) { + return (int)$id; + } + + $id = $wpdb->get_var( "SELECT blog_id FROM $wpdb->blogs WHERE domain = '$domain' and path = '$path' /* get_blog_id_from_url */" ); + + if ( !$id ) { + wp_cache_set( md5( $domain . $path ), -1, 'blog-id-cache' ); + return false; + } + wp_cache_set( md5( $domain . $path ), $id, 'blog-id-cache' ); + + return $id; +} + +// Admin functions + +/** + * Redirect a user based on $_GET or $_POST arguments. + * + * The function looks for redirect arguments in the following order: + * 1) $_GET['ref'] + * 2) $_POST['ref'] + * 3) $_SERVER['HTTP_REFERER'] + * 4) $_GET['redirect'] + * 5) $_POST['redirect'] + * 6) $url + * + * @since MU + * @uses wpmu_admin_redirect_add_updated_param() + * + * @param string $url + */ +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='. esc_html( substr( $_GET['redirect'], 2 ) ); + } elseif ( isset( $_POST['redirect'] ) ) { + $url = wpmu_admin_redirect_add_updated_param( $_POST['redirect'] ); + } + wp_redirect( $url ); + exit(); +} + +/** + * Adds an 'updated=true' argument to a URL. + * + * @since MU + * + * @param string $url + * @return string + */ +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; +} + +/** + * Checks an email address against a list of banned domains. + * + * This function checks against the Banned Email Domains list + * at wp-admin/network/settings.php. The check is only run on + * self-registrations; user creation at wp-admin/network/users.php + * bypasses this check. + * + * @since MU + * + * @param string $user_email The email provided by the user at registration. + * @return bool Returns true when the email address is banned. + */ +function is_email_address_unsafe( $user_email ) { + $banned_names = get_site_option( 'banned_email_domains' ); + if ($banned_names && !is_array( $banned_names )) + $banned_names = explode( "\n", $banned_names); + + 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; +} + +/** + * Processes new user registrations. + * + * Checks the data provided by the user during signup. Verifies + * the validity and uniqueness of user names and user email addresses, + * and checks email addresses against admin-provided domain + * whitelists and blacklists. + * + * The hook 'wpmu_validate_user_signup' provides an easy way + * to modify the signup process. The value $result, which is passed + * to the hook, contains both the user-provided info and the error + * messages created by the function. 'wpmu_validate_user_signup' allows + * you to process the data in any way you'd like, and unset the + * relevant errors if necessary. + * + * @since MU + * @uses is_email_address_unsafe() + * @uses username_exists() + * @uses email_exists() + * + * @param string $user_name The login name provided by the user. + * @param string $user_email The email provided by the user. + * @return array Contains username, email, and error messages. + */ +function wpmu_validate_user_signup($user_name, $user_email) { + global $wpdb; + + $errors = new WP_Error(); + + $orig_username = $user_name; + $user_name = preg_replace( '/\s+/', '', sanitize_user( $user_name, true ) ); + $maybe = array(); + preg_match( '/[a-z0-9]+/', $user_name, $maybe ); + + if ( $user_name != $orig_username || $user_name != $maybe[0] ) { + $errors->add( 'user_name', __( 'Only lowercase letters (a-z) and numbers are allowed.' ) ); + $user_name = $orig_username; + } + + $user_email = sanitize_email( $user_email ); + + if ( empty( $user_name ) ) + $errors->add('user_name', __('Please enter a username')); + + $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')); + + $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, 'orig_username' => $orig_username, 'user_email' => $user_email, 'errors' => $errors); + + return apply_filters('wpmu_validate_user_signup', $result); +} + +/** + * Processes new site registrations. + * + * Checks the data provided by the user during blog signup. Verifies + * the validity and uniqueness of blog paths and domains. + * + * This function prevents the current user from registering a new site + * with a blogname equivalent to another user's login name. Passing the + * $user parameter to the function, where $user is the other user, is + * effectively an override of this limitation. + * + * Filter 'wpmu_validate_blog_signup' if you want to modify + * the way that WordPress validates new site signups. + * + * @since MU + * @uses domain_exists() + * @uses username_exists() + * + * @param string $blogname The blog name provided by the user. Must be unique. + * @param string $blog_title The blog title provided by the user. + * @return array Contains the new site data and error messages. + */ +function wpmu_validate_blog_signup($blogname, $blog_title, $user = '') { + global $wpdb, $domain, $base, $current_site; + + $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 ); + } + + // On sub dir installs, Some names are so illegal, only a filter can spring them from jail + if (! is_subdomain_install() ) + $illegal_names = array_merge($illegal_names, apply_filters( 'subdirectory_reserved_names', array( 'page', 'comments', 'blog', 'files', 'feed' ) ) ); + + + if ( empty( $blogname ) ) + $errors->add('blogname', __('Please enter a site 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_super_admin() ) + $errors->add('blogname', __('Site name must be at least 4 characters')); + + if ( strpos( ' ' . $blogname, '_' ) != false ) + $errors->add( 'blogname', __( 'Sorry, site names may not contain the character “_”!' ) ); + + // do not allow users to create a blog that conflicts with a page on the main blog. + if ( !is_subdomain_install() && $wpdb->get_var( $wpdb->prepare( "SELECT post_name FROM " . $wpdb->get_blog_prefix( $current_site->blog_id ) . "posts WHERE post_type = 'page' AND post_name = %s", $blogname ) ) ) + $errors->add( 'blogname', __( 'Sorry, you may not use that site name.' ) ); + + // all numeric? + $match = array(); + preg_match( '/[0-9]*/', $blogname, $match ); + if ( $match[0] == $blogname ) + $errors->add('blogname', __('Sorry, site 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 site title')); + + // Check if the domain/path has been used already. + if ( is_subdomain_install() ) { + $mydomain = $blogname . '.' . preg_replace( '|^www\.|', '', $domain ); + $path = $base; + } else { + $mydomain = "$domain"; + $path = $base.$blogname.'/'; + } + if ( domain_exists($mydomain, $path) ) + $errors->add('blogname', __('Sorry, that site already exists!')); + + if ( username_exists( $blogname ) ) { + if ( is_object( $user ) == false || ( is_object($user) && ( $user->user_login != $blogname ) ) ) + $errors->add( 'blogname', __( 'Sorry, that site 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 site 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 site signup information for future activation. + * + * @since MU + * @uses wpmu_signup_blog_notification() + * + * @param string $domain The requested domain. + * @param string $path The requested path. + * @param string $title The requested site title. + * @param string $user The user's requested login name. + * @param string $user_email The user's email address. + * @param array $meta By default, contains the requested privacy setting and lang_id. + */ +function wpmu_signup_blog($domain, $path, $title, $user, $user_email, $meta = '') { + global $wpdb; + + $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); +} + +/** + * Record user signup information for future activation. + * + * This function is used when user registration is open but + * new site registration is not. + * + * @since MU + * @uses wpmu_signup_user_notification() + * + * @param string $user The user's requested login name. + * @param string $user_email The user's email address. + * @param array $meta By default, this is an empty array. + */ +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. + * + * This is the notification function used when site registration + * is enabled. + * + * Filter 'wpmu_signup_blog_notification' to bypass this function or + * replace it with your own notification behavior. + * + * Filter 'wpmu_signup_blog_notification_email' and + * 'wpmu_signup_blog_notification_email' to change the content + * and subject line of the email sent to newly registered users. + * + * @since MU + * + * @param string $domain The new blog domain. + * @param string $path The new blog path. + * @param string $title The site title. + * @param string $user The user's login name. + * @param string $user_email The user's email address. + * @param array $meta By default, contains the requested privacy setting and lang_id. + * @param string $key The activation key created in wpmu_signup_blog() + * @return bool + */ +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 ( !is_subdomain_install() || $current_site->id != 1 ) + $activate_url = network_site_url("wp-activate.php?key=$key"); + else + $activate_url = "http://{$domain}{$path}wp-activate.php?key=$key"; // @todo use *_url() API + + $activate_url = esc_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' : esc_html( get_site_option( 'site_name' ) ); + $message_headers = "From: \"{$from_name}\" <{$admin_email}>\n" . "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n"; + $message = sprintf( + apply_filters( 'wpmu_signup_blog_notification_email', + __( "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 site here:\n\n%s" ), + $domain, $path, $title, $user, $user_email, $key, $meta + ), + $activate_url, + esc_url( "http://{$domain}{$path}" ), + $key + ); + // TODO: Don't hard code activation link. + $subject = sprintf( + apply_filters( 'wpmu_signup_blog_notification_subject', + __( '[%1$s] Activate %2$s' ), + $domain, $path, $title, $user, $user_email, $key, $meta + ), + $from_name, + esc_url( 'http://' . $domain . $path ) + ); + wp_mail($user_email, $subject, $message, $message_headers); + return true; +} + +/** + * Notify user of signup success. + * + * This is the notification function used when no new site has + * been requested. + * + * Filter 'wpmu_signup_user_notification' to bypass this function or + * replace it with your own notification behavior. + * + * Filter 'wpmu_signup_user_notification_email' and + * 'wpmu_signup_user_notification_subject' to change the content + * and subject line of the email sent to newly registered users. + * + * @since MU + * + * @param string $user The user's login name. + * @param string $user_email The user's email address. + * @param array $meta By default, an empty array. + * @param string $key The activation key created in wpmu_signup_user() + * @return bool + */ +function wpmu_signup_user_notification($user, $user_email, $key, $meta = '') { + 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' : esc_html( get_site_option( 'site_name' ) ); + $message_headers = "From: \"{$from_name}\" <{$admin_email}>\n" . "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n"; + $message = sprintf( + apply_filters( 'wpmu_signup_user_notification_email', + __( "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" ), + $user, $user_email, $key, $meta + ), + site_url( "wp-activate.php?key=$key" ) + ); + // TODO: Don't hard code activation link. + $subject = sprintf( + apply_filters( 'wpmu_signup_user_notification_subject', + __( '[%1$s] Activate %2$s' ), + $user, $user_email, $key, $meta + ), + $from_name, + $user + ); + wp_mail($user_email, $subject, $message, $message_headers); + return true; +} + +/** + * Activate a signup. + * + * Hook to 'wpmu_activate_user' or 'wpmu_activate_blog' for events + * that should happen only when users or sites are self-created (since + * those actions are not called when users and sites are created + * by a Super Admin). + * + * @since MU + * @uses wp_generate_password() + * @uses wpmu_welcome_user_notification() + * @uses add_user_to_blog() + * @uses add_new_user_to_blog() + * @uses wpmu_create_user() + * @uses wpmu_create_blog() + * @uses wpmu_welcome_notification() + * + * @param string $key The activation key provided to the user. + * @return array An array containing information about the activated user and/or blog + */ +function wpmu_activate_signup($key) { + global $wpdb, $current_site; + + $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 ) { + if ( empty( $signup->domain ) ) + return new WP_Error( 'already_active', __( 'The user is already active.' ), $signup ); + else + return new WP_Error( 'already_active', __( 'The site is already active.' ), $signup ); + } + + $meta = unserialize($signup->meta); + $user_login = $wpdb->escape($signup->user_login); + $user_email = $wpdb->escape($signup->user_email); + $password = wp_generate_password( 12, false ); + + $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_new_user_to_blog( $user_id, $user_email, $meta ); + do_action('wpmu_activate_user', $user_id, $password, $meta); + return array('user_id' => $user_id, 'password' => $password, 'meta' => $meta); + } + + $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); +} + +/** + * Create a user. + * + * This function runs when a user self-registers as well as when + * a Super Admin creates a new user. Hook to 'wpmu_new_user' for events + * that should affect all new users, but only on Multisite (otherwise + * use 'user_register'). + * + * @since MU + * @uses wp_create_user() + * + * @param string $user_name The new user's login name. + * @param string $password The new user's password. + * @param string $email The new user's email address. + * @return mixed Returns false on failure, or int $user_id on success + */ +function wpmu_create_user( $user_name, $password, $email) { + $user_name = preg_replace( '/\s+/', '', sanitize_user( $user_name, true ) ); + + $user_id = wp_create_user( $user_name, $password, $email ); + if ( is_wp_error($user_id) ) + return false; + + // Newly created users have no roles or caps until they are added to a blog. + delete_user_option( $user_id, 'capabilities' ); + delete_user_option( $user_id, 'user_level' ); + + do_action( 'wpmu_new_user', $user_id ); + + return $user_id; +} + +/** + * Create a site. + * + * This function runs when a user self-registers a new site as well + * as when a Super Admin creates a new site. Hook to 'wpmu_new_blog' + * for events that should affect all new sites. + * + * On subdirectory installs, $domain is the same as the main site's + * domain, and the path is the subdirectory name (eg 'example.com' + * and '/blog1/'). On subdomain installs, $domain is the new subdomain + + * root domain (eg 'blog1.example.com'), and $path is '/'. + * + * @since MU + * @uses domain_exists() + * @uses insert_blog() + * @uses wp_install_defaults() + * @uses add_user_to_blog() + * + * @param string $domain The new site's domain. + * @param string $path The new site's path. + * @param string $title The new site's title. + * @param int $user_id The user ID of the new site's admin. + * @param array $meta Optional. Used to set initial site options. + * @param int $site_id Optional. Only relevant on multi-network installs. + * @return mixed Returns WP_Error object on failure, int $blog_id on success + */ +function wpmu_create_blog($domain, $path, $title, $user_id, $meta = '', $site_id = 1) { + $domain = preg_replace( '/\s+/', '', sanitize_user( $domain, true ) ); + + if ( is_subdomain_install() ) + $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', __('Site 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 site.')); + + switch_to_blog($blog_id); + install_blog($blog_id, $title); + wp_install_defaults($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', (int)$meta['public'] ); + + if ( !is_super_admin() && ! get_user_meta( $user_id, 'primary_blog', true ) ) + update_user_meta( $user_id, 'primary_blog', $blog_id ); + + restore_current_blog(); + do_action( 'wpmu_new_blog', $blog_id, $user_id, $domain, $path, $site_id, $meta ); + + return $blog_id; +} + +/** + * Notifies the network admin that a new site has been activated. + * + * Filter 'newblog_notify_siteadmin' to change the content of + * the notification email. + * + * @since MU + * + * @param int $blog_id The new site's ID. + * @return bool + */ +function newblog_notify_siteadmin( $blog_id, $deprecated = '' ) { + if ( get_site_option( 'registrationnotification' ) != 'yes' ) + return false; + + $email = get_site_option( 'admin_email' ); + if ( is_email($email) == false ) + return false; + + $options_site_url = esc_url(network_admin_url('settings.php')); + + switch_to_blog( $blog_id ); + $blogname = get_option( 'blogname' ); + $siteurl = site_url(); + restore_current_blog(); + + $msg = sprintf( __( 'New Site: %1s +URL: %2s +Remote IP: %3s + +Disable these notifications: %4s' ), $blogname, $siteurl, $_SERVER['REMOTE_ADDR'], $options_site_url); + $msg = apply_filters( 'newblog_notify_siteadmin', $msg ); + + wp_mail( $email, sprintf( __( 'New Site Registration: %s' ), $siteurl ), $msg ); + return true; +} + +/** + * Notifies the network admin that a new user has been activated. + * + * Filter 'newuser_notify_siteadmin' to change the content of + * the notification email. + * + * @since MU + * + * @param int $user_id The new user's ID. + * @return bool + */ +function newuser_notify_siteadmin( $user_id ) { + 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 = esc_url(network_admin_url('settings.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; +} + +/** + * Check whether a blogname is already taken. + * + * Used during the new site registration process to ensure + * that each blogname is unique. + * + * @since MU + * + * @param string $domain The domain to be checked. + * @param string $path The path to be checked. + * @param int $site_id Optional. Relevant only on multi-network installs. + * @return int + */ +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) ); +} + +/** + * Store basic site info in the blogs table. + * + * This function creates a row in the wp_blogs table and returns + * the new blog's ID. It is the first step in creating a new blog. + * + * @since MU + * + * @param string $domain The domain of the new site. + * @param string $path The path of the new site. + * @param int $site_id Unless you're running a multi-network install, be sure to set this value to 1. + * @return int The ID of the new row + */ +function insert_blog($domain, $path, $site_id) { + global $wpdb; + + $path = trailingslashit($path); + $site_id = (int) $site_id; + + $result = $wpdb->insert( $wpdb->blogs, array('site_id' => $site_id, 'domain' => $domain, 'path' => $path, 'registered' => current_time('mysql')) ); + if ( ! $result ) + return false; + + refresh_blog_details($wpdb->insert_id); + return $wpdb->insert_id; +} + +/** + * Install an empty blog. + * + * Creates the new blog tables and options. If calling this function + * directly, be sure to use switch_to_blog() first, so that $wpdb + * points to the new blog. + * + * @since MU + * @uses make_db_current_silent() + * @uses populate_roles() + * + * @param int $blog_id The value returned by insert_blog(). + * @param string $blog_title The title of the new site. + */ +function install_blog($blog_id, $blog_title = '') { + global $wpdb, $table_prefix, $wp_roles; + $wpdb->suppress_errors(); + + // Cast for security + $blog_id = (int) $blog_id; + + require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); + + 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', UPLOADBLOGSDIR . "/$blog_id/files"); + update_option('blogname', stripslashes( $blog_title ) ); + update_option('admin_email', ''); + $wpdb->update( $wpdb->options, array('option_value' => ''), array('option_name' => 'admin_email') ); + + // 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') ); + + $wpdb->suppress_errors( false ); +} + +/** + * Set blog defaults. + * + * This function creates a row in the wp_blogs table. + * + * @since MU + * @deprecated MU + * @deprecated Use wp_install_defaults() + * @uses wp_install_defaults() + * + * @param int $blog_id Ignored in this function. + * @param int $user_id + */ +function install_blog_defaults($blog_id, $user_id) { + global $wpdb; + + require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); + + $wpdb->suppress_errors(); + + wp_install_defaults($user_id); + + $wpdb->suppress_errors( false ); +} + +/** + * Notify a user that her blog activation has been successful. + * + * Filter 'wpmu_welcome_notification' to disable or bypass. + * + * Filter 'update_welcome_email' and 'update_welcome_subject' to + * modify the content and subject line of the notification email. + * + * @since MU + * + * @param int $blog_id + * @param int $user_id + * @param string $password + * @param string $title The new blog's title + * @param array $meta Optional. Not used in the default function, but is passed along to hooks for customization. + * @return bool + */ +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 site has been successfully set up at: +BLOG_URL + +You can log in to the administrator account with the following information: +Username: USERNAME +Password: PASSWORD +Log in here: BLOG_URLwp-login.php + +We hope you enjoy your new site. Thanks! + +--The 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_TITLE', $title, $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' : esc_html( get_site_option( 'site_name' ) ); + $message_headers = "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'; + + $subject = apply_filters( 'update_welcome_subject', sprintf(__('New %1$s Site: %2$s'), $current_site->site_name, stripslashes( $title ) ) ); + wp_mail($user->user_email, $subject, $message, $message_headers); + return true; +} + +/** + * Notify a user that her account activation has been successful. + * + * Filter 'wpmu_welcome_user_notification' to disable or bypass. + * + * Filter 'update_welcome_user_email' and 'update_welcome_user_subject' to + * modify the content and subject line of the notification email. + * + * @since MU + * + * @param int $user_id + * @param string $password + * @param array $meta Optional. Not used in the default function, but is passed along to hooks for customization. + * @return bool + */ +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 = get_site_option( 'welcome_user_email' ); + + $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 ); + $welcome_email = str_replace( 'LOGINLINK', wp_login_url(), $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' : esc_html( get_site_option( 'site_name' ) ); + $message_headers = "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'; + + $subject = apply_filters( 'update_welcome_user_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; +} + +/** + * Get the current site info. + * + * Returns an object containing the ID, domain, path, and site_name + * of the site being viewed. + * + * @since MU + * + * @return object + */ +function get_current_site() { + global $current_site; + return $current_site; +} + +/** + * Get a numeric user ID from either an email address or a login. + * + * @since MU + * @uses is_email() + * + * @param string $string + * @return int + */ +function get_user_id_from_string( $string ) { + $user_id = 0; + if ( is_email( $string ) ) { + $user = get_user_by('email', $string); + if ( $user ) + $user_id = $user->ID; + } elseif ( is_numeric( $string ) ) { + $user_id = $string; + } else { + $user = get_user_by('login', $string); + if ( $user ) + $user_id = $user->ID; + } + + return $user_id; +} + +/** + * Get a user's most recent post. + * + * Walks through each of a user's blogs to find the post with + * the most recent post_date_gmt. + * + * @since MU + * @uses get_blogs_of_user() + * + * @param int $user_id + * @return array Contains the blog_id, post_id, post_date_gmt, and post_gmt_ts + */ +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 + +/** + * Get the size of a directory. + * + * A helper function that is used primarily to check whether + * a blog has exceeded its allowed upload space. + * + * @since MU + * @uses recurse_dirsize() + * + * @param string $directory + * @return int + */ +function get_dirsize( $directory ) { + $dirsize = get_transient( 'dirsize_cache' ); + if ( is_array( $dirsize ) && isset( $dirsize[ $directory ][ 'size' ] ) ) + return $dirsize[ $directory ][ 'size' ]; + + if ( false == is_array( $dirsize ) ) + $dirsize = array(); + + $dirsize[ $directory ][ 'size' ] = recurse_dirsize( $directory ); + + set_transient( 'dirsize_cache', $dirsize, 3600 ); + return $dirsize[ $directory ][ 'size' ]; +} + +/** + * Get the size of a directory recursively. + * + * Used by get_dirsize() to get a directory's size when it contains + * other directories. + * + * @since MU + * + * @param string $directory + * @return int + */ +function recurse_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 = recurse_dirsize($path); + if ($handlesize > 0) + $size += $handlesize; + } + } + } + closedir($handle); + } + return $size; +} + +/** + * Check whether a blog has used its allotted upload space. + * + * Used by get_dirsize() to get a directory's size when it contains + * other directories. + * + * @since MU + * @uses get_dirsize() + * + * @param bool $echo Optional. If $echo is set and the quota is exceeded, a warning message is echoed. Default is true. + * @return int + */ +function upload_is_user_over_quota( $echo = true ) { + if ( get_site_option( 'upload_space_check_disabled' ) ) + return false; + + $spaceAllowed = get_space_allowed(); + if ( empty( $spaceAllowed ) || !is_numeric( $spaceAllowed ) ) + $spaceAllowed = 10; // Default space allowed is 10 MB + + $dirName = BLOGUPLOADDIR; + $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; + } +} + +/** + * Check an array of MIME types against a whitelist. + * + * WordPress ships with a set of allowed upload filetypes, + * which is defined in wp-includes/functions.php in + * get_allowed_mime_types(). This function is used to filter + * that list against the filetype whitelist provided by Multisite + * Super Admins at wp-admin/network/settings.php. + * + * @since MU + * + * @param array $mimes + * @return array + */ +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 ( $ext != '' && strpos( $ext_pattern, $ext ) !== false ) + $site_mimes[$ext_pattern] = $mime; + } + } + return $site_mimes; +} + +/** + * Update a blog's post count. + * + * WordPress MS stores a blog's post count as an option so as + * to avoid extraneous COUNTs when a blog's details are fetched + * with get_blog_details(). This function is called when posts + * are published to make sure the count stays current. + * + * @since MU + */ +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'" ) ); +} + +/** + * Logs user registrations. + * + * @since MU + * + * @param int $blog_id + * @param int $user_id + */ +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')) ); +} + +/** + * Get the remaining upload space for this blog. + * + * @since MU + * @uses upload_is_user_over_quota() + * @uses get_space_allowed() + * @uses get_dirsize() + * + * @param int $size + * @return int + */ +function fix_import_form_size( $size ) { + if ( upload_is_user_over_quota( false ) == true ) + return 0; + + $spaceAllowed = 1024 * 1024 * get_space_allowed(); + $dirName = BLOGUPLOADDIR; + $dirsize = get_dirsize($dirName) ; + if ( $size > $spaceAllowed - $dirsize ) + return $spaceAllowed - $dirsize; // remaining space + else + return $size; // default +} + +/** + * Maintains a canonical list of terms by syncing terms created for each blog with the global terms table. + * + * @since 3.0.0 + * + * @see term_id_filter + * + * @param int $term_id An ID for a term on the current blog. + * @return int An ID from the global terms table mapped from $term_id. + */ +function global_terms( $term_id, $deprecated = '' ) { + global $wpdb; + static $global_terms_recurse = null; + + if ( !global_terms_enabled() ) + return $term_id; + + // prevent a race condition + $recurse_start = false; + if ( $global_terms_recurse === null ) { + $recurse_start = true; + $global_terms_recurse = 1; + } elseif ( 10 < $global_terms_recurse++ ) { + return $term_id; + } + + $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 ) { + $used_global_id = $wpdb->get_var( $wpdb->prepare( "SELECT cat_ID FROM $wpdb->sitecategories WHERE cat_ID = %d", $c->term_id ) ); + if ( null == $used_global_id ) { + $wpdb->insert( $wpdb->sitecategories, array( 'cat_ID' => $term_id, 'cat_name' => $c->name, 'category_nicename' => $c->slug ) ); + $global_id = $wpdb->insert_id; + if ( empty( $global_id ) ) + return $term_id; + } else { + $max_global_id = $wpdb->get_var( "SELECT MAX(cat_ID) FROM $wpdb->sitecategories" ); + $max_local_id = $wpdb->get_var( "SELECT MAX(term_id) FROM $wpdb->terms" ); + $new_global_id = max( $max_global_id, $max_local_id ) + mt_rand( 100, 400 ); + $wpdb->insert( $wpdb->sitecategories, array( 'cat_ID' => $new_global_id, 'cat_name' => $c->name, 'category_nicename' => $c->slug ) ); + $global_id = $wpdb->insert_id; + } + } elseif ( $global_id != $term_id ) { + $local_id = $wpdb->get_row( $wpdb->prepare( "SELECT term_id FROM $wpdb->terms WHERE term_id = %d", $global_id ) ); + if ( null != $local_id ) + $local_id = global_terms( $local_id ); + if ( 10 < $global_terms_recurse ) + $global_id = $term_id; + } + + if ( $global_id != $term_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); + } + if( $recurse_start ) + $global_terms_recurse = null; + + return $global_id; +} + +/** + * Ensure that the current site's domain is listed in the allowed redirect host list. + * + * @see wp_validate_redirect() + * @since MU + * + * @return array The current site's domain + */ +function redirect_this_site( $deprecated = '' ) { + global $current_site; + return array( $current_site->domain ); +} + +/** + * Check whether an upload is too big. + * + * @since MU + * + * @param array $upload + * @return mixed If the upload is under the size limit, $upload is returned. Otherwise returns an error message. + */ +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 %d KB in size.' ) . '
            ', get_site_option( 'fileupload_maxk', 1500 )); + + return $upload; +} + +/** + * Add a nonce field to the signup page. + * + * @since MU + * @uses wp_nonce_field() + */ +function signup_nonce_fields() { + $id = mt_rand(); + echo ""; + wp_nonce_field('signup_form_' . $id, '_signup_form', false); +} + +/** + * Process the signup nonce created in signup_nonce_fields(). + * + * @since MU + * @uses wp_create_nonce() + * + * @param array $result + * @return array + */ +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; +} + +/** + * Correct 404 redirects when NOBLOGREDIRECT is defined. + * + * @since MU + */ +function maybe_redirect_404() { + global $current_site; + if ( is_main_site() && is_404() && defined( 'NOBLOGREDIRECT' ) && ( $destination = apply_filters( 'blog_redirect_404', NOBLOGREDIRECT ) ) ) { + if ( $destination == '%siteurl%' ) + $destination = network_home_url(); + wp_redirect( $destination ); + exit(); + } +} + +/** + * Add a new user to a blog by visiting /newbloguser/username/. + * + * This will only work when the user's details are saved as an option + * keyed as 'new_user_x', where 'x' is the username of the user to be + * added, as when a user is invited through the regular WP Add User interface. + * + * @since MU + * @uses add_existing_user_to_blog() + */ +function maybe_add_existing_user_to_blog() { + if ( false === strpos( $_SERVER[ 'REQUEST_URI' ], '/newbloguser/' ) ) + return false; + + $parts = explode( '/', $_SERVER[ 'REQUEST_URI' ] ); + $key = array_pop( $parts ); + + if ( $key == '' ) + $key = array_pop( $parts ); + + $details = get_option( 'new_user_' . $key ); + if ( !empty( $details ) ) + delete_option( 'new_user_' . $key ); + + if ( empty( $details ) || is_wp_error( add_existing_user_to_blog( $details ) ) ) + wp_die( sprintf(__('An error occurred adding you to this site. Back to the homepage.'), site_url() ) ); + + wp_die( sprintf(__('You have been added to this site. Please visit the homepage or login using your username and password.'), site_url(), admin_url() ), __('Success') ); +} + +/** + * Add a user to a blog based on details from maybe_add_existing_user_to_blog(). + * + * @since MU + * @uses add_user_to_blog() + * + * @param array $details + */ +function add_existing_user_to_blog( $details = false ) { + global $blog_id; + + if ( is_array( $details ) ) { + $result = add_user_to_blog( $blog_id, $details[ 'user_id' ], $details[ 'role' ] ); + do_action( 'added_existing_user', $details[ 'user_id' ], $result ); + } + return $result; +} + +/** + * Add a newly created user to the appropriate blog + * + * @since MU + * + * @param int $user_id + * @param string $email + * @param array $meta + */ +function add_new_user_to_blog( $user_id, $email, $meta ) { + global $current_site; + if ( !empty( $meta[ 'add_to_blog' ] ) ) { + $blog_id = $meta[ 'add_to_blog' ]; + $role = $meta[ 'new_role' ]; + remove_user_from_blog($user_id, $current_site->blog_id); // remove user from main blog. + add_user_to_blog( $blog_id, $user_id, $role ); + update_user_meta( $user_id, 'primary_blog', $blog_id ); + } +} + +/** + * Correct From host on outgoing mail to match the site domain + * + * @since MU + */ +function fix_phpmailer_messageid( $phpmailer ) { + global $current_site; + $phpmailer->Hostname = $current_site->domain; +} + +/** + * Check to see whether a user is marked as a spammer, based on username + * + * @since MU + * @uses get_current_user_id() + * @uses get_user_id_from_string() + * + * @param string $username + * @return bool + */ +function is_user_spammy( $username = 0 ) { + if ( $username == 0 ) { + $user_id = get_current_user_id(); + } else { + $user_id = get_user_id_from_string( $username ); + } + $u = new WP_User( $user_id ); + + return ( isset( $u->spam ) && $u->spam == 1 ); +} + +/** + * Update this blog's 'public' setting in the global blogs table. + * + * Public blogs have a setting of 1, private blogs are 0. + * + * @since MU + * @uses update_blog_status() + * + * @param int $old_value + * @param int $value The new public value + * @return bool + */ +function update_blog_public( $old_value, $value ) { + global $wpdb; + do_action('update_blog_public'); + update_blog_status( $wpdb->blogid, 'public', (int) $value ); +} +add_action('update_option_blog_public', 'update_blog_public', 10, 2); + +/** + * Get the "dashboard blog", the blog where users without a blog edit their profile data. + * + * @since MU + * @uses get_blog_details() + * + * @return int + */ +function get_dashboard_blog() { + if ( $blog = get_site_option( 'dashboard_blog' ) ) + return get_blog_details( $blog ); + + return get_blog_details( $GLOBALS['current_site']->blog_id ); +} + +/** + * Check whether a usermeta key has to do with the current blog. + * + * @since MU + * @uses wp_get_current_user() + * + * @param string $key + * @param int $user_id Optional. Defaults to current user. + * @param int $blog_id Optional. Defaults to current blog. + * @return bool + */ +function is_user_option_local( $key, $user_id = 0, $blog_id = 0 ) { + global $wpdb; + + $current_user = wp_get_current_user(); + if ( $user_id == 0 ) + $user_id = $current_user->ID; + if ( $blog_id == 0 ) + $blog_id = $wpdb->blogid; + + $local_key = $wpdb->base_prefix . $blog_id . '_' . $key; + + if ( isset( $current_user->$local_key ) ) + return true; + + return false; +} + +/** + * Check whether users can self-register, based on Network settings. + * + * @since MU + * + * @return bool + */ +function users_can_register_signup_filter() { + $registration = get_site_option('registration'); + if ( $registration == 'all' || $registration == 'user' ) + return true; + + return false; +} +add_filter('option_users_can_register', 'users_can_register_signup_filter'); + +/** + * Ensure that the welcome message is not empty. Currently unused. + * + * @since MU + * + * @param string $text + * @return string + */ +function welcome_user_msg_filter( $text ) { + if ( !$text ) { + return __( 'Dear User, + +Your new account is set up. + +You can log in with the following information: +Username: USERNAME +Password: PASSWORD +LOGINLINK + +Thanks! + +--The Team @ SITE_NAME' ); + } + return $text; +} +add_filter( 'site_option_welcome_user_email', 'welcome_user_msg_filter' ); + +/** + * Whether to force SSL on content. + * + * @since 2.8.5 + * + * @param string|bool $force + * @return bool True if forced, false if not forced. + */ +function force_ssl_content( $force = '' ) { + static $forced_content; + + if ( '' != $force ) { + $old_forced = $forced_content; + $forced_content = $force; + return $old_forced; + } + + return $forced_content; +} + +/** + * Formats an String URL to use HTTPS if HTTP is found. + * Useful as a filter. + * + * @since 2.8.5 + **/ +function filter_SSL( $url ) { + if ( !is_string( $url ) ) + return get_bloginfo( 'url' ); //return home blog url with proper scheme + + $arrURL = parse_url( $url ); + + if ( force_ssl_content() && is_ssl() ) { + if ( 'http' === $arrURL['scheme'] && 'https' !== $arrURL['scheme'] ) + $url = str_replace( $arrURL['scheme'], 'https', $url ); + } + + return $url; +} + +/** + * Schedule update of the network-wide counts for the current network. + * + * @since 3.1.0 + */ +function wp_schedule_update_network_counts() { + if ( !is_main_site() ) + return; + + if ( !wp_next_scheduled('update_network_counts') && !defined('WP_INSTALLING') ) + wp_schedule_event(time(), 'twicedaily', 'update_network_counts'); +} + +/** + * Update the network-wide counts for the current network. + * + * @since 3.1.0 + */ +function wp_update_network_counts() { + global $wpdb; + + $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'", $wpdb->siteid) ); + update_site_option( 'blog_count', $count ); + + $count = $wpdb->get_var( $wpdb->prepare("SELECT COUNT(ID) as c FROM $wpdb->users WHERE spam = '0' AND deleted = '0'") ); + update_site_option( 'user_count', $count ); +} + +?> \ No newline at end of file diff --git a/src/wp-includes/ms-load.php b/src/wp-includes/ms-load.php new file mode 100644 index 0000000..78d01e6 --- /dev/null +++ b/src/wp-includes/ms-load.php @@ -0,0 +1,250 @@ +WP_PLUGIN_DIR and WP_PLUGIN_URL + * in wp-config.php. + * + * @access private + * @since 3.1.0 + * @return array Files to include + */ +function wp_get_active_network_plugins() { + $active_plugins = (array) get_site_option( 'active_sitewide_plugins', array() ); + if ( empty( $active_plugins ) ) + return array(); + + $plugins = array(); + $active_plugins = array_keys( $active_plugins ); + sort( $active_plugins ); + + foreach ( $active_plugins as $plugin ) { + if ( ! validate_file( $plugin ) // $plugin must validate as file + && '.php' == substr( $plugin, -4 ) // $plugin must end with '.php' + && file_exists( WP_PLUGIN_DIR . '/' . $plugin ) // $plugin must exist + ) + $plugins[] = WP_PLUGIN_DIR . '/' . $plugin; + } + return $plugins; +} + +/** + * Checks status of current blog. + * + * Checks if the blog is deleted, inactive, archived, or spammed. + * + * Dies with a default message if the blog does not pass the check. + * + * To change the default message when a blog does not pass the check, + * use the wp-content/blog-deleted.php, blog-inactive.php and + * blog-suspended.php drop-ins. + * + * @return bool|string Returns true on success, or drop-in file to include. + */ +function ms_site_check() { + global $wpdb, $current_blog; + + // Allow short-circuiting + $check = apply_filters('ms_site_check', null); + if ( null !== $check ) + return true; + + // Allow super admins to see blocked sites + if ( is_super_admin() ) + return true; + + if ( '1' == $current_blog->deleted ) { + if ( file_exists( WP_CONTENT_DIR . '/blog-deleted.php' ) ) + return WP_CONTENT_DIR . '/blog-deleted.php'; + else + wp_die( __( 'This user has elected to delete their account and the content is no longer available.' ), '', array( 'response' => 410 ) ); + } + + if ( '2' == $current_blog->deleted ) { + if ( file_exists( WP_CONTENT_DIR . '/blog-inactive.php' ) ) + return WP_CONTENT_DIR . '/blog-inactive.php'; + else + wp_die( sprintf( __( 'This site has not been activated yet. If you are having problems activating your site, 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' ) { + if ( file_exists( WP_CONTENT_DIR . '/blog-suspended.php' ) ) + return WP_CONTENT_DIR . '/blog-suspended.php'; + else + wp_die( __( 'This site has been archived or suspended.' ), '', array( 'response' => 410 ) ); + } + + return true; +} + +/** + * Sets current site name. + * + * @access private + * @since 3.0.0 + * @return object $current_site object with site_name + */ +function get_current_site_name( $current_site ) { + global $wpdb; + + $current_site->site_name = wp_cache_get( $current_site->id . ':site_name', 'site-options' ); + if ( ! $current_site->site_name ) { + $current_site->site_name = $wpdb->get_var( $wpdb->prepare( "SELECT meta_value FROM $wpdb->sitemeta WHERE site_id = %d AND meta_key = 'site_name'", $current_site->id ) ); + if ( ! $current_site->site_name ) + $current_site->site_name = ucfirst( $current_site->domain ); + } + wp_cache_set( $current_site->id . ':site_name', $current_site->site_name, 'site-options' ); + + return $current_site; +} + +/** + * Sets current_site object. + * + * @access private + * @since 3.0.0 + * @return object $current_site object + */ +function wpmu_current_site() { + global $wpdb, $current_site, $domain, $path, $sites, $cookie_domain; + if ( defined( 'DOMAIN_CURRENT_SITE' ) && defined( 'PATH_CURRENT_SITE' ) ) { + $current_site->id = defined( 'SITE_ID_CURRENT_SITE' ) ? SITE_ID_CURRENT_SITE : 1; + $current_site->domain = DOMAIN_CURRENT_SITE; + $current_site->path = $path = PATH_CURRENT_SITE; + if ( defined( 'BLOG_ID_CURRENT_SITE' ) ) + $current_site->blog_id = BLOG_ID_CURRENT_SITE; + elseif ( defined( 'BLOGID_CURRENT_SITE' ) ) // deprecated. + $current_site->blog_id = BLOGID_CURRENT_SITE; + if ( DOMAIN_CURRENT_SITE == $domain ) + $current_site->cookie_domain = $cookie_domain; + elseif ( substr( $current_site->domain, 0, 4 ) == 'www.' ) + $current_site->cookie_domain = substr( $current_site->domain, 4 ); + else + $current_site->cookie_domain = $current_site->domain; + + wp_load_core_site_options( $current_site->id ); + + return $current_site; + } + + $current_site = wp_cache_get( 'current_site', 'site-options' ); + if ( $current_site ) + return $current_site; + + $sites = $wpdb->get_results( "SELECT * FROM $wpdb->site" ); // usually only one site + if ( 1 == count( $sites ) ) { + $current_site = $sites[0]; + wp_load_core_site_options( $current_site->id ); + $path = $current_site->path; + $current_site->blog_id = $wpdb->get_var( $wpdb->prepare( "SELECT blog_id FROM $wpdb->blogs WHERE domain = %s AND path = %s", $current_site->domain, $current_site->path ) ); + $current_site = get_current_site_name( $current_site ); + if ( substr( $current_site->domain, 0, 4 ) == 'www.' ) + $current_site->cookie_domain = substr( $current_site->domain, 4 ); + wp_cache_set( 'current_site', $current_site, 'site-options' ); + return $current_site; + } + $path = substr( $_SERVER[ 'REQUEST_URI' ], 0, 1 + strpos( $_SERVER[ 'REQUEST_URI' ], '/', 1 ) ); + + if ( $domain == $cookie_domain ) + $current_site = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->site WHERE domain = %s AND path = %s", $domain, $path ) ); + else + $current_site = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->site WHERE domain IN ( %s, %s ) AND path = %s ORDER BY CHAR_LENGTH( domain ) DESC LIMIT 1", $domain, $cookie_domain, $path ) ); + + if ( ! $current_site ) { + if ( $domain == $cookie_domain ) + $current_site = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->site WHERE domain = %s AND path='/'", $domain ) ); + else + $current_site = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->site WHERE domain IN ( %s, %s ) AND path = '/' ORDER BY CHAR_LENGTH( domain ) DESC LIMIT 1", $domain, $cookie_domain, $path ) ); + } + + if ( $current_site ) { + $path = $current_site->path; + $current_site->cookie_domain = $cookie_domain; + return $current_site; + } + + if ( is_subdomain_install() ) { + $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 ) { + $current_site->cookie_domain = $current_site->domain; + return $current_site; + } + + $current_site = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->site WHERE domain = %s AND path='/'", $sitedomain) ); + } + + if ( $current_site || defined( 'WP_INSTALLING' ) ) { + $path = '/'; + return $current_site; + } + + // Still no dice. + if ( 1 == count( $sites ) ) + wp_die( sprintf( /*WP_I18N_BLOG_DOESNT_EXIST*/'Este sitio no existe. Por favor, prueba %s.'/*/WP_I18N_BLOG_DOESNT_EXIST*/, $sites[0]->domain . $sites[0]->path ) ); + else + wp_die( /*WP_I18N_NO_SITE_DEFINED*/'No se ha definido un sitio para este servidor. Si eres el propietario de este sitio, por favor, consulta Arreglando una red de WordPress para tener ayuda.'/*/WP_I18N_NO_SITE_DEFINED*/ ); +} + +/** + * Displays a failure message. + * + * Used when a blog's tables do not exist. Checks for a missing $wpdb->site table as well. + * + * @access private + * @since 3.0.0 + */ +function ms_not_installed() { + global $wpdb, $domain, $path; + + $title = /*WP_I18N_FATAL_ERROR*/'Error estableciendo conexión con la base de datos'/*/WP_I18N_FATAL_ERROR*/; + $msg = '

            ' . $title . '

            '; + if ( ! is_admin() ) + die( $msg ); + $msg .= '

            ' . /*WP_I18N_CONTACT_OWNER*/'Si tu sitio no se muestra contacta con el propietario de esta red.'/*/WP_I18N_CONTACT_OWNER*/ . ''; + $msg .= ' ' . /*WP_I18N_CHECK_MYSQL*/'Si eres el propietario de esta red comprueba que MySQL se está ejecutando adecuadamente y que niguna de las tablas tiene errores.'/*/WP_I18N_CHECK_MYSQL*/ . '

            '; + if ( false && !$wpdb->get_var( "SHOW TABLES LIKE '$wpdb->site'" ) ) + $msg .= '

            ' . sprintf( /*WP_I18N_TABLES_MISSING_LONG*/'Se han perdido las tablas de la base de datos. Esto quiere decir que MySQL no está funcionando, WordPress no ha sido instalado correctamente, o alguien ha eliminado %s. Realmente, debes revisar tu base de datos ahora mismo.'/*/WP_I18N_TABLES_MISSING_LONG*/, $wpdb->site ) . '

            '; + else + $msg .= '

            ' . sprintf( /*WP_I18N_NO_SITE_FOUND*/'No podemos encontrar el sitio %1$s. Buscamos la tabla %2$sen la base de datos %3$s. ¿Es correcto?'/*/WP_I18N_NO_SITE_FOUND*/, rtrim( $domain . $path, '/' ), $wpdb->blogs, DB_NAME ) . '

            '; + $msg .= '

            ' . /*WP_I18N_WHAT_DO_I_DO*/'What do I do now?'/*WP_I18N_WHAT_DO_I_DO*/ . ' '; + $msg .= /*WP_I18N_RTFM*/'Lee la página de errores. Algunas de las guías que hay ahí pueden ayudarte a hacerte una idea sobre qué ha ido mal.'/*/WP_I18N_RTFM*/; + $msg .= ' ' . /*WP_I18N_STUCK*/'Si todavía estás atascado con este mensaje, comprueba que tu base de datos contiene las siguientes tablas:'/*/WP_I18N_STUCK*/ . '

              '; + foreach ( $wpdb->tables('global') as $t => $table ) { + if ( 'sitecategories' == $t ) + continue; + $msg .= '
            • ' . $table . '
            • '; + } + $msg .= '
            '; + + wp_die( $msg, $title ); +} + +?> \ No newline at end of file diff --git a/src/wp-includes/ms-settings.php b/src/wp-includes/ms-settings.php new file mode 100644 index 0000000..6cd2d12 --- /dev/null +++ b/src/wp-includes/ms-settings.php @@ -0,0 +1,136 @@ +wp-config.php. $base está definido como BASE cuando debería ser parecido a / o /sitios/.'/*/WP_I18N_BASE_ERROR*/ ); + +/** Include Multisite initialization functions */ +require( ABSPATH . WPINC . '/ms-load.php' ); +require( ABSPATH . WPINC . '/ms-default-constants.php' ); + +if ( defined( 'SUNRISE' ) ) + include_once( WP_CONTENT_DIR . '/sunrise.php' ); + +/** Check for and define SUBDOMAIN_INSTALL and the deprecated VHOST constant. */ +ms_subdomain_constants(); + +if ( !isset( $current_site ) || !isset( $current_blog ) ) { + + $domain = addslashes( $_SERVER['HTTP_HOST'] ); + if ( false !== strpos( $domain, ':' ) ) { + if ( substr( $domain, -3 ) == ':80' ) { + $domain = substr( $domain, 0, -3 ); + $_SERVER['HTTP_HOST'] = substr( $_SERVER['HTTP_HOST'], 0, -3 ); + } elseif ( substr( $domain, -4 ) == ':443' ) { + $domain = substr( $domain, 0, -4 ); + $_SERVER['HTTP_HOST'] = substr( $_SERVER['HTTP_HOST'], 0, -4 ); + } else { + wp_die( /*WP_I18N_NO_PORT_NUMBER*/'El multisitio sólo funciona sin el número del puerto en la URL.'/*/WP_I18N_NO_PORT_NUMBER*/ ); + } + } + + $domain = rtrim( $domain, '.' ); + $cookie_domain = $domain; + if ( substr( $cookie_domain, 0, 4 ) == 'www.' ) + $cookie_domain = substr( $cookie_domain, 4 ); + + $path = preg_replace( '|([a-z0-9-]+.php.*)|', '', $_SERVER['REQUEST_URI'] ); + $path = str_replace ( '/wp-admin/', '/', $path ); + $path = preg_replace( '|(/[a-z0-9-]+?/).*|', '$1', $path ); + + $current_site = wpmu_current_site(); + if ( ! isset( $current_site->blog_id ) ) + $current_site->blog_id = $wpdb->get_var( $wpdb->prepare( "SELECT blog_id FROM $wpdb->blogs WHERE domain = %s AND path = %s", $current_site->domain, $current_site->path ) ); + + if ( is_subdomain_install() ) { + $current_blog = wp_cache_get( 'current_blog_' . $domain, 'site-options' ); + if ( !$current_blog ) { + $current_blog = get_blog_details( array( 'domain' => $domain ), false ); + if ( $current_blog ) + wp_cache_set( 'current_blog_' . $domain, $current_blog, 'site-options' ); + } + if ( $current_blog && $current_blog->site_id != $current_site->id ) { + $current_site = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->site WHERE id = %d", $current_blog->site_id ) ); + if ( ! isset( $current_site->blog_id ) ) + $current_site->blog_id = $wpdb->get_var( $wpdb->prepare( "SELECT blog_id FROM $wpdb->blogs WHERE domain = %s AND path = %s", $current_site->domain, $current_site->path ) ); + } else + $blogname = substr( $domain, 0, strpos( $domain, '.' ) ); + } else { + $blogname = htmlspecialchars( substr( $_SERVER[ 'REQUEST_URI' ], strlen( $path ) ) ); + if ( false !== strpos( $blogname, '/' ) ) + $blogname = substr( $blogname, 0, strpos( $blogname, '/' ) ); + if ( false !== strpos( $blogname, '?' ) ) + $blogname = substr( $blogname, 0, strpos( $blogname, '?' ) ); + $reserved_blognames = array( 'page', 'comments', 'blog', 'wp-admin', 'wp-includes', 'wp-content', 'files', 'feed' ); + if ( $blogname != '' && ! in_array( $blogname, $reserved_blognames ) && ! is_file( $blogname ) ) + $path .= $blogname . '/'; + $current_blog = wp_cache_get( 'current_blog_' . $domain . $path, 'site-options' ); + if ( ! $current_blog ) { + $current_blog = get_blog_details( array( 'domain' => $domain, 'path' => $path ), false ); + if ( $current_blog ) + wp_cache_set( 'current_blog_' . $domain . $path, $current_blog, 'site-options' ); + } + unset($reserved_blognames); + } + + if ( ! defined( 'WP_INSTALLING' ) && is_subdomain_install() && ! is_object( $current_blog ) ) { + if ( defined( 'NOBLOGREDIRECT' ) ) { + $destination = NOBLOGREDIRECT; + if ( '%siteurl%' == $destination ) + $destination = "http://" . $current_site->domain . $current_site->path; + } else { + $destination = 'http://' . $current_site->domain . $current_site->path . 'wp-signup.php?new=' . str_replace( '.' . $current_site->domain, '', $domain ); + } + header( 'Location: ' . $destination ); + die(); + } + + if ( ! defined( 'WP_INSTALLING' ) ) { + if ( $current_site && ! $current_blog ) { + if ( $current_site->domain != $_SERVER[ 'HTTP_HOST' ] ) { + header( 'Location: http://' . $current_site->domain . $current_site->path ); + exit; + } + $current_blog = get_blog_details( array( 'domain' => $current_site->domain, 'path' => $current_site->path ), false ); + } + if ( ! $current_blog || ! $current_site ) + ms_not_installed(); + } + + $blog_id = $current_blog->blog_id; + $public = $current_blog->public; + + if ( empty( $current_blog->site_id ) ) + $current_blog->site_id = 1; + $site_id = $current_blog->site_id; + + $current_site = get_current_site_name( $current_site ); + + if ( ! $blog_id ) { + if ( defined( 'WP_INSTALLING' ) ) { + $current_blog->blog_id = $blog_id = 1; + } else { + $msg = ! $wpdb->get_var( "SHOW TABLES LIKE '$wpdb->site'" ) ? ' ' . /*WP_I18N_TABLES_MISSING*/'No se encuentran tablas de la base de datos.'/*/WP_I18N_TABLES_MISSING*/ : ''; + wp_die( /*WP_I18N_NO_BLOG*/'No existe ningún sitio en el sistema con este nombre.'/*/WP_I18N_NO_BLOG*/ . $msg ); + } + } +} +$wpdb->set_prefix( $table_prefix, false ); // $table_prefix can be set in sunrise.php +$wpdb->set_blog_id( $current_blog->blog_id, $current_blog->site_id ); +$table_prefix = $wpdb->get_blog_prefix(); + +// need to init cache again after blog_id is set +wp_start_object_cache(); + +// Define upload directory constants +ms_upload_constants(); diff --git a/src/wp-includes/nav-menu-template.php b/src/wp-includes/nav-menu-template.php new file mode 100644 index 0000000..21898ab --- /dev/null +++ b/src/wp-includes/nav-menu-template.php @@ -0,0 +1,489 @@ + 'menu_item_parent', 'id' => 'db_id' ); + + /** + * @see Walker::start_lvl() + * @since 3.0.0 + * + * @param string $output Passed by reference. Used to append additional content. + * @param int $depth Depth of page. Used for padding. + */ + function start_lvl(&$output, $depth) { + $indent = str_repeat("\t", $depth); + $output .= "\n$indent
              \n"; + } + + /** + * @see Walker::end_lvl() + * @since 3.0.0 + * + * @param string $output Passed by reference. Used to append additional content. + * @param int $depth Depth of page. Used for padding. + */ + function end_lvl(&$output, $depth) { + $indent = str_repeat("\t", $depth); + $output .= "$indent
            \n"; + } + + /** + * @see Walker::start_el() + * @since 3.0.0 + * + * @param string $output Passed by reference. Used to append additional content. + * @param object $item Menu item data object. + * @param int $depth Depth of menu item. Used for padding. + * @param int $current_page Menu item ID. + * @param object $args + */ + function start_el(&$output, $item, $depth, $args) { + global $wp_query; + $indent = ( $depth ) ? str_repeat( "\t", $depth ) : ''; + + $class_names = $value = ''; + + $classes = empty( $item->classes ) ? array() : (array) $item->classes; + $classes[] = 'menu-item-' . $item->ID; + + $class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item, $args ) ); + $class_names = ' class="' . esc_attr( $class_names ) . '"'; + + $id = apply_filters( 'nav_menu_item_id', 'menu-item-'. $item->ID, $item, $args ); + $id = strlen( $id ) ? ' id="' . esc_attr( $id ) . '"' : ''; + + $output .= $indent . ''; + + $attributes = ! empty( $item->attr_title ) ? ' title="' . esc_attr( $item->attr_title ) .'"' : ''; + $attributes .= ! empty( $item->target ) ? ' target="' . esc_attr( $item->target ) .'"' : ''; + $attributes .= ! empty( $item->xfn ) ? ' rel="' . esc_attr( $item->xfn ) .'"' : ''; + $attributes .= ! empty( $item->url ) ? ' href="' . esc_attr( $item->url ) .'"' : ''; + + $item_output = $args->before; + $item_output .= ''; + $item_output .= $args->link_before . apply_filters( 'the_title', $item->title, $item->ID ) . $args->link_after; + $item_output .= ''; + $item_output .= $args->after; + + $output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args ); + } + + /** + * @see Walker::end_el() + * @since 3.0.0 + * + * @param string $output Passed by reference. Used to append additional content. + * @param object $item Page data object. Not used. + * @param int $depth Depth of page. Not Used. + */ + function end_el(&$output, $item, $depth) { + $output .= "\n"; + } +} + +/** + * Displays a navigation menu. + * + * Optional $args contents: + * + * menu - The menu that is desired. Accepts (matching in order) id, slug, name. Defaults to blank. + * menu_class - CSS class to use for the ul element which forms the menu. Defaults to 'menu'. + * menu_id - The ID that is applied to the ul element which forms the menu. Defaults to the menu slug, incremented. + * container - Whether to wrap the ul, and what to wrap it with. Defaults to 'div'. + * container_class - the class that is applied to the container. Defaults to 'menu-{menu slug}-container'. + * container_id - The ID that is applied to the container. Defaults to blank. + * fallback_cb - If the menu doesn't exists, a callback function will fire. Defaults to 'wp_page_menu'. Set to false for no fallback. + * before - Text before the link text. + * after - Text after the link text. + * link_before - Text before the link. + * link_after - Text after the link. + * echo - Whether to echo the menu or return it. Defaults to echo. + * depth - how many levels of the hierarchy are to be included. 0 means all. Defaults to 0. + * walker - allows a custom walker to be specified. + * theme_location - the location in the theme to be used. Must be registered with register_nav_menu() in order to be selectable by the user. + * items_wrap - How the list items should be wrapped. Defaults to a ul with an id and class. Uses printf() format with numbered placeholders. + * + * @since 3.0.0 + * + * @param array $args Arguments + */ +function wp_nav_menu( $args = array() ) { + static $menu_id_slugs = array(); + + $defaults = array( 'menu' => '', 'container' => 'div', 'container_class' => '', 'container_id' => '', 'menu_class' => 'menu', 'menu_id' => '', + 'echo' => true, 'fallback_cb' => 'wp_page_menu', 'before' => '', 'after' => '', 'link_before' => '', 'link_after' => '', 'items_wrap' => '
              %3$s
            ', + 'depth' => 0, 'walker' => '', 'theme_location' => '' ); + + $args = wp_parse_args( $args, $defaults ); + $args = apply_filters( 'wp_nav_menu_args', $args ); + $args = (object) $args; + + // Get the nav menu based on the requested menu + $menu = wp_get_nav_menu_object( $args->menu ); + + // Get the nav menu based on the theme_location + if ( ! $menu && $args->theme_location && ( $locations = get_nav_menu_locations() ) && isset( $locations[ $args->theme_location ] ) ) + $menu = wp_get_nav_menu_object( $locations[ $args->theme_location ] ); + + // get the first menu that has items if we still can't find a menu + if ( ! $menu && !$args->theme_location ) { + $menus = wp_get_nav_menus(); + foreach ( $menus as $menu_maybe ) { + if ( $menu_items = wp_get_nav_menu_items($menu_maybe->term_id) ) { + $menu = $menu_maybe; + break; + } + } + } + + // If the menu exists, get its items. + if ( $menu && ! is_wp_error($menu) && !isset($menu_items) ) + $menu_items = wp_get_nav_menu_items( $menu->term_id ); + + // If no menu was found or if the menu has no items and no location was requested, call the fallback_cb if it exists + if ( ( !$menu || is_wp_error($menu) || ( isset($menu_items) && empty($menu_items) && !$args->theme_location ) ) + && $args->fallback_cb && is_callable( $args->fallback_cb ) ) + return call_user_func( $args->fallback_cb, (array) $args ); + + // If no fallback function was specified and the menu doesn't exists, bail. + if ( !$menu || is_wp_error($menu) ) + return false; + + $nav_menu = $items = ''; + + $show_container = false; + if ( $args->container ) { + $allowed_tags = apply_filters( 'wp_nav_menu_container_allowedtags', array( 'div', 'nav' ) ); + if ( in_array( $args->container, $allowed_tags ) ) { + $show_container = true; + $class = $args->container_class ? ' class="' . esc_attr( $args->container_class ) . '"' : ' class="menu-'. $menu->slug .'-container"'; + $id = $args->container_id ? ' id="' . esc_attr( $args->container_id ) . '"' : ''; + $nav_menu .= '<'. $args->container . $id . $class . '>'; + } + } + + // Set up the $menu_item variables + _wp_menu_item_classes_by_context( $menu_items ); + + $sorted_menu_items = array(); + foreach ( (array) $menu_items as $key => $menu_item ) + $sorted_menu_items[$menu_item->menu_order] = $menu_item; + + unset($menu_items); + + $sorted_menu_items = apply_filters( 'wp_nav_menu_objects', $sorted_menu_items, $args ); + + $items .= walk_nav_menu_tree( $sorted_menu_items, $args->depth, $args ); + unset($sorted_menu_items); + + // Attributes + if ( ! empty( $args->menu_id ) ) { + $wrap_id = $args->menu_id; + } else { + $wrap_id = 'menu-' . $menu->slug; + while ( in_array( $wrap_id, $menu_id_slugs ) ) { + if ( preg_match( '#-(\d+)$#', $wrap_id, $matches ) ) + $wrap_id = preg_replace('#-(\d+)$#', '-' . ++$matches[1], $wrap_id ); + else + $wrap_id = $wrap_id . '-1'; + } + } + $menu_id_slugs[] = $wrap_id; + + $wrap_class = $args->menu_class ? $args->menu_class : ''; + + // Allow plugins to hook into the menu to add their own
          • 's + $items = apply_filters( 'wp_nav_menu_items', $items, $args ); + $items = apply_filters( "wp_nav_menu_{$menu->slug}_items", $items, $args ); + + $nav_menu .= sprintf( $args->items_wrap, esc_attr( $wrap_id ), esc_attr( $wrap_class ), $items ); + unset( $items ); + + if ( $show_container ) + $nav_menu .= 'container . '>'; + + $nav_menu = apply_filters( 'wp_nav_menu', $nav_menu, $args ); + + if ( $args->echo ) + echo $nav_menu; + else + return $nav_menu; +} + +/** + * Add the class property classes for the current context, if applicable. + * + * @access private + * @since 3.0 + * + * @param array $menu_items The current menu item objects to which to add the class property information. + */ +function _wp_menu_item_classes_by_context( &$menu_items ) { + global $wp_query; + + $queried_object = $wp_query->get_queried_object(); + $queried_object_id = (int) $wp_query->queried_object_id; + + $active_object = ''; + $active_ancestor_item_ids = array(); + $active_parent_item_ids = array(); + $active_parent_object_ids = array(); + $possible_taxonomy_ancestors = array(); + $possible_object_parents = array(); + $home_page_id = (int) get_option( 'page_for_posts' ); + + if ( $wp_query->is_singular && ! empty( $queried_object->post_type ) && ! is_post_type_hierarchical( $queried_object->post_type ) ) { + foreach ( (array) get_object_taxonomies( $queried_object->post_type ) as $taxonomy ) { + if ( is_taxonomy_hierarchical( $taxonomy ) ) { + $term_hierarchy = _get_term_hierarchy( $taxonomy ); + $terms = wp_get_object_terms( $queried_object_id, $taxonomy, array( 'fields' => 'ids' ) ); + if ( is_array( $terms ) ) { + $possible_object_parents = array_merge( $possible_object_parents, $terms ); + $term_to_ancestor = array(); + foreach ( (array) $term_hierarchy as $anc => $descs ) { + foreach ( (array) $descs as $desc ) + $term_to_ancestor[ $desc ] = $anc; + } + + foreach ( $terms as $desc ) { + do { + $possible_taxonomy_ancestors[ $taxonomy ][] = $desc; + if ( isset( $term_to_ancestor[ $desc ] ) ) { + $_desc = $term_to_ancestor[ $desc ]; + unset( $term_to_ancestor[ $desc ] ); + $desc = $_desc; + } else { + $desc = 0; + } + } while ( ! empty( $desc ) ); + } + } + } + } + } elseif ( ! empty( $queried_object->post_type ) && is_post_type_hierarchical( $queried_object->post_type ) ) { + _get_post_ancestors( $queried_object ); + } elseif ( ! empty( $queried_object->taxonomy ) && is_taxonomy_hierarchical( $queried_object->taxonomy ) ) { + $term_hierarchy = _get_term_hierarchy( $queried_object->taxonomy ); + $term_to_ancestor = array(); + foreach ( (array) $term_hierarchy as $anc => $descs ) { + foreach ( (array) $descs as $desc ) + $term_to_ancestor[ $desc ] = $anc; + } + $desc = $queried_object->term_id; + do { + $possible_taxonomy_ancestors[ $queried_object->taxonomy ][] = $desc; + if ( isset( $term_to_ancestor[ $desc ] ) ) { + $_desc = $term_to_ancestor[ $desc ]; + unset( $term_to_ancestor[ $desc ] ); + $desc = $_desc; + } else { + $desc = 0; + } + } while ( ! empty( $desc ) ); + } + + $possible_object_parents = array_filter( $possible_object_parents ); + + $front_page_url = home_url(); + + foreach ( (array) $menu_items as $key => $menu_item ) { + + $menu_items[$key]->current = false; + + $classes = (array) $menu_item->classes; + $classes[] = 'menu-item'; + $classes[] = 'menu-item-type-' . $menu_item->type; + $classes[] = 'menu-item-object-' . $menu_item->object; + + // if the menu item corresponds to a taxonomy term for the currently-queried non-hierarchical post object + if ( $wp_query->is_singular && 'taxonomy' == $menu_item->type && in_array( $menu_item->object_id, $possible_object_parents ) ) { + $active_parent_object_ids[] = (int) $menu_item->object_id; + $active_parent_item_ids[] = (int) $menu_item->db_id; + $active_object = $queried_object->post_type; + + // if the menu item corresponds to the currently-queried post or taxonomy object + } elseif ( + $menu_item->object_id == $queried_object_id && + ( + ( ! empty( $home_page_id ) && 'post_type' == $menu_item->type && $wp_query->is_home && $home_page_id == $menu_item->object_id ) || + ( 'post_type' == $menu_item->type && $wp_query->is_singular ) || + ( 'taxonomy' == $menu_item->type && ( $wp_query->is_category || $wp_query->is_tag || $wp_query->is_tax ) ) + ) + ) { + $classes[] = 'current-menu-item'; + $menu_items[$key]->current = true; + $_anc_id = (int) $menu_item->db_id; + + while( + ( $_anc_id = get_post_meta( $_anc_id, '_menu_item_menu_item_parent', true ) ) && + ! in_array( $_anc_id, $active_ancestor_item_ids ) + ) { + $active_ancestor_item_ids[] = $_anc_id; + } + + if ( 'post_type' == $menu_item->type && 'page' == $menu_item->object ) { + // Back compat classes for pages to match wp_page_menu() + $classes[] = 'page_item'; + $classes[] = 'page-item-' . $menu_item->object_id; + $classes[] = 'current_page_item'; + } + $active_parent_item_ids[] = (int) $menu_item->menu_item_parent; + $active_parent_object_ids[] = (int) $menu_item->post_parent; + $active_object = $menu_item->object; + + // if the menu item corresponds to the currently-requested URL + } elseif ( 'custom' == $menu_item->object ) { + $current_url = untrailingslashit( ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] ); + $item_url = untrailingslashit( strpos( $menu_item->url, '#' ) ? substr( $menu_item->url, 0, strpos( $menu_item->url, '#' ) ) : $menu_item->url ); + $_indexless_current = untrailingslashit( preg_replace( '/index.php$/', '', $current_url ) ); + + if ( in_array( $item_url, array( $current_url, $_indexless_current ) ) ) { + $classes[] = 'current-menu-item'; + $menu_items[$key]->current = true; + $_anc_id = (int) $menu_item->db_id; + + while( + ( $_anc_id = get_post_meta( $_anc_id, '_menu_item_menu_item_parent', true ) ) && + ! in_array( $_anc_id, $active_ancestor_item_ids ) + ) { + $active_ancestor_item_ids[] = $_anc_id; + } + + if ( in_array( home_url(), array( untrailingslashit( $current_url ), untrailingslashit( $_indexless_current ) ) ) ) { + // Back compat for home link to match wp_page_menu() + $classes[] = 'current_page_item'; + } + $active_parent_item_ids[] = (int) $menu_item->menu_item_parent; + $active_parent_object_ids[] = (int) $menu_item->post_parent; + $active_object = $menu_item->object; + + // give front page item current-menu-item class when extra query arguments involved + } elseif ( $item_url == $front_page_url && is_front_page() ) { + $classes[] = 'current-menu-item'; + } + + if ( untrailingslashit($item_url) == home_url() ) + $classes[] = 'menu-item-home'; + } + + // back-compat with wp_page_menu: add "current_page_parent" to static home page link for any non-page query + if ( ! empty( $home_page_id ) && 'post_type' == $menu_item->type && empty( $wp_query->is_page ) && $home_page_id == $menu_item->object_id ) + $classes[] = 'current_page_parent'; + + $menu_items[$key]->classes = array_unique( $classes ); + } + $active_ancestor_item_ids = array_filter( array_unique( $active_ancestor_item_ids ) ); + $active_parent_item_ids = array_filter( array_unique( $active_parent_item_ids ) ); + $active_parent_object_ids = array_filter( array_unique( $active_parent_object_ids ) ); + + // set parent's class + foreach ( (array) $menu_items as $key => $parent_item ) { + $classes = (array) $parent_item->classes; + $menu_items[$key]->current_item_ancestor = false; + $menu_items[$key]->current_item_parent = false; + + if ( + isset( $parent_item->type ) && + ( + // ancestral post object + ( + 'post_type' == $parent_item->type && + ! empty( $queried_object->post_type ) && + is_post_type_hierarchical( $queried_object->post_type ) && + in_array( $parent_item->object_id, $queried_object->ancestors ) && + $parent_item->object != $queried_object->ID + ) || + + // ancestral term + ( + 'taxonomy' == $parent_item->type && + isset( $possible_taxonomy_ancestors[ $parent_item->object ] ) && + in_array( $parent_item->object_id, $possible_taxonomy_ancestors[ $parent_item->object ] ) && + ( + ! isset( $queried_object->term_id ) || + $parent_item->object_id != $queried_object->term_id + ) + ) + ) + ) { + $classes[] = empty( $queried_object->taxonomy ) ? 'current-' . $queried_object->post_type . '-ancestor' : 'current-' . $queried_object->taxonomy . '-ancestor'; + } + + if ( in_array( intval( $parent_item->db_id ), $active_ancestor_item_ids ) ) { + $classes[] = 'current-menu-ancestor'; + $menu_items[$key]->current_item_ancestor = true; + } + if ( in_array( $parent_item->db_id, $active_parent_item_ids ) ) { + $classes[] = 'current-menu-parent'; + $menu_items[$key]->current_item_parent = true; + } + if ( in_array( $parent_item->object_id, $active_parent_object_ids ) ) + $classes[] = 'current-' . $active_object . '-parent'; + + if ( 'post_type' == $parent_item->type && 'page' == $parent_item->object ) { + // Back compat classes for pages to match wp_page_menu() + if ( in_array('current-menu-parent', $classes) ) + $classes[] = 'current_page_parent'; + if ( in_array('current-menu-ancestor', $classes) ) + $classes[] = 'current_page_ancestor'; + } + + $menu_items[$key]->classes = array_unique( $classes ); + } +} + +/** + * Retrieve the HTML list content for nav menu items. + * + * @uses Walker_Nav_Menu to create HTML list content. + * @since 3.0.0 + * @see Walker::walk() for parameters and return description. + */ +function walk_nav_menu_tree( $items, $depth, $r ) { + $walker = ( empty($r->walker) ) ? new Walker_Nav_Menu : $r->walker; + $args = array( $items, $depth, $r ); + + return call_user_func_array( array(&$walker, 'walk'), $args ); +} + +/** + * Prevents a menu item ID from being used more than once. + * + * @since 3.0.1 + * @access private + */ +function _nav_menu_item_id_use_once( $id, $item ) { + static $_used_ids = array(); + if ( in_array( $item->ID, $_used_ids ) ) + return ''; + $_used_ids[] = $item->ID; + return $id; +} +add_filter( 'nav_menu_item_id', '_nav_menu_item_id_use_once', 10, 2 ); diff --git a/src/wp-includes/nav-menu.php b/src/wp-includes/nav-menu.php new file mode 100644 index 0000000..467d73e --- /dev/null +++ b/src/wp-includes/nav-menu.php @@ -0,0 +1,784 @@ +taxonomy ) && + 'nav_menu' == $menu_obj->taxonomy + ) + return true; + + return false; +} + +/** + * Register navigation menus for a theme. + * + * @since 3.0.0 + * + * @param array $locations Associative array of menu location identifiers (like a slug) and descriptive text. + */ +function register_nav_menus( $locations = array() ) { + global $_wp_registered_nav_menus; + + add_theme_support( 'menus' ); + + $_wp_registered_nav_menus = array_merge( (array) $_wp_registered_nav_menus, $locations ); +} + +/** + * Unregisters a navigation menu for a theme. + * + * @param array $location the menu location identifier + * + * @return bool True on success, false on failure. + */ +function unregister_nav_menu( $location ) { + global $_wp_registered_nav_menus; + + if ( is_array( $_wp_registered_nav_menus ) && isset( $_wp_registered_nav_menus[$location] ) ) { + unset( $_wp_registered_nav_menus[$location] ); + return true; + } + return false; +} + +/** + * Register a navigation menu for a theme. + * + * @since 3.0.0 + * + * @param string $location Menu location identifier, like a slug. + * @param string $description Menu location descriptive text. + */ +function register_nav_menu( $location, $description ) { + register_nav_menus( array( $location => $description ) ); +} +/** + * Returns an array of all registered navigation menus in a theme + * + * @since 3.0.0 + * @return array + */ +function get_registered_nav_menus() { + global $_wp_registered_nav_menus; + if ( isset( $_wp_registered_nav_menus ) ) + return $_wp_registered_nav_menus; + return array(); +} + +/** + * Returns an array with the registered navigation menu locations and the menu assigned to it + * + * @since 3.0.0 + * @return array + */ + +function get_nav_menu_locations() { + return get_theme_mod( 'nav_menu_locations' ); +} + +/** + * Whether a registered nav menu location has a menu assigned to it. + * + * @since 3.0.0 + * @param string $location Menu location identifier. + * @return bool Whether location has a menu. + */ +function has_nav_menu( $location ) { + $locations = get_nav_menu_locations(); + return ( ! empty( $locations[ $location ] ) ); +} + +/** + * Determine whether the given ID is a nav menu item. + * + * @since 3.0.0 + * + * @param int $menu_item_id The ID of the potential nav menu item. + * @return bool Whether the given ID is that of a nav menu item. + */ +function is_nav_menu_item( $menu_item_id = 0 ) { + return ( ! is_wp_error( $menu_item_id ) && ( 'nav_menu_item' == get_post_type( $menu_item_id ) ) ); +} + +/** + * Create a Navigation Menu. + * + * @since 3.0.0 + * + * @param string $menu_name Menu Name + * @return mixed Menu object on success|WP_Error on failure + */ +function wp_create_nav_menu( $menu_name ) { + return wp_update_nav_menu_object( 0, array( 'menu-name' => $menu_name ) ); +} + +/** + * Delete a Navigation Menu. + * + * @since 3.0.0 + * + * @param string $menu name|id|slug + * @return mixed Menu object on success|WP_Error on failure + */ +function wp_delete_nav_menu( $menu ) { + $menu = wp_get_nav_menu_object( $menu ); + if ( ! $menu ) + return false; + + $menu_objects = get_objects_in_term( $menu->term_id, 'nav_menu' ); + if ( ! empty( $menu_objects ) ) { + foreach ( $menu_objects as $item ) { + wp_delete_post( $item ); + } + } + + $result = wp_delete_term( $menu->term_id, 'nav_menu' ); + + if ( $result && !is_wp_error($result) ) + do_action( 'wp_delete_nav_menu', $menu->term_id ); + + return $result; +} + +/** + * Save the properties of a menu or create a new menu with those properties. + * + * @since 3.0.0 + * + * @param int $menu_id The ID of the menu or "0" to create a new menu. + * @param array $menu_data The array of menu data. + * @return int|error object The menu's ID or WP_Error object. + */ +function wp_update_nav_menu_object( $menu_id = 0, $menu_data = array() ) { + $menu_id = (int) $menu_id; + + $_menu = wp_get_nav_menu_object( $menu_id ); + + $args = array( + 'description' => ( isset( $menu_data['description'] ) ? $menu_data['description'] : '' ), + 'name' => ( isset( $menu_data['menu-name'] ) ? $menu_data['menu-name'] : '' ), + 'parent' => ( isset( $menu_data['parent'] ) ? (int) $menu_data['parent'] : 0 ), + 'slug' => null, + ); + + // double-check that we're not going to have one menu take the name of another + $_possible_existing = get_term_by( 'name', $menu_data['menu-name'], 'nav_menu' ); + if ( + $_possible_existing && + ! is_wp_error( $_possible_existing ) && + isset( $_possible_existing->term_id ) && + $_possible_existing->term_id != $menu_id + ) + return new WP_Error( 'menu_exists', sprintf( __('The menu name %s conflicts with another menu name. Please try another.'), esc_html( $menu_data['menu-name'] ) ) ); + + // menu doesn't already exist, so create a new menu + if ( ! $_menu || is_wp_error( $_menu ) ) { + $menu_exists = get_term_by( 'name', $menu_data['menu-name'], 'nav_menu' ); + + if ( $menu_exists ) + return new WP_Error( 'menu_exists', sprintf( __('The menu name %s conflicts with another menu name. Please try another.'), esc_html( $menu_data['menu-name'] ) ) ); + + $_menu = wp_insert_term( $menu_data['menu-name'], 'nav_menu', $args ); + + if ( is_wp_error( $_menu ) ) + return $_menu; + + do_action( 'wp_create_nav_menu', $_menu['term_id'], $menu_data ); + + return (int) $_menu['term_id']; + } + + if ( ! $_menu || ! isset( $_menu->term_id ) ) + return 0; + + $menu_id = (int) $_menu->term_id; + + $update_response = wp_update_term( $menu_id, 'nav_menu', $args ); + + if ( is_wp_error( $update_response ) ) + return $update_response; + + do_action( 'wp_update_nav_menu', $menu_id, $menu_data ); + return $menu_id; +} + +/** + * Save the properties of a menu item or create a new one. + * + * @since 3.0.0 + * + * @param int $menu_id The ID of the menu. Required. If "0", makes the menu item a draft orphan. + * @param int $menu_item_db_id The ID of the menu item. If "0", creates a new menu item. + * @param array $menu_item_data The menu item's data. + * @return int The menu item's database ID or WP_Error object on failure. + */ +function wp_update_nav_menu_item( $menu_id = 0, $menu_item_db_id = 0, $menu_item_data = array() ) { + $menu_id = (int) $menu_id; + $menu_item_db_id = (int) $menu_item_db_id; + + // make sure that we don't convert non-nav_menu_item objects into nav_menu_item objects + if ( ! empty( $menu_item_db_id ) && ! is_nav_menu_item( $menu_item_db_id ) ) + return new WP_Error('update_nav_menu_item_failed', __('The given object ID is not that of a menu item.')); + + $menu = wp_get_nav_menu_object( $menu_id ); + + if ( ( ! $menu && 0 !== $menu_id ) || is_wp_error( $menu ) ) + return $menu; + + $menu_items = 0 == $menu_id ? array() : (array) wp_get_nav_menu_items( $menu_id, array( 'post_status' => 'publish,draft' ) ); + + $count = count( $menu_items ); + + $defaults = array( + 'menu-item-db-id' => $menu_item_db_id, + 'menu-item-object-id' => 0, + 'menu-item-object' => '', + 'menu-item-parent-id' => 0, + 'menu-item-position' => 0, + 'menu-item-type' => 'custom', + 'menu-item-title' => '', + 'menu-item-url' => '', + 'menu-item-description' => '', + 'menu-item-attr-title' => '', + 'menu-item-target' => '', + 'menu-item-classes' => '', + 'menu-item-xfn' => '', + 'menu-item-status' => '', + ); + + $args = wp_parse_args( $menu_item_data, $defaults ); + + if ( 0 == $menu_id ) { + $args['menu-item-position'] = 1; + } elseif ( 0 == (int) $args['menu-item-position'] ) { + $last_item = array_pop( $menu_items ); + $args['menu-item-position'] = ( $last_item && isset( $last_item->menu_order ) ) ? 1 + $last_item->menu_order : $count; + } + + $original_parent = 0 < $menu_item_db_id ? get_post_field( 'post_parent', $menu_item_db_id ) : 0; + + if ( 'custom' != $args['menu-item-type'] ) { + /* if non-custom menu item, then: + * use original object's URL + * blank default title to sync with original object's + */ + + $args['menu-item-url'] = ''; + + $original_title = ''; + if ( 'taxonomy' == $args['menu-item-type'] ) { + $original_parent = get_term_field( 'parent', $args['menu-item-object-id'], $args['menu-item-object'], 'raw' ); + $original_title = get_term_field( 'name', $args['menu-item-object-id'], $args['menu-item-object'], 'raw' ); + } elseif ( 'post_type' == $args['menu-item-type'] ) { + + $original_object = get_post( $args['menu-item-object-id'] ); + $original_parent = (int) $original_object->post_parent; + $original_title = $original_object->post_title; + } + + if ( empty( $args['menu-item-title'] ) || $args['menu-item-title'] == $original_title ) { + $args['menu-item-title'] = ''; + + // hack to get wp to create a post object when too many properties are empty + if ( empty( $args['menu-item-description'] ) ) + $args['menu-item-description'] = ' '; + } + } + + // Populate the menu item object + $post = array( + 'menu_order' => $args['menu-item-position'], + 'ping_status' => 0, + 'post_content' => $args['menu-item-description'], + 'post_excerpt' => $args['menu-item-attr-title'], + 'post_parent' => $original_parent, + 'post_title' => $args['menu-item-title'], + 'post_type' => 'nav_menu_item', + ); + + if ( 0 != $menu_id ) + $post['tax_input'] = array( 'nav_menu' => array( intval( $menu->term_id ) ) ); + + // New menu item. Default is draft status + if ( 0 == $menu_item_db_id ) { + $post['ID'] = 0; + $post['post_status'] = 'publish' == $args['menu-item-status'] ? 'publish' : 'draft'; + $menu_item_db_id = wp_insert_post( $post ); + + // Update existing menu item. Default is publish status + } else { + $post['ID'] = $menu_item_db_id; + $post['post_status'] = 'draft' == $args['menu-item-status'] ? 'draft' : 'publish'; + wp_update_post( $post ); + } + + if ( 'custom' == $args['menu-item-type'] ) { + $args['menu-item-object-id'] = $menu_item_db_id; + $args['menu-item-object'] = 'custom'; + } + + if ( ! $menu_item_db_id || is_wp_error( $menu_item_db_id ) ) + return $menu_item_db_id; + + $menu_item_db_id = (int) $menu_item_db_id; + + update_post_meta( $menu_item_db_id, '_menu_item_type', sanitize_key($args['menu-item-type']) ); + update_post_meta( $menu_item_db_id, '_menu_item_menu_item_parent', (int) $args['menu-item-parent-id'] ); + update_post_meta( $menu_item_db_id, '_menu_item_object_id', (int) $args['menu-item-object-id'] ); + update_post_meta( $menu_item_db_id, '_menu_item_object', sanitize_key($args['menu-item-object']) ); + update_post_meta( $menu_item_db_id, '_menu_item_target', sanitize_key($args['menu-item-target']) ); + + $args['menu-item-classes'] = array_map( 'sanitize_html_class', explode( ' ', $args['menu-item-classes'] ) ); + $args['menu-item-xfn'] = implode( ' ', array_map( 'sanitize_html_class', explode( ' ', $args['menu-item-xfn'] ) ) ); + update_post_meta( $menu_item_db_id, '_menu_item_classes', $args['menu-item-classes'] ); + update_post_meta( $menu_item_db_id, '_menu_item_xfn', $args['menu-item-xfn'] ); + update_post_meta( $menu_item_db_id, '_menu_item_url', esc_url_raw($args['menu-item-url']) ); + + if ( 0 == $menu_id ) + update_post_meta( $menu_item_db_id, '_menu_item_orphaned', time() ); + else + delete_post_meta( $menu_item_db_id, '_menu_item_orphaned' ); + + do_action('wp_update_nav_menu_item', $menu_id, $menu_item_db_id, $args ); + + return $menu_item_db_id; +} + +/** + * Returns all navigation menu objects. + * + * @since 3.0.0 + * + * @param array $args Array of arguments passed on to get_terms(). + * @return array menu objects + */ +function wp_get_nav_menus( $args = array() ) { + $defaults = array( 'hide_empty' => false, 'orderby' => 'none' ); + $args = wp_parse_args( $args, $defaults ); + return apply_filters( 'wp_get_nav_menus', get_terms( 'nav_menu', $args), $args ); +} + +/** + * Sort menu items by the desired key. + * + * @since 3.0.0 + * @access private + * + * @param object $a The first object to compare + * @param object $b The second object to compare + * @return int -1, 0, or 1 if $a is considered to be respectively less than, equal to, or greater than $b. + */ +function _sort_nav_menu_items( $a, $b ) { + global $_menu_item_sort_prop; + + if ( empty( $_menu_item_sort_prop ) ) + return 0; + + if ( ! isset( $a->$_menu_item_sort_prop ) || ! isset( $b->$_menu_item_sort_prop ) ) + return 0; + + $_a = (int) $a->$_menu_item_sort_prop; + $_b = (int) $b->$_menu_item_sort_prop; + + if ( $a->$_menu_item_sort_prop == $b->$_menu_item_sort_prop ) + return 0; + elseif ( $_a == $a->$_menu_item_sort_prop && $_b == $b->$_menu_item_sort_prop ) + return $_a < $_b ? -1 : 1; + else + return strcmp( $a->$_menu_item_sort_prop, $b->$_menu_item_sort_prop ); +} + +/** + * Returns if a menu item is valid. Bug #13958 + * + * @since 3.2.0 + * @access private + * + * @param object $menu_item The menu item to check + * @return bool false if invalid, else true. + */ +function _is_valid_nav_menu_item( $item ) { + if ( ! empty( $item->_invalid ) ) + return false; + + return true; +} + +/** + * Returns all menu items of a navigation menu. + * + * @since 3.0.0 + * + * @param string $menu menu name, id, or slug + * @param string $args + * @return mixed $items array of menu items, else false. + */ +function wp_get_nav_menu_items( $menu, $args = array() ) { + global $_wp_using_ext_object_cache; + + $menu = wp_get_nav_menu_object( $menu ); + + if ( ! $menu ) + return false; + + static $fetched = array(); + + $items = get_objects_in_term( $menu->term_id, 'nav_menu' ); + + if ( empty( $items ) ) + return $items; + + $defaults = array( 'order' => 'ASC', 'orderby' => 'menu_order', 'post_type' => 'nav_menu_item', + 'post_status' => 'publish', 'output' => ARRAY_A, 'output_key' => 'menu_order', 'nopaging' => true, + 'update_post_term_cache' => false ); + $args = wp_parse_args( $args, $defaults ); + if ( count( $items ) > 1 ) + $args['include'] = implode( ',', $items ); + else + $args['include'] = $items[0]; + + $items = get_posts( $args ); + + if ( is_wp_error( $items ) || ! is_array( $items ) ) + return false; + + // Get all posts and terms at once to prime the caches + if ( empty( $fetched[$menu->term_id] ) || $_wp_using_ext_object_cache ) { + $fetched[$menu->term_id] = true; + $posts = array(); + $terms = array(); + foreach ( $items as $item ) { + $object_id = get_post_meta( $item->ID, '_menu_item_object_id', true ); + $object = get_post_meta( $item->ID, '_menu_item_object', true ); + $type = get_post_meta( $item->ID, '_menu_item_type', true ); + + if ( 'post_type' == $type ) + $posts[$object][] = $object_id; + elseif ( 'taxonomy' == $type) + $terms[$object][] = $object_id; + } + + if ( ! empty( $posts ) ) { + foreach ( array_keys($posts) as $post_type ) { + get_posts( array('post__in' => $posts[$post_type], 'post_type' => $post_type, 'nopaging' => true, 'update_post_term_cache' => false) ); + } + } + unset($posts); + + if ( ! empty( $terms ) ) { + foreach ( array_keys($terms) as $taxonomy ) { + get_terms($taxonomy, array('include' => $terms[$taxonomy]) ); + } + } + unset($terms); + } + + $items = array_map( 'wp_setup_nav_menu_item', $items ); + + if ( ! is_admin() ) // Remove invalid items only in frontend + $items = array_filter( $items, '_is_valid_nav_menu_item' ); + + if ( ARRAY_A == $args['output'] ) { + $GLOBALS['_menu_item_sort_prop'] = $args['output_key']; + usort($items, '_sort_nav_menu_items'); + $i = 1; + foreach( $items as $k => $item ) { + $items[$k]->$args['output_key'] = $i++; + } + } + + return apply_filters( 'wp_get_nav_menu_items', $items, $menu, $args ); +} + +/** + * Decorates a menu item object with the shared navigation menu item properties. + * + * Properties: + * - db_id: The DB ID of this item as a nav_menu_item object, if it exists (0 if it doesn't exist). + * - object_id: The DB ID of the original object this menu item represents, e.g. ID for posts and term_id for categories. + * - type: The family of objects originally represented, such as "post_type" or "taxonomy." + * - object: The type of object originally represented, such as "category," "post", or "attachment." + * - type_label: The singular label used to describe this type of menu item. + * - post_parent: The DB ID of the original object's parent object, if any (0 otherwise). + * - menu_item_parent: The DB ID of the nav_menu_item that is this item's menu parent, if any. 0 otherwise. + * - url: The URL to which this menu item points. + * - title: The title of this menu item. + * - target: The target attribute of the link element for this menu item. + * - attr_title: The title attribute of the link element for this menu item. + * - classes: The array of class attribute values for the link element of this menu item. + * - xfn: The XFN relationship expressed in the link of this menu item. + * - description: The description of this menu item. + * + * @since 3.0.0 + * + * @param object $menu_item The menu item to modify. + * @return object $menu_item The menu item with standard menu item properties. + */ +function wp_setup_nav_menu_item( $menu_item ) { + if ( isset( $menu_item->post_type ) ) { + if ( 'nav_menu_item' == $menu_item->post_type ) { + $menu_item->db_id = (int) $menu_item->ID; + $menu_item->menu_item_parent = empty( $menu_item->menu_item_parent ) ? get_post_meta( $menu_item->ID, '_menu_item_menu_item_parent', true ) : $menu_item->menu_item_parent; + $menu_item->object_id = empty( $menu_item->object_id ) ? get_post_meta( $menu_item->ID, '_menu_item_object_id', true ) : $menu_item->object_id; + $menu_item->object = empty( $menu_item->object ) ? get_post_meta( $menu_item->ID, '_menu_item_object', true ) : $menu_item->object; + $menu_item->type = empty( $menu_item->type ) ? get_post_meta( $menu_item->ID, '_menu_item_type', true ) : $menu_item->type; + + if ( 'post_type' == $menu_item->type ) { + $object = get_post_type_object( $menu_item->object ); + if ( $object ) { + $menu_item->type_label = $object->labels->singular_name; + } else { + $menu_item->type_label = $menu_item->object; + $menu_item->_invalid = true; + } + + $menu_item->url = get_permalink( $menu_item->object_id ); + + $original_object = get_post( $menu_item->object_id ); + $original_title = $original_object->post_title; + $menu_item->title = '' == $menu_item->post_title ? $original_title : $menu_item->post_title; + + } elseif ( 'taxonomy' == $menu_item->type ) { + $object = get_taxonomy( $menu_item->object ); + if ( $object ) { + $menu_item->type_label = $object->labels->singular_name; + } else { + $menu_item->type_label = $menu_item->object; + $menu_item->_invalid = true; + } + + $term_url = get_term_link( (int) $menu_item->object_id, $menu_item->object ); + $menu_item->url = !is_wp_error( $term_url ) ? $term_url : ''; + + $original_title = get_term_field( 'name', $menu_item->object_id, $menu_item->object, 'raw' ); + if ( is_wp_error( $original_title ) ) + $original_title = false; + $menu_item->title = '' == $menu_item->post_title ? $original_title : $menu_item->post_title; + + } else { + $menu_item->type_label = __('Custom'); + $menu_item->title = $menu_item->post_title; + $menu_item->url = empty( $menu_item->url ) ? get_post_meta( $menu_item->ID, '_menu_item_url', true ) : $menu_item->url; + } + + $menu_item->target = empty( $menu_item->target ) ? get_post_meta( $menu_item->ID, '_menu_item_target', true ) : $menu_item->target; + + $menu_item->attr_title = empty( $menu_item->attr_title ) ? apply_filters( 'nav_menu_attr_title', $menu_item->post_excerpt ) : $menu_item->attr_title; + $menu_item->description = empty( $menu_item->description ) ? apply_filters( 'nav_menu_description', $menu_item->post_content ) : $menu_item->description; + + $menu_item->classes = empty( $menu_item->classes ) ? (array) get_post_meta( $menu_item->ID, '_menu_item_classes', true ) : $menu_item->classes; + $menu_item->xfn = empty( $menu_item->xfn ) ? get_post_meta( $menu_item->ID, '_menu_item_xfn', true ) : $menu_item->xfn; + } else { + $menu_item->db_id = 0; + $menu_item->menu_item_parent = 0; + $menu_item->object_id = (int) $menu_item->ID; + $menu_item->type = 'post_type'; + + $object = get_post_type_object( $menu_item->post_type ); + $menu_item->object = $object->name; + $menu_item->type_label = $object->labels->singular_name; + + $menu_item->title = $menu_item->post_title; + $menu_item->url = get_permalink( $menu_item->ID ); + $menu_item->target = ''; + + $menu_item->attr_title = apply_filters( 'nav_menu_attr_title', $menu_item->post_excerpt ); + $menu_item->description = apply_filters( 'nav_menu_description', $menu_item->post_content ); + $menu_item->classes = array(); + $menu_item->xfn = ''; + } + } elseif ( isset( $menu_item->taxonomy ) ) { + $menu_item->ID = $menu_item->term_id; + $menu_item->db_id = 0; + $menu_item->menu_item_parent = 0; + $menu_item->object_id = (int) $menu_item->term_id; + $menu_item->post_parent = (int) $menu_item->parent; + $menu_item->type = 'taxonomy'; + + $object = get_taxonomy( $menu_item->taxonomy ); + $menu_item->object = $object->name; + $menu_item->type_label = $object->labels->singular_name; + + $menu_item->title = $menu_item->name; + $menu_item->url = get_term_link( $menu_item, $menu_item->taxonomy ); + $menu_item->target = ''; + $menu_item->attr_title = ''; + $menu_item->description = get_term_field( 'description', $menu_item->term_id, $menu_item->taxonomy ); + $menu_item->classes = array(); + $menu_item->xfn = ''; + + } + + return apply_filters( 'wp_setup_nav_menu_item', $menu_item ); +} + +/** + * Get the menu items associated with a particular object. + * + * @since 3.0.0 + * + * @param int $object_id The ID of the original object. + * @param string $object_type The type of object, such as "taxonomy" or "post_type." + * @return array The array of menu item IDs; empty array if none; + */ +function wp_get_associated_nav_menu_items( $object_id = 0, $object_type = 'post_type' ) { + $object_id = (int) $object_id; + $menu_item_ids = array(); + + $query = new WP_Query; + $menu_items = $query->query( + array( + 'meta_key' => '_menu_item_object_id', + 'meta_value' => $object_id, + 'post_status' => 'any', + 'post_type' => 'nav_menu_item', + 'posts_per_page' => -1, + ) + ); + foreach( (array) $menu_items as $menu_item ) { + if ( isset( $menu_item->ID ) && is_nav_menu_item( $menu_item->ID ) ) { + if ( get_post_meta( $menu_item->ID, '_menu_item_type', true ) != $object_type ) + continue; + + $menu_item_ids[] = (int) $menu_item->ID; + } + } + + return array_unique( $menu_item_ids ); +} + +/** + * Callback for handling a menu item when its original object is deleted. + * + * @since 3.0.0 + * @access private + * + * @param int $object_id The ID of the original object being trashed. + * + */ +function _wp_delete_post_menu_item( $object_id = 0 ) { + $object_id = (int) $object_id; + + $menu_item_ids = wp_get_associated_nav_menu_items( $object_id, 'post_type' ); + + foreach( (array) $menu_item_ids as $menu_item_id ) { + wp_delete_post( $menu_item_id, true ); + } +} + +/** + * Callback for handling a menu item when its original object is deleted. + * + * @since 3.0.0 + * @access private + * + * @param int $object_id The ID of the original object being trashed. + * + */ +function _wp_delete_tax_menu_item( $object_id = 0 ) { + $object_id = (int) $object_id; + + $menu_item_ids = wp_get_associated_nav_menu_items( $object_id, 'taxonomy' ); + + foreach( (array) $menu_item_ids as $menu_item_id ) { + wp_delete_post( $menu_item_id, true ); + } +} + +/** + * Automatically add newly published page objects to menus with that as an option. + * + * @since 3.0.0 + * @access private + * + * @param string $new_status The new status of the post object. + * @param string $old_status The old status of the post object. + * @param object $post The post object being transitioned from one status to another. + * @return void + */ +function _wp_auto_add_pages_to_menu( $new_status, $old_status, $post ) { + if ( 'publish' != $new_status || 'publish' == $old_status || 'page' != $post->post_type ) + return; + if ( ! empty( $post->post_parent ) ) + return; + $auto_add = get_option( 'nav_menu_options' ); + if ( empty( $auto_add ) || ! is_array( $auto_add ) || ! isset( $auto_add['auto_add'] ) ) + return; + $auto_add = $auto_add['auto_add']; + if ( empty( $auto_add ) || ! is_array( $auto_add ) ) + return; + + $args = array( + 'menu-item-object-id' => $post->ID, + 'menu-item-object' => $post->post_type, + 'menu-item-type' => 'post_type', + 'menu-item-status' => 'publish', + ); + + foreach ( $auto_add as $menu_id ) { + $items = wp_get_nav_menu_items( $menu_id, array( 'post_status' => 'publish,draft' ) ); + if ( ! is_array( $items ) ) + continue; + foreach ( $items as $item ) { + if ( $post->ID == $item->object_id ) + continue 2; + } + wp_update_nav_menu_item( $menu_id, 0, $args ); + } +} + +?> diff --git a/src/wp-includes/pluggable-deprecated.php b/src/wp-includes/pluggable-deprecated.php new file mode 100644 index 0000000..bb0e4f0 --- /dev/null +++ b/src/wp-includes/pluggable-deprecated.php @@ -0,0 +1,136 @@ +ID, $remember); +} +else : + _deprecated_function( 'wp_setcookie', '2.5', 'wp_set_auth_cookie()' ); +endif; + +if ( !function_exists('wp_clearcookie') ) : +/** + * Clears the authentication cookie, logging the user out. This function is deprecated. + * + * @since 1.5 + * @deprecated 2.5 + * @deprecated Use wp_clear_auth_cookie() + * @see wp_clear_auth_cookie() + */ +function wp_clearcookie() { + _deprecated_function( __FUNCTION__, '2.5', 'wp_clear_auth_cookie()' ); + wp_clear_auth_cookie(); +} +else : + _deprecated_function( 'wp_clearcookie', '2.5', 'wp_clear_auth_cookie()' ); +endif; + +if ( !function_exists('wp_get_cookie_login') ): +/** + * Gets the user cookie login. This function is deprecated. + * + * This function is deprecated and should no longer be extended as it won't be + * used anywhere in WordPress. Also, plugins shouldn't use it either. + * + * @since 2.0.3 + * @deprecated 2.5 + * @deprecated No alternative + * + * @return bool Always returns false + */ +function wp_get_cookie_login() { + _deprecated_function( __FUNCTION__, '2.5' ); + return false; +} +else : + _deprecated_function( 'wp_get_cookie_login', '2.5' ); +endif; + +if ( !function_exists('wp_login') ) : +/** + * Checks a users login information and logs them in if it checks out. This function is deprecated. + * + * Use the global $error to get the reason why the login failed. If the username + * is blank, no error will be set, so assume blank username on that case. + * + * Plugins extending this function should also provide the global $error and set + * what the error is, so that those checking the global for why there was a + * failure can utilize it later. + * + * @since 1.2.2 + * @deprecated Use wp_signon() + * @global string $error Error when false is returned + * + * @param string $username User's username + * @param string $password User's password + * @param bool $deprecated Not used + * @return bool False on login failure, true on successful check + */ +function wp_login($username, $password, $deprecated = '') { + _deprecated_function( __FUNCTION__, '2.5', 'wp_signon()' ); + global $error; + + $user = wp_authenticate($username, $password); + + if ( ! is_wp_error($user) ) + return true; + + $error = $user->get_error_message(); + return false; +} +else : + _deprecated_function( 'wp_login', '2.5', 'wp_signon()' ); +endif; \ No newline at end of file diff --git a/src/wp-includes/pluggable.php b/src/wp-includes/pluggable.php new file mode 100644 index 0000000..3001433 --- /dev/null +++ b/src/wp-includes/pluggable.php @@ -0,0 +1,1811 @@ +ID) ) + return $current_user; + + $current_user = new WP_User($id, $name); + + setup_userdata($current_user->ID); + + do_action('set_current_user'); + + return $current_user; +} +endif; + +if ( !function_exists('wp_get_current_user') ) : +/** + * Retrieve the current user object. + * + * @since 2.0.3 + * + * @return WP_User Current user WP_User object + */ +function wp_get_current_user() { + global $current_user; + + get_currentuserinfo(); + + return $current_user; +} +endif; + +if ( !function_exists('get_currentuserinfo') ) : +/** + * Populate global variables with information about the currently logged in user. + * + * Will set the current user, if the current user is not set. The current user + * will be set to the logged in person. If no user is logged in, then it will + * set the current user to 0, which is invalid and won't have any permissions. + * + * @since 0.71 + * @uses $current_user Checks if the current user is set + * @uses wp_validate_auth_cookie() Retrieves current logged in user. + * + * @return bool|null False on XMLRPC Request and invalid auth cookie. Null when current user set + */ +function get_currentuserinfo() { + global $current_user; + + if ( defined('XMLRPC_REQUEST') && XMLRPC_REQUEST ) + return false; + + if ( ! empty($current_user) ) + return; + + if ( ! $user = wp_validate_auth_cookie() ) { + if ( is_blog_admin() || is_network_admin() || empty($_COOKIE[LOGGED_IN_COOKIE]) || !$user = wp_validate_auth_cookie($_COOKIE[LOGGED_IN_COOKIE], 'logged_in') ) { + wp_set_current_user(0); + return false; + } + } + + wp_set_current_user($user); +} +endif; + +if ( !function_exists('get_userdata') ) : +/** + * Retrieve user info by user ID. + * + * @since 0.71 + * + * @param int $user_id User ID + * @return bool|object False on failure, User DB row object + */ +function get_userdata( $user_id ) { + global $wpdb; + + if ( ! is_numeric( $user_id ) ) + return false; + + $user_id = absint( $user_id ); + if ( ! $user_id ) + return false; + + $user = wp_cache_get( $user_id, 'users' ); + + if ( $user ) + return $user; + + if ( ! $user = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->users WHERE ID = %d LIMIT 1", $user_id ) ) ) + return false; + + _fill_user( $user ); + + return $user; +} +endif; + +if ( !function_exists('cache_users') ) : +/** + * Retrieve info for user lists to prevent multiple queries by get_userdata() + * + * @since 3.0.0 + * + * @param array $users User ID numbers list + */ +function cache_users( $users ) { + global $wpdb; + + $clean = array(); + foreach($users as $id) { + $id = (int) $id; + if (wp_cache_get($id, 'users')) { + // seems to be cached already + } else { + $clean[] = $id; + } + } + + if ( 0 == count($clean) ) + return; + + $list = implode(',', $clean); + + $results = $wpdb->get_results("SELECT * FROM $wpdb->users WHERE ID IN ($list)"); + + _fill_many_users($results); +} +endif; + +if ( !function_exists('get_user_by') ) : +/** + * Retrieve user info by a given field + * + * @since 2.8.0 + * + * @param string $field The field to retrieve the user with. id | slug | email | login + * @param int|string $value A value for $field. A user ID, slug, email address, or login name. + * @return bool|object False on failure, User DB row object + */ +function get_user_by($field, $value) { + global $wpdb; + + switch ($field) { + case 'id': + return get_userdata($value); + break; + case 'slug': + $user_id = wp_cache_get($value, 'userslugs'); + $field = 'user_nicename'; + break; + case 'email': + $user_id = wp_cache_get($value, 'useremail'); + $field = 'user_email'; + break; + case 'login': + $value = sanitize_user( $value ); + $user_id = wp_cache_get($value, 'userlogins'); + $field = 'user_login'; + break; + default: + return false; + } + + if ( false !== $user_id ) + return get_userdata($user_id); + + if ( !$user = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->users WHERE $field = %s", $value) ) ) + return false; + + _fill_user($user); + + return $user; +} +endif; + +if ( !function_exists('get_userdatabylogin') ) : +/** + * Retrieve user info by login name. + * + * @since 0.71 + * + * @param string $user_login User's username + * @return bool|object False on failure, User DB row object + */ +function get_userdatabylogin($user_login) { + return get_user_by('login', $user_login); +} +endif; + +if ( !function_exists('get_user_by_email') ) : +/** + * Retrieve user info by email. + * + * @since 2.5 + * + * @param string $email User's email address + * @return bool|object False on failure, User DB row object + */ +function get_user_by_email($email) { + return get_user_by('email', $email); +} +endif; + +if ( !function_exists( 'wp_mail' ) ) : +/** + * Send mail, similar to PHP's mail + * + * A true return value does not automatically mean that the user received the + * email successfully. It just only means that the method used was able to + * process the request without any errors. + * + * Using the two 'wp_mail_from' and 'wp_mail_from_name' hooks allow from + * creating a from address like 'Name ' when both are set. If + * just 'wp_mail_from' is set, then just the email address will be used with no + * name. + * + * The default content type is 'text/plain' which does not allow using HTML. + * However, you can set the content type of the email by using the + * 'wp_mail_content_type' filter. + * + * The default charset is based on the charset used on the blog. The charset can + * be set using the 'wp_mail_charset' filter. + * + * @since 1.2.1 + * @uses apply_filters() Calls 'wp_mail' hook on an array of all of the parameters. + * @uses apply_filters() Calls 'wp_mail_from' hook to get the from email address. + * @uses apply_filters() Calls 'wp_mail_from_name' hook to get the from address name. + * @uses apply_filters() Calls 'wp_mail_content_type' hook to get the email content type. + * @uses apply_filters() Calls 'wp_mail_charset' hook to get the email charset + * @uses do_action_ref_array() Calls 'phpmailer_init' hook on the reference to + * phpmailer object. + * @uses PHPMailer + * @ + * + * @param string|array $to Array or comma-separated list of email addresses to send message. + * @param string $subject Email subject + * @param string $message Message contents + * @param string|array $headers Optional. Additional headers. + * @param string|array $attachments Optional. Files to attach. + * @return bool Whether the email contents were sent successfully. + */ +function wp_mail( $to, $subject, $message, $headers = '', $attachments = array() ) { + // Compact the input, apply the filters, and extract them back out + extract( apply_filters( 'wp_mail', compact( 'to', 'subject', 'message', 'headers', 'attachments' ) ) ); + + if ( !is_array($attachments) ) + $attachments = explode( "\n", str_replace( "\r\n", "\n", $attachments ) ); + + global $phpmailer; + + // (Re)create it, if it's gone missing + if ( !is_object( $phpmailer ) || !is_a( $phpmailer, 'PHPMailer' ) ) { + require_once ABSPATH . WPINC . '/class-phpmailer.php'; + require_once ABSPATH . WPINC . '/class-smtp.php'; + $phpmailer = new PHPMailer( true ); + } + + // Headers + if ( empty( $headers ) ) { + $headers = array(); + } else { + if ( !is_array( $headers ) ) { + // Explode the headers out, so this function can take both + // string headers and an array of headers. + $tempheaders = explode( "\n", str_replace( "\r\n", "\n", $headers ) ); + } else { + $tempheaders = $headers; + } + $headers = array(); + $cc = array(); + $bcc = array(); + + // If it's actually got contents + if ( !empty( $tempheaders ) ) { + // Iterate through the raw headers + foreach ( (array) $tempheaders as $header ) { + if ( strpos($header, ':') === false ) { + if ( false !== stripos( $header, 'boundary=' ) ) { + $parts = preg_split('/boundary=/i', trim( $header ) ); + $boundary = trim( str_replace( array( "'", '"' ), '', $parts[1] ) ); + } + continue; + } + // Explode them out + list( $name, $content ) = explode( ':', trim( $header ), 2 ); + + // Cleanup crew + $name = trim( $name ); + $content = trim( $content ); + + switch ( strtolower( $name ) ) { + // Mainly for legacy -- process a From: header if it's there + case 'from': + if ( strpos($content, '<' ) !== false ) { + // So... making my life hard again? + $from_name = substr( $content, 0, strpos( $content, '<' ) - 1 ); + $from_name = str_replace( '"', '', $from_name ); + $from_name = trim( $from_name ); + + $from_email = substr( $content, strpos( $content, '<' ) + 1 ); + $from_email = str_replace( '>', '', $from_email ); + $from_email = trim( $from_email ); + } else { + $from_email = trim( $content ); + } + break; + case 'content-type': + if ( strpos( $content, ';' ) !== false ) { + list( $type, $charset ) = explode( ';', $content ); + $content_type = trim( $type ); + if ( false !== stripos( $charset, 'charset=' ) ) { + $charset = trim( str_replace( array( 'charset=', '"' ), '', $charset ) ); + } elseif ( false !== stripos( $charset, 'boundary=' ) ) { + $boundary = trim( str_replace( array( 'BOUNDARY=', 'boundary=', '"' ), '', $charset ) ); + $charset = ''; + } + } else { + $content_type = trim( $content ); + } + break; + case 'cc': + $cc = array_merge( (array) $cc, explode( ',', $content ) ); + break; + case 'bcc': + $bcc = array_merge( (array) $bcc, explode( ',', $content ) ); + break; + default: + // Add it to our grand headers array + $headers[trim( $name )] = trim( $content ); + break; + } + } + } + } + + // Empty out the values that may be set + $phpmailer->ClearAddresses(); + $phpmailer->ClearAllRecipients(); + $phpmailer->ClearAttachments(); + $phpmailer->ClearBCCs(); + $phpmailer->ClearCCs(); + $phpmailer->ClearCustomHeaders(); + $phpmailer->ClearReplyTos(); + + // From email and name + // If we don't have a name from the input headers + if ( !isset( $from_name ) ) + $from_name = 'WordPress'; + + /* If we don't have an email from the input headers default to wordpress@$sitename + * Some hosts will block outgoing mail from this address if it doesn't exist but + * there's no easy alternative. Defaulting to admin_email might appear to be another + * option but some hosts may refuse to relay mail from an unknown domain. See + * http://trac.wordpress.org/ticket/5007. + */ + + if ( !isset( $from_email ) ) { + // Get the site domain and get rid of www. + $sitename = strtolower( $_SERVER['SERVER_NAME'] ); + if ( substr( $sitename, 0, 4 ) == 'www.' ) { + $sitename = substr( $sitename, 4 ); + } + + $from_email = 'wordpress@' . $sitename; + } + + // Plugin authors can override the potentially troublesome default + $phpmailer->From = apply_filters( 'wp_mail_from' , $from_email ); + $phpmailer->FromName = apply_filters( 'wp_mail_from_name', $from_name ); + + // Set destination addresses + if ( !is_array( $to ) ) + $to = explode( ',', $to ); + + foreach ( (array) $to as $recipient ) { + try { + // Break $recipient into name and address parts if in the format "Foo " + $recipient_name = ''; + if( preg_match( '/(.+)\s?<(.+)>/', $recipient, $matches ) ) { + if ( count( $matches ) == 3 ) { + $recipient_name = $matches[1]; + $recipient = $matches[2]; + } + } + $phpmailer->AddAddress( trim( $recipient ), $recipient_name); + } catch ( phpmailerException $e ) { + continue; + } + } + + // Set mail's subject and body + $phpmailer->Subject = $subject; + $phpmailer->Body = $message; + + // Add any CC and BCC recipients + if ( !empty( $cc ) ) { + foreach ( (array) $cc as $recipient ) { + try { + // Break $recipient into name and address parts if in the format "Foo " + $recipient_name = ''; + if( preg_match( '/(.+)\s?<(.+)>/', $recipient, $matches ) ) { + if ( count( $matches ) == 3 ) { + $recipient_name = $matches[1]; + $recipient = $matches[2]; + } + } + $phpmailer->AddCc( trim($recipient), $recipient_name ); + } catch ( phpmailerException $e ) { + continue; + } + } + } + + if ( !empty( $bcc ) ) { + foreach ( (array) $bcc as $recipient) { + try { + // Break $recipient into name and address parts if in the format "Foo " + $recipient_name = ''; + if( preg_match( '/(.+)\s?<(.+)>/', $recipient, $matches ) ) { + if ( count( $matches ) == 3 ) { + $recipient_name = $matches[1]; + $recipient = $matches[2]; + } + } + $phpmailer->AddBcc( trim($recipient), $recipient_name ); + } catch ( phpmailerException $e ) { + continue; + } + } + } + + // Set to use PHP's mail() + $phpmailer->IsMail(); + + // Set Content-Type and charset + // If we don't have a content-type from the input headers + if ( !isset( $content_type ) ) + $content_type = 'text/plain'; + + $content_type = apply_filters( 'wp_mail_content_type', $content_type ); + + $phpmailer->ContentType = $content_type; + + // Set whether it's plaintext, depending on $content_type + if ( 'text/html' == $content_type ) + $phpmailer->IsHTML( true ); + + // If we don't have a charset from the input headers + if ( !isset( $charset ) ) + $charset = get_bloginfo( 'charset' ); + + // Set the content-type and charset + $phpmailer->CharSet = apply_filters( 'wp_mail_charset', $charset ); + + // Set custom headers + if ( !empty( $headers ) ) { + foreach( (array) $headers as $name => $content ) { + $phpmailer->AddCustomHeader( sprintf( '%1$s: %2$s', $name, $content ) ); + } + + if ( false !== stripos( $content_type, 'multipart' ) && ! empty($boundary) ) + $phpmailer->AddCustomHeader( sprintf( "Content-Type: %s;\n\t boundary=\"%s\"", $content_type, $boundary ) ); + } + + if ( !empty( $attachments ) ) { + foreach ( $attachments as $attachment ) { + try { + $phpmailer->AddAttachment($attachment); + } catch ( phpmailerException $e ) { + continue; + } + } + } + + do_action_ref_array( 'phpmailer_init', array( &$phpmailer ) ); + + // Send! + try { + $phpmailer->Send(); + } catch ( phpmailerException $e ) { + return false; + } + + return true; +} +endif; + +if ( !function_exists('wp_authenticate') ) : +/** + * Checks a user's login information and logs them in if it checks out. + * + * @since 2.5.0 + * + * @param string $username User's username + * @param string $password User's password + * @return WP_Error|WP_User WP_User object if login successful, otherwise WP_Error object. + */ +function wp_authenticate($username, $password) { + $username = sanitize_user($username); + $password = trim($password); + + $user = apply_filters('authenticate', null, $username, $password); + + if ( $user == null ) { + // TODO what should the error message be? (Or would these even happen?) + // Only needed if all authentication handlers fail to return anything. + $user = new WP_Error('authentication_failed', __('ERROR: Invalid username or incorrect password.')); + } + + $ignore_codes = array('empty_username', 'empty_password'); + + if (is_wp_error($user) && !in_array($user->get_error_code(), $ignore_codes) ) { + do_action('wp_login_failed', $username); + } + + return $user; +} +endif; + +if ( !function_exists('wp_logout') ) : +/** + * Log the current user out. + * + * @since 2.5.0 + */ +function wp_logout() { + wp_clear_auth_cookie(); + do_action('wp_logout'); +} +endif; + +if ( !function_exists('wp_validate_auth_cookie') ) : +/** + * Validates authentication cookie. + * + * The checks include making sure that the authentication cookie is set and + * pulling in the contents (if $cookie is not used). + * + * Makes sure the cookie is not expired. Verifies the hash in cookie is what is + * should be and compares the two. + * + * @since 2.5 + * + * @param string $cookie Optional. If used, will validate contents instead of cookie's + * @param string $scheme Optional. The cookie scheme to use: auth, secure_auth, or logged_in + * @return bool|int False if invalid cookie, User ID if valid. + */ +function wp_validate_auth_cookie($cookie = '', $scheme = '') { + if ( ! $cookie_elements = wp_parse_auth_cookie($cookie, $scheme) ) { + do_action('auth_cookie_malformed', $cookie, $scheme); + return false; + } + + extract($cookie_elements, EXTR_OVERWRITE); + + $expired = $expiration; + + // Allow a grace period for POST and AJAX requests + if ( defined('DOING_AJAX') || 'POST' == $_SERVER['REQUEST_METHOD'] ) + $expired += 3600; + + // Quick check to see if an honest cookie has expired + if ( $expired < time() ) { + do_action('auth_cookie_expired', $cookie_elements); + return false; + } + + $user = get_userdatabylogin($username); + if ( ! $user ) { + do_action('auth_cookie_bad_username', $cookie_elements); + return false; + } + + $pass_frag = substr($user->user_pass, 8, 4); + + $key = wp_hash($username . $pass_frag . '|' . $expiration, $scheme); + $hash = hash_hmac('md5', $username . '|' . $expiration, $key); + + if ( $hmac != $hash ) { + do_action('auth_cookie_bad_hash', $cookie_elements); + return false; + } + + if ( $expiration < time() ) // AJAX/POST grace period set above + $GLOBALS['login_grace_period'] = 1; + + do_action('auth_cookie_valid', $cookie_elements, $user); + + return $user->ID; +} +endif; + +if ( !function_exists('wp_generate_auth_cookie') ) : +/** + * Generate authentication cookie contents. + * + * @since 2.5 + * @uses apply_filters() Calls 'auth_cookie' hook on $cookie contents, User ID + * and expiration of cookie. + * + * @param int $user_id User ID + * @param int $expiration Cookie expiration in seconds + * @param string $scheme Optional. The cookie scheme to use: auth, secure_auth, or logged_in + * @return string Authentication cookie contents + */ +function wp_generate_auth_cookie($user_id, $expiration, $scheme = 'auth') { + $user = get_userdata($user_id); + + $pass_frag = substr($user->user_pass, 8, 4); + + $key = wp_hash($user->user_login . $pass_frag . '|' . $expiration, $scheme); + $hash = hash_hmac('md5', $user->user_login . '|' . $expiration, $key); + + $cookie = $user->user_login . '|' . $expiration . '|' . $hash; + + return apply_filters('auth_cookie', $cookie, $user_id, $expiration, $scheme); +} +endif; + +if ( !function_exists('wp_parse_auth_cookie') ) : +/** + * Parse a cookie into its components + * + * @since 2.7 + * + * @param string $cookie + * @param string $scheme Optional. The cookie scheme to use: auth, secure_auth, or logged_in + * @return array Authentication cookie components + */ +function wp_parse_auth_cookie($cookie = '', $scheme = '') { + if ( empty($cookie) ) { + switch ($scheme){ + case 'auth': + $cookie_name = AUTH_COOKIE; + break; + case 'secure_auth': + $cookie_name = SECURE_AUTH_COOKIE; + break; + case "logged_in": + $cookie_name = LOGGED_IN_COOKIE; + break; + default: + if ( is_ssl() ) { + $cookie_name = SECURE_AUTH_COOKIE; + $scheme = 'secure_auth'; + } else { + $cookie_name = AUTH_COOKIE; + $scheme = 'auth'; + } + } + + if ( empty($_COOKIE[$cookie_name]) ) + return false; + $cookie = $_COOKIE[$cookie_name]; + } + + $cookie_elements = explode('|', $cookie); + if ( count($cookie_elements) != 3 ) + return false; + + list($username, $expiration, $hmac) = $cookie_elements; + + return compact('username', 'expiration', 'hmac', 'scheme'); +} +endif; + +if ( !function_exists('wp_set_auth_cookie') ) : +/** + * Sets the authentication cookies based User ID. + * + * The $remember parameter increases the time that the cookie will be kept. The + * default the cookie is kept without remembering is two days. When $remember is + * set, the cookies will be kept for 14 days or two weeks. + * + * @since 2.5 + * + * @param int $user_id User ID + * @param bool $remember Whether to remember the user + */ +function wp_set_auth_cookie($user_id, $remember = false, $secure = '') { + if ( $remember ) { + $expiration = $expire = time() + apply_filters('auth_cookie_expiration', 1209600, $user_id, $remember); + } else { + $expiration = time() + apply_filters('auth_cookie_expiration', 172800, $user_id, $remember); + $expire = 0; + } + + if ( '' === $secure ) + $secure = is_ssl(); + + $secure = apply_filters('secure_auth_cookie', $secure, $user_id); + $secure_logged_in_cookie = apply_filters('secure_logged_in_cookie', false, $user_id, $secure); + + if ( $secure ) { + $auth_cookie_name = SECURE_AUTH_COOKIE; + $scheme = 'secure_auth'; + } else { + $auth_cookie_name = AUTH_COOKIE; + $scheme = 'auth'; + } + + $auth_cookie = wp_generate_auth_cookie($user_id, $expiration, $scheme); + $logged_in_cookie = wp_generate_auth_cookie($user_id, $expiration, 'logged_in'); + + do_action('set_auth_cookie', $auth_cookie, $expire, $expiration, $user_id, $scheme); + do_action('set_logged_in_cookie', $logged_in_cookie, $expire, $expiration, $user_id, 'logged_in'); + + setcookie($auth_cookie_name, $auth_cookie, $expire, PLUGINS_COOKIE_PATH, COOKIE_DOMAIN, $secure, true); + setcookie($auth_cookie_name, $auth_cookie, $expire, ADMIN_COOKIE_PATH, COOKIE_DOMAIN, $secure, true); + setcookie(LOGGED_IN_COOKIE, $logged_in_cookie, $expire, COOKIEPATH, COOKIE_DOMAIN, $secure_logged_in_cookie, true); + if ( COOKIEPATH != SITECOOKIEPATH ) + setcookie(LOGGED_IN_COOKIE, $logged_in_cookie, $expire, SITECOOKIEPATH, COOKIE_DOMAIN, $secure_logged_in_cookie, true); +} +endif; + +if ( !function_exists('wp_clear_auth_cookie') ) : +/** + * Removes all of the cookies associated with authentication. + * + * @since 2.5 + */ +function wp_clear_auth_cookie() { + do_action('clear_auth_cookie'); + + setcookie(AUTH_COOKIE, ' ', time() - 31536000, ADMIN_COOKIE_PATH, COOKIE_DOMAIN); + setcookie(SECURE_AUTH_COOKIE, ' ', time() - 31536000, ADMIN_COOKIE_PATH, COOKIE_DOMAIN); + setcookie(AUTH_COOKIE, ' ', time() - 31536000, PLUGINS_COOKIE_PATH, COOKIE_DOMAIN); + setcookie(SECURE_AUTH_COOKIE, ' ', time() - 31536000, PLUGINS_COOKIE_PATH, COOKIE_DOMAIN); + setcookie(LOGGED_IN_COOKIE, ' ', time() - 31536000, COOKIEPATH, COOKIE_DOMAIN); + setcookie(LOGGED_IN_COOKIE, ' ', time() - 31536000, SITECOOKIEPATH, COOKIE_DOMAIN); + + // Old cookies + setcookie(AUTH_COOKIE, ' ', time() - 31536000, COOKIEPATH, COOKIE_DOMAIN); + setcookie(AUTH_COOKIE, ' ', time() - 31536000, SITECOOKIEPATH, COOKIE_DOMAIN); + setcookie(SECURE_AUTH_COOKIE, ' ', time() - 31536000, COOKIEPATH, COOKIE_DOMAIN); + setcookie(SECURE_AUTH_COOKIE, ' ', time() - 31536000, SITECOOKIEPATH, COOKIE_DOMAIN); + + // Even older cookies + setcookie(USER_COOKIE, ' ', time() - 31536000, COOKIEPATH, COOKIE_DOMAIN); + setcookie(PASS_COOKIE, ' ', time() - 31536000, COOKIEPATH, COOKIE_DOMAIN); + setcookie(USER_COOKIE, ' ', time() - 31536000, SITECOOKIEPATH, COOKIE_DOMAIN); + setcookie(PASS_COOKIE, ' ', time() - 31536000, SITECOOKIEPATH, COOKIE_DOMAIN); +} +endif; + +if ( !function_exists('is_user_logged_in') ) : +/** + * Checks if the current visitor is a logged in user. + * + * @since 2.0.0 + * + * @return bool True if user is logged in, false if not logged in. + */ +function is_user_logged_in() { + $user = wp_get_current_user(); + + if ( $user->id == 0 ) + return false; + + return true; +} +endif; + +if ( !function_exists('auth_redirect') ) : +/** + * Checks if a user is logged in, if not it redirects them to the login page. + * + * @since 1.5 + */ +function auth_redirect() { + // Checks if a user is logged in, if not redirects them to the login page + + $secure = ( is_ssl() || force_ssl_admin() ); + + $secure = apply_filters('secure_auth_redirect', $secure); + + // If https is required and request is http, redirect + if ( $secure && !is_ssl() && false !== strpos($_SERVER['REQUEST_URI'], 'wp-admin') ) { + if ( 0 === strpos($_SERVER['REQUEST_URI'], 'http') ) { + wp_redirect(preg_replace('|^http://|', 'https://', $_SERVER['REQUEST_URI'])); + exit(); + } else { + wp_redirect('https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']); + exit(); + } + } + + if ( is_user_admin() ) + $scheme = 'logged_in'; + else + $scheme = apply_filters( 'auth_redirect_scheme', '' ); + + if ( $user_id = wp_validate_auth_cookie( '', $scheme) ) { + do_action('auth_redirect', $user_id); + + // If the user wants ssl but the session is not ssl, redirect. + if ( !$secure && get_user_option('use_ssl', $user_id) && false !== strpos($_SERVER['REQUEST_URI'], 'wp-admin') ) { + if ( 0 === strpos($_SERVER['REQUEST_URI'], 'http') ) { + wp_redirect(preg_replace('|^http://|', 'https://', $_SERVER['REQUEST_URI'])); + exit(); + } else { + wp_redirect('https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']); + exit(); + } + } + + return; // The cookie is good so we're done + } + + // The cookie is no good so force login + nocache_headers(); + + if ( is_ssl() ) + $proto = 'https://'; + else + $proto = 'http://'; + + $redirect = ( strpos($_SERVER['REQUEST_URI'], '/options.php') && wp_get_referer() ) ? wp_get_referer() : $proto . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; + + $login_url = wp_login_url($redirect, true); + + wp_redirect($login_url); + exit(); +} +endif; + +if ( !function_exists('check_admin_referer') ) : +/** + * Makes sure that a user was referred from another admin page. + * + * To avoid security exploits. + * + * @since 1.2.0 + * @uses do_action() Calls 'check_admin_referer' on $action. + * + * @param string $action Action nonce + * @param string $query_arg where to look for nonce in $_REQUEST (since 2.5) + */ +function check_admin_referer($action = -1, $query_arg = '_wpnonce') { + if ( -1 == $action ) + _doing_it_wrong( __FUNCTION__, __( 'You should specify a nonce action to be verified by using the first parameter.' ), '3.2' ); + + $adminurl = strtolower(admin_url()); + $referer = strtolower(wp_get_referer()); + $result = isset($_REQUEST[$query_arg]) ? wp_verify_nonce($_REQUEST[$query_arg], $action) : false; + if ( !$result && !(-1 == $action && strpos($referer, $adminurl) === 0) ) { + wp_nonce_ays($action); + die(); + } + do_action('check_admin_referer', $action, $result); + return $result; +}endif; + +if ( !function_exists('check_ajax_referer') ) : +/** + * Verifies the AJAX request to prevent processing requests external of the blog. + * + * @since 2.0.3 + * + * @param string $action Action nonce + * @param string $query_arg where to look for nonce in $_REQUEST (since 2.5) + */ +function check_ajax_referer( $action = -1, $query_arg = false, $die = true ) { + if ( $query_arg ) + $nonce = $_REQUEST[$query_arg]; + else + $nonce = isset($_REQUEST['_ajax_nonce']) ? $_REQUEST['_ajax_nonce'] : $_REQUEST['_wpnonce']; + + $result = wp_verify_nonce( $nonce, $action ); + + if ( $die && false == $result ) + die('-1'); + + do_action('check_ajax_referer', $action, $result); + + return $result; +} +endif; + +if ( !function_exists('wp_redirect') ) : +/** + * Redirects to another page. + * + * @since 1.5.1 + * @uses apply_filters() Calls 'wp_redirect' hook on $location and $status. + * + * @param string $location The path to redirect to + * @param int $status Status code to use + * @return bool False if $location is not set + */ +function wp_redirect($location, $status = 302) { + global $is_IIS; + + $location = apply_filters('wp_redirect', $location, $status); + $status = apply_filters('wp_redirect_status', $status, $location); + + if ( !$location ) // allows the wp_redirect filter to cancel a redirect + return false; + + $location = wp_sanitize_redirect($location); + + if ( !$is_IIS && php_sapi_name() != 'cgi-fcgi' ) + status_header($status); // This causes problems on IIS and some FastCGI setups + + header("Location: $location", true, $status); +} +endif; + +if ( !function_exists('wp_sanitize_redirect') ) : +/** + * Sanitizes a URL for use in a redirect. + * + * @since 2.3 + * + * @return string redirect-sanitized URL + **/ +function wp_sanitize_redirect($location) { + $location = preg_replace('|[^a-z0-9-~+_.?#=&;,/:%!]|i', '', $location); + $location = wp_kses_no_null($location); + + // remove %0d and %0a from location + $strip = array('%0d', '%0a', '%0D', '%0A'); + $location = _deep_replace($strip, $location); + return $location; +} +endif; + +if ( !function_exists('wp_safe_redirect') ) : +/** + * Performs a safe (local) redirect, using wp_redirect(). + * + * Checks whether the $location is using an allowed host, if it has an absolute + * path. A plugin can therefore set or remove allowed host(s) to or from the + * list. + * + * If the host is not allowed, then the redirect is to wp-admin on the siteurl + * instead. This prevents malicious redirects which redirect to another host, + * but only used in a few places. + * + * @since 2.3 + * @uses wp_validate_redirect() To validate the redirect is to an allowed host. + * + * @return void Does not return anything + **/ +function wp_safe_redirect($location, $status = 302) { + + // Need to look at the URL the way it will end up in wp_redirect() + $location = wp_sanitize_redirect($location); + + $location = wp_validate_redirect($location, admin_url()); + + wp_redirect($location, $status); +} +endif; + +if ( !function_exists('wp_validate_redirect') ) : +/** + * Validates a URL for use in a redirect. + * + * Checks whether the $location is using an allowed host, if it has an absolute + * path. A plugin can therefore set or remove allowed host(s) to or from the + * list. + * + * If the host is not allowed, then the redirect is to $default supplied + * + * @since 2.8.1 + * @uses apply_filters() Calls 'allowed_redirect_hosts' on an array containing + * WordPress host string and $location host string. + * + * @param string $location The redirect to validate + * @param string $default The value to return is $location is not allowed + * @return string redirect-sanitized URL + **/ +function wp_validate_redirect($location, $default = '') { + // browsers will assume 'http' is your protocol, and will obey a redirect to a URL starting with '//' + if ( substr($location, 0, 2) == '//' ) + $location = 'http:' . $location; + + // In php 5 parse_url may fail if the URL query part contains http://, bug #38143 + $test = ( $cut = strpos($location, '?') ) ? substr( $location, 0, $cut ) : $location; + + $lp = parse_url($test); + + // Give up if malformed URL + if ( false === $lp ) + return $default; + + // Allow only http and https schemes. No data:, etc. + if ( isset($lp['scheme']) && !('http' == $lp['scheme'] || 'https' == $lp['scheme']) ) + return $default; + + // Reject if scheme is set but host is not. This catches urls like https:host.com for which parse_url does not set the host field. + if ( isset($lp['scheme']) && !isset($lp['host']) ) + return $default; + + $wpp = parse_url(home_url()); + + $allowed_hosts = (array) apply_filters('allowed_redirect_hosts', array($wpp['host']), isset($lp['host']) ? $lp['host'] : ''); + + if ( isset($lp['host']) && ( !in_array($lp['host'], $allowed_hosts) && $lp['host'] != strtolower($wpp['host'])) ) + $location = $default; + + return $location; +} +endif; + +if ( ! function_exists('wp_notify_postauthor') ) : +/** + * Notify an author of a comment/trackback/pingback to one of their posts. + * + * @since 1.0.0 + * + * @param int $comment_id Comment ID + * @param string $comment_type Optional. The comment type either 'comment' (default), 'trackback', or 'pingback' + * @return bool False if user email does not exist. True on completion. + */ +function wp_notify_postauthor( $comment_id, $comment_type = '' ) { + $comment = get_comment( $comment_id ); + $post = get_post( $comment->comment_post_ID ); + $author = get_userdata( $post->post_author ); + + // The comment was left by the author + if ( $comment->user_id == $post->post_author ) + return false; + + // The author moderated a comment on his own post + if ( $post->post_author == get_current_user_id() ) + return false; + + // If there's no email to send the comment to + if ( '' == $author->user_email ) + return false; + + $comment_author_domain = @gethostbyaddr($comment->comment_author_IP); + + // The blogname option is escaped with esc_html on the way into the database in sanitize_option + // we want to reverse this for the plain text arena of emails. + $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES); + + if ( empty( $comment_type ) ) $comment_type = 'comment'; + + if ('comment' == $comment_type) { + $notify_message = sprintf( __( 'New comment on your post "%s"' ), $post->post_title ) . "\r\n"; + /* translators: 1: comment author, 2: author IP, 3: author domain */ + $notify_message .= sprintf( __('Author : %1$s (IP: %2$s , %3$s)'), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n"; + $notify_message .= sprintf( __('E-mail : %s'), $comment->comment_author_email ) . "\r\n"; + $notify_message .= sprintf( __('URL : %s'), $comment->comment_author_url ) . "\r\n"; + $notify_message .= sprintf( __('Whois : http://whois.arin.net/rest/ip/%s'), $comment->comment_author_IP ) . "\r\n"; + $notify_message .= __('Comment: ') . "\r\n" . $comment->comment_content . "\r\n\r\n"; + $notify_message .= __('You can see all comments on this post here: ') . "\r\n"; + /* translators: 1: blog name, 2: post title */ + $subject = sprintf( __('[%1$s] Comment: "%2$s"'), $blogname, $post->post_title ); + } elseif ('trackback' == $comment_type) { + $notify_message = sprintf( __( 'New trackback on your post "%s"' ), $post->post_title ) . "\r\n"; + /* translators: 1: website name, 2: author IP, 3: author domain */ + $notify_message .= sprintf( __('Website: %1$s (IP: %2$s , %3$s)'), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n"; + $notify_message .= sprintf( __('URL : %s'), $comment->comment_author_url ) . "\r\n"; + $notify_message .= __('Excerpt: ') . "\r\n" . $comment->comment_content . "\r\n\r\n"; + $notify_message .= __('You can see all trackbacks on this post here: ') . "\r\n"; + /* translators: 1: blog name, 2: post title */ + $subject = sprintf( __('[%1$s] Trackback: "%2$s"'), $blogname, $post->post_title ); + } elseif ('pingback' == $comment_type) { + $notify_message = sprintf( __( 'New pingback on your post "%s"' ), $post->post_title ) . "\r\n"; + /* translators: 1: comment author, 2: author IP, 3: author domain */ + $notify_message .= sprintf( __('Website: %1$s (IP: %2$s , %3$s)'), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n"; + $notify_message .= sprintf( __('URL : %s'), $comment->comment_author_url ) . "\r\n"; + $notify_message .= __('Excerpt: ') . "\r\n" . sprintf('[...] %s [...]', $comment->comment_content ) . "\r\n\r\n"; + $notify_message .= __('You can see all pingbacks on this post here: ') . "\r\n"; + /* translators: 1: blog name, 2: post title */ + $subject = sprintf( __('[%1$s] Pingback: "%2$s"'), $blogname, $post->post_title ); + } + $notify_message .= get_permalink($comment->comment_post_ID) . "#comments\r\n\r\n"; + $notify_message .= sprintf( __('Permalink: %s'), get_permalink( $comment->comment_post_ID ) . '#comment-' . $comment_id ) . "\r\n"; + if ( EMPTY_TRASH_DAYS ) + $notify_message .= sprintf( __('Trash it: %s'), admin_url("comment.php?action=trash&c=$comment_id") ) . "\r\n"; + else + $notify_message .= sprintf( __('Delete it: %s'), admin_url("comment.php?action=delete&c=$comment_id") ) . "\r\n"; + $notify_message .= sprintf( __('Spam it: %s'), admin_url("comment.php?action=spam&c=$comment_id") ) . "\r\n"; + + $wp_email = 'wordpress@' . preg_replace('#^www\.#', '', strtolower($_SERVER['SERVER_NAME'])); + + if ( '' == $comment->comment_author ) { + $from = "From: \"$blogname\" <$wp_email>"; + if ( '' != $comment->comment_author_email ) + $reply_to = "Reply-To: $comment->comment_author_email"; + } else { + $from = "From: \"$comment->comment_author\" <$wp_email>"; + if ( '' != $comment->comment_author_email ) + $reply_to = "Reply-To: \"$comment->comment_author_email\" <$comment->comment_author_email>"; + } + + $message_headers = "$from\n" + . "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n"; + + if ( isset($reply_to) ) + $message_headers .= $reply_to . "\n"; + + $notify_message = apply_filters('comment_notification_text', $notify_message, $comment_id); + $subject = apply_filters('comment_notification_subject', $subject, $comment_id); + $message_headers = apply_filters('comment_notification_headers', $message_headers, $comment_id); + + @wp_mail( $author->user_email, $subject, $notify_message, $message_headers ); + + return true; +} +endif; + +if ( !function_exists('wp_notify_moderator') ) : +/** + * Notifies the moderator of the blog about a new comment that is awaiting approval. + * + * @since 1.0 + * @uses $wpdb + * + * @param int $comment_id Comment ID + * @return bool Always returns true + */ +function wp_notify_moderator($comment_id) { + global $wpdb; + + if ( 0 == get_option( 'moderation_notify' ) ) + return true; + + $comment = get_comment($comment_id); + $post = get_post($comment->comment_post_ID); + $user = get_userdata( $post->post_author ); + // Send to the administation and to the post author if the author can modify the comment. + $email_to = array( get_option('admin_email') ); + if ( user_can($user->ID, 'edit_comment', $comment_id) && !empty($user->user_email) && ( get_option('admin_email') != $user->user_email) ) + $email_to[] = $user->user_email; + + $comment_author_domain = @gethostbyaddr($comment->comment_author_IP); + $comments_waiting = $wpdb->get_var("SELECT count(comment_ID) FROM $wpdb->comments WHERE comment_approved = '0'"); + + // The blogname option is escaped with esc_html on the way into the database in sanitize_option + // we want to reverse this for the plain text arena of emails. + $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES); + + switch ($comment->comment_type) + { + case 'trackback': + $notify_message = sprintf( __('A new trackback on the post "%s" is waiting for your approval'), $post->post_title ) . "\r\n"; + $notify_message .= get_permalink($comment->comment_post_ID) . "\r\n\r\n"; + $notify_message .= sprintf( __('Website : %1$s (IP: %2$s , %3$s)'), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n"; + $notify_message .= sprintf( __('URL : %s'), $comment->comment_author_url ) . "\r\n"; + $notify_message .= __('Trackback excerpt: ') . "\r\n" . $comment->comment_content . "\r\n\r\n"; + break; + case 'pingback': + $notify_message = sprintf( __('A new pingback on the post "%s" is waiting for your approval'), $post->post_title ) . "\r\n"; + $notify_message .= get_permalink($comment->comment_post_ID) . "\r\n\r\n"; + $notify_message .= sprintf( __('Website : %1$s (IP: %2$s , %3$s)'), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n"; + $notify_message .= sprintf( __('URL : %s'), $comment->comment_author_url ) . "\r\n"; + $notify_message .= __('Pingback excerpt: ') . "\r\n" . $comment->comment_content . "\r\n\r\n"; + break; + default: //Comments + $notify_message = sprintf( __('A new comment on the post "%s" is waiting for your approval'), $post->post_title ) . "\r\n"; + $notify_message .= get_permalink($comment->comment_post_ID) . "\r\n\r\n"; + $notify_message .= sprintf( __('Author : %1$s (IP: %2$s , %3$s)'), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n"; + $notify_message .= sprintf( __('E-mail : %s'), $comment->comment_author_email ) . "\r\n"; + $notify_message .= sprintf( __('URL : %s'), $comment->comment_author_url ) . "\r\n"; + $notify_message .= sprintf( __('Whois : http://whois.arin.net/rest/ip/%s'), $comment->comment_author_IP ) . "\r\n"; + $notify_message .= __('Comment: ') . "\r\n" . $comment->comment_content . "\r\n\r\n"; + break; + } + + $notify_message .= sprintf( __('Approve it: %s'), admin_url("comment.php?action=approve&c=$comment_id") ) . "\r\n"; + if ( EMPTY_TRASH_DAYS ) + $notify_message .= sprintf( __('Trash it: %s'), admin_url("comment.php?action=trash&c=$comment_id") ) . "\r\n"; + else + $notify_message .= sprintf( __('Delete it: %s'), admin_url("comment.php?action=delete&c=$comment_id") ) . "\r\n"; + $notify_message .= sprintf( __('Spam it: %s'), admin_url("comment.php?action=spam&c=$comment_id") ) . "\r\n"; + + $notify_message .= sprintf( _n('Currently %s comment is waiting for approval. Please visit the moderation panel:', + 'Currently %s comments are waiting for approval. Please visit the moderation panel:', $comments_waiting), number_format_i18n($comments_waiting) ) . "\r\n"; + $notify_message .= admin_url("edit-comments.php?comment_status=moderated") . "\r\n"; + + $subject = sprintf( __('[%1$s] Please moderate: "%2$s"'), $blogname, $post->post_title ); + $message_headers = ''; + + $notify_message = apply_filters('comment_moderation_text', $notify_message, $comment_id); + $subject = apply_filters('comment_moderation_subject', $subject, $comment_id); + $message_headers = apply_filters('comment_moderation_headers', $message_headers); + + foreach ( $email_to as $email ) + @wp_mail($email, $subject, $notify_message, $message_headers); + + return true; +} +endif; + +if ( !function_exists('wp_password_change_notification') ) : +/** + * Notify the blog admin of a user changing password, normally via email. + * + * @since 2.7 + * + * @param object $user User Object + */ +function wp_password_change_notification(&$user) { + // send a copy of password change notification to the admin + // but check to see if it's the admin whose password we're changing, and skip this + if ( $user->user_email != get_option('admin_email') ) { + $message = sprintf(__('Password Lost and Changed for user: %s'), $user->user_login) . "\r\n"; + // The blogname option is escaped with esc_html on the way into the database in sanitize_option + // we want to reverse this for the plain text arena of emails. + $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES); + wp_mail(get_option('admin_email'), sprintf(__('[%s] Password Lost/Changed'), $blogname), $message); + } +} +endif; + +if ( !function_exists('wp_new_user_notification') ) : +/** + * Notify the blog admin of a new user, normally via email. + * + * @since 2.0 + * + * @param int $user_id User ID + * @param string $plaintext_pass Optional. The user's plaintext password + */ +function wp_new_user_notification($user_id, $plaintext_pass = '') { + $user = new WP_User($user_id); + + $user_login = stripslashes($user->user_login); + $user_email = stripslashes($user->user_email); + + // The blogname option is escaped with esc_html on the way into the database in sanitize_option + // we want to reverse this for the plain text arena of emails. + $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES); + + $message = sprintf(__('New user registration on your site %s:'), $blogname) . "\r\n\r\n"; + $message .= sprintf(__('Username: %s'), $user_login) . "\r\n\r\n"; + $message .= sprintf(__('E-mail: %s'), $user_email) . "\r\n"; + + @wp_mail(get_option('admin_email'), sprintf(__('[%s] New User Registration'), $blogname), $message); + + if ( empty($plaintext_pass) ) + return; + + $message = sprintf(__('Username: %s'), $user_login) . "\r\n"; + $message .= sprintf(__('Password: %s'), $plaintext_pass) . "\r\n"; + $message .= wp_login_url() . "\r\n"; + + wp_mail($user_email, sprintf(__('[%s] Your username and password'), $blogname), $message); + +} +endif; + +if ( !function_exists('wp_nonce_tick') ) : +/** + * Get the time-dependent variable for nonce creation. + * + * A nonce has a lifespan of two ticks. Nonces in their second tick may be + * updated, e.g. by autosave. + * + * @since 2.5 + * + * @return int + */ +function wp_nonce_tick() { + $nonce_life = apply_filters('nonce_life', 86400); + + return ceil(time() / ( $nonce_life / 2 )); +} +endif; + +if ( !function_exists('wp_verify_nonce') ) : +/** + * Verify that correct nonce was used with time limit. + * + * The user is given an amount of time to use the token, so therefore, since the + * UID and $action remain the same, the independent variable is the time. + * + * @since 2.0.3 + * + * @param string $nonce Nonce that was used in the form to verify + * @param string|int $action Should give context to what is taking place and be the same when nonce was created. + * @return bool Whether the nonce check passed or failed. + */ +function wp_verify_nonce($nonce, $action = -1) { + $user = wp_get_current_user(); + $uid = (int) $user->id; + + $i = wp_nonce_tick(); + + // Nonce generated 0-12 hours ago + if ( substr(wp_hash($i . $action . $uid, 'nonce'), -12, 10) == $nonce ) + return 1; + // Nonce generated 12-24 hours ago + if ( substr(wp_hash(($i - 1) . $action . $uid, 'nonce'), -12, 10) == $nonce ) + return 2; + // Invalid nonce + return false; +} +endif; + +if ( !function_exists('wp_create_nonce') ) : +/** + * Creates a random, one time use token. + * + * @since 2.0.3 + * + * @param string|int $action Scalar value to add context to the nonce. + * @return string The one use form token + */ +function wp_create_nonce($action = -1) { + $user = wp_get_current_user(); + $uid = (int) $user->id; + + $i = wp_nonce_tick(); + + return substr(wp_hash($i . $action . $uid, 'nonce'), -12, 10); +} +endif; + +if ( !function_exists('wp_salt') ) : +/** + * Get salt to add to hashes to help prevent attacks. + * + * The secret key is located in two places: the database in case the secret key + * isn't defined in the second place, which is in the wp-config.php file. If you + * are going to set the secret key, then you must do so in the wp-config.php + * file. + * + * The secret key in the database is randomly generated and will be appended to + * the secret key that is in wp-config.php file in some instances. It is + * important to have the secret key defined or changed in wp-config.php. + * + * If you have installed WordPress 2.5 or later, then you will have the + * SECRET_KEY defined in the wp-config.php already. You will want to change the + * value in it because hackers will know what it is. If you have upgraded to + * WordPress 2.5 or later version from a version before WordPress 2.5, then you + * should add the constant to your wp-config.php file. + * + * Below is an example of how the SECRET_KEY constant is defined with a value. + * You must not copy the below example and paste into your wp-config.php. If you + * need an example, then you can have a + * {@link https://api.wordpress.org/secret-key/1.1/ secret key created} for you. + * + * + * define('SECRET_KEY', 'mAry1HadA15|\/|b17w55w1t3asSn09w'); + * + * + * Salting passwords helps against tools which has stored hashed values of + * common dictionary strings. The added values makes it harder to crack if given + * salt string is not weak. + * + * @since 2.5 + * @link https://api.wordpress.org/secret-key/1.1/ Create a Secret Key for wp-config.php + * + * @param string $scheme Authentication scheme + * @return string Salt value + */ +function wp_salt($scheme = 'auth') { + global $wp_default_secret_key; + $secret_key = ''; + if ( defined('SECRET_KEY') && ('' != SECRET_KEY) && ( $wp_default_secret_key != SECRET_KEY) ) + $secret_key = SECRET_KEY; + + if ( 'auth' == $scheme ) { + if ( defined('AUTH_KEY') && ('' != AUTH_KEY) && ( $wp_default_secret_key != AUTH_KEY) ) + $secret_key = AUTH_KEY; + + if ( defined('AUTH_SALT') && ('' != AUTH_SALT) && ( $wp_default_secret_key != AUTH_SALT) ) { + $salt = AUTH_SALT; + } elseif ( defined('SECRET_SALT') && ('' != SECRET_SALT) && ( $wp_default_secret_key != SECRET_SALT) ) { + $salt = SECRET_SALT; + } else { + $salt = get_site_option('auth_salt'); + if ( empty($salt) ) { + $salt = wp_generate_password( 64, true, true ); + update_site_option('auth_salt', $salt); + } + } + } elseif ( 'secure_auth' == $scheme ) { + if ( defined('SECURE_AUTH_KEY') && ('' != SECURE_AUTH_KEY) && ( $wp_default_secret_key != SECURE_AUTH_KEY) ) + $secret_key = SECURE_AUTH_KEY; + + if ( defined('SECURE_AUTH_SALT') && ('' != SECURE_AUTH_SALT) && ( $wp_default_secret_key != SECURE_AUTH_SALT) ) { + $salt = SECURE_AUTH_SALT; + } else { + $salt = get_site_option('secure_auth_salt'); + if ( empty($salt) ) { + $salt = wp_generate_password( 64, true, true ); + update_site_option('secure_auth_salt', $salt); + } + } + } elseif ( 'logged_in' == $scheme ) { + if ( defined('LOGGED_IN_KEY') && ('' != LOGGED_IN_KEY) && ( $wp_default_secret_key != LOGGED_IN_KEY) ) + $secret_key = LOGGED_IN_KEY; + + if ( defined('LOGGED_IN_SALT') && ('' != LOGGED_IN_SALT) && ( $wp_default_secret_key != LOGGED_IN_SALT) ) { + $salt = LOGGED_IN_SALT; + } else { + $salt = get_site_option('logged_in_salt'); + if ( empty($salt) ) { + $salt = wp_generate_password( 64, true, true ); + update_site_option('logged_in_salt', $salt); + } + } + } elseif ( 'nonce' == $scheme ) { + if ( defined('NONCE_KEY') && ('' != NONCE_KEY) && ( $wp_default_secret_key != NONCE_KEY) ) + $secret_key = NONCE_KEY; + + if ( defined('NONCE_SALT') && ('' != NONCE_SALT) && ( $wp_default_secret_key != NONCE_SALT) ) { + $salt = NONCE_SALT; + } else { + $salt = get_site_option('nonce_salt'); + if ( empty($salt) ) { + $salt = wp_generate_password( 64, true, true ); + update_site_option('nonce_salt', $salt); + } + } + } else { + // ensure each auth scheme has its own unique salt + $salt = hash_hmac('md5', $scheme, $secret_key); + } + + return apply_filters('salt', $secret_key . $salt, $scheme); +} +endif; + +if ( !function_exists('wp_hash') ) : +/** + * Get hash of given string. + * + * @since 2.0.3 + * @uses wp_salt() Get WordPress salt + * + * @param string $data Plain text to hash + * @return string Hash of $data + */ +function wp_hash($data, $scheme = 'auth') { + $salt = wp_salt($scheme); + + return hash_hmac('md5', $data, $salt); +} +endif; + +if ( !function_exists('wp_hash_password') ) : +/** + * Create a hash (encrypt) of a plain text password. + * + * For integration with other applications, this function can be overwritten to + * instead use the other package password checking algorithm. + * + * @since 2.5 + * @global object $wp_hasher PHPass object + * @uses PasswordHash::HashPassword + * + * @param string $password Plain text user password to hash + * @return string The hash string of the password + */ +function wp_hash_password($password) { + global $wp_hasher; + + if ( empty($wp_hasher) ) { + require_once( ABSPATH . 'wp-includes/class-phpass.php'); + // By default, use the portable hash from phpass + $wp_hasher = new PasswordHash(8, TRUE); + } + + return $wp_hasher->HashPassword($password); +} +endif; + +if ( !function_exists('wp_check_password') ) : +/** + * Checks the plaintext password against the encrypted Password. + * + * Maintains compatibility between old version and the new cookie authentication + * protocol using PHPass library. The $hash parameter is the encrypted password + * and the function compares the plain text password when encypted similarly + * against the already encrypted password to see if they match. + * + * For integration with other applications, this function can be overwritten to + * instead use the other package password checking algorithm. + * + * @since 2.5 + * @global object $wp_hasher PHPass object used for checking the password + * against the $hash + $password + * @uses PasswordHash::CheckPassword + * + * @param string $password Plaintext user's password + * @param string $hash Hash of the user's password to check against. + * @return bool False, if the $password does not match the hashed password + */ +function wp_check_password($password, $hash, $user_id = '') { + global $wp_hasher; + + // If the hash is still md5... + if ( strlen($hash) <= 32 ) { + $check = ( $hash == md5($password) ); + if ( $check && $user_id ) { + // Rehash using new hash. + wp_set_password($password, $user_id); + $hash = wp_hash_password($password); + } + + return apply_filters('check_password', $check, $password, $hash, $user_id); + } + + // If the stored hash is longer than an MD5, presume the + // new style phpass portable hash. + if ( empty($wp_hasher) ) { + require_once( ABSPATH . 'wp-includes/class-phpass.php'); + // By default, use the portable hash from phpass + $wp_hasher = new PasswordHash(8, TRUE); + } + + $check = $wp_hasher->CheckPassword($password, $hash); + + return apply_filters('check_password', $check, $password, $hash, $user_id); +} +endif; + +if ( !function_exists('wp_generate_password') ) : +/** + * Generates a random password drawn from the defined set of characters. + * + * @since 2.5 + * + * @param int $length The length of password to generate + * @param bool $special_chars Whether to include standard special characters. Default true. + * @param bool $extra_special_chars Whether to include other special characters. Used when + * generating secret keys and salts. Default false. + * @return string The random password + **/ +function wp_generate_password( $length = 12, $special_chars = true, $extra_special_chars = false ) { + $chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'; + if ( $special_chars ) + $chars .= '!@#$%^&*()'; + if ( $extra_special_chars ) + $chars .= '-_ []{}<>~`+=,.;:/?|'; + + $password = ''; + for ( $i = 0; $i < $length; $i++ ) { + $password .= substr($chars, wp_rand(0, strlen($chars) - 1), 1); + } + + // random_password filter was previously in random_password function which was deprecated + return apply_filters('random_password', $password); +} +endif; + +if ( !function_exists('wp_rand') ) : + /** + * Generates a random number + * + * @since 2.6.2 + * + * @param int $min Lower limit for the generated number (optional, default is 0) + * @param int $max Upper limit for the generated number (optional, default is 4294967295) + * @return int A random number between min and max + */ +function wp_rand( $min = 0, $max = 0 ) { + global $rnd_value; + + // Reset $rnd_value after 14 uses + // 32(md5) + 40(sha1) + 40(sha1) / 8 = 14 random numbers from $rnd_value + if ( strlen($rnd_value) < 8 ) { + if ( defined( 'WP_SETUP_CONFIG' ) ) + static $seed = ''; + else + $seed = get_transient('random_seed'); + $rnd_value = md5( uniqid(microtime() . mt_rand(), true ) . $seed ); + $rnd_value .= sha1($rnd_value); + $rnd_value .= sha1($rnd_value . $seed); + $seed = md5($seed . $rnd_value); + if ( ! defined( 'WP_SETUP_CONFIG' ) ) + set_transient('random_seed', $seed); + } + + // Take the first 8 digits for our value + $value = substr($rnd_value, 0, 8); + + // Strip the first eight, leaving the remainder for the next call to wp_rand(). + $rnd_value = substr($rnd_value, 8); + + $value = abs(hexdec($value)); + + // Reduce the value to be within the min - max range + // 4294967295 = 0xffffffff = max random number + if ( $max != 0 ) + $value = $min + (($max - $min + 1) * ($value / (4294967295 + 1))); + + return abs(intval($value)); +} +endif; + +if ( !function_exists('wp_set_password') ) : +/** + * Updates the user's password with a new encrypted one. + * + * For integration with other applications, this function can be overwritten to + * instead use the other package password checking algorithm. + * + * @since 2.5 + * @uses $wpdb WordPress database object for queries + * @uses wp_hash_password() Used to encrypt the user's password before passing to the database + * + * @param string $password The plaintext new user password + * @param int $user_id User ID + */ +function wp_set_password( $password, $user_id ) { + global $wpdb; + + $hash = wp_hash_password($password); + $wpdb->update($wpdb->users, array('user_pass' => $hash, 'user_activation_key' => ''), array('ID' => $user_id) ); + + wp_cache_delete($user_id, 'users'); +} +endif; + +if ( !function_exists( 'get_avatar' ) ) : +/** + * Retrieve the avatar for a user who provided a user ID or email address. + * + * @since 2.5 + * @param int|string|object $id_or_email A user ID, email address, or comment object + * @param int $size Size of the avatar image + * @param string $default URL to a default image to use if no avatar is available + * @param string $alt Alternate text to use in image tag. Defaults to blank + * @return string tag for the user's avatar +*/ +function get_avatar( $id_or_email, $size = '96', $default = '', $alt = false ) { + if ( ! get_option('show_avatars') ) + return false; + + if ( false === $alt) + $safe_alt = ''; + else + $safe_alt = esc_attr( $alt ); + + if ( !is_numeric($size) ) + $size = '96'; + + $email = ''; + if ( is_numeric($id_or_email) ) { + $id = (int) $id_or_email; + $user = get_userdata($id); + if ( $user ) + $email = $user->user_email; + } elseif ( is_object($id_or_email) ) { + // No avatar for pingbacks or trackbacks + $allowed_comment_types = apply_filters( 'get_avatar_comment_types', array( 'comment' ) ); + if ( ! empty( $id_or_email->comment_type ) && ! in_array( $id_or_email->comment_type, (array) $allowed_comment_types ) ) + return false; + + if ( !empty($id_or_email->user_id) ) { + $id = (int) $id_or_email->user_id; + $user = get_userdata($id); + if ( $user) + $email = $user->user_email; + } elseif ( !empty($id_or_email->comment_author_email) ) { + $email = $id_or_email->comment_author_email; + } + } else { + $email = $id_or_email; + } + + if ( empty($default) ) { + $avatar_default = get_option('avatar_default'); + if ( empty($avatar_default) ) + $default = 'mystery'; + else + $default = $avatar_default; + } + + if ( !empty($email) ) + $email_hash = md5( strtolower( $email ) ); + + if ( is_ssl() ) { + $host = 'https://secure.gravatar.com'; + } else { + if ( !empty($email) ) + $host = sprintf( "http://%d.gravatar.com", ( hexdec( $email_hash[0] ) % 2 ) ); + else + $host = 'http://0.gravatar.com'; + } + + if ( 'mystery' == $default ) + $default = "$host/avatar/ad516503a11cd5ca435acc9bb6523536?s={$size}"; // ad516503a11cd5ca435acc9bb6523536 == md5('unknown@gravatar.com') + elseif ( 'blank' == $default ) + $default = includes_url('images/blank.gif'); + elseif ( !empty($email) && 'gravatar_default' == $default ) + $default = ''; + elseif ( 'gravatar_default' == $default ) + $default = "$host/avatar/s={$size}"; + elseif ( empty($email) ) + $default = "$host/avatar/?d=$default&s={$size}"; + elseif ( strpos($default, 'http://') === 0 ) + $default = add_query_arg( 's', $size, $default ); + + if ( !empty($email) ) { + $out = "$host/avatar/"; + $out .= $email_hash; + $out .= '?s='.$size; + $out .= '&d=' . urlencode( $default ); + + $rating = get_option('avatar_rating'); + if ( !empty( $rating ) ) + $out .= "&r={$rating}"; + + $avatar = "{$safe_alt}"; + } else { + $avatar = "{$safe_alt}"; + } + + return apply_filters('get_avatar', $avatar, $id_or_email, $size, $default, $alt); +} +endif; + +if ( !function_exists( 'wp_text_diff' ) ) : +/** + * Displays a human readable HTML representation of the difference between two strings. + * + * The Diff is available for getting the changes between versions. The output is + * HTML, so the primary use is for displaying the changes. If the two strings + * are equivalent, then an empty string will be returned. + * + * The arguments supported and can be changed are listed below. + * + * 'title' : Default is an empty string. Titles the diff in a manner compatible + * with the output. + * 'title_left' : Default is an empty string. Change the HTML to the left of the + * title. + * 'title_right' : Default is an empty string. Change the HTML to the right of + * the title. + * + * @since 2.6 + * @see wp_parse_args() Used to change defaults to user defined settings. + * @uses Text_Diff + * @uses WP_Text_Diff_Renderer_Table + * + * @param string $left_string "old" (left) version of string + * @param string $right_string "new" (right) version of string + * @param string|array $args Optional. Change 'title', 'title_left', and 'title_right' defaults. + * @return string Empty string if strings are equivalent or HTML with differences. + */ +function wp_text_diff( $left_string, $right_string, $args = null ) { + $defaults = array( 'title' => '', 'title_left' => '', 'title_right' => '' ); + $args = wp_parse_args( $args, $defaults ); + + if ( !class_exists( 'WP_Text_Diff_Renderer_Table' ) ) + require( ABSPATH . WPINC . '/wp-diff.php' ); + + $left_string = normalize_whitespace($left_string); + $right_string = normalize_whitespace($right_string); + + $left_lines = split("\n", $left_string); + $right_lines = split("\n", $right_string); + + $text_diff = new Text_Diff($left_lines, $right_lines); + $renderer = new WP_Text_Diff_Renderer_Table(); + $diff = $renderer->render($text_diff); + + if ( !$diff ) + return ''; + + $r = "\n"; + $r .= ""; + + if ( $args['title'] || $args['title_left'] || $args['title_right'] ) + $r .= ""; + if ( $args['title'] ) + $r .= "\n"; + if ( $args['title_left'] || $args['title_right'] ) { + $r .= "\n"; + $r .= "\t\n"; + $r .= "\t\n"; + $r .= "\n"; + } + if ( $args['title'] || $args['title_left'] || $args['title_right'] ) + $r .= "\n"; + + $r .= "\n$diff\n\n"; + $r .= "
            $args[title]
            $args[title_left]$args[title_right]
            "; + + return $r; +} +endif; diff --git a/src/wp-includes/plugin.php b/src/wp-includes/plugin.php new file mode 100644 index 0000000..945461c --- /dev/null +++ b/src/wp-includes/plugin.php @@ -0,0 +1,788 @@ + + * function example_hook($example) { echo $example; } + * add_filter('example_filter', 'example_hook'); + * + * + * In WordPress 1.5.1+, hooked functions can take extra arguments that are set + * when the matching do_action() or apply_filters() call is run. The + * $accepted_args allow for calling functions only when the number of args + * match. Hooked functions can take extra arguments that are set when the + * matching do_action() or apply_filters() call is run. For example, the action + * comment_id_not_found will pass any functions that hook onto it the ID of the + * requested comment. + * + * Note: the function will return true no matter if the + * function was hooked fails or not. There are no checks for whether the + * function exists beforehand and no checks to whether the $function_to_add + * is even a string. It is up to you to take care and this is done for + * optimization purposes, so everything is as quick as possible. + * + * @package WordPress + * @subpackage Plugin + * @since 0.71 + * @global array $wp_filter Stores all of the filters added in the form of + * wp_filter['tag']['array of priorities']['array of functions serialized']['array of ['array (functions, accepted_args)']'] + * @global array $merged_filters Tracks the tags that need to be merged for later. If the hook is added, it doesn't need to run through that process. + * + * @param string $tag The name of the filter to hook the $function_to_add to. + * @param callback $function_to_add The name of the function to be called when the filter is applied. + * @param int $priority optional. Used to specify the order in which the functions associated with a particular action are executed (default: 10). Lower numbers correspond with earlier execution, and functions with the same priority are executed in the order in which they were added to the action. + * @param int $accepted_args optional. The number of arguments the function accept (default 1). + * @return boolean true + */ +function add_filter($tag, $function_to_add, $priority = 10, $accepted_args = 1) { + global $wp_filter, $merged_filters; + + $idx = _wp_filter_build_unique_id($tag, $function_to_add, $priority); + $wp_filter[$tag][$priority][$idx] = array('function' => $function_to_add, 'accepted_args' => $accepted_args); + unset( $merged_filters[ $tag ] ); + return true; +} + +/** + * Check if any filter has been registered for a hook. + * + * @package WordPress + * @subpackage Plugin + * @since 2.5 + * @global array $wp_filter Stores all of the filters + * + * @param string $tag The name of the filter hook. + * @param callback $function_to_check optional. If specified, return the priority of that function on this hook or false if not attached. + * @return int|boolean Optionally returns the priority on that hook for the specified function. + */ +function has_filter($tag, $function_to_check = false) { + global $wp_filter; + + $has = !empty($wp_filter[$tag]); + if ( false === $function_to_check || false == $has ) + return $has; + + if ( !$idx = _wp_filter_build_unique_id($tag, $function_to_check, false) ) + return false; + + foreach ( (array) array_keys($wp_filter[$tag]) as $priority ) { + if ( isset($wp_filter[$tag][$priority][$idx]) ) + return $priority; + } + + return false; +} + +/** + * Call the functions added to a filter hook. + * + * The callback functions attached to filter hook $tag are invoked by calling + * this function. This function can be used to create a new filter hook by + * simply calling this function with the name of the new hook specified using + * the $tag parameter. + * + * The function allows for additional arguments to be added and passed to hooks. + * + * function example_hook($string, $arg1, $arg2) + * { + * //Do stuff + * return $string; + * } + * $value = apply_filters('example_filter', 'filter me', 'arg1', 'arg2'); + * + * + * @package WordPress + * @subpackage Plugin + * @since 0.71 + * @global array $wp_filter Stores all of the filters + * @global array $merged_filters Merges the filter hooks using this function. + * @global array $wp_current_filter stores the list of current filters with the current one last + * + * @param string $tag The name of the filter hook. + * @param mixed $value The value on which the filters hooked to $tag are applied on. + * @param mixed $var,... Additional variables passed to the functions hooked to $tag. + * @return mixed The filtered value after all hooked functions are applied to it. + */ +function apply_filters($tag, $value) { + global $wp_filter, $merged_filters, $wp_current_filter; + + $args = array(); + + // Do 'all' actions first + if ( isset($wp_filter['all']) ) { + $wp_current_filter[] = $tag; + $args = func_get_args(); + _wp_call_all_hook($args); + } + + if ( !isset($wp_filter[$tag]) ) { + if ( isset($wp_filter['all']) ) + array_pop($wp_current_filter); + return $value; + } + + if ( !isset($wp_filter['all']) ) + $wp_current_filter[] = $tag; + + // Sort + if ( !isset( $merged_filters[ $tag ] ) ) { + ksort($wp_filter[$tag]); + $merged_filters[ $tag ] = true; + } + + reset( $wp_filter[ $tag ] ); + + if ( empty($args) ) + $args = func_get_args(); + + do { + foreach( (array) current($wp_filter[$tag]) as $the_ ) + if ( !is_null($the_['function']) ){ + $args[1] = $value; + $value = call_user_func_array($the_['function'], array_slice($args, 1, (int) $the_['accepted_args'])); + } + + } while ( next($wp_filter[$tag]) !== false ); + + array_pop( $wp_current_filter ); + + return $value; +} + +/** + * Execute functions hooked on a specific filter hook, specifying arguments in an array. + * + * @see apply_filters() This function is identical, but the arguments passed to the + * functions hooked to $tag are supplied using an array. + * + * @package WordPress + * @subpackage Plugin + * @since 3.0.0 + * @global array $wp_filter Stores all of the filters + * @global array $merged_filters Merges the filter hooks using this function. + * @global array $wp_current_filter stores the list of current filters with the current one last + * + * @param string $tag The name of the filter hook. + * @param array $args The arguments supplied to the functions hooked to $tag + * @return mixed The filtered value after all hooked functions are applied to it. + */ +function apply_filters_ref_array($tag, $args) { + global $wp_filter, $merged_filters, $wp_current_filter; + + // Do 'all' actions first + if ( isset($wp_filter['all']) ) { + $wp_current_filter[] = $tag; + $all_args = func_get_args(); + _wp_call_all_hook($all_args); + } + + if ( !isset($wp_filter[$tag]) ) { + if ( isset($wp_filter['all']) ) + array_pop($wp_current_filter); + return $args[0]; + } + + if ( !isset($wp_filter['all']) ) + $wp_current_filter[] = $tag; + + // Sort + if ( !isset( $merged_filters[ $tag ] ) ) { + ksort($wp_filter[$tag]); + $merged_filters[ $tag ] = true; + } + + reset( $wp_filter[ $tag ] ); + + do { + foreach( (array) current($wp_filter[$tag]) as $the_ ) + if ( !is_null($the_['function']) ) + $args[0] = call_user_func_array($the_['function'], array_slice($args, 0, (int) $the_['accepted_args'])); + + } while ( next($wp_filter[$tag]) !== false ); + + array_pop( $wp_current_filter ); + + return $args[0]; +} + +/** + * Removes a function from a specified filter hook. + * + * This function removes a function attached to a specified filter hook. This + * method can be used to remove default functions attached to a specific filter + * hook and possibly replace them with a substitute. + * + * To remove a hook, the $function_to_remove and $priority arguments must match + * when the hook was added. This goes for both filters and actions. No warning + * will be given on removal failure. + * + * @package WordPress + * @subpackage Plugin + * @since 1.2 + * + * @param string $tag The filter hook to which the function to be removed is hooked. + * @param callback $function_to_remove The name of the function which should be removed. + * @param int $priority optional. The priority of the function (default: 10). + * @param int $accepted_args optional. The number of arguments the function accpets (default: 1). + * @return boolean Whether the function existed before it was removed. + */ +function remove_filter($tag, $function_to_remove, $priority = 10, $accepted_args = 1) { + $function_to_remove = _wp_filter_build_unique_id($tag, $function_to_remove, $priority); + + $r = isset($GLOBALS['wp_filter'][$tag][$priority][$function_to_remove]); + + if ( true === $r) { + unset($GLOBALS['wp_filter'][$tag][$priority][$function_to_remove]); + if ( empty($GLOBALS['wp_filter'][$tag][$priority]) ) + unset($GLOBALS['wp_filter'][$tag][$priority]); + unset($GLOBALS['merged_filters'][$tag]); + } + + return $r; +} + +/** + * Remove all of the hooks from a filter. + * + * @since 2.7 + * + * @param string $tag The filter to remove hooks from. + * @param int $priority The priority number to remove. + * @return bool True when finished. + */ +function remove_all_filters($tag, $priority = false) { + global $wp_filter, $merged_filters; + + if( isset($wp_filter[$tag]) ) { + if( false !== $priority && isset($wp_filter[$tag][$priority]) ) + unset($wp_filter[$tag][$priority]); + else + unset($wp_filter[$tag]); + } + + if( isset($merged_filters[$tag]) ) + unset($merged_filters[$tag]); + + return true; +} + +/** + * Retrieve the name of the current filter or action. + * + * @package WordPress + * @subpackage Plugin + * @since 2.5 + * + * @return string Hook name of the current filter or action. + */ +function current_filter() { + global $wp_current_filter; + return end( $wp_current_filter ); +} + + +/** + * Hooks a function on to a specific action. + * + * Actions are the hooks that the WordPress core launches at specific points + * during execution, or when specific events occur. Plugins can specify that + * one or more of its PHP functions are executed at these points, using the + * Action API. + * + * @uses add_filter() Adds an action. Parameter list and functionality are the same. + * + * @package WordPress + * @subpackage Plugin + * @since 1.2 + * + * @param string $tag The name of the action to which the $function_to_add is hooked. + * @param callback $function_to_add The name of the function you wish to be called. + * @param int $priority optional. Used to specify the order in which the functions associated with a particular action are executed (default: 10). Lower numbers correspond with earlier execution, and functions with the same priority are executed in the order in which they were added to the action. + * @param int $accepted_args optional. The number of arguments the function accept (default 1). + */ +function add_action($tag, $function_to_add, $priority = 10, $accepted_args = 1) { + return add_filter($tag, $function_to_add, $priority, $accepted_args); +} + + +/** + * Execute functions hooked on a specific action hook. + * + * This function invokes all functions attached to action hook $tag. It is + * possible to create new action hooks by simply calling this function, + * specifying the name of the new hook using the $tag parameter. + * + * You can pass extra arguments to the hooks, much like you can with + * apply_filters(). + * + * @see apply_filters() This function works similar with the exception that + * nothing is returned and only the functions or methods are called. + * + * @package WordPress + * @subpackage Plugin + * @since 1.2 + * @global array $wp_filter Stores all of the filters + * @global array $wp_actions Increments the amount of times action was triggered. + * + * @param string $tag The name of the action to be executed. + * @param mixed $arg,... Optional additional arguments which are passed on to the functions hooked to the action. + * @return null Will return null if $tag does not exist in $wp_filter array + */ +function do_action($tag, $arg = '') { + global $wp_filter, $wp_actions, $merged_filters, $wp_current_filter; + + if ( ! isset($wp_actions) ) + $wp_actions = array(); + + if ( ! isset($wp_actions[$tag]) ) + $wp_actions[$tag] = 1; + else + ++$wp_actions[$tag]; + + // Do 'all' actions first + if ( isset($wp_filter['all']) ) { + $wp_current_filter[] = $tag; + $all_args = func_get_args(); + _wp_call_all_hook($all_args); + } + + if ( !isset($wp_filter[$tag]) ) { + if ( isset($wp_filter['all']) ) + array_pop($wp_current_filter); + return; + } + + if ( !isset($wp_filter['all']) ) + $wp_current_filter[] = $tag; + + $args = array(); + if ( is_array($arg) && 1 == count($arg) && isset($arg[0]) && is_object($arg[0]) ) // array(&$this) + $args[] =& $arg[0]; + else + $args[] = $arg; + for ( $a = 2; $a < func_num_args(); $a++ ) + $args[] = func_get_arg($a); + + // Sort + if ( !isset( $merged_filters[ $tag ] ) ) { + ksort($wp_filter[$tag]); + $merged_filters[ $tag ] = true; + } + + reset( $wp_filter[ $tag ] ); + + do { + foreach ( (array) current($wp_filter[$tag]) as $the_ ) + if ( !is_null($the_['function']) ) + call_user_func_array($the_['function'], array_slice($args, 0, (int) $the_['accepted_args'])); + + } while ( next($wp_filter[$tag]) !== false ); + + array_pop($wp_current_filter); +} + +/** + * Retrieve the number times an action is fired. + * + * @package WordPress + * @subpackage Plugin + * @since 2.1 + * @global array $wp_actions Increments the amount of times action was triggered. + * + * @param string $tag The name of the action hook. + * @return int The number of times action hook $tag is fired + */ +function did_action($tag) { + global $wp_actions; + + if ( ! isset( $wp_actions ) || ! isset( $wp_actions[$tag] ) ) + return 0; + + return $wp_actions[$tag]; +} + +/** + * Execute functions hooked on a specific action hook, specifying arguments in an array. + * + * @see do_action() This function is identical, but the arguments passed to the + * functions hooked to $tag are supplied using an array. + * + * @package WordPress + * @subpackage Plugin + * @since 2.1 + * @global array $wp_filter Stores all of the filters + * @global array $wp_actions Increments the amount of times action was triggered. + * + * @param string $tag The name of the action to be executed. + * @param array $args The arguments supplied to the functions hooked to $tag + * @return null Will return null if $tag does not exist in $wp_filter array + */ +function do_action_ref_array($tag, $args) { + global $wp_filter, $wp_actions, $merged_filters, $wp_current_filter; + + if ( ! isset($wp_actions) ) + $wp_actions = array(); + + if ( ! isset($wp_actions[$tag]) ) + $wp_actions[$tag] = 1; + else + ++$wp_actions[$tag]; + + // Do 'all' actions first + if ( isset($wp_filter['all']) ) { + $wp_current_filter[] = $tag; + $all_args = func_get_args(); + _wp_call_all_hook($all_args); + } + + if ( !isset($wp_filter[$tag]) ) { + if ( isset($wp_filter['all']) ) + array_pop($wp_current_filter); + return; + } + + if ( !isset($wp_filter['all']) ) + $wp_current_filter[] = $tag; + + // Sort + if ( !isset( $merged_filters[ $tag ] ) ) { + ksort($wp_filter[$tag]); + $merged_filters[ $tag ] = true; + } + + reset( $wp_filter[ $tag ] ); + + do { + foreach( (array) current($wp_filter[$tag]) as $the_ ) + if ( !is_null($the_['function']) ) + call_user_func_array($the_['function'], array_slice($args, 0, (int) $the_['accepted_args'])); + + } while ( next($wp_filter[$tag]) !== false ); + + array_pop($wp_current_filter); +} + +/** + * Check if any action has been registered for a hook. + * + * @package WordPress + * @subpackage Plugin + * @since 2.5 + * @see has_filter() has_action() is an alias of has_filter(). + * + * @param string $tag The name of the action hook. + * @param callback $function_to_check optional. If specified, return the priority of that function on this hook or false if not attached. + * @return int|boolean Optionally returns the priority on that hook for the specified function. + */ +function has_action($tag, $function_to_check = false) { + return has_filter($tag, $function_to_check); +} + +/** + * Removes a function from a specified action hook. + * + * This function removes a function attached to a specified action hook. This + * method can be used to remove default functions attached to a specific filter + * hook and possibly replace them with a substitute. + * + * @package WordPress + * @subpackage Plugin + * @since 1.2 + * + * @param string $tag The action hook to which the function to be removed is hooked. + * @param callback $function_to_remove The name of the function which should be removed. + * @param int $priority optional The priority of the function (default: 10). + * @param int $accepted_args optional. The number of arguments the function accpets (default: 1). + * @return boolean Whether the function is removed. + */ +function remove_action($tag, $function_to_remove, $priority = 10, $accepted_args = 1) { + return remove_filter($tag, $function_to_remove, $priority, $accepted_args); +} + +/** + * Remove all of the hooks from an action. + * + * @since 2.7 + * + * @param string $tag The action to remove hooks from. + * @param int $priority The priority number to remove them from. + * @return bool True when finished. + */ +function remove_all_actions($tag, $priority = false) { + return remove_all_filters($tag, $priority); +} + +// +// Functions for handling plugins. +// + +/** + * Gets the basename of a plugin. + * + * This method extracts the name of a plugin from its filename. + * + * @package WordPress + * @subpackage Plugin + * @since 1.5 + * + * @access private + * + * @param string $file The filename of plugin. + * @return string The name of a plugin. + * @uses WP_PLUGIN_DIR + */ +function plugin_basename($file) { + $file = str_replace('\\','/',$file); // sanitize for Win32 installs + $file = preg_replace('|/+|','/', $file); // remove any duplicate slash + $plugin_dir = str_replace('\\','/',WP_PLUGIN_DIR); // sanitize for Win32 installs + $plugin_dir = preg_replace('|/+|','/', $plugin_dir); // remove any duplicate slash + $mu_plugin_dir = str_replace('\\','/',WPMU_PLUGIN_DIR); // sanitize for Win32 installs + $mu_plugin_dir = preg_replace('|/+|','/', $mu_plugin_dir); // remove any duplicate slash + $file = preg_replace('#^' . preg_quote($plugin_dir, '#') . '/|^' . preg_quote($mu_plugin_dir, '#') . '/#','',$file); // get relative path from plugins dir + $file = trim($file, '/'); + return $file; +} + +/** + * Gets the filesystem directory path (with trailing slash) for the plugin __FILE__ passed in + * @package WordPress + * @subpackage Plugin + * @since 2.8 + * + * @param string $file The filename of the plugin (__FILE__) + * @return string the filesystem path of the directory that contains the plugin + */ +function plugin_dir_path( $file ) { + return trailingslashit( dirname( $file ) ); +} + +/** + * Gets the URL directory path (with trailing slash) for the plugin __FILE__ passed in + * @package WordPress + * @subpackage Plugin + * @since 2.8 + * + * @param string $file The filename of the plugin (__FILE__) + * @return string the URL path of the directory that contains the plugin + */ +function plugin_dir_url( $file ) { + return trailingslashit( plugins_url( '', $file ) ); +} + +/** + * Set the activation hook for a plugin. + * + * When a plugin is activated, the action 'activate_PLUGINNAME' hook is + * activated. In the name of this hook, PLUGINNAME is replaced with the name of + * the plugin, including the optional subdirectory. For example, when the plugin + * is located in wp-content/plugin/sampleplugin/sample.php, then the name of + * this hook will become 'activate_sampleplugin/sample.php'. When the plugin + * consists of only one file and is (as by default) located at + * wp-content/plugin/sample.php the name of this hook will be + * 'activate_sample.php'. + * + * @package WordPress + * @subpackage Plugin + * @since 2.0 + * + * @param string $file The filename of the plugin including the path. + * @param callback $function the function hooked to the 'activate_PLUGIN' action. + */ +function register_activation_hook($file, $function) { + $file = plugin_basename($file); + add_action('activate_' . $file, $function); +} + +/** + * Set the deactivation hook for a plugin. + * + * When a plugin is deactivated, the action 'deactivate_PLUGINNAME' hook is + * deactivated. In the name of this hook, PLUGINNAME is replaced with the name + * of the plugin, including the optional subdirectory. For example, when the + * plugin is located in wp-content/plugin/sampleplugin/sample.php, then + * the name of this hook will become 'activate_sampleplugin/sample.php'. + * + * When the plugin consists of only one file and is (as by default) located at + * wp-content/plugin/sample.php the name of this hook will be + * 'activate_sample.php'. + * + * @package WordPress + * @subpackage Plugin + * @since 2.0 + * + * @param string $file The filename of the plugin including the path. + * @param callback $function the function hooked to the 'activate_PLUGIN' action. + */ +function register_deactivation_hook($file, $function) { + $file = plugin_basename($file); + add_action('deactivate_' . $file, $function); +} + +/** + * Set the uninstallation hook for a plugin. + * + * Registers the uninstall hook that will be called when the user clicks on the + * uninstall link that calls for the plugin to uninstall itself. The link won't + * be active unless the plugin hooks into the action. + * + * The plugin should not run arbitrary code outside of functions, when + * registering the uninstall hook. In order to run using the hook, the plugin + * will have to be included, which means that any code laying outside of a + * function will be run during the uninstall process. The plugin should not + * hinder the uninstall process. + * + * If the plugin can not be written without running code within the plugin, then + * the plugin should create a file named 'uninstall.php' in the base plugin + * folder. This file will be called, if it exists, during the uninstall process + * bypassing the uninstall hook. The plugin, when using the 'uninstall.php' + * should always check for the 'WP_UNINSTALL_PLUGIN' constant, before + * executing. + * + * @since 2.7 + * + * @param string $file + * @param callback $callback The callback to run when the hook is called. Must be a static method or function. + */ +function register_uninstall_hook( $file, $callback ) { + if ( is_array( $callback ) && is_object( $callback[0] ) ) { + _doing_it_wrong( __FUNCTION__, __( 'Only a static class method or function can be used in an uninstall hook.' ), '3.1' ); + return; + } + + // The option should not be autoloaded, because it is not needed in most + // cases. Emphasis should be put on using the 'uninstall.php' way of + // uninstalling the plugin. + $uninstallable_plugins = (array) get_option('uninstall_plugins'); + $uninstallable_plugins[plugin_basename($file)] = $callback; + update_option('uninstall_plugins', $uninstallable_plugins); +} + +/** + * Calls the 'all' hook, which will process the functions hooked into it. + * + * The 'all' hook passes all of the arguments or parameters that were used for + * the hook, which this function was called for. + * + * This function is used internally for apply_filters(), do_action(), and + * do_action_ref_array() and is not meant to be used from outside those + * functions. This function does not check for the existence of the all hook, so + * it will fail unless the all hook exists prior to this function call. + * + * @package WordPress + * @subpackage Plugin + * @since 2.5 + * @access private + * + * @uses $wp_filter Used to process all of the functions in the 'all' hook + * + * @param array $args The collected parameters from the hook that was called. + * @param string $hook Optional. The hook name that was used to call the 'all' hook. + */ +function _wp_call_all_hook($args) { + global $wp_filter; + + reset( $wp_filter['all'] ); + do { + foreach( (array) current($wp_filter['all']) as $the_ ) + if ( !is_null($the_['function']) ) + call_user_func_array($the_['function'], $args); + + } while ( next($wp_filter['all']) !== false ); +} + +/** + * Build Unique ID for storage and retrieval. + * + * The old way to serialize the callback caused issues and this function is the + * solution. It works by checking for objects and creating an a new property in + * the class to keep track of the object and new objects of the same class that + * need to be added. + * + * It also allows for the removal of actions and filters for objects after they + * change class properties. It is possible to include the property $wp_filter_id + * in your class and set it to "null" or a number to bypass the workaround. + * However this will prevent you from adding new classes and any new classes + * will overwrite the previous hook by the same class. + * + * Functions and static method callbacks are just returned as strings and + * shouldn't have any speed penalty. + * + * @package WordPress + * @subpackage Plugin + * @access private + * @since 2.2.3 + * @link http://trac.wordpress.org/ticket/3875 + * + * @global array $wp_filter Storage for all of the filters and actions + * @param string $tag Used in counting how many hooks were applied + * @param callback $function Used for creating unique id + * @param int|bool $priority Used in counting how many hooks were applied. If === false and $function is an object reference, we return the unique id only if it already has one, false otherwise. + * @return string|bool Unique ID for usage as array key or false if $priority === false and $function is an object reference, and it does not already have a uniqe id. + */ +function _wp_filter_build_unique_id($tag, $function, $priority) { + global $wp_filter; + static $filter_id_count = 0; + + if ( is_string($function) ) + return $function; + + if ( is_object($function) ) { + // Closures are currently implemented as objects + $function = array( $function, '' ); + } else { + $function = (array) $function; + } + + if (is_object($function[0]) ) { + // Object Class Calling + if ( function_exists('spl_object_hash') ) { + return spl_object_hash($function[0]) . $function[1]; + } else { + $obj_idx = get_class($function[0]).$function[1]; + if ( !isset($function[0]->wp_filter_id) ) { + if ( false === $priority ) + return false; + $obj_idx .= isset($wp_filter[$tag][$priority]) ? count((array)$wp_filter[$tag][$priority]) : $filter_id_count; + $function[0]->wp_filter_id = $filter_id_count; + ++$filter_id_count; + } else { + $obj_idx .= $function[0]->wp_filter_id; + } + + return $obj_idx; + } + } else if ( is_string($function[0]) ) { + // Static Calling + return $function[0].$function[1]; + } +} + +?> diff --git a/src/wp-includes/pomo/entry.php b/src/wp-includes/pomo/entry.php new file mode 100644 index 0000000..07ddfd4 --- /dev/null +++ b/src/wp-includes/pomo/entry.php @@ -0,0 +1,69 @@ + $value) { + $this->$varname = $value; + } + if (isset($args['plural'])) $this->is_plural = true; + if (!is_array($this->translations)) $this->translations = array(); + if (!is_array($this->references)) $this->references = array(); + if (!is_array($this->flags)) $this->flags = array(); + } + + /** + * Generates a unique key for this entry + * + * @return string|bool the key or false if the entry is empty + */ + function key() { + if (is_null($this->singular)) return false; + // prepend context and EOT, like in MO files + return is_null($this->context)? $this->singular : $this->context.chr(4).$this->singular; + } +} +endif; \ No newline at end of file diff --git a/src/wp-includes/pomo/mo.php b/src/wp-includes/pomo/mo.php new file mode 100644 index 0000000..72e0e7b --- /dev/null +++ b/src/wp-includes/pomo/mo.php @@ -0,0 +1,231 @@ +is_resource()) + return false; + return $this->import_from_reader($reader); + } + + function export_to_file($filename) { + $fh = fopen($filename, 'wb'); + if ( !$fh ) return false; + $entries = array_filter($this->entries, create_function('$e', 'return !empty($e->translations);')); + ksort($entries); + $magic = 0x950412de; + $revision = 0; + $total = count($entries) + 1; // all the headers are one entry + $originals_lenghts_addr = 28; + $translations_lenghts_addr = $originals_lenghts_addr + 8 * $total; + $size_of_hash = 0; + $hash_addr = $translations_lenghts_addr + 8 * $total; + $current_addr = $hash_addr; + fwrite($fh, pack('V*', $magic, $revision, $total, $originals_lenghts_addr, + $translations_lenghts_addr, $size_of_hash, $hash_addr)); + fseek($fh, $originals_lenghts_addr); + + // headers' msgid is an empty string + fwrite($fh, pack('VV', 0, $current_addr)); + $current_addr++; + $originals_table = chr(0); + + foreach($entries as $entry) { + $originals_table .= $this->export_original($entry) . chr(0); + $length = strlen($this->export_original($entry)); + fwrite($fh, pack('VV', $length, $current_addr)); + $current_addr += $length + 1; // account for the NULL byte after + } + + $exported_headers = $this->export_headers(); + fwrite($fh, pack('VV', strlen($exported_headers), $current_addr)); + $current_addr += strlen($exported_headers) + 1; + $translations_table = $exported_headers . chr(0); + + foreach($entries as $entry) { + $translations_table .= $this->export_translations($entry) . chr(0); + $length = strlen($this->export_translations($entry)); + fwrite($fh, pack('VV', $length, $current_addr)); + $current_addr += $length + 1; + } + + fwrite($fh, $originals_table); + fwrite($fh, $translations_table); + fclose($fh); + } + + function export_original($entry) { + //TODO: warnings for control characters + $exported = $entry->singular; + if ($entry->is_plural) $exported .= chr(0).$entry->plural; + if (!is_null($entry->context)) $exported = $entry->context . chr(4) . $exported; + return $exported; + } + + function export_translations($entry) { + //TODO: warnings for control characters + return implode(chr(0), $entry->translations); + } + + function export_headers() { + $exported = ''; + foreach($this->headers as $header => $value) { + $exported.= "$header: $value\n"; + } + return $exported; + } + + function get_byteorder($magic) { + // The magic is 0x950412de + + // bug in PHP 5.0.2, see https://savannah.nongnu.org/bugs/?func=detailitem&item_id=10565 + $magic_little = (int) - 1794895138; + $magic_little_64 = (int) 2500072158; + // 0xde120495 + $magic_big = ((int) - 569244523) & 0xFFFFFFFF; + if ($magic_little == $magic || $magic_little_64 == $magic) { + return 'little'; + } else if ($magic_big == $magic) { + return 'big'; + } else { + return false; + } + } + + function import_from_reader($reader) { + $endian_string = MO::get_byteorder($reader->readint32()); + if (false === $endian_string) { + return false; + } + $reader->setEndian($endian_string); + + $endian = ('big' == $endian_string)? 'N' : 'V'; + + $header = $reader->read(24); + if ($reader->strlen($header) != 24) + return false; + + // parse header + $header = unpack("{$endian}revision/{$endian}total/{$endian}originals_lenghts_addr/{$endian}translations_lenghts_addr/{$endian}hash_length/{$endian}hash_addr", $header); + if (!is_array($header)) + return false; + + extract( $header ); + + // support revision 0 of MO format specs, only + if ($revision != 0) + return false; + + // seek to data blocks + $reader->seekto($originals_lenghts_addr); + + // read originals' indices + $originals_lengths_length = $translations_lenghts_addr - $originals_lenghts_addr; + if ( $originals_lengths_length != $total * 8 ) + return false; + + $originals = $reader->read($originals_lengths_length); + if ( $reader->strlen( $originals ) != $originals_lengths_length ) + return false; + + // read translations' indices + $translations_lenghts_length = $hash_addr - $translations_lenghts_addr; + if ( $translations_lenghts_length != $total * 8 ) + return false; + + $translations = $reader->read($translations_lenghts_length); + if ( $reader->strlen( $translations ) != $translations_lenghts_length ) + return false; + + // transform raw data into set of indices + $originals = $reader->str_split( $originals, 8 ); + $translations = $reader->str_split( $translations, 8 ); + + // skip hash table + $strings_addr = $hash_addr + $hash_length * 4; + + $reader->seekto($strings_addr); + + $strings = $reader->read_all(); + $reader->close(); + + for ( $i = 0; $i < $total; $i++ ) { + $o = unpack( "{$endian}length/{$endian}pos", $originals[$i] ); + $t = unpack( "{$endian}length/{$endian}pos", $translations[$i] ); + if ( !$o || !$t ) return false; + + // adjust offset due to reading strings to separate space before + $o['pos'] -= $strings_addr; + $t['pos'] -= $strings_addr; + + $original = $reader->substr( $strings, $o['pos'], $o['length'] ); + $translation = $reader->substr( $strings, $t['pos'], $t['length'] ); + + if ('' === $original) { + $this->set_headers($this->make_headers($translation)); + } else { + $entry = &$this->make_entry($original, $translation); + $this->entries[$entry->key()] = &$entry; + } + } + return true; + } + + /** + * Build a Translation_Entry from original string and translation strings, + * found in a MO file + * + * @static + * @param string $original original string to translate from MO file. Might contain + * 0x04 as context separator or 0x00 as singular/plural separator + * @param string $translation translation string from MO file. Might contain + * 0x00 as a plural translations separator + */ + function &make_entry($original, $translation) { + $entry = new Translation_Entry(); + // look for context + $parts = explode(chr(4), $original); + if (isset($parts[1])) { + $original = $parts[1]; + $entry->context = $parts[0]; + } + // look for plural original + $parts = explode(chr(0), $original); + $entry->singular = $parts[0]; + if (isset($parts[1])) { + $entry->is_plural = true; + $entry->plural = $parts[1]; + } + // plural translations are also separated by \0 + $entry->translations = explode(chr(0), $translation); + return $entry; + } + + function select_plural_form($count) { + return $this->gettext_select_plural_form($count); + } + + function get_plural_forms_count() { + return $this->_nplurals; + } +} +endif; \ No newline at end of file diff --git a/src/wp-includes/pomo/po.php b/src/wp-includes/pomo/po.php new file mode 100644 index 0000000..8e3eb61 --- /dev/null +++ b/src/wp-includes/pomo/po.php @@ -0,0 +1,363 @@ +headers as $header => $value) { + $header_string.= "$header: $value\n"; + } + $poified = PO::poify($header_string); + return rtrim("msgid \"\"\nmsgstr $poified"); + } + + /** + * Exports all entries to PO format + * + * @return string sequence of mgsgid/msgstr PO strings, doesn't containt newline at the end + */ + function export_entries() { + //TODO sorting + return implode("\n\n", array_map(array('PO', 'export_entry'), $this->entries)); + } + + /** + * Exports the whole PO file as a string + * + * @param bool $include_headers whether to include the headers in the export + * @return string ready for inclusion in PO file string for headers and all the enrtries + */ + function export($include_headers = true) { + $res = ''; + if ($include_headers) { + $res .= $this->export_headers(); + $res .= "\n\n"; + } + $res .= $this->export_entries(); + return $res; + } + + /** + * Same as {@link export}, but writes the result to a file + * + * @param string $filename where to write the PO string + * @param bool $include_headers whether to include tje headers in the export + * @return bool true on success, false on error + */ + function export_to_file($filename, $include_headers = true) { + $fh = fopen($filename, 'w'); + if (false === $fh) return false; + $export = $this->export($include_headers); + $res = fwrite($fh, $export); + if (false === $res) return false; + return fclose($fh); + } + + /** + * Formats a string in PO-style + * + * @static + * @param string $string the string to format + * @return string the poified string + */ + function poify($string) { + $quote = '"'; + $slash = '\\'; + $newline = "\n"; + + $replaces = array( + "$slash" => "$slash$slash", + "$quote" => "$slash$quote", + "\t" => '\t', + ); + + $string = str_replace(array_keys($replaces), array_values($replaces), $string); + + $po = $quote.implode("${slash}n$quote$newline$quote", explode($newline, $string)).$quote; + // add empty string on first line for readbility + if (false !== strpos($string, $newline) && + (substr_count($string, $newline) > 1 || !($newline === substr($string, -strlen($newline))))) { + $po = "$quote$quote$newline$po"; + } + // remove empty strings + $po = str_replace("$newline$quote$quote", '', $po); + return $po; + } + + /** + * Gives back the original string from a PO-formatted string + * + * @static + * @param string $string PO-formatted string + * @return string enascaped string + */ + function unpoify($string) { + $escapes = array('t' => "\t", 'n' => "\n", '\\' => '\\'); + $lines = array_map('trim', explode("\n", $string)); + $lines = array_map(array('PO', 'trim_quotes'), $lines); + $unpoified = ''; + $previous_is_backslash = false; + foreach($lines as $line) { + preg_match_all('/./u', $line, $chars); + $chars = $chars[0]; + foreach($chars as $char) { + if (!$previous_is_backslash) { + if ('\\' == $char) + $previous_is_backslash = true; + else + $unpoified .= $char; + } else { + $previous_is_backslash = false; + $unpoified .= isset($escapes[$char])? $escapes[$char] : $char; + } + } + } + return $unpoified; + } + + /** + * Inserts $with in the beginning of every new line of $string and + * returns the modified string + * + * @static + * @param string $string prepend lines in this string + * @param string $with prepend lines with this string + */ + function prepend_each_line($string, $with) { + $php_with = var_export($with, true); + $lines = explode("\n", $string); + // do not prepend the string on the last empty line, artefact by explode + if ("\n" == substr($string, -1)) unset($lines[count($lines) - 1]); + $res = implode("\n", array_map(create_function('$x', "return $php_with.\$x;"), $lines)); + // give back the empty line, we ignored above + if ("\n" == substr($string, -1)) $res .= "\n"; + return $res; + } + + /** + * Prepare a text as a comment -- wraps the lines and prepends # + * and a special character to each line + * + * @access private + * @param string $text the comment text + * @param string $char character to denote a special PO comment, + * like :, default is a space + */ + function comment_block($text, $char=' ') { + $text = wordwrap($text, PO_MAX_LINE_LEN - 3); + return PO::prepend_each_line($text, "#$char "); + } + + /** + * Builds a string from the entry for inclusion in PO file + * + * @static + * @param object &$entry the entry to convert to po string + * @return string|bool PO-style formatted string for the entry or + * false if the entry is empty + */ + function export_entry(&$entry) { + if (is_null($entry->singular)) return false; + $po = array(); + if (!empty($entry->translator_comments)) $po[] = PO::comment_block($entry->translator_comments); + if (!empty($entry->extracted_comments)) $po[] = PO::comment_block($entry->extracted_comments, '.'); + if (!empty($entry->references)) $po[] = PO::comment_block(implode(' ', $entry->references), ':'); + if (!empty($entry->flags)) $po[] = PO::comment_block(implode(", ", $entry->flags), ','); + if (!is_null($entry->context)) $po[] = 'msgctxt '.PO::poify($entry->context); + $po[] = 'msgid '.PO::poify($entry->singular); + if (!$entry->is_plural) { + $translation = empty($entry->translations)? '' : $entry->translations[0]; + $po[] = 'msgstr '.PO::poify($translation); + } else { + $po[] = 'msgid_plural '.PO::poify($entry->plural); + $translations = empty($entry->translations)? array('', '') : $entry->translations; + foreach($translations as $i => $translation) { + $po[] = "msgstr[$i] ".PO::poify($translation); + } + } + return implode("\n", $po); + } + + function import_from_file($filename) { + $f = fopen($filename, 'r'); + if (!$f) return false; + $lineno = 0; + while (true) { + $res = $this->read_entry($f, $lineno); + if (!$res) break; + if ($res['entry']->singular == '') { + $this->set_headers($this->make_headers($res['entry']->translations[0])); + } else { + $this->add_entry($res['entry']); + } + } + PO::read_line($f, 'clear'); + return $res !== false; + } + + function read_entry($f, $lineno = 0) { + $entry = new Translation_Entry(); + // where were we in the last step + // can be: comment, msgctxt, msgid, msgid_plural, msgstr, msgstr_plural + $context = ''; + $msgstr_index = 0; + $is_final = create_function('$context', 'return $context == "msgstr" || $context == "msgstr_plural";'); + while (true) { + $lineno++; + $line = PO::read_line($f); + if (!$line) { + if (feof($f)) { + if ($is_final($context)) + break; + elseif (!$context) // we haven't read a line and eof came + return null; + else + return false; + } else { + return false; + } + } + if ($line == "\n") continue; + $line = trim($line); + if (preg_match('/^#/', $line, $m)) { + // the comment is the start of a new entry + if ($is_final($context)) { + PO::read_line($f, 'put-back'); + $lineno--; + break; + } + // comments have to be at the beginning + if ($context && $context != 'comment') { + return false; + } + // add comment + $this->add_comment_to_entry($entry, $line); + } elseif (preg_match('/^msgctxt\s+(".*")/', $line, $m)) { + if ($is_final($context)) { + PO::read_line($f, 'put-back'); + $lineno--; + break; + } + if ($context && $context != 'comment') { + return false; + } + $context = 'msgctxt'; + $entry->context .= PO::unpoify($m[1]); + } elseif (preg_match('/^msgid\s+(".*")/', $line, $m)) { + if ($is_final($context)) { + PO::read_line($f, 'put-back'); + $lineno--; + break; + } + if ($context && $context != 'msgctxt' && $context != 'comment') { + return false; + } + $context = 'msgid'; + $entry->singular .= PO::unpoify($m[1]); + } elseif (preg_match('/^msgid_plural\s+(".*")/', $line, $m)) { + if ($context != 'msgid') { + return false; + } + $context = 'msgid_plural'; + $entry->is_plural = true; + $entry->plural .= PO::unpoify($m[1]); + } elseif (preg_match('/^msgstr\s+(".*")/', $line, $m)) { + if ($context != 'msgid') { + return false; + } + $context = 'msgstr'; + $entry->translations = array(PO::unpoify($m[1])); + } elseif (preg_match('/^msgstr\[(\d+)\]\s+(".*")/', $line, $m)) { + if ($context != 'msgid_plural' && $context != 'msgstr_plural') { + return false; + } + $context = 'msgstr_plural'; + $msgstr_index = $m[1]; + $entry->translations[$m[1]] = PO::unpoify($m[2]); + } elseif (preg_match('/^".*"$/', $line)) { + $unpoified = PO::unpoify($line); + switch ($context) { + case 'msgid': + $entry->singular .= $unpoified; break; + case 'msgctxt': + $entry->context .= $unpoified; break; + case 'msgid_plural': + $entry->plural .= $unpoified; break; + case 'msgstr': + $entry->translations[0] .= $unpoified; break; + case 'msgstr_plural': + $entry->translations[$msgstr_index] .= $unpoified; break; + default: + return false; + } + } else { + return false; + } + } + if (array() == array_filter($entry->translations, create_function('$t', 'return $t || "0" === $t;'))) { + $entry->translations = array(); + } + return array('entry' => $entry, 'lineno' => $lineno); + } + + function read_line($f, $action = 'read') { + static $last_line = ''; + static $use_last_line = false; + if ('clear' == $action) { + $last_line = ''; + return true; + } + if ('put-back' == $action) { + $use_last_line = true; + return true; + } + $line = $use_last_line? $last_line : fgets($f); + $last_line = $line; + $use_last_line = false; + return $line; + } + + function add_comment_to_entry(&$entry, $po_comment_line) { + $first_two = substr($po_comment_line, 0, 2); + $comment = trim(substr($po_comment_line, 2)); + if ('#:' == $first_two) { + $entry->references = array_merge($entry->references, preg_split('/\s+/', $comment)); + } elseif ('#.' == $first_two) { + $entry->extracted_comments = trim($entry->extracted_comments . "\n" . $comment); + } elseif ('#,' == $first_two) { + $entry->flags = array_merge($entry->flags, preg_split('/,\s*/', $comment)); + } else { + $entry->translator_comments = trim($entry->translator_comments . "\n" . $comment); + } + } + + function trim_quotes($s) { + if ( substr($s, 0, 1) == '"') $s = substr($s, 1); + if ( substr($s, -1, 1) == '"') $s = substr($s, 0, -1); + return $s; + } +} +endif; diff --git a/src/wp-includes/pomo/streams.php b/src/wp-includes/pomo/streams.php new file mode 100644 index 0000000..289cc78 --- /dev/null +++ b/src/wp-includes/pomo/streams.php @@ -0,0 +1,209 @@ + + * + * @version $Id: streams.php 406 2010-02-07 11:10:24Z nbachiyski $ + * @package pomo + * @subpackage streams + */ + +if ( !class_exists( 'POMO_Reader' ) ): +class POMO_Reader { + + var $endian = 'little'; + var $_post = ''; + + function POMO_Reader() { + $this->is_overloaded = ((ini_get("mbstring.func_overload") & 2) != 0) && function_exists('mb_substr'); + $this->_pos = 0; + } + + /** + * Sets the endianness of the file. + * + * @param string $endian 'big' or 'little' + */ + function setEndian($endian) { + $this->endian = $endian; + } + + /** + * Reads a 32bit Integer from the Stream + * + * @return mixed The integer, corresponding to the next 32 bits from + * the stream of false if there are not enough bytes or on error + */ + function readint32() { + $bytes = $this->read(4); + if (4 != $this->strlen($bytes)) + return false; + $endian_letter = ('big' == $this->endian)? 'N' : 'V'; + $int = unpack($endian_letter, $bytes); + return array_shift($int); + } + + /** + * Reads an array of 32-bit Integers from the Stream + * + * @param integer count How many elements should be read + * @return mixed Array of integers or false if there isn't + * enough data or on error + */ + function readint32array($count) { + $bytes = $this->read(4 * $count); + if (4*$count != $this->strlen($bytes)) + return false; + $endian_letter = ('big' == $this->endian)? 'N' : 'V'; + return unpack($endian_letter.$count, $bytes); + } + + + 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 str_split($string, $chunk_size) { + if (!function_exists('str_split')) { + $length = $this->strlen($string); + $out = array(); + for ($i = 0; $i < $length; $i += $chunk_size) + $out[] = $this->substr($string, $i, $chunk_size); + return $out; + } else { + return str_split( $string, $chunk_size ); + } + } + + + function pos() { + return $this->_pos; + } + + function is_resource() { + return true; + } + + function close() { + return true; + } +} +endif; + +if ( !class_exists( 'POMO_FileReader' ) ): +class POMO_FileReader extends POMO_Reader { + function POMO_FileReader($filename) { + parent::POMO_Reader(); + $this->_f = fopen($filename, 'r'); + } + + function read($bytes) { + return fread($this->_f, $bytes); + } + + function seekto($pos) { + if ( -1 == fseek($this->_f, $pos, SEEK_SET)) { + return false; + } + $this->_pos = $pos; + return true; + } + + function is_resource() { + return is_resource($this->_f); + } + + function feof() { + return feof($this->_f); + } + + function close() { + return fclose($this->_f); + } + + function read_all() { + $all = ''; + while ( !$this->feof() ) + $all .= $this->read(4096); + return $all; + } +} +endif; + +if ( !class_exists( 'POMO_StringReader' ) ): +/** + * Provides file-like methods for manipulating a string instead + * of a physical file. + */ +class POMO_StringReader extends POMO_Reader { + + var $_str = ''; + + function POMO_StringReader($str = '') { + parent::POMO_Reader(); + $this->_str = $str; + $this->_pos = 0; + } + + + 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 length() { + return $this->strlen($this->_str); + } + + function read_all() { + return $this->substr($this->_str, $this->_pos, $this->strlen($this->_str)); + } + +} +endif; + +if ( !class_exists( 'POMO_CachedFileReader' ) ): +/** + * Reads the contents of the file in the beginning. + */ +class POMO_CachedFileReader extends POMO_StringReader { + function POMO_CachedFileReader($filename) { + parent::POMO_StringReader(); + $this->_str = file_get_contents($filename); + if (false === $this->_str) + return false; + $this->_pos = 0; + } +} +endif; + +if ( !class_exists( 'POMO_CachedIntFileReader' ) ): +/** + * Reads the contents of the file in the beginning. + */ +class POMO_CachedIntFileReader extends POMO_CachedFileReader { + function POMO_CachedIntFileReader($filename) { + parent::POMO_CachedFileReader($filename); + } +} +endif; \ No newline at end of file diff --git a/src/wp-includes/pomo/translations.php b/src/wp-includes/pomo/translations.php new file mode 100644 index 0000000..01be8df --- /dev/null +++ b/src/wp-includes/pomo/translations.php @@ -0,0 +1,253 @@ +key(); + if (false === $key) return false; + $this->entries[$key] = &$entry; + return true; + } + + /** + * Sets $header PO header to $value + * + * If the header already exists, it will be overwritten + * + * TODO: this should be out of this class, it is gettext specific + * + * @param string $header header name, without trailing : + * @param string $value header value, without trailing \n + */ + function set_header($header, $value) { + $this->headers[$header] = $value; + } + + function set_headers(&$headers) { + foreach($headers as $header => $value) { + $this->set_header($header, $value); + } + } + + function get_header($header) { + return isset($this->headers[$header])? $this->headers[$header] : false; + } + + function translate_entry(&$entry) { + $key = $entry->key(); + return isset($this->entries[$key])? $this->entries[$key] : false; + } + + function translate($singular, $context=null) { + $entry = new Translation_Entry(array('singular' => $singular, 'context' => $context)); + $translated = $this->translate_entry($entry); + return ($translated && !empty($translated->translations))? $translated->translations[0] : $singular; + } + + /** + * Given the number of items, returns the 0-based index of the plural form to use + * + * Here, in the base Translations class, the commong logic for English is implmented: + * 0 if there is one element, 1 otherwise + * + * This function should be overrided by the sub-classes. For example MO/PO can derive the logic + * from their headers. + * + * @param integer $count number of items + */ + function select_plural_form($count) { + return 1 == $count? 0 : 1; + } + + function get_plural_forms_count() { + return 2; + } + + function translate_plural($singular, $plural, $count, $context = null) { + $entry = new Translation_Entry(array('singular' => $singular, 'plural' => $plural, 'context' => $context)); + $translated = $this->translate_entry($entry); + $index = $this->select_plural_form($count); + $total_plural_forms = $this->get_plural_forms_count(); + if ($translated && 0 <= $index && $index < $total_plural_forms && + is_array($translated->translations) && + isset($translated->translations[$index])) + return $translated->translations[$index]; + else + return 1 == $count? $singular : $plural; + } + + /** + * Merge $other in the current object. + * + * @param Object &$other Another Translation object, whose translations will be merged in this one + * @return void + **/ + function merge_with(&$other) { + foreach( $other->entries as $entry ) { + $this->entries[$entry->key()] = $entry; + } + } +} + +class Gettext_Translations extends Translations { + /** + * The gettext implmentation of select_plural_form. + * + * It lives in this class, because there are more than one descendand, which will use it and + * they can't share it effectively. + * + */ + function gettext_select_plural_form($count) { + if (!isset($this->_gettext_select_plural_form) || is_null($this->_gettext_select_plural_form)) { + list( $nplurals, $expression ) = $this->nplurals_and_expression_from_header($this->get_header('Plural-Forms')); + $this->_nplurals = $nplurals; + $this->_gettext_select_plural_form = $this->make_plural_form_function($nplurals, $expression); + } + return call_user_func($this->_gettext_select_plural_form, $count); + } + + function nplurals_and_expression_from_header($header) { + if (preg_match('/^\s*nplurals\s*=\s*(\d+)\s*;\s+plural\s*=\s*(.+)$/', $header, $matches)) { + $nplurals = (int)$matches[1]; + $expression = trim($this->parenthesize_plural_exression($matches[2])); + return array($nplurals, $expression); + } else { + return array(2, 'n != 1'); + } + } + + /** + * Makes a function, which will return the right translation index, according to the + * plural forms header + */ + function make_plural_form_function($nplurals, $expression) { + $expression = str_replace('n', '$n', $expression); + $func_body = " + \$index = (int)($expression); + return (\$index < $nplurals)? \$index : $nplurals - 1;"; + return create_function('$n', $func_body); + } + + /** + * Adds parantheses to the inner parts of ternary operators in + * plural expressions, because PHP evaluates ternary oerators from left to right + * + * @param string $expression the expression without parentheses + * @return string the expression with parentheses added + */ + function parenthesize_plural_exression($expression) { + $expression .= ';'; + $res = ''; + $depth = 0; + for ($i = 0; $i < strlen($expression); ++$i) { + $char = $expression[$i]; + switch ($char) { + case '?': + $res .= ' ? ('; + $depth++; + break; + case ':': + $res .= ') : ('; + break; + case ';': + $res .= str_repeat(')', $depth) . ';'; + $depth= 0; + break; + default: + $res .= $char; + } + } + return rtrim($res, ';'); + } + + function make_headers($translation) { + $headers = array(); + // sometimes \ns are used instead of real new lines + $translation = str_replace('\n', "\n", $translation); + $lines = explode("\n", $translation); + foreach($lines as $line) { + $parts = explode(':', $line, 2); + if (!isset($parts[1])) continue; + $headers[trim($parts[0])] = trim($parts[1]); + } + return $headers; + } + + function set_header($header, $value) { + parent::set_header($header, $value); + if ('Plural-Forms' == $header) { + list( $nplurals, $expression ) = $this->nplurals_and_expression_from_header($this->get_header('Plural-Forms')); + $this->_nplurals = $nplurals; + $this->_gettext_select_plural_form = $this->make_plural_form_function($nplurals, $expression); + } + } +} +endif; + +if ( !class_exists( 'NOOP_Translations' ) ): +/** + * Provides the same interface as Translations, but doesn't do anything + */ +class NOOP_Translations { + var $entries = array(); + var $headers = array(); + + function add_entry($entry) { + return true; + } + + function set_header($header, $value) { + } + + function set_headers(&$headers) { + } + + function get_header($header) { + return false; + } + + function translate_entry(&$entry) { + return false; + } + + function translate($singular, $context=null) { + return $singular; + } + + function select_plural_form($count) { + return 1 == $count? 0 : 1; + } + + function get_plural_forms_count() { + return 2; + } + + function translate_plural($singular, $plural, $count, $context = null) { + return 1 == $count? $singular : $plural; + } + + function merge_with(&$other) { + } +} +endif; diff --git a/src/wp-includes/post-template.php b/src/wp-includes/post-template.php new file mode 100644 index 0000000..d6a0978 --- /dev/null +++ b/src/wp-includes/post-template.php @@ -0,0 +1,1440 @@ +ID; +} + +/** + * Display or retrieve the current post title with optional content. + * + * @since 0.71 + * + * @param string $before Optional. Content to prepend to the title. + * @param string $after Optional. Content to append to the title. + * @param bool $echo Optional, default to true.Whether to display or return. + * @return null|string Null on no title. String if $echo parameter is false. + */ +function the_title($before = '', $after = '', $echo = true) { + $title = get_the_title(); + + if ( strlen($title) == 0 ) + return; + + $title = $before . $title . $after; + + if ( $echo ) + echo $title; + else + return $title; +} + +/** + * Sanitize the current title when retrieving or displaying. + * + * Works like {@link the_title()}, except the parameters can be in a string or + * an array. See the function for what can be override in the $args parameter. + * + * The title before it is displayed will have the tags stripped and {@link + * esc_attr()} before it is passed to the user or displayed. The default + * as with {@link the_title()}, is to display the title. + * + * @since 2.3.0 + * + * @param string|array $args Optional. Override the defaults. + * @return string|null Null on failure or display. String when echo is false. + */ +function the_title_attribute( $args = '' ) { + $title = get_the_title(); + + if ( strlen($title) == 0 ) + return; + + $defaults = array('before' => '', 'after' => '', 'echo' => true); + $r = wp_parse_args($args, $defaults); + extract( $r, EXTR_SKIP ); + + + $title = $before . $title . $after; + $title = esc_attr(strip_tags($title)); + + if ( $echo ) + echo $title; + else + return $title; +} + +/** + * Retrieve post title. + * + * If the post is protected and the visitor is not an admin, then "Protected" + * will be displayed before the post title. If the post is private, then + * "Private" will be located before the post title. + * + * @since 0.71 + * + * @param int $id Optional. Post ID. + * @return string + */ +function get_the_title( $id = 0 ) { + $post = &get_post($id); + + $title = isset($post->post_title) ? $post->post_title : ''; + $id = isset($post->ID) ? $post->ID : (int) $id; + + if ( !is_admin() ) { + if ( !empty($post->post_password) ) { + $protected_title_format = apply_filters('protected_title_format', __('Protected: %s')); + $title = sprintf($protected_title_format, $title); + } else if ( isset($post->post_status) && 'private' == $post->post_status ) { + $private_title_format = apply_filters('private_title_format', __('Private: %s')); + $title = sprintf($private_title_format, $title); + } + } + return apply_filters( 'the_title', $title, $id ); +} + +/** + * Display the Post Global Unique Identifier (guid). + * + * The guid will appear to be a link, but should not be used as an link to the + * post. The reason you should not use it as a link, is because of moving the + * blog across domains. + * + * Url is escaped to make it xml safe + * + * @since 1.5.0 + * + * @param int $id Optional. Post ID. + */ +function the_guid( $id = 0 ) { + echo esc_url( get_the_guid( $id ) ); +} + +/** + * Retrieve the Post Global Unique Identifier (guid). + * + * The guid will appear to be a link, but should not be used as an link to the + * post. The reason you should not use it as a link, is because of moving the + * blog across domains. + * + * @since 1.5.0 + * + * @param int $id Optional. Post ID. + * @return string + */ +function get_the_guid( $id = 0 ) { + $post = &get_post($id); + + return apply_filters('get_the_guid', $post->guid); +} + +/** + * Display the post content. + * + * @since 0.71 + * + * @param string $more_link_text Optional. Content for when there is more text. + * @param string $stripteaser Optional. Teaser content before the more text. + */ +function the_content($more_link_text = null, $stripteaser = 0) { + $content = get_the_content($more_link_text, $stripteaser); + $content = apply_filters('the_content', $content); + $content = str_replace(']]>', ']]>', $content); + echo $content; +} + +/** + * Retrieve the post content. + * + * @since 0.71 + * + * @param string $more_link_text Optional. Content for when there is more text. + * @param string $stripteaser Optional. Teaser content before the more text. + * @return string + */ +function get_the_content($more_link_text = null, $stripteaser = 0) { + global $post, $more, $page, $pages, $multipage, $preview; + + if ( null === $more_link_text ) + $more_link_text = __( '(more...)' ); + + $output = ''; + $hasTeaser = false; + + // If post password required and it doesn't match the cookie. + if ( post_password_required($post) ) { + $output = get_the_password_form(); + return $output; + } + + if ( $page > count($pages) ) // if the requested page doesn't exist + $page = count($pages); // give them the highest numbered page that DOES exist + + $content = $pages[$page-1]; + if ( preg_match('//', $content, $matches) ) { + $content = explode($matches[0], $content, 2); + if ( !empty($matches[1]) && !empty($more_link_text) ) + $more_link_text = strip_tags(wp_kses_no_null(trim($matches[1]))); + + $hasTeaser = true; + } else { + $content = array($content); + } + if ( (false !== strpos($post->post_content, '') && ((!$multipage) || ($page==1))) ) + $stripteaser = 1; + $teaser = $content[0]; + if ( ($more) && ($stripteaser) && ($hasTeaser) ) + $teaser = ''; + $output .= $teaser; + if ( count($content) > 1 ) { + if ( $more ) { + $output .= '' . $content[1]; + } else { + if ( ! empty($more_link_text) ) + $output .= apply_filters( 'the_content_more_link', ' ID}\" class=\"more-link\">$more_link_text", $more_link_text ); + $output = force_balance_tags($output); + } + + } + if ( $preview ) // preview fix for javascript bug with foreign languages + $output = preg_replace_callback('/\%u([0-9A-F]{4})/', '_convert_urlencoded_to_entities', $output); + + return $output; +} + +/** + * Preview fix for javascript bug with foreign languages + * + * @since 3.1.0 + * @access private + * @param array $match Match array from preg_replace_callback + * @returns string + */ +function _convert_urlencoded_to_entities( $match ) { + return '&#' . base_convert( $match[1], 16, 10 ) . ';'; +} + +/** + * Display the post excerpt. + * + * @since 0.71 + * @uses apply_filters() Calls 'the_excerpt' hook on post excerpt. + */ +function the_excerpt() { + echo apply_filters('the_excerpt', get_the_excerpt()); +} + +/** + * Retrieve the post excerpt. + * + * @since 0.71 + * + * @param mixed $deprecated Not used. + * @return string + */ +function get_the_excerpt( $deprecated = '' ) { + if ( !empty( $deprecated ) ) + _deprecated_argument( __FUNCTION__, '2.3' ); + + global $post; + $output = $post->post_excerpt; + if ( post_password_required($post) ) { + $output = __('There is no excerpt because this is a protected post.'); + return $output; + } + + return apply_filters('get_the_excerpt', $output); +} + +/** + * Whether post has excerpt. + * + * @since 2.3.0 + * + * @param int $id Optional. Post ID. + * @return bool + */ +function has_excerpt( $id = 0 ) { + $post = &get_post( $id ); + return ( !empty( $post->post_excerpt ) ); +} + +/** + * Display the classes for the post div. + * + * @since 2.7.0 + * + * @param string|array $class One or more classes to add to the class list. + * @param int $post_id An optional post ID. + */ +function post_class( $class = '', $post_id = null ) { + // Separates classes with a single space, collates classes for post DIV + echo 'class="' . join( ' ', get_post_class( $class, $post_id ) ) . '"'; +} + +/** + * Retrieve the classes for the post div as an array. + * + * The class names are add are many. If the post is a sticky, then the 'sticky' + * class name. The class 'hentry' is always added to each post. For each + * category, the class will be added with 'category-' with category slug is + * added. The tags are the same way as the categories with 'tag-' before the tag + * slug. All classes are passed through the filter, 'post_class' with the list + * of classes, followed by $class parameter value, with the post ID as the last + * parameter. + * + * @since 2.7.0 + * + * @param string|array $class One or more classes to add to the class list. + * @param int $post_id An optional post ID. + * @return array Array of classes. + */ +function get_post_class( $class = '', $post_id = null ) { + $post = get_post($post_id); + + $classes = array(); + + if ( empty($post) ) + return $classes; + + $classes[] = 'post-' . $post->ID; + $classes[] = $post->post_type; + $classes[] = 'type-' . $post->post_type; + $classes[] = 'status-' . $post->post_status; + + // Post Format + $post_format = get_post_format( $post->ID ); + + if ( post_type_supports( $post->post_type, 'post-formats' ) ) { + if ( $post_format && !is_wp_error($post_format) ) + $classes[] = 'format-' . sanitize_html_class( $post_format ); + else + $classes[] = 'format-standard'; + } + + // post requires password + if ( post_password_required($post->ID) ) + $classes[] = 'post-password-required'; + + // sticky for Sticky Posts + if ( is_sticky($post->ID) && is_home() && !is_paged() ) + $classes[] = 'sticky'; + + // hentry for hAtom compliance + $classes[] = 'hentry'; + + // Categories + if ( is_object_in_taxonomy( $post->post_type, 'category' ) ) { + foreach ( (array) get_the_category($post->ID) as $cat ) { + if ( empty($cat->slug ) ) + continue; + $classes[] = 'category-' . sanitize_html_class($cat->slug, $cat->term_id); + } + } + + // Tags + if ( is_object_in_taxonomy( $post->post_type, 'post_tag' ) ) { + foreach ( (array) get_the_tags($post->ID) as $tag ) { + if ( empty($tag->slug ) ) + continue; + $classes[] = 'tag-' . sanitize_html_class($tag->slug, $tag->term_id); + } + } + + if ( !empty($class) ) { + if ( !is_array( $class ) ) + $class = preg_split('#\s+#', $class); + $classes = array_merge($classes, $class); + } + + $classes = array_map('esc_attr', $classes); + + return apply_filters('post_class', $classes, $class, $post->ID); +} + +/** + * Display the classes for the body element. + * + * @since 2.8.0 + * + * @param string|array $class One or more classes to add to the class list. + */ +function body_class( $class = '' ) { + // Separates classes with a single space, collates classes for body element + echo 'class="' . join( ' ', get_body_class( $class ) ) . '"'; +} + +/** + * Retrieve the classes for the body element as an array. + * + * @since 2.8.0 + * + * @param string|array $class One or more classes to add to the class list. + * @return array Array of classes. + */ +function get_body_class( $class = '' ) { + global $wp_query, $wpdb; + + $classes = array(); + + if ( is_rtl() ) + $classes[] = 'rtl'; + + if ( is_front_page() ) + $classes[] = 'home'; + if ( is_home() ) + $classes[] = 'blog'; + if ( is_archive() ) + $classes[] = 'archive'; + if ( is_date() ) + $classes[] = 'date'; + if ( is_search() ) + $classes[] = 'search'; + if ( is_paged() ) + $classes[] = 'paged'; + if ( is_attachment() ) + $classes[] = 'attachment'; + if ( is_404() ) + $classes[] = 'error404'; + + if ( is_single() ) { + $post_id = $wp_query->get_queried_object_id(); + $post = $wp_query->get_queried_object(); + + $classes[] = 'single'; + $classes[] = 'single-' . sanitize_html_class($post->post_type, $post_id); + $classes[] = 'postid-' . $post_id; + + // Post Format + $post_format = get_post_format( $post->ID ); + + if ( $post_format && !is_wp_error($post_format) ) + $classes[] = 'single-format-' . sanitize_html_class( $post_format ); + else + $classes[] = 'single-format-standard'; + + if ( is_attachment() ) { + $mime_type = get_post_mime_type($post_id); + $mime_prefix = array( 'application/', 'image/', 'text/', 'audio/', 'video/', 'music/' ); + $classes[] = 'attachmentid-' . $post_id; + $classes[] = 'attachment-' . str_replace( $mime_prefix, '', $mime_type ); + } + } elseif ( is_archive() ) { + if ( is_post_type_archive() ) { + $classes[] = 'post-type-archive'; + $classes[] = 'post-type-archive-' . sanitize_html_class( get_query_var( 'post_type' ) ); + } else if ( is_author() ) { + $author = $wp_query->get_queried_object(); + $classes[] = 'author'; + $classes[] = 'author-' . sanitize_html_class( $author->user_nicename , $author->ID ); + $classes[] = 'author-' . $author->ID; + } elseif ( is_category() ) { + $cat = $wp_query->get_queried_object(); + $classes[] = 'category'; + $classes[] = 'category-' . sanitize_html_class( $cat->slug, $cat->term_id ); + $classes[] = 'category-' . $cat->term_id; + } elseif ( is_tag() ) { + $tags = $wp_query->get_queried_object(); + $classes[] = 'tag'; + $classes[] = 'tag-' . sanitize_html_class( $tags->slug, $tags->term_id ); + $classes[] = 'tag-' . $tags->term_id; + } elseif ( is_tax() ) { + $term = $wp_query->get_queried_object(); + $classes[] = 'tax-' . sanitize_html_class( $term->taxonomy ); + $classes[] = 'term-' . sanitize_html_class( $term->slug, $term->term_id ); + $classes[] = 'term-' . $term->term_id; + } + } elseif ( is_page() ) { + $classes[] = 'page'; + + $page_id = $wp_query->get_queried_object_id(); + + $post = get_page($page_id); + + $classes[] = 'page-id-' . $page_id; + + if ( $wpdb->get_var( $wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_parent = %d AND post_type = 'page' AND post_status = 'publish' LIMIT 1", $page_id) ) ) + $classes[] = 'page-parent'; + + if ( $post->post_parent ) { + $classes[] = 'page-child'; + $classes[] = 'parent-pageid-' . $post->post_parent; + } + if ( is_page_template() ) { + $classes[] = 'page-template'; + $classes[] = 'page-template-' . sanitize_html_class( str_replace( '.', '-', get_post_meta( $page_id, '_wp_page_template', true ) ), '' ); + } else { + $classes[] = 'page-template-default'; + } + } elseif ( is_search() ) { + if ( !empty( $wp_query->posts ) ) + $classes[] = 'search-results'; + else + $classes[] = 'search-no-results'; + } + + if ( is_user_logged_in() ) + $classes[] = 'logged-in'; + + if ( is_admin_bar_showing() ) + $classes[] = 'admin-bar'; + + $page = $wp_query->get( 'page' ); + + if ( !$page || $page < 2) + $page = $wp_query->get( 'paged' ); + + if ( $page && $page > 1 ) { + $classes[] = 'paged-' . $page; + + if ( is_single() ) + $classes[] = 'single-paged-' . $page; + elseif ( is_page() ) + $classes[] = 'page-paged-' . $page; + elseif ( is_category() ) + $classes[] = 'category-paged-' . $page; + elseif ( is_tag() ) + $classes[] = 'tag-paged-' . $page; + elseif ( is_date() ) + $classes[] = 'date-paged-' . $page; + elseif ( is_author() ) + $classes[] = 'author-paged-' . $page; + elseif ( is_search() ) + $classes[] = 'search-paged-' . $page; + elseif ( is_post_type_archive() ) + $classes[] = 'post-type-paged-' . $page; + } + + if ( ! empty( $class ) ) { + if ( !is_array( $class ) ) + $class = preg_split( '#\s+#', $class ); + $classes = array_merge( $classes, $class ); + } else { + // Ensure that we always coerce class to being an array. + $class = array(); + } + + $classes = array_map( 'esc_attr', $classes ); + + return apply_filters( 'body_class', $classes, $class ); +} + +/** + * Whether post requires password and correct password has been provided. + * + * @since 2.7.0 + * + * @param int|object $post An optional post. Global $post used if not provided. + * @return bool false if a password is not required or the correct password cookie is present, true otherwise. + */ +function post_password_required( $post = null ) { + $post = get_post($post); + + if ( empty($post->post_password) ) + return false; + + if ( !isset($_COOKIE['wp-postpass_' . COOKIEHASH]) ) + return true; + + if ( $_COOKIE['wp-postpass_' . COOKIEHASH] != $post->post_password ) + return true; + + return false; +} + +/** + * Display "sticky" CSS class, if a post is sticky. + * + * @since 2.7.0 + * + * @param int $post_id An optional post ID. + */ +function sticky_class( $post_id = null ) { + if ( !is_sticky($post_id) ) + return; + + echo " sticky"; +} + +/** + * Page Template Functions for usage in Themes + * + * @package WordPress + * @subpackage Template + */ + +/** + * The formatted output of a list of pages. + * + * Displays page links for paginated posts (i.e. includes the . + * Quicktag one or more times). This tag must be within The Loop. + * + * The defaults for overwriting are: + * 'next_or_number' - Default is 'number' (string). Indicates whether page + * numbers should be used. Valid values are number and next. + * 'nextpagelink' - Default is 'Next Page' (string). Text for link to next page. + * of the bookmark. + * 'previouspagelink' - Default is 'Previous Page' (string). Text for link to + * previous page, if available. + * 'pagelink' - Default is '%' (String).Format string for page numbers. The % in + * the parameter string will be replaced with the page number, so Page % + * generates "Page 1", "Page 2", etc. Defaults to %, just the page number. + * 'before' - Default is '

            Pages:' (string). The html or text to prepend to + * each bookmarks. + * 'after' - Default is '

            ' (string). The html or text to append to each + * bookmarks. + * 'link_before' - Default is '' (string). The html or text to prepend to each + * Pages link inside the tag. Also prepended to the current item, which + * is not linked. + * 'link_after' - Default is '' (string). The html or text to append to each + * Pages link inside the tag. Also appended to the current item, which + * is not linked. + * + * @since 1.2.0 + * @access private + * + * @param string|array $args Optional. Overwrite the defaults. + * @return string Formatted output in HTML. + */ +function wp_link_pages($args = '') { + $defaults = array( + 'before' => '

            ' . __('Pages:'), 'after' => '

            ', + 'link_before' => '', 'link_after' => '', + 'next_or_number' => 'number', 'nextpagelink' => __('Next page'), + 'previouspagelink' => __('Previous page'), 'pagelink' => '%', + 'echo' => 1 + ); + + $r = wp_parse_args( $args, $defaults ); + $r = apply_filters( 'wp_link_pages_args', $r ); + extract( $r, EXTR_SKIP ); + + global $page, $numpages, $multipage, $more, $pagenow; + + $output = ''; + if ( $multipage ) { + if ( 'number' == $next_or_number ) { + $output .= $before; + for ( $i = 1; $i < ($numpages+1); $i = $i + 1 ) { + $j = str_replace('%',$i,$pagelink); + $output .= ' '; + if ( ($i != $page) || ((!$more) && ($page==1)) ) { + $output .= _wp_link_page($i); + } + $output .= $link_before . $j . $link_after; + if ( ($i != $page) || ((!$more) && ($page==1)) ) + $output .= '
            '; + } + $output .= $after; + } else { + if ( $more ) { + $output .= $before; + $i = $page - 1; + if ( $i && $more ) { + $output .= _wp_link_page($i); + $output .= $link_before. $previouspagelink . $link_after . ''; + } + $i = $page + 1; + if ( $i <= $numpages && $more ) { + $output .= _wp_link_page($i); + $output .= $link_before. $nextpagelink . $link_after . ''; + } + $output .= $after; + } + } + } + + if ( $echo ) + echo $output; + + return $output; +} + +/** + * Helper function for wp_link_pages(). + * + * @since 3.1.0 + * @access private + * + * @param int $i Page number. + * @return string Link. + */ +function _wp_link_page( $i ) { + global $post, $wp_rewrite; + + if ( 1 == $i ) { + $url = get_permalink(); + } else { + if ( '' == get_option('permalink_structure') || in_array($post->post_status, array('draft', 'pending')) ) + $url = add_query_arg( 'page', $i, get_permalink() ); + elseif ( 'page' == get_option('show_on_front') && get_option('page_on_front') == $post->ID ) + $url = trailingslashit(get_permalink()) . user_trailingslashit("$wp_rewrite->pagination_base/" . $i, 'single_paged'); + else + $url = trailingslashit(get_permalink()) . user_trailingslashit($i, 'single_paged'); + } + + return ''; +} + +// +// Post-meta: Custom per-post fields. +// + +/** + * Retrieve post custom meta data field. + * + * @since 1.5.0 + * + * @param string $key Meta data key name. + * @return bool|string|array Array of values or single value, if only one element exists. False will be returned if key does not exist. + */ +function post_custom( $key = '' ) { + $custom = get_post_custom(); + + if ( !isset( $custom[$key] ) ) + return false; + elseif ( 1 == count($custom[$key]) ) + return $custom[$key][0]; + else + return $custom[$key]; +} + +/** + * Display list of post custom fields. + * + * @internal This will probably change at some point... + * @since 1.2.0 + * @uses apply_filters() Calls 'the_meta_key' on list item HTML content, with key and value as separate parameters. + */ +function the_meta() { + if ( $keys = get_post_custom_keys() ) { + echo "\n"; + } +} + +// +// Pages +// + +/** + * Retrieve or display list of pages as a dropdown (select list). + * + * @since 2.1.0 + * + * @param array|string $args Optional. Override default arguments. + * @return string HTML content, if not displaying. + */ +function wp_dropdown_pages($args = '') { + $defaults = array( + 'depth' => 0, 'child_of' => 0, + 'selected' => 0, 'echo' => 1, + 'name' => 'page_id', 'id' => '', + 'show_option_none' => '', 'show_option_no_change' => '', + 'option_none_value' => '' + ); + + $r = wp_parse_args( $args, $defaults ); + extract( $r, EXTR_SKIP ); + + $pages = get_pages($r); + $output = ''; + $name = esc_attr($name); + // Back-compat with old system where both id and name were based on $name argument + if ( empty($id) ) + $id = $name; + + if ( ! empty($pages) ) { + $output = "\n"; + } + + $output = apply_filters('wp_dropdown_pages', $output); + + if ( $echo ) + echo $output; + + return $output; +} + +/** + * Retrieve or display list of pages in list (li) format. + * + * @since 1.5.0 + * + * @param array|string $args Optional. Override default arguments. + * @return string HTML content, if not displaying. + */ +function wp_list_pages($args = '') { + $defaults = array( + 'depth' => 0, 'show_date' => '', + 'date_format' => get_option('date_format'), + 'child_of' => 0, 'exclude' => '', + 'title_li' => __('Pages'), 'echo' => 1, + 'authors' => '', 'sort_column' => 'menu_order, post_title', + 'link_before' => '', 'link_after' => '', 'walker' => '', + ); + + $r = wp_parse_args( $args, $defaults ); + extract( $r, EXTR_SKIP ); + + $output = ''; + $current_page = 0; + + // sanitize, mostly to keep spaces out + $r['exclude'] = preg_replace('/[^0-9,]/', '', $r['exclude']); + + // Allow plugins to filter an array of excluded pages (but don't put a nullstring into the array) + $exclude_array = ( $r['exclude'] ) ? explode(',', $r['exclude']) : array(); + $r['exclude'] = implode( ',', apply_filters('wp_list_pages_excludes', $exclude_array) ); + + // Query pages. + $r['hierarchical'] = 0; + $pages = get_pages($r); + + if ( !empty($pages) ) { + if ( $r['title_li'] ) + $output .= '
          • '; + } + + $output = apply_filters('wp_list_pages', $output, $r); + + if ( $r['echo'] ) + echo $output; + else + return $output; +} + +/** + * Display or retrieve list of pages with optional home link. + * + * The arguments are listed below and part of the arguments are for {@link + * wp_list_pages()} function. Check that function for more info on those + * arguments. + * + *
              + *
            • sort_column - How to sort the list of pages. Defaults + * to page title. Use column for posts table.
            • + *
            • menu_class - Class to use for the div ID which contains + * the page list. Defaults to 'menu'.
            • + *
            • echo - Whether to echo list or return it. Defaults to + * echo.
            • + *
            • link_before - Text before show_home argument text.
            • + *
            • link_after - Text after show_home argument text.
            • + *
            • show_home - If you set this argument, then it will + * display the link to the home page. The show_home argument really just needs + * to be set to the value of the text of the link.
            • + *
            + * + * @since 2.7.0 + * + * @param array|string $args + */ +function wp_page_menu( $args = array() ) { + $defaults = array('sort_column' => 'menu_order, post_title', 'menu_class' => 'menu', 'echo' => true, 'link_before' => '', 'link_after' => ''); + $args = wp_parse_args( $args, $defaults ); + $args = apply_filters( 'wp_page_menu_args', $args ); + + $menu = ''; + + $list_args = $args; + + // Show Home in the menu + if ( ! empty($args['show_home']) ) { + if ( true === $args['show_home'] || '1' === $args['show_home'] || 1 === $args['show_home'] ) + $text = __('Home'); + else + $text = $args['show_home']; + $class = ''; + if ( is_front_page() && !is_paged() ) + $class = 'class="current_page_item"'; + $menu .= '
          • ' . $args['link_before'] . $text . $args['link_after'] . '
          • '; + // If the front page is a page, add it to the exclude list + if (get_option('show_on_front') == 'page') { + if ( !empty( $list_args['exclude'] ) ) { + $list_args['exclude'] .= ','; + } else { + $list_args['exclude'] = ''; + } + $list_args['exclude'] .= get_option('page_on_front'); + } + } + + $list_args['echo'] = false; + $list_args['title_li'] = ''; + $menu .= str_replace( array( "\r", "\n", "\t" ), '', wp_list_pages($list_args) ); + + if ( $menu ) + $menu = '
              ' . $menu . '
            '; + + $menu = '
            ' . $menu . "
            \n"; + $menu = apply_filters( 'wp_page_menu', $menu, $args ); + if ( $args['echo'] ) + echo $menu; + else + return $menu; +} + +// +// Page helpers +// + +/** + * Retrieve HTML list content for page list. + * + * @uses Walker_Page to create HTML list content. + * @since 2.1.0 + * @see Walker_Page::walk() for parameters and return description. + */ +function walk_page_tree($pages, $depth, $current_page, $r) { + if ( empty($r['walker']) ) + $walker = new Walker_Page; + else + $walker = $r['walker']; + + $args = array($pages, $depth, $r, $current_page); + return call_user_func_array(array(&$walker, 'walk'), $args); +} + +/** + * Retrieve HTML dropdown (select) content for page list. + * + * @uses Walker_PageDropdown to create HTML dropdown content. + * @since 2.1.0 + * @see Walker_PageDropdown::walk() for parameters and return description. + */ +function walk_page_dropdown_tree() { + $args = func_get_args(); + if ( empty($args[2]['walker']) ) // the user's options are the third parameter + $walker = new Walker_PageDropdown; + else + $walker = $args[2]['walker']; + + return call_user_func_array(array(&$walker, 'walk'), $args); +} + +/** + * Create HTML list of pages. + * + * @package WordPress + * @since 2.1.0 + * @uses Walker + */ +class Walker_Page extends Walker { + /** + * @see Walker::$tree_type + * @since 2.1.0 + * @var string + */ + var $tree_type = 'page'; + + /** + * @see Walker::$db_fields + * @since 2.1.0 + * @todo Decouple this. + * @var array + */ + var $db_fields = array ('parent' => 'post_parent', 'id' => 'ID'); + + /** + * @see Walker::start_lvl() + * @since 2.1.0 + * + * @param string $output Passed by reference. Used to append additional content. + * @param int $depth Depth of page. Used for padding. + */ + function start_lvl(&$output, $depth) { + $indent = str_repeat("\t", $depth); + $output .= "\n$indent
              \n"; + } + + /** + * @see Walker::end_lvl() + * @since 2.1.0 + * + * @param string $output Passed by reference. Used to append additional content. + * @param int $depth Depth of page. Used for padding. + */ + function end_lvl(&$output, $depth) { + $indent = str_repeat("\t", $depth); + $output .= "$indent
            \n"; + } + + /** + * @see Walker::start_el() + * @since 2.1.0 + * + * @param string $output Passed by reference. Used to append additional content. + * @param object $page Page data object. + * @param int $depth Depth of page. Used for padding. + * @param int $current_page Page ID. + * @param array $args + */ + function start_el(&$output, $page, $depth, $args, $current_page) { + if ( $depth ) + $indent = str_repeat("\t", $depth); + else + $indent = ''; + + extract($args, EXTR_SKIP); + $css_class = array('page_item', 'page-item-'.$page->ID); + if ( !empty($current_page) ) { + $_current_page = get_page( $current_page ); + _get_post_ancestors($_current_page); + if ( isset($_current_page->ancestors) && in_array($page->ID, (array) $_current_page->ancestors) ) + $css_class[] = 'current_page_ancestor'; + if ( $page->ID == $current_page ) + $css_class[] = 'current_page_item'; + elseif ( $_current_page && $page->ID == $_current_page->post_parent ) + $css_class[] = 'current_page_parent'; + } elseif ( $page->ID == get_option('page_for_posts') ) { + $css_class[] = 'current_page_parent'; + } + + $css_class = implode(' ', apply_filters('page_css_class', $css_class, $page)); + + $output .= $indent . '
          • ' . $link_before . apply_filters( 'the_title', $page->post_title, $page->ID ) . $link_after . ''; + + if ( !empty($show_date) ) { + if ( 'modified' == $show_date ) + $time = $page->post_modified; + else + $time = $page->post_date; + + $output .= " " . mysql2date($date_format, $time); + } + } + + /** + * @see Walker::end_el() + * @since 2.1.0 + * + * @param string $output Passed by reference. Used to append additional content. + * @param object $page Page data object. Not used. + * @param int $depth Depth of page. Not Used. + */ + function end_el(&$output, $page, $depth) { + $output .= "
          • \n"; + } + +} + +/** + * Create HTML dropdown list of pages. + * + * @package WordPress + * @since 2.1.0 + * @uses Walker + */ +class Walker_PageDropdown extends Walker { + /** + * @see Walker::$tree_type + * @since 2.1.0 + * @var string + */ + var $tree_type = 'page'; + + /** + * @see Walker::$db_fields + * @since 2.1.0 + * @todo Decouple this + * @var array + */ + var $db_fields = array ('parent' => 'post_parent', 'id' => 'ID'); + + /** + * @see Walker::start_el() + * @since 2.1.0 + * + * @param string $output Passed by reference. Used to append additional content. + * @param object $page Page data object. + * @param int $depth Depth of page in reference to parent pages. Used for padding. + * @param array $args Uses 'selected' argument for selected page to set selected HTML attribute for option element. + */ + function start_el(&$output, $page, $depth, $args) { + $pad = str_repeat(' ', $depth * 3); + + $output .= "\t\n"; + } +} + +// +// Attachments +// + +/** + * Display an attachment page link using an image or icon. + * + * @since 2.0.0 + * + * @param int $id Optional. Post ID. + * @param bool $fullsize Optional, default is false. Whether to use full size. + * @param bool $deprecated Deprecated. Not used. + * @param bool $permalink Optional, default is false. Whether to include permalink. + */ +function the_attachment_link( $id = 0, $fullsize = false, $deprecated = false, $permalink = false ) { + if ( !empty( $deprecated ) ) + _deprecated_argument( __FUNCTION__, '2.5' ); + + if ( $fullsize ) + echo wp_get_attachment_link($id, 'full', $permalink); + else + echo wp_get_attachment_link($id, 'thumbnail', $permalink); +} + +/** + * Retrieve an attachment page link using an image or icon, if possible. + * + * @since 2.5.0 + * @uses apply_filters() Calls 'wp_get_attachment_link' filter on HTML content with same parameters as function. + * + * @param int $id Optional. Post ID. + * @param string $size Optional, default is 'thumbnail'. Size of image, either array or string. + * @param bool $permalink Optional, default is false. Whether to add permalink to image. + * @param bool $icon Optional, default is false. Whether to include icon. + * @param string $text Optional, default is false. If string, then will be link text. + * @return string HTML content. + */ +function wp_get_attachment_link($id = 0, $size = 'thumbnail', $permalink = false, $icon = false, $text = false) { + $id = intval($id); + $_post = & get_post( $id ); + + if ( ('attachment' != $_post->post_type) || !$url = wp_get_attachment_url($_post->ID) ) + return __('Missing Attachment'); + + if ( $permalink ) + $url = get_attachment_link($_post->ID); + + $post_title = esc_attr($_post->post_title); + + if ( $text ) { + $link_text = esc_attr($text); + } elseif ( ( is_int($size) && $size != 0 ) or ( is_string($size) && $size != 'none' ) or $size != false ) { + $link_text = wp_get_attachment_image($id, $size, $icon); + } else { + $link_text = ''; + } + + if( trim($link_text) == '' ) + $link_text = $_post->post_title; + + return apply_filters( 'wp_get_attachment_link', "$link_text", $id, $size, $permalink, $icon, $text ); +} + +/** + * Wrap attachment in <

            > element before content. + * + * @since 2.0.0 + * @uses apply_filters() Calls 'prepend_attachment' hook on HTML content. + * + * @param string $content + * @return string + */ +function prepend_attachment($content) { + global $post; + + if ( empty($post->post_type) || $post->post_type != 'attachment' ) + return $content; + + $p = '

            '; + // show the medium sized image representation of the attachment if available, and link to the raw file + $p .= wp_get_attachment_link(0, 'medium', false); + $p .= '

            '; + $p = apply_filters('prepend_attachment', $p); + + return "$p\n$content"; +} + +// +// Misc +// + +/** + * Retrieve protected post password form content. + * + * @since 1.0.0 + * @uses apply_filters() Calls 'the_password_form' filter on output. + * + * @return string HTML content for password form for password protected post. + */ +function get_the_password_form() { + global $post; + $label = 'pwbox-'.(empty($post->ID) ? rand() : $post->ID); + $output = '
            +

            ' . __("This post is password protected. To view it please enter your password below:") . '

            +

            +
            + '; + return apply_filters('the_password_form', $output); +} + +/** + * Whether currently in a page template. + * + * This template tag allows you to determine if you are in a page template. + * You can optionally provide a template name and then the check will be + * specific to that template. + * + * @since 2.5.0 + * @uses $wp_query + * + * @param string $template The specific template name if specific matching is required. + * @return bool False on failure, true if success. + */ +function is_page_template($template = '') { + if (!is_page()) { + return false; + } + + global $wp_query; + + $page = $wp_query->get_queried_object(); + $custom_fields = get_post_custom_values('_wp_page_template',$page->ID); + $page_template = $custom_fields[0]; + + // We have no argument passed so just see if a page_template has been specified + if ( empty( $template ) ) { + if ( !empty( $page_template ) and ( 'default' != $page_template ) ) { + return true; + } + } elseif ( $template == $page_template) { + return true; + } + + return false; +} + +/** + * Retrieve formatted date timestamp of a revision (linked to that revisions's page). + * + * @package WordPress + * @subpackage Post_Revisions + * @since 2.6.0 + * + * @uses date_i18n() + * + * @param int|object $revision Revision ID or revision object. + * @param bool $link Optional, default is true. Link to revisions's page? + * @return string i18n formatted datetimestamp or localized 'Current Revision'. + */ +function wp_post_revision_title( $revision, $link = true ) { + if ( !$revision = get_post( $revision ) ) + return $revision; + + if ( !in_array( $revision->post_type, array( 'post', 'page', 'revision' ) ) ) + return false; + + /* translators: revision date format, see http://php.net/date */ + $datef = _x( 'j F, Y @ G:i', 'revision date format'); + /* translators: 1: date */ + $autosavef = __( '%1$s [Autosave]' ); + /* translators: 1: date */ + $currentf = __( '%1$s [Current Revision]' ); + + $date = date_i18n( $datef, strtotime( $revision->post_modified ) ); + if ( $link && current_user_can( 'edit_post', $revision->ID ) && $link = get_edit_post_link( $revision->ID ) ) + $date = "$date"; + + if ( !wp_is_post_revision( $revision ) ) + $date = sprintf( $currentf, $date ); + elseif ( wp_is_post_autosave( $revision ) ) + $date = sprintf( $autosavef, $date ); + + return $date; +} + +/** + * Display list of a post's revisions. + * + * Can output either a UL with edit links or a TABLE with diff interface, and + * restore action links. + * + * Second argument controls parameters: + * (bool) parent : include the parent (the "Current Revision") in the list. + * (string) format : 'list' or 'form-table'. 'list' outputs UL, 'form-table' + * outputs TABLE with UI. + * (int) right : what revision is currently being viewed - used in + * form-table format. + * (int) left : what revision is currently being diffed against right - + * used in form-table format. + * + * @package WordPress + * @subpackage Post_Revisions + * @since 2.6.0 + * + * @uses wp_get_post_revisions() + * @uses wp_post_revision_title() + * @uses get_edit_post_link() + * @uses get_the_author_meta() + * + * @todo split into two functions (list, form-table) ? + * + * @param int|object $post_id Post ID or post object. + * @param string|array $args See description {@link wp_parse_args()}. + * @return null + */ +function wp_list_post_revisions( $post_id = 0, $args = null ) { + if ( !$post = get_post( $post_id ) ) + return; + + $defaults = array( 'parent' => false, 'right' => false, 'left' => false, 'format' => 'list', 'type' => 'all' ); + extract( wp_parse_args( $args, $defaults ), EXTR_SKIP ); + + switch ( $type ) { + case 'autosave' : + if ( !$autosave = wp_get_post_autosave( $post->ID ) ) + return; + $revisions = array( $autosave ); + break; + case 'revision' : // just revisions - remove autosave later + case 'all' : + default : + if ( !$revisions = wp_get_post_revisions( $post->ID ) ) + return; + break; + } + + /* translators: post revision: 1: when, 2: author name */ + $titlef = _x( '%1$s by %2$s', 'post revision' ); + + if ( $parent ) + array_unshift( $revisions, $post ); + + $rows = $right_checked = ''; + $class = false; + $can_edit_post = current_user_can( 'edit_post', $post->ID ); + foreach ( $revisions as $revision ) { + if ( !current_user_can( 'read_post', $revision->ID ) ) + continue; + if ( 'revision' === $type && wp_is_post_autosave( $revision ) ) + continue; + + $date = wp_post_revision_title( $revision ); + $name = get_the_author_meta( 'display_name', $revision->post_author ); + + if ( 'form-table' == $format ) { + if ( $left ) + $left_checked = $left == $revision->ID ? ' checked="checked"' : ''; + else + $left_checked = $right_checked ? ' checked="checked"' : ''; // [sic] (the next one) + $right_checked = $right == $revision->ID ? ' checked="checked"' : ''; + + $class = $class ? '' : " class='alternate'"; + + if ( $post->ID != $revision->ID && $can_edit_post ) + $actions = 'ID|$revision->ID" ) . '">' . __( 'Restore' ) . ''; + else + $actions = ''; + + $rows .= "\n"; + $rows .= "\t\n"; + $rows .= "\t\n"; + $rows .= "\t$date\n"; + $rows .= "\t$name\n"; + $rows .= "\t$actions\n"; + $rows .= "\n"; + } else { + $title = sprintf( $titlef, $date, $name ); + $rows .= "\t
          • $title
          • \n"; + } + } + + if ( 'form-table' == $format ) : ?> + +
            + +
            +
            + + + +
            +
            + +
            + + + + + + + + + + + + + + + + + + + + + +
            + +
            + +\n"; + echo $rows; + echo "
          "; + endif; + +} diff --git a/src/wp-includes/post-thumbnail-template.php b/src/wp-includes/post-thumbnail-template.php new file mode 100644 index 0000000..38ae903 --- /dev/null +++ b/src/wp-includes/post-thumbnail-template.php @@ -0,0 +1,105 @@ +thumbnails_cached ) + return; + + $thumb_ids = array(); + foreach ( $wp_query->posts as $post ) { + if ( $id = get_post_thumbnail_id( $post->ID ) ) + $thumb_ids[] = $id; + } + + if ( ! empty ( $thumb_ids ) ) { + get_posts( array( + 'update_post_term_cache' => false, + 'include' => $thumb_ids, + 'post_type' => 'attachment', + 'post_status' => 'inherit', + 'nopaging' => true + ) ); + } + + $wp_query->thumbnails_cached = true; +} + +/** + * Retrieve Post Thumbnail. + * + * @since 2.9.0 + * + * @param int $post_id Optional. Post ID. + * @param string $size Optional. Image size. Defaults to 'thumbnail'. + * @param string|array $attr Optional. Query string or array of attributes. + */ +function get_the_post_thumbnail( $post_id = null, $size = 'post-thumbnail', $attr = '' ) { + $post_id = ( null === $post_id ) ? get_the_ID() : $post_id; + $post_thumbnail_id = get_post_thumbnail_id( $post_id ); + $size = apply_filters( 'post_thumbnail_size', $size ); + if ( $post_thumbnail_id ) { + do_action( 'begin_fetch_post_thumbnail_html', $post_id, $post_thumbnail_id, $size ); // for "Just In Time" filtering of all of wp_get_attachment_image()'s filters + if ( in_the_loop() ) + update_post_thumbnail_cache(); + $html = wp_get_attachment_image( $post_thumbnail_id, $size, false, $attr ); + do_action( 'end_fetch_post_thumbnail_html', $post_id, $post_thumbnail_id, $size ); + } else { + $html = ''; + } + return apply_filters( 'post_thumbnail_html', $html, $post_id, $post_thumbnail_id, $size, $attr ); +} + +?> diff --git a/src/wp-includes/post.php b/src/wp-includes/post.php new file mode 100644 index 0000000..0cf04d5 --- /dev/null +++ b/src/wp-includes/post.php @@ -0,0 +1,5298 @@ + array( + 'name_admin_bar' => _x( 'Post', 'add new on admin bar' ), + ), + 'public' => true, + '_builtin' => true, /* internal use only. don't use this when registering your own post type. */ + '_edit_link' => 'post.php?post=%d', /* internal use only. don't use this when registering your own post type. */ + 'capability_type' => 'post', + 'map_meta_cap' => true, + 'hierarchical' => false, + 'rewrite' => false, + 'query_var' => false, + 'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'trackbacks', 'custom-fields', 'comments', 'revisions', 'post-formats' ), + ) ); + + register_post_type( 'page', array( + 'labels' => array( + 'name_admin_bar' => _x( 'Page', 'add new on admin bar' ), + ), + 'public' => true, + 'publicly_queryable' => false, + '_builtin' => true, /* internal use only. don't use this when registering your own post type. */ + '_edit_link' => 'post.php?post=%d', /* internal use only. don't use this when registering your own post type. */ + 'capability_type' => 'page', + 'map_meta_cap' => true, + 'hierarchical' => true, + 'rewrite' => false, + 'query_var' => false, + 'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'page-attributes', 'custom-fields', 'comments', 'revisions' ), + ) ); + + register_post_type( 'attachment', array( + 'labels' => array( + 'name' => __( 'Media' ), + ), + 'public' => true, + 'show_ui' => false, + '_builtin' => true, /* internal use only. don't use this when registering your own post type. */ + '_edit_link' => 'media.php?attachment_id=%d', /* internal use only. don't use this when registering your own post type. */ + 'capability_type' => 'post', + 'map_meta_cap' => true, + 'hierarchical' => false, + 'rewrite' => false, + 'query_var' => false, + 'show_in_nav_menus' => false, + 'supports' => array( 'comments' ), + ) ); + + register_post_type( 'revision', array( + 'labels' => array( + 'name' => __( 'Revisions' ), + 'singular_name' => __( 'Revision' ), + ), + 'public' => false, + '_builtin' => true, /* internal use only. don't use this when registering your own post type. */ + '_edit_link' => 'revision.php?revision=%d', /* internal use only. don't use this when registering your own post type. */ + 'capability_type' => 'post', + 'map_meta_cap' => true, + 'hierarchical' => false, + 'rewrite' => false, + 'query_var' => false, + 'can_export' => false, + ) ); + + register_post_type( 'nav_menu_item', array( + 'labels' => array( + 'name' => __( 'Navigation Menu Items' ), + 'singular_name' => __( 'Navigation Menu Item' ), + ), + 'public' => false, + '_builtin' => true, /* internal use only. don't use this when registering your own post type. */ + 'hierarchical' => false, + 'rewrite' => false, + 'query_var' => false, + ) ); + + register_post_status( 'publish', array( + 'label' => _x( 'Published', 'post' ), + 'public' => true, + '_builtin' => true, /* internal use only. */ + 'label_count' => _n_noop( 'Published (%s)', 'Published (%s)' ), + ) ); + + register_post_status( 'future', array( + 'label' => _x( 'Scheduled', 'post' ), + 'protected' => true, + '_builtin' => true, /* internal use only. */ + 'label_count' => _n_noop('Scheduled (%s)', 'Scheduled (%s)' ), + ) ); + + register_post_status( 'draft', array( + 'label' => _x( 'Draft', 'post' ), + 'protected' => true, + '_builtin' => true, /* internal use only. */ + 'label_count' => _n_noop( 'Draft (%s)', 'Drafts (%s)' ), + ) ); + + register_post_status( 'pending', array( + 'label' => _x( 'Pending', 'post' ), + 'protected' => true, + '_builtin' => true, /* internal use only. */ + 'label_count' => _n_noop( 'Pending (%s)', 'Pending (%s)' ), + ) ); + + register_post_status( 'private', array( + 'label' => _x( 'Private', 'post' ), + 'private' => true, + '_builtin' => true, /* internal use only. */ + 'label_count' => _n_noop( 'Private (%s)', 'Private (%s)' ), + ) ); + + register_post_status( 'trash', array( + 'label' => _x( 'Trash', 'post' ), + 'internal' => true, + '_builtin' => true, /* internal use only. */ + 'label_count' => _n_noop( 'Trash (%s)', 'Trash (%s)' ), + 'show_in_admin_status_list' => true, + ) ); + + register_post_status( 'auto-draft', array( + 'label' => 'auto-draft', + 'internal' => true, + '_builtin' => true, /* internal use only. */ + ) ); + + register_post_status( 'inherit', array( + 'label' => 'inherit', + 'internal' => true, + '_builtin' => true, /* internal use only. */ + 'exclude_from_search' => false, + ) ); +} +add_action( 'init', 'create_initial_post_types', 0 ); // highest priority + +/** + * Retrieve attached file path based on attachment ID. + * + * You can optionally send it through the 'get_attached_file' filter, but by + * default it will just return the file path unfiltered. + * + * The function works by getting the single post meta name, named + * '_wp_attached_file' and returning it. This is a convenience function to + * prevent looking up the meta name and provide a mechanism for sending the + * attached filename through a filter. + * + * @since 2.0.0 + * @uses apply_filters() Calls 'get_attached_file' on file path and attachment ID. + * + * @param int $attachment_id Attachment ID. + * @param bool $unfiltered Whether to apply filters. + * @return string The file path to the attached file. + */ +function get_attached_file( $attachment_id, $unfiltered = false ) { + $file = get_post_meta( $attachment_id, '_wp_attached_file', true ); + // If the file is relative, prepend upload dir + if ( 0 !== strpos($file, '/') && !preg_match('|^.:\\\|', $file) && ( ($uploads = wp_upload_dir()) && false === $uploads['error'] ) ) + $file = $uploads['basedir'] . "/$file"; + if ( $unfiltered ) + return $file; + return apply_filters( 'get_attached_file', $file, $attachment_id ); +} + +/** + * Update attachment file path based on attachment ID. + * + * Used to update the file path of the attachment, which uses post meta name + * '_wp_attached_file' to store the path of the attachment. + * + * @since 2.1.0 + * @uses apply_filters() Calls 'update_attached_file' on file path and attachment ID. + * + * @param int $attachment_id Attachment ID + * @param string $file File path for the attachment + * @return bool False on failure, true on success. + */ +function update_attached_file( $attachment_id, $file ) { + if ( !get_post( $attachment_id ) ) + return false; + + $file = apply_filters( 'update_attached_file', $file, $attachment_id ); + $file = _wp_relative_upload_path($file); + + return update_post_meta( $attachment_id, '_wp_attached_file', $file ); +} + +/** + * Return relative path to an uploaded file. + * + * The path is relative to the current upload dir. + * + * @since 2.9.0 + * @uses apply_filters() Calls '_wp_relative_upload_path' on file path. + * + * @param string $path Full path to the file + * @return string relative path on success, unchanged path on failure. + */ +function _wp_relative_upload_path( $path ) { + $new_path = $path; + + if ( ($uploads = wp_upload_dir()) && false === $uploads['error'] ) { + if ( 0 === strpos($new_path, $uploads['basedir']) ) { + $new_path = str_replace($uploads['basedir'], '', $new_path); + $new_path = ltrim($new_path, '/'); + } + } + + return apply_filters( '_wp_relative_upload_path', $new_path, $path ); +} + +/** + * Retrieve all children of the post parent ID. + * + * Normally, without any enhancements, the children would apply to pages. In the + * context of the inner workings of WordPress, pages, posts, and attachments + * share the same table, so therefore the functionality could apply to any one + * of them. It is then noted that while this function does not work on posts, it + * does not mean that it won't work on posts. It is recommended that you know + * what context you wish to retrieve the children of. + * + * Attachments may also be made the child of a post, so if that is an accurate + * statement (which needs to be verified), it would then be possible to get + * all of the attachments for a post. Attachments have since changed since + * version 2.5, so this is most likely unaccurate, but serves generally as an + * example of what is possible. + * + * The arguments listed as defaults are for this function and also of the + * {@link get_posts()} function. The arguments are combined with the + * get_children defaults and are then passed to the {@link get_posts()} + * function, which accepts additional arguments. You can replace the defaults in + * this function, listed below and the additional arguments listed in the + * {@link get_posts()} function. + * + * The 'post_parent' is the most important argument and important attention + * needs to be paid to the $args parameter. If you pass either an object or an + * integer (number), then just the 'post_parent' is grabbed and everything else + * is lost. If you don't specify any arguments, then it is assumed that you are + * in The Loop and the post parent will be grabbed for from the current post. + * + * The 'post_parent' argument is the ID to get the children. The 'numberposts' + * is the amount of posts to retrieve that has a default of '-1', which is + * used to get all of the posts. Giving a number higher than 0 will only + * retrieve that amount of posts. + * + * The 'post_type' and 'post_status' arguments can be used to choose what + * criteria of posts to retrieve. The 'post_type' can be anything, but WordPress + * post types are 'post', 'pages', and 'attachments'. The 'post_status' + * argument will accept any post status within the write administration panels. + * + * @see get_posts() Has additional arguments that can be replaced. + * @internal Claims made in the long description might be inaccurate. + * + * @since 2.0.0 + * + * @param mixed $args Optional. User defined arguments for replacing the defaults. + * @param string $output Optional. Constant for return type, either OBJECT (default), ARRAY_A, ARRAY_N. + * @return array|bool False on failure and the type will be determined by $output parameter. + */ +function get_children($args = '', $output = OBJECT) { + $kids = array(); + if ( empty( $args ) ) { + if ( isset( $GLOBALS['post'] ) ) { + $args = array('post_parent' => (int) $GLOBALS['post']->post_parent ); + } else { + return $kids; + } + } elseif ( is_object( $args ) ) { + $args = array('post_parent' => (int) $args->post_parent ); + } elseif ( is_numeric( $args ) ) { + $args = array('post_parent' => (int) $args); + } + + $defaults = array( + 'numberposts' => -1, 'post_type' => 'any', + 'post_status' => 'any', 'post_parent' => 0, + ); + + $r = wp_parse_args( $args, $defaults ); + + $children = get_posts( $r ); + + if ( !$children ) + return $kids; + + update_post_cache($children); + + foreach ( $children as $key => $child ) + $kids[$child->ID] = $children[$key]; + + if ( $output == OBJECT ) { + return $kids; + } elseif ( $output == ARRAY_A ) { + foreach ( (array) $kids as $kid ) + $weeuns[$kid->ID] = get_object_vars($kids[$kid->ID]); + return $weeuns; + } elseif ( $output == ARRAY_N ) { + foreach ( (array) $kids as $kid ) + $babes[$kid->ID] = array_values(get_object_vars($kids[$kid->ID])); + return $babes; + } else { + return $kids; + } +} + +/** + * Get extended entry info (). + * + * There should not be any space after the second dash and before the word + * 'more'. There can be text or space(s) after the word 'more', but won't be + * referenced. + * + * The returned array has 'main' and 'extended' keys. Main has the text before + * the . The 'extended' key has the content after the + * comment. + * + * @since 1.0.0 + * + * @param string $post Post content. + * @return array Post before ('main') and after ('extended'). + */ +function get_extended($post) { + //Match the new style more links + if ( preg_match('//', $post, $matches) ) { + list($main, $extended) = explode($matches[0], $post, 2); + } else { + $main = $post; + $extended = ''; + } + + // Strip leading and trailing whitespace + $main = preg_replace('/^[\s]*(.*)[\s]*$/', '\\1', $main); + $extended = preg_replace('/^[\s]*(.*)[\s]*$/', '\\1', $extended); + + return array('main' => $main, 'extended' => $extended); +} + +/** + * Retrieves post data given a post ID or post object. + * + * See {@link sanitize_post()} for optional $filter values. Also, the parameter + * $post, must be given as a variable, since it is passed by reference. + * + * @since 1.5.1 + * @uses $wpdb + * @link http://codex.wordpress.org/Function_Reference/get_post + * + * @param int|object $post Post ID or post object. + * @param string $output Optional, default is Object. Either OBJECT, ARRAY_A, or ARRAY_N. + * @param string $filter Optional, default is raw. + * @return mixed Post data + */ +function &get_post(&$post, $output = OBJECT, $filter = 'raw') { + global $wpdb; + $null = null; + + if ( empty($post) ) { + if ( isset($GLOBALS['post']) ) + $_post = & $GLOBALS['post']; + else + return $null; + } elseif ( is_object($post) && empty($post->filter) ) { + _get_post_ancestors($post); + $_post = sanitize_post($post, 'raw'); + wp_cache_add($post->ID, $_post, 'posts'); + } else { + if ( is_object($post) ) + $post_id = $post->ID; + else + $post_id = $post; + + $post_id = (int) $post_id; + if ( ! $_post = wp_cache_get($post_id, 'posts') ) { + $_post = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->posts WHERE ID = %d LIMIT 1", $post_id)); + if ( ! $_post ) + return $null; + _get_post_ancestors($_post); + $_post = sanitize_post($_post, 'raw'); + wp_cache_add($_post->ID, $_post, 'posts'); + } + } + + if ($filter != 'raw') + $_post = sanitize_post($_post, $filter); + + if ( $output == OBJECT ) { + return $_post; + } elseif ( $output == ARRAY_A ) { + $__post = get_object_vars($_post); + return $__post; + } elseif ( $output == ARRAY_N ) { + $__post = array_values(get_object_vars($_post)); + return $__post; + } else { + return $_post; + } +} + +/** + * Retrieve ancestors of a post. + * + * @since 2.5.0 + * + * @param int|object $post Post ID or post object + * @return array Ancestor IDs or empty array if none are found. + */ +function get_post_ancestors($post) { + $post = get_post($post); + + if ( !empty($post->ancestors) ) + return $post->ancestors; + + return array(); +} + +/** + * Retrieve data from a post field based on Post ID. + * + * Examples of the post field will be, 'post_type', 'post_status', 'content', + * etc and based off of the post object property or key names. + * + * The context values are based off of the taxonomy filter functions and + * supported values are found within those functions. + * + * @since 2.3.0 + * @uses sanitize_post_field() See for possible $context values. + * + * @param string $field Post field name + * @param id $post Post ID + * @param string $context Optional. How to filter the field. Default is display. + * @return WP_Error|string Value in post field or WP_Error on failure + */ +function get_post_field( $field, $post, $context = 'display' ) { + $post = (int) $post; + $post = get_post( $post ); + + if ( is_wp_error($post) ) + return $post; + + if ( !is_object($post) ) + return ''; + + if ( !isset($post->$field) ) + return ''; + + return sanitize_post_field($field, $post->$field, $post->ID, $context); +} + +/** + * Retrieve the mime type of an attachment based on the ID. + * + * This function can be used with any post type, but it makes more sense with + * attachments. + * + * @since 2.0.0 + * + * @param int $ID Optional. Post ID. + * @return bool|string False on failure or returns the mime type + */ +function get_post_mime_type($ID = '') { + $post = & get_post($ID); + + if ( is_object($post) ) + return $post->post_mime_type; + + return false; +} + +/** + * Retrieve the format slug for a post + * + * @since 3.1.0 + * + * @param int|object $post A post + * + * @return mixed The format if successful. False if no format is set. WP_Error if errors. + */ +function get_post_format( $post = null ) { + $post = get_post($post); + + if ( ! post_type_supports( $post->post_type, 'post-formats' ) ) + return false; + + $_format = get_the_terms( $post->ID, 'post_format' ); + + if ( empty( $_format ) ) + return false; + + $format = array_shift( $_format ); + + return ( str_replace('post-format-', '', $format->slug ) ); +} + +/** + * Check if a post has a particular format + * + * @since 3.1.0 + * @uses has_term() + * + * @param string $format The format to check for + * @param object|id $post The post to check. If not supplied, defaults to the current post if used in the loop. + * @return bool True if the post has the format, false otherwise. + */ +function has_post_format( $format, $post = null ) { + return has_term('post-format-' . sanitize_key($format), 'post_format', $post); +} + +/** + * Assign a format to a post + * + * @since 3.1.0 + * + * @param int|object $post The post for which to assign a format + * @param string $format A format to assign. Use an empty string or array to remove all formats from the post. + * @return mixed WP_Error on error. Array of affected term IDs on success. + */ +function set_post_format( $post, $format ) { + $post = get_post($post); + + if ( empty($post) ) + return new WP_Error('invalid_post', __('Invalid post')); + + if ( !empty($format) ) { + $format = sanitize_key($format); + if ( 'standard' == $format || !in_array( $format, array_keys( get_post_format_slugs() ) ) ) + $format = ''; + else + $format = 'post-format-' . $format; + } + + return wp_set_post_terms($post->ID, $format, 'post_format'); +} + +/** + * Retrieve the post status based on the Post ID. + * + * If the post ID is of an attachment, then the parent post status will be given + * instead. + * + * @since 2.0.0 + * + * @param int $ID Post ID + * @return string|bool Post status or false on failure. + */ +function get_post_status($ID = '') { + $post = get_post($ID); + + if ( !is_object($post) ) + return false; + + if ( 'attachment' == $post->post_type ) { + if ( 'private' == $post->post_status ) + return 'private'; + + // Unattached attachments are assumed to be published + if ( ( 'inherit' == $post->post_status ) && ( 0 == $post->post_parent) ) + return 'publish'; + + // Inherit status from the parent + if ( $post->post_parent && ( $post->ID != $post->post_parent ) ) + return get_post_status($post->post_parent); + } + + return $post->post_status; +} + +/** + * Retrieve all of the WordPress supported post statuses. + * + * Posts have a limited set of valid status values, this provides the + * post_status values and descriptions. + * + * @since 2.5.0 + * + * @return array List of post statuses. + */ +function get_post_statuses( ) { + $status = array( + 'draft' => __('Draft'), + 'pending' => __('Pending Review'), + 'private' => __('Private'), + 'publish' => __('Published') + ); + + return $status; +} + +/** + * Retrieve all of the WordPress support page statuses. + * + * Pages have a limited set of valid status values, this provides the + * post_status values and descriptions. + * + * @since 2.5.0 + * + * @return array List of page statuses. + */ +function get_page_statuses( ) { + $status = array( + 'draft' => __('Draft'), + 'private' => __('Private'), + 'publish' => __('Published') + ); + + return $status; +} + +/** + * Register a post type. Do not use before init. + * + * A simple function for creating or modifying a post status based on the + * parameters given. The function will accept an array (second optional + * parameter), along with a string for the post status name. + * + * + * Optional $args contents: + * + * label - A descriptive name for the post status marked for translation. Defaults to $post_status. + * public - Whether posts of this status should be shown in the front end of the site. Defaults to true. + * exclude_from_search - Whether to exclude posts with this post status from search results. Defaults to false. + * show_in_admin_all_list - Whether to include posts in the edit listing for their post type + * show_in_admin_status_list - Show in the list of statuses with post counts at the top of the edit + * listings, e.g. All (12) | Published (9) | My Custom Status (2) ... + * + * Arguments prefixed with an _underscore shouldn't be used by plugins and themes. + * + * @package WordPress + * @subpackage Post + * @since 3.0.0 + * @uses $wp_post_statuses Inserts new post status object into the list + * + * @param string $post_status Name of the post status. + * @param array|string $args See above description. + */ +function register_post_status($post_status, $args = array()) { + global $wp_post_statuses; + + if (!is_array($wp_post_statuses)) + $wp_post_statuses = array(); + + // Args prefixed with an underscore are reserved for internal use. + $defaults = array('label' => false, 'label_count' => false, 'exclude_from_search' => null, '_builtin' => false, '_edit_link' => 'post.php?post=%d', 'capability_type' => 'post', 'hierarchical' => false, 'public' => null, 'internal' => null, 'protected' => null, 'private' => null, 'show_in_admin_all' => null, 'publicly_queryable' => null, 'show_in_admin_status_list' => null, 'show_in_admin_all_list' => null, 'single_view_cap' => null); + $args = wp_parse_args($args, $defaults); + $args = (object) $args; + + $post_status = sanitize_key($post_status); + $args->name = $post_status; + + if ( null === $args->public && null === $args->internal && null === $args->protected && null === $args->private ) + $args->internal = true; + + if ( null === $args->public ) + $args->public = false; + + if ( null === $args->private ) + $args->private = false; + + if ( null === $args->protected ) + $args->protected = false; + + if ( null === $args->internal ) + $args->internal = false; + + if ( null === $args->publicly_queryable ) + $args->publicly_queryable = $args->public; + + if ( null === $args->exclude_from_search ) + $args->exclude_from_search = $args->internal; + + if ( null === $args->show_in_admin_all_list ) + $args->show_in_admin_all_list = !$args->internal; + + if ( null === $args->show_in_admin_status_list ) + $args->show_in_admin_status_list = !$args->internal; + + if ( null === $args->single_view_cap ) + $args->single_view_cap = $args->public ? '' : 'edit'; + + if ( false === $args->label ) + $args->label = $post_status; + + if ( false === $args->label_count ) + $args->label_count = array( $args->label, $args->label ); + + $wp_post_statuses[$post_status] = $args; + + return $args; +} + +/** + * Retrieve a post status object by name + * + * @package WordPress + * @subpackage Post + * @since 3.0.0 + * @uses $wp_post_statuses + * @see register_post_status + * @see get_post_statuses + * + * @param string $post_status The name of a registered post status + * @return object A post status object + */ +function get_post_status_object( $post_status ) { + global $wp_post_statuses; + + if ( empty($wp_post_statuses[$post_status]) ) + return null; + + return $wp_post_statuses[$post_status]; +} + +/** + * Get a list of all registered post status objects. + * + * @package WordPress + * @subpackage Post + * @since 3.0.0 + * @uses $wp_post_statuses + * @see register_post_status + * @see get_post_status_object + * + * @param array|string $args An array of key => value arguments to match against the post status objects. + * @param string $output The type of output to return, either post status 'names' or 'objects'. 'names' is the default. + * @param string $operator The logical operation to perform. 'or' means only one element + * from the array needs to match; 'and' means all elements must match. The default is 'and'. + * @return array A list of post type names or objects + */ +function get_post_stati( $args = array(), $output = 'names', $operator = 'and' ) { + global $wp_post_statuses; + + $field = ('names' == $output) ? 'name' : false; + + return wp_filter_object_list($wp_post_statuses, $args, $operator, $field); +} + +/** + * Whether the post type is hierarchical. + * + * A false return value might also mean that the post type does not exist. + * + * @since 3.0.0 + * @see get_post_type_object + * + * @param string $post_type Post type name + * @return bool Whether post type is hierarchical. + */ +function is_post_type_hierarchical( $post_type ) { + if ( ! post_type_exists( $post_type ) ) + return false; + + $post_type = get_post_type_object( $post_type ); + return $post_type->hierarchical; +} + +/** + * Checks if a post type is registered. + * + * @since 3.0.0 + * @uses get_post_type_object() + * + * @param string $post_type Post type name + * @return bool Whether post type is registered. + */ +function post_type_exists( $post_type ) { + return (bool) get_post_type_object( $post_type ); +} + +/** + * Retrieve the post type of the current post or of a given post. + * + * @since 2.1.0 + * + * @uses $post The Loop current post global + * + * @param mixed $the_post Optional. Post object or post ID. + * @return bool|string post type or false on failure. + */ +function get_post_type( $the_post = false ) { + global $post; + + if ( false === $the_post ) + $the_post = $post; + elseif ( is_numeric($the_post) ) + $the_post = get_post($the_post); + + if ( is_object($the_post) ) + return $the_post->post_type; + + return false; +} + +/** + * Retrieve a post type object by name + * + * @package WordPress + * @subpackage Post + * @since 3.0.0 + * @uses $wp_post_types + * @see register_post_type + * @see get_post_types + * + * @param string $post_type The name of a registered post type + * @return object A post type object + */ +function get_post_type_object( $post_type ) { + global $wp_post_types; + + if ( empty($wp_post_types[$post_type]) ) + return null; + + return $wp_post_types[$post_type]; +} + +/** + * Get a list of all registered post type objects. + * + * @package WordPress + * @subpackage Post + * @since 2.9.0 + * @uses $wp_post_types + * @see register_post_type + * + * @param array|string $args An array of key => value arguments to match against the post type objects. + * @param string $output The type of output to return, either post type 'names' or 'objects'. 'names' is the default. + * @param string $operator The logical operation to perform. 'or' means only one element + * from the array needs to match; 'and' means all elements must match. The default is 'and'. + * @return array A list of post type names or objects + */ +function get_post_types( $args = array(), $output = 'names', $operator = 'and' ) { + global $wp_post_types; + + $field = ('names' == $output) ? 'name' : false; + + return wp_filter_object_list($wp_post_types, $args, $operator, $field); +} + +/** + * Register a post type. Do not use before init. + * + * A function for creating or modifying a post type based on the + * parameters given. The function will accept an array (second optional + * parameter), along with a string for the post type name. + * + * Optional $args contents: + * + * - label - Name of the post type shown in the menu. Usually plural. If not set, labels['name'] will be used. + * - description - A short descriptive summary of what the post type is. Defaults to blank. + * - public - Whether posts of this type should be shown in the admin UI. Defaults to false. + * - exclude_from_search - Whether to exclude posts with this post type from search results. + * Defaults to true if the type is not public, false if the type is public. + * - publicly_queryable - Whether post_type queries can be performed from the front page. + * Defaults to whatever public is set as. + * - show_ui - Whether to generate a default UI for managing this post type. Defaults to true + * if the type is public, false if the type is not public. + * - show_in_menu - Where to show the post type in the admin menu. True for a top level menu, + * false for no menu, or can be a top level page like 'tools.php' or 'edit.php?post_type=page'. + * show_ui must be true. + * - menu_position - The position in the menu order the post type should appear. Defaults to the bottom. + * - menu_icon - The url to the icon to be used for this menu. Defaults to use the posts icon. + * - capability_type - The string to use to build the read, edit, and delete capabilities. Defaults to 'post'. + * May be passed as an array to allow for alternative plurals when using this argument as a base to construct the + * capabilities, e.g. array('story', 'stories'). + * - capabilities - Array of capabilities for this post type. By default the capability_type is used + * as a base to construct capabilities. You can see accepted values in {@link get_post_type_capabilities()}. + * - map_meta_cap - Whether to use the internal default meta capability handling. Defaults to false. + * - hierarchical - Whether the post type is hierarchical. Defaults to false. + * - supports - An alias for calling add_post_type_support() directly. See {@link add_post_type_support()} + * for documentation. Defaults to none. + * - register_meta_box_cb - Provide a callback function that will be called when setting up the + * meta boxes for the edit form. Do remove_meta_box() and add_meta_box() calls in the callback. + * - taxonomies - An array of taxonomy identifiers that will be registered for the post type. + * Default is no taxonomies. Taxonomies can be registered later with register_taxonomy() or + * register_taxonomy_for_object_type(). + * - labels - An array of labels for this post type. By default post labels are used for non-hierarchical + * types and page labels for hierarchical ones. You can see accepted values in {@link get_post_type_labels()}. + * - permalink_epmask - The default rewrite endpoint bitmasks. + * - has_archive - True to enable post type archives. Will generate the proper rewrite rules if rewrite is enabled. + * - rewrite - false to prevent rewrite. Defaults to true. Use array('slug'=>$slug) to customize permastruct; + * default will use $post_type as slug. Other options include 'with_front', 'feeds', and 'pages'. + * - query_var - false to prevent queries, or string to value of the query var to use for this post type + * - can_export - true allows this post type to be exported. + * - show_in_nav_menus - true makes this post type available for selection in navigation menus. + * - _builtin - true if this post type is a native or "built-in" post_type. THIS IS FOR INTERNAL USE ONLY! + * - _edit_link - URL segement to use for edit link of this post type. THIS IS FOR INTERNAL USE ONLY! + * + * @since 2.9.0 + * @uses $wp_post_types Inserts new post type object into the list + * + * @param string $post_type Name of the post type. + * @param array|string $args See above description. + * @return object|WP_Error the registered post type object, or an error object + */ +function register_post_type($post_type, $args = array()) { + global $wp_post_types, $wp_rewrite, $wp; + + if ( !is_array($wp_post_types) ) + $wp_post_types = array(); + + // Args prefixed with an underscore are reserved for internal use. + $defaults = array( + 'labels' => array(), 'description' => '', 'publicly_queryable' => null, 'exclude_from_search' => null, + 'capability_type' => 'post', 'capabilities' => array(), 'map_meta_cap' => null, + '_builtin' => false, '_edit_link' => 'post.php?post=%d', 'hierarchical' => false, + 'public' => false, 'rewrite' => true, 'has_archive' => false, 'query_var' => true, + 'supports' => array(), 'register_meta_box_cb' => null, + 'taxonomies' => array(), 'show_ui' => null, 'menu_position' => null, 'menu_icon' => null, + 'permalink_epmask' => EP_PERMALINK, 'can_export' => true, + 'show_in_nav_menus' => null, 'show_in_menu' => null, 'show_in_admin_bar' => null, + ); + $args = wp_parse_args($args, $defaults); + $args = (object) $args; + + $post_type = sanitize_key($post_type); + $args->name = $post_type; + + if ( strlen( $post_type ) > 20 ) + return new WP_Error( 'post_type_too_long', __( 'Post types cannot exceed 20 characters in length' ) ); + + // If not set, default to the setting for public. + if ( null === $args->publicly_queryable ) + $args->publicly_queryable = $args->public; + + // If not set, default to the setting for public. + if ( null === $args->show_ui ) + $args->show_ui = $args->public; + + // If not set, default to the setting for show_ui. + if ( null === $args->show_in_menu || ! $args->show_ui ) + $args->show_in_menu = $args->show_ui; + + // If not set, default to the whether the full UI is shown. + if ( null === $args->show_in_admin_bar ) + $args->show_in_admin_bar = true === $args->show_in_menu; + + // Whether to show this type in nav-menus.php. Defaults to the setting for public. + if ( null === $args->show_in_nav_menus ) + $args->show_in_nav_menus = $args->public; + + // If not set, default to true if not public, false if public. + if ( null === $args->exclude_from_search ) + $args->exclude_from_search = !$args->public; + + // Back compat with quirky handling in version 3.0. #14122 + if ( empty( $args->capabilities ) && null === $args->map_meta_cap && in_array( $args->capability_type, array( 'post', 'page' ) ) ) + $args->map_meta_cap = true; + + if ( null === $args->map_meta_cap ) + $args->map_meta_cap = false; + + $args->cap = get_post_type_capabilities( $args ); + unset($args->capabilities); + + if ( is_array( $args->capability_type ) ) + $args->capability_type = $args->capability_type[0]; + + if ( ! empty($args->supports) ) { + add_post_type_support($post_type, $args->supports); + unset($args->supports); + } else { + // Add default features + add_post_type_support($post_type, array('title', 'editor')); + } + + if ( false !== $args->query_var && !empty($wp) ) { + if ( true === $args->query_var ) + $args->query_var = $post_type; + $args->query_var = sanitize_title_with_dashes($args->query_var); + $wp->add_query_var($args->query_var); + } + + if ( false !== $args->rewrite && '' != get_option('permalink_structure') ) { + if ( ! is_array( $args->rewrite ) ) + $args->rewrite = array(); + if ( empty( $args->rewrite['slug'] ) ) + $args->rewrite['slug'] = $post_type; + if ( ! isset( $args->rewrite['with_front'] ) ) + $args->rewrite['with_front'] = true; + if ( ! isset( $args->rewrite['pages'] ) ) + $args->rewrite['pages'] = true; + if ( ! isset( $args->rewrite['feeds'] ) || ! $args->has_archive ) + $args->rewrite['feeds'] = (bool) $args->has_archive; + + if ( $args->hierarchical ) + $wp_rewrite->add_rewrite_tag("%$post_type%", '(.+?)', $args->query_var ? "{$args->query_var}=" : "post_type=$post_type&name="); + else + $wp_rewrite->add_rewrite_tag("%$post_type%", '([^/]+)', $args->query_var ? "{$args->query_var}=" : "post_type=$post_type&name="); + + if ( $args->has_archive ) { + $archive_slug = $args->has_archive === true ? $args->rewrite['slug'] : $args->has_archive; + if ( $args->rewrite['with_front'] ) + $archive_slug = substr( $wp_rewrite->front, 1 ) . $archive_slug; + else + $archive_slug = $wp_rewrite->root . $archive_slug; + + $wp_rewrite->add_rule( "{$archive_slug}/?$", "index.php?post_type=$post_type", 'top' ); + if ( $args->rewrite['feeds'] && $wp_rewrite->feeds ) { + $feeds = '(' . trim( implode( '|', $wp_rewrite->feeds ) ) . ')'; + $wp_rewrite->add_rule( "{$archive_slug}/feed/$feeds/?$", "index.php?post_type=$post_type" . '&feed=$matches[1]', 'top' ); + $wp_rewrite->add_rule( "{$archive_slug}/$feeds/?$", "index.php?post_type=$post_type" . '&feed=$matches[1]', 'top' ); + } + if ( $args->rewrite['pages'] ) + $wp_rewrite->add_rule( "{$archive_slug}/{$wp_rewrite->pagination_base}/([0-9]{1,})/?$", "index.php?post_type=$post_type" . '&paged=$matches[1]', 'top' ); + } + + $wp_rewrite->add_permastruct($post_type, "{$args->rewrite['slug']}/%$post_type%", $args->rewrite['with_front'], $args->permalink_epmask); + } + + if ( $args->register_meta_box_cb ) + add_action('add_meta_boxes_' . $post_type, $args->register_meta_box_cb, 10, 1); + + $args->labels = get_post_type_labels( $args ); + $args->label = $args->labels->name; + + $wp_post_types[$post_type] = $args; + + add_action( 'future_' . $post_type, '_future_post_hook', 5, 2 ); + + foreach ( $args->taxonomies as $taxonomy ) { + register_taxonomy_for_object_type( $taxonomy, $post_type ); + } + + return $args; +} + +/** + * Builds an object with all post type capabilities out of a post type object + * + * Post type capabilities use the 'capability_type' argument as a base, if the + * capability is not set in the 'capabilities' argument array or if the + * 'capabilities' argument is not supplied. + * + * The capability_type argument can optionally be registered as an array, with + * the first value being singular and the second plural, e.g. array('story, 'stories') + * Otherwise, an 's' will be added to the value for the plural form. After + * registration, capability_type will always be a string of the singular value. + * + * By default, seven keys are accepted as part of the capabilities array: + * + * - edit_post, read_post, and delete_post are meta capabilities, which are then + * generally mapped to corresponding primitive capabilities depending on the + * context, which would be the post being edited/read/deleted and the user or + * role being checked. Thus these capabilities would generally not be granted + * directly to users or roles. + * + * - edit_posts - Controls whether objects of this post type can be edited. + * - edit_others_posts - Controls whether objects of this type owned by other users + * can be edited. If the post type does not support an author, then this will + * behave like edit_posts. + * - publish_posts - Controls publishing objects of this post type. + * - read_private_posts - Controls whether private objects can be read. + + * These four primitive capabilities are checked in core in various locations. + * There are also seven other primitive capabilities which are not referenced + * directly in core, except in map_meta_cap(), which takes the three aforementioned + * meta capabilities and translates them into one or more primitive capabilities + * that must then be checked against the user or role, depending on the context. + * + * - read - Controls whether objects of this post type can be read. + * - delete_posts - Controls whether objects of this post type can be deleted. + * - delete_private_posts - Controls whether private objects can be deleted. + * - delete_published_posts - Controls whether published objects can be deleted. + * - delete_others_posts - Controls whether objects owned by other users can be + * can be deleted. If the post type does not support an author, then this will + * behave like delete_posts. + * - edit_private_posts - Controls whether private objects can be edited. + * - edit_published_posts - Controls whether published objects can be edited. + * + * These additional capabilities are only used in map_meta_cap(). Thus, they are + * only assigned by default if the post type is registered with the 'map_meta_cap' + * argument set to true (default is false). + * + * @see map_meta_cap() + * @since 3.0.0 + * + * @param object $args Post type registration arguments + * @return object object with all the capabilities as member variables + */ +function get_post_type_capabilities( $args ) { + if ( ! is_array( $args->capability_type ) ) + $args->capability_type = array( $args->capability_type, $args->capability_type . 's' ); + + // Singular base for meta capabilities, plural base for primitive capabilities. + list( $singular_base, $plural_base ) = $args->capability_type; + + $default_capabilities = array( + // Meta capabilities + 'edit_post' => 'edit_' . $singular_base, + 'read_post' => 'read_' . $singular_base, + 'delete_post' => 'delete_' . $singular_base, + // Primitive capabilities used outside of map_meta_cap(): + 'edit_posts' => 'edit_' . $plural_base, + 'edit_others_posts' => 'edit_others_' . $plural_base, + 'publish_posts' => 'publish_' . $plural_base, + 'read_private_posts' => 'read_private_' . $plural_base, + ); + + // Primitive capabilities used within map_meta_cap(): + if ( $args->map_meta_cap ) { + $default_capabilities_for_mapping = array( + 'read' => 'read', + 'delete_posts' => 'delete_' . $plural_base, + 'delete_private_posts' => 'delete_private_' . $plural_base, + 'delete_published_posts' => 'delete_published_' . $plural_base, + 'delete_others_posts' => 'delete_others_' . $plural_base, + 'edit_private_posts' => 'edit_private_' . $plural_base, + 'edit_published_posts' => 'edit_published_' . $plural_base, + ); + $default_capabilities = array_merge( $default_capabilities, $default_capabilities_for_mapping ); + } + + $capabilities = array_merge( $default_capabilities, $args->capabilities ); + + // Remember meta capabilities for future reference. + if ( $args->map_meta_cap ) + _post_type_meta_capabilities( $capabilities ); + + return (object) $capabilities; +} + +/** + * Stores or returns a list of post type meta caps for map_meta_cap(). + * + * @since 3.1.0 + * @access private + */ +function _post_type_meta_capabilities( $capabilities = null ) { + static $meta_caps = array(); + if ( null === $capabilities ) + return $meta_caps; + foreach ( $capabilities as $core => $custom ) { + if ( in_array( $core, array( 'read_post', 'delete_post', 'edit_post' ) ) ) + $meta_caps[ $custom ] = $core; + } +} + +/** + * Builds an object with all post type labels out of a post type object + * + * Accepted keys of the label array in the post type object: + * - name - general name for the post type, usually plural. The same and overriden by $post_type_object->label. Default is Posts/Pages + * - singular_name - name for one object of this post type. Default is Post/Page + * - add_new - Default is Add New for both hierarchical and non-hierarchical types. When internationalizing this string, please use a {@link http://codex.wordpress.org/I18n_for_WordPress_Developers#Disambiguation_by_context gettext context} matching your post type. Example: _x('Add New', 'product'); + * - add_new_item - Default is Add New Post/Add New Page + * - edit_item - Default is Edit Post/Edit Page + * - new_item - Default is New Post/New Page + * - view_item - Default is View Post/View Page + * - search_items - Default is Search Posts/Search Pages + * - not_found - Default is No posts found/No pages found + * - not_found_in_trash - Default is No posts found in Trash/No pages found in Trash + * - parent_item_colon - This string isn't used on non-hierarchical types. In hierarchical ones the default is Parent Page: + * + * Above, the first default value is for non-hierarchical post types (like posts) and the second one is for hierarchical post types (like pages). + * + * @since 3.0.0 + * @param object $post_type_object + * @return object object with all the labels as member variables + */ +function get_post_type_labels( $post_type_object ) { + $nohier_vs_hier_defaults = array( + 'name' => array( _x('Posts', 'post type general name'), _x('Pages', 'post type general name') ), + 'singular_name' => array( _x('Post', 'post type singular name'), _x('Page', 'post type singular name') ), + 'add_new' => array( _x('Add New', 'post'), _x('Add New', 'page') ), + 'add_new_item' => array( __('Add New Post'), __('Add New Page') ), + 'edit_item' => array( __('Edit Post'), __('Edit Page') ), + 'new_item' => array( __('New Post'), __('New Page') ), + 'view_item' => array( __('View Post'), __('View Page') ), + 'search_items' => array( __('Search Posts'), __('Search Pages') ), + 'not_found' => array( __('No posts found.'), __('No pages found.') ), + 'not_found_in_trash' => array( __('No posts found in Trash.'), __('No pages found in Trash.') ), + 'parent_item_colon' => array( null, __('Parent Page:') ), + 'all_items' => array( __( 'All Posts' ), __( 'All Pages' ) ) + ); + $nohier_vs_hier_defaults['menu_name'] = $nohier_vs_hier_defaults['name']; + return _get_custom_object_labels( $post_type_object, $nohier_vs_hier_defaults ); +} + +/** + * Builds an object with custom-something object (post type, taxonomy) labels out of a custom-something object + * + * @access private + * @since 3.0.0 + */ +function _get_custom_object_labels( $object, $nohier_vs_hier_defaults ) { + + if ( isset( $object->label ) && empty( $object->labels['name'] ) ) + $object->labels['name'] = $object->label; + + if ( !isset( $object->labels['singular_name'] ) && isset( $object->labels['name'] ) ) + $object->labels['singular_name'] = $object->labels['name']; + + if ( ! isset( $object->labels['name_admin_bar'] ) ) + $object->labels['name_admin_bar'] = isset( $object->labels['singular_name'] ) ? $object->labels['singular_name'] : $object->name; + + if ( !isset( $object->labels['menu_name'] ) && isset( $object->labels['name'] ) ) + $object->labels['menu_name'] = $object->labels['name']; + + if ( !isset( $object->labels['all_items'] ) && isset( $object->labels['menu_name'] ) ) + $object->labels['all_items'] = $object->labels['menu_name']; + + foreach ( $nohier_vs_hier_defaults as $key => $value ) + $defaults[$key] = $object->hierarchical ? $value[1] : $value[0]; + + $labels = array_merge( $defaults, $object->labels ); + return (object)$labels; +} + +/** + * Adds submenus for post types. + * + * @access private + * @since 3.1.0 + */ +function _add_post_type_submenus() { + foreach ( get_post_types( array( 'show_ui' => true ) ) as $ptype ) { + $ptype_obj = get_post_type_object( $ptype ); + // Submenus only. + if ( ! $ptype_obj->show_in_menu || $ptype_obj->show_in_menu === true ) + continue; + add_submenu_page( $ptype_obj->show_in_menu, $ptype_obj->labels->name, $ptype_obj->labels->all_items, $ptype_obj->cap->edit_posts, "edit.php?post_type=$ptype" ); + } +} +add_action( 'admin_menu', '_add_post_type_submenus' ); + +/** + * Register support of certain features for a post type. + * + * All features are directly associated with a functional area of the edit screen, such as the + * editor or a meta box: 'title', 'editor', 'comments', 'revisions', 'trackbacks', 'author', + * 'excerpt', 'page-attributes', 'thumbnail', and 'custom-fields'. + * + * Additionally, the 'revisions' feature dictates whether the post type will store revisions, + * and the 'comments' feature dicates whether the comments count will show on the edit screen. + * + * @since 3.0.0 + * @param string $post_type The post type for which to add the feature + * @param string|array $feature the feature being added, can be an array of feature strings or a single string + */ +function add_post_type_support( $post_type, $feature ) { + global $_wp_post_type_features; + + $features = (array) $feature; + foreach ($features as $feature) { + if ( func_num_args() == 2 ) + $_wp_post_type_features[$post_type][$feature] = true; + else + $_wp_post_type_features[$post_type][$feature] = array_slice( func_get_args(), 2 ); + } +} + +/** + * Remove support for a feature from a post type. + * + * @since 3.0.0 + * @param string $post_type The post type for which to remove the feature + * @param string $feature The feature being removed + */ +function remove_post_type_support( $post_type, $feature ) { + global $_wp_post_type_features; + + if ( !isset($_wp_post_type_features[$post_type]) ) + return; + + if ( isset($_wp_post_type_features[$post_type][$feature]) ) + unset($_wp_post_type_features[$post_type][$feature]); +} + +/** + * Checks a post type's support for a given feature + * + * @since 3.0.0 + * @param string $post_type The post type being checked + * @param string $feature the feature being checked + * @return boolean + */ + +function post_type_supports( $post_type, $feature ) { + global $_wp_post_type_features; + + if ( !isset( $_wp_post_type_features[$post_type][$feature] ) ) + return false; + + // If no args passed then no extra checks need be performed + if ( func_num_args() <= 2 ) + return true; + + // @todo Allow pluggable arg checking + //$args = array_slice( func_get_args(), 2 ); + + return true; +} + +/** + * Updates the post type for the post ID. + * + * The page or post cache will be cleaned for the post ID. + * + * @since 2.5.0 + * + * @uses $wpdb + * + * @param int $post_id Post ID to change post type. Not actually optional. + * @param string $post_type Optional, default is post. Supported values are 'post' or 'page' to + * name a few. + * @return int Amount of rows changed. Should be 1 for success and 0 for failure. + */ +function set_post_type( $post_id = 0, $post_type = 'post' ) { + global $wpdb; + + $post_type = sanitize_post_field('post_type', $post_type, $post_id, 'db'); + $return = $wpdb->update($wpdb->posts, array('post_type' => $post_type), array('ID' => $post_id) ); + + if ( 'page' == $post_type ) + clean_page_cache($post_id); + else + clean_post_cache($post_id); + + return $return; +} + +/** + * Retrieve list of latest posts or posts matching criteria. + * + * The defaults are as follows: + * 'numberposts' - Default is 5. Total number of posts to retrieve. + * 'offset' - Default is 0. See {@link WP_Query::query()} for more. + * 'category' - What category to pull the posts from. + * 'orderby' - Default is 'post_date'. How to order the posts. + * 'order' - Default is 'DESC'. The order to retrieve the posts. + * 'include' - See {@link WP_Query::query()} for more. + * 'exclude' - See {@link WP_Query::query()} for more. + * 'meta_key' - See {@link WP_Query::query()} for more. + * 'meta_value' - See {@link WP_Query::query()} for more. + * 'post_type' - Default is 'post'. Can be 'page', or 'attachment' to name a few. + * 'post_parent' - The parent of the post or post type. + * 'post_status' - Default is 'publish'. Post status to retrieve. + * + * @since 1.2.0 + * @uses $wpdb + * @uses WP_Query::query() See for more default arguments and information. + * @link http://codex.wordpress.org/Template_Tags/get_posts + * + * @param array $args Optional. Overrides defaults. + * @return array List of posts. + */ +function get_posts($args = null) { + $defaults = array( + 'numberposts' => 5, 'offset' => 0, + 'category' => 0, 'orderby' => 'post_date', + 'order' => 'DESC', 'include' => array(), + 'exclude' => array(), 'meta_key' => '', + 'meta_value' =>'', 'post_type' => 'post', + 'suppress_filters' => true + ); + + $r = wp_parse_args( $args, $defaults ); + if ( empty( $r['post_status'] ) ) + $r['post_status'] = ( 'attachment' == $r['post_type'] ) ? 'inherit' : 'publish'; + if ( ! empty($r['numberposts']) && empty($r['posts_per_page']) ) + $r['posts_per_page'] = $r['numberposts']; + if ( ! empty($r['category']) ) + $r['cat'] = $r['category']; + if ( ! empty($r['include']) ) { + $incposts = wp_parse_id_list( $r['include'] ); + $r['posts_per_page'] = count($incposts); // only the number of posts included + $r['post__in'] = $incposts; + } elseif ( ! empty($r['exclude']) ) + $r['post__not_in'] = wp_parse_id_list( $r['exclude'] ); + + $r['ignore_sticky_posts'] = true; + $r['no_found_rows'] = true; + + $get_posts = new WP_Query; + return $get_posts->query($r); + +} + +// +// Post meta functions +// + +/** + * Add meta data field to a post. + * + * Post meta data is called "Custom Fields" on the Administration Screen. + * + * @since 1.5.0 + * @uses $wpdb + * @link http://codex.wordpress.org/Function_Reference/add_post_meta + * + * @param int $post_id Post ID. + * @param string $meta_key Metadata name. + * @param mixed $meta_value Metadata value. + * @param bool $unique Optional, default is false. Whether the same key should not be added. + * @return bool False for failure. True for success. + */ +function add_post_meta($post_id, $meta_key, $meta_value, $unique = false) { + // make sure meta is added to the post, not a revision + if ( $the_post = wp_is_post_revision($post_id) ) + $post_id = $the_post; + + return add_metadata('post', $post_id, $meta_key, $meta_value, $unique); +} + +/** + * Remove metadata matching criteria from a post. + * + * You can match based on the key, or key and value. Removing based on key and + * value, will keep from removing duplicate metadata with the same key. It also + * allows removing all metadata matching key, if needed. + * + * @since 1.5.0 + * @uses $wpdb + * @link http://codex.wordpress.org/Function_Reference/delete_post_meta + * + * @param int $post_id post ID + * @param string $meta_key Metadata name. + * @param mixed $meta_value Optional. Metadata value. + * @return bool False for failure. True for success. + */ +function delete_post_meta($post_id, $meta_key, $meta_value = '') { + // make sure meta is added to the post, not a revision + if ( $the_post = wp_is_post_revision($post_id) ) + $post_id = $the_post; + + return delete_metadata('post', $post_id, $meta_key, $meta_value); +} + +/** + * Retrieve post meta field for a post. + * + * @since 1.5.0 + * @uses $wpdb + * @link http://codex.wordpress.org/Function_Reference/get_post_meta + * + * @param int $post_id Post ID. + * @param string $key The meta key to retrieve. + * @param bool $single Whether to return a single value. + * @return mixed Will be an array if $single is false. Will be value of meta data field if $single + * is true. + */ +function get_post_meta($post_id, $key, $single = false) { + return get_metadata('post', $post_id, $key, $single); +} + +/** + * Update post meta field based on post ID. + * + * Use the $prev_value parameter to differentiate between meta fields with the + * same key and post ID. + * + * If the meta field for the post does not exist, it will be added. + * + * @since 1.5.0 + * @uses $wpdb + * @link http://codex.wordpress.org/Function_Reference/update_post_meta + * + * @param int $post_id Post ID. + * @param string $meta_key Metadata key. + * @param mixed $meta_value Metadata value. + * @param mixed $prev_value Optional. Previous value to check before removing. + * @return bool False on failure, true if success. + */ +function update_post_meta($post_id, $meta_key, $meta_value, $prev_value = '') { + // make sure meta is added to the post, not a revision + if ( $the_post = wp_is_post_revision($post_id) ) + $post_id = $the_post; + + return update_metadata('post', $post_id, $meta_key, $meta_value, $prev_value); +} + +/** + * Delete everything from post meta matching meta key. + * + * @since 2.3.0 + * @uses $wpdb + * + * @param string $post_meta_key Key to search for when deleting. + * @return bool Whether the post meta key was deleted from the database + */ +function delete_post_meta_by_key($post_meta_key) { + if ( !$post_meta_key ) + return false; + + global $wpdb; + $post_ids = $wpdb->get_col($wpdb->prepare("SELECT DISTINCT post_id FROM $wpdb->postmeta WHERE meta_key = %s", $post_meta_key)); + if ( $post_ids ) { + $postmetaids = $wpdb->get_col( $wpdb->prepare( "SELECT meta_id FROM $wpdb->postmeta WHERE meta_key = %s", $post_meta_key ) ); + $in = implode( ',', array_fill(1, count($postmetaids), '%d')); + do_action( 'delete_postmeta', $postmetaids ); + $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->postmeta WHERE meta_id IN($in)", $postmetaids )); + do_action( 'deleted_postmeta', $postmetaids ); + foreach ( $post_ids as $post_id ) + wp_cache_delete($post_id, 'post_meta'); + return true; + } + return false; +} + +/** + * Retrieve post meta fields, based on post ID. + * + * The post meta fields are retrieved from the cache, so the function is + * optimized to be called more than once. It also applies to the functions, that + * use this function. + * + * @since 1.2.0 + * @link http://codex.wordpress.org/Function_Reference/get_post_custom + * + * @uses $id Current Loop Post ID + * + * @param int $post_id post ID + * @return array + */ +function get_post_custom( $post_id = 0 ) { + $post_id = absint( $post_id ); + + if ( ! $post_id ) + $post_id = get_the_ID(); + + if ( ! wp_cache_get( $post_id, 'post_meta' ) ) + update_postmeta_cache( $post_id ); + + return wp_cache_get( $post_id, 'post_meta' ); +} + +/** + * Retrieve meta field names for a post. + * + * If there are no meta fields, then nothing (null) will be returned. + * + * @since 1.2.0 + * @link http://codex.wordpress.org/Function_Reference/get_post_custom_keys + * + * @param int $post_id post ID + * @return array|null Either array of the keys, or null if keys could not be retrieved. + */ +function get_post_custom_keys( $post_id = 0 ) { + $custom = get_post_custom( $post_id ); + + if ( !is_array($custom) ) + return; + + if ( $keys = array_keys($custom) ) + return $keys; +} + +/** + * Retrieve values for a custom post field. + * + * The parameters must not be considered optional. All of the post meta fields + * will be retrieved and only the meta field key values returned. + * + * @since 1.2.0 + * @link http://codex.wordpress.org/Function_Reference/get_post_custom_values + * + * @param string $key Meta field key. + * @param int $post_id Post ID + * @return array Meta field values. + */ +function get_post_custom_values( $key = '', $post_id = 0 ) { + if ( !$key ) + return null; + + $custom = get_post_custom($post_id); + + return isset($custom[$key]) ? $custom[$key] : null; +} + +/** + * Check if post is sticky. + * + * Sticky posts should remain at the top of The Loop. If the post ID is not + * given, then The Loop ID for the current post will be used. + * + * @since 2.7.0 + * + * @param int $post_id Optional. Post ID. + * @return bool Whether post is sticky. + */ +function is_sticky( $post_id = 0 ) { + $post_id = absint( $post_id ); + + if ( ! $post_id ) + $post_id = get_the_ID(); + + $stickies = get_option( 'sticky_posts' ); + + if ( ! is_array( $stickies ) ) + return false; + + if ( in_array( $post_id, $stickies ) ) + return true; + + return false; +} + +/** + * Sanitize every post field. + * + * If the context is 'raw', then the post object or array will get minimal santization of the int fields. + * + * @since 2.3.0 + * @uses sanitize_post_field() Used to sanitize the fields. + * + * @param object|array $post The Post Object or Array + * @param string $context Optional, default is 'display'. How to sanitize post fields. + * @return object|array The now sanitized Post Object or Array (will be the same type as $post) + */ +function sanitize_post($post, $context = 'display') { + if ( is_object($post) ) { + // Check if post already filtered for this context + if ( isset($post->filter) && $context == $post->filter ) + return $post; + if ( !isset($post->ID) ) + $post->ID = 0; + foreach ( array_keys(get_object_vars($post)) as $field ) + $post->$field = sanitize_post_field($field, $post->$field, $post->ID, $context); + $post->filter = $context; + } else { + // Check if post already filtered for this context + if ( isset($post['filter']) && $context == $post['filter'] ) + return $post; + if ( !isset($post['ID']) ) + $post['ID'] = 0; + foreach ( array_keys($post) as $field ) + $post[$field] = sanitize_post_field($field, $post[$field], $post['ID'], $context); + $post['filter'] = $context; + } + return $post; +} + +/** + * Sanitize post field based on context. + * + * Possible context values are: 'raw', 'edit', 'db', 'display', 'attribute' and 'js'. The + * 'display' context is used by default. 'attribute' and 'js' contexts are treated like 'display' + * when calling filters. + * + * @since 2.3.0 + * @uses apply_filters() Calls 'edit_$field' and '{$field_no_prefix}_edit_pre' passing $value and + * $post_id if $context == 'edit' and field name prefix == 'post_'. + * + * @uses apply_filters() Calls 'edit_post_$field' passing $value and $post_id if $context == 'db'. + * @uses apply_filters() Calls 'pre_$field' passing $value if $context == 'db' and field name prefix == 'post_'. + * @uses apply_filters() Calls '{$field}_pre' passing $value if $context == 'db' and field name prefix != 'post_'. + * + * @uses apply_filters() Calls '$field' passing $value, $post_id and $context if $context == anything + * other than 'raw', 'edit' and 'db' and field name prefix == 'post_'. + * @uses apply_filters() Calls 'post_$field' passing $value if $context == anything other than 'raw', + * 'edit' and 'db' and field name prefix != 'post_'. + * + * @param string $field The Post Object field name. + * @param mixed $value The Post Object value. + * @param int $post_id Post ID. + * @param string $context How to sanitize post fields. Looks for 'raw', 'edit', 'db', 'display', + * 'attribute' and 'js'. + * @return mixed Sanitized value. + */ +function sanitize_post_field($field, $value, $post_id, $context) { + $int_fields = array('ID', 'post_parent', 'menu_order'); + if ( in_array($field, $int_fields) ) + $value = (int) $value; + + // Fields which contain arrays of ints. + $array_int_fields = array( 'ancestors' ); + if ( in_array($field, $array_int_fields) ) { + $value = array_map( 'absint', $value); + return $value; + } + + if ( 'raw' == $context ) + return $value; + + $prefixed = false; + if ( false !== strpos($field, 'post_') ) { + $prefixed = true; + $field_no_prefix = str_replace('post_', '', $field); + } + + if ( 'edit' == $context ) { + $format_to_edit = array('post_content', 'post_excerpt', 'post_title', 'post_password'); + + if ( $prefixed ) { + $value = apply_filters("edit_{$field}", $value, $post_id); + // Old school + $value = apply_filters("{$field_no_prefix}_edit_pre", $value, $post_id); + } else { + $value = apply_filters("edit_post_{$field}", $value, $post_id); + } + + if ( in_array($field, $format_to_edit) ) { + if ( 'post_content' == $field ) + $value = format_to_edit($value, user_can_richedit()); + else + $value = format_to_edit($value); + } else { + $value = esc_attr($value); + } + } else if ( 'db' == $context ) { + if ( $prefixed ) { + $value = apply_filters("pre_{$field}", $value); + $value = apply_filters("{$field_no_prefix}_save_pre", $value); + } else { + $value = apply_filters("pre_post_{$field}", $value); + $value = apply_filters("{$field}_pre", $value); + } + } else { + // Use display filters by default. + if ( $prefixed ) + $value = apply_filters($field, $value, $post_id, $context); + else + $value = apply_filters("post_{$field}", $value, $post_id, $context); + } + + if ( 'attribute' == $context ) + $value = esc_attr($value); + else if ( 'js' == $context ) + $value = esc_js($value); + + return $value; +} + +/** + * Make a post sticky. + * + * Sticky posts should be displayed at the top of the front page. + * + * @since 2.7.0 + * + * @param int $post_id Post ID. + */ +function stick_post($post_id) { + $stickies = get_option('sticky_posts'); + + if ( !is_array($stickies) ) + $stickies = array($post_id); + + if ( ! in_array($post_id, $stickies) ) + $stickies[] = $post_id; + + update_option('sticky_posts', $stickies); +} + +/** + * Unstick a post. + * + * Sticky posts should be displayed at the top of the front page. + * + * @since 2.7.0 + * + * @param int $post_id Post ID. + */ +function unstick_post($post_id) { + $stickies = get_option('sticky_posts'); + + if ( !is_array($stickies) ) + return; + + if ( ! in_array($post_id, $stickies) ) + return; + + $offset = array_search($post_id, $stickies); + if ( false === $offset ) + return; + + array_splice($stickies, $offset, 1); + + update_option('sticky_posts', $stickies); +} + +/** + * Count number of posts of a post type and is user has permissions to view. + * + * This function provides an efficient method of finding the amount of post's + * type a blog has. Another method is to count the amount of items in + * get_posts(), but that method has a lot of overhead with doing so. Therefore, + * when developing for 2.5+, use this function instead. + * + * The $perm parameter checks for 'readable' value and if the user can read + * private posts, it will display that for the user that is signed in. + * + * @since 2.5.0 + * @link http://codex.wordpress.org/Template_Tags/wp_count_posts + * + * @param string $type Optional. Post type to retrieve count + * @param string $perm Optional. 'readable' or empty. + * @return object Number of posts for each status + */ +function wp_count_posts( $type = 'post', $perm = '' ) { + global $wpdb; + + $user = wp_get_current_user(); + + $cache_key = $type; + + $query = "SELECT post_status, COUNT( * ) AS num_posts FROM {$wpdb->posts} WHERE post_type = %s"; + if ( 'readable' == $perm && is_user_logged_in() ) { + $post_type_object = get_post_type_object($type); + if ( !current_user_can( $post_type_object->cap->read_private_posts ) ) { + $cache_key .= '_' . $perm . '_' . $user->ID; + $query .= " AND (post_status != 'private' OR ( post_author = '$user->ID' AND post_status = 'private' ))"; + } + } + $query .= ' GROUP BY post_status'; + + $count = wp_cache_get($cache_key, 'counts'); + if ( false !== $count ) + return $count; + + $count = $wpdb->get_results( $wpdb->prepare( $query, $type ), ARRAY_A ); + + $stats = array(); + foreach ( get_post_stati() as $state ) + $stats[$state] = 0; + + foreach ( (array) $count as $row ) + $stats[$row['post_status']] = $row['num_posts']; + + $stats = (object) $stats; + wp_cache_set($cache_key, $stats, 'counts'); + + return $stats; +} + + +/** + * Count number of attachments for the mime type(s). + * + * If you set the optional mime_type parameter, then an array will still be + * returned, but will only have the item you are looking for. It does not give + * you the number of attachments that are children of a post. You can get that + * by counting the number of children that post has. + * + * @since 2.5.0 + * + * @param string|array $mime_type Optional. Array or comma-separated list of MIME patterns. + * @return array Number of posts for each mime type. + */ +function wp_count_attachments( $mime_type = '' ) { + global $wpdb; + + $and = wp_post_mime_type_where( $mime_type ); + $count = $wpdb->get_results( "SELECT post_mime_type, COUNT( * ) AS num_posts FROM $wpdb->posts WHERE post_type = 'attachment' AND post_status != 'trash' $and GROUP BY post_mime_type", ARRAY_A ); + + $stats = array( ); + foreach( (array) $count as $row ) { + $stats[$row['post_mime_type']] = $row['num_posts']; + } + $stats['trash'] = $wpdb->get_var( "SELECT COUNT( * ) FROM $wpdb->posts WHERE post_type = 'attachment' AND post_status = 'trash' $and"); + + return (object) $stats; +} + +/** + * Check a MIME-Type against a list. + * + * If the wildcard_mime_types parameter is a string, it must be comma separated + * list. If the real_mime_types is a string, it is also comma separated to + * create the list. + * + * @since 2.5.0 + * + * @param string|array $wildcard_mime_types e.g. audio/mpeg or image (same as image/*) or + * flash (same as *flash*). + * @param string|array $real_mime_types post_mime_type values + * @return array array(wildcard=>array(real types)) + */ +function wp_match_mime_types($wildcard_mime_types, $real_mime_types) { + $matches = array(); + if ( is_string($wildcard_mime_types) ) + $wildcard_mime_types = array_map('trim', explode(',', $wildcard_mime_types)); + if ( is_string($real_mime_types) ) + $real_mime_types = array_map('trim', explode(',', $real_mime_types)); + $wild = '[-._a-z0-9]*'; + foreach ( (array) $wildcard_mime_types as $type ) { + $type = str_replace('*', $wild, $type); + $patternses[1][$type] = "^$type$"; + if ( false === strpos($type, '/') ) { + $patternses[2][$type] = "^$type/"; + $patternses[3][$type] = $type; + } + } + asort($patternses); + foreach ( $patternses as $patterns ) + foreach ( $patterns as $type => $pattern ) + foreach ( (array) $real_mime_types as $real ) + if ( preg_match("#$pattern#", $real) && ( empty($matches[$type]) || false === array_search($real, $matches[$type]) ) ) + $matches[$type][] = $real; + return $matches; +} + +/** + * Convert MIME types into SQL. + * + * @since 2.5.0 + * + * @param string|array $post_mime_types List of mime types or comma separated string of mime types. + * @param string $table_alias Optional. Specify a table alias, if needed. + * @return string The SQL AND clause for mime searching. + */ +function wp_post_mime_type_where($post_mime_types, $table_alias = '') { + $where = ''; + $wildcards = array('', '%', '%/%'); + if ( is_string($post_mime_types) ) + $post_mime_types = array_map('trim', explode(',', $post_mime_types)); + foreach ( (array) $post_mime_types as $mime_type ) { + $mime_type = preg_replace('/\s/', '', $mime_type); + $slashpos = strpos($mime_type, '/'); + if ( false !== $slashpos ) { + $mime_group = preg_replace('/[^-*.a-zA-Z0-9]/', '', substr($mime_type, 0, $slashpos)); + $mime_subgroup = preg_replace('/[^-*.+a-zA-Z0-9]/', '', substr($mime_type, $slashpos + 1)); + if ( empty($mime_subgroup) ) + $mime_subgroup = '*'; + else + $mime_subgroup = str_replace('/', '', $mime_subgroup); + $mime_pattern = "$mime_group/$mime_subgroup"; + } else { + $mime_pattern = preg_replace('/[^-*.a-zA-Z0-9]/', '', $mime_type); + if ( false === strpos($mime_pattern, '*') ) + $mime_pattern .= '/*'; + } + + $mime_pattern = preg_replace('/\*+/', '%', $mime_pattern); + + if ( in_array( $mime_type, $wildcards ) ) + return ''; + + if ( false !== strpos($mime_pattern, '%') ) + $wheres[] = empty($table_alias) ? "post_mime_type LIKE '$mime_pattern'" : "$table_alias.post_mime_type LIKE '$mime_pattern'"; + else + $wheres[] = empty($table_alias) ? "post_mime_type = '$mime_pattern'" : "$table_alias.post_mime_type = '$mime_pattern'"; + } + if ( !empty($wheres) ) + $where = ' AND (' . join(' OR ', $wheres) . ') '; + return $where; +} + +/** + * Trashes or deletes a post or page. + * + * When the post and page is permanently deleted, everything that is tied to it is deleted also. + * This includes comments, post meta fields, and terms associated with the post. + * + * The post or page is moved to trash instead of permanently deleted unless trash is + * disabled, item is already in the trash, or $force_delete is true. + * + * @since 1.0.0 + * @uses do_action() on 'delete_post' before deletion unless post type is 'attachment'. + * @uses do_action() on 'deleted_post' after deletion unless post type is 'attachment'. + * @uses wp_delete_attachment() if post type is 'attachment'. + * @uses wp_trash_post() if item should be trashed. + * + * @param int $postid Post ID. + * @param bool $force_delete Whether to bypass trash and force deletion. Defaults to false. + * @return mixed False on failure + */ +function wp_delete_post( $postid = 0, $force_delete = false ) { + global $wpdb, $wp_rewrite; + + if ( !$post = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->posts WHERE ID = %d", $postid)) ) + return $post; + + if ( !$force_delete && ( $post->post_type == 'post' || $post->post_type == 'page') && get_post_status( $postid ) != 'trash' && EMPTY_TRASH_DAYS ) + return wp_trash_post($postid); + + if ( $post->post_type == 'attachment' ) + return wp_delete_attachment( $postid, $force_delete ); + + do_action('before_delete_post', $postid); + + delete_post_meta($postid,'_wp_trash_meta_status'); + delete_post_meta($postid,'_wp_trash_meta_time'); + + wp_delete_object_term_relationships($postid, get_object_taxonomies($post->post_type)); + + $parent_data = array( 'post_parent' => $post->post_parent ); + $parent_where = array( 'post_parent' => $postid ); + + if ( 'page' == $post->post_type) { + // if the page is defined in option page_on_front or post_for_posts, + // adjust the corresponding options + if ( get_option('page_on_front') == $postid ) { + update_option('show_on_front', 'posts'); + delete_option('page_on_front'); + } + if ( get_option('page_for_posts') == $postid ) { + delete_option('page_for_posts'); + } + + // Point children of this page to its parent, also clean the cache of affected children + $children_query = $wpdb->prepare("SELECT * FROM $wpdb->posts WHERE post_parent = %d AND post_type='page'", $postid); + $children = $wpdb->get_results($children_query); + + $wpdb->update( $wpdb->posts, $parent_data, $parent_where + array( 'post_type' => 'page' ) ); + } else { + unstick_post($postid); + } + + // Do raw query. wp_get_post_revisions() is filtered + $revision_ids = $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_parent = %d AND post_type = 'revision'", $postid ) ); + // Use wp_delete_post (via wp_delete_post_revision) again. Ensures any meta/misplaced data gets cleaned up. + foreach ( $revision_ids as $revision_id ) + wp_delete_post_revision( $revision_id ); + + // Point all attachments to this post up one level + $wpdb->update( $wpdb->posts, $parent_data, $parent_where + array( 'post_type' => 'attachment' ) ); + + $comment_ids = $wpdb->get_col( $wpdb->prepare( "SELECT comment_ID FROM $wpdb->comments WHERE comment_post_ID = %d", $postid )); + if ( ! empty($comment_ids) ) { + do_action( 'delete_comment', $comment_ids ); + foreach ( $comment_ids as $comment_id ) + wp_delete_comment( $comment_id, true ); + do_action( 'deleted_comment', $comment_ids ); + } + + $post_meta_ids = $wpdb->get_col( $wpdb->prepare( "SELECT meta_id FROM $wpdb->postmeta WHERE post_id = %d ", $postid )); + if ( !empty($post_meta_ids) ) { + do_action( 'delete_postmeta', $post_meta_ids ); + $in_post_meta_ids = "'" . implode("', '", $post_meta_ids) . "'"; + $wpdb->query( "DELETE FROM $wpdb->postmeta WHERE meta_id IN($in_post_meta_ids)" ); + do_action( 'deleted_postmeta', $post_meta_ids ); + } + + do_action( 'delete_post', $postid ); + $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->posts WHERE ID = %d", $postid )); + do_action( 'deleted_post', $postid ); + + if ( 'page' == $post->post_type ) { + clean_page_cache($postid); + + foreach ( (array) $children as $child ) + clean_page_cache($child->ID); + + $wp_rewrite->flush_rules(false); + } else { + clean_post_cache($postid); + } + + wp_clear_scheduled_hook('publish_future_post', array( $postid ) ); + + do_action('after_delete_post', $postid); + + return $post; +} + +/** + * Moves a post or page to the Trash + * + * If trash is disabled, the post or page is permanently deleted. + * + * @since 2.9.0 + * @uses do_action() on 'trash_post' before trashing + * @uses do_action() on 'trashed_post' after trashing + * @uses wp_delete_post() if trash is disabled + * + * @param int $post_id Post ID. + * @return mixed False on failure + */ +function wp_trash_post($post_id = 0) { + if ( !EMPTY_TRASH_DAYS ) + return wp_delete_post($post_id, true); + + if ( !$post = wp_get_single_post($post_id, ARRAY_A) ) + return $post; + + if ( $post['post_status'] == 'trash' ) + return false; + + do_action('trash_post', $post_id); + + add_post_meta($post_id,'_wp_trash_meta_status', $post['post_status']); + add_post_meta($post_id,'_wp_trash_meta_time', time()); + + $post['post_status'] = 'trash'; + wp_insert_post($post); + + wp_trash_post_comments($post_id); + + do_action('trashed_post', $post_id); + + return $post; +} + +/** + * Restores a post or page from the Trash + * + * @since 2.9.0 + * @uses do_action() on 'untrash_post' before undeletion + * @uses do_action() on 'untrashed_post' after undeletion + * + * @param int $post_id Post ID. + * @return mixed False on failure + */ +function wp_untrash_post($post_id = 0) { + if ( !$post = wp_get_single_post($post_id, ARRAY_A) ) + return $post; + + if ( $post['post_status'] != 'trash' ) + return false; + + do_action('untrash_post', $post_id); + + $post_status = get_post_meta($post_id, '_wp_trash_meta_status', true); + + $post['post_status'] = $post_status; + + delete_post_meta($post_id, '_wp_trash_meta_status'); + delete_post_meta($post_id, '_wp_trash_meta_time'); + + wp_insert_post($post); + + wp_untrash_post_comments($post_id); + + do_action('untrashed_post', $post_id); + + return $post; +} + +/** + * Moves comments for a post to the trash + * + * @since 2.9.0 + * @uses do_action() on 'trash_post_comments' before trashing + * @uses do_action() on 'trashed_post_comments' after trashing + * + * @param int $post Post ID or object. + * @return mixed False on failure + */ +function wp_trash_post_comments($post = null) { + global $wpdb; + + $post = get_post($post); + if ( empty($post) ) + return; + + $post_id = $post->ID; + + do_action('trash_post_comments', $post_id); + + $comments = $wpdb->get_results( $wpdb->prepare("SELECT comment_ID, comment_approved FROM $wpdb->comments WHERE comment_post_ID = %d", $post_id) ); + if ( empty($comments) ) + return; + + // Cache current status for each comment + $statuses = array(); + foreach ( $comments as $comment ) + $statuses[$comment->comment_ID] = $comment->comment_approved; + add_post_meta($post_id, '_wp_trash_meta_comments_status', $statuses); + + // Set status for all comments to post-trashed + $result = $wpdb->update($wpdb->comments, array('comment_approved' => 'post-trashed'), array('comment_post_ID' => $post_id)); + + clean_comment_cache( array_keys($statuses) ); + + do_action('trashed_post_comments', $post_id, $statuses); + + return $result; +} + +/** + * Restore comments for a post from the trash + * + * @since 2.9.0 + * @uses do_action() on 'untrash_post_comments' before trashing + * @uses do_action() on 'untrashed_post_comments' after trashing + * + * @param int $post Post ID or object. + * @return mixed False on failure + */ +function wp_untrash_post_comments($post = null) { + global $wpdb; + + $post = get_post($post); + if ( empty($post) ) + return; + + $post_id = $post->ID; + + $statuses = get_post_meta($post_id, '_wp_trash_meta_comments_status', true); + + if ( empty($statuses) ) + return true; + + do_action('untrash_post_comments', $post_id); + + // Restore each comment to its original status + $group_by_status = array(); + foreach ( $statuses as $comment_id => $comment_status ) + $group_by_status[$comment_status][] = $comment_id; + + foreach ( $group_by_status as $status => $comments ) { + // Sanity check. This shouldn't happen. + if ( 'post-trashed' == $status ) + $status = '0'; + $comments_in = implode( "', '", $comments ); + $wpdb->query( "UPDATE $wpdb->comments SET comment_approved = '$status' WHERE comment_ID IN ('" . $comments_in . "')" ); + } + + clean_comment_cache( array_keys($statuses) ); + + delete_post_meta($post_id, '_wp_trash_meta_comments_status'); + + do_action('untrashed_post_comments', $post_id); +} + +/** + * Retrieve the list of categories for a post. + * + * Compatibility layer for themes and plugins. Also an easy layer of abstraction + * away from the complexity of the taxonomy layer. + * + * @since 2.1.0 + * + * @uses wp_get_object_terms() Retrieves the categories. Args details can be found here. + * + * @param int $post_id Optional. The Post ID. + * @param array $args Optional. Overwrite the defaults. + * @return array + */ +function wp_get_post_categories( $post_id = 0, $args = array() ) { + $post_id = (int) $post_id; + + $defaults = array('fields' => 'ids'); + $args = wp_parse_args( $args, $defaults ); + + $cats = wp_get_object_terms($post_id, 'category', $args); + return $cats; +} + +/** + * Retrieve the tags for a post. + * + * There is only one default for this function, called 'fields' and by default + * is set to 'all'. There are other defaults that can be overridden in + * {@link wp_get_object_terms()}. + * + * @package WordPress + * @subpackage Post + * @since 2.3.0 + * + * @uses wp_get_object_terms() Gets the tags for returning. Args can be found here + * + * @param int $post_id Optional. The Post ID + * @param array $args Optional. Overwrite the defaults + * @return array List of post tags. + */ +function wp_get_post_tags( $post_id = 0, $args = array() ) { + return wp_get_post_terms( $post_id, 'post_tag', $args); +} + +/** + * Retrieve the terms for a post. + * + * There is only one default for this function, called 'fields' and by default + * is set to 'all'. There are other defaults that can be overridden in + * {@link wp_get_object_terms()}. + * + * @package WordPress + * @subpackage Post + * @since 2.8.0 + * + * @uses wp_get_object_terms() Gets the tags for returning. Args can be found here + * + * @param int $post_id Optional. The Post ID + * @param string $taxonomy The taxonomy for which to retrieve terms. Defaults to post_tag. + * @param array $args Optional. Overwrite the defaults + * @return array List of post tags. + */ +function wp_get_post_terms( $post_id = 0, $taxonomy = 'post_tag', $args = array() ) { + $post_id = (int) $post_id; + + $defaults = array('fields' => 'all'); + $args = wp_parse_args( $args, $defaults ); + + $tags = wp_get_object_terms($post_id, $taxonomy, $args); + + return $tags; +} + +/** + * Retrieve number of recent posts. + * + * @since 1.0.0 + * @uses wp_parse_args() + * @uses get_posts() + * + * @param string $deprecated Deprecated. + * @param array $args Optional. Overrides defaults. + * @param string $output Optional. + * @return unknown. + */ +function wp_get_recent_posts( $args = array(), $output = ARRAY_A ) { + + if ( is_numeric( $args ) ) { + _deprecated_argument( __FUNCTION__, '3.1', __( 'Passing an integer number of posts is deprecated. Pass an array of arguments instead.' ) ); + $args = array( 'numberposts' => absint( $args ) ); + } + + // Set default arguments + $defaults = array( + 'numberposts' => 10, 'offset' => 0, + 'category' => 0, 'orderby' => 'post_date', + 'order' => 'DESC', 'include' => '', + 'exclude' => '', 'meta_key' => '', + 'meta_value' =>'', 'post_type' => 'post', 'post_status' => 'draft, publish, future, pending, private', + 'suppress_filters' => true + ); + + $r = wp_parse_args( $args, $defaults ); + + $results = get_posts( $r ); + + // Backward compatibility. Prior to 3.1 expected posts to be returned in array + if ( ARRAY_A == $output ){ + foreach( $results as $key => $result ) { + $results[$key] = get_object_vars( $result ); + } + return $results ? $results : array(); + } + + return $results ? $results : false; + +} + +/** + * Retrieve a single post, based on post ID. + * + * Has categories in 'post_category' property or key. Has tags in 'tags_input' + * property or key. + * + * @since 1.0.0 + * + * @param int $postid Post ID. + * @param string $mode How to return result, either OBJECT, ARRAY_N, or ARRAY_A. + * @return object|array Post object or array holding post contents and information + */ +function wp_get_single_post($postid = 0, $mode = OBJECT) { + $postid = (int) $postid; + + $post = get_post($postid, $mode); + + if ( + ( OBJECT == $mode && empty( $post->ID ) ) || + ( OBJECT != $mode && empty( $post['ID'] ) ) + ) + return ( OBJECT == $mode ? null : array() ); + + // Set categories and tags + if ( $mode == OBJECT ) { + $post->post_category = array(); + if ( is_object_in_taxonomy($post->post_type, 'category') ) + $post->post_category = wp_get_post_categories($postid); + $post->tags_input = array(); + if ( is_object_in_taxonomy($post->post_type, 'post_tag') ) + $post->tags_input = wp_get_post_tags($postid, array('fields' => 'names')); + } else { + $post['post_category'] = array(); + if ( is_object_in_taxonomy($post['post_type'], 'category') ) + $post['post_category'] = wp_get_post_categories($postid); + $post['tags_input'] = array(); + if ( is_object_in_taxonomy($post['post_type'], 'post_tag') ) + $post['tags_input'] = wp_get_post_tags($postid, array('fields' => 'names')); + } + + return $post; +} + +/** + * Insert a post. + * + * If the $postarr parameter has 'ID' set to a value, then post will be updated. + * + * You can set the post date manually, but setting the values for 'post_date' + * and 'post_date_gmt' keys. You can close the comments or open the comments by + * setting the value for 'comment_status' key. + * + * The defaults for the parameter $postarr are: + * 'post_status' - Default is 'draft'. + * 'post_type' - Default is 'post'. + * 'post_author' - Default is current user ID ($user_ID). The ID of the user who added the post. + * 'ping_status' - Default is the value in 'default_ping_status' option. + * Whether the attachment can accept pings. + * 'post_parent' - Default is 0. Set this for the post it belongs to, if any. + * 'menu_order' - Default is 0. The order it is displayed. + * 'to_ping' - Whether to ping. + * 'pinged' - Default is empty string. + * 'post_password' - Default is empty string. The password to access the attachment. + * 'guid' - Global Unique ID for referencing the attachment. + * 'post_content_filtered' - Post content filtered. + * 'post_excerpt' - Post excerpt. + * + * @since 1.0.0 + * @uses $wpdb + * @uses $wp_rewrite + * @uses $user_ID + * @uses do_action() Calls 'pre_post_update' on post ID if this is an update. + * @uses do_action() Calls 'edit_post' action on post ID and post data if this is an update. + * @uses do_action() Calls 'save_post' and 'wp_insert_post' on post id and post data just before returning. + * @uses apply_filters() Calls 'wp_insert_post_data' passing $data, $postarr prior to database update or insert. + * @uses wp_transition_post_status() + * + * @param array $postarr Elements that make up post to insert. + * @param bool $wp_error Optional. Allow return of WP_Error on failure. + * @return int|WP_Error The value 0 or WP_Error on failure. The post ID on success. + */ +function wp_insert_post($postarr, $wp_error = false) { + global $wpdb, $wp_rewrite, $user_ID; + + $defaults = array('post_status' => 'draft', 'post_type' => 'post', 'post_author' => $user_ID, + 'ping_status' => get_option('default_ping_status'), 'post_parent' => 0, + 'menu_order' => 0, 'to_ping' => '', 'pinged' => '', 'post_password' => '', + 'guid' => '', 'post_content_filtered' => '', 'post_excerpt' => '', 'import_id' => 0, + 'post_content' => '', 'post_title' => ''); + + $postarr = wp_parse_args($postarr, $defaults); + + unset( $postarr[ 'filter' ] ); + + $postarr = sanitize_post($postarr, 'db'); + + // export array as variables + extract($postarr, EXTR_SKIP); + + // Are we updating or creating? + $update = false; + if ( !empty($ID) ) { + $update = true; + $previous_status = get_post_field('post_status', $ID); + } else { + $previous_status = 'new'; + } + + if ( ('' == $post_content) && ('' == $post_title) && ('' == $post_excerpt) && ('attachment' != $post_type) ) { + if ( $wp_error ) + return new WP_Error('empty_content', __('Content, title, and excerpt are empty.')); + else + return 0; + } + + if ( empty($post_type) ) + $post_type = 'post'; + + if ( empty($post_status) ) + $post_status = 'draft'; + + if ( !empty($post_category) ) + $post_category = array_filter($post_category); // Filter out empty terms + + // Make sure we set a valid category. + if ( empty($post_category) || 0 == count($post_category) || !is_array($post_category) ) { + // 'post' requires at least one category. + if ( 'post' == $post_type && 'auto-draft' != $post_status ) + $post_category = array( get_option('default_category') ); + else + $post_category = array(); + } + + if ( empty($post_author) ) + $post_author = $user_ID; + + $post_ID = 0; + + // Get the post ID and GUID + if ( $update ) { + $post_ID = (int) $ID; + $guid = get_post_field( 'guid', $post_ID ); + $post_before = get_post($post_ID); + } + + // Don't allow contributors to set the post slug for pending review posts + if ( 'pending' == $post_status && !current_user_can( 'publish_posts' ) ) + $post_name = ''; + + // Create a valid post name. Drafts and pending posts are allowed to have an empty + // post name. + if ( empty($post_name) ) { + if ( !in_array( $post_status, array( 'draft', 'pending', 'auto-draft' ) ) ) + $post_name = sanitize_title($post_title); + else + $post_name = ''; + } else { + $post_name = sanitize_title($post_name); + } + + // If the post date is empty (due to having been new or a draft) and status is not 'draft' or 'pending', set date to now + if ( empty($post_date) || '0000-00-00 00:00:00' == $post_date ) + $post_date = current_time('mysql'); + + if ( empty($post_date_gmt) || '0000-00-00 00:00:00' == $post_date_gmt ) { + if ( !in_array( $post_status, array( 'draft', 'pending', 'auto-draft' ) ) ) + $post_date_gmt = get_gmt_from_date($post_date); + else + $post_date_gmt = '0000-00-00 00:00:00'; + } + + if ( $update || '0000-00-00 00:00:00' == $post_date ) { + $post_modified = current_time( 'mysql' ); + $post_modified_gmt = current_time( 'mysql', 1 ); + } else { + $post_modified = $post_date; + $post_modified_gmt = $post_date_gmt; + } + + if ( 'publish' == $post_status ) { + $now = gmdate('Y-m-d H:i:59'); + if ( mysql2date('U', $post_date_gmt, false) > mysql2date('U', $now, false) ) + $post_status = 'future'; + } elseif( 'future' == $post_status ) { + $now = gmdate('Y-m-d H:i:59'); + if ( mysql2date('U', $post_date_gmt, false) <= mysql2date('U', $now, false) ) + $post_status = 'publish'; + } + + if ( empty($comment_status) ) { + if ( $update ) + $comment_status = 'closed'; + else + $comment_status = get_option('default_comment_status'); + } + if ( empty($ping_status) ) + $ping_status = get_option('default_ping_status'); + + if ( isset($to_ping) ) + $to_ping = preg_replace('|\s+|', "\n", $to_ping); + else + $to_ping = ''; + + if ( ! isset($pinged) ) + $pinged = ''; + + if ( isset($post_parent) ) + $post_parent = (int) $post_parent; + else + $post_parent = 0; + + // Check the post_parent to see if it will cause a hierarchy loop + $post_parent = apply_filters( 'wp_insert_post_parent', $post_parent, $post_ID, compact( array_keys( $postarr ) ), $postarr ); + + if ( isset($menu_order) ) + $menu_order = (int) $menu_order; + else + $menu_order = 0; + + if ( !isset($post_password) || 'private' == $post_status ) + $post_password = ''; + + $post_name = wp_unique_post_slug($post_name, $post_ID, $post_status, $post_type, $post_parent); + + // expected_slashed (everything!) + $data = compact( array( 'post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_content_filtered', 'post_title', 'post_excerpt', 'post_status', 'post_type', 'comment_status', 'ping_status', 'post_password', 'post_name', 'to_ping', 'pinged', 'post_modified', 'post_modified_gmt', 'post_parent', 'menu_order', 'guid' ) ); + $data = apply_filters('wp_insert_post_data', $data, $postarr); + $data = stripslashes_deep( $data ); + $where = array( 'ID' => $post_ID ); + + if ( $update ) { + do_action( 'pre_post_update', $post_ID ); + if ( false === $wpdb->update( $wpdb->posts, $data, $where ) ) { + if ( $wp_error ) + return new WP_Error('db_update_error', __('Could not update post in the database'), $wpdb->last_error); + else + return 0; + } + } else { + if ( isset($post_mime_type) ) + $data['post_mime_type'] = stripslashes( $post_mime_type ); // This isn't in the update + // If there is a suggested ID, use it if not already present + if ( !empty($import_id) ) { + $import_id = (int) $import_id; + if ( ! $wpdb->get_var( $wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE ID = %d", $import_id) ) ) { + $data['ID'] = $import_id; + } + } + if ( false === $wpdb->insert( $wpdb->posts, $data ) ) { + if ( $wp_error ) + return new WP_Error('db_insert_error', __('Could not insert post into the database'), $wpdb->last_error); + else + return 0; + } + $post_ID = (int) $wpdb->insert_id; + + // use the newly generated $post_ID + $where = array( 'ID' => $post_ID ); + } + + if ( empty($data['post_name']) && !in_array( $data['post_status'], array( 'draft', 'pending', 'auto-draft' ) ) ) { + $data['post_name'] = sanitize_title($data['post_title'], $post_ID); + $wpdb->update( $wpdb->posts, array( 'post_name' => $data['post_name'] ), $where ); + } + + if ( is_object_in_taxonomy($post_type, 'category') ) + wp_set_post_categories( $post_ID, $post_category ); + + if ( isset( $tags_input ) && is_object_in_taxonomy($post_type, 'post_tag') ) + wp_set_post_tags( $post_ID, $tags_input ); + + // new-style support for all custom taxonomies + if ( !empty($tax_input) ) { + foreach ( $tax_input as $taxonomy => $tags ) { + $taxonomy_obj = get_taxonomy($taxonomy); + if ( is_array($tags) ) // array = hierarchical, string = non-hierarchical. + $tags = array_filter($tags); + if ( current_user_can($taxonomy_obj->cap->assign_terms) ) + wp_set_post_terms( $post_ID, $tags, $taxonomy ); + } + } + + $current_guid = get_post_field( 'guid', $post_ID ); + + if ( 'page' == $data['post_type'] ) + clean_page_cache($post_ID); + else + clean_post_cache($post_ID); + + // Set GUID + if ( !$update && '' == $current_guid ) + $wpdb->update( $wpdb->posts, array( 'guid' => get_permalink( $post_ID ) ), $where ); + + $post = get_post($post_ID); + + if ( !empty($page_template) && 'page' == $data['post_type'] ) { + $post->page_template = $page_template; + $page_templates = get_page_templates(); + if ( 'default' != $page_template && !in_array($page_template, $page_templates) ) { + if ( $wp_error ) + return new WP_Error('invalid_page_template', __('The page template is invalid.')); + else + return 0; + } + update_post_meta($post_ID, '_wp_page_template', $page_template); + } + + wp_transition_post_status($data['post_status'], $previous_status, $post); + + if ( $update ) { + do_action('edit_post', $post_ID, $post); + $post_after = get_post($post_ID); + do_action( 'post_updated', $post_ID, $post_after, $post_before); + } + + do_action('save_post', $post_ID, $post); + do_action('wp_insert_post', $post_ID, $post); + + return $post_ID; +} + +/** + * Update a post with new post data. + * + * The date does not have to be set for drafts. You can set the date and it will + * not be overridden. + * + * @since 1.0.0 + * + * @param array|object $postarr Post data. Arrays are expected to be escaped, objects are not. + * @return int 0 on failure, Post ID on success. + */ +function wp_update_post($postarr = array()) { + if ( is_object($postarr) ) { + // non-escaped post was passed + $postarr = get_object_vars($postarr); + $postarr = add_magic_quotes($postarr); + } + + // First, get all of the original fields + $post = wp_get_single_post($postarr['ID'], ARRAY_A); + + // Escape data pulled from DB. + $post = add_magic_quotes($post); + + // Passed post category list overwrites existing category list if not empty. + if ( isset($postarr['post_category']) && is_array($postarr['post_category']) + && 0 != count($postarr['post_category']) ) + $post_cats = $postarr['post_category']; + else + $post_cats = $post['post_category']; + + // Drafts shouldn't be assigned a date unless explicitly done so by the user + if ( isset( $post['post_status'] ) && in_array($post['post_status'], array('draft', 'pending', 'auto-draft')) && empty($postarr['edit_date']) && + ('0000-00-00 00:00:00' == $post['post_date_gmt']) ) + $clear_date = true; + else + $clear_date = false; + + // Merge old and new fields with new fields overwriting old ones. + $postarr = array_merge($post, $postarr); + $postarr['post_category'] = $post_cats; + if ( $clear_date ) { + $postarr['post_date'] = current_time('mysql'); + $postarr['post_date_gmt'] = ''; + } + + if ($postarr['post_type'] == 'attachment') + return wp_insert_attachment($postarr); + + return wp_insert_post($postarr); +} + +/** + * Publish a post by transitioning the post status. + * + * @since 2.1.0 + * @uses $wpdb + * @uses do_action() Calls 'edit_post', 'save_post', and 'wp_insert_post' on post_id and post data. + * + * @param int $post_id Post ID. + * @return null + */ +function wp_publish_post($post_id) { + global $wpdb; + + $post = get_post($post_id); + + if ( empty($post) ) + return; + + if ( 'publish' == $post->post_status ) + return; + + $wpdb->update( $wpdb->posts, array( 'post_status' => 'publish' ), array( 'ID' => $post_id ) ); + + $old_status = $post->post_status; + $post->post_status = 'publish'; + wp_transition_post_status('publish', $old_status, $post); + + // Update counts for the post's terms. + foreach ( (array) get_object_taxonomies('post') as $taxonomy ) { + $tt_ids = wp_get_object_terms($post_id, $taxonomy, array('fields' => 'tt_ids')); + wp_update_term_count($tt_ids, $taxonomy); + } + + do_action('edit_post', $post_id, $post); + do_action('save_post', $post_id, $post); + do_action('wp_insert_post', $post_id, $post); +} + +/** + * Publish future post and make sure post ID has future post status. + * + * Invoked by cron 'publish_future_post' event. This safeguard prevents cron + * from publishing drafts, etc. + * + * @since 2.5.0 + * + * @param int $post_id Post ID. + * @return null Nothing is returned. Which can mean that no action is required or post was published. + */ +function check_and_publish_future_post($post_id) { + + $post = get_post($post_id); + + if ( empty($post) ) + return; + + if ( 'future' != $post->post_status ) + return; + + $time = strtotime( $post->post_date_gmt . ' GMT' ); + + if ( $time > time() ) { // Uh oh, someone jumped the gun! + wp_clear_scheduled_hook( 'publish_future_post', array( $post_id ) ); // clear anything else in the system + wp_schedule_single_event( $time, 'publish_future_post', array( $post_id ) ); + return; + } + + return wp_publish_post($post_id); +} + + +/** + * Computes a unique slug for the post, when given the desired slug and some post details. + * + * @since 2.8.0 + * + * @global wpdb $wpdb + * @global WP_Rewrite $wp_rewrite + * @param string $slug the desired slug (post_name) + * @param integer $post_ID + * @param string $post_status no uniqueness checks are made if the post is still draft or pending + * @param string $post_type + * @param integer $post_parent + * @return string unique slug for the post, based on $post_name (with a -1, -2, etc. suffix) + */ +function wp_unique_post_slug( $slug, $post_ID, $post_status, $post_type, $post_parent ) { + if ( in_array( $post_status, array( 'draft', 'pending', 'auto-draft' ) ) ) + return $slug; + + global $wpdb, $wp_rewrite; + + $feeds = $wp_rewrite->feeds; + if ( ! is_array( $feeds ) ) + $feeds = array(); + + $hierarchical_post_types = get_post_types( array('hierarchical' => true) ); + if ( 'attachment' == $post_type ) { + // Attachment slugs must be unique across all types. + $check_sql = "SELECT post_name FROM $wpdb->posts WHERE post_name = %s AND ID != %d LIMIT 1"; + $post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $slug, $post_ID ) ); + + if ( $post_name_check || in_array( $slug, $feeds ) || apply_filters( 'wp_unique_post_slug_is_bad_attachment_slug', false, $slug ) ) { + $suffix = 2; + do { + $alt_post_name = substr ($slug, 0, 200 - ( strlen( $suffix ) + 1 ) ) . "-$suffix"; + $post_name_check = $wpdb->get_var( $wpdb->prepare($check_sql, $alt_post_name, $post_ID ) ); + $suffix++; + } while ( $post_name_check ); + $slug = $alt_post_name; + } + } elseif ( in_array( $post_type, $hierarchical_post_types ) ) { + // Page slugs must be unique within their own trees. Pages are in a separate + // namespace than posts so page slugs are allowed to overlap post slugs. + $check_sql = "SELECT post_name FROM $wpdb->posts WHERE post_name = %s AND post_type IN ( '" . implode( "', '", esc_sql( $hierarchical_post_types ) ) . "' ) AND ID != %d AND post_parent = %d LIMIT 1"; + $post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $slug, $post_ID, $post_parent ) ); + + if ( $post_name_check || in_array( $slug, $feeds ) || preg_match( "@^($wp_rewrite->pagination_base)?\d+$@", $slug ) || apply_filters( 'wp_unique_post_slug_is_bad_hierarchical_slug', false, $slug, $post_type, $post_parent ) ) { + $suffix = 2; + do { + $alt_post_name = substr( $slug, 0, 200 - ( strlen( $suffix ) + 1 ) ) . "-$suffix"; + $post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $alt_post_name, $post_ID, $post_parent ) ); + $suffix++; + } while ( $post_name_check ); + $slug = $alt_post_name; + } + } else { + // Post slugs must be unique across all posts. + $check_sql = "SELECT post_name FROM $wpdb->posts WHERE post_name = %s AND post_type = %s AND ID != %d LIMIT 1"; + $post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $slug, $post_type, $post_ID ) ); + + if ( $post_name_check || in_array( $slug, $feeds ) || apply_filters( 'wp_unique_post_slug_is_bad_flat_slug', false, $slug, $post_type ) ) { + $suffix = 2; + do { + $alt_post_name = substr( $slug, 0, 200 - ( strlen( $suffix ) + 1 ) ) . "-$suffix"; + $post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $alt_post_name, $post_type, $post_ID ) ); + $suffix++; + } while ( $post_name_check ); + $slug = $alt_post_name; + } + } + + return $slug; +} + +/** + * Adds tags to a post. + * + * @uses wp_set_post_tags() Same first two parameters, but the last parameter is always set to true. + * + * @package WordPress + * @subpackage Post + * @since 2.3.0 + * + * @param int $post_id Post ID + * @param string $tags The tags to set for the post, separated by commas. + * @return bool|null Will return false if $post_id is not an integer or is 0. Will return null otherwise + */ +function wp_add_post_tags($post_id = 0, $tags = '') { + return wp_set_post_tags($post_id, $tags, true); +} + + +/** + * Set the tags for a post. + * + * @since 2.3.0 + * @uses wp_set_object_terms() Sets the tags for the post. + * + * @param int $post_id Post ID. + * @param string $tags The tags to set for the post, separated by commas. + * @param bool $append If true, don't delete existing tags, just add on. If false, replace the tags with the new tags. + * @return mixed Array of affected term IDs. WP_Error or false on failure. + */ +function wp_set_post_tags( $post_id = 0, $tags = '', $append = false ) { + return wp_set_post_terms( $post_id, $tags, 'post_tag', $append); +} + +/** + * Set the terms for a post. + * + * @since 2.8.0 + * @uses wp_set_object_terms() Sets the tags for the post. + * + * @param int $post_id Post ID. + * @param string $tags The tags to set for the post, separated by commas. + * @param bool $append If true, don't delete existing tags, just add on. If false, replace the tags with the new tags. + * @return mixed Array of affected term IDs. WP_Error or false on failure. + */ +function wp_set_post_terms( $post_id = 0, $tags = '', $taxonomy = 'post_tag', $append = false ) { + $post_id = (int) $post_id; + + if ( !$post_id ) + return false; + + if ( empty($tags) ) + $tags = array(); + + $tags = is_array($tags) ? $tags : explode( ',', trim($tags, " \n\t\r\0\x0B,") ); + + // Hierarchical taxonomies must always pass IDs rather than names so that children with the same + // names but different parents aren't confused. + if ( is_taxonomy_hierarchical( $taxonomy ) ) { + $tags = array_map( 'intval', $tags ); + $tags = array_unique( $tags ); + } + + return wp_set_object_terms($post_id, $tags, $taxonomy, $append); +} + +/** + * Set categories for a post. + * + * If the post categories parameter is not set, then the default category is + * going used. + * + * @since 2.1.0 + * + * @param int $post_ID Post ID. + * @param array $post_categories Optional. List of categories. + * @return bool|mixed + */ +function wp_set_post_categories($post_ID = 0, $post_categories = array()) { + $post_ID = (int) $post_ID; + $post_type = get_post_type( $post_ID ); + $post_status = get_post_status( $post_ID ); + // If $post_categories isn't already an array, make it one: + if ( !is_array($post_categories) || empty($post_categories) ) { + if ( 'post' == $post_type && 'auto-draft' != $post_status ) + $post_categories = array( get_option('default_category') ); + else + $post_categories = array(); + } else if ( 1 == count($post_categories) && '' == reset($post_categories) ) { + return true; + } + + if ( !empty($post_categories) ) { + $post_categories = array_map('intval', $post_categories); + $post_categories = array_unique($post_categories); + } + + return wp_set_object_terms($post_ID, $post_categories, 'category'); +} + +/** + * Transition the post status of a post. + * + * Calls hooks to transition post status. + * + * The first is 'transition_post_status' with new status, old status, and post data. + * + * The next action called is 'OLDSTATUS_to_NEWSTATUS' the 'NEWSTATUS' is the + * $new_status parameter and the 'OLDSTATUS' is $old_status parameter; it has the + * post data. + * + * The final action is named 'NEWSTATUS_POSTTYPE', 'NEWSTATUS' is from the $new_status + * parameter and POSTTYPE is post_type post data. + * + * @since 2.3.0 + * @link http://codex.wordpress.org/Post_Status_Transitions + * + * @uses do_action() Calls 'transition_post_status' on $new_status, $old_status and + * $post if there is a status change. + * @uses do_action() Calls '{$old_status}_to_{$new_status}' on $post if there is a status change. + * @uses do_action() Calls '{$new_status}_{$post->post_type}' on post ID and $post. + * + * @param string $new_status Transition to this post status. + * @param string $old_status Previous post status. + * @param object $post Post data. + */ +function wp_transition_post_status($new_status, $old_status, $post) { + do_action('transition_post_status', $new_status, $old_status, $post); + do_action("{$old_status}_to_{$new_status}", $post); + do_action("{$new_status}_{$post->post_type}", $post->ID, $post); +} + +// +// Trackback and ping functions +// + +/** + * Add a URL to those already pung. + * + * @since 1.5.0 + * @uses $wpdb + * + * @param int $post_id Post ID. + * @param string $uri Ping URI. + * @return int How many rows were updated. + */ +function add_ping($post_id, $uri) { + global $wpdb; + $pung = $wpdb->get_var( $wpdb->prepare( "SELECT pinged FROM $wpdb->posts WHERE ID = %d", $post_id )); + $pung = trim($pung); + $pung = preg_split('/\s/', $pung); + $pung[] = $uri; + $new = implode("\n", $pung); + $new = apply_filters('add_ping', $new); + // expected_slashed ($new) + $new = stripslashes($new); + return $wpdb->update( $wpdb->posts, array( 'pinged' => $new ), array( 'ID' => $post_id ) ); +} + +/** + * Retrieve enclosures already enclosed for a post. + * + * @since 1.5.0 + * @uses $wpdb + * + * @param int $post_id Post ID. + * @return array List of enclosures + */ +function get_enclosed($post_id) { + $custom_fields = get_post_custom( $post_id ); + $pung = array(); + if ( !is_array( $custom_fields ) ) + return $pung; + + foreach ( $custom_fields as $key => $val ) { + if ( 'enclosure' != $key || !is_array( $val ) ) + continue; + foreach( $val as $enc ) { + $enclosure = split( "\n", $enc ); + $pung[] = trim( $enclosure[ 0 ] ); + } + } + $pung = apply_filters('get_enclosed', $pung, $post_id); + return $pung; +} + +/** + * Retrieve URLs already pinged for a post. + * + * @since 1.5.0 + * @uses $wpdb + * + * @param int $post_id Post ID. + * @return array + */ +function get_pung($post_id) { + global $wpdb; + $pung = $wpdb->get_var( $wpdb->prepare( "SELECT pinged FROM $wpdb->posts WHERE ID = %d", $post_id )); + $pung = trim($pung); + $pung = preg_split('/\s/', $pung); + $pung = apply_filters('get_pung', $pung); + return $pung; +} + +/** + * Retrieve URLs that need to be pinged. + * + * @since 1.5.0 + * @uses $wpdb + * + * @param int $post_id Post ID + * @return array + */ +function get_to_ping($post_id) { + global $wpdb; + $to_ping = $wpdb->get_var( $wpdb->prepare( "SELECT to_ping FROM $wpdb->posts WHERE ID = %d", $post_id )); + $to_ping = trim($to_ping); + $to_ping = preg_split('/\s/', $to_ping, -1, PREG_SPLIT_NO_EMPTY); + $to_ping = apply_filters('get_to_ping', $to_ping); + return $to_ping; +} + +/** + * Do trackbacks for a list of URLs. + * + * @since 1.0.0 + * + * @param string $tb_list Comma separated list of URLs + * @param int $post_id Post ID + */ +function trackback_url_list($tb_list, $post_id) { + if ( ! empty( $tb_list ) ) { + // get post data + $postdata = wp_get_single_post($post_id, ARRAY_A); + + // import postdata as variables + extract($postdata, EXTR_SKIP); + + // form an excerpt + $excerpt = strip_tags($post_excerpt ? $post_excerpt : $post_content); + + if (strlen($excerpt) > 255) { + $excerpt = substr($excerpt,0,252) . '...'; + } + + $trackback_urls = explode(',', $tb_list); + foreach( (array) $trackback_urls as $tb_url) { + $tb_url = trim($tb_url); + trackback($tb_url, stripslashes($post_title), $excerpt, $post_id); + } + } +} + +// +// Page functions +// + +/** + * Get a list of page IDs. + * + * @since 2.0.0 + * @uses $wpdb + * + * @return array List of page IDs. + */ +function get_all_page_ids() { + global $wpdb; + + if ( ! $page_ids = wp_cache_get('all_page_ids', 'posts') ) { + $page_ids = $wpdb->get_col("SELECT ID FROM $wpdb->posts WHERE post_type = 'page'"); + wp_cache_add('all_page_ids', $page_ids, 'posts'); + } + + return $page_ids; +} + +/** + * Retrieves page data given a page ID or page object. + * + * @since 1.5.1 + * + * @param mixed $page Page object or page ID. Passed by reference. + * @param string $output What to output. OBJECT, ARRAY_A, or ARRAY_N. + * @param string $filter How the return value should be filtered. + * @return mixed Page data. + */ +function &get_page(&$page, $output = OBJECT, $filter = 'raw') { + $p = get_post($page, $output, $filter); + return $p; +} + +/** + * Retrieves a page given its path. + * + * @since 2.1.0 + * @uses $wpdb + * + * @param string $page_path Page path + * @param string $output Optional. Output type. OBJECT, ARRAY_N, or ARRAY_A. Default OBJECT. + * @param string $post_type Optional. Post type. Default page. + * @return mixed Null when complete. + */ +function get_page_by_path($page_path, $output = OBJECT, $post_type = 'page') { + global $wpdb; + $null = null; + $page_path = rawurlencode(urldecode($page_path)); + $page_path = str_replace('%2F', '/', $page_path); + $page_path = str_replace('%20', ' ', $page_path); + $page_paths = '/' . trim($page_path, '/'); + $leaf_path = sanitize_title(basename($page_paths)); + $page_paths = explode('/', $page_paths); + $full_path = ''; + foreach ( (array) $page_paths as $pathdir ) + $full_path .= ( $pathdir != '' ? '/' : '' ) . sanitize_title($pathdir); + + $pages = $wpdb->get_results( $wpdb->prepare( "SELECT ID, post_name, post_parent FROM $wpdb->posts WHERE post_name = %s AND (post_type = %s OR post_type = 'attachment')", $leaf_path, $post_type )); + + if ( empty($pages) ) + return $null; + + foreach ( $pages as $page ) { + $path = '/' . $leaf_path; + $curpage = $page; + while ( $curpage->post_parent != 0 ) { + $post_parent = $curpage->post_parent; + $curpage = wp_cache_get( $post_parent, 'posts' ); + if ( false === $curpage ) + $curpage = $wpdb->get_row( $wpdb->prepare( "SELECT ID, post_name, post_parent FROM $wpdb->posts WHERE ID = %d and post_type = %s", $post_parent, $post_type ) ); + $path = '/' . $curpage->post_name . $path; + } + + if ( $path == $full_path ) + return get_page($page->ID, $output, $post_type); + } + + return $null; +} + +/** + * Retrieve a page given its title. + * + * @since 2.1.0 + * @uses $wpdb + * + * @param string $page_title Page title + * @param string $output Optional. Output type. OBJECT, ARRAY_N, or ARRAY_A. Default OBJECT. + * @param string $post_type Optional. Post type. Default page. + * @return mixed + */ +function get_page_by_title($page_title, $output = OBJECT, $post_type = 'page' ) { + global $wpdb; + $page = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_title = %s AND post_type= %s", $page_title, $post_type ) ); + if ( $page ) + return get_page($page, $output); + + return null; +} + +/** + * Retrieve child pages from list of pages matching page ID. + * + * Matches against the pages parameter against the page ID. Also matches all + * children for the same to retrieve all children of a page. Does not make any + * SQL queries to get the children. + * + * @since 1.5.1 + * + * @param int $page_id Page ID. + * @param array $pages List of pages' objects. + * @return array + */ +function &get_page_children($page_id, $pages) { + $page_list = array(); + foreach ( (array) $pages as $page ) { + if ( $page->post_parent == $page_id ) { + $page_list[] = $page; + if ( $children = get_page_children($page->ID, $pages) ) + $page_list = array_merge($page_list, $children); + } + } + return $page_list; +} + +/** + * Order the pages with children under parents in a flat list. + * + * It uses auxiliary structure to hold parent-children relationships and + * runs in O(N) complexity + * + * @since 2.0.0 + * + * @param array $pages Posts array. + * @param int $page_id Parent page ID. + * @return array A list arranged by hierarchy. Children immediately follow their parents. + */ +function &get_page_hierarchy( &$pages, $page_id = 0 ) { + if ( empty( $pages ) ) { + $result = array(); + return $result; + } + + $children = array(); + foreach ( (array) $pages as $p ) { + $parent_id = intval( $p->post_parent ); + $children[ $parent_id ][] = $p; + } + + $result = array(); + _page_traverse_name( $page_id, $children, $result ); + + return $result; +} + +/** + * function to traverse and return all the nested children post names of a root page. + * $children contains parent-chilren relations + * + * @since 2.9.0 + */ +function _page_traverse_name( $page_id, &$children, &$result ){ + if ( isset( $children[ $page_id ] ) ){ + foreach( (array)$children[ $page_id ] as $child ) { + $result[ $child->ID ] = $child->post_name; + _page_traverse_name( $child->ID, $children, $result ); + } + } +} + +/** + * Builds URI for a page. + * + * Sub pages will be in the "directory" under the parent page post name. + * + * @since 1.5.0 + * + * @param mixed $page Page object or page ID. + * @return string Page URI. + */ +function get_page_uri($page) { + if ( ! is_object($page) ) + $page = get_page($page); + $uri = $page->post_name; + + // A page cannot be it's own parent. + if ( $page->post_parent == $page->ID ) + return $uri; + + while ($page->post_parent != 0) { + $page = get_page($page->post_parent); + $uri = $page->post_name . "/" . $uri; + } + + return $uri; +} + +/** + * Retrieve a list of pages. + * + * The defaults that can be overridden are the following: 'child_of', + * 'sort_order', 'sort_column', 'post_title', 'hierarchical', 'exclude', + * 'include', 'meta_key', 'meta_value','authors', 'number', and 'offset'. + * + * @since 1.5.0 + * @uses $wpdb + * + * @param mixed $args Optional. Array or string of options that overrides defaults. + * @return array List of pages matching defaults or $args + */ +function &get_pages($args = '') { + global $wpdb; + + $defaults = array( + 'child_of' => 0, 'sort_order' => 'ASC', + 'sort_column' => 'post_title', 'hierarchical' => 1, + 'exclude' => array(), 'include' => array(), + 'meta_key' => '', 'meta_value' => '', + 'authors' => '', 'parent' => -1, 'exclude_tree' => '', + 'number' => '', 'offset' => 0, + 'post_type' => 'page', 'post_status' => 'publish', + ); + + $r = wp_parse_args( $args, $defaults ); + extract( $r, EXTR_SKIP ); + $number = (int) $number; + $offset = (int) $offset; + + // Make sure the post type is hierarchical + $hierarchical_post_types = get_post_types( array( 'hierarchical' => true ) ); + if ( !in_array( $post_type, $hierarchical_post_types ) ) + return false; + + // Make sure we have a valid post status + if ( !is_array( $post_status ) ) + $post_status = explode( ',', $post_status ); + if ( array_diff( $post_status, get_post_stati() ) ) + return false; + + $cache = array(); + $key = md5( serialize( compact(array_keys($defaults)) ) ); + if ( $cache = wp_cache_get( 'get_pages', 'posts' ) ) { + if ( is_array($cache) && isset( $cache[ $key ] ) ) { + $pages = apply_filters('get_pages', $cache[ $key ], $r ); + return $pages; + } + } + + if ( !is_array($cache) ) + $cache = array(); + + $inclusions = ''; + if ( !empty($include) ) { + $child_of = 0; //ignore child_of, parent, exclude, meta_key, and meta_value params if using include + $parent = -1; + $exclude = ''; + $meta_key = ''; + $meta_value = ''; + $hierarchical = false; + $incpages = wp_parse_id_list( $include ); + if ( ! empty( $incpages ) ) { + foreach ( $incpages as $incpage ) { + if (empty($inclusions)) + $inclusions = $wpdb->prepare(' AND ( ID = %d ', $incpage); + else + $inclusions .= $wpdb->prepare(' OR ID = %d ', $incpage); + } + } + } + if (!empty($inclusions)) + $inclusions .= ')'; + + $exclusions = ''; + if ( !empty($exclude) ) { + $expages = wp_parse_id_list( $exclude ); + if ( ! empty( $expages ) ) { + foreach ( $expages as $expage ) { + if (empty($exclusions)) + $exclusions = $wpdb->prepare(' AND ( ID <> %d ', $expage); + else + $exclusions .= $wpdb->prepare(' AND ID <> %d ', $expage); + } + } + } + if (!empty($exclusions)) + $exclusions .= ')'; + + $author_query = ''; + if (!empty($authors)) { + $post_authors = preg_split('/[\s,]+/',$authors); + + if ( ! empty( $post_authors ) ) { + foreach ( $post_authors as $post_author ) { + //Do we have an author id or an author login? + if ( 0 == intval($post_author) ) { + $post_author = get_userdatabylogin($post_author); + if ( empty($post_author) ) + continue; + if ( empty($post_author->ID) ) + continue; + $post_author = $post_author->ID; + } + + if ( '' == $author_query ) + $author_query = $wpdb->prepare(' post_author = %d ', $post_author); + else + $author_query .= $wpdb->prepare(' OR post_author = %d ', $post_author); + } + if ( '' != $author_query ) + $author_query = " AND ($author_query)"; + } + } + + $join = ''; + $where = "$exclusions $inclusions "; + if ( ! empty( $meta_key ) || ! empty( $meta_value ) ) { + $join = " LEFT JOIN $wpdb->postmeta ON ( $wpdb->posts.ID = $wpdb->postmeta.post_id )"; + + // meta_key and meta_value might be slashed + $meta_key = stripslashes($meta_key); + $meta_value = stripslashes($meta_value); + if ( ! empty( $meta_key ) ) + $where .= $wpdb->prepare(" AND $wpdb->postmeta.meta_key = %s", $meta_key); + if ( ! empty( $meta_value ) ) + $where .= $wpdb->prepare(" AND $wpdb->postmeta.meta_value = %s", $meta_value); + + } + + if ( $parent >= 0 ) + $where .= $wpdb->prepare(' AND post_parent = %d ', $parent); + + if ( 1 == count( $post_status ) ) { + $where_post_type = $wpdb->prepare( "post_type = %s AND post_status = %s", $post_type, array_shift( $post_status ) ); + } else { + $post_status = implode( "', '", $post_status ); + $where_post_type = $wpdb->prepare( "post_type = %s AND post_status IN ('$post_status')", $post_type ); + } + + $orderby_array = array(); + $allowed_keys = array('author', 'post_author', 'date', 'post_date', 'title', 'post_title', 'modified', + 'post_modified', 'modified_gmt', 'post_modified_gmt', 'menu_order', 'parent', 'post_parent', + 'ID', 'rand', 'comment_count'); + foreach ( explode( ',', $sort_column ) as $orderby ) { + $orderby = trim( $orderby ); + if ( !in_array( $orderby, $allowed_keys ) ) + continue; + + switch ( $orderby ) { + case 'menu_order': + break; + case 'ID': + $orderby = "$wpdb->posts.ID"; + break; + case 'rand': + $orderby = 'RAND()'; + break; + case 'comment_count': + $orderby = "$wpdb->posts.comment_count"; + break; + default: + if ( 0 === strpos( $orderby, 'post_' ) ) + $orderby = "$wpdb->posts." . $orderby; + else + $orderby = "$wpdb->posts.post_" . $orderby; + } + + $orderby_array[] = $orderby; + + } + $sort_column = ! empty( $orderby_array ) ? implode( ',', $orderby_array ) : "$wpdb->posts.post_title"; + + $sort_order = strtoupper( $sort_order ); + if ( '' !== $sort_order && !in_array( $sort_order, array( 'ASC', 'DESC' ) ) ) + $sort_order = 'ASC'; + + $query = "SELECT * FROM $wpdb->posts $join WHERE ($where_post_type) $where "; + $query .= $author_query; + $query .= " ORDER BY " . $sort_column . " " . $sort_order ; + + if ( !empty($number) ) + $query .= ' LIMIT ' . $offset . ',' . $number; + + $pages = $wpdb->get_results($query); + + if ( empty($pages) ) { + $pages = apply_filters('get_pages', array(), $r); + return $pages; + } + + // Sanitize before caching so it'll only get done once + $num_pages = count($pages); + for ($i = 0; $i < $num_pages; $i++) { + $pages[$i] = sanitize_post($pages[$i], 'raw'); + } + + // Update cache. + update_page_cache($pages); + + if ( $child_of || $hierarchical ) + $pages = & get_page_children($child_of, $pages); + + if ( !empty($exclude_tree) ) { + $exclude = (int) $exclude_tree; + $children = get_page_children($exclude, $pages); + $excludes = array(); + foreach ( $children as $child ) + $excludes[] = $child->ID; + $excludes[] = $exclude; + $num_pages = count($pages); + for ( $i = 0; $i < $num_pages; $i++ ) { + if ( in_array($pages[$i]->ID, $excludes) ) + unset($pages[$i]); + } + } + + $cache[ $key ] = $pages; + wp_cache_set( 'get_pages', $cache, 'posts' ); + + $pages = apply_filters('get_pages', $pages, $r); + + return $pages; +} + +// +// Attachment functions +// + +/** + * Check if the attachment URI is local one and is really an attachment. + * + * @since 2.0.0 + * + * @param string $url URL to check + * @return bool True on success, false on failure. + */ +function is_local_attachment($url) { + if (strpos($url, home_url()) === false) + return false; + if (strpos($url, home_url('/?attachment_id=')) !== false) + return true; + if ( $id = url_to_postid($url) ) { + $post = & get_post($id); + if ( 'attachment' == $post->post_type ) + return true; + } + return false; +} + +/** + * Insert an attachment. + * + * If you set the 'ID' in the $object parameter, it will mean that you are + * updating and attempt to update the attachment. You can also set the + * attachment name or title by setting the key 'post_name' or 'post_title'. + * + * You can set the dates for the attachment manually by setting the 'post_date' + * and 'post_date_gmt' keys' values. + * + * By default, the comments will use the default settings for whether the + * comments are allowed. You can close them manually or keep them open by + * setting the value for the 'comment_status' key. + * + * The $object parameter can have the following: + * 'post_status' - Default is 'draft'. Can not be overridden, set the same as parent post. + * 'post_type' - Default is 'post', will be set to attachment. Can not override. + * 'post_author' - Default is current user ID. The ID of the user, who added the attachment. + * 'ping_status' - Default is the value in default ping status option. Whether the attachment + * can accept pings. + * 'post_parent' - Default is 0. Can use $parent parameter or set this for the post it belongs + * to, if any. + * 'menu_order' - Default is 0. The order it is displayed. + * 'to_ping' - Whether to ping. + * 'pinged' - Default is empty string. + * 'post_password' - Default is empty string. The password to access the attachment. + * 'guid' - Global Unique ID for referencing the attachment. + * 'post_content_filtered' - Attachment post content filtered. + * 'post_excerpt' - Attachment excerpt. + * + * @since 2.0.0 + * @uses $wpdb + * @uses $user_ID + * @uses do_action() Calls 'edit_attachment' on $post_ID if this is an update. + * @uses do_action() Calls 'add_attachment' on $post_ID if this is not an update. + * + * @param string|array $object Arguments to override defaults. + * @param string $file Optional filename. + * @param int $parent Parent post ID. + * @return int Attachment ID. + */ +function wp_insert_attachment($object, $file = false, $parent = 0) { + global $wpdb, $user_ID; + + $defaults = array('post_status' => 'inherit', 'post_type' => 'post', 'post_author' => $user_ID, + 'ping_status' => get_option('default_ping_status'), 'post_parent' => 0, + 'menu_order' => 0, 'to_ping' => '', 'pinged' => '', 'post_password' => '', + 'guid' => '', 'post_content_filtered' => '', 'post_excerpt' => '', 'import_id' => 0, 'context' => ''); + + $object = wp_parse_args($object, $defaults); + if ( !empty($parent) ) + $object['post_parent'] = $parent; + + unset( $object[ 'filter' ] ); + + $object = sanitize_post($object, 'db'); + + // export array as variables + extract($object, EXTR_SKIP); + + if ( empty($post_author) ) + $post_author = $user_ID; + + $post_type = 'attachment'; + + if ( ! in_array( $post_status, array( 'inherit', 'private' ) ) ) + $post_status = 'inherit'; + + // Make sure we set a valid category. + if ( !isset($post_category) || 0 == count($post_category) || !is_array($post_category) ) { + // 'post' requires at least one category. + if ( 'post' == $post_type ) + $post_category = array( get_option('default_category') ); + else + $post_category = array(); + } + + // Are we updating or creating? + if ( !empty($ID) ) { + $update = true; + $post_ID = (int) $ID; + } else { + $update = false; + $post_ID = 0; + } + + // Create a valid post name. + if ( empty($post_name) ) + $post_name = sanitize_title($post_title); + else + $post_name = sanitize_title($post_name); + + // expected_slashed ($post_name) + $post_name = wp_unique_post_slug($post_name, $post_ID, $post_status, $post_type, $post_parent); + + if ( empty($post_date) ) + $post_date = current_time('mysql'); + if ( empty($post_date_gmt) ) + $post_date_gmt = current_time('mysql', 1); + + if ( empty($post_modified) ) + $post_modified = $post_date; + if ( empty($post_modified_gmt) ) + $post_modified_gmt = $post_date_gmt; + + if ( empty($comment_status) ) { + if ( $update ) + $comment_status = 'closed'; + else + $comment_status = get_option('default_comment_status'); + } + if ( empty($ping_status) ) + $ping_status = get_option('default_ping_status'); + + if ( isset($to_ping) ) + $to_ping = preg_replace('|\s+|', "\n", $to_ping); + else + $to_ping = ''; + + if ( isset($post_parent) ) + $post_parent = (int) $post_parent; + else + $post_parent = 0; + + if ( isset($menu_order) ) + $menu_order = (int) $menu_order; + else + $menu_order = 0; + + if ( !isset($post_password) ) + $post_password = ''; + + if ( ! isset($pinged) ) + $pinged = ''; + + // expected_slashed (everything!) + $data = compact( array( 'post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_content_filtered', 'post_title', 'post_excerpt', 'post_status', 'post_type', 'comment_status', 'ping_status', 'post_password', 'post_name', 'to_ping', 'pinged', 'post_modified', 'post_modified_gmt', 'post_parent', 'menu_order', 'post_mime_type', 'guid' ) ); + $data = stripslashes_deep( $data ); + + if ( $update ) { + $wpdb->update( $wpdb->posts, $data, array( 'ID' => $post_ID ) ); + } else { + // If there is a suggested ID, use it if not already present + if ( !empty($import_id) ) { + $import_id = (int) $import_id; + if ( ! $wpdb->get_var( $wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE ID = %d", $import_id) ) ) { + $data['ID'] = $import_id; + } + } + + $wpdb->insert( $wpdb->posts, $data ); + $post_ID = (int) $wpdb->insert_id; + } + + if ( empty($post_name) ) { + $post_name = sanitize_title($post_title, $post_ID); + $wpdb->update( $wpdb->posts, compact("post_name"), array( 'ID' => $post_ID ) ); + } + + wp_set_post_categories($post_ID, $post_category); + + if ( $file ) + update_attached_file( $post_ID, $file ); + + clean_post_cache($post_ID); + + if ( isset($post_parent) && $post_parent < 0 ) + add_post_meta($post_ID, '_wp_attachment_temp_parent', $post_parent, true); + + if ( ! empty( $context ) ) + add_post_meta( $post_ID, '_wp_attachment_context', $context, true ); + + if ( $update) { + do_action('edit_attachment', $post_ID); + } else { + do_action('add_attachment', $post_ID); + } + + return $post_ID; +} + +/** + * Trashes or deletes an attachment. + * + * When an attachment is permanently deleted, the file will also be removed. + * Deletion removes all post meta fields, taxonomy, comments, etc. associated + * with the attachment (except the main post). + * + * The attachment is moved to the trash instead of permanently deleted unless trash + * for media is disabled, item is already in the trash, or $force_delete is true. + * + * @since 2.0.0 + * @uses $wpdb + * @uses do_action() Calls 'delete_attachment' hook on Attachment ID. + * + * @param int $post_id Attachment ID. + * @param bool $force_delete Whether to bypass trash and force deletion. Defaults to false. + * @return mixed False on failure. Post data on success. + */ +function wp_delete_attachment( $post_id, $force_delete = false ) { + global $wpdb; + + if ( !$post = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->posts WHERE ID = %d", $post_id) ) ) + return $post; + + if ( 'attachment' != $post->post_type ) + return false; + + if ( !$force_delete && EMPTY_TRASH_DAYS && MEDIA_TRASH && 'trash' != $post->post_status ) + return wp_trash_post( $post_id ); + + delete_post_meta($post_id, '_wp_trash_meta_status'); + delete_post_meta($post_id, '_wp_trash_meta_time'); + + $meta = wp_get_attachment_metadata( $post_id ); + $backup_sizes = get_post_meta( $post->ID, '_wp_attachment_backup_sizes', true ); + $file = get_attached_file( $post_id ); + + if ( is_multisite() ) + delete_transient( 'dirsize_cache' ); + + do_action('delete_attachment', $post_id); + + wp_delete_object_term_relationships($post_id, array('category', 'post_tag')); + wp_delete_object_term_relationships($post_id, get_object_taxonomies($post->post_type)); + + $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->postmeta WHERE meta_key = '_thumbnail_id' AND meta_value = %d", $post_id )); + + $comment_ids = $wpdb->get_col( $wpdb->prepare( "SELECT comment_ID FROM $wpdb->comments WHERE comment_post_ID = %d", $post_id )); + if ( ! empty( $comment_ids ) ) { + do_action( 'delete_comment', $comment_ids ); + foreach ( $comment_ids as $comment_id ) + wp_delete_comment( $comment_id, true ); + do_action( 'deleted_comment', $comment_ids ); + } + + $post_meta_ids = $wpdb->get_col( $wpdb->prepare( "SELECT meta_id FROM $wpdb->postmeta WHERE post_id = %d ", $post_id )); + if ( !empty($post_meta_ids) ) { + do_action( 'delete_postmeta', $post_meta_ids ); + $in_post_meta_ids = "'" . implode("', '", $post_meta_ids) . "'"; + $wpdb->query( "DELETE FROM $wpdb->postmeta WHERE meta_id IN($in_post_meta_ids)" ); + do_action( 'deleted_postmeta', $post_meta_ids ); + } + + do_action( 'delete_post', $post_id ); + $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->posts WHERE ID = %d", $post_id )); + do_action( 'deleted_post', $post_id ); + + $uploadpath = wp_upload_dir(); + + if ( ! empty($meta['thumb']) ) { + // Don't delete the thumb if another attachment uses it + if (! $wpdb->get_row( $wpdb->prepare( "SELECT meta_id FROM $wpdb->postmeta WHERE meta_key = '_wp_attachment_metadata' AND meta_value LIKE %s AND post_id <> %d", '%' . $meta['thumb'] . '%', $post_id)) ) { + $thumbfile = str_replace(basename($file), $meta['thumb'], $file); + $thumbfile = apply_filters('wp_delete_file', $thumbfile); + @ unlink( path_join($uploadpath['basedir'], $thumbfile) ); + } + } + + // remove intermediate and backup images if there are any + foreach ( get_intermediate_image_sizes() as $size ) { + if ( $intermediate = image_get_intermediate_size($post_id, $size) ) { + $intermediate_file = apply_filters('wp_delete_file', $intermediate['path']); + @ unlink( path_join($uploadpath['basedir'], $intermediate_file) ); + } + } + + if ( is_array($backup_sizes) ) { + foreach ( $backup_sizes as $size ) { + $del_file = path_join( dirname($meta['file']), $size['file'] ); + $del_file = apply_filters('wp_delete_file', $del_file); + @ unlink( path_join($uploadpath['basedir'], $del_file) ); + } + } + + $file = apply_filters('wp_delete_file', $file); + + if ( ! empty($file) ) + @ unlink($file); + + clean_post_cache($post_id); + + return $post; +} + +/** + * Retrieve attachment meta field for attachment ID. + * + * @since 2.1.0 + * + * @param int $post_id Attachment ID + * @param bool $unfiltered Optional, default is false. If true, filters are not run. + * @return string|bool Attachment meta field. False on failure. + */ +function wp_get_attachment_metadata( $post_id = 0, $unfiltered = false ) { + $post_id = (int) $post_id; + if ( !$post =& get_post( $post_id ) ) + return false; + + $data = get_post_meta( $post->ID, '_wp_attachment_metadata', true ); + + if ( $unfiltered ) + return $data; + + return apply_filters( 'wp_get_attachment_metadata', $data, $post->ID ); +} + +/** + * Update metadata for an attachment. + * + * @since 2.1.0 + * + * @param int $post_id Attachment ID. + * @param array $data Attachment data. + * @return int + */ +function wp_update_attachment_metadata( $post_id, $data ) { + $post_id = (int) $post_id; + if ( !$post =& get_post( $post_id ) ) + return false; + + $data = apply_filters( 'wp_update_attachment_metadata', $data, $post->ID ); + + return update_post_meta( $post->ID, '_wp_attachment_metadata', $data); +} + +/** + * Retrieve the URL for an attachment. + * + * @since 2.1.0 + * + * @param int $post_id Attachment ID. + * @return string + */ +function wp_get_attachment_url( $post_id = 0 ) { + $post_id = (int) $post_id; + if ( !$post =& get_post( $post_id ) ) + return false; + + $url = ''; + if ( $file = get_post_meta( $post->ID, '_wp_attached_file', true) ) { //Get attached file + if ( ($uploads = wp_upload_dir()) && false === $uploads['error'] ) { //Get upload directory + if ( 0 === strpos($file, $uploads['basedir']) ) //Check that the upload base exists in the file location + $url = str_replace($uploads['basedir'], $uploads['baseurl'], $file); //replace file location with url location + elseif ( false !== strpos($file, 'wp-content/uploads') ) + $url = $uploads['baseurl'] . substr( $file, strpos($file, 'wp-content/uploads') + 18 ); + else + $url = $uploads['baseurl'] . "/$file"; //Its a newly uploaded file, therefor $file is relative to the basedir. + } + } + + if ( empty($url) ) //If any of the above options failed, Fallback on the GUID as used pre-2.7, not recomended to rely upon this. + $url = get_the_guid( $post->ID ); + + $url = apply_filters( 'wp_get_attachment_url', $url, $post->ID ); + + if ( 'attachment' != $post->post_type || empty( $url ) ) + return false; + + return $url; +} + +/** + * Retrieve thumbnail for an attachment. + * + * @since 2.1.0 + * + * @param int $post_id Attachment ID. + * @return mixed False on failure. Thumbnail file path on success. + */ +function wp_get_attachment_thumb_file( $post_id = 0 ) { + $post_id = (int) $post_id; + if ( !$post =& get_post( $post_id ) ) + return false; + if ( !is_array( $imagedata = wp_get_attachment_metadata( $post->ID ) ) ) + return false; + + $file = get_attached_file( $post->ID ); + + if ( !empty($imagedata['thumb']) && ($thumbfile = str_replace(basename($file), $imagedata['thumb'], $file)) && file_exists($thumbfile) ) + return apply_filters( 'wp_get_attachment_thumb_file', $thumbfile, $post->ID ); + return false; +} + +/** + * Retrieve URL for an attachment thumbnail. + * + * @since 2.1.0 + * + * @param int $post_id Attachment ID + * @return string|bool False on failure. Thumbnail URL on success. + */ +function wp_get_attachment_thumb_url( $post_id = 0 ) { + $post_id = (int) $post_id; + if ( !$post =& get_post( $post_id ) ) + return false; + if ( !$url = wp_get_attachment_url( $post->ID ) ) + return false; + + $sized = image_downsize( $post_id, 'thumbnail' ); + if ( $sized ) + return $sized[0]; + + if ( !$thumb = wp_get_attachment_thumb_file( $post->ID ) ) + return false; + + $url = str_replace(basename($url), basename($thumb), $url); + + return apply_filters( 'wp_get_attachment_thumb_url', $url, $post->ID ); +} + +/** + * Check if the attachment is an image. + * + * @since 2.1.0 + * + * @param int $post_id Attachment ID + * @return bool + */ +function wp_attachment_is_image( $post_id = 0 ) { + $post_id = (int) $post_id; + if ( !$post =& get_post( $post_id ) ) + return false; + + if ( !$file = get_attached_file( $post->ID ) ) + return false; + + $ext = preg_match('/\.([^.]+)$/', $file, $matches) ? strtolower($matches[1]) : false; + + $image_exts = array('jpg', 'jpeg', 'gif', 'png'); + + if ( 'image/' == substr($post->post_mime_type, 0, 6) || $ext && 'import' == $post->post_mime_type && in_array($ext, $image_exts) ) + return true; + return false; +} + +/** + * Retrieve the icon for a MIME type. + * + * @since 2.1.0 + * + * @param string $mime MIME type + * @return string|bool + */ +function wp_mime_type_icon( $mime = 0 ) { + if ( !is_numeric($mime) ) + $icon = wp_cache_get("mime_type_icon_$mime"); + if ( empty($icon) ) { + $post_id = 0; + $post_mimes = array(); + if ( is_numeric($mime) ) { + $mime = (int) $mime; + if ( $post =& get_post( $mime ) ) { + $post_id = (int) $post->ID; + $ext = preg_replace('/^.+?\.([^.]+)$/', '$1', $post->guid); + if ( !empty($ext) ) { + $post_mimes[] = $ext; + if ( $ext_type = wp_ext2type( $ext ) ) + $post_mimes[] = $ext_type; + } + $mime = $post->post_mime_type; + } else { + $mime = 0; + } + } else { + $post_mimes[] = $mime; + } + + $icon_files = wp_cache_get('icon_files'); + + if ( !is_array($icon_files) ) { + $icon_dir = apply_filters( 'icon_dir', ABSPATH . WPINC . '/images/crystal' ); + $icon_dir_uri = apply_filters( 'icon_dir_uri', includes_url('images/crystal') ); + $dirs = apply_filters( 'icon_dirs', array($icon_dir => $icon_dir_uri) ); + $icon_files = array(); + while ( $dirs ) { + $dir = array_shift($keys = array_keys($dirs)); + $uri = array_shift($dirs); + if ( $dh = opendir($dir) ) { + while ( false !== $file = readdir($dh) ) { + $file = basename($file); + if ( substr($file, 0, 1) == '.' ) + continue; + if ( !in_array(strtolower(substr($file, -4)), array('.png', '.gif', '.jpg') ) ) { + if ( is_dir("$dir/$file") ) + $dirs["$dir/$file"] = "$uri/$file"; + continue; + } + $icon_files["$dir/$file"] = "$uri/$file"; + } + closedir($dh); + } + } + wp_cache_set('icon_files', $icon_files, 600); + } + + // Icon basename - extension = MIME wildcard + foreach ( $icon_files as $file => $uri ) + $types[ preg_replace('/^([^.]*).*$/', '$1', basename($file)) ] =& $icon_files[$file]; + + if ( ! empty($mime) ) { + $post_mimes[] = substr($mime, 0, strpos($mime, '/')); + $post_mimes[] = substr($mime, strpos($mime, '/') + 1); + $post_mimes[] = str_replace('/', '_', $mime); + } + + $matches = wp_match_mime_types(array_keys($types), $post_mimes); + $matches['default'] = array('default'); + + foreach ( $matches as $match => $wilds ) { + if ( isset($types[$wilds[0]])) { + $icon = $types[$wilds[0]]; + if ( !is_numeric($mime) ) + wp_cache_set("mime_type_icon_$mime", $icon); + break; + } + } + } + + return apply_filters( 'wp_mime_type_icon', $icon, $mime, $post_id ); // Last arg is 0 if function pass mime type. +} + +/** + * Checked for changed slugs for published post objects and save the old slug. + * + * The function is used when a post object of any type is updated, + * by comparing the current and previous post objects. + * + * If the slug was changed and not already part of the old slugs then it will be + * added to the post meta field ('_wp_old_slug') for storing old slugs for that + * post. + * + * The most logically usage of this function is redirecting changed post objects, so + * that those that linked to an changed post will be redirected to the new post. + * + * @since 2.1.0 + * + * @param int $post_id Post ID. + * @param object $post The Post Object + * @param object $post_before The Previous Post Object + * @return int Same as $post_id + */ +function wp_check_for_changed_slugs($post_id, $post, $post_before) { + // dont bother if it hasnt changed + if ( $post->post_name == $post_before->post_name ) + return; + + // we're only concerned with published, non-hierarchical objects + if ( $post->post_status != 'publish' || is_post_type_hierarchical( $post->post_type ) ) + return; + + $old_slugs = (array) get_post_meta($post_id, '_wp_old_slug'); + + // if we haven't added this old slug before, add it now + if ( !empty( $post_before->post_name ) && !in_array($post_before->post_name, $old_slugs) ) + add_post_meta($post_id, '_wp_old_slug', $post_before->post_name); + + // if the new slug was used previously, delete it from the list + if ( in_array($post->post_name, $old_slugs) ) + delete_post_meta($post_id, '_wp_old_slug', $post->post_name); +} + +/** + * Retrieve the private post SQL based on capability. + * + * This function provides a standardized way to appropriately select on the + * post_status of a post type. The function will return a piece of SQL code + * that can be added to a WHERE clause; this SQL is constructed to allow all + * published posts, and all private posts to which the user has access. + * + * @since 2.2.0 + * + * @uses $user_ID + * + * @param string $post_type currently only supports 'post' or 'page'. + * @return string SQL code that can be added to a where clause. + */ +function get_private_posts_cap_sql( $post_type ) { + return get_posts_by_author_sql( $post_type, false ); +} + +/** + * Retrieve the post SQL based on capability, author, and type. + * + * @see get_private_posts_cap_sql() for full description. + * + * @since 3.0.0 + * @param string $post_type Post type. + * @param bool $full Optional. Returns a full WHERE statement instead of just an 'andalso' term. + * @param int $post_author Optional. Query posts having a single author ID. + * @return string SQL WHERE code that can be added to a query. + */ +function get_posts_by_author_sql( $post_type, $full = true, $post_author = null ) { + global $user_ID, $wpdb; + + // Private posts + $post_type_obj = get_post_type_object( $post_type ); + if ( ! $post_type_obj ) + return ' 1 = 0 '; + + // This hook is deprecated. Why you'd want to use it, I dunno. + if ( ! $cap = apply_filters( 'pub_priv_sql_capability', '' ) ) + $cap = $post_type_obj->cap->read_private_posts; + + if ( $full ) { + if ( null === $post_author ) { + $sql = $wpdb->prepare( 'WHERE post_type = %s AND ', $post_type ); + } else { + $sql = $wpdb->prepare( 'WHERE post_author = %d AND post_type = %s AND ', $post_author, $post_type ); + } + } else { + $sql = ''; + } + + $sql .= "(post_status = 'publish'"; + + if ( current_user_can( $cap ) ) { + // Does the user have the capability to view private posts? Guess so. + $sql .= " OR post_status = 'private'"; + } elseif ( is_user_logged_in() ) { + // Users can view their own private posts. + $id = (int) $user_ID; + if ( null === $post_author || ! $full ) { + $sql .= " OR post_status = 'private' AND post_author = $id"; + } elseif ( $id == (int) $post_author ) { + $sql .= " OR post_status = 'private'"; + } // else none + } // else none + + $sql .= ')'; + + return $sql; +} + +/** + * Retrieve the date that the last post was published. + * + * The server timezone is the default and is the difference between GMT and + * server time. The 'blog' value is the date when the last post was posted. The + * 'gmt' is when the last post was posted in GMT formatted date. + * + * @since 0.71 + * + * @uses apply_filters() Calls 'get_lastpostdate' filter + * + * @param string $timezone The location to get the time. Can be 'gmt', 'blog', or 'server'. + * @return string The date of the last post. + */ +function get_lastpostdate($timezone = 'server') { + return apply_filters( 'get_lastpostdate', _get_last_post_time( $timezone, 'date' ), $timezone ); +} + +/** + * Retrieve last post modified date depending on timezone. + * + * The server timezone is the default and is the difference between GMT and + * server time. The 'blog' value is just when the last post was modified. The + * 'gmt' is when the last post was modified in GMT time. + * + * @since 1.2.0 + * @uses apply_filters() Calls 'get_lastpostmodified' filter + * + * @param string $timezone The location to get the time. Can be 'gmt', 'blog', or 'server'. + * @return string The date the post was last modified. + */ +function get_lastpostmodified($timezone = 'server') { + $lastpostmodified = _get_last_post_time( $timezone, 'modified' ); + + $lastpostdate = get_lastpostdate($timezone); + if ( $lastpostdate > $lastpostmodified ) + $lastpostmodified = $lastpostdate; + + return apply_filters( 'get_lastpostmodified', $lastpostmodified, $timezone ); +} + +/** + * Retrieve latest post date data based on timezone. + * + * @access private + * @since 3.1.0 + * + * @param string $timezone The location to get the time. Can be 'gmt', 'blog', or 'server'. + * @param string $field Field to check. Can be 'date' or 'modified'. + * @return string The date. + */ +function _get_last_post_time( $timezone, $field ) { + global $wpdb; + + if ( !in_array( $field, array( 'date', 'modified' ) ) ) + return false; + + $timezone = strtolower( $timezone ); + + $key = "lastpost{$field}:$timezone"; + + $date = wp_cache_get( $key, 'timeinfo' ); + + if ( !$date ) { + $add_seconds_server = date('Z'); + + $post_types = get_post_types( array( 'public' => true ) ); + array_walk( $post_types, array( &$wpdb, 'escape_by_ref' ) ); + $post_types = "'" . implode( "', '", $post_types ) . "'"; + + switch ( $timezone ) { + case 'gmt': + $date = $wpdb->get_var("SELECT post_{$field}_gmt FROM $wpdb->posts WHERE post_status = 'publish' AND post_type IN ({$post_types}) ORDER BY post_{$field}_gmt DESC LIMIT 1"); + break; + case 'blog': + $date = $wpdb->get_var("SELECT post_{$field} FROM $wpdb->posts WHERE post_status = 'publish' AND post_type IN ({$post_types}) ORDER BY post_{$field}_gmt DESC LIMIT 1"); + break; + case 'server': + $date = $wpdb->get_var("SELECT DATE_ADD(post_{$field}_gmt, INTERVAL '$add_seconds_server' SECOND) FROM $wpdb->posts WHERE post_status = 'publish' AND post_type IN ({$post_types}) ORDER BY post_{$field}_gmt DESC LIMIT 1"); + break; + } + + if ( $date ) + wp_cache_set( $key, $date, 'timeinfo' ); + } + + return $date; +} + +/** + * Updates posts in cache. + * + * @usedby update_page_cache() Aliased by this function. + * + * @package WordPress + * @subpackage Cache + * @since 1.5.1 + * + * @param array $posts Array of post objects + */ +function update_post_cache(&$posts) { + if ( !$posts ) + return; + + foreach ( $posts as $post ) + wp_cache_add($post->ID, $post, 'posts'); +} + +/** + * Will clean the post in the cache. + * + * Cleaning means delete from the cache of the post. Will call to clean the term + * object cache associated with the post ID. + * + * clean_post_cache() will call itself recursively for each child post. + * + * This function not run if $_wp_suspend_cache_invalidation is not empty. See + * wp_suspend_cache_invalidation(). + * + * @package WordPress + * @subpackage Cache + * @since 2.0.0 + * + * @uses do_action() Calls 'clean_post_cache' on $id before adding children (if any). + * + * @param int $id The Post ID in the cache to clean + */ +function clean_post_cache($id) { + global $_wp_suspend_cache_invalidation, $wpdb; + + if ( !empty($_wp_suspend_cache_invalidation) ) + return; + + $id = (int) $id; + + if ( 0 === $id ) + return; + + wp_cache_delete($id, 'posts'); + wp_cache_delete($id, 'post_meta'); + + clean_object_term_cache($id, 'post'); + + wp_cache_delete( 'wp_get_archives', 'general' ); + + do_action('clean_post_cache', $id); + + if ( $children = $wpdb->get_col( $wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_parent = %d", $id) ) ) { + foreach ( $children as $cid ) { + // Loop detection + if ( $cid == $id ) + continue; + clean_post_cache( $cid ); + } + } + + if ( is_multisite() ) + wp_cache_delete( $wpdb->blogid . '-' . $id, 'global-posts' ); +} + +/** + * Alias of update_post_cache(). + * + * @see update_post_cache() Posts and pages are the same, alias is intentional + * + * @package WordPress + * @subpackage Cache + * @since 1.5.1 + * + * @param array $pages list of page objects + */ +function update_page_cache(&$pages) { + update_post_cache($pages); +} + +/** + * Will clean the page in the cache. + * + * Clean (read: delete) page from cache that matches $id. Will also clean cache + * associated with 'all_page_ids' and 'get_pages'. + * + * @package WordPress + * @subpackage Cache + * @since 2.0.0 + * + * @uses do_action() Will call the 'clean_page_cache' hook action. + * + * @param int $id Page ID to clean + */ +function clean_page_cache($id) { + clean_post_cache($id); + + wp_cache_delete( 'all_page_ids', 'posts' ); + wp_cache_delete( 'get_pages', 'posts' ); + + do_action('clean_page_cache', $id); +} + +/** + * Call major cache updating functions for list of Post objects. + * + * @package WordPress + * @subpackage Cache + * @since 1.5.0 + * + * @uses $wpdb + * @uses update_post_cache() + * @uses update_object_term_cache() + * @uses update_postmeta_cache() + * + * @param array $posts Array of Post objects + * @param string $post_type The post type of the posts in $posts. Default is 'post'. + * @param bool $update_term_cache Whether to update the term cache. Default is true. + * @param bool $update_meta_cache Whether to update the meta cache. Default is true. + */ +function update_post_caches(&$posts, $post_type = 'post', $update_term_cache = true, $update_meta_cache = true) { + // No point in doing all this work if we didn't match any posts. + if ( !$posts ) + return; + + update_post_cache($posts); + + $post_ids = array(); + foreach ( $posts as $post ) + $post_ids[] = $post->ID; + + if ( empty($post_type) ) + $post_type = 'post'; + + if ( $update_term_cache ) { + if ( is_array($post_type) ) { + $ptypes = $post_type; + } elseif ( 'any' == $post_type ) { + // Just use the post_types in the supplied posts. + foreach ( $posts as $post ) + $ptypes[] = $post->post_type; + $ptypes = array_unique($ptypes); + } else { + $ptypes = array($post_type); + } + + if ( ! empty($ptypes) ) + update_object_term_cache($post_ids, $ptypes); + } + + if ( $update_meta_cache ) + update_postmeta_cache($post_ids); +} + +/** + * Updates metadata cache for list of post IDs. + * + * Performs SQL query to retrieve the metadata for the post IDs and updates the + * metadata cache for the posts. Therefore, the functions, which call this + * function, do not need to perform SQL queries on their own. + * + * @package WordPress + * @subpackage Cache + * @since 2.1.0 + * + * @uses $wpdb + * + * @param array $post_ids List of post IDs. + * @return bool|array Returns false if there is nothing to update or an array of metadata. + */ +function update_postmeta_cache($post_ids) { + return update_meta_cache('post', $post_ids); +} + +/** + * Will clean the attachment in the cache. + * + * Cleaning means delete from the cache. Optionaly will clean the term + * object cache associated with the attachment ID. + * + * This function will not run if $_wp_suspend_cache_invalidation is not empty. See + * wp_suspend_cache_invalidation(). + * + * @package WordPress + * @subpackage Cache + * @since 3.0.0 + * + * @uses do_action() Calls 'clean_attachment_cache' on $id. + * + * @param int $id The attachment ID in the cache to clean + * @param bool $clean_terms optional. Whether to clean terms cache + */ +function clean_attachment_cache($id, $clean_terms = false) { + global $_wp_suspend_cache_invalidation; + + if ( !empty($_wp_suspend_cache_invalidation) ) + return; + + $id = (int) $id; + + wp_cache_delete($id, 'posts'); + wp_cache_delete($id, 'post_meta'); + + if ( $clean_terms ) + clean_object_term_cache($id, 'attachment'); + + do_action('clean_attachment_cache', $id); +} + +// +// Hooks +// + +/** + * Hook for managing future post transitions to published. + * + * @since 2.3.0 + * @access private + * @uses $wpdb + * @uses do_action() Calls 'private_to_published' on post ID if this is a 'private_to_published' call. + * @uses wp_clear_scheduled_hook() with 'publish_future_post' and post ID. + * + * @param string $new_status New post status + * @param string $old_status Previous post status + * @param object $post Object type containing the post information + */ +function _transition_post_status($new_status, $old_status, $post) { + global $wpdb; + + if ( $old_status != 'publish' && $new_status == 'publish' ) { + // Reset GUID if transitioning to publish and it is empty + if ( '' == get_the_guid($post->ID) ) + $wpdb->update( $wpdb->posts, array( 'guid' => get_permalink( $post->ID ) ), array( 'ID' => $post->ID ) ); + do_action('private_to_published', $post->ID); // Deprecated, use private_to_publish + } + + // If published posts changed clear the lastpostmodified cache + if ( 'publish' == $new_status || 'publish' == $old_status) { + foreach ( array( 'server', 'gmt', 'blog' ) as $timezone ) { + wp_cache_delete( "lastpostmodified:$timezone", 'timeinfo' ); + wp_cache_delete( "lastpostdate:$timezone", 'timeinfo' ); + } + } + + // Always clears the hook in case the post status bounced from future to draft. + wp_clear_scheduled_hook('publish_future_post', array( $post->ID ) ); +} + +/** + * Hook used to schedule publication for a post marked for the future. + * + * The $post properties used and must exist are 'ID' and 'post_date_gmt'. + * + * @since 2.3.0 + * @access private + * + * @param int $deprecated Not used. Can be set to null. Never implemented. + * Not marked as deprecated with _deprecated_argument() as it conflicts with + * wp_transition_post_status() and the default filter for _future_post_hook(). + * @param object $post Object type containing the post information + */ +function _future_post_hook( $deprecated = '', $post ) { + wp_clear_scheduled_hook( 'publish_future_post', array( $post->ID ) ); + wp_schedule_single_event( strtotime( get_gmt_from_date( $post->post_date ) . ' GMT') , 'publish_future_post', array( $post->ID ) ); +} + +/** + * Hook to schedule pings and enclosures when a post is published. + * + * @since 2.3.0 + * @access private + * @uses $wpdb + * @uses XMLRPC_REQUEST and APP_REQUEST constants. + * @uses do_action() Calls 'xmlprc_publish_post' on post ID if XMLRPC_REQUEST is defined. + * @uses do_action() Calls 'app_publish_post' on post ID if APP_REQUEST is defined. + * + * @param int $post_id The ID in the database table of the post being published + */ +function _publish_post_hook($post_id) { + global $wpdb; + + if ( defined('XMLRPC_REQUEST') ) + do_action('xmlrpc_publish_post', $post_id); + if ( defined('APP_REQUEST') ) + do_action('app_publish_post', $post_id); + + if ( defined('WP_IMPORTING') ) + return; + + $data = array( 'post_id' => $post_id, 'meta_value' => '1' ); + if ( get_option('default_pingback_flag') ) { + $wpdb->insert( $wpdb->postmeta, $data + array( 'meta_key' => '_pingme' ) ); + do_action( 'added_postmeta', $wpdb->insert_id, $post_id, '_pingme', 1 ); + } + $wpdb->insert( $wpdb->postmeta, $data + array( 'meta_key' => '_encloseme' ) ); + do_action( 'added_postmeta', $wpdb->insert_id, $post_id, '_encloseme', 1 ); + + wp_schedule_single_event(time(), 'do_pings'); +} + +/** + * Hook used to prevent page/post cache and rewrite rules from staying dirty. + * + * Does two things. If the post is a page and has a template then it will + * update/add that template to the meta. For both pages and posts, it will clean + * the post cache to make sure that the cache updates to the changes done + * recently. For pages, the rewrite rules of WordPress are flushed to allow for + * any changes. + * + * The $post parameter, only uses 'post_type' property and 'page_template' + * property. + * + * @since 2.3.0 + * @access private + * @uses $wp_rewrite Flushes Rewrite Rules. + * + * @param int $post_id The ID in the database table for the $post + * @param object $post Object type containing the post information + */ +function _save_post_hook($post_id, $post) { + if ( $post->post_type == 'page' ) { + clean_page_cache($post_id); + // Avoid flushing rules for every post during import. + if ( !defined('WP_IMPORTING') ) { + global $wp_rewrite; + $wp_rewrite->flush_rules(false); + } + } else { + clean_post_cache($post_id); + } +} + +/** + * Retrieve post ancestors and append to post ancestors property. + * + * Will only retrieve ancestors once, if property is already set, then nothing + * will be done. If there is not a parent post, or post ID and post parent ID + * are the same then nothing will be done. + * + * The parameter is passed by reference, so nothing needs to be returned. The + * property will be updated and can be referenced after the function is + * complete. The post parent will be an ancestor and the parent of the post + * parent will be an ancestor. There will only be two ancestors at the most. + * + * @since 2.5.0 + * @access private + * @uses $wpdb + * + * @param object $_post Post data. + * @return null When nothing needs to be done. + */ +function _get_post_ancestors(&$_post) { + global $wpdb; + + if ( isset($_post->ancestors) ) + return; + + $_post->ancestors = array(); + + if ( empty($_post->post_parent) || $_post->ID == $_post->post_parent ) + return; + + $id = $_post->ancestors[] = $_post->post_parent; + while ( $ancestor = $wpdb->get_var( $wpdb->prepare("SELECT `post_parent` FROM $wpdb->posts WHERE ID = %d LIMIT 1", $id) ) ) { + // Loop detection: If the ancestor has been seen before, break. + if ( ( $ancestor == $_post->ID ) || in_array($ancestor, $_post->ancestors) ) + break; + $id = $_post->ancestors[] = $ancestor; + } +} + +/** + * Determines which fields of posts are to be saved in revisions. + * + * Does two things. If passed a post *array*, it will return a post array ready + * to be insterted into the posts table as a post revision. Otherwise, returns + * an array whose keys are the post fields to be saved for post revisions. + * + * @package WordPress + * @subpackage Post_Revisions + * @since 2.6.0 + * @access private + * @uses apply_filters() Calls '_wp_post_revision_fields' on 'title', 'content' and 'excerpt' fields. + * + * @param array $post Optional a post array to be processed for insertion as a post revision. + * @param bool $autosave optional Is the revision an autosave? + * @return array Post array ready to be inserted as a post revision or array of fields that can be versioned. + */ +function _wp_post_revision_fields( $post = null, $autosave = false ) { + static $fields = false; + + if ( !$fields ) { + // Allow these to be versioned + $fields = array( + 'post_title' => __( 'Title' ), + 'post_content' => __( 'Content' ), + 'post_excerpt' => __( 'Excerpt' ), + ); + + // Runs only once + $fields = apply_filters( '_wp_post_revision_fields', $fields ); + + // WP uses these internally either in versioning or elsewhere - they cannot be versioned + foreach ( array( 'ID', 'post_name', 'post_parent', 'post_date', 'post_date_gmt', 'post_status', 'post_type', 'comment_count', 'post_author' ) as $protect ) + unset( $fields[$protect] ); + } + + if ( !is_array($post) ) + return $fields; + + $return = array(); + foreach ( array_intersect( array_keys( $post ), array_keys( $fields ) ) as $field ) + $return[$field] = $post[$field]; + + $return['post_parent'] = $post['ID']; + $return['post_status'] = 'inherit'; + $return['post_type'] = 'revision'; + $return['post_name'] = $autosave ? "$post[ID]-autosave" : "$post[ID]-revision"; + $return['post_date'] = isset($post['post_modified']) ? $post['post_modified'] : ''; + $return['post_date_gmt'] = isset($post['post_modified_gmt']) ? $post['post_modified_gmt'] : ''; + + return $return; +} + +/** + * Saves an already existing post as a post revision. + * + * Typically used immediately prior to post updates. + * + * @package WordPress + * @subpackage Post_Revisions + * @since 2.6.0 + * + * @uses _wp_put_post_revision() + * + * @param int $post_id The ID of the post to save as a revision. + * @return mixed Null or 0 if error, new revision ID, if success. + */ +function wp_save_post_revision( $post_id ) { + // We do autosaves manually with wp_create_post_autosave() + if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) + return; + + // WP_POST_REVISIONS = 0, false + if ( ! WP_POST_REVISIONS ) + return; + + if ( !$post = get_post( $post_id, ARRAY_A ) ) + return; + + if ( !post_type_supports($post['post_type'], 'revisions') ) + return; + + $return = _wp_put_post_revision( $post ); + + // WP_POST_REVISIONS = true (default), -1 + if ( !is_numeric( WP_POST_REVISIONS ) || WP_POST_REVISIONS < 0 ) + return $return; + + // all revisions and (possibly) one autosave + $revisions = wp_get_post_revisions( $post_id, array( 'order' => 'ASC' ) ); + + // WP_POST_REVISIONS = (int) (# of autosaves to save) + $delete = count($revisions) - WP_POST_REVISIONS; + + if ( $delete < 1 ) + return $return; + + $revisions = array_slice( $revisions, 0, $delete ); + + for ( $i = 0; isset($revisions[$i]); $i++ ) { + if ( false !== strpos( $revisions[$i]->post_name, 'autosave' ) ) + continue; + wp_delete_post_revision( $revisions[$i]->ID ); + } + + return $return; +} + +/** + * Retrieve the autosaved data of the specified post. + * + * Returns a post object containing the information that was autosaved for the + * specified post. + * + * @package WordPress + * @subpackage Post_Revisions + * @since 2.6.0 + * + * @param int $post_id The post ID. + * @return object|bool The autosaved data or false on failure or when no autosave exists. + */ +function wp_get_post_autosave( $post_id ) { + + if ( !$post = get_post( $post_id ) ) + return false; + + $q = array( + 'name' => "{$post->ID}-autosave", + 'post_parent' => $post->ID, + 'post_type' => 'revision', + 'post_status' => 'inherit' + ); + + // Use WP_Query so that the result gets cached + $autosave_query = new WP_Query; + + add_action( 'parse_query', '_wp_get_post_autosave_hack' ); + $autosave = $autosave_query->query( $q ); + remove_action( 'parse_query', '_wp_get_post_autosave_hack' ); + + if ( $autosave && is_array($autosave) && is_object($autosave[0]) ) + return $autosave[0]; + + return false; +} + +/** + * Internally used to hack WP_Query into submission. + * + * @package WordPress + * @subpackage Post_Revisions + * @since 2.6.0 + * + * @param object $query WP_Query object + */ +function _wp_get_post_autosave_hack( $query ) { + $query->is_single = false; +} + +/** + * Determines if the specified post is a revision. + * + * @package WordPress + * @subpackage Post_Revisions + * @since 2.6.0 + * + * @param int|object $post Post ID or post object. + * @return bool|int False if not a revision, ID of revision's parent otherwise. + */ +function wp_is_post_revision( $post ) { + if ( !$post = wp_get_post_revision( $post ) ) + return false; + return (int) $post->post_parent; +} + +/** + * Determines if the specified post is an autosave. + * + * @package WordPress + * @subpackage Post_Revisions + * @since 2.6.0 + * + * @param int|object $post Post ID or post object. + * @return bool|int False if not a revision, ID of autosave's parent otherwise + */ +function wp_is_post_autosave( $post ) { + if ( !$post = wp_get_post_revision( $post ) ) + return false; + if ( "{$post->post_parent}-autosave" !== $post->post_name ) + return false; + return (int) $post->post_parent; +} + +/** + * Inserts post data into the posts table as a post revision. + * + * @package WordPress + * @subpackage Post_Revisions + * @since 2.6.0 + * + * @uses wp_insert_post() + * + * @param int|object|array $post Post ID, post object OR post array. + * @param bool $autosave Optional. Is the revision an autosave? + * @return mixed Null or 0 if error, new revision ID if success. + */ +function _wp_put_post_revision( $post = null, $autosave = false ) { + if ( is_object($post) ) + $post = get_object_vars( $post ); + elseif ( !is_array($post) ) + $post = get_post($post, ARRAY_A); + if ( !$post || empty($post['ID']) ) + return; + + if ( isset($post['post_type']) && 'revision' == $post['post_type'] ) + return new WP_Error( 'post_type', __( 'Cannot create a revision of a revision' ) ); + + $post = _wp_post_revision_fields( $post, $autosave ); + $post = add_magic_quotes($post); //since data is from db + + $revision_id = wp_insert_post( $post ); + if ( is_wp_error($revision_id) ) + return $revision_id; + + if ( $revision_id ) + do_action( '_wp_put_post_revision', $revision_id ); + return $revision_id; +} + +/** + * Gets a post revision. + * + * @package WordPress + * @subpackage Post_Revisions + * @since 2.6.0 + * + * @uses get_post() + * + * @param int|object $post Post ID or post object + * @param string $output Optional. OBJECT, ARRAY_A, or ARRAY_N. + * @param string $filter Optional sanitation filter. @see sanitize_post() + * @return mixed Null if error or post object if success + */ +function &wp_get_post_revision(&$post, $output = OBJECT, $filter = 'raw') { + $null = null; + if ( !$revision = get_post( $post, OBJECT, $filter ) ) + return $revision; + if ( 'revision' !== $revision->post_type ) + return $null; + + if ( $output == OBJECT ) { + return $revision; + } elseif ( $output == ARRAY_A ) { + $_revision = get_object_vars($revision); + return $_revision; + } elseif ( $output == ARRAY_N ) { + $_revision = array_values(get_object_vars($revision)); + return $_revision; + } + + return $revision; +} + +/** + * Restores a post to the specified revision. + * + * Can restore a past revision using all fields of the post revision, or only selected fields. + * + * @package WordPress + * @subpackage Post_Revisions + * @since 2.6.0 + * + * @uses wp_get_post_revision() + * @uses wp_update_post() + * @uses do_action() Calls 'wp_restore_post_revision' on post ID and revision ID if wp_update_post() + * is successful. + * + * @param int|object $revision_id Revision ID or revision object. + * @param array $fields Optional. What fields to restore from. Defaults to all. + * @return mixed Null if error, false if no fields to restore, (int) post ID if success. + */ +function wp_restore_post_revision( $revision_id, $fields = null ) { + if ( !$revision = wp_get_post_revision( $revision_id, ARRAY_A ) ) + return $revision; + + if ( !is_array( $fields ) ) + $fields = array_keys( _wp_post_revision_fields() ); + + $update = array(); + foreach( array_intersect( array_keys( $revision ), $fields ) as $field ) + $update[$field] = $revision[$field]; + + if ( !$update ) + return false; + + $update['ID'] = $revision['post_parent']; + + $update = add_magic_quotes( $update ); //since data is from db + + $post_id = wp_update_post( $update ); + if ( is_wp_error( $post_id ) ) + return $post_id; + + if ( $post_id ) + do_action( 'wp_restore_post_revision', $post_id, $revision['ID'] ); + + return $post_id; +} + +/** + * Deletes a revision. + * + * Deletes the row from the posts table corresponding to the specified revision. + * + * @package WordPress + * @subpackage Post_Revisions + * @since 2.6.0 + * + * @uses wp_get_post_revision() + * @uses wp_delete_post() + * + * @param int|object $revision_id Revision ID or revision object. + * @return mixed Null or WP_Error if error, deleted post if success. + */ +function wp_delete_post_revision( $revision_id ) { + if ( !$revision = wp_get_post_revision( $revision_id ) ) + return $revision; + + $delete = wp_delete_post( $revision->ID ); + if ( is_wp_error( $delete ) ) + return $delete; + + if ( $delete ) + do_action( 'wp_delete_post_revision', $revision->ID, $revision ); + + return $delete; +} + +/** + * Returns all revisions of specified post. + * + * @package WordPress + * @subpackage Post_Revisions + * @since 2.6.0 + * + * @uses get_children() + * + * @param int|object $post_id Post ID or post object + * @return array empty if no revisions + */ +function wp_get_post_revisions( $post_id = 0, $args = null ) { + if ( ! WP_POST_REVISIONS ) + return array(); + if ( ( !$post = get_post( $post_id ) ) || empty( $post->ID ) ) + return array(); + + $defaults = array( 'order' => 'DESC', 'orderby' => 'date' ); + $args = wp_parse_args( $args, $defaults ); + $args = array_merge( $args, array( 'post_parent' => $post->ID, 'post_type' => 'revision', 'post_status' => 'inherit' ) ); + + if ( !$revisions = get_children( $args ) ) + return array(); + return $revisions; +} + +function _set_preview($post) { + + if ( ! is_object($post) ) + return $post; + + $preview = wp_get_post_autosave($post->ID); + + if ( ! is_object($preview) ) + return $post; + + $preview = sanitize_post($preview); + + $post->post_content = $preview->post_content; + $post->post_title = $preview->post_title; + $post->post_excerpt = $preview->post_excerpt; + + return $post; +} + +function _show_post_preview() { + + if ( isset($_GET['preview_id']) && isset($_GET['preview_nonce']) ) { + $id = (int) $_GET['preview_id']; + + if ( false == wp_verify_nonce( $_GET['preview_nonce'], 'post_preview_' . $id ) ) + wp_die( __('You do not have permission to preview drafts.') ); + + add_filter('the_preview', '_set_preview'); + } +} + +/** + * Returns the post's parent's post_ID + * + * @since 3.1.0 + * + * @param int $post_id + * + * @return int|bool false on error + */ +function wp_get_post_parent_id( $post_ID ) { + $post = get_post( $post_ID ); + if ( !$post || is_wp_error( $post ) ) + return false; + return (int) $post->post_parent; +} + +/** + * Checks the given subset of the post hierarchy for hierarchy loops. + * Prevents loops from forming and breaks those that it finds. + * + * Attached to the wp_insert_post_parent filter. + * + * @since 3.1.0 + * @uses wp_find_hierarchy_loop() + * + * @param int $post_parent ID of the parent for the post we're checking. + * @parem int $post_ID ID of the post we're checking. + * + * @return int The new post_parent for the post. + */ +function wp_check_post_hierarchy_for_loops( $post_parent, $post_ID ) { + // Nothing fancy here - bail + if ( !$post_parent ) + return 0; + + // New post can't cause a loop + if ( empty( $post_ID ) ) + return $post_parent; + + // Can't be its own parent + if ( $post_parent == $post_ID ) + return 0; + + // Now look for larger loops + + if ( !$loop = wp_find_hierarchy_loop( 'wp_get_post_parent_id', $post_ID, $post_parent ) ) + return $post_parent; // No loop + + // Setting $post_parent to the given value causes a loop + if ( isset( $loop[$post_ID] ) ) + return 0; + + // There's a loop, but it doesn't contain $post_ID. Break the loop. + foreach ( array_keys( $loop ) as $loop_member ) + wp_update_post( array( 'ID' => $loop_member, 'post_parent' => 0 ) ); + + return $post_parent; +} + +/** + * Returns an array of post format slugs to their translated and pretty display versions + * + * @since 3.1.0 + * + * @return array The array of translations + */ +function get_post_format_strings() { + $strings = array( + 'standard' => _x( 'Standard', 'Post format' ), // Special case. any value that evals to false will be considered standard + 'aside' => _x( 'Aside', 'Post format' ), + 'chat' => _x( 'Chat', 'Post format' ), + 'gallery' => _x( 'Gallery', 'Post format' ), + 'link' => _x( 'Link', 'Post format' ), + 'image' => _x( 'Image', 'Post format' ), + 'quote' => _x( 'Quote', 'Post format' ), + 'status' => _x( 'Status', 'Post format' ), + 'video' => _x( 'Video', 'Post format' ), + 'audio' => _x( 'Audio', 'Post format' ), + ); + return $strings; +} + +/** + * Retrieves an array of post format slugs. + * + * @since 3.1.0 + * + * @return array The array of post format slugs. + */ +function get_post_format_slugs() { + $slugs = array_keys( get_post_format_strings() ); + return array_combine( $slugs, $slugs ); +} + +/** + * Returns a pretty, translated version of a post format slug + * + * @since 3.1.0 + * + * @param string $slug A post format slug + * @return string The translated post format name + */ +function get_post_format_string( $slug ) { + $strings = get_post_format_strings(); + if ( !$slug ) + return $strings['standard']; + else + return ( isset( $strings[$slug] ) ) ? $strings[$slug] : ''; +} + +/** + * Sets a post thumbnail. + * + * @since 3.1.0 + * + * @param int|object $post Post ID or object where thumbnail should be attached. + * @param int $thumbnail_id Thumbnail to attach. + * @return bool True on success, false on failure. + */ +function set_post_thumbnail( $post, $thumbnail_id ) { + $post = get_post( $post ); + $thumbnail_id = absint( $thumbnail_id ); + if ( $post && $thumbnail_id && get_post( $thumbnail_id ) ) { + $thumbnail_html = wp_get_attachment_image( $thumbnail_id, 'thumbnail' ); + if ( ! empty( $thumbnail_html ) ) { + update_post_meta( $post->ID, '_thumbnail_id', $thumbnail_id ); + return true; + } + } + return false; +} + +/** + * Returns a link to a post format index. + * + * @since 3.1.0 + * + * @param $format string Post format + * @return string Link + */ +function get_post_format_link( $format ) { + $term = get_term_by('slug', 'post-format-' . $format, 'post_format' ); + if ( ! $term || is_wp_error( $term ) ) + return false; + return get_term_link( $term ); +} + +/** + * Filters the request to allow for the format prefix. + * + * @access private + * @since 3.1.0 + */ +function _post_format_request( $qvs ) { + if ( ! isset( $qvs['post_format'] ) ) + return $qvs; + $slugs = get_post_format_slugs(); + if ( isset( $slugs[ $qvs['post_format'] ] ) ) + $qvs['post_format'] = 'post-format-' . $slugs[ $qvs['post_format'] ]; + $tax = get_taxonomy( 'post_format' ); + $qvs['post_type'] = $tax->object_type; + return $qvs; +} +add_filter( 'request', '_post_format_request' ); + +/** + * Filters the post format term link to remove the format prefix. + * + * @access private + * @since 3.1.0 + */ +function _post_format_link( $link, $term, $taxonomy ) { + global $wp_rewrite; + if ( 'post_format' != $taxonomy ) + return $link; + if ( $wp_rewrite->get_extra_permastruct( $taxonomy ) ) { + return str_replace( "/{$term->slug}", '/' . str_replace( 'post-format-', '', $term->slug ), $link ); + } else { + $link = remove_query_arg( 'post_format', $link ); + return add_query_arg( 'post_format', str_replace( 'post-format-', '', $term->slug ), $link ); + } +} +add_filter( 'term_link', '_post_format_link', 10, 3 ); + +/** + * Remove the post format prefix from the name property of the term object created by get_term(). + * + * @access private + * @since 3.1.0 + */ +function _post_format_get_term( $term ) { + if ( isset( $term->slug ) ) { + $term->name = get_post_format_string( str_replace( 'post-format-', '', $term->slug ) ); + } + return $term; +} +add_filter( 'get_post_format', '_post_format_get_term' ); + +/** + * Remove the post format prefix from the name property of the term objects created by get_terms(). + * + * @access private + * @since 3.1.0 + */ +function _post_format_get_terms( $terms, $taxonomies, $args ) { + if ( in_array( 'post_format', (array) $taxonomies ) ) { + if ( isset( $args['fields'] ) && 'names' == $args['fields'] ) { + foreach( $terms as $order => $name ) { + $terms[$order] = get_post_format_string( str_replace( 'post-format-', '', $name ) ); + } + } else { + foreach ( (array) $terms as $order => $term ) { + if ( isset( $term->taxonomy ) && 'post_format' == $term->taxonomy ) { + $terms[$order]->name = get_post_format_string( str_replace( 'post-format-', '', $term->slug ) ); + } + } + } + } + return $terms; +} +add_filter( 'get_terms', '_post_format_get_terms', 10, 3 ); + +/** + * Remove the post format prefix from the name property of the term objects created by wp_get_object_terms(). + * + * @access private + * @since 3.1.0 + */ +function _post_format_wp_get_object_terms( $terms ) { + foreach ( (array) $terms as $order => $term ) { + if ( isset( $term->taxonomy ) && 'post_format' == $term->taxonomy ) { + $terms[$order]->name = get_post_format_string( str_replace( 'post-format-', '', $term->slug ) ); + } + } + return $terms; +} +add_filter( 'wp_get_object_terms', '_post_format_wp_get_object_terms' ); + +?> diff --git a/src/wp-includes/query.php b/src/wp-includes/query.php new file mode 100644 index 0000000..d70348c --- /dev/null +++ b/src/wp-includes/query.php @@ -0,0 +1,3575 @@ +get($var); +} + + +/** + * Retrieve the currently-queried object. Wrapper for $wp_query->get_queried_object() + * + * @uses WP_Query::get_queried_object + * + * @since 3.1.0 + * @access public + * + * @return object + */ +function get_queried_object() { + global $wp_query; + return $wp_query->get_queried_object(); +} + +/** + * Retrieve ID of the current queried object. Wrapper for $wp_query->get_queried_object_id() + * + * @uses WP_Query::get_queried_object_id() + * + * @since 3.1.0 + * @access public + * + * @return int + */ +function get_queried_object_id() { + global $wp_query; + return $wp_query->get_queried_object_id(); +} + +/** + * Set query variable. + * + * @see WP_Query::set() + * @since 2.2.0 + * @uses $wp_query + * + * @param string $var Query variable key. + * @param mixed $value + * @return null + */ +function set_query_var($var, $value) { + global $wp_query; + + return $wp_query->set($var, $value); +} + +/** + * Set up The Loop with query parameters. + * + * This will override the current WordPress Loop and shouldn't be used more than + * once. This must not be used within the WordPress Loop. + * + * @since 1.5.0 + * @uses $wp_query + * + * @param string $query + * @return array List of posts + */ +function &query_posts($query) { + unset($GLOBALS['wp_query']); + $GLOBALS['wp_query'] =& new WP_Query(); + return $GLOBALS['wp_query']->query($query); +} + +/** + * Destroy the previous query and set up a new query. + * + * This should be used after {@link query_posts()} and before another {@link + * query_posts()}. This will remove obscure bugs that occur when the previous + * wp_query object is not destroyed properly before another is set up. + * + * @since 2.3.0 + * @uses $wp_query + */ +function wp_reset_query() { + unset($GLOBALS['wp_query']); + $GLOBALS['wp_query'] =& $GLOBALS['wp_the_query']; + wp_reset_postdata(); +} + +/** + * After looping through a separate query, this function restores + * the $post global to the current post in the main query + * + * @since 3.0.0 + * @uses $wp_query + */ +function wp_reset_postdata() { + global $wp_query; + if ( !empty($wp_query->post) ) { + $GLOBALS['post'] = $wp_query->post; + setup_postdata($wp_query->post); + } +} + +/* + * Query type checks. + */ + +/** + * Is the query for an archive page? + * + * Month, Year, Category, Author, Post Type archive... + * + * @see WP_Query::is_archive() + * @since 1.5.0 + * @uses $wp_query + * + * @return bool + */ +function is_archive() { + global $wp_query; + + if ( ! isset( $wp_query ) ) { + _doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1' ); + return false; + } + + return $wp_query->is_archive(); +} + +/** + * Is the query for a post type archive page? + * + * @see WP_Query::is_post_type_archive() + * @since 3.1.0 + * @uses $wp_query + * + * @param mixed $post_types Optional. Post type or array of posts types to check against. + * @return bool + */ +function is_post_type_archive( $post_types = '' ) { + global $wp_query; + + if ( ! isset( $wp_query ) ) { + _doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1' ); + return false; + } + + return $wp_query->is_post_type_archive( $post_types ); +} + +/** + * Is the query for an attachment page? + * + * @see WP_Query::is_attachment() + * @since 2.0.0 + * @uses $wp_query + * + * @return bool + */ +function is_attachment() { + global $wp_query; + + if ( ! isset( $wp_query ) ) { + _doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1' ); + return false; + } + + return $wp_query->is_attachment(); +} + +/** + * Is the query for an author archive page? + * + * If the $author parameter is specified, this function will additionally + * check if the query is for one of the authors specified. + * + * @see WP_Query::is_author() + * @since 1.5.0 + * @uses $wp_query + * + * @param mixed $author Optional. User ID, nickname, nicename, or array of User IDs, nicknames, and nicenames + * @return bool + */ +function is_author( $author = '' ) { + global $wp_query; + + if ( ! isset( $wp_query ) ) { + _doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1' ); + return false; + } + + return $wp_query->is_author( $author ); +} + +/** + * Is the query for a category archive page? + * + * If the $category parameter is specified, this function will additionally + * check if the query is for one of the categories specified. + * + * @see WP_Query::is_category() + * @since 1.5.0 + * @uses $wp_query + * + * @param mixed $category Optional. Category ID, name, slug, or array of Category IDs, names, and slugs. + * @return bool + */ +function is_category( $category = '' ) { + global $wp_query; + + if ( ! isset( $wp_query ) ) { + _doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1' ); + return false; + } + + return $wp_query->is_category( $category ); +} + +/** + * Is the query for a tag archive page? + * + * If the $tag parameter is specified, this function will additionally + * check if the query is for one of the tags specified. + * + * @see WP_Query::is_tag() + * @since 2.3.0 + * @uses $wp_query + * + * @param mixed $slug Optional. Tag slug or array of slugs. + * @return bool + */ +function is_tag( $slug = '' ) { + global $wp_query; + + if ( ! isset( $wp_query ) ) { + _doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1' ); + return false; + } + + return $wp_query->is_tag( $slug ); +} + +/** + * Is the query for a taxonomy archive page? + * + * If the $taxonomy parameter is specified, this function will additionally + * check if the query is for that specific $taxonomy. + * + * If the $term parameter is specified in addition to the $taxonomy parameter, + * this function will additionally check if the query is for one of the terms + * specified. + * + * @see WP_Query::is_tax() + * @since 2.5.0 + * @uses $wp_query + * + * @param mixed $taxonomy Optional. Taxonomy slug or slugs. + * @param mixed $term Optional. Term ID, name, slug or array of Term IDs, names, and slugs. + * @return bool + */ +function is_tax( $taxonomy = '', $term = '' ) { + global $wp_query; + + if ( ! isset( $wp_query ) ) { + _doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1' ); + return false; + } + + return $wp_query->is_tax( $taxonomy, $term ); +} + +/** + * Whether the current URL is within the comments popup window. + * + * @see WP_Query::is_comments_popup() + * @since 1.5.0 + * @uses $wp_query + * + * @return bool + */ +function is_comments_popup() { + global $wp_query; + + if ( ! isset( $wp_query ) ) { + _doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1' ); + return false; + } + + return $wp_query->is_comments_popup(); +} + +/** + * Is the query for a date archive? + * + * @see WP_Query::is_date() + * @since 1.5.0 + * @uses $wp_query + * + * @return bool + */ +function is_date() { + global $wp_query; + + if ( ! isset( $wp_query ) ) { + _doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1' ); + return false; + } + + return $wp_query->is_date(); +} + +/** + * Is the query for a day archive? + * + * @see WP_Query::is_day() + * @since 1.5.0 + * @uses $wp_query + * + * @return bool + */ +function is_day() { + global $wp_query; + + if ( ! isset( $wp_query ) ) { + _doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1' ); + return false; + } + + return $wp_query->is_day(); +} + +/** + * Is the query for a feed? + * + * @see WP_Query::is_feed() + * @since 1.5.0 + * @uses $wp_query + * + * @param string|array $feeds Optional feed types to check. + * @return bool + */ +function is_feed( $feeds = '' ) { + global $wp_query; + + if ( ! isset( $wp_query ) ) { + _doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1' ); + return false; + } + + return $wp_query->is_feed( $feeds ); +} + +/** + * Is the query for a comments feed? + * + * @see WP_Query::is_comments_feed() + * @since 3.0.0 + * @uses $wp_query + * + * @return bool + */ +function is_comment_feed() { + global $wp_query; + + if ( ! isset( $wp_query ) ) { + _doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1' ); + return false; + } + + return $wp_query->is_comment_feed(); +} + +/** + * Is the query for the front page of the site? + * + * This is for what is displayed at your site's main URL. + * + * Depends on the site's "Front page displays" Reading Settings 'show_on_front' and 'page_on_front'. + * + * If you set a static page for the front page of your site, this function will return + * true when viewing that page. + * + * Otherwise the same as @see is_home() + * + * @see WP_Query::is_front_page() + * @since 2.5.0 + * @uses is_home() + * @uses get_option() + * + * @return bool True, if front of site. + */ +function is_front_page() { + global $wp_query; + + if ( ! isset( $wp_query ) ) { + _doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1' ); + return false; + } + + return $wp_query->is_front_page(); +} + +/** + * Is the query for the blog homepage? + * + * This is the page which shows the time based blog content of your site. + * + * Depends on the site's "Front page displays" Reading Settings 'show_on_front' and 'page_for_posts'. + * + * If you set a static page for the front page of your site, this function will return + * true only on the page you set as the "Posts page". + * + * @see is_front_page() + * + * @see WP_Query::is_home() + * @since 1.5.0 + * @uses $wp_query + * + * @return bool True if blog view homepage. + */ +function is_home() { + global $wp_query; + + if ( ! isset( $wp_query ) ) { + _doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1' ); + return false; + } + + return $wp_query->is_home(); +} + +/** + * Is the query for a month archive? + * + * @see WP_Query::is_month() + * @since 1.5.0 + * @uses $wp_query + * + * @return bool + */ +function is_month() { + global $wp_query; + + if ( ! isset( $wp_query ) ) { + _doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1' ); + return false; + } + + return $wp_query->is_month(); +} + +/** + * Is the query for a single page? + * + * If the $page parameter is specified, this function will additionally + * check if the query is for one of the pages specified. + * + * @see is_single() + * @see is_singular() + * + * @see WP_Query::is_page() + * @since 1.5.0 + * @uses $wp_query + * + * @param mixed $page Page ID, title, slug, or array of such. + * @return bool + */ +function is_page( $page = '' ) { + global $wp_query; + + if ( ! isset( $wp_query ) ) { + _doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1' ); + return false; + } + + return $wp_query->is_page( $page ); +} + +/** + * Is the query for paged result and not for the first page? + * + * @see WP_Query::is_paged() + * @since 1.5.0 + * @uses $wp_query + * + * @return bool + */ +function is_paged() { + global $wp_query; + + if ( ! isset( $wp_query ) ) { + _doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1' ); + return false; + } + + return $wp_query->is_paged(); +} + +/** + * Is the query for a post or page preview? + * + * @see WP_Query::is_preview() + * @since 2.0.0 + * @uses $wp_query + * + * @return bool + */ +function is_preview() { + global $wp_query; + + if ( ! isset( $wp_query ) ) { + _doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1' ); + return false; + } + + return $wp_query->is_preview(); +} + +/** + * Is the query for the robots file? + * + * @see WP_Query::is_robots() + * @since 2.1.0 + * @uses $wp_query + * + * @return bool + */ +function is_robots() { + global $wp_query; + + if ( ! isset( $wp_query ) ) { + _doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1' ); + return false; + } + + return $wp_query->is_robots(); +} + +/** + * Is the query for a search? + * + * @see WP_Query::is_search() + * @since 1.5.0 + * @uses $wp_query + * + * @return bool + */ +function is_search() { + global $wp_query; + + if ( ! isset( $wp_query ) ) { + _doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1' ); + return false; + } + + return $wp_query->is_search(); +} + +/** + * Is the query for a single post? + * + * Works for any post type, except attachments and pages + * + * If the $post parameter is specified, this function will additionally + * check if the query is for one of the Posts specified. + * + * @see is_page() + * @see is_singular() + * + * @see WP_Query::is_single() + * @since 1.5.0 + * @uses $wp_query + * + * @param mixed $post Post ID, title, slug, or array of such. + * @return bool + */ +function is_single( $post = '' ) { + global $wp_query; + + if ( ! isset( $wp_query ) ) { + _doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1' ); + return false; + } + + return $wp_query->is_single( $post ); +} + +/** + * Is the query for a single post of any post type (post, attachment, page, ... )? + * + * If the $post_types parameter is specified, this function will additionally + * check if the query is for one of the Posts Types specified. + * + * @see is_page() + * @see is_single() + * + * @see WP_Query::is_singular() + * @since 1.5.0 + * @uses $wp_query + * + * @param mixed $post_types Optional. Post Type or array of Post Types + * @return bool + */ +function is_singular( $post_types = '' ) { + global $wp_query; + + if ( ! isset( $wp_query ) ) { + _doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1' ); + return false; + } + + return $wp_query->is_singular( $post_types ); +} + +/** + * Is the query for a specific time? + * + * @see WP_Query::is_time() + * @since 1.5.0 + * @uses $wp_query + * + * @return bool + */ +function is_time() { + global $wp_query; + + if ( ! isset( $wp_query ) ) { + _doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1' ); + return false; + } + + return $wp_query->is_time(); +} + +/** + * Is the query for a trackback endpoint call? + * + * @see WP_Query::is_trackback() + * @since 1.5.0 + * @uses $wp_query + * + * @return bool + */ +function is_trackback() { + global $wp_query; + + if ( ! isset( $wp_query ) ) { + _doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1' ); + return false; + } + + return $wp_query->is_trackback(); +} + +/** + * Is the query for a specific year? + * + * @see WP_Query::is_year() + * @since 1.5.0 + * @uses $wp_query + * + * @return bool + */ +function is_year() { + global $wp_query; + + if ( ! isset( $wp_query ) ) { + _doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1' ); + return false; + } + + return $wp_query->is_year(); +} + +/** + * Is the query a 404 (returns no results)? + * + * @see WP_Query::is_404() + * @since 1.5.0 + * @uses $wp_query + * + * @return bool + */ +function is_404() { + global $wp_query; + + if ( ! isset( $wp_query ) ) { + _doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1' ); + return false; + } + + return $wp_query->is_404(); +} + +/* + * The Loop. Post loop control. + */ + +/** + * Whether current WordPress query has results to loop over. + * + * @see WP_Query::have_posts() + * @since 1.5.0 + * @uses $wp_query + * + * @return bool + */ +function have_posts() { + global $wp_query; + + return $wp_query->have_posts(); +} + +/** + * Whether the caller is in the Loop. + * + * @since 2.0.0 + * @uses $wp_query + * + * @return bool True if caller is within loop, false if loop hasn't started or ended. + */ +function in_the_loop() { + global $wp_query; + + return $wp_query->in_the_loop; +} + +/** + * Rewind the loop posts. + * + * @see WP_Query::rewind_posts() + * @since 1.5.0 + * @uses $wp_query + * + * @return null + */ +function rewind_posts() { + global $wp_query; + + return $wp_query->rewind_posts(); +} + +/** + * Iterate the post index in the loop. + * + * @see WP_Query::the_post() + * @since 1.5.0 + * @uses $wp_query + */ +function the_post() { + global $wp_query; + + $wp_query->the_post(); +} + +/* + * Comments loop. + */ + +/** + * Whether there are comments to loop over. + * + * @see WP_Query::have_comments() + * @since 2.2.0 + * @uses $wp_query + * + * @return bool + */ +function have_comments() { + global $wp_query; + return $wp_query->have_comments(); +} + +/** + * Iterate comment index in the comment loop. + * + * @see WP_Query::the_comment() + * @since 2.2.0 + * @uses $wp_query + * + * @return object + */ +function the_comment() { + global $wp_query; + return $wp_query->the_comment(); +} + +/* + * WP_Query + */ + +/** + * The WordPress Query class. + * + * @link http://codex.wordpress.org/Function_Reference/WP_Query Codex page. + * + * @since 1.5.0 + */ +class WP_Query { + + /** + * Query vars set by the user + * + * @since 1.5.0 + * @access public + * @var array + */ + var $query; + + /** + * Query vars, after parsing + * + * @since 1.5.0 + * @access public + * @var array + */ + var $query_vars = array(); + + /** + * Taxonomy query, as passed to get_tax_sql() + * + * @since 3.1.0 + * @access public + * @var object WP_Tax_Query + */ + var $tax_query; + + /** + * Metadata query container + * + * @since 3.2.0 + * @access public + * @var object WP_Meta_Query + */ + var $meta_query = false; + + /** + * Holds the data for a single object that is queried. + * + * Holds the contents of a post, page, category, attachment. + * + * @since 1.5.0 + * @access public + * @var object|array + */ + var $queried_object; + + /** + * The ID of the queried object. + * + * @since 1.5.0 + * @access public + * @var int + */ + var $queried_object_id; + + /** + * Get post database query. + * + * @since 2.0.1 + * @access public + * @var string + */ + var $request; + + /** + * List of posts. + * + * @since 1.5.0 + * @access public + * @var array + */ + var $posts; + + /** + * The amount of posts for the current query. + * + * @since 1.5.0 + * @access public + * @var int + */ + var $post_count = 0; + + /** + * Index of the current item in the loop. + * + * @since 1.5.0 + * @access public + * @var int + */ + var $current_post = -1; + + /** + * Whether the loop has started and the caller is in the loop. + * + * @since 2.0.0 + * @access public + * @var bool + */ + var $in_the_loop = false; + + /** + * The current post ID. + * + * @since 1.5.0 + * @access public + * @var object + */ + var $post; + + /** + * The list of comments for current post. + * + * @since 2.2.0 + * @access public + * @var array + */ + var $comments; + + /** + * The amount of comments for the posts. + * + * @since 2.2.0 + * @access public + * @var int + */ + var $comment_count = 0; + + /** + * The index of the comment in the comment loop. + * + * @since 2.2.0 + * @access public + * @var int + */ + var $current_comment = -1; + + /** + * Current comment ID. + * + * @since 2.2.0 + * @access public + * @var int + */ + var $comment; + + /** + * Amount of posts if limit clause was not used. + * + * @since 2.1.0 + * @access public + * @var int + */ + var $found_posts = 0; + + /** + * The amount of pages. + * + * @since 2.1.0 + * @access public + * @var int + */ + var $max_num_pages = 0; + + /** + * The amount of comment pages. + * + * @since 2.7.0 + * @access public + * @var int + */ + var $max_num_comment_pages = 0; + + /** + * Set if query is single post. + * + * @since 1.5.0 + * @access public + * @var bool + */ + var $is_single = false; + + /** + * Set if query is preview of blog. + * + * @since 2.0.0 + * @access public + * @var bool + */ + var $is_preview = false; + + /** + * Set if query returns a page. + * + * @since 1.5.0 + * @access public + * @var bool + */ + var $is_page = false; + + /** + * Set if query is an archive list. + * + * @since 1.5.0 + * @access public + * @var bool + */ + var $is_archive = false; + + /** + * Set if query is part of a date. + * + * @since 1.5.0 + * @access public + * @var bool + */ + var $is_date = false; + + /** + * Set if query contains a year. + * + * @since 1.5.0 + * @access public + * @var bool + */ + var $is_year = false; + + /** + * Set if query contains a month. + * + * @since 1.5.0 + * @access public + * @var bool + */ + var $is_month = false; + + /** + * Set if query contains a day. + * + * @since 1.5.0 + * @access public + * @var bool + */ + var $is_day = false; + + /** + * Set if query contains time. + * + * @since 1.5.0 + * @access public + * @var bool + */ + var $is_time = false; + + /** + * Set if query contains an author. + * + * @since 1.5.0 + * @access public + * @var bool + */ + var $is_author = false; + + /** + * Set if query contains category. + * + * @since 1.5.0 + * @access public + * @var bool + */ + var $is_category = false; + + /** + * Set if query contains tag. + * + * @since 2.3.0 + * @access public + * @var bool + */ + var $is_tag = false; + + /** + * Set if query contains taxonomy. + * + * @since 2.5.0 + * @access public + * @var bool + */ + var $is_tax = false; + + /** + * Set if query was part of a search result. + * + * @since 1.5.0 + * @access public + * @var bool + */ + var $is_search = false; + + /** + * Set if query is feed display. + * + * @since 1.5.0 + * @access public + * @var bool + */ + var $is_feed = false; + + /** + * Set if query is comment feed display. + * + * @since 2.2.0 + * @access public + * @var bool + */ + var $is_comment_feed = false; + + /** + * Set if query is trackback. + * + * @since 1.5.0 + * @access public + * @var bool + */ + var $is_trackback = false; + + /** + * Set if query is blog homepage. + * + * @since 1.5.0 + * @access public + * @var bool + */ + var $is_home = false; + + /** + * Set if query couldn't found anything. + * + * @since 1.5.0 + * @access public + * @var bool + */ + var $is_404 = false; + + /** + * Set if query is within comments popup window. + * + * @since 1.5.0 + * @access public + * @var bool + */ + var $is_comments_popup = false; + + /** + * Set if query is paged + * + * @since 1.5.0 + * @access public + * @var bool + */ + var $is_paged = false; + + /** + * Set if query is part of administration page. + * + * @since 1.5.0 + * @access public + * @var bool + */ + var $is_admin = false; + + /** + * Set if query is an attachment. + * + * @since 2.0.0 + * @access public + * @var bool + */ + var $is_attachment = false; + + /** + * Set if is single, is a page, or is an attachment. + * + * @since 2.1.0 + * @access public + * @var bool + */ + var $is_singular = false; + + /** + * Set if query is for robots. + * + * @since 2.1.0 + * @access public + * @var bool + */ + var $is_robots = false; + + /** + * Set if query contains posts. + * + * Basically, the homepage if the option isn't set for the static homepage. + * + * @since 2.1.0 + * @access public + * @var bool + */ + var $is_posts_page = false; + + /** + * Set if query is for a post type archive. + * + * @since 3.1.0 + * @access public + * @var bool + */ + var $is_post_type_archive = false; + + /** + * Stores the ->query_vars state like md5(serialize( $this->query_vars ) ) so we know + * whether we have to re-parse because something has changed + * + * @since 3.1.0 + * @access private + */ + var $query_vars_hash = false; + + /** + * Whether query vars have changed since the initial parse_query() call. Used to catch modifications to query vars made + * via pre_get_posts hooks. + * + * @since 3.1.1 + * @access private + */ + var $query_vars_changed = true; + + /** + * Set if post thumbnails are cached + * + * @since 3.2.0 + * @access public + * @var bool + */ + var $thumbnails_cached = false; + + /** + * Resets query flags to false. + * + * The query flags are what page info WordPress was able to figure out. + * + * @since 2.0.0 + * @access private + */ + function init_query_flags() { + $this->is_single = false; + $this->is_preview = false; + $this->is_page = false; + $this->is_archive = false; + $this->is_date = false; + $this->is_year = false; + $this->is_month = false; + $this->is_day = false; + $this->is_time = false; + $this->is_author = false; + $this->is_category = false; + $this->is_tag = false; + $this->is_tax = false; + $this->is_search = false; + $this->is_feed = false; + $this->is_comment_feed = false; + $this->is_trackback = false; + $this->is_home = false; + $this->is_404 = false; + $this->is_comments_popup = false; + $this->is_paged = false; + $this->is_admin = false; + $this->is_attachment = false; + $this->is_singular = false; + $this->is_robots = false; + $this->is_posts_page = false; + $this->is_post_type_archive = false; + } + + /** + * Initiates object properties and sets default values. + * + * @since 1.5.0 + * @access public + */ + function init() { + unset($this->posts); + unset($this->query); + $this->query_vars = array(); + unset($this->queried_object); + unset($this->queried_object_id); + $this->post_count = 0; + $this->current_post = -1; + $this->in_the_loop = false; + unset( $this->request ); + unset( $this->post ); + unset( $this->comments ); + unset( $this->comment ); + $this->comment_count = 0; + $this->current_comment = -1; + $this->found_posts = 0; + $this->max_num_pages = 0; + $this->max_num_comment_pages = 0; + + $this->init_query_flags(); + } + + /** + * Reparse the query vars. + * + * @since 1.5.0 + * @access public + */ + function parse_query_vars() { + $this->parse_query(); + } + + /** + * Fills in the query variables, which do not exist within the parameter. + * + * @since 2.1.0 + * @access public + * + * @param array $array Defined query variables. + * @return array Complete query variables with undefined ones filled in empty. + */ + function fill_query_vars($array) { + $keys = array( + 'error' + , 'm' + , 'p' + , 'post_parent' + , 'subpost' + , 'subpost_id' + , 'attachment' + , 'attachment_id' + , 'name' + , 'static' + , 'pagename' + , 'page_id' + , 'second' + , 'minute' + , 'hour' + , 'day' + , 'monthnum' + , 'year' + , 'w' + , 'category_name' + , 'tag' + , 'cat' + , 'tag_id' + , 'author_name' + , 'feed' + , 'tb' + , 'paged' + , 'comments_popup' + , 'meta_key' + , 'meta_value' + , 'preview' + , 's' + , 'sentence' + , 'fields' + ); + + foreach ( $keys as $key ) { + if ( !isset($array[$key]) ) + $array[$key] = ''; + } + + $array_keys = array('category__in', 'category__not_in', 'category__and', 'post__in', 'post__not_in', + 'tag__in', 'tag__not_in', 'tag__and', 'tag_slug__in', 'tag_slug__and'); + + foreach ( $array_keys as $key ) { + if ( !isset($array[$key]) ) + $array[$key] = array(); + } + return $array; + } + + /** + * Parse a query string and set query type booleans. + * + * @since 1.5.0 + * @access public + * + * @param string|array $query Optional query. + */ + function parse_query( $query = '' ) { + if ( ! empty( $query ) ) { + $this->init(); + $this->query = $this->query_vars = wp_parse_args( $query ); + } elseif ( ! isset( $this->query ) ) { + $this->query = $this->query_vars; + } + + $this->query_vars = $this->fill_query_vars($this->query_vars); + $qv = &$this->query_vars; + $this->query_vars_changed = true; + + if ( ! empty($qv['robots']) ) + $this->is_robots = true; + + $qv['p'] = absint($qv['p']); + $qv['page_id'] = absint($qv['page_id']); + $qv['year'] = absint($qv['year']); + $qv['monthnum'] = absint($qv['monthnum']); + $qv['day'] = absint($qv['day']); + $qv['w'] = absint($qv['w']); + $qv['m'] = absint($qv['m']); + $qv['paged'] = absint($qv['paged']); + $qv['cat'] = preg_replace( '|[^0-9,-]|', '', $qv['cat'] ); // comma separated list of positive or negative integers + $qv['pagename'] = trim( $qv['pagename'] ); + $qv['name'] = trim( $qv['name'] ); + if ( '' !== $qv['hour'] ) $qv['hour'] = absint($qv['hour']); + if ( '' !== $qv['minute'] ) $qv['minute'] = absint($qv['minute']); + if ( '' !== $qv['second'] ) $qv['second'] = absint($qv['second']); + + // Compat. Map subpost to attachment. + if ( '' != $qv['subpost'] ) + $qv['attachment'] = $qv['subpost']; + if ( '' != $qv['subpost_id'] ) + $qv['attachment_id'] = $qv['subpost_id']; + + $qv['attachment_id'] = absint($qv['attachment_id']); + + if ( ('' != $qv['attachment']) || !empty($qv['attachment_id']) ) { + $this->is_single = true; + $this->is_attachment = true; + } elseif ( '' != $qv['name'] ) { + $this->is_single = true; + } elseif ( $qv['p'] ) { + $this->is_single = true; + } elseif ( ('' !== $qv['hour']) && ('' !== $qv['minute']) &&('' !== $qv['second']) && ('' != $qv['year']) && ('' != $qv['monthnum']) && ('' != $qv['day']) ) { + // If year, month, day, hour, minute, and second are set, a single + // post is being queried. + $this->is_single = true; + } elseif ( '' != $qv['static'] || '' != $qv['pagename'] || !empty($qv['page_id']) ) { + $this->is_page = true; + $this->is_single = false; + } else { + // Look for archive queries. Dates, categories, authors, search, post type archives. + + if ( !empty($qv['s']) ) { + $this->is_search = true; + } + + if ( '' !== $qv['second'] ) { + $this->is_time = true; + $this->is_date = true; + } + + if ( '' !== $qv['minute'] ) { + $this->is_time = true; + $this->is_date = true; + } + + if ( '' !== $qv['hour'] ) { + $this->is_time = true; + $this->is_date = true; + } + + if ( $qv['day'] ) { + if ( ! $this->is_date ) { + $this->is_day = true; + $this->is_date = true; + } + } + + if ( $qv['monthnum'] ) { + if ( ! $this->is_date ) { + $this->is_month = true; + $this->is_date = true; + } + } + + if ( $qv['year'] ) { + if ( ! $this->is_date ) { + $this->is_year = true; + $this->is_date = true; + } + } + + if ( $qv['m'] ) { + $this->is_date = true; + if ( strlen($qv['m']) > 9 ) { + $this->is_time = true; + } else if ( strlen($qv['m']) > 7 ) { + $this->is_day = true; + } else if ( strlen($qv['m']) > 5 ) { + $this->is_month = true; + } else { + $this->is_year = true; + } + } + + if ( '' != $qv['w'] ) { + $this->is_date = true; + } + + $this->query_vars_hash = false; + $this->parse_tax_query( $qv ); + + foreach ( $this->tax_query->queries as $tax_query ) { + if ( 'NOT IN' != $tax_query['operator'] ) { + switch ( $tax_query['taxonomy'] ) { + case 'category': + $this->is_category = true; + break; + case 'post_tag': + $this->is_tag = true; + break; + default: + $this->is_tax = true; + } + } + } + unset( $tax_query ); + + if ( empty($qv['author']) || ($qv['author'] == '0') ) { + $this->is_author = false; + } else { + $this->is_author = true; + } + + if ( '' != $qv['author_name'] ) + $this->is_author = true; + + if ( !empty( $qv['post_type'] ) && ! is_array( $qv['post_type'] ) ) { + $post_type_obj = get_post_type_object( $qv['post_type'] ); + if ( ! empty( $post_type_obj->has_archive ) ) + $this->is_post_type_archive = true; + } + + if ( $this->is_post_type_archive || $this->is_date || $this->is_author || $this->is_category || $this->is_tag || $this->is_tax ) + $this->is_archive = true; + } + + if ( '' != $qv['feed'] ) + $this->is_feed = true; + + if ( '' != $qv['tb'] ) + $this->is_trackback = true; + + if ( '' != $qv['paged'] && ( intval($qv['paged']) > 1 ) ) + $this->is_paged = true; + + if ( '' != $qv['comments_popup'] ) + $this->is_comments_popup = true; + + // if we're previewing inside the write screen + if ( '' != $qv['preview'] ) + $this->is_preview = true; + + if ( is_admin() ) + $this->is_admin = true; + + if ( false !== strpos($qv['feed'], 'comments-') ) { + $qv['feed'] = str_replace('comments-', '', $qv['feed']); + $qv['withcomments'] = 1; + } + + $this->is_singular = $this->is_single || $this->is_page || $this->is_attachment; + + if ( $this->is_feed && ( !empty($qv['withcomments']) || ( empty($qv['withoutcomments']) && $this->is_singular ) ) ) + $this->is_comment_feed = true; + + if ( !( $this->is_singular || $this->is_archive || $this->is_search || $this->is_feed || $this->is_trackback || $this->is_404 || $this->is_admin || $this->is_comments_popup || $this->is_robots ) ) + $this->is_home = true; + + // Correct is_* for page_on_front and page_for_posts + if ( $this->is_home && 'page' == get_option('show_on_front') && get_option('page_on_front') ) { + $_query = wp_parse_args($this->query); + // pagename can be set and empty depending on matched rewrite rules. Ignore an empty pagename. + if ( isset($_query['pagename']) && '' == $_query['pagename'] ) + unset($_query['pagename']); + if ( empty($_query) || !array_diff( array_keys($_query), array('preview', 'page', 'paged', 'cpage') ) ) { + $this->is_page = true; + $this->is_home = false; + $qv['page_id'] = get_option('page_on_front'); + // Correct for page_on_front + if ( !empty($qv['paged']) ) { + $qv['page'] = $qv['paged']; + unset($qv['paged']); + } + } + } + + if ( '' != $qv['pagename'] ) { + $this->queried_object =& get_page_by_path($qv['pagename']); + if ( !empty($this->queried_object) ) + $this->queried_object_id = (int) $this->queried_object->ID; + else + unset($this->queried_object); + + if ( 'page' == get_option('show_on_front') && isset($this->queried_object_id) && $this->queried_object_id == get_option('page_for_posts') ) { + $this->is_page = false; + $this->is_home = true; + $this->is_posts_page = true; + } + } + + if ( $qv['page_id'] ) { + if ( 'page' == get_option('show_on_front') && $qv['page_id'] == get_option('page_for_posts') ) { + $this->is_page = false; + $this->is_home = true; + $this->is_posts_page = true; + } + } + + if ( !empty($qv['post_type']) ) { + if ( is_array($qv['post_type']) ) + $qv['post_type'] = array_map('sanitize_key', $qv['post_type']); + else + $qv['post_type'] = sanitize_key($qv['post_type']); + } + + if ( ! empty( $qv['post_status'] ) ) { + if ( is_array( $qv['post_status'] ) ) + $qv['post_status'] = array_map('sanitize_key', $qv['post_status']); + else + $qv['post_status'] = preg_replace('|[^a-z0-9_,-]|', '', $qv['post_status']); + } + + if ( $this->is_posts_page && ( ! isset($qv['withcomments']) || ! $qv['withcomments'] ) ) + $this->is_comment_feed = false; + + $this->is_singular = $this->is_single || $this->is_page || $this->is_attachment; + // Done correcting is_* for page_on_front and page_for_posts + + if ( '404' == $qv['error'] ) + $this->set_404(); + + $this->query_vars_hash = md5( serialize( $this->query_vars ) ); + $this->query_vars_changed = false; + + do_action_ref_array('parse_query', array(&$this)); + } + + /* + * Parses various taxonomy related query vars. + * + * @access protected + * @since 3.1.0 + * + * @param array &$q The query variables + */ + function parse_tax_query( &$q ) { + if ( ! empty( $q['tax_query'] ) && is_array( $q['tax_query'] ) ) { + $tax_query = $q['tax_query']; + } else { + $tax_query = array(); + } + + if ( !empty($q['taxonomy']) && !empty($q['term']) ) { + $tax_query[] = array( + 'taxonomy' => $q['taxonomy'], + 'terms' => array( $q['term'] ), + 'field' => 'slug', + ); + } + + foreach ( $GLOBALS['wp_taxonomies'] as $taxonomy => $t ) { + if ( 'post_tag' == $taxonomy ) + continue; // Handled further down in the $q['tag'] block + + if ( $t->query_var && !empty( $q[$t->query_var] ) ) { + $tax_query_defaults = array( + 'taxonomy' => $taxonomy, + 'field' => 'slug', + ); + + if ( isset( $t->rewrite['hierarchical'] ) && $t->rewrite['hierarchical'] ) { + $q[$t->query_var] = wp_basename( $q[$t->query_var] ); + } + + $term = $q[$t->query_var]; + + if ( strpos($term, '+') !== false ) { + $terms = preg_split( '/[+]+/', $term ); + foreach ( $terms as $term ) { + $tax_query[] = array_merge( $tax_query_defaults, array( + 'terms' => array( $term ) + ) ); + } + } else { + $tax_query[] = array_merge( $tax_query_defaults, array( + 'terms' => preg_split( '/[,]+/', $term ) + ) ); + } + } + } + + // Category stuff + if ( !empty($q['cat']) && '0' != $q['cat'] && !$this->is_singular && $this->query_vars_changed ) { + $q['cat'] = ''.urldecode($q['cat']).''; + $q['cat'] = addslashes_gpc($q['cat']); + $cat_array = preg_split('/[,\s]+/', $q['cat']); + $q['cat'] = ''; + $req_cats = array(); + foreach ( (array) $cat_array as $cat ) { + $cat = intval($cat); + $req_cats[] = $cat; + $in = ($cat > 0); + $cat = abs($cat); + if ( $in ) { + $q['category__in'][] = $cat; + $q['category__in'] = array_merge( $q['category__in'], get_term_children($cat, 'category') ); + } else { + $q['category__not_in'][] = $cat; + $q['category__not_in'] = array_merge( $q['category__not_in'], get_term_children($cat, 'category') ); + } + } + $q['cat'] = implode(',', $req_cats); + } + + if ( !empty($q['category__in']) ) { + $q['category__in'] = array_map('absint', array_unique( (array) $q['category__in'] ) ); + $tax_query[] = array( + 'taxonomy' => 'category', + 'terms' => $q['category__in'], + 'field' => 'term_id', + 'include_children' => false + ); + } + + if ( !empty($q['category__not_in']) ) { + $q['category__not_in'] = array_map('absint', array_unique( (array) $q['category__not_in'] ) ); + $tax_query[] = array( + 'taxonomy' => 'category', + 'terms' => $q['category__not_in'], + 'operator' => 'NOT IN', + 'include_children' => false + ); + } + + if ( !empty($q['category__and']) ) { + $q['category__and'] = array_map('absint', array_unique( (array) $q['category__and'] ) ); + $tax_query[] = array( + 'taxonomy' => 'category', + 'terms' => $q['category__and'], + 'field' => 'term_id', + 'operator' => 'AND', + 'include_children' => false + ); + } + + // Tag stuff + if ( '' != $q['tag'] && !$this->is_singular && $this->query_vars_changed ) { + if ( strpos($q['tag'], ',') !== false ) { + $tags = preg_split('/[,\s]+/', $q['tag']); + foreach ( (array) $tags as $tag ) { + $tag = sanitize_term_field('slug', $tag, 0, 'post_tag', 'db'); + $q['tag_slug__in'][] = $tag; + } + } else if ( preg_match('/[+\s]+/', $q['tag']) || !empty($q['cat']) ) { + $tags = preg_split('/[+\s]+/', $q['tag']); + foreach ( (array) $tags as $tag ) { + $tag = sanitize_term_field('slug', $tag, 0, 'post_tag', 'db'); + $q['tag_slug__and'][] = $tag; + } + } else { + $q['tag'] = sanitize_term_field('slug', $q['tag'], 0, 'post_tag', 'db'); + $q['tag_slug__in'][] = $q['tag']; + } + } + + if ( !empty($q['tag_id']) ) { + $q['tag_id'] = absint( $q['tag_id'] ); + $tax_query[] = array( + 'taxonomy' => 'post_tag', + 'terms' => $q['tag_id'] + ); + } + + if ( !empty($q['tag__in']) ) { + $q['tag__in'] = array_map('absint', array_unique( (array) $q['tag__in'] ) ); + $tax_query[] = array( + 'taxonomy' => 'post_tag', + 'terms' => $q['tag__in'] + ); + } + + if ( !empty($q['tag__not_in']) ) { + $q['tag__not_in'] = array_map('absint', array_unique( (array) $q['tag__not_in'] ) ); + $tax_query[] = array( + 'taxonomy' => 'post_tag', + 'terms' => $q['tag__not_in'], + 'operator' => 'NOT IN' + ); + } + + if ( !empty($q['tag__and']) ) { + $q['tag__and'] = array_map('absint', array_unique( (array) $q['tag__and'] ) ); + $tax_query[] = array( + 'taxonomy' => 'post_tag', + 'terms' => $q['tag__and'], + 'operator' => 'AND' + ); + } + + if ( !empty($q['tag_slug__in']) ) { + $q['tag_slug__in'] = array_map('sanitize_title', array_unique( (array) $q['tag_slug__in'] ) ); + $tax_query[] = array( + 'taxonomy' => 'post_tag', + 'terms' => $q['tag_slug__in'], + 'field' => 'slug' + ); + } + + if ( !empty($q['tag_slug__and']) ) { + $q['tag_slug__and'] = array_map('sanitize_title', array_unique( (array) $q['tag_slug__and'] ) ); + $tax_query[] = array( + 'taxonomy' => 'post_tag', + 'terms' => $q['tag_slug__and'], + 'field' => 'slug', + 'operator' => 'AND' + ); + } + + $this->tax_query = new WP_Tax_Query( $tax_query ); + } + + /** + * Sets the 404 property and saves whether query is feed. + * + * @since 2.0.0 + * @access public + */ + function set_404() { + $is_feed = $this->is_feed; + + $this->init_query_flags(); + $this->is_404 = true; + + $this->is_feed = $is_feed; + } + + /** + * Retrieve query variable. + * + * @since 1.5.0 + * @access public + * + * @param string $query_var Query variable key. + * @return mixed + */ + function get($query_var) { + if ( isset($this->query_vars[$query_var]) ) + return $this->query_vars[$query_var]; + + return ''; + } + + /** + * Set query variable. + * + * @since 1.5.0 + * @access public + * + * @param string $query_var Query variable key. + * @param mixed $value Query variable value. + */ + function set($query_var, $value) { + $this->query_vars[$query_var] = $value; + } + + /** + * Retrieve the posts based on query variables. + * + * There are a few filters and actions that can be used to modify the post + * database query. + * + * @since 1.5.0 + * @access public + * @uses do_action_ref_array() Calls 'pre_get_posts' hook before retrieving posts. + * + * @return array List of posts. + */ + function &get_posts() { + global $wpdb, $user_ID, $_wp_using_ext_object_cache; + + $this->parse_query(); + + do_action_ref_array('pre_get_posts', array(&$this)); + + // Shorthand. + $q = &$this->query_vars; + + // Fill again in case pre_get_posts unset some vars. + $q = $this->fill_query_vars($q); + + // Parse meta query + $this->meta_query = new WP_Meta_Query(); + $this->meta_query->parse_query_vars( $q ); + + // Set a flag if a pre_get_posts hook changed the query vars. + $hash = md5( serialize( $this->query_vars ) ); + if ( $hash != $this->query_vars_hash ) { + $this->query_vars_changed = true; + $this->query_vars_hash = $hash; + } + unset($hash); + + // First let's clear some variables + $distinct = ''; + $whichauthor = ''; + $whichmimetype = ''; + $where = ''; + $limits = ''; + $join = ''; + $search = ''; + $groupby = ''; + $fields = ''; + $post_status_join = false; + $page = 1; + + if ( isset( $q['caller_get_posts'] ) ) { + _deprecated_argument( 'WP_Query', '3.1', __( '"caller_get_posts" is deprecated. Use "ignore_sticky_posts" instead.' ) ); + if ( !isset( $q['ignore_sticky_posts'] ) ) + $q['ignore_sticky_posts'] = $q['caller_get_posts']; + } + + if ( !isset( $q['ignore_sticky_posts'] ) ) + $q['ignore_sticky_posts'] = false; + + if ( !isset($q['suppress_filters']) ) + $q['suppress_filters'] = false; + + if ( !isset($q['cache_results']) ) { + if ( $_wp_using_ext_object_cache ) + $q['cache_results'] = false; + else + $q['cache_results'] = true; + } + + if ( !isset($q['update_post_term_cache']) ) + $q['update_post_term_cache'] = true; + + if ( !isset($q['update_post_meta_cache']) ) + $q['update_post_meta_cache'] = true; + + if ( !isset($q['post_type']) ) { + if ( $this->is_search ) + $q['post_type'] = 'any'; + else + $q['post_type'] = ''; + } + $post_type = $q['post_type']; + if ( !isset($q['posts_per_page']) || $q['posts_per_page'] == 0 ) + $q['posts_per_page'] = get_option('posts_per_page'); + if ( isset($q['showposts']) && $q['showposts'] ) { + $q['showposts'] = (int) $q['showposts']; + $q['posts_per_page'] = $q['showposts']; + } + if ( (isset($q['posts_per_archive_page']) && $q['posts_per_archive_page'] != 0) && ($this->is_archive || $this->is_search) ) + $q['posts_per_page'] = $q['posts_per_archive_page']; + if ( !isset($q['nopaging']) ) { + if ( $q['posts_per_page'] == -1 ) { + $q['nopaging'] = true; + } else { + $q['nopaging'] = false; + } + } + if ( $this->is_feed ) { + $q['posts_per_page'] = get_option('posts_per_rss'); + $q['nopaging'] = false; + } + $q['posts_per_page'] = (int) $q['posts_per_page']; + if ( $q['posts_per_page'] < -1 ) + $q['posts_per_page'] = abs($q['posts_per_page']); + else if ( $q['posts_per_page'] == 0 ) + $q['posts_per_page'] = 1; + + if ( !isset($q['comments_per_page']) || $q['comments_per_page'] == 0 ) + $q['comments_per_page'] = get_option('comments_per_page'); + + if ( $this->is_home && (empty($this->query) || $q['preview'] == 'true') && ( 'page' == get_option('show_on_front') ) && get_option('page_on_front') ) { + $this->is_page = true; + $this->is_home = false; + $q['page_id'] = get_option('page_on_front'); + } + + if ( isset($q['page']) ) { + $q['page'] = trim($q['page'], '/'); + $q['page'] = absint($q['page']); + } + + // If true, forcibly turns off SQL_CALC_FOUND_ROWS even when limits are present. + if ( isset($q['no_found_rows']) ) + $q['no_found_rows'] = (bool) $q['no_found_rows']; + else + $q['no_found_rows'] = false; + + switch ( $q['fields'] ) { + case 'ids': + $fields = "$wpdb->posts.ID"; + break; + case 'id=>parent': + $fields = "$wpdb->posts.ID, $wpdb->posts.post_parent"; + break; + default: + $fields = "$wpdb->posts.*"; + } + + // If a month is specified in the querystring, load that month + if ( $q['m'] ) { + $q['m'] = '' . preg_replace('|[^0-9]|', '', $q['m']); + $where .= " AND YEAR($wpdb->posts.post_date)=" . substr($q['m'], 0, 4); + if ( strlen($q['m']) > 5 ) + $where .= " AND MONTH($wpdb->posts.post_date)=" . substr($q['m'], 4, 2); + if ( strlen($q['m']) > 7 ) + $where .= " AND DAYOFMONTH($wpdb->posts.post_date)=" . substr($q['m'], 6, 2); + if ( strlen($q['m']) > 9 ) + $where .= " AND HOUR($wpdb->posts.post_date)=" . substr($q['m'], 8, 2); + if ( strlen($q['m']) > 11 ) + $where .= " AND MINUTE($wpdb->posts.post_date)=" . substr($q['m'], 10, 2); + if ( strlen($q['m']) > 13 ) + $where .= " AND SECOND($wpdb->posts.post_date)=" . substr($q['m'], 12, 2); + } + + if ( '' !== $q['hour'] ) + $where .= " AND HOUR($wpdb->posts.post_date)='" . $q['hour'] . "'"; + + if ( '' !== $q['minute'] ) + $where .= " AND MINUTE($wpdb->posts.post_date)='" . $q['minute'] . "'"; + + if ( '' !== $q['second'] ) + $where .= " AND SECOND($wpdb->posts.post_date)='" . $q['second'] . "'"; + + if ( $q['year'] ) + $where .= " AND YEAR($wpdb->posts.post_date)='" . $q['year'] . "'"; + + if ( $q['monthnum'] ) + $where .= " AND MONTH($wpdb->posts.post_date)='" . $q['monthnum'] . "'"; + + if ( $q['day'] ) + $where .= " AND DAYOFMONTH($wpdb->posts.post_date)='" . $q['day'] . "'"; + + // If we've got a post_type AND its not "any" post_type. + if ( !empty($q['post_type']) && 'any' != $q['post_type'] ) { + foreach ( (array)$q['post_type'] as $_post_type ) { + $ptype_obj = get_post_type_object($_post_type); + if ( !$ptype_obj || !$ptype_obj->query_var || empty($q[ $ptype_obj->query_var ]) ) + continue; + + if ( ! $ptype_obj->hierarchical || strpos($q[ $ptype_obj->query_var ], '/') === false ) { + // Non-hierarchical post_types & parent-level-hierarchical post_types can directly use 'name' + $q['name'] = $q[ $ptype_obj->query_var ]; + } else { + // Hierarchical post_types will operate through the + $q['pagename'] = $q[ $ptype_obj->query_var ]; + $q['name'] = ''; + } + + // Only one request for a slug is possible, this is why name & pagename are overwritten above. + break; + } //end foreach + unset($ptype_obj); + } + + if ( '' != $q['name'] ) { + $q['name'] = sanitize_title_for_query( $q['name'] ); + $where .= " AND $wpdb->posts.post_name = '" . $q['name'] . "'"; + } elseif ( '' != $q['pagename'] ) { + if ( isset($this->queried_object_id) ) { + $reqpage = $this->queried_object_id; + } else { + if ( 'page' != $q['post_type'] ) { + foreach ( (array)$q['post_type'] as $_post_type ) { + $ptype_obj = get_post_type_object($_post_type); + if ( !$ptype_obj || !$ptype_obj->hierarchical ) + continue; + + $reqpage = get_page_by_path($q['pagename'], OBJECT, $_post_type); + if ( $reqpage ) + break; + } + unset($ptype_obj); + } else { + $reqpage = get_page_by_path($q['pagename']); + } + if ( !empty($reqpage) ) + $reqpage = $reqpage->ID; + else + $reqpage = 0; + } + + $page_for_posts = get_option('page_for_posts'); + if ( ('page' != get_option('show_on_front') ) || empty($page_for_posts) || ( $reqpage != $page_for_posts ) ) { + $q['pagename'] = sanitize_title_for_query( wp_basename( $q['pagename'] ) ); + $q['name'] = $q['pagename']; + $where .= " AND ($wpdb->posts.ID = '$reqpage')"; + $reqpage_obj = get_page($reqpage); + if ( is_object($reqpage_obj) && 'attachment' == $reqpage_obj->post_type ) { + $this->is_attachment = true; + $post_type = $q['post_type'] = 'attachment'; + $this->is_page = true; + $q['attachment_id'] = $reqpage; + } + } + } elseif ( '' != $q['attachment'] ) { + $q['attachment'] = sanitize_title_for_query( wp_basename( $q['attachment'] ) ); + $q['name'] = $q['attachment']; + $where .= " AND $wpdb->posts.post_name = '" . $q['attachment'] . "'"; + } + + if ( $q['w'] ) + $where .= ' AND ' . _wp_mysql_week( "`$wpdb->posts`.`post_date`" ) . " = '" . $q['w'] . "'"; + + if ( intval($q['comments_popup']) ) + $q['p'] = absint($q['comments_popup']); + + // If an attachment is requested by number, let it supercede any post number. + if ( $q['attachment_id'] ) + $q['p'] = absint($q['attachment_id']); + + // If a post number is specified, load that post + if ( $q['p'] ) { + $where .= " AND {$wpdb->posts}.ID = " . $q['p']; + } elseif ( $q['post__in'] ) { + $post__in = implode(',', array_map( 'absint', $q['post__in'] )); + $where .= " AND {$wpdb->posts}.ID IN ($post__in)"; + } elseif ( $q['post__not_in'] ) { + $post__not_in = implode(',', array_map( 'absint', $q['post__not_in'] )); + $where .= " AND {$wpdb->posts}.ID NOT IN ($post__not_in)"; + } + + if ( is_numeric($q['post_parent']) ) + $where .= $wpdb->prepare( " AND $wpdb->posts.post_parent = %d ", $q['post_parent'] ); + + if ( $q['page_id'] ) { + if ( ('page' != get_option('show_on_front') ) || ( $q['page_id'] != get_option('page_for_posts') ) ) { + $q['p'] = $q['page_id']; + $where = " AND {$wpdb->posts}.ID = " . $q['page_id']; + } + } + + // If a search pattern is specified, load the posts that match + if ( !empty($q['s']) ) { + // added slashes screw with quote grouping when done early, so done later + $q['s'] = stripslashes($q['s']); + if ( !empty($q['sentence']) ) { + $q['search_terms'] = array($q['s']); + } else { + preg_match_all('/".*?("|$)|((?<=[\\s",+])|^)[^\\s",+]+/', $q['s'], $matches); + $q['search_terms'] = array_map('_search_terms_tidy', $matches[0]); + } + $n = !empty($q['exact']) ? '' : '%'; + $searchand = ''; + foreach( (array) $q['search_terms'] as $term ) { + $term = esc_sql( like_escape( $term ) ); + $search .= "{$searchand}(($wpdb->posts.post_title LIKE '{$n}{$term}{$n}') OR ($wpdb->posts.post_content LIKE '{$n}{$term}{$n}'))"; + $searchand = ' AND '; + } + + if ( !empty($search) ) { + $search = " AND ({$search}) "; + if ( !is_user_logged_in() ) + $search .= " AND ($wpdb->posts.post_password = '') "; + } + } + + // Allow plugins to contextually add/remove/modify the search section of the database query + $search = apply_filters_ref_array('posts_search', array( $search, &$this ) ); + + // Taxonomies + if ( !$this->is_singular ) { + $this->parse_tax_query( $q ); + + $clauses = $this->tax_query->get_sql( $wpdb->posts, 'ID' ); + + $join .= $clauses['join']; + $where .= $clauses['where']; + } + + if ( $this->is_tax ) { + if ( empty($post_type) ) { + $post_type = 'any'; + $post_status_join = true; + } elseif ( in_array('attachment', (array) $post_type) ) { + $post_status_join = true; + } + } + + // Back-compat + if ( !empty($this->tax_query->queries) ) { + $tax_query_in_and = wp_list_filter( $this->tax_query->queries, array( 'operator' => 'NOT IN' ), 'NOT' ); + if ( !empty( $tax_query_in_and ) ) { + if ( !isset( $q['taxonomy'] ) ) { + foreach ( $tax_query_in_and as $a_tax_query ) { + if ( !in_array( $a_tax_query['taxonomy'], array( 'category', 'post_tag' ) ) ) { + $q['taxonomy'] = $a_tax_query['taxonomy']; + if ( 'slug' == $a_tax_query['field'] ) + $q['term'] = $a_tax_query['terms'][0]; + else + $q['term_id'] = $a_tax_query['terms'][0]; + + break; + } + } + } + + $cat_query = wp_list_filter( $tax_query_in_and, array( 'taxonomy' => 'category' ) ); + if ( !empty( $cat_query ) ) { + $cat_query = reset( $cat_query ); + $the_cat = get_term_by( $cat_query['field'], $cat_query['terms'][0], 'category' ); + if ( $the_cat ) { + $this->set( 'cat', $the_cat->term_id ); + $this->set( 'category_name', $the_cat->slug ); + } + unset( $the_cat ); + } + unset( $cat_query ); + + $tag_query = wp_list_filter( $tax_query_in_and, array( 'taxonomy' => 'post_tag' ) ); + if ( !empty( $tag_query ) ) { + $tag_query = reset( $tag_query ); + $the_tag = get_term_by( $tag_query['field'], $tag_query['terms'][0], 'post_tag' ); + if ( $the_tag ) { + $this->set( 'tag_id', $the_tag->term_id ); + } + unset( $the_tag ); + } + unset( $tag_query ); + } + } + + if ( !empty( $this->tax_query->queries ) || !empty( $this->meta_query->queries ) ) { + $groupby = "{$wpdb->posts}.ID"; + } + + // Author/user stuff + + if ( empty($q['author']) || ($q['author'] == '0') ) { + $whichauthor = ''; + } else { + $q['author'] = (string)urldecode($q['author']); + $q['author'] = addslashes_gpc($q['author']); + if ( strpos($q['author'], '-') !== false ) { + $eq = '!='; + $andor = 'AND'; + $q['author'] = explode('-', $q['author']); + $q['author'] = (string)absint($q['author'][1]); + } else { + $eq = '='; + $andor = 'OR'; + } + $author_array = preg_split('/[,\s]+/', $q['author']); + $_author_array = array(); + foreach ( $author_array as $key => $_author ) + $_author_array[] = "$wpdb->posts.post_author " . $eq . ' ' . absint($_author); + $whichauthor .= ' AND (' . implode(" $andor ", $_author_array) . ')'; + unset($author_array, $_author_array); + } + + // Author stuff for nice URLs + + if ( '' != $q['author_name'] ) { + if ( strpos($q['author_name'], '/') !== false ) { + $q['author_name'] = explode('/', $q['author_name']); + if ( $q['author_name'][ count($q['author_name'])-1 ] ) { + $q['author_name'] = $q['author_name'][count($q['author_name'])-1]; // no trailing slash + } else { + $q['author_name'] = $q['author_name'][count($q['author_name'])-2]; // there was a trailling slash + } + } + $q['author_name'] = sanitize_title_for_query( $q['author_name'] ); + $q['author'] = get_user_by('slug', $q['author_name']); + if ( $q['author'] ) + $q['author'] = $q['author']->ID; + $whichauthor .= " AND ($wpdb->posts.post_author = " . absint($q['author']) . ')'; + } + + // MIME-Type stuff for attachment browsing + + if ( isset($q['post_mime_type']) && '' != $q['post_mime_type'] ) { + $table_alias = $post_status_join ? $wpdb->posts : ''; + $whichmimetype = wp_post_mime_type_where($q['post_mime_type'], $table_alias); + } + + $where .= $search . $whichauthor . $whichmimetype; + + if ( empty($q['order']) || ((strtoupper($q['order']) != 'ASC') && (strtoupper($q['order']) != 'DESC')) ) + $q['order'] = 'DESC'; + + // Order by + if ( empty($q['orderby']) ) { + $orderby = "$wpdb->posts.post_date " . $q['order']; + } elseif ( 'none' == $q['orderby'] ) { + $orderby = ''; + } else { + // Used to filter values + $allowed_keys = array('author', 'date', 'title', 'modified', 'menu_order', 'parent', 'ID', 'rand', 'comment_count'); + if ( !empty($q['meta_key']) ) { + $allowed_keys[] = $q['meta_key']; + $allowed_keys[] = 'meta_value'; + $allowed_keys[] = 'meta_value_num'; + } + $q['orderby'] = urldecode($q['orderby']); + $q['orderby'] = addslashes_gpc($q['orderby']); + + $orderby_array = array(); + foreach ( explode( ' ', $q['orderby'] ) as $i => $orderby ) { + // Only allow certain values for safety + if ( ! in_array($orderby, $allowed_keys) ) + continue; + + switch ( $orderby ) { + case 'menu_order': + break; + case 'ID': + $orderby = "$wpdb->posts.ID"; + break; + case 'rand': + $orderby = 'RAND()'; + break; + case $q['meta_key']: + case 'meta_value': + $orderby = "$wpdb->postmeta.meta_value"; + break; + case 'meta_value_num': + $orderby = "$wpdb->postmeta.meta_value+0"; + break; + case 'comment_count': + $orderby = "$wpdb->posts.comment_count"; + break; + default: + $orderby = "$wpdb->posts.post_" . $orderby; + } + + $orderby_array[] = $orderby; + } + $orderby = implode( ',', $orderby_array ); + + if ( empty( $orderby ) ) + $orderby = "$wpdb->posts.post_date ".$q['order']; + else + $orderby .= " {$q['order']}"; + } + + if ( is_array( $post_type ) ) { + $post_type_cap = 'multiple_post_type'; + } else { + $post_type_object = get_post_type_object( $post_type ); + if ( empty( $post_type_object ) ) + $post_type_cap = $post_type; + } + + $exclude_post_types = ''; + $in_search_post_types = get_post_types( array('exclude_from_search' => false) ); + if ( ! empty( $in_search_post_types ) ) + $exclude_post_types .= $wpdb->prepare(" AND $wpdb->posts.post_type IN ('" . join("', '", $in_search_post_types ) . "')"); + + if ( 'any' == $post_type ) { + $where .= $exclude_post_types; + } elseif ( !empty( $post_type ) && is_array( $post_type ) ) { + $where .= " AND $wpdb->posts.post_type IN ('" . join("', '", $post_type) . "')"; + } elseif ( ! empty( $post_type ) ) { + $where .= " AND $wpdb->posts.post_type = '$post_type'"; + $post_type_object = get_post_type_object ( $post_type ); + } elseif ( $this->is_attachment ) { + $where .= " AND $wpdb->posts.post_type = 'attachment'"; + $post_type_object = get_post_type_object ( 'attachment' ); + } elseif ( $this->is_page ) { + $where .= " AND $wpdb->posts.post_type = 'page'"; + $post_type_object = get_post_type_object ( 'page' ); + } else { + $where .= " AND $wpdb->posts.post_type = 'post'"; + $post_type_object = get_post_type_object ( 'post' ); + } + + if ( ! empty( $post_type_object ) ) { + $edit_cap = $post_type_object->cap->edit_post; + $read_cap = $post_type_object->cap->read_post; + $edit_others_cap = $post_type_object->cap->edit_others_posts; + $read_private_cap = $post_type_object->cap->read_private_posts; + } else { + $edit_cap = 'edit_' . $post_type_cap; + $read_cap = 'read_' . $post_type_cap; + $edit_others_cap = 'edit_others_' . $post_type_cap . 's'; + $read_private_cap = 'read_private_' . $post_type_cap . 's'; + } + + if ( ! empty( $q['post_status'] ) ) { + $statuswheres = array(); + $q_status = $q['post_status']; + if ( ! is_array( $q_status ) ) + $q_status = explode(',', $q_status); + $r_status = array(); + $p_status = array(); + $e_status = array(); + if ( in_array('any', $q_status) ) { + foreach ( get_post_stati( array('exclude_from_search' => true) ) as $status ) + $e_status[] = "$wpdb->posts.post_status <> '$status'"; + } else { + foreach ( get_post_stati() as $status ) { + if ( in_array( $status, $q_status ) ) { + if ( 'private' == $status ) + $p_status[] = "$wpdb->posts.post_status = '$status'"; + else + $r_status[] = "$wpdb->posts.post_status = '$status'"; + } + } + } + + if ( empty($q['perm'] ) || 'readable' != $q['perm'] ) { + $r_status = array_merge($r_status, $p_status); + unset($p_status); + } + + if ( !empty($e_status) ) { + $statuswheres[] = "(" . join( ' AND ', $e_status ) . ")"; + } + if ( !empty($r_status) ) { + if ( !empty($q['perm'] ) && 'editable' == $q['perm'] && !current_user_can($edit_others_cap) ) + $statuswheres[] = "($wpdb->posts.post_author = $user_ID " . "AND (" . join( ' OR ', $r_status ) . "))"; + else + $statuswheres[] = "(" . join( ' OR ', $r_status ) . ")"; + } + if ( !empty($p_status) ) { + if ( !empty($q['perm'] ) && 'readable' == $q['perm'] && !current_user_can($read_private_cap) ) + $statuswheres[] = "($wpdb->posts.post_author = $user_ID " . "AND (" . join( ' OR ', $p_status ) . "))"; + else + $statuswheres[] = "(" . join( ' OR ', $p_status ) . ")"; + } + if ( $post_status_join ) { + $join .= " LEFT JOIN $wpdb->posts AS p2 ON ($wpdb->posts.post_parent = p2.ID) "; + foreach ( $statuswheres as $index => $statuswhere ) + $statuswheres[$index] = "($statuswhere OR ($wpdb->posts.post_status = 'inherit' AND " . str_replace($wpdb->posts, 'p2', $statuswhere) . "))"; + } + foreach ( $statuswheres as $statuswhere ) + $where .= " AND $statuswhere"; + } elseif ( !$this->is_singular ) { + $where .= " AND ($wpdb->posts.post_status = 'publish'"; + + // Add public states. + $public_states = get_post_stati( array('public' => true) ); + foreach ( (array) $public_states as $state ) { + if ( 'publish' == $state ) // Publish is hard-coded above. + continue; + $where .= " OR $wpdb->posts.post_status = '$state'"; + } + + if ( is_admin() ) { + // Add protected states that should show in the admin all list. + $admin_all_states = get_post_stati( array('protected' => true, 'show_in_admin_all_list' => true) ); + foreach ( (array) $admin_all_states as $state ) + $where .= " OR $wpdb->posts.post_status = '$state'"; + } + + if ( is_user_logged_in() ) { + // Add private states that are limited to viewing by the author of a post or someone who has caps to read private states. + $private_states = get_post_stati( array('private' => true) ); + foreach ( (array) $private_states as $state ) + $where .= current_user_can( $read_private_cap ) ? " OR $wpdb->posts.post_status = '$state'" : " OR $wpdb->posts.post_author = $user_ID AND $wpdb->posts.post_status = '$state'"; + } + + $where .= ')'; + } + + if ( !empty( $this->meta_query->queries ) ) { + $clauses = $this->meta_query->get_sql( 'post', $wpdb->posts, 'ID', $this ); + $join .= $clauses['join']; + $where .= $clauses['where']; + } + + // Apply filters on where and join prior to paging so that any + // manipulations to them are reflected in the paging by day queries. + if ( !$q['suppress_filters'] ) { + $where = apply_filters_ref_array('posts_where', array( $where, &$this ) ); + $join = apply_filters_ref_array('posts_join', array( $join, &$this ) ); + } + + // Paging + if ( empty($q['nopaging']) && !$this->is_singular ) { + $page = absint($q['paged']); + if ( empty($page) ) + $page = 1; + + if ( empty($q['offset']) ) { + $pgstrt = ''; + $pgstrt = ($page - 1) * $q['posts_per_page'] . ', '; + $limits = 'LIMIT ' . $pgstrt . $q['posts_per_page']; + } else { // we're ignoring $page and using 'offset' + $q['offset'] = absint($q['offset']); + $pgstrt = $q['offset'] . ', '; + $limits = 'LIMIT ' . $pgstrt . $q['posts_per_page']; + } + } + + // Comments feeds + if ( $this->is_comment_feed && ( $this->is_archive || $this->is_search || !$this->is_singular ) ) { + if ( $this->is_archive || $this->is_search ) { + $cjoin = "JOIN $wpdb->posts ON ($wpdb->comments.comment_post_ID = $wpdb->posts.ID) $join "; + $cwhere = "WHERE comment_approved = '1' $where"; + $cgroupby = "$wpdb->comments.comment_id"; + } else { // Other non singular e.g. front + $cjoin = "JOIN $wpdb->posts ON ( $wpdb->comments.comment_post_ID = $wpdb->posts.ID )"; + $cwhere = "WHERE post_status = 'publish' AND comment_approved = '1'"; + $cgroupby = ''; + } + + if ( !$q['suppress_filters'] ) { + $cjoin = apply_filters_ref_array('comment_feed_join', array( $cjoin, &$this ) ); + $cwhere = apply_filters_ref_array('comment_feed_where', array( $cwhere, &$this ) ); + $cgroupby = apply_filters_ref_array('comment_feed_groupby', array( $cgroupby, &$this ) ); + $corderby = apply_filters_ref_array('comment_feed_orderby', array( 'comment_date_gmt DESC', &$this ) ); + $climits = apply_filters_ref_array('comment_feed_limits', array( 'LIMIT ' . get_option('posts_per_rss'), &$this ) ); + } + $cgroupby = ( ! empty( $cgroupby ) ) ? 'GROUP BY ' . $cgroupby : ''; + $corderby = ( ! empty( $corderby ) ) ? 'ORDER BY ' . $corderby : ''; + + $this->comments = (array) $wpdb->get_results("SELECT $distinct $wpdb->comments.* FROM $wpdb->comments $cjoin $cwhere $cgroupby $corderby $climits"); + $this->comment_count = count($this->comments); + + $post_ids = array(); + + foreach ( $this->comments as $comment ) + $post_ids[] = (int) $comment->comment_post_ID; + + $post_ids = join(',', $post_ids); + $join = ''; + if ( $post_ids ) + $where = "AND $wpdb->posts.ID IN ($post_ids) "; + else + $where = "AND 0"; + } + + $pieces = array( 'where', 'groupby', 'join', 'orderby', 'distinct', 'fields', 'limits' ); + + // Apply post-paging filters on where and join. Only plugins that + // manipulate paging queries should use these hooks. + if ( !$q['suppress_filters'] ) { + $where = apply_filters_ref_array( 'posts_where_paged', array( $where, &$this ) ); + $groupby = apply_filters_ref_array( 'posts_groupby', array( $groupby, &$this ) ); + $join = apply_filters_ref_array( 'posts_join_paged', array( $join, &$this ) ); + $orderby = apply_filters_ref_array( 'posts_orderby', array( $orderby, &$this ) ); + $distinct = apply_filters_ref_array( 'posts_distinct', array( $distinct, &$this ) ); + $limits = apply_filters_ref_array( 'post_limits', array( $limits, &$this ) ); + $fields = apply_filters_ref_array( 'posts_fields', array( $fields, &$this ) ); + + // Filter all clauses at once, for convenience + $clauses = (array) apply_filters_ref_array( 'posts_clauses', array( compact( $pieces ), &$this ) ); + foreach ( $pieces as $piece ) + $$piece = isset( $clauses[ $piece ] ) ? $clauses[ $piece ] : ''; + } + + // Announce current selection parameters. For use by caching plugins. + do_action( 'posts_selection', $where . $groupby . $orderby . $limits . $join ); + + // Filter again for the benefit of caching plugins. Regular plugins should use the hooks above. + if ( !$q['suppress_filters'] ) { + $where = apply_filters_ref_array( 'posts_where_request', array( $where, &$this ) ); + $groupby = apply_filters_ref_array( 'posts_groupby_request', array( $groupby, &$this ) ); + $join = apply_filters_ref_array( 'posts_join_request', array( $join, &$this ) ); + $orderby = apply_filters_ref_array( 'posts_orderby_request', array( $orderby, &$this ) ); + $distinct = apply_filters_ref_array( 'posts_distinct_request', array( $distinct, &$this ) ); + $fields = apply_filters_ref_array( 'posts_fields_request', array( $fields, &$this ) ); + $limits = apply_filters_ref_array( 'post_limits_request', array( $limits, &$this ) ); + + // Filter all clauses at once, for convenience + $clauses = (array) apply_filters_ref_array( 'posts_clauses_request', array( compact( $pieces ), &$this ) ); + foreach ( $pieces as $piece ) + $$piece = isset( $clauses[ $piece ] ) ? $clauses[ $piece ] : ''; + } + + if ( ! empty($groupby) ) + $groupby = 'GROUP BY ' . $groupby; + if ( !empty( $orderby ) ) + $orderby = 'ORDER BY ' . $orderby; + + $found_rows = ''; + if ( !$q['no_found_rows'] && !empty($limits) ) + $found_rows = 'SQL_CALC_FOUND_ROWS'; + + $this->request = " SELECT $found_rows $distinct $fields FROM $wpdb->posts $join WHERE 1=1 $where $groupby $orderby $limits"; + if ( !$q['suppress_filters'] ) + $this->request = apply_filters_ref_array('posts_request', array( $this->request, &$this ) ); + + if ( 'ids' == $q['fields'] ) { + $this->posts = $wpdb->get_col($this->request); + + return $this->posts; + } + + if ( 'id=>parent' == $q['fields'] ) { + $this->posts = $wpdb->get_results($this->request); + + $r = array(); + foreach ( $this->posts as $post ) + $r[ $post->ID ] = $post->post_parent; + + return $r; + } + + $this->posts = $wpdb->get_results($this->request); + + // Raw results filter. Prior to status checks. + if ( !$q['suppress_filters'] ) + $this->posts = apply_filters_ref_array('posts_results', array( $this->posts, &$this ) ); + + if ( !empty($this->posts) && $this->is_comment_feed && $this->is_singular ) { + $cjoin = apply_filters_ref_array('comment_feed_join', array( '', &$this ) ); + $cwhere = apply_filters_ref_array('comment_feed_where', array( "WHERE comment_post_ID = '{$this->posts[0]->ID}' AND comment_approved = '1'", &$this ) ); + $cgroupby = apply_filters_ref_array('comment_feed_groupby', array( '', &$this ) ); + $cgroupby = ( ! empty( $cgroupby ) ) ? 'GROUP BY ' . $cgroupby : ''; + $corderby = apply_filters_ref_array('comment_feed_orderby', array( 'comment_date_gmt DESC', &$this ) ); + $corderby = ( ! empty( $corderby ) ) ? 'ORDER BY ' . $corderby : ''; + $climits = apply_filters_ref_array('comment_feed_limits', array( 'LIMIT ' . get_option('posts_per_rss'), &$this ) ); + $comments_request = "SELECT $wpdb->comments.* FROM $wpdb->comments $cjoin $cwhere $cgroupby $corderby $climits"; + $this->comments = $wpdb->get_results($comments_request); + $this->comment_count = count($this->comments); + } + + if ( !$q['no_found_rows'] && !empty($limits) ) { + $found_posts_query = apply_filters_ref_array( 'found_posts_query', array( 'SELECT FOUND_ROWS()', &$this ) ); + $this->found_posts = $wpdb->get_var( $found_posts_query ); + $this->found_posts = apply_filters_ref_array( 'found_posts', array( $this->found_posts, &$this ) ); + $this->max_num_pages = ceil($this->found_posts / $q['posts_per_page']); + } + + // Check post status to determine if post should be displayed. + if ( !empty($this->posts) && ($this->is_single || $this->is_page) ) { + $status = get_post_status($this->posts[0]); + $post_status_obj = get_post_status_object($status); + //$type = get_post_type($this->posts[0]); + if ( !$post_status_obj->public ) { + if ( ! is_user_logged_in() ) { + // User must be logged in to view unpublished posts. + $this->posts = array(); + } else { + if ( $post_status_obj->protected ) { + // User must have edit permissions on the draft to preview. + if ( ! current_user_can($edit_cap, $this->posts[0]->ID) ) { + $this->posts = array(); + } else { + $this->is_preview = true; + if ( 'future' != $status ) + $this->posts[0]->post_date = current_time('mysql'); + } + } elseif ( $post_status_obj->private ) { + if ( ! current_user_can($read_cap, $this->posts[0]->ID) ) + $this->posts = array(); + } else { + $this->posts = array(); + } + } + } + + if ( $this->is_preview && current_user_can( $edit_cap, $this->posts[0]->ID ) ) + $this->posts[0] = apply_filters_ref_array('the_preview', array( $this->posts[0], &$this )); + } + + // Put sticky posts at the top of the posts array + $sticky_posts = get_option('sticky_posts'); + if ( $this->is_home && $page <= 1 && is_array($sticky_posts) && !empty($sticky_posts) && !$q['ignore_sticky_posts'] ) { + $num_posts = count($this->posts); + $sticky_offset = 0; + // Loop over posts and relocate stickies to the front. + for ( $i = 0; $i < $num_posts; $i++ ) { + if ( in_array($this->posts[$i]->ID, $sticky_posts) ) { + $sticky_post = $this->posts[$i]; + // Remove sticky from current position + array_splice($this->posts, $i, 1); + // Move to front, after other stickies + array_splice($this->posts, $sticky_offset, 0, array($sticky_post)); + // Increment the sticky offset. The next sticky will be placed at this offset. + $sticky_offset++; + // Remove post from sticky posts array + $offset = array_search($sticky_post->ID, $sticky_posts); + unset( $sticky_posts[$offset] ); + } + } + + // If any posts have been excluded specifically, Ignore those that are sticky. + if ( !empty($sticky_posts) && !empty($q['post__not_in']) ) + $sticky_posts = array_diff($sticky_posts, $q['post__not_in']); + + // Fetch sticky posts that weren't in the query results + if ( !empty($sticky_posts) ) { + $stickies__in = implode(',', array_map( 'absint', $sticky_posts )); + // honor post type(s) if not set to any + $stickies_where = ''; + if ( 'any' != $post_type && '' != $post_type ) { + if ( is_array( $post_type ) ) { + $post_types = join( "', '", $post_type ); + } else { + $post_types = $post_type; + } + $stickies_where = "AND $wpdb->posts.post_type IN ('" . $post_types . "')"; + } + + $stickies = $wpdb->get_results( "SELECT * FROM $wpdb->posts WHERE $wpdb->posts.ID IN ($stickies__in) $stickies_where" ); + foreach ( $stickies as $sticky_post ) { + // Ignore sticky posts the current user cannot read or are not published. + if ( 'publish' != $sticky_post->post_status ) + continue; + array_splice($this->posts, $sticky_offset, 0, array($sticky_post)); + $sticky_offset++; + } + } + } + + if ( !$q['suppress_filters'] ) + $this->posts = apply_filters_ref_array('the_posts', array( $this->posts, &$this ) ); + + $this->post_count = count($this->posts); + + // Sanitize before caching so it'll only get done once + for ( $i = 0; $i < $this->post_count; $i++ ) { + $this->posts[$i] = sanitize_post($this->posts[$i], 'raw'); + } + + if ( $q['cache_results'] ) + update_post_caches($this->posts, $post_type, $q['update_post_term_cache'], $q['update_post_meta_cache']); + + if ( $this->post_count > 0 ) { + $this->post = $this->posts[0]; + } + + return $this->posts; + } + + /** + * Set up the next post and iterate current post index. + * + * @since 1.5.0 + * @access public + * + * @return object Next post. + */ + function next_post() { + + $this->current_post++; + + $this->post = $this->posts[$this->current_post]; + return $this->post; + } + + /** + * Sets up the current post. + * + * Retrieves the next post, sets up the post, sets the 'in the loop' + * property to true. + * + * @since 1.5.0 + * @access public + * @uses $post + * @uses do_action_ref_array() Calls 'loop_start' if loop has just started + */ + function the_post() { + global $post; + $this->in_the_loop = true; + + if ( $this->current_post == -1 ) // loop has just started + do_action_ref_array('loop_start', array(&$this)); + + $post = $this->next_post(); + setup_postdata($post); + } + + /** + * Whether there are more posts available in the loop. + * + * Calls action 'loop_end', when the loop is complete. + * + * @since 1.5.0 + * @access public + * @uses do_action_ref_array() Calls 'loop_end' if loop is ended + * + * @return bool True if posts are available, false if end of loop. + */ + function have_posts() { + if ( $this->current_post + 1 < $this->post_count ) { + return true; + } elseif ( $this->current_post + 1 == $this->post_count && $this->post_count > 0 ) { + do_action_ref_array('loop_end', array(&$this)); + // Do some cleaning up after the loop + $this->rewind_posts(); + } + + $this->in_the_loop = false; + return false; + } + + /** + * Rewind the posts and reset post index. + * + * @since 1.5.0 + * @access public + */ + function rewind_posts() { + $this->current_post = -1; + if ( $this->post_count > 0 ) { + $this->post = $this->posts[0]; + } + } + + /** + * Iterate current comment index and return comment object. + * + * @since 2.2.0 + * @access public + * + * @return object Comment object. + */ + function next_comment() { + $this->current_comment++; + + $this->comment = $this->comments[$this->current_comment]; + return $this->comment; + } + + /** + * Sets up the current comment. + * + * @since 2.2.0 + * @access public + * @global object $comment Current comment. + * @uses do_action() Calls 'comment_loop_start' hook when first comment is processed. + */ + function the_comment() { + global $comment; + + $comment = $this->next_comment(); + + if ( $this->current_comment == 0 ) { + do_action('comment_loop_start'); + } + } + + /** + * Whether there are more comments available. + * + * Automatically rewinds comments when finished. + * + * @since 2.2.0 + * @access public + * + * @return bool True, if more comments. False, if no more posts. + */ + function have_comments() { + if ( $this->current_comment + 1 < $this->comment_count ) { + return true; + } elseif ( $this->current_comment + 1 == $this->comment_count ) { + $this->rewind_comments(); + } + + return false; + } + + /** + * Rewind the comments, resets the comment index and comment to first. + * + * @since 2.2.0 + * @access public + */ + function rewind_comments() { + $this->current_comment = -1; + if ( $this->comment_count > 0 ) { + $this->comment = $this->comments[0]; + } + } + + /** + * Sets up the WordPress query by parsing query string. + * + * @since 1.5.0 + * @access public + * + * @param string $query URL query string. + * @return array List of posts. + */ + function &query( $query ) { + $this->init(); + $this->query = $this->query_vars = wp_parse_args( $query ); + return $this->get_posts(); + } + + /** + * Retrieve queried object. + * + * If queried object is not set, then the queried object will be set from + * the category, tag, taxonomy, posts page, single post, page, or author + * query variable. After it is set up, it will be returned. + * + * @since 1.5.0 + * @access public + * + * @return object + */ + function get_queried_object() { + if ( isset($this->queried_object) ) + return $this->queried_object; + + $this->queried_object = NULL; + $this->queried_object_id = 0; + + if ( $this->is_category || $this->is_tag || $this->is_tax ) { + $tax_query_in_and = wp_list_filter( $this->tax_query->queries, array( 'operator' => 'NOT IN' ), 'NOT' ); + + $query = reset( $tax_query_in_and ); + + if ( 'term_id' == $query['field'] ) + $term = get_term( reset( $query['terms'] ), $query['taxonomy'] ); + else + $term = get_term_by( $query['field'], reset( $query['terms'] ), $query['taxonomy'] ); + + if ( $term && ! is_wp_error($term) ) { + $this->queried_object = $term; + $this->queried_object_id = (int) $term->term_id; + + if ( $this->is_category ) + _make_cat_compat( $this->queried_object ); + } + } elseif ( $this->is_post_type_archive ) { + $this->queried_object = get_post_type_object( $this->get('post_type') ); + } elseif ( $this->is_posts_page ) { + $page_for_posts = get_option('page_for_posts'); + $this->queried_object = & get_page( $page_for_posts ); + $this->queried_object_id = (int) $this->queried_object->ID; + } elseif ( $this->is_singular && !is_null($this->post) ) { + $this->queried_object = $this->post; + $this->queried_object_id = (int) $this->post->ID; + } elseif ( $this->is_author ) { + $this->queried_object_id = (int) $this->get('author'); + $this->queried_object = get_userdata( $this->queried_object_id ); + } + + return $this->queried_object; + } + + /** + * Retrieve ID of the current queried object. + * + * @since 1.5.0 + * @access public + * + * @return int + */ + function get_queried_object_id() { + $this->get_queried_object(); + + if ( isset($this->queried_object_id) ) { + return $this->queried_object_id; + } + + return 0; + } + + /** + * Constructor. + * + * Sets up the WordPress query, if parameter is not empty. + * + * @since 1.5.0 + * @access public + * + * @param string $query URL query string. + * @return WP_Query + */ + function __construct($query = '') { + if ( ! empty($query) ) { + $this->query($query); + } + } + + /** + * Is the query for an archive page? + * + * Month, Year, Category, Author, Post Type archive... + * + * @since 3.1.0 + * + * @return bool + */ + function is_archive() { + return (bool) $this->is_archive; + } + + /** + * Is the query for a post type archive page? + * + * @since 3.1.0 + * + * @param mixed $post_types Optional. Post type or array of posts types to check against. + * @return bool + */ + function is_post_type_archive( $post_types = '' ) { + if ( empty( $post_types ) || !$this->is_post_type_archive ) + return (bool) $this->is_post_type_archive; + + $post_type_object = $this->get_queried_object(); + + return in_array( $post_type_object->name, (array) $post_types ); + } + + /** + * Is the query for an attachment page? + * + * @since 3.1.0 + * + * @return bool + */ + function is_attachment() { + return (bool) $this->is_attachment; + } + + /** + * Is the query for an author archive page? + * + * If the $author parameter is specified, this function will additionally + * check if the query is for one of the authors specified. + * + * @since 3.1.0 + * + * @param mixed $author Optional. User ID, nickname, nicename, or array of User IDs, nicknames, and nicenames + * @return bool + */ + function is_author( $author = '' ) { + if ( !$this->is_author ) + return false; + + if ( empty($author) ) + return true; + + $author_obj = $this->get_queried_object(); + + $author = (array) $author; + + if ( in_array( $author_obj->ID, $author ) ) + return true; + elseif ( in_array( $author_obj->nickname, $author ) ) + return true; + elseif ( in_array( $author_obj->user_nicename, $author ) ) + return true; + + return false; + } + + /** + * Is the query for a category archive page? + * + * If the $category parameter is specified, this function will additionally + * check if the query is for one of the categories specified. + * + * @since 3.1.0 + * + * @param mixed $category Optional. Category ID, name, slug, or array of Category IDs, names, and slugs. + * @return bool + */ + function is_category( $category = '' ) { + if ( !$this->is_category ) + return false; + + if ( empty($category) ) + return true; + + $cat_obj = $this->get_queried_object(); + + $category = (array) $category; + + if ( in_array( $cat_obj->term_id, $category ) ) + return true; + elseif ( in_array( $cat_obj->name, $category ) ) + return true; + elseif ( in_array( $cat_obj->slug, $category ) ) + return true; + + return false; + } + + /** + * Is the query for a tag archive page? + * + * If the $tag parameter is specified, this function will additionally + * check if the query is for one of the tags specified. + * + * @since 3.1.0 + * + * @param mixed $slug Optional. Tag slug or array of slugs. + * @return bool + */ + function is_tag( $slug = '' ) { + if ( !$this->is_tag ) + return false; + + if ( empty( $slug ) ) + return true; + + $tag_obj = $this->get_queried_object(); + + $slug = (array) $slug; + + if ( in_array( $tag_obj->slug, $slug ) ) + return true; + + return false; + } + + /** + * Is the query for a taxonomy archive page? + * + * If the $taxonomy parameter is specified, this function will additionally + * check if the query is for that specific $taxonomy. + * + * If the $term parameter is specified in addition to the $taxonomy parameter, + * this function will additionally check if the query is for one of the terms + * specified. + * + * @since 3.1.0 + * + * @param mixed $taxonomy Optional. Taxonomy slug or slugs. + * @param mixed $term. Optional. Term ID, name, slug or array of Term IDs, names, and slugs. + * @return bool + */ + function is_tax( $taxonomy = '', $term = '' ) { + global $wp_taxonomies; + + if ( !$this->is_tax ) + return false; + + if ( empty( $taxonomy ) ) + return true; + + $queried_object = $this->get_queried_object(); + $tax_array = array_intersect( array_keys( $wp_taxonomies ), (array) $taxonomy ); + $term_array = (array) $term; + + if ( empty( $term ) ) // Only a Taxonomy provided + return isset( $queried_object->taxonomy ) && count( $tax_array ) && in_array( $queried_object->taxonomy, $tax_array ); + + return isset( $queried_object->term_id ) && + count( array_intersect( + array( $queried_object->term_id, $queried_object->name, $queried_object->slug ), + $term_array + ) ); + } + + /** + * Whether the current URL is within the comments popup window. + * + * @since 3.1.0 + * + * @return bool + */ + function is_comments_popup() { + return (bool) $this->is_comments_popup; + } + + /** + * Is the query for a date archive? + * + * @since 3.1.0 + * + * @return bool + */ + function is_date() { + return (bool) $this->is_date; + } + + + /** + * Is the query for a day archive? + * + * @since 3.1.0 + * + * @return bool + */ + function is_day() { + return (bool) $this->is_day; + } + + /** + * Is the query for a feed? + * + * @since 3.1.0 + * + * @param string|array $feeds Optional feed types to check. + * @return bool + */ + function is_feed( $feeds = '' ) { + if ( empty( $feeds ) || ! $this->is_feed ) + return (bool) $this->is_feed; + $qv = $this->get( 'feed' ); + if ( 'feed' == $qv ) + $qv = get_default_feed(); + return in_array( $qv, (array) $feeds ); + } + + /** + * Is the query for a comments feed? + * + * @since 3.1.0 + * + * @return bool + */ + function is_comment_feed() { + return (bool) $this->is_comment_feed; + } + + /** + * Is the query for the front page of the site? + * + * This is for what is displayed at your site's main URL. + * + * Depends on the site's "Front page displays" Reading Settings 'show_on_front' and 'page_on_front'. + * + * If you set a static page for the front page of your site, this function will return + * true when viewing that page. + * + * Otherwise the same as @see WP_Query::is_home() + * + * @since 3.1.0 + * @uses is_home() + * @uses get_option() + * + * @return bool True, if front of site. + */ + function is_front_page() { + // most likely case + if ( 'posts' == get_option( 'show_on_front') && $this->is_home() ) + return true; + elseif ( 'page' == get_option( 'show_on_front') && get_option( 'page_on_front' ) && $this->is_page( get_option( 'page_on_front' ) ) ) + return true; + else + return false; + } + + /** + * Is the query for the blog homepage? + * + * This is the page which shows the time based blog content of your site. + * + * Depends on the site's "Front page displays" Reading Settings 'show_on_front' and 'page_for_posts'. + * + * If you set a static page for the front page of your site, this function will return + * true only on the page you set as the "Posts page". + * + * @see WP_Query::is_front_page() + * + * @since 3.1.0 + * + * @return bool True if blog view homepage. + */ + function is_home() { + return (bool) $this->is_home; + } + + /** + * Is the query for a month archive? + * + * @since 3.1.0 + * + * @return bool + */ + function is_month() { + return (bool) $this->is_month; + } + + /** + * Is the query for a single page? + * + * If the $page parameter is specified, this function will additionally + * check if the query is for one of the pages specified. + * + * @see WP_Query::is_single() + * @see WP_Query::is_singular() + * + * @since 3.1.0 + * + * @param mixed $page Page ID, title, slug, or array of such. + * @return bool + */ + function is_page( $page = '' ) { + if ( !$this->is_page ) + return false; + + if ( empty( $page ) ) + return true; + + $page_obj = $this->get_queried_object(); + + $page = (array) $page; + + if ( in_array( $page_obj->ID, $page ) ) + return true; + elseif ( in_array( $page_obj->post_title, $page ) ) + return true; + else if ( in_array( $page_obj->post_name, $page ) ) + return true; + + return false; + } + + /** + * Is the query for paged result and not for the first page? + * + * @since 3.1.0 + * + * @return bool + */ + function is_paged() { + return (bool) $this->is_paged; + } + + /** + * Is the query for a post or page preview? + * + * @since 3.1.0 + * + * @return bool + */ + function is_preview() { + return (bool) $this->is_preview; + } + + /** + * Is the query for the robots file? + * + * @since 3.1.0 + * + * @return bool + */ + function is_robots() { + return (bool) $this->is_robots; + } + + /** + * Is the query for a search? + * + * @since 3.1.0 + * + * @return bool + */ + function is_search() { + return (bool) $this->is_search; + } + + /** + * Is the query for a single post? + * + * Works for any post type, except attachments and pages + * + * If the $post parameter is specified, this function will additionally + * check if the query is for one of the Posts specified. + * + * @see WP_Query::is_page() + * @see WP_Query::is_singular() + * + * @since 3.1.0 + * + * @param mixed $post Post ID, title, slug, or array of such. + * @return bool + */ + function is_single( $post = '' ) { + if ( !$this->is_single ) + return false; + + if ( empty($post) ) + return true; + + $post_obj = $this->get_queried_object(); + + $post = (array) $post; + + if ( in_array( $post_obj->ID, $post ) ) + return true; + elseif ( in_array( $post_obj->post_title, $post ) ) + return true; + elseif ( in_array( $post_obj->post_name, $post ) ) + return true; + + return false; + } + + /** + * Is the query for a single post of any post type (post, attachment, page, ... )? + * + * If the $post_types parameter is specified, this function will additionally + * check if the query is for one of the Posts Types specified. + * + * @see WP_Query::is_page() + * @see WP_Query::is_single() + * + * @since 3.1.0 + * + * @param mixed $post_types Optional. Post Type or array of Post Types + * @return bool + */ + function is_singular( $post_types = '' ) { + if ( empty( $post_types ) || !$this->is_singular ) + return (bool) $this->is_singular; + + $post_obj = $this->get_queried_object(); + + return in_array( $post_obj->post_type, (array) $post_types ); + } + + /** + * Is the query for a specific time? + * + * @since 3.1.0 + * + * @return bool + */ + function is_time() { + return (bool) $this->is_time; + } + + /** + * Is the query for a trackback endpoint call? + * + * @since 3.1.0 + * + * @return bool + */ + function is_trackback() { + return (bool) $this->is_trackback; + } + + /** + * Is the query for a specific year? + * + * @since 3.1.0 + * + * @return bool + */ + function is_year() { + return (bool) $this->is_year; + } + + /** + * Is the query a 404 (returns no results)? + * + * @since 3.1.0 + * + * @return bool + */ + function is_404() { + return (bool) $this->is_404; + } +} + +/** + * Redirect old slugs to the correct permalink. + * + * Attempts to find the current slug from the past slugs. + * + * @since 2.1.0 + * @uses $wp_query + * @uses $wpdb + * + * @return null If no link is found, null is returned. + */ +function wp_old_slug_redirect() { + global $wp_query; + if ( is_404() && '' != $wp_query->query_vars['name'] ) : + global $wpdb; + + // Guess the current post_type based on the query vars. + if ( get_query_var('post_type') ) + $post_type = get_query_var('post_type'); + elseif ( !empty($wp_query->query_vars['pagename']) ) + $post_type = 'page'; + else + $post_type = 'post'; + + if ( is_array( $post_type ) ) { + if ( count( $post_type ) > 1 ) + return; + $post_type = array_shift( $post_type ); + } + + // Do not attempt redirect for hierarchical post types + if ( is_post_type_hierarchical( $post_type ) ) + return; + + $query = $wpdb->prepare("SELECT post_id FROM $wpdb->postmeta, $wpdb->posts WHERE ID = post_id AND post_type = %s AND meta_key = '_wp_old_slug' AND meta_value = %s", $post_type, $wp_query->query_vars['name']); + + // if year, monthnum, or day have been specified, make our query more precise + // just in case there are multiple identical _wp_old_slug values + if ( '' != $wp_query->query_vars['year'] ) + $query .= $wpdb->prepare(" AND YEAR(post_date) = %d", $wp_query->query_vars['year']); + if ( '' != $wp_query->query_vars['monthnum'] ) + $query .= $wpdb->prepare(" AND MONTH(post_date) = %d", $wp_query->query_vars['monthnum']); + if ( '' != $wp_query->query_vars['day'] ) + $query .= $wpdb->prepare(" AND DAYOFMONTH(post_date) = %d", $wp_query->query_vars['day']); + + $id = (int) $wpdb->get_var($query); + + if ( ! $id ) + return; + + $link = get_permalink($id); + + if ( !$link ) + return; + + wp_redirect( $link, 301 ); // Permanent redirect + exit; + endif; +} + +/** + * Set up global post data. + * + * @since 1.5.0 + * + * @param object $post Post data. + * @uses do_action_ref_array() Calls 'the_post' + * @return bool True when finished. + */ +function setup_postdata($post) { + global $id, $authordata, $currentday, $currentmonth, $page, $pages, $multipage, $more, $numpages; + + $id = (int) $post->ID; + + $authordata = get_userdata($post->post_author); + + $currentday = mysql2date('d.m.y', $post->post_date, false); + $currentmonth = mysql2date('m', $post->post_date, false); + $numpages = 1; + $page = get_query_var('page'); + if ( !$page ) + $page = 1; + if ( is_single() || is_page() || is_feed() ) + $more = 1; + $content = $post->post_content; + if ( strpos( $content, '' ) ) { + if ( $page > 1 ) + $more = 1; + $multipage = 1; + $content = str_replace("\n\n", '', $content); + $content = str_replace("\n", '', $content); + $content = str_replace("\n", '', $content); + $pages = explode('', $content); + $numpages = count($pages); + } else { + $pages = array( $post->post_content ); + $multipage = 0; + } + + do_action_ref_array('the_post', array(&$post)); + + return true; +} +?> diff --git a/src/wp-includes/registration-functions.php b/src/wp-includes/registration-functions.php new file mode 100644 index 0000000..889919d --- /dev/null +++ b/src/wp-includes/registration-functions.php @@ -0,0 +1,8 @@ + \ No newline at end of file diff --git a/src/wp-includes/registration.php b/src/wp-includes/registration.php new file mode 100644 index 0000000..07d919c --- /dev/null +++ b/src/wp-includes/registration.php @@ -0,0 +1,8 @@ + \ No newline at end of file diff --git a/src/wp-includes/rewrite.php b/src/wp-includes/rewrite.php new file mode 100644 index 0000000..46c1b32 --- /dev/null +++ b/src/wp-includes/rewrite.php @@ -0,0 +1,1991 @@ +add_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. + * + * @since 2.1.0 + * + * @param string $tagname + * @param string $regex + */ +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 permalink structure. + * + * @see WP_Rewrite::add_permastruct() + * @since 3.0.0 + * + * @param string $name Name for permalink structure. + * @param string $struct Permalink structure. + * @param bool $with_front Prepend front base to permalink structure. + */ +function add_permastruct( $name, $struct, $with_front = true, $ep_mask = EP_NONE ) { + global $wp_rewrite; + return $wp_rewrite->add_permastruct( $name, $struct, $with_front, $ep_mask ); +} + +/** + * Add a new feed type like /atom1/. + * + * @since 2.1.0 + * + * @param string $feedname + * @param callback $function Callback to run on feed display. + * @return string Feed action name. + */ +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; +} + +/** + * Remove rewrite rules and then recreate rewrite rules. + * + * @see WP_Rewrite::flush_rules() + * @since 3.0.0 + * + * @param bool $hard Whether to update .htaccess (hard flush) or just update + * rewrite_rules transient (soft flush). Default is true (hard). + */ +function flush_rewrite_rules( $hard = true ) { + global $wp_rewrite; + $wp_rewrite->flush_rules( $hard ); +} + +//pseudo-places +/** + * Endpoint Mask for default, which is nothing. + * + * @since 2.1.0 + */ +define('EP_NONE', 0); + +/** + * Endpoint Mask for Permalink. + * + * @since 2.1.0 + */ +define('EP_PERMALINK', 1); + +/** + * Endpoint Mask for Attachment. + * + * @since 2.1.0 + */ +define('EP_ATTACHMENT', 2); + +/** + * Endpoint Mask for date. + * + * @since 2.1.0 + */ +define('EP_DATE', 4); + +/** + * Endpoint Mask for year + * + * @since 2.1.0 + */ +define('EP_YEAR', 8); + +/** + * Endpoint Mask for month. + * + * @since 2.1.0 + */ +define('EP_MONTH', 16); + +/** + * Endpoint Mask for day. + * + * @since 2.1.0 + */ +define('EP_DAY', 32); + +/** + * Endpoint Mask for root. + * + * @since 2.1.0 + */ +define('EP_ROOT', 64); + +/** + * Endpoint Mask for comments. + * + * @since 2.1.0 + */ +define('EP_COMMENTS', 128); + +/** + * Endpoint Mask for searches. + * + * @since 2.1.0 + */ +define('EP_SEARCH', 256); + +/** + * Endpoint Mask for categories. + * + * @since 2.1.0 + */ +define('EP_CATEGORIES', 512); + +/** + * Endpoint Mask for tags. + * + * @since 2.3.0 + */ +define('EP_TAGS', 1024); + +/** + * Endpoint Mask for authors. + * + * @since 2.1.0 + */ +define('EP_AUTHORS', 2048); + +/** + * Endpoint Mask for pages. + * + * @since 2.1.0 + */ +define('EP_PAGES', 4096); + +/** + * Endpoint Mask for everything. + * + * @since 2.1.0 + */ +define('EP_ALL', 8191); + +/** + * Add an endpoint, like /trackback/. + * + * The endpoints are added to the end of the request. So a request matching + * "/2008/10/14/my_post/myep/", the endpoint will be "/myep/". + * + * Be sure to flush the rewrite rules (wp_rewrite->flush_rules()) when your plugin gets + * activated (register_activation_hook()) and deactivated (register_deactivation_hook()) + * + * @since 2.1.0 + * @see WP_Rewrite::add_endpoint() Parameters and more description. + * @uses $wp_rewrite + * + * @param unknown_type $name + * @param unknown_type $places + */ +function add_rewrite_endpoint($name, $places) { + global $wp_rewrite; + $wp_rewrite->add_endpoint($name, $places); +} + +/** + * Filter the URL base for taxonomies. + * + * To remove any manually prepended /index.php/. + * + * @access private + * @since 2.6.0 + * + * @param string $base The taxonomy base that we're going to filter + * @return string + */ +function _wp_filter_taxonomy_base( $base ) { + if ( !empty( $base ) ) { + $base = preg_replace( '|^/index\.php/|', '', $base ); + $base = trim( $base, '/' ); + } + return $base; +} + +/** + * Examine a url and try to determine the post ID it represents. + * + * Checks are supposedly from the hosted site blog. + * + * @since 1.0.0 + * + * @param string $url Permalink to check. + * @return int Post ID, or 0 on failure. + */ +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; + + // 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(home_url(), '://www.') && false === strpos($url, '://www.') ) + $url = str_replace('://', '://www.', $url); + + // Strip 'www.' if it is present and shouldn't be + if ( false === strpos(home_url(), '://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, home_url()) ) { + // Chop off http://domain.com + $url = str_replace(home_url(), '', $url); + } else { + // Chop off /path/to/blog + $home_path = parse_url(home_url()); + $home_path = isset( $home_path['path'] ) ? $home_path['path'] : '' ; + $url = str_replace($home_path, '', $url); + } + + // Trim leading and lagging slashes + $url = trim($url, '/'); + + $request = $url; + + // Look for matches. + $request_match = $request; + foreach ( (array)$rewrite as $match => $query) { + // If the requesting file is the anchor of the match, prepend it + // to the path info. + if ( !empty($url) && ($url != $request) && (strpos($match, $url) === 0) ) + $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. + $query = addslashes(WP_MatchesMapRegex::apply($query, $matches)); + + // Filter out non-public query vars + global $wp; + parse_str($query, $query_vars); + $query = array(); + foreach ( (array) $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 ( !empty($query->posts) && $query->is_singular ) + return $query->post->ID; + else + return 0; + } + } + return 0; +} + +/** + * WordPress Rewrite Component. + * + * The WordPress Rewrite class writes the rewrite module rules to the .htaccess + * file. It also handles parsing the request to get the correct setup for the + * WordPress Query class. + * + * The Rewrite along with WP class function as a front controller for WordPress. + * You can add rules to trigger your page view and processing using this + * component. The full functionality of a front controller does not exist, + * meaning you can't define how the template files load based on the rewrite + * rules. + * + * @since 1.5.0 + */ +class WP_Rewrite { + /** + * Default permalink structure for WordPress. + * + * @since 1.5.0 + * @access private + * @var string + */ + var $permalink_structure; + + /** + * Whether to add trailing slashes. + * + * @since 2.2.0 + * @access private + * @var bool + */ + var $use_trailing_slashes; + + /** + * Permalink author request base ( example.com/author/authorname ). + * + * @since 1.5.0 + * @access private + * @var string + */ + var $author_base = 'author'; + + /** + * Permalink request structure for author pages. + * + * @since 1.5.0 + * @access private + * @var string + */ + var $author_structure; + + /** + * Permalink request structure for dates. + * + * @since 1.5.0 + * @access private + * @var string + */ + var $date_structure; + + /** + * Permalink request structure for pages. + * + * @since 1.5.0 + * @access private + * @var string + */ + var $page_structure; + + /** + * Search permalink base ( example.com/search/query ). + * + * @since 1.5.0 + * @access private + * @var string + */ + var $search_base = 'search'; + + /** + * Permalink request structure for searches. + * + * @since 1.5.0 + * @access private + * @var string + */ + var $search_structure; + + /** + * Comments permalink base. + * + * @since 1.5.0 + * @access private + * @var string + */ + var $comments_base = 'comments'; + + /** + * Pagination permalink base. + * + * @since 3.1.0 + * @access private + * @var string + */ + var $pagination_base = 'page'; + + /** + * Feed permalink base. + * + * @since 1.5.0 + * @access private + * @var string + */ + var $feed_base = 'feed'; + + /** + * Comments feed request structure permalink. + * + * @since 1.5.0 + * @access private + * @var string + */ + var $comments_feed_structure; + + /** + * Feed request structure permalink. + * + * @since 1.5.0 + * @access private + * @var string + */ + var $feed_structure; + + /** + * Front URL path. + * + * The difference between the root property is that WordPress might be + * located at example/WordPress/index.php, if permalinks are turned off. The + * WordPress/index.php will be the front portion. If permalinks are turned + * on, this will most likely be empty or not set. + * + * @since 1.5.0 + * @access private + * @var string + */ + var $front; + + /** + * Root URL path to WordPress (without domain). + * + * The difference between front property is that WordPress might be located + * at example.com/WordPress/. The root is the 'WordPress/' portion. + * + * @since 1.5.0 + * @access private + * @var string + */ + var $root = ''; + + /** + * Permalink to the home page. + * + * @since 1.5.0 + * @access public + * @var string + */ + var $index = 'index.php'; + + /** + * Request match string. + * + * @since 1.5.0 + * @access private + * @var string + */ + var $matches = ''; + + /** + * Rewrite rules to match against the request to find the redirect or query. + * + * @since 1.5.0 + * @access private + * @var array + */ + var $rules; + + /** + * Additional rules added external to the rewrite class. + * + * Those not generated by the class, see add_rewrite_rule(). + * + * @since 2.1.0 + * @access private + * @var array + */ + var $extra_rules = array(); // + + /** + * Additional rules that belong at the beginning to match first. + * + * Those not generated by the class, see add_rewrite_rule(). + * + * @since 2.3.0 + * @access private + * @var array + */ + var $extra_rules_top = array(); // + + /** + * Rules that don't redirect to WP's index.php. + * + * These rules are written to the mod_rewrite portion of the .htaccess. + * + * @since 2.1.0 + * @access private + * @var array + */ + var $non_wp_rules = array(); // + + /** + * Extra permalink structures. + * + * @since 2.1.0 + * @access private + * @var array + */ + var $extra_permastructs = array(); + + /** + * Endpoints permalinks + * + * @since 2.1.0 + * @access private + * @var array + */ + var $endpoints; + + /** + * Whether to write every mod_rewrite rule for WordPress. + * + * This is off by default, turning it on might print a lot of rewrite rules + * to the .htaccess file. + * + * @since 2.0.0 + * @access public + * @var bool + */ + var $use_verbose_rules = false; + + /** + * Whether to write every mod_rewrite rule for WordPress pages. + * + * @since 2.5.0 + * @access public + * @var bool + */ + var $use_verbose_page_rules = true; + + /** + * Permalink structure search for preg_replace. + * + * @since 1.5.0 + * @access private + * @var array + */ + var $rewritecode = + array( + '%year%', + '%monthnum%', + '%day%', + '%hour%', + '%minute%', + '%second%', + '%postname%', + '%post_id%', + '%author%', + '%pagename%', + '%search%' + ); + + /** + * Preg_replace values for the search, see {@link WP_Rewrite::$rewritecode}. + * + * @since 1.5.0 + * @access private + * @var array + */ + 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]+)', + '([^/]+)', + '([^/]+?)', + '(.+)' + ); + + /** + * Search for the query to look for replacing. + * + * @since 1.5.0 + * @access private + * @var array + */ + var $queryreplace = + array ( + 'year=', + 'monthnum=', + 'day=', + 'hour=', + 'minute=', + 'second=', + 'name=', + 'p=', + 'author_name=', + 'pagename=', + 's=' + ); + + /** + * Supported default feeds. + * + * @since 1.5.0 + * @access private + * @var array + */ + var $feeds = array ( 'feed', 'rdf', 'rss', 'rss2', 'atom' ); + + /** + * Whether permalinks are being used. + * + * This can be either rewrite module or permalink in the HTTP query string. + * + * @since 1.5.0 + * @access public + * + * @return bool True, if permalinks are enabled. + */ + function using_permalinks() { + return ! empty($this->permalink_structure); + } + + /** + * Whether permalinks are being used and rewrite module is not enabled. + * + * Means that permalink links are enabled and index.php is in the URL. + * + * @since 1.5.0 + * @access public + * + * @return bool + */ + 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; + } + + /** + * Whether permalinks are being used and rewrite module is enabled. + * + * Using permalinks and index.php is not in the URL. + * + * @since 1.5.0 + * @access public + * + * @return bool + */ + function using_mod_rewrite_permalinks() { + if ( $this->using_permalinks() && ! $this->using_index_permalinks() ) + return true; + else + return false; + } + + /** + * Index for matches for usage in preg_*() functions. + * + * The format of the string is, with empty matches property value, '$NUM'. + * The 'NUM' will be replaced with the value in the $number parameter. With + * the matches property not empty, the value of the returned string will + * contain that value of the matches property. The format then will be + * '$MATCHES[NUM]', with MATCHES as the value in the property and NUM the + * value of the $number parameter. + * + * @since 1.5.0 + * @access public + * + * @param int $number Index number. + * @return string + */ + function preg_index($number) { + $match_prefix = '$'; + $match_suffix = ''; + + if ( ! empty($this->matches) ) { + $match_prefix = '$' . $this->matches . '['; + $match_suffix = ']'; + } + + return "$match_prefix$number$match_suffix"; + } + + /** + * Retrieve all page and attachments for pages URIs. + * + * The attachments are for those that have pages as parents and will be + * retrieved. + * + * @since 2.5.0 + * @access public + * + * @return array Array of page URIs as first element and attachment URIs as second element. + */ + 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' AND post_status != 'auto-draft'") ); + + // If we have no pages get out quick + if ( !$posts ) + return array( array(), array() ); + + //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(); + + 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 ( !empty($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 ); + } + + /** + * Retrieve all of the rewrite rules for pages. + * + * If the 'use_verbose_page_rules' property is false, then there will only + * be a single rewrite rule for pages for those matching '%pagename%'. With + * the property set to true, the attachments and the pages will be added for + * each individual attachment URI and page URI, respectively. + * + * @since 1.5.0 + * @access public + * + * @return array + */ + 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; + } + + /** + * Retrieve date permalink structure, with year, month, and day. + * + * The permalink structure for the date, if not set already depends on the + * permalink structure. It can be one of three formats. The first is year, + * month, day; the second is day, month, year; and the last format is month, + * day, year. These are matched against the permalink structure for which + * one is used. If none matches, then the default will be used, which is + * year, month, day. + * + * Prevents post ID and date permalinks from overlapping. In the case of + * post_id, the date permalink will be prepended with front permalink with + * 'date/' before the actual permalink to form the complete date permalink + * structure. + * + * @since 1.5.0 + * @access public + * + * @return bool|string False on no permalink structure. Date permalink structure. + */ + 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 ( (array) $tokens[0] as $token) { + if ( '%post_id%' == $token && ($tok_index <= 3) ) { + $front = $front . 'date/'; + break; + } + $tok_index++; + } + + $this->date_structure = $front . $date_endian; + + return $this->date_structure; + } + + /** + * Retrieve the year permalink structure without month and day. + * + * Gets the date permalink structure and strips out the month and day + * permalink structures. + * + * @since 1.5.0 + * @access public + * + * @return bool|string False on failure. Year structure on success. + */ + 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; + } + + /** + * Retrieve the month permalink structure without day and with year. + * + * Gets the date permalink structure and strips out the day permalink + * structures. Keeps the year permalink structure. + * + * @since 1.5.0 + * @access public + * + * @return bool|string False on failure. Year/Month structure on success. + */ + 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; + } + + /** + * Retrieve the day permalink structure with month and year. + * + * Keeps date permalink structure with all year, month, and day. + * + * @since 1.5.0 + * @access public + * + * @return bool|string False on failure. Year/Month/Day structure on success. + */ + function get_day_permastruct() { + return $this->get_date_permastruct($this->permalink_structure); + } + + /** + * Retrieve the permalink structure for categories. + * + * If the category_base property has no value, then the category structure + * will have the front property value, followed by 'category', and finally + * '%category%'. If it does, then the root property will be used, along with + * the category_base property value. + * + * @since 1.5.0 + * @access public + * + * @return bool|string False on failure. Category permalink structure. + */ + function get_category_permastruct() { + return $this->get_extra_permastruct('category'); + } + + /** + * Retrieve the permalink structure for tags. + * + * If the tag_base property has no value, then the tag structure will have + * the front property value, followed by 'tag', and finally '%tag%'. If it + * does, then the root property will be used, along with the tag_base + * property value. + * + * @since 2.3.0 + * @access public + * + * @return bool|string False on failure. Tag permalink structure. + */ + function get_tag_permastruct() { + return $this->get_extra_permastruct('post_tag'); + } + + /** + * Retrieve extra permalink structure by name. + * + * @since 2.5.0 + * @access public + * + * @param string $name Permalink structure name. + * @return string|bool False if not found. Permalink structure string. + */ + function get_extra_permastruct($name) { + if ( empty($this->permalink_structure) ) + return false; + + if ( isset($this->extra_permastructs[$name]) ) + return $this->extra_permastructs[$name][0]; + + return false; + } + + /** + * Retrieve the author permalink structure. + * + * The permalink structure is front property, author base, and finally + * '/%author%'. Will set the author_structure property and then return it + * without attempting to set the value again. + * + * @since 1.5.0 + * @access public + * + * @return string|bool False if not found. Permalink structure string. + */ + 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; + } + + /** + * Retrieve the search permalink structure. + * + * The permalink structure is root property, search base, and finally + * '/%search%'. Will set the search_structure property and then return it + * without attempting to set the value again. + * + * @since 1.5.0 + * @access public + * + * @return string|bool False if not found. Permalink structure string. + */ + 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; + } + + /** + * Retrieve the page permalink structure. + * + * The permalink structure is root property, and '%pagename%'. Will set the + * page_structure property and then return it without attempting to set the + * value again. + * + * @since 1.5.0 + * @access public + * + * @return string|bool False if not found. Permalink structure string. + */ + 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; + } + + /** + * Retrieve the feed permalink structure. + * + * The permalink structure is root property, feed base, and finally + * '/%feed%'. Will set the feed_structure property and then return it + * without attempting to set the value again. + * + * @since 1.5.0 + * @access public + * + * @return string|bool False if not found. Permalink structure string. + */ + 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; + } + + /** + * Retrieve the comment feed permalink structure. + * + * The permalink structure is root property, comment base property, feed + * base and finally '/%feed%'. Will set the comment_feed_structure property + * and then return it without attempting to set the value again. + * + * @since 1.5.0 + * @access public + * + * @return string|bool False if not found. Permalink structure string. + */ + 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; + } + + /** + * Append or update tag, pattern, and query for replacement. + * + * 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. + * + * @internal What is the purpose of this function again? Need to finish long + * description. + * + * @since 1.5.0 + * @access public + * + * @param string $tag Append tag to rewritecode property array. + * @param string $pattern Append pattern to rewritereplace property array. + * @param string $query Append query to queryreplace property array. + */ + function add_rewrite_tag($tag, $pattern, $query) { + $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; + } + } + + /** + * Generate the rules from permalink structure. + * + * The main WP_Rewrite function for building the rewrite rule list. The + * contents of the function is a mix of black magic and regular expressions, + * so best just ignore the contents and move to the parameters. + * + * @since 1.5.0 + * @access public + * + * @param string $permalink_structure The permalink structure. + * @param int $ep_mask Optional, default is EP_NONE. Endpoint constant, see EP_* constants. + * @param bool $paged Optional, default is true. Whether permalink request is paged. + * @param bool $feed Optional, default is true. Whether for feed. + * @param bool $forcomments Optional, default is false. Whether for comments. + * @param bool $walk_dirs Optional, default is true. Whether to create list of directories to walk over. + * @param bool $endpoints Optional, default is true. Whether endpoints are enabled. + * @return array Rewrite rule list. + */ + 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 ( (array) $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 = $this->pagination_base . '/?([0-9]{1,})/?$'; + $commentregex = 'comment-page-([0-9]{1,})/?$'; + + //build up an array of endpoint regexes to append => queries to append + if ( $endpoints ) { + $ep_query_append = array (); + foreach ( (array) $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, '/'); + $dirs = $walk_dirs ? explode('/', $structure) : array( $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; + default: + $ep_mask_specific = EP_NONE; + } + + //create query for /page/xx + $pagematch = $match . $pageregex; + $pagequery = $index . '?' . $query . '&paged=' . $this->preg_index($num_toks + 1); + + //create query for /comment-page-xx + $commentmatch = $match . $commentregex; + $commentquery = $index . '?' . $query . '&cpage=' . $this->preg_index($num_toks + 1); + + if ( get_option('page_on_front') ) { + //create query for Root /comment-page-xx + $rootcommentmatch = $match . $commentregex; + $rootcommentquery = $index . '?' . $query . '&page_id=' . get_option('page_on_front') . '&cpage=' . $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)); + + //only on pages with comments add ../comment-page-xx/ + if ( EP_PAGES & $ep_mask || EP_PERMALINK & $ep_mask ) + $rewrite = array_merge($rewrite, array($commentmatch => $commentquery)); + else if ( EP_ROOT & $ep_mask && get_option('page_on_front') ) + $rewrite = array_merge($rewrite, array($rootcommentmatch => $rootcommentquery)); + + //do endpoints + if ( $endpoints ) { + foreach ( (array) $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 ( ! $post ) { + // For custom post types, we need to add on endpoints as well. + foreach ( get_post_types( array('_builtin' => false ) ) as $ptype ) { + if ( strpos($struct, "%$ptype%") !== false ) { + $post = true; + $page = is_post_type_hierarchical( $ptype ); // This is for page style attachment url's + break; + } + } + } + + //if we're creating rules for a permalink, do all the endpoints like attachments etc + if ( $post ) { + //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...) + $sub1comment = $sub1 . $commentregex; //and /comment-page-xx + //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...) + $sub2comment = $sub2 . $commentregex; //and /comment-page-xx + + //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); + $subcommentquery = $subquery . '&cpage=' . $this->preg_index(2); + + //do endpoints for attachments + if ( !empty($endpoints) ) { + foreach ( (array) $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, $sub1comment => $subcommentquery)); + $rewrite = array_merge(array($sub2 => $subquery, $sub2tb => $subtbquery, $sub2feed => $subfeedquery, $sub2feed2 => $subfeedquery, $sub2comment => $subcommentquery), $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! + } + + /** + * Generate Rewrite rules with permalink structure and walking directory only. + * + * Shorten version of {@link WP_Rewrite::generate_rewrite_rules()} that + * allows for shorter list of parameters. See the method for longer + * description of what generating rewrite rules does. + * + * @uses WP_Rewrite::generate_rewrite_rules() See for long description and rest of parameters. + * @since 1.5.0 + * @access public + * + * @param string $permalink_structure The permalink structure to generate rules. + * @param bool $walk_dirs Optional, default is false. Whether to create list of directories to walk over. + * @return array + */ + function generate_rewrite_rule($permalink_structure, $walk_dirs = false) { + return $this->generate_rewrite_rules($permalink_structure, EP_NONE, false, false, false, $walk_dirs); + } + + /** + * Construct rewrite matches and queries from permalink structure. + * + * Runs the action 'generate_rewrite_rules' with the parameter that is an + * reference to the current WP_Rewrite instance to further manipulate the + * permalink structures and rewrite rules. Runs the 'rewrite_rules_array' + * filter on the full rewrite rule array. + * + * There are two ways to manipulate the rewrite rules, one by hooking into + * the 'generate_rewrite_rules' action and gaining full control of the + * object or just manipulating the rewrite rule array before it is passed + * from the function. + * + * @since 1.5.0 + * @access public + * + * @return array An associate array of matches and queries. + */ + function rewrite_rules() { + $rewrite = array(); + + if ( empty($this->permalink_structure) ) + return $rewrite; + + // robots.txt -only if installed at the root + $home_path = parse_url( home_url() ); + $robots_rewrite = ( empty( $home_path['path'] ) || '/' == $home_path['path'] ) ? array( 'robots\.txt$' => $this->index . '?robots=1' ) : array(); + + // 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'); + + // Registration rules + $registration_pages = array(); + if ( is_multisite() && is_main_site() ) { + $registration_pages['.*wp-signup.php$'] = $this->index . '?signup=true'; + $registration_pages['.*wp-activate.php$'] = $this->index . '?activate=true'; + } + + // 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); + + // 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 $permastructname => $permastruct ) { + if ( is_array($permastruct) ) + $rules = $this->generate_rewrite_rules($permastruct[0], $permastruct[1]); + else + $rules = $this->generate_rewrite_rules($permastruct, EP_NONE); + + $rules = apply_filters($permastructname . '_rewrite_rules', $rules); + if ( 'post_tag' == $permastructname ) + $rules = apply_filters('tag_rewrite_rules', $rules); + + $this->extra_rules_top = array_merge($this->extra_rules_top, $rules); + } + + // Put them together. + if ( $this->use_verbose_page_rules ) + $this->rules = array_merge($this->extra_rules_top, $robots_rewrite, $default_feeds, $registration_pages, $page_rewrite, $root_rewrite, $comments_rewrite, $search_rewrite, $author_rewrite, $date_rewrite, $post_rewrite, $this->extra_rules); + else + $this->rules = array_merge($this->extra_rules_top, $robots_rewrite, $default_feeds, $registration_pages, $root_rewrite, $comments_rewrite, $search_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; + } + + /** + * Retrieve the rewrite rules. + * + * The difference between this method and {@link + * WP_Rewrite::rewrite_rules()} is that this method stores the rewrite rules + * in the 'rewrite_rules' option and retrieves it. This prevents having to + * process all of the permalinks to get the rewrite rules in the form of + * caching. + * + * @since 1.5.0 + * @access public + * + * @return array Rewrite 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; + } + + /** + * Retrieve mod_rewrite formatted rewrite rules to write to .htaccess. + * + * Does not actually write to the .htaccess file, but creates the rules for + * the process that will. + * + * Will add the non_wp_rules property rules to the .htaccess file before + * the WordPress rewrite rules one. + * + * @since 1.5.0 + * @access public + * + * @return string + */ + function mod_rewrite_rules() { + if ( ! $this->using_permalinks() ) + return ''; + + $site_root = parse_url(get_option('siteurl')); + if ( isset( $site_root['path'] ) ) + $site_root = trailingslashit($site_root['path']); + + $home_root = parse_url(home_url()); + if ( isset( $home_root['path'] ) ) + $home_root = trailingslashit($home_root['path']); + else + $home_root = '/'; + + $rules = "\n"; + $rules .= "RewriteEngine On\n"; + $rules .= "RewriteBase $home_root\n"; + $rules .= "RewriteRule ^index\.php$ - [L]\n"; // Prevent -f checks on index.php. + + //add in the rules that don't redirect to WP's index.php (and thus shouldn't be handled by WP at all) + foreach ( (array) $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 ( (array) $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; + } + + /** + * Retrieve IIS7 URL Rewrite formatted rewrite rules to write to web.config file. + * + * Does not actually write to the web.config file, but creates the rules for + * the process that will. + * + * @since 2.8.0 + * @access public + * + * @return string + */ + function iis7_url_rewrite_rules( $add_parent_tags = false ) { + + if ( ! $this->using_permalinks() ) + return ''; + $rules = ''; + if ( $add_parent_tags ) { + $rules .= ' + + + '; + } + if ( !is_multisite() ) { + $rules .= ' + + + + + + + + '; + } else { + if (is_subdomain_install()) { + $rules .= ' + + + + + + + + + + + + + + + + + + + + '; + } else { + $rules .= ' + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + '; + } + } + if ( $add_parent_tags ) { + $rules .= ' + + + +'; + } + + $rules = apply_filters('iis7_url_rewrite_rules', $rules); + + return $rules; + } + + /** + * Add a straight rewrite rule. + * + * Any value in the $after parameter that isn't 'bottom' will be placed at + * the top of the rules. + * + * @since 2.1.0 + * @access public + * + * @param string $regex Regular expression to match against request. + * @param string $redirect URL regex redirects to when regex matches request. + * @param string $after Optional, default is bottom. Location to place 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. + * + * Can redirect to any place. + * + * @since 2.1.0 + * @access public + * + * @param string $regex Regular expression to match against request. + * @param string $redirect URL regex redirects to when regex matches request. + */ + 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). + * + * @since 2.1.0 + * @access public + * + * @param string $name Name of endpoint. + * @param array $places URL types that endpoint can be used. + */ + function add_endpoint($name, $places) { + global $wp; + $this->endpoints[] = array ( $places, $name ); + $wp->add_query_var($name); + } + + /** + * Add permalink structure. + * + * These are added along with the extra rewrite rules that are merged to the + * top. + * + * @since 2.5.0 + * @access public + * + * @param string $name Name for permalink structure. + * @param string $struct Permalink structure. + * @param bool $with_front Prepend front base to permalink structure. + */ + function add_permastruct($name, $struct, $with_front = true, $ep_mask = EP_NONE) { + if ( $with_front ) + $struct = $this->front . $struct; + else + $struct = $this->root . $struct; + $this->extra_permastructs[$name] = array($struct, $ep_mask); + } + + /** + * Remove rewrite rules and then recreate rewrite rules. + * + * Calls {@link WP_Rewrite::wp_rewrite_rules()} after removing the + * 'rewrite_rules' option. If the function named 'save_mod_rewrite_rules' + * exists, it will be called. + * + * @since 2.0.1 + * @access public + * @param bool $hard Whether to update .htaccess (hard flush) or just update rewrite_rules option (soft flush). Default is true (hard). + */ + function flush_rules($hard = true) { + delete_option('rewrite_rules'); + $this->wp_rewrite_rules(); + if ( $hard && function_exists('save_mod_rewrite_rules') ) + save_mod_rewrite_rules(); + if ( $hard && function_exists('iis7_save_url_rewrite_rules') ) + iis7_save_url_rewrite_rules(); + } + + /** + * Sets up the object's properties. + * + * The 'use_verbose_page_rules' object property will be set to true if the + * permalink structure begins with one of the following: '%postname%', '%category%', + * '%tag%', or '%author%'. + * + * @since 1.5.0 + * @access public + */ + 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 . '/'; + 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) ); + + // Enable generic rules for pages if permalink structure doesn't begin with a wildcard. + if ( preg_match("/^[^%]*%(?:postname|category|tag|author)%/", $this->permalink_structure) ) + $this->use_verbose_page_rules = true; + else + $this->use_verbose_page_rules = false; + } + + /** + * Set the main permalink structure for the blog. + * + * Will update the 'permalink_structure' option, if there is a difference + * between the current permalink structure and the parameter value. Calls + * {@link WP_Rewrite::init()} after the option is updated. + * + * Fires the 'permalink_structure_changed' action once the init call has + * processed passing the old and new values + * + * @since 1.5.0 + * @access public + * + * @param string $permalink_structure Permalink structure. + */ + function set_permalink_structure($permalink_structure) { + if ( $permalink_structure != $this->permalink_structure ) { + update_option('permalink_structure', $permalink_structure); + $this->init(); + do_action('permalink_structure_changed', $this->permalink_structure, $permalink_structure); + } + } + + /** + * Set the category base for the category permalink. + * + * Will update the 'category_base' option, if there is a difference between + * the current category base and the parameter value. Calls + * {@link WP_Rewrite::init()} after the option is updated. + * + * @since 1.5.0 + * @access public + * + * @param string $category_base Category permalink structure base. + */ + function set_category_base($category_base) { + if ( $category_base != get_option('category_base') ) { + update_option('category_base', $category_base); + $this->init(); + } + } + + /** + * Set the tag base for the tag permalink. + * + * Will update the 'tag_base' option, if there is a difference between the + * current tag base and the parameter value. Calls + * {@link WP_Rewrite::init()} after the option is updated. + * + * @since 2.3.0 + * @access public + * + * @param string $tag_base Tag permalink structure base. + */ + function set_tag_base( $tag_base ) { + if ( $tag_base != get_option( 'tag_base') ) { + update_option( 'tag_base', $tag_base ); + $this->init(); + } + } + + /** + * Constructor - Calls init(), which runs setup. + * + * @since 1.5.0 + * @access public + * + * @return WP_Rewrite + */ + function __construct() { + $this->init(); + } +} + +?> diff --git a/src/wp-includes/rss-functions.php b/src/wp-includes/rss-functions.php new file mode 100644 index 0000000..ea32692 --- /dev/null +++ b/src/wp-includes/rss-functions.php @@ -0,0 +1,10 @@ + diff --git a/src/wp-includes/rss.php b/src/wp-includes/rss.php new file mode 100644 index 0000000..88bfa62 --- /dev/null +++ b/src/wp-includes/rss.php @@ -0,0 +1,939 @@ + + * @version 0.51 + * @license GPL + * + * @package External + * @subpackage MagpieRSS + */ + +/** + * Deprecated. Use SimplePie (class-simplepie.php) instead. + */ +_deprecated_file( basename( __FILE__ ), '3.0', WPINC . '/class-simplepie.php' ); + +/* + * Hook to use another RSS object instead of MagpieRSS + */ +do_action('load_feed_engine'); + +/** RSS feed constant. */ +define('RSS', 'RSS'); +define('ATOM', 'Atom'); +define('MAGPIE_USER_AGENT', 'WordPress/' . $GLOBALS['wp_version']); + +class MagpieRSS { + var $parser; + var $current_item = array(); // item currently being parsed + var $items = array(); // collection of parsed items + var $channel = array(); // hash of channel fields + var $textinput = array(); + var $image = array(); + var $feed_type; + var $feed_version; + + // parser variables + var $stack = array(); // parser stack + var $inchannel = false; + var $initem = false; + var $incontent = false; // if in Atom field + var $intextinput = false; + var $inimage = false; + var $current_field = ''; + var $current_namespace = false; + + //var $ERROR = ""; + + var $_CONTENT_CONSTRUCTS = array('content', 'summary', 'info', 'title', 'tagline', 'copyright'); + + function MagpieRSS ($source) { + + # if PHP xml isn't compiled in, die + # + if ( !function_exists('xml_parser_create') ) + trigger_error( "Failed to load PHP's XML Extension. http://www.php.net/manual/en/ref.xml.php" ); + + $parser = @xml_parser_create(); + + if ( !is_resource($parser) ) + trigger_error( "Failed to create an instance of PHP's XML parser. http://www.php.net/manual/en/ref.xml.php"); + + + $this->parser = $parser; + + # pass in parser, and a reference to this object + # set up handlers + # + xml_set_object( $this->parser, $this ); + xml_set_element_handler($this->parser, + 'feed_start_element', 'feed_end_element' ); + + xml_set_character_data_handler( $this->parser, 'feed_cdata' ); + + $status = xml_parse( $this->parser, $source ); + + if (! $status ) { + $errorcode = xml_get_error_code( $this->parser ); + if ( $errorcode != XML_ERROR_NONE ) { + $xml_error = xml_error_string( $errorcode ); + $error_line = xml_get_current_line_number($this->parser); + $error_col = xml_get_current_column_number($this->parser); + $errormsg = "$xml_error at line $error_line, column $error_col"; + + $this->error( $errormsg ); + } + } + + xml_parser_free( $this->parser ); + + $this->normalize(); + } + + function feed_start_element($p, $element, &$attrs) { + $el = $element = strtolower($element); + $attrs = array_change_key_case($attrs, CASE_LOWER); + + // check for a namespace, and split if found + $ns = false; + if ( strpos( $element, ':' ) ) { + list($ns, $el) = split( ':', $element, 2); + } + if ( $ns and $ns != 'rdf' ) { + $this->current_namespace = $ns; + } + + # if feed type isn't set, then this is first element of feed + # identify feed from root element + # + if (!isset($this->feed_type) ) { + if ( $el == 'rdf' ) { + $this->feed_type = RSS; + $this->feed_version = '1.0'; + } + elseif ( $el == 'rss' ) { + $this->feed_type = RSS; + $this->feed_version = $attrs['version']; + } + elseif ( $el == 'feed' ) { + $this->feed_type = ATOM; + $this->feed_version = $attrs['version']; + $this->inchannel = true; + } + return; + } + + if ( $el == 'channel' ) + { + $this->inchannel = true; + } + elseif ($el == 'item' or $el == 'entry' ) + { + $this->initem = true; + if ( isset($attrs['rdf:about']) ) { + $this->current_item['about'] = $attrs['rdf:about']; + } + } + + // if we're in the default namespace of an RSS feed, + // record textinput or image fields + elseif ( + $this->feed_type == RSS and + $this->current_namespace == '' and + $el == 'textinput' ) + { + $this->intextinput = true; + } + + elseif ( + $this->feed_type == RSS and + $this->current_namespace == '' and + $el == 'image' ) + { + $this->inimage = true; + } + + # handle atom content constructs + elseif ( $this->feed_type == ATOM and in_array($el, $this->_CONTENT_CONSTRUCTS) ) + { + // avoid clashing w/ RSS mod_content + if ($el == 'content' ) { + $el = 'atom_content'; + } + + $this->incontent = $el; + + + } + + // if inside an Atom content construct (e.g. content or summary) field treat tags as text + elseif ($this->feed_type == ATOM and $this->incontent ) + { + // if tags are inlined, then flatten + $attrs_str = join(' ', + array_map(array('MagpieRSS', 'map_attrs'), + array_keys($attrs), + array_values($attrs) ) ); + + $this->append_content( "<$element $attrs_str>" ); + + array_unshift( $this->stack, $el ); + } + + // Atom support many links per containging element. + // Magpie treats link elements of type rel='alternate' + // as being equivalent to RSS's simple link element. + // + elseif ($this->feed_type == ATOM and $el == 'link' ) + { + if ( isset($attrs['rel']) and $attrs['rel'] == 'alternate' ) + { + $link_el = 'link'; + } + else { + $link_el = 'link_' . $attrs['rel']; + } + + $this->append($link_el, $attrs['href']); + } + // set stack[0] to current element + else { + array_unshift($this->stack, $el); + } + } + + + + function feed_cdata ($p, $text) { + + if ($this->feed_type == ATOM and $this->incontent) + { + $this->append_content( $text ); + } + else { + $current_el = join('_', array_reverse($this->stack)); + $this->append($current_el, $text); + } + } + + function feed_end_element ($p, $el) { + $el = strtolower($el); + + if ( $el == 'item' or $el == 'entry' ) + { + $this->items[] = $this->current_item; + $this->current_item = array(); + $this->initem = false; + } + elseif ($this->feed_type == RSS and $this->current_namespace == '' and $el == 'textinput' ) + { + $this->intextinput = false; + } + elseif ($this->feed_type == RSS and $this->current_namespace == '' and $el == 'image' ) + { + $this->inimage = false; + } + elseif ($this->feed_type == ATOM and in_array($el, $this->_CONTENT_CONSTRUCTS) ) + { + $this->incontent = false; + } + elseif ($el == 'channel' or $el == 'feed' ) + { + $this->inchannel = false; + } + elseif ($this->feed_type == ATOM and $this->incontent ) { + // balance tags properly + // note: i don't think this is actually neccessary + if ( $this->stack[0] == $el ) + { + $this->append_content(""); + } + else { + $this->append_content("<$el />"); + } + + array_shift( $this->stack ); + } + else { + array_shift( $this->stack ); + } + + $this->current_namespace = false; + } + + function concat (&$str1, $str2="") { + if (!isset($str1) ) { + $str1=""; + } + $str1 .= $str2; + } + + function append_content($text) { + if ( $this->initem ) { + $this->concat( $this->current_item[ $this->incontent ], $text ); + } + elseif ( $this->inchannel ) { + $this->concat( $this->channel[ $this->incontent ], $text ); + } + } + + // smart append - field and namespace aware + function append($el, $text) { + if (!$el) { + return; + } + if ( $this->current_namespace ) + { + if ( $this->initem ) { + $this->concat( + $this->current_item[ $this->current_namespace ][ $el ], $text); + } + elseif ($this->inchannel) { + $this->concat( + $this->channel[ $this->current_namespace][ $el ], $text ); + } + elseif ($this->intextinput) { + $this->concat( + $this->textinput[ $this->current_namespace][ $el ], $text ); + } + elseif ($this->inimage) { + $this->concat( + $this->image[ $this->current_namespace ][ $el ], $text ); + } + } + else { + if ( $this->initem ) { + $this->concat( + $this->current_item[ $el ], $text); + } + elseif ($this->intextinput) { + $this->concat( + $this->textinput[ $el ], $text ); + } + elseif ($this->inimage) { + $this->concat( + $this->image[ $el ], $text ); + } + elseif ($this->inchannel) { + $this->concat( + $this->channel[ $el ], $text ); + } + + } + } + + function normalize () { + // if atom populate rss fields + if ( $this->is_atom() ) { + $this->channel['descripton'] = $this->channel['tagline']; + for ( $i = 0; $i < count($this->items); $i++) { + $item = $this->items[$i]; + if ( isset($item['summary']) ) + $item['description'] = $item['summary']; + if ( isset($item['atom_content'])) + $item['content']['encoded'] = $item['atom_content']; + + $this->items[$i] = $item; + } + } + elseif ( $this->is_rss() ) { + $this->channel['tagline'] = $this->channel['description']; + for ( $i = 0; $i < count($this->items); $i++) { + $item = $this->items[$i]; + if ( isset($item['description'])) + $item['summary'] = $item['description']; + if ( isset($item['content']['encoded'] ) ) + $item['atom_content'] = $item['content']['encoded']; + + $this->items[$i] = $item; + } + } + } + + function is_rss () { + if ( $this->feed_type == RSS ) { + return $this->feed_version; + } + else { + return false; + } + } + + function is_atom() { + if ( $this->feed_type == ATOM ) { + return $this->feed_version; + } + else { + return false; + } + } + + function map_attrs($k, $v) { + return "$k=\"$v\""; + } + + function error( $errormsg, $lvl = E_USER_WARNING ) { + // append PHP's error message if track_errors enabled + if ( isset($php_errormsg) ) { + $errormsg .= " ($php_errormsg)"; + } + if ( MAGPIE_DEBUG ) { + trigger_error( $errormsg, $lvl); + } else { + error_log( $errormsg, 0); + } + } + +} + +if ( !function_exists('fetch_rss') ) : +/** + * Build Magpie object based on RSS from URL. + * + * @since 1.5.0 + * @package External + * @subpackage MagpieRSS + * + * @param string $url URL to retrieve feed + * @return bool|MagpieRSS false on failure or MagpieRSS object on success. + */ +function fetch_rss ($url) { + // initialize constants + init(); + + if ( !isset($url) ) { + // error("fetch_rss called without a url"); + return false; + } + + // if cache is disabled + if ( !MAGPIE_CACHE_ON ) { + // fetch file, and parse it + $resp = _fetch_remote_file( $url ); + if ( is_success( $resp->status ) ) { + return _response_to_rss( $resp ); + } + else { + // error("Failed to fetch $url and cache is off"); + return false; + } + } + // else cache is ON + else { + // Flow + // 1. check cache + // 2. if there is a hit, make sure its fresh + // 3. if cached obj fails freshness check, fetch remote + // 4. if remote fails, return stale object, or error + + $cache = new RSSCache( MAGPIE_CACHE_DIR, MAGPIE_CACHE_AGE ); + + if (MAGPIE_DEBUG and $cache->ERROR) { + debug($cache->ERROR, E_USER_WARNING); + } + + + $cache_status = 0; // response of check_cache + $request_headers = array(); // HTTP headers to send with fetch + $rss = 0; // parsed RSS object + $errormsg = 0; // errors, if any + + if (!$cache->ERROR) { + // return cache HIT, MISS, or STALE + $cache_status = $cache->check_cache( $url ); + } + + // if object cached, and cache is fresh, return cached obj + if ( $cache_status == 'HIT' ) { + $rss = $cache->get( $url ); + if ( isset($rss) and $rss ) { + $rss->from_cache = 1; + if ( MAGPIE_DEBUG > 1) { + debug("MagpieRSS: Cache HIT", E_USER_NOTICE); + } + return $rss; + } + } + + // else attempt a conditional get + + // set up headers + if ( $cache_status == 'STALE' ) { + $rss = $cache->get( $url ); + if ( isset($rss->etag) and $rss->last_modified ) { + $request_headers['If-None-Match'] = $rss->etag; + $request_headers['If-Last-Modified'] = $rss->last_modified; + } + } + + $resp = _fetch_remote_file( $url, $request_headers ); + + if (isset($resp) and $resp) { + if ($resp->status == '304' ) { + // we have the most current copy + if ( MAGPIE_DEBUG > 1) { + debug("Got 304 for $url"); + } + // reset cache on 304 (at minutillo insistent prodding) + $cache->set($url, $rss); + return $rss; + } + elseif ( is_success( $resp->status ) ) { + $rss = _response_to_rss( $resp ); + if ( $rss ) { + if (MAGPIE_DEBUG > 1) { + debug("Fetch successful"); + } + // add object to cache + $cache->set( $url, $rss ); + return $rss; + } + } + else { + $errormsg = "Failed to fetch $url. "; + if ( $resp->error ) { + # compensate for Snoopy's annoying habbit to tacking + # on '\n' + $http_error = substr($resp->error, 0, -2); + $errormsg .= "(HTTP Error: $http_error)"; + } + else { + $errormsg .= "(HTTP Response: " . $resp->response_code .')'; + } + } + } + else { + $errormsg = "Unable to retrieve RSS file for unknown reasons."; + } + + // else fetch failed + + // attempt to return cached object + if ($rss) { + if ( MAGPIE_DEBUG ) { + debug("Returning STALE object for $url"); + } + return $rss; + } + + // else we totally failed + // error( $errormsg ); + + return false; + + } // end if ( !MAGPIE_CACHE_ON ) { +} // end fetch_rss() +endif; + +/** + * Retrieve URL headers and content using WP HTTP Request API. + * + * @since 1.5.0 + * @package External + * @subpackage MagpieRSS + * + * @param string $url URL to retrieve + * @param array $headers Optional. Headers to send to the URL. + * @return Snoopy style response + */ +function _fetch_remote_file($url, $headers = "" ) { + $resp = wp_remote_request($url, array('headers' => $headers, 'timeout' => MAGPIE_FETCH_TIME_OUT)); + if ( is_wp_error($resp) ) { + $error = array_shift($resp->errors); + + $resp = new stdClass; + $resp->status = 500; + $resp->response_code = 500; + $resp->error = $error[0] . "\n"; //\n = Snoopy compatibility + return $resp; + } + + // Snoopy returns headers unprocessed. + // Also note, WP_HTTP lowercases all keys, Snoopy did not. + $return_headers = array(); + foreach ( wp_remote_retrieve_headers( $resp ) as $key => $value ) { + if ( !is_array($value) ) { + $return_headers[] = "$key: $value"; + } else { + foreach ( $value as $v ) + $return_headers[] = "$key: $v"; + } + } + + $response = new stdClass; + $response->status = wp_remote_retrieve_response_code( $resp ); + $response->response_code = wp_remote_retrieve_response_code( $resp ); + $response->headers = $return_headers; + $response->results = wp_remote_retrieve_body( $resp ); + + return $response; +} + +/** + * Retrieve + * + * @since 1.5.0 + * @package External + * @subpackage MagpieRSS + * + * @param unknown_type $resp + * @return unknown + */ +function _response_to_rss ($resp) { + $rss = new MagpieRSS( $resp->results ); + + // if RSS parsed successfully + if ( $rss && (!isset($rss->ERROR) || !$rss->ERROR) ) { + + // find Etag, and Last-Modified + foreach( (array) $resp->headers as $h) { + // 2003-03-02 - Nicola Asuni (www.tecnick.com) - fixed bug "Undefined offset: 1" + if (strpos($h, ": ")) { + list($field, $val) = explode(": ", $h, 2); + } + else { + $field = $h; + $val = ""; + } + + if ( $field == 'etag' ) { + $rss->etag = $val; + } + + if ( $field == 'last-modified' ) { + $rss->last_modified = $val; + } + } + + return $rss; + } // else construct error message + else { + $errormsg = "Failed to parse RSS file."; + + if ($rss) { + $errormsg .= " (" . $rss->ERROR . ")"; + } + // error($errormsg); + + return false; + } // end if ($rss and !$rss->error) +} + +/** + * Set up constants with default values, unless user overrides. + * + * @since 1.5.0 + * @package External + * @subpackage MagpieRSS + */ +function init () { + if ( defined('MAGPIE_INITALIZED') ) { + return; + } + else { + define('MAGPIE_INITALIZED', 1); + } + + if ( !defined('MAGPIE_CACHE_ON') ) { + define('MAGPIE_CACHE_ON', 1); + } + + if ( !defined('MAGPIE_CACHE_DIR') ) { + define('MAGPIE_CACHE_DIR', './cache'); + } + + if ( !defined('MAGPIE_CACHE_AGE') ) { + define('MAGPIE_CACHE_AGE', 60*60); // one hour + } + + if ( !defined('MAGPIE_CACHE_FRESH_ONLY') ) { + define('MAGPIE_CACHE_FRESH_ONLY', 0); + } + + if ( !defined('MAGPIE_DEBUG') ) { + define('MAGPIE_DEBUG', 0); + } + + if ( !defined('MAGPIE_USER_AGENT') ) { + $ua = 'WordPress/' . $GLOBALS['wp_version']; + + if ( MAGPIE_CACHE_ON ) { + $ua = $ua . ')'; + } + else { + $ua = $ua . '; No cache)'; + } + + define('MAGPIE_USER_AGENT', $ua); + } + + if ( !defined('MAGPIE_FETCH_TIME_OUT') ) { + define('MAGPIE_FETCH_TIME_OUT', 2); // 2 second timeout + } + + // use gzip encoding to fetch rss files if supported? + if ( !defined('MAGPIE_USE_GZIP') ) { + define('MAGPIE_USE_GZIP', true); + } +} + +function is_info ($sc) { + return $sc >= 100 && $sc < 200; +} + +function is_success ($sc) { + return $sc >= 200 && $sc < 300; +} + +function is_redirect ($sc) { + return $sc >= 300 && $sc < 400; +} + +function is_error ($sc) { + return $sc >= 400 && $sc < 600; +} + +function is_client_error ($sc) { + return $sc >= 400 && $sc < 500; +} + +function is_server_error ($sc) { + return $sc >= 500 && $sc < 600; +} + +class RSSCache { + var $BASE_CACHE; // where the cache files are stored + var $MAX_AGE = 43200; // when are files stale, default twelve hours + var $ERROR = ''; // accumulate error messages + + function RSSCache ($base='', $age='') { + $this->BASE_CACHE = WP_CONTENT_DIR . '/cache'; + if ( $base ) { + $this->BASE_CACHE = $base; + } + if ( $age ) { + $this->MAX_AGE = $age; + } + + } + +/*=======================================================================*\ + Function: set + Purpose: add an item to the cache, keyed on url + Input: url from wich the rss file was fetched + Output: true on sucess +\*=======================================================================*/ + function set ($url, $rss) { + $cache_option = 'rss_' . $this->file_name( $url ); + + set_transient($cache_option, $rss, $this->MAX_AGE); + + return $cache_option; + } + +/*=======================================================================*\ + Function: get + Purpose: fetch an item from the cache + Input: url from wich the rss file was fetched + Output: cached object on HIT, false on MISS +\*=======================================================================*/ + function get ($url) { + $this->ERROR = ""; + $cache_option = 'rss_' . $this->file_name( $url ); + + if ( ! $rss = get_transient( $cache_option ) ) { + $this->debug( + "Cache doesn't contain: $url (cache option: $cache_option)" + ); + return 0; + } + + return $rss; + } + +/*=======================================================================*\ + Function: check_cache + Purpose: check a url for membership in the cache + and whether the object is older then MAX_AGE (ie. STALE) + Input: url from wich the rss file was fetched + Output: cached object on HIT, false on MISS +\*=======================================================================*/ + function check_cache ( $url ) { + $this->ERROR = ""; + $cache_option = 'rss_' . $this->file_name( $url ); + + if ( get_transient($cache_option) ) { + // object exists and is current + return 'HIT'; + } else { + // object does not exist + return 'MISS'; + } + } + +/*=======================================================================*\ + Function: serialize +\*=======================================================================*/ + function serialize ( $rss ) { + return serialize( $rss ); + } + +/*=======================================================================*\ + Function: unserialize +\*=======================================================================*/ + function unserialize ( $data ) { + return unserialize( $data ); + } + +/*=======================================================================*\ + Function: file_name + Purpose: map url to location in cache + Input: url from wich the rss file was fetched + Output: a file name +\*=======================================================================*/ + function file_name ($url) { + return md5( $url ); + } + +/*=======================================================================*\ + Function: error + Purpose: register error +\*=======================================================================*/ + function error ($errormsg, $lvl=E_USER_WARNING) { + // append PHP's error message if track_errors enabled + if ( isset($php_errormsg) ) { + $errormsg .= " ($php_errormsg)"; + } + $this->ERROR = $errormsg; + if ( MAGPIE_DEBUG ) { + trigger_error( $errormsg, $lvl); + } + else { + error_log( $errormsg, 0); + } + } + function debug ($debugmsg, $lvl=E_USER_NOTICE) { + if ( MAGPIE_DEBUG ) { + $this->error("MagpieRSS [debug] $debugmsg", $lvl); + } + } +} + +if ( !function_exists('parse_w3cdtf') ) : +function parse_w3cdtf ( $date_str ) { + + # regex to match wc3dtf + $pat = "/(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(:(\d{2}))?(?:([-+])(\d{2}):?(\d{2})|(Z))?/"; + + if ( preg_match( $pat, $date_str, $match ) ) { + list( $year, $month, $day, $hours, $minutes, $seconds) = + array( $match[1], $match[2], $match[3], $match[4], $match[5], $match[7]); + + # calc epoch for current date assuming GMT + $epoch = gmmktime( $hours, $minutes, $seconds, $month, $day, $year); + + $offset = 0; + if ( $match[11] == 'Z' ) { + # zulu time, aka GMT + } + else { + list( $tz_mod, $tz_hour, $tz_min ) = + array( $match[8], $match[9], $match[10]); + + # zero out the variables + if ( ! $tz_hour ) { $tz_hour = 0; } + if ( ! $tz_min ) { $tz_min = 0; } + + $offset_secs = (($tz_hour*60)+$tz_min)*60; + + # is timezone ahead of GMT? then subtract offset + # + if ( $tz_mod == '+' ) { + $offset_secs = $offset_secs * -1; + } + + $offset = $offset_secs; + } + $epoch = $epoch + $offset; + return $epoch; + } + else { + return -1; + } +} +endif; + +if ( !function_exists('wp_rss') ) : +/** + * Display all RSS items in a HTML ordered list. + * + * @since 1.5.0 + * @package External + * @subpackage MagpieRSS + * + * @param string $url URL of feed to display. Will not auto sense feed URL. + * @param int $num_items Optional. Number of items to display, default is all. + */ +function wp_rss( $url, $num_items = -1 ) { + if ( $rss = fetch_rss( $url ) ) { + echo '
            '; + + if ( $num_items !== -1 ) { + $rss->items = array_slice( $rss->items, 0, $num_items ); + } + + foreach ( (array) $rss->items as $item ) { + printf( + '
          • %3$s
          • ', + esc_url( $item['link'] ), + esc_attr( strip_tags( $item['description'] ) ), + esc_html( $item['title'] ) + ); + } + + echo '
          '; + } else { + _e( 'An error has occurred, which probably means the feed is down. Try again later.' ); + } +} +endif; + +if ( !function_exists('get_rss') ) : +/** + * Display RSS items in HTML list items. + * + * You have to specify which HTML list you want, either ordered or unordered + * before using the function. You also have to specify how many items you wish + * to display. You can't display all of them like you can with wp_rss() + * function. + * + * @since 1.5.0 + * @package External + * @subpackage MagpieRSS + * + * @param string $url URL of feed to display. Will not auto sense feed URL. + * @param int $num_items Optional. Number of items to display, default is all. + * @return bool False on failure. + */ +function get_rss ($url, $num_items = 5) { // Like get posts, but for RSS + $rss = fetch_rss($url); + if ( $rss ) { + $rss->items = array_slice($rss->items, 0, $num_items); + foreach ( (array) $rss->items as $item ) { + echo "
        • \n"; + echo ""; + echo esc_html($item['title']); + echo "
          \n"; + echo "
        • \n"; + } + } else { + return false; + } +} +endif; + +?> diff --git a/src/wp-includes/script-loader.php b/src/wp-includes/script-loader.php new file mode 100644 index 0000000..1111237 --- /dev/null +++ b/src/wp-includes/script-loader.php @@ -0,0 +1,801 @@ +add_data( 'script-handle', 'group', 1 ); queues the script for the footer + * + * @since 2.6.0 + * + * @param object $scripts WP_Scripts object. + */ +function wp_default_scripts( &$scripts ) { + + if ( !$guessurl = site_url() ) + $guessurl = wp_guess_url(); + + $scripts->base_url = $guessurl; + $scripts->content_url = defined('WP_CONTENT_URL')? WP_CONTENT_URL : ''; + $scripts->default_version = get_bloginfo( 'version' ); + $scripts->default_dirs = array('/wp-admin/js/', '/wp-includes/js/'); + + $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '.dev' : ''; + + // Always ensure that we have the convertEntities function + $scripts->add( 'l10n', "/wp-includes/js/l10n$suffix.js", false, '20101110' ); + $scripts->enqueue( 'l10n' ); + + $scripts->add( 'utils', "/wp-admin/js/utils$suffix.js", false, '20101110' ); + + $scripts->add( 'common', "/wp-admin/js/common$suffix.js", array('jquery', 'hoverIntent', 'utils'), '20110610' ); + $scripts->add_data( 'common', 'group', 1 ); + $scripts->localize( 'common', 'commonL10n', array( + 'warnDelete' => __("You are about to permanently delete the selected items.\n 'Cancel' to stop, 'OK' to delete."), + 'l10n_print_after' => 'try{convertEntities(commonL10n);}catch(e){};' + ) ); + + $scripts->add( 'sack', "/wp-includes/js/tw-sack$suffix.js", false, '1.6.1' ); + $scripts->add_data( 'sack', 'group', 1 ); + + $scripts->add( 'quicktags', "/wp-includes/js/quicktags$suffix.js", false, '20110502' ); + $scripts->add_data( 'quicktags', 'group', 1 ); + $scripts->localize( 'quicktags', 'quicktagsL10n', array( + 'quickLinks' => __('(Quick Links)'), + 'wordLookup' => __('Enter a word to look up:'), + 'dictionaryLookup' => esc_attr(__('Dictionary lookup')), + 'lookup' => esc_attr(__('lookup')), + 'closeAllOpenTags' => esc_attr(__('Close all open tags')), + 'closeTags' => esc_attr(__('close tags')), + 'enterURL' => __('Enter the URL'), + 'enterImageURL' => __('Enter the URL of the image'), + 'enterImageDescription' => __('Enter a description of the image'), + 'fullscreen' => __('fullscreen'), + 'toggleFullscreen' => esc_attr( __('Toggle fullscreen mode') ), + 'l10n_print_after' => 'try{convertEntities(quicktagsL10n);}catch(e){};' + ) ); + + $scripts->add( 'colorpicker', "/wp-includes/js/colorpicker$suffix.js", array('prototype'), '3517m' ); + + $scripts->add( 'editor', "/wp-admin/js/editor$suffix.js", array('utils','jquery'), '20110411' ); + $scripts->add_data( 'editor', 'group', 1 ); + + $scripts->add( 'wp-fullscreen', "/wp-admin/js/wp-fullscreen$suffix.js", array('jquery'), '20110704' ); + $scripts->add_data( 'wp-fullscreen', 'group', 1 ); + + $scripts->add( 'prototype', '/wp-includes/js/prototype.js', false, '1.6.1'); + + $scripts->add( 'wp-ajax-response', "/wp-includes/js/wp-ajax-response$suffix.js", array('jquery'), '20091119' ); + $scripts->add_data( 'wp-ajax-response', 'group', 1 ); + $scripts->localize( 'wp-ajax-response', 'wpAjax', array( + 'noPerm' => __('You do not have permission to do that.'), + 'broken' => __('An unidentified error has occurred.'), + 'l10n_print_after' => 'try{convertEntities(wpAjax);}catch(e){};' + ) ); + + $scripts->add( 'autosave', "/wp-includes/js/autosave$suffix.js", array('schedule', 'wp-ajax-response'), '20110524' ); + $scripts->add_data( 'autosave', 'group', 1 ); + + $scripts->add( 'wp-lists', "/wp-includes/js/wp-lists$suffix.js", array('wp-ajax-response'), '20110521' ); + $scripts->add_data( 'wp-lists', 'group', 1 ); + + $scripts->add( 'scriptaculous-root', '/wp-includes/js/scriptaculous/wp-scriptaculous.js', array('prototype'), '1.8.3'); + $scripts->add( 'scriptaculous-builder', '/wp-includes/js/scriptaculous/builder.js', array('scriptaculous-root'), '1.8.3'); + $scripts->add( 'scriptaculous-dragdrop', '/wp-includes/js/scriptaculous/dragdrop.js', array('scriptaculous-builder', 'scriptaculous-effects'), '1.8.3'); + $scripts->add( 'scriptaculous-effects', '/wp-includes/js/scriptaculous/effects.js', array('scriptaculous-root'), '1.8.3'); + $scripts->add( 'scriptaculous-slider', '/wp-includes/js/scriptaculous/slider.js', array('scriptaculous-effects'), '1.8.3'); + $scripts->add( 'scriptaculous-sound', '/wp-includes/js/scriptaculous/sound.js', array( 'scriptaculous-root' ), '1.8.3' ); + $scripts->add( 'scriptaculous-controls', '/wp-includes/js/scriptaculous/controls.js', array('scriptaculous-root'), '1.8.3'); + $scripts->add( 'scriptaculous', '', array('scriptaculous-dragdrop', 'scriptaculous-slider', 'scriptaculous-controls'), '1.8.3'); + + // not used in core, replaced by Jcrop.js + $scripts->add( 'cropper', '/wp-includes/js/crop/cropper.js', array('scriptaculous-dragdrop'), '20070118'); + + $scripts->add( 'jquery', '/wp-includes/js/jquery/jquery.js', false, '1.6.1'); + + $scripts->add( 'jquery-ui-core', '/wp-includes/js/jquery/ui.core.js', array('jquery'), '1.8.12' ); + $scripts->add_data( 'jquery-ui-core', 'group', 1 ); + + $scripts->add( 'jquery-ui-position', '/wp-includes/js/jquery/ui.position.js', array('jquery-ui-core'), '1.8.12' ); + $scripts->add_data( 'jquery-ui-position', 'group', 1 ); + + $scripts->add( 'jquery-ui-widget', '/wp-includes/js/jquery/ui.widget.js', array('jquery-ui-core'), '1.8.12' ); + $scripts->add_data( 'jquery-ui-widget', 'group', 1 ); + + $scripts->add( 'jquery-ui-mouse', '/wp-includes/js/jquery/ui.mouse.js', array('jquery-ui-widget'), '1.8.12' ); + $scripts->add_data( 'jquery-ui-mouse', 'group', 1 ); + + $scripts->add( 'jquery-ui-button', '/wp-includes/js/jquery/ui.button.js', array('jquery-ui-core', 'jquery-ui-widget'), '1.8.12' ); + $scripts->add_data( 'jquery-ui-button', 'group', 1 ); + + $scripts->add( 'jquery-ui-tabs', '/wp-includes/js/jquery/ui.tabs.js', array('jquery-ui-core', 'jquery-ui-widget'), '1.8.12' ); + $scripts->add_data( 'jquery-ui-tabs', 'group', 1 ); + + $scripts->add( 'jquery-ui-sortable', '/wp-includes/js/jquery/ui.sortable.js', array('jquery-ui-core', 'jquery-ui-mouse'), '1.8.12' ); + $scripts->add_data( 'jquery-ui-sortable', 'group', 1 ); + + $scripts->add( 'jquery-ui-draggable', '/wp-includes/js/jquery/ui.draggable.js', array('jquery-ui-core', 'jquery-ui-mouse'), '1.8.12' ); + $scripts->add_data( 'jquery-ui-draggable', 'group', 1 ); + + $scripts->add( 'jquery-ui-droppable', '/wp-includes/js/jquery/ui.droppable.js', array('jquery-ui-core', 'jquery-ui-mouse', 'jquery-ui-draggable'), '1.8.12' ); + $scripts->add_data( 'jquery-ui-droppable', 'group', 1 ); + + $scripts->add( 'jquery-ui-selectable', '/wp-includes/js/jquery/ui.selectable.js', array('jquery-ui-core', 'jquery-ui-mouse'), '1.8.12' ); + $scripts->add_data( 'jquery-ui-selectable', 'group', 1 ); + + $scripts->add( 'jquery-ui-resizable', '/wp-includes/js/jquery/ui.resizable.js', array('jquery-ui-core', 'jquery-ui-mouse'), '1.8.12' ); + $scripts->add_data( 'jquery-ui-resizable', 'group', 1 ); + + $scripts->add( 'jquery-ui-dialog', '/wp-includes/js/jquery/ui.dialog.js', array('jquery-ui-resizable', 'jquery-ui-draggable', 'jquery-ui-button', 'jquery-ui-position'), '1.8.12' ); + $scripts->add_data( 'jquery-ui-dialog', 'group', 1 ); + + // deprecated, not used in core, most functionality is included in jQuery 1.3 + $scripts->add( 'jquery-form', "/wp-includes/js/jquery/jquery.form$suffix.js", array('jquery'), '2.73'); + $scripts->add_data( 'jquery-form', 'group', 1 ); + + $scripts->add( 'jquery-color', "/wp-includes/js/jquery/jquery.color$suffix.js", array('jquery'), '2.0-4561m'); + $scripts->add_data( 'jquery-color', 'group', 1 ); + + $scripts->add( 'suggest', "/wp-includes/js/jquery/suggest$suffix.js", array('jquery'), '1.1-20110113'); + $scripts->add_data( 'suggest', 'group', 1 ); + + $scripts->add( 'schedule', '/wp-includes/js/jquery/jquery.schedule.js', array('jquery'), '20m'); + $scripts->add_data( 'schedule', 'group', 1 ); + + $scripts->add( 'jquery-query', "/wp-includes/js/jquery/jquery.query.js", array('jquery'), '2.1.7' ); + $scripts->add_data( 'jquery-query', 'group', 1 ); + + $scripts->add( 'jquery-serialize-object', "/wp-includes/js/jquery/jquery.serialize-object.js", array('jquery'), '0.2' ); + $scripts->add_data( 'jquery-serialize-object', 'group', 1 ); + + $scripts->add( 'jquery-hotkeys', "/wp-includes/js/jquery/jquery.hotkeys$suffix.js", array('jquery'), '0.0.2m' ); + $scripts->add_data( 'jquery-hotkeys', 'group', 1 ); + + $scripts->add( 'jquery-table-hotkeys', "/wp-includes/js/jquery/jquery.table-hotkeys$suffix.js", array('jquery', 'jquery-hotkeys'), '20090102' ); + $scripts->add_data( 'jquery-table-hotkeys', 'group', 1 ); + + $scripts->add( 'thickbox', "/wp-includes/js/thickbox/thickbox.js", array('jquery'), '3.1-20110528'); + $scripts->add_data( 'thickbox', 'group', 1 ); + $scripts->localize( 'thickbox', 'thickboxL10n', array( + 'next' => __('Next >'), + 'prev' => __('< Prev'), + 'image' => __('Image'), + 'of' => __('of'), + 'close' => __('Close'), + 'noiframes' => __('This feature requires inline frames. You have iframes disabled or your browser does not support them.'), + 'loadingAnimation' => includes_url('js/thickbox/loadingAnimation.gif'), + 'closeImage' => includes_url('js/thickbox/tb-close.png'), + 'l10n_print_after' => 'try{convertEntities(thickboxL10n);}catch(e){};' + ) ); + + $scripts->add( 'jcrop', "/wp-includes/js/jcrop/jquery.Jcrop$suffix.js", array('jquery'), '0.9.8-20110113'); + + $scripts->add( 'swfobject', "/wp-includes/js/swfobject.js", false, '2.2'); + + $scripts->add( 'swfupload', '/wp-includes/js/swfupload/swfupload.js', false, '2201-20110113'); + $scripts->add( 'swfupload-swfobject', '/wp-includes/js/swfupload/plugins/swfupload.swfobject.js', array('swfupload', 'swfobject'), '2201a'); + $scripts->add( 'swfupload-queue', '/wp-includes/js/swfupload/plugins/swfupload.queue.js', array('swfupload'), '2201'); + $scripts->add( 'swfupload-speed', '/wp-includes/js/swfupload/plugins/swfupload.speed.js', array('swfupload'), '2201'); + + if ( defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ) { + // queue all SWFUpload scripts that are used by default + $scripts->add( 'swfupload-all', false, array('swfupload', 'swfupload-swfobject', 'swfupload-queue'), '2201'); + } else { + $scripts->add( 'swfupload-all', '/wp-includes/js/swfupload/swfupload-all.js', array(), '2201a'); + } + + $scripts->add( 'swfupload-handlers', "/wp-includes/js/swfupload/handlers$suffix.js", array('swfupload-all', 'jquery'), '2201-20110524'); + $max_upload_size = ( (int) ( $max_up = @ini_get('upload_max_filesize') ) < (int) ( $max_post = @ini_get('post_max_size') ) ) ? $max_up : $max_post; + if ( empty($max_upload_size) ) + $max_upload_size = __('not configured'); + // these error messages came from the sample swfupload js, they might need changing. + $scripts->localize( 'swfupload-handlers', 'swfuploadL10n', array( + 'queue_limit_exceeded' => __('You have attempted to queue too many files.'), + 'file_exceeds_size_limit' => __('This file exceeds the maximum upload size for this site.'), + 'zero_byte_file' => __('This file is empty. Please try another.'), + 'invalid_filetype' => __('This file type is not allowed. Please try another.'), + 'default_error' => __('An error occurred in the upload. Please try again later.'), + 'missing_upload_url' => __('There was a configuration error. Please contact the server administrator.'), + 'upload_limit_exceeded' => __('You may only upload 1 file.'), + 'http_error' => __('HTTP error.'), + 'upload_failed' => __('Upload failed.'), + 'io_error' => __('IO error.'), + 'security_error' => __('Security error.'), + 'file_cancelled' => __('File canceled.'), + 'upload_stopped' => __('Upload stopped.'), + 'dismiss' => __('Dismiss'), + 'crunching' => __('Crunching…'), + 'deleted' => __('moved to the trash.'), + 'error_uploading' => __('“%s” has failed to upload due to an error'), + 'l10n_print_after' => 'try{convertEntities(swfuploadL10n);}catch(e){};', + ) ); + + $scripts->add( 'comment-reply', "/wp-includes/js/comment-reply$suffix.js", false, '20090102'); + + $scripts->add( 'json2', "/wp-includes/js/json2$suffix.js", false, '2011-02-23'); + + $scripts->add( 'imgareaselect', "/wp-includes/js/imgareaselect/jquery.imgareaselect$suffix.js", array('jquery'), '0.9.6-20110515' ); + $scripts->add_data( 'imgareaselect', 'group', 1 ); + + $scripts->add( 'password-strength-meter', "/wp-admin/js/password-strength-meter$suffix.js", array('jquery'), '20101027' ); + $scripts->add_data( 'password-strength-meter', 'group', 1 ); + $scripts->localize( 'password-strength-meter', 'pwsL10n', array( + 'empty' => __('Strength indicator'), + 'short' => __('Very weak'), + 'bad' => __('Weak'), + /* translators: password strength */ + 'good' => _x('Medium', 'password strength'), + 'strong' => __('Strong'), + 'mismatch' => __('Mismatch'), + 'l10n_print_after' => 'try{convertEntities(pwsL10n);}catch(e){};' + ) ); + + $scripts->add( 'user-profile', "/wp-admin/js/user-profile$suffix.js", array( 'jquery', 'password-strength-meter' ), '20110628' ); + $scripts->add_data( 'user-profile', 'group', 1 ); + + $scripts->add( 'admin-bar', "/wp-includes/js/admin-bar$suffix.js", false, '20110131' ); + $scripts->add_data( 'admin-bar', 'group', 1 ); + + $scripts->add( 'wplink', "/wp-includes/js/tinymce/plugins/wplink/js/wplink$suffix.js", array( 'jquery', 'wpdialogs' ), '20110528' ); + $scripts->add_data( 'wplink', 'group', 1 ); + $scripts->localize( 'wplink', 'wpLinkL10n', array( + 'title' => __('Insert/edit link'), + 'update' => __('Update'), + 'save' => __('Add Link'), + 'noTitle' => __('(no title)'), + 'noMatchesFound' => __('No matches found.'), + 'l10n_print_after' => 'try{convertEntities(wpLinkL10n);}catch(e){};', + ) ); + + $scripts->add( 'wpdialogs', "/wp-includes/js/tinymce/plugins/wpdialogs/js/wpdialog$suffix.js", array( 'jquery-ui-dialog' ), '20110528' ); + $scripts->add_data( 'wpdialogs', 'group', 1 ); + + $scripts->add( 'wpdialogs-popup', "/wp-includes/js/tinymce/plugins/wpdialogs/js/popup$suffix.js", array( 'wpdialogs' ), '20110421' ); + $scripts->add_data( 'wpdialogs-popup', 'group', 1 ); + + if ( is_admin() ) { + $scripts->add( 'ajaxcat', "/wp-admin/js/cat$suffix.js", array( 'wp-lists' ), '20090102' ); + $scripts->add_data( 'ajaxcat', 'group', 1 ); + $scripts->localize( 'ajaxcat', 'catL10n', array( + 'add' => esc_attr(__('Add')), + 'how' => __('Separate multiple categories with commas.'), + 'l10n_print_after' => 'try{convertEntities(catL10n);}catch(e){};' + ) ); + + $scripts->add( 'admin-categories', "/wp-admin/js/categories$suffix.js", array('wp-lists'), '20091201' ); + $scripts->add_data( 'admin-categories', 'group', 1 ); + + $scripts->add( 'admin-tags', "/wp-admin/js/tags$suffix.js", array('jquery', 'wp-ajax-response'), '20110429' ); + $scripts->add_data( 'admin-tags', 'group', 1 ); + $scripts->localize( 'admin-tags', 'tagsl10n', array( + 'noPerm' => __('You do not have permission to do that.'), + 'broken' => __('An unidentified error has occurred.'), + 'l10n_print_after' => 'try{convertEntities(tagsl10n);}catch(e){};' + )); + + $scripts->add( 'admin-custom-fields', "/wp-admin/js/custom-fields$suffix.js", array('wp-lists'), '20110429' ); + $scripts->add_data( 'admin-custom-fields', 'group', 1 ); + + $scripts->add( 'admin-comments', "/wp-admin/js/edit-comments$suffix.js", array('wp-lists', 'jquery-ui-resizable', 'quicktags', 'jquery-query'), '20110602' ); + $scripts->add_data( 'admin-comments', 'group', 1 ); + $scripts->localize( 'admin-comments', 'adminCommentsL10n', array( + 'hotkeys_highlight_first' => isset($_GET['hotkeys_highlight_first']), + 'hotkeys_highlight_last' => isset($_GET['hotkeys_highlight_last']), + 'replyApprove' => __( 'Approve and Reply' ), + 'reply' => __( 'Reply' ) + ) ); + + $scripts->add( 'xfn', "/wp-admin/js/xfn$suffix.js", array('jquery'), '20110524' ); + $scripts->add_data( 'xfn', 'group', 1 ); + + $scripts->add( 'postbox', "/wp-admin/js/postbox$suffix.js", array('jquery-ui-sortable'), '20110612' ); + $scripts->add_data( 'postbox', 'group', 1 ); + + $scripts->add( 'post', "/wp-admin/js/post$suffix.js", array('suggest', 'wp-lists', 'postbox'), '20110524' ); + $scripts->add_data( 'post', 'group', 1 ); + $scripts->localize( 'post', 'postL10n', array( + 'tagsUsed' => __('Tags used on this post:'), + 'add' => esc_attr(__('Add')), + 'addTag' => esc_attr(__('Add new Tag')), + 'separate' => __('Separate tags with commas'), + 'ok' => __('OK'), + 'cancel' => __('Cancel'), + 'edit' => __('Edit'), + 'publishOn' => __('Publish on:'), + 'publishOnFuture' => __('Schedule for:'), + 'publishOnPast' => __('Published on:'), + 'showcomm' => __('Show more comments'), + 'endcomm' => __('No more comments found.'), + 'publish' => __('Publish'), + 'schedule' => __('Schedule'), + 'update' => __('Update'), + 'savePending' => __('Save as Pending'), + 'saveDraft' => __('Save Draft'), + 'private' => __('Private'), + 'public' => __('Public'), + 'publicSticky' => __('Public, Sticky'), + 'password' => __('Password Protected'), + 'privatelyPublished' => __('Privately Published'), + 'published' => __('Published'), + 'l10n_print_after' => 'try{convertEntities(postL10n);}catch(e){};' + ) ); + + $scripts->add( 'link', "/wp-admin/js/link$suffix.js", array('wp-lists', 'postbox'), '20110524' ); + $scripts->add_data( 'link', 'group', 1 ); + + $scripts->add( 'comment', "/wp-admin/js/comment$suffix.js", array('jquery'), '20110429' ); + $scripts->add_data( 'comment', 'group', 1 ); + $scripts->localize( 'comment', 'commentL10n', array( + 'cancel' => __('Cancel'), + 'edit' => __('Edit'), + 'submittedOn' => __('Submitted on:'), + 'l10n_print_after' => 'try{convertEntities(commentL10n);}catch(e){};' + ) ); + + $scripts->add( 'admin-gallery', "/wp-admin/js/gallery$suffix.js", array( 'jquery-ui-sortable' ), '20110414' ); + + $scripts->add( 'media-upload', "/wp-admin/js/media-upload$suffix.js", array( 'thickbox' ), '20110425' ); + $scripts->add_data( 'media-upload', 'group', 1 ); + + $scripts->add( 'admin-widgets', "/wp-admin/js/widgets$suffix.js", array( 'jquery-ui-sortable', 'jquery-ui-draggable', 'jquery-ui-droppable' ), '20110601' ); + $scripts->add_data( 'admin-widgets', 'group', 1 ); + + $scripts->add( 'word-count', "/wp-admin/js/word-count$suffix.js", array( 'jquery' ), '20110515' ); + $scripts->add_data( 'word-count', 'group', 1 ); + + $scripts->add( 'theme', "/wp-admin/js/theme$suffix.js", array( 'thickbox' ), '20110118' ); + $scripts->add_data( 'theme', 'group', 1 ); + + $scripts->add( 'theme-preview', "/wp-admin/js/theme-preview$suffix.js", array( 'thickbox', 'jquery' ), '20100407' ); + $scripts->add_data( 'theme-preview', 'group', 1 ); + + $scripts->add( 'inline-edit-post', "/wp-admin/js/inline-edit-post$suffix.js", array( 'jquery', 'suggest' ), '20110609' ); + $scripts->add_data( 'inline-edit-post', 'group', 1 ); + $scripts->localize( 'inline-edit-post', 'inlineEditL10n', array( + 'error' => __('Error while saving the changes.'), + 'ntdeltitle' => __('Remove From Bulk Edit'), + 'notitle' => __('(no title)'), + 'l10n_print_after' => 'try{convertEntities(inlineEditL10n);}catch(e){};' + ) ); + + $scripts->add( 'inline-edit-tax', "/wp-admin/js/inline-edit-tax$suffix.js", array( 'jquery' ), '20110609' ); + $scripts->add_data( 'inline-edit-tax', 'group', 1 ); + $scripts->localize( 'inline-edit-tax', 'inlineEditL10n', array( + 'error' => __('Error while saving the changes.'), + 'l10n_print_after' => 'try{convertEntities(inlineEditL10n);}catch(e){};' + ) ); + + $scripts->add( 'plugin-install', "/wp-admin/js/plugin-install$suffix.js", array( 'jquery', 'thickbox' ), '20110113' ); + $scripts->add_data( 'plugin-install', 'group', 1 ); + $scripts->localize( 'plugin-install', 'plugininstallL10n', array( + 'plugin_information' => __('Plugin Information:'), + 'ays' => __('Are you sure you want to install this plugin?'), + 'l10n_print_after' => 'try{convertEntities(plugininstallL10n);}catch(e){};' + ) ); + + $scripts->add( 'farbtastic', '/wp-admin/js/farbtastic.js', array('jquery'), '1.2' ); + + $scripts->add( 'dashboard', "/wp-admin/js/dashboard$suffix.js", array( 'jquery', 'admin-comments', 'postbox' ), '20110524' ); + $scripts->add_data( 'dashboard', 'group', 1 ); + + $scripts->add( 'hoverIntent', "/wp-includes/js/hoverIntent$suffix.js", array('jquery'), '20090102' ); + $scripts->add_data( 'hoverIntent', 'group', 1 ); + + $scripts->add( 'list-revisions', "/wp-includes/js/wp-list-revisions$suffix.js", null, '20091223' ); + + $scripts->add( 'media', "/wp-admin/js/media$suffix.js", array( 'jquery-ui-draggable' ), '20101022' ); + $scripts->add_data( 'media', 'group', 1 ); + + $scripts->add( 'image-edit', "/wp-admin/js/image-edit$suffix.js", array('jquery', 'json2', 'imgareaselect'), '20110524' ); + $scripts->add_data( 'image-edit', 'group', 1 ); + + $scripts->add( 'set-post-thumbnail', "/wp-admin/js/set-post-thumbnail$suffix.js", array( 'jquery' ), '20100518' ); + $scripts->add_data( 'set-post-thumbnail', 'group', 1 ); + $scripts->localize( 'set-post-thumbnail', 'setPostThumbnailL10n', array( + 'setThumbnail' => __( 'Use as featured image' ), + 'saving' => __( 'Saving...' ), + 'error' => __( 'Could not set that as the thumbnail image. Try a different attachment.' ), + 'done' => __( 'Done' ), + 'l10n_print_after' => 'try{convertEntities(setPostThumbnailL10n);}catch(e){};' + ) ); + + // Navigation Menus + $scripts->add( 'nav-menu', "/wp-admin/js/nav-menu$suffix.js", array('jquery-ui-sortable'), '20110524' ); + $scripts->localize( 'nav-menu', 'navMenuL10n', array( + 'noResultsFound' => _x('No results found.', 'search results'), + 'warnDeleteMenu' => __( "You are about to permanently delete this menu. \n 'Cancel' to stop, 'OK' to delete." ), + 'saveAlert' => __('The changes you made will be lost if you navigate away from this page.'), + 'l10n_print_after' => 'try{convertEntities(navMenuL10n);}catch(e){};' + ) ); + + $scripts->add( 'custom-background', "/wp-admin/js/custom-background$suffix.js", array('farbtastic'), '20110511' ); + $scripts->add_data( 'custom-background', 'group', 1 ); + } +} + +/** + * Assign default styles to $styles object. + * + * Nothing is returned, because the $styles parameter is passed by reference. + * Meaning that whatever object is passed will be updated without having to + * reassign the variable that was passed back to the same value. This saves + * memory. + * + * Adding default styles is not the only task, it also assigns the base_url + * property, the default version, and text direction for the object. + * + * @since 2.6.0 + * + * @param object $styles + */ +function wp_default_styles( &$styles ) { + // This checks to see if site_url() returns something and if it does not + // then it assigns $guess_url to wp_guess_url(). Strange format, but it works. + if ( ! $guessurl = site_url() ) + $guessurl = wp_guess_url(); + + $styles->base_url = $guessurl; + $styles->content_url = defined('WP_CONTENT_URL')? WP_CONTENT_URL : ''; + $styles->default_version = get_bloginfo( 'version' ); + $styles->text_direction = function_exists( 'is_rtl' ) && is_rtl() ? 'rtl' : 'ltr'; + $styles->default_dirs = array('/wp-admin/'); + + $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '.dev' : ''; + + $rtl_styles = array( 'wp-admin', 'global', 'colors', 'colors-fresh', 'colors-classic', 'dashboard', 'ie', 'install', 'login', 'media', 'theme-editor', 'upload', 'widgets', 'press-this', 'plugin-install', 'nav-menu', 'farbtastic', 'admin-bar', 'wplink', 'theme-install' ); + // Any rtl stylesheets that don't have a .dev version for ltr + $no_suffix = array( 'farbtastic' ); + + $styles->add( 'wp-admin', "/wp-admin/css/wp-admin$suffix.css", array(), '20110711' ); + + $styles->add( 'ie', "/wp-admin/css/ie$suffix.css", array(), '20110711' ); + $styles->add_data( 'ie', 'conditional', 'lte IE 7' ); + + // all colors stylesheets need to have the same query strings (cache manifest compat) + $colors_version = '20110703'; + + // Register "meta" stylesheet for admin colors. All colors-* style sheets should have the same version string. + $styles->add( 'colors', true, array(), $colors_version ); + + // do not refer to these directly, the right one is queued by the above "meta" colors handle + $styles->add( 'colors-fresh', "/wp-admin/css/colors-fresh$suffix.css", array(), $colors_version ); + $styles->add( 'colors-classic', "/wp-admin/css/colors-classic$suffix.css", array(), $colors_version ); + + $styles->add( 'ms', "/wp-admin/css/ms$suffix.css", array(), '20110623' ); + $styles->add( 'global', "/wp-admin/css/global$suffix.css", array(), '20110711b' ); + $styles->add( 'media', "/wp-admin/css/media$suffix.css", array(), '20110707' ); + $styles->add( 'widgets', "/wp-admin/css/widgets$suffix.css", array(), '20110606' ); + $styles->add( 'dashboard', "/wp-admin/css/dashboard$suffix.css", array(), '20110711' ); + $styles->add( 'install', "/wp-admin/css/install$suffix.css", array(), '20110707' ); // Readme as well + $styles->add( 'theme-editor', "/wp-admin/css/theme-editor$suffix.css", array(), '20110602' ); + $styles->add( 'press-this', "/wp-admin/css/press-this$suffix.css", array(), '20110707' ); + $styles->add( 'thickbox', '/wp-includes/js/thickbox/thickbox.css', array(), '20090514' ); + $styles->add( 'login', "/wp-admin/css/login$suffix.css", array(), '20110610' ); + $styles->add( 'plugin-install', "/wp-admin/css/plugin-install$suffix.css", array(), '20110628' ); + $styles->add( 'theme-install', "/wp-admin/css/theme-install$suffix.css", array(), '20110506' ); + $styles->add( 'farbtastic', '/wp-admin/css/farbtastic.css', array(), '1.3u' ); + $styles->add( 'jcrop', '/wp-includes/js/jcrop/jquery.Jcrop.css', array(), '0.9.8' ); + $styles->add( 'imgareaselect', '/wp-includes/js/imgareaselect/imgareaselect.css', array(), '0.9.1' ); + $styles->add( 'nav-menu', "/wp-admin/css/nav-menu$suffix.css", array(), '20110611' ); + $styles->add( 'admin-bar', "/wp-includes/css/admin-bar$suffix.css", array(), '20110622' ); + $styles->add( 'wp-jquery-ui-dialog', "/wp-includes/css/jquery-ui-dialog$suffix.css", array(), '20101224' ); + $styles->add( 'wplink', "/wp-includes/js/tinymce/plugins/wplink/css/wplink$suffix.css", array(), '20101224' ); + + foreach ( $rtl_styles as $rtl_style ) { + $styles->add_data( $rtl_style, 'rtl', true ); + if ( $suffix && ! in_array( $rtl_style, $no_suffix ) ) + $styles->add_data( $rtl_style, 'suffix', $suffix ); + } +} + +/** + * Reorder JavaScript scripts array to place prototype before jQuery. + * + * @since 2.3.1 + * + * @param array $js_array JavaScript scripst array + * @return array Reordered array, if needed. + */ +function wp_prototype_before_jquery( $js_array ) { + if ( false === $jquery = array_search( 'jquery', $js_array, true ) ) + return $js_array; + + if ( false === $prototype = array_search( 'prototype', $js_array, true ) ) + return $js_array; + + if ( $prototype < $jquery ) + return $js_array; + + unset($js_array[$prototype]); + + array_splice( $js_array, $jquery, 0, 'prototype' ); + + return $js_array; +} + +/** + * Load localized data on print rather than initialization. + * + * These localizations require information that may not be loaded even by init. + * + * @since 2.5.0 + */ +function wp_just_in_time_script_localization() { + + wp_localize_script( 'autosave', 'autosaveL10n', array( + 'autosaveInterval' => AUTOSAVE_INTERVAL, + 'savingText' => __('Saving Draft…'), + 'saveAlert' => __('The changes you made will be lost if you navigate away from this page.'), + 'l10n_print_after' => 'try{convertEntities(autosaveL10n);}catch(e){};' + ) ); + +} + +/** + * Administration Screen CSS for changing the styles. + * + * If installing the 'wp-admin/' directory will be replaced with './'. + * + * The $_wp_admin_css_colors global manages the Administration Screens CSS + * stylesheet that is loaded. The option that is set is 'admin_color' and is the + * color and key for the array. The value for the color key is an object with + * a 'url' parameter that has the URL path to the CSS file. + * + * The query from $src parameter will be appended to the URL that is given from + * the $_wp_admin_css_colors array value URL. + * + * @since 2.6.0 + * @uses $_wp_admin_css_colors + * + * @param string $src Source URL. + * @param string $handle Either 'colors' or 'colors-rtl'. + * @return string URL path to CSS stylesheet for Administration Screens. + */ +function wp_style_loader_src( $src, $handle ) { + if ( defined('WP_INSTALLING') ) + return preg_replace( '#^wp-admin/#', './', $src ); + + if ( 'colors' == $handle || 'colors-rtl' == $handle ) { + global $_wp_admin_css_colors; + $color = get_user_option('admin_color'); + + if ( empty($color) || !isset($_wp_admin_css_colors[$color]) ) + $color = 'fresh'; + + $color = $_wp_admin_css_colors[$color]; + $parsed = parse_url( $src ); + $url = $color->url; + + if ( defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ) + $url = preg_replace('/.css$|.css(?=\?)/', '.dev.css', $url); + + if ( isset($parsed['query']) && $parsed['query'] ) { + wp_parse_str( $parsed['query'], $qv ); + $url = add_query_arg( $qv, $url ); + } + + return $url; + } + + return $src; +} + +/** + * Prints the script queue in the HTML head on admin pages. + * + * Postpones the scripts that were queued for the footer. + * print_footer_scripts() is called in the footer to print these scripts. + * + * @since 2.8 + * @see wp_print_scripts() + */ +function print_head_scripts() { + global $wp_scripts, $concatenate_scripts; + + if ( ! did_action('wp_print_scripts') ) + do_action('wp_print_scripts'); + + if ( !is_a($wp_scripts, 'WP_Scripts') ) + $wp_scripts = new WP_Scripts(); + + script_concat_settings(); + $wp_scripts->do_items( 'l10n' ); + $wp_scripts->do_concat = $concatenate_scripts; + $wp_scripts->do_head_items(); + + if ( apply_filters('print_head_scripts', true) ) + _print_scripts(); + + $wp_scripts->reset(); + return $wp_scripts->done; +} + +/** + * Prints the scripts that were queued for the footer on admin pages. + * + * @since 2.8 + */ +function print_footer_scripts() { + global $wp_scripts, $concatenate_scripts; + + if ( ! did_action('wp_print_footer_scripts') ) + do_action('wp_print_footer_scripts'); + + if ( !is_a($wp_scripts, 'WP_Scripts') ) + return array(); // No need to run if not instantiated. + + script_concat_settings(); + $wp_scripts->do_concat = $concatenate_scripts; + $wp_scripts->do_footer_items(); + + if ( apply_filters('print_footer_scripts', true) ) + _print_scripts(); + + $wp_scripts->reset(); + return $wp_scripts->done; +} + +function _print_scripts() { + global $wp_scripts, $compress_scripts; + + $zip = $compress_scripts ? 1 : 0; + if ( $zip && defined('ENFORCE_GZIP') && ENFORCE_GZIP ) + $zip = 'gzip'; + + if ( !empty($wp_scripts->concat) ) { + + if ( !empty($wp_scripts->print_code) ) { + echo "\n"; + } + + $ver = md5("$wp_scripts->concat_version"); + $src = $wp_scripts->base_url . "/wp-admin/load-scripts.php?c={$zip}&load=" . trim($wp_scripts->concat, ', ') . "&ver=$ver"; + echo "\n"; + } + + if ( !empty($wp_scripts->print_html) ) + echo $wp_scripts->print_html; +} + +/** + * Prints the script queue in the HTML head on the front end. + * + * Postpones the scripts that were queued for the footer. + * wp_print_footer_scripts() is called in the footer to print these scripts. + * + * @since 2.8 + */ +function wp_print_head_scripts() { + if ( ! did_action('wp_print_scripts') ) + do_action('wp_print_scripts'); + + global $wp_scripts; + + if ( !is_a($wp_scripts, 'WP_Scripts') ) + return array(); // no need to run if nothing is queued + + return print_head_scripts(); +} + +/** + * Prints the scripts that were queued for the footer on the front end. + * + * @since 2.8 + */ +function wp_print_footer_scripts() { + return print_footer_scripts(); +} + +/** + * Wrapper for do_action('wp_enqueue_scripts') + * + * Allows plugins to queue scripts for the front end using wp_enqueue_script(). + * Runs first in wp_head() where all is_home(), is_page(), etc. functions are available. + * + * @since 2.8 + */ +function wp_enqueue_scripts() { + do_action('wp_enqueue_scripts'); +} + +function print_admin_styles() { + global $wp_styles, $concatenate_scripts, $compress_css; + + if ( !is_a($wp_styles, 'WP_Styles') ) + $wp_styles = new WP_Styles(); + + script_concat_settings(); + $wp_styles->do_concat = $concatenate_scripts; + $zip = $compress_css ? 1 : 0; + if ( $zip && defined('ENFORCE_GZIP') && ENFORCE_GZIP ) + $zip = 'gzip'; + + $wp_styles->do_items(false); + + if ( apply_filters('print_admin_styles', true) ) { + if ( !empty($wp_styles->concat) ) { + $dir = $wp_styles->text_direction; + $ver = md5("$wp_styles->concat_version{$dir}"); + $href = $wp_styles->base_url . "/wp-admin/load-styles.php?c={$zip}&dir={$dir}&load=" . trim($wp_styles->concat, ', ') . "&ver=$ver"; + echo "\n"; + } + + if ( !empty($wp_styles->print_html) ) + echo $wp_styles->print_html; + } + + $wp_styles->do_concat = false; + $wp_styles->concat = $wp_styles->concat_version = $wp_styles->print_html = ''; + return $wp_styles->done; +} + +function script_concat_settings() { + global $concatenate_scripts, $compress_scripts, $compress_css; + + $compressed_output = ( ini_get('zlib.output_compression') || 'ob_gzhandler' == ini_get('output_handler') ); + + if ( ! isset($concatenate_scripts) ) { + $concatenate_scripts = defined('CONCATENATE_SCRIPTS') ? CONCATENATE_SCRIPTS : true; + if ( ! is_admin() || ( defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ) ) + $concatenate_scripts = false; + } + + if ( ! isset($compress_scripts) ) { + $compress_scripts = defined('COMPRESS_SCRIPTS') ? COMPRESS_SCRIPTS : true; + if ( $compress_scripts && ( ! get_site_option('can_compress_scripts') || $compressed_output ) ) + $compress_scripts = false; + } + + if ( ! isset($compress_css) ) { + $compress_css = defined('COMPRESS_CSS') ? COMPRESS_CSS : true; + if ( $compress_css && ( ! get_site_option('can_compress_scripts') || $compressed_output ) ) + $compress_css = false; + } +} + +add_action( 'wp_default_scripts', 'wp_default_scripts' ); +add_filter( 'wp_print_scripts', 'wp_just_in_time_script_localization' ); +add_filter( 'print_scripts_array', 'wp_prototype_before_jquery' ); + +add_action( 'wp_default_styles', 'wp_default_styles' ); +add_filter( 'style_loader_src', 'wp_style_loader_src', 10, 2 ); diff --git a/src/wp-includes/shortcodes.php b/src/wp-includes/shortcodes.php new file mode 100644 index 0000000..f2048bd --- /dev/null +++ b/src/wp-includes/shortcodes.php @@ -0,0 +1,298 @@ + + * $out = do_shortcode($content); + * + * + * @link http://codex.wordpress.org/Shortcode_API + * + * @package WordPress + * @subpackage Shortcodes + * @since 2.5 + */ + +/** + * Container for storing shortcode tags and their hook to call for the shortcode + * + * @since 2.5 + * @name $shortcode_tags + * @var array + * @global array $shortcode_tags + */ +$shortcode_tags = array(); + +/** + * Add hook for shortcode tag. + * + * There can only be one hook for each shortcode. Which means that if another + * plugin has a similar shortcode, it will override yours or yours will override + * theirs depending on which order the plugins are included and/or ran. + * + * Simplest example of a shortcode tag using the API: + * + * + * // [footag foo="bar"] + * function footag_func($atts) { + * return "foo = {$atts[foo]}"; + * } + * add_shortcode('footag', 'footag_func'); + * + * + * Example with nice attribute defaults: + * + * + * // [bartag foo="bar"] + * function bartag_func($atts) { + * extract(shortcode_atts(array( + * 'foo' => 'no foo', + * 'baz' => 'default baz', + * ), $atts)); + * + * return "foo = {$foo}"; + * } + * add_shortcode('bartag', 'bartag_func'); + * + * + * Example with enclosed content: + * + * + * // [baztag]content[/baztag] + * function baztag_func($atts, $content='') { + * return "content = $content"; + * } + * add_shortcode('baztag', 'baztag_func'); + * + * + * @since 2.5 + * @uses $shortcode_tags + * + * @param string $tag Shortcode tag to be searched in post content. + * @param callable $func Hook to run when shortcode is found. + */ +function add_shortcode($tag, $func) { + global $shortcode_tags; + + if ( is_callable($func) ) + $shortcode_tags[$tag] = $func; +} + +/** + * Removes hook for shortcode. + * + * @since 2.5 + * @uses $shortcode_tags + * + * @param string $tag shortcode tag to remove hook for. + */ +function remove_shortcode($tag) { + global $shortcode_tags; + + unset($shortcode_tags[$tag]); +} + +/** + * Clear all shortcodes. + * + * This function is simple, it clears all of the shortcode tags by replacing the + * shortcodes global by a empty array. This is actually a very efficient method + * for removing all shortcodes. + * + * @since 2.5 + * @uses $shortcode_tags + */ +function remove_all_shortcodes() { + global $shortcode_tags; + + $shortcode_tags = array(); +} + +/** + * Search content for shortcodes and filter shortcodes through their hooks. + * + * If there are no shortcode tags defined, then the content will be returned + * without any filtering. This might cause issues when plugins are disabled but + * the shortcode will still show up in the post or content. + * + * @since 2.5 + * @uses $shortcode_tags + * @uses get_shortcode_regex() Gets the search pattern for searching shortcodes. + * + * @param string $content Content to search for shortcodes + * @return string Content with shortcodes filtered out. + */ +function do_shortcode($content) { + global $shortcode_tags; + + if (empty($shortcode_tags) || !is_array($shortcode_tags)) + return $content; + + $pattern = get_shortcode_regex(); + return preg_replace_callback('/'.$pattern.'/s', 'do_shortcode_tag', $content); +} + +/** + * Retrieve the shortcode regular expression for searching. + * + * The regular expression combines the shortcode tags in the regular expression + * in a regex class. + * + * The regular expresion contains 6 different sub matches to help with parsing. + * + * 1/6 - An extra [ or ] to allow for escaping shortcodes with double [[]] + * 2 - The shortcode name + * 3 - The shortcode argument list + * 4 - The self closing / + * 5 - The content of a shortcode when it wraps some content. + * + * @since 2.5 + * @uses $shortcode_tags + * + * @return string The shortcode search regular expression + */ +function get_shortcode_regex() { + global $shortcode_tags; + $tagnames = array_keys($shortcode_tags); + $tagregexp = join( '|', array_map('preg_quote', $tagnames) ); + + // WARNING! Do not change this regex without changing do_shortcode_tag() and strip_shortcodes() + return '(.?)\[('.$tagregexp.')\b(.*?)(?:(\/))?\](?:(.+?)\[\/\2\])?(.?)'; +} + +/** + * Regular Expression callable for do_shortcode() for calling shortcode hook. + * @see get_shortcode_regex for details of the match array contents. + * + * @since 2.5 + * @access private + * @uses $shortcode_tags + * + * @param array $m Regular expression match array + * @return mixed False on failure. + */ +function do_shortcode_tag( $m ) { + global $shortcode_tags; + + // allow [[foo]] syntax for escaping a tag + if ( $m[1] == '[' && $m[6] == ']' ) { + return substr($m[0], 1, -1); + } + + $tag = $m[2]; + $attr = shortcode_parse_atts( $m[3] ); + + if ( isset( $m[5] ) ) { + // enclosing tag - extra parameter + return $m[1] . call_user_func( $shortcode_tags[$tag], $attr, $m[5], $tag ) . $m[6]; + } else { + // self-closing tag + return $m[1] . call_user_func( $shortcode_tags[$tag], $attr, NULL, $tag ) . $m[6]; + } +} + +/** + * Retrieve all attributes from the shortcodes tag. + * + * The attributes list has the attribute name as the key and the value of the + * attribute as the value in the key/value pair. This allows for easier + * retrieval of the attributes, since all attributes have to be known. + * + * @since 2.5 + * + * @param string $text + * @return array List of attributes and their value. + */ +function shortcode_parse_atts($text) { + $atts = array(); + $pattern = '/(\w+)\s*=\s*"([^"]*)"(?:\s|$)|(\w+)\s*=\s*\'([^\']*)\'(?:\s|$)|(\w+)\s*=\s*([^\s\'"]+)(?:\s|$)|"([^"]*)"(?:\s|$)|(\S+)(?:\s|$)/'; + $text = preg_replace("/[\x{00a0}\x{200b}]+/u", " ", $text); + if ( preg_match_all($pattern, $text, $match, PREG_SET_ORDER) ) { + foreach ($match as $m) { + if (!empty($m[1])) + $atts[strtolower($m[1])] = stripcslashes($m[2]); + elseif (!empty($m[3])) + $atts[strtolower($m[3])] = stripcslashes($m[4]); + elseif (!empty($m[5])) + $atts[strtolower($m[5])] = stripcslashes($m[6]); + elseif (isset($m[7]) and strlen($m[7])) + $atts[] = stripcslashes($m[7]); + elseif (isset($m[8])) + $atts[] = stripcslashes($m[8]); + } + } else { + $atts = ltrim($text); + } + return $atts; +} + +/** + * Combine user attributes with known attributes and fill in defaults when needed. + * + * The pairs should be considered to be all of the attributes which are + * supported by the caller and given as a list. The returned attributes will + * only contain the attributes in the $pairs list. + * + * If the $atts list has unsupported attributes, then they will be ignored and + * removed from the final returned list. + * + * @since 2.5 + * + * @param array $pairs Entire list of supported attributes and their defaults. + * @param array $atts User defined attributes in shortcode tag. + * @return array Combined and filtered attribute list. + */ +function shortcode_atts($pairs, $atts) { + $atts = (array)$atts; + $out = array(); + foreach($pairs as $name => $default) { + if ( array_key_exists($name, $atts) ) + $out[$name] = $atts[$name]; + else + $out[$name] = $default; + } + return $out; +} + +/** + * Remove all shortcode tags from the given content. + * + * @since 2.5 + * @uses $shortcode_tags + * + * @param string $content Content to remove shortcode tags. + * @return string Content without shortcode tags. + */ +function strip_shortcodes( $content ) { + global $shortcode_tags; + + if (empty($shortcode_tags) || !is_array($shortcode_tags)) + return $content; + + $pattern = get_shortcode_regex(); + + return preg_replace('/'.$pattern.'/s', '$1$6', $content); +} + +add_filter('the_content', 'do_shortcode', 11); // AFTER wpautop() + +?> \ No newline at end of file diff --git a/src/wp-includes/taxonomy.php b/src/wp-includes/taxonomy.php new file mode 100644 index 0000000..dee7af8 --- /dev/null +++ b/src/wp-includes/taxonomy.php @@ -0,0 +1,3190 @@ + true, + 'update_count_callback' => '_update_post_term_count', + 'query_var' => 'category_name', + 'rewrite' => did_action( 'init' ) ? array( + 'hierarchical' => true, + 'slug' => get_option('category_base') ? get_option('category_base') : 'category', + 'with_front' => ( get_option('category_base') && ! $wp_rewrite->using_index_permalinks() ) ? false : true ) : false, + 'public' => true, + 'show_ui' => true, + '_builtin' => true, + ) ); + + register_taxonomy( 'post_tag', 'post', array( + 'hierarchical' => false, + 'update_count_callback' => '_update_post_term_count', + 'query_var' => 'tag', + 'rewrite' => did_action( 'init' ) ? array( + 'slug' => get_option('tag_base') ? get_option('tag_base') : 'tag', + 'with_front' => ( get_option('tag_base') && ! $wp_rewrite->using_index_permalinks() ) ? false : true ) : false, + 'public' => true, + 'show_ui' => true, + '_builtin' => true, + ) ); + + register_taxonomy( 'nav_menu', 'nav_menu_item', array( + 'public' => false, + 'hierarchical' => false, + 'labels' => array( + 'name' => __( 'Navigation Menus' ), + 'singular_name' => __( 'Navigation Menu' ), + ), + 'query_var' => false, + 'rewrite' => false, + 'show_ui' => false, + '_builtin' => true, + 'show_in_nav_menus' => false, + ) ); + + register_taxonomy( 'link_category', 'link', array( + 'hierarchical' => false, + 'labels' => array( + 'name' => __( 'Link Categories' ), + 'singular_name' => __( 'Link Category' ), + 'search_items' => __( 'Search Link Categories' ), + 'popular_items' => null, + 'all_items' => __( 'All Link Categories' ), + 'edit_item' => __( 'Edit Link Category' ), + 'update_item' => __( 'Update Link Category' ), + 'add_new_item' => __( 'Add New Link Category' ), + 'new_item_name' => __( 'New Link Category Name' ), + 'separate_items_with_commas' => null, + 'add_or_remove_items' => null, + 'choose_from_most_used' => null, + ), + 'query_var' => false, + 'rewrite' => false, + 'public' => false, + 'show_ui' => false, + '_builtin' => true, + ) ); + + $rewrite = false; + if ( did_action( 'init' ) ) { + $rewrite = apply_filters( 'post_format_rewrite_base', 'type' ); + $rewrite = $rewrite ? array( 'slug' => $rewrite ) : false; + } + + register_taxonomy( 'post_format', 'post', array( + 'public' => true, + 'hierarchical' => false, + 'labels' => array( + 'name' => _x( 'Format', 'post format' ), + 'singular_name' => _x( 'Format', 'post format' ), + ), + 'query_var' => true, + 'rewrite' => $rewrite, + 'show_ui' => false, + '_builtin' => true, + 'show_in_nav_menus' => false, + ) ); +} +add_action( 'init', 'create_initial_taxonomies', 0 ); // highest priority + +/** + * Get a list of registered taxonomy objects. + * + * @package WordPress + * @subpackage Taxonomy + * @since 3.0.0 + * @uses $wp_taxonomies + * @see register_taxonomy + * + * @param array $args An array of key => value arguments to match against the taxonomy objects. + * @param string $output The type of output to return, either taxonomy 'names' or 'objects'. 'names' is the default. + * @param string $operator The logical operation to perform. 'or' means only one element + * from the array needs to match; 'and' means all elements must match. The default is 'and'. + * @return array A list of taxonomy names or objects + */ +function get_taxonomies( $args = array(), $output = 'names', $operator = 'and' ) { + global $wp_taxonomies; + + $field = ('names' == $output) ? 'name' : false; + + return wp_filter_object_list($wp_taxonomies, $args, $operator, $field); +} + + +/** + * 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.0 + * + * @uses $wp_taxonomies + * + * @param array|string|object $object Name of the type of taxonomy object, or an object (row from posts) + * @param string $output The type of output to return, either taxonomy 'names' or 'objects'. 'names' is the default. + * @return array The names of all taxonomy of $object_type. + */ +function get_object_taxonomies($object, $output = 'names') { + 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 ( (array) $wp_taxonomies as $tax_name => $tax_obj ) { + if ( array_intersect($object, (array) $tax_obj->object_type) ) { + if ( 'names' == $output ) + $taxonomies[] = $tax_name; + else + $taxonomies[ $tax_name ] = $tax_obj; + } + } + + 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.0 + * + * @uses $wp_taxonomies + * @uses taxonomy_exists() 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 ( ! taxonomy_exists( $taxonomy ) ) + return false; + + return $wp_taxonomies[$taxonomy]; +} + +/** + * Checks that the taxonomy name exists. + * + * Formerly is_taxonomy(), introduced in 2.3.0. + * + * @package WordPress + * @subpackage Taxonomy + * @since 3.0.0 + * + * @uses $wp_taxonomies + * + * @param string $taxonomy Name of taxonomy object + * @return bool Whether the taxonomy exists. + */ +function taxonomy_exists( $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.0 + * + * @uses taxonomy_exists() 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 ( ! taxonomy_exists($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 taxonomy_exists() to check + * whether taxonomy exists. + * + * Optional $args contents: + * + * label - Name of the taxonomy shown in the menu. Usually plural. If not set, labels['name'] will be used. + * + * hierarchical - 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. + * + * public - If the taxonomy should be publically queryable; //@TODO not implemented. + * defaults to true. + * + * show_ui - If the WordPress UI admin tags UI should apply to this taxonomy; + * defaults to public. + * + * show_in_nav_menus - true makes this taxonomy available for selection in navigation menus. + * Defaults to public. + * + * show_tagcloud - false to prevent the taxonomy being listed in the Tag Cloud Widget; + * defaults to show_ui which defalts to public. + * + * labels - An array of labels for this taxonomy. You can see accepted values in {@link get_taxonomy_labels()}. By default tag labels are used for non-hierarchical types and category labels for hierarchical ones. + * + * @package WordPress + * @subpackage Taxonomy + * @since 2.3.0 + * @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; + + if ( ! is_array($wp_taxonomies) ) + $wp_taxonomies = array(); + + $defaults = array( 'hierarchical' => false, + 'update_count_callback' => '', + 'rewrite' => true, + 'query_var' => $taxonomy, + 'public' => true, + 'show_ui' => null, + 'show_tagcloud' => null, + '_builtin' => false, + 'labels' => array(), + 'capabilities' => array(), + 'show_in_nav_menus' => null, + ); + $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'] && '' != get_option('permalink_structure') ) { + $args['rewrite'] = wp_parse_args($args['rewrite'], array( + 'slug' => sanitize_title_with_dashes($taxonomy), + 'with_front' => true, + 'hierarchical' => false + )); + + if ( $args['hierarchical'] && $args['rewrite']['hierarchical'] ) + $tag = '(.+?)'; + else + $tag = '([^/]+)'; + + $wp_rewrite->add_rewrite_tag("%$taxonomy%", $tag, $args['query_var'] ? "{$args['query_var']}=" : "taxonomy=$taxonomy&term="); + $wp_rewrite->add_permastruct($taxonomy, "{$args['rewrite']['slug']}/%$taxonomy%", $args['rewrite']['with_front']); + } + + if ( is_null($args['show_ui']) ) + $args['show_ui'] = $args['public']; + + // Whether to show this type in nav-menus.php. Defaults to the setting for public. + if ( null === $args['show_in_nav_menus'] ) + $args['show_in_nav_menus'] = $args['public']; + + if ( is_null($args['show_tagcloud']) ) + $args['show_tagcloud'] = $args['show_ui']; + + $default_caps = array( + 'manage_terms' => 'manage_categories', + 'edit_terms' => 'manage_categories', + 'delete_terms' => 'manage_categories', + 'assign_terms' => 'edit_posts', + ); + $args['cap'] = (object) array_merge( $default_caps, $args['capabilities'] ); + unset( $args['capabilities'] ); + + $args['name'] = $taxonomy; + $args['object_type'] = array_unique( (array)$object_type ); + + $args['labels'] = get_taxonomy_labels( (object) $args ); + $args['label'] = $args['labels']->name; + + $wp_taxonomies[$taxonomy] = (object) $args; + + // register callback handling for metabox + add_filter('wp_ajax_add-' . $taxonomy, '_wp_ajax_add_hierarchical_term'); +} + +/** + * Builds an object with all taxonomy labels out of a taxonomy object + * + * Accepted keys of the label array in the taxonomy object: + * - name - general name for the taxonomy, usually plural. The same as and overriden by $tax->label. Default is Post Tags/Categories + * - singular_name - name for one object of this taxonomy. Default is Post Tag/Category + * - search_items - Default is Search Tags/Search Categories + * - popular_items - This string isn't used on hierarchical taxonomies. Default is Popular Tags + * - all_items - Default is All Tags/All Categories + * - parent_item - This string isn't used on non-hierarchical taxonomies. In hierarchical ones the default is Parent Category + * - parent_item_colon - The same as parent_item, but with colon : in the end + * - edit_item - Default is Edit Tag/Edit Category + * - update_item - Default is Update Tag/Update Category + * - add_new_item - Default is Add New Tag/Add New Category + * - new_item_name - Default is New Tag Name/New Category Name + * - separate_items_with_commas - This string isn't used on hierarchical taxonomies. Default is "Separate tags with commas," used in the meta box. + * - add_or_remove_items - This string isn't used on hierarchical taxonomies. Default is "Add or remove tags," used in the meta box when JavaScript is disabled. + * - choose_from_most_used - This string isn't used on hierarchical taxonomies. Default is "Choose from the most used tags," used in the meta box. + * + * Above, the first default value is for non-hierarchical taxonomies (like tags) and the second one is for hierarchical taxonomies (like categories.) + * + * @since 3.0.0 + * @param object $tax Taxonomy object + * @return object object with all the labels as member variables + */ + +function get_taxonomy_labels( $tax ) { + if ( isset( $tax->helps ) && empty( $tax->labels['separate_items_with_commas'] ) ) + $tax->labels['separate_items_with_commas'] = $tax->helps; + + $nohier_vs_hier_defaults = array( + 'name' => array( _x( 'Post Tags', 'taxonomy general name' ), _x( 'Categories', 'taxonomy general name' ) ), + 'singular_name' => array( _x( 'Post Tag', 'taxonomy singular name' ), _x( 'Category', 'taxonomy singular name' ) ), + 'search_items' => array( __( 'Search Tags' ), __( 'Search Categories' ) ), + 'popular_items' => array( __( 'Popular Tags' ), null ), + 'all_items' => array( __( 'All Tags' ), __( 'All Categories' ) ), + 'parent_item' => array( null, __( 'Parent Category' ) ), + 'parent_item_colon' => array( null, __( 'Parent Category:' ) ), + 'edit_item' => array( __( 'Edit Tag' ), __( 'Edit Category' ) ), + 'view_item' => array( __( 'View Tag' ), __( 'View Category' ) ), + 'update_item' => array( __( 'Update Tag' ), __( 'Update Category' ) ), + 'add_new_item' => array( __( 'Add New Tag' ), __( 'Add New Category' ) ), + 'new_item_name' => array( __( 'New Tag Name' ), __( 'New Category Name' ) ), + 'separate_items_with_commas' => array( __( 'Separate tags with commas' ), null ), + 'add_or_remove_items' => array( __( 'Add or remove tags' ), null ), + 'choose_from_most_used' => array( __( 'Choose from the most used tags' ), null ), + ); + $nohier_vs_hier_defaults['menu_name'] = $nohier_vs_hier_defaults['name']; + + return _get_custom_object_labels( $tax, $nohier_vs_hier_defaults ); +} + +/** + * Add an already registered taxonomy to an object type. + * + * @package WordPress + * @subpackage Taxonomy + * @since 3.0.0 + * @uses $wp_taxonomies Modifies taxonomy object + * + * @param string $taxonomy Name of taxonomy object + * @param array|string $object_type Name of the object type + * @return bool True if successful, false if not + */ +function register_taxonomy_for_object_type( $taxonomy, $object_type) { + global $wp_taxonomies; + + if ( !isset($wp_taxonomies[$taxonomy]) ) + return false; + + if ( ! get_post_type_object($object_type) ) + return false; + + if ( ! in_array( $object_type, $wp_taxonomies[$taxonomy]->object_type ) ) + $wp_taxonomies[$taxonomy]->object_type[] = $object_type; + + return true; +} + +// +// 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.0 + * + * @uses $wpdb + * @uses wp_parse_args() Creates an array from string $args. + * + * @param int|array $term_ids Term id or array of term ids 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( $term_ids, $taxonomies, $args = array() ) { + global $wpdb; + + if ( ! is_array( $term_ids ) ) + $term_ids = array( $term_ids ); + + if ( ! is_array( $taxonomies ) ) + $taxonomies = array( $taxonomies ); + + foreach ( (array) $taxonomies as $taxonomy ) { + if ( ! taxonomy_exists( $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'; + + $term_ids = array_map('intval', $term_ids ); + + $taxonomies = "'" . implode( "', '", $taxonomies ) . "'"; + $term_ids = "'" . implode( "', '", $term_ids ) . "'"; + + $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 ($term_ids) ORDER BY tr.object_id $order"); + + if ( ! $object_ids ) + return array(); + + return $object_ids; +} + +/** + * Given a taxonomy query, generates SQL to be appended to a main query. + * + * @since 3.1.0 + * + * @see WP_Tax_Query + * + * @param array $tax_query A compact tax query + * @param string $primary_table + * @param string $primary_id_column + * @return array + */ +function get_tax_sql( $tax_query, $primary_table, $primary_id_column ) { + $tax_query_obj = new WP_Tax_Query( $tax_query ); + return $tax_query_obj->get_sql( $primary_table, $primary_id_column ); +} + +/** + * Container class for a multiple taxonomy query. + * + * @since 3.1.0 + */ +class WP_Tax_Query { + + /** + * List of taxonomy queries. A single taxonomy query is an associative array: + * - 'taxonomy' string The taxonomy being queried + * - 'terms' string|array The list of terms + * - 'field' string (optional) Which term field is being used. + * Possible values: 'term_id', 'slug' or 'name' + * Default: 'term_id' + * - 'operator' string (optional) + * Possible values: 'AND', 'IN' or 'NOT IN'. + * Default: 'IN' + * - 'include_children' bool (optional) Whether to include child terms. + * Default: true + * + * @since 3.1.0 + * @access public + * @var array + */ + public $queries = array(); + + /** + * The relation between the queries. Can be one of 'AND' or 'OR'. + * + * @since 3.1.0 + * @access public + * @var string + */ + public $relation; + + /** + * Standard response when the query should not return any rows. + * + * @since 3.2.0 + * @access private + * @var string + */ + private static $no_results = array( 'join' => '', 'where' => ' AND 0 = 1' ); + + /** + * Constructor. + * + * Parses a compact tax query and sets defaults. + * + * @since 3.1.0 + * @access public + * + * @param array $tax_query A compact tax query: + * array( + * 'relation' => 'OR', + * array( + * 'taxonomy' => 'tax1', + * 'terms' => array( 'term1', 'term2' ), + * 'field' => 'slug', + * ), + * array( + * 'taxonomy' => 'tax2', + * 'terms' => array( 'term-a', 'term-b' ), + * 'field' => 'slug', + * ), + * ) + */ + public function __construct( $tax_query ) { + if ( isset( $tax_query['relation'] ) && strtoupper( $tax_query['relation'] ) == 'OR' ) { + $this->relation = 'OR'; + } else { + $this->relation = 'AND'; + } + + $defaults = array( + 'taxonomy' => '', + 'terms' => array(), + 'include_children' => true, + 'field' => 'term_id', + 'operator' => 'IN', + ); + + foreach ( $tax_query as $query ) { + if ( ! is_array( $query ) ) + continue; + + $query = array_merge( $defaults, $query ); + + $query['terms'] = (array) $query['terms']; + + $this->queries[] = $query; + } + } + + /** + * Generates SQL clauses to be appended to a main query. + * + * @since 3.1.0 + * @access public + * + * @param string $primary_table + * @param string $primary_id_column + * @return array + */ + public function get_sql( $primary_table, $primary_id_column ) { + global $wpdb; + + $join = ''; + $where = array(); + $i = 0; + + foreach ( $this->queries as $query ) { + $this->clean_query( $query ); + + if ( is_wp_error( $query ) ) { + return self::$no_results; + } + + extract( $query ); + + if ( 'IN' == $operator ) { + + if ( empty( $terms ) ) { + if ( 'OR' == $this->relation ) + continue; + else + return self::$no_results; + } + + $terms = implode( ',', $terms ); + + $alias = $i ? 'tt' . $i : $wpdb->term_relationships; + + $join .= " INNER JOIN $wpdb->term_relationships"; + $join .= $i ? " AS $alias" : ''; + $join .= " ON ($primary_table.$primary_id_column = $alias.object_id)"; + + $where[] = "$alias.term_taxonomy_id $operator ($terms)"; + } elseif ( 'NOT IN' == $operator ) { + + if ( empty( $terms ) ) + continue; + + $terms = implode( ',', $terms ); + + $where[] = "$primary_table.$primary_id_column NOT IN ( + SELECT object_id + FROM $wpdb->term_relationships + WHERE term_taxonomy_id IN ($terms) + )"; + } elseif ( 'AND' == $operator ) { + + if ( empty( $terms ) ) + continue; + + $num_terms = count( $terms ); + + $terms = implode( ',', $terms ); + + $where[] = "( + SELECT COUNT(1) + FROM $wpdb->term_relationships + WHERE term_taxonomy_id IN ($terms) + AND object_id = $primary_table.$primary_id_column + ) = $num_terms"; + } + + $i++; + } + + if ( !empty( $where ) ) + $where = ' AND ( ' . implode( " $this->relation ", $where ) . ' )'; + else + $where = ''; + + return compact( 'join', 'where' ); + } + + /** + * Validates a single query. + * + * @since 3.2.0 + * @access private + * + * @param array &$query The single query + */ + private function clean_query( &$query ) { + if ( ! taxonomy_exists( $query['taxonomy'] ) ) { + $query = new WP_Error( 'Invalid taxonomy' ); + return; + } + + $query['terms'] = array_unique( (array) $query['terms'] ); + + if ( is_taxonomy_hierarchical( $query['taxonomy'] ) && $query['include_children'] ) { + $this->transform_query( $query, 'term_id' ); + + if ( is_wp_error( $query ) ) + return; + + $children = array(); + foreach ( $query['terms'] as $term ) { + $children = array_merge( $children, get_term_children( $term, $query['taxonomy'] ) ); + $children[] = $term; + } + $query['terms'] = $children; + } + + $this->transform_query( $query, 'term_taxonomy_id' ); + } + + /** + * Transforms a single query, from one field to another. + * + * @since 3.2.0 + * @access private + * + * @param array &$query The single query + * @param string $resulting_field The resulting field + */ + private function transform_query( &$query, $resulting_field ) { + global $wpdb; + + if ( empty( $query['terms'] ) ) + return; + + if ( $query['field'] == $resulting_field ) + return; + + $resulting_field = esc_sql( $resulting_field ); + + switch ( $query['field'] ) { + case 'slug': + case 'name': + $terms = "'" . implode( "','", array_map( 'sanitize_title_for_query', $query['terms'] ) ) . "'"; + $terms = $wpdb->get_col( " + SELECT $wpdb->term_taxonomy.$resulting_field + FROM $wpdb->term_taxonomy + INNER JOIN $wpdb->terms USING (term_id) + WHERE taxonomy = '{$query['taxonomy']}' + AND $wpdb->terms.{$query['field']} IN ($terms) + " ); + break; + + default: + $terms = implode( ',', array_map( 'intval', $query['terms'] ) ); + $terms = $wpdb->get_col( " + SELECT $resulting_field + FROM $wpdb->term_taxonomy + WHERE taxonomy = '{$query['taxonomy']}' + AND term_id IN ($terms) + " ); + } + + if ( 'AND' == $query['operator'] && count( $terms ) < count( $query['terms'] ) ) { + $query = new WP_Error( 'Inexistent terms' ); + return; + } + + $query['terms'] = $terms; + $query['field'] = $resulting_field; + } +} + +/** + * 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.0 + * + * @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; + $null = null; + + if ( empty($term) ) { + $error = new WP_Error('invalid_term', __('Empty Term')); + return $error; + } + + if ( ! taxonomy_exists($taxonomy) ) { + $error = new WP_Error('invalid_taxonomy', __('Invalid Taxonomy')); + return $error; + } + + if ( is_object($term) && empty($term->filter) ) { + wp_cache_add($term->term_id, $term, $taxonomy); + $_term = $term; + } else { + if ( is_object($term) ) + $term = $term->term_id; + $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) ); + if ( ! $_term ) + return $null; + 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 ) { + $__term = get_object_vars($_term); + return $__term; + } elseif ( $output == ARRAY_N ) { + $__term = array_values(get_object_vars($_term)); + return $__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.0 + * + * @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 ( ! taxonomy_exists($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 + $value = stripslashes($value); + $field = 't.name'; + } else { + $term = get_term( (int) $value, $taxonomy, $output, $filter); + if ( is_wp_error( $term ) ) + $term = false; + return $term; + } + + $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 = 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; + } +} + +/** + * Merge all term children into a single array of their IDs. + * + * This recursive function will merge all of the children of $term into the same + * array of term IDs. 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.0 + * + * @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_id ID 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_id, $taxonomy ) { + if ( ! taxonomy_exists($taxonomy) ) + return new WP_Error('invalid_taxonomy', __('Invalid Taxonomy')); + + $term_id = intval( $term_id ); + + $terms = _get_term_hierarchy($taxonomy); + + if ( ! isset($terms[$term_id]) ) + return array(); + + $children = $terms[$term_id]; + + foreach ( (array) $terms[$term_id] 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.0 + * + * @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.0 + * + * @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 a given 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 'get_terms_orderby' filter passes the ORDER BY clause for the query + * along with the $args array. + * + * The 'get_terms_fields' filter passes the fields for the SELECT query + * along with the $args array. + * + * The list of arguments that $args can contain, which will overwrite the defaults: + * + * orderby - Default is 'name'. Can be name, count, term_group, slug or nothing + * (will use term_id), Passing a custom value other than these will cause it to + * order based on the custom value. + * + * order - Default is ASC. Can use DESC. + * + * hide_empty - Default is true. Will not return empty terms, which means + * terms whose count is 0 according to the given taxonomy. + * + * exclude - Default is an empty array. An array, comma- or space-delimited string + * of term ids to exclude from the return array. If 'include' is non-empty, + * 'exclude' is ignored. + * + * exclude_tree - Default is an empty array. An array, comma- or space-delimited + * string of term ids to exclude from the return array, along with all of their + * descendant terms according to the primary taxonomy. If 'include' is non-empty, + * 'exclude_tree' is ignored. + * + * include - Default is an empty array. An array, comma- or space-delimited string + * of term ids to include in the return array. + * + * number - The maximum number of terms to return. Default is to return them all. + * + * offset - The number by which to offset the terms query. + * + * fields - Default is 'all', which returns an array of term objects. + * If 'fields' is 'ids' or 'names', returns an array of + * integers or strings, respectively. + * + * slug - Returns terms whose "slug" matches this value. Default is empty string. + * + * hierarchical - Whether to include terms that have non-empty descendants + * (even if 'hide_empty' is set to true). + * + * search - Returned terms' names will contain the value of 'search', + * case-insensitive. Default is an empty string. + * + * name__like - Returned terms' names will begin with the value of 'name__like', + * case-insensitive. Default is empty string. + * + * The argument 'pad_counts', if set to true will include the quantity of a term's + * children in the quantity of each term's "count" object variable. + * + * The 'get' argument, if set to 'all' instead of its default empty string, + * returns terms regardless of ancestry or whether the terms are empty. + * + * The 'child_of' argument, when used, should be set to the integer of a term ID. Its default + * is 0. If set to a non-zero value, all returned terms will be descendants + * of that term according to the given taxonomy. Hence 'child_of' is set to 0 + * if more than one taxonomy is passed in $taxonomies, because multiple taxonomies + * make term ancestry ambiguous. + * + * The 'parent' argument, when used, should be set to the integer of a term ID. Its default is + * the empty string '', which has a different meaning from the integer 0. + * If set to an integer value, all returned terms will have as an immediate + * ancestor the term whose ID is specified by that integer according to the given taxonomy. + * The 'parent' argument is different from 'child_of' in that a term X is considered a 'parent' + * of term Y only if term X is the father of term Y, not its grandfather or great-grandfather, etc. + * + * The 'cache_domain' argument enables a unique cache key to be produced when this query is stored + * in object cache. For instance, if you are using one of this function's filters to modify the + * query (such as 'terms_clauses'), setting 'cache_domain' to a unique value will not overwrite + * the cache for similar queries. Default value is 'core'. + * + * @package WordPress + * @subpackage Taxonomy + * @since 2.3.0 + * + * @uses $wpdb + * @uses wp_parse_args() Merges the defaults with those defined by $args and allows for strings. + * + * @param string|array $taxonomies 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 ( ! taxonomy_exists($taxonomy) ) { + $error = & new WP_Error('invalid_taxonomy', __('Invalid Taxonomy')); + return $error; + } + } + + $defaults = array('orderby' => 'name', 'order' => 'ASC', + 'hide_empty' => true, 'exclude' => array(), 'exclude_tree' => array(), 'include' => array(), + 'number' => '', 'fields' => 'all', 'slug' => '', 'parent' => '', + 'hierarchical' => true, 'child_of' => 0, 'get' => '', 'name__like' => '', + 'pad_counts' => false, 'offset' => '', 'search' => '', 'cache_domain' => 'core' ); + $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; + } + + $args = apply_filters( 'get_terms_args', $args, $taxonomies ); + + 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 ); + $last_changed = wp_cache_get('last_changed', 'terms'); + if ( !$last_changed ) { + $last_changed = time(); + wp_cache_set('last_changed', $last_changed, 'terms'); + } + $cache_key = "get_terms:$key:$last_changed"; + $cache = wp_cache_get( $cache_key, 'terms' ); + if ( false !== $cache ) { + $cache = apply_filters('get_terms', $cache, $taxonomies, $args); + return $cache; + } + + $_orderby = strtolower($orderby); + 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 ( 'none' == $_orderby ) + $orderby = ''; + elseif ( empty($_orderby) || 'id' == $_orderby ) + $orderby = 't.term_id'; + else + $orderby = 't.name'; + + $orderby = apply_filters( 'get_terms_orderby', $orderby, $args ); + + if ( !empty($orderby) ) + $orderby = "ORDER BY $orderby"; + else + $order = ''; + + $order = strtoupper( $order ); + if ( '' !== $order && !in_array( $order, array( 'ASC', 'DESC' ) ) ) + $order = 'ASC'; + + $where = "tt.taxonomy IN ('" . implode("', '", $taxonomies) . "')"; + $inclusions = ''; + if ( !empty($include) ) { + $exclude = ''; + $exclude_tree = ''; + $interms = wp_parse_id_list($include); + 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_tree ) ) { + $excluded_trunks = wp_parse_id_list($exclude_tree); + foreach ( $excluded_trunks as $extrunk ) { + $excluded_children = (array) get_terms($taxonomies[0], array('child_of' => intval($extrunk), 'fields' => 'ids', 'hide_empty' => 0)); + $excluded_children[] = $extrunk; + foreach( $excluded_children as $exterm ) { + if ( empty($exclusions) ) + $exclusions = ' AND ( t.term_id <> ' . intval($exterm) . ' '; + else + $exclusions .= ' AND t.term_id <> ' . intval($exterm) . ' '; + } + } + } + + if ( !empty($exclude) ) { + $exterms = wp_parse_id_list($exclude); + 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) ) { + $name__like = like_escape( $name__like ); + $where .= $wpdb->prepare( " AND t.name LIKE %s", $name__like . '%' ); + } + + if ( '' !== $parent ) { + $parent = (int) $parent; + $where .= " AND tt.parent = '$parent'"; + } + + if ( $hide_empty && !$hierarchical ) + $where .= ' AND tt.count > 0'; + + // don't limit the query results when we have to descend the family tree + if ( ! empty($number) && ! $hierarchical && empty( $child_of ) && '' === $parent ) { + if ( $offset ) + $limits = 'LIMIT ' . $offset . ',' . $number; + else + $limits = 'LIMIT ' . $number; + } else { + $limits = ''; + } + + if ( !empty($search) ) { + $search = like_escape($search); + $where .= $wpdb->prepare( " AND (t.name LIKE %s)", '%' . $search . '%'); + } + + $selects = array(); + switch ( $fields ) { + case 'all': + $selects = array('t.*', 'tt.*'); + break; + case 'ids': + case 'id=>parent': + $selects = array('t.term_id', 'tt.parent', 'tt.count'); + break; + case 'names': + $selects = array('t.term_id', 'tt.parent', 'tt.count', 't.name'); + break; + case 'count': + $orderby = ''; + $order = ''; + $selects = array('COUNT(*)'); + } + + $_fields = $fields; + + $fields = implode(', ', apply_filters( 'get_terms_fields', $selects, $args )); + + $join = "INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id"; + + $pieces = array( 'fields', 'join', 'where', 'orderby', 'order', 'limits' ); + $clauses = apply_filters( 'terms_clauses', compact( $pieces ), $taxonomies, $args ); + foreach ( $pieces as $piece ) + $$piece = isset( $clauses[ $piece ] ) ? $clauses[ $piece ] : ''; + + $query = "SELECT $fields FROM $wpdb->terms AS t $join WHERE $where $orderby $order $limits"; + + $fields = $_fields; + + if ( 'count' == $fields ) { + $term_count = $wpdb->get_var($query); + return $term_count; + } + + $terms = $wpdb->get_results($query); + if ( 'all' == $fields ) { + update_term_cache($terms); + } + + if ( empty($terms) ) { + wp_cache_add( $cache_key, array(), 'terms', 86400 ); // one day + $terms = apply_filters('get_terms', array(), $taxonomies, $args); + return $terms; + } + + if ( $child_of ) { + $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 && 'all' == $fields ) + _pad_term_counts($terms, $taxonomies[0]); + + // Make sure we show empty categories that have children. + if ( $hierarchical && $hide_empty && is_array($terms) ) { + foreach ( $terms as $k => $term ) { + if ( ! $term->count ) { + $children = _get_term_children($term->term_id, $terms, $taxonomies[0]); + if ( is_array($children) ) + foreach ( $children as $child ) + if ( $child->count ) + continue 2; + + // It really is empty + unset($terms[$k]); + } + } + } + reset ( $terms ); + + $_terms = array(); + if ( 'id=>parent' == $fields ) { + while ( $term = array_shift($terms) ) + $_terms[$term->term_id] = $term->parent; + $terms = $_terms; + } elseif ( 'ids' == $fields ) { + while ( $term = array_shift($terms) ) + $_terms[] = $term->term_id; + $terms = $_terms; + } elseif ( 'names' == $fields ) { + while ( $term = array_shift($terms) ) + $_terms[] = $term->name; + $terms = $_terms; + } + + if ( 0 < $number && intval(@count($terms)) > $number ) { + $terms = array_slice($terms, $offset, $number); + } + + wp_cache_add( $cache_key, $terms, 'terms', 86400 ); // one day + + $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. + * + * Formerly is_term(), introduced in 2.3.0. + * + * @package WordPress + * @subpackage Taxonomy + * @since 3.0.0 + * + * @uses $wpdb + * + * @param int|string $term The term to check + * @param string $taxonomy The taxonomy name to use + * @param int $parent ID of parent term under which to confine the exists search. + * @return mixed Get the term id or Term Object, if exists. + */ +function term_exists($term, $taxonomy = '', $parent = 0) { + 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 ) ); + } + + $term = trim( stripslashes( $term ) ); + + if ( '' === $slug = sanitize_title($term) ) + return 0; + + $where = 't.slug = %s'; + $else_where = 't.name = %s'; + $where_fields = array($slug); + $else_where_fields = array($term); + if ( !empty($taxonomy) ) { + $parent = (int) $parent; + if ( $parent > 0 ) { + $where_fields[] = $parent; + $else_where_fields[] = $parent; + $where .= ' AND tt.parent = %d'; + $else_where .= ' AND tt.parent = %d'; + } + + $where_fields[] = $taxonomy; + $else_where_fields[] = $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", $where_fields), 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", $else_where_fields), ARRAY_A); + } + + if ( $result = $wpdb->get_var( $wpdb->prepare("SELECT term_id FROM $wpdb->terms as t WHERE $where", $where_fields) ) ) + return $result; + + return $wpdb->get_var( $wpdb->prepare("SELECT term_id FROM $wpdb->terms as t WHERE $else_where", $else_where_fields) ); +} + +/** + * 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.0 + * + * @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; + + $term_id = $do_object ? $term->term_id : (isset($term['term_id']) ? $term['term_id'] : 0); + + foreach ( (array) $fields as $field ) { + if ( $do_object ) { + if ( isset($term->$field) ) + $term->$field = sanitize_term_field($field, $term->$field, $term_id, $taxonomy, $context); + } else { + if ( isset($term[$field]) ) + $term[$field] = sanitize_term_field($field, $term[$field], $term_id, $taxonomy, $context); + } + } + + if ( $do_object ) + $term->filter = $context; + else + $term['filter'] = $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.0 + * + * @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 = esc_html($value); // textarea_escaped + else + $value = esc_attr($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 = esc_attr($value); + else if ( 'js' == $context ) + $value = esc_js($value); + + return $value; +} + +/** + * Count how many terms are in Taxonomy. + * + * Default $args is 'hide_empty' which can be 'hide_empty=true' or array('hide_empty' => true). + * + * @package WordPress + * @subpackage Taxonomy + * @since 2.3.0 + * + * @uses get_terms() + * @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. See get_terms() + * @return int How many terms are in $taxonomy + */ +function wp_count_terms( $taxonomy, $args = array() ) { + $defaults = array('hide_empty' => false); + $args = wp_parse_args($args, $defaults); + + // backwards compatibility + if ( isset($args['ignore_empty']) ) { + $args['hide_empty'] = $args['ignore_empty']; + unset($args['ignore_empty']); + } + + $args['fields'] = 'count'; + + return get_terms($taxonomy, $args); +} + +/** + * Will unlink the object from the taxonomy or taxonomies. + * + * Will remove all relationships between the object and any terms in + * a particular taxonomy or taxonomies. Does not remove the term or + * taxonomy itself. + * + * @package WordPress + * @subpackage Taxonomy + * @since 2.3.0 + * @uses $wpdb + * + * @param int $object_id The term Object Id that refers to the term + * @param string|array $taxonomies 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 ( (array) $taxonomies as $taxonomy ) { + $tt_ids = wp_get_object_terms($object_id, $taxonomy, array('fields' => 'tt_ids')); + $in_tt_ids = "'" . implode("', '", $tt_ids) . "'"; + do_action( 'delete_term_relationships', $object_id, $tt_ids ); + $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->term_relationships WHERE object_id = %d AND term_taxonomy_id IN ($in_tt_ids)", $object_id) ); + do_action( 'deleted_term_relationships', $object_id, $tt_ids ); + wp_update_term_count($tt_ids, $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. + * + * The $args 'force_default' will force the term supplied as default to be + * assigned even if the object was not going to be termless + * @package WordPress + * @subpackage Taxonomy + * @since 2.3.0 + * + * @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 = term_exists($term, $taxonomy) ) + return false; + if ( is_wp_error( $ids ) ) + return $ids; + + $tt_id = $ids['term_taxonomy_id']; + + $defaults = array(); + + if ( 'category' == $taxonomy ) { + $defaults['default'] = get_option( 'default_category' ); + if ( $defaults['default'] == $term ) + return 0; // Don't delete the default category + } + + $args = wp_parse_args($args, $defaults); + extract($args, EXTR_SKIP); + + if ( isset( $default ) ) { + $default = (int) $default; + if ( ! term_exists($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; + + $edit_tt_ids = $wpdb->get_col( "SELECT `term_taxonomy_id` FROM $wpdb->term_taxonomy WHERE `parent` = " . (int)$term_obj->term_id ); + do_action( 'edit_term_taxonomies', $edit_tt_ids ); + $wpdb->update( $wpdb->term_taxonomy, compact( 'parent' ), array( 'parent' => $term_obj->term_id) + compact( 'taxonomy' ) ); + do_action( 'edited_term_taxonomies', $edit_tt_ids ); + } + + $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, array('fields' => 'ids', 'orderby' => 'none')); + if ( 1 == count($terms) && isset($default) ) { + $terms = array($default); + } else { + $terms = array_diff($terms, array($term)); + if (isset($default) && isset($force_default) && $force_default) + $terms = array_merge($terms, array($default)); + } + $terms = array_map('intval', $terms); + wp_set_object_terms($object, $terms, $taxonomy); + } + + // Clean the relationship caches for all object types using this term + $tax_object = get_taxonomy( $taxonomy ); + foreach ( $tax_object->object_type as $object_type ) + clean_object_term_cache( $objects, $object_type ); + + do_action( 'delete_term_taxonomy', $tt_id ); + $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->term_taxonomy WHERE term_taxonomy_id = %d", $tt_id ) ); + do_action( 'deleted_term_taxonomy', $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; +} + +/** + * Deletes one existing category. + * + * @since 2.0.0 + * @uses wp_delete_term() + * + * @param int $cat_ID + * @return mixed Returns true if completes delete action; false if term doesnt exist; + * Zero on attempted deletion of default Category; WP_Error object is also a possibility. + */ +function wp_delete_category( $cat_ID ) { + return wp_delete_term( $cat_ID, 'category' ); +} + +/** + * 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.0 + * @uses $wpdb + * + * @param int|array $object_ids The ID(s) 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 ( (array) $taxonomies as $taxonomy ) { + if ( ! taxonomy_exists($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 if ( 'none' == $orderby ) { + $orderby = ''; + $order = ''; + } else { + $orderby = 't.term_id'; + } + + // tt_ids queries can only be none or tr.term_taxonomy_id + if ( ('tt_ids' == $fields) && !empty($orderby) ) + $orderby = 'tr.term_taxonomy_id'; + + if ( !empty($orderby) ) + $orderby = "ORDER BY $orderby"; + + $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) $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) $orderby $order"); + } + + if ( ! $terms ) + $terms = array(); + + return apply_filters('wp_get_object_terms', $terms, $object_ids, $taxonomies, $args); +} + +/** + * 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.0 + * @uses $wpdb + * + * @uses apply_filters() Calls 'pre_insert_term' hook with term and taxonomy as parameters. + * @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 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 ( ! taxonomy_exists($taxonomy) ) + return new WP_Error('invalid_taxonomy', __('Invalid taxonomy')); + + $term = apply_filters( 'pre_insert_term', $term, $taxonomy ); + if ( is_wp_error( $term ) ) + return $term; + + 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; + do_action( 'edit_terms', $alias->term_id ); + $wpdb->update($wpdb->terms, compact('term_group'), array('term_id' => $alias->term_id) ); + do_action( 'edited_terms', $alias->term_id ); + } + } + + if ( $term_id = term_exists($slug) ) { + $existing_term = $wpdb->get_row( $wpdb->prepare( "SELECT name FROM $wpdb->terms WHERE term_id = %d", $term_id), ARRAY_A ); + // We've got an existing term in the same taxonomy, which matches the name of the new term: + if ( is_taxonomy_hierarchical($taxonomy) && $existing_term['name'] == $name && $exists = term_exists( (int) $term_id, $taxonomy ) ) { + // Hierarchical, and it matches an existing term, Do not allow same "name" in the same level. + $siblings = get_terms($taxonomy, array('fields' => 'names', 'get' => 'all', 'parent' => (int)$parent) ); + if ( in_array($name, $siblings) ) { + return new WP_Error('term_exists', __('A term with the name provided already exists with this parent.'), $exists['term_id']); + } else { + $slug = wp_unique_term_slug($slug, (object) $args); + if ( false === $wpdb->insert( $wpdb->terms, compact( 'name', 'slug', 'term_group' ) ) ) + return new WP_Error('db_insert_error', __('Could not insert term into the database'), $wpdb->last_error); + $term_id = (int) $wpdb->insert_id; + } + } elseif ( $existing_term['name'] != $name ) { + // We've got an existing term, with a different name, Create the new term. + $slug = wp_unique_term_slug($slug, (object) $args); + if ( false === $wpdb->insert( $wpdb->terms, compact( 'name', 'slug', 'term_group' ) ) ) + return new WP_Error('db_insert_error', __('Could not insert term into the database'), $wpdb->last_error); + $term_id = (int) $wpdb->insert_id; + } elseif ( $exists = term_exists( (int) $term_id, $taxonomy ) ) { + // Same name, same slug. + return new WP_Error('term_exists', __('A term with the name provided already exists.'), $exists['term_id']); + } + } else { + // This term does not exist at all in the database, Create it. + $slug = wp_unique_term_slug($slug, (object) $args); + if ( false === $wpdb->insert( $wpdb->terms, compact( 'name', 'slug', 'term_group' ) ) ) + return new WP_Error('db_insert_error', __('Could not insert term into the database'), $wpdb->last_error); + $term_id = (int) $wpdb->insert_id; + } + + // Seems unreachable, However, Is used in the case that a term name is provided, which sanitizes to an empty string. + if ( empty($slug) ) { + $slug = sanitize_title($slug, $term_id); + do_action( 'edit_terms', $term_id ); + $wpdb->update( $wpdb->terms, compact( 'slug' ), compact( 'term_id' ) ); + do_action( 'edited_terms', $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, $taxonomy); + 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, $taxonomy); + 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.0 + * @uses $wpdb + * + * @param int $object_id The object to relate to. + * @param array|int|string $terms The slug or id of the term, will replace all existing + * related terms in this taxonomy. + * @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 ( ! taxonomy_exists($taxonomy) ) + return new WP_Error('invalid_taxonomy', __('Invalid Taxonomy')); + + if ( !is_array($terms) ) + $terms = array($terms); + + if ( ! $append ) + $old_tt_ids = wp_get_object_terms($object_id, $taxonomy, array('fields' => 'tt_ids', 'orderby' => 'none')); + else + $old_tt_ids = array(); + + $tt_ids = array(); + $term_ids = array(); + + foreach ( (array) $terms as $term) { + if ( !strlen(trim($term)) ) + continue; + + if ( !$term_info = term_exists($term, $taxonomy) ) { + // Skip if a non-existent term ID is passed. + if ( is_int($term) ) + continue; + $term_info = wp_insert_term($term, $taxonomy); + } + if ( is_wp_error($term_info) ) + return $term_info; + $term_ids[] = $term_info['term_id']; + $tt_id = $term_info['term_taxonomy_id']; + $tt_ids[] = $tt_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, $tt_id ) ) ) + continue; + do_action( 'add_term_relationship', $object_id, $tt_id ); + $wpdb->insert( $wpdb->term_relationships, array( 'object_id' => $object_id, 'term_taxonomy_id' => $tt_id ) ); + do_action( 'added_term_relationship', $object_id, $tt_id ); + } + + wp_update_term_count($tt_ids, $taxonomy); + + if ( ! $append ) { + $delete_terms = array_diff($old_tt_ids, $tt_ids); + if ( $delete_terms ) { + $in_delete_terms = "'" . implode("', '", $delete_terms) . "'"; + do_action( 'delete_term_relationships', $object_id, $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) ); + do_action( 'deleted_term_relationships', $object_id, $delete_terms ); + 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, array('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)"); + } + + do_action('set_object_terms', $object_id, $terms, $tt_ids, $taxonomy, $append, $old_tt_ids); + 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 + * hierarchical 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.0 + * @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 ( ! term_exists( $slug ) ) + return $slug; + + // 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 ( ! term_exists( $slug ) ) + return $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.0 + * + * @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_id 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_id, $taxonomy, $args = array() ) { + global $wpdb; + + if ( ! taxonomy_exists($taxonomy) ) + return new WP_Error('invalid_taxonomy', __('Invalid taxonomy')); + + $term_id = (int) $term_id; + + // First, get all of the original args + $term = get_term ($term_id, $taxonomy, ARRAY_A); + + if ( is_wp_error( $term ) ) + return $term; + + // 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; + do_action( 'edit_terms', $alias->term_id ); + $wpdb->update( $wpdb->terms, compact('term_group'), array( 'term_id' => $alias->term_id ) ); + do_action( 'edited_terms', $alias->term_id ); + } + } + + // Check $parent to see if it will cause a hierarchy loop + $parent = apply_filters( 'wp_update_term_parent', $parent, $term_id, $taxonomy, compact( array_keys( $args ) ), $args ); + + // 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)); + } + do_action( 'edit_terms', $term_id ); + $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' ) ); + } + do_action( 'edited_terms', $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) ); + do_action( 'edit_term_taxonomy', $tt_id, $taxonomy ); + $wpdb->update( $wpdb->term_taxonomy, compact( 'term_id', 'taxonomy', 'description', 'parent' ), array( 'term_taxonomy_id' => $tt_id ) ); + do_action( 'edited_term_taxonomy', $tt_id, $taxonomy ); + + do_action("edit_term", $term_id, $tt_id, $taxonomy); + 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, $taxonomy); + 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.5.0 + * + * @param bool $defer Optional. Enable if true, disable if false. + * @return bool Whether term counting is enabled or disabled. + */ +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.0 + * @uses $wpdb + * + * @param int|array $terms The term_taxonomy_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) 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.5.0 + * + * @param array $terms The term_taxonomy_id 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, $taxonomy); + } else { + // Default count updater + foreach ( (array) $terms as $term) { + $count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->term_relationships WHERE term_taxonomy_id = %d", $term) ); + do_action( 'edit_term_taxonomy', $term, $taxonomy ); + $wpdb->update( $wpdb->term_taxonomy, compact( 'count' ), array( 'term_taxonomy_id' => $term ) ); + do_action( 'edited_term_taxonomy', $term, $taxonomy ); + } + + } + + clean_term_cache($terms, '', false); + + 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.0 + * + * @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.0 + * @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. + * @param bool $clean_taxonomy Whether to clean taxonomy wide caches (true), or just individual term object caches (false). Default is true. + */ +function clean_term_cache($ids, $taxonomy = '', $clean_taxonomy = true) { + global $wpdb; + static $cleaned = array(); + + if ( !is_array($ids) ) + $ids = array($ids); + + $taxonomies = array(); + // If no taxonomy, assume tt_ids. + if ( empty($taxonomy) ) { + $tt_ids = array_map('intval', $ids); + $tt_ids = implode(', ', $tt_ids); + $terms = $wpdb->get_results("SELECT term_id, taxonomy FROM $wpdb->term_taxonomy WHERE term_taxonomy_id IN ($tt_ids)"); + $ids = array(); + foreach ( (array) $terms as $term ) { + $taxonomies[] = $term->taxonomy; + $ids[] = $term->term_id; + wp_cache_delete($term->term_id, $term->taxonomy); + } + $taxonomies = array_unique($taxonomies); + } else { + $taxonomies = array($taxonomy); + foreach ( $taxonomies as $taxonomy ) { + foreach ( $ids as $id ) { + wp_cache_delete($id, $taxonomy); + } + } + } + + foreach ( $taxonomies as $taxonomy ) { + if ( isset($cleaned[$taxonomy]) ) + continue; + $cleaned[$taxonomy] = true; + + if ( $clean_taxonomy ) { + wp_cache_delete('all_ids', $taxonomy); + wp_cache_delete('get', $taxonomy); + delete_option("{$taxonomy}_children"); + // Regenerate {$taxonomy}_children + _get_term_hierarchy($taxonomy); + } + + do_action('clean_term_cache', $ids, $taxonomy); + } + + wp_cache_set('last_changed', time(), 'terms'); +} + + +/** + * Retrieves the taxonomy relationship to the term object id. + * + * @package WordPress + * @subpackage Taxonomy + * @since 2.3.0 + * + * @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.0 + * @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, array('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.0 + * + * @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 ( (array) $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 as Term IDs. + * + * @package WordPress + * @subpackage Taxonomy + * @access private + * @since 2.3.0 + * + * @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 hierarchical or returns children as Term IDs. + */ +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, array('get' => 'all', 'orderby' => 'id', 'fields' => 'id=>parent')); + foreach ( $terms as $term_id => $parent ) { + if ( $parent > 0 ) + $children[$parent][] = $term_id; + } + update_option("{$taxonomy}_children", $children); + + return $children; +} + + +/** + * Get the subset of $terms that are descendants of $term_id. + * + * If $terms is an array of objects, then _get_term_children returns an array of objects. + * If $terms is an array of IDs, then _get_term_children returns an array of IDs. + * + * @package WordPress + * @subpackage Taxonomy + * @access private + * @since 2.3.0 + * + * @param int $term_id The ancestor term: all returned terms should be descendants of $term_id. + * @param array $terms The set of terms---either an array of term objects or term IDs---from which those that are descendants of $term_id will be chosen. + * @param string $taxonomy The taxonomy which determines the hierarchy of the terms. + * @return array The subset of $terms that are descendants of $term_id. + */ +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 ( (array) $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.0 + * @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 hierarchical taxonomies like post categories. + if ( !is_taxonomy_hierarchical( $taxonomy ) ) + return; + + $term_hier = _get_term_hierarchy($taxonomy); + + if ( empty($term_hier) ) + return; + + $term_items = array(); + + foreach ( (array) $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 + $tax_obj = get_taxonomy($taxonomy); + $object_types = esc_sql($tax_obj->object_type); + $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 (" . implode(',', array_keys($term_ids)) . ") AND post_type IN ('" . implode("', '", $object_types) . "') AND post_status = 'publish'"); + foreach ( $results as $row ) { + $id = $term_ids[$row->term_taxonomy_id]; + $term_items[$id][$row->object_id] = isset($term_items[$id][$row->object_id]) ? ++$term_items[$id][$row->object_id] : 1; + } + + // 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] = isset($term_items[$parent][$item_id]) ? ++$term_items[$parent][$item_id]: 1; + } + $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 object types of the current taxonomy. + * + * Private function for the default callback for post_tag and category + * taxonomies. + * + * @package WordPress + * @subpackage Taxonomy + * @access private + * @since 2.3.0 + * @uses $wpdb + * + * @param array $terms List of Term taxonomy IDs + * @param object $taxonomy Current taxonomy object of terms + */ +function _update_post_term_count( $terms, $taxonomy ) { + global $wpdb; + + $object_types = is_array($taxonomy->object_type) ? $taxonomy->object_type : array($taxonomy->object_type); + $object_types = esc_sql($object_types); + + foreach ( (array) $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 IN ('" . implode("', '", $object_types) . "') AND term_taxonomy_id = %d", $term ) ); + do_action( 'edit_term_taxonomy', $term, $taxonomy ); + $wpdb->update( $wpdb->term_taxonomy, compact( 'count' ), array( 'term_taxonomy_id' => $term ) ); + do_action( 'edited_term_taxonomy', $term, $taxonomy ); + } +} + + +/** + * Generates a permalink for a taxonomy term archive. + * + * @since 2.5.0 + * + * @uses apply_filters() Calls 'term_link' with term link and term object, and taxonomy parameters. + * @uses apply_filters() For the post_tag Taxonomy, Calls 'tag_link' with tag link and tag ID as parameters. + * @uses apply_filters() For the category Taxonomy, Calls 'category_link' filter on category link and category ID. + * + * @param object|int|string $term + * @param string $taxonomy (optional if $term is object) + * @return string|WP_Error HTML link to taxonomy term archive on success, WP_Error if term does not exist. + */ +function get_term_link( $term, $taxonomy = '') { + global $wp_rewrite; + + if ( !is_object($term) ) { + if ( is_int($term) ) { + $term = &get_term($term, $taxonomy); + } else { + $term = &get_term_by('slug', $term, $taxonomy); + } + } + + if ( !is_object($term) ) + $term = new WP_Error('invalid_term', __('Empty Term')); + + if ( is_wp_error( $term ) ) + return $term; + + $taxonomy = $term->taxonomy; + + $termlink = $wp_rewrite->get_extra_permastruct($taxonomy); + + $slug = $term->slug; + $t = get_taxonomy($taxonomy); + + if ( empty($termlink) ) { + if ( 'category' == $taxonomy ) + $termlink = '?cat=' . $term->term_id; + elseif ( $t->query_var ) + $termlink = "?$t->query_var=$slug"; + else + $termlink = "?taxonomy=$taxonomy&term=$slug"; + $termlink = home_url($termlink); + } else { + if ( $t->rewrite['hierarchical'] ) { + $hierarchical_slugs = array(); + $ancestors = get_ancestors($term->term_id, $taxonomy); + foreach ( (array)$ancestors as $ancestor ) { + $ancestor_term = get_term($ancestor, $taxonomy); + $hierarchical_slugs[] = $ancestor_term->slug; + } + $hierarchical_slugs = array_reverse($hierarchical_slugs); + $hierarchical_slugs[] = $slug; + $termlink = str_replace("%$taxonomy%", implode('/', $hierarchical_slugs), $termlink); + } else { + $termlink = str_replace("%$taxonomy%", $slug, $termlink); + } + $termlink = home_url( user_trailingslashit($termlink, 'category') ); + } + // Back Compat filters. + if ( 'post_tag' == $taxonomy ) + $termlink = apply_filters( 'tag_link', $termlink, $term->term_id ); + elseif ( 'category' == $taxonomy ) + $termlink = apply_filters( 'category_link', $termlink, $term->term_id ); + + 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. + * 'template' : The template to use for displaying the taxonomy terms. + * + * @since 2.5.0 + * @uses get_the_taxonomies() + * + * @param array $args Override the defaults. + */ +function the_taxonomies($args = array()) { + $defaults = array( + 'post' => 0, + 'before' => '', + 'sep' => ' ', + 'after' => '', + 'template' => '%s: %l.' + ); + + $r = wp_parse_args( $args, $defaults ); + extract( $r, EXTR_SKIP ); + + echo $before . join($sep, get_the_taxonomies($post, $r)) . $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.5.0 + * + * @param int $post Optional. Post ID or will use Global Post ID (in loop). + * @param array $args Override the defaults. + * @return array + */ +function get_the_taxonomies($post = 0, $args = array() ) { + if ( is_int($post) ) + $post =& get_post($post); + elseif ( !is_object($post) ) + $post =& $GLOBALS['post']; + + $args = wp_parse_args( $args, array( + 'template' => '%s: %l.', + ) ); + extract( $args, EXTR_SKIP ); + + $taxonomies = array(); + + if ( !$post ) + return $taxonomies; + + 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.5.0 + * @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); +} + +/** + * Determine if the given object is associated with any of the given terms. + * + * The given terms are checked against the object's terms' term_ids, names and slugs. + * Terms given as integers will only be checked against the object's terms' term_ids. + * If no terms are given, determines if object is associated with any terms in the given taxonomy. + * + * @since 2.7.0 + * @uses get_object_term_cache() + * @uses wp_get_object_terms() + * + * @param int $object_id ID of the object (post ID, link ID, ...) + * @param string $taxonomy Single taxonomy name + * @param int|string|array $terms Optional. Term term_id, name, slug or array of said + * @return bool|WP_Error. WP_Error on input error. + */ +function is_object_in_term( $object_id, $taxonomy, $terms = null ) { + if ( !$object_id = (int) $object_id ) + return new WP_Error( 'invalid_object', __( 'Invalid object ID' ) ); + + $object_terms = get_object_term_cache( $object_id, $taxonomy ); + if ( empty( $object_terms ) ) + $object_terms = wp_get_object_terms( $object_id, $taxonomy ); + + if ( is_wp_error( $object_terms ) ) + return $object_terms; + if ( empty( $object_terms ) ) + return false; + if ( empty( $terms ) ) + return ( !empty( $object_terms ) ); + + $terms = (array) $terms; + + if ( $ints = array_filter( $terms, 'is_int' ) ) + $strs = array_diff( $terms, $ints ); + else + $strs =& $terms; + + foreach ( $object_terms as $object_term ) { + if ( $ints && in_array( $object_term->term_id, $ints ) ) return true; // If int, check against term_id + if ( $strs ) { + if ( in_array( $object_term->term_id, $strs ) ) return true; + if ( in_array( $object_term->name, $strs ) ) return true; + if ( in_array( $object_term->slug, $strs ) ) return true; + } + } + + return false; +} + +/** + * Determine if the given object type is associated with the given taxonomy. + * + * @since 3.0.0 + * @uses get_object_taxonomies() + * + * @param string $object_type Object type string + * @param string $taxonomy Single taxonomy name + * @return bool True if object is associated with the taxonomy, otherwise false. + */ +function is_object_in_taxonomy($object_type, $taxonomy) { + $taxonomies = get_object_taxonomies($object_type); + + if ( empty($taxonomies) ) + return false; + + if ( in_array($taxonomy, $taxonomies) ) + return true; + + return false; +} + +/** + * Get an array of ancestor IDs for a given object. + * + * @param int $object_id The ID of the object + * @param string $object_type The type of object for which we'll be retrieving ancestors. + * @return array of ancestors from lowest to highest in the hierarchy. + */ +function get_ancestors($object_id = 0, $object_type = '') { + $object_id = (int) $object_id; + + $ancestors = array(); + + if ( empty( $object_id ) ) { + return apply_filters('get_ancestors', $ancestors, $object_id, $object_type); + } + + if ( is_taxonomy_hierarchical( $object_type ) ) { + $term = get_term($object_id, $object_type); + while ( ! is_wp_error($term) && ! empty( $term->parent ) && ! in_array( $term->parent, $ancestors ) ) { + $ancestors[] = (int) $term->parent; + $term = get_term($term->parent, $object_type); + } + } elseif ( null !== get_post_type_object( $object_type ) ) { + $object = get_post($object_id); + if ( ! is_wp_error( $object ) && isset( $object->ancestors ) && is_array( $object->ancestors ) ) + $ancestors = $object->ancestors; + else { + while ( ! is_wp_error($object) && ! empty( $object->post_parent ) && ! in_array( $object->post_parent, $ancestors ) ) { + $ancestors[] = (int) $object->post_parent; + $object = get_post($object->post_parent); + } + } + } + + return apply_filters('get_ancestors', $ancestors, $object_id, $object_type); +} + +/** + * Returns the term's parent's term_ID + * + * @since 3.1.0 + * + * @param int $term_id + * @param string $taxonomy + * + * @return int|bool false on error + */ +function wp_get_term_taxonomy_parent_id( $term_id, $taxonomy ) { + $term = get_term( $term_id, $taxonomy ); + if ( !$term || is_wp_error( $term ) ) + return false; + return (int) $term->parent; +} + +/** + * Checks the given subset of the term hierarchy for hierarchy loops. + * Prevents loops from forming and breaks those that it finds. + * + * Attached to the wp_update_term_parent filter. + * + * @since 3.1.0 + * @uses wp_find_hierarchy_loop() + * + * @param int $parent term_id of the parent for the term we're checking. + * @param int $term_id The term we're checking. + * @param string $taxonomy The taxonomy of the term we're checking. + * + * @return int The new parent for the term. + */ +function wp_check_term_hierarchy_for_loops( $parent, $term_id, $taxonomy ) { + // Nothing fancy here - bail + if ( !$parent ) + return 0; + + // Can't be its own parent + if ( $parent == $term_id ) + return 0; + + // Now look for larger loops + + if ( !$loop = wp_find_hierarchy_loop( 'wp_get_term_taxonomy_parent_id', $term_id, $parent, array( $taxonomy ) ) ) + return $parent; // No loop + + // Setting $parent to the given value causes a loop + if ( isset( $loop[$term_id] ) ) + return 0; + + // There's a loop, but it doesn't contain $term_id. Break the loop. + foreach ( array_keys( $loop ) as $loop_member ) + wp_update_term( $loop_member, $taxonomy, array( 'parent' => 0 ) ); + + return $parent; +} diff --git a/src/wp-includes/template-loader.php b/src/wp-includes/template-loader.php new file mode 100644 index 0000000..7c72a05 --- /dev/null +++ b/src/wp-includes/template-loader.php @@ -0,0 +1,47 @@ + diff --git a/src/wp-includes/theme-compat/comments-popup.php b/src/wp-includes/theme-compat/comments-popup.php new file mode 100644 index 0000000..12ad736 --- /dev/null +++ b/src/wp-includes/theme-compat/comments-popup.php @@ -0,0 +1,129 @@ + + + + <?php printf(__('%1$s - Comments on %2$s'), get_option('blogname'), the_title('','',false)); ?> + + + + + + + +

          + + +

          + +

          RSS feed for comments on this post.'); ?>

          + + +

          URL to TrackBack this entry is: %s'), get_trackback_url()); ?>

          + + + + + +
            + +
          1. + +

            %4$s'), get_comment_author_link(), get_comment_date(), get_comment_ID(), get_comment_time()); ?>

            +
          2. + + +
          + +

          + + + +

          +

          HTML allowed: %s'), allowed_tags()); ?>

          + +
          + +

          %2$s. Log out »'), get_option('siteurl') . '/wp-admin/profile.php', $user_identity, wp_logout_url(get_permalink())); ?>

          + +

          + + +

          + +

          + + +

          + +

          + + +

          + + +

          + +
          + +

          + +

          + + " /> + +

          + ID); ?> +
          + +

          + + +
          + + +

          + + + +

          WordPress'), 'http://wordpress.org/'); ?>

          + + + + diff --git a/src/wp-includes/theme-compat/comments.php b/src/wp-includes/theme-compat/comments.php new file mode 100644 index 0000000..c6fbb7f --- /dev/null +++ b/src/wp-includes/theme-compat/comments.php @@ -0,0 +1,102 @@ + +

          + + + + + +

          + + + +
            + +
          + + + + + + + + + +

          + + + + + + + +
          + +

          + +
          + +
          + + +

          logged in to post a comment.'), wp_login_url( get_permalink() )); ?>

          + + +
          + + + +

          %2$s.'), get_option('siteurl') . '/wp-admin/profile.php', $user_identity); ?>

          + + + +

          /> +

          + +

          /> +

          + +

          +

          + + + + + +

          + +

          + +

          +ID); ?> + +
          + + +
          + + diff --git a/src/wp-includes/theme-compat/footer.php b/src/wp-includes/theme-compat/footer.php new file mode 100644 index 0000000..0e987ed --- /dev/null +++ b/src/wp-includes/theme-compat/footer.php @@ -0,0 +1,30 @@ + + +
          + + + + + + + + + diff --git a/src/wp-includes/theme-compat/header.php b/src/wp-includes/theme-compat/header.php new file mode 100644 index 0000000..7abaa02 --- /dev/null +++ b/src/wp-includes/theme-compat/header.php @@ -0,0 +1,50 @@ + + +> + + + + +<?php wp_title('«', true, 'right'); ?> <?php bloginfo('name'); ?> + + + + + + + + + + +> +
          + + + +
          diff --git a/src/wp-includes/theme-compat/sidebar.php b/src/wp-includes/theme-compat/sidebar.php new file mode 100644 index 0000000..9c8cf5b --- /dev/null +++ b/src/wp-includes/theme-compat/sidebar.php @@ -0,0 +1,84 @@ + + + diff --git a/src/wp-includes/theme.php b/src/wp-includes/theme.php new file mode 100644 index 0000000..78d9739 --- /dev/null +++ b/src/wp-includes/theme.php @@ -0,0 +1,1985 @@ +text_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); +} + +/** + * Retrieve name of the current theme. + * + * @since 1.5.0 + * @uses apply_filters() Calls 'template' filter on template option. + * + * @return string Template name. + */ +function get_template() { + return apply_filters('template', get_option('template')); +} + +/** + * Retrieve current theme directory. + * + * @since 1.5.0 + * @uses apply_filters() Calls 'template_directory' filter on template directory path and template name. + * + * @return string Template directory path. + */ +function get_template_directory() { + $template = get_template(); + $theme_root = get_theme_root( $template ); + $template_dir = "$theme_root/$template"; + + return apply_filters( 'template_directory', $template_dir, $template, $theme_root ); +} + +/** + * Retrieve theme directory URI. + * + * @since 1.5.0 + * @uses apply_filters() Calls 'template_directory_uri' filter on template directory URI path and template name. + * + * @return string Template directory URI. + */ +function get_template_directory_uri() { + $template = get_template(); + $theme_root_uri = get_theme_root_uri( $template ); + $template_dir_uri = "$theme_root_uri/$template"; + + return apply_filters( 'template_directory_uri', $template_dir_uri, $template, $theme_root_uri ); +} + +/** + * Retrieve theme data from parsed theme file. + * + * The description will have the tags filtered with the following HTML elements + * whitelisted. The 'a' element with the href and title + * attributes. The abbr element with the title attribute. The + * acronym element with the title attribute allowed. The + * code, em, and strong elements also allowed. + * + * The style.css file must contain theme name, theme URI, and description. The + * data can also contain author URI, author, template (parent template), + * version, status, and finally tags. Some of these are not used by WordPress + * administration panels, but are used by theme directory web sites which list + * the theme. + * + * @since 1.5.0 + * + * @param string $theme_file Theme file path. + * @return array Theme data. + */ +function get_theme_data( $theme_file ) { + $default_headers = array( + 'Name' => 'Theme Name', + 'URI' => 'Theme URI', + 'Description' => 'Description', + 'Author' => 'Author', + 'AuthorURI' => 'Author URI', + 'Version' => 'Version', + 'Template' => 'Template', + 'Status' => 'Status', + 'Tags' => 'Tags' + ); + + $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 = get_file_data( $theme_file, $default_headers, 'theme' ); + + $theme_data['Name'] = $theme_data['Title'] = wp_kses( $theme_data['Name'], $themes_allowed_tags ); + + $theme_data['URI'] = esc_url( $theme_data['URI'] ); + + $theme_data['Description'] = wptexturize( wp_kses( $theme_data['Description'], $themes_allowed_tags ) ); + + $theme_data['AuthorURI'] = esc_url( $theme_data['AuthorURI'] ); + + $theme_data['Template'] = wp_kses( $theme_data['Template'], $themes_allowed_tags ); + + $theme_data['Version'] = wp_kses( $theme_data['Version'], $themes_allowed_tags ); + + if ( $theme_data['Status'] == '' ) + $theme_data['Status'] = 'publish'; + else + $theme_data['Status'] = wp_kses( $theme_data['Status'], $themes_allowed_tags ); + + if ( $theme_data['Tags'] == '' ) + $theme_data['Tags'] = array(); + else + $theme_data['Tags'] = array_map( 'trim', explode( ',', wp_kses( $theme_data['Tags'], array() ) ) ); + + if ( $theme_data['Author'] == '' ) { + $theme_data['Author'] = $theme_data['AuthorName'] = __('Anonymous'); + } else { + $theme_data['AuthorName'] = wp_kses( $theme_data['Author'], $themes_allowed_tags ); + if ( empty( $theme_data['AuthorURI'] ) ) { + $theme_data['Author'] = $theme_data['AuthorName']; + } else { + $theme_data['Author'] = sprintf( '%3$s', $theme_data['AuthorURI'], esc_attr__( 'Visit author homepage' ), $theme_data['AuthorName'] ); + } + } + + return $theme_data; +} + +/** + * Retrieve list of themes with theme data in theme directory. + * + * The theme is broken, if it doesn't have a parent theme and is missing either + * style.css and, or index.php. If the theme has a parent theme then it is + * broken, if it is missing style.css; index.php is optional. The broken theme + * list is saved in the {@link $wp_broken_themes} global, which is displayed on + * the theme list in the administration panels. + * + * @since 1.5.0 + * @global array $wp_broken_themes Stores the broken themes. + * @global array $wp_themes Stores the working themes. + * + * @return array Theme list with theme data. + */ +function get_themes() { + global $wp_themes, $wp_broken_themes; + + if ( isset($wp_themes) ) + return $wp_themes; + + if ( !$theme_files = search_theme_directories() ) + return false; + + asort( $theme_files ); + + $wp_themes = array(); + + foreach ( (array) $theme_files as $theme_file ) { + $theme_root = $theme_file['theme_root']; + $theme_file = $theme_file['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; + } + + $parent_template = $template; + + if ( empty($template) ) { + if ( file_exists("$theme_root/$stylesheet/index.php") ) + $template = $stylesheet; + 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"; + $template_directory = "$theme_root/$template"; + } else { + /** + * The parent theme doesn't exist in the current theme's folder or sub folder + * so lets use the theme root for the parent template. + */ + if ( isset($theme_files[$template]) && file_exists( $theme_files[$template]['theme_root'] . "/$template/index.php" ) ) { + $template_directory = $theme_files[$template]['theme_root'] . "/$template"; + } else { + if ( empty( $parent_template) ) + $wp_broken_themes[$name] = array('Name' => $name, 'Title' => $title, 'Description' => __('Template is missing.'), 'error' => 'no_template'); + else + $wp_broken_themes[$name] = array('Name' => $name, 'Title' => $title, 'Description' => sprintf( __('The parent theme is missing. Please install the "%s" parent theme.'), $parent_template ), 'error' => 'no_parent', 'parent' => $parent_template ); + continue; + } + + } + } else { + $template_directory = trim( $theme_root . '/' . $template ); + } + + $stylesheet_files = array(); + $template_files = array(); + + $stylesheet_dir = @ dir("$theme_root/$stylesheet"); + if ( $stylesheet_dir ) { + while ( ($file = $stylesheet_dir->read()) !== false ) { + if ( !preg_match('|^\.+$|', $file) ) { + if ( preg_match('|\.css$|', $file) ) + $stylesheet_files[] = "$theme_root/$stylesheet/$file"; + elseif ( preg_match('|\.php$|', $file) ) + $template_files[] = "$theme_root/$stylesheet/$file"; + } + } + @ $stylesheet_dir->close(); + } + + $template_dir = @ dir("$template_directory"); + if ( $template_dir ) { + while ( ($file = $template_dir->read()) !== false ) { + if ( preg_match('|^\.+$|', $file) ) + continue; + if ( preg_match('|\.php$|', $file) ) { + $template_files[] = "$template_directory/$file"; + } elseif ( is_dir("$template_directory/$file") ) { + $template_subdir = @ dir("$template_directory/$file"); + if ( !$template_subdir ) + continue; + while ( ($subfile = $template_subdir->read()) !== false ) { + if ( preg_match('|^\.+$|', $subfile) ) + continue; + if ( preg_match('|\.php$|', $subfile) ) + $template_files[] = "$template_directory/$file/$subfile"; + } + @ $template_subdir->close(); + } + } + @ $template_dir->close(); + } + + //Make unique and remove duplicates when stylesheet and template are the same i.e. most themes + $template_files = array_unique($template_files); + $stylesheet_files = array_unique($stylesheet_files); + + $template_dir = $template_directory; + $stylesheet_dir = $theme_root . '/' . $stylesheet; + + 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 Twenty Eleven, Twenty Ten, Default and Classic themes always trump + // their pretenders. + if ( isset($wp_themes[$name]) ) { + $trump_cards = array( + 'classic' => 'WordPress Classic', + 'default' => 'WordPress Default', + 'twentyten' => 'Twenty Ten', + 'twentyeleven' => 'Twenty Eleven', + ); + if ( isset( $trump_cards[ $stylesheet ] ) && $name == $trump_cards[ $stylesheet ] ) { + // If another theme has claimed to be one of our default themes, move + // them aside. + $suffix = $wp_themes[$name]['Stylesheet']; + $new_name = "$name/$suffix"; + $wp_themes[$new_name] = $wp_themes[$name]; + $wp_themes[$new_name]['Name'] = $new_name; + } else { + $name = "$name/$stylesheet"; + } + } + + $theme_roots[$stylesheet] = str_replace( WP_CONTENT_DIR, '', $theme_root ); + $wp_themes[$name] = array( + 'Name' => $name, + 'Title' => $title, + 'Description' => $description, + 'Author' => $author, + 'Author Name' => $theme_data['AuthorName'], + 'Author URI' => $theme_data['AuthorURI'], + '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'], + 'Theme Root' => $theme_root, + 'Theme Root URI' => str_replace( WP_CONTENT_DIR, content_url(), $theme_root ), + ); + } + + unset($theme_files); + + /* Store theme roots in the DB */ + if ( get_site_transient( 'theme_roots' ) != $theme_roots ) + set_site_transient( 'theme_roots', $theme_roots, 7200 ); // cache for two hours + unset($theme_roots); + + /* Resolve theme dependencies. */ + $theme_names = array_keys( $wp_themes ); + foreach ( (array) $theme_names as $theme_name ) { + $wp_themes[$theme_name]['Parent Theme'] = ''; + if ( $wp_themes[$theme_name]['Stylesheet'] != $wp_themes[$theme_name]['Template'] ) { + foreach ( (array) $theme_names as $parent_theme_name ) { + if ( ($wp_themes[$parent_theme_name]['Stylesheet'] == $wp_themes[$parent_theme_name]['Template']) && ($wp_themes[$parent_theme_name]['Template'] == $wp_themes[$theme_name]['Template']) ) { + $wp_themes[$theme_name]['Parent Theme'] = $wp_themes[$parent_theme_name]['Name']; + break; + } + } + } + } + + return $wp_themes; +} + +/** + * Retrieve theme roots. + * + * @since 2.9.0 + * + * @return array|string An arry of theme roots keyed by template/stylesheet or a single theme root if all themes have the same root. + */ +function get_theme_roots() { + global $wp_theme_directories; + + if ( count($wp_theme_directories) <= 1 ) + return '/themes'; + + $theme_roots = get_site_transient( 'theme_roots' ); + if ( false === $theme_roots ) { + get_themes(); + $theme_roots = get_site_transient( 'theme_roots' ); // this is set in get_theme() + } + return $theme_roots; +} + +/** + * Retrieve theme data. + * + * @since 1.5.0 + * + * @param string $theme Theme name. + * @return array|null Null, if theme name does not exist. Theme data, if exists. + */ +function get_theme($theme) { + $themes = get_themes(); + + if ( array_key_exists($theme, $themes) ) + return $themes[$theme]; + + return null; +} + +/** + * Retrieve current theme display name. + * + * If the 'current_theme' option has already been set, then it will be returned + * instead. If it is not set, then each theme will be iterated over until both + * the current stylesheet and current template name. + * + * @since 1.5.0 + * + * @return string + */ +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 = 'Twenty Ten'; + + 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; +} + +/** + * Register a directory that contains themes. + * + * @since 2.9.0 + * + * @param string $directory Either the full filesystem path to a theme folder or a folder within WP_CONTENT_DIR + * @return bool + */ +function register_theme_directory( $directory) { + global $wp_theme_directories; + + /* If this folder does not exist, return and do not register */ + if ( !file_exists( $directory ) ) + /* Try prepending as the theme directory could be relative to the content directory */ + $registered_directory = WP_CONTENT_DIR . '/' . $directory; + else + $registered_directory = $directory; + + /* If this folder does not exist, return and do not register */ + if ( !file_exists( $registered_directory ) ) + return false; + + $wp_theme_directories[] = $registered_directory; + + return true; +} + +/** + * Search all registered theme directories for complete and valid themes. + * + * @since 2.9.0 + * + * @return array Valid themes found + */ +function search_theme_directories() { + global $wp_theme_directories, $wp_broken_themes; + if ( empty( $wp_theme_directories ) ) + return false; + + $theme_files = array(); + $wp_broken_themes = array(); + + /* Loop the registered theme directories and extract all themes */ + foreach ( (array) $wp_theme_directories as $theme_root ) { + $theme_loc = $theme_root; + + /* We don't want to replace all forward slashes, see Trac #4541 */ + if ( '/' != WP_CONTENT_DIR ) + $theme_loc = str_replace(WP_CONTENT_DIR, '', $theme_root); + + /* Files in the root of the current theme 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 == '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] = array( 'theme_file' => $theme_dir . '/' . $theme_file, 'theme_root' => $theme_root ); + $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_subdirs = @opendir( $subdir ); + + $found_subdir_themes = false; + while ( ($theme_subdir = readdir($theme_subdirs)) !== false ) { + if ( is_dir( $subdir . '/' . $theme_subdir) && is_readable($subdir . '/' . $theme_subdir) ) { + if ( $theme_subdir[0] == '.' || $theme_subdir == 'CVS' ) + continue; + + $stylish_dir = @opendir($subdir . '/' . $theme_subdir); + $found_stylesheet = false; + + while ( ($theme_file = readdir($stylish_dir)) !== false ) { + if ( $theme_file == 'style.css' ) { + $theme_files["$theme_dir/$theme_subdir"] = array( 'theme_file' => $subdir_name . '/' . $theme_subdir . '/' . $theme_file, 'theme_root' => $theme_root ); + $found_stylesheet = true; + $found_subdir_themes = true; + break; + } + } + @closedir($stylish_dir); + } + } + @closedir($theme_subdirs); + if ( !$found_subdir_themes ) + $wp_broken_themes[$theme_dir] = array('Name' => $theme_dir, 'Title' => $theme_dir, 'Description' => __('Stylesheet is missing.')); + } + } + } + @closedir( $themes_dir ); + } + return $theme_files; +} + +/** + * Retrieve path to themes directory. + * + * Does not have trailing slash. + * + * @since 1.5.0 + * @uses apply_filters() Calls 'theme_root' filter on path. + * + * @param string $stylesheet_or_template The stylesheet or template name of the theme + * @return string Theme path. + */ +function get_theme_root( $stylesheet_or_template = false ) { + if ( $stylesheet_or_template ) { + if ( $theme_root = get_raw_theme_root($stylesheet_or_template) ) + $theme_root = WP_CONTENT_DIR . $theme_root; + else + $theme_root = WP_CONTENT_DIR . '/themes'; + } else { + $theme_root = WP_CONTENT_DIR . '/themes'; + } + + return apply_filters( 'theme_root', $theme_root ); +} + +/** + * Retrieve URI for themes directory. + * + * Does not have trailing slash. + * + * @since 1.5.0 + * + * @param string $stylesheet_or_template The stylesheet or template name of the theme + * @return string Themes URI. + */ +function get_theme_root_uri( $stylesheet_or_template = false ) { + if ( $stylesheet_or_template ) { + if ( $theme_root = get_raw_theme_root($stylesheet_or_template) ) + $theme_root_uri = content_url( $theme_root ); + else + $theme_root_uri = content_url( 'themes' ); + } else { + $theme_root_uri = content_url( 'themes' ); + } + + return apply_filters( 'theme_root_uri', $theme_root_uri, get_option('siteurl'), $stylesheet_or_template ); +} + +/** + * Get the raw theme root relative to the content directory with no filters applied. + * + * @since 3.1.0 + * + * @param string $stylesheet_or_template The stylesheet or template name of the theme + * @return string Theme root + */ +function get_raw_theme_root( $stylesheet_or_template, $no_cache = false ) { + global $wp_theme_directories; + + if ( count($wp_theme_directories) <= 1 ) + return '/themes'; + + $theme_root = false; + + // If requesting the root for the current theme, consult options to avoid calling get_theme_roots() + if ( !$no_cache ) { + if ( get_option('stylesheet') == $stylesheet_or_template ) + $theme_root = get_option('stylesheet_root'); + elseif ( get_option('template') == $stylesheet_or_template ) + $theme_root = get_option('template_root'); + } + + if ( empty($theme_root) ) { + $theme_roots = get_theme_roots(); + if ( !empty($theme_roots[$stylesheet_or_template]) ) + $theme_root = $theme_roots[$stylesheet_or_template]; + } + + return $theme_root; +} + +/** + * Retrieve path to a template + * + * Used to quickly retrieve the path of a template without including the file + * extension. It will also check the parent theme, if the file exists, with + * the use of {@link locate_template()}. Allows for more generic template location + * without the use of the other get_*_template() functions. + * + * @since 1.5.0 + * + * @param string $type Filename without extension. + * @param array $templates An optional list of template candidates + * @return string Full path to file. + */ +function get_query_template( $type, $templates = array() ) { + $type = preg_replace( '|[^a-z0-9-]+|', '', $type ); + + if ( empty( $templates ) ) + $templates = array("{$type}.php"); + + return apply_filters( "{$type}_template", locate_template( $templates ) ); +} + +/** + * Retrieve path of index template in current or parent template. + * + * @since 3.0.0 + * + * @return string + */ +function get_index_template() { + return get_query_template('index'); +} + +/** + * Retrieve path of 404 template in current or parent template. + * + * @since 1.5.0 + * + * @return string + */ +function get_404_template() { + return get_query_template('404'); +} + +/** + * Retrieve path of archive template in current or parent template. + * + * @since 1.5.0 + * + * @return string + */ +function get_archive_template() { + $post_type = get_query_var( 'post_type' ); + + $templates = array(); + + if ( $post_type ) + $templates[] = "archive-{$post_type}.php"; + $templates[] = 'archive.php'; + + return get_query_template( 'archive', $templates ); +} + +/** + * Retrieve path of author template in current or parent template. + * + * @since 1.5.0 + * + * @return string + */ +function get_author_template() { + $author = get_queried_object(); + + $templates = array(); + + $templates[] = "author-{$author->user_nicename}.php"; + $templates[] = "author-{$author->ID}.php"; + $templates[] = 'author.php'; + + return get_query_template( 'author', $templates ); +} + +/** + * Retrieve path of category template in current or parent template. + * + * Works by first retrieving the current slug for example 'category-default.php' and then + * trying category ID, for example 'category-1.php' and will finally fallback to category.php + * template, if those files don't exist. + * + * @since 1.5.0 + * @uses apply_filters() Calls 'category_template' on file path of category template. + * + * @return string + */ +function get_category_template() { + $category = get_queried_object(); + + $templates = array(); + + $templates[] = "category-{$category->slug}.php"; + $templates[] = "category-{$category->term_id}.php"; + $templates[] = 'category.php'; + + return get_query_template( 'category', $templates ); +} + +/** + * Retrieve path of tag template in current or parent template. + * + * Works by first retrieving the current tag name, for example 'tag-wordpress.php' and then + * trying tag ID, for example 'tag-1.php' and will finally fallback to tag.php + * template, if those files don't exist. + * + * @since 2.3.0 + * @uses apply_filters() Calls 'tag_template' on file path of tag template. + * + * @return string + */ +function get_tag_template() { + $tag = get_queried_object(); + + $templates = array(); + + $templates[] = "tag-{$tag->slug}.php"; + $templates[] = "tag-{$tag->term_id}.php"; + $templates[] = 'tag.php'; + + return get_query_template( 'tag', $templates ); +} + +/** + * Retrieve path of taxonomy template in current or parent template. + * + * Retrieves the taxonomy and term, if term is available. The template is + * prepended with 'taxonomy-' and followed by both the taxonomy string and + * the taxonomy string followed by a dash and then followed by the term. + * + * The taxonomy and term template is checked and used first, if it exists. + * Second, just the taxonomy template is checked, and then finally, taxonomy.php + * template is used. If none of the files exist, then it will fall back on to + * index.php. + * + * @since 2.5.0 + * @uses apply_filters() Calls 'taxonomy_template' filter on found path. + * + * @return string + */ +function get_taxonomy_template() { + $term = get_queried_object(); + $taxonomy = $term->taxonomy; + + $templates = array(); + + $templates[] = "taxonomy-$taxonomy-{$term->slug}.php"; + $templates[] = "taxonomy-$taxonomy.php"; + $templates[] = 'taxonomy.php'; + + return get_query_template( 'taxonomy', $templates ); +} + +/** + * Retrieve path of date template in current or parent template. + * + * @since 1.5.0 + * + * @return string + */ +function get_date_template() { + return get_query_template('date'); +} + +/** + * Retrieve path of home template in current or parent template. + * + * This is the template used for the page containing the blog posts + * + * Attempts to locate 'home.php' first before falling back to 'index.php'. + * + * @since 1.5.0 + * @uses apply_filters() Calls 'home_template' on file path of home template. + * + * @return string + */ +function get_home_template() { + $templates = array( 'home.php', 'index.php' ); + + return get_query_template( 'home', $templates ); +} + +/** + * Retrieve path of front-page template in current or parent template. + * + * Looks for 'front-page.php'. + * + * @since 3.0.0 + * @uses apply_filters() Calls 'front_page_template' on file path of template. + * + * @return string + */ +function get_front_page_template() { + $templates = array('front-page.php'); + + return get_query_template( 'front_page', $templates ); +} + +/** + * Retrieve path of page template in current or parent template. + * + * Will first look for the specifically assigned page template + * The will search for 'page-{slug}.php' followed by 'page-id.php' + * and finally 'page.php' + * + * @since 1.5.0 + * + * @return string + */ +function get_page_template() { + $id = get_queried_object_id(); + $template = get_post_meta($id, '_wp_page_template', true); + $pagename = get_query_var('pagename'); + + if ( !$pagename && $id > 0 ) { + // If a static page is set as the front page, $pagename will not be set. Retrieve it from the queried object + $post = get_queried_object(); + $pagename = $post->post_name; + } + + if ( 'default' == $template ) + $template = ''; + + $templates = array(); + if ( !empty($template) && !validate_file($template) ) + $templates[] = $template; + if ( $pagename ) + $templates[] = "page-$pagename.php"; + if ( $id ) + $templates[] = "page-$id.php"; + $templates[] = 'page.php'; + + return get_query_template( 'page', $templates ); +} + +/** + * Retrieve path of paged template in current or parent template. + * + * @since 1.5.0 + * + * @return string + */ +function get_paged_template() { + return get_query_template('paged'); +} + +/** + * Retrieve path of search template in current or parent template. + * + * @since 1.5.0 + * + * @return string + */ +function get_search_template() { + return get_query_template('search'); +} + +/** + * Retrieve path of single template in current or parent template. + * + * @since 1.5.0 + * + * @return string + */ +function get_single_template() { + $object = get_queried_object(); + + $templates = array(); + + $templates[] = "single-{$object->post_type}.php"; + $templates[] = "single.php"; + + return get_query_template( 'single', $templates ); +} + +/** + * Retrieve path of attachment template in current or parent template. + * + * The attachment path first checks if the first part of the mime type exists. + * The second check is for the second part of the mime type. The last check is + * for both types separated by an underscore. If neither are found then the file + * 'attachment.php' is checked and returned. + * + * Some examples for the 'text/plain' mime type are 'text.php', 'plain.php', and + * finally 'text_plain.php'. + * + * @since 2.0.0 + * + * @return string + */ +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'); +} + +/** + * Retrieve path of comment popup template in current or parent template. + * + * Checks for comment popup template in current template, if it exists or in the + * parent template. + * + * @since 1.5.0 + * @uses apply_filters() Calls 'comments_popup_template' filter on path. + * + * @return string + */ +function get_comments_popup_template() { + $template = get_query_template( 'comments_popup', array( 'comments-popup.php' ) ); + + // Backward compat code will be removed in a future release + if ('' == $template) + $template = ABSPATH . WPINC . '/theme-compat/comments-popup.php'; + + return $template; +} + +/** + * Retrieve the name of the highest priority template file that exists. + * + * Searches in the STYLESHEETPATH before TEMPLATEPATH so that themes which + * inherit from a parent theme can just overload one file. + * + * @since 2.7.0 + * + * @param string|array $template_names Template file(s) to search for, in order. + * @param bool $load If true the template file will be loaded if it is found. + * @param bool $require_once Whether to require_once or require. Default true. Has no effect if $load is false. + * @return string The template filename if one is located. + */ +function locate_template($template_names, $load = false, $require_once = true ) { + $located = ''; + foreach ( (array) $template_names as $template_name ) { + if ( !$template_name ) + continue; + if ( file_exists(STYLESHEETPATH . '/' . $template_name)) { + $located = STYLESHEETPATH . '/' . $template_name; + break; + } else if ( file_exists(TEMPLATEPATH . '/' . $template_name) ) { + $located = TEMPLATEPATH . '/' . $template_name; + break; + } + } + + if ( $load && '' != $located ) + load_template( $located, $require_once ); + + return $located; +} + +/** + * Require the template file with WordPress environment. + * + * The globals are set up for the template file to ensure that the WordPress + * environment is available from within the function. The query variables are + * also available. + * + * @since 1.5.0 + * + * @param string $_template_file Path to template file. + * @param bool $require_once Whether to require_once or require. Default true. + */ +function load_template( $_template_file, $require_once = true ) { + 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 ); + + if ( $require_once ) + require_once( $_template_file ); + else + require( $_template_file ); +} + +/** + * Display localized stylesheet link element. + * + * @since 2.1.0 + */ +function locale_stylesheet() { + $stylesheet = get_locale_stylesheet_uri(); + if ( empty($stylesheet) ) + return; + echo ''; +} + +/** + * Start preview theme output buffer. + * + * Will only preform task if the user has permissions and template and preview + * query variables exist. + * + * @since 2.6.0 + */ +function preview_theme() { + if ( ! (isset($_GET['template']) && isset($_GET['preview'])) ) + return; + + if ( !current_user_can( 'switch_themes' ) ) + return; + + // Admin Thickbox requests + if ( isset( $_GET['preview_iframe'] ) ) + show_admin_bar( false ); + + $_GET['template'] = preg_replace('|[^a-z0-9_./-]|i', '', $_GET['template']); + + if ( validate_file($_GET['template']) ) + return; + + add_filter( 'template', '_preview_theme_template_filter' ); + + if ( isset($_GET['stylesheet']) ) { + $_GET['stylesheet'] = preg_replace('|[^a-z0-9_./-]|i', '', $_GET['stylesheet']); + if ( validate_file($_GET['stylesheet']) ) + return; + add_filter( 'stylesheet', '_preview_theme_stylesheet_filter' ); + } + + // Prevent theme mods to current theme being used on theme being previewed + add_filter( 'pre_option_mods_' . get_current_theme(), '__return_empty_array' ); + + ob_start( 'preview_theme_ob_filter' ); +} +add_action('setup_theme', 'preview_theme'); + +/** + * Private function to modify the current template when previewing a theme + * + * @since 2.9.0 + * @access private + * + * @return string + */ +function _preview_theme_template_filter() { + return isset($_GET['template']) ? $_GET['template'] : ''; +} + +/** + * Private function to modify the current stylesheet when previewing a theme + * + * @since 2.9.0 + * @access private + * + * @return string + */ +function _preview_theme_stylesheet_filter() { + return isset($_GET['stylesheet']) ? $_GET['stylesheet'] : ''; +} + +/** + * Callback function for ob_start() to capture all links in the theme. + * + * @since 2.6.0 + * @access private + * + * @param string $content + * @return string + */ +function preview_theme_ob_filter( $content ) { + return preg_replace_callback( "|()|", 'preview_theme_ob_filter_callback', $content ); +} + +/** + * Manipulates preview theme links in order to control and maintain location. + * + * Callback function for preg_replace_callback() to accept and filter matches. + * + * @since 2.6.0 + * @access private + * + * @param array $matches + * @return string + */ +function preview_theme_ob_filter_callback( $matches ) { + if ( strpos($matches[4], 'onclick') !== false ) + $matches[4] = preg_replace('#onclick=([\'"]).*?(?. (? 1, 'template' => $_GET['template'], 'stylesheet' => @$_GET['stylesheet'] ), $matches[3] ); + if ( 0 === strpos($link, 'preview=1') ) + $link = "?$link"; + return $matches[1] . esc_attr( $link ) . $matches[4]; +} + +/** + * Switches current theme to new template and stylesheet names. + * + * @since 2.5.0 + * @uses do_action() Calls 'switch_theme' action on updated theme display name. + * + * @param string $template Template name + * @param string $stylesheet Stylesheet name. + */ +function switch_theme($template, $stylesheet) { + global $wp_theme_directories; + + update_option('template', $template); + update_option('stylesheet', $stylesheet); + if ( count($wp_theme_directories) > 1 ) { + update_option('template_root', get_raw_theme_root($template, true)); + update_option('stylesheet_root', get_raw_theme_root($stylesheet, true)); + } + delete_option('current_theme'); + $theme = get_current_theme(); + if ( is_admin() && false === get_option( "theme_mods_$stylesheet" ) ) { + $default_theme_mods = (array) get_option( "mods_$theme" ); + add_option( "theme_mods_$stylesheet", $default_theme_mods ); + } + do_action('switch_theme', $theme); +} + +/** + * Checks that current theme files 'index.php' and 'style.css' exists. + * + * Does not check the default theme, which is the fallback and should always exist. + * Will switch theme to the fallback theme if current theme does not validate. + * You can use the 'validate_current_theme' filter to return FALSE to + * disable this functionality. + * + * @since 1.5.0 + * @see WP_DEFAULT_THEME + * + * @return bool + */ +function validate_current_theme() { + // Don't validate during an install/upgrade. + if ( defined('WP_INSTALLING') || !apply_filters( 'validate_current_theme', true ) ) + return true; + + if ( get_template() != WP_DEFAULT_THEME && !file_exists(get_template_directory() . '/index.php') ) { + switch_theme( WP_DEFAULT_THEME, WP_DEFAULT_THEME ); + return false; + } + + if ( get_stylesheet() != WP_DEFAULT_THEME && !file_exists(get_template_directory() . '/style.css') ) { + switch_theme( WP_DEFAULT_THEME, WP_DEFAULT_THEME ); + return false; + } + + if ( is_child_theme() && ! file_exists( get_stylesheet_directory() . '/style.css' ) ) { + switch_theme( WP_DEFAULT_THEME, WP_DEFAULT_THEME ); + return false; + } + + return true; +} + +/** + * Retrieve all theme modifications. + * + * @since 3.1.0 + * + * @return array Theme modifications. + */ +function get_theme_mods() { + $theme_slug = get_option( 'stylesheet' ); + if ( false === ( $mods = get_option( "theme_mods_$theme_slug" ) ) ) { + $theme_name = get_current_theme(); + $mods = get_option( "mods_$theme_name" ); // Deprecated location. + if ( is_admin() && false !== $mods ) { + update_option( "theme_mods_$theme_slug", $mods ); + delete_option( "mods_$theme_name" ); + } + } + return $mods; +} + +/** + * Retrieve theme modification value for the current theme. + * + * If the modification name does not exist, then the $default will be passed + * through {@link http://php.net/sprintf sprintf()} PHP function with the first + * string the template directory URI and the second string the stylesheet + * directory URI. + * + * @since 2.1.0 + * @uses apply_filters() Calls 'theme_mod_$name' filter on the value. + * + * @param string $name Theme modification name. + * @param bool|string $default + * @return string + */ +function get_theme_mod( $name, $default = false ) { + $mods = get_theme_mods(); + + 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() ) ); +} + +/** + * Update theme modification value for the current theme. + * + * @since 2.1.0 + * + * @param string $name Theme modification name. + * @param string $value theme modification value. + */ +function set_theme_mod( $name, $value ) { + $mods = get_theme_mods(); + + $mods[ $name ] = $value; + + $theme = get_option( 'stylesheet' ); + update_option( "theme_mods_$theme", $mods ); +} + +/** + * Remove theme modification name from current theme list. + * + * If removing the name also removes all elements, then the entire option will + * be removed. + * + * @since 2.1.0 + * + * @param string $name Theme modification name. + * @return null + */ +function remove_theme_mod( $name ) { + $mods = get_theme_mods(); + + if ( ! isset( $mods[ $name ] ) ) + return; + + unset( $mods[ $name ] ); + + if ( empty( $mods ) ) + return remove_theme_mods(); + + $theme = get_option( 'stylesheet' ); + update_option( "theme_mods_$theme", $mods ); +} + +/** + * Remove theme modifications option for current theme. + * + * @since 2.1.0 + */ +function remove_theme_mods() { + delete_option( 'theme_mods_' . get_option( 'stylesheet' ) ); + delete_option( 'mods_' . get_current_theme() ); +} + +/** + * Retrieve text color for custom header. + * + * @since 2.1.0 + * @uses HEADER_TEXTCOLOR + * + * @return string + */ +function get_header_textcolor() { + $default = defined('HEADER_TEXTCOLOR') ? HEADER_TEXTCOLOR : ''; + + return get_theme_mod('header_textcolor', $default); +} + +/** + * Display text color for custom header. + * + * @since 2.1.0 + */ +function header_textcolor() { + echo get_header_textcolor(); +} + +/** + * Retrieve header image for custom header. + * + * @since 2.1.0 + * @uses HEADER_IMAGE + * + * @return string + */ +function get_header_image() { + $default = defined( 'HEADER_IMAGE' ) ? HEADER_IMAGE : ''; + $url = get_theme_mod( 'header_image', $default ); + + if ( 'remove-header' == $url ) + return false; + + if ( is_random_header_image() ) + $url = get_random_header_image(); + + if ( is_ssl() ) + $url = str_replace( 'http://', 'https://', $url ); + else + $url = str_replace( 'https://', 'http://', $url ); + + return esc_url_raw( $url ); +} + +/** + * Get random header image from registered images in theme. + * + * @since 3.2.0 + * + * @return string Path to header image + */ +function get_random_header_image() { + global $_wp_default_headers; + + $header_image_mod = get_theme_mod( 'header_image', '' ); + $headers = array(); + + if ( 'random-uploaded-image' == $header_image_mod ) + $headers = get_uploaded_header_images(); + elseif ( ! empty( $_wp_default_headers ) ) { + if ( 'random-default-image' == $header_image_mod ) { + $headers = $_wp_default_headers; + } else { + $is_random = get_theme_support( 'custom-header' ); + if ( isset( $is_random[ 0 ] ) && !empty( $is_random[ 0 ][ 'random-default' ] ) ) + $headers = $_wp_default_headers; + } + } + + if ( empty( $headers ) ) + return ''; + + $random_image = array_rand( $headers ); + $header_url = sprintf( $headers[$random_image]['url'], get_template_directory_uri(), get_stylesheet_directory_uri() ); + + return $header_url; +} + +/** + * Check if random header image is in use. + * + * Always true if user expressly chooses the option in Appearance > Header. + * Also true if theme has multiple header images registered, no specific header image + * is chosen, and theme turns on random headers with add_theme_support(). + * + * @since 3.2.0 + * @uses HEADER_IMAGE + * + * @param string $type The random pool to use. any|default|uploaded + * @return boolean + */ +function is_random_header_image( $type = 'any' ) { + $default = defined( 'HEADER_IMAGE' ) ? HEADER_IMAGE : ''; + $header_image_mod = get_theme_mod( 'header_image', $default ); + + if ( 'any' == $type ) { + if ( 'random-default-image' == $header_image_mod || 'random-uploaded-image' == $header_image_mod || ( '' != get_random_header_image() && empty( $header_image_mod ) ) ) + return true; + } else { + if ( "random-$type-image" == $header_image_mod ) + return true; + elseif ( 'default' == $type && empty( $header_image_mod ) && '' != get_random_header_image() ) + return true; + } + + return false; +} + +/** + * Display header image path. + * + * @since 2.1.0 + */ +function header_image() { + echo get_header_image(); +} + +/** + * Get the header images uploaded for the current theme. + * + * @since 3.2.0 + * + * @return array + */ +function get_uploaded_header_images() { + $header_images = array(); + + // @todo caching + $headers = get_posts( array( 'post_type' => 'attachment', 'meta_key' => '_wp_attachment_is_custom_header', 'meta_value' => get_option('stylesheet'), 'orderby' => 'none', 'nopaging' => true ) ); + + if ( empty( $headers ) ) + return array(); + + foreach ( (array) $headers as $header ) { + $url = esc_url_raw( $header->guid ); + $header = basename($url); + $header_images[$header] = array(); + $header_images[$header]['url'] = $url; + $header_images[$header]['thumbnail_url'] = $url; + $header_images[$header]['uploaded'] = true; + } + + return $header_images; +} + +/** + * Add callbacks for image header display. + * + * The parameter $header_callback callback will be required to display the + * content for the 'wp_head' action. The parameter $admin_header_callback + * callback will be added to Custom_Image_Header class and that will be added + * to the 'admin_menu' action. + * + * @since 2.1.0 + * @uses Custom_Image_Header Sets up for $admin_header_callback for administration panel display. + * + * @param callback $header_callback Call on 'wp_head' action. + * @param callback $admin_header_callback Call on custom header administration screen. + * @param callback $admin_image_div_callback Output a custom header image div on the custom header administration screen. Optional. + */ +function add_custom_image_header( $header_callback, $admin_header_callback, $admin_image_div_callback = '' ) { + if ( ! empty( $header_callback ) ) + add_action('wp_head', $header_callback); + + $support = array( 'callback' => $header_callback ); + $theme_support = get_theme_support( 'custom-header' ); + if ( ! empty( $theme_support ) && is_array( $theme_support[ 0 ] ) ) + $support = array_merge( $theme_support[ 0 ], $support ); + add_theme_support( 'custom-header', $support ); + add_theme_support( 'custom-header-uploads' ); + + if ( ! is_admin() ) + return; + + global $custom_image_header; + + require_once( ABSPATH . 'wp-admin/custom-header.php' ); + $custom_image_header = new Custom_Image_Header( $admin_header_callback, $admin_image_div_callback ); + add_action( 'admin_menu', array( &$custom_image_header, 'init' ) ); +} + +/** + * Remove image header support. + * + * @since 3.1.0 + * @see add_custom_image_header() + * + * @return bool Whether support was removed. + */ +function remove_custom_image_header() { + if ( ! current_theme_supports( 'custom-header' ) ) + return false; + + $callback = get_theme_support( 'custom-header' ); + remove_action( 'wp_head', $callback[0]['callback'] ); + _remove_theme_support( 'custom-header' ); + remove_theme_support( 'custom-header-uploads' ); + + if ( is_admin() ) { + remove_action( 'admin_menu', array( &$GLOBALS['custom_image_header'], 'init' ) ); + unset( $GLOBALS['custom_image_header'] ); + } + + return true; +} + +/** + * Register a selection of default headers to be displayed by the custom header admin UI. + * + * @since 3.0.0 + * + * @param array $headers Array of headers keyed by a string id. The ids point to arrays containing 'url', 'thumbnail_url', and 'description' keys. + */ +function register_default_headers( $headers ) { + global $_wp_default_headers; + + $_wp_default_headers = array_merge( (array) $_wp_default_headers, (array) $headers ); +} + +/** + * Unregister default headers. + * + * This function must be called after register_default_headers() has already added the + * header you want to remove. + * + * @see register_default_headers() + * @since 3.0.0 + * + * @param string|array $header The header string id (key of array) to remove, or an array thereof. + * @return True on success, false on failure. + */ +function unregister_default_headers( $header ) { + global $_wp_default_headers; + if ( is_array( $header ) ) { + array_map( 'unregister_default_headers', $header ); + } elseif ( isset( $_wp_default_headers[ $header ] ) ) { + unset( $_wp_default_headers[ $header ] ); + return true; + } else { + return false; + } +} + +/** + * Retrieve background image for custom background. + * + * @since 3.0.0 + * + * @return string + */ +function get_background_image() { + $default = defined('BACKGROUND_IMAGE') ? BACKGROUND_IMAGE : ''; + + return get_theme_mod('background_image', $default); +} + +/** + * Display background image path. + * + * @since 3.0.0 + */ +function background_image() { + echo get_background_image(); +} + +/** + * Retrieve value for custom background color. + * + * @since 3.0.0 + * @uses BACKGROUND_COLOR + * + * @return string + */ +function get_background_color() { + $default = defined('BACKGROUND_COLOR') ? BACKGROUND_COLOR : ''; + + return get_theme_mod('background_color', $default); +} + +/** + * Display background color value. + * + * @since 3.0.0 + */ +function background_color() { + echo get_background_color(); +} + +/** + * Add callbacks for background image display. + * + * The parameter $header_callback callback will be required to display the + * content for the 'wp_head' action. The parameter $admin_header_callback + * callback will be added to Custom_Background class and that will be added + * to the 'admin_menu' action. + * + * @since 3.0.0 + * @uses Custom_Background Sets up for $admin_header_callback for administration panel display. + * + * @param callback $header_callback Call on 'wp_head' action. + * @param callback $admin_header_callback Call on custom background administration screen. + * @param callback $admin_image_div_callback Output a custom background image div on the custom background administration screen. Optional. + */ +function add_custom_background( $header_callback = '', $admin_header_callback = '', $admin_image_div_callback = '' ) { + if ( isset( $GLOBALS['custom_background'] ) ) + return; + + if ( empty( $header_callback ) ) + $header_callback = '_custom_background_cb'; + + add_action( 'wp_head', $header_callback ); + + add_theme_support( 'custom-background', array( 'callback' => $header_callback ) ); + + if ( ! is_admin() ) + return; + require_once( ABSPATH . 'wp-admin/custom-background.php' ); + $GLOBALS['custom_background'] =& new Custom_Background( $admin_header_callback, $admin_image_div_callback ); + add_action( 'admin_menu', array( &$GLOBALS['custom_background'], 'init' ) ); +} + +/** + * Remove custom background support. + * + * @since 3.1.0 + * @see add_custom_background() + * + * @return bool Whether support was removed. + */ +function remove_custom_background() { + if ( ! current_theme_supports( 'custom-background' ) ) + return false; + + $callback = get_theme_support( 'custom-background' ); + remove_action( 'wp_head', $callback[0]['callback'] ); + _remove_theme_support( 'custom-background' ); + + if ( is_admin() ) { + remove_action( 'admin_menu', array( &$GLOBALS['custom_background'], 'init' ) ); + unset( $GLOBALS['custom_background'] ); + } + + return true; +} + +/** + * Default custom background callback. + * + * @since 3.0.0 + * @see add_custom_background() + * @access protected + */ +function _custom_background_cb() { + $background = get_background_image(); + $color = get_background_color(); + if ( ! $background && ! $color ) + return; + + $style = $color ? "background-color: #$color;" : ''; + + if ( $background ) { + $image = " background-image: url('$background');"; + + $repeat = get_theme_mod( 'background_repeat', 'repeat' ); + if ( ! in_array( $repeat, array( 'no-repeat', 'repeat-x', 'repeat-y', 'repeat' ) ) ) + $repeat = 'repeat'; + $repeat = " background-repeat: $repeat;"; + + $position = get_theme_mod( 'background_position_x', 'left' ); + if ( ! in_array( $position, array( 'center', 'right', 'left' ) ) ) + $position = 'left'; + $position = " background-position: top $position;"; + + $attachment = get_theme_mod( 'background_attachment', 'scroll' ); + if ( ! in_array( $attachment, array( 'fixed', 'scroll' ) ) ) + $attachment = 'scroll'; + $attachment = " background-attachment: $attachment;"; + + $style .= $image . $repeat . $position . $attachment; + } +?> + + diff --git a/src/wp-includes/update.php b/src/wp-includes/update.php new file mode 100644 index 0000000..6cb2337 --- /dev/null +++ b/src/wp-includes/update.php @@ -0,0 +1,366 @@ +updates = array(); + $current->version_checked = $wp_version; + } + + $locale = apply_filters( 'core_version_check_locale', get_locale() ); + + // Update last_checked for current to prevent multiple blocking requests if request hangs + $current->last_checked = time(); + set_site_transient( 'update_core', $current ); + + if ( method_exists( $wpdb, 'db_version' ) ) + $mysql_version = preg_replace('/[^0-9.].*/', '', $wpdb->db_version()); + else + $mysql_version = 'N/A'; + + if ( is_multisite( ) ) { + $user_count = get_user_count( ); + $num_blogs = get_blog_count( ); + $wp_install = network_site_url( ); + $multisite_enabled = 1; + } else { + $user_count = count_users( ); + $multisite_enabled = 0; + $num_blogs = 1; + $wp_install = home_url( '/' ); + } + + $local_package = isset( $wp_local_package )? $wp_local_package : ''; + $url = "http://api.wordpress.org/core/version-check/1.6/?version=$wp_version&php=$php_version&locale=$locale&mysql=$mysql_version&local_package=$local_package&blogs=$num_blogs&users={$user_count['total_users']}&multisite_enabled=$multisite_enabled"; + + $options = array( + 'timeout' => ( ( defined('DOING_CRON') && DOING_CRON ) ? 30 : 3 ), + 'user-agent' => 'WordPress/' . $wp_version . '; ' . home_url( '/' ), + 'headers' => array( + 'wp_install' => $wp_install, + 'wp_blog' => home_url( '/' ) + ) + ); + + $response = wp_remote_get($url, $options); + + if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) ) + return false; + + $body = trim( wp_remote_retrieve_body( $response ) ); + if ( ! $body = maybe_unserialize( $body ) ) + return false; + if ( ! isset( $body['offers'] ) ) + return false; + $offers = $body['offers']; + + foreach ( $offers as &$offer ) { + foreach ( $offer as $offer_key => $value ) { + if ( 'packages' == $offer_key ) + $offer['packages'] = (object) array_intersect_key( array_map( 'esc_url', $offer['packages'] ), + array_fill_keys( array( 'full', 'no_content', 'new_bundled', 'partial' ), '' ) ); + elseif ( 'download' == $offer_key ) + $offer['download'] = esc_url( $value ); + else + $offer[ $offer_key ] = esc_html( $value ); + } + $offer = (object) array_intersect_key( $offer, array_fill_keys( array( 'response', 'download', 'locale', + 'packages', 'current', 'php_version', 'mysql_version', 'new_bundled', 'partial_version' ), '' ) ); + } + + $updates = new stdClass(); + $updates->updates = $offers; + $updates->last_checked = time(); + $updates->version_checked = $wp_version; + set_site_transient( 'update_core', $updates); +} + +/** + * Check plugin versions against the latest versions hosted on WordPress.org. + * + * The WordPress version, PHP version, and Locale is sent along with a list of + * all plugins installed. Checks against the WordPress server at + * api.wordpress.org. Will only check if WordPress isn't installing. + * + * @package WordPress + * @since 2.3.0 + * @uses $wp_version Used to notify the WordPress version. + * + * @return mixed Returns null if update is unsupported. Returns false if check is too soon. + */ +function wp_update_plugins() { + include ABSPATH . WPINC . '/version.php'; // include an unmodified $wp_version + + if ( defined('WP_INSTALLING') ) + return false; + + // If running blog-side, bail unless we've not checked in the last 12 hours + if ( !function_exists( 'get_plugins' ) ) + require_once( ABSPATH . 'wp-admin/includes/plugin.php' ); + + $plugins = get_plugins(); + $active = get_option( 'active_plugins', array() ); + $current = get_site_transient( 'update_plugins' ); + if ( ! is_object($current) ) + $current = new stdClass; + + $new_option = new stdClass; + $new_option->last_checked = time(); + $timeout = 'load-plugins.php' == current_filter() ? 3600 : 43200; //Check for updated every 60 minutes if hitting the themes page, Else, check every 12 hours + $time_not_changed = isset( $current->last_checked ) && $timeout > ( time() - $current->last_checked ); + + $plugin_changed = false; + foreach ( $plugins as $file => $p ) { + $new_option->checked[ $file ] = $p['Version']; + + if ( !isset( $current->checked[ $file ] ) || strval($current->checked[ $file ]) !== strval($p['Version']) ) + $plugin_changed = true; + } + + if ( isset ( $current->response ) && is_array( $current->response ) ) { + foreach ( $current->response as $plugin_file => $update_details ) { + if ( ! isset($plugins[ $plugin_file ]) ) { + $plugin_changed = true; + break; + } + } + } + + // Bail if we've checked in the last 12 hours and if nothing has changed + if ( $time_not_changed && !$plugin_changed ) + return false; + + // Update last_checked for current to prevent multiple blocking requests if request hangs + $current->last_checked = time(); + set_site_transient( 'update_plugins', $current ); + + $to_send = (object) compact('plugins', 'active'); + + $options = array( + 'timeout' => ( ( defined('DOING_CRON') && DOING_CRON ) ? 30 : 3), + 'body' => array( 'plugins' => serialize( $to_send ) ), + 'user-agent' => 'WordPress/' . $wp_version . '; ' . get_bloginfo( 'url' ) + ); + + $raw_response = wp_remote_post('http://api.wordpress.org/plugins/update-check/1.0/', $options); + + if ( is_wp_error( $raw_response ) || 200 != wp_remote_retrieve_response_code( $raw_response ) ) + return false; + + $response = unserialize( wp_remote_retrieve_body( $raw_response ) ); + + if ( false !== $response ) + $new_option->response = $response; + else + $new_option->response = array(); + + set_site_transient( 'update_plugins', $new_option ); +} + +/** + * Check theme versions against the latest versions hosted on WordPress.org. + * + * A list of all themes installed in sent to WP. Checks against the + * WordPress server at api.wordpress.org. Will only check if WordPress isn't + * installing. + * + * @package WordPress + * @since 2.7.0 + * @uses $wp_version Used to notify the WordPress version. + * + * @return mixed Returns null if update is unsupported. Returns false if check is too soon. + */ +function wp_update_themes() { + include ABSPATH . WPINC . '/version.php'; // include an unmodified $wp_version + + if ( defined( 'WP_INSTALLING' ) ) + return false; + + if ( !function_exists( 'get_themes' ) ) + require_once( ABSPATH . 'wp-includes/theme.php' ); + + $installed_themes = get_themes( ); + $last_update = get_site_transient( 'update_themes' ); + if ( ! is_object($last_update) ) + $last_update = new stdClass; + + $timeout = 'load-themes.php' == current_filter() ? 3600 : 43200; //Check for updated every 60 minutes if hitting the themes page, Else, check every 12 hours + $time_not_changed = isset( $last_update->last_checked ) && $timeout > ( time( ) - $last_update->last_checked ); + + $themes = array(); + $checked = array(); + $exclude_fields = array('Template Files', 'Stylesheet Files', 'Status', 'Theme Root', 'Theme Root URI', 'Template Dir', 'Stylesheet Dir', 'Description', 'Tags', 'Screenshot'); + + // Put slug of current theme into request. + $themes['current_theme'] = get_option( 'stylesheet' ); + + foreach ( (array) $installed_themes as $theme_title => $theme ) { + $themes[$theme['Stylesheet']] = array(); + $checked[$theme['Stylesheet']] = $theme['Version']; + + $themes[$theme['Stylesheet']]['Name'] = $theme['Name']; + $themes[$theme['Stylesheet']]['Version'] = $theme['Version']; + + foreach ( (array) $theme as $key => $value ) { + if ( !in_array($key, $exclude_fields) ) + $themes[$theme['Stylesheet']][$key] = $value; + } + } + + $theme_changed = false; + foreach ( $checked as $slug => $v ) { + $update_request->checked[ $slug ] = $v; + + if ( !isset( $last_update->checked[ $slug ] ) || strval($last_update->checked[ $slug ]) !== strval($v) ) + $theme_changed = true; + } + + if ( isset ( $last_update->response ) && is_array( $last_update->response ) ) { + foreach ( $last_update->response as $slug => $update_details ) { + if ( ! isset($checked[ $slug ]) ) { + $theme_changed = true; + break; + } + } + } + + if ( $time_not_changed && !$theme_changed ) + return false; + + // Update last_checked for current to prevent multiple blocking requests if request hangs + $last_update->last_checked = time(); + set_site_transient( 'update_themes', $last_update ); + + $options = array( + 'timeout' => ( ( defined('DOING_CRON') && DOING_CRON ) ? 30 : 3), + 'body' => array( 'themes' => serialize( $themes ) ), + 'user-agent' => 'WordPress/' . $wp_version . '; ' . get_bloginfo( 'url' ) + ); + + $raw_response = wp_remote_post( 'http://api.wordpress.org/themes/update-check/1.0/', $options ); + + if ( is_wp_error( $raw_response ) || 200 != wp_remote_retrieve_response_code( $raw_response ) ) + return false; + + $new_update = new stdClass; + $new_update->last_checked = time( ); + $new_update->checked = $checked; + + $response = unserialize( wp_remote_retrieve_body( $raw_response ) ); + if ( false !== $response ) + $new_update->response = $response; + + set_site_transient( 'update_themes', $new_update ); +} + +function _maybe_update_core() { + include ABSPATH . WPINC . '/version.php'; // include an unmodified $wp_version + + $current = get_site_transient( 'update_core' ); + + if ( isset( $current->last_checked ) && + 43200 > ( time() - $current->last_checked ) && + isset( $current->version_checked ) && + $current->version_checked == $wp_version ) + return; + + wp_version_check(); +} +/** + * Check the last time plugins were run before checking plugin versions. + * + * This might have been backported to WordPress 2.6.1 for performance reasons. + * This is used for the wp-admin to check only so often instead of every page + * load. + * + * @since 2.7.0 + * @access private + */ +function _maybe_update_plugins() { + $current = get_site_transient( 'update_plugins' ); + if ( isset( $current->last_checked ) && 43200 > ( time() - $current->last_checked ) ) + return; + wp_update_plugins(); +} + +/** + * Check themes versions only after a duration of time. + * + * This is for performance reasons to make sure that on the theme version + * checker is not run on every page load. + * + * @since 2.7.0 + * @access private + */ +function _maybe_update_themes( ) { + $current = get_site_transient( 'update_themes' ); + if ( isset( $current->last_checked ) && 43200 > ( time( ) - $current->last_checked ) ) + return; + + wp_update_themes(); +} + +/** + * Schedule core, theme, and plugin update checks. + * + * @since 3.1.0 + */ +function wp_schedule_update_checks() { + if ( !wp_next_scheduled('wp_version_check') && !defined('WP_INSTALLING') ) + wp_schedule_event(time(), 'twicedaily', 'wp_version_check'); + + if ( !wp_next_scheduled('wp_update_plugins') && !defined('WP_INSTALLING') ) + wp_schedule_event(time(), 'twicedaily', 'wp_update_plugins'); + + if ( !wp_next_scheduled('wp_update_themes') && !defined('WP_INSTALLING') ) + wp_schedule_event(time(), 'twicedaily', 'wp_update_themes'); +} + +if ( ! is_main_site() ) + return; + +add_action( 'admin_init', '_maybe_update_core' ); +add_action( 'wp_version_check', 'wp_version_check' ); + +add_action( 'load-plugins.php', 'wp_update_plugins' ); +add_action( 'load-update.php', 'wp_update_plugins' ); +add_action( 'load-update-core.php', 'wp_update_plugins' ); +add_action( 'admin_init', '_maybe_update_plugins' ); +add_action( 'wp_update_plugins', 'wp_update_plugins' ); + +add_action( 'load-themes.php', 'wp_update_themes' ); +add_action( 'load-update.php', 'wp_update_themes' ); +add_action( 'load-update-core.php', 'wp_update_themes' ); +add_action( 'admin_init', '_maybe_update_themes' ); +add_action( 'wp_update_themes', 'wp_update_themes' ); + +add_action('init', 'wp_schedule_update_checks'); + +?> diff --git a/src/wp-includes/user.php b/src/wp-includes/user.php new file mode 100644 index 0000000..af7f5de --- /dev/null +++ b/src/wp-includes/user.php @@ -0,0 +1,1621 @@ +get_error_codes() == array('empty_username', 'empty_password') ) { + $user = new WP_Error('', ''); + } + + return $user; + } + + wp_set_auth_cookie($user->ID, $credentials['remember'], $secure_cookie); + do_action('wp_login', $credentials['user_login']); + return $user; +} + + +/** + * Authenticate the user using the username and password. + */ +add_filter('authenticate', 'wp_authenticate_username_password', 20, 3); +function wp_authenticate_username_password($user, $username, $password) { + if ( is_a($user, 'WP_User') ) { return $user; } + + if ( empty($username) || empty($password) ) { + $error = new WP_Error(); + + if ( empty($username) ) + $error->add('empty_username', __('ERROR: The username field is empty.')); + + if ( empty($password) ) + $error->add('empty_password', __('ERROR: The password field is empty.')); + + return $error; + } + + $userdata = get_user_by('login', $username); + + if ( !$userdata ) + return new WP_Error('invalid_username', sprintf(__('ERROR: Invalid username. Lost your password?'), site_url('wp-login.php?action=lostpassword', 'login'))); + + if ( is_multisite() ) { + // Is user marked as spam? + if ( 1 == $userdata->spam) + return new WP_Error('invalid_username', __('ERROR: Your account has been marked as a spammer.')); + + // Is a user's blog marked as spam? + if ( !is_super_admin( $userdata->ID ) && isset($userdata->primary_blog) ) { + $details = get_blog_details( $userdata->primary_blog ); + if ( is_object( $details ) && $details->spam == 1 ) + return new WP_Error('blog_suspended', __('Site Suspended.')); + } + } + + $userdata = apply_filters('wp_authenticate_user', $userdata, $password); + if ( is_wp_error($userdata) ) + return $userdata; + + if ( !wp_check_password($password, $userdata->user_pass, $userdata->ID) ) + return new WP_Error( 'incorrect_password', sprintf( __( 'ERROR: The password you entered for the username %1$s is incorrect. Lost your password?' ), + $username, site_url( 'wp-login.php?action=lostpassword', 'login' ) ) ); + + $user = new WP_User($userdata->ID); + return $user; +} + +/** + * Authenticate the user using the WordPress auth cookie. + */ +function wp_authenticate_cookie($user, $username, $password) { + if ( is_a($user, 'WP_User') ) { return $user; } + + if ( empty($username) && empty($password) ) { + $user_id = wp_validate_auth_cookie(); + if ( $user_id ) + return new WP_User($user_id); + + global $auth_secure_cookie; + + if ( $auth_secure_cookie ) + $auth_cookie = SECURE_AUTH_COOKIE; + else + $auth_cookie = AUTH_COOKIE; + + if ( !empty($_COOKIE[$auth_cookie]) ) + return new WP_Error('expired_session', __('Please log in again.')); + + // If the cookie is not set, be silent. + } + + return $user; +} + +/** + * Number of posts user has written. + * + * @since 3.0.0 + * @uses $wpdb WordPress database object for queries. + * + * @param int $userid User ID. + * @return int Amount of posts user has written. + */ +function count_user_posts($userid) { + global $wpdb; + + $where = get_posts_by_author_sql('post', TRUE, $userid); + + $count = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->posts $where" ); + + return apply_filters('get_usernumposts', $count, $userid); +} + +/** + * Number of posts written by a list of users. + * + * @since 3.0.0 + * @param array $user_ids Array of user IDs. + * @param string|array $post_type Optional. Post type to check. Defaults to post. + * @return array Amount of posts each user has written. + */ +function count_many_users_posts($users, $post_type = 'post' ) { + global $wpdb; + + $count = array(); + if ( empty( $users ) || ! is_array( $users ) ) + return $count; + + $userlist = implode( ',', array_map( 'absint', $users ) ); + $where = get_posts_by_author_sql( $post_type ); + + $result = $wpdb->get_results( "SELECT post_author, COUNT(*) FROM $wpdb->posts $where AND post_author IN ($userlist) GROUP BY post_author", ARRAY_N ); + foreach ( $result as $row ) { + $count[ $row[0] ] = $row[1]; + } + + foreach ( $users as $id ) { + if ( ! isset( $count[ $id ] ) ) + $count[ $id ] = 0; + } + + return $count; +} + +/** + * Check that the user login name and password is correct. + * + * @since 0.71 + * @todo xmlrpc only. Maybe move to xmlrpc.php. + * + * @param string $user_login User name. + * @param string $user_pass User password. + * @return bool False if does not authenticate, true if username and password authenticates. + */ +function user_pass_ok($user_login, $user_pass) { + $user = wp_authenticate($user_login, $user_pass); + if ( is_wp_error($user) ) + return false; + + return true; +} + +// +// User option functions +// + +/** + * Get the current user's ID + * + * @since MU + * + * @uses wp_get_current_user + * + * @return int The current user's ID + */ +function get_current_user_id() { + $user = wp_get_current_user(); + return ( isset( $user->ID ) ? (int) $user->ID : 0 ); +} + +/** + * Retrieve user option that can be either per Site or per Network. + * + * If the user ID is not given, then the current user will be used instead. If + * the user ID is given, then the user data will be retrieved. The filter for + * the result, will also pass the original option name and finally the user data + * object as the third parameter. + * + * The option will first check for the per site name and then the per Network name. + * + * @since 2.0.0 + * @uses $wpdb WordPress database object for queries. + * @uses apply_filters() Calls 'get_user_option_$option' hook with result, + * option parameter, and user data object. + * + * @param string $option User option name. + * @param int $user Optional. User ID. + * @param bool $deprecated Use get_option() to check for an option in the options table. + * @return mixed + */ +function get_user_option( $option, $user = 0, $deprecated = '' ) { + global $wpdb; + + if ( !empty( $deprecated ) ) + _deprecated_argument( __FUNCTION__, '3.0' ); + + if ( empty($user) ) { + $user = wp_get_current_user(); + $user = $user->ID; + } + + $user = get_userdata($user); + + // Keys used as object vars cannot have dashes. + $key = str_replace('-', '', $option); + + if ( isset( $user->{$wpdb->prefix . $key} ) ) // Blog specific + $result = $user->{$wpdb->prefix . $key}; + elseif ( isset( $user->{$key} ) ) // User specific and cross-blog + $result = $user->{$key}; + else + $result = false; + + return apply_filters("get_user_option_{$option}", $result, $option, $user); +} + +/** + * Update user option with global blog capability. + * + * User options are just like user metadata except that they have support for + * global blog options. If the 'global' parameter is false, which it is by default + * it will prepend the WordPress table prefix to the option name. + * + * Deletes the user option if $newvalue is empty. + * + * @since 2.0.0 + * @uses $wpdb WordPress database object for queries + * + * @param int $user_id User ID + * @param string $option_name User option name. + * @param mixed $newvalue User option value. + * @param bool $global Optional. Whether option name is global or blog specific. Default false (blog specific). + * @return unknown + */ +function update_user_option( $user_id, $option_name, $newvalue, $global = false ) { + global $wpdb; + + if ( !$global ) + $option_name = $wpdb->prefix . $option_name; + + // For backward compatibility. See differences between update_user_meta() and deprecated update_usermeta(). + // http://core.trac.wordpress.org/ticket/13088 + if ( is_null( $newvalue ) || is_scalar( $newvalue ) && empty( $newvalue ) ) + return delete_user_meta( $user_id, $option_name ); + + return update_user_meta( $user_id, $option_name, $newvalue ); +} + +/** + * Delete user option with global blog capability. + * + * User options are just like user metadata except that they have support for + * global blog options. If the 'global' parameter is false, which it is by default + * it will prepend the WordPress table prefix to the option name. + * + * @since 3.0.0 + * @uses $wpdb WordPress database object for queries + * + * @param int $user_id User ID + * @param string $option_name User option name. + * @param bool $global Optional. Whether option name is global or blog specific. Default false (blog specific). + * @return unknown + */ +function delete_user_option( $user_id, $option_name, $global = false ) { + global $wpdb; + + if ( !$global ) + $option_name = $wpdb->prefix . $option_name; + return delete_user_meta( $user_id, $option_name ); +} + +/** + * WordPress User Query class. + * + * @since 3.1.0 + */ +class WP_User_Query { + + /** + * List of found user ids + * + * @since 3.1.0 + * @access private + * @var array + */ + var $results; + + /** + * Total number of found users for the current query + * + * @since 3.1.0 + * @access private + * @var int + */ + var $total_users = 0; + + // SQL clauses + var $query_fields; + var $query_from; + var $query_where; + var $query_orderby; + var $query_limit; + + + /** + * PHP5 constructor + * + * @since 3.1.0 + * + * @param string|array $args The query variables + * @return WP_User_Query + */ + function __construct( $query = null ) { + if ( !empty( $query ) ) { + $this->query_vars = wp_parse_args( $query, array( + 'blog_id' => $GLOBALS['blog_id'], + 'role' => '', + 'meta_key' => '', + 'meta_value' => '', + 'meta_compare' => '', + 'include' => array(), + 'exclude' => array(), + 'search' => '', + 'orderby' => 'login', + 'order' => 'ASC', + 'offset' => '', + 'number' => '', + 'count_total' => true, + 'fields' => 'all', + 'who' => '' + ) ); + + $this->prepare_query(); + $this->query(); + } + } + + /** + * Prepare the query variables + * + * @since 3.1.0 + * @access private + */ + function prepare_query() { + global $wpdb; + + $qv = &$this->query_vars; + + if ( is_array( $qv['fields'] ) ) { + $qv['fields'] = array_unique( $qv['fields'] ); + + $this->query_fields = array(); + foreach ( $qv['fields'] as $field ) + $this->query_fields[] = $wpdb->users . '.' . esc_sql( $field ); + $this->query_fields = implode( ',', $this->query_fields ); + } elseif ( 'all' == $qv['fields'] ) { + $this->query_fields = "$wpdb->users.*"; + } else { + $this->query_fields = "$wpdb->users.ID"; + } + + if ( $this->query_vars['count_total'] ) + $this->query_fields = 'SQL_CALC_FOUND_ROWS ' . $this->query_fields; + + $this->query_from = "FROM $wpdb->users"; + $this->query_where = "WHERE 1=1"; + + // sorting + if ( in_array( $qv['orderby'], array('nicename', 'email', 'url', 'registered') ) ) { + $orderby = 'user_' . $qv['orderby']; + } elseif ( in_array( $qv['orderby'], array('user_nicename', 'user_email', 'user_url', 'user_registered') ) ) { + $orderby = $qv['orderby']; + } elseif ( 'name' == $qv['orderby'] || 'display_name' == $qv['orderby'] ) { + $orderby = 'display_name'; + } elseif ( 'post_count' == $qv['orderby'] ) { + // todo: avoid the JOIN + $where = get_posts_by_author_sql('post'); + $this->query_from .= " LEFT OUTER JOIN ( + SELECT post_author, COUNT(*) as post_count + FROM $wpdb->posts + $where + GROUP BY post_author + ) p ON ({$wpdb->users}.ID = p.post_author) + "; + $orderby = 'post_count'; + } elseif ( 'ID' == $qv['orderby'] || 'id' == $qv['orderby'] ) { + $orderby = 'ID'; + } else { + $orderby = 'user_login'; + } + + $qv['order'] = strtoupper( $qv['order'] ); + if ( 'ASC' == $qv['order'] ) + $order = 'ASC'; + else + $order = 'DESC'; + $this->query_orderby = "ORDER BY $orderby $order"; + + // limit + if ( $qv['number'] ) { + if ( $qv['offset'] ) + $this->query_limit = $wpdb->prepare("LIMIT %d, %d", $qv['offset'], $qv['number']); + else + $this->query_limit = $wpdb->prepare("LIMIT %d", $qv['number']); + } + + $search = trim( $qv['search'] ); + if ( $search ) { + $leading_wild = ( ltrim($search, '*') != $search ); + $trailing_wild = ( rtrim($search, '*') != $search ); + if ( $leading_wild && $trailing_wild ) + $wild = 'both'; + elseif ( $leading_wild ) + $wild = 'leading'; + elseif ( $trailing_wild ) + $wild = 'trailing'; + else + $wild = false; + if ( $wild ) + $search = trim($search, '*'); + + if ( false !== strpos( $search, '@') ) + $search_columns = array('user_email'); + elseif ( is_numeric($search) ) + $search_columns = array('user_login', 'ID'); + elseif ( preg_match('|^https?://|', $search) ) + $search_columns = array('user_url'); + else + $search_columns = array('user_login', 'user_nicename'); + + $this->query_where .= $this->get_search_sql( $search, $search_columns, $wild ); + } + + $blog_id = absint( $qv['blog_id'] ); + + if ( 'authors' == $qv['who'] && $blog_id ) { + $qv['meta_key'] = $wpdb->get_blog_prefix( $blog_id ) . 'user_level'; + $qv['meta_value'] = 0; + $qv['meta_compare'] = '!='; + $qv['blog_id'] = $blog_id = 0; // Prevent extra meta query + } + + $role = trim( $qv['role'] ); + + if ( $blog_id && ( $role || is_multisite() ) ) { + $cap_meta_query = array(); + $cap_meta_query['key'] = $wpdb->get_blog_prefix( $blog_id ) . 'capabilities'; + + if ( $role ) { + $cap_meta_query['value'] = '"' . $role . '"'; + $cap_meta_query['compare'] = 'like'; + } + + $qv['meta_query'][] = $cap_meta_query; + } + + $meta_query = new WP_Meta_Query(); + $meta_query->parse_query_vars( $qv ); + + if ( !empty( $meta_query->queries ) ) { + $clauses = $meta_query->get_sql( 'user', $wpdb->users, 'ID', $this ); + $this->query_from .= $clauses['join']; + $this->query_where .= $clauses['where']; + + if ( 'OR' == $meta_query->relation ) + $this->query_fields = 'DISTINCT ' . $this->query_fields; + } + + if ( !empty( $qv['include'] ) ) { + $ids = implode( ',', wp_parse_id_list( $qv['include'] ) ); + $this->query_where .= " AND $wpdb->users.ID IN ($ids)"; + } elseif ( !empty($qv['exclude']) ) { + $ids = implode( ',', wp_parse_id_list( $qv['exclude'] ) ); + $this->query_where .= " AND $wpdb->users.ID NOT IN ($ids)"; + } + + do_action_ref_array( 'pre_user_query', array( &$this ) ); + } + + /** + * Execute the query, with the current variables + * + * @since 3.1.0 + * @access private + */ + function query() { + global $wpdb; + + if ( is_array( $this->query_vars['fields'] ) || 'all' == $this->query_vars['fields'] ) { + $this->results = $wpdb->get_results("SELECT $this->query_fields $this->query_from $this->query_where $this->query_orderby $this->query_limit"); + } else { + $this->results = $wpdb->get_col("SELECT $this->query_fields $this->query_from $this->query_where $this->query_orderby $this->query_limit"); + } + + if ( $this->query_vars['count_total'] ) + $this->total_users = $wpdb->get_var( apply_filters( 'found_users_query', 'SELECT FOUND_ROWS()' ) ); + + if ( !$this->results ) + return; + + if ( 'all_with_meta' == $this->query_vars['fields'] ) { + cache_users( $this->results ); + + $r = array(); + foreach ( $this->results as $userid ) + $r[ $userid ] = new WP_User( $userid, '', $this->query_vars['blog_id'] ); + + $this->results = $r; + } + } + + /* + * Used internally to generate an SQL string for searching across multiple columns + * + * @access protected + * @since 3.1.0 + * + * @param string $string + * @param array $cols + * @param bool $wild Whether to allow wildcard searches. Default is false for Network Admin, true for + * single site. Single site allows leading and trailing wildcards, Network Admin only trailing. + * @return string + */ + function get_search_sql( $string, $cols, $wild = false ) { + $string = esc_sql( $string ); + + $searches = array(); + $leading_wild = ( 'leading' == $wild || 'both' == $wild ) ? '%' : ''; + $trailing_wild = ( 'trailing' == $wild || 'both' == $wild ) ? '%' : ''; + foreach ( $cols as $col ) { + if ( 'ID' == $col ) + $searches[] = "$col = '$string'"; + else + $searches[] = "$col LIKE '$leading_wild" . like_escape($string) . "$trailing_wild'"; + } + + return ' AND (' . implode(' OR ', $searches) . ')'; + } + + /** + * Return the list of users + * + * @since 3.1.0 + * @access public + * + * @return array + */ + function get_results() { + return $this->results; + } + + /** + * Return the total number of users for the current query + * + * @since 3.1.0 + * @access public + * + * @return array + */ + function get_total() { + return $this->total_users; + } +} + +/** + * Retrieve list of users matching criteria. + * + * @since 3.1.0 + * @uses $wpdb + * @uses WP_User_Query See for default arguments and information. + * + * @param array $args Optional. + * @return array List of users. + */ +function get_users( $args = array() ) { + + $args = wp_parse_args( $args ); + $args['count_total'] = false; + + $user_search = new WP_User_Query($args); + + return (array) $user_search->get_results(); +} + +/** + * Get the blogs a user belongs to. + * + * @since 3.0.0 + * + * @param int $id User Id + * @param bool $all Whether to retrieve all blogs or only blogs that are not marked as deleted, archived, or spam. + * @return array A list of the user's blogs. False if the user was not found or an empty array if the user has no blogs. + */ +function get_blogs_of_user( $id, $all = false ) { + global $wpdb; + + if ( !is_multisite() ) { + $blog_id = get_current_blog_id(); + $blogs = array(); + $blogs[ $blog_id ]->userblog_id = $blog_id; + $blogs[ $blog_id ]->blogname = get_option('blogname'); + $blogs[ $blog_id ]->domain = ''; + $blogs[ $blog_id ]->path = ''; + $blogs[ $blog_id ]->site_id = 1; + $blogs[ $blog_id ]->siteurl = get_option('siteurl'); + return $blogs; + } + + $blogs = wp_cache_get( 'blogs_of_user-' . $id, 'users' ); + + // Try priming the new cache from the old cache + if ( false === $blogs ) { + $cache_suffix = $all ? '_all' : '_short'; + $blogs = wp_cache_get( 'blogs_of_user_' . $id . $cache_suffix, 'users' ); + if ( is_array( $blogs ) ) { + $blogs = array_keys( $blogs ); + if ( $all ) + wp_cache_set( 'blogs_of_user-' . $id, $blogs, 'users' ); + } + } + + if ( false === $blogs ) { + $user = get_userdata( (int) $id ); + if ( !$user ) + return false; + + $blogs = $match = array(); + $prefix_length = strlen($wpdb->base_prefix); + foreach ( (array) $user as $key => $value ) { + if ( $prefix_length && substr($key, 0, $prefix_length) != $wpdb->base_prefix ) + continue; + if ( substr($key, -12, 12) != 'capabilities' ) + continue; + if ( preg_match( '/^' . $wpdb->base_prefix . '((\d+)_)?capabilities$/', $key, $match ) ) { + if ( count( $match ) > 2 ) + $blogs[] = (int) $match[ 2 ]; + else + $blogs[] = 1; + } + } + wp_cache_set( 'blogs_of_user-' . $id, $blogs, 'users' ); + } + + $blog_deets = array(); + foreach ( (array) $blogs as $blog_id ) { + $blog = get_blog_details( $blog_id ); + if ( $blog && isset( $blog->domain ) && ( $all == true || $all == false && ( $blog->archived == 0 && $blog->spam == 0 && $blog->deleted == 0 ) ) ) { + $blog_deets[ $blog_id ]->userblog_id = $blog_id; + $blog_deets[ $blog_id ]->blogname = $blog->blogname; + $blog_deets[ $blog_id ]->domain = $blog->domain; + $blog_deets[ $blog_id ]->path = $blog->path; + $blog_deets[ $blog_id ]->site_id = $blog->site_id; + $blog_deets[ $blog_id ]->siteurl = $blog->siteurl; + } + } + + return apply_filters( 'get_blogs_of_user', $blog_deets, $id, $all ); +} + +/** + * Checks if the current user belong to a given blog. + * + * @since 3.0.0 + * + * @param int $blog_id Blog ID + * @return bool True if the current users belong to $blog_id, false if not. + */ +function is_blog_user( $blog_id = 0 ) { + global $wpdb; + + $current_user = wp_get_current_user(); + 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; +} + +/** + * Add meta data field to a user. + * + * Post meta data is called "Custom Fields" on the Administration Screens. + * + * @since 3.0.0 + * @uses add_metadata() + * @link http://codex.wordpress.org/Function_Reference/add_user_meta + * + * @param int $user_id Post ID. + * @param string $meta_key Metadata name. + * @param mixed $meta_value Metadata value. + * @param bool $unique Optional, default is false. Whether the same key should not be added. + * @return bool False for failure. True for success. + */ +function add_user_meta($user_id, $meta_key, $meta_value, $unique = false) { + return add_metadata('user', $user_id, $meta_key, $meta_value, $unique); +} + +/** + * Remove metadata matching criteria from a user. + * + * You can match based on the key, or key and value. Removing based on key and + * value, will keep from removing duplicate metadata with the same key. It also + * allows removing all metadata matching key, if needed. + * + * @since 3.0.0 + * @uses delete_metadata() + * @link http://codex.wordpress.org/Function_Reference/delete_user_meta + * + * @param int $user_id user ID + * @param string $meta_key Metadata name. + * @param mixed $meta_value Optional. Metadata value. + * @return bool False for failure. True for success. + */ +function delete_user_meta($user_id, $meta_key, $meta_value = '') { + return delete_metadata('user', $user_id, $meta_key, $meta_value); +} + +/** + * Retrieve user meta field for a user. + * + * @since 3.0.0 + * @uses get_metadata() + * @link http://codex.wordpress.org/Function_Reference/get_user_meta + * + * @param int $user_id Post ID. + * @param string $key The meta key to retrieve. + * @param bool $single Whether to return a single value. + * @return mixed Will be an array if $single is false. Will be value of meta data field if $single + * is true. + */ +function get_user_meta($user_id, $key, $single = false) { + return get_metadata('user', $user_id, $key, $single); +} + +/** + * Update user meta field based on user ID. + * + * Use the $prev_value parameter to differentiate between meta fields with the + * same key and user ID. + * + * If the meta field for the user does not exist, it will be added. + * + * @since 3.0.0 + * @uses update_metadata + * @link http://codex.wordpress.org/Function_Reference/update_user_meta + * + * @param int $user_id Post ID. + * @param string $meta_key Metadata key. + * @param mixed $meta_value Metadata value. + * @param mixed $prev_value Optional. Previous value to check before removing. + * @return bool False on failure, true if success. + */ +function update_user_meta($user_id, $meta_key, $meta_value, $prev_value = '') { + return update_metadata('user', $user_id, $meta_key, $meta_value, $prev_value); +} + +/** + * Count number of users who have each of the user roles. + * + * Assumes there are neither duplicated nor orphaned capabilities meta_values. + * Assumes role names are unique phrases. Same assumption made by WP_User_Query::prepare_query() + * Using $strategy = 'time' this is CPU-intensive and should handle around 10^7 users. + * Using $strategy = 'memory' this is memory-intensive and should handle around 10^5 users, but see WP Bug #12257. + * + * @since 3.0.0 + * @param string $strategy 'time' or 'memory' + * @return array Includes a grand total and an array of counts indexed by role strings. + */ +function count_users($strategy = 'time') { + global $wpdb, $wp_roles; + + // Initialize + $id = get_current_blog_id(); + $blog_prefix = $wpdb->get_blog_prefix($id); + $result = array(); + + if ( 'time' == $strategy ) { + global $wp_roles; + + if ( ! isset( $wp_roles ) ) + $wp_roles = new WP_Roles(); + + $avail_roles = $wp_roles->get_names(); + + // Build a CPU-intensive query that will return concise information. + $select_count = array(); + foreach ( $avail_roles as $this_role => $name ) { + $select_count[] = "COUNT(NULLIF(`meta_value` LIKE '%" . like_escape($this_role) . "%', FALSE))"; + } + $select_count = implode(', ', $select_count); + + // Add the meta_value index to the selection list, then run the query. + $row = $wpdb->get_row( "SELECT $select_count, COUNT(*) FROM $wpdb->usermeta WHERE meta_key = '{$blog_prefix}capabilities'", ARRAY_N ); + + // Run the previous loop again to associate results with role names. + $col = 0; + $role_counts = array(); + foreach ( $avail_roles as $this_role => $name ) { + $count = (int) $row[$col++]; + if ($count > 0) { + $role_counts[$this_role] = $count; + } + } + + // Get the meta_value index from the end of the result set. + $total_users = (int) $row[$col]; + + $result['total_users'] = $total_users; + $result['avail_roles'] =& $role_counts; + } else { + $avail_roles = array(); + + $users_of_blog = $wpdb->get_col( "SELECT meta_value FROM $wpdb->usermeta WHERE meta_key = '{$blog_prefix}capabilities'" ); + + foreach ( $users_of_blog as $caps_meta ) { + $b_roles = unserialize($caps_meta); + if ( is_array($b_roles) ) { + foreach ( $b_roles as $b_role => $val ) { + if ( isset($avail_roles[$b_role]) ) { + $avail_roles[$b_role]++; + } else { + $avail_roles[$b_role] = 1; + } + } + } + } + + $result['total_users'] = count( $users_of_blog ); + $result['avail_roles'] =& $avail_roles; + } + + return $result; +} + +// +// Private helper functions +// + +/** + * Set up global user vars. + * + * Used by wp_set_current_user() for back compat. Might be deprecated in the future. + * + * @since 2.0.4 + * @global string $userdata User description. + * @global string $user_login The user username for logging in + * @global int $user_level The level of the user + * @global int $user_ID The ID of the user + * @global string $user_email The email address of the user + * @global string $user_url The url in the user's profile + * @global string $user_pass_md5 MD5 of the user's password + * @global string $user_identity The display name of the user + * + * @param int $for_user_id Optional. User ID to set up global data. + */ +function setup_userdata($for_user_id = '') { + global $user_login, $userdata, $user_level, $user_ID, $user_email, $user_url, $user_pass_md5, $user_identity; + + if ( '' == $for_user_id ) + $user = wp_get_current_user(); + else + $user = new WP_User($for_user_id); + + $userdata = $user->data; + $user_ID = (int) $user->ID; + $user_level = (int) isset($user->user_level) ? $user->user_level : 0; + + if ( 0 == $user->ID ) { + $user_login = $user_email = $user_url = $user_pass_md5 = $user_identity = ''; + return; + } + + $user_login = $user->user_login; + $user_email = $user->user_email; + $user_url = $user->user_url; + $user_pass_md5 = md5($user->user_pass); + $user_identity = $user->display_name; +} + +/** + * Create dropdown HTML content of users. + * + * The content can either be displayed, which it is by default or retrieved by + * setting the 'echo' argument. The 'include' and 'exclude' arguments do not + * need to be used; all users will be displayed in that case. Only one can be + * used, either 'include' or 'exclude', but not both. + * + * The available arguments are as follows: + *
            + *
          1. show_option_all - Text to show all and whether HTML option exists.
          2. + *
          3. show_option_none - Text for show none and whether HTML option exists.
          4. + *
          5. hide_if_only_one_author - Don't create the dropdown if there is only one user.
          6. + *
          7. orderby - SQL order by clause for what order the users appear. Default is 'display_name'.
          8. + *
          9. order - Default is 'ASC'. Can also be 'DESC'.
          10. + *
          11. include - User IDs to include.
          12. + *
          13. exclude - User IDs to exclude.
          14. + *
          15. multi - Default is 'false'. Whether to skip the ID attribute on the 'select' element. A 'true' value is overridden when id argument is set.
          16. + *
          17. show - Default is 'display_name'. User table column to display. If the selected item is empty then the user_login will be displayed in parentheses
          18. + *
          19. echo - Default is '1'. Whether to display or retrieve content.
          20. + *
          21. selected - Which User ID is selected.
          22. + *
          23. include_selected - Always include the selected user ID in the dropdown. Default is false.
          24. + *
          25. name - Default is 'user'. Name attribute of select element.
          26. + *
          27. id - Default is the value of the 'name' parameter. ID attribute of select element.
          28. + *
          29. class - Class attribute of select element.
          30. + *
          31. blog_id - ID of blog (Multisite only). Defaults to ID of current blog.
          32. + *
          33. who - Which users to query. Currently only 'authors' is supported. Default is all users.
          34. + *
          + * + * @since 2.3.0 + * @uses $wpdb WordPress database object for queries + * + * @param string|array $args Optional. Override defaults. + * @return string|null Null on display. String of HTML content on retrieve. + */ +function wp_dropdown_users( $args = '' ) { + $defaults = array( + 'show_option_all' => '', 'show_option_none' => '', 'hide_if_only_one_author' => '', + 'orderby' => 'display_name', 'order' => 'ASC', + 'include' => '', 'exclude' => '', 'multi' => 0, + 'show' => 'display_name', 'echo' => 1, + 'selected' => 0, 'name' => 'user', 'class' => '', 'id' => '', + 'blog_id' => $GLOBALS['blog_id'], 'who' => '', 'include_selected' => false + ); + + $defaults['selected'] = is_author() ? get_query_var( 'author' ) : 0; + + $r = wp_parse_args( $args, $defaults ); + extract( $r, EXTR_SKIP ); + + $query_args = wp_array_slice_assoc( $r, array( 'blog_id', 'include', 'exclude', 'orderby', 'order', 'who' ) ); + $query_args['fields'] = array( 'ID', $show ); + $users = get_users( $query_args ); + + $output = ''; + if ( !empty($users) && ( empty($hide_if_only_one_author) || count($users) > 1 ) ) { + $name = esc_attr( $name ); + if ( $multi && ! $id ) + $id = ''; + else + $id = $id ? " id='" . esc_attr( $id ) . "'" : " id='$name'"; + + $output = ""; + } + + $output = apply_filters('wp_dropdown_users', $output); + + if ( $echo ) + echo $output; + + return $output; +} + +/** + * Add user meta data as properties to given user object. + * + * The finished user data is cached, but the cache is not used to fill in the + * user data for the given object. Once the function has been used, the cache + * should be used to retrieve user data. The intention is if the current data + * had been cached already, there would be no need to call this function. + * + * @access private + * @since 2.5.0 + * @uses $wpdb WordPress database object for queries + * + * @param object $user The user data object. + */ +function _fill_user( &$user ) { + $metavalues = get_user_metavalues(array($user->ID)); + _fill_single_user($user, $metavalues[$user->ID]); +} + +/** + * Perform the query to get the $metavalues array(s) needed by _fill_user and _fill_many_users + * + * @since 3.0.0 + * @param array $ids User ID numbers list. + * @return array of arrays. The array is indexed by user_id, containing $metavalues object arrays. + */ +function get_user_metavalues($ids) { + $objects = array(); + + $ids = array_map('intval', $ids); + foreach ( $ids as $id ) + $objects[$id] = array(); + + $metas = update_meta_cache('user', $ids); + + foreach ( $metas as $id => $meta ) { + foreach ( $meta as $key => $metavalues ) { + foreach ( $metavalues as $value ) { + $objects[$id][] = (object)array( 'user_id' => $id, 'meta_key' => $key, 'meta_value' => $value); + } + } + } + + return $objects; +} + +/** + * Unserialize user metadata, fill $user object, then cache everything. + * + * @since 3.0.0 + * @param object $user The User object. + * @param array $metavalues An array of objects provided by get_user_metavalues() + */ +function _fill_single_user( &$user, &$metavalues ) { + global $wpdb; + + foreach ( $metavalues as $meta ) { + $value = maybe_unserialize($meta->meta_value); + // Keys used as object vars cannot have dashes. + $key = str_replace('-', '', $meta->meta_key); + $user->{$key} = $value; + } + + $level = $wpdb->prefix . 'user_level'; + if ( isset( $user->{$level} ) ) + $user->user_level = $user->{$level}; + + // For backwards compat. + if ( isset($user->first_name) ) + $user->user_firstname = $user->first_name; + if ( isset($user->last_name) ) + $user->user_lastname = $user->last_name; + if ( isset($user->description) ) + $user->user_description = $user->description; + + update_user_caches($user); +} + +/** + * Take an array of user objects, fill them with metas, and cache them. + * + * @since 3.0.0 + * @param array $users User objects + */ +function _fill_many_users( &$users ) { + $ids = array(); + foreach( $users as $user_object ) { + $ids[] = $user_object->ID; + } + + $metas = get_user_metavalues($ids); + + foreach ( $users as $user_object ) { + if ( isset($metas[$user_object->ID]) ) { + _fill_single_user($user_object, $metas[$user_object->ID]); + } + } +} + +/** + * Sanitize every user field. + * + * If the context is 'raw', then the user object or array will get minimal santization of the int fields. + * + * @since 2.3.0 + * @uses sanitize_user_field() Used to sanitize the fields. + * + * @param object|array $user The User Object or Array + * @param string $context Optional, default is 'display'. How to sanitize user fields. + * @return object|array The now sanitized User Object or Array (will be the same type as $user) + */ +function sanitize_user_object($user, $context = 'display') { + if ( is_object($user) ) { + if ( !isset($user->ID) ) + $user->ID = 0; + if ( isset($user->data) ) + $vars = get_object_vars( $user->data ); + else + $vars = get_object_vars($user); + foreach ( array_keys($vars) as $field ) { + if ( is_string($user->$field) || is_numeric($user->$field) ) + $user->$field = sanitize_user_field($field, $user->$field, $user->ID, $context); + } + $user->filter = $context; + } else { + if ( !isset($user['ID']) ) + $user['ID'] = 0; + foreach ( array_keys($user) as $field ) + $user[$field] = sanitize_user_field($field, $user[$field], $user['ID'], $context); + $user['filter'] = $context; + } + + return $user; +} + +/** + * Sanitize user field based on context. + * + * Possible context values are: 'raw', 'edit', 'db', 'display', 'attribute' and 'js'. The + * 'display' context is used by default. 'attribute' and 'js' contexts are treated like 'display' + * when calling filters. + * + * @since 2.3.0 + * @uses apply_filters() Calls 'edit_$field' and '{$field_no_prefix}_edit_pre' passing $value and + * $user_id if $context == 'edit' and field name prefix == 'user_'. + * + * @uses apply_filters() Calls 'edit_user_$field' passing $value and $user_id if $context == 'db'. + * @uses apply_filters() Calls 'pre_$field' passing $value if $context == 'db' and field name prefix == 'user_'. + * @uses apply_filters() Calls '{$field}_pre' passing $value if $context == 'db' and field name prefix != 'user_'. + * + * @uses apply_filters() Calls '$field' passing $value, $user_id and $context if $context == anything + * other than 'raw', 'edit' and 'db' and field name prefix == 'user_'. + * @uses apply_filters() Calls 'user_$field' passing $value if $context == anything other than 'raw', + * 'edit' and 'db' and field name prefix != 'user_'. + * + * @param string $field The user Object field name. + * @param mixed $value The user Object value. + * @param int $user_id user ID. + * @param string $context How to sanitize user fields. Looks for 'raw', 'edit', 'db', 'display', + * 'attribute' and 'js'. + * @return mixed Sanitized value. + */ +function sanitize_user_field($field, $value, $user_id, $context) { + $int_fields = array('ID'); + if ( in_array($field, $int_fields) ) + $value = (int) $value; + + if ( 'raw' == $context ) + return $value; + + if ( !is_string($value) && !is_numeric($value) ) + return $value; + + $prefixed = false; + if ( false !== strpos($field, 'user_') ) { + $prefixed = true; + $field_no_prefix = str_replace('user_', '', $field); + } + + if ( 'edit' == $context ) { + if ( $prefixed ) { + $value = apply_filters("edit_{$field}", $value, $user_id); + } else { + $value = apply_filters("edit_user_{$field}", $value, $user_id); + } + + if ( 'description' == $field ) + $value = esc_html( $value ); // textarea_escaped? + else + $value = esc_attr($value); + } else if ( 'db' == $context ) { + if ( $prefixed ) { + $value = apply_filters("pre_{$field}", $value); + } else { + $value = apply_filters("pre_user_{$field}", $value); + } + } else { + // Use display filters by default. + if ( $prefixed ) + $value = apply_filters($field, $value, $user_id, $context); + else + $value = apply_filters("user_{$field}", $value, $user_id, $context); + } + + if ( 'user_url' == $field ) + $value = esc_url($value); + + if ( 'attribute' == $context ) + $value = esc_attr($value); + else if ( 'js' == $context ) + $value = esc_js($value); + + return $value; +} + +/** + * Update all user caches + * + * @since 3.0.0 + * + * @param object $user User object to be cached + */ +function update_user_caches(&$user) { + wp_cache_add($user->ID, $user, 'users'); + wp_cache_add($user->user_login, $user->ID, 'userlogins'); + wp_cache_add($user->user_email, $user->ID, 'useremail'); + wp_cache_add($user->user_nicename, $user->ID, 'userslugs'); +} + +/** + * Clean all user caches + * + * @since 3.0.0 + * + * @param int $id User ID + */ +function clean_user_cache($id) { + $user = new WP_User($id); + + wp_cache_delete($id, 'users'); + wp_cache_delete($user->user_login, 'userlogins'); + wp_cache_delete($user->user_email, 'useremail'); + wp_cache_delete($user->user_nicename, 'userslugs'); + wp_cache_delete('blogs_of_user-' . $id, 'users'); +} + +/** + * Checks whether the given username exists. + * + * @since 2.0.0 + * + * @param string $username Username. + * @return null|int The user's ID on success, and null on failure. + */ +function username_exists( $username ) { + if ( $user = get_userdatabylogin( $username ) ) { + return $user->ID; + } else { + return null; + } +} + +/** + * 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; +} + +/** + * 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 ); +} + +/** + * 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 appearance. + * '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. 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|WP_Error The newly created user's ID or a WP_Error object if the user could not be created. + */ +function wp_insert_user($userdata) { + global $wpdb; + + extract($userdata, EXTR_SKIP); + + // Are we updating or creating? + if ( !empty($ID) ) { + $ID = (int) $ID; + $update = true; + $old_user_data = get_userdata($ID); + } 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); + + //Remove any non-printable chars from the login string to see if we have ended up with an empty username + $user_login = trim($user_login); + + if ( empty($user_login) ) + return new WP_Error('empty_user_login', __('Cannot create a user with an empty login name.') ); + + if ( !$update && username_exists( $user_login ) ) + return new WP_Error('existing_user_login', __('This username is already registered.') ); + + 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 ( !$update && ! defined( 'WP_IMPORTING' ) && email_exists($user_email) ) + return new WP_Error('existing_user_email', __('This email address is already registered.') ); + + 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($comment_shortcuts) ) + $comment_shortcuts = 'false'; + + if ( empty($admin_color) ) + $admin_color = 'fresh'; + $admin_color = preg_replace('|[^a-z0-9 _.\-@]|i', '', $admin_color); + + if ( empty($use_ssl) ) + $use_ssl = 0; + + if ( empty($user_registered) ) + $user_registered = gmdate('Y-m-d H:i:s'); + + if ( empty($show_admin_bar_front) ) + $show_admin_bar_front = 'true'; + + if ( empty($show_admin_bar_admin) ) + $show_admin_bar_admin = is_multisite() ? 'true' : 'false'; + + $user_nicename_check = $wpdb->get_var( $wpdb->prepare("SELECT ID FROM $wpdb->users WHERE user_nicename = %s AND user_login != %s LIMIT 1" , $user_nicename, $user_login)); + + if ( $user_nicename_check ) { + $suffix = 2; + while ($user_nicename_check) { + $alt_user_nicename = $user_nicename . "-$suffix"; + $user_nicename_check = $wpdb->get_var( $wpdb->prepare("SELECT ID FROM $wpdb->users WHERE user_nicename = %s AND user_login != %s LIMIT 1" , $alt_user_nicename, $user_login)); + $suffix++; + } + $user_nicename = $alt_user_nicename; + } + + $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_user_meta( $user_id, 'first_name', $first_name ); + update_user_meta( $user_id, 'last_name', $last_name ); + update_user_meta( $user_id, 'nickname', $nickname ); + update_user_meta( $user_id, 'description', $description ); + update_user_meta( $user_id, 'rich_editing', $rich_editing ); + update_user_meta( $user_id, 'comment_shortcuts', $comment_shortcuts ); + update_user_meta( $user_id, 'admin_color', $admin_color ); + update_user_meta( $user_id, 'use_ssl', $use_ssl ); + update_user_meta( $user_id, 'show_admin_bar_front', $show_admin_bar_front ); + update_user_meta( $user_id, 'show_admin_bar_admin', $show_admin_bar_admin ); + + $user = new WP_User($user_id); + + foreach ( _wp_get_user_contactmethods( $user ) as $method => $name ) { + if ( empty($$method) ) + $$method = ''; + + update_user_meta( $user_id, $method, $$method ); + } + + if ( isset($role) ) + $user->set_role($role); + elseif ( !$update ) + $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, $old_user_data); + else + do_action('user_register', $user_id); + + return $user_id; +} + +/** + * 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']); + } + + wp_cache_delete($user[ 'user_email' ], 'useremail'); + + // 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; +} + +/** + * 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 + * + * @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 = '') { + $user_login = esc_sql( $username ); + $user_email = esc_sql( $email ); + $user_pass = $password; + + $userdata = compact('user_login', 'user_email', 'user_pass'); + return wp_insert_user($userdata); +} + + +/** + * Set up the default contact methods + * + * @access private + * @since + * + * @param object $user User data object (optional) + * @return array $user_contactmethods Array of contact methods and their labels. + */ +function _wp_get_user_contactmethods( $user = null ) { + $user_contactmethods = array( + 'aim' => __('AIM'), + 'yim' => __('Yahoo IM'), + 'jabber' => __('Jabber / Google Talk') + ); + return apply_filters( 'user_contactmethods', $user_contactmethods, $user ); +} + +?> diff --git a/src/wp-includes/vars.php b/src/wp-includes/vars.php new file mode 100644 index 0000000..aca78f1 --- /dev/null +++ b/src/wp-includes/vars.php @@ -0,0 +1,97 @@ + \ No newline at end of file diff --git a/src/wp-includes/version.php b/src/wp-includes/version.php new file mode 100644 index 0000000..d51fe89 --- /dev/null +++ b/src/wp-includes/version.php @@ -0,0 +1,44 @@ +' . __('There are no options for this widget.') . '

          '; + return 'noform'; + } + + // Functions you'll need to call. + + /** + * PHP4 constructor + */ + function WP_Widget( $id_base = false, $name, $widget_options = array(), $control_options = array() ) { + WP_Widget::__construct( $id_base, $name, $widget_options, $control_options ); + } + + /** + * PHP5 constructor + * + * @param string $id_base Optional Base ID for the widget, lower case, + * if left empty a portion of the widget's class name will be used. Has to be unique. + * @param string $name Name for the widget displayed on the configuration page. + * @param array $widget_options Optional Passed to wp_register_sidebar_widget() + * - description: shown on the configuration page + * - classname + * @param array $control_options Optional Passed to wp_register_widget_control() + * - width: required if more than 250px + * - height: currently not used but may be needed in the future + */ + function __construct( $id_base = false, $name, $widget_options = array(), $control_options = array() ) { + $this->id_base = empty($id_base) ? preg_replace( '/(wp_)?widget_/', '', strtolower(get_class($this)) ) : strtolower($id_base); + $this->name = $name; + $this->option_name = 'widget_' . $this->id_base; + $this->widget_options = wp_parse_args( $widget_options, array('classname' => $this->option_name) ); + $this->control_options = wp_parse_args( $control_options, array('id_base' => $this->id_base) ); + } + + /** + * Constructs name attributes for use in form() fields + * + * This function should be used in form() methods to create name attributes for fields to be saved by update() + * + * @param string $field_name Field name + * @return string Name attribute for $field_name + */ + function get_field_name($field_name) { + return 'widget-' . $this->id_base . '[' . $this->number . '][' . $field_name . ']'; + } + + /** + * Constructs id attributes for use in form() fields + * + * This function should be used in form() methods to create id attributes for fields to be saved by update() + * + * @param string $field_name Field name + * @return string ID attribute for $field_name + */ + function get_field_id($field_name) { + return 'widget-' . $this->id_base . '-' . $this->number . '-' . $field_name; + } + + // Private Functions. Don't worry about these. + + function _register() { + $settings = $this->get_settings(); + $empty = true; + + if ( is_array($settings) ) { + foreach ( array_keys($settings) as $number ) { + if ( is_numeric($number) ) { + $this->_set($number); + $this->_register_one($number); + $empty = false; + } + } + } + + if ( $empty ) { + // If there are none, we register the widget's existance with a + // generic template + $this->_set(1); + $this->_register_one(); + } + } + + function _set($number) { + $this->number = $number; + $this->id = $this->id_base . '-' . $number; + } + + function _get_display_callback() { + return array(&$this, 'display_callback'); + } + + function _get_update_callback() { + return array(&$this, 'update_callback'); + } + + function _get_form_callback() { + return array(&$this, 'form_callback'); + } + + /** Generate the actual widget content. + * Just finds the instance and calls widget(). + * Do NOT over-ride this function. */ + function display_callback( $args, $widget_args = 1 ) { + if ( is_numeric($widget_args) ) + $widget_args = array( 'number' => $widget_args ); + + $widget_args = wp_parse_args( $widget_args, array( 'number' => -1 ) ); + $this->_set( $widget_args['number'] ); + $instance = $this->get_settings(); + + if ( array_key_exists( $this->number, $instance ) ) { + $instance = $instance[$this->number]; + // filters the widget's settings, return false to stop displaying the widget + $instance = apply_filters('widget_display_callback', $instance, $this, $args); + if ( false !== $instance ) + $this->widget($args, $instance); + } + } + + /** Deal with changed settings. + * Do NOT over-ride this function. */ + function update_callback( $widget_args = 1 ) { + global $wp_registered_widgets; + + if ( is_numeric($widget_args) ) + $widget_args = array( 'number' => $widget_args ); + + $widget_args = wp_parse_args( $widget_args, array( 'number' => -1 ) ); + $all_instances = $this->get_settings(); + + // We need to update the data + if ( $this->updated ) + return; + + $sidebars_widgets = wp_get_sidebars_widgets(); + + if ( isset($_POST['delete_widget']) && $_POST['delete_widget'] ) { + // Delete the settings for this instance of the widget + if ( isset($_POST['the-widget-id']) ) + $del_id = $_POST['the-widget-id']; + else + return; + + if ( isset($wp_registered_widgets[$del_id]['params'][0]['number']) ) { + $number = $wp_registered_widgets[$del_id]['params'][0]['number']; + + if ( $this->id_base . '-' . $number == $del_id ) + unset($all_instances[$number]); + } + } else { + if ( isset($_POST['widget-' . $this->id_base]) && is_array($_POST['widget-' . $this->id_base]) ) { + $settings = $_POST['widget-' . $this->id_base]; + } elseif ( isset($_POST['id_base']) && $_POST['id_base'] == $this->id_base ) { + $num = $_POST['multi_number'] ? (int) $_POST['multi_number'] : (int) $_POST['widget_number']; + $settings = array( $num => array() ); + } else { + return; + } + + foreach ( $settings as $number => $new_instance ) { + $new_instance = stripslashes_deep($new_instance); + $this->_set($number); + + $old_instance = isset($all_instances[$number]) ? $all_instances[$number] : array(); + + $instance = $this->update($new_instance, $old_instance); + + // filters the widget's settings before saving, return false to cancel saving (keep the old settings if updating) + $instance = apply_filters('widget_update_callback', $instance, $new_instance, $old_instance, $this); + if ( false !== $instance ) + $all_instances[$number] = $instance; + + break; // run only once + } + } + + $this->save_settings($all_instances); + $this->updated = true; + } + + /** Generate the control form. + * Do NOT over-ride this function. */ + function form_callback( $widget_args = 1 ) { + if ( is_numeric($widget_args) ) + $widget_args = array( 'number' => $widget_args ); + + $widget_args = wp_parse_args( $widget_args, array( 'number' => -1 ) ); + $all_instances = $this->get_settings(); + + if ( -1 == $widget_args['number'] ) { + // We echo out a form where 'number' can be set later + $this->_set('__i__'); + $instance = array(); + } else { + $this->_set($widget_args['number']); + $instance = $all_instances[ $widget_args['number'] ]; + } + + // filters the widget admin form before displaying, return false to stop displaying it + $instance = apply_filters('widget_form_callback', $instance, $this); + + $return = null; + if ( false !== $instance ) { + $return = $this->form($instance); + // add extra fields in the widget form - be sure to set $return to null if you add any + // if the widget has no form the text echoed from the default form method can be hidden using css + do_action_ref_array( 'in_widget_form', array(&$this, &$return, $instance) ); + } + return $return; + } + + /** Helper function: Registers a single instance. */ + function _register_one($number = -1) { + wp_register_sidebar_widget( $this->id, $this->name, $this->_get_display_callback(), $this->widget_options, array( 'number' => $number ) ); + _register_widget_update_callback( $this->id_base, $this->_get_update_callback(), $this->control_options, array( 'number' => -1 ) ); + _register_widget_form_callback( $this->id, $this->name, $this->_get_form_callback(), $this->control_options, array( 'number' => $number ) ); + } + + function save_settings($settings) { + $settings['_multiwidget'] = 1; + update_option( $this->option_name, $settings ); + } + + function get_settings() { + $settings = get_option($this->option_name); + + if ( false === $settings && isset($this->alt_option_name) ) + $settings = get_option($this->alt_option_name); + + if ( !is_array($settings) ) + $settings = array(); + + if ( !array_key_exists('_multiwidget', $settings) ) { + // old format, conver if single widget + $settings = wp_convert_widget_settings($this->id_base, $this->option_name, $settings); + } + + unset($settings['_multiwidget'], $settings['__i__']); + return $settings; + } +} + +/** + * Singleton that registers and instantiates WP_Widget classes. + * + * @package WordPress + * @subpackage Widgets + * @since 2.8 + */ +class WP_Widget_Factory { + var $widgets = array(); + + function WP_Widget_Factory() { + add_action( 'widgets_init', array( &$this, '_register_widgets' ), 100 ); + } + + function register($widget_class) { + $this->widgets[$widget_class] = & new $widget_class(); + } + + function unregister($widget_class) { + if ( isset($this->widgets[$widget_class]) ) + unset($this->widgets[$widget_class]); + } + + function _register_widgets() { + global $wp_registered_widgets; + $keys = array_keys($this->widgets); + $registered = array_keys($wp_registered_widgets); + $registered = array_map('_get_widget_id_base', $registered); + + foreach ( $keys as $key ) { + // don't register new widget if old widget with the same id is already registered + if ( in_array($this->widgets[$key]->id_base, $registered, true) ) { + unset($this->widgets[$key]); + continue; + } + + $this->widgets[$key]->_register(); + } + } +} + +/* Global Variables */ + +/** @ignore */ +global $wp_registered_sidebars, $wp_registered_widgets, $wp_registered_widget_controls, $wp_registered_widget_updates; + +/** + * Stores the sidebars, since many themes can have more than one. + * + * @global array $wp_registered_sidebars + * @since 2.2.0 + */ +$wp_registered_sidebars = array(); + +/** + * Stores the registered widgets. + * + * @global array $wp_registered_widgets + * @since 2.2.0 + */ +$wp_registered_widgets = array(); + +/** + * Stores the registered widget control (options). + * + * @global array $wp_registered_widget_controls + * @since 2.2.0 + */ +$wp_registered_widget_controls = array(); +$wp_registered_widget_updates = array(); + +/** + * Private + */ +$_wp_sidebars_widgets = array(); + +/** + * Private + */ + $_wp_deprecated_widgets_callbacks = array( + 'wp_widget_pages', + 'wp_widget_pages_control', + 'wp_widget_calendar', + 'wp_widget_calendar_control', + 'wp_widget_archives', + 'wp_widget_archives_control', + 'wp_widget_links', + 'wp_widget_meta', + 'wp_widget_meta_control', + 'wp_widget_search', + 'wp_widget_recent_entries', + 'wp_widget_recent_entries_control', + 'wp_widget_tag_cloud', + 'wp_widget_tag_cloud_control', + 'wp_widget_categories', + 'wp_widget_categories_control', + 'wp_widget_text', + 'wp_widget_text_control', + 'wp_widget_rss', + 'wp_widget_rss_control', + 'wp_widget_recent_comments', + 'wp_widget_recent_comments_control' + ); + +/* Template tags & API functions */ + +/** + * Register a widget + * + * Registers a WP_Widget widget + * + * @since 2.8.0 + * + * @see WP_Widget + * @see WP_Widget_Factory + * @uses WP_Widget_Factory + * + * @param string $widget_class The name of a class that extends WP_Widget + */ +function register_widget($widget_class) { + global $wp_widget_factory; + + $wp_widget_factory->register($widget_class); +} + +/** + * Unregister a widget + * + * Unregisters a WP_Widget widget. Useful for unregistering default widgets. + * Run within a function hooked to the widgets_init action. + * + * @since 2.8.0 + * + * @see WP_Widget + * @see WP_Widget_Factory + * @uses WP_Widget_Factory + * + * @param string $widget_class The name of a class that extends WP_Widget + */ +function unregister_widget($widget_class) { + global $wp_widget_factory; + + $wp_widget_factory->unregister($widget_class); +} + +/** + * Creates multiple sidebars. + * + * If you wanted to quickly create multiple sidebars for a theme or internally. + * This function will allow you to do so. If you don't pass the 'name' and/or + * 'id' in $args, then they will be built for you. + * + * The default for the name is "Sidebar #", with '#' being replaced with the + * number the sidebar is currently when greater than one. If first sidebar, the + * name will be just "Sidebar". The default for id is "sidebar-" followed by the + * number the sidebar creation is currently at. If the id is provided, and mutliple + * sidebars are being defined, the id will have "-2" appended, and so on. + * + * @since 2.2.0 + * + * @see register_sidebar() The second parameter is documented by register_sidebar() and is the same here. + * @uses parse_str() Converts a string to an array to be used in the rest of the function. + * @uses register_sidebar() Sends single sidebar information [name, id] to this + * function to handle building the sidebar. + * + * @param int $number Number of sidebars to create. + * @param string|array $args Builds Sidebar based off of 'name' and 'id' values. + */ +function register_sidebars($number = 1, $args = array()) { + global $wp_registered_sidebars; + $number = (int) $number; + + if ( is_string($args) ) + parse_str($args, $args); + + for ( $i = 1; $i <= $number; $i++ ) { + $_args = $args; + + if ( $number > 1 ) + $_args['name'] = isset($args['name']) ? sprintf($args['name'], $i) : sprintf(__('Sidebar %d'), $i); + else + $_args['name'] = isset($args['name']) ? $args['name'] : __('Sidebar'); + + // Custom specified ID's are suffixed if they exist already. + // Automatically generated sidebar names need to be suffixed regardless starting at -0 + if ( isset($args['id']) ) { + $_args['id'] = $args['id']; + $n = 2; // Start at -2 for conflicting custom ID's + while ( isset($wp_registered_sidebars[$_args['id']]) ) + $_args['id'] = $args['id'] . '-' . $n++; + } else { + $n = count($wp_registered_sidebars); + do { + $_args['id'] = 'sidebar-' . ++$n; + } while ( isset($wp_registered_sidebars[$_args['id']]) ); + } + register_sidebar($_args); + } +} + +/** + * Builds the definition for a single sidebar and returns the ID. + * + * The $args parameter takes either a string or an array with 'name' and 'id' + * contained in either usage. It will be noted that the values will be applied + * to all sidebars, so if creating more than one, it will be advised to allow + * for WordPress to create the defaults for you. + * + * Example for string would be 'name=whatever;id=whatever1' and for + * the array it would be array( + * 'name' => 'whatever', + * 'id' => 'whatever1'). + * + * name - The name of the sidebar, which presumably the title which will be + * displayed. + * id - The unique identifier by which the sidebar will be called by. + * before_widget - The content that will prepended to the widgets when they are + * displayed. + * after_widget - The content that will be appended to the widgets when they are + * displayed. + * before_title - The content that will be prepended to the title when displayed. + * after_title - the content that will be appended to the title when displayed. + * + * Content is assumed to be HTML and should be formatted as such, but + * doesn't have to be. + * + * @since 2.2.0 + * @uses $wp_registered_sidebars Stores the new sidebar in this array by sidebar ID. + * + * @param string|array $args Builds Sidebar based off of 'name' and 'id' values + * @return string The sidebar id that was added. + */ +function register_sidebar($args = array()) { + global $wp_registered_sidebars; + + $i = count($wp_registered_sidebars) + 1; + + $defaults = array( + 'name' => sprintf(__('Sidebar %d'), $i ), + 'id' => "sidebar-$i", + 'description' => '', + 'before_widget' => '
        • ', + 'after_widget' => "
        • \n", + 'before_title' => '

          ', + 'after_title' => "

          \n", + ); + + $sidebar = wp_parse_args( $args, $defaults ); + + $wp_registered_sidebars[$sidebar['id']] = $sidebar; + + add_theme_support('widgets'); + + do_action( 'register_sidebar', $sidebar ); + + return $sidebar['id']; +} + +/** + * Removes a sidebar from the list. + * + * @since 2.2.0 + * + * @uses $wp_registered_sidebars Stores the new sidebar in this array by sidebar ID. + * + * @param string $name The ID of the sidebar when it was added. + */ +function unregister_sidebar( $name ) { + global $wp_registered_sidebars; + + if ( isset( $wp_registered_sidebars[$name] ) ) + unset( $wp_registered_sidebars[$name] ); +} + +/** + * Register widget for use in sidebars. + * + * The default widget option is 'classname' that can be override. + * + * The function can also be used to unregister widgets when $output_callback + * parameter is an empty string. + * + * @since 2.2.0 + * + * @uses $wp_registered_widgets Uses stored registered widgets. + * @uses $wp_register_widget_defaults Retrieves widget defaults. + * + * @param int|string $id Widget ID. + * @param string $name Widget display title. + * @param callback $output_callback Run when widget is called. + * @param array|string $options Optional. Widget Options. + * @param mixed $params,... Widget parameters to add to widget. + * @return null Will return if $output_callback is empty after removing widget. + */ +function wp_register_sidebar_widget($id, $name, $output_callback, $options = array()) { + global $wp_registered_widgets, $wp_registered_widget_controls, $wp_registered_widget_updates, $_wp_deprecated_widgets_callbacks; + + $id = strtolower($id); + + if ( empty($output_callback) ) { + unset($wp_registered_widgets[$id]); + return; + } + + $id_base = _get_widget_id_base($id); + if ( in_array($output_callback, $_wp_deprecated_widgets_callbacks, true) && !is_callable($output_callback) ) { + if ( isset($wp_registered_widget_controls[$id]) ) + unset($wp_registered_widget_controls[$id]); + + if ( isset($wp_registered_widget_updates[$id_base]) ) + unset($wp_registered_widget_updates[$id_base]); + + 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' ) ) ) { + do_action( 'wp_register_sidebar_widget', $widget ); + $wp_registered_widgets[$id] = $widget; + } +} + +/** + * Retrieve description for widget. + * + * When registering widgets, the options can also include 'description' that + * describes the widget for display on the widget administration panel or + * in the theme. + * + * @since 2.5.0 + * + * @param int|string $id Widget ID. + * @return string Widget description, if available. Null on failure to retrieve description. + */ +function wp_widget_description( $id ) { + if ( !is_scalar($id) ) + return; + + global $wp_registered_widgets; + + if ( isset($wp_registered_widgets[$id]['description']) ) + return esc_html( $wp_registered_widgets[$id]['description'] ); +} + +/** + * Retrieve description for a sidebar. + * + * When registering sidebars a 'description' parameter can be included that + * describes the sidebar for display on the widget administration panel. + * + * @since 2.9.0 + * + * @param int|string $id sidebar ID. + * @return string Sidebar description, if available. Null on failure to retrieve description. + */ +function wp_sidebar_description( $id ) { + if ( !is_scalar($id) ) + return; + + global $wp_registered_sidebars; + + if ( isset($wp_registered_sidebars[$id]['description']) ) + return esc_html( $wp_registered_sidebars[$id]['description'] ); +} + + +/** + * Remove widget from sidebar. + * + * @since 2.2.0 + * + * @param int|string $id Widget ID. + */ +function wp_unregister_sidebar_widget($id) { + do_action( 'wp_unregister_sidebar_widget', $id ); + + wp_register_sidebar_widget($id, '', ''); + wp_unregister_widget_control($id); +} + +/** + * Registers widget control callback for customizing options. + * + * The options contains the 'height', 'width', and 'id_base' keys. The 'height' + * option is never used. The 'width' option is the width of the fully expanded + * control form, but try hard to use the default width. The 'id_base' is for + * multi-widgets (widgets which allow multiple instances such as the text + * widget), an id_base must be provided. The widget id will end up looking like + * {$id_base}-{$unique_number}. + * + * @since 2.2.0 + * + * @param int|string $id Sidebar ID. + * @param string $name Sidebar display name. + * @param callback $control_callback Run when sidebar is displayed. + * @param array|string $options Optional. Widget options. See above long description. + * @param mixed $params,... Optional. Additional parameters to add to widget. + */ +function wp_register_widget_control($id, $name, $control_callback, $options = array()) { + global $wp_registered_widget_controls, $wp_registered_widget_updates, $wp_registered_widgets, $_wp_deprecated_widgets_callbacks; + + $id = strtolower($id); + $id_base = _get_widget_id_base($id); + + if ( empty($control_callback) ) { + unset($wp_registered_widget_controls[$id]); + unset($wp_registered_widget_updates[$id_base]); + return; + } + + if ( in_array($control_callback, $_wp_deprecated_widgets_callbacks, true) && !is_callable($control_callback) ) { + if ( isset($wp_registered_widgets[$id]) ) + unset($wp_registered_widgets[$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; + + if ( isset($wp_registered_widget_updates[$id_base]) ) + return; + + if ( isset($widget['params'][0]['number']) ) + $widget['params'][0]['number'] = -1; + + unset($widget['width'], $widget['height'], $widget['name'], $widget['id']); + $wp_registered_widget_updates[$id_base] = $widget; +} + +function _register_widget_update_callback($id_base, $update_callback, $options = array()) { + global $wp_registered_widget_updates; + + if ( isset($wp_registered_widget_updates[$id_base]) ) { + if ( empty($update_callback) ) + unset($wp_registered_widget_updates[$id_base]); + return; + } + + $widget = array( + 'callback' => $update_callback, + 'params' => array_slice(func_get_args(), 3) + ); + + $widget = array_merge($widget, $options); + $wp_registered_widget_updates[$id_base] = $widget; +} + +function _register_widget_form_callback($id, $name, $form_callback, $options = array()) { + global $wp_registered_widget_controls; + + $id = strtolower($id); + + if ( empty($form_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 ); + $options = wp_parse_args($options, $defaults); + $options['width'] = (int) $options['width']; + $options['height'] = (int) $options['height']; + + $widget = array( + 'name' => $name, + 'id' => $id, + 'callback' => $form_callback, + 'params' => array_slice(func_get_args(), 4) + ); + $widget = array_merge($widget, $options); + + $wp_registered_widget_controls[$id] = $widget; +} + +/** + * Remove control callback for widget. + * + * @since 2.2.0 + * @uses wp_register_widget_control() Unregisters by using empty callback. + * + * @param int|string $id Widget ID. + */ +function wp_unregister_widget_control($id) { + return wp_register_widget_control($id, '', ''); +} + +/** + * Display dynamic sidebar. + * + * By default it displays the default sidebar or 'sidebar-1'. The 'sidebar-1' is + * not named by the theme, the actual name is '1', but 'sidebar-' is added to + * the registered sidebars for the name. If you named your sidebar 'after-post', + * then the parameter $index will still be 'after-post', but the lookup will be + * for 'sidebar-after-post'. + * + * It is confusing for the $index parameter, but just know that it should just + * work. When you register the sidebar in the theme, you will use the same name + * for this function or "Pay no heed to the man behind the curtain." Just accept + * it as an oddity of WordPress sidebar register and display. + * + * @since 2.2.0 + * + * @param int|string $index Optional, default is 1. Name or ID of dynamic sidebar. + * @return bool True, if widget sidebar was found and called. False if not found or not called. + */ +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 ( (array) $wp_registered_sidebars as $key => $value ) { + if ( sanitize_title($value['name']) == $index ) { + $index = $key; + break; + } + } + } + + $sidebars_widgets = wp_get_sidebars_widgets(); + if ( empty( $sidebars_widgets ) ) + return false; + + 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 ( (array) $sidebars_widgets[$index] as $id ) { + + if ( !isset($wp_registered_widgets[$id]) ) continue; + + $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']; + + do_action( 'dynamic_sidebar', $wp_registered_widgets[$id] ); + + if ( is_callable($callback) ) { + call_user_func_array($callback, $params); + $did_one = true; + } + } + + return $did_one; +} + +/** + * Whether widget is displayed on the front-end. + * + * Either $callback or $id_base can be used + * $id_base is the first argument when extending WP_Widget class + * Without the optional $widget_id parameter, returns the ID of the first sidebar + * in which the first instance of the widget with the given callback or $id_base is found. + * With the $widget_id parameter, returns the ID of the sidebar where + * the widget with that callback/$id_base AND that ID is found. + * + * NOTE: $widget_id and $id_base are the same for single widgets. To be effective + * this function has to run after widgets have initialized, at action 'init' or later. + * + * @since 2.2.0 + * + * @param string $callback Optional, Widget callback to check. + * @param int $widget_id Optional, but needed for checking. Widget ID. + * @param string $id_base Optional, the base ID of a widget created by extending WP_Widget. + * @param bool $skip_inactive Optional, whether to check in 'wp_inactive_widgets'. + * @return mixed false if widget is not active or id of sidebar in which the widget is active. + */ +function is_active_widget($callback = false, $widget_id = false, $id_base = false, $skip_inactive = true) { + global $wp_registered_widgets; + + $sidebars_widgets = wp_get_sidebars_widgets(); + + if ( is_array($sidebars_widgets) ) { + foreach ( $sidebars_widgets as $sidebar => $widgets ) { + if ( $skip_inactive && 'wp_inactive_widgets' == $sidebar ) + continue; + + if ( is_array($widgets) ) { + foreach ( $widgets as $widget ) { + if ( ( $callback && isset($wp_registered_widgets[$widget]['callback']) && $wp_registered_widgets[$widget]['callback'] == $callback ) || ( $id_base && _get_widget_id_base($widget) == $id_base ) ) { + if ( !$widget_id || $widget_id == $wp_registered_widgets[$widget]['id'] ) + return $sidebar; + } + } + } + } + } + return false; +} + +/** + * Whether the dynamic sidebar is enabled and used by theme. + * + * @since 2.2.0 + * + * @return bool True, if using widgets. False, if not using widgets. + */ +function is_dynamic_sidebar() { + global $wp_registered_widgets, $wp_registered_sidebars; + $sidebars_widgets = get_option('sidebars_widgets'); + foreach ( (array) $wp_registered_sidebars as $index => $sidebar ) { + if ( count($sidebars_widgets[$index]) ) { + foreach ( (array) $sidebars_widgets[$index] as $widget ) + if ( array_key_exists($widget, $wp_registered_widgets) ) + return true; + } + } + return false; +} + +/** + * Whether a sidebar is in use. + * + * @since 2.8 + * + * @param mixed $index Sidebar name, id or number to check. + * @return bool true if the sidebar is in use, false otherwise. + */ +function is_active_sidebar( $index ) { + $index = ( is_int($index) ) ? "sidebar-$index" : sanitize_title($index); + $sidebars_widgets = wp_get_sidebars_widgets(); + if ( !empty($sidebars_widgets[$index]) ) + return true; + + return false; +} + +/* Internal Functions */ + +/** + * Retrieve full list of sidebars and their widgets. + * + * Will upgrade sidebar widget list, if needed. Will also save updated list, if + * needed. + * + * @since 2.2.0 + * @access private + * + * @param bool $deprecated Not used (deprecated). + * @return array Upgraded list of widgets to version 3 array format when called from the admin. + */ +function wp_get_sidebars_widgets($deprecated = true) { + if ( $deprecated !== true ) + _deprecated_argument( __FUNCTION__, '2.8.1' ); + + global $wp_registered_widgets, $wp_registered_sidebars, $_wp_sidebars_widgets; + + // If loading from front page, consult $_wp_sidebars_widgets rather than options + // to see if wp_convert_widget_settings() has made manipulations in memory. + if ( !is_admin() ) { + if ( empty($_wp_sidebars_widgets) ) + $_wp_sidebars_widgets = get_option('sidebars_widgets', array()); + + $sidebars_widgets = $_wp_sidebars_widgets; + } else { + $sidebars_widgets = get_option('sidebars_widgets', array()); + $_sidebars_widgets = array(); + + if ( isset($sidebars_widgets['wp_inactive_widgets']) || empty($sidebars_widgets) ) + $sidebars_widgets['array_version'] = 3; + elseif ( !isset($sidebars_widgets['array_version']) ) + $sidebars_widgets['array_version'] = 1; + + switch ( $sidebars_widgets['array_version'] ) { + case 1 : + foreach ( (array) $sidebars_widgets as $index => $sidebar ) + if ( is_array($sidebar) ) + foreach ( (array) $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 ( (array) $sidebars as $id ) { + if ( array_key_exists( $id, $sidebars_widgets ) ) { + $_sidebars_widgets[$id] = $sidebars_widgets[$id]; + unset($sidebars_widgets[$id], $sidebars[$id]); + } + } + + // move the rest to wp_inactive_widgets + if ( !isset($_sidebars_widgets['wp_inactive_widgets']) ) + $_sidebars_widgets['wp_inactive_widgets'] = array(); + + if ( !empty($sidebars_widgets) ) { + foreach ( $sidebars_widgets as $lost => $val ) { + if ( is_array($val) ) + $_sidebars_widgets['wp_inactive_widgets'] = array_merge( (array) $_sidebars_widgets['wp_inactive_widgets'], $val ); + } + } + + $sidebars_widgets = $_sidebars_widgets; + unset($_sidebars_widgets); + } + } + } + + if ( is_array( $sidebars_widgets ) && isset($sidebars_widgets['array_version']) ) + unset($sidebars_widgets['array_version']); + + $sidebars_widgets = apply_filters('sidebars_widgets', $sidebars_widgets); + return $sidebars_widgets; +} + +/** + * Set the sidebar widget option to update sidebars. + * + * @since 2.2.0 + * @access private + * + * @param array $sidebars_widgets Sidebar widgets and their settings. + */ +function wp_set_sidebars_widgets( $sidebars_widgets ) { + if ( !isset( $sidebars_widgets['array_version'] ) ) + $sidebars_widgets['array_version'] = 3; + update_option( 'sidebars_widgets', $sidebars_widgets ); +} + +/** + * Retrieve default registered sidebars list. + * + * @since 2.2.0 + * @access private + * + * @return array + */ +function wp_get_widget_defaults() { + global $wp_registered_sidebars; + + $defaults = array(); + + foreach ( (array) $wp_registered_sidebars as $index => $sidebar ) + $defaults[$index] = array(); + + return $defaults; +} + +/** + * Convert the widget settings from single to multi-widget format. + * + * @since 2.8.0 + * + * @return array + */ +function wp_convert_widget_settings($base_name, $option_name, $settings) { + // This test may need expanding. + $single = $changed = false; + if ( empty($settings) ) { + $single = true; + } else { + foreach ( array_keys($settings) as $number ) { + if ( 'number' == $number ) + continue; + if ( !is_numeric($number) ) { + $single = true; + break; + } + } + } + + if ( $single ) { + $settings = array( 2 => $settings ); + + // If loading from the front page, update sidebar in memory but don't save to options + if ( is_admin() ) { + $sidebars_widgets = get_option('sidebars_widgets'); + } else { + if ( empty($GLOBALS['_wp_sidebars_widgets']) ) + $GLOBALS['_wp_sidebars_widgets'] = get_option('sidebars_widgets', array()); + $sidebars_widgets = &$GLOBALS['_wp_sidebars_widgets']; + } + + foreach ( (array) $sidebars_widgets as $index => $sidebar ) { + if ( is_array($sidebar) ) { + foreach ( $sidebar as $i => $name ) { + if ( $base_name == $name ) { + $sidebars_widgets[$index][$i] = "$name-2"; + $changed = true; + break 2; + } + } + } + } + + if ( is_admin() && $changed ) + update_option('sidebars_widgets', $sidebars_widgets); + } + + $settings['_multiwidget'] = 1; + if ( is_admin() ) + update_option( $option_name, $settings ); + + return $settings; +} + +/** + * Output an arbitrary widget as a template tag + * + * @since 2.8 + * + * @param string $widget the widget's PHP class name (see default-widgets.php) + * @param array $instance the widget's instance settings + * @param array $args the widget's sidebar args + * @return void + **/ +function the_widget($widget, $instance = array(), $args = array()) { + global $wp_widget_factory; + + $widget_obj = $wp_widget_factory->widgets[$widget]; + if ( !is_a($widget_obj, 'WP_Widget') ) + return; + + $before_widget = sprintf('
          ', $widget_obj->widget_options['classname']); + $default_args = array('before_widget' => $before_widget, 'after_widget' => "
          ", 'before_title' => '

          ', 'after_title' => '

          '); + + $args = wp_parse_args($args, $default_args); + $instance = wp_parse_args($instance); + + do_action( 'the_widget', $widget, $instance, $args ); + + $widget_obj->_set(-1); + $widget_obj->widget($args, $instance); +} + +/** + * Private + */ +function _get_widget_id_base($id) { + return preg_replace( '/-[0-9]+$/', '', $id ); +} diff --git a/src/wp-includes/wlwmanifest.xml b/src/wp-includes/wlwmanifest.xml new file mode 100644 index 0000000..eb13147 --- /dev/null +++ b/src/wp-includes/wlwmanifest.xml @@ -0,0 +1,44 @@ + + + + + + WordPress + Yes + Yes + + + + WordPress + images/wlw/wp-icon.png + images/wlw/wp-watermark.png + View site + Dashboard + + + + + + + + + + + + + + + diff --git a/src/wp-includes/wp-db.php b/src/wp-includes/wp-db.php new file mode 100644 index 0000000..89ed397 --- /dev/null +++ b/src/wp-includes/wp-db.php @@ -0,0 +1,1554 @@ + '%d' + * + * @since 2.8.0 + * @see wpdb:prepare() + * @see wpdb:insert() + * @see wpdb:update() + * @see wp_set_wpdb_vars() + * @access public + * @var array + */ + var $field_types = array(); + + /** + * Database table columns charset + * + * @since 2.2.0 + * @access public + * @var string + */ + var $charset; + + /** + * Database table columns collate + * + * @since 2.2.0 + * @access public + * @var string + */ + var $collate; + + /** + * Whether to use mysql_real_escape_string + * + * @since 2.8.0 + * @access public + * @var bool + */ + var $real_escape = false; + + /** + * Database Username + * + * @since 2.9.0 + * @access private + * @var string + */ + var $dbuser; + + /** + * A textual description of the last query/get_row/get_var call + * + * @since 3.0.0 + * @access public + * @var string + */ + var $func_call; + + /** + * 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. + * + * @link http://core.trac.wordpress.org/ticket/3354 + * @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 ( WP_DEBUG ) + $this->show_errors(); + + $this->init_charset(); + + $this->dbuser = $dbuser; + $this->dbpassword = $dbpassword; + $this->dbname = $dbname; + $this->dbhost = $dbhost; + + $this->db_connect(); + } + + /** + * PHP5 style destructor and will run when database object is destroyed. + * + * @see wpdb::__construct() + * @since 2.0.8 + * @return bool true + */ + function __destruct() { + return true; + } + + /** + * Set $this->charset and $this->collate + * + * @since 3.1.0 + */ + function init_charset() { + if ( function_exists('is_multisite') && is_multisite() ) { + $this->charset = 'utf8'; + if ( defined( 'DB_COLLATE' ) && DB_COLLATE ) + $this->collate = DB_COLLATE; + else + $this->collate = 'utf8_general_ci'; + } elseif ( defined( 'DB_COLLATE' ) ) { + $this->collate = DB_COLLATE; + } + + if ( defined( 'DB_CHARSET' ) ) + $this->charset = DB_CHARSET; + } + + /** + * Sets the connection's character set. + * + * @since 3.1.0 + * + * @param resource $dbh The resource given by mysql_connect + * @param string $charset The character set (optional) + * @param string $collate The collation (optional) + */ + function set_charset($dbh, $charset = null, $collate = null) { + if ( !isset($charset) ) + $charset = $this->charset; + if ( !isset($collate) ) + $collate = $this->collate; + if ( $this->has_cap( 'collation', $dbh ) && !empty( $charset ) ) { + if ( function_exists( 'mysql_set_charset' ) && $this->has_cap( 'set_charset', $dbh ) ) { + mysql_set_charset( $charset, $dbh ); + $this->real_escape = true; + } else { + $query = $this->prepare( 'SET NAMES %s', $charset ); + if ( ! empty( $collate ) ) + $query .= $this->prepare( ' COLLATE %s', $collate ); + mysql_query( $query, $dbh ); + } + } + } + + /** + * Sets the table prefix for the WordPress tables. + * + * @since 2.5.0 + * + * @param string $prefix Alphanumeric name for the new prefix. + * @return string|WP_Error Old prefix or WP_Error on error + */ + function set_prefix( $prefix, $set_table_names = true ) { + + if ( preg_match( '|[^a-z0-9_]|i', $prefix ) ) + return new WP_Error('invalid_db_prefix', /*WP_I18N_DB_BAD_PREFIX*/'Prefijo de la base de datos no válido'/*/WP_I18N_DB_BAD_PREFIX*/); + + $old_prefix = is_multisite() ? '' : $prefix; + + if ( isset( $this->base_prefix ) ) + $old_prefix = $this->base_prefix; + + $this->base_prefix = $prefix; + + if ( $set_table_names ) { + foreach ( $this->tables( 'global' ) as $table => $prefixed_table ) + $this->$table = $prefixed_table; + + if ( is_multisite() && empty( $this->blogid ) ) + return $old_prefix; + + $this->prefix = $this->get_blog_prefix(); + + foreach ( $this->tables( 'blog' ) as $table => $prefixed_table ) + $this->$table = $prefixed_table; + + foreach ( $this->tables( 'old' ) as $table => $prefixed_table ) + $this->$table = $prefixed_table; + } + return $old_prefix; + } + + /** + * Sets blog id. + * + * @since 3.0.0 + * @access public + * @param int $blog_id + * @param int $site_id Optional. + * @return string previous blog id + */ + function set_blog_id( $blog_id, $site_id = 0 ) { + if ( ! empty( $site_id ) ) + $this->siteid = $site_id; + + $old_blog_id = $this->blogid; + $this->blogid = $blog_id; + + $this->prefix = $this->get_blog_prefix(); + + foreach ( $this->tables( 'blog' ) as $table => $prefixed_table ) + $this->$table = $prefixed_table; + + foreach ( $this->tables( 'old' ) as $table => $prefixed_table ) + $this->$table = $prefixed_table; + + return $old_blog_id; + } + + /** + * Gets blog prefix. + * + * @uses is_multisite() + * @since 3.0.0 + * @param int $blog_id Optional. + * @return string Blog prefix. + */ + function get_blog_prefix( $blog_id = null ) { + if ( is_multisite() ) { + if ( null === $blog_id ) + $blog_id = $this->blogid; + $blog_id = (int) $blog_id; + if ( defined( 'MULTISITE' ) && ( 0 == $blog_id || 1 == $blog_id ) ) + return $this->base_prefix; + else + return $this->base_prefix . $blog_id . '_'; + } else { + return $this->base_prefix; + } + } + + /** + * Returns an array of WordPress tables. + * + * Also allows for the CUSTOM_USER_TABLE and CUSTOM_USER_META_TABLE to + * override the WordPress users and usersmeta tables that would otherwise + * be determined by the prefix. + * + * The scope argument can take one of the following: + * + * 'all' - returns 'all' and 'global' tables. No old tables are returned. + * 'blog' - returns the blog-level tables for the queried blog. + * 'global' - returns the global tables for the installation, returning multisite tables only if running multisite. + * 'ms_global' - returns the multisite global tables, regardless if current installation is multisite. + * 'old' - returns tables which are deprecated. + * + * @since 3.0.0 + * @uses wpdb::$tables + * @uses wpdb::$old_tables + * @uses wpdb::$global_tables + * @uses wpdb::$ms_global_tables + * @uses is_multisite() + * + * @param string $scope Optional. Can be all, global, ms_global, blog, or old tables. Defaults to all. + * @param bool $prefix Optional. Whether to include table prefixes. Default true. If blog + * prefix is requested, then the custom users and usermeta tables will be mapped. + * @param int $blog_id Optional. The blog_id to prefix. Defaults to wpdb::$blogid. Used only when prefix is requested. + * @return array Table names. When a prefix is requested, the key is the unprefixed table name. + */ + function tables( $scope = 'all', $prefix = true, $blog_id = 0 ) { + switch ( $scope ) { + case 'all' : + $tables = array_merge( $this->global_tables, $this->tables ); + if ( is_multisite() ) + $tables = array_merge( $tables, $this->ms_global_tables ); + break; + case 'blog' : + $tables = $this->tables; + break; + case 'global' : + $tables = $this->global_tables; + if ( is_multisite() ) + $tables = array_merge( $tables, $this->ms_global_tables ); + break; + case 'ms_global' : + $tables = $this->ms_global_tables; + break; + case 'old' : + $tables = $this->old_tables; + break; + default : + return array(); + break; + } + + if ( $prefix ) { + if ( ! $blog_id ) + $blog_id = $this->blogid; + $blog_prefix = $this->get_blog_prefix( $blog_id ); + $base_prefix = $this->base_prefix; + $global_tables = array_merge( $this->global_tables, $this->ms_global_tables ); + foreach ( $tables as $k => $table ) { + if ( in_array( $table, $global_tables ) ) + $tables[ $table ] = $base_prefix . $table; + else + $tables[ $table ] = $blog_prefix . $table; + unset( $tables[ $k ] ); + } + + if ( isset( $tables['users'] ) && defined( 'CUSTOM_USER_TABLE' ) ) + $tables['users'] = CUSTOM_USER_TABLE; + + if ( isset( $tables['usermeta'] ) && defined( 'CUSTOM_USER_META_TABLE' ) ) + $tables['usermeta'] = CUSTOM_USER_META_TABLE; + } + + return $tables; + } + + /** + * 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 + * @param resource $dbh Optional link identifier. + * @return null Always null. + */ + function select( $db, $dbh = null) { + if ( is_null($dbh) ) + $dbh = $this->dbh; + + if ( !@mysql_select_db( $db, $dbh ) ) { + $this->ready = false; + $this->bail( sprintf( /*WP_I18N_DB_SELECT_DB*/'

          No se pudo elegir base de datos

          +

          Hemos podido conectar con el servidor de la bases de datos (lo que significa que tu nombre de usuario y la contraseña están correctos) pero no se pudo elegir la base de datos %1$s.

          +
            +
          • ¿Estás seguro que existe?
          • +
          • ¿El usuario %2$s tiene permiso para utilizar la base de datos %1$?
          • +
          • En algunos sistemas el nombre de la base de datos es el prefijo con el nombre de usuario, que sería como username_%1$s. ¿Podría ser ésto el problema?
          • +
          +

          Si no sabes cómo configurar una base de datos debes ponerte en contacto con el administrador de su hosting. Si todo lo demás falla puedes encontrar ayuda en los Foros de Soporte de WordPress.

          '/*/WP_I18N_DB_SELECT_DB*/, $db, $this->dbuser ), 'db_select_fail' ); + return; + } + } + + /** + * Weak escape, using addslashes() + * + * @see addslashes() + * @since 2.8.0 + * @access private + * + * @param string $string + * @return string + */ + function _weak_escape( $string ) { + return addslashes( $string ); + } + + /** + * Real escape, using mysql_real_escape_string() or addslashes() + * + * @see mysql_real_escape_string() + * @see addslashes() + * @since 2.8.0 + * @access private + * + * @param string $string to escape + * @return string escaped + */ + function _real_escape( $string ) { + if ( $this->dbh && $this->real_escape ) + return mysql_real_escape_string( $string, $this->dbh ); + else + return addslashes( $string ); + } + + /** + * Escape data. Works on arrays. + * + * @uses wpdb::_escape() + * @uses wpdb::_real_escape() + * @since 2.8.0 + * @access private + * + * @param string|array $data + * @return string|array escaped + */ + function _escape( $data ) { + if ( is_array( $data ) ) { + foreach ( (array) $data as $k => $v ) { + if ( is_array($v) ) + $data[$k] = $this->_escape( $v ); + else + $data[$k] = $this->_real_escape( $v ); + } + } else { + $data = $this->_real_escape( $data ); + } + + return $data; + } + + /** + * Escapes content for insertion into the database using addslashes(), for security. + * + * Works on arrays. + * + * @since 0.71 + * @param string|array $data to escape + * @return string|array escaped as query safe string + */ + function escape( $data ) { + if ( is_array( $data ) ) { + foreach ( (array) $data as $k => $v ) { + if ( is_array( $v ) ) + $data[$k] = $this->escape( $v ); + else + $data[$k] = $this->_weak_escape( $v ); + } + } else { + $data = $this->_weak_escape( $data ); + } + + return $data; + } + + /** + * Escapes content by reference for insertion into the database, for security + * + * @uses wpdb::_real_escape() + * @since 2.3.0 + * @param string $string to escape + * @return void + */ + function escape_by_ref( &$string ) { + $string = $this->_real_escape( $string ); + } + + /** + * Prepares a SQL query for safe execution. Uses sprintf()-like syntax. + * + * The following directives can be used in the query format string: + * %d (decimal number) + * %s (string) + * %% (literal percentage sign - no argument needed) + * + * Both %d and %s are to be left unquoted in the query string and they need an argument passed for them. + * Literals (%) as parts of the query must be properly written as %%. + * + * This function only supports a small subset of the sprintf syntax; it only supports %d (decimal number), %s (string). + * Does not support sign, padding, alignment, width or precision specifiers. + * Does not support argument numbering/swapping. + * + * May be called like {@link http://php.net/sprintf sprintf()} or like {@link http://php.net/vsprintf vsprintf()}. + * + * Both %d and %s should be left unquoted in the query string. + * + * + * wpdb::prepare( "SELECT * FROM `table` WHERE `column` = %s AND `field` = %d", 'foo', 1337 ) + * wpdb::prepare( "SELECT DATE_FORMAT(`field`, '%%c') FROM `table` WHERE `column` = %s", 'foo' ); + * + * + * @link http://php.net/sprintf Description of syntax. + * @since 2.3.0 + * + * @param string $query Query statement with sprintf()-like placeholders + * @param array|mixed $args The array of variables to substitute into the query's placeholders if being called like + * {@link http://php.net/vsprintf vsprintf()}, or the first variable to substitute into the query's placeholders if + * being called like {@link http://php.net/sprintf sprintf()}. + * @param mixed $args,... further variables to substitute into the query's placeholders if being called like + * {@link http://php.net/sprintf sprintf()}. + * @return null|false|string Sanitized query string, null if there is no query, false if there is an error and string + * if there was something to prepare + */ + function prepare( $query = null ) { // ( $query, *$args ) + if ( is_null( $query ) ) + return; + + $args = func_get_args(); + array_shift( $args ); + // If args were passed as an array (as in vsprintf), move them up + if ( isset( $args[0] ) && is_array($args[0]) ) + $args = $args[0]; + $query = str_replace( "'%s'", '%s', $query ); // in case someone mistakenly already singlequoted it + $query = str_replace( '"%s"', '%s', $query ); // doublequote unquoting + $query = preg_replace( '|(?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*/'Error %1$s de la base de datos de WordPress para la consulta %2$s realizada por %3$s'/*/WP_I18N_DB_QUERY_ERROR_FULL*/, $str, $this->last_query, $caller ); + else + $error_str = sprintf( /*WP_I18N_DB_QUERY_ERROR*/'Error %1$s de la base de datos de WordPress para la consulta %2$s'/*/WP_I18N_DB_QUERY_ERROR*/, $str, $this->last_query ); + + if ( function_exists( 'error_log' ) + && ( $log_file = @ini_get( 'error_log' ) ) + && ( 'syslog' == $log_file || @is_writable( $log_file ) ) + ) + @error_log( $error_str ); + + // Are we showing errors? + if ( ! $this->show_errors ) + return false; + + // If there is an error then take note of it + if ( is_multisite() ) { + $msg = "WordPress database error: [$str]\n{$this->last_query}\n"; + if ( defined( 'ERRORLOGFILE' ) ) + error_log( $msg, 3, ERRORLOGFILE ); + if ( defined( 'DIEONDBERROR' ) ) + wp_die( $msg ); + } else { + $str = htmlspecialchars( $str, ENT_QUOTES ); + $query = htmlspecialchars( $this->last_query, ENT_QUOTES ); + + print "
          +

          WordPress database error: [$str]
          + $query

          +
          "; + } + } + + /** + * 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 + * @see wpdb::hide_errors() + * + * @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. + * + * By default database errors are not shown. + * + * @since 0.71 + * @see wpdb::show_errors() + * + * @return bool Whether showing of errors was active + */ + function hide_errors() { + $show = $this->show_errors; + $this->show_errors = false; + return $show; + } + + /** + * Whether to suppress database errors. + * + * By default database errors are suppressed, with a simple + * call to this function they can be enabled. + * + * @since 2.5.0 + * @see wpdb::hide_errors() + * @param bool $suppress Optional. New value. Defaults to true. + * @return bool Old value + */ + function suppress_errors( $suppress = true ) { + $errors = $this->suppress_errors; + $this->suppress_errors = (bool) $suppress; + return $errors; + } + + /** + * Kill cached query results. + * + * @since 0.71 + * @return void + */ + function flush() { + $this->last_result = array(); + $this->col_info = null; + $this->last_query = null; + } + + /** + * Connect to and select database + * + * @since 3.0.0 + */ + function db_connect() { + if ( WP_DEBUG ) { + $this->dbh = mysql_connect( $this->dbhost, $this->dbuser, $this->dbpassword, true ); + } else { + $this->dbh = @mysql_connect( $this->dbhost, $this->dbuser, $this->dbpassword, true ); + } + + if ( !$this->dbh ) { + $this->bail( sprintf( /*WP_I18N_DB_CONN_ERROR*/' +

          Error de conexión con la base de datos

          +

          Esto puede deberse a que los datos de usuario y contraseña de tu wp-config.php son incorrectos o a que no es posible contactar con el servidor de base de datos en %s, lo que podría significar que el servidor de bases de datos de tu host está inactivo.

          +
            +
          • ¿Estás seguro de que el nombre de usuario y la contraseña son correctos?
          • +
          • ¿Estás seguro de que el nombre del host es correcto?
          • +
          • ¿Estás seguro de que el servidor de bases de datos está activo?
          • +
          +

          Si no tienes muy claro lo que significan los términos anteriores, ponte en contacto con tu proveedor de alojamiento. Si necesitas más ayuda, puedes visitar los Foros de ayuda de WordPress.

          +'/*/WP_I18N_DB_CONN_ERROR*/, $this->dbhost ), 'db_connect_fail' ); + + return; + } + + $this->set_charset( $this->dbh ); + + $this->ready = true; + + $this->select( $this->dbname, $this->dbh ); + } + + /** + * Perform a MySQL database query, using current database connection. + * + * More information can be found on the codex page. + * + * @since 0.71 + * + * @param string $query Database query + * @return int|false Number of rows affected/selected or false on error + */ + function query( $query ) { + if ( ! $this->ready ) + return false; + + // 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 ); + + $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; + + if ( defined( 'SAVEQUERIES' ) && SAVEQUERIES ) + $this->timer_start(); + + $this->result = @mysql_query( $query, $this->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 ( $this->last_error = mysql_error( $this->dbh ) ) { + $this->print_error(); + return false; + } + + if ( preg_match( '/^\s*(create|alter|truncate|drop) /i', $query ) ) { + $return_val = $this->result; + } elseif ( preg_match( '/^\s*(insert|delete|update|replace) /i', $query ) ) { + $this->rows_affected = mysql_affected_rows( $this->dbh ); + // Take note of the insert_id + if ( preg_match( '/^\s*(insert|replace) /i', $query ) ) { + $this->insert_id = mysql_insert_id($this->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 + // and return number of rows selected + $this->num_rows = $num_rows; + $return_val = $num_rows; + } + + return $return_val; + } + + /** + * Insert a row into a table. + * + * + * wpdb::insert( 'table', array( 'column' => 'foo', 'field' => 'bar' ) ) + * wpdb::insert( 'table', array( 'column' => 'foo', 'field' => 1337 ), array( '%s', '%d' ) ) + * + * + * @since 2.5.0 + * @see wpdb::prepare() + * @see wpdb::$field_types + * @see wp_set_wpdb_vars() + * + * @param string $table table name + * @param array $data Data to insert (in column => value pairs). Both $data columns and $data values should be "raw" (neither should be SQL escaped). + * @param array|string $format Optional. An array of formats to be mapped to each of the value in $data. If string, that format will be used for all of the values in $data. + * A format is one of '%d', '%s' (decimal number, string). If omitted, all values in $data will be treated as strings unless otherwise specified in wpdb::$field_types. + * @return int|false The number of rows inserted, or false on error. + */ + function insert( $table, $data, $format = null ) { + return $this->_insert_replace_helper( $table, $data, $format, 'INSERT' ); + } + + /** + * Replace a row into a table. + * + * + * wpdb::replace( 'table', array( 'column' => 'foo', 'field' => 'bar' ) ) + * wpdb::replace( 'table', array( 'column' => 'foo', 'field' => 1337 ), array( '%s', '%d' ) ) + * + * + * @since 3.0.0 + * @see wpdb::prepare() + * @see wpdb::$field_types + * @see wp_set_wpdb_vars() + * + * @param string $table table name + * @param array $data Data to insert (in column => value pairs). Both $data columns and $data values should be "raw" (neither should be SQL escaped). + * @param array|string $format Optional. An array of formats to be mapped to each of the value in $data. If string, that format will be used for all of the values in $data. + * A format is one of '%d', '%s' (decimal number, string). If omitted, all values in $data will be treated as strings unless otherwise specified in wpdb::$field_types. + * @return int|false The number of rows affected, or false on error. + */ + function replace( $table, $data, $format = null ) { + return $this->_insert_replace_helper( $table, $data, $format, 'REPLACE' ); + } + + /** + * Helper function for insert and replace. + * + * Runs an insert or replace query based on $type argument. + * + * @access private + * @since 3.0.0 + * @see wpdb::prepare() + * @see wpdb::$field_types + * @see wp_set_wpdb_vars() + * + * @param string $table table name + * @param array $data Data to insert (in column => value pairs). Both $data columns and $data values should be "raw" (neither should be SQL escaped). + * @param array|string $format Optional. An array of formats to be mapped to each of the value in $data. If string, that format will be used for all of the values in $data. + * A format is one of '%d', '%s' (decimal number, string). If omitted, all values in $data will be treated as strings unless otherwise specified in wpdb::$field_types. + * @return int|false The number of rows affected, or false on error. + */ + function _insert_replace_helper( $table, $data, $format = null, $type = 'INSERT' ) { + if ( ! in_array( strtoupper( $type ), array( 'REPLACE', 'INSERT' ) ) ) + return false; + $formats = $format = (array) $format; + $fields = array_keys( $data ); + $formatted_fields = array(); + foreach ( $fields as $field ) { + if ( !empty( $format ) ) + $form = ( $form = array_shift( $formats ) ) ? $form : $format[0]; + elseif ( isset( $this->field_types[$field] ) ) + $form = $this->field_types[$field]; + else + $form = '%s'; + $formatted_fields[] = $form; + } + $sql = "{$type} INTO `$table` (`" . implode( '`,`', $fields ) . "`) VALUES ('" . implode( "','", $formatted_fields ) . "')"; + return $this->query( $this->prepare( $sql, $data ) ); + } + + /** + * Update a row in the table + * + * + * wpdb::update( 'table', array( 'column' => 'foo', 'field' => 'bar' ), array( 'ID' => 1 ) ) + * wpdb::update( 'table', array( 'column' => 'foo', 'field' => 1337 ), array( 'ID' => 1 ), array( '%s', '%d' ), array( '%d' ) ) + * + * + * @since 2.5.0 + * @see wpdb::prepare() + * @see wpdb::$field_types + * @see wp_set_wpdb_vars() + * + * @param string $table table name + * @param array $data Data to update (in column => value pairs). Both $data columns and $data values should be "raw" (neither should be SQL escaped). + * @param array $where A named array of WHERE clauses (in column => value pairs). Multiple clauses will be joined with ANDs. Both $where columns and $where values should be "raw". + * @param array|string $format Optional. An array of formats to be mapped to each of the values in $data. If string, that format will be used for all of the values in $data. + * A format is one of '%d', '%s' (decimal number, string). If omitted, all values in $data will be treated as strings unless otherwise specified in wpdb::$field_types. + * @param array|string $format_where Optional. An array of formats to be mapped to each of the values in $where. If string, that format will be used for all of the items in $where. A format is one of '%d', '%s' (decimal number, string). If omitted, all values in $where will be treated as strings. + * @return int|false The number of rows updated, or false on error. + */ + function update( $table, $data, $where, $format = null, $where_format = null ) { + if ( ! is_array( $data ) || ! is_array( $where ) ) + return false; + + $formats = $format = (array) $format; + $bits = $wheres = array(); + foreach ( (array) array_keys( $data ) as $field ) { + if ( !empty( $format ) ) + $form = ( $form = array_shift( $formats ) ) ? $form : $format[0]; + elseif ( isset($this->field_types[$field]) ) + $form = $this->field_types[$field]; + else + $form = '%s'; + $bits[] = "`$field` = {$form}"; + } + + $where_formats = $where_format = (array) $where_format; + foreach ( (array) array_keys( $where ) as $field ) { + if ( !empty( $where_format ) ) + $form = ( $form = array_shift( $where_formats ) ) ? $form : $where_format[0]; + elseif ( isset( $this->field_types[$field] ) ) + $form = $this->field_types[$field]; + else + $form = '%s'; + $wheres[] = "`$field` = {$form}"; + } + + $sql = "UPDATE `$table` SET " . implode( ', ', $bits ) . ' WHERE ' . implode( ' AND ', $wheres ); + return $this->query( $this->prepare( $sql, array_merge( array_values( $data ), array_values( $where ) ) ) ); + } + + /** + * Retrieve one variable from the database. + * + * Executes a SQL query and returns the value from the SQL result. + * If the SQL result contains more than one column and/or more than one row, this function returns the value in the column and row specified. + * If $query is null, this function returns the value in the specified column and row from the previous SQL result. + * + * @since 0.71 + * + * @param string|null $query Optional. SQL query. Defaults to null, use the result from the previous query. + * @param int $x Optional. Column of value to return. Indexed from 0. + * @param int $y Optional. Row of value to return. Indexed from 0. + * @return string|null Database query result (as string), or null on failure + */ + 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. + * + * Executes a SQL query and returns the row from the SQL result. + * + * @since 0.71 + * + * @param string|null $query SQL query. + * @param string $output Optional. one of ARRAY_A | ARRAY_N | OBJECT constants. Return an associative array (column => value, ...), + * a numerically indexed array (0 => value, ...) or an object ( ->column = value ), respectively. + * @param int $y Optional. Row to return. Indexed from 0. + * @return mixed Database query result in format specifed by $output or null on failure + */ + 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) -- El tipo de salida (output) debe ser uno de estos: OBJECT, ARRAY_A, ARRAY_N'/*/WP_I18N_DB_GETROW_ERROR*/); + } + } + + /** + * Retrieve one column from the database. + * + * Executes a SQL query and returns the column from the SQL result. + * If the SQL result contains more than one column, this function returns the column specified. + * If $query is null, this function returns the specified column from the previous SQL result. + * + * @since 0.71 + * + * @param string|null $query Optional. SQL query. Defaults to previous query. + * @param int $x Optional. Column to return. Indexed from 0. + * @return array Database query result. Array indexed from 0 by SQL result row number. + */ + function get_col( $query = null , $x = 0 ) { + if ( $query ) + $this->query( $query ); + + $new_array = array(); + // Extract the column values + for ( $i = 0, $j = count( $this->last_result ); $i < $j; $i++ ) { + $new_array[$i] = $this->get_var( null, $x, $i ); + } + return $new_array; + } + + /** + * Retrieve an entire SQL result set from the database (i.e., many rows) + * + * Executes a SQL query and returns the entire SQL result. + * + * @since 0.71 + * + * @param string $query SQL query. + * @param string $output Optional. Any of ARRAY_A | ARRAY_N | OBJECT | OBJECT_K constants. With one of the first three, return an array of rows indexed from 0 by SQL result row number. + * Each row is an associative array (column => value, ...), a numerically indexed array (0 => value, ...), or an object. ( ->column = value ), respectively. + * With OBJECT_K, return an associative array of row objects keyed by the value of each row's first column's value. Duplicate keys are discarded. + * @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; + + $new_array = array(); + 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 ) { + foreach( (array) $this->last_result as $row ) { + if ( $output == ARRAY_N ) { + // ...integer-keyed row arrays + $new_array[] = array_values( get_object_vars( $row ) ); + } else { + // ...column name-keyed row arrays + $new_array[] = get_object_vars( $row ); + } + } + } + return $new_array; + } + return null; + } + + /** + * Retrieve column metadata from the last query. + * + * @since 0.71 + * + * @param string $info_type Optional. 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 Optional. 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; + $new_array = array(); + foreach( (array) $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 true + */ + function timer_start() { + $mtime = explode( ' ', microtime() ); + $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 = explode( ' ', microtime() ); + $time_end = $mtime[1] + $mtime[0]; + $time_total = $time_end - $this->time_start; + return $time_total; + } + + /** + * Wraps errors in a nice header and footer and dies. + * + * Will not die if wpdb::$show_errors is true + * + * @since 1.5.0 + * + * @param string $message The Error message + * @param string $error_code Optional. A Computer readable string to identify the error. + * @return false|void + */ + function bail( $message, $error_code = '500' ) { + if ( !$this->show_errors ) { + if ( class_exists( 'WP_Error' ) ) + $this->error = new WP_Error($error_code, $message); + else + $this->error = $message; + return false; + } + wp_die($message); + } + + /** + * Whether MySQL database is at least the required minimum version. + * + * @since 2.5.0 + * @uses $wp_version + * @uses $required_mysql_version + * + * @return WP_Error + */ + function check_database_version() { + global $wp_version, $required_mysql_version; + // Make sure the server has the required MySQL version + if ( version_compare($this->db_version(), $required_mysql_version, '<') ) + return new WP_Error('database_version', sprintf( __( 'ERROR: WordPress %1$s requires MySQL %2$s or higher' ), $wp_version, $required_mysql_version )); + } + + /** + * Whether the database 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 $this->has_cap( 'collation' ); + } + + /** + * Determine if a database supports a particular feature + * + * @since 2.7.0 + * @see wpdb::db_version() + * + * @param string $db_cap the feature + * @return bool + */ + function has_cap( $db_cap ) { + $version = $this->db_version(); + + switch ( strtolower( $db_cap ) ) { + case 'collation' : // @since 2.5.0 + case 'group_concat' : // @since 2.7 + case 'subqueries' : // @since 2.7 + return version_compare( $version, '4.1', '>=' ); + case 'set_charset' : + return version_compare($version, '5.0.7', '>='); + }; + + return false; + } + + /** + * Retrieve the name of the function that called wpdb. + * + * 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() { + $trace = array_reverse( debug_backtrace() ); + $caller = array(); + + foreach ( $trace as $call ) { + if ( isset( $call['class'] ) && __CLASS__ == $call['class'] ) + continue; // Filter out wpdb calls. + $caller[] = isset( $call['class'] ) ? "{$call['class']}->{$call['function']}" : $call['function']; + } + + return join( ', ', $caller ); + } + + /** + * The database version number. + * + * @since 2.7.0 + * + * @return false|string false on failure, version number on success + */ + function db_version() { + return preg_replace( '/[^0-9.].*/', '', mysql_get_server_info( $this->dbh ) ); + } +} + +?> diff --git a/src/wp-includes/wp-diff.php b/src/wp-includes/wp-diff.php new file mode 100644 index 0000000..ed36ee9 --- /dev/null +++ b/src/wp-includes/wp-diff.php @@ -0,0 +1,477 @@ ++{$line}"; + } + + /** + * @ignore + * + * @param string $line HTML-escape the value. + * @return string + */ + function deletedLine( $line ) { + return "-{$line}"; + } + + /** + * @ignore + * + * @param string $line HTML-escape the value. + * @return string + */ + function contextLine( $line ) { + return " {$line}"; + } + + /** + * @ignore + * + * @return string + */ + function emptyLine() { + return ' '; + } + + /** + * @ignore + * @access private + * + * @param array $lines + * @param bool $encode + * @return string + */ + function _added( $lines, $encode = true ) { + $r = ''; + foreach ($lines as $line) { + if ( $encode ) + $line = htmlspecialchars( $line ); + $r .= '' . $this->emptyLine() . $this->addedLine( $line ) . "\n"; + } + return $r; + } + + /** + * @ignore + * @access private + * + * @param array $lines + * @param bool $encode + * @return string + */ + function _deleted( $lines, $encode = true ) { + $r = ''; + foreach ($lines as $line) { + if ( $encode ) + $line = htmlspecialchars( $line ); + $r .= '' . $this->deletedLine( $line ) . $this->emptyLine() . "\n"; + } + return $r; + } + + /** + * @ignore + * @access private + * + * @param array $lines + * @param bool $encode + * @return string + */ + function _context( $lines, $encode = true ) { + $r = ''; + foreach ($lines as $line) { + if ( $encode ) + $line = htmlspecialchars( $line ); + $r .= '' . + $this->contextLine( $line ) . $this->contextLine( $line ) . "\n"; + } + return $r; + } + + /** + * Process changed lines to do word-by-word diffs for extra highlighting. + * + * (TRAC style) sometimes these lines can actually be deleted or added rows. + * We do additional processing to figure that out + * + * @access private + * @since 2.6.0 + * + * @param array $orig + * @param array $final + * @return string + */ + function _changed( $orig, $final ) { + $r = ''; + + // Does the aforementioned additional processing + // *_matches tell what rows are "the same" in orig and final. Those pairs will be diffed to get word changes + // match is numeric: an index in other column + // match is 'X': no match. It is a new row + // *_rows are column vectors for the orig column and the final column. + // row >= 0: an indix of the $orig or $final array + // row < 0: a blank row for that column + list($orig_matches, $final_matches, $orig_rows, $final_rows) = $this->interleave_changed_lines( $orig, $final ); + + + // These will hold the word changes as determined by an inline diff + $orig_diffs = array(); + $final_diffs = array(); + + // Compute word diffs for each matched pair using the inline diff + foreach ( $orig_matches as $o => $f ) { + if ( is_numeric($o) && is_numeric($f) ) { + $text_diff = new Text_Diff( 'auto', array( array($orig[$o]), array($final[$f]) ) ); + $renderer = new $this->inline_diff_renderer; + $diff = $renderer->render( $text_diff ); + + // If they're too different, don't include any or + if ( $diff_count = preg_match_all( '!(.*?|.*?)!', $diff, $diff_matches ) ) { + // length of all text between or + $stripped_matches = strlen(strip_tags( join(' ', $diff_matches[0]) )); + // since we count lengith of text between or (instead of picking just one), + // we double the length of chars not in those tags. + $stripped_diff = strlen(strip_tags( $diff )) * 2 - $stripped_matches; + $diff_ratio = $stripped_matches / $stripped_diff; + if ( $diff_ratio > $this->_diff_threshold ) + continue; // Too different. Don't save diffs. + } + + // Un-inline the diffs by removing del or ins + $orig_diffs[$o] = preg_replace( '|.*?|', '', $diff ); + $final_diffs[$f] = preg_replace( '|.*?|', '', $diff ); + } + } + + foreach ( array_keys($orig_rows) as $row ) { + // Both columns have blanks. Ignore them. + if ( $orig_rows[$row] < 0 && $final_rows[$row] < 0 ) + continue; + + // If we have a word based diff, use it. Otherwise, use the normal line. + if ( isset( $orig_diffs[$orig_rows[$row]] ) ) + $orig_line = $orig_diffs[$orig_rows[$row]]; + elseif ( isset( $orig[$orig_rows[$row]] ) ) + $orig_line = htmlspecialchars($orig[$orig_rows[$row]]); + else + $orig_line = ''; + + if ( isset( $final_diffs[$final_rows[$row]] ) ) + $final_line = $final_diffs[$final_rows[$row]]; + elseif ( isset( $final[$final_rows[$row]] ) ) + $final_line = htmlspecialchars($final[$final_rows[$row]]); + else + $final_line = ''; + + if ( $orig_rows[$row] < 0 ) { // Orig is blank. This is really an added row. + $r .= $this->_added( array($final_line), false ); + } elseif ( $final_rows[$row] < 0 ) { // Final is blank. This is really a deleted row. + $r .= $this->_deleted( array($orig_line), false ); + } else { // A true changed row. + $r .= '' . $this->deletedLine( $orig_line ) . $this->addedLine( $final_line ) . "\n"; + } + } + + return $r; + } + + /** + * Takes changed blocks and matches which rows in orig turned into which rows in final. + * + * Returns + * *_matches ( which rows match with which ) + * *_rows ( order of rows in each column interleaved with blank rows as + * necessary ) + * + * @since 2.6.0 + * + * @param unknown_type $orig + * @param unknown_type $final + * @return unknown + */ + function interleave_changed_lines( $orig, $final ) { + + // Contains all pairwise string comparisons. Keys are such that this need only be a one dimensional array. + $matches = array(); + foreach ( array_keys($orig) as $o ) { + foreach ( array_keys($final) as $f ) { + $matches["$o,$f"] = $this->compute_string_distance( $orig[$o], $final[$f] ); + } + } + asort($matches); // Order by string distance. + + $orig_matches = array(); + $final_matches = array(); + + foreach ( $matches as $keys => $difference ) { + list($o, $f) = explode(',', $keys); + $o = (int) $o; + $f = (int) $f; + + // Already have better matches for these guys + if ( isset($orig_matches[$o]) && isset($final_matches[$f]) ) + continue; + + // First match for these guys. Must be best match + if ( !isset($orig_matches[$o]) && !isset($final_matches[$f]) ) { + $orig_matches[$o] = $f; + $final_matches[$f] = $o; + continue; + } + + // Best match of this final is already taken? Must mean this final is a new row. + if ( isset($orig_matches[$o]) ) + $final_matches[$f] = 'x'; + + // Best match of this orig is already taken? Must mean this orig is a deleted row. + elseif ( isset($final_matches[$f]) ) + $orig_matches[$o] = 'x'; + } + + // We read the text in this order + ksort($orig_matches); + ksort($final_matches); + + + // Stores rows and blanks for each column. + $orig_rows = $orig_rows_copy = array_keys($orig_matches); + $final_rows = array_keys($final_matches); + + // Interleaves rows with blanks to keep matches aligned. + // We may end up with some extraneous blank rows, but we'll just ignore them later. + foreach ( $orig_rows_copy as $orig_row ) { + $final_pos = array_search($orig_matches[$orig_row], $final_rows, true); + $orig_pos = (int) array_search($orig_row, $orig_rows, true); + + if ( false === $final_pos ) { // This orig is paired with a blank final. + array_splice( $final_rows, $orig_pos, 0, -1 ); + } elseif ( $final_pos < $orig_pos ) { // This orig's match is up a ways. Pad final with blank rows. + $diff_pos = $final_pos - $orig_pos; + while ( $diff_pos < 0 ) + array_splice( $final_rows, $orig_pos, 0, $diff_pos++ ); + } elseif ( $final_pos > $orig_pos ) { // This orig's match is down a ways. Pad orig with blank rows. + $diff_pos = $orig_pos - $final_pos; + while ( $diff_pos < 0 ) + array_splice( $orig_rows, $orig_pos, 0, $diff_pos++ ); + } + } + + + // Pad the ends with blank rows if the columns aren't the same length + $diff_count = count($orig_rows) - count($final_rows); + if ( $diff_count < 0 ) { + while ( $diff_count < 0 ) + array_push($orig_rows, $diff_count++); + } elseif ( $diff_count > 0 ) { + $diff_count = -1 * $diff_count; + while ( $diff_count < 0 ) + array_push($final_rows, $diff_count++); + } + + return array($orig_matches, $final_matches, $orig_rows, $final_rows); + +/* + // Debug + echo "\n\n\n\n\n"; + + echo "-- DEBUG Matches: Orig -> Final --"; + + foreach ( $orig_matches as $o => $f ) { + echo "\n\n\n\n\n"; + echo "ORIG: $o, FINAL: $f\n"; + var_dump($orig[$o],$final[$f]); + } + echo "\n\n\n\n\n"; + + echo "-- DEBUG Matches: Final -> Orig --"; + + foreach ( $final_matches as $f => $o ) { + echo "\n\n\n\n\n"; + echo "FINAL: $f, ORIG: $o\n"; + var_dump($final[$f],$orig[$o]); + } + echo "\n\n\n\n\n"; + + echo "-- DEBUG Rows: Orig -- Final --"; + + echo "\n\n\n\n\n"; + foreach ( $orig_rows as $row => $o ) { + if ( $o < 0 ) + $o = 'X'; + $f = $final_rows[$row]; + if ( $f < 0 ) + $f = 'X'; + echo "$o -- $f\n"; + } + echo "\n\n\n\n\n"; + + echo "-- END DEBUG --"; + + echo "\n\n\n\n\n"; + + return array($orig_matches, $final_matches, $orig_rows, $final_rows); +*/ + } + + /** + * Computes a number that is intended to reflect the "distance" between two strings. + * + * @since 2.6.0 + * + * @param string $string1 + * @param string $string2 + * @return int + */ + function compute_string_distance( $string1, $string2 ) { + // Vectors containing character frequency for all chars in each string + $chars1 = count_chars($string1); + $chars2 = count_chars($string2); + + // L1-norm of difference vector. + $difference = array_sum( array_map( array(&$this, 'difference'), $chars1, $chars2 ) ); + + // $string1 has zero length? Odd. Give huge penalty by not dividing. + if ( !$string1 ) + return $difference; + + // Return distance per charcter (of string1) + return $difference / strlen($string1); + } + + /** + * @ignore + * @since 2.6.0 + * + * @param int $a + * @param int $b + * @return int + */ + function difference( $a, $b ) { + return abs( $a - $b ); + } + +} + +/** + * Better word splitting than the PEAR package provides. + * + * @since 2.6.0 + * @uses Text_Diff_Renderer_inline Extends + */ +class WP_Text_Diff_Renderer_inline extends Text_Diff_Renderer_inline { + + /** + * @ignore + * @since 2.6.0 + * + * @param string $string + * @param string $newlineEscape + * @return string + */ + function _splitOnWords($string, $newlineEscape = "\n") { + $string = str_replace("\0", '', $string); + $words = preg_split( '/([^\w])/u', $string, -1, PREG_SPLIT_DELIM_CAPTURE ); + $words = str_replace( "\n", $newlineEscape, $words ); + return $words; + } + +} + +?> diff --git a/src/wp-links-opml.php b/src/wp-links-opml.php new file mode 100644 index 0000000..e30869b --- /dev/null +++ b/src/wp-links-opml.php @@ -0,0 +1,59 @@ +\n"; +?> + + + <?php printf( __('Links for %s'), esc_attr(get_bloginfo('name', 'display')) ); ?> + GMT + + + + 'link_category', 'hierarchical' => 0)); +else + $cats = get_categories(array('taxonomy' => 'link_category', 'hierarchical' => 0, 'include' => $link_cat)); + +foreach ( (array)$cats as $cat ) : + $catname = apply_filters('link_category', $cat->name); + +?> + + $cat->term_id)); + foreach ( (array)$bookmarks as $bookmark ) : + $title = apply_filters('link_title', $bookmark->link_name); +?> + + + + + + \ No newline at end of file diff --git a/src/wp-load.php b/src/wp-load.php new file mode 100644 index 0000000..c6d1ead --- /dev/null +++ b/src/wp-load.php @@ -0,0 +1,60 @@ +wp-config.php. Este archivo es necesario para empezar. ¿Necesitas ayuda? La encontrarás aquí (en inglés). Puedes crear un archivo wp-config.php a través de la web, pero esto no funciona en algunos servidores. Lo más seguro es crear el archivo manualmente.

          Crear un archivo de configuración'/*/WP_I18N_NO_CONFIG*/, $path), /*WP_I18N_ERROR_TITLE*/'WordPress › Error'/*/WP_I18N_ERROR_TITLE*/, array('text_direction' => $text_direction)); + +} + +?> \ No newline at end of file diff --git a/src/wp-login.php b/src/wp-login.php new file mode 100644 index 0000000..ffa00ab --- /dev/null +++ b/src/wp-login.php @@ -0,0 +1,698 @@ + element. + * @param string $message Optional. Message to display in header. + * @param WP_Error $wp_error Optional. WordPress Error Object + */ +function login_header($title = 'Log In', $message = '', $wp_error = '') { + global $error, $is_iphone, $interim_login, $current_site; + + // Don't index any of these forms + add_filter( 'pre_option_blog_public', '__return_zero' ); + add_action( 'login_head', 'noindex' ); + + if ( empty($wp_error) ) + $wp_error = new WP_Error(); + + // Shake it! + $shake_error_codes = array( 'empty_password', 'empty_email', 'invalid_email', 'invalidcombo', 'empty_username', 'invalid_username', 'incorrect_password' ); + $shake_error_codes = apply_filters( 'shake_error_codes', $shake_error_codes ); + + if ( $shake_error_codes && $wp_error->get_error_code() && in_array( $wp_error->get_error_code(), $shake_error_codes ) ) + add_action( 'login_head', 'wp_shake_js', 12 ); + + ?> + +> + + + <?php bloginfo('name'); ?> › <?php echo $title; ?> + + + + + + + + + +

          + +

          +add('error', $error); + unset($error); + } + + if ( $wp_error->get_error_code() ) { + $errors = ''; + $messages = ''; + foreach ( $wp_error->get_error_codes() as $code ) { + $severity = $wp_error->get_error_data($code); + foreach ( $wp_error->get_error_messages($code) as $error ) { + if ( 'message' == $severity ) + $messages .= ' ' . $error . "
          \n"; + else + $errors .= ' ' . $error . "
          \n"; + } + } + if ( !empty($errors) ) + echo '
          ' . apply_filters('login_errors', $errors) . "
          \n"; + if ( !empty($messages) ) + echo '

          ' . apply_filters('login_messages', $messages) . "

          \n"; + } +} // End of login_header() + +/** + * Outputs the footer for the login page. + * + * @param string $input_id Which input to auto-focus + */ +function login_footer($input_id = '') { + ?> +

          +
          + + + + + + + + + + +add('empty_username', __('ERROR: Enter a username or e-mail address.')); + + if ( strpos($_POST['user_login'], '@') ) { + $user_data = get_user_by_email(trim($_POST['user_login'])); + if ( empty($user_data) ) + $errors->add('invalid_email', __('ERROR: There is no user registered with that email address.')); + } else { + $login = trim($_POST['user_login']); + $user_data = get_userdatabylogin($login); + } + + do_action('lostpassword_post'); + + if ( $errors->get_error_code() ) + return $errors; + + if ( !$user_data ) { + $errors->add('invalidcombo', __('ERROR: Invalid username or e-mail.')); + return $errors; + } + + // redefining user_login ensures we return the right case in the email + $user_login = $user_data->user_login; + $user_email = $user_data->user_email; + + do_action('retreive_password', $user_login); // Misspelled and deprecated + do_action('retrieve_password', $user_login); + + $allow = apply_filters('allow_password_reset', true, $user_data->ID); + + if ( ! $allow ) + return new WP_Error('no_password_reset', __('Password reset is not allowed for this user')); + else if ( is_wp_error($allow) ) + return $allow; + + $key = $wpdb->get_var($wpdb->prepare("SELECT user_activation_key FROM $wpdb->users WHERE user_login = %s", $user_login)); + if ( empty($key) ) { + // Generate something random for a key... + $key = wp_generate_password(20, false); + do_action('retrieve_password_key', $user_login, $key); + // Now insert the new md5 key into the db + $wpdb->update($wpdb->users, array('user_activation_key' => $key), array('user_login' => $user_login)); + } + $message = __('Someone requested that the password be reset for the following account:') . "\r\n\r\n"; + $message .= network_site_url() . "\r\n\r\n"; + $message .= sprintf(__('Username: %s'), $user_login) . "\r\n\r\n"; + $message .= __('If this was a mistake, just ignore this email and nothing will happen.') . "\r\n\r\n"; + $message .= __('To reset your password, visit the following address:') . "\r\n\r\n"; + $message .= '<' . network_site_url("wp-login.php?action=rp&key=$key&login=" . rawurlencode($user_login), 'login') . ">\r\n"; + + if ( is_multisite() ) + $blogname = $GLOBALS['current_site']->site_name; + else + // The blogname option is escaped with esc_html on the way into the database in sanitize_option + // we want to reverse this for the plain text arena of emails. + $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES); + + $title = sprintf( __('[%s] Password Reset'), $blogname ); + + $title = apply_filters('retrieve_password_title', $title); + $message = apply_filters('retrieve_password_message', $message, $key); + + if ( $message && !wp_mail($user_email, $title, $message) ) + wp_die( __('The e-mail could not be sent.') . "
          \n" . __('Possible reason: your host may have disabled the mail() function...') ); + + return true; +} + +/** + * Retrieves a user row based on password reset key and login + * + * @uses $wpdb WordPress Database object + * + * @param string $key Hash to validate sending user's password + * @param string $login The user login + * + * @return object|WP_Error + */ +function check_password_reset_key($key, $login) { + global $wpdb; + + $key = preg_replace('/[^a-z0-9]/i', '', $key); + + if ( empty( $key ) || !is_string( $key ) ) + return new WP_Error('invalid_key', __('Invalid key')); + + if ( empty($login) || !is_string($login) ) + return new WP_Error('invalid_key', __('Invalid key')); + + $user = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->users WHERE user_activation_key = %s AND user_login = %s", $key, $login)); + + if ( empty( $user ) ) + return new WP_Error('invalid_key', __('Invalid key')); + + return $user; +} + +/** + * Handles resetting the user's password. + * + * @uses $wpdb WordPress Database object + * + * @param string $key Hash to validate sending user's password + */ +function reset_password($user, $new_pass) { + do_action('password_reset', $user, $new_pass); + + wp_set_password($new_pass, $user->ID); + + wp_password_change_notification($user); +} + +/** + * Handles registering a new user. + * + * @param string $user_login User's username for logging in + * @param string $user_email User's email address to send password and add + * @return int|WP_Error Either user's ID or error on failure. + */ +function register_new_user( $user_login, $user_email ) { + $errors = new WP_Error(); + + $sanitized_user_login = sanitize_user( $user_login ); + $user_email = apply_filters( 'user_registration_email', $user_email ); + + // Check the username + if ( $sanitized_user_login == '' ) { + $errors->add( 'empty_username', __( 'ERROR: Please enter a username.' ) ); + } elseif ( ! validate_username( $user_login ) ) { + $errors->add( 'invalid_username', __( 'ERROR: This username is invalid because it uses illegal characters. Please enter a valid username.' ) ); + $sanitized_user_login = ''; + } elseif ( username_exists( $sanitized_user_login ) ) { + $errors->add( 'username_exists', __( 'ERROR: This username is already registered, please choose another one.' ) ); + } + + // Check the e-mail address + if ( $user_email == '' ) { + $errors->add( 'empty_email', __( 'ERROR: Please type your e-mail address.' ) ); + } elseif ( ! is_email( $user_email ) ) { + $errors->add( 'invalid_email', __( 'ERROR: The email address isn’t correct.' ) ); + $user_email = ''; + } elseif ( email_exists( $user_email ) ) { + $errors->add( 'email_exists', __( 'ERROR: This email is already registered, please choose another one.' ) ); + } + + do_action( 'register_post', $sanitized_user_login, $user_email, $errors ); + + $errors = apply_filters( 'registration_errors', $errors, $sanitized_user_login, $user_email ); + + if ( $errors->get_error_code() ) + return $errors; + + $user_pass = wp_generate_password( 12, false); + $user_id = wp_create_user( $sanitized_user_login, $user_pass, $user_email ); + if ( ! $user_id ) { + $errors->add( 'registerfail', sprintf( __( 'ERROR: Couldn’t register you... please contact the webmaster !' ), get_option( 'admin_email' ) ) ); + return $errors; + } + + update_user_option( $user_id, 'default_password_nag', true, true ); //Set up the Password change nag. + + wp_new_user_notification( $user_id, $user_pass ); + + return $user_id; +} + +// +// Main +// + +$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : 'login'; +$errors = new WP_Error(); + +if ( isset($_GET['key']) ) + $action = 'resetpass'; + +// validate action so as to default to the login screen +if ( !in_array($action, array('logout', 'lostpassword', 'retrievepassword', 'resetpass', 'rp', 'register', 'login'), true) && false === has_filter('login_form_' . $action) ) + $action = 'login'; + +nocache_headers(); + +header('Content-Type: '.get_bloginfo('html_type').'; charset='.get_bloginfo('charset')); + +if ( defined('RELOCATE') ) { // Move flag is set + if ( isset( $_SERVER['PATH_INFO'] ) && ($_SERVER['PATH_INFO'] != $_SERVER['PHP_SELF']) ) + $_SERVER['PHP_SELF'] = str_replace( $_SERVER['PATH_INFO'], '', $_SERVER['PHP_SELF'] ); + + $schema = is_ssl() ? 'https://' : 'http://'; + if ( dirname($schema . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']) != get_option('siteurl') ) + update_option('siteurl', dirname($schema . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']) ); +} + +//Set a cookie now to see if they are supported by the browser. +setcookie(TEST_COOKIE, 'WP Cookie check', 0, COOKIEPATH, COOKIE_DOMAIN); +if ( SITECOOKIEPATH != COOKIEPATH ) + setcookie(TEST_COOKIE, 'WP Cookie check', 0, SITECOOKIEPATH, COOKIE_DOMAIN); + +// allow plugins to override the default actions, and to add extra actions if they want +do_action( 'login_init' ); +do_action( 'login_form_' . $action ); + +$http_post = ('POST' == $_SERVER['REQUEST_METHOD']); +switch ($action) { + +case 'logout' : + check_admin_referer('log-out'); + wp_logout(); + + $redirect_to = !empty( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : 'wp-login.php?loggedout=true'; + wp_safe_redirect( $redirect_to ); + exit(); + +break; + +case 'lostpassword' : +case 'retrievepassword' : + + if ( $http_post ) { + $errors = retrieve_password(); + if ( !is_wp_error($errors) ) { + $redirect_to = !empty( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : 'wp-login.php?checkemail=confirm'; + wp_safe_redirect( $redirect_to ); + exit(); + } + } + + if ( isset($_GET['error']) && 'invalidkey' == $_GET['error'] ) $errors->add('invalidkey', __('Sorry, that key does not appear to be valid.')); + $redirect_to = apply_filters( 'lostpassword_redirect', !empty( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : '' ); + + do_action('lost_password'); + login_header(__('Lost Password'), '

          ' . __('Please enter your username or email address. You will receive a link to create a new password via email.') . '

          ', $errors); + + $user_login = isset($_POST['user_login']) ? stripslashes($_POST['user_login']) : ''; + +?> + +
          +

          + +

          + + +

          +
          + + + +' . __('Your password has been reset.') . ' ' . __('Log in') . '

          '); + login_footer(); + exit; + } + + wp_enqueue_script('utils'); + wp_enqueue_script('user-profile'); + + login_header(__('Reset Password'), '

          ' . __('Enter your new password below.') . '

          ', $errors ); + +?> +
          + + +

          + +

          +

          + +

          + +
          +

          + +
          +

          +
          + + + +' . __('Register For This Site') . '

          ', $errors); +?> + +
          +

          + +

          +

          + +

          + +

          +
          + +

          +
          + + + +ID) ) { + $secure_cookie = true; + force_ssl_admin(true); + } + } + } + + if ( isset( $_REQUEST['redirect_to'] ) ) { + $redirect_to = $_REQUEST['redirect_to']; + // Redirect to https if user wants ssl + if ( $secure_cookie && false !== strpos($redirect_to, 'wp-admin') ) + $redirect_to = preg_replace('|^http://|', 'https://', $redirect_to); + } else { + $redirect_to = admin_url(); + } + + $reauth = empty($_REQUEST['reauth']) ? false : true; + + // If the user was redirected to a secure login form from a non-secure admin page, and secure login is required but secure admin is not, then don't use a secure + // cookie and redirect back to the referring non-secure admin page. This allows logins to always be POSTed over SSL while allowing the user to choose visiting + // the admin via http or https. + if ( !$secure_cookie && is_ssl() && force_ssl_login() && !force_ssl_admin() && ( 0 !== strpos($redirect_to, 'https') ) && ( 0 === strpos($redirect_to, 'http') ) ) + $secure_cookie = false; + + $user = wp_signon('', $secure_cookie); + + $redirect_to = apply_filters('login_redirect', $redirect_to, isset( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : '', $user); + + if ( !is_wp_error($user) && !$reauth ) { + if ( $interim_login ) { + $message = '

          ' . __('You have logged in successfully.') . '

          '; + login_header( '', $message ); ?> + +

          +

          +
          +id) && !is_super_admin( $user->id ) ) + $redirect_to = user_admin_url(); + elseif ( is_multisite() && !$user->has_cap('read') ) + $redirect_to = get_dashboard_url( $user->id ); + elseif ( !$user->has_cap('edit_posts') ) + $redirect_to = admin_url('profile.php'); + } + wp_safe_redirect($redirect_to); + exit(); + } + + $errors = $user; + // Clear errors if loggedout is set. + if ( !empty($_GET['loggedout']) || $reauth ) + $errors = new WP_Error(); + + // If cookies are disabled we can't log in even with a valid user+pass + if ( isset($_POST['testcookie']) && empty($_COOKIE[TEST_COOKIE]) ) + $errors->add('test_cookie', __("ERROR: Cookies are blocked or not supported by your browser. You must enable cookies to use WordPress.")); + + // Some parts of this script use the main login form to display a message + if ( isset($_GET['loggedout']) && TRUE == $_GET['loggedout'] ) + $errors->add('loggedout', __('You are now logged out.'), 'message'); + elseif ( isset($_GET['registration']) && 'disabled' == $_GET['registration'] ) + $errors->add('registerdisabled', __('User registration is currently not allowed.')); + elseif ( isset($_GET['checkemail']) && 'confirm' == $_GET['checkemail'] ) + $errors->add('confirm', __('Check your e-mail for the confirmation link.'), 'message'); + elseif ( isset($_GET['checkemail']) && 'newpass' == $_GET['checkemail'] ) + $errors->add('newpass', __('Check your e-mail for your new password.'), 'message'); + elseif ( isset($_GET['checkemail']) && 'registered' == $_GET['checkemail'] ) + $errors->add('registered', __('Registration complete. Please check your e-mail.'), 'message'); + elseif ( $interim_login ) + $errors->add('expired', __('Your session has expired. Please log-in again.'), 'message'); + + // Clear any stale cookies. + if ( $reauth ) + wp_clear_auth_cookie(); + + login_header(__('Log In'), '', $errors); + + if ( isset($_POST['log']) ) + $user_login = ( 'incorrect_password' == $errors->get_error_code() || 'empty_password' == $errors->get_error_code() ) ? esc_attr(stripslashes($_POST['log'])) : ''; + $rememberme = ! empty( $_POST['rememberme'] ); +?> + +
          +

          + +

          +

          + +

          + +

          +

          + + + + + + + +

          +
          + + + + + + + + diff --git a/src/wp-mail.php b/src/wp-mail.php new file mode 100644 index 0000000..69b5415 --- /dev/null +++ b/src/wp-mail.php @@ -0,0 +1,236 @@ + Writing + * + * @package WordPress + */ + +/** Make sure that the WordPress bootstrap has run before continuing. */ +require(dirname(__FILE__) . '/wp-load.php'); + +if ( ! apply_filters( 'enable_post_by_email_configuration', true ) ) + wp_die( __( 'This action has been disabled by the administrator.' ) ); + +/** Allow a plugin to do a complete takeover of Post by Email **/ +do_action('wp-mail.php'); + +/** Get the POP3 class with which to access the mailbox. */ +require_once( ABSPATH . WPINC . '/class-pop3.php' ); + +/** Only check at this interval for new messages. */ +if ( !defined('WP_MAIL_INTERVAL') ) + define('WP_MAIL_INTERVAL', 300); // 5 minutes + +$last_checked = get_transient('mailserver_last_checked'); + +if ( $last_checked ) + wp_die(__('Slow down cowboy, no need to check for new mails so often!')); + +set_transient('mailserver_last_checked', true, WP_MAIL_INTERVAL); + +$time_difference = get_option('gmt_offset') * 3600; + +$phone_delim = '::'; + +$pop3 = new POP3(); + +if ( !$pop3->connect( get_option('mailserver_url'), get_option('mailserver_port') ) || !$pop3->user( get_option('mailserver_login') ) ) + wp_die( esc_html( $pop3->ERROR ) ); + +$count = $pop3->pass( get_option('mailserver_pass') ); + +if( false === $count ) + wp_die( esc_html( $pop3->ERROR ) ); + +if( 0 === $count ) { + $pop3->quit(); + wp_die( __('There doesn’t seem to be any new mail.') ); +} + +for ( $i = 1; $i <= $count; $i++ ) { + + $message = $pop3->get($i); + + $bodysignal = false; + $boundary = ''; + $charset = ''; + $content = ''; + $content_type = ''; + $content_transfer_encoding = ''; + $post_author = 1; + $author_found = false; + $dmonths = array('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'); + foreach ($message as $line) { + // body signal + if ( strlen($line) < 3 ) + $bodysignal = true; + if ( $bodysignal ) { + $content .= $line; + } else { + if ( preg_match('/Content-Type: /i', $line) ) { + $content_type = trim($line); + $content_type = substr($content_type, 14, strlen($content_type) - 14); + $content_type = explode(';', $content_type); + if ( ! empty( $content_type[1] ) ) { + $charset = explode('=', $content_type[1]); + $charset = ( ! empty( $charset[1] ) ) ? trim($charset[1]) : ''; + } + $content_type = $content_type[0]; + } + if ( preg_match('/Content-Transfer-Encoding: /i', $line) ) { + $content_transfer_encoding = trim($line); + $content_transfer_encoding = substr($content_transfer_encoding, 27, strlen($content_transfer_encoding) - 27); + $content_transfer_encoding = explode(';', $content_transfer_encoding); + $content_transfer_encoding = $content_transfer_encoding[0]; + } + if ( ( $content_type == 'multipart/alternative' ) && ( false !== strpos($line, 'boundary="') ) && ( '' == $boundary ) ) { + $boundary = trim($line); + $boundary = explode('"', $boundary); + $boundary = $boundary[1]; + } + if (preg_match('/Subject: /i', $line)) { + $subject = trim($line); + $subject = substr($subject, 9, strlen($subject) - 9); + // Captures any text in the subject before $phone_delim as the subject + if ( function_exists('iconv_mime_decode') ) { + $subject = iconv_mime_decode($subject, 2, get_option('blog_charset')); + } else { + $subject = wp_iso_descrambler($subject); + } + $subject = explode($phone_delim, $subject); + $subject = $subject[0]; + } + + // Set the author using the email address (From or Reply-To, the last used) + // otherwise use the site admin + if ( preg_match('/(From|Reply-To): /', $line) ) { + if ( preg_match('|[a-z0-9_.-]+@[a-z0-9_.-]+(?!.*<)|i', $line, $matches) ) + $author = $matches[0]; + else + $author = trim($line); + $author = sanitize_email($author); + if ( is_email($author) ) { + echo '

          ' . sprintf(__('Author is %s'), $author) . '

          '; + $userdata = get_user_by_email($author); + if ( empty($userdata) ) { + $author_found = false; + } else { + $post_author = $userdata->ID; + $author_found = true; + } + } else { + $author_found = false; + } + } + + if (preg_match('/Date: /i', $line)) { // of the form '20 Mar 2002 20:32:37' + $ddate = trim($line); + $ddate = str_replace('Date: ', '', $ddate); + if (strpos($ddate, ',')) { + $ddate = trim(substr($ddate, strpos($ddate, ',') + 1, strlen($ddate))); + } + $date_arr = explode(' ', $ddate); + $date_time = explode(':', $date_arr[3]); + + $ddate_H = $date_time[0]; + $ddate_i = $date_time[1]; + $ddate_s = $date_time[2]; + + $ddate_m = $date_arr[1]; + $ddate_d = $date_arr[0]; + $ddate_Y = $date_arr[2]; + for ( $j = 0; $j < 12; $j++ ) { + if ( $ddate_m == $dmonths[$j] ) { + $ddate_m = $j+1; + } + } + + $time_zn = intval($date_arr[4]) * 36; + $ddate_U = gmmktime($ddate_H, $ddate_i, $ddate_s, $ddate_m, $ddate_d, $ddate_Y); + $ddate_U = $ddate_U - $time_zn; + $post_date = gmdate('Y-m-d H:i:s', $ddate_U + $time_difference); + $post_date_gmt = gmdate('Y-m-d H:i:s', $ddate_U); + } + } + } + + // Set $post_status based on $author_found and on author's publish_posts capability + if ( $author_found ) { + $user = new WP_User($post_author); + $post_status = ( $user->has_cap('publish_posts') ) ? 'publish' : 'pending'; + } else { + // Author not found in DB, set status to pending. Author already set to admin. + $post_status = 'pending'; + } + + $subject = trim($subject); + + if ( $content_type == 'multipart/alternative' ) { + $content = explode('--'.$boundary, $content); + $content = $content[2]; + // match case-insensitive content-transfer-encoding + if ( preg_match( '/Content-Transfer-Encoding: quoted-printable/i', $content, $delim) ) { + $content = explode($delim[0], $content); + $content = $content[1]; + } + $content = strip_tags($content, '


          '); + } + $content = trim($content); + + //Give Post-By-Email extending plugins full access to the content + //Either the raw content or the content of the last quoted-printable section + $content = apply_filters('wp_mail_original_content', $content); + + if ( false !== stripos($content_transfer_encoding, "quoted-printable") ) { + $content = quoted_printable_decode($content); + } + + if ( function_exists('iconv') && ! empty( $charset ) ) { + $content = iconv($charset, get_option('blog_charset'), $content); + } + + // Captures any text in the body after $phone_delim as the body + $content = explode($phone_delim, $content); + $content = empty( $content[1] ) ? $content[0] : $content[1]; + + $content = trim($content); + + $post_content = apply_filters('phone_content', $content); + + $post_title = xmlrpc_getposttitle($content); + + if ($post_title == '') $post_title = $subject; + + $post_category = array(get_option('default_email_category')); + + $post_data = compact('post_content','post_title','post_date','post_date_gmt','post_author','post_category', 'post_status'); + $post_data = add_magic_quotes($post_data); + + $post_ID = wp_insert_post($post_data); + if ( is_wp_error( $post_ID ) ) + echo "\n" . $post_ID->get_error_message(); + + // We couldn't post, for whatever reason. Better move forward to the next email. + if ( empty( $post_ID ) ) + continue; + + do_action('publish_phone', $post_ID); + + echo "\n

          " . sprintf(__('Author: %s'), esc_html($post_author)) . '

          '; + echo "\n

          " . sprintf(__('Posted title: %s'), esc_html($post_title)) . '

          '; + + if(!$pop3->delete($i)) { + echo '

          ' . sprintf(__('Oops: %s'), esc_html($pop3->ERROR)) . '

          '; + $pop3->reset(); + exit; + } else { + echo '

          ' . sprintf(__('Mission complete. Message %s deleted.'), $i) . '

          '; + } + +} + +$pop3->quit(); + +?> diff --git a/src/wp-pass.php b/src/wp-pass.php new file mode 100644 index 0000000..c0c0c42 --- /dev/null +++ b/src/wp-pass.php @@ -0,0 +1,20 @@ + diff --git a/src/wp-rdf.php b/src/wp-rdf.php new file mode 100644 index 0000000..cc94ad0 --- /dev/null +++ b/src/wp-rdf.php @@ -0,0 +1,12 @@ + diff --git a/src/wp-register.php b/src/wp-register.php new file mode 100644 index 0000000..0b1a769 --- /dev/null +++ b/src/wp-register.php @@ -0,0 +1,15 @@ + diff --git a/src/wp-rss.php b/src/wp-rss.php new file mode 100644 index 0000000..af2427a --- /dev/null +++ b/src/wp-rss.php @@ -0,0 +1,12 @@ + diff --git a/src/wp-rss2.php b/src/wp-rss2.php new file mode 100644 index 0000000..de75c23 --- /dev/null +++ b/src/wp-rss2.php @@ -0,0 +1,12 @@ + diff --git a/src/wp-settings.php b/src/wp-settings.php new file mode 100644 index 0000000..9b89b57 --- /dev/null +++ b/src/wp-settings.php @@ -0,0 +1,324 @@ +init(); + +/** + * Most of WP is loaded at this stage, and the user is authenticated. WP continues + * to load on the init hook that follows (e.g. widgets), and many plugins instantiate + * themselves on it for all sorts of reasons (e.g. they need a user, a taxonomy, etc.). + * + * If you wish to plug an action once WP is loaded, use the wp_loaded hook below. + */ +do_action( 'init' ); + +// Check site status +if ( is_multisite() ) { + if ( true !== ( $file = ms_site_check() ) ) { + require( $file ); + die(); + } + unset($file); +} + +/** + * This hook is fired once WP, all plugins, and the theme are fully loaded and instantiated. + * + * AJAX requests should use wp-admin/admin-ajax.php. admin-ajax.php can handle requests for + * users not logged in. + * + * @link http://codex.wordpress.org/AJAX_in_Plugins + * + * @since 3.0.0 + */ +do_action('wp_loaded'); +?> diff --git a/src/wp-signup.php b/src/wp-signup.php new file mode 100644 index 0000000..cce2083 --- /dev/null +++ b/src/wp-signup.php @@ -0,0 +1,455 @@ +\n"; +} + +if ( !is_multisite() ) { + wp_redirect( site_url('wp-login.php?action=register') ); + die(); +} + +if ( !is_main_site() ) { + wp_redirect( network_home_url( 'wp-signup.php' ) ); + die(); +} + +// Fix for page title +$wp_query->is_404 = false; + +function wpmu_signup_stylesheet() { + ?> + + +
          +
          +' . __('Site Name:') . ''; + else + echo ''; + + if ( $errmsg = $errors->get_error_message('blogname') ) { ?> +

          + ' . $current_site->domain . $current_site->path . '
          '; + else + echo '.' . ( $site_domain = preg_replace( '|^www\.|', '', $current_site->domain ) ) . '
          '; + + if ( !is_user_logged_in() ) { + if ( !is_subdomain_install() ) + $site = $current_site->domain . $current_site->path . __( 'sitename' ); + else + $site = __( 'domain' ) . '.' . $site_domain . $current_site->path; + echo '

          (' . sprintf( __('Your address will be %s.'), $site ) . ') ' . __( 'Must be at least 4 characters, letters and numbers only. It cannot be changed, so choose carefully!' ) . '

          '; + } + + // Blog Title + ?> + + get_error_message('blog_title') ) { ?> +

          + '; + ?> + +
          +

          + + +
          + + +

          +
          + + ' . __('Username:') . ''; + if ( $errmsg = $errors->get_error_message('user_name') ) { + echo '

          '.$errmsg.'

          '; + } + echo '
          '; + _e( '(Must be at least 4 characters, letters and numbers only.)' ); + ?> + + + get_error_message('user_email') ) { ?> +

          + +
          + get_error_message('generic') ) { + echo '

          ' . $errmsg . '

          '; + } + do_action( 'signup_extra_fields', $errors ); +} + +function validate_user_form() { + return wpmu_validate_user_signup($_POST['user_name'], $_POST['user_email']); +} + +function signup_another_blog($blogname = '', $blog_title = '', $errors = '') { + global $current_site; + $current_user = wp_get_current_user(); + + if ( ! is_wp_error($errors) ) { + $errors = new WP_Error(); + } + + // allow definition of default variables + $filtered_results = apply_filters('signup_another_blog_init', array('blogname' => $blogname, 'blog_title' => $blog_title, 'errors' => $errors )); + $blogname = $filtered_results['blogname']; + $blog_title = $filtered_results['blog_title']; + $errors = $filtered_results['errors']; + + echo '

          ' . sprintf( __( 'Get another %s site in seconds' ), $current_site->site_name ) . '

          '; + + if ( $errors->get_error_code() ) { + echo '

          ' . __( 'There was a problem, please correct the form below and try again.' ) . '

          '; + } + ?> +

          add another site to your account. There is no limit to the number of sites you can have, so create to your heart’s content, but write responsibly!' ), $current_user->display_name ) ?>

          + + ID); + if ( !empty($blogs) ) { ?> + +

          + + + +

          +
          + + + +

          +
          + get_error_code() ) { + signup_another_blog($blogname, $blog_title, $errors); + return false; + } + + $public = (int) $_POST['blog_public']; + $meta = apply_filters( 'signup_create_blog_meta', array( 'lang_id' => 1, 'public' => $public ) ); // deprecated + $meta = apply_filters( 'add_signup_meta', $meta ); + + wpmu_create_blog( $domain, $path, $blog_title, $current_user->id, $meta, $wpdb->siteid ); + confirm_another_blog_signup($domain, $path, $blog_title, $current_user->user_login, $current_user->user_email, $meta); + return true; +} + +function confirm_another_blog_signup($domain, $path, $blog_title, $user_name, $user_email = '', $meta = '') { + ?> +

          {$blog_title}" ) ?>

          +

          + http://%2$s is your new site. Log in as “%4$s” using your existing password.' ), $domain.$path, $domain.$path, "http://" . $domain.$path . "wp-login.php", $user_name ) ?> +

          + $user_name, 'user_email' => $user_email, 'errors' => $errors )); + $user_name = $filtered_results['user_name']; + $user_email = $filtered_results['user_email']; + $errors = $filtered_results['errors']; + + ?> + +

          site_name ) ?>

          +
          + + + + +

          + + + + + + /> + +
          + /> + + +

          + +

          +
          + get_error_code() ) { + signup_user($user_name, $user_email, $errors); + return false; + } + + if ( 'blog' == $_POST['signup_for'] ) { + signup_blog($user_name, $user_email); + return false; + } + + wpmu_signup_user($user_name, $user_email, apply_filters( 'add_signup_meta', array() ) ); + + confirm_user_signup($user_name, $user_email); + return true; +} + +function confirm_user_signup($user_name, $user_email) { + ?> +

          +

          you must activate it.' ) ?>

          +

          %1$s and click the link given.' ), $user_email) ?>

          +

          + $user_name, 'user_email' => $user_email, 'blogname' => $blogname, 'blog_title' => $blog_title, 'errors' => $errors )); + $user_name = $filtered_results['user_name']; + $user_email = $filtered_results['user_email']; + $blogname = $filtered_results['blogname']; + $blog_title = $filtered_results['blog_title']; + $errors = $filtered_results['errors']; + + if ( empty($blogname) ) + $blogname = $user_name; + ?> +
          + + + + + +

          +
          + get_error_code() ) { + signup_user($user_name, $user_email, $errors); + return false; + } + + $result = wpmu_validate_blog_signup($_POST['blogname'], $_POST['blog_title']); + extract($result); + + if ( $errors->get_error_code() ) { + signup_blog($user_name, $user_email, $blogname, $blog_title, $errors); + return false; + } + + $public = (int) $_POST['blog_public']; + $meta = array ('lang_id' => 1, 'public' => $public); + $meta = apply_filters( 'add_signup_meta', $meta ); + + wpmu_signup_blog($domain, $path, $blog_title, $user_name, $user_email, $meta); + confirm_blog_signup($domain, $path, $blog_title, $user_name, $user_email, $meta); + return true; +} + +function confirm_blog_signup($domain, $path, $blog_title, $user_name = '', $user_email = '', $meta) { + ?> +

          {$blog_title}" ) ?>

          + +

          you must activate it.' ) ?>

          +

          %s and click the link given.' ), $user_email) ?>

          +

          +

          +

          + +

            +
          • +
          • +
          • +
          +

          + ' . sprintf( __( 'Greetings Site Administrator! You are currently allowing “%s” registrations. To change or disable registration go to your Options page.' ), $i18n_signup[$active_signup], esc_url( network_admin_url( 'settings.php' ) ) ) . '
          '; + +$newblogname = isset($_GET['new']) ? strtolower(preg_replace('/^-|-$|[^-a-zA-Z0-9]/', '', $_GET['new'])) : null; + +$current_user = wp_get_current_user(); +if ( $active_signup == 'none' ) { + _e( 'Registration has been disabled.' ); +} elseif ( $active_signup == 'blog' && !is_user_logged_in() ) { + if ( is_ssl() ) + $proto = 'https://'; + else + $proto = 'http://'; + $login_url = site_url( 'wp-login.php?redirect_to=' . urlencode($proto . $_SERVER['HTTP_HOST'] . '/wp-signup.php' )); + echo sprintf( __( 'You must first log in, and then you can create a new site.' ), $login_url ); +} else { + $stage = isset( $_POST['stage'] ) ? $_POST['stage'] : 'default'; + switch ( $stage ) { + case 'validate-user-signup' : + if ( $active_signup == 'all' || $_POST[ 'signup_for' ] == 'blog' && $active_signup == 'blog' || $_POST[ 'signup_for' ] == 'user' && $active_signup == 'user' ) + validate_user_signup(); + else + _e( 'User registration has been disabled.' ); + break; + case 'validate-blog-signup': + if ( $active_signup == 'all' || $active_signup == 'blog' ) + validate_blog_signup(); + else + _e( 'Site registration has been disabled.' ); + break; + case 'gimmeanotherblog': + validate_another_blog_signup(); + break; + case 'default': + default : + $user_email = isset( $_POST[ 'user_email' ] ) ? $_POST[ 'user_email' ] : ''; + do_action( 'preprocess_signup_form' ); // populate the form from invites, elsewhere? + if ( is_user_logged_in() && ( $active_signup == 'all' || $active_signup == 'blog' ) ) + signup_another_blog($newblogname); + elseif ( is_user_logged_in() == false && ( $active_signup == 'all' || $active_signup == 'user' ) ) + signup_user( $newblogname, $user_email ); + elseif ( is_user_logged_in() == false && ( $active_signup == 'blog' ) ) + _e( 'Sorry, new registrations are not allowed at this time.' ); + else + _e( 'You are logged in already. No need to register again!' ); + + if ( $newblogname ) { + $newblog = get_blogaddress_by_name( $newblogname ); + + if ( $active_signup == 'blog' || $active_signup == 'all' ) + printf( __( '

          The site you were looking for, %s does not exist, but you can create it now!

          ' ), $newblog ); + else + printf( __( '

          The site you were looking for, %s, does not exist.

          ' ), $newblog ); + } + break; + } +} +?> +
          +
          + + + diff --git a/src/wp-trackback.php b/src/wp-trackback.php new file mode 100644 index 0000000..737fbce --- /dev/null +++ b/src/wp-trackback.php @@ -0,0 +1,111 @@ + '1' ) ); +} + +/** + * trackback_response() - Respond with error or success XML message + * + * @param int|bool $error Whether there was an error + * @param string $error_message Error message if an error occurred + */ +function trackback_response($error = 0, $error_message = '') { + header('Content-Type: text/xml; charset=' . get_option('blog_charset') ); + if ($error) { + echo '\n"; + echo "\n"; + echo "1\n"; + echo "$error_message\n"; + echo ""; + die(); + } else { + echo '\n"; + echo "\n"; + echo "0\n"; + echo ""; + } +} + +// trackback is done by a POST +$request_array = 'HTTP_POST_VARS'; + +if ( !isset($_GET['tb_id']) || !$_GET['tb_id'] ) { + $tb_id = explode('/', $_SERVER['REQUEST_URI']); + $tb_id = intval( $tb_id[ count($tb_id) - 1 ] ); +} + +$tb_url = isset($_POST['url']) ? $_POST['url'] : ''; +$charset = isset($_POST['charset']) ? $_POST['charset'] : ''; + +// These three are stripslashed here so that they can be properly escaped after mb_convert_encoding() +$title = isset($_POST['title']) ? stripslashes($_POST['title']) : ''; +$excerpt = isset($_POST['excerpt']) ? stripslashes($_POST['excerpt']) : ''; +$blog_name = isset($_POST['blog_name']) ? stripslashes($_POST['blog_name']) : ''; + +if ($charset) + $charset = str_replace( array(',', ' '), '', strtoupper( trim($charset) ) ); +else + $charset = 'ASCII, UTF-8, ISO-8859-1, JIS, EUC-JP, SJIS'; + +// No valid uses for UTF-7 +if ( false !== strpos($charset, 'UTF-7') ) + die; + +if ( function_exists('mb_convert_encoding') ) { // For international trackbacks + $title = mb_convert_encoding($title, get_option('blog_charset'), $charset); + $excerpt = mb_convert_encoding($excerpt, get_option('blog_charset'), $charset); + $blog_name = mb_convert_encoding($blog_name, get_option('blog_charset'), $charset); +} + +// Now that mb_convert_encoding() has been given a swing, we need to escape these three +$title = $wpdb->escape($title); +$excerpt = $wpdb->escape($excerpt); +$blog_name = $wpdb->escape($blog_name); + +if ( is_single() || is_page() ) + $tb_id = $posts[0]->ID; + +if ( !isset($tb_id) || !intval( $tb_id ) ) + trackback_response(1, 'I really need an ID for this to work.'); + +if (empty($title) && empty($tb_url) && empty($blog_name)) { + // If it doesn't look like a trackback at all... + wp_redirect(get_permalink($tb_id)); + exit; +} + +if ( !empty($tb_url) && !empty($title) ) { + header('Content-Type: text/xml; charset=' . get_option('blog_charset') ); + + if ( !pings_open($tb_id) ) + trackback_response(1, 'Sorry, trackbacks are closed for this item.'); + + $title = wp_html_excerpt( $title, 250 ).'...'; + $excerpt = wp_html_excerpt( $excerpt, 252 ).'...'; + + $comment_post_ID = (int) $tb_id; + $comment_author = $blog_name; + $comment_author_email = ''; + $comment_author_url = $tb_url; + $comment_content = "$title\n\n$excerpt"; + $comment_type = 'trackback'; + + $dupe = $wpdb->get_results( $wpdb->prepare("SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_author_url = %s", $comment_post_ID, $comment_author_url) ); + if ( $dupe ) + trackback_response(1, 'We already have a ping from that URL for this post.'); + + $commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_content', 'comment_type'); + + wp_new_comment($commentdata); + + do_action('trackback_post', $wpdb->insert_id); + trackback_response(0); +} +?> \ No newline at end of file diff --git a/src/xmlrpc.php b/src/xmlrpc.php new file mode 100644 index 0000000..ff7bfcd --- /dev/null +++ b/src/xmlrpc.php @@ -0,0 +1,110 @@ + +'; ?> + + + WordPress + http://wordpress.org/ + + + + + + + + + + +serve_request(); +?> \ No newline at end of file